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

Running consumption tracker charged by a decoder against its policy. More...

#include <ra8_decomp_limits.h>

Collaboration diagram for ra8_decomp_budget_t:

Data Fields

ra8_decomp_limits_t limits
 Policy in force for this budget.
uint64_t out_bytes
 Decompressed bytes produced so far.
uint64_t in_bytes
 Compressed bytes consumed so far.
uint32_t entries
 Archive entries enumerated so far.
uint32_t iters
 Decode-loop turns charged so far.
uint8_t depth
 Current stacked decode-layer depth.

Detailed Description

Running consumption tracker charged by a decoder against its policy.

One budget tracks one decode unit (streaming decoders) or one archive enumeration (walkers). Decoders charge it as they go: ra8_decomp_budget_charge_output after emitting bytes, ra8_decomp_budget_charge_entry per enumerated member, ra8_decomp_budget_charge_iter per decode-loop turn, and ra8_decomp_budget_enter / ra8_decomp_budget_leave around a stacked layer. Each charge fails closed with the axis-specific error the moment its bound is crossed.

Invariant
depth <= limits.max_depth between charges.
Counters only grow (except depth, which is balanced by enter/leave).
Example:
(void)ra8_decomp_budget_init(&b, nullptr); // default policy
while (more_input) {
// ... decode one chunk producing n bytes from in_total consumed ...
RA8_RETURN_ON_ERROR(ra8_decomp_budget_charge_output(&b, in_total, n), tag, "bomb");
}
#define RA8_RETURN_ON_ERROR(err, tag, message)
Early return on error, propagating the code upward.
Definition ra8_check.h:184
ra8_err_t ra8_decomp_budget_charge_output(ra8_decomp_budget_t *b, uint64_t in_total, uint64_t out_delta)
Charge decompressed output against the cap and ratio bounds.
ra8_err_t ra8_decomp_budget_charge_iter(ra8_decomp_budget_t *b)
Charge one decode-loop turn against the iteration budget.
ra8_err_t ra8_decomp_budget_init(ra8_decomp_budget_t *b, const ra8_decomp_limits_t *limits)
Bind a budget to a policy (or the default policy) and zero it.
Running consumption tracker charged by a decoder against its policy.
See also
ra8_decomp_limits_t
Since
Version 0.1.0

Definition at line 169 of file ra8_decomp_limits.h.

Field Documentation

◆ depth

uint8_t ra8_decomp_budget_t::depth

Current stacked decode-layer depth.

Definition at line 175 of file ra8_decomp_limits.h.

◆ entries

uint32_t ra8_decomp_budget_t::entries

Archive entries enumerated so far.

Definition at line 173 of file ra8_decomp_limits.h.

◆ in_bytes

uint64_t ra8_decomp_budget_t::in_bytes

Compressed bytes consumed so far.

Definition at line 172 of file ra8_decomp_limits.h.

◆ iters

uint32_t ra8_decomp_budget_t::iters

Decode-loop turns charged so far.

Definition at line 174 of file ra8_decomp_limits.h.

◆ limits

ra8_decomp_limits_t ra8_decomp_budget_t::limits

Policy in force for this budget.

Definition at line 170 of file ra8_decomp_limits.h.

Referenced by internal_finish_member(), and priv_comic_cbr_open().

◆ out_bytes

uint64_t ra8_decomp_budget_t::out_bytes

Decompressed bytes produced so far.

Definition at line 171 of file ra8_decomp_limits.h.


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