ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
epub_img_tiles.h
Go to the documentation of this file.
1
50
51#pragma once
52
53#ifdef __cplusplus
54extern "C" {
55#endif
56
57#include <stddef.h>
58#include <stdint.h>
59
60#include "epub.h"
61#include "jof.h"
62#include "jof_produce.h"
63#include "ra8_err.h"
64#include "ra8_tile_cache.h"
65
73typedef enum : uint8_t {
76
97
118
129typedef struct {
131 uint8_t* scratch;
132 size_t scratch_cap;
134
155
174typedef struct {
175 uint16_t tile_w;
176 uint16_t tile_h;
177 uint8_t codec;
178 uint16_t max_width;
179 uint16_t max_height;
180 uint8_t* work;
181 size_t work_cap;
182 uint8_t* webp_work;
186
218 const ra8_tile_cache_cfg_t* storage,
219 uint8_t* scratch,
220 uint32_t scratch_cap);
221
255 epub_book_t* book,
256 const char* path,
257 uint32_t image_id);
258
293 jof_pread_fn pread,
294 void* pread_ctx,
295 uint64_t total_size,
296 uint32_t image_id);
297
348 epub_book_t* book,
349 const char* href,
350 uint32_t image_id,
351 const epub_atlas_import_cfg_t* cfg);
352
372[[nodiscard]] ra8_err_t
373epub_tile_binder_info(const epub_tile_binder_t* binder, uint32_t image_id, jof_info_t* out_info);
374
410 uint32_t image_id,
411 uint16_t tile_x,
412 uint16_t tile_y,
413 ra8_tile_t* out_tile);
414
433[[nodiscard]] ra8_err_t epub_tile_binder_put(epub_tile_binder_t* binder, const uint8_t* pixels);
434
473 uint32_t image_id,
474 const ra8_tile_rect_t* view,
476 uint16_t max_tiles,
477 uint16_t* out_warmed);
478
511[[nodiscard]] ra8_err_t epub_reflow_img_load(void* ctx,
512 const char* href,
513 uint32_t href_len,
514 const uint8_t** out_bytes,
515 size_t* out_len);
516
517#ifdef __cplusplus
518}
519#endif
EPUB (.epub) reader and chapter iterator for ra8-firmware.
@ k_epub_max_path_len
Max href length (incl.
Definition epub.h:89
ra8_err_t epub_tile_binder_add(epub_tile_binder_t *binder, epub_book_t *book, const char *path, uint32_t image_id)
Register a stored in-archive JOF atlas entry under image_id (#231).
ra8_err_t epub_tile_binder_info(const epub_tile_binder_t *binder, uint32_t image_id, jof_info_t *out_info)
Report a registered image's parsed geometry (#231).
ra8_err_t epub_tile_binder_add_ext(epub_tile_binder_t *binder, jof_pread_fn pread, void *pread_ctx, uint64_t total_size, uint32_t image_id)
Register an externally-backed JOF atlas under image_id (#231).
ra8_err_t epub_tile_binder_prefetch_pan(epub_tile_binder_t *binder, uint32_t image_id, const ra8_tile_rect_t *view, ra8_tile_pan_dir_t dir, uint16_t max_tiles, uint16_t *out_warmed)
Predictively warm the tiles one step ahead of a panning image (#341).
ra8_err_t epub_tile_binder_import(epub_tile_binder_t *binder, epub_book_t *book, const char *href, uint32_t image_id, const epub_atlas_import_cfg_t *cfg)
Import a manifest image through the transcode producer and register it for tile paging (#231 – the op...
epub_tile_limits_t
Binder capacity limits.
@ k_epub_tile_max_sources
Distinct images per binder.
ra8_err_t epub_reflow_img_load(void *ctx, const char *href, uint32_t href_len, const uint8_t **out_bytes, size_t *out_len)
Real reflow <img> byte loader off an EPUB book (#231).
ra8_err_t epub_tile_binder_init(epub_tile_binder_t *binder, const ra8_tile_cache_cfg_t *storage, uint8_t *scratch, uint32_t scratch_cap)
Initialise a tile binder over caller-supplied tile-cache storage (#231).
ra8_err_t epub_tile_binder_put(epub_tile_binder_t *binder, const uint8_t *pixels)
Release one pin taken by epub_tile_binder_get() (#231).
ra8_err_t epub_tile_binder_get(epub_tile_binder_t *binder, uint32_t image_id, uint16_t tile_x, uint16_t tile_y, ra8_tile_t *out_tile)
Get (and pin) one decoded tile of a registered image (#231).
JOF band-tile atlas: the display-native normalized image format (#231, shared with the longstrip scro...
ra8_err_t(* jof_pread_fn)(void *ctx, uint64_t offset, uint8_t *buf, size_t len, size_t *got)
Positioned-read seam over an atlas backing store (DIP).
Definition jof.h:241
Import-time transcode producer: JPEG/PNG/WebP -> JOF band-tile atlas in bounded RAM (#231,...
ra8_err_t(* jof_sink_fn)(void *ctx, const uint8_t *buf, size_t len)
Append-only byte sink for the produced atlas (DIP seam).
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
Fixed-RAM-budget image-tile cache with LRU eviction (Layer 3b, #147).
ra8_tile_pan_dir_t
Direction of viewport travel, for predictive pan prefetch.
Import-time transcode knobs: tile geometry, budget caps, work arena and the destination store.
size_t webp_work_cap
WebP arena size (jof_webp_work_bytes()).
uint16_t tile_h
Tile height, pixels (>= 1).
uint16_t max_height
Height budget cap (0 = format cap).
epub_atlas_store_t store
Destination atlas store.
size_t work_cap
Arena size (jof_work_bytes()).
uint16_t max_width
Width budget cap (0 = format cap).
uint16_t tile_w
Tile width, pixels (>= 1).
uint8_t codec
jof_codec_t member.
uint8_t * webp_work
WebP whole-frame arena, or NULL to reject WebP.
Where an on-device-produced atlas lives: sink to write, pread to read back (DIP – an SDRAM memstore a...
void * pread_ctx
Context for pread.
jof_pread_fn pread
Read-back seam for the same bytes.
void * sink_ctx
Context for sink.
jof_sink_fn sink
Append-only atlas writer.
Opened EPUB book.
Definition epub.h:286
Context for the real reflow <img> loader (epub_reflow_img_load).
uint8_t * scratch
Caller-owned encoded-bytes scratch.
size_t scratch_cap
Scratch capacity (bounded RAM ceiling).
epub_book_t * book
Book to resolve <img src> hrefs against.
Binds up to k_epub_tile_max_sources images to one tile cache.
epub_tile_source_t sources[k_epub_tile_max_sources]
Registered images.
uint8_t * scratch
Stored-tile staging for deflate atlases.
ra8_tile_cache_t cache
Owned tile cache (decode wired to the binder).
uint32_t scratch_cap
Capacity of scratch.
uint8_t source_count
Registered image count.
One registered atlas image (private to the binder; treat as opaque).
jof_pread_fn pread
External atlas read seam, or NULL.
uint32_t image_id
Tile-cache key namespace for this image.
uint64_t total_size
Atlas byte length (backing size).
void * pread_ctx
Context for pread.
char path[k_epub_max_path_len]
Entry path (book-backed only).
epub_book_t * book
Owning book, or NULL for external atlas.
jof_info_t info
Parsed + validated atlas geometry.
Parsed + validated geometry of one JOF atlas.
Definition jof.h:208
Caller-supplied storage + decoder for ra8_tile_cache_init.
Tile-cache state (caller-owned; treat as private).
An inclusive rectangle of tile grid coordinates (the visible tiles).
A pinned view of a cached tile returned by ra8_tile_cache_get.