code wiki / (root) / nx_av1_adst.nx

nx_av1_adst.nx

buildroot/runtime/nx_av1_adst.nx

3630 B102 linesdepth 3pulls 3 transitivereach 3 importersview sourcekind librarytopic av1
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_av1_txfm.nx nx_av1_adst.nx nx_av1_adst_gate.nx nx_av1_txfm2d.nx nx_av1_txfm2d_gate.nx

imports: nx_syscalls.nxnx_av1_txfm.nx

imported by: nx_av1_adst_gate.nxnx_av1_txfm2d.nxnx_av1_txfm2d_gate.nx

structs

none

consts

31const NX_SINPI_1_9: i64 = 1321
32const NX_SINPI_2_9: i64 = 2482
33const NX_SINPI_3_9: i64 = 3344
34const NX_SINPI_4_9: i64 = 3803
85const NX_TXT_DCT_DCT: i64 = 0
86const NX_TXT_ADST_DCT: i64 = 1
87const NX_TXT_DCT_ADST: i64 = 2
88const NX_TXT_ADST_ADST: i64 = 3

functions

41func nx_av1_iadst4(io: *i64) -> i64
91func nx_av1_txt_row_is_adst(tx_type: i64) -> i64
called by 1: main
98func nx_av1_txt_col_is_adst(tx_type: i64) -> i64
called by 1: main