20typedef enum : uint32_t {
41typedef enum : uint8_t {
70 if ((offset > source->
size) || ((uint64_t)len > (source->
size - offset))) {
77 source->
read_at(source->
ctx, offset + done, &bytes[done], len - done, &got);
81 if ((got == 0U) || (got > (len - done))) {
105 return (uint16_t)(((uint16_t)bytes[0] << 8U) | bytes[1]);
125 ((uint32_t)bytes[2] << 8U) | bytes[3];
170 uint64_t offset = 2U;
171 while (offset < source->size) {
185 uint8_t length_bytes[2];
195 uint8_t components = 0U;
200 if ((components != 1U) && (components != 3U)) {
231 if (color_type == 0U) {
235 if ((color_type == 4U) || (color_type == 6U)) {
239 if (color_type == 2U) {
243 if (color_type != 3U) {
305 if (
memcmp(head, png,
sizeof(png)) == 0) {
313 if ((
memcmp(head, riff,
sizeof(riff)) == 0) &&
344 if ((source ==
nullptr) || (source->
read_at ==
nullptr) || (out ==
nullptr)) {
363 const uint64_t row = (uint64_t)out->
width * out->
bpp;
uint32_t jof_stored_bound(uint32_t raw_bytes)
Worst-case stored-tile byte bound for scratch/cell sizing.
Import-time transcode producer: JPEG/PNG/WebP -> JOF band-tile atlas in bounded RAM (#231,...
uint32_t jof_work_bytes(uint16_t max_width, uint16_t max_height, uint16_t tile_w, uint16_t tile_h)
Compute the work-arena size the producer needs for given caps.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
@ k_ra8_err_not_supported
Requested feature not compiled in, not wired, or not supported by this MCU variant.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
@ k_ra8_err_null_ptr
Pointer was NULL where a valid pointer was required.
@ k_ra8_err_protocol_error
Protocol-level error (e.g.
@ k_ra8_err_invalid_size
Invalid size parameter (too large, too small, or misaligned).
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Caller-workspace I/O contracts for portable format-tool engines.
ra8_err_t ra8_fmt_jof_convert_requirements(const ra8_fmt_source_t *source, ra8_fmt_jof_convert_requirements_t *out)
Derive source geometry and exact JOF conversion workspace needs.
static uint16_t internal_be16(const uint8_t bytes[2])
Decode one big-endian uint16 field.
static bool internal_is_sof(uint8_t marker)
Classify a JPEG SOF-range marker without table-marker false positives.
static ra8_err_t internal_stable(const ra8_fmt_source_t *source)
Validate a source through its optional stability callback.
static uint32_t internal_be32(const uint8_t bytes[4])
Decode one big-endian uint32 field.
ra8_err_t ra8_fmt_jof_verify_requirements(const ra8_fmt_source_t *source, ra8_fmt_jof_verify_requirements_t *out)
Derive exact producer and comparison storage for bounded JOF verification.
static ra8_err_t internal_png_bpp(const ra8_fmt_source_t *source, uint8_t color_type, uint8_t *bpp)
Scan pre-IDAT PNG chunks for palette transparency.
static ra8_err_t internal_exact(const ra8_fmt_source_t *source, uint64_t offset, uint8_t *bytes, size_t len)
Read one exact positioned span.
verify_plan_const_t
Bounded encoded-header probe constants.
@ k_verify_jpeg_dac
JPEG arithmetic table code.
@ k_verify_png_head
Signature, IHDR, and colour type.
@ k_verify_jpeg_soi
JPEG start-of-image marker.
@ k_verify_png_color_type
PNG IHDR colour-type offset.
@ k_verify_u32_high_shift
Big-endian uint32 high shift.
@ k_verify_png_idat
PNG IDAT chunk code.
@ k_verify_jpeg_jpg
JPEG reserved SOF-range code.
@ k_verify_jpeg_marker
JPEG marker introducer.
@ k_verify_fourcc_bytes
RIFF/WebP fourCC width.
@ k_verify_jpeg_dht
JPEG table code in SOF range.
@ k_verify_jpeg_sof0
First JPEG SOF code.
@ k_verify_png_chunks
First post-IHDR chunk offset.
@ k_verify_webp_form_offset
RIFF form-type field offset.
@ k_verify_jpeg_sof_last
Last JPEG SOF-range marker.
@ k_verify_png_trns
PNG tRNS chunk code.
@ k_verify_jpeg_components
Component-count offset after len.
@ k_verify_png_chunk_record
PNG chunk framing bytes.
static ra8_err_t internal_jpeg_bpp(const ra8_fmt_source_t *source, uint8_t *bpp)
Determine baseline JPEG output channels from the first SOF.
static ra8_err_t internal_bpp(const ra8_fmt_source_t *source, uint8_t *bpp)
Derive exact producer output channels from source headers.
verify_png_signature_t
Fixed non-ASCII bytes in the PNG signature.
@ k_verify_png_sig_sub
DOS EOF byte.
@ k_verify_png_sig_cr
Carriage return byte.
@ k_verify_png_sig_lf
Line feed byte.
@ k_verify_png_sig_high
High-bit signature byte.
int memcmp(const void *a, const void *b, size_t n)
Compare bytes in two memory areas.
Source geometry and exact arenas required by one JOF conversion.
uint16_t width
Declared source width in pixels.
uint32_t webp_work_bytes
Exact WebP whole-frame bytes, or zero.
uint16_t height
Declared source height in pixels.
uint16_t tile_height
Height selected for emitted tiles.
uint32_t work_bytes
Exact streaming-producer arena bytes.
Exact phase-reused storage requirements for JOF verification.
uint32_t row_bytes
One decoded reference row.
uint8_t bpp
Decoder output bytes per pixel.
uint16_t band_height
Subject tile height under test.
uint32_t reference_work_bytes
One-row reference producer arena.
uint16_t width
Source width in pixels.
uint16_t height
Source height in pixels.
uint32_t band_tile_bytes
Largest decoded subject tile.
uint32_t scratch_bytes
Largest stored-tile staging buffer.
uint32_t webp_work_bytes
Whole-frame WebP arena, or zero.
uint32_t banded_work_bytes
Banded subject producer arena.
Immutable, randomly readable input object.
uint64_t size
Exact object byte length.
void * ctx
Backend-owned context.
ra8_fmt_source_validate_fn validate
Optional stability callback.
jof_pread_fn read_at
Positioned-read callback.