nx_jpeg_sos.nx
buildroot/runtime/nx_jpeg_sos.nx
about
nx_jpeg_sos.nx -- JPEG Start-of-Scan header parser.
Per ITU-T Rec. T.81 sec B.2.3.
SOS segment payload (immediately after the 2-byte length the
marker scanner already consumed):
Ns (1 byte) number of components in this scan (1..4)
per component (2 bytes each):
Csj (1 byte) component selector (matches a Ci from the
active SOF frame descriptor)
TdjTaj (1 byte) high4 = Td DC Huffman table id (0..3),
low4 = Ta AC Huffman table id (0..3)
Ss (1 byte) start of spectral selection. Baseline JPEG
always 0.
Se (1 byte) end of spectral selection. Baseline JPEG
always 63.
AhAl (1 byte) high4 = Ah successive-approximation high,
low4 = Al successive-approximation low.
Baseline JPEG always 0x00.
Total: 1 + 2 * Ns + 3 bytes.
After this header, the entropy-coded segment begins (handled by
nx_jpeg_entropy).
nx_safety_envelope:
intended_use: "Scan-header parsing for JPEG decode."
sil_target: SIL1
evidence: [t81_section_b_2_3_canonical_basis,
bounded_4_component_max]
hazard_register: [bug-tape-sos-bad-ns,
bug-tape-sos-progressive-mistaken-baseline]
residual_risk: "Progressive JPEG (Ss != 0 or Se != 63 or
AhAl != 0) is detected but not decoded by
this primitive."
verdict: NOT_YET_EVALUATED
dependencies 1 imports · 6 importers
imports: nx_syscalls.nx
imported by: nx_jpeg_decode.nxnx_jpeg_decode_image.nxnx_jpeg_decode_image_test.nxnx_jpeg_mcu.nxnx_jpeg_progressive.nxnx_jpeg_sos_test.nx
structs
| 53 | struct NxJpegSosComponent |
| 61 | struct NxJpegScan |
consts
| 40 | const NX_JPEG_SOS_OK: i64 = 0 |
| 41 | const NX_JPEG_SOS_TRUNC: i64 = 1 |
| 42 | const NX_JPEG_SOS_BAD_NS: i64 = 2 |
| 43 | const NX_JPEG_SOS_BAD_TABLE: i64 = 3 |
| 44 | const NX_JPEG_SOS_NOT_BASELINE: i64 = 4 |
| 45 | const NX_JPEG_SOS_RESULT_N: i64 = 5 |
| 59 | const NX_JPEG_SOS_COMP_BYTES: i64 = 24 |
| 70 | const NX_JPEG_SCAN_BYTES: i64 = 48 |
functions
| 47 | func nx_jpeg_sos_result_is_valid(v: i64) -> i64 |
| 74 | func nx_jpeg_sos_parse(payload: *u8, payload_len: i64, |