nx_range_coef.nx
buildroot/runtime/nx_range_coef.nx
about
nx_range_coef.nx -- adaptive order-0 byte model wrapper around
nx_range_coder, sized for the post-RLE coefficient stream.
The post-zigzag-RLE byte stream is highly skewed: most run-bytes
are small (the longest runs are bounded by 63), and most level-
bytes are small (low magnitude after quantisation). An adaptive
frequency table tracks the distribution within the message and
asks the arithmetic coder for sub-byte symbol widths -- the
compounding compression step on top of zigzag + RLE.
Adaptation policy: each encoded byte bumps its frequency by 8;
after total > 16384 we halve all frequencies (decay to prevent
the model from over-committing to the early bytes of the stream).
genealogy_id: rissanen_1976_arithmetic_coding +
witten_neal_cleary_1987_arithmetic_coding_for_data_compression +
nx_range_coder_q10
lineage_id: nishi_range_coef_q10
dependencies 2 imports · 0 importers
imports: nx_syscalls_x86_64.nxnx_range_coder.nx
imported by: nobody (leaf or entry point)
structs
| 40 | struct RangeCoefModel |
consts
| 30 | const NX_RCF_VERDICT_UNKNOWN: i64 = 0 |
| 31 | const NX_RCF_VERDICT_OK: i64 = 1 |
| 32 | const NX_RCF_VERDICT_BUF_FULL: i64 = 2 |
| 33 | const NX_RCF_VERDICT_BAD_INPUT: i64 = 3 |
| 34 | const NX_RCF_VERDICT_TRUNCATED: i64 = 4 |
| 35 | const NX_RCF_VERDICT_N: i64 = 5 |
| 37 | const NX_RCF_DECAY_THRESHOLD: i64 = 16384 |
| 38 | const NX_RCF_INCREMENT: i64 = 8 |
functions
| 45 | func nx_rcf_model_init(m: *RangeCoefModel, freq_buf: *i64) -> i64 |
| 54 | func _rcf_adapt(m: *RangeCoefModel, b: i64) -> i64 |
| 77 | func nx_rcf_encode( |
| 119 | func nx_rcf_decode( |
| 160 | func nx_rcf_verdict_is_valid(v: i64) -> i64 |