ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
jof_internal.h
Go to the documentation of this file.
1
29
30#pragma once
31
32#include <stddef.h>
33#include <stdint.h>
34
35#include "jof_produce.h"
36#include "ra8_attributes.h"
37#include "ra8_err.h"
38
43typedef enum : uint8_t {
46
58typedef struct {
59 uint8_t* base;
60 size_t cap;
61 size_t off;
63
82RA8_PRIV void* priv_jof_bump_take(jof_bump_t* bump, size_t len);
83
96typedef ra8_err_t (*jof_geom_fn)(void* ctx, uint16_t width, uint16_t height, uint8_t channels);
97
111typedef ra8_err_t (*jof_rows_fn)(void* ctx,
112 const uint8_t* px,
113 uint16_t width,
114 uint16_t y0,
115 uint16_t nrows,
116 uint8_t channels);
117
163 void* pull_ctx,
164 jof_bump_t* bump,
165 uint16_t max_w,
166 uint16_t max_h,
167 jof_geom_fn on_geom,
168 jof_rows_fn on_rows,
169 void* cb_ctx);
170
175typedef enum : uint32_t {
178
192typedef struct {
193 const uint8_t* head;
194 size_t head_len;
195 size_t pos;
197 void* inner_ctx;
199
212typedef struct {
216
217 uint16_t cap_w;
218 uint16_t cap_h;
219
220 uint16_t w;
221 uint16_t h;
222 uint8_t bpp;
223 uint16_t tile_cols;
224 uint16_t tile_rows;
225 uint32_t tile_count;
226 uint8_t geom_done;
227
228 uint8_t* band;
229 uint8_t* stage;
230 uint8_t* cmp;
231 uint32_t cmp_cap;
232 uint8_t* idx;
233 uint8_t* dfl;
234 uint32_t dfl_len;
235
236 uint32_t rows_seen;
237 uint32_t band_fill;
238 uint32_t tiles_done;
239 uint32_t written;
241
265RA8_PRIV ra8_err_t priv_jof_prefix_pull(void* ctx, uint8_t* buf, size_t cap, size_t* got);
266
293RA8_PRIV ra8_err_t priv_jof_on_geom(void* ctx, uint16_t width, uint16_t height, uint8_t channels);
294
323 const uint8_t* px,
324 uint16_t width,
325 uint16_t y0,
326 uint16_t nrows,
327 uint8_t channels);
328
ra8_err_t priv_jof_on_geom(void *ctx, uint16_t width, uint16_t height, uint8_t channels)
Bind the source geometry: validate caps, carve buffers, emit header.
void * priv_jof_bump_take(jof_bump_t *bump, size_t len)
Carve len 8-byte-aligned bytes from the bump arena.
Definition jof_produce.c:89
jof_bump_const_t
Bump-allocator alignment constants.
@ k_jof_bump_align
Every carve is 8-byte aligned.
jof_carve_const_t
Carve-sizing constant shared by both work-arena calculators.
@ k_jof_carve_slack
Alignment slack folded into every arena sizing.
ra8_err_t priv_jof_on_rows(void *ctx, const uint8_t *px, uint16_t width, uint16_t y0, uint16_t nrows, uint8_t channels)
Row sink shared by every decoder arm: accumulate, flush full bands.
ra8_err_t priv_jof_png_rows(jof_pull_fn pull, void *pull_ctx, jof_bump_t *bump, uint16_t max_w, uint16_t max_h, jof_geom_fn on_geom, jof_rows_fn on_rows, void *cb_ctx)
Streaming PNG scanline decode: pull bytes in, emit rows in order.
Definition jof_png.c:579
ra8_err_t(* jof_geom_fn)(void *ctx, uint16_t width, uint16_t height, uint8_t channels)
Producer geometry hook: fires once when the source dimensions and output channel count are known,...
ra8_err_t(* jof_rows_fn)(void *ctx, const uint8_t *px, uint16_t width, uint16_t y0, uint16_t nrows, uint8_t channels)
Producer row sink: receives decoded pixel rows strictly in order.
ra8_err_t priv_jof_webp_transcode(jof_prod_state_t *st, jof_prefix_pull_t *pfx)
Transcode a WebP source into the JOF tile path (whole-frame, #290).
ra8_err_t priv_jof_prefix_pull(void *ctx, uint8_t *buf, size_t cap, size_t *got)
Pull adapter: replay the sniffed head, then delegate to the source.
Import-time transcode producer: JPEG/PNG/WebP -> JOF band-tile atlas in bounded RAM (#231,...
ra8_err_t(* jof_pull_fn)(void *ctx, uint8_t *buf, size_t cap, size_t *got)
Forward byte source for the producer (DIP seam).
Annotation-attribute framework macros for ra8-firmware.
#define RA8_PRIV
Module-private helper: shared across TUs but only inside one library.
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Linear (bump) allocator over the caller's work arena.
size_t off
First free byte.
uint8_t * base
Arena base (caller's work buffer).
size_t cap
Arena capacity, bytes.
Pull adapter that replays the sniffed head bytes, then delegates.
size_t head_len
Sniffed byte count.
const uint8_t * head
Sniffed bytes to replay.
size_t pos
Replay cursor.
void * inner_ctx
Context for the source.
jof_pull_fn inner
Real source.
Whole transcode state (module-static instance in the producer TU).
uint32_t tiles_done
Tiles encoded + recorded so far.
uint32_t cmp_cap
Capacity of cmp.
uint32_t written
Atlas bytes sunk so far.
uint8_t * cmp
One encoded tile (deflate codec).
uint8_t geom_done
1 once geometry was bound.
uint32_t band_fill
Rows currently in the band.
jof_bump_t bump_store
Arena allocator state.
const jof_produce_cfg_t * cfg
Caller configuration.
uint8_t * idx
Tile index bytes (8 per tile).
uint8_t * stage
One packed tile payload.
uint8_t bpp
Output bytes per pixel.
uint16_t w
Source width, pixels.
uint16_t cap_h
Effective height cap.
uint16_t tile_cols
Tile grid columns.
uint32_t rows_seen
Decoded rows accumulated so far.
uint32_t dfl_len
Scratch length (0 for raw codec).
uint16_t tile_rows
Tile grid rows.
uint32_t tile_count
Total tiles (cols * rows).
jof_bump_t * bump
Arena allocator (owned).
uint8_t * dfl
Deflate compressor scratch.
uint8_t * band
One tile row of decoded pixels.
uint16_t h
Source height, pixels.
uint16_t cap_w
Effective width cap.
Producer configuration: source, sink, tile geometry and work arena.