nx_av1_adst.nx
buildroot/runtime/nx_av1_adst.nx
about
nx_av1_adst.nx -- AV1/AV2 inverse ADST (asymmetric discrete sine transform).
AV1 picks between DCT and ADST per block and per axis, because they have
opposite shapes at the block edge: the DCT's first basis is FLAT, the ADST's
is a RISING RAMP. Intra-predicted residuals are typically small next to the
predicted edge and grow with distance from it, which is exactly the ADST's
basis-0 shape -- that is the whole reason it exists in the codec.
SUBSTITUTING ONE FOR THE OTHER DECODES. That is the danger: a block coded
with ADST and reconstructed with DCT produces a plausible image with wrong
gradients near block edges, which reads as banding or a soft grid rather
than as corruption. Nothing errors.
THE SINPI CONSTANTS ARE NOT THE COSINE TABLE. ADST uses sin(k*pi/9) at
12-bit -- 1321, 2482, 3344, 3803 -- which appear nowhere in the DCT's
quarter-period cosine table. Reaching for cos128() here silently builds a
transform with the wrong basis entirely.
THE OUTPUT OF A BASIS-0 IMPULSE IS THE CONSTANT SET ITSELF. Feeding
[4096,0,0,0] returns exactly [1321, 2482, 3344, 3803] -- the four constants,
in order. That makes the transform exactly checkable without reference
vectors, and it is what the gate asserts.
genealogy_id: av1_spec_7_13_2_6_inverse_adst
lineage_id: nx_av1_adst_v1
license_tier: ORIGINAL
dependencies 2 imports · 3 importers
imports: nx_syscalls.nxnx_av1_txfm.nx
imported by: nx_av1_adst_gate.nxnx_av1_txfm2d.nxnx_av1_txfm2d_gate.nx
structs
| none |
consts
| 31 | const NX_SINPI_1_9: i64 = 1321 |
| 32 | const NX_SINPI_2_9: i64 = 2482 |
| 33 | const NX_SINPI_3_9: i64 = 3344 |
| 34 | const NX_SINPI_4_9: i64 = 3803 |
| 85 | const NX_TXT_DCT_DCT: i64 = 0 |
| 86 | const NX_TXT_ADST_DCT: i64 = 1 |
| 87 | const NX_TXT_DCT_ADST: i64 = 2 |
| 88 | const NX_TXT_ADST_ADST: i64 = 3 |
functions
| 41 | func nx_av1_iadst4(io: *i64) -> i64 |
| 91 | func nx_av1_txt_row_is_adst(tx_type: i64) -> i64 called by 1: main |
| 98 | func nx_av1_txt_col_is_adst(tx_type: i64) -> i64 called by 1: main |