code wiki / (root) / nx_bitio.nx

nx_bitio.nx

buildroot/runtime/nx_bitio.nx

2047 B51 linesdepth 0pulls 0 transitivereach 126 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_bitio.nx -- MSB-first bit-level writer/reader over a byte buffer. Reusable across every sub-byte-coded codec: ACELP pulse-position/sign indices, VQ/RVQ codebook indices, packed gain indices, entropy fields. The voice/video codecs currently pack in whole bytes or nibbles, which wastes bits at low bitrate -- this lets a field be exactly as wide as it needs (e.g. a 17-bit G.729 fixed-codebook index, a 7-bit pitch lag). Functional / positional: the caller owns the bit cursor (so one function can return the value while the caller advances by the known width). The writer tolerates a DIRTY buffer (it both sets and clears each touched bit), so callers need not pre-zero. Big-endian bit order within the stream (MSB of the field emitted first) -- matches ITU/3GPP bit packing. genealogy_id: itu_g729_bitstream + 3gpp_amr_packing lineage_id: nishi_bitio_msb

dependencies 0 imports · 4 importers

nx_bitio.nx nx_bitio_kat.nx nx_huffman_kat.nx nx_netquant.nx nx_ventropy.nx

imports: none

imported by: nx_bitio_kat.nxnx_huffman_kat.nxnx_netquant.nxnx_ventropy.nx

structs

none

consts

none

functions

20func nx_bw_put(buf: *u8, bitpos: i64, value: i64, nbits: i64) -> i64
36func nx_br_get(buf: *u8, bitpos: i64, nbits: i64) -> i64
51func nx_bits_bytes(bits: i64) -> i64 { return (bits + 7) >> 3 }