nx_jpeg_mcu.nx
buildroot/runtime/nx_jpeg_mcu.nx
about
nx_jpeg_mcu.nx -- baseline-JPEG MCU walker. Per ITU-T Rec. T.81
sec A.2.3. The top-level orchestrator that ties together every
per-block primitive shipped earlier in Arc C1.
MCU = Minimum Coded Unit. For each MCU position in the image:
for each component (in scan order):
for each data unit (block) in this MCU for this component:
(Hi * Vi blocks total for component i)
1. nx_jpeg_ent_decode_block -- entropy decode -> zz-order 64 coeffs
2. nx_jpeg_dequant_un_zigzag -- * QTable, un-zigzag -> 64 nat coeffs
3. nx_jpeg_idct_8x8 -- inverse DCT -> 64 samples
4. level shift +128 + clamp to [0..255] -> 64 u8 samples
5. write to component sample plane at correct (x,y)
Per-component plane dimensions (T.81 sec A.2.4):
x_i = ceil(X * Hi / max_h)
y_i = ceil(Y * Vi / max_v)
For 4:2:0 YCbCr (max_h = max_v = 2; Y has H=V=2, Cb/Cr H=V=1):
Y plane: full image width x height (each MCU contributes 16x16 px = 4 blocks)
Cb plane: half width x half height (each MCU contributes 8x8 px = 1 block)
Cr plane: half width x half height (each MCU contributes 8x8 px = 1 block)
nx_safety_envelope:
intended_use: "Top-level MCU walker for baseline JPEG decode."
sil_target: SIL1
evidence: [t81_section_a_2_3_canonical_basis,
composes_9_per_block_primitives,
bounded_iteration_via_sof_mcu_rows_cols]
hazard_register: [bug-tape-mcu-grid-overrun,
bug-tape-component-plane-stride-mismatch,
bug-tape-prev-dc-not-reset-per-scan]
residual_risk: "Restart-marker (DRI) interval handling not yet
wired -- baseline JPEGs without restart markers
decode correctly; those with RST0..RST7 markers
need a follow-on stone."
verdict: NOT_YET_EVALUATED
dependencies 8 imports · 5 importers
imports: nx_syscalls.nxnx_jpeg_sof.nxnx_jpeg_sos.nxnx_jpeg_dht.nxnx_jpeg_entropy.nxnx_jpeg_dequant.nxnx_jpeg_zigzag.nxnx_jpeg_idct.nx
imported by: nx_jpeg_decode.nxnx_jpeg_decode_image.nxnx_jpeg_decode_image_test.nxnx_jpeg_mcu_test.nxnx_jpeg_progressive.nx
structs
| 63 | struct NxJpegMcuScratch |
| 86 | struct NxJpegBitStream |
consts
| 48 | const NX_JPEG_MCU_OK: i64 = 0 |
| 49 | const NX_JPEG_MCU_BAD_COMPONENT: i64 = 1 // component count mismatch |
| 50 | const NX_JPEG_MCU_ENTROPY_FAIL: i64 = 2 |
| 51 | const NX_JPEG_MCU_BAD_QTABLE: i64 = 3 |
| 52 | const NX_JPEG_MCU_RESULT_N: i64 = 4 |
| 70 | const NX_JPEG_MCU_SCRATCH_BYTES: i64 = 32 |
| 93 | const NX_JPEG_BITSTREAM_BYTES: i64 = 32 |
functions
| 54 | func nx_jpeg_mcu_result_is_valid(v: i64) -> i64 |
| 75 | func nx_jpeg_mcu_scratch_init(s: *NxJpegMcuScratch) -> i64 |
| 97 | func nx_jpeg_mcu_decode_one_block(dc_table: *NxJpegHTable, |
| 163 | func nx_jpeg_mcu_decode_one_component(sof_comp: *NxJpegSofComponent, |