示例#1
0
    bool nextImpl() override
    {
        size_t size_decompressed;
        size_t size_compressed_without_checksum;
        size_compressed = readCompressedData(size_decompressed, size_compressed_without_checksum);
        if (!size_compressed)
            return false;

        memory.resize(size_decompressed + LZ4::ADDITIONAL_BYTES_AT_END_OF_BUFFER);
        working_buffer = Buffer(&memory[0], &memory[size_decompressed]);

        decompress(working_buffer.begin(), size_decompressed, size_compressed_without_checksum);

        return true;
    }
示例#2
0
void ThreadedDyscoColumn<DataType>::loadBlock(size_t blockIndex)
{
	if(blockIndex < nBlocksInFile())
	{
		readCompressedData(blockIndex, _packedBlockReadBuffer.data(), _blockSize);
		const size_t nPolarizations = _shape[0], nChannels = _shape[1],
			nRows = nRowsInBlock(),
			nMetaFloats = metaDataFloatCount(nRows, nPolarizations, nChannels, _antennaCount);
		unsigned char* symbolStart = _packedBlockReadBuffer.data() + nMetaFloats*sizeof(float);
		BytePacker::unpack(_bitsPerSymbol, _unpackedSymbolReadBuffer.data(), symbolStart, symbolCount(nRows, nPolarizations, nChannels));
		float* metaData = reinterpret_cast<float*>(_packedBlockReadBuffer.data());
		initializeDecode(_timeBlockBuffer.get(), metaData, nRows, _antennaCount);
		uint64_t startRow = getRowIndex(blockIndex);
		_timeBlockBuffer->resize(nRows);
		for(size_t blockRow=0; blockRow!=nRows; ++blockRow)
		{
			int a1 = (*_ant1Col)(startRow + blockRow), a2 = (*_ant2Col)(startRow + blockRow);
			decode(_timeBlockBuffer.get(), _unpackedSymbolReadBuffer.data(), blockRow, a1, a2);
		}
	}
	_currentBlock = blockIndex;
	_isCurrentBlockChanged = false;
}