Module rans

Module rans 

Source
Expand description

rANS (range Asymmetric Numeral System) coder with an optional multi-lane path.

The primary implementation is scalar and portable. On x86_64 builds, this module also exposes an 8-lane interleaved encoder/decoder API.

§Design

  • Uses 8-way parallel rANS states for throughput
  • 15-bit precision for probability quantization
  • Interleaved bitstream for decoder efficiency
  • Supports both streaming and batch modes

Structs§

BlockedRansDecoder
Blocked rANS decoder for streaming large files.
BlockedRansEncoder
Blocked rANS encoder for streaming large files.
Cdf
rANS CDF representation for a symbol.
RansDecoder
Scalar rANS decoder.
RansEncoder
Scalar rANS encoder.
SimdRansDecoder
SIMD lane-parallel rANS types on x86_64. 8-way interleaved rANS decoder.
SimdRansEncoder
SIMD lane-parallel rANS types on x86_64. 8-way interleaved rANS encoder.

Constants§

ANS_BITS
Number of bits for rANS probability precision
ANS_HIGH
Upper bound for rANS state (2^31)
ANS_LOW
Lower bound for rANS state (2^15)
ANS_TOTAL
Total probability range (2^15 = 32768)
BLOCK_SIZE
Block size for blocked rANS (128KB)
RANS_LANES
SIMD lane-parallel rANS types on x86_64. Number of parallel rANS streams

Functions§

cdf_for_symbol
Get Cdf for a symbol from a CDF table.
quantize_pdf_to_rans_cdf
Quantize PDF to rANS CDF table with guaranteed minimum frequencies.
quantize_pdf_to_rans_cdf_with_buffer
Quantize PDF to rANS CDF using reusable scratch buffers.