Changeset 17674
- Timestamp:
- 04/17/14 08:32:33 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/fitsCompressor.cc
r17006 r17674 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; … … 1580 1555 return -1; 1581 1556 } 1582 fileNameOut = fileNameIn .substr(0, pos)+ ".fz";1557 fileNameOut = fileNameIn + ".fz"; 1583 1558 } 1584 1559 … … 1710 1685 //get header structures 1711 1686 BlockHeader rawHeader; 1712 BlockHeader smoothmanHeader(0, zfits::kOrderByRow, 2);1687 BlockHeader smoothmanHeader(0, FITS::kOrderByRow, 2); 1713 1688 vector<uint16_t> rawProcessings(1); 1714 rawProcessings[0] = zfits::kFactRaw;1689 rawProcessings[0] = FITS::kFactRaw; 1715 1690 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; 1718 1693 // smoothmanProcessings[2] = FACT_RAW; 1719 1694
Note:
See TracChangeset
for help on using the changeset viewer.