code wiki / (root) / nx_jpeg_progressive.nx

nx_jpeg_progressive.nx

buildroot/runtime/nx_jpeg_progressive.nx

19088 B401 linesdepth 7pulls 14 transitivereach 72 importersview sourcekind librarytopic jpeg
docsdependenciesstructsconstsfunctions

about

nx_jpeg_progressive.nx -- PROGRESSIVE JPEG decode (SOF2), the eat-the-debt unblock for real web photos. Baseline decodes one scan block->IDCT->pixel; progressive has MANY scans that each refine a spectral band of a full-image COEFFICIENT buffer (spectral selection Ss..Se + successive approximation Ah/Al), then a single IDCT pass at the end. Four scan kinds: DC-first, DC-refine, AC-first (EOBRUN), AC-refine (the fiddly one). Faithful to T.81 G.1.2 / libjpeg jdphuff. Restart intervals (DRI>0) NOT yet handled (assumes DRI=0). ORIGINAL.

dependencies 10 imports · 2 importers

nx_syscalls.nx nx_jpeg_sof.nx nx_jpeg_sos.nx nx_jpeg_dqt.nx nx_jpeg_dht.nx nx_jpeg_entropy.nx nx_jpeg_dequant.nx nx_jpeg_idct.nx nx_jpeg_mcu.nx nx_jpeg_decode.nx nx_jpeg_progressive.nx nx_jpeg_ascii.nx nx_jpegprobe.nx

imports: nx_syscalls.nxnx_jpeg_sof.nxnx_jpeg_sos.nxnx_jpeg_dqt.nxnx_jpeg_dht.nxnx_jpeg_entropy.nxnx_jpeg_dequant.nxnx_jpeg_idct.nxnx_jpeg_mcu.nxnx_jpeg_decode.nx

imported by: nx_jpeg_ascii.nxnx_jpegprobe.nx

structs

none

consts

17const NX_JPEG_PROG_OK: i64 = 0
18const NX_JPEG_PROG_FAIL: i64 = 1

functions

20func pgw(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(2, s, n); return 0 }
calls 1: sys_write
21func pgd(v: i64) -> i64
34func nx_jpeg_is_progressive(jpeg: *u8, jpeg_len: i64) -> i64
56func prog_next_marker(j: *u8, len: i64, from: i64) -> i64
called by 1: nx_jpeg_prog_decode
71func prog_refine_nz(coeffs: *i64, k: i64, p1: i64, bit: i64) -> i64
called by 1: prog_scan
82func prog_scan(j: *u8, len: i64, scan: *NxJpegScan, frame: *NxJpegFrame,
256func prog_be16(j: *u8, o: i64) -> i64 { return ((j[o] & 0xff) << 8) | (j[o + 1] & 0xff) }
261func nx_jpeg_prog_decode(jpeg: *u8, jpeg_len: i64, ctx: *NxJpegDecCtx, planes: *u8, strides: *i64) -> i64