code wiki / (root) / nx_jpeg_decode_image.nx

nx_jpeg_decode_image.nx

buildroot/runtime/nx_jpeg_decode_image.nx

10308 B234 linesdepth 5pulls 10 transitivereach 76 importersview sourcekind librarytopic jpeg
docsdependenciesstructsconstsfunctions

about

nx_jpeg_decode_image.nx -- full-image driver for the bits-up baseline JPEG decoder. Per ITU-T Rec. T.81 sec A + F. Takes: - Pre-parsed frame descriptor (NxJpegFrame from nx_jpeg_sof_parse) - Pre-parsed scan header (NxJpegScan from nx_jpeg_sos_parse) - 4-entry quantization tables array (indexed by sof_component.tqi) - 4-entry DC + AC Huffman tables (indexed by scan_component.td/ta) - Entropy-coded byte buffer (the bytes after the SOS header) - Per-component caller-allocated sample planes + their strides Loops over the MCU grid (rows x cols from the frame's max-h/max-v). For each MCU, iterates scan components in order, dispatching to nx_jpeg_mcu_decode_one_component which handles the Hi*Vi block grid. Per-component prev_dc tracking: each scan starts with prev_dc = 0 for every component; the MCU walker updates it across blocks. nx_safety_envelope: intended_use: "Top-level baseline-JPEG image decoder, sample planes out. Caller adds YCbCr->RGB upsample." sil_target: SIL1 evidence: [t81_section_a_canonical_basis, composes_marker_dqt_dht_sof_sos_entropy_mcu] hazard_register: [bug-tape-component-id-vs-array-index-confusion, bug-tape-restart-interval-not-honored, bug-tape-mcu-grid-cell-stride-mismatch] residual_risk: "Restart-marker (DRI / RSTn) intervals NOT yet honored. Bitstream-with-restart-markers decode requires a follow-on stone." verdict: NOT_YET_EVALUATED

dependencies 6 imports · 2 importers

nx_syscalls.nx nx_jpeg_sof.nx nx_jpeg_sos.nx nx_jpeg_dht.nx nx_jpeg_dequant.nx nx_jpeg_mcu.nx nx_jpeg_decode_image.nx nx_jpeg_decode.nx nx_jpeg_decode_image_test.nx

imports: nx_syscalls.nxnx_jpeg_sof.nxnx_jpeg_sos.nxnx_jpeg_dht.nxnx_jpeg_dequant.nxnx_jpeg_mcu.nx

imported by: nx_jpeg_decode.nxnx_jpeg_decode_image_test.nx

structs

84struct NxJpegDecCompState

consts

40const NX_JPEG_DEC_OK: i64 = 0
41const NX_JPEG_DEC_BAD_COMP: i64 = 1 // scan component selector doesn't match SOF
42const NX_JPEG_DEC_BAD_TQ: i64 = 2 // SOF component points at unknown qtable
43const NX_JPEG_DEC_BAD_TD: i64 = 3 // scan component DC table id not present
44const NX_JPEG_DEC_BAD_TA: i64 = 4 // scan component AC table id not present
45const NX_JPEG_DEC_MCU_FAIL: i64 = 5 // MCU decode propagated an entropy / mcu error
46const NX_JPEG_DEC_RESULT_N: i64 = 6
94const NX_JPEG_DEC_COMPSTATE_BYTES: i64 = 56

functions

48func nx_jpeg_dec_result_is_valid(v: i64) -> i64
57func _decoder_sof_for_scan_comp(frame: *NxJpegFrame,
70func _decoder_lookup_huffman(tables: *NxJpegHTable, n_tables: i64,
99func nx_jpeg_decode_image_resolve(frame: *NxJpegFrame, scan: *NxJpegScan,
143func nx_jpeg_decode_image_walk_mcus(frame: *NxJpegFrame, scan: *NxJpegScan,
156func _decoder_consume_rst(scan: *NxJpegScan, state: *NxJpegDecCompState,
194func nx_jpeg_decode_image_walk_mcus_ri(frame: *NxJpegFrame, scan: *NxJpegScan,