nx_jpeg_dequant.nx
buildroot/runtime/nx_jpeg_dequant.nx
about
nx_jpeg_dequant.nx -- dequantization + un-zigzag composer.
Per ITU-T Rec. T.81 sec A.3.4 / F.2.1.4.
JPEG stores quantized DCT coefficients in zig-zag scan order so
the entropy-coded RLE clusters the typically-many trailing zeros.
To recover natural-order coefficients for the IDCT:
1. Dequantize: natural-magnitude_zz[k] = q_zz[k] * quant_zz[k]
(element-wise multiply in zig-zag order; legal because both
arrays are in the same order)
2. Un-zigzag: natural[un_zigzag[k]] = natural-magnitude_zz[k]
Composed in a single pass for efficiency: walk k = 0..63 once,
computing the natural position from the un_zigzag table and
writing the dequantized value directly to natural[un_zigzag[k]].
nx_safety_envelope:
intended_use: "Dequant + un-zigzag for JPEG decode pipeline."
sil_target: SIL1
evidence: [t81_section_a3_4_canonical_basis,
composes_zigzag_primitive,
composes_dqt_primitive]
hazard_register: [bug-tape-dequant-zero-divisor-not-applicable,
bug-tape-zigzag-permutation-table-corruption]
residual_risk: "Caller responsible for ensuring quant table
has 64 entries and is the table-id specified
by the SOF0 component descriptor."
verdict: NOT_YET_EVALUATED
dependencies 2 imports · 4 importers
imports: nx_syscalls.nxnx_jpeg_zigzag.nx
imported by: nx_jpeg_decode_image.nxnx_jpeg_dequant_test.nxnx_jpeg_mcu.nxnx_jpeg_progressive.nx
structs
| none |
consts
| none |
functions
| 40 | func nx_jpeg_dequant_un_zigzag(zz_coeffs: *i64, called by 3: mainnx_jpeg_mcu_decode_one_blocknx_jpeg_prog_decode calls 2: sys_mmapnx_jpeg_zigzag_inverse_table |