3 ms·
Show HN: State-of-the-Art Arithmetic/Range Entropy Coder/Decoder in Go
- bugfix-66 4y agoChange if is1 { to if !is1 { to fix the bug. And the decoder: https://bugfix-66.com/618a1b3b0c80f1439a36cd83cd79f3a5e0b34dc1a691a082833ceb9631aee5f4 https://bugfix-66.com/618a1b3b0c80f1439a36cd83cd79f3a5e0b34d... See if you can make the simple fix yourself. From wikipedia: Arithmetic coding (AC) is a form of entropy encoding used in data compression. Normally, a string of characters is represented using a fixed number of bits per character, as in the ASCII code. When a string is converted to arithmetic encoding, frequently used characters will be stored with fewer bits and not-so-frequently occurring characters will be stored with more bits, resulting in fewer bits used in total. Arithmetic coding differs from other forms of entropy encoding, such as Huffman coding, in that rather than separating the input into component symbols and replacing each with a code, arithmetic coding encodes the entire message into a single number, an arbitrary-precision fraction q, where 0.0 ≤ q < 1.0. It represents the current information as a range, defined by two numbers. https://en.m.wikipedia.org/wiki/Arithmetic_coding https://en.m.wikipedia.org/wiki/Arithmetic_coding