ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_rabook_gray4.h
Go to the documentation of this file.
1
43#pragma once
44
45#include <stdint.h>
46
47#include "ra8_err.h"
48
49#ifdef __cplusplus
50extern "C" {
51#endif
52
53/* -------------------------------------------------------------------------- */
54/* Public constants */
55/* -------------------------------------------------------------------------- */
56
86
87/* -------------------------------------------------------------------------- */
88/* API */
89/* -------------------------------------------------------------------------- */
90
118void ra8_rabook_gray4_output_dims(uint16_t src_w,
119 uint16_t src_h,
120 uint16_t max_edge,
121 uint16_t* out_w,
122 uint16_t* out_h);
123
157ra8_err_t ra8_rabook_gray4_downscale(const uint8_t* src,
158 uint16_t src_w,
159 uint16_t src_h,
160 uint8_t* dst,
161 uint16_t dst_w,
162 uint16_t dst_h);
163
200ra8_err_t ra8_rabook_gray4_encode(const uint8_t* gray_pixels,
201 uint16_t w,
202 uint16_t h,
203 uint8_t* out,
204 uint32_t out_cap,
205 uint32_t* out_size);
206
243ra8_err_t ra8_rabook_gray8_encode(const uint8_t* gray_pixels,
244 uint16_t w,
245 uint16_t h,
246 uint8_t* out,
247 uint32_t out_cap,
248 uint32_t* out_size);
249
250#ifdef __cplusplus
251} /* extern "C" */
252#endif
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
ra8_err_t ra8_rabook_gray4_encode(const uint8_t *gray_pixels, uint16_t w, uint16_t h, uint8_t *out, uint32_t out_cap, uint32_t *out_size)
Quantise a grayscale buffer to 16 levels and pack as 4-bpp nibbles.
ra8_err_t ra8_rabook_gray4_downscale(const uint8_t *src, uint16_t src_w, uint16_t src_h, uint8_t *dst, uint16_t dst_w, uint16_t dst_h)
Bilinear-interpolate a grayscale image from (src_w x src_h) to (dst_w x dst_h).
ra8_rabook_gray4_consts_t
Compile-time constants for the gray4 transcode stage.
@ k_ra8_rabook_gray4_quant_div
Palette step: 255 / 15 rounds to 17.
@ k_ra8_rabook_gray4_nib_per_byte
Pixels packed per output byte.
@ k_ra8_rabook_gray4_nib_max
Maximum nibble value (4 bits unsigned).
@ k_ra8_rabook_gray4_round_half
Added before quant divide to round-to-nearest.
@ k_ra8_rabook_gray4_gray_levels
Palette depth: 16 evenly-spaced levels.
ra8_err_t ra8_rabook_gray8_encode(const uint8_t *gray_pixels, uint16_t w, uint16_t h, uint8_t *out, uint32_t out_cap, uint32_t *out_size)
Copy a grayscale buffer out verbatim as 8-bpp (one byte per pixel).
void ra8_rabook_gray4_output_dims(uint16_t src_w, uint16_t src_h, uint16_t max_edge, uint16_t *out_w, uint16_t *out_h)
Compute scaled output dimensions keeping the longer edge within max_edge.