nx_jpeg_zigzag.nx
buildroot/runtime/nx_jpeg_zigzag.nx
about
nx_jpeg_zigzag.nx -- inverse zig-zag scan order for JPEG 8x8 blocks.
Per ITU-T Rec. T.81 Fig. A.6 / table H.1.
JPEG stores DCT coefficients in zig-zag order to cluster non-zero
coefficients near the start of the stream (improves run-length
coding efficiency). Decoding pipeline needs the inverse:
natural_block[un_zigzag[k]] = zigzag_block[k]
for k in 0..63. This file ships the 64-entry inverse-zigzag table
AND a primitive that applies it to an 8x8 i64 coefficient block.
The zig-zag scan visits 8x8 block positions in this order
(T.81 Fig. A.6):
0 1 5 6 14 15 27 28
2 4 7 13 16 26 29 42
3 8 12 17 25 30 41 43
9 11 18 24 31 40 44 53
10 19 23 32 39 45 52 54
20 22 33 38 46 51 55 60
21 34 37 47 50 56 59 61
35 36 48 49 57 58 62 63
nx_safety_envelope:
intended_use: "8x8 DCT-block un-zigzag for JPEG decode."
sil_target: SIL1
evidence: [t81_figure_a6_canonical_basis,
fixed_64_entry_table_bit_exact_reproducible]
verdict: NOT_YET_EVALUATED
dependencies 1 imports · 4 importers
imports: nx_syscalls.nx
imported by: nx_jpeg_dequant.nxnx_jpeg_dequant_test.nxnx_jpeg_mcu.nxnx_jpeg_zigzag_test.nx
structs
| none |
consts
| none |
functions
| 37 | func nx_jpeg_zigzag_inverse_table(out: *i64) -> i64 |
| 53 | func nx_jpeg_un_zigzag(src: *i64, dst: *i64) -> i64 |