当前位置: 首页>>代码示例>>C++>>正文


C++ BitStream::GetBytes方法代码示例

本文整理汇总了C++中BitStream::GetBytes方法的典型用法代码示例。如果您正苦于以下问题:C++ BitStream::GetBytes方法的具体用法?C++ BitStream::GetBytes怎么用?C++ BitStream::GetBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BitStream的用法示例。


在下文中一共展示了BitStream::GetBytes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: LoadTree

// ********************************************************************************************
void HuffmanEncoder::LoadTree(BitStream& bit_stream, HuffmanEncoder& tree)
{
	static uchar* mem_buf = NULL;
	static uint32 mem_size;

	bit_stream.FlushInputWordBuffer();

	bit_stream.GetWord(mem_size);
	my_assert(mem_size > 0);
	mem_buf = new uchar[mem_size];
	bit_stream.GetBytes(mem_buf, mem_size);
	tree.LoadTree(mem_buf, mem_size);

	delete [] mem_buf;
}
开发者ID:PCDS,项目名称:paraDSRC,代码行数:16,代码来源:huffman.cpp

示例2: Read

// ********************************************************************************************
void Block::Read(BitStream &bit_stream, LzMatcher &lz_matcher, std::vector<Field> &fields, uint32 n_fields,
	uint32 fastq_flags, std::vector<uchar> &symbols, HuffmanEncoder *Huffman_sym,
	std::vector<uchar> &qualities, std::vector<HuffmanEncoder*> &Huffman_qua, 
	uint32 max_run_len, std::vector<HuffmanEncoder*> &Huffman_run, uint32 n_qualities, 
	uint32 _global_max_sequence_length, uint32 max_quality_length, uint32 block_no, 
	uint32 quality_stats_mode, bool extracting)
{
	global_max_sequence_length = _global_max_sequence_length;

#if (D_RESERVE_BYTES_PER_BLOCK)
	{
		uchar bytes[Block::RESERVED_BYTES];
		bit_stream.GetBytes(bytes, Block::RESERVED_BYTES);
		for (uint32 i = 0; i < Block::RESERVED_BYTES; ++i)
		{
			my_assert(bytes[i] == INVALID_BYTE);
		}
	}
#endif

	no_of_amb.resize(rec_count);
	for (uint32 i = 0; i < rec_count; ++i)
	{
		records[i].Reset();
		no_of_amb[i] = 0;
	}

	int32 quality_len_bits = BitStream::BitLength(max_quality_length);
	if ((fastq_flags & FLAG_PLUS_ONLY) == 0)
	{
		for (uint32 i = 0; i < rec_count; ++i)
		{
			bit_stream.GetBit(records[i].plus_len);
		}
	}
	else
	{
		for (uint32 i = 0; i < rec_count; ++i)
		{
			records[i].plus_len = 1;
		}
	}

	if ((fastq_flags & FLAG_VARIABLE_LENGTH) != 0)
	{
		uint32 tmp;
		for (uint32 i = 0; i < rec_count; ++i)
		{
			FastqRecord& rec = records[i];
			bit_stream.GetBits(tmp, quality_len_bits);
			rec.quality_len = tmp;
			rec.ExtendTo(rec.quality, rec.quality_size, tmp+2);
			rec.sequence_len = tmp;
			rec.ExtendTo(rec.sequence, rec.sequence_size, tmp+2);
		}
	}
	else
	{
		for (uint32 i = 0; i < rec_count; ++i)
		{
			FastqRecord& rec = records[i];
			rec.quality_len = max_quality_length;
			rec.ExtendTo(rec.quality, rec.quality_size, max_quality_length+2);
			rec.sequence_len = global_max_sequence_length;
			rec.ExtendTo(rec.sequence, rec.sequence_size, global_max_sequence_length+2);
		}
	}

	if ((fastq_flags & FLAG_LINE_BREAKS) != 0)
	{
		uint32 line_breaks_bits;
		bit_stream.GetBits(line_breaks_bits, 5);
		uint32 tmp;

		for (uint32 i = 0; i < rec_count; ++i)
		{
			FastqRecord& rec = records[i];
			if (rec.sequence_breaks)
			{
				delete rec.sequence_breaks;
				rec.sequence_breaks = NULL;
			}

			bit_stream.GetBits(tmp, line_breaks_bits);
			while (tmp != 0)
			{
				if (!rec.sequence_breaks)
				{
					rec.sequence_breaks = new std::vector<int>;
				}
				rec.sequence_breaks->push_back(tmp);

				bit_stream.GetBits(tmp, line_breaks_bits);
			}


			if (rec.quality_breaks)
			{
				delete rec.quality_breaks;
//.........这里部分代码省略.........
开发者ID:PCDS,项目名称:paraDSRC,代码行数:101,代码来源:block.cpp


注:本文中的BitStream::GetBytes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。