25#if __has_include("ra8_tile_cache.h") && __has_include("jof.h")
44typedef enum : uint8_t {
45 k_epub_import_magic_len = 4U,
79static ra8_err_t internal_entry_pull(
void* ctx, uint8_t* buf,
size_t cap,
size_t* got)
81 epub_entry_pull_t* pull = (epub_entry_pull_t*)ctx;
108 static const uint8_t s_atlas_magic[k_epub_import_magic_len] = {
'J',
'O',
'F',
'1'};
109 *out_is_atlas =
false;
110 uint8_t magic[k_epub_import_magic_len] = {};
119 if ((got ==
sizeof(magic)) && (
memcmp(magic, s_atlas_magic,
sizeof(magic)) == 0)) {
120 *out_is_atlas =
true;
149 epub_entry_pull_t pull = {};
156 .pull = internal_entry_pull,
172 return (err !=
k_ra8_ok) ? err : close_err;
198 static const char*
const s_tag =
"epub_img_import";
214 const ra8_err_t nz = internal_import_args_ok(binder, book, href, cfg);
218 const size_t hlen =
strlen(href);
222 bool is_atlas =
false;
231 err = internal_transcode(book, href, cfg, &info);
EPUB (.epub) reader and chapter iterator for ra8-firmware.
@ k_epub_max_path_len
Max href length (incl.
Iterative, bounded-RAM ZIP-entry extraction for the EPUB reader (#231).
ra8_err_t epub_entry_pread(epub_book_t *book, const char *path, uint64_t offset, uint8_t *buf, size_t len, size_t *got)
Positioned read of a stored (uncompressed) archive entry – windowed random access in bounded RAM (#23...
ra8_err_t epub_entry_read(epub_entry_reader_t *reader, uint8_t *buf, size_t cap, size_t *got)
Pull the next chunk of a streaming entry into a bounded caller buffer (#231).
ra8_err_t epub_entry_close(epub_entry_reader_t *reader)
Tear down a streaming-entry cursor and release its inflate state (#231).
ra8_err_t epub_entry_open(epub_book_t *book, const char *path, epub_entry_reader_t *out_reader, uint64_t *out_size)
Begin a bounded-RAM streaming extraction of one archive entry (#231).
int epub_img_import_unused_translation_unit_t
Page a large in-EPUB image through ra8_tile_cache + a real reflow <img> loader off the streaming read...
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_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_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...
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,...
ra8_err_t jof_produce(const jof_produce_cfg_t *cfg, jof_info_t *out_info)
Transcode one encoded JPEG/PNG/WebP source into a JOF atlas (#231, #290).
static const char * s_tag
Logging / check tag.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_not_supported
Requested feature not compiled in, not wired, or not supported by this MCU variant.
@ k_ra8_err_invalid_arg
Invalid function argument.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
int memcmp(const void *a, const void *b, size_t n)
Compare bytes in two memory areas.
size_t strlen(const char *s)
Calculate string length.
static ra8_sdcard_card_type_t internal_classify(uint8_t high_capacity, uint32_t blocks)
Classify card type from OCR.CCS and decoded block count.
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.
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.
Forward streaming cursor over one ZIP entry – inflate in bounded RAM (#231).
Binds up to k_epub_tile_max_sources images to one tile cache.
Parsed + validated geometry of one JOF atlas.
uint32_t total_size
Whole atlas byte length (footer included).
Producer configuration: source, sink, tile geometry and work arena.