Performance trend¶
Five separate mechanisms, not one, and it matters which is which:
- The hard gate:
iclforge-perf(tests/performance/test_performance.cpp) asserts that each workload, encode or decode, of AC-3, E-AC-3, the Atmos object layer and AC-4 finishes within twice its real-time budget (kSlackFactor): real time is the functional requirement, and the second factor is headroom for a runner slower than a development machine. It runs in the pull-request gate, where thePerformancectest label runs alone and last, in the merge queue and after each merge. A failure here blocks CI outright - see CI Status. Not run under the ASan/UBSan leg: instrumented code has nothing useful to say about throughput at any slack factor, so that leg excludes thePerformancelabel entirely (CMakePresets.json'stest-linux-llvm-asan-ubsanpreset). - The merge queue's comparison and gate: for an entry that changes
src/, thecomparejob (_compare.yml, called frompr-gate.yml) measures the entry's head against the commit it is queued on and publishes the table. Its infrastructure is informational (continue-on-error), but an explicit hard-regression verdict is passed to the separate blockingperformance-gatejob. No measurement or an approvedperf-regression-approvedlabel on the pull request passes the gate. - This page's whole-frame tables:
iclforge-bench(tests/performance/bench_encoder.cpp) runs the same configurations for longer (200 frames) and records the actual ms/frame number, not just a pass/fail, in the run after each merge tomain, one record per run (a burst of merges is one run). It exists to answer a question the hard gate cannot: is throughput quietly drifting slower over time even while it keeps passing. The series is Speed: a workload's ms per frame against its own frame budget. - This page's per-kernel tables:
iclforge-kernelbench(tests/performance/kernel_bench.cpp) times each hot kernel in isolation (ns/call, fed real audio through the real windowing + forward MDCT) in the same runs. It answers the question one level belowiclforge-bench's: when a whole-frame number drifts, which stage moved - without anyone having to reattach a profiler to find out. - This page's memory tables:
iclforge-membench(tests/performance/bench_memory.cpp) counts what the others time: heap allocations and allocator traffic per frame (Allocation per frame), the live bytes still held after the steady-state frames (Live growth), and peak RSS, across the same encoder configurations plus the decode paths the timing benches never covered. It records the memory-usage programme's progress the same way the whole-frame series recorded the CPU programme's, and - unlike ms/frame - its numbers are near-deterministic for a fixed workload, so a flagged row is a real behavioural change, not runner noise. Allocation per frame counts allocator traffic, not memory in use: a buffer allocated and freed every frame counts every time and is held by none.
All of this exists because a severe encoder regression (a per-call recomputation the forward MDCT should have cached) once shipped with no coverage to catch it: the hard gate blocks a repeat outright, and the trend tables catch the gradual drift a pass/fail gate cannot see.
What is measured, and on what¶
The AC-3, E-AC-3 and Atmos encoders are plain_51 and plain_51_fast_mdct,
eac3_51_auto and eac3_stereo_auto, and atmos_4obj, atmos_4obj_fast_mdct and
atmos_4obj_qmf_fast_mdct; their decoders are ac3_51_decode, eac3_51_decode and
atmos_4obj_decode. AC-4 adds ac4_stereo_encode and ac4_51_encode, and
ac4_stereo_decode and ac4_51_decode, which read those encoders' streams. The decode series
are timed against streams encoded in the same run: a decode number only means something against
a stream whose rate and tool set are known. By name, plain_* and ac3_* are AC-3 (plain_51
is iclforge::ac3::FrameEncoder at 5.1, 448 kbit/s), eac3_*, ecpl_* and atmos_* are E-AC-3 (Atmos is
joint object coding carried in E-AC-3), ac4_* is AC-4 and truehd_* is TrueHD. The memory series name their
workloads <codec>_<layout>_encode and _decode (ac3_51_encode, ecpl_51_encode,
atmos_4obj_decode), with one for enhanced coupling that the timing series lack.
An AC-4 frame is longer than an AC-3 one. At frame_rate_index 13 it is 2 048 samples, 42.67 ms
at 48 kHz, against A/52's 1 536 samples and 32 ms, so each result carries its own real-time
budget and the AC-4 rows are held to theirs. The AC-4 workloads encode the same fixture at
frame_rate_index 13, stereo at 192 kbit/s and 5.1 at 448. The per-kernel tables add AC-4's
shared transforms: ac4_mdct512_forward, ac4_imdct512_inverse, ac4_fft512_forward,
ac4_qmf_analysis64 and ac4_qmf_synthesis64. AC-4 decode quality has its own series on
Quality trend.
TrueHD adds truehd_stereo_*, truehd_51_*, truehd_71_*, truehd_51_96k_* and truehd_stereo_192k_* (each
_encode and _decode):
24 bits, stereo, 5.1 and 7.1 at 48 kHz, 5.1 at 96 kHz and stereo at 192 kHz, from the same reference_51.wav. The 7.1 rows repeat its first two channels as the rear
surrounds, and the 96 and 192 kHz rows declare the same samples at the higher rate: they measure what the codec does for a second of audio at that rate
(more samples, another substream layout, a lower filter limit), not the music's spectrum there. iclforge-perf holds all ten to twice their real-time budget.
TrueHD against FFmpeg and DEE has the comparison. The file is 16 bit; the low byte of
each 24-bit sample is a fixed pseudo-random sequence that stands for a master's noise floor. A frame is
an access unit, 40 samples or 0.83 ms, so a decode is a few microseconds and the table shows three
significant digits below 1 ms. The decode series run the stream the encoder wrote from the same source,
twenty times over. The encoder is given one access unit a call, as a live caller would, and the call that
completes a 128-unit restart interval does the interval's whole analysis: the mean is the cost of the
codec, and the maximum column is that burst. The memory series carry the same names and count
three intervals. iclforge-bench --truehd-fixtures adds a row for each committed TrueHD and MLP stream
(testdata/truehd); CI does not pass it, the rows are a table to read.
Every workload is fed real programme material (testdata/audio/reference_51.wav,
through tests/performance/real_audio.hpp), not the 440 Hz tone iclforge-bench and
iclforge-perf ran on before PF1. A single stationary tone is not a cheaper version of
programme material, it is a different workload: its spectrum is one bin wide, so the
SNR-offset search converges against an allocation almost nothing competes for,
coupling has near-nothing to share between channels, rematrixing sees a pair that is
already identical, and the transient detector never fires — so the block-switched
transform never runs at all. A regression confined to any of those could not move the
number. iclforge-kernelbench had this rule from the start; PF1 applied it to the other
two. The fixture is 78 frames long and the benches run 200, so frame indices wrap;
the seam that creates lands in the same place on every run.
The persistent x86 series uses linux-gcc; whole-frame performance also has an
arm64 series from linux-gcc-arm64. Kernel and memory histories remain x86-only.
These are fixed-runner trends, not comparisons across the 11 split platform
legs, and developer-machine numbers are not comparable to these rows.
linux-gcc runs on GitHub's hosted ubuntu-latest, and the machine behind that
label changes from run to run: it was six CPU models in the six weeks to
2026-10-12, and in the last two days of them plain_51 took 2.07 ms/frame on an
EPYC 9V45, 3.74 on an EPYC 9V74 and 4.38 on an EPYC 7763, on the same code.
Whole-frame records have named the model they were measured on (cpu_model)
since 2026-09-01, and kernel records name it from the change that introduced the
comparison described below; those written before 2026-10-13 name none. The checks
and the charts on this page compare a figure with others from the same model. The
arm64 leg has been a Neoverse-N2 on every run.
The change that inlined to_fixed25 and fused it with exponent extraction does not
show as a clean step in the whole-frame series above: the ~7% of a fast-path frame it
targeted is smaller than this page's own run-to-run variance on a shared runner, so
the effect is real but not visible against that noise floor in a 200-frame series.
Isolated from the rest of the frame - the exact per-bin loop, ~9,100 conversions
sized like one real 5.1 frame's worth, minimum of several runs - it measured
~50 µs before and ~30 µs after per frame's worth of calls (a 1.5-1.8× speedup on that
slice), consistent with the ~33-38 µs the change targeted. The gate that actually
matters for this change is byte-identical output, not a timing number: see that change's
commit message for the corpus that was checked.
Profile by source line, not by symbol¶
The single largest performance finding in this codebase was invisible to symbol-level profiling, and the way it hid is worth repeating because the trap is generic.
joc::reconstruct_mdct_band showed 62% self-time in an Atmos decode. That reads like
"vectorise its inner loop", and doing so would have been worth about 2%. Re-profiling
the same run with perf report --sort=srcline showed the time was not in that
function's arithmetic at all: 45% of the whole profile was in joc.hpp, inlined —
FrameParameters::object_offset() walking an O(objects) list on every coefficient
access, making a frame O(objects²). Fixing that made a 12-object decode 1.82x faster
in the MDCT domain and 2.90x in the QMF domain (the default), against roughly 18% from
four phases of transform vectorisation.
Symbol self-time attributes inlined header code to whoever inlined it, so an
accidentally-quadratic accessor appears as arithmetic in its caller. When a symbol
looks hot, confirm which lines before designing a fix. A RelWithDebInfo build with
-O3 -g is enough; on this repo it also needs -Wno-error=null-dereference for a GCC
false positive in apps/forge/cli/src/commands/audio_io.cpp that the Release preset does not trip.
The same method found the second-largest win: aht_bin_gaq_bits fully quantising six
mantissas per candidate gain to read one integer width off each result — 43% of an
E-AC-3 encode profile, and 1.70x on eac3_51_auto once the width was derived from the
escape predicate instead.
A bench that cannot see a bug class cannot gate it¶
iclforge-kernelbench's JOC series originally ran at four objects. The quadratic accessor
above moved those rows about 26% — an ordinary-looking optimisation — while moving a
real 12-object decode 1.8-2.9x. The bench was structurally unable to report the
difference, because at four objects an O(objects²) term is nearly invisible.
joc_reconstruct_mdct_12obj and joc_reconstruct_qmf_12obj exist to close that. Twelve
is representative rather than arbitrary: TS 103 420 caps a programme at 15 dynamic
objects plus the bed LFE, and twelve is three clean batches of four for the batched
transform paths. When adding a series, ask what class of regression it can and cannot
see at the size it runs — a workload sized where the interesting term vanishes will
pass forever while the thing it nominally covers rots.
tools/ci/append_performance_history.py appends every main run's numbers
(after a merge, nightly, or when asked for with gh workflow run ci.yml --ref main;
a commit is recorded once, however many runs measure it)
to the quality-history branch (reused, not a new branch - the same reasoning
Quality trend already gives for a dedicated branch over
gh-pages: incremental, no publish-cadence coupling, fetchable client-side with no
auth). On top of the hard gate's absolute per-frame budget (32 ms for AC-3 and E-AC-3,
42.67 ms for AC-4), it applies a trailing-baseline
check: a soft one (20% slower than the trailing 10-run mean, ::warning:: only) and
a hard one (100% slower - i.e. at least doubled - ::error::, fails the
persist-performance-trend CI job after the numbers are still recorded, so a big
regression is never silently un-recorded just because it also failed the run).
The trailing mean is of one machine's records: the last ten of the series that were
measured on the same CPU model as the run, however far back they are. Until
2026-10-13 it was the last ten records of any machine, and a run on the EPYC 7763
after a few on the EPYC 9V45 read as 20% slower, or as doubled after ten, with no
change in the code. Replayed over main's history to that date, the 2,098
linux-gcc records that name a model raised 118 soft warnings against every
machine's mean and 11 against their own model's. All 11 are on the EPYC 9V74, which
runs plain_51 at 3.74 or at 4.82 ms/frame under the one name, so a model name
does not always mean one speed and a run that changes between the two is still
flagged at the soft tier.
A run on a model its series has no record from yet has nothing like it to be compared with, and neither has a run that recorded no model. Both are compared with the last ten records of every machine, at both tiers, and the annotation says that this is what it compared with. The job's log says, for each leg, how many series were compared with their own model's records and how many with every machine's. The thresholds are unchanged.
Both append scripts key every series by its own name end to end, so a workload or kernel added to a bench simply starts its own series: its first run has no trailing mean to be compared against and cannot trip its own regression gate, and it never perturbs an existing series' baseline. That is also why an existing series' name is not reused for a differently-shaped measurement — a trailing mean over two different workloads is a number with no owner.
tools/ci/append_kernel_history.py does the same for iclforge-kernelbench's per-kernel
numbers (kernels-develop.jsonl / kernels-main.jsonl, same branch), with the same
two trailing-baseline tiers - but both tiers are ::warning:: annotations and the
kernel series never fails the job: a micro-kernel's ns/call on a shared CI runner
is far noisier than a 200-frame whole-frame average, and iclforge-perf plus the
whole-frame series already gate anything a user would feel. This page's per-kernel
tables are where kernel regressions surface. Every series is keyed by its own kernel
name end to end - a trailing mean over mixed kernels would be a number with no owner,
the same conflation the quality-trend history once had to be cured of. Its trailing
mean is of the run's own CPU model too, by the same rule; the kernel records written
before 2026-10-13 name no model, so each model's own comparison starts with its
first record after that, and until then a run is compared with every machine's.
tools/ci/append_memory_history.py does the same for iclforge-membench's numbers
(memory-develop.jsonl / memory-main.jsonl, same branch), with the same two
tiers on two churn metrics per series - allocations/frame and bytes/frame,
either one regressing flags the record - and it gates like the whole-frame
series does (the hard tier fails the job, after the push). One check is absolute
rather than trend-relative: steady_live_growth, the bytes still held live
after the steady-state frames (Live growth), warns above 4 KiB and hard-fails above 1 MiB,
because a leak is a leak regardless of what last week's runs did.
Only linux-gcc (and, for the whole-frame series, linux-gcc-arm64) is measured, not the full CI matrix: a timing trend's value is in
comparing one consistent runner against its own history over time, not in comparing
GitHub's runner classes against each other the way the gold-reference SNR numbers
usefully are cross-platform. The memory series counts allocations, which do not
depend on the machine, and its trailing mean is of every record.
performance-develop.jsonl, kernels-develop.jsonl and memory-develop.jsonl
all stopped gaining rows on 2026-08-24, develop's last commit before
2026-08-25's move to trunk-based development retired the branch - see
Quality trend for the detail, which
applies here identically. They are kept as-is, not deleted or merged into
main's own files; each section below renders main's ongoing history
directly and folds develop's frozen one into a collapsed Show historical
data block beneath it instead.
Whole-frame trend¶
Each series below is a chart first, table second. The chart plots the
generated recent window (or the full history while it still fits that window),
not just the table's last 20 rows, as
ms/frame against commit date, with a dashed ring around any point whose commit
was tagged as a GitHub release - hover a point for the exact commit, date,
number and CPU model. Each CPU model is a line of its own in its own colour, the
same colour on every chart, and the legend names the models a chart has; the
table's CPU column says the same for each row. Read along one line: a change in
the code moves every line, and a step from one line to another is a different
machine. The scale fits the measurements, and the dashed line for the throughput
budget is drawn where it is within twice the slowest point. Elsewhere the legend
gives the budget as a figure: 24 of the 28 series run at a tenth of their budget or
less, and a scale that reached up to it left their history as one flat band along
the bottom. On 2026-10-13 no series is within twice its budget (the closest,
linux-gcc / atmos_4obj, is at 27% of it), so no chart draws the line. A
downward slope is the improvement this whole page exists to make visible;
release rings turn that into a release-to-release story instead of a wall
of per-commit numbers. main's chart and table render directly, in solid
colour; develop's frozen history sits inside the collapsed Show
historical data (develop, pre-2026-08-25 GitFlow era) block below each
series, drawn dashed and muted when opened so it reads as archived rather
than as a second live series - the per-kernel and memory sections below
follow the same convention, table-only (no chart to style).
Loading trend data…
Per-kernel trend¶
Same commits, one level finer: each kernel's ns/call from iclforge-kernelbench, one
series per kernel. Both directions of both block sizes are covered in both their
direct and fast forms — mdct512_forward/_fast, mdct256_pair/_fast,
imdct512_windowed/_fast, imdct256_pair/_fast — so the ratio between a pair
is what mode=reference costs, and the fast inverse that became the decoder's
default in 0.9.0 has a series of its own rather than being tracked through the
direct form no decoder runs any more. The Δ column is each run against its own series' trailing
10-run mean - the same window and thresholds append_kernel_history.py annotates
with: ≥ +20% is flagged as a soft drift, ≥ +100% as a hard one. Neither ever fails
CI (see above); a flagged row here is an invitation to look, not a broken build.
The mean is of the earlier rows from the row's own CPU model, as the script takes it.
A Δ marked (mixed) is against every machine's rows instead, because the row names no
model or is the first from its model, and a difference between two machines reads there
as a change: every row recorded before 2026-10-13 is one of those.
Several kernels appear twice, as a <name> / <name>_fast pair: the transforms
exist in two evaluations (the spec's own direct form and an accelerated one - see
Verification), and both are
recorded, because the reference form is maintained code that a mode=reference run
actually executes, not dead weight. The _fast row is what a default encode or
decode spends; the bare row is what the oracle costs.
Loading kernel trend data…
Memory trend¶
Same runs, a different measure: Allocation per frame, each workload's
heap-allocation count and allocator traffic per frame from iclforge-membench, one
series per workload - including the decode paths the timing benches don't
cover. It counts allocator traffic, not memory in use: a buffer allocated and
freed every frame counts every time and is held by none. The Δ column is
bytes/frame against the series' trailing 10-run mean, the same window and
thresholds append_memory_history.py flags with (≥ +20% soft, ≥ +100% hard on
either churn metric); no absolute limit sits on Allocation per frame. A
non-zero live growth is its own signal (bytes still held after the
steady-state frames, 199 of a 200-frame run for most workloads - on the trunk
that check is absolute rather than trend-relative, warning above 4 KiB and
failing above 1 MiB). These counts are near-deterministic for a fixed workload:
a flagged row is a real change in allocation behaviour, not runner noise. The
memory-usage optimization programme's phases land as visible downward steps in
these series - that is what this table exists to show.
The same question is now asked before the merge as well. These series are
written by persist-performance-trend, which runs on main only (after a merge,
nightly, and when asked for), so for
a while a step was reported on the trunk after it landed - a red check on an
already-merged commit, blocking nothing and belonging to whoever pushed next.
The E-AC-3 encode step from 67 to 199 allocs/frame in 2026-08 (issue #544) is
exactly how it was found: the gate fired on the merge, and by then the merge
was the thing it was reporting on. The
memory half of the compare job (tools/ci/compare_memory.py, in _compare.yml, run for a
merge queue entry that changes src/) closes that: it
builds iclforge-membench at the entry's head and at the commit it is queued on and runs
each once, comparing the same two churn metrics against the same thresholds,
imported from append_memory_history.py so the two gates cannot disagree. One
run per side is the whole measurement - these counts do not move between runs
of a fixed binary, which is why this gate needs none of the repetition and
interleaving the speed half of the same job uses to see past timing
noise. Its hard tier fails the Memory gate job, and with it the queue entry;
memory-regression-approved on the pull request turns that back into an
annotation, the way perf-regression-approved does for speed. The gate reads
the label when it runs, so add it before the entry gets there, or after a
failure and queue the pull request again.
In that pre-merge job the leak check keeps its absolute thresholds but applies
them to what the entry changed - crossing a threshold the base was
under, or growing by more than one. Most of the workloads already retain
bytes across their steady state and several sit past the 4 KiB warn line,
so a per-PR check copied over unchanged would annotate every pull request for
the merge base's own findings. persist-performance-trend keeps the
unconditional absolute view on the trunk.
One limit still worth knowing when reading these series: the history a trunk run compares against is per branch, so a branch rename or a gitflow-to-trunk switch starts one from empty - the trailing window now widens to the sibling branch series when a branch's own file holds fewer than three records, and a workload with no history anywhere is annotated as ungated rather than passing quietly.
Two landed programmes are the biggest steps in these series. The 2026-08
memory-usage programme cut steady-state allocator traffic per frame by 85-88%
on the encode series (as measured when it landed, on the linux-gcc
runner: AC-3 encode 225,028 → 26,778 bytes/frame and 286 → 86 allocations;
E-AC-3 214,808 → 28,792 and 157 → 67; Atmos 218,960 → 32,656 and
196 → 106) and 54-61% on the decode series - and, outside these tables, took
every output-producing CLI command memory-flat at any programme length (a
3-minute 5.1 encode peaked at 437.8 MiB before the programme and 9.3 MiB
after; decode 217 → 28.5 MiB, spdif 225.7 → 18.0 MiB).
Two of those three encode figures stopped describing the code for a while. At
main = e982712b the same leg recorded E-AC-3 encode at 53,845.7 bytes/frame
and 199.11 allocations, and Atmos at 53,606.4 and 219.10 - both of them above
the pre-programme baselines quoted above, 157 and 196 allocations. The decode
series was unaffected, and so was AC-3 encode, which still read 26,778.5 and
86.04. That last row is why the other two can be read at all: a workload that
still matches its landed figure to the decimal, on the same leg, rules out
platform, stdlib and measurement-context drift. Without that control the two
divergences would be arguable; with it, what moved is the code the other two
share.
It is one step rather than a drift. Both E-AC-3-family workloads sit flat at
the old values through every record up to 3aedec41 and flat at the new ones
from 83546721 (2026-08-25) onward. Bisecting iclforge-membench brackets the
step to PR #352's per-channel exponent-run planner: the commit before it
(f54ea929) measures 95.0 allocations/frame for eac3_51_encode, and
fb58aa62 measures 248.2 (a windows-msvc build - the leg differs from this
table's, the step does not). AC-3 encode is untouched because it plans its
exponent runs through its own encoder.
The extra churn was a defect rather than the planner's intended cost, and was
tracked as #544.
encode_run in libs/ac3/src/encoder/eac3_frame.cpp assigned the by-value
return of iclforge::ac3::encode_exponents, which owns a std::vector, so each run
reallocated that buffer on every frame; the planner multiplied the number of
runs from one per channel to one per run per channel. The bench's own columns
carried the signature. Before the step each encode workload's steady-state
count sat below its first frame's (E-AC-3 134 first, 67.00 steady), which is
warm-up followed by reuse. After it the steady-state count exceeded the first
frame's (159 first, 199.11 steady), which is a path allocating fresh storage
every frame. run.decoded and run.bap in the same function reused their
capacity correctly, as did ChannelPlan::runs.
The fixes of 2026-09-11 (6927156da, 9d5dcb136) closed #544, and the series
shows the steps. By the record for 2026-09-12 (4e64769f) E-AC-3 encode read 41.15
allocations/frame against 67 when the programme landed, and 34,582 bytes against 28,792;
Atmos encode read 81.14 against 106 and 32,980 against 32,656; and AC-3 encode, whose own
churn had fallen too, read 58.06 against 86 and 20,111 against 26,778.
The fast-IMDCT rollout that followed
(Validation → Performance and reference modes)
lands in the decode series as two distinct marks. The flat-substream-state
change shows directly: the decode workloads' setup allocations dropped from
4 allocations / 47,606 bytes to exactly zero. The transform change itself
mostly does not show in heap columns, and knowing why matters for reading
the table: the direct evaluation's 320 KiB of step-3 matrices are lazily
built static storage, so switching the default to the FFT path removes
them from the process (a 3-minute CLI decode's peak working set drops
~0.2-0.3 MiB) without moving an allocation count. Its real payoff is time,
which the timing series on this page did not cover when it landed (they timed
encode only; roadmap PF1 added the three decode series after the fact):
measured 180-second decodes went from 3.53 s to 0.79 s (AC-3) and 3.49 s to
0.75 s (E-AC-3) when the fast path became the default - mode=reference
runs the old numbers on purpose.
Loading memory trend data…
Minimum-footprint decoder¶
Not a trend series — one measured configuration, on the concrete target the
roadmap names: arm-none-eabi cross-compiled for QEMU's mps2-an385 machine (Cortex-M3,
soft float, no OS), ICLFORGE_MINIMAL_DECODER=ON, CMAKE_BUILD_TYPE=MinSizeRel. See
Building → Minimum-footprint decoder profile
for what the profile changes and why.
firmware/baremetal/probe.cpp decodes six frames each of ten real streams — 5.1 AC-3 (448 kbit/s,
coupling), 2/0 AC-3 (192 kbit/s) and 1/0 AC-3 (128 kbit/s); 5.1 E-AC-3 (384 kbit/s, AHT + spx +
standard coupling), 5.1 E-AC-3 with §E3.5 enhanced coupling (384 kbit/s, cpl+ecpl), E-AC-3
Atmos (448 kbit/s, six objects over a 5.1 bed) and 2/0 E-AC-3 (192 kbit/s, which is the only
layout §7.5.4 rematrixing exists in) and E-AC-3 7.1.4 (640 kbit/s, a bed and two dependent
substreams) and a second Atmos stream with three of its objects raised to the ceiling, and the
5.1 E-AC-3 stream again with film-standard dynrng words and dialnorm 24 — and reports what it
cost. That is fourteen fixtures: the first Atmos stream is decoded twice, bed-only and with its
objects reconstructed, the two 5.1 streams and the 7.1.4 one are decoded a second time through
the §7.8 output stage, folded to Lo/Ro stereo in line mode (ac3_fold, eac3_fold,
eac3_714_fold), the dynrng stream is decoded in line mode without a fold (eac3_line, the
one fixture where line mode has work to do), and the height stream's objects are reconstructed
and placed onto 7.1.4 (eac3_atmos_render). Numbers below were measured on 2026-09-11 for
PR #654, arm-none-eabi GCC 14.2.1 under QEMU 10.2.1's mps2-an385; build-footprint in
.github/workflows/_build.yml reproduces them, after a merge that changes the ESP lane's
trees (CI lane partitions) and in every nightly run, and
tools/checks/run_baremetal_probe.sh reproduces them locally.
The table below was first measured early in the bare-metal probe's own feature branch (PR #351). Several
develop merges landed on that branch afterwards but before it merged to main — most
significantly DC10's QMF-domain JOC reconstruction, which the decode path needs
(libs/dsp/src/qmf.cpp and libs/ac3/src/verify/eac3_mirror.cpp, both correctly added to
libs/ac3/minimal.cmake's source list at the time, per that merge's own commit message), plus
the FFT/IMDCT rewrite and the decoder output stage — and nobody re-measured the table
or the ceiling before merging. The image had already reached 412,516 bytes by then.
The same thing happened a second time. The largest movement in that re-measurement was a
relocation rather than growth. The Pimpl sweep (ee5ff91e) gave both decoders a
struct Impl; std::unique_ptr<Impl> impl_;
(both in libs/ac3/include/iclforge/ac3/decoder/decoder.hpp), so sizeof(iclforge::ac3::FrameDecoder) and
sizeof(iclforge::ac3::Eac3Decoder) fell from 12,952 and 27,408 bytes to a single 4-byte pointer each, and
the state they used to hold in place now lives on the heap. That state came out of automatic
storage: both decoders are locals in decode_ac3() and decode_eac3(), and .bss was unchanged
at 237,592 bytes across those two measurements. It has moved since, for unrelated reasons the
Static footprint section below sets out. Peak heap rose by 27,416 bytes, which is the E-AC-3
decoder's former in-place size rather than the two summed — decode_ac3() returns before
decode_eac3() runs, so only the larger of the two is ever live at the peak. The rest of the
delta is .text, up 5,728 bytes and the whole of the image change, from the ordinary work of the
intervening commits.
Static footprint¶
| Bytes | |
|---|---|
.text (code + read-only data) |
289,484 |
.data (initialised) |
400 |
.bss (zero-initialised) |
62,217 |
| Image total | 352,101 (343.8 KiB) |
These are arm-none-eabi-size's own columns, which is what ICLFORGE_MAX_IMAGE_BYTES gates, so
they group sections rather than list them: .text here includes .init, .fini and
.ARM.exidx, .data includes .init_array and .fini_array, and .bss includes .tbss. Read
per-section with arm-none-eabi-size -A, .text is 289,452, .data 388 and .bss 62,184.
main at 7bdb58e7 measured 340,821 on the same leg: the 11,280 bytes since are all .text,
9,216 of them the dynrng stream eac3_line decodes and the rest the output stage's block-wise
fold.
.bss fell from 237,592 bytes in two steps. Moving ecpl_channel_spectrum's 32 KB scratch off
thread-local storage — it made the library unlinkable into any FreeRTOS application, see
the ESP32-S3 page — took
.tbss from 32,784 bytes to 24, and tls.cpp's block was resized from 64 KiB to 4 KiB to
match. The decode path then moved to float32 under this profile, halving every coefficient
buffer. .text rose 5,680 bytes over the same span, which is the float32 transform
instantiation.
.text has risen as fixtures were added, and most of each rise is the bitstreams themselves:
fixture.hpp is constexpr std::array data linked into probe.cpp.obj's read-only section.
It held 19,968 bytes of stream before the enhanced-coupling and 2/0 fixtures, 33,792 with them,
and 52,224 now across seven streams. None of the tools those fixtures reach added code —
eac3_tools.cpp, fft.cpp, joc.cpp and oamd.cpp were already in libs/ac3/minimal.cmake's
source list and already linked, which is the point: what the fixtures added was execution, not
size.
The float decode path moved it again, by less than the size of the conversion suggests. Against
the 320,940 bytes main measured before it (223,260 of .text, 97,280 of .bss), .text is
1,264 bytes larger and .bss 2,864. The <double> instantiations this profile no longer
references left the image as their float forms came in, so most of the conversion was a swap:
eac3_decoder.cpp.obj is 912 bytes smaller, joc.cpp.obj 590 larger. The .bss is two
things. 1,949 bytes are the stage timers' tables, stage_timers.cpp.obj, linked into every
shape of the probe so that a timed build and a plain one differ only in the library's include
path; 912 are two tables eac3_tools.cpp now fills once at start-up rather than computing per
call, spectral extension's attenuation (32 codes by 3 taps) and the AHT's inverse kernel in
float.
Enhanced coupling's float forms then took 7,067 bytes back off, to 318,001. The double dft512
and its tables left the image — fft.cpp.obj went from 4,444 to 3,004 bytes of .text and
from 9,204 to 5,116 of .bss, the float twiddles being half the size — and
eac3_decoder.cpp.obj lost 1,150 bytes of .text with its double §E3.5 path.
The hot-path sweep's BitReader cache and bit-allocation memos cost 2,520 bytes of .text and
no .bss, for an image of 320,521. 1,686 of it is decoder.cpp.obj, whose read sites are the
most numerous; 716 is eac3_decoder.cpp.obj. The access unit's memcpy and its moved object
description are 80 bytes more: 320,601. The 7.1.4 fixture is 55,496 more, and nearly all of it
is what it says: 30,720 bytes of stream in .text and 24,576 of .bss for the four channels the
probe's PCM block grew by, against 168 bytes of code. 376,097. The block-granular output forms then
took that block out altogether - the probe reads the decoders' blocks in place and holds no PCM -
and .bss fell 73,824 bytes to 46,829, against 872 bytes of .text for the forms themselves:
303,145, the smallest image the probe has had since its fixtures were four. The output stage's
float forms and the two fold rows are 472 more - 456 of .text, 16 of .bss - for 303,617:
output.cpp.obj went from 4.5 KiB to 4.6, the narrowed Hilbert kernel being a second static
beside the double one, and probe.cpp.obj from 86.0 KiB to 86.3 with the rows. Placing objects
is 33,640 more, for 337,257: the height stream's 10,752 bytes and
spatial.cpp in .text, and in .bss a 12,288-byte render block - twelve channels of one
256-sample block, what a player holds - with a 1,536-byte table of each object's gain per slot.
The stage-timer table's growth from 32 zones to 64, which the encoder's rows needed, is 1,536
more of .bss in every shape of the probe: 338,793.
Where it went, objects over 2 KiB (see tools/checks/footprint_report.py --map for the full
attribution from the linker map):
| Object | .text |
.bss |
|---|---|---|
probe.cpp.obj (the harness itself — fixtures, checks, allocator hooks) |
86.0 KiB | 809 B |
eac3_decoder.cpp.obj (all of Annex E) |
37.5 KiB | 0 B |
eac3_tools.cpp.obj (spx/ecpl band geometry + §3.5.5 reconstruction) |
19.8 KiB | 11.2 KiB |
mdct.cpp.obj (inverse transform, fast path only) |
15.9 KiB | 14.6 KiB |
decoder.cpp.obj (AC-3) |
20.8 KiB | 0 B |
joc.cpp.obj (§6 object reconstruction from the bed) |
14.0 KiB | 0 B |
qmf.cpp.obj (DC10's QMF-domain JOC reconstruction) |
6.0 KiB | 4.2 KiB |
fft.cpp.obj (the 512-point DFT §3.5.5 enhanced coupling needs) |
2.9 KiB | 5.0 KiB |
oamd.cpp.obj (§H.1 object metadata) |
6.8 KiB | 0 B |
output.cpp.obj (OutputStage::apply/mix_levels, both decoders') |
4.5 KiB | 16 B |
tls.cpp.obj (the single-thread TLS block — see below) |
8 B | 4.0 KiB |
bitalloc.cpp.obj (§7.2 bit allocation, both generations) |
3.9 KiB | 0 B |
transient_prenoise.cpp.obj (§3.7 post-IMDCT correction) |
744 B | 3.0 KiB |
libm_a-e_pow.o (newlib's pow) |
2.9 KiB | 0 B |
stage_timers.cpp.obj (the stage timers' tables, linked into every shape of the probe so that a timed build and a plain one differ only in the library's include path) |
918 B | 1.9 KiB |
arm_librdimon_a-syscalls.o (newlib's semihosting syscalls) |
2.5 KiB | 176 B |
libm_a-k_rem_pio2.o (newlib's trig argument reduction) |
2.2 KiB | 0 B |
| everything else, summed | 22.3 KiB | 769 B |
One earlier correction is worth knowing when comparing this table against older versions of it.
The attribution used to read GNU ld's "Discarded input sections" block as though it were part of
the map proper, so every --gc-sections casualty was credited to the object it came from; it
inflated the .text column by 63 KiB, eac3_tools.cpp.obj most of all (21.3 KiB reported
against 8.4 KiB actually linked). footprint_report.py has skipped that block since, and both
columns reconcile with arm-none-eabi-size's own totals.
tls.cpp.obj's 4 KiB is the single-thread __aeabi_read_tp stub's static block
(firmware/baremetal/platform/baremetal/tls.cpp), checked by two ASSERT()s in the linker script
rather than trusted.
It was 64 KiB, sized against ecpl_channel_spectrum's thread_local scratch. That scratch is no
longer thread-local: at 32 KB it made the library unlinkable into any FreeRTOS application,
because FreeRTOS carves each task's thread-local area out of that task's own stack and ESP-IDF's
1 KB IPC task could not then be created. With the storage moved to the heap behind a
unique_ptr, the measured .tbss is 24 bytes, so 4 KiB leaves the same order of headroom the
old number did.
Table ROM budget¶
The reason the minimum-footprint decoder profile asks for this figure by name: the direct-form transform tables mode=reference
needs are absent from this image entirely, not merely unused. Measured on the object file
with dumpbin /HEADERS (Windows) — the actual .bss reservation, not an estimate:
| Table | Bytes | Only needed by |
|---|---|---|
ForwardCosTable<512> |
1,048,576 | Direct-form forward MDCT, long — encode, not on this decoder's path at all |
ForwardCosTable<256> × 2 |
524,288 | Direct-form forward MDCT, short — encode |
InnerSumTable |
262,144 | Direct-form inverse, long — decode, mode=reference only |
InnerSumPairTable |
65,536 | Direct-form inverse, short — decode, mode=reference only |
| Total excluded | 1,900,544 (1.81 MiB) | |
| Fast-path tables actually linked in | ~12,600 |
A build asking for mode=reference in this profile gets DecodeError::kNoReferenceTransform rather than
a silent fast-path substitution — see the building doc for why.
Runtime footprint¶
| Value | |
|---|---|
| Peak heap | 237,206 bytes (231.6 KiB), the 7.1.4 fixture folded to stereo; 230,798 as coded, 211,371 with Atmos objects |
| Retained after teardown | 12 bytes |
sizeof(iclforge::ac3::FrameDecoder) |
4 bytes (one unique_ptr — see above) |
sizeof(iclforge::ac3::Eac3Decoder) |
4 bytes (one unique_ptr — see above) |
| Caller-owned PCM buffer | none: the probe decodes through the _by_block forms and reads the decoders' blocks in place |
| AC-3 allocations per frame, steady state | 3 |
| AC-3 2/0 and 1/0 allocations per frame, steady state | 1 |
| E-AC-3 allocations per frame, steady state | 12 |
| E-AC-3 enhanced coupling allocations per frame, steady state | 12 |
| E-AC-3 2/0 allocations per frame, steady state | 10 |
| Atmos bed allocations per frame, steady state | 20 |
| Atmos with objects allocations per frame, steady state | 31 |
| E-AC-3 7.1.4 allocations per frame, steady state | 35 |
The steady-state allocation counts are the gap Building records: the minimum-footprint profile asks
for zero, and this is 1–35. What is left is no longer the per-block geometry vectors inside the
decoders — those are Impl members now, reused frame to frame — but the std::vector members
of the returned DecodedFrame/DecodedSubstream, which the memory programme's _into
forms could not remove because they are inherent to those two return types
rather than to allocation reuse. DecodedFrame::blksw is the whole of AC-3's remaining one
per frame; DecodedSubstream::channels is 7 of E-AC-3's 12. Reaching zero means those becoming
fixed-capacity or pooled, a public-type change tracked separately from this profile.
Enhanced coupling used to be the outlier here, at 126 against 43–86, and had its own ceiling of
140. It measures 12 now, level with plain E-AC-3, because the gap was never §E3.5's geometry:
sixty of it were two std::vector<double> built per coupled channel per block in the
reconstruction loop, and the rest went when both decoders' frame-scope buffers moved onto the
decoder. There is one ceiling, 100, and no exemption.
Both bare-metal legs report all of these counts identically, on different libstdc++ versions
(GCC 14.2 for arm-none-eabi, 15.2 for Xtensa under ESP-IDF 6.1), as they do the peak and the
retained bytes. The counts come from the decoders' own per-block geometry rather than from
anything the standard library is free to vary, so a divergence between the legs would itself be
news.
The peak is what an Atmos fixture decoded with its objects costs — it was 179,064 before that
fixture existed, and 449,826 when the object path was first measured. Domain::kMdctBand, a
float32 ReconstructionState, per-object scratches sized to the stream and handing back the
enhanced-coupling scratch between decodes took it to 233,546. Moving the decoders' frame-scope
buffers onto the decoder — what closed the per-frame churn above — added 2,845 back, because a
buffer's high-water capacity is now held for the decoder's lifetime rather than released each
frame. JOC's mixing then began narrowing the frame's matrix once into a scratch of its own rather
than at every read, 912 bytes more. The float form of the enhanced-coupling scratch, and of
the decoder's own §E3.5 state, then gave 4,108 back, and the bit-allocation memos — each
stream's last exponent set and allocation parameters, kept so an unchanged block reuses its
allocation — hold 1,608 across a frame; they are built on a stream's first block, so a run's
allocation total rises by 41 while every fixture's steady-state count above is unchanged.
Moving a substream's object description into the access unit rather than copying it then gave
24,600 back. 210,203 fits the 280,792 bytes an ESP32-S3 has free with 70,589 to spare - 26,188
below the 236,391 main carried before this stack, and the lowest peak the probe has reported
since objects were first reconstructed, with a quarter of the part's free SRAM unused at it.
The 7.1.4 fixture then set a new one: 229,630, the widest programme the format has, against the
257,572 bytes the probe's twelve-channel PCM block leaves free on the part - 27,942 to spare.
The same stream folded to stereo is the peak now, 237,206. The peak by fixture, identical on
both legs, measured on 2026-09-11:
| Fixture | Peak heap | Allocations per frame |
|---|---|---|
ac3_mono |
47,596 | 1 |
ac3_stereo |
49,304 | 1 |
ac3 5.1 |
56,421 | 3 |
ac3_fold |
58,469 | 3 |
eac3_atmos_bed |
124,903 | 20 |
eac3_stereo |
141,702 | 10 |
eac3_ecpl |
158,661 | 12 |
eac3 5.1 |
168,210 | 12 |
eac3_line |
168,286 | 12 |
eac3_fold |
174,566 | 12 |
eac3_atmos_objects |
211,371 | 31 |
eac3_atmos_render |
211,741 | 36 |
eac3_714 |
230,798 | 35 |
eac3_714_fold |
237,206 | 35 |
The AC-3 rows carry the 36,872 bytes of the block form's own frame (decode_frame_by_block: AC-3 has
no substream vectors to hand out views of, so it keeps one frame, sized once); the E-AC-3 rows did
not move, since that form copies nothing. Before the block forms the AC-3 rows were 10,652, 12,356
and 19,457. The fold rows are their streams' rows plus the output stage's own buffers, a block of
each and not a frame: for AC-3 a block of the two outputs (2,048 bytes), and for E-AC-3 a block
of the six seats its layout fold stages the substreams' channels into (6,144), the fold itself
going straight into the caller's first two channels. Until 2026-09-11 both were frame-long, and
the fold rows peaked at 68,709, 217,574 and 280,214 bytes.
The ESP32-S3 page has what each step was worth.
Retained after teardown is bytes still live when the probe finishes, after every decoder it
made has been destroyed — so not per-frame growth and not a leak. It is 12 bytes now: one
__cxa_thread_atexit registration record, for the pointer to enhanced coupling's spectrum scratch,
the one thread_local the library still declares.
It was 34,232 until the probe began calling iclforge::ac3::eac3::release_ecpl_scratch() between fixtures,
and 24 until the per-bin angle buffer stopped being a second thread_local. The 34,232 was
enhanced coupling's 32,768-byte spectrum scratch and its 1,440-byte bin-angle vector, both
thread_local so §E3.5 neither allocates per call nor puts 32 KB on the stack, and therefore
resident for the life of a task that never exits. Bounded and paid once — but enough to decide
whether something else fits, and it decided: object reconstruction failed on an ESP32-S3 whenever
it ran after an enhanced-coupling decode, on a 6,144-byte request, and succeeds now that the
scratch goes back. The scratch is 23,552 bytes on this profile now (its float form, tables
included) and the angle buffer a stack array. Nothing could measure any of it until a fixture
reached §E3.5.
tools/checks/run_baremetal_probe.sh gates the image, the heap peak, the retained bytes and
every fixture's allocation count at ceilings above these measured values, so a regression stops
the build instead of drifting the table silently. The fixture names come from the probe's own
output rather than a list in the script, so a fixture added and forgotten cannot pass unnoticed.
Instructions per frame¶
tools/checks/run_baremetal_probe.sh --icount builds the probe with its clock on the
mps2-an385's 25 MHz timer and runs QEMU under -icount shift=0, where the guest clock advances
one nanosecond per executed instruction; the probe's microseconds are then thousands of Thumb-2
instructions, the same on every host. Measured on the arm-none-eabi leg on 2026-09-11, -Os,
soft float throughout (the leg has no FPU, so this is what a part without one pays):
| Fixture | Instructions per frame | Ceiling |
|---|---|---|
ac3_mono |
1,626,000 | 2,000,000 |
ac3_stereo |
3,550,000 | 4,500,000 |
eac3_stereo |
4,858,000 | 6,000,000 |
eac3_atmos_bed |
8,945,000 | 11,000,000 |
ac3 5.1 |
10,228,000 | 13,000,000 |
ac3_fold |
10,770,000 | 13,500,000 |
eac3 5.1 |
12,965,000 | 16,000,000 |
eac3_line |
13,595,000 | 17,000,000 |
eac3_fold |
14,244,000 | 17,000,000 |
eac3_atmos_objects |
28,218,000 | 35,000,000 |
eac3_atmos_render |
28,941,000 | 36,000,000 |
eac3_ecpl |
28,863,000 | 36,000,000 |
eac3_714 |
33,900,000 | 42,000,000 |
eac3_714_fold |
36,040,000 | 45,000,000 |
The fold is 542,000 instructions over plain AC-3 5.1, 1,279,000 over E-AC-3 5.1 and 2,140,000
over 7.1.4: 5%, 10% and 6%. eac3_line is 630,000 over eac3, which is §7.7.1's gain and
§5.4.2.8's normalisation on a stream carrying dynrng words and dialnorm 24; its stream is the
5.1 one encoded with those two added. On the other rows' streams, at dialnorm 31 and with no
dynrng words, line mode does no per-sample work, so the fold rows count the fold. The render
row is the objects row plus the placing: 5% of its count is the render, the rest the same
reconstruction.
Not cycles on any real part: a Cortex-M3 would take more, an ESP32-S3 with its FPU takes a fifth of a 5.1 frame's count in cycles. What the column is for is that it is deterministic — two runs agree to the instruction — so a change that adds one per cent of work to a fixture shows in the run's own lines, and the ceilings above hold the same headroom the other gates do. The ESP32-C3 page reads the ESP32-C3's prospects off it.
Instructions per frame, fixed-point tier¶
The same clock on the same leg with the decoder built as its fixed-point tier
(tools/checks/run_baremetal_probe.sh --scalar=fixed --icount),
measured 2026-09-10. Integer arithmetic where the
row above it is software floating point: a Q7.24 multiply is one smull and a
shift where a soft-float one is a call. The ceilings are ICOUNT_CEILING_FIXED
in the runner, with the same headroom rule as every other gate here. Both
columns re-measured on 2026-09-11.
| Fixture | Fixed tier | Float tier | Ratio | Ceiling |
|---|---|---|---|---|
ac3_mono |
615,000 | 1,626,000 | 0.38x | 1,000,000 |
ac3_stereo |
1,245,000 | 3,550,000 | 0.35x | 2,000,000 |
eac3_stereo |
1,817,000 | 4,858,000 | 0.37x | 2,500,000 |
eac3_atmos_bed |
3,538,000 | 8,945,000 | 0.40x | 4,500,000 |
ac3 5.1 |
3,804,000 | 10,228,000 | 0.37x | 5,000,000 |
ac3_fold |
5,301,000 | 10,770,000 | 0.49x | 7,000,000 |
eac3 5.1 |
4,825,000 | 12,965,000 | 0.37x | 6,500,000 |
eac3_line |
6,273,000 | 13,595,000 | 0.46x | 7,000,000 |
eac3_fold |
7,985,000 | 14,244,000 | 0.56x | 10,500,000 |
eac3_atmos_objects |
25,091,000 | 28,218,000 | 0.89x | 31,500,000 |
eac3_atmos_render |
25,522,000 | 28,941,000 | 0.88x | 32,000,000 |
eac3_ecpl |
10,086,000 | 28,863,000 | 0.35x | 13,000,000 |
eac3_714 |
12,087,000 | 33,900,000 | 0.36x | 15,500,000 |
eac3_714_fold |
17,019,000 | 36,040,000 | 0.47x | 21,500,000 |
The output stage is where this tier gains least: its samples are float in and out, so
every multiply-add converts a sample to Q7.24 and back and the add is software floating
point, which is why the fold rows and eac3_line sit at 0.46x to 0.56x where the decode
alone is 0.35x to 0.40x.
The Annex E rows were measured twice. The tier reached them in two steps: the
store and the transform first, with the adaptive hybrid transform, enhanced
coupling and the spectral extension notch still running on float copies
converted at the seam, and those three in the tier afterwards. What that
second step moved:
| Fixture | Tools through float | Tools in the tier |
|---|---|---|
eac3_ecpl |
24,272,000 | 10,088,000 |
eac3_714 |
17,650,000 | 12,092,000 |
eac3 5.1 |
6,639,000 | 4,827,000 |
eac3_fold |
9,870,000 | 8,053,000 |
eac3_stereo |
2,502,000 | 1,818,000 |
Enhanced coupling is the row it was written for: three inverse transforms, a 512-point DFT and a per-bin complex reconstruction per coupled channel per block, all of it software floating point before and integer after.
The two object rows moved by neither step, and that is not the tier's doing.
JOC's reconstruction runs in float in every build of this library, the
double one included (recon_scalar_t in iclforge/ac3/oba/joc.hpp), so an object row
is a float transform sandwich whatever the decoder's own scalar is; the tier's
only contact with it is one conversion per matrix coefficient read. Bringing
it in would be a fixed forward MDCT and a fixed QMF path - a separate piece of
work with its own quality question, and one that would change nothing for the
other two tiers.
The image is 364,685 bytes against the float tier's 352,101 - the fixed
transform's tables and kernel beside the float ones the object path still
needs - and the peak heap 244,502 on this leg, the 7.1.4 fold (238,094 for
7.1.4 as coded). The pcm_hash lines
are identical on this leg and on the x86 host for all fourteen fixtures and are
pinned in testdata/fixed-probe-pcm-hashes.json
(tools/checks/check_probe_hashes.py); with the scalar's conversions from
float and double written as floating expressions the two legs had differed
by a raw unit on a few AC-3 samples, and writing them on the value's bits
(fixed32.hpp) is what made them agree.
Instructions per encoded frame¶
The same clock on the encode probe, tools/checks/run_baremetal_probe.sh --encoder --icount,
measured 2026-09-10 on the same leg. The encoders run in the profile's scalar end to end since
2026-09-10, soft float on this leg as the decoders are; what is left of the gap to the decode
rows above - 1.7 to 3 times for the same layout - is the search: exponent-run planning, several
hundred bit-allocation calls a frame, mantissa bit counts, integer work the decoder does once a
block. The ceilings are ICOUNT_CEILING_ENCODE in the runner, with the same headroom as every
other gate.
| Row | Instructions per frame | Ceiling | Peak heap | Allocations per frame |
|---|---|---|---|---|
ac3_stereo 2/0, 192 kbit/s |
9,136,000 | 16,000,000 | 52,707 | 34 |
eac3_stereo 2/0, 192 kbit/s |
12,683,000 | 30,000,000 | 79,894 | 76 |
eac3_tools 2/0, 192 kbit/s, cpl + spx + AHT |
16,920,000 | 31,000,000 | 143,037 | 47 |
ac3 5.1, 448 kbit/s |
24,866,000 | 43,000,000 | 110,918 | 67 |
eac3 5.1, 384 kbit/s |
33,207,000 | 78,000,000 | 158,602 | 173 |
eac3_ecpl 2/0, 192 kbit/s, §E3.5 |
48,217,000 | 104,000,000 | 130,887 | 87 |
The three 2/0 rows are new with the timing; the encode image is 225,357 bytes with them
(157,136 .text, 400 .data, 67,821 .bss): the rows, the stage timers' application half
(an encode image links it now that the probe reports its stages) and the 64-zone table, and the
encoders' float forms beside the double ones - smaller than the image with the front end alone
in float (242,589), the double software routines the rest of the encoder had pulled in
having gone with it. The counts fell a further 8% to 12% when the rate-control search and the
exponent-run planner were made cheaper (the ESP32-S3 page's Encoding section); the peaks rose
by the cached masking curves, some 200 bytes a run. Building
has what the encode direction cannot fit on an ESP32-S3, with the host profile's numbers.
The AC-4 decoder¶
tools/checks/run_baremetal_probe.sh --ac4 builds the decode profile with the AC-4 decoder in it
(ICLFORGE_MINIMAL_AC4=ON, ICLFORGE_DECODE_SCALAR=float; the presets config-arm-none-eabi-minimal-ac4
and its -icount and config-linux-gcc-minimal-ac4) and the AC-4 probe in place of the AC-3 and
E-AC-3 one: AC-4 shares nothing with iclforge::ac3, so it is a build of its own. It decodes six
committed streams (firmware/baremetal/ac4_fixture.hpp, made by
tools/generators/gen_baremetal_ac4_fixture.py): 2.0 from DEE with A-SPX, 2.0 constructed in
A-CPL, 5.1 from DEE, 5.1 constructed in A-CPL, DEE's 5.1.4 tones, and DEE's 2.0 at 48 kbit/s,
whose A-SPX runs companding (added by D14a4, the one fixture that reaches float pow and exp2),
three or four frames each (two for the 5.1.4 tones), all at frame rate index 13, 2 048 samples at
48 kHz. Measured on 2026-09-30 on
the same arm-none-eabi leg as the tables above (GCC 14.2.1, QEMU 10.2.1, -Os, soft float), in
float. The seam's directory here is generic, so the QMF banks' vector kernels run through its
portable types: 0.2 to 0.3% fewer instructions than the scalar loops and 4.2 KB more image.
| Fixture | Instructions per frame | Ceiling | Peak heap | Ceiling | Allocations per frame | Ceiling | Stack |
|---|---|---|---|---|---|---|---|
ac4_20_music |
54,530,000 | 60,000,000 | 431,805 | 485,000 | 52 | 58 | 18,288 |
ac4_20_acpl |
57,883,000 | 64,000,000 | 626,008 | 690,000 | 50 | 56 | 19,456 |
ac4_51_music |
117,580,000 | 130,000,000 | 996,954 | 1,100,000 | 153 | 168 | 19,456 |
ac4_51_acpl |
124,489,000 | 137,000,000 | 1,205,460 | 1,330,000 | 90 | 99 | 19,456 |
ac4_514_tones |
205,781,000 | 227,000,000 | 1,931,680 | 2,130,000 | 191 | 210 | 19,456 |
ac4_20_companding |
58,624,000 | 64,500,000 | 466,163 | 522,000 | 75 | 82 | 19,440 |
The first five rows are the figures of D14a's third part. Measured again with D14a4 in the tree
they give the same counts to within half a per cent (54.5 M, 57.8 M, 117.1 M, 124.2 M and 205.5 M
instructions a frame), an image of 485,056 bytes, and the same PCM hashes. With D14a5 in the tree the
counts agree to within 0.01% (54.5 M, 57.8 M, 117.1 M, 124.2 M, 205.5 M and 58.6 M), the peak heap, the
stack and the hashes are the same, and the image is 683,448 bytes, 198,416 more than the same tree
before D14a5 (485,032), 196,464 of them the sample rate converter's three float tables, which the
compiler builds into it.
With D14e in the tree (2026-10-02, the same leg) the counts are within 1.1% of D14a4's, the peak heaps 0.8 to 6.8%
lower, the PCM hashes the same, and the image is 691,896 bytes (689,244 .text, 392 .data, 2,260 .bss),
8,448 more than with D14a5: the specialised FFT passes, the A-CPL interpolation and the other code D14e adds, at
-Os. D14e's changes are for the P4's in-order core and its flash, and a soft-float Cortex-M3 runs the same operations in
the same order:
| Fixture | Instructions per frame | Ceiling | Peak heap | Ceiling | Allocations per frame | Ceiling | Stack |
|---|---|---|---|---|---|---|---|
ac4_20_music |
54,766,000 | 60,000,000 | 413,611 | 485,000 | 56 | 58 | 16,580 |
ac4_20_acpl |
57,284,000 | 64,000,000 | 601,504 | 690,000 | 50 | 56 | 19,480 |
ac4_51_music |
116,737,000 | 130,000,000 | 946,390 | 1,100,000 | 147 | 168 | 19,480 |
ac4_51_acpl |
122,882,000 | 137,000,000 | 1,147,590 | 1,330,000 | 84 | 99 | 19,480 |
ac4_514_tones |
206,264,000 | 227,000,000 | 1,800,312 | 2,130,000 | 203 | 210 | 19,480 |
ac4_20_companding |
58,818,000 | 64,500,000 | 462,435 | 522,000 | 73 | 82 | 19,480 |
The image is 683,448 bytes (680,804 .text, 392 .data, 2,252 .bss; 198,416 bytes of .text more than
before D14a5, 196,464 of them the converter's tables), the ceiling 750,000; the
stack ceiling is 21,500 here and 28,500 on the host, whose frames are larger (24.7 to 26.0 KB read
there); retained bytes after teardown 0, the ceiling 1,024. The ceilings are the runner's
(ICOUNT_CEILING_AC4 in run_baremetal_probe.sh, and the peaks and the allocations a frame in
testdata/ac4-probe-ceilings.json), each a tenth or so over its figure
with the same rule as the tables above. On the x86-64 host (GCC 16, 64-bit pointers) the peaks
are 442,193, 634,088, 1,024,014, 1,235,048, 1,954,304 and, for the companding fixture, 474,083.
The PCM of every fixture is bit-identical on the two legs, and the hashes are pinned in
testdata/ac4-probe-pcm-hashes.json. The companding fixture is what holds that for the
streams with companding: before D14a4 the C libraries' powf and exp2f gave the Cortex-M3 leg,
the host and the board a PCM each for such a stream, and no fixture had companding to say so.
The fixed-point tier (D14d, 2026-10-02, the same leg, run_baremetal_probe.sh --ac4 --scalar=fixed
--icount) decodes the same six fixtures with integer arithmetic where the float tier's is software
floating point, and its PCM hashes are the same on this leg, on the x86-64 host and on RV32IMC
(testdata/ac4-fixed-probe-pcm-hashes.json). Its instruction ceilings are the runner's
ICOUNT_CEILING_AC4_FIXED; the peaks, allocations and stack share the float tier's ceilings:
| Fixture | Instructions per frame | Ceiling | Peak heap | Allocations per frame | Stack |
|---|---|---|---|---|---|
ac4_20_music |
38,233,000 | 42,000,000 | 429,667 | 56 | 18,380 |
ac4_20_acpl |
34,202,000 | 37,500,000 | 626,368 | 50 | 21,080 |
ac4_51_music |
55,629,000 | 61,000,000 | 970,430 | 147 | 21,080 |
ac4_51_acpl |
52,493,000 | 58,000,000 | 1,172,502 | 84 | 21,080 |
ac4_514_tones |
90,383,000 | 99,500,000 | 1,825,056 | 203 | 21,080 |
ac4_20_companding |
39,856,000 | 44,000,000 | 486,331 | 73 | 21,080 |
That is 0.43 to 0.70 of the float tier's instructions, the widest streams the lowest, and peaks
1.4 to 5.2% above its own. The image is 727,656 bytes (725,004 .text), against a ceiling of
800,000: 35,760 more than the float image, with the converter's tables in Q1.30 in place of
float, the same 196,464 bytes. On the x86-64 host (GCC 14) the peaks are 438,527 to 1,848,776
bytes and the stack 24,908.
With the decoder's memory work in the PCM hashes of both tiers are the same, and:
| Fixture | float instructions per frame |
Fixed instructions per frame | float peak heap |
Fixed peak heap | Allocations per frame |
|---|---|---|---|---|---|
ac4_20_music |
25,226,000 | 6,700,000 | 286,365 | 286,365 | 55 |
ac4_20_acpl |
35,114,000 | 10,529,000 | 418,110 | 426,918 | 48 |
ac4_51_music |
87,174,000 | 24,041,000 | 696,375 | 704,311 | 143 |
ac4_51_acpl |
100,699,000 | 28,787,000 | 859,616 | 868,424 | 82 |
ac4_514_tones |
161,804,000 | 42,962,000 | 1,494,319 | 1,502,903 | 202 |
ac4_20_companding |
29,271,000 | 8,308,000 | 321,307 | 329,147 | 71 |
The peaks are 2.0's by a third and 5.1's by 27% below the tables above. The instruction counts are an
average over a fixture's three or four frames, the first included, and the first no longer builds the
inverse transform's tables in software floating point: they are built by the compiler into flash, which
makes the images 750,276 bytes (float) and 801,812 (fixed). The stack is 19,472 and 21,064 bytes. On
the x86-64 host the fixed tier's peaks are 295,225 to 1,526,819 bytes.
The first frame allocates 279 KB, 261 KB, 661 KB, 639 KB, 1.47 MB and 270 KB (D14f; 510 KB, 490 KB, 987 KB, 998 KB, 1.86 MB
and 498 KB at D14e, 550 KB, 531 KB, 1.21 MB, 1.22 MB, 2.06 MB and 541 KB at D14a), the decoder's state built as the stream's
layout is first seen; the steady state allocates 48 to 143 allocations a frame at 2.0 and 5.1 and 202 at 5.1.4, the syntax
layer's element vectors built afresh each frame (vector<Track> the largest). That is the gap to zero here, as it is for the AC-3 and E-AC-3 decoders above. D14c did not bring the peak under the S3's
internal RAM: the S3 puts the decoder's state in PSRAM, and its QEMU row holds what is left in internal RAM, 3 to 5 KB at 2.0
and 9 to 14 KB at 5.1 and 5.1.4 when D14c measured it, before D14f (ESP32-S3); the
peaks are this leg's to the byte there.