Changeset 16867 for trunk/Mars/mcore/zfits.h
- Timestamp:
- 06/19/13 12:47:49 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/mcore/zfits.h
r16856 r16867 14 14 #include "huffman.h" 15 15 16 /* 17 #define FACT_RAW 0x0 18 #define FACT_SMOOTHING 0x1 19 #define FACT_HUFFMAN16 0x2 20 21 #define FACT_COL_MAJOR 'C' 22 #define FACT_ROW_MAJOR 'R' 23 */ 24 16 25 17 26 #ifndef __MARS__ … … 19 28 { 20 29 #endif 30 31 enum FACT_COMPRESSION_PROCESS 32 { 33 FACT_RAW = 0x0, 34 FACT_SMOOTHING = 0x1, 35 FACT_HUFFMAN16 = 0x2 36 }; 37 38 enum FACT_ROW_ORDERING 39 { 40 FACT_COL_MAJOR = 'C', 41 FACT_ROW_MAJOR = 'R' 42 }; 21 43 22 44 class zfits : public fits … … 57 79 return true; 58 80 } 81 59 82 protected: 60 83 … … 99 122 100 123 BlockHeader(uint64_t s=0, 101 char o= 'R'/*FACT_ROW_MAJOR*/,124 char o=FACT_ROW_MAJOR, 102 125 unsigned char n=1) : size(s), 103 126 ordering(o), … … 131 154 fColumnOrdering.resize(fTable.sortedCols.size()); 132 155 for (auto it=fColumnOrdering.begin(); it != fColumnOrdering.end(); it++) 133 (*it) = 'R';//FACT_ROW_MAJOR; 134 156 (*it) = FACT_ROW_MAJOR; 135 157 //Get compressed specific keywords 136 158 fNumTiles = fTable.isCompressed ? GetInt("NAXIS2") : 0; … … 272 294 //skip to the beginning of the tile 273 295 seekg(fHeapOff+fCatalog[requestedTile][0].second - sizeof(TileHeader)); 274 275 296 TileHeader tHead; 276 297 read((char*)(&tHead), sizeof(TileHeader)); … … 305 326 switch (fColumnOrdering[i]) 306 327 { 307 case 'R': //FACT_ROW_MAJOR:328 case FACT_ROW_MAJOR: 308 329 // regular, "semi-transposed" copy 309 330 for (char *dest=buffer; dest<buffer+thisRoundNumRows*fTable.bytes_per_row; dest+=fTable.bytes_per_row) // row-by-row … … 314 335 break; 315 336 316 case 'C'://FACT_COL_MAJOR:337 case FACT_COL_MAJOR: 317 338 // transposed copy 318 339 for (char *elem=buffer; elem<buffer+it->bytes; elem+=it->size) // element-by-element (arrays) … … 328 349 clear(rdstate()|ios::badbit); 329 350 #ifdef __EXCEPTIONS 330 throw runtime_error("Unkown column ordering scheme ");351 throw runtime_error("Unkown column ordering scheme found"); 331 352 #else 332 353 gLog << ___err___ << "ERROR - unkown column ordering scheme" << endl; … … 410 431 fColumnOrdering[i] = head->ordering; 411 432 412 const uint32_t numRows = (head->ordering== 'R'/*FACT_ROW_MAJOR*/) ? thisRoundNumRows : col.num;413 const uint32_t numCols = (head->ordering== 'C'/*FACT_COL_MAJOR*/) ? thisRoundNumRows : col.num;433 const uint32_t numRows = (head->ordering==FACT_ROW_MAJOR) ? thisRoundNumRows : col.num; 434 const uint32_t numCols = (head->ordering==FACT_COL_MAJOR) ? thisRoundNumRows : col.num; 414 435 415 436 const char *src = fCompressedBuffer.data()+compressedOffset+sizeof(BlockHeader)+sizeof(uint16_t)*head->numProcs; … … 421 442 switch (head->processings[j]) 422 443 { 423 case 0x0://FACT_RAW:444 case FACT_RAW: 424 445 sizeWritten = UncompressUNCOMPRESSED(dest, src, numRows*numCols, col.size); 425 446 break; 426 case 0x1://FACT_SMOOTHING:447 case FACT_SMOOTHING: 427 448 sizeWritten = UnApplySMOOTHING(reinterpret_cast<int16_t*>(dest), numRows*numCols); 428 449 break; 429 case 0x2://FACT_HUFFMAN16:450 case FACT_HUFFMAN16: 430 451 sizeWritten = UncompressHUFFMAN16(dest, src, numRows); 431 452 break; … … 477 498 478 499 //a new tile begins here 479 catalog. emplace_back(0);//push_back(vector<pair<int64_t, int64_t> >(0));500 catalog.push_back(vector<pair<int64_t, int64_t> >(0)); 480 501 offsetInHeap += sizeof(TileHeader); 481 502 … … 486 507 if (fTable.sortedCols[i].num == 0) 487 508 { 488 catalog.back(). emplace_back(0,0);509 catalog.back().push_back(make_pair(0,0)); 489 510 continue; 490 511 } … … 494 515 if (!good()) 495 516 break; 496 catalog.back().emplace_back( int64_t(columnHead.size),offsetInHeap);517 catalog.back().emplace_back((int64_t)(columnHead.size),offsetInHeap); 497 518 offsetInHeap += columnHead.size; 498 519 seekg(fHeapOff+offsetInHeap);
Note:
See TracChangeset
for help on using the changeset viewer.