Changeset 17674 for trunk/FACT++/src


Ignore:
Timestamp:
04/17/14 08:32:33 (11 years ago)
Author:
lyard
Message:
modified the fitsCompressor code to take into account the refactoring of the fits classes, namely the introduction of FITS.h
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/fitsCompressor.cc

    r17006 r17674  
    1919
    2020using namespace std;
    21 
    22 typedef struct TileHeader
    23 {
    24   char     id[4];
    25   uint32_t numRows;
    26   uint64_t size;
    27   TileHeader(uint32_t nRows=0,
    28              uint64_t s=0) : id({'T', 'I', 'L', 'E'}),
    29                              numRows(nRows),
    30                              size(s)
    31   { };
    32 } __attribute__((__packed__)) TileHeader;
    33 
    34 typedef struct BlockHeader
    35 {
    36     uint64_t      size;
    37     char          ordering;
    38     unsigned char numProcs;
    39     BlockHeader(uint64_t      s=0,
    40                 char          o=zfits::kOrderByRow,
    41                 unsigned char n=1) : size(s),
    42                                      ordering(o),
    43                                      numProcs(n)
    44     {}
    45 } __attribute__((__packed__)) BlockHeader;
    4621
    4722class CompressedFitsFile
     
    12001175        switch (_columns[i].getColumnOrdering())//getCompression())
    12011176        {
    1202             case zfits::kOrderByRow:
     1177            case FITS::kOrderByRow:
    12031178                for (uint32_t k=0;k<thisRoundNumRows;k++)
    12041179                {//regular, "semi-transposed" copy
     
    12081183            break;
    12091184
    1210             case zfits::kOrderByCol :
     1185            case FITS::kOrderByCol :
    12111186                for (int j=0;j<_columns[i].numElems();j++)
    12121187                    for (uint32_t k=0;k<thisRoundNumRows;k++)
     
    13481323            switch (sequence[j])
    13491324            {
    1350                 case zfits::kFactRaw:
     1325                case FITS::kFactRaw:
    13511326//                    if (head.numProcs == 1)
    13521327                        compressedOffset += compressUNCOMPRESSED(&(_compressedBuffer[threadIndex][compressedOffset]), &(_transposedBuffer[threadIndex][offset]), thisRoundNumRows, _columns[i].sizeOfElems(), _columns[i].numElems());
    13531328                break;
    1354                 case zfits::kFactSmoothing:
     1329                case FITS::kFactSmoothing:
    13551330                        applySMOOTHING(&(_compressedBuffer[threadIndex][compressedOffset]), &(_transposedBuffer[threadIndex][offset]), thisRoundNumRows, _columns[i].sizeOfElems(), _columns[i].numElems());
    13561331                break;
    1357                 case zfits::kFactHuffman16:
    1358                     if (head.ordering == zfits::kOrderByCol)
     1332                case FITS::kFactHuffman16:
     1333                    if (head.ordering == FITS::kOrderByCol)
    13591334                        compressedOffset += compressHUFFMAN(&(_compressedBuffer[threadIndex][compressedOffset]), &(_transposedBuffer[threadIndex][offset]), thisRoundNumRows, _columns[i].sizeOfElems(), _columns[i].numElems());
    13601335                    else
     
    13681343
    13691344        //check if compressed size is larger than uncompressed
    1370         if (sequence[0] != zfits::kFactRaw &&
     1345        if (sequence[0] != FITS::kFactRaw &&
    13711346            compressedOffset - previousOffset > _columns[i].sizeOfElems()*_columns[i].numElems()*thisRoundNumRows+sizeof(BlockHeader)+sizeof(uint16_t)*sequence.size())
    13721347        {//if so set flag and redo it uncompressed
     
    13771352            he.size = compressedOffset - previousOffset;
    13781353            he.numProcs = 1;
    1379             he.ordering = zfits::kOrderByRow;
     1354            he.ordering = FITS::kOrderByRow;
    13801355            memcpy(&(_compressedBuffer[threadIndex][previousOffset]), (char*)(&he), sizeof(BlockHeader));
    1381             _compressedBuffer[threadIndex][previousOffset+sizeof(BlockHeader)] = zfits::kFactRaw;
     1356            _compressedBuffer[threadIndex][previousOffset+sizeof(BlockHeader)] = FITS::kFactRaw;
    13821357            offset += thisRoundNumRows*_columns[i].sizeOfElems()*_columns[i].numElems();
    13831358           _catalog[currentCatalogRow][i].first = compressedOffset - _catalog[currentCatalogRow][i].second;
     
    15801555            return -1;
    15811556        }
    1582         fileNameOut = fileNameIn.substr(0, pos) + ".fz";
     1557        fileNameOut = fileNameIn + ".fz";
    15831558    }
    15841559
     
    17101685        //get header structures
    17111686        BlockHeader rawHeader;
    1712         BlockHeader smoothmanHeader(0, zfits::kOrderByRow, 2);
     1687        BlockHeader smoothmanHeader(0, FITS::kOrderByRow, 2);
    17131688        vector<uint16_t> rawProcessings(1);
    1714         rawProcessings[0] = zfits::kFactRaw;
     1689        rawProcessings[0] = FITS::kFactRaw;
    17151690        vector<uint16_t> smoothmanProcessings(2);
    1716         smoothmanProcessings[0] = zfits::kFactSmoothing;
    1717         smoothmanProcessings[1] = zfits::kFactHuffman16;
     1691        smoothmanProcessings[0] = FITS::kFactSmoothing;
     1692        smoothmanProcessings[1] = FITS::kFactHuffman16;
    17181693//        smoothmanProcessings[2] = FACT_RAW;
    17191694
Note: See TracChangeset for help on using the changeset viewer.