nx_av1_frame.nx
buildroot/runtime/nx_av1_frame.nx
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
imports: nx_syscalls.nxnx_bitstream.nxnx_av1_seq.nx
imported by: nx_av1_frame_gate.nx
structs
| none |
consts
| 29 | const NX_QP_BASE: i64 = 0 |
| 30 | const NX_QP_YDC: i64 = 1 |
| 31 | const NX_QP_UDC: i64 = 2 |
| 32 | const NX_QP_UAC: i64 = 3 |
| 33 | const NX_QP_VDC: i64 = 4 |
| 34 | const NX_QP_VAC: i64 = 5 |
| 35 | const NX_QP_USEQM: i64 = 6 |
| 36 | const NX_QP_QMY: i64 = 7 |
| 37 | const NX_QP_QMU: i64 = 8 |
| 38 | const NX_QP_QMV: i64 = 9 |
| 40 | const NX_CDEF_DAMPING: i64 = 0 |
| 41 | const NX_CDEF_BITS: i64 = 1 |
| 42 | const NX_CDEF_YPRI: i64 = 2 |
| 43 | const NX_CDEF_YSEC: i64 = 10 |
| 44 | const NX_CDEF_UVPRI: i64 = 18 |
| 45 | const NX_CDEF_UVSEC: i64 = 26 |
functions
| 49 | func nx_av1_su_read(bs: *NxBitStream, n: i64) -> i64 |
| 58 | func nx_av1_su_write(w: *NxAv1Bw, v: i64, n: i64) -> i64 |
| 72 | func nx_av1_delta_q_read(bs: *NxBitStream) -> i64 |
| 77 | func nx_av1_delta_q_write(w: *NxAv1Bw, v: i64) -> i64 |
| 90 | func nx_av1_quant_write(w: *NxAv1Bw, mono: i64, separate_uv: i64, fld: *i64) -> i64 |
| 125 | func nx_av1_quant_read(bs: *NxBitStream, mono: i64, separate_uv: i64, fld: *i64) -> i64 |
| 167 | func nx_av1_cdef_sec_decode(coded: i64) -> i64 |
| 172 | func nx_av1_cdef_sec_encode(strength: i64) -> i64 |
| 182 | func nx_av1_cdef_write(w: *NxAv1Bw, num_planes: i64, fld: *i64) -> i64 |
| 215 | func nx_av1_cdef_read(bs: *NxBitStream, num_planes: i64, fld: *i64) -> i64 |