ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
comic_tiles.h
Go to the documentation of this file.
1
80#pragma once
81
82#include <stddef.h>
83#include <stdint.h>
84
85#include "jof.h"
86#include "jof_produce.h"
87#include "ra8_err.h"
88#include "ra8_tile_cache.h"
89
90#ifdef __cplusplus
91extern "C" {
92#endif
93
103typedef enum : uint8_t {
106
126typedef struct {
127 uint16_t tile_w;
128 uint16_t tile_h;
129 uint8_t codec;
130 uint16_t max_width;
131 uint16_t max_height;
132 uint8_t* work;
133 size_t work_cap;
134 uint8_t* webp_work;
136 uint8_t* atlas;
137 size_t atlas_cap;
139
165
199[[nodiscard]] ra8_err_t comic_tiles_footprint(const uint8_t* enc,
200 size_t len,
201 uint16_t* out_w,
202 uint16_t* out_h,
203 uint64_t* out_decoded_bytes);
204
230[[nodiscard]] bool comic_tiles_over_budget(uint64_t decoded_bytes, uint64_t budget_bytes);
231
264 const ra8_tile_cache_cfg_t* storage,
265 uint8_t* scratch,
266 uint32_t scratch_cap);
267
307 const uint8_t* enc,
308 size_t enc_len,
309 const comic_tiles_import_cfg_t* cfg);
310
330[[nodiscard]] ra8_err_t comic_tiles_info(const comic_tile_reader_t* r, jof_info_t* out_info);
331
367[[nodiscard]] ra8_err_t
368comic_tiles_tile(comic_tile_reader_t* r, uint16_t tile_x, uint16_t tile_y, ra8_tile_t* out_tile);
369
389[[nodiscard]] ra8_err_t comic_tiles_release(comic_tile_reader_t* r, const uint8_t* pixels);
390
391#ifdef __cplusplus
392}
393#endif
ra8_err_t comic_tiles_tile(comic_tile_reader_t *r, uint16_t tile_x, uint16_t tile_y, ra8_tile_t *out_tile)
Get (and pin) one decoded tile of the bound page (#344).
ra8_err_t comic_tiles_import(comic_tile_reader_t *r, const uint8_t *enc, size_t enc_len, const comic_tiles_import_cfg_t *cfg)
Transcode one encoded comic page to a JOF atlas and bind it for tiling.
ra8_err_t comic_tiles_info(const comic_tile_reader_t *r, jof_info_t *out_info)
Report the bound page's parsed atlas geometry (#344).
ra8_err_t comic_tiles_footprint(const uint8_t *enc, size_t len, uint16_t *out_w, uint16_t *out_h, uint64_t *out_decoded_bytes)
Read a comic page's decoded footprint from its encoded header (#344).
comic_tiles_const_t
Fixed constants for the comic tiling budget estimate.
@ k_comic_tiles_decoded_bpp
Bytes/pixel used for the budget estimate.
bool comic_tiles_over_budget(uint64_t decoded_bytes, uint64_t budget_bytes)
Decide whether a page's decoded footprint exceeds the resident budget.
ra8_err_t comic_tiles_init(comic_tile_reader_t *r, const ra8_tile_cache_cfg_t *storage, uint8_t *scratch, uint32_t scratch_cap)
Initialise a comic tile reader over caller-supplied tile-cache storage.
ra8_err_t comic_tiles_release(comic_tile_reader_t *r, const uint8_t *pixels)
Release one pin taken by comic_tiles_tile (#344).
JOF band-tile atlas: the display-native normalized image format (#231, shared with the longstrip scro...
Import-time transcode producer: JPEG/PNG/WebP -> JOF band-tile atlas in bounded RAM (#231,...
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).
One comic tile reader: owned tile cache, atlas store, bound page.
bool bound
True while a page atlas is imported.
uint32_t scratch_cap
Capacity of scratch.
uint32_t epoch
Import counter; the tile-cache key id.
uint8_t * scratch
Stored-tile staging for deflate atlases.
jof_memstore_t store
Atlas backing for the bound page.
ra8_tile_cache_t cache
Owned tile cache (decode wired to this).
jof_info_t info
Parsed geometry of the bound page.
Import-time transcode knobs, work arena, and destination atlas store.
uint8_t codec
jof_codec_t member.
uint16_t tile_w
Tile width, pixels (>= 1).
uint8_t * atlas
Atlas memstore backing (out-lives tile fetch).
uint16_t max_width
Width budget cap (0 = format cap).
size_t atlas_cap
Capacity of atlas in bytes.
uint16_t tile_h
Tile height, pixels (>= 1).
uint8_t * webp_work
WebP whole-frame arena, or NULL to reject WebP.
size_t work_cap
Arena size (jof_work_bytes()).
uint16_t max_height
Height budget cap (0 = format cap).
size_t webp_work_cap
WebP arena size (jof_webp_work_bytes()).
Parsed + validated geometry of one JOF atlas.
Definition jof.h:208
Append-only memory store: the simplest atlas backing (RAM/SDRAM).
Definition jof.h:256
Caller-supplied storage + decoder for ra8_tile_cache_init.
Tile-cache state (caller-owned; treat as private).
A pinned view of a cached tile returned by ra8_tile_cache_get.