|
ADS
Algorithms and Data Structures
|
The bits of the compressors of this folder, packed in bytes, since their input and their output are streams of bytes: a PackedBitWriter appends bits, the first one in the most significant bit of the first byte, and a PackedBitReader reads them back in the same order. More...
#include "ADS/Contract.h"#include <algorithm>#include <cstddef>#include <cstdint>#include <span>#include <string>#include <vector>#include "ADS/compression/impl/PackedBits.tpp"Go to the source code of this file.
Classes | |
| class | ADS::PackedBitWriter |
| a growing sequence of bits, packed in bytes, the first bit in the most significant bit of the first byte More... | |
| class | ADS::PackedBitReader |
| reads the bits of a sequence of bytes in the order of a PackedBitWriter, and zeros past its end More... | |
Namespaces | |
| namespace | ADS |
The bits of the compressors of this folder, packed in bytes, since their input and their output are streams of bytes: a PackedBitWriter appends bits, the first one in the most significant bit of the first byte, and a PackedBitReader reads them back in the same order.
A code of \( k \) bits goes in with one call, the most significant bit first, so that the value of the bits read so far is the integer whose binary digits they are; this is the order in which the canonical code of Huffman [see CanonicalHuffman.h] and the arithmetic coder [see ArithmeticCoding.h] read their input, one bit at a time, and in which a dyadic fraction \( v / 2^k \) is written as \( 0.b_1 b_2 \ldots b_k \). The last byte is padded with zeros, and a PackedBitReader gives zeros past the end of its bytes, which is what the decoder of the arithmetic code expects; the decoders that must not read past the end check it with position(). The streams of bits on words of 64 bits, with the fields read a word at a time, are those of the integer codes [see BitStream.h].
The contracts [see Contract.h]: a code has at most 64 bits. The operations are defined in PackedBits.tpp.