nx_av1_txfm.nx
buildroot/runtime/nx_av1_txfm.nx
about
nx_av1_txfm.nx -- AV1/AV2 transform primitives.
Layer six, the last one before actual residual reconstruction. Everything
here is integer and bit-exact by mandate: an inverse transform that is off
by one anywhere drifts the reference frames apart from the encoder's, and
the picture degrades over a GOP rather than failing.
Round2 AND Round2Signed BOTH EXIST AND DIFFER. Round2 adds half and
arithmetic-shifts, so it rounds negatives toward positive infinity:
Round2(-3, 1) is -1. Round2Signed rounds AWAY from zero by construction:
Round2Signed(-3, 1) is -2. The spec uses each in specific places and they
are not interchangeable -- substituting one for the other produces a
transform that is correct on non-negative input and half-wrong on real
signal, which is exactly the kind of defect that survives a smoke test.
THE COSINE TABLE IS 12-BIT AND QUARTER-PERIOD. Cos128_Lookup holds only
angles 0..64; the other three quadrants are reflections with sign flips.
Getting a quadrant sign wrong inverts half the basis functions, which
decodes to a recognisable but wrong image -- it does not look like noise,
so it is easy to ship.
THE WHT IS EXACTLY INVERTIBLE. The lossless path's Walsh-Hadamard pair is
integer-exact in both directions, which makes it the one transform provable
by pure round-trip rather than against reference vectors.
genealogy_id: av1_spec_7_13_inverse_transform
lineage_id: nx_av1_txfm_v1
license_tier: ORIGINAL
dependencies 1 imports · 7 importers
imports: nx_syscalls.nx
imported by: nx_av1_adst.nxnx_av1_adst_gate.nxnx_av1_dct.nxnx_av1_dct_gate.nxnx_av1_txfm2d.nxnx_av1_txfm2d_gate.nxnx_av1_txfm_gate.nx
structs
| none |
consts
| 32 | const NX_TX_COS_BITS: i64 = 12 |
| 33 | const NX_TX_COS_ONE: i64 = 4096 |
functions
| 37 | func nx_av1_round2(x: i64, n: i64) -> i64 |
| 42 | func nx_av1_round2_signed(x: i64, n: i64) -> i64 |
| 51 | func nx_av1_brev(num_bits: i64, x: i64) -> i64 |
| 65 | func nx_av1_clamp(v: i64, lo: i64, hi: i64) -> i64 called by 1: main |
| 76 | func nx_av1_cos_table(t: *i64) -> i64 |
| 98 | func nx_av1_cos128(t: *i64, angle: i64) -> i64 |
| 106 | func nx_av1_sin128(t: *i64, angle: i64) -> i64 |
| 115 | func nx_av1_fwht4(inp: *i64, out: *i64) -> i64 called by 1: main |
| 134 | func nx_av1_iwht4(inp: *i64, out: *i64, shift: i64) -> i64 called by 1: main |
| 159 | func nx_av1_identity4(v: i64) -> i64 |
| 163 | func nx_av1_identity8(v: i64) -> i64 called by 1: main |
| 167 | func nx_av1_identity16(v: i64) -> i64 |
| 171 | func nx_av1_identity32(v: i64) -> i64 called by 1: main |
| 181 | func nx_av1_butterfly_b(t: *i64, arr: *i64, a: i64, b: i64, angle: i64, flip: i64) -> i64 |
| 196 | func nx_av1_butterfly_h(arr: *i64, a: i64, b: i64, flip: i64) -> i64 called by 1: main |