15 #ifndef THRILL_CORE_GOLOMB_BIT_STREAM_HEADER 16 #define THRILL_CORE_GOLOMB_BIT_STREAM_HEADER 28 template <
typename BlockWriter>
40 :
Super(block_writer),
44 die_unless(block_writer.block_size() %
sizeof(size_t) == 0);
62 assert(Super::pos_ == 0);
81 size_t q = value /
b_;
82 size_t r = value - (q *
b_);
117 res = (res << (
log2b_ - 1)) | r;
144 template <
typename BlockReader>
154 :
Super(block_reader),
171 return Super::block_reader_.HasNext();
173 return Super::HasNextZeroTest();
179 return Super::block_reader_.template GetRaw<size_t>();
182 size_t q = Super::GetNumberOfOnesUntilNextZero();
183 size_t r = Super::GetBits(
log2b_ - 1);
191 template <
typename Type2>
217 #endif // !THRILL_CORE_GOLOMB_BIT_STREAM_HEADER
size_t max_little_value_
escape value
BlockWriter & block_writer_
Output BlockWriter.
GolombBitStreamWriter(BlockWriter &block_writer, const size_t &b)
size_t b_
Golomb code parameter.
GolombBitStreamReader(BlockReader &block_reader, const size_t &b)
void PutBits(const size_t &value, unsigned bits)
Append k bits to the data array.
static unsigned integer_log2_ceil(int i)
calculate the log2 floor of an integer type
size_t max_little_value_
escape value
size_t pos_
currently filled number of bits
GolombBitStreamWriter & operator=(const GolombBitStreamWriter &)=delete
non-copyable: delete assignment operator
bool first_call_
false, when PutGolomb_in was called already
size_t b_
Golomb code parameter.
void PutGolomb(const size_t &value)
Append new Golomb-encoded value to bitset.