[Paper Review] Asymmetric numeral systems: entropy coding combining speed of Huffman coding with compression rate of arithmetic coding
This paper introduces Asymmetric Numeral Systems (ANS) as a novel entropy coding method that combines the speed of Huffman coding with the compression efficiency of arithmetic coding. By using a single natural number as the state and redefining digit placement based on symbol probabilities, ANS achieves near-theoretical compression limits with significantly faster decoding—up to 50% faster than Huffman for 256-symbol alphabets—while enabling built-in data encryption via pseudorandom table generation.
The modern data compression is mainly based on two approaches to entropy coding: Huffman (HC) and arithmetic/range coding (AC). The former is much faster, but approximates probabilities with powers of 2, usually leading to relatively low compression rates. The latter uses nearly exact probabilities - easily approaching theoretical compression rate limit (Shannon entropy), but at cost of much larger computational cost. Asymmetric numeral systems (ANS) is a new approach to accurate entropy coding, which allows to end this trade-off between speed and rate: the recent implementation [1] provides about $50\%$ faster decoding than HC for 256 size alphabet, with compression rate similar to provided by AC. This advantage is due to being simpler than AC: using single natural number as the state, instead of two to represent a range. Beside simplifying renormalization, it allows to put the entire behavior for given probability distribution into a relatively small table: defining entropy coding automaton. The memory cost of such table for 256 size alphabet is a few kilobytes. There is a large freedom while choosing a specific table - using pseudorandom number generator initialized with cryptographic key for this purpose allows to simultaneously encrypt the data. This article also introduces and discusses many other variants of this new entropy coding approach, which can provide direct alternatives for standard AC, for large alphabet range coding, or for approximated quasi arithmetic coding.
Motivation & Objective
- To address the long-standing tradeoff between speed and compression efficiency in entropy coding.
- To develop a practical alternative to arithmetic coding that avoids complex renormalization and state management.
- To enable simultaneous data compression and encryption using a single framework based on probabilistic state transitions.
- To explore the feasibility of using ANS as a lightweight, nonlinear building block in cryptographic systems.
- To provide a theoretical and practical foundation for ANS as a general-purpose entropy coding method with tunable performance and security.
Proposed method
- Uses a single natural number as the state, replacing the two-number range representation of arithmetic coding.
- Defines a transition rule where symbol s maps state x to x′ ≈ x/p_s, ensuring information gain matches log(1/p_s) bits.
- Redefines even and odd number sets to reflect symbol probabilities, creating a uniform distribution with varying densities.
- Constructs a finite-state automaton (tANS) by precomputing a lookup table mapping states to symbols and next states.
- Employs pseudorandom number generators initialized with cryptographic keys to generate unique coding tables for secure, key-dependent encoding.
- Uses bit-block transfer during renormalization instead of complex range arithmetic, simplifying implementation and improving speed.
Experimental results
Research questions
- RQ1Can a single-state entropy coder achieve compression rates close to Shannon entropy while maintaining decoding speed comparable to Huffman coding?
- RQ2How can the state transition rule be designed to ensure information-theoretic optimality while enabling efficient implementation?
- RQ3To what extent can ANS support built-in data encryption through key-dependent table generation?
- RQ4What are the performance and security trade-offs when using pseudorandom initialization for coding tables?
- RQ5How can ANS be adapted for use in adaptive, context-based, or multi-alphabet compression systems?
Key findings
- ANS achieves compression rates nearly identical to arithmetic coding, approaching the theoretical Shannon entropy limit.
- Decoding with tANS is up to 50% faster than Huffman coding for a 256-symbol alphabet, due to simpler state transitions and bit-block handling.
- The method reduces computational complexity by replacing two-number range representation with a single natural number state, simplifying renormalization.
- The use of pseudorandom number generators to initialize coding tables enables simultaneous data compression and encryption with key-dependent behavior.
- The method allows for multiple independent encodings per key by using block indices to seed the PRNG, enhancing resistance to brute-force attacks.
- The tANS table for a 256-symbol alphabet requires only a few kilobytes of memory, making it practical for real-world deployment.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.