Asymmetric Numeral Systems

from Wikipedia, the free encyclopedia

Asymmetric Numeral Systems ( ANS , asymmetric number systems ) are a family of Entropiekodierungen that Jaroslaw "Jarek" Duda at the Jagiellonian University were developed. ANS combines the compression rate of the arithmetic coding , which uses an almost exact probability distribution , with a computational effort comparable to the Huffman coding .

AMS is used, among other things, in the compression algorithms Zstandard and LZFSE , in the compression of the image formats PIK and JPEG XL .

Entropy coding

The sequence of 1000 zeros and ones would be 1000 bits when stored directly. If the sequence is known to contain only one one and 999 zeros, it is sufficient to only store the position of the one, which means that only bits are required.

The number of combinations of symbols with ones and zeros corresponds approximately with a probability of for ones according to the Stirling formula

Therefore, approximately bits are required to store such a sequence , the entropy corresponding to one symbol. In the case of , bits are still required, but far fewer with asymmetrical probability. For example, only about bits are required.

An entropy coder enables a symbol sequence to be coded with a number of bits per symbol approximately corresponding to the entropy.

Basic concept of ANS

The basic idea is to encode information into a single natural number . In the usual binary system, a bit of information can be added to using the coding function, so that . When the coding function is used, all bits are shifted by one position and added to the least significant position. The decoding function enables the extraction of the previous number as well as the added symbol . By using the coding function several times, a sequence can be coded and decoding again in the reverse order by using the decoding function several times.

The procedure described is optimal when the probability distribution of the two possible symbols is symmetrical, ie . This process is generalized by ANS for any set of symbols with an associated, often asymmetrical, probability distribution .

After adding the information from to is respectively , where the number of bits of information in the number and the approximate number of bits correspond to the symbol .

Uniform binary variant (uABS)

The binary variant with roughly evenly distributed symbols with and . The coding function and the decoding function result as follows:

Range variant (rANS)

The range variant also uses arithmetic formulas, but in contrast to uABS allows a larger alphabet. It can be seen as a modification of a place value system in which some consecutive digits have been combined into areas.

The probability distribution of the set of symbols is approximately described by fractions of the form with and . The symbol is assigned to the area with a ranking system as a basis . The symbol can be determined from the position of a symbol in the place value system . The coding function and the decoding function result as follows:

In the encoder there are usually , and in tabular form, ideally also and in order to achieve a better running time.

If the power of 2 is chosen, the multiplications and divisions can be replaced by faster bit-wise shifts and by bit-wise AND . This means that only one multiplication is required during decoding.

Tabular variant (tANS)

The tabular variant packs the entire process for in a table that describes a finite automaton . This makes it possible to dispense with multiplications entirely.

Remarks

As with Huffman coding, changing the probability distribution of tANS is relatively expensive, which is why it is mainly used in static application scenarios.

In contrast to this, rANS is a faster alternative to range coding . It requires multiplications, but is more memory efficient and is suitable for dynamically adapted probability distributions.

Encoding and decoding of ANS are done in opposite directions. The decoding runs from back to front in the encoded data. So that a stack can be dispensed with during decoding , backward coding is often used in practice.

Individual evidence

  1. Timothy B. Lee: Inventor says Google is patenting work he put in the public domain. In: Ars Technica . June 10, 2018, accessed June 24, 2020 .
  2. Zstandard Compression Format. In: GitHub . Retrieved June 23, 2020 (English).
  3. Sergio De Simone: Apple Open-Sources its New Compression Algorithm LZFSE. In: InfoQ. July 2, 2016, accessed June 24, 2020 .
  4. PIK. In: GitHub . Retrieved June 24, 2020 .
  5. Alexander Rhatushnyak, Jan Wassenberg, Jon Sneyers, Jyrki Alakuijala, Lode Vandevenne: Committee Draft of JPEG XL Image Coding System . August 13, 2019, arxiv : 1908.03565 .
  6. a b Jarek Duda: Asymmetric numeral systems: entropy coding combining speed of Huffman coding with compression rate of arithmetic coding . January 6, 2014, arxiv : 1311.2540 .