{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/asymmetric-numeral-systems-entropy-coding","title":"Asymmetric numeral systems: entropy coding combining speed of Huffman coding with compression rate of arithmetic coding","arxiv_id":"1311.2540","date":"2013-11-11","proceeding":null,"authors":["Jarek Duda"],"abstract":"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.","url_abs":"http://arxiv.org/abs/1311.2540v2","url_pdf":"http://arxiv.org/pdf/1311.2540v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"links_only","authors_date_abstract":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license), from the Kaggle arXiv metadata snapshot of 2026-09-12"},"code_links":[{"paper_slug":"asymmetric-numeral-systems-entropy-coding","repo_url":"https://github.com/Cyan4973/FiniteStateEntropy","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"BSD-2-Clause"}},{"paper_slug":"asymmetric-numeral-systems-entropy-coding","repo_url":"https://github.com/FGlazov/Python-rANSCoder","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"CC0-1.0"}},{"paper_slug":"asymmetric-numeral-systems-entropy-coding","repo_url":"https://github.com/GarethCa/Py-tANS","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":null},{"paper_slug":"asymmetric-numeral-systems-entropy-coding","repo_url":"https://github.com/JarekDuda/AsymmetricNumeralSystemsToolkit","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"GPL-2.0"}},{"paper_slug":"asymmetric-numeral-systems-entropy-coding","repo_url":"https://github.com/fierg/twoDimensionalRLE","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"asymmetric-numeral-systems-entropy-coding","repo_url":"https://github.com/phucnm/pzip-fse","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok"}},{"paper_slug":"asymmetric-numeral-systems-entropy-coding","repo_url":"https://github.com/pkorus/l3ic","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok"}},{"paper_slug":"asymmetric-numeral-systems-entropy-coding","repo_url":"https://github.com/rygorous/ryg_rans","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"NOASSERTION"}}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=1311.2540","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1311.2540"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/Cyan4973/FiniteStateEntropy","reach":{"status":"ok","spdx":"BSD-2-Clause"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/rygorous/ryg_rans","reach":{"status":"ok","spdx":"NOASSERTION"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/fierg/twoDimensionalRLE","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/phucnm/pzip-fse","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/JarekDuda/AsymmetricNumeralSystemsToolkit","reach":{"status":"ok","spdx":"GPL-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/GarethCa/Py-tANS","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/FGlazov/Python-rANSCoder","reach":{"status":"ok","spdx":"CC0-1.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/pkorus/l3ic","reach":{"status":"ok"}}],"summary":{"ran_draft_wrong":1,"unverified":3},"by_repo_kind":{"listed":{"samples":4,"ran":1,"repositories":2}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":1,"samples":[{"code_sha256_prefix":"fe80544ff5c379e8","entry":"make_data","repo":"GarethCa/Py-tANS","repo_kind":"listed","path":"tests/test_coder.py","file_url":"https://github.com/GarethCa/Py-tANS/blob/HEAD/tests/test_coder.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"fe80544ff5c379e8"}},{"code_sha256_prefix":"53b7d4919589f88e","entry":"argmax","repo":"FGlazov/Python-rANSCoder","repo_kind":"listed","path":"src/rans/rANSCoder.py","file_url":"https://github.com/FGlazov/Python-rANSCoder/blob/HEAD/src/rans/rANSCoder.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"CC0-1.0","inline_ok":true,"mcp_get_code":{"code_sha256":"53b7d4919589f88e"}},{"code_sha256_prefix":"31055cf1e3342780","entry":"find_in_int_dist","repo":"FGlazov/Python-rANSCoder","repo_kind":"listed","path":"src/rans/rANSCoder.py","file_url":"https://github.com/FGlazov/Python-rANSCoder/blob/HEAD/src/rans/rANSCoder.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"CC0-1.0","inline_ok":true,"mcp_get_code":{"code_sha256":"31055cf1e3342780"}},{"code_sha256_prefix":"9810adc1ca05d0a5","entry":"float_to_int_probs","repo":"FGlazov/Python-rANSCoder","repo_kind":"listed","path":"src/rans/rANSCoder.py","file_url":"https://github.com/FGlazov/Python-rANSCoder/blob/HEAD/src/rans/rANSCoder.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"CC0-1.0","inline_ok":true,"mcp_get_code":{"code_sha256":"9810adc1ca05d0a5"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}