[2c47b73] | 1 | /** |
---|
| 2 | * @file sz_uint32.c |
---|
| 3 | * @author Sheng Di |
---|
| 4 | * @date Aug, 2017 |
---|
| 5 | * @brief sz_uint32, Compression and Decompression functions |
---|
| 6 | * (C) 2017 by Mathematics and Computer Science (MCS), Argonne National Laboratory. |
---|
| 7 | * See COPYRIGHT in top-level directory. |
---|
| 8 | */ |
---|
| 9 | |
---|
| 10 | |
---|
| 11 | #include <stdio.h> |
---|
| 12 | #include <stdlib.h> |
---|
| 13 | #include <string.h> |
---|
| 14 | #include <unistd.h> |
---|
| 15 | #include <math.h> |
---|
| 16 | #include "sz.h" |
---|
| 17 | #include "CompressElement.h" |
---|
| 18 | #include "DynamicByteArray.h" |
---|
| 19 | #include "DynamicIntArray.h" |
---|
| 20 | #include "zlib.h" |
---|
| 21 | #include "rw.h" |
---|
| 22 | #include "TightDataPointStorageI.h" |
---|
| 23 | #include "sz_uint32.h" |
---|
| 24 | |
---|
| 25 | unsigned int optimize_intervals_uint32_1D(uint32_t *oriData, size_t dataLength, double realPrecision) |
---|
| 26 | { |
---|
| 27 | size_t i = 0, radiusIndex; |
---|
| 28 | int64_t pred_value = 0, pred_err; |
---|
| 29 | size_t *intervals = (size_t*)malloc(confparams_cpr->maxRangeRadius*sizeof(size_t)); |
---|
| 30 | memset(intervals, 0, confparams_cpr->maxRangeRadius*sizeof(size_t)); |
---|
| 31 | size_t totalSampleSize = dataLength/confparams_cpr->sampleDistance; |
---|
| 32 | for(i=2;i<dataLength;i++) |
---|
| 33 | { |
---|
| 34 | if(i%confparams_cpr->sampleDistance==0) |
---|
| 35 | { |
---|
| 36 | //pred_value = 2*oriData[i-1] - oriData[i-2]; |
---|
| 37 | pred_value = oriData[i-1]; |
---|
| 38 | pred_err = llabs(pred_value - oriData[i]); |
---|
| 39 | radiusIndex = (uint64_t)((pred_err/realPrecision+1)/2); |
---|
| 40 | if(radiusIndex>=confparams_cpr->maxRangeRadius) |
---|
| 41 | radiusIndex = confparams_cpr->maxRangeRadius - 1; |
---|
| 42 | intervals[radiusIndex]++; |
---|
| 43 | } |
---|
| 44 | } |
---|
| 45 | //compute the appropriate number |
---|
| 46 | size_t targetCount = totalSampleSize*confparams_cpr->predThreshold; |
---|
| 47 | size_t sum = 0; |
---|
| 48 | for(i=0;i<confparams_cpr->maxRangeRadius;i++) |
---|
| 49 | { |
---|
| 50 | sum += intervals[i]; |
---|
| 51 | if(sum>targetCount) |
---|
| 52 | break; |
---|
| 53 | } |
---|
| 54 | if(i>=confparams_cpr->maxRangeRadius) |
---|
| 55 | i = confparams_cpr->maxRangeRadius-1; |
---|
| 56 | |
---|
| 57 | unsigned int accIntervals = 2*(i+1); |
---|
| 58 | unsigned int powerOf2 = roundUpToPowerOf2(accIntervals); |
---|
| 59 | |
---|
| 60 | if(powerOf2<32) |
---|
| 61 | powerOf2 = 32; |
---|
| 62 | |
---|
| 63 | free(intervals); |
---|
| 64 | //printf("accIntervals=%d, powerOf2=%d\n", accIntervals, powerOf2); |
---|
| 65 | return powerOf2; |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | unsigned int optimize_intervals_uint32_2D(uint32_t *oriData, size_t r1, size_t r2, double realPrecision) |
---|
| 69 | { |
---|
| 70 | size_t i,j, index; |
---|
| 71 | size_t radiusIndex; |
---|
| 72 | int64_t pred_value = 0, pred_err; |
---|
| 73 | size_t *intervals = (size_t*)malloc(confparams_cpr->maxRangeRadius*sizeof(size_t)); |
---|
| 74 | memset(intervals, 0, confparams_cpr->maxRangeRadius*sizeof(size_t)); |
---|
| 75 | size_t totalSampleSize = r1*r2/confparams_cpr->sampleDistance; |
---|
| 76 | for(i=1;i<r1;i++) |
---|
| 77 | { |
---|
| 78 | for(j=1;j<r2;j++) |
---|
| 79 | { |
---|
| 80 | if((i+j)%confparams_cpr->sampleDistance==0) |
---|
| 81 | { |
---|
| 82 | index = i*r2+j; |
---|
| 83 | pred_value = oriData[index-1] + oriData[index-r2] - oriData[index-r2-1]; |
---|
| 84 | pred_err = llabs(pred_value - oriData[index]); |
---|
| 85 | radiusIndex = (uint64_t)((pred_err/realPrecision+1)/2); |
---|
| 86 | if(radiusIndex>=confparams_cpr->maxRangeRadius) |
---|
| 87 | radiusIndex = confparams_cpr->maxRangeRadius - 1; |
---|
| 88 | intervals[radiusIndex]++; |
---|
| 89 | } |
---|
| 90 | } |
---|
| 91 | } |
---|
| 92 | //compute the appropriate number |
---|
| 93 | size_t targetCount = totalSampleSize*confparams_cpr->predThreshold; |
---|
| 94 | size_t sum = 0; |
---|
| 95 | for(i=0;i<confparams_cpr->maxRangeRadius;i++) |
---|
| 96 | { |
---|
| 97 | sum += intervals[i]; |
---|
| 98 | if(sum>targetCount) |
---|
| 99 | break; |
---|
| 100 | } |
---|
| 101 | if(i>=confparams_cpr->maxRangeRadius) |
---|
| 102 | i = confparams_cpr->maxRangeRadius-1; |
---|
| 103 | unsigned int accIntervals = 2*(i+1); |
---|
| 104 | unsigned int powerOf2 = roundUpToPowerOf2(accIntervals); |
---|
| 105 | |
---|
| 106 | if(powerOf2<32) |
---|
| 107 | powerOf2 = 32; |
---|
| 108 | |
---|
| 109 | free(intervals); |
---|
| 110 | //printf("confparams_cpr->maxRangeRadius = %d, accIntervals=%d, powerOf2=%d\n", confparams_cpr->maxRangeRadius, accIntervals, powerOf2); |
---|
| 111 | return powerOf2; |
---|
| 112 | } |
---|
| 113 | |
---|
| 114 | unsigned int optimize_intervals_uint32_3D(uint32_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision) |
---|
| 115 | { |
---|
| 116 | size_t i,j,k, index; |
---|
| 117 | size_t radiusIndex; |
---|
| 118 | size_t r23=r2*r3; |
---|
| 119 | int64_t pred_value = 0, pred_err; |
---|
| 120 | size_t *intervals = (size_t*)malloc(confparams_cpr->maxRangeRadius*sizeof(size_t)); |
---|
| 121 | memset(intervals, 0, confparams_cpr->maxRangeRadius*sizeof(size_t)); |
---|
| 122 | size_t totalSampleSize = (r1-1)*(r2-1)*(r3-1)/confparams_cpr->sampleDistance; |
---|
| 123 | for(i=1;i<r1;i++) |
---|
| 124 | { |
---|
| 125 | for(j=1;j<r2;j++) |
---|
| 126 | { |
---|
| 127 | for(k=1;k<r3;k++) |
---|
| 128 | { |
---|
| 129 | if((i+j+k)%confparams_cpr->sampleDistance==0) |
---|
| 130 | { |
---|
| 131 | index = i*r23+j*r3+k; |
---|
| 132 | pred_value = oriData[index-1] + oriData[index-r3] + oriData[index-r23] |
---|
| 133 | - oriData[index-1-r23] - oriData[index-r3-1] - oriData[index-r3-r23] + oriData[index-r3-r23-1]; |
---|
| 134 | pred_err = llabs(pred_value - oriData[index]); |
---|
| 135 | radiusIndex = (pred_err/realPrecision+1)/2; |
---|
| 136 | if(radiusIndex>=confparams_cpr->maxRangeRadius) |
---|
| 137 | { |
---|
| 138 | radiusIndex = confparams_cpr->maxRangeRadius - 1; |
---|
| 139 | //printf("radiusIndex=%d\n", radiusIndex); |
---|
| 140 | } |
---|
| 141 | intervals[radiusIndex]++; |
---|
| 142 | } |
---|
| 143 | } |
---|
| 144 | } |
---|
| 145 | } |
---|
| 146 | //compute the appropriate number |
---|
| 147 | size_t targetCount = totalSampleSize*confparams_cpr->predThreshold; |
---|
| 148 | size_t sum = 0; |
---|
| 149 | for(i=0;i<confparams_cpr->maxRangeRadius;i++) |
---|
| 150 | { |
---|
| 151 | sum += intervals[i]; |
---|
| 152 | if(sum>targetCount) |
---|
| 153 | break; |
---|
| 154 | } |
---|
| 155 | if(i>=confparams_cpr->maxRangeRadius) |
---|
| 156 | i = confparams_cpr->maxRangeRadius-1; |
---|
| 157 | unsigned int accIntervals = 2*(i+1); |
---|
| 158 | unsigned int powerOf2 = roundUpToPowerOf2(accIntervals); |
---|
| 159 | |
---|
| 160 | if(powerOf2<32) |
---|
| 161 | powerOf2 = 32; |
---|
| 162 | |
---|
| 163 | free(intervals); |
---|
| 164 | //printf("targetCount=%d, sum=%d, totalSampleSize=%d, ratio=%f, accIntervals=%d, powerOf2=%d\n", targetCount, sum, totalSampleSize, (double)sum/(double)totalSampleSize, accIntervals, powerOf2); |
---|
| 165 | return powerOf2; |
---|
| 166 | } |
---|
| 167 | |
---|
| 168 | |
---|
| 169 | unsigned int optimize_intervals_uint32_4D(uint32_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision) |
---|
| 170 | { |
---|
| 171 | size_t i,j,k,l, index; |
---|
| 172 | size_t radiusIndex; |
---|
| 173 | size_t r234=r2*r3*r4; |
---|
| 174 | size_t r34=r3*r4; |
---|
| 175 | int64_t pred_value = 0, pred_err; |
---|
| 176 | size_t *intervals = (size_t*)malloc(confparams_cpr->maxRangeRadius*sizeof(size_t)); |
---|
| 177 | memset(intervals, 0, confparams_cpr->maxRangeRadius*sizeof(size_t)); |
---|
| 178 | size_t totalSampleSize = (r1-1)*(r2-1)*(r3-1)*(r4-1)/confparams_cpr->sampleDistance; |
---|
| 179 | for(i=1;i<r1;i++) |
---|
| 180 | { |
---|
| 181 | for(j=1;j<r2;j++) |
---|
| 182 | { |
---|
| 183 | for(k=1;k<r3;k++) |
---|
| 184 | { |
---|
| 185 | for (l=1;l<r4;l++) |
---|
| 186 | { |
---|
| 187 | if((i+j+k+l)%confparams_cpr->sampleDistance==0) |
---|
| 188 | { |
---|
| 189 | index = i*r234+j*r34+k*r4+l; |
---|
| 190 | pred_value = oriData[index-1] + oriData[index-r3] + oriData[index-r34] |
---|
| 191 | - oriData[index-1-r34] - oriData[index-r4-1] - oriData[index-r4-r34] + oriData[index-r4-r34-1]; |
---|
| 192 | pred_err = llabs(pred_value - oriData[index]); |
---|
| 193 | radiusIndex = (uint64_t)((pred_err/realPrecision+1)/2); |
---|
| 194 | if(radiusIndex>=confparams_cpr->maxRangeRadius) |
---|
| 195 | radiusIndex = confparams_cpr->maxRangeRadius - 1; |
---|
| 196 | intervals[radiusIndex]++; |
---|
| 197 | } |
---|
| 198 | } |
---|
| 199 | } |
---|
| 200 | } |
---|
| 201 | } |
---|
| 202 | //compute the appropriate number |
---|
| 203 | size_t targetCount = totalSampleSize*confparams_cpr->predThreshold; |
---|
| 204 | size_t sum = 0; |
---|
| 205 | for(i=0;i<confparams_cpr->maxRangeRadius;i++) |
---|
| 206 | { |
---|
| 207 | sum += intervals[i]; |
---|
| 208 | if(sum>targetCount) |
---|
| 209 | break; |
---|
| 210 | } |
---|
| 211 | if(i>=confparams_cpr->maxRangeRadius) |
---|
| 212 | i = confparams_cpr->maxRangeRadius-1; |
---|
| 213 | |
---|
| 214 | unsigned int accIntervals = 2*(i+1); |
---|
| 215 | unsigned int powerOf2 = roundUpToPowerOf2(accIntervals); |
---|
| 216 | |
---|
| 217 | if(powerOf2<32) |
---|
| 218 | powerOf2 = 32; |
---|
| 219 | |
---|
| 220 | free(intervals); |
---|
| 221 | return powerOf2; |
---|
| 222 | } |
---|
| 223 | |
---|
| 224 | TightDataPointStorageI* SZ_compress_uint32_1D_MDQ(uint32_t *oriData, size_t dataLength, double realPrecision, int64_t valueRangeSize, int64_t minValue) |
---|
| 225 | { |
---|
| 226 | unsigned char bytes[8] = {0,0,0,0,0,0,0,0}; |
---|
| 227 | int byteSize = computeByteSizePerIntValue(valueRangeSize); |
---|
| 228 | unsigned int quantization_intervals; |
---|
| 229 | if(exe_params->optQuantMode==1) |
---|
| 230 | quantization_intervals = optimize_intervals_uint32_1D(oriData, dataLength, realPrecision); |
---|
| 231 | else |
---|
| 232 | quantization_intervals = exe_params->intvCapacity; |
---|
| 233 | updateQuantizationInfo(quantization_intervals); |
---|
| 234 | size_t i; |
---|
| 235 | |
---|
| 236 | int* type = (int*) malloc(dataLength*sizeof(int)); |
---|
| 237 | |
---|
| 238 | uint32_t* spaceFillingValue = oriData; // |
---|
| 239 | |
---|
| 240 | DynamicByteArray *exactDataByteArray; |
---|
| 241 | new_DBA(&exactDataByteArray, DynArrayInitLen); |
---|
| 242 | |
---|
| 243 | int64_t last3CmprsData[3] = {0,0,0}; |
---|
| 244 | |
---|
| 245 | //add the first data |
---|
| 246 | type[0] = 0; |
---|
| 247 | compressUInt32Value(spaceFillingValue[0], minValue, byteSize, bytes); |
---|
| 248 | memcpyDBA_Data(exactDataByteArray, bytes, byteSize); |
---|
| 249 | listAdd_int(last3CmprsData, spaceFillingValue[0]); |
---|
| 250 | |
---|
| 251 | type[1] = 0; |
---|
| 252 | compressUInt32Value(spaceFillingValue[1], minValue, byteSize, bytes); |
---|
| 253 | memcpyDBA_Data(exactDataByteArray, bytes, byteSize); |
---|
| 254 | listAdd_int(last3CmprsData, spaceFillingValue[1]); |
---|
| 255 | //printf("%.30G\n",last3CmprsData[0]); |
---|
| 256 | |
---|
| 257 | int state; |
---|
| 258 | double checkRadius = (exe_params->intvCapacity-1)*realPrecision; |
---|
| 259 | int64_t curData; |
---|
| 260 | uint32_t pred, predAbsErr; |
---|
| 261 | double interval = 2*realPrecision; |
---|
| 262 | |
---|
| 263 | for(i=2;i<dataLength;i++) |
---|
| 264 | { |
---|
| 265 | // if(i==2869438) |
---|
| 266 | // printf("i=%d\n", i); |
---|
| 267 | curData = spaceFillingValue[i]; |
---|
| 268 | //pred = 2*last3CmprsData[0] - last3CmprsData[1]; |
---|
| 269 | pred = last3CmprsData[0]; |
---|
| 270 | predAbsErr = llabs(curData - pred); |
---|
| 271 | if(predAbsErr<=checkRadius) |
---|
| 272 | { |
---|
| 273 | state = (predAbsErr/realPrecision+1)/2; |
---|
| 274 | if(curData>=pred) |
---|
| 275 | { |
---|
| 276 | type[i] = exe_params->intvRadius+state; |
---|
| 277 | pred = pred + state*interval; |
---|
| 278 | } |
---|
| 279 | else //curData<pred |
---|
| 280 | { |
---|
| 281 | type[i] = exe_params->intvRadius-state; |
---|
| 282 | pred = pred - state*interval; |
---|
| 283 | } |
---|
| 284 | /* if(type[i]==0) |
---|
| 285 | printf("err:type[%d]=0\n", i);*/ |
---|
| 286 | listAdd_int(last3CmprsData, pred); |
---|
| 287 | continue; |
---|
| 288 | } |
---|
| 289 | |
---|
| 290 | //unpredictable data processing |
---|
| 291 | type[i] = 0; |
---|
| 292 | compressUInt32Value(curData, minValue, byteSize, bytes); |
---|
| 293 | memcpyDBA_Data(exactDataByteArray, bytes, byteSize); |
---|
| 294 | listAdd_int(last3CmprsData, curData); |
---|
| 295 | }//end of for |
---|
| 296 | |
---|
| 297 | size_t exactDataNum = exactDataByteArray->size / byteSize; |
---|
| 298 | |
---|
| 299 | TightDataPointStorageI* tdps; |
---|
| 300 | |
---|
| 301 | new_TightDataPointStorageI(&tdps, dataLength, exactDataNum, byteSize, |
---|
| 302 | type, exactDataByteArray->array, exactDataByteArray->size, |
---|
| 303 | realPrecision, minValue, quantization_intervals, SZ_UINT32); |
---|
| 304 | |
---|
| 305 | //sdi:Debug |
---|
| 306 | /* int sum =0; |
---|
| 307 | for(i=0;i<dataLength;i++) |
---|
| 308 | if(type[i]==0) sum++; |
---|
| 309 | printf("opt_quantizations=%d, exactDataNum=%d, sum=%d\n",quantization_intervals, exactDataNum, sum);*/ |
---|
| 310 | |
---|
| 311 | //free memory |
---|
| 312 | free(type); |
---|
| 313 | free(exactDataByteArray); //exactDataByteArray->array has been released in free_TightDataPointStorageF(tdps); |
---|
| 314 | |
---|
| 315 | return tdps; |
---|
| 316 | } |
---|
| 317 | |
---|
| 318 | void SZ_compress_args_uint32_StoreOriData(uint32_t* oriData, size_t dataLength, TightDataPointStorageI* tdps, |
---|
| 319 | unsigned char** newByteData, size_t *outSize) |
---|
| 320 | { |
---|
| 321 | int intSize=sizeof(uint32_t); |
---|
| 322 | size_t k = 0, i; |
---|
| 323 | tdps->isLossless = 1; |
---|
| 324 | size_t totalByteLength = 3 + MetaDataByteLength + exe_params->SZ_SIZE_TYPE + 1 + intSize*dataLength; |
---|
| 325 | *newByteData = (unsigned char*)malloc(totalByteLength); |
---|
| 326 | |
---|
| 327 | unsigned char dsLengthBytes[8]; |
---|
| 328 | for (i = 0; i < 3; i++)//3 |
---|
| 329 | (*newByteData)[k++] = versionNumber[i]; |
---|
| 330 | |
---|
| 331 | if(exe_params->SZ_SIZE_TYPE==4)//1 |
---|
| 332 | (*newByteData)[k++] = 16; //00010000 |
---|
| 333 | else |
---|
| 334 | (*newByteData)[k++] = 80; //01010000: 01000000 indicates the SZ_SIZE_TYPE=8 |
---|
| 335 | |
---|
| 336 | convertSZParamsToBytes(confparams_cpr, &((*newByteData)[k])); |
---|
| 337 | k = k + MetaDataByteLength; |
---|
| 338 | |
---|
| 339 | sizeToBytes(dsLengthBytes,dataLength); //SZ_SIZE_TYPE: 4 or 8 |
---|
| 340 | for (i = 0; i < exe_params->SZ_SIZE_TYPE; i++) |
---|
| 341 | (*newByteData)[k++] = dsLengthBytes[i]; |
---|
| 342 | |
---|
| 343 | if(sysEndianType==BIG_ENDIAN_SYSTEM) |
---|
| 344 | memcpy((*newByteData)+4+MetaDataByteLength+exe_params->SZ_SIZE_TYPE, oriData, dataLength*intSize); |
---|
| 345 | else |
---|
| 346 | { |
---|
| 347 | unsigned char* p = (*newByteData)+4+MetaDataByteLength+exe_params->SZ_SIZE_TYPE; |
---|
| 348 | for(i=0;i<dataLength;i++,p+=intSize) |
---|
| 349 | int32ToBytes_bigEndian(p, oriData[i]); |
---|
| 350 | } |
---|
| 351 | *outSize = totalByteLength; |
---|
| 352 | } |
---|
| 353 | |
---|
| 354 | void SZ_compress_args_uint32_NoCkRngeNoGzip_1D(unsigned char** newByteData, uint32_t *oriData, |
---|
| 355 | size_t dataLength, double realPrecision, size_t *outSize, int64_t valueRangeSize, uint32_t minValue) |
---|
| 356 | { |
---|
| 357 | TightDataPointStorageI* tdps = SZ_compress_uint32_1D_MDQ(oriData, dataLength, realPrecision, valueRangeSize, minValue); |
---|
| 358 | //TODO: return bytes.... |
---|
| 359 | convertTDPStoFlatBytes_int(tdps, newByteData, outSize); |
---|
| 360 | if(*outSize > dataLength*sizeof(uint32_t)) |
---|
| 361 | SZ_compress_args_uint32_StoreOriData(oriData, dataLength+2, tdps, newByteData, outSize); |
---|
| 362 | free_TightDataPointStorageI(tdps); |
---|
| 363 | } |
---|
| 364 | |
---|
| 365 | TightDataPointStorageI* SZ_compress_uint32_2D_MDQ(uint32_t *oriData, size_t r1, size_t r2, double realPrecision, int64_t valueRangeSize, int64_t minValue) |
---|
| 366 | { |
---|
| 367 | unsigned char bytes[8] = {0,0,0,0,0,0,0,0}; |
---|
| 368 | int byteSize = computeByteSizePerIntValue(valueRangeSize); |
---|
| 369 | |
---|
| 370 | unsigned int quantization_intervals; |
---|
| 371 | if(exe_params->optQuantMode==1) |
---|
| 372 | { |
---|
| 373 | quantization_intervals = optimize_intervals_uint32_2D(oriData, r1, r2, realPrecision); |
---|
| 374 | updateQuantizationInfo(quantization_intervals); |
---|
| 375 | } |
---|
| 376 | else |
---|
| 377 | quantization_intervals = exe_params->intvCapacity; |
---|
| 378 | size_t i,j; |
---|
| 379 | int64_t pred1D, pred2D, curValue; |
---|
| 380 | int64_t diff = 0.0; |
---|
| 381 | double itvNum = 0; |
---|
| 382 | uint32_t *P0, *P1; |
---|
| 383 | |
---|
| 384 | size_t dataLength = r1*r2; |
---|
| 385 | |
---|
| 386 | P0 = (uint32_t*)malloc(r2*sizeof(uint32_t)); |
---|
| 387 | memset(P0, 0, r2*sizeof(uint32_t)); |
---|
| 388 | P1 = (uint32_t*)malloc(r2*sizeof(uint32_t)); |
---|
| 389 | memset(P1, 0, r2*sizeof(uint32_t)); |
---|
| 390 | |
---|
| 391 | int* type = (int*) malloc(dataLength*sizeof(int)); |
---|
| 392 | //type[dataLength]=0; |
---|
| 393 | |
---|
| 394 | uint32_t* spaceFillingValue = oriData; // |
---|
| 395 | |
---|
| 396 | DynamicByteArray *exactDataByteArray; |
---|
| 397 | new_DBA(&exactDataByteArray, DynArrayInitLen); |
---|
| 398 | |
---|
| 399 | type[0] = 0; |
---|
| 400 | curValue = P1[0] = spaceFillingValue[0]; |
---|
| 401 | compressUInt32Value(curValue, minValue, byteSize, bytes); |
---|
| 402 | memcpyDBA_Data(exactDataByteArray, bytes, byteSize); |
---|
| 403 | |
---|
| 404 | /* Process Row-0 data 1*/ |
---|
| 405 | pred1D = P1[0]; |
---|
| 406 | diff = spaceFillingValue[1] - pred1D; |
---|
| 407 | |
---|
| 408 | itvNum = llabs(diff)/realPrecision + 1; |
---|
| 409 | |
---|
| 410 | if (itvNum < exe_params->intvCapacity) |
---|
| 411 | { |
---|
| 412 | if (diff < 0) itvNum = -itvNum; |
---|
| 413 | type[1] = (int) (itvNum/2) + exe_params->intvRadius; |
---|
| 414 | P1[1] = pred1D + 2 * (type[1] - exe_params->intvRadius) * realPrecision; |
---|
| 415 | } |
---|
| 416 | else |
---|
| 417 | { |
---|
| 418 | type[1] = 0; |
---|
| 419 | curValue = P1[1] = spaceFillingValue[1]; |
---|
| 420 | compressUInt32Value(curValue, minValue, byteSize, bytes); |
---|
| 421 | memcpyDBA_Data(exactDataByteArray, bytes, byteSize); |
---|
| 422 | } |
---|
| 423 | |
---|
| 424 | /* Process Row-0 data 2 --> data r2-1 */ |
---|
| 425 | for (j = 2; j < r2; j++) |
---|
| 426 | { |
---|
| 427 | pred1D = 2*P1[j-1] - P1[j-2]; |
---|
| 428 | diff = spaceFillingValue[j] - pred1D; |
---|
| 429 | |
---|
| 430 | itvNum = llabs(diff)/realPrecision + 1; |
---|
| 431 | |
---|
| 432 | if (itvNum < exe_params->intvCapacity) |
---|
| 433 | { |
---|
| 434 | if (diff < 0) itvNum = -itvNum; |
---|
| 435 | type[j] = (int) (itvNum/2) + exe_params->intvRadius; |
---|
| 436 | P1[j] = pred1D + 2 * (type[j] - exe_params->intvRadius) * realPrecision; |
---|
| 437 | } |
---|
| 438 | else |
---|
| 439 | { |
---|
| 440 | type[j] = 0; |
---|
| 441 | curValue = P1[j] = spaceFillingValue[j]; |
---|
| 442 | compressUInt32Value(curValue, minValue, byteSize, bytes); |
---|
| 443 | memcpyDBA_Data(exactDataByteArray, bytes, byteSize); |
---|
| 444 | } |
---|
| 445 | } |
---|
| 446 | |
---|
| 447 | /* Process Row-1 --> Row-r1-1 */ |
---|
| 448 | size_t index; |
---|
| 449 | for (i = 1; i < r1; i++) |
---|
| 450 | { |
---|
| 451 | /* Process row-i data 0 */ |
---|
| 452 | index = i*r2; |
---|
| 453 | pred1D = P1[0]; |
---|
| 454 | diff = spaceFillingValue[index] - pred1D; |
---|
| 455 | |
---|
| 456 | itvNum = llabs(diff)/realPrecision + 1; |
---|
| 457 | |
---|
| 458 | if (itvNum < exe_params->intvCapacity) |
---|
| 459 | { |
---|
| 460 | if (diff < 0) itvNum = -itvNum; |
---|
| 461 | type[index] = (int) (itvNum/2) + exe_params->intvRadius; |
---|
| 462 | P0[0] = pred1D + 2 * (type[index] - exe_params->intvRadius) * realPrecision; |
---|
| 463 | } |
---|
| 464 | else |
---|
| 465 | { |
---|
| 466 | type[index] = 0; |
---|
| 467 | curValue = P0[0] = spaceFillingValue[index]; |
---|
| 468 | compressUInt32Value(curValue, minValue, byteSize, bytes); |
---|
| 469 | memcpyDBA_Data(exactDataByteArray, bytes, byteSize); |
---|
| 470 | } |
---|
| 471 | |
---|
| 472 | /* Process row-i data 1 --> r2-1*/ |
---|
| 473 | for (j = 1; j < r2; j++) |
---|
| 474 | { |
---|
| 475 | index = i*r2+j; |
---|
| 476 | pred2D = P0[j-1] + P1[j] - P1[j-1]; |
---|
| 477 | |
---|
| 478 | diff = spaceFillingValue[index] - pred2D; |
---|
| 479 | |
---|
| 480 | itvNum = llabs(diff)/realPrecision + 1; |
---|
| 481 | |
---|
| 482 | if (itvNum < exe_params->intvCapacity) |
---|
| 483 | { |
---|
| 484 | if (diff < 0) itvNum = -itvNum; |
---|
| 485 | type[index] = (int) (itvNum/2) + exe_params->intvRadius; |
---|
| 486 | P0[j] = pred2D + 2 * (type[index] - exe_params->intvRadius) * realPrecision; |
---|
| 487 | } |
---|
| 488 | else |
---|
| 489 | { |
---|
| 490 | type[index] = 0; |
---|
| 491 | curValue = P0[j] = spaceFillingValue[index]; |
---|
| 492 | compressUInt32Value(curValue, minValue, byteSize, bytes); |
---|
| 493 | memcpyDBA_Data(exactDataByteArray, bytes, byteSize); |
---|
| 494 | } |
---|
| 495 | } |
---|
| 496 | |
---|
| 497 | uint32_t *Pt; |
---|
| 498 | Pt = P1; |
---|
| 499 | P1 = P0; |
---|
| 500 | P0 = Pt; |
---|
| 501 | } |
---|
| 502 | |
---|
| 503 | if(r2!=1) |
---|
| 504 | free(P0); |
---|
| 505 | free(P1); |
---|
| 506 | |
---|
| 507 | size_t exactDataNum = exactDataByteArray->size; |
---|
| 508 | |
---|
| 509 | TightDataPointStorageI* tdps; |
---|
| 510 | |
---|
| 511 | new_TightDataPointStorageI(&tdps, dataLength, exactDataNum, byteSize, |
---|
| 512 | type, exactDataByteArray->array, exactDataByteArray->size, |
---|
| 513 | realPrecision, minValue, quantization_intervals, SZ_UINT32); |
---|
| 514 | |
---|
| 515 | //free memory |
---|
| 516 | free(type); |
---|
| 517 | free(exactDataByteArray); //exactDataByteArray->array has been released in free_TightDataPointStorageF(tdps); |
---|
| 518 | |
---|
| 519 | return tdps; |
---|
| 520 | } |
---|
| 521 | |
---|
| 522 | /** |
---|
| 523 | * |
---|
| 524 | * Note: @r1 is high dimension |
---|
| 525 | * @r2 is low dimension |
---|
| 526 | * */ |
---|
| 527 | void SZ_compress_args_uint32_NoCkRngeNoGzip_2D(unsigned char** newByteData, uint32_t *oriData, size_t r1, size_t r2, double realPrecision, size_t *outSize, |
---|
| 528 | int64_t valueRangeSize, uint32_t minValue) |
---|
| 529 | { |
---|
| 530 | TightDataPointStorageI* tdps = SZ_compress_uint32_2D_MDQ(oriData, r1, r2, realPrecision, valueRangeSize, minValue); |
---|
| 531 | |
---|
| 532 | convertTDPStoFlatBytes_int(tdps, newByteData, outSize); |
---|
| 533 | |
---|
| 534 | size_t dataLength = r1*r2; |
---|
| 535 | if(*outSize>dataLength*sizeof(uint32_t)) |
---|
| 536 | SZ_compress_args_uint32_StoreOriData(oriData, dataLength, tdps, newByteData, outSize); |
---|
| 537 | |
---|
| 538 | free_TightDataPointStorageI(tdps); |
---|
| 539 | } |
---|
| 540 | |
---|
| 541 | TightDataPointStorageI* SZ_compress_uint32_3D_MDQ(uint32_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, int64_t valueRangeSize, int64_t minValue) |
---|
| 542 | { |
---|
| 543 | unsigned char bytes[8] = {0,0,0,0,0,0,0,0}; |
---|
| 544 | int byteSize = computeByteSizePerIntValue(valueRangeSize); |
---|
| 545 | |
---|
| 546 | unsigned int quantization_intervals; |
---|
| 547 | if(exe_params->optQuantMode==1) |
---|
| 548 | { |
---|
| 549 | quantization_intervals = optimize_intervals_uint32_3D(oriData, r1, r2, r3, realPrecision); |
---|
| 550 | updateQuantizationInfo(quantization_intervals); |
---|
| 551 | } |
---|
| 552 | else |
---|
| 553 | quantization_intervals = exe_params->intvCapacity; |
---|
| 554 | size_t i,j,k; |
---|
| 555 | int64_t pred1D, pred2D, pred3D, curValue; |
---|
| 556 | int64_t diff = 0.0; |
---|
| 557 | double itvNum = 0; |
---|
| 558 | uint32_t *P0, *P1; |
---|
| 559 | |
---|
| 560 | size_t dataLength = r1*r2*r3; |
---|
| 561 | |
---|
| 562 | size_t r23 = r2*r3; |
---|
| 563 | P0 = (uint32_t*)malloc(r23*sizeof(uint32_t)); |
---|
| 564 | P1 = (uint32_t*)malloc(r23*sizeof(uint32_t)); |
---|
| 565 | |
---|
| 566 | int* type = (int*) malloc(dataLength*sizeof(int)); |
---|
| 567 | |
---|
| 568 | uint32_t* spaceFillingValue = oriData; // |
---|
| 569 | |
---|
| 570 | DynamicByteArray *exactDataByteArray; |
---|
| 571 | new_DBA(&exactDataByteArray, DynArrayInitLen); |
---|
| 572 | |
---|
| 573 | type[0] = 0; |
---|
| 574 | P1[0] = spaceFillingValue[0]; |
---|
| 575 | compressUInt32Value(spaceFillingValue[0], minValue, byteSize, bytes); |
---|
| 576 | memcpyDBA_Data(exactDataByteArray, bytes, byteSize); |
---|
| 577 | |
---|
| 578 | /* Process Row-0 data 1*/ |
---|
| 579 | pred1D = P1[0]; |
---|
| 580 | diff = spaceFillingValue[1] - pred1D; |
---|
| 581 | |
---|
| 582 | itvNum = llabs(diff)/realPrecision + 1; |
---|
| 583 | |
---|
| 584 | if (itvNum < exe_params->intvCapacity) |
---|
| 585 | { |
---|
| 586 | if (diff < 0) itvNum = -itvNum; |
---|
| 587 | type[1] = (int) (itvNum/2) + exe_params->intvRadius; |
---|
| 588 | P1[1] = pred1D + 2 * (type[1] - exe_params->intvRadius) * realPrecision; |
---|
| 589 | } |
---|
| 590 | else |
---|
| 591 | { |
---|
| 592 | type[1] = 0; |
---|
| 593 | curValue = P1[1] = spaceFillingValue[1]; |
---|
| 594 | compressUInt32Value(curValue, minValue, byteSize, bytes); |
---|
| 595 | memcpyDBA_Data(exactDataByteArray, bytes, byteSize); |
---|
| 596 | } |
---|
| 597 | |
---|
| 598 | /* Process Row-0 data 2 --> data r3-1 */ |
---|
| 599 | for (j = 2; j < r3; j++) |
---|
| 600 | { |
---|
| 601 | pred1D = 2*P1[j-1] - P1[j-2]; |
---|
| 602 | diff = spaceFillingValue[j] - pred1D; |
---|
| 603 | |
---|
| 604 | itvNum = llabs(diff)/realPrecision + 1; |
---|
| 605 | |
---|
| 606 | if (itvNum < exe_params->intvCapacity) |
---|
| 607 | { |
---|
| 608 | if (diff < 0) itvNum = -itvNum; |
---|
| 609 | type[j] = (int) (itvNum/2) + exe_params->intvRadius; |
---|
| 610 | P1[j] = pred1D + 2 * (type[j] - exe_params->intvRadius) * realPrecision; |
---|
| 611 | } |
---|
| 612 | else |
---|
| 613 | { |
---|
| 614 | type[j] = 0; |
---|
| 615 | curValue = P1[j] = spaceFillingValue[j]; |
---|
| 616 | compressUInt32Value(curValue, minValue, byteSize, bytes); |
---|
| 617 | memcpyDBA_Data(exactDataByteArray, bytes, byteSize); |
---|
| 618 | } |
---|
| 619 | } |
---|
| 620 | |
---|
| 621 | /* Process Row-1 --> Row-r2-1 */ |
---|
| 622 | size_t index; |
---|
| 623 | for (i = 1; i < r2; i++) |
---|
| 624 | { |
---|
| 625 | /* Process row-i data 0 */ |
---|
| 626 | index = i*r3; |
---|
| 627 | pred1D = P1[index-r3]; |
---|
| 628 | diff = spaceFillingValue[index] - pred1D; |
---|
| 629 | |
---|
| 630 | itvNum = llabs(diff)/realPrecision + 1; |
---|
| 631 | |
---|
| 632 | if (itvNum < exe_params->intvCapacity) |
---|
| 633 | { |
---|
| 634 | if (diff < 0) itvNum = -itvNum; |
---|
| 635 | type[index] = (int) (itvNum/2) + exe_params->intvRadius; |
---|
| 636 | P1[index] = pred1D + 2 * (type[index] - exe_params->intvRadius) * realPrecision; |
---|
| 637 | } |
---|
| 638 | else |
---|
| 639 | { |
---|
| 640 | type[index] = 0; |
---|
| 641 | curValue = P1[index] = spaceFillingValue[index]; |
---|
| 642 | compressUInt32Value(curValue, minValue, byteSize, bytes); |
---|
| 643 | memcpyDBA_Data(exactDataByteArray, bytes, byteSize); |
---|
| 644 | } |
---|
| 645 | |
---|
| 646 | /* Process row-i data 1 --> data r3-1*/ |
---|
| 647 | for (j = 1; j < r3; j++) |
---|
| 648 | { |
---|
| 649 | index = i*r3+j; |
---|
| 650 | pred2D = P1[index-1] + P1[index-r3] - P1[index-r3-1]; |
---|
| 651 | |
---|
| 652 | diff = spaceFillingValue[index] - pred2D; |
---|
| 653 | |
---|
| 654 | itvNum = llabs(diff)/realPrecision + 1; |
---|
| 655 | |
---|
| 656 | if (itvNum < exe_params->intvCapacity) |
---|
| 657 | { |
---|
| 658 | if (diff < 0) itvNum = -itvNum; |
---|
| 659 | type[index] = (int) (itvNum/2) + exe_params->intvRadius; |
---|
| 660 | P1[index] = pred2D + 2 * (type[index] - exe_params->intvRadius) * realPrecision; |
---|
| 661 | } |
---|
| 662 | else |
---|
| 663 | { |
---|
| 664 | type[index] = 0; |
---|
| 665 | curValue = P1[index] = spaceFillingValue[index]; |
---|
| 666 | compressUInt32Value(curValue, minValue, byteSize, bytes); |
---|
| 667 | memcpyDBA_Data(exactDataByteArray, bytes, byteSize); |
---|
| 668 | } |
---|
| 669 | } |
---|
| 670 | } |
---|
| 671 | |
---|
| 672 | |
---|
| 673 | /////////////////////////// Process layer-1 --> layer-r1-1 /////////////////////////// |
---|
| 674 | |
---|
| 675 | for (k = 1; k < r1; k++) |
---|
| 676 | { |
---|
| 677 | /* Process Row-0 data 0*/ |
---|
| 678 | index = k*r23; |
---|
| 679 | pred1D = P1[0]; |
---|
| 680 | diff = spaceFillingValue[index] - pred1D; |
---|
| 681 | |
---|
| 682 | itvNum = llabs(diff)/realPrecision + 1; |
---|
| 683 | |
---|
| 684 | if (itvNum < exe_params->intvCapacity) |
---|
| 685 | { |
---|
| 686 | if (diff < 0) itvNum = -itvNum; |
---|
| 687 | type[index] = (int) (itvNum/2) + exe_params->intvRadius; |
---|
| 688 | P0[0] = pred1D + 2 * (type[index] - exe_params->intvRadius) * realPrecision; |
---|
| 689 | } |
---|
| 690 | else |
---|
| 691 | { |
---|
| 692 | type[index] = 0; |
---|
| 693 | curValue = P0[0] = spaceFillingValue[index]; |
---|
| 694 | compressUInt32Value(curValue, minValue, byteSize, bytes); |
---|
| 695 | memcpyDBA_Data(exactDataByteArray, bytes, byteSize); |
---|
| 696 | } |
---|
| 697 | |
---|
| 698 | |
---|
| 699 | /* Process Row-0 data 1 --> data r3-1 */ |
---|
| 700 | for (j = 1; j < r3; j++) |
---|
| 701 | { |
---|
| 702 | //index = k*r2*r3+j; |
---|
| 703 | index ++; |
---|
| 704 | pred2D = P0[j-1] + P1[j] - P1[j-1]; |
---|
| 705 | diff = spaceFillingValue[index] - pred2D; |
---|
| 706 | |
---|
| 707 | itvNum = llabs(diff)/realPrecision + 1; |
---|
| 708 | |
---|
| 709 | if (itvNum < exe_params->intvCapacity) |
---|
| 710 | { |
---|
| 711 | if (diff < 0) itvNum = -itvNum; |
---|
| 712 | type[index] = (int) (itvNum/2) + exe_params->intvRadius; |
---|
| 713 | P0[j] = pred2D + 2 * (type[index] - exe_params->intvRadius) * realPrecision; |
---|
| 714 | /* if(type[index]==0) |
---|
| 715 | printf("err:type[%d]=0, index4\n", index); */ |
---|
| 716 | } |
---|
| 717 | else |
---|
| 718 | { |
---|
| 719 | type[index] = 0; |
---|
| 720 | curValue = P0[j] = spaceFillingValue[index]; |
---|
| 721 | compressUInt32Value(curValue, minValue, byteSize, bytes); |
---|
| 722 | memcpyDBA_Data(exactDataByteArray, bytes, byteSize); |
---|
| 723 | } |
---|
| 724 | } |
---|
| 725 | |
---|
| 726 | /* Process Row-1 --> Row-r2-1 */ |
---|
| 727 | size_t index2D; |
---|
| 728 | for (i = 1; i < r2; i++) |
---|
| 729 | { |
---|
| 730 | /* Process Row-i data 0 */ |
---|
| 731 | index = k*r23 + i*r3; |
---|
| 732 | index2D = i*r3; |
---|
| 733 | pred2D = P0[index2D-r3] + P1[index2D] - P1[index2D-r3]; |
---|
| 734 | diff = spaceFillingValue[index] - pred2D; |
---|
| 735 | |
---|
| 736 | itvNum = llabs(diff)/realPrecision + 1; |
---|
| 737 | |
---|
| 738 | if (itvNum < exe_params->intvCapacity) |
---|
| 739 | { |
---|
| 740 | if (diff < 0) itvNum = -itvNum; |
---|
| 741 | type[index] = (int) (itvNum/2) + exe_params->intvRadius; |
---|
| 742 | P0[index2D] = pred2D + 2 * (type[index] - exe_params->intvRadius) * realPrecision; |
---|
| 743 | } |
---|
| 744 | else |
---|
| 745 | { |
---|
| 746 | type[index] = 0; |
---|
| 747 | curValue = P0[index2D] = spaceFillingValue[index]; |
---|
| 748 | compressUInt32Value(curValue, minValue, byteSize, bytes); |
---|
| 749 | memcpyDBA_Data(exactDataByteArray, bytes, byteSize); |
---|
| 750 | } |
---|
| 751 | |
---|
| 752 | /* Process Row-i data 1 --> data r3-1 */ |
---|
| 753 | for (j = 1; j < r3; j++) |
---|
| 754 | { |
---|
| 755 | // if(k==63&&i==43&&j==27) |
---|
| 756 | // printf("i=%d\n", i); |
---|
| 757 | //index = k*r2*r3 + i*r3 + j; |
---|
| 758 | index ++; |
---|
| 759 | index2D = i*r3 + j; |
---|
| 760 | pred3D = P0[index2D-1] + P0[index2D-r3]+ P1[index2D] - P0[index2D-r3-1] - P1[index2D-r3] - P1[index2D-1] + P1[index2D-r3-1]; |
---|
| 761 | diff = spaceFillingValue[index] - pred3D; |
---|
| 762 | |
---|
| 763 | itvNum = llabs(diff)/realPrecision + 1; |
---|
| 764 | |
---|
| 765 | if (itvNum < exe_params->intvCapacity) |
---|
| 766 | { |
---|
| 767 | if (diff < 0) itvNum = -itvNum; |
---|
| 768 | type[index] = (int) (itvNum/2) + exe_params->intvRadius; |
---|
| 769 | P0[index2D] = pred3D + 2 * (type[index] - exe_params->intvRadius) * realPrecision; |
---|
| 770 | } |
---|
| 771 | else |
---|
| 772 | { |
---|
| 773 | type[index] = 0; |
---|
| 774 | curValue = P0[index2D] = spaceFillingValue[index]; |
---|
| 775 | compressUInt32Value(curValue, minValue, byteSize, bytes); |
---|
| 776 | memcpyDBA_Data(exactDataByteArray, bytes, byteSize); |
---|
| 777 | } |
---|
| 778 | } |
---|
| 779 | } |
---|
| 780 | |
---|
| 781 | uint32_t *Pt; |
---|
| 782 | Pt = P1; |
---|
| 783 | P1 = P0; |
---|
| 784 | P0 = Pt; |
---|
| 785 | } |
---|
| 786 | if(r23!=1) |
---|
| 787 | free(P0); |
---|
| 788 | free(P1); |
---|
| 789 | |
---|
| 790 | size_t exactDataNum = exactDataByteArray->size; |
---|
| 791 | |
---|
| 792 | TightDataPointStorageI* tdps; |
---|
| 793 | |
---|
| 794 | new_TightDataPointStorageI(&tdps, dataLength, exactDataNum, byteSize, |
---|
| 795 | type, exactDataByteArray->array, exactDataByteArray->size, |
---|
| 796 | realPrecision, minValue, quantization_intervals, SZ_UINT32); |
---|
| 797 | |
---|
| 798 | //free memory |
---|
| 799 | free(type); |
---|
| 800 | free(exactDataByteArray); //exactDataByteArray->array has been released in free_TightDataPointStorageF(tdps); |
---|
| 801 | |
---|
| 802 | return tdps; |
---|
| 803 | } |
---|
| 804 | |
---|
| 805 | |
---|
| 806 | void SZ_compress_args_uint32_NoCkRngeNoGzip_3D(unsigned char** newByteData, uint32_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t *outSize, |
---|
| 807 | int64_t valueRangeSize, int64_t minValue) |
---|
| 808 | { |
---|
| 809 | TightDataPointStorageI* tdps = SZ_compress_uint32_3D_MDQ(oriData, r1, r2, r3, realPrecision, valueRangeSize, minValue); |
---|
| 810 | |
---|
| 811 | convertTDPStoFlatBytes_int(tdps, newByteData, outSize); |
---|
| 812 | |
---|
| 813 | size_t dataLength = r1*r2*r3; |
---|
| 814 | if(*outSize>dataLength*sizeof(uint32_t)) |
---|
| 815 | SZ_compress_args_uint32_StoreOriData(oriData, dataLength, tdps, newByteData, outSize); |
---|
| 816 | |
---|
| 817 | free_TightDataPointStorageI(tdps); |
---|
| 818 | } |
---|
| 819 | |
---|
| 820 | |
---|
| 821 | TightDataPointStorageI* SZ_compress_uint32_4D_MDQ(uint32_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, int64_t valueRangeSize, int64_t minValue) |
---|
| 822 | { |
---|
| 823 | unsigned char bytes[8] = {0,0,0,0,0,0,0,0}; |
---|
| 824 | int byteSize = computeByteSizePerIntValue(valueRangeSize); |
---|
| 825 | |
---|
| 826 | unsigned int quantization_intervals; |
---|
| 827 | if(exe_params->optQuantMode==1) |
---|
| 828 | { |
---|
| 829 | quantization_intervals = optimize_intervals_uint32_4D(oriData, r1, r2, r3, r4, realPrecision); |
---|
| 830 | updateQuantizationInfo(quantization_intervals); |
---|
| 831 | } |
---|
| 832 | else |
---|
| 833 | quantization_intervals = exe_params->intvCapacity; |
---|
| 834 | size_t i,j,k; |
---|
| 835 | int64_t pred1D, pred2D, pred3D, curValue; |
---|
| 836 | int64_t diff = 0.0; |
---|
| 837 | double itvNum = 0; |
---|
| 838 | uint32_t *P0, *P1; |
---|
| 839 | |
---|
| 840 | size_t dataLength = r1*r2*r3*r4; |
---|
| 841 | |
---|
| 842 | size_t r234 = r2*r3*r4; |
---|
| 843 | size_t r34 = r3*r4; |
---|
| 844 | |
---|
| 845 | P0 = (uint32_t*)malloc(r34*sizeof(uint32_t)); |
---|
| 846 | P1 = (uint32_t*)malloc(r34*sizeof(uint32_t)); |
---|
| 847 | |
---|
| 848 | int* type = (int*) malloc(dataLength*sizeof(int)); |
---|
| 849 | |
---|
| 850 | uint32_t* spaceFillingValue = oriData; // |
---|
| 851 | |
---|
| 852 | DynamicByteArray *exactDataByteArray; |
---|
| 853 | new_DBA(&exactDataByteArray, DynArrayInitLen); |
---|
| 854 | |
---|
| 855 | size_t l; |
---|
| 856 | for (l = 0; l < r1; l++) |
---|
| 857 | { |
---|
| 858 | |
---|
| 859 | /////////////////////////// Process layer-0 /////////////////////////// |
---|
| 860 | /* Process Row-0 data 0*/ |
---|
| 861 | size_t index = l*r234; |
---|
| 862 | size_t index2D = 0; |
---|
| 863 | |
---|
| 864 | type[index] = 0; |
---|
| 865 | curValue = P1[index2D] = spaceFillingValue[index]; |
---|
| 866 | compressUInt32Value(curValue, minValue, byteSize, bytes); |
---|
| 867 | memcpyDBA_Data(exactDataByteArray, bytes, byteSize); |
---|
| 868 | |
---|
| 869 | /* Process Row-0 data 1*/ |
---|
| 870 | index = l*r234+1; |
---|
| 871 | index2D = 1; |
---|
| 872 | |
---|
| 873 | pred1D = P1[index2D-1]; |
---|
| 874 | diff = curValue - pred1D; |
---|
| 875 | |
---|
| 876 | itvNum = llabs(diff)/realPrecision + 1; |
---|
| 877 | |
---|
| 878 | if (itvNum < exe_params->intvCapacity) |
---|
| 879 | { |
---|
| 880 | if (diff < 0) itvNum = -itvNum; |
---|
| 881 | type[index] = (int) (itvNum/2) + exe_params->intvRadius; |
---|
| 882 | P1[index2D] = pred1D + 2 * (type[index] - exe_params->intvRadius) * realPrecision; |
---|
| 883 | } |
---|
| 884 | else |
---|
| 885 | { |
---|
| 886 | type[index] = 0; |
---|
| 887 | |
---|
| 888 | curValue = P1[index2D] = spaceFillingValue[0]; |
---|
| 889 | compressUInt32Value(curValue, minValue, byteSize, bytes); |
---|
| 890 | memcpyDBA_Data(exactDataByteArray, bytes, byteSize); |
---|
| 891 | } |
---|
| 892 | |
---|
| 893 | /* Process Row-0 data 2 --> data r4-1 */ |
---|
| 894 | for (j = 2; j < r4; j++) |
---|
| 895 | { |
---|
| 896 | index = l*r234+j; |
---|
| 897 | index2D = j; |
---|
| 898 | |
---|
| 899 | pred1D = 2*P1[index2D-1] - P1[index2D-2]; |
---|
| 900 | diff = spaceFillingValue[index] - pred1D; |
---|
| 901 | |
---|
| 902 | itvNum = llabs(diff)/realPrecision + 1; |
---|
| 903 | |
---|
| 904 | if (itvNum < exe_params->intvCapacity) |
---|
| 905 | { |
---|
| 906 | if (diff < 0) itvNum = -itvNum; |
---|
| 907 | type[index] = (int) (itvNum/2) + exe_params->intvRadius; |
---|
| 908 | P1[index2D] = pred1D + 2 * (type[index] - exe_params->intvRadius) * realPrecision; |
---|
| 909 | } |
---|
| 910 | else |
---|
| 911 | { |
---|
| 912 | type[index] = 0; |
---|
| 913 | |
---|
| 914 | curValue = P1[index2D] = spaceFillingValue[0]; |
---|
| 915 | compressUInt32Value(curValue, minValue, byteSize, bytes); |
---|
| 916 | memcpyDBA_Data(exactDataByteArray, bytes, byteSize); |
---|
| 917 | } |
---|
| 918 | } |
---|
| 919 | |
---|
| 920 | /* Process Row-1 --> Row-r3-1 */ |
---|
| 921 | for (i = 1; i < r3; i++) |
---|
| 922 | { |
---|
| 923 | /* Process row-i data 0 */ |
---|
| 924 | index = l*r234+i*r4; |
---|
| 925 | index2D = i*r4; |
---|
| 926 | |
---|
| 927 | pred1D = P1[index2D-r4]; |
---|
| 928 | diff = spaceFillingValue[index] - pred1D; |
---|
| 929 | |
---|
| 930 | itvNum = llabs(diff)/realPrecision + 1; |
---|
| 931 | |
---|
| 932 | if (itvNum < exe_params->intvCapacity) |
---|
| 933 | { |
---|
| 934 | if (diff < 0) itvNum = -itvNum; |
---|
| 935 | type[index] = (int) (itvNum/2) + exe_params->intvRadius; |
---|
| 936 | P1[index2D] = pred1D + 2 * (type[index] - exe_params->intvRadius) * realPrecision; |
---|
| 937 | } |
---|
| 938 | else |
---|
| 939 | { |
---|
| 940 | type[index] = 0; |
---|
| 941 | |
---|
| 942 | curValue = P1[index2D] = spaceFillingValue[0]; |
---|
| 943 | compressUInt32Value(curValue, minValue, byteSize, bytes); |
---|
| 944 | memcpyDBA_Data(exactDataByteArray, bytes, byteSize); |
---|
| 945 | } |
---|
| 946 | |
---|
| 947 | /* Process row-i data 1 --> data r4-1*/ |
---|
| 948 | for (j = 1; j < r4; j++) |
---|
| 949 | { |
---|
| 950 | index = l*r234+i*r4+j; |
---|
| 951 | index2D = i*r4+j; |
---|
| 952 | |
---|
| 953 | pred2D = P1[index2D-1] + P1[index2D-r4] - P1[index2D-r4-1]; |
---|
| 954 | |
---|
| 955 | diff = spaceFillingValue[index] - pred2D; |
---|
| 956 | |
---|
| 957 | itvNum = llabs(diff)/realPrecision + 1; |
---|
| 958 | |
---|
| 959 | if (itvNum < exe_params->intvCapacity) |
---|
| 960 | { |
---|
| 961 | if (diff < 0) itvNum = -itvNum; |
---|
| 962 | type[index] = (int) (itvNum/2) + exe_params->intvRadius; |
---|
| 963 | P1[index2D] = pred2D + 2 * (type[index] - exe_params->intvRadius) * realPrecision; |
---|
| 964 | } |
---|
| 965 | else |
---|
| 966 | { |
---|
| 967 | type[index] = 0; |
---|
| 968 | |
---|
| 969 | curValue = P1[index2D] = spaceFillingValue[0]; |
---|
| 970 | compressUInt32Value(curValue, minValue, byteSize, bytes); |
---|
| 971 | memcpyDBA_Data(exactDataByteArray, bytes, byteSize); |
---|
| 972 | } |
---|
| 973 | } |
---|
| 974 | } |
---|
| 975 | |
---|
| 976 | |
---|
| 977 | /////////////////////////// Process layer-1 --> layer-r2-1 /////////////////////////// |
---|
| 978 | |
---|
| 979 | for (k = 1; k < r2; k++) |
---|
| 980 | { |
---|
| 981 | /* Process Row-0 data 0*/ |
---|
| 982 | index = l*r234+k*r34; |
---|
| 983 | index2D = 0; |
---|
| 984 | |
---|
| 985 | pred1D = P1[index2D]; |
---|
| 986 | diff = spaceFillingValue[index] - pred1D; |
---|
| 987 | |
---|
| 988 | itvNum = llabs(diff)/realPrecision + 1; |
---|
| 989 | |
---|
| 990 | if (itvNum < exe_params->intvCapacity) |
---|
| 991 | { |
---|
| 992 | if (diff < 0) itvNum = -itvNum; |
---|
| 993 | type[index] = (int) (itvNum/2) + exe_params->intvRadius; |
---|
| 994 | P0[index2D] = pred1D + 2 * (type[index] - exe_params->intvRadius) * realPrecision; |
---|
| 995 | } |
---|
| 996 | else |
---|
| 997 | { |
---|
| 998 | type[index] = 0; |
---|
| 999 | |
---|
| 1000 | curValue = P0[index2D] = spaceFillingValue[0]; |
---|
| 1001 | compressUInt32Value(curValue, minValue, byteSize, bytes); |
---|
| 1002 | memcpyDBA_Data(exactDataByteArray, bytes, byteSize); |
---|
| 1003 | } |
---|
| 1004 | |
---|
| 1005 | /* Process Row-0 data 1 --> data r4-1 */ |
---|
| 1006 | for (j = 1; j < r4; j++) |
---|
| 1007 | { |
---|
| 1008 | index = l*r234+k*r34+j; |
---|
| 1009 | index2D = j; |
---|
| 1010 | |
---|
| 1011 | pred2D = P0[index2D-1] + P1[index2D] - P1[index2D-1]; |
---|
| 1012 | diff = spaceFillingValue[index] - pred2D; |
---|
| 1013 | |
---|
| 1014 | itvNum = llabs(diff)/realPrecision + 1; |
---|
| 1015 | |
---|
| 1016 | if (itvNum < exe_params->intvCapacity) |
---|
| 1017 | { |
---|
| 1018 | if (diff < 0) itvNum = -itvNum; |
---|
| 1019 | type[index] = (int) (itvNum/2) + exe_params->intvRadius; |
---|
| 1020 | P0[index2D] = pred2D + 2 * (type[index] - exe_params->intvRadius) * realPrecision; |
---|
| 1021 | } |
---|
| 1022 | else |
---|
| 1023 | { |
---|
| 1024 | type[index] = 0; |
---|
| 1025 | |
---|
| 1026 | curValue = P0[index2D] = spaceFillingValue[0]; |
---|
| 1027 | compressUInt32Value(curValue, minValue, byteSize, bytes); |
---|
| 1028 | memcpyDBA_Data(exactDataByteArray, bytes, byteSize); |
---|
| 1029 | } |
---|
| 1030 | } |
---|
| 1031 | |
---|
| 1032 | /* Process Row-1 --> Row-r3-1 */ |
---|
| 1033 | for (i = 1; i < r3; i++) |
---|
| 1034 | { |
---|
| 1035 | /* Process Row-i data 0 */ |
---|
| 1036 | index = l*r234+k*r34+i*r4; |
---|
| 1037 | index2D = i*r4; |
---|
| 1038 | |
---|
| 1039 | pred2D = P0[index2D-r4] + P1[index2D] - P1[index2D-r4]; |
---|
| 1040 | diff = spaceFillingValue[index] - pred2D; |
---|
| 1041 | |
---|
| 1042 | itvNum = llabs(diff)/realPrecision + 1; |
---|
| 1043 | |
---|
| 1044 | if (itvNum < exe_params->intvCapacity) |
---|
| 1045 | { |
---|
| 1046 | if (diff < 0) itvNum = -itvNum; |
---|
| 1047 | type[index] = (int) (itvNum/2) + exe_params->intvRadius; |
---|
| 1048 | P0[index2D] = pred2D + 2 * (type[index] - exe_params->intvRadius) * realPrecision; |
---|
| 1049 | } |
---|
| 1050 | else |
---|
| 1051 | { |
---|
| 1052 | type[index] = 0; |
---|
| 1053 | |
---|
| 1054 | curValue = P0[index2D] = spaceFillingValue[0]; |
---|
| 1055 | compressUInt32Value(curValue, minValue, byteSize, bytes); |
---|
| 1056 | memcpyDBA_Data(exactDataByteArray, bytes, byteSize); |
---|
| 1057 | } |
---|
| 1058 | |
---|
| 1059 | /* Process Row-i data 1 --> data r4-1 */ |
---|
| 1060 | for (j = 1; j < r4; j++) |
---|
| 1061 | { |
---|
| 1062 | index = l*r234+k*r34+i*r4+j; |
---|
| 1063 | index2D = i*r4+j; |
---|
| 1064 | |
---|
| 1065 | pred3D = P0[index2D-1] + P0[index2D-r4]+ P1[index2D] - P0[index2D-r4-1] - P1[index2D-r4] - P1[index2D-1] + P1[index2D-r4-1]; |
---|
| 1066 | diff = spaceFillingValue[index] - pred3D; |
---|
| 1067 | |
---|
| 1068 | |
---|
| 1069 | itvNum = llabs(diff)/realPrecision + 1; |
---|
| 1070 | |
---|
| 1071 | if (itvNum < exe_params->intvCapacity) |
---|
| 1072 | { |
---|
| 1073 | if (diff < 0) itvNum = -itvNum; |
---|
| 1074 | type[index] = (int) (itvNum/2) + exe_params->intvRadius; |
---|
| 1075 | P0[index2D] = pred3D + 2 * (type[index] - exe_params->intvRadius) * realPrecision; |
---|
| 1076 | } |
---|
| 1077 | else |
---|
| 1078 | { |
---|
| 1079 | type[index] = 0; |
---|
| 1080 | |
---|
| 1081 | curValue = P0[index2D] = spaceFillingValue[0]; |
---|
| 1082 | compressUInt32Value(curValue, minValue, byteSize, bytes); |
---|
| 1083 | memcpyDBA_Data(exactDataByteArray, bytes, byteSize); |
---|
| 1084 | } |
---|
| 1085 | } |
---|
| 1086 | } |
---|
| 1087 | |
---|
| 1088 | uint32_t *Pt; |
---|
| 1089 | Pt = P1; |
---|
| 1090 | P1 = P0; |
---|
| 1091 | P0 = Pt; |
---|
| 1092 | } |
---|
| 1093 | } |
---|
| 1094 | |
---|
| 1095 | free(P0); |
---|
| 1096 | free(P1); |
---|
| 1097 | |
---|
| 1098 | size_t exactDataNum = exactDataByteArray->size; |
---|
| 1099 | |
---|
| 1100 | TightDataPointStorageI* tdps; |
---|
| 1101 | |
---|
| 1102 | new_TightDataPointStorageI(&tdps, dataLength, exactDataNum, byteSize, |
---|
| 1103 | type, exactDataByteArray->array, exactDataByteArray->size, |
---|
| 1104 | realPrecision, minValue, quantization_intervals, SZ_UINT32); |
---|
| 1105 | |
---|
| 1106 | //free memory |
---|
| 1107 | free(type); |
---|
| 1108 | free(exactDataByteArray); //exactDataByteArray->array has been released in free_TightDataPointStorageF(tdps); |
---|
| 1109 | |
---|
| 1110 | return tdps; |
---|
| 1111 | } |
---|
| 1112 | |
---|
| 1113 | void SZ_compress_args_uint32_NoCkRngeNoGzip_4D(unsigned char** newByteData, uint32_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, |
---|
| 1114 | size_t *outSize, int64_t valueRangeSize, int64_t minValue) |
---|
| 1115 | { |
---|
| 1116 | TightDataPointStorageI* tdps = SZ_compress_uint32_4D_MDQ(oriData, r1, r2, r3, r4, realPrecision, valueRangeSize, minValue); |
---|
| 1117 | |
---|
| 1118 | convertTDPStoFlatBytes_int(tdps, newByteData, outSize); |
---|
| 1119 | |
---|
| 1120 | size_t dataLength = r1*r2*r3*r4; |
---|
| 1121 | if(*outSize>dataLength*sizeof(uint32_t)) |
---|
| 1122 | SZ_compress_args_uint32_StoreOriData(oriData, dataLength, tdps, newByteData, outSize); |
---|
| 1123 | |
---|
| 1124 | free_TightDataPointStorageI(tdps); |
---|
| 1125 | } |
---|
| 1126 | |
---|
| 1127 | void SZ_compress_args_uint32_withinRange(unsigned char** newByteData, uint32_t *oriData, size_t dataLength, size_t *outSize) |
---|
| 1128 | { |
---|
| 1129 | TightDataPointStorageI* tdps = (TightDataPointStorageI*) malloc(sizeof(TightDataPointStorageI)); |
---|
| 1130 | tdps->typeArray = NULL; |
---|
| 1131 | |
---|
| 1132 | tdps->allSameData = 1; |
---|
| 1133 | tdps->dataSeriesLength = dataLength; |
---|
| 1134 | tdps->exactDataBytes = (unsigned char*)malloc(sizeof(unsigned char)*4); |
---|
| 1135 | tdps->isLossless = 0; |
---|
| 1136 | //tdps->exactByteSize = 4; |
---|
| 1137 | tdps->exactDataNum = 1; |
---|
| 1138 | tdps->exactDataBytes_size = 4; |
---|
| 1139 | |
---|
| 1140 | uint32_t value = oriData[0]; |
---|
| 1141 | int32ToBytes_bigEndian(tdps->exactDataBytes, value); |
---|
| 1142 | |
---|
| 1143 | size_t tmpOutSize; |
---|
| 1144 | convertTDPStoFlatBytes_int(tdps, newByteData, &tmpOutSize); |
---|
| 1145 | |
---|
| 1146 | *outSize = tmpOutSize;//3+1+sizeof(uint32_t)+SZ_SIZE_TYPE; //8==3+1+4(uint32_size) |
---|
| 1147 | free_TightDataPointStorageI(tdps); |
---|
| 1148 | } |
---|
| 1149 | |
---|
| 1150 | int SZ_compress_args_uint32_wRngeNoGzip(unsigned char** newByteData, uint32_t *oriData, |
---|
| 1151 | size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize, |
---|
| 1152 | int errBoundMode, double absErr_Bound, double relBoundRatio) |
---|
| 1153 | { |
---|
| 1154 | int status = SZ_SCES; |
---|
| 1155 | size_t dataLength = computeDataLength(r5,r4,r3,r2,r1); |
---|
| 1156 | int64_t valueRangeSize = 0; |
---|
| 1157 | |
---|
| 1158 | uint32_t minValue = computeRangeSize_int(oriData, SZ_UINT32, dataLength, &valueRangeSize); |
---|
| 1159 | double realPrecision = getRealPrecision_int(valueRangeSize, errBoundMode, absErr_Bound, relBoundRatio, &status); |
---|
| 1160 | |
---|
| 1161 | if(valueRangeSize <= realPrecision) |
---|
| 1162 | { |
---|
| 1163 | SZ_compress_args_uint32_withinRange(newByteData, oriData, dataLength, outSize); |
---|
| 1164 | } |
---|
| 1165 | else |
---|
| 1166 | { |
---|
| 1167 | // SZ_compress_args_uint32_NoCkRngeNoGzip_2D(newByteData, oriData, r2, r1, realPrecision, outSize); |
---|
| 1168 | if(r5==0&&r4==0&&r3==0&&r2==0) |
---|
| 1169 | { |
---|
| 1170 | SZ_compress_args_uint32_NoCkRngeNoGzip_1D(newByteData, oriData, r1, realPrecision, outSize, valueRangeSize, minValue); |
---|
| 1171 | } |
---|
| 1172 | else if(r5==0&&r4==0&&r3==0) |
---|
| 1173 | { |
---|
| 1174 | SZ_compress_args_uint32_NoCkRngeNoGzip_2D(newByteData, oriData, r2, r1, realPrecision, outSize, valueRangeSize, minValue); |
---|
| 1175 | } |
---|
| 1176 | else if(r5==0&&r4==0) |
---|
| 1177 | { |
---|
| 1178 | SZ_compress_args_uint32_NoCkRngeNoGzip_3D(newByteData, oriData, r3, r2, r1, realPrecision, outSize, valueRangeSize, minValue); |
---|
| 1179 | } |
---|
| 1180 | else if(r5==0) |
---|
| 1181 | { |
---|
| 1182 | SZ_compress_args_uint32_NoCkRngeNoGzip_3D(newByteData, oriData, r4*r3, r2, r1, realPrecision, outSize, valueRangeSize, minValue); |
---|
| 1183 | } |
---|
| 1184 | } |
---|
| 1185 | return status; |
---|
| 1186 | } |
---|
| 1187 | |
---|
| 1188 | int SZ_compress_args_uint32(unsigned char** newByteData, uint32_t *oriData, |
---|
| 1189 | size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize, |
---|
| 1190 | int errBoundMode, double absErr_Bound, double relBoundRatio) |
---|
| 1191 | { |
---|
| 1192 | confparams_cpr->errorBoundMode = errBoundMode; |
---|
| 1193 | |
---|
| 1194 | if(errBoundMode>=PW_REL) |
---|
| 1195 | { |
---|
| 1196 | printf("Error: Current SZ version doesn't support integer data compression with point-wise relative error bound being based on pwrType=AVG\n"); |
---|
| 1197 | exit(0); |
---|
| 1198 | return SZ_NSCS; |
---|
| 1199 | } |
---|
| 1200 | int status = SZ_SCES; |
---|
| 1201 | size_t dataLength = computeDataLength(r5,r4,r3,r2,r1); |
---|
| 1202 | int64_t valueRangeSize = 0; |
---|
| 1203 | |
---|
| 1204 | uint32_t minValue = (uint32_t)computeRangeSize_int(oriData, SZ_UINT32, dataLength, &valueRangeSize); |
---|
| 1205 | double realPrecision = 0; |
---|
| 1206 | |
---|
| 1207 | if(confparams_cpr->errorBoundMode==PSNR) |
---|
| 1208 | { |
---|
| 1209 | confparams_cpr->errorBoundMode = ABS; |
---|
| 1210 | realPrecision = confparams_cpr->absErrBound = computeABSErrBoundFromPSNR(confparams_cpr->psnr, (double)confparams_cpr->predThreshold, (double)valueRangeSize); |
---|
| 1211 | //printf("realPrecision=%lf\n", realPrecision); |
---|
| 1212 | } |
---|
| 1213 | else |
---|
| 1214 | realPrecision = getRealPrecision_int(valueRangeSize, errBoundMode, absErr_Bound, relBoundRatio, &status); |
---|
| 1215 | |
---|
| 1216 | if(valueRangeSize <= realPrecision) |
---|
| 1217 | { |
---|
| 1218 | SZ_compress_args_uint32_withinRange(newByteData, oriData, dataLength, outSize); |
---|
| 1219 | } |
---|
| 1220 | else |
---|
| 1221 | { |
---|
| 1222 | size_t tmpOutSize = 0; |
---|
| 1223 | unsigned char* tmpByteData; |
---|
| 1224 | if (r2==0) |
---|
| 1225 | { |
---|
| 1226 | SZ_compress_args_uint32_NoCkRngeNoGzip_1D(&tmpByteData, oriData, r1, realPrecision, &tmpOutSize, valueRangeSize, minValue); |
---|
| 1227 | } |
---|
| 1228 | else |
---|
| 1229 | if (r3==0) |
---|
| 1230 | { |
---|
| 1231 | SZ_compress_args_uint32_NoCkRngeNoGzip_2D(&tmpByteData, oriData, r2, r1, realPrecision, &tmpOutSize, valueRangeSize, minValue); |
---|
| 1232 | } |
---|
| 1233 | else |
---|
| 1234 | if (r4==0) |
---|
| 1235 | { |
---|
| 1236 | SZ_compress_args_uint32_NoCkRngeNoGzip_3D(&tmpByteData, oriData, r3, r2, r1, realPrecision, &tmpOutSize, valueRangeSize, minValue); |
---|
| 1237 | } |
---|
| 1238 | else |
---|
| 1239 | if (r5==0) |
---|
| 1240 | { |
---|
| 1241 | SZ_compress_args_uint32_NoCkRngeNoGzip_4D(&tmpByteData, oriData, r4, r3, r2, r1, realPrecision, &tmpOutSize, valueRangeSize, minValue); |
---|
| 1242 | } |
---|
| 1243 | else |
---|
| 1244 | { |
---|
| 1245 | printf("Error: doesn't support 5 dimensions for now.\n"); |
---|
| 1246 | status = SZ_DERR; //dimension error |
---|
| 1247 | } |
---|
| 1248 | //Call Gzip to do the further compression. |
---|
| 1249 | if(confparams_cpr->szMode==SZ_BEST_SPEED) |
---|
| 1250 | { |
---|
| 1251 | *outSize = tmpOutSize; |
---|
| 1252 | *newByteData = tmpByteData; |
---|
| 1253 | } |
---|
| 1254 | else if(confparams_cpr->szMode==SZ_BEST_COMPRESSION || confparams_cpr->szMode==SZ_DEFAULT_COMPRESSION) |
---|
| 1255 | { |
---|
| 1256 | *outSize = zlib_compress5(tmpByteData, tmpOutSize, newByteData, confparams_cpr->gzipMode); |
---|
| 1257 | free(tmpByteData); |
---|
| 1258 | } |
---|
| 1259 | else |
---|
| 1260 | { |
---|
| 1261 | printf("Error: Wrong setting of confparams_cpr->szMode in the uint32_t compression.\n"); |
---|
| 1262 | status = SZ_MERR; //mode error |
---|
| 1263 | } |
---|
| 1264 | } |
---|
| 1265 | |
---|
| 1266 | return status; |
---|
| 1267 | } |
---|