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

Caller-owned bump arena backing a single WebP decode. More...

#include <ra8_webp_arena.h>

Data Fields

uint8_t * base
 First byte of caller-owned backing store (>= cap bytes).
size_t cap
 Backing-store capacity in bytes.
size_t offset
 Bump cursor; next allocation starts here.
uint32_t live
 Count of outstanding (unfreed) allocations.

Detailed Description

Caller-owned bump arena backing a single WebP decode.

A linear bump allocator over base[0..cap) with a live-block count: libwebp's allocations bump offset, each free decrements live, and the arena auto-resets to empty when live reaches 0 – so it fully drains after each decode with no caller bookkeeping and no fragmentation.

Invariant
offset <= cap at all times.
live == 0 implies offset == 0 (fully drained).
Example:
alignas(16) static uint8_t backing[2U * 1024U * 1024U];
ra8_webp_arena_t arena = {.base = backing, .cap = sizeof backing,
.offset = 0U, .live = 0U};
// ... WebP decode draws scratch from `arena` ...
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.
See also
ra8_webp_arena_bind()
Since
0.1.0

Definition at line 71 of file ra8_webp_arena.h.

Field Documentation

◆ base

uint8_t* ra8_webp_arena_t::base

First byte of caller-owned backing store (>= cap bytes).

Definition at line 72 of file ra8_webp_arena.h.

Referenced by ra8_webp_arena_malloc().

◆ cap

size_t ra8_webp_arena_t::cap

Backing-store capacity in bytes.

Definition at line 73 of file ra8_webp_arena.h.

Referenced by ra8_webp_arena_malloc().

◆ live

uint32_t ra8_webp_arena_t::live

Count of outstanding (unfreed) allocations.

Managed field.

Definition at line 75 of file ra8_webp_arena.h.

Referenced by ra8_webp_arena_bind(), ra8_webp_arena_free(), and ra8_webp_arena_malloc().

◆ offset

size_t ra8_webp_arena_t::offset

Bump cursor; next allocation starts here.

Managed field.

Definition at line 74 of file ra8_webp_arena.h.

Referenced by ra8_webp_arena_bind(), ra8_webp_arena_free(), and ra8_webp_arena_malloc().


The documentation for this struct was generated from the following file: