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

Single-image to JOF worker: the per-page transcode the cbz2jof Go driver shells out to. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  jof_worker_result_t : int {
  k_jof_worker_ok = 0 ,
  k_jof_worker_usage = 1 ,
  k_jof_worker_input = 2 ,
  k_jof_worker_output = 3 ,
  k_jof_worker_geometry = 4 ,
  k_jof_worker_decode = 5 ,
  k_jof_worker_memory = 6
}
 Process exit code contract between the worker and its Go driver. More...

Functions

jof_worker_result_t jof_worker_convert (const char *in_path, const char *out_path)
 Transcode one encoded image file into one JOF atlas file.

Detailed Description

Single-image to JOF worker: the per-page transcode the cbz2jof Go driver shells out to.

The Go layer owns archive policy (CBZ entry selection, limits, atomic page publication); this worker owns pixels. It reads one encoded JPEG, PNG, or WebP source file through the firmware's own jof_produce() pipeline and writes one JOF band-tile atlas, so a page converted here is byte-identical to one the RA8 would produce from the same source bytes.

[Ring 4 / Domain] {World: NS}

Since
0.1.0

Definition in file jof_worker.h.

Enumeration Type Documentation

◆ jof_worker_result_t

enum jof_worker_result_t : int

Process exit code contract between the worker and its Go driver.

Explicitly sized so the ok=0 .. memory=6 mapping below is the ABI, not a compiler choice. ok is zero so the shell idiom if (rc) treats any failure as true.

Since
0.1.0
Enumerator
k_jof_worker_ok 

Atlas fully written to the output path.

k_jof_worker_usage 

Wrong argument count or null path.

k_jof_worker_input 

Input open/stat/read failed or was refused.

k_jof_worker_output 

Output open/write/close failed.

k_jof_worker_geometry 

Source dimensions unusable or unproduceable.

k_jof_worker_decode 

Source is hostile or an unsupported variant.

k_jof_worker_memory 

A bounded work arena could not be allocated.

Definition at line 33 of file jof_worker.h.

Function Documentation

◆ jof_worker_convert()

jof_worker_result_t jof_worker_convert ( const char * in_path,
const char * out_path )
nodiscard

Transcode one encoded image file into one JOF atlas file.

Opens and bounds-checks the input, probes its dimensions, sizes the exact jof_work_bytes() / jof_webp_work_bytes() arenas for them, runs jof_produce() with a full-width band tile (tile_w == width, tile_h == min(height, 256)), and closes the output. On any failure the output path is closed and removed, so no torn atlas is left behind; cleanup failure never masks the primary error.

Parameters
[in]in_pathEncoded source image (JPEG, PNG, or WebP).
[in]out_pathDestination JOF atlas (created/truncated).
Returns
One jof_worker_result_t member.
Return values
k_jof_worker_okAtlas fully written to the output path.
k_jof_worker_usageWrong argument count or null path.
k_jof_worker_inputInput open/stat/read failed or was refused.
k_jof_worker_outputOutput open/write/close failed.
k_jof_worker_geometrySource dimensions unusable or unproduceable.
k_jof_worker_decodeSource is hostile or an unsupported variant.
k_jof_worker_memoryA bounded work arena could not be allocated.
Precondition
in_path and out_path are non-NULL NUL-terminated paths.
in_path points to an existing readable file.
Postcondition
On k_jof_worker_ok out_path holds one complete JOF atlas.
On any other result out_path does not exist.
Note
Not thread-safe (module-static decoder contexts in the producer).
Since
0.1.0

Definition at line 410 of file jof_worker.c.

References jof_probe_dims(), jof_work_bytes(), jof_worker_convert(), k_jof_worker_geometry, k_jof_worker_memory, k_jof_worker_ok, k_jof_worker_usage, k_ra8_ok, k_worker_tile_h, worker_alloc_webp(), worker_produce_to_file(), and worker_read_source().

Referenced by jof_worker_convert(), and main().