code wiki / (root) / nx_h264_bits.nx

nx_h264_bits.nx

buildroot/runtime/nx_h264_bits.nx

3725 B106 linesdepth 2pulls 2 transitivereach 45 importersview sourcekind librarytopic h264
docsdependenciesstructsconstsfunctions

about

nx_h264_bits.nx -- H.264 bitstream reader + Exp-Golomb (rung 2 keystone). EVERY field in H.264 SPS/PPS/slice headers is coded as ue(v) (unsigned Exp-Golomb) or se(v) (signed), read MSB-first. This is THE primitive the whole decoder stands on -- so it is built and KAT-gated against the canonical Exp-Golomb code words before anything above it is attempted. ue(v): count leadingZeros z (zeros before the first 1, which is consumed), read z more bits 'rest', value = (1<<z) - 1 + rest. codeword "1"->0, "010"->1, "011"->2, "00100"->3, "00101"->4 ... se(v): map k=ue(v): 0->0, 1->+1, 2->-1, 3->+2, 4->-2 (sign + ceil(k/2)). genealogy_id: itu_t_h264_annexB_exp_golomb + teuhola_1978_exp_golomb lineage_id: msb_bitreader + ue_se_exp_golomb license_tier: ORIGINAL

dependencies 1 imports · 43 importers

nx_syscalls.nx nx_h264_bits.nx nx_h264_bframe_probe.nx nx_h264_bframe_reflist_gate.nx nx_h264_bframe_walk.nx nx_h264_bits_gate.nx nx_h264_block_e2e_gate.nx nx_h264_brecon.nx nx_h264_cavlc_level.nx nx_h264_cavlc_level_gate.nx nx_h264_cavlc_rt_gate.nx nx_h264_cdc_gate.nx

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

imports: nx_syscalls.nx

imported by: nx_h264_bframe_probe.nxnx_h264_bframe_reflist_gate.nxnx_h264_bframe_walk.nxnx_h264_bits_gate.nxnx_h264_block_e2e_gate.nxnx_h264_brecon.nxnx_h264_cavlc_level.nxnx_h264_cavlc_level_gate.nxnx_h264_cavlc_rt_gate.nxnx_h264_cdc_gate.nxnx_h264_cdc_tz_gate.nxnx_h264_coeff_token.nxnx_h264_coeff_token_gate.nxnx_h264_colmv_gate.nxnx_h264_ctctx_gate.nxnx_h264_ctfull_gate.nxnx_h264_decode_frame.nxnx_h264_iframe.nxnx_h264_mb.nxnx_h264_mb_gate.nxnx_h264_mb_pred.nxnx_h264_mb_pred_gate.nxnx_h264_mv_recon_gate.nxnx_h264_pframe_probe.nxnx_h264_pframe_recon.nxnx_h264_pframe_walk.nxnx_h264_pmvfield.nxnx_h264_pps.nxnx_h264_pps_gate.nxnx_h264_residual.nxnx_h264_residual_gate.nxnx_h264_run_before.nxnx_h264_run_before_gate.nxnx_h264_slice.nxnx_h264_slice_extract.nxnx_h264_slice_gate.nxnx_h264_sps.nxnx_h264_sps_gate.nxnx_h264_total_zeros.nxnx_h264_total_zeros_gate.nxnx_h264_ts_probe.nxnx_h264_tzrb_gate.nxnx_mp4_real_probe.nx

structs

17struct BitReader

consts

39const NX_BR_BYTES: i64 = 128 // 9 fields x 8 = 72; 128 leaves headroom. All 14

functions

42func br_init(br: *BitReader, data: *u8, len: i64) -> i64
called by 31: mainmainmainmainmainmain+25 calls 1: sys_mmap
60func br_read_bit(br: *BitReader) -> i64
69func br_read_bits(br: *BitReader, n: i64) -> i64
80func br_read_ue(br: *BitReader) -> i64
94func br_read_se(br: *BitReader) -> i64
103func br_align(br: *BitReader) -> i64