Changeset 17675
- Timestamp:
- 04/17/14 08:40:32 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/fitsDecompressor.cc
r17007 r17675 19 19 20 20 using namespace std; 21 22 typedef struct TileHeader23 {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 BlockHeader35 {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;46 21 47 22 class CompressedFitsFile … … 1200 1175 switch (_columns[i].getColumnOrdering())//getCompression()) 1201 1176 { 1202 case zfits::kOrderByRow:1177 case FITS::kOrderByRow: 1203 1178 for (uint32_t k=0;k<thisRoundNumRows;k++) 1204 1179 {//regular, "semi-transposed" copy … … 1208 1183 break; 1209 1184 1210 case zfits::kOrderByCol :1185 case FITS::kOrderByCol : 1211 1186 for (int j=0;j<_columns[i].numElems();j++) 1212 1187 for (uint32_t k=0;k<thisRoundNumRows;k++) … … 1348 1323 switch (sequence[j]) 1349 1324 { 1350 case zfits::kFactRaw:1325 case FITS::kFactRaw: 1351 1326 // if (head.numProcs == 1) 1352 1327 compressedOffset += compressUNCOMPRESSED(&(_compressedBuffer[threadIndex][compressedOffset]), &(_transposedBuffer[threadIndex][offset]), thisRoundNumRows, _columns[i].sizeOfElems(), _columns[i].numElems()); 1353 1328 break; 1354 case zfits::kFactSmoothing:1329 case FITS::kFactSmoothing: 1355 1330 applySMOOTHING(&(_compressedBuffer[threadIndex][compressedOffset]), &(_transposedBuffer[threadIndex][offset]), thisRoundNumRows, _columns[i].sizeOfElems(), _columns[i].numElems()); 1356 1331 break; 1357 case zfits::kFactHuffman16:1358 if (head.ordering == zfits::kOrderByCol)1332 case FITS::kFactHuffman16: 1333 if (head.ordering == FITS::kOrderByCol) 1359 1334 compressedOffset += compressHUFFMAN(&(_compressedBuffer[threadIndex][compressedOffset]), &(_transposedBuffer[threadIndex][offset]), thisRoundNumRows, _columns[i].sizeOfElems(), _columns[i].numElems()); 1360 1335 else … … 1368 1343 1369 1344 //check if compressed size is larger than uncompressed 1370 if (sequence[0] != zfits::kFactRaw &&1345 if (sequence[0] != FITS::kFactRaw && 1371 1346 compressedOffset - previousOffset > _columns[i].sizeOfElems()*_columns[i].numElems()*thisRoundNumRows+sizeof(BlockHeader)+sizeof(uint16_t)*sequence.size()) 1372 1347 {//if so set flag and redo it uncompressed … … 1377 1352 he.size = compressedOffset - previousOffset; 1378 1353 he.numProcs = 1; 1379 he.ordering = zfits::kOrderByRow;1354 he.ordering = FITS::kOrderByRow; 1380 1355 memcpy(&(_compressedBuffer[threadIndex][previousOffset]), (char*)(&he), sizeof(BlockHeader)); 1381 _compressedBuffer[threadIndex][previousOffset+sizeof(BlockHeader)] = zfits::kFactRaw;1356 _compressedBuffer[threadIndex][previousOffset+sizeof(BlockHeader)] = FITS::kFactRaw; 1382 1357 offset += thisRoundNumRows*_columns[i].sizeOfElems()*_columns[i].numElems(); 1383 1358 _catalog[currentCatalogRow][i].first = compressedOffset - _catalog[currentCatalogRow][i].second;
Note:
See TracChangeset
for help on using the changeset viewer.