|
|
|
|
|
by mamaniscalco
3372 days ago
|
|
Encoding can be greatly speed up by constructing an array of the codes for each symbol (left justified) plus the code length. During encode you look up the code for the current symbol, shift it to align with the current output bit position, bitwise or it into the output stream and adjust your output position according to the code length. Similarly an array of the codes can be used to decode quickly as well using a binary search. Avoid using tree traversal when encoding and decoding to greatly increase performance. Also, Huffman is fast becoming obsolete with the introduction of ANS. |
|
And that's a nice find on the ANS. I hadn't heard of that before, but will have to look into it.