code wiki / (root) / nx_jpeg_decode.nx

nx_jpeg_decode.nx

buildroot/runtime/nx_jpeg_decode.nx

9941 B214 linesdepth 6pulls 13 transitivereach 74 importersview sourcekind librarytopic jpeg
docsdependenciesstructsconstsfunctions

about

nx_jpeg_decode.nx -- top-level baseline-JPEG decoder. The marker-walking front-end that ties every brick in the JPEG arc into a bytes-in / sample-planes-out API. Pipeline: jpeg_bytes -> nx_jpeg_seg_next (marker scan) for each segment: DQT -> nx_jpeg_dqt_parse, append to qtables DHT -> nx_jpeg_dht_parse, append to htables SOF0 -> nx_jpeg_sof_parse, store frame SOS -> nx_jpeg_sos_parse, store scan + record entropy_off (entropy bytes run from segment end to EOI) else -> skip (APP / COM / etc.) -> nx_jpeg_decode_image_resolve (per-component table lookup) -> nx_jpeg_decode_image_walk_mcus (MCU grid driver) Output: per-component sample planes filled. Caller upsamples + YCbCr->RGB to produce the final RGB framebuffer. Caller supplies all the storage (frame + scan + qtables + htables + per-component planes). Substrate adds no malloc beyond the scratch arenas internal to per-block primitives. nx_safety_envelope: intended_use: "Top-level baseline-JPEG decode -- bytes-in, sample-planes-out. Last brick before YCbCr->RGB upsample step." sil_target: SIL1 evidence: [composes_marker_dqt_dht_sof_sos_decode_image, sealed_verdicts_per_segment_kind, bounded_iteration] hazard_register: [bug-tape-progressive-mistaken-baseline, bug-tape-restart-marker-not-honored, bug-tape-app-segment-length-overrun] residual_risk: "Baseline (SOF0) only. Progressive (SOF2), extended-sequential (SOF1), and arithmetic- coded variants reject with NOT_BASELINE." verdict: NOT_YET_EVALUATED

dependencies 8 imports · 3 importers

nx_syscalls.nx nx_jpeg_marker.nx nx_jpeg_dqt.nx nx_jpeg_dht.nx nx_jpeg_sof.nx nx_jpeg_sos.nx nx_jpeg_mcu.nx nx_jpeg_decode_image.nx nx_jpeg_decode.nx nx_jpeg_ascii.nx nx_jpeg_decode_test.nx nx_jpeg_progressive.nx

imports: nx_syscalls.nxnx_jpeg_marker.nxnx_jpeg_dqt.nxnx_jpeg_dht.nxnx_jpeg_sof.nxnx_jpeg_sos.nxnx_jpeg_mcu.nxnx_jpeg_decode_image.nx

imported by: nx_jpeg_ascii.nxnx_jpeg_decode_test.nxnx_jpeg_progressive.nx

structs

70struct NxJpegDecCtx

consts

50const NX_JPEG_DEC_TOP_OK: i64 = 0
51const NX_JPEG_DEC_TOP_NO_SOI: i64 = 1
52const NX_JPEG_DEC_TOP_NO_SOF: i64 = 2
53const NX_JPEG_DEC_TOP_NO_SOS: i64 = 3
54const NX_JPEG_DEC_TOP_BAD_DQT: i64 = 4
55const NX_JPEG_DEC_TOP_BAD_DHT: i64 = 5
56const NX_JPEG_DEC_TOP_BAD_SOF: i64 = 6
57const NX_JPEG_DEC_TOP_BAD_SOS: i64 = 7
58const NX_JPEG_DEC_TOP_NOT_BASELINE: i64 = 8
59const NX_JPEG_DEC_TOP_IMAGE_FAIL: i64 = 9 // resolve / walk_mcus error
60const NX_JPEG_DEC_TOP_RESULT_N: i64 = 10
88const NX_JPEG_DEC_CTX_BYTES: i64 = 112

functions

62func nx_jpeg_dec_top_result_is_valid(v: i64) -> i64
92func nx_jpeg_dec_ctx_init(ctx: *NxJpegDecCtx) -> i64
122func nx_jpeg_decode(jpeg: *u8, jpeg_len: i64,