FACT++  1.0
bool zfits::UncompressBuffer ( const std::vector< size_t > &  offsets,
const uint32_t &  thisRoundNumRows,
const uint32_t  offset 
)
inlineprivate

Definition at line 503 of file zfits.h.

References ___err___, BlockHeader(), clear(), fits::fTable, gLog, i, FITS::kFactHuffman16, FITS::kFactRaw, FITS::kFactSmoothing, FITS::kOrderByCol, FITS::kOrderByRow, fits::Table::Column::num, FITS::BlockHeader::numProcs, numRows, FITS::BlockHeader::ordering, FITS::BlockHeader::processings, fits::Table::Column::size, fits::Table::sorted_cols, str, UnApplySMOOTHING(), UncompressHUFFMAN16(), and UncompressUNCOMPRESSED().

Referenced by ReadBinaryRow().

506  {
507  char *dest = fTransposedBuffer.data();
508 
509  //uncompress column by column
510  for (uint32_t i=0; i<fTable.sorted_cols.size(); i++)
511  {
512  const fits::Table::Column &col = fTable.sorted_cols[i];
513  if (col.num == 0)
514  continue;
515 
516  //get the compression flag
517  const int64_t compressedOffset = offsets[i]+offset;
518 
519  const FITS::BlockHeader* head = reinterpret_cast<FITS::BlockHeader*>(&fCompressedBuffer[compressedOffset]);
520 
521  fColumnOrdering[i] = head->ordering;
522 
523  const uint32_t numRows = (head->ordering==FITS::kOrderByRow) ? thisRoundNumRows : col.num;
524  const uint32_t numCols = (head->ordering==FITS::kOrderByCol) ? thisRoundNumRows : col.num;
525 
526  const char *src = fCompressedBuffer.data()+compressedOffset+sizeof(FITS::BlockHeader)+sizeof(uint16_t)*head->numProcs;
527 
528  for (int32_t j=head->numProcs-1;j >= 0; j--)
529  {
530  uint32_t sizeWritten=0;
531 
532  switch (head->processings[j])
533  {
534  case FITS::kFactRaw:
535  sizeWritten = UncompressUNCOMPRESSED(dest, src, numRows*numCols, col.size);
536  break;
537 
539  sizeWritten = UnApplySMOOTHING(reinterpret_cast<int16_t*>(dest), numRows*numCols);
540  break;
541 
543  sizeWritten = UncompressHUFFMAN16(dest, src, numRows);
544  break;
545 
546  default:
547  clear(rdstate()|std::ios::badbit);
548 
549  std::ostringstream str;
550  str << "Unknown processing applied to data (col=" << i << ", proc=" << j << "/" << (int)head->numProcs;
551 #ifdef __EXCEPTIONS
552  throw std::runtime_error(str.str());
553 #else
554  gLog << ___err___ << "ERROR - " << str.str() << std::endl;
555  return false;
556 #endif
557  }
558  //increment destination counter only when processing done.
559  if (j==0)
560  dest+= sizeWritten;
561  }
562  }
563 
564  return true;
565  }
std::vector< char > fTransposedBuffer
intermediate buffer to transpose the rows
Definition: zfits.h:138
unsigned char numProcs
Definition: FITS.h:132
uint32_t UncompressHUFFMAN16(char *dest, const char *src, uint32_t numChunks)
Definition: zfits.h:466
int i
Definition: db_dim_client.c:21
char str[80]
Definition: test_client.c:7
uint32_t UncompressUNCOMPRESSED(char *dest, const char *src, uint32_t numElems, uint32_t sizeOfElems)
Definition: zfits.h:456
SortedColumns sorted_cols
Definition: fits.h:117
#define gLog
Definition: fits.h:36
BlockHeader(uint64_t s=0, char o=kOrderByRow, unsigned char n=1)
Definition: FITS.h:76
#define ___err___
Definition: fits.h:37
Table fTable
Definition: fits.h:502
std::vector< char > fColumnOrdering
ordering of the column&#39;s rows. Can change from tile to tile.
Definition: zfits.h:140
uint16_t processings[]
Definition: FITS.h:133
std::vector< char > fCompressedBuffer
compressed rows
Definition: zfits.h:139
char ordering
Definition: FITS.h:131
uint32_t UnApplySMOOTHING(int16_t *data, uint32_t numElems)
Definition: zfits.h:492
void clear()
Definition: HeadersFTM.h:216
uint32_t numRows
Definition: FITS.h:72

+ Here is the call graph for this function:

+ Here is the caller graph for this function: