本文整理汇总了C++中BitStream::GetWord方法的典型用法代码示例。如果您正苦于以下问题:C++ BitStream::GetWord方法的具体用法?C++ BitStream::GetWord怎么用?C++ BitStream::GetWord使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitStream
的用法示例。
在下文中一共展示了BitStream::GetWord方法的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;
}
示例2: Read
//.........这里部分代码省略.........
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;
rec.quality_breaks = NULL;
}
bit_stream.GetBits(tmp, line_breaks_bits);
while (tmp != 0)
{
if (!rec.quality_breaks)
{
rec.quality_breaks = new std::vector<int>;
}
rec.quality_breaks->push_back(tmp);
bit_stream.GetBits(tmp, line_breaks_bits);
}
}
}
bit_stream.FlushInputWordBuffer();
bool is_num_fields_constant = (fastq_flags & FLAG_CONST_NUM_FIELDS) != 0;
ReadTitle(bit_stream, fields, n_fields, block_no, is_num_fields_constant);
if (quality_stats_mode == QUALITY_RLE)
{
ReadQualityRLE(bit_stream, qualities, Huffman_qua, n_qualities, Huffman_run, max_run_len);
MakeUnRLE();
}
else
{
bool use_trunc_h = quality_stats_mode == QUALITY_PLAIN_TRUNC;
bool uses_const_delta = (fastq_flags & (FLAG_USE_DELTA | FLAG_DELTA_CONSTANT)) == (FLAG_USE_DELTA | FLAG_DELTA_CONSTANT);
ReadQualityPlain(bit_stream, qualities, Huffman_qua, n_qualities, use_trunc_h, uses_const_delta);
}
bool try_lz = (fastq_flags & FLAG_TRY_LZ) != 0;
if ((fastq_flags & FLAG_DNA_PLAIN) != 0)
{
ReadDNAPlain(bit_stream, lz_matcher, symbols, try_lz, extracting);
}
else
{
ReadDNAHuf(bit_stream, lz_matcher, symbols, Huffman_sym, try_lz, extracting); // lz_matches not supported when Huffman encoding
}
#if (D_COMPUTE_RECORDS_CRC_PER_BLOCK)
uint32 hash;
bit_stream.GetWord(hash);
my_assert(hash == ComputeRecordsCrc32());
#endif
}