ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_rabook_pipeline_scratch_t Struct Reference

Caller-owned temporary buffers the pipeline stage needs. More...

#include <ra8_rabook_pipeline.h>

Collaboration diagram for ra8_rabook_pipeline_scratch_t:

Data Fields

uint8_t * xhtml
 Chapter XHTML scratch buffer.
size_t xhtml_cap
 Capacity of xhtml in bytes.
uint8_t * image_raw
 Raw encoded cover/image byte buffer.
size_t image_cap
 Capacity of image_raw in bytes.
ra8_img_arena_timg_arena
 stb_image bump arena (caller-sized scratch).
uint8_t * gray
 Intermediate gray-pixel downscale buffer.
uint32_t gray_cap
 Capacity of gray in pixels (bytes).
char * css
 Stylesheet load scratch (NUL-terminated).
size_t css_cap
 Capacity of css in bytes.
bool skip_images
 Drop all images (text/CSS-only).
uint16_t max_image_edge
 Opt-in downscale clamp on the longer edge in pixels; 0 (the zero-init default) preserves source resolution (full-res manga for the zoom loupe).
uint8_t pixel_format
 Device profile: raster depth to emit, book_image_pixfmt_t.
ra8_rabook_xml_workspace_txml_workspace
 Caller-owned XHTML parser state.

Detailed Description

Caller-owned temporary buffers the pipeline stage needs.

All buffer fields must be set to valid, non-NULL pointers with the capacities large enough for the book being compiled. The pipeline never allocates; it writes only into these buffers and the builder arenas inside ra8_rabook_buffers_t.

skip_images (default false): when true the image stage is a no-op – no image-table entries are added and the cover index stays nil, so the blob is text/CSS-only. It is the on-device equivalent of the desktop epub_compile.py --no-images option (its empty manifest.items() image loop), and yields a blob byte-identical to that desktop --no-images golden. Stylesheets, chapters and metadata are unaffected. The image_raw / img_arena / gray buffers may stay tiny when skip_images is true.

pixel_format (default 0 == k_book_pixfmt_gray4) is the device profile that selects the raster depth: 4-bpp packed grayscale for an even 16-level e-ink panel, or k_book_pixfmt_gray8 for the lossless 8-bpp source on a deeper panel. It only affects raster transcode; SVG, stylesheets, chapters and metadata are unaffected.

Invariant
Every pointer is non-NULL and each buffer holds at least its cap.
xhtml, image_raw, gray and the img_arena backing store do not overlap. The transcode stage reuses image_raw in place as the encode output (4-bpp nibbles or the 8-bpp copy) while the decoded source pixels are still live in img_arena (and gray on the downscale path), so an aliased buffer would corrupt the still-live source.
Warning
Do not alias these buffers: image_raw is overwritten with the encoded output while img_arena / gray still hold the pixels being read.
static uint8_t xhtml_buf[64U * 1024U];
static uint8_t image_raw[4U * 1024U * 1024U];
static uint8_t img_scratch[4U * 1024U * 1024U];
static uint8_t gray_buf[1600U * 1200U];
ra8_img_arena_t arena = { img_scratch, sizeof(img_scratch), 0U, 0U };
xhtml_buf, sizeof(xhtml_buf),
image_raw, sizeof(image_raw),
&arena,
gray_buf, sizeof(gray_buf),
};
Caller-owned bump arena backing a single image decode.
Caller-owned temporary buffers the pipeline stage needs.
uint8_t * image_raw
Raw encoded cover/image byte buffer.
See also
rabook_compile_from_epub
Since
Version 0.1.0

Definition at line 110 of file ra8_rabook_pipeline.h.

Field Documentation

◆ css

char* ra8_rabook_pipeline_scratch_t::css

Stylesheet load scratch (NUL-terminated).

Definition at line 118 of file ra8_rabook_pipeline.h.

Referenced by internal_compile_stylesheets().

◆ css_cap

size_t ra8_rabook_pipeline_scratch_t::css_cap

Capacity of css in bytes.

Definition at line 119 of file ra8_rabook_pipeline.h.

Referenced by internal_compile_stylesheets().

◆ gray

uint8_t* ra8_rabook_pipeline_scratch_t::gray

Intermediate gray-pixel downscale buffer.

Definition at line 116 of file ra8_rabook_pipeline.h.

Referenced by internal_downscale_if_needed().

◆ gray_cap

uint32_t ra8_rabook_pipeline_scratch_t::gray_cap

Capacity of gray in pixels (bytes).

Definition at line 117 of file ra8_rabook_pipeline.h.

Referenced by internal_downscale_if_needed().

◆ image_cap

size_t ra8_rabook_pipeline_scratch_t::image_cap

Capacity of image_raw in bytes.

Definition at line 114 of file ra8_rabook_pipeline.h.

Referenced by internal_add_manifest_image(), and internal_encode_gray().

◆ image_raw

uint8_t* ra8_rabook_pipeline_scratch_t::image_raw

Raw encoded cover/image byte buffer.

Definition at line 113 of file ra8_rabook_pipeline.h.

Referenced by internal_add_manifest_image(), internal_encode_gray(), and internal_transcode_image().

◆ img_arena

ra8_img_arena_t* ra8_rabook_pipeline_scratch_t::img_arena

stb_image bump arena (caller-sized scratch).

Definition at line 115 of file ra8_rabook_pipeline.h.

Referenced by internal_transcode_image().

◆ max_image_edge

uint16_t ra8_rabook_pipeline_scratch_t::max_image_edge

Opt-in downscale clamp on the longer edge in pixels; 0 (the zero-init default) preserves source resolution (full-res manga for the zoom loupe).

Mirrors the desktop tool's opt-in --max-edge knob.

Definition at line 121 of file ra8_rabook_pipeline.h.

Referenced by internal_transcode_image().

◆ pixel_format

uint8_t ra8_rabook_pipeline_scratch_t::pixel_format

Device profile: raster depth to emit, book_image_pixfmt_t.

0 (the zero-init default) is k_book_pixfmt_gray4 – the 4-bpp packing a grayscale panel wants; k_book_pixfmt_gray8 keeps the lossless 8-bpp source for a deeper panel.

Definition at line 126 of file ra8_rabook_pipeline.h.

Referenced by internal_encode_gray(), and internal_transcode_image().

◆ skip_images

bool ra8_rabook_pipeline_scratch_t::skip_images

Drop all images (text/CSS-only).

See below.

Definition at line 120 of file ra8_rabook_pipeline.h.

Referenced by internal_compile_images().

◆ xhtml

uint8_t* ra8_rabook_pipeline_scratch_t::xhtml

Chapter XHTML scratch buffer.

Definition at line 111 of file ra8_rabook_pipeline.h.

Referenced by internal_compile_chapters().

◆ xhtml_cap

size_t ra8_rabook_pipeline_scratch_t::xhtml_cap

Capacity of xhtml in bytes.

Definition at line 112 of file ra8_rabook_pipeline.h.

Referenced by internal_compile_chapters().

◆ xml_workspace

ra8_rabook_xml_workspace_t* ra8_rabook_pipeline_scratch_t::xml_workspace

Caller-owned XHTML parser state.

Definition at line 133 of file ra8_rabook_pipeline.h.

Referenced by internal_compile_chapters(), and priv_rabook_pipeline_check_common().


The documentation for this struct was generated from the following file: