code wiki / (root) / nx_av1_frame.nx

nx_av1_frame.nx

buildroot/runtime/nx_av1_frame.nx

7960 B236 linesdepth 5pulls 5 transitivereach 1 importersview sourcekind librarytopic av1
docsdependenciesstructsconstsfunctions

about

nx_av1_frame.nx -- AV1/AV2 frame-header parameter blocks, writer and reader. Layer five. quantization_params() and cdef_params() are the two blocks that decide, respectively, how coefficients are scaled and how the constrained directional enhancement filter is applied. Both are read straight off the uncompressed header, both are shared verbatim with AV2, and both are self-contained enough to prove by round-trip. su() IS TWO'S COMPLEMENT AT AN ARBITRARY WIDTH. A delta-Q is su(1+6) -- a SEVEN bit signed field, not eight. Sign-extending from the wrong bit turns -1 into +63 and every negative delta into a large positive one, which does not error: it just makes the whole frame come out at the wrong quantiser. THE CDEF SECONDARY STRENGTH SKIPS 3. The field is two bits, and a coded 3 means strength FOUR -- the set is {0, 1, 2, 4} and strength 3 does not exist. A writer that stores 4 verbatim overflows the field; one that stores 3 silently means 4. This module maps on write and remaps on read, and REFUSES an attempt to encode strength 3, which is unrepresentable rather than merely unusual. genealogy_id: av1_spec_5_9_12_quantization_params lineage_id: nx_av1_frame_v1 license_tier: ORIGINAL

dependencies 3 imports · 1 importers

nx_syscalls.nx nx_bitstream.nx nx_av1_seq.nx nx_av1_frame.nx nx_av1_frame_gate.nx

imports: nx_syscalls.nxnx_bitstream.nxnx_av1_seq.nx

imported by: nx_av1_frame_gate.nx

structs

none

consts

29const NX_QP_BASE: i64 = 0
30const NX_QP_YDC: i64 = 1
31const NX_QP_UDC: i64 = 2
32const NX_QP_UAC: i64 = 3
33const NX_QP_VDC: i64 = 4
34const NX_QP_VAC: i64 = 5
35const NX_QP_USEQM: i64 = 6
36const NX_QP_QMY: i64 = 7
37const NX_QP_QMU: i64 = 8
38const NX_QP_QMV: i64 = 9
40const NX_CDEF_DAMPING: i64 = 0
41const NX_CDEF_BITS: i64 = 1
42const NX_CDEF_YPRI: i64 = 2
43const NX_CDEF_YSEC: i64 = 10
44const NX_CDEF_UVPRI: i64 = 18
45const NX_CDEF_UVSEC: i64 = 26

functions

49func nx_av1_su_read(bs: *NxBitStream, n: i64) -> i64
58func nx_av1_su_write(w: *NxAv1Bw, v: i64, n: i64) -> i64
72func nx_av1_delta_q_read(bs: *NxBitStream) -> i64
77func nx_av1_delta_q_write(w: *NxAv1Bw, v: i64) -> i64
90func nx_av1_quant_write(w: *NxAv1Bw, mono: i64, separate_uv: i64, fld: *i64) -> i64
125func nx_av1_quant_read(bs: *NxBitStream, mono: i64, separate_uv: i64, fld: *i64) -> i64
167func nx_av1_cdef_sec_decode(coded: i64) -> i64
172func nx_av1_cdef_sec_encode(strength: i64) -> i64
182func nx_av1_cdef_write(w: *NxAv1Bw, num_planes: i64, fld: *i64) -> i64
215func nx_av1_cdef_read(bs: *NxBitStream, num_planes: i64, fld: *i64) -> i64