code wiki / (root) / nx_ventropy.nx

nx_ventropy.nx

buildroot/runtime/nx_ventropy.nx

6608 B144 linesdepth 1pulls 1 transitivereach 119 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_ventropy.nx -- sovereign ENTROPY CODING of a quantized 4x4 coefficient block (V-R3). After transform+quant a block is mostly zeros clustered toward high frequency; this scans it in ZIG-ZAG order (low->high freq, so zeros bunch at the end), run-length-codes (zeros-run, level) pairs, and bit-packs them with an EOB terminator + variable-length signed levels. A near-static block -> ~1 byte; a few nonzeros -> a few bytes (vs 32 raw). This is the CAVLC-family stage VP8/H.264 use. Composes nx_bitio (MSB bit writer/reader). license_tier: ORIGINAL

dependencies 1 imports · 11 importers

nx_bitio.nx nx_ventropy.nx nx_rangecoder.nx nx_rangecoder_sig.nx nx_rd_intra_gate.nx nx_rdcurve_gate.nx nx_vcodec.nx nx_vcodec_mrbits_gate.nx nx_vcodec_tsize_rd_gate.nx nx_ventropy_gate.nx nx_ventropy_pack_gate.nx nx_vmvpred_gate.nx

diagram shows first 10 each side; +0 more imports, +1 more importers in the complete lists below.

imports: nx_bitio.nx

imported by: nx_rangecoder.nxnx_rangecoder_sig.nxnx_rd_intra_gate.nxnx_rdcurve_gate.nxnx_vcodec.nxnx_vcodec_mrbits_gate.nxnx_vcodec_tsize_rd_gate.nxnx_ventropy_gate.nxnx_ventropy_pack_gate.nxnx_vmvpred_gate.nxnx_vmvres.nx

structs

none

consts

none

functions

9func ve_zz_idx(k: i64) -> i64 {
17func ve_zze(v: i64) -> i64 { if v < 0 { return ((0 - v) << 1) - 1 } return v << 1 }
18func ve_zzd(z: i64) -> i64 { if (z & 1) == 1 { return 0 - ((z + 1) >> 1) } return z >> 1 }
19func ve_blen(z: i64) -> i64 { var n: i64 = 0; var x: i64 = z; while x > 0 { n = n + 1; x = x >> 1 } return n }
21func ve_vput(buf: *u8, bp: i64, v: i64) -> i64 {
27func ve_vlen(buf: *u8, bp: i64) -> i64 { return 5 + nx_br_get(buf, bp, 5) }
28func ve_vval(buf: *u8, bp: i64) -> i64 {
38func ve_encode_at(coeffs: *i64, buf: *u8, bp0: i64) -> i64 {
57func ve_decode_at(buf: *u8, coeffs: *i64, bp0: i64) -> i64 {
76func ve_encode(coeffs: *i64, buf: *u8) -> i64 { return ve_encode_at(coeffs, buf, 0) }
78func ve_decode(buf: *u8, coeffs: *i64) -> i64 { return ve_decode_at(buf, coeffs, 0) }
called by 1: main calls 1: ve_decode_at
84func ve_cost(coeffs: *i64) -> i64 {
94func ve64_cost(coeffs: *i64, zz8: *i64) -> i64 {
110func ve64_encode_at(coeffs: *i64, buf: *u8, bp0: i64, zz8: *i64) -> i64 {
127func ve64_decode_at(buf: *u8, coeffs: *i64, bp0: i64, zz8: *i64) -> i64 {
called by 1: vc_dec_sub8 calls 3: nx_br_getve_vvalve_vlen