Work on dynamic huffman coding.

This commit is contained in:
James Grogan 2022-11-28 18:05:39 +00:00
parent 7f5009fb5e
commit a6e31c8d39
16 changed files with 456 additions and 95 deletions

View file

@ -6,6 +6,8 @@
#include <string>
#include <optional>
class BitStream;
class HuffmanCodeLengthTable
{
public:
@ -21,6 +23,8 @@ public:
const PrefixCode& getCode(std::size_t index) const;
std::optional<PrefixCode> getCodeForSymbol(unsigned symbol) const;
using CompressedSequenceEntry = std::pair<unsigned, unsigned>;
const std::vector<CompressedSequenceEntry>& getCompressedLengthSequence() const;
@ -34,6 +38,8 @@ public:
void setInputLengthSequence(const std::vector<unsigned char>& sequence, bool targetDeflate = true);
bool readNextSymbol(unsigned& buffer, BitStream* stream);
private:
HuffmanTree mTree;