code wiki / (root) / nx_range_coef.nx

nx_range_coef.nx

buildroot/runtime/nx_range_coef.nx

5238 B164 linesdepth 4pulls 4 transitivereach 0 importersview sourcekind orphan librarytopic range
docsdependenciesstructsconstsfunctions

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

nx_syscalls_x86_64.nx nx_range_coder.nx nx_range_coef.nx

imports: nx_syscalls_x86_64.nxnx_range_coder.nx

imported by: nobody (leaf or entry point)

structs

40struct RangeCoefModel

consts

30const NX_RCF_VERDICT_UNKNOWN: i64 = 0
31const NX_RCF_VERDICT_OK: i64 = 1
32const NX_RCF_VERDICT_BUF_FULL: i64 = 2
33const NX_RCF_VERDICT_BAD_INPUT: i64 = 3
34const NX_RCF_VERDICT_TRUNCATED: i64 = 4
35const NX_RCF_VERDICT_N: i64 = 5
37const NX_RCF_DECAY_THRESHOLD: i64 = 16384
38const NX_RCF_INCREMENT: i64 = 8

functions

45func nx_rcf_model_init(m: *RangeCoefModel, freq_buf: *i64) -> i64
54func _rcf_adapt(m: *RangeCoefModel, b: i64) -> i64
77func nx_rcf_encode(
119func nx_rcf_decode(
160func nx_rcf_verdict_is_valid(v: i64) -> i64