code wiki / (root) / nx_jpeg_mcu.nx

nx_jpeg_mcu.nx

buildroot/runtime/nx_jpeg_mcu.nx

8022 B189 linesdepth 4pulls 9 transitivereach 78 importersview sourcekind librarytopic jpeg
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_jpeg_sof.nx nx_jpeg_sos.nx nx_jpeg_dht.nx nx_jpeg_entropy.nx nx_jpeg_dequant.nx nx_jpeg_zigzag.nx nx_jpeg_idct.nx nx_jpeg_mcu.nx nx_jpeg_decode.nx nx_jpeg_decode_image.nx nx_jpeg_decode_image_test.nx nx_jpeg_mcu_test.nx nx_jpeg_progressive.nx

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

63struct NxJpegMcuScratch
86struct NxJpegBitStream

consts

48const NX_JPEG_MCU_OK: i64 = 0
49const NX_JPEG_MCU_BAD_COMPONENT: i64 = 1 // component count mismatch
50const NX_JPEG_MCU_ENTROPY_FAIL: i64 = 2
51const NX_JPEG_MCU_BAD_QTABLE: i64 = 3
52const NX_JPEG_MCU_RESULT_N: i64 = 4
70const NX_JPEG_MCU_SCRATCH_BYTES: i64 = 32
93const NX_JPEG_BITSTREAM_BYTES: i64 = 32

functions

54func nx_jpeg_mcu_result_is_valid(v: i64) -> i64
75func nx_jpeg_mcu_scratch_init(s: *NxJpegMcuScratch) -> i64
97func nx_jpeg_mcu_decode_one_block(dc_table: *NxJpegHTable,
163func nx_jpeg_mcu_decode_one_component(sof_comp: *NxJpegSofComponent,