nx_zigzag.nx
buildroot/runtime/nx_zigzag.nx
about
nx_zigzag.nx -- canonical 8x8 zigzag scan order (JPEG/MPEG/H.264).
After a 2D DCT, energy concentrates in the low-frequency corner
(top-left); high-frequency coefficients are mostly zero after
quantisation. The zigzag scan re-orders the 64 coefficients so
low-frequency entries come first and high-frequency entries last,
turning sparse 8x8 blocks into 64-element vectors with long runs
of zeros at the tail -- perfect for run-length encoding.
Layout (row-major position -> position in zigzag stream):
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
Equivalently, position-in-stream k -> (row, col) via the inverse
table below. We expose both directions.
genealogy_id: jpeg_iso_10918_1992 + h261_itu_1990 + h263_itu_1996 +
nx_dct8_q10
lineage_id: nishi_zigzag_q10
dependencies 1 imports · 19 importers
diagram shows first 10 each side; +0 more imports, +9 more importers in the complete lists below.
imports: nx_syscalls.nx
imported by: nx_cam_poster.nxnx_codec_rd2_gate.nxnx_codec_rd_gate.nxnx_codec_real_rd2.nxnx_codec_real_rd2f.nxnx_codec_real_rd2g.nxnx_codec_real_rd3.nxnx_galx_thumb_oneshot.nxnx_jpeg_block_enc_gate.nxnx_jpeg_color_write.nxnx_jpeg_color_write_gate.nxnx_jpeg_rst_gate.nxnx_jpeg_write.nxnx_jpeg_write_gate.nxnx_reader_panels_gate.nxnx_reader_tile.nxnx_reader_tile_gate.nxnx_reader_zoomserve_gate.nxnx_video_codec.nx
structs
| none |
consts
| 37 | const NX_ZIGZAG_VERDICT_UNKNOWN: i64 = 0 |
| 38 | const NX_ZIGZAG_VERDICT_OK: i64 = 1 |
| 39 | const NX_ZIGZAG_VERDICT_BAD_PARAMS: i64 = 2 |
| 40 | const NX_ZIGZAG_VERDICT_N: i64 = 3 |
functions
| 45 | func nx_zigzag_init(to_zz: *i64, from_zz: *i64) -> i64 |
| 75 | func nx_zigzag_scan(block: *i64, to_zz: *i64, stream: *i64) -> i64 |
| 85 | func nx_zigzag_unscan(stream: *i64, from_zz: *i64, block: *i64) -> i64 |
| 94 | func nx_zigzag_verdict_is_valid(v: i64) -> i64 |