[{"data":1,"prerenderedAt":435},["ShallowReactive",2],{"navigation":3,"\u002Fconcepts\u002Fcodecs\u002Frans":222,"\u002Fconcepts\u002Fcodecs\u002Frans-surround":430},[4,8,168,206,210,214,218],{"title":5,"path":6,"stem":7},"Quickstart","\u002Fquickstart","01.quickstart",{"title":9,"path":10,"stem":11,"children":12},"Concepts","\u002Fconcepts","20.concepts",[13,15,19,23,84,88,92,96,100],{"title":9,"path":10,"stem":14},"20.concepts\u002Findex",{"title":16,"path":17,"stem":18},"Preprocessing Graph","\u002Fconcepts\u002Fppg","20.concepts\u002F2.ppg",{"title":20,"path":21,"stem":22},"Plane decomposition","\u002Fconcepts\u002Fplanes","20.concepts\u002F3.planes",{"title":24,"path":25,"stem":26,"children":27},"Codecs","\u002Fconcepts\u002Fcodecs","20.concepts\u002F4.codecs",[28,32,36,40,44,48,52,56,60,64,68,72,76,80],{"title":29,"path":30,"stem":31},"Arithmetic","\u002Fconcepts\u002Fcodecs\u002Farithmetic","20.concepts\u002Fcodecs\u002Farithmetic",{"title":33,"path":34,"stem":35},"Context Mixing Lite","\u002Fconcepts\u002Fcodecs\u002Fcontext-mixing-lite","20.concepts\u002Fcodecs\u002Fcontext-mixing-lite",{"title":37,"path":38,"stem":39},"FPC","\u002Fconcepts\u002Fcodecs\u002Ffpc","20.concepts\u002Fcodecs\u002Ffpc",{"title":41,"path":42,"stem":43},"Huffman LLM 5-Bit","\u002Fconcepts\u002Fcodecs\u002Fhuff-llm","20.concepts\u002Fcodecs\u002Fhuff-llm",{"title":45,"path":46,"stem":47},"Huffman","\u002Fconcepts\u002Fcodecs\u002Fhuffman","20.concepts\u002Fcodecs\u002Fhuffman",{"title":49,"path":50,"stem":51},"Identity","\u002Fconcepts\u002Fcodecs\u002Fidentity","20.concepts\u002Fcodecs\u002Fidentity",{"title":53,"path":54,"stem":55},"Neural Predictor","\u002Fconcepts\u002Fcodecs\u002Fneural-predictor","20.concepts\u002Fcodecs\u002Fneural-predictor",{"title":57,"path":58,"stem":59},"Order-1 Arithmetic","\u002Fconcepts\u002Fcodecs\u002Forder1-arithmetic","20.concepts\u002Fcodecs\u002Forder1-arithmetic",{"title":61,"path":62,"stem":63},"Order-1 Scale AC","\u002Fconcepts\u002Fcodecs\u002Forder1-scale-ac","20.concepts\u002Fcodecs\u002Forder1-scale-ac",{"title":65,"path":66,"stem":67},"Per-Group Codebook","\u002Fconcepts\u002Fcodecs\u002Fper-group-codebook","20.concepts\u002Fcodecs\u002Fper-group-codebook",{"title":69,"path":70,"stem":71},"rANS","\u002Fconcepts\u002Fcodecs\u002Frans","20.concepts\u002Fcodecs\u002Frans",{"title":73,"path":74,"stem":75},"tANS","\u002Fconcepts\u002Fcodecs\u002Ftans","20.concepts\u002Fcodecs\u002Ftans",{"title":77,"path":78,"stem":79},"Zstd","\u002Fconcepts\u002Fcodecs\u002Fzstd","20.concepts\u002Fcodecs\u002Fzstd",{"title":81,"path":82,"stem":83},"Zstd Dictionary","\u002Fconcepts\u002Fcodecs\u002Fzstd-dict","20.concepts\u002Fcodecs\u002Fzstd-dict",{"title":85,"path":86,"stem":87},"Container format","\u002Fconcepts\u002Fcontainer","20.concepts\u002F5.container",{"title":89,"path":90,"stem":91},"Delta compression","\u002Fconcepts\u002Fdelta","20.concepts\u002F6.delta",{"title":93,"path":94,"stem":95},"Extensibility","\u002Fconcepts\u002Fextensibility","20.concepts\u002F7.extensibility",{"title":24,"path":25,"stem":97,"children":98},"20.concepts\u002Fcodecs\u002Findex",[99],{"title":24,"path":25,"stem":97},{"title":101,"path":102,"stem":103,"children":104},"Transforms","\u002Fconcepts\u002Ftransforms","20.concepts\u002Ftransforms\u002Findex",[105,106,110,114,118,122,126,130,134,140,144,148,152,156,160,164],{"title":101,"path":102,"stem":103},{"title":107,"path":108,"stem":109},"Alpha-Stable Normalize","\u002Fconcepts\u002Ftransforms\u002Falpha-stable-normalize","20.concepts\u002Ftransforms\u002Falpha-stable-normalize",{"title":111,"path":112,"stem":113},"Bit Reorder","\u002Fconcepts\u002Ftransforms\u002Fbit-reorder","20.concepts\u002Ftransforms\u002Fbit-reorder",{"title":115,"path":116,"stem":117},"Block Microscaling Repack","\u002Fconcepts\u002Ftransforms\u002Fblock-microscaling-repack","20.concepts\u002Ftransforms\u002Fblock-microscaling-repack",{"title":119,"path":120,"stem":121},"Burrows-Wheeler","\u002Fconcepts\u002Ftransforms\u002Fburrows-wheeler","20.concepts\u002Ftransforms\u002Fburrows-wheeler",{"title":123,"path":124,"stem":125},"Byte Split & Nibble Split","\u002Fconcepts\u002Ftransforms\u002Fbyte-split","20.concepts\u002Ftransforms\u002Fbyte-split",{"title":127,"path":128,"stem":129},"Concat","\u002Fconcepts\u002Ftransforms\u002Fconcat","20.concepts\u002Ftransforms\u002Fconcat",{"title":131,"path":132,"stem":133},"Delta","\u002Fconcepts\u002Ftransforms\u002Fdelta","20.concepts\u002Ftransforms\u002Fdelta",{"title":135,"path":136,"stem":137,"children":138},"Index Bitwidth Pack","\u002Fconcepts\u002Ftransforms\u002Findex-bitwidth-pack","20.concepts\u002Ftransforms\u002Findex-bitwidth-pack",[139],{"title":135,"path":136,"stem":137},{"title":141,"path":142,"stem":143},"IntDelta","\u002Fconcepts\u002Ftransforms\u002Fint-delta","20.concepts\u002Ftransforms\u002Fint-delta",{"title":145,"path":146,"stem":147},"Mantissa Zero Strip","\u002Fconcepts\u002Ftransforms\u002Fmantissa-zero-strip","20.concepts\u002Ftransforms\u002Fmantissa-zero-strip",{"title":149,"path":150,"stem":151},"Move to Front","\u002Fconcepts\u002Ftransforms\u002Fmove-to-front","20.concepts\u002Ftransforms\u002Fmove-to-front",{"title":153,"path":154,"stem":155},"MxFp4 Deinterleave","\u002Fconcepts\u002Ftransforms\u002Fmxfp4-deinterleave","20.concepts\u002Ftransforms\u002Fmxfp4-deinterleave",{"title":157,"path":158,"stem":159},"Predictor XOR","\u002Fconcepts\u002Ftransforms\u002Fpredictor-xor","20.concepts\u002Ftransforms\u002Fpredictor-xor",{"title":161,"path":162,"stem":163},"Reshape","\u002Fconcepts\u002Ftransforms\u002Freshape","20.concepts\u002Ftransforms\u002Freshape",{"title":165,"path":166,"stem":167},"Spherical Normalize","\u002Fconcepts\u002Ftransforms\u002Fspherical-normalize","20.concepts\u002Ftransforms\u002Fspherical-normalize",{"title":169,"path":170,"stem":171,"children":172},"Guides","\u002Fguides","30.guides\u002F00.index",[173,174,178,182,186,190,194,198,202],{"title":169,"path":170,"stem":171},{"title":175,"path":176,"stem":177},"CLI usage","\u002Fguides\u002Fcli","30.guides\u002F01.cli",{"title":179,"path":180,"stem":181},"Python API","\u002Fguides\u002Fpython-api","30.guides\u002F02.python-api",{"title":183,"path":184,"stem":185},"Writing your first extension","\u002Fguides\u002Fextension-authoring","30.guides\u002F03.extension-authoring",{"title":187,"path":188,"stem":189},"Trust and security","\u002Fguides\u002Ftrust-and-security","30.guides\u002F04.trust-and-security",{"title":191,"path":192,"stem":193},"Random access","\u002Fguides\u002Frandom-access","30.guides\u002F10.random-access",{"title":195,"path":196,"stem":197},"Tuning","\u002Fguides\u002Ftuning","30.guides\u002F11.tuning",{"title":199,"path":200,"stem":201},"Safetensors","\u002Fguides\u002Fsafetensors","30.guides\u002F50.safetensors",{"title":203,"path":204,"stem":205},"Transformers","\u002Fguides\u002Ftransformers","30.guides\u002F51.transformers",{"title":207,"path":208,"stem":209},"API reference","\u002Fapi","40.api",{"title":211,"path":212,"stem":213},"Benchmarks","\u002Fbenchmarks","50.benchmarks",{"title":215,"path":216,"stem":217},"Extensions","\u002Fextensions","60.extensions",{"title":219,"path":220,"stem":221},"Contributing","\u002Fcontributing","90.contributing",{"id":223,"title":69,"body":224,"description":424,"extension":425,"kind":426,"language":426,"links":426,"meta":427,"navigation":426,"path":70,"seo":428,"stem":71,"summary":426,"__hash__":429},"docs\u002F20.concepts\u002Fcodecs\u002Frans.md",{"type":225,"value":226,"toc":419},"minimark",[227,232,245,250,253,382,391,395,398,402,415],[228,229,231],"h1",{"id":230},"rans-codec","rANS Codec",[233,234,235,236,239,240,244],"p",{},"The ",[237,238,69],"code",{}," (range-ANS) codec is a high-precision entropy coder that acts as a peer to the ",[241,242,45],"a",{"href":243},"huffman"," coder in the PTWM dispatcher.",[246,247,249],"h2",{"id":248},"theory","Theory",[233,251,252],{},"Asymmetric Numeral Systems (ANS) offers a compression ratio close to arithmetic coding with a decoding speed comparable to Huffman coding. PTWM's implementation uses 11-bit precision and features four interleaved 32-bit streams.",[254,255,260],"pre",{"className":256,"code":257,"language":258,"meta":259,"style":259},"language-mermaid shiki shiki-themes material-theme-lighter github-light github-dark","graph LR\n    subgraph State [4 Interleaved 32-bit States]\n        S0[State 0]\n        S1[State 1]\n        S2[State 2]\n        S3[State 3]\n    end\n    \n    subgraph ByteStream [Encoded Byte Stream]\n        B0[Byte 0]\n        B1[Byte 1]\n        B2[Byte 2]\n        B3[Byte 3]\n        B4[...]\n    end\n    \n    S0 -.->|Consumes| B0\n    S1 -.->|Consumes| B1\n    S2 -.->|Consumes| B2\n    S3 -.->|Consumes| B3\n","mermaid","",[237,261,262,270,276,282,288,294,300,306,312,318,324,330,336,342,348,353,358,364,370,376],{"__ignoreMap":259},[263,264,267],"span",{"class":265,"line":266},"line",1,[263,268,269],{},"graph LR\n",[263,271,273],{"class":265,"line":272},2,[263,274,275],{},"    subgraph State [4 Interleaved 32-bit States]\n",[263,277,279],{"class":265,"line":278},3,[263,280,281],{},"        S0[State 0]\n",[263,283,285],{"class":265,"line":284},4,[263,286,287],{},"        S1[State 1]\n",[263,289,291],{"class":265,"line":290},5,[263,292,293],{},"        S2[State 2]\n",[263,295,297],{"class":265,"line":296},6,[263,298,299],{},"        S3[State 3]\n",[263,301,303],{"class":265,"line":302},7,[263,304,305],{},"    end\n",[263,307,309],{"class":265,"line":308},8,[263,310,311],{},"    \n",[263,313,315],{"class":265,"line":314},9,[263,316,317],{},"    subgraph ByteStream [Encoded Byte Stream]\n",[263,319,321],{"class":265,"line":320},10,[263,322,323],{},"        B0[Byte 0]\n",[263,325,327],{"class":265,"line":326},11,[263,328,329],{},"        B1[Byte 1]\n",[263,331,333],{"class":265,"line":332},12,[263,334,335],{},"        B2[Byte 2]\n",[263,337,339],{"class":265,"line":338},13,[263,340,341],{},"        B3[Byte 3]\n",[263,343,345],{"class":265,"line":344},14,[263,346,347],{},"        B4[...]\n",[263,349,351],{"class":265,"line":350},15,[263,352,305],{},[263,354,356],{"class":265,"line":355},16,[263,357,311],{},[263,359,361],{"class":265,"line":360},17,[263,362,363],{},"    S0 -.->|Consumes| B0\n",[263,365,367],{"class":265,"line":366},18,[263,368,369],{},"    S1 -.->|Consumes| B1\n",[263,371,373],{"class":265,"line":372},19,[263,374,375],{},"    S2 -.->|Consumes| B2\n",[263,377,379],{"class":265,"line":378},20,[263,380,381],{},"    S3 -.->|Consumes| B3\n",[233,383,384,385,387,388,390],{},"rANS is particularly effective on planes with very low entropy or highly skewed distributions (e.g., long runs of zeros after a Move-To-Front transform), where Huffman's 1-bit-per-symbol minimum becomes a bottleneck. The compressor's dispatcher will trial-encode every plane and select ",[237,386,69],{}," if it produces a smaller payload than ",[237,389,45],{},".",[246,392,394],{"id":393},"usage","Usage",[233,396,397],{},"This codec accepts any plane descriptor. It includes a raw fallback mechanism to ensure it never expands incompressible data.",[246,399,401],{"id":400},"references","References",[403,404,405],"ul",{},[406,407,408,409],"li",{},"Jarek Duda, \"Asymmetric numeral systems: entropy coding combining speed of Huffman coding with compression rate of arithmetic coding\" (2013). ",[241,410,414],{"href":411,"rel":412},"https:\u002F\u002Farxiv.org\u002Fabs\u002F1311.2540",[413],"nofollow","Link",[416,417,418],"style",{},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":259,"searchDepth":278,"depth":278,"links":420},[421,422,423],{"id":248,"depth":272,"text":249},{"id":393,"depth":272,"text":394},{"id":400,"depth":272,"text":401},"Range Asymmetric Numeral Systems entropy coder.","md",null,{},{"title":69,"description":424},"HLaorxHMbvhLoPrY00lwN6qmgSJRBFBk8o_GB0u-83I",[431,433],{"title":65,"path":66,"stem":67,"description":432,"children":-1},"Models per-group nibble distributions for quantized MXFP4 value planes.",{"title":73,"path":74,"stem":75,"description":434,"children":-1},"Tabled Asymmetric Numeral Systems (Finite State Entropy) coder.",1784796355968]