28#include "src/webp/decode.h"
48 if (WebPGetInfo(data, size, &w, &h) == 0) {
101 if ((out_stride < min_stride) || (((
size_t)*h * out_stride) > out_capacity)) {
105 if (out_stride > (
size_t)INT_MAX) {
161 uint8_t*
const result = WebPDecodeRGBAInto(data, size, out_rgba, out_capacity, (
int)out_stride);
163 if (result ==
nullptr) {
178 if (out_w !=
nullptr) {
181 if (out_h !=
nullptr) {
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_RETURN_ON_ERROR(err, tag, message)
Early return on error, propagating the code upward.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_not_supported
Requested feature not compiled in, not wired, or not supported by this MCU variant.
@ k_ra8_err_invalid_arg
Invalid function argument.
@ k_ra8_err_validation_failed
Validation rule failed (caller-supplied invariant not satisfied).
@ k_ra8_err_range_check_failed
Value outside range enforced by RA8_CHECK_RANGE / RA8_CHECK_RANGE_TAG.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
#define ra8_log_error(tag, message)
RA8 log error.
static ra8_err_t internal_webp_check_output(const uint8_t *data, size_t size, size_t out_stride, size_t out_capacity, uint32_t *w, uint32_t *h)
Read the WebP header and validate the caller's output geometry.
static ra8_err_t internal_webp_decode_impl(const uint8_t *data, size_t size, ra8_webp_arena_t *arena, uint8_t *out_rgba, size_t out_stride, size_t out_capacity, uint32_t *out_w, uint32_t *out_h)
Validate geometry, decode the WebP into out_rgba, and report size.
static const char s_ra8_webp_tag[]
Component tag used in validation log lines.
ra8_err_t ra8_webp_decode_rgba(const uint8_t *data, size_t size, ra8_webp_arena_t *arena, uint8_t *out_rgba, size_t out_stride, size_t out_capacity, uint32_t *out_w, uint32_t *out_h)
Decode a WebP into a caller-owned RGBA8888 buffer, heap-free.
ra8_err_t ra8_webp_get_info(const uint8_t *data, size_t size, uint32_t *out_w, uint32_t *out_h)
Read a WebP header's pixel dimensions without decoding the body.
Zero-heap WebP (VP8 / VP8L) decode facade over the vendored libwebp.
@ k_ra8_webp_bytes_per_px
Output bytes per pixel (RGBA8888).
@ k_ra8_webp_max_dim
Max accepted width/height, pixels/axis.
Heap-free scratch allocator hooks for the vendored libwebp decoder.
void ra8_webp_arena_unbind(void)
Unbind the active arena; subsequent allocation hooks fail with nullptr.
void ra8_webp_arena_bind(ra8_webp_arena_t *arena)
Bind arena as the active scratch for subsequent decode allocations.
Caller-owned bump arena backing a single WebP decode.