Changeset 17262 for trunk/Mars
- Timestamp:
- 10/18/13 16:56:16 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/mcore/zofits.h
r17258 r17262 21 21 namespace std 22 22 { 23 #else24 using namespace std;25 23 #endif 26 24 … … 478 476 for (auto it=fCatalog.begin(); it!= fCatalog.end(); it++) 479 477 { 480 compressed_offset += sizeof( TileHeader);481 heap_size += sizeof( TileHeader);478 compressed_offset += sizeof(FITS::TileHeader); 479 heap_size += sizeof(FITS::TileHeader); 482 480 for (uint32_t j=0; j<it->size(); j++) 483 481 { … … 539 537 bool AddColumn(uint32_t cnt, char typechar, const string& name, const string& unit, const string& comment="", bool addHeaderKeys=true) 540 538 { 541 return AddColumn( kFactRaw, cnt, typechar, name, unit, comment, addHeaderKeys);539 return AddColumn(FITS::kFactRaw, cnt, typechar, name, unit, comment, addHeaderKeys); 542 540 } 543 541 … … 612 610 void reallocateBuffers() 613 611 { 614 const size_t chunk_size = fRealRowWidth*fNumRowsPerTile + fRealColumns.size()*sizeof( BlockHeader) + sizeof(TileHeader) + 8; //+8 for checksuming;612 const size_t chunk_size = fRealRowWidth*fNumRowsPerTile + fRealColumns.size()*sizeof(FITS::BlockHeader) + sizeof(FITS::TileHeader) + 8; //+8 for checksuming; 615 613 fMemPool.setChunkSize(chunk_size); 616 614 … … 741 739 uint64_t compressBuffer(char* dest, char* src, uint32_t num_rows, CatalogRow& catalog_row) 742 740 { 743 const uint32_t thisRoundNumRows 744 uint32_t offset 741 const uint32_t thisRoundNumRows = (num_rows%fNumRowsPerTile) ? num_rows%fNumRowsPerTile : fNumRowsPerTile; 742 uint32_t offset = 0; 745 743 746 744 //skip the checksum reserved area … … 748 746 749 747 //skip the 'TILE' marker and tile size entry 750 uint64_t compressedOffset = sizeof( TileHeader);748 uint64_t compressedOffset = sizeof(FITS::TileHeader); 751 749 752 750 //now compress each column one by one by calling compression on arrays … … 758 756 continue; 759 757 760 Compression& head = fRealColumns[i].block_head;758 FITS::Compression& head = fRealColumns[i].block_head; 761 759 762 760 //set the default byte telling if uncompressed the compressed Flag … … 770 768 switch (head.getProc(j)) 771 769 { 772 case kFactRaw:770 case FITS::kFactRaw: 773 771 compressedOffset += compressUNCOMPRESSED(dest + compressedOffset, src + offset, thisRoundNumRows*fRealColumns[i].col.size*fRealColumns[i].col.num); 774 772 break; 775 773 776 case kFactSmoothing:774 case FITS::kFactSmoothing: 777 775 applySMOOTHING(src + offset, thisRoundNumRows*fRealColumns[i].col.num); 778 776 break; 779 777 780 case kFactHuffman16:781 if (head.getOrdering() == kOrderByCol)778 case FITS::kFactHuffman16: 779 if (head.getOrdering() == FITS::kOrderByCol) 782 780 compressedOffset += compressHUFFMAN16(dest + compressedOffset, src + offset, thisRoundNumRows, fRealColumns[i].col.size, fRealColumns[i].col.num); 783 781 else … … 787 785 } 788 786 789 //check if compressed size is larger than uncompressed 790 if ((head.getProc(0) != kFactRaw) && (compressedOffset - previousOffset > fRealColumns[i].col.size*fRealColumns[i].col.num*thisRoundNumRows+head.getSizeOnDisk()))// && two) 791 {//if so set flag and redo it uncompressed 787 //check if compressed size is larger than uncompressed 788 //if so set flag and redo it uncompressed 789 if ((head.getProc(0) != FITS::kFactRaw) && (compressedOffset - previousOffset > fRealColumns[i].col.size*fRealColumns[i].col.num*thisRoundNumRows+head.getSizeOnDisk()))// && two) 790 { 792 791 //de-smooth ! 793 if (head.getProc(0) == kFactSmoothing)792 if (head.getProc(0) == FITS::kFactSmoothing) 794 793 UnApplySMOOTHING(src+offset, fRealColumns[i].col.num*thisRoundNumRows); 795 794 796 Compression he;795 FITS::Compression he; 797 796 798 797 compressedOffset = previousOffset + he.getSizeOnDisk(); … … 815 814 } 816 815 817 const TileHeader tile_head(thisRoundNumRows, compressedOffset);818 memcpy(dest, &tile_head, sizeof( TileHeader));816 const FITS::TileHeader tile_head(thisRoundNumRows, compressedOffset); 817 memcpy(dest, &tile_head, sizeof(FITS::TileHeader)); 819 818 820 819 return compressedOffset; … … 833 832 switch (fRealColumns[i].block_head.getOrdering()) 834 833 { 835 case kOrderByRow:834 case FITS::kOrderByRow: 836 835 //regular, "semi-transposed" copy 837 836 for (uint32_t k=0;k<thisRoundNumRows;k++) … … 842 841 break; 843 842 844 case kOrderByCol:843 case FITS::kOrderByCol: 845 844 //transposed copy 846 845 for (uint32_t j=0;j<fRealColumns[i].col.num;j++) … … 965 964 struct CompressedColumn 966 965 { 967 CompressedColumn(const Table::Column& c, const Compression& h) : col(c),966 CompressedColumn(const Table::Column& c, const FITS::Compression& h) : col(c), 968 967 block_head(h) 969 968 {} 970 Table::Column col; ///< the regular column entry971 Compressionblock_head; ///< the compression data associated with that column969 Table::Column col; ///< the regular column entry 970 FITS::Compression block_head; ///< the compression data associated with that column 972 971 }; 973 972 vector<CompressedColumn> fRealColumns; ///< Vector hosting the columns of the file
Note:
See TracChangeset
for help on using the changeset viewer.