|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Bind a tiled gray8 atlas behind an ra8_tile_cache as a zoom source (#478). More...
Go to the source code of this file.
Data Structures | |
| struct | zoom_tile_src_t |
| A tiled gray8 image, its grid, and the cache that pages it. More... | |
Functions | |
| ra8_err_t | zoom_tile_src_init (zoom_tile_src_t *ts, ra8_tile_cache_t *cache, uint32_t image_id, uint32_t width, uint32_t height, uint16_t tile_w, uint16_t tile_h) |
| Bind a tiled image and its cache, deriving the tile grid. | |
| ra8_err_t | zoom_tile_src_bind (zoom_tile_src_t *ts, zoom_source_t *out) |
| Present a bound tiled image to the zoom engine as a zoom_source_t. | |
| ra8_err_t | zoom_tile_read (void *ctx, uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint8_t *out, uint32_t out_stride) |
| zoom_read_fn over a tiled atlas paged by an ra8_tile_cache. | |
| ra8_err_t | zoom_tiles_prefetch (zoom_tile_src_t *ts, const zoom_view_t *v, zoom_pan_t dir, uint16_t max_tiles, uint16_t *out_warmed) |
| Warm the tiles one pan step beyond what a view currently shows. | |
Bind a tiled gray8 atlas behind an ra8_tile_cache as a zoom source (#478).
The manga / comic half of the tap-to-zoom viewer, and the half that answers the residency question. A full-resolution comic page does not fit in RAM, so it lives as a tiled atlas (JOF, #231) paged through an ::ra8_tile_cache. This adapter turns "give me source rectangle (x,y,w,h)" into "get exactly the tiles that rectangle intersects, copy the overlap, release them" – so the resident set at any instant is the tiles under the viewport and never the page.
Each tile is acquired and released around a single copy, so at most one cell is pinned at a time and a cache smaller than the frame degrades to re-decoding rather than to k_ra8_err_no_mem. Sizing the cache to the frame is the caller's job and is what stops thrash (#338); zoom_tiles_prefetch warms the lead edge of a pan out of whatever spare capacity the caller declares.
The TU compiles to nothing when ra8_tile_cache.h is not on the include path, so an app that only magnifies .rabook figures does not drag ra8_mem in.
Definition in file zoom_tiles.h.
|
nodiscard |
zoom_read_fn over a tiled atlas paged by an ra8_tile_cache.
Bound by zoom_tile_src_bind; not normally called directly. Walks only the tiles the rectangle intersects, copying each overlap and releasing the cell before moving on, so the pin count never exceeds one and the resident set is bounded by the cache, not by the rectangle.
| [in] | ctx | The zoom_tile_src_t binding. |
| [in] | x | Rectangle left edge, source pixels. |
| [in] | y | Rectangle top edge, source pixels. |
| [in] | w | Rectangle width, source pixels (> 0). |
| [in] | h | Rectangle height, source pixels (> 0). |
| [out] | out | gray8 destination of at least out_stride * h bytes. |
| [in] | out_stride | Bytes between successive output rows (>= w). |
| k_ra8_ok | The rectangle was assembled from its tiles. |
| k_ra8_err_null_ptr | ctx or out is NULL. |
| k_ra8_err_invalid_arg | Zero extent, or out_stride < w. |
| k_ra8_err_out_of_range | The rectangle leaves the image. |
| k_ra8_err_invalid_size | A fetched tile is not the declared geometry. |
| k_ra8_err_* | Propagated verbatim from the tile cache. |
ctx is a bound zoom_tile_src_t.
|
nodiscard |
Present a bound tiled image to the zoom engine as a zoom_source_t.
| [in] | ts | Binding populated by zoom_tile_src_init. |
| [out] | out | Source descriptor to fill. |
| k_ra8_ok | out is ready to hand to zoom_view_open. |
| k_ra8_err_null_ptr | ts, out, or ts->cache is NULL. |
| k_ra8_err_invalid_arg | The bound extent is unusable (zero or too large). |
ts was populated by zoom_tile_src_init. ts outlives every view bound to out. ts is not modified.Referenced by ez_bind_page().
|
nodiscard |
Bind a tiled image and its cache, deriving the tile grid.
Derives tile_cols / tile_rows rather than accepting them, so the grid can never disagree with the extent it is supposed to cover – the disagreement that turns into an out-of-range tile fetch three layers down. Validates that the derived grid fits the 16-bit tile indices the cache key uses.
| [out] | ts | Binding to populate. |
| [in] | cache | Initialised tile cache whose decoder serves this image. |
| [in] | image_id | Tile-cache key image id (distinguishes co-resident images). |
| [in] | width | Full-resolution image width, pixels (> 0). |
| [in] | height | Full-resolution image height, pixels (> 0). |
| [in] | tile_w | Tile width, pixels (> 0). |
| [in] | tile_h | Tile height, pixels (> 0). |
| k_ra8_ok | ts is bound and its grid derived. |
| k_ra8_err_null_ptr | ts or cache is NULL. |
| k_ra8_err_invalid_arg | An extent or a tile dimension is zero. |
| k_ra8_err_invalid_size | The derived grid exceeds 65535 tiles on an axis. |
cache was initialised by ra8_tile_cache_init. ts is not left partially bound.Referenced by ez_bind_page().
|
nodiscard |
Warm the tiles one pan step beyond what a view currently shows.
Joins the two halves this library exists to keep in agreement: the view reports the source pixels it will read (zoom_view_window), ra8_tile_rect_of_pixels turns that into the tile rectangle, and the cache warms the lead edge of dir out of max_tiles of spare capacity. Best-effort by construction – read-ahead that could not complete never fails a pan.
| [in,out] | ts | Bound tiled source. |
| [in] | v | The open view whose visible window drives the warm. |
| [in] | dir | Direction of travel; k_zoom_pan_none warms nothing. |
| [in] | max_tiles | Residency budget: warm at most this many tiles. |
| [out] | out_warmed | Tiles warmed (may be NULL). |
| k_ra8_ok | The sweep ran (possibly warming nothing). |
| k_ra8_err_null_ptr | ts, v, or ts->cache is NULL. |
| k_ra8_err_* | Propagated from zoom_view_window or the cache. |
v is open and bound to the same image as ts. max_tiles is the caller's spare capacity, not the cache size. max_tiles respects the cache's spare capacity. max_tiles.Referenced by ez_scene_prefetch().