Ignore:
Timestamp:
09/28/18 16:32:55 (6 years ago)
Author:
Hal Finkel <hfinkel@…>
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)
Message:

importing new SZ files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • thirdparty/SZ/sz/src/TightDataPointStorageF.c

    r2c47b73 r9ee2ce3  
    4747        (*this)->pwrErrBoundBytes = NULL; 
    4848        (*this)->pwrErrBoundBytes_size = 0;      
     49         
     50        (*this)->raBytes = NULL; 
     51        (*this)->raBytes_size = 0; 
    4952} 
    5053 
     
    8285        int mode = confparams_dec->szMode; 
    8386        int predictionMode = confparams_dec->predictionMode; 
     87        int losslessCompressor = confparams_dec->losslessCompressor; 
    8488        if(confparams_dec!=NULL) 
    8589                free(confparams_dec); 
    8690        confparams_dec = params; 
    8791        confparams_dec->szMode = mode; 
     92        confparams_dec->losslessCompressor = losslessCompressor; 
     93 
    8894        if(mode==SZ_TEMPORAL_COMPRESSION) 
    8995        { 
     
    9399         
    94100        index += MetaDataByteLength; 
     101 
     102        int isRandomAccess = (sameRByte >> 7) & 0x01; 
    95103         
    96104        unsigned char dsLengthBytes[8]; 
     
    118126        else 
    119127                (*this)->allSameData = 0; 
     128        if(isRandomAccess == 1) 
     129        { 
     130                (*this)->raBytes_size = flatBytesLength - 3 - 1 - MetaDataByteLength - exe_params->SZ_SIZE_TYPE; 
     131                (*this)->raBytes = &(flatBytes[index]); 
     132                return errorBoundMode; 
     133        }                        
    120134 
    121135        int rtype_ = sameRByte & 0x08;          //=00001000 
     
    166180                for(i = 0;i<exe_params->SZ_SIZE_TYPE;i++)  
    167181                        byteBuf[i] = flatBytes[index++]; 
    168                 (*this)->rtypeArray_size = bytesToSize(byteBuf);//(ST)           
     182                (*this)->rtypeArray_size = bytesToSize(byteBuf);//(ST) 
    169183        } 
    170184        else 
     
    200214        } 
    201215 
     216        int minLogValueSize = 0; 
     217        if(errorBoundMode>=PW_REL) 
     218                minLogValueSize = 4; 
     219 
    202220        if ((*this)->rtypeArray != NULL)  
    203221        { 
    204222                (*this)->residualMidBits_size = flatBytesLength - 3 - 1 - MetaDataByteLength - exe_params->SZ_SIZE_TYPE - 4 - radExpoL - segmentL - pwrErrBoundBytesL - 4 - 4 - 1 - 8  
    205                                 - exe_params->SZ_SIZE_TYPE - exe_params->SZ_SIZE_TYPE - exe_params->SZ_SIZE_TYPE - exe_params->SZ_SIZE_TYPE - 4 - (*this)->rtypeArray_size 
    206                                 - (*this)->typeArray_size - (*this)->leadNumArray_size 
     223                                - exe_params->SZ_SIZE_TYPE - exe_params->SZ_SIZE_TYPE - exe_params->SZ_SIZE_TYPE - minLogValueSize - exe_params->SZ_SIZE_TYPE - 4 - (*this)->rtypeArray_size 
     224                                - minLogValueSize - (*this)->typeArray_size - (*this)->leadNumArray_size 
    207225                                - (*this)->exactMidBytes_size - pwrErrBoundBytes_size; 
    208226                for (i = 0; i < (*this)->rtypeArray_size; i++) 
     
    212230        { 
    213231                (*this)->residualMidBits_size = flatBytesLength - 3 - 1 - MetaDataByteLength - exe_params->SZ_SIZE_TYPE - 4 - radExpoL - segmentL - pwrErrBoundBytesL - 4 - 4 - 1 - 8  
    214                                 - exe_params->SZ_SIZE_TYPE - exe_params->SZ_SIZE_TYPE - exe_params->SZ_SIZE_TYPE - (*this)->typeArray_size 
     232                                - exe_params->SZ_SIZE_TYPE - exe_params->SZ_SIZE_TYPE - exe_params->SZ_SIZE_TYPE - minLogValueSize - (*this)->typeArray_size 
    215233                                - (*this)->leadNumArray_size - (*this)->exactMidBytes_size - pwrErrBoundBytes_size; 
    216         }        
     234        } 
     235 
     236        if(errorBoundMode>=PW_REL) 
     237        { 
     238                (*this)->minLogValue = bytesToFloat(&flatBytes[index]); 
     239                index+=4; 
     240        } 
    217241 
    218242        (*this)->typeArray = &flatBytes[index];  
     
    419443                bytes[k++] = exactMidBytesLength[i]; 
    420444 
     445        if(confparams_cpr->errorBoundMode>=PW_REL) 
     446        { 
     447                floatToBytes(exactMidBytesLength, tdps->minLogValue); 
     448                for(i=0;i<4;i++) 
     449                        bytes[k++] = exactMidBytesLength[i]; 
     450        } 
     451 
    421452        memcpy(&(bytes[k]), tdps->typeArray, tdps->typeArray_size); 
    422453        k += tdps->typeArray_size; 
     
    520551        memcpy(&(bytes[k]), tdps->rtypeArray, tdps->rtypeArray_size); 
    521552        k += tdps->rtypeArray_size; 
     553         
     554        if(confparams_cpr->errorBoundMode>=PW_REL) 
     555        { 
     556                floatToBytes(exactMidBytesLength, tdps->minLogValue); 
     557                for(i=0;i<4;i++) 
     558                        bytes[k++] = exactMidBytesLength[i]; 
     559        }        
     560         
    522561        memcpy(&(bytes[k]), tdps->typeArray, tdps->typeArray_size); 
    523562        k += tdps->typeArray_size; 
     
    575614                for (i = 0; i < tdps->exactMidBytes_size; i++) 
    576615                        (*bytes)[k++] = tdps->exactMidBytes[i]; 
     616 
     617                *size = totalByteLength; 
     618        } 
     619        else if (tdps->rtypeArray == NULL) 
     620        { 
     621                size_t residualMidBitsLength = tdps->residualMidBits == NULL ? 0 : tdps->residualMidBits_size; 
     622                size_t segmentL = 0, radExpoL = 0, pwrBoundArrayL = 0; 
     623                int minLogValueSize = 0; 
     624                if(confparams_cpr->errorBoundMode>=PW_REL) 
     625                {                        
     626                        segmentL = exe_params->SZ_SIZE_TYPE; 
     627                        radExpoL = 1; 
     628                        pwrBoundArrayL = 4; 
     629                        minLogValueSize = 4; 
     630                } 
     631 
     632                size_t totalByteLength = 3 + 1 + MetaDataByteLength + exe_params->SZ_SIZE_TYPE + 4 + radExpoL + segmentL + pwrBoundArrayL + 4 + 4 + 1 + 8  
     633                                + exe_params->SZ_SIZE_TYPE + exe_params->SZ_SIZE_TYPE + exe_params->SZ_SIZE_TYPE + minLogValueSize 
     634                                + tdps->typeArray_size + tdps->leadNumArray_size  
     635                                + tdps->exactMidBytes_size + residualMidBitsLength + tdps->pwrErrBoundBytes_size; 
     636 
     637                *bytes = (unsigned char *)malloc(sizeof(unsigned char)*totalByteLength); 
     638 
     639                convertTDPStoBytes_float(tdps, *bytes, dsLengthBytes, sameByte); 
     640                 
     641                *size = totalByteLength; 
     642        } 
     643        else //the case with reserved value 
     644        { 
     645                size_t residualMidBitsLength = tdps->residualMidBits == NULL ? 0 : tdps->residualMidBits_size;           
     646                size_t segmentL = 0, radExpoL = 0, pwrBoundArrayL = 0; 
     647                int minLogValueSize = 0; 
     648                if(confparams_cpr->errorBoundMode>=PW_REL) 
     649                { 
     650                        segmentL = exe_params->SZ_SIZE_TYPE; 
     651                        radExpoL = 1; 
     652                        pwrBoundArrayL = 4; 
     653                        minLogValueSize = 4; 
     654                } 
     655 
     656                size_t totalByteLength = 3 + 1 + MetaDataByteLength + exe_params->SZ_SIZE_TYPE + 4 + radExpoL + segmentL + pwrBoundArrayL + 4 + 4 + 1 + 8  
     657                                + exe_params->SZ_SIZE_TYPE + exe_params->SZ_SIZE_TYPE + exe_params->SZ_SIZE_TYPE + exe_params->SZ_SIZE_TYPE + 4 + tdps->rtypeArray_size 
     658                                + minLogValueSize + tdps->typeArray_size + tdps->leadNumArray_size 
     659                                + tdps->exactMidBytes_size + residualMidBitsLength + tdps->pwrErrBoundBytes_size; 
     660 
     661                sameByte = (unsigned char) (sameByte | 0x08); // 00001000, the 4th bit 
     662                // denotes whether it is 
     663                // with "reserved value" 
     664                 
     665                if(confparams_cpr->errorBoundMode>=PW_REL) 
     666                        sameByte = (unsigned char) (sameByte | 0x10); // 00001000, the 5th bit 
     667 
     668                *bytes = (unsigned char*)malloc(sizeof(unsigned char)*totalByteLength); 
     669 
     670                convertTDPStoBytes_float_reserve(tdps, *bytes, dsLengthBytes, sameByte); 
     671                 
     672                *size = totalByteLength; 
     673        } 
     674} 
     675 
     676void convertTDPStoFlatBytes_float_args(TightDataPointStorageF *tdps, unsigned char* bytes, size_t *size) 
     677{ 
     678        size_t i, k = 0;  
     679        unsigned char dsLengthBytes[8]; 
     680         
     681        if(exe_params->SZ_SIZE_TYPE==4) 
     682                intToBytes_bigEndian(dsLengthBytes, tdps->dataSeriesLength);//4 
     683        else 
     684                longToBytes_bigEndian(dsLengthBytes, tdps->dataSeriesLength);//8 
     685                 
     686        unsigned char sameByte = tdps->allSameData==1?(unsigned char)1:(unsigned char)0; 
     687        sameByte = sameByte | (confparams_cpr->szMode << 1); 
     688        if(tdps->isLossless) 
     689                sameByte = (unsigned char) (sameByte | 0x10); 
     690        if(confparams_cpr->errorBoundMode>=PW_REL) 
     691                sameByte = (unsigned char) (sameByte | 0x20); // 00100000, the 5th bit 
     692        if(exe_params->SZ_SIZE_TYPE==8) 
     693                sameByte = (unsigned char) (sameByte | 0x40); // 01000000, the 6th bit 
     694                 
     695        if(tdps->allSameData==1) 
     696        { 
     697                size_t totalByteLength = 3 + 1 + MetaDataByteLength + exe_params->SZ_SIZE_TYPE + tdps->exactMidBytes_size; 
     698                //*bytes = (unsigned char *)malloc(sizeof(unsigned char)*totalByteLength); 
     699 
     700                for (i = 0; i < 3; i++)//3 
     701                        bytes[k++] = versionNumber[i]; 
     702                bytes[k++] = sameByte; 
     703 
     704                convertSZParamsToBytes(confparams_cpr, &(bytes[k])); 
     705                k = k + MetaDataByteLength; 
     706 
     707                for (i = 0; i < exe_params->SZ_SIZE_TYPE; i++) 
     708                        bytes[k++] = dsLengthBytes[i];           
     709                for (i = 0; i < tdps->exactMidBytes_size; i++) 
     710                        bytes[k++] = tdps->exactMidBytes[i]; 
    577711 
    578712                *size = totalByteLength; 
     
    594728                                + tdps->exactMidBytes_size + residualMidBitsLength + tdps->pwrErrBoundBytes_size; 
    595729 
    596                 *bytes = (unsigned char *)malloc(sizeof(unsigned char)*totalByteLength); 
    597  
    598                 convertTDPStoBytes_float(tdps, *bytes, dsLengthBytes, sameByte); 
    599                  
    600                 *size = totalByteLength; 
    601         } 
    602         else //the case with reserved value 
    603         { 
    604                 size_t residualMidBitsLength = tdps->residualMidBits == NULL ? 0 : tdps->residualMidBits_size;           
    605                 size_t segmentL = 0, radExpoL = 0, pwrBoundArrayL = 0; 
    606                 if(confparams_cpr->errorBoundMode>=PW_REL) 
    607                 { 
    608                         segmentL = exe_params->SZ_SIZE_TYPE; 
    609                         radExpoL = 1; 
    610                         pwrBoundArrayL = 4; 
    611                 } 
    612  
    613                 size_t totalByteLength = 3 + 1 + MetaDataByteLength + exe_params->SZ_SIZE_TYPE + 4 + radExpoL + segmentL + pwrBoundArrayL + 4 + 4 + 1 + 8  
    614                                 + exe_params->SZ_SIZE_TYPE + exe_params->SZ_SIZE_TYPE + exe_params->SZ_SIZE_TYPE + exe_params->SZ_SIZE_TYPE + 4 + tdps->rtypeArray_size 
    615                                 + tdps->typeArray_size + tdps->leadNumArray_size 
    616                                 + tdps->exactMidBytes_size + residualMidBitsLength + tdps->pwrErrBoundBytes_size; 
    617  
    618                 sameByte = (unsigned char) (sameByte | 0x08); // 00001000, the 4th bit 
    619                 // denotes whether it is 
    620                 // with "reserved value" 
    621                  
    622                 if(confparams_cpr->errorBoundMode>=PW_REL) 
    623                         sameByte = (unsigned char) (sameByte | 0x10); // 00001000, the 5th bit 
    624  
    625                 *bytes = (unsigned char*)malloc(sizeof(unsigned char)*totalByteLength); 
    626  
    627                 convertTDPStoBytes_float_reserve(tdps, *bytes, dsLengthBytes, sameByte); 
    628                  
    629                 *size = totalByteLength; 
    630         } 
    631 } 
    632  
    633 void convertTDPStoFlatBytes_float_args(TightDataPointStorageF *tdps, unsigned char* bytes, size_t *size) 
    634 { 
    635         size_t i, k = 0;  
    636         unsigned char dsLengthBytes[8]; 
    637          
    638         if(exe_params->SZ_SIZE_TYPE==4) 
    639                 intToBytes_bigEndian(dsLengthBytes, tdps->dataSeriesLength);//4 
    640         else 
    641                 longToBytes_bigEndian(dsLengthBytes, tdps->dataSeriesLength);//8 
    642                  
    643         unsigned char sameByte = tdps->allSameData==1?(unsigned char)1:(unsigned char)0; 
    644         sameByte = sameByte | (confparams_cpr->szMode << 1); 
    645         if(tdps->isLossless) 
    646                 sameByte = (unsigned char) (sameByte | 0x10); 
    647         if(confparams_cpr->errorBoundMode>=PW_REL) 
    648                 sameByte = (unsigned char) (sameByte | 0x20); // 00100000, the 5th bit 
    649         if(exe_params->SZ_SIZE_TYPE==8) 
    650                 sameByte = (unsigned char) (sameByte | 0x40); // 01000000, the 6th bit 
    651                  
    652         if(tdps->allSameData==1) 
    653         { 
    654                 size_t totalByteLength = 3 + 1 + MetaDataByteLength + exe_params->SZ_SIZE_TYPE + tdps->exactMidBytes_size; 
    655                 //*bytes = (unsigned char *)malloc(sizeof(unsigned char)*totalByteLength); 
    656  
    657                 for (i = 0; i < 3; i++)//3 
    658                         bytes[k++] = versionNumber[i]; 
    659                 bytes[k++] = sameByte; 
    660  
    661                 convertSZParamsToBytes(confparams_cpr, &(bytes[k])); 
    662                 k = k + MetaDataByteLength; 
    663  
    664                 for (i = 0; i < exe_params->SZ_SIZE_TYPE; i++) 
    665                         bytes[k++] = dsLengthBytes[i];           
    666                 for (i = 0; i < tdps->exactMidBytes_size; i++) 
    667                         bytes[k++] = tdps->exactMidBytes[i]; 
    668  
    669                 *size = totalByteLength; 
    670         } 
    671         else if (tdps->rtypeArray == NULL) 
    672         { 
    673                 size_t residualMidBitsLength = tdps->residualMidBits == NULL ? 0 : tdps->residualMidBits_size; 
    674                 size_t segmentL = 0, radExpoL = 0, pwrBoundArrayL = 0; 
    675                 if(confparams_cpr->errorBoundMode>=PW_REL) 
    676                 {                        
    677                         segmentL = exe_params->SZ_SIZE_TYPE; 
    678                         radExpoL = 1; 
    679                         pwrBoundArrayL = 4; 
    680                 } 
    681  
    682                 size_t totalByteLength = 3 + 1 + MetaDataByteLength + exe_params->SZ_SIZE_TYPE + 4 + radExpoL + segmentL + pwrBoundArrayL + 4 + 4 + 1 + 8  
    683                                 + exe_params->SZ_SIZE_TYPE + exe_params->SZ_SIZE_TYPE + exe_params->SZ_SIZE_TYPE   
    684                                 + tdps->typeArray_size + tdps->leadNumArray_size  
    685                                 + tdps->exactMidBytes_size + residualMidBitsLength + tdps->pwrErrBoundBytes_size; 
    686  
    687730                convertTDPStoBytes_float(tdps, bytes, dsLengthBytes, sameByte); 
    688731                 
     
    722765 * */ 
    723766void free_TightDataPointStorageF(TightDataPointStorageF *tdps) 
    724 {                        
     767{ 
    725768        if(tdps->rtypeArray!=NULL) 
    726769                free(tdps->rtypeArray); 
Note: See TracChangeset for help on using the changeset viewer.