code wiki / (root) / nx_flac_frame_gate.nx

nx_flac_frame_gate.nx

buildroot/runtime/nx_flac_frame_gate.nx

7628 B182 linesdepth 6pulls 6 transitivereach 0 importersview sourcekind gate/prooftopic flac
docsdependenciesstructsconstsfunctions

about

nx_flac_frame_gate.nx -- proves FLAC frame + subframe decoding. T4/T5 assemble REAL frames byte by byte and decode them to samples: a 192-sample CONSTANT frame at 44.1kHz/16-bit mono, and a 3-sample VERBATIM frame using the deferred 8-bit block size. Both exercise the whole path -- sync, flag bytes, UTF-8 frame number, deferred fields, CRC-8, subframe header, sample extraction. T6 is the one that matters for long streams: the header LENGTH is variable (4 flag bytes + a 1-7 byte number + optional deferred block size and rate), and the CRC covers exactly those bytes. A parser with a hard-coded length works on every short file and breaks at frame 128, when the UTF-8 number grows to two bytes. T6 asserts hdrlen 6 for the simple frame and 7 for the deferred-blocksize one. NON-VACUITY: T8 covers refusals -- broken sync, a flipped CRC byte, and the reserved bit set must each be rejected. license_tier: ORIGINAL

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_bitstream.nx nx_flac.nx nx_flac_frame.nx nx_flac_frame_gate.nx

imports: nx_syscalls.nxnx_bitstream.nxnx_flac.nxnx_flac_frame.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap nx_flac_utf8_read nx_flac_utf8_len nx_flac_utf8_len ↻ nx_flac_crc16 nx_bitstream_alloc sys_mmap ↻ nx_flac_read_signed nx_bitstream_read_msb nx_bitstream_bits_remainin _bs_peek_byte nx_flac_crc8 nx_flac_frame_parse nx_flac_block_size nx_flac_sample_rate nx_flac_bit_depth sys_mmap ↻ nx_flac_utf8_read ↻ nx_flac_crc8 ↻ nx_flac_subframe nx_bitstream_read_msb ↻ nx_flac_read_signed ↻ nx_flac_read_residual nx_bitstream_read_msb ↻ nx_flac_read_signed ↻ nx_flac_read_rice nx_bitstream_read_msb ↻ nx_flac_unfold nx_flac_restore_fixed nx_flac_fixed_predict sys_mmap ↻ nx_flac_restore_lpc g_puts sys_write sys_exit g_putn sys_mmap ↻ g_puts ↻ sys_write ↻

structs

none

consts

none

functions

25func g_puts(s: *u8) -> i64
called by 2: g_putnmain calls 1: sys_write
32func g_putn(v: i64) -> i64
called by 1: main calls 3: sys_mmapg_putssys_write
46func main() -> i64