|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Exact caller-workspace planning for JOF verification. More...
#include <stddef.h>#include <stdint.h>#include <string.h>#include "jof_produce.h"#include "ra8_attributes.h"#include "ra8_fmt_stream.h"Go to the source code of this file.
Enumerations | |
| enum | verify_plan_const_t : uint32_t { k_verify_png_head = 26U , k_verify_png_chunks = 33U , k_verify_png_trns = 0x74524E53U , k_verify_png_idat = 0x49444154U , k_verify_jpeg_sof0 = 0xC0U , k_verify_jpeg_dht = 0xC4U , k_verify_jpeg_jpg = 0xC8U , k_verify_jpeg_dac = 0xCCU , k_verify_jpeg_marker = 0xFFU , k_verify_jpeg_soi = 0xD8U , k_verify_jpeg_sof_last = 0xCFU , k_verify_u32_high_shift = 24U , k_verify_jpeg_components = 7U , k_verify_png_chunk_record = 12U , k_verify_png_color_type = 25U , k_verify_fourcc_bytes = 4U , k_verify_webp_form_offset = 8U } |
| Bounded encoded-header probe constants. More... | |
| enum | verify_png_signature_t : uint8_t { k_verify_png_sig_high = 0x89U , k_verify_png_sig_cr = 0x0DU , k_verify_png_sig_lf = 0x0AU , k_verify_png_sig_sub = 0x1AU } |
| Fixed non-ASCII bytes in the PNG signature. More... | |
Functions | |
| 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. | |
| static uint16_t | internal_be16 (const uint8_t bytes[2]) |
| Decode one big-endian uint16 field. | |
| static uint32_t | internal_be32 (const uint8_t bytes[4]) |
| Decode one big-endian uint32 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_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_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_bpp (const ra8_fmt_source_t *source, uint8_t *bpp) |
| Derive exact producer output channels from source headers. | |
| static ra8_err_t | internal_stable (const ra8_fmt_source_t *source) |
| Validate a source through its optional stability callback. | |
| 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. | |
Exact caller-workspace planning for JOF verification.
Probes encoded JPEG, PNG, and WebP headers through positioned reads, derives decoder channel geometry, and reports exact caller-workspace bounds.
Definition in file ra8_fmt_stream_verify_plan.c.
| enum verify_plan_const_t : uint32_t |
Bounded encoded-header probe constants.
Definition at line 20 of file ra8_fmt_stream_verify_plan.c.
| enum verify_png_signature_t : uint8_t |
Fixed non-ASCII bytes in the PNG signature.
| Enumerator | |
|---|---|
| k_verify_png_sig_high | High-bit signature byte. |
| k_verify_png_sig_cr | Carriage return byte. |
| k_verify_png_sig_lf | Line feed byte. |
| k_verify_png_sig_sub | DOS EOF byte. |
Definition at line 41 of file ra8_fmt_stream_verify_plan.c.
|
static |
Decode one big-endian uint16 field.
Combines exactly two network-order bytes without unaligned access.
| [in] | bytes | Two encoded bytes. |
| UINT16_MAX | The encoded field contains all one bits. |
bytes spans exactly two readable bytes. Definition at line 103 of file ra8_fmt_stream_verify_plan.c.
Referenced by internal_jpeg_bpp().
|
static |
Decode one big-endian uint32 field.
Combines exactly four network-order bytes without unaligned access.
| [in] | bytes | Four encoded bytes. |
| UINT32_MAX | The encoded field contains all one bits. |
bytes spans exactly four readable bytes. Definition at line 122 of file ra8_fmt_stream_verify_plan.c.
References k_verify_u32_high_shift.
Referenced by internal_png_bpp().
|
static |
Derive exact producer output channels from source headers.
Dispatches bounded JPEG, PNG, and WebP header probes.
| [in] | source | Supported encoded image. |
| [out] | bpp | Receives one, three, or four. |
| k_ra8_ok | A supported source supplied its decoder channel count. |
| k_ra8_err_not_supported | The source kind is unsupported. |
| other | Source or malformed-header status. |
source is non-null with at least the bounded probe prefix. bpp is writable. bpp. Definition at line 287 of file ra8_fmt_stream_verify_plan.c.
References internal_exact(), internal_jpeg_bpp(), internal_png_bpp(), k_ra8_err_not_supported, k_ra8_ok, k_verify_fourcc_bytes, k_verify_jpeg_marker, k_verify_jpeg_soi, k_verify_png_color_type, k_verify_png_head, k_verify_png_sig_cr, k_verify_png_sig_high, k_verify_png_sig_lf, k_verify_png_sig_sub, k_verify_webp_form_offset, and memcmp().
Referenced by ra8_fmt_jof_verify_requirements().
|
static |
Read one exact positioned span.
Loops over legal short reads and rejects premature or oversized progress.
| [in] | source | Bound immutable source. |
| [in] | offset | Absolute offset. |
| [out] | bytes | Exact destination span. |
| [in] | len | Required byte count. |
| k_ra8_ok | Every requested byte was initialized. |
| k_ra8_err_protocol_error | The range or callback progress was invalid. |
| other | Positioned-source callback status. |
source size. bytes spans len writable bytes. Definition at line 68 of file ra8_fmt_stream_verify_plan.c.
References ra8_fmt_source_t::ctx, k_ra8_err_protocol_error, k_ra8_ok, ra8_fmt_source_t::read_at, and ra8_fmt_source_t::size.
Referenced by internal_bpp(), internal_jpeg_bpp(), and internal_png_bpp().
|
static |
Classify a JPEG SOF-range marker without table-marker false positives.
Accepts frame markers while excluding DHT, JPG, and DAC codes.
| [in] | marker | Candidate marker byte. |
marker is a supported start-of-frame marker. | true | The marker denotes a frame header. |
| false | The marker is outside the range or names a table. |
marker is the byte following a JPEG marker introducer. Definition at line 143 of file ra8_fmt_stream_verify_plan.c.
References k_verify_jpeg_dac, k_verify_jpeg_dht, k_verify_jpeg_jpg, k_verify_jpeg_sof0, and k_verify_jpeg_sof_last.
Referenced by internal_jpeg_bpp().
|
static |
Determine baseline JPEG output channels from the first SOF.
Walks bounded marker segments until a supported frame header is found.
| [in] | source | JPEG source. |
| [out] | bpp | Receives one or three output channels. |
| k_ra8_ok | A supported SOF supplied the channel count. |
| k_ra8_err_not_supported | The SOF channel count is unsupported. |
| other | Source or malformed-marker status. |
source is non-null with a positioned-read callback. bpp. Definition at line 168 of file ra8_fmt_stream_verify_plan.c.
References internal_be16(), internal_exact(), internal_is_sof(), k_ra8_err_not_supported, k_ra8_err_protocol_error, k_ra8_ok, k_verify_jpeg_components, and k_verify_jpeg_marker.
Referenced by internal_bpp().
|
static |
Scan pre-IDAT PNG chunks for palette transparency.
Maps IHDR colour type and optional tRNS presence to producer channels.
| [in] | source | PNG source. |
| [in] | color_type | IHDR colour-type byte. |
| [out] | bpp | Receives the producer output channel count. |
| k_ra8_ok | A supported mapping reached the first IDAT. |
| k_ra8_err_not_supported | The colour type is unsupported. |
| other | Source or malformed-chunk status. |
source is a bounded PNG positioned source. bpp is writable. bpp exactly as the producer does. Definition at line 229 of file ra8_fmt_stream_verify_plan.c.
References internal_be32(), internal_exact(), k_ra8_err_not_supported, k_ra8_err_protocol_error, k_ra8_ok, k_verify_png_chunk_record, k_verify_png_chunks, k_verify_png_idat, k_verify_png_trns, and ra8_fmt_source_t::size.
Referenced by internal_bpp().
|
static |
Validate a source through its optional stability callback.
Delegates immutable-view revalidation while preserving optional bindings.
| [in] | source | Source to validate. |
| k_ra8_ok | The source is unchanged or has no validator. |
| other | The backend observed mutation or validation failure. |
source is non-null. Definition at line 336 of file ra8_fmt_stream_verify_plan.c.
References ra8_fmt_source_t::ctx, k_ra8_ok, ra8_fmt_source_t::size, and ra8_fmt_source_t::validate.
Referenced by ra8_fmt_jof_verify_requirements().
|
nodiscard |
Derive exact producer and comparison storage for bounded JOF verification.
| [in] | source | Stable JPEG, PNG, or WebP source. |
| [out] | out | Receives exact phase requirements. |
source provides immutable positioned reads for its declared size. Definition at line 341 of file ra8_fmt_stream_verify_plan.c.
References ra8_fmt_jof_verify_requirements_t::band_height, ra8_fmt_jof_verify_requirements_t::band_tile_bytes, ra8_fmt_jof_verify_requirements_t::banded_work_bytes, ra8_fmt_jof_verify_requirements_t::bpp, ra8_fmt_jof_convert_requirements_t::height, ra8_fmt_jof_verify_requirements_t::height, internal_bpp(), internal_stable(), jof_stored_bound(), jof_work_bytes(), k_ra8_err_invalid_size, k_ra8_err_null_ptr, k_ra8_ok, ra8_fmt_jof_convert_requirements(), ra8_fmt_source_t::read_at, ra8_fmt_jof_verify_requirements_t::reference_work_bytes, ra8_fmt_jof_verify_requirements_t::row_bytes, ra8_fmt_jof_verify_requirements_t::scratch_bytes, ra8_fmt_jof_convert_requirements_t::tile_height, ra8_fmt_jof_convert_requirements_t::webp_work_bytes, ra8_fmt_jof_verify_requirements_t::webp_work_bytes, ra8_fmt_jof_convert_requirements_t::width, ra8_fmt_jof_verify_requirements_t::width, and ra8_fmt_jof_convert_requirements_t::work_bytes.
Referenced by internal_open_and_size().