ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
jof_produce.h
Go to the documentation of this file.
1
81
82#pragma once
83
84#ifdef __cplusplus
85extern "C" {
86#endif
87
88#include <stddef.h>
89#include <stdint.h>
90
91#include "jof.h"
92#include "ra8_err.h"
93
111typedef ra8_err_t (*jof_pull_fn)(void* ctx, uint8_t* buf, size_t cap, size_t* got);
112
129typedef ra8_err_t (*jof_sink_fn)(void* ctx, const uint8_t* buf, size_t len);
130
155typedef struct {
157 void* pull_ctx;
159 void* sink_ctx;
160 uint16_t tile_w;
161 uint16_t tile_h;
162 uint8_t codec;
163 uint16_t max_width;
164 uint16_t max_height;
165 uint8_t* work;
166 size_t work_cap;
167 uint8_t* webp_work;
170
200[[nodiscard]] uint32_t
201jof_work_bytes(uint16_t max_width, uint16_t max_height, uint16_t tile_w, uint16_t tile_h);
202
236[[nodiscard]] uint32_t
237jof_webp_work_bytes(uint16_t max_width, uint16_t max_height, uint32_t max_src_bytes);
238
290[[nodiscard]] ra8_err_t
291jof_probe_dims(const uint8_t* data, size_t len, uint16_t* out_w, uint16_t* out_h);
292
364[[nodiscard]] ra8_err_t jof_produce(const jof_produce_cfg_t* cfg, jof_info_t* out_info);
365
366#ifdef __cplusplus
367}
368#endif
JOF band-tile atlas: the display-native normalized image format (#231, shared with the longstrip scro...
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).
ra8_err_t jof_probe_dims(const uint8_t *data, size_t len, uint16_t *out_w, uint16_t *out_h)
Read a source image's pixel dimensions without decoding its body.
ra8_err_t(* jof_pull_fn)(void *ctx, uint8_t *buf, size_t cap, size_t *got)
Forward byte source for the producer (DIP seam).
uint32_t jof_webp_work_bytes(uint16_t max_width, uint16_t max_height, uint32_t max_src_bytes)
Compute the whole-frame webp_work arena a WebP source needs (#290).
uint32_t jof_work_bytes(uint16_t max_width, uint16_t max_height, uint16_t tile_w, uint16_t tile_h)
Compute the work-arena size the producer needs for given caps.
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).
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
Parsed + validated geometry of one JOF atlas.
Definition jof.h:208
Producer configuration: source, sink, tile geometry and work arena.
uint16_t max_width
Width budget cap (0 = format cap).
size_t webp_work_cap
WebP arena size; see webp_work_bytes().
void * pull_ctx
Context for pull.
uint8_t codec
jof_codec_t member.
uint16_t max_height
Height budget cap (0 = format cap).
jof_sink_fn sink
Atlas byte sink (append-only).
jof_pull_fn pull
Encoded-source byte stream.
void * sink_ctx
Context for sink.
uint8_t * webp_work
Whole-frame arena for WebP; NULL disables it.
uint16_t tile_h
Tile height, pixels (>= 1).
size_t work_cap
Arena size; see jof_work_bytes().
uint16_t tile_w
Tile width, pixels (>= 1).