Changeset 9ee2ce3 for thirdparty/SZ/sz/src/sz.c
- Timestamp:
- 09/28/18 16:32:55 (6 years ago)
- Branches:
- master, pympi
- Children:
- e6aa0eb
- Parents:
- abca157
- git-author:
- Hal Finkel <hfinkel@…> (09/28/18 16:32:55)
- git-committer:
- Hal Finkel <hfinkel@…> (09/28/18 16:32:55)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
thirdparty/SZ/sz/src/sz.c
r2c47b73 r9ee2ce3 23 23 #include "Huffman.h" 24 24 #include "conf.h" 25 #include "utility.h" 25 26 //#include "CurveFillingCompressStorage.h" 26 27 … … 36 37 37 38 sz_exedata *exe_params = NULL; 39 40 int sz_with_regression = SZ_WITH_LINEAR_REGRESSION; //SZ_NO_REGRESSION 38 41 39 42 /*following global variables are desgined for time-series based compression*/ … … 70 73 int SZ_Init_Params(sz_params *params) 71 74 { 72 int x = 1; 73 char *y = (char*)&x; 74 int endianType = BIG_ENDIAN_SYSTEM; 75 if(*y==1) endianType = LITTLE_ENDIAN_SYSTEM; 76 77 sysEndianType = endianType; 78 exe_params->SZ_SIZE_TYPE = sizeof(size_t); 79 80 // set default values 81 if(params->max_quant_intervals > 0) 75 SZ_Init(NULL); 76 77 if(params->losslessCompressor!=GZIP_COMPRESSOR && params->losslessCompressor!=ZSTD_COMPRESSOR) 78 params->losslessCompressor = ZSTD_COMPRESSOR; 79 80 if(params->max_quant_intervals > 0) 82 81 params->maxRangeRadius = params->max_quant_intervals/2; 83 else 84 params->max_quant_intervals = params->maxRangeRadius*2; 85 86 exe_params->intvCapacity = params->maxRangeRadius*2; 87 exe_params->intvRadius = params->maxRangeRadius; 88 89 if(params->quantization_intervals>0) 90 { 91 updateQuantizationInfo(params->quantization_intervals); 92 exe_params->optQuantMode = 0; 93 } 94 else 95 exe_params->optQuantMode = 1; 96 82 83 memcpy(confparams_cpr, params, sizeof(sz_params)); 97 84 98 85 if(params->quantization_intervals%2!=0) … … 101 88 return SZ_NSCS; 102 89 } 103 104 confparams_cpr = (sz_params*)malloc(sizeof(sz_params));105 memcpy(confparams_cpr, params, sizeof(sz_params));106 90 107 91 return SZ_SCES; … … 536 520 //confparams_dec->szMode = (sameRByte & 0x06)>>1; 537 521 isLossless = (sameRByte & 0x10)>>4; 522 523 int isRandomAccess = (sameRByte >> 7) & 0x01; 524 525 if(exe_params==NULL) 526 { 527 exe_params = (sz_exedata *)malloc(sizeof(struct sz_exedata)); 528 memset(exe_params, 0, sizeof(struct sz_exedata)); 529 } 538 530 exe_params->SZ_SIZE_TYPE = ((sameRByte & 0x40)>>6)==1?8:4; 539 531 … … 548 540 dataSeriesLength = bytesToSize(&(bytes[index]));// 4 or 8 549 541 index += exe_params->SZ_SIZE_TYPE; 550 index += 4; //max_quant_intervals551 542 //index += 4; //max_quant_intervals 543 552 544 sz_metadata* metadata = (sz_metadata*)malloc(sizeof(struct sz_metadata)); 553 545 … … 565 557 if(isConstant==0 && isLossless==0) 566 558 { 567 int radExpoL = 0, segmentL = 0, pwrErrBoundBytesL = 0; 568 if(metadata->conf_params->errorBoundMode >= PW_REL) 559 if(isRandomAccess==1) 569 560 { 570 radExpoL = 1; 571 segmentL = exe_params->SZ_SIZE_TYPE; 572 pwrErrBoundBytesL = 4; 561 unsigned char* raBytes = &(bytes[index]); 562 defactoNBBins = bytesToInt_bigEndian(raBytes + sizeof(int) + sizeof(double)); 573 563 } 574 575 int offset_typearray = 3 + 1 + MetaDataByteLength + exe_params->SZ_SIZE_TYPE + 4 + radExpoL + segmentL + pwrErrBoundBytesL + 4 + 4 + 1 + 8 576 + exe_params->SZ_SIZE_TYPE + exe_params->SZ_SIZE_TYPE + exe_params->SZ_SIZE_TYPE; 577 size_t nodeCount = bytesToInt_bigEndian(bytes+offset_typearray); 578 defactoNBBins = (nodeCount+1)/2; 579 } 564 else 565 { 566 int radExpoL = 0, segmentL = 0, pwrErrBoundBytesL = 0; 567 if(metadata->conf_params->errorBoundMode >= PW_REL) 568 { 569 radExpoL = 1; 570 segmentL = exe_params->SZ_SIZE_TYPE; 571 pwrErrBoundBytesL = 4; 572 } 573 574 int offset_typearray = 3 + 1 + MetaDataByteLength + exe_params->SZ_SIZE_TYPE + 4 + radExpoL + segmentL + pwrErrBoundBytesL + 4 + (4 + params->dataType*4) + 1 + 8 575 + exe_params->SZ_SIZE_TYPE + exe_params->SZ_SIZE_TYPE + exe_params->SZ_SIZE_TYPE + 4; 576 defactoNBBins = bytesToInt_bigEndian(bytes+offset_typearray); 577 } 578 579 } 580 580 581 581 metadata->defactoNBBins = defactoNBBins; … … 778 778 } 779 779 return totalSize; 780 }781 782 int isZlibFormat(unsigned char magic1, unsigned char magic2)783 {784 if(magic1==104&&magic2==5) //DC+BS785 return 1;786 if(magic1==104&&magic2==129) //DC+DC787 return 1;788 if(magic1==104&&magic2==222) //DC+BC789 return 1;790 if(magic1==120&&magic2==1) //BC+BS791 return 1;792 if(magic1==120&&magic2==156) //BC+DC793 return 1;794 if(magic1==120&&magic2==218) //BC+BS795 return 1;796 return 0;797 780 } 798 781
Note: See TracChangeset
for help on using the changeset viewer.