diff options
author | solar <solar@yandex-team.ru> | 2022-02-10 16:49:59 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:59 +0300 |
commit | da648cf6f097dd42d968802dca7734c68ef57d67 (patch) | |
tree | 7e2a3befe759a1ce261f51c2ef5bb3159257abed /library/cpp/codecs/huffman_codec.cpp | |
parent | bee0f5f332db3abff5839ff24ac18000c161a30a (diff) | |
download | ydb-da648cf6f097dd42d968802dca7734c68ef57d67.tar.gz |
Restoring authorship annotation for <solar@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/codecs/huffman_codec.cpp')
-rw-r--r-- | library/cpp/codecs/huffman_codec.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/library/cpp/codecs/huffman_codec.cpp b/library/cpp/codecs/huffman_codec.cpp index 650fe7cdfd..a6486af264 100644 --- a/library/cpp/codecs/huffman_codec.cpp +++ b/library/cpp/codecs/huffman_codec.cpp @@ -235,20 +235,20 @@ namespace NCodecs { THuffmanCache(const THuffmanCodec::TImpl& encoder); void Decode(NBitIO::TBitInput& in, TBuffer& out) const; - }; - + }; + THolder<THuffmanCache> Cache; - + public: TImpl() : SubTablesNum(1) { Invalid.CodeLength = 255; } - + ui8 Encode(TStringBuf in, TBuffer& out) const { out.Clear(); - + if (in.empty()) { return 0; } @@ -302,8 +302,8 @@ namespace NCodecs { } else { while (ReadNextChar(bin, out)) { } - } - } + } + } } Y_FORCE_INLINE int ReadNextChar(NBitIO::TBitInput& bin, TBuffer& out) const { @@ -517,13 +517,13 @@ namespace NCodecs { DecodeCache.push_back(*it); } totalBits += bits; - } - } + } + } DecodeCache.push_back(0); CacheEntries.shrink_to_fit(); DecodeCache.shrink_to_fit(); - } - + } + void THuffmanCodec::TImpl::THuffmanCache::Decode(NBitIO::TBitInput& bin, TBuffer& out) const { int bits = 0; ui64 code = 0; @@ -541,13 +541,13 @@ namespace NCodecs { bin.Back(bits); if (!Original.ReadNextChar(bin, out)) break; - + code = 0; bits = 0; } - } - } - + } + } + THuffmanCodec::THuffmanCodec() : Impl(new TImpl) { @@ -588,5 +588,5 @@ namespace NCodecs { Impl->LearnByFreqs(freqs); Trained = true; } - + } |