FACT++  1.0
bool CompressedFitsFile::reallocateBuffers ( )
protected

protected function to allocate the intermediate buffers

Definition at line 627 of file fitsCompressor.cc.

References _buffer, _columns, _compressedBuffer, _numRowsPerTile, _numThreads, _rowWidth, _transposedBuffer, i, and TileHeader().

Referenced by CompressedFitsWriter::addColumn(), and CompressedFitsWriter::setNumWorkingThreads().

628 {
629  if (_buffer)
630  {
631  _buffer = _buffer - 4;
632  delete[] _buffer;
633  for (uint32_t i=0;i<_compressedBuffer.size();i++)
634  {
636  delete[] _transposedBuffer[i];
637  delete[] _compressedBuffer[i];
638  }
639  }
640  _buffer = new char[_rowWidth*_numRowsPerTile + 12];
641  if (_buffer == NULL) return false;
642  memset(_buffer, 0, 4);
643  _buffer = _buffer + 4;
644  if (_compressedBuffer.size() != _numThreads)
645  {
648  }
649  for (uint32_t i=0;i<_numThreads;i++)
650  {
652  _compressedBuffer[i] = new char[_rowWidth*_numRowsPerTile + _columns.size() + sizeof(TileHeader) + 12]; //use a bit more memory for compression flags and checksumming
653  if (_transposedBuffer[i] == NULL || _compressedBuffer[i] == NULL)
654  return false;
655  //shift the compressed buffer by 4 bytes, for checksum calculation
656  memset(_compressedBuffer[i], 0, 4);
658  //initialize the tile header
659  TileHeader tileHeader;
660  memcpy(_compressedBuffer[i], &tileHeader, sizeof(TileHeader));
661  }
662  return true;
663 }
int i
Definition: db_dim_client.c:21
uint32_t _numThreads
The number of threads that will be used to compress.
vector< char * > _transposedBuffer
Memory buffer to store rows while they are transposed.
uint32_t _rowWidth
Total number of bytes in one row.
char * _buffer
Memory buffer to store rows while they are not compressed.
vector< ColumnEntry > _columns
Columns in the file.
uint32_t _numRowsPerTile
Number of rows per tile.
TileHeader()
Definition: FITS.h:75
vector< char * > _compressedBuffer
Memory buffer to store rows while they are compressed.

+ Here is the call graph for this function:

+ Here is the caller graph for this function: