code wiki / (root) / nx_vtransform_dct2.nx

nx_vtransform_dct2.nx

buildroot/runtime/nx_vtransform_dct2.nx

4688 B98 linesdepth 2pulls 2 transitivereach 110 importersview sourcekind librarytopic vtransform
docsdependenciesstructsconstsfunctions

about

nx_vtransform_dct2.nx -- ROYALTY-FREE integer DCT-II (4x4) for the sovereign video codec. PATENT-CLEAN BY PROVENANCE: the literal Ahmed-Natarajan-Rao 1974 DCT-II basis cos((2n+1)*k*pi/8), evaluated at scale 64 and rounded to integers -> matrix M, with UNIFORM scalar quantization. This is NOT H.264/AVC's specific integer core ([1,1,1,1; 2,1,-1,-2; 1,-1,-1,1; 1,-2,2,-1]) and NOT its position-dependent Mf/Vi quant tables (those are the AVC patent-pool technique), and NOT HEVC's 32x32-derived matrices. The DCT *itself* is 1974 prior art -- CITED to the sovereign-fetched source knowledge/fetched/dct_provenance.raw ("Nasir Ahmed ... in 1972 ... Natarajan ... Rao ... 1974"). Better energy compaction than Walsh-Hadamard on natural images -> recovers the DCT RD win cleanly. Shape-compatible with nx_vtransform: vt2_fwd / vt2_inv / vt2_quant / vt2_dequant operate on a 4x4 i64 block (row-major, 16 elements). license_tier: ORIGINAL

dependencies 1 imports · 4 importers

nx_syscalls.nx nx_vtransform_dct2.nx nx_rangecoder_gain_gate.nx nx_vcodec.nx nx_vcodec_mrbits_gate.nx nx_vcodec_tsize_rd_gate.nx

imports: nx_syscalls.nx

imported by: nx_rangecoder_gain_gate.nxnx_vcodec.nxnx_vcodec_mrbits_gate.nxnx_vcodec_tsize_rd_gate.nx

structs

none

consts

20const DCT2_QSHIFT: i64 = 10 // q<<10: aligns the quant step with the WHT path's raw scale (DCT 2D fwd
23const DCT2_ISHIFT: i64 = 24 // inverse final descale (2D round-trip ~= 4096^2 = 2^24)
24const DCT2_IROUND: i64 = 8388608 // 1<<23, symmetric rounding for the inverse descale
76const VC_QOFF_24: i64 = 10

functions

27func vt2_1d_fwd(b: *i64, base: i64, st: i64) -> i64
called by 1: vt2_fwd
39func vt2_1d_inv(b: *i64, base: i64, st: i64) -> i64
called by 1: vt2_inv
50func vt2_fwd(blk: *i64) -> i64
57func vt2_inv(blk: *i64) -> i64
78func vt2_quant(blk: *i64, q: i64) -> i64
called by 3: mainenc_armtscode
93func vt2_dequant(blk: *i64, q: i64) -> i64