Validation¶
Quality is measured, not asserted, and coverage has known edges. This page is both: how output is checked, and exactly where checking runs out.
The codecs are not checked alike. AC-3 and E-AC-3 have FFmpeg's decoder and Dolby's encoder as outside references. AC-4 has Dolby's encoder here and no reference decoder: FFmpeg does not decode it, and Dolby's own decoder returned no audio when tried. The sections before AC-4 are about AC-3 and E-AC-3 unless they say otherwise; the AC-4 section describes its checks from the inspector to the encoder and Hearth's engine, and Where each check runs says which stage of CI runs what.
Six independent checks¶
In rough order of strength:
- The in-repo decoder. Fully normative and shares the encoder's core, so a round trip exercises the bit-allocation model in both directions. It reaches float32-precision PCM parity with FFmpeg's decoder on identical streams: max sample difference 7.9e-6 (≈ −102 dBFS) for AC-3, 1.4e-5 for E-AC-3. It also reads FFmpeg's own encoder output, Dolby Encoding Engine's, and pinned commercial-encoder excerpts from FFmpeg's FATE archive — see Third-party bitstreams for what that corpus is, and for the five decoder defects wiring it up exposed.
- FFmpeg as an external oracle. The streams the gold-reference gate, the codec matrix and
the encoder-space searches produce are strict-decoded with
-err_detect crccheck+bitstream+buffer+explode(and-xerror, where the script reads the exit code), which fails on a CRC error, a bitstream violation or a buffer problem rather than concealing it. The gold-reference gate does this in the pull-request gate; the matrix and the searches do it nightly in FFmpeg Validate. FFmpeg has no AC-4 decoder, so for AC-4 it checks framing only. - Independent Python transcriptions.
tools/holds second implementations of the spec pseudocode, written from the standard separately from the C++: the §7.2.2 bit allocation, the Tables 7.29/7.30 DRC lookups, MDCT goldens. Agreement between two transcriptions of the same text is weaker evidence than a decoder, but it catches transcription slips that a self-consistent round trip cannot. - Dolby's own tooling as a syntax oracle. The Reference Player and the Dolby Media Encoder
were diffed field-for-field against this encoder's output during the object work. That found
several real bugs — the EMDF container belonging in a skip field rather than the aux field,
codecdatae=0, a dynamic-object-only programme with the LFE as an object but not a JOC output, and metadata flag arrays transmitted index-0-first.
One DEE-produced stream is committed rather than only diffed against:
testdata/object-fixture/dee_joc_514.ec3, a DD+ JOC encode of a synthetic 5.1.4 tone bed
(tools/generators/gen_object_fixture.py, local-only — DEE is licensed and never runs in CI).
It is the only Atmos stream here this project's own encoder did not make, and every part of
the object layer it exercises was refused outright before it existed: a bed programme with a
twelve-channel assignment and b_bed_chan_distribute set, object_gain_idx 3, a second
oa_element carrying a trim_element, joc_dmx_config_idx 3 with a nonzero joc_clipgain_x_bits
(4, though joc_clipgain_y_bits is 0, which makes the computed joc_clipgain exactly unity —
see oba::joc::parse_payload's own comment; this fixture exercises the nonzero-field parse path
but not a non-unity gain) and sparse coding, and an EMDF container mixing payload_frame_aligned
0 and 1 across its
payloads. Decoding it also caught a real audio-layer bug — audblk reads cplfgaincod and
cplfsnroffst ahead of the per-channel lists when the block couples, and the decoder skipped
both, which no stream this project produces could have exposed.
Two more, dee_joc_714.ec3 and dee_joc_916.ec3, are 7.1.4 and 9.1.6 beds that play one input
channel at a time, a tenth of a second each. They exist for what ten channels cannot show: that
the bed's channel order holds at twelve and sixteen, where Table 12's order and a production
tool's input order are different permutations (9.1.6 puts the wides last in the bed and right
after the rears at the input). The slice an object comes back loud in names the input channel
it carries, whatever the solver did with the others, and every object does — the DEE-checked
claim docs/library/spatial-and-atmos.md makes of CBI beds.
What that fixture asserts is not just "it parses". Each of the ten channels of the source bed
carries a different tone, so identifying each reconstructed JOC object by which tone dominates
it is an independent check on both the reconstruction and the order the bed's channels
occupy — the order TS 103 420 §5.6.1.1.4 states backwards
(libs/ac3/tests/oba/test_dee_joc_fixture.cpp).
Two limits are worth stating: DEE's atmos_mezz (ADM BWF) input refuses a master this project
authors, gating on content provenance rather than syntax, so the fixture is channel-based
immersive and carries no dynamic objects — object size, zone constraints and snap are covered
by the in-repo encode round trip instead. And retail Atmos discs, whatever they would exercise,
are not redistributable and are not used here.
5. Fuzzing, in both directions. Into the decoder: the libFuzzer harnesses under fuzz/ drive
the codecs' untrusted-input entry points looking for crashes and undefined behaviour
(ASan+UBSan). There are 32, listed in Threat model;
AC-4's are fuzz_ac4_parse (the inspector and the sync-frame splitter), fuzz_ac4_decode
(the syntax layer and the reconstruction to PCM), fuzz_ac4_encode, and for the content
signature fuzz_ac4_content_signature (where the sync frames stop and what the digest covers)
and fuzz_content_signature (the Thrift, DER, X.509, PEM and verification readers it hands
the trailer to). Three differential
harnesses decode each mutated stream with both this project's decoder and FFmpeg's and diff
the PCM; they cover AC-3, E-AC-3 and TrueHD (whose rule is stricter, since the codec is lossless:
a stream both decode without a complaint must give equal samples), because FFmpeg does not decode AC-4. CI runs them:
Fuzz Regress replays the checked-in seed and regression corpora on every push and on pull
requests (a repository variable can pause the pull-request run; see
Where each check runs), Fuzz Short and Fuzz Differential add a
bounded mutation budget on pushes, and Fuzz Nightly goes deeper.
The object and metadata layer is driven directly rather than through the decoder: separate
harnesses over emdf::parse_container, oba::parse_payload, oba::joc::parse_payload,
signing::verify_atmos_stream/verify_atmos_frame and (opt-in) iclforge::adm::parse_bw64, each
seeded from the real payloads inside this project's own Atmos streams. A sixth,
oba::parse_osc_packet — the OSC 1.0 wire form a live session's object positions arrive over,
driving live mode=atmos positions=osc:<port> and the GUI live room — is covered the same
direct way by fuzz_osc_parse, part of tools/fuzz/run.sh's default target list and so covered by
CI exactly as the object and metadata harnesses are, ADM's opt-in one apart; its own seeds are
hand-built OSC packets (libs/objects/fuzz/seeds/fuzz_osc_parse/) rather than extracted from an Atmos
stream, since there is no bitstream to extract them from. See
Threat model. That matters because the indirect route was
mostly closed: both the AC-3 and the E-AC-3 decoder check their CRC words before reading the
frame behind them, so a mutation landing in a skip field died at the checksum. The two decode
harnesses now carry a custom mutator that re-stamps crc1 and crc2 after mutating — crc1
through the GF(2) polynomial inverse it has to be solved with — while leaving one mutation in
four unrepaired so the rejection path itself stays reachable. AC-4's decoder does not refuse a
frame on its CRC, so its harnesses need no such mutator.
TrueHD's reader meets the same wall at five doors: the unit's check nibble, the major sync's CRC-16,
the restart header's CRC-8, a segment's parity byte and CRC-8, and the extra data's nibble and parity
byte. fuzz_truehd_parse, fuzz_truehd_decode and fuzz_differential_truehd_decode carry a mutator
(libs/truehd/fuzz/truehd_mutator.hpp) that rewrites them with the library's own routines after each
mutation, leaving one mutation in four unrepaired. The lossless check is a function of the decoded
samples and is not repaired. The differential harness found three disagreements with FFmpeg in its
first ten minutes: an MLP stream of 16-bit words that codes a bit below the word, a ch_assign read
the wrong way round (fixed: libs/truehd/ERRATA.md entry 42) and a changed major sync, which resets
the library's filter histories and not FFmpeg's (ERRATA.md questions 40 to 42 hold the two open
ones and the refusal of a repeated ch_assign). tools/fuzz/README.md
has the runs.
Out of the encoder: tools/ci/fuzz_encoder_space.py (AC-3) and
tools/ci/fuzz_eac3_encoder_space.py (E-AC-3) draw random legal encoder
configurations crossed with adversarial PCM — transients, silence↔loud transitions inside one
frame, spectral jumps between blocks, dense harmonics, clipping — and hold every stream they
produce against both decoders. This is the one check here that varies the input material
rather than the option list; it exists because an encoder defect that produced streams both
decoders reject needed a specific input shape to reach, and so escaped every other check on
this page. The E-AC-3 half additionally covers the Annex E tool tokens, the fscod2 half
rates, VBR, the layouts that need dependent substreams and Atmos object counts, and classifies
each case by which oracle can actually read it (the table below).
tools/ci/fuzz_ac4_encoder_space.py asks the same of AC-4 against the checks that exist
there: the encoder's syntax trace, the decoder's and tools/references/ac4_syntax.py's must
agree record for record, FFmpeg's demuxers must find every frame, and the decoder must decode
them (The encoder). The searches run bounded, 120 seconds each, in FFmpeg
Validate, which is a nightly job, and deeper, 900 seconds each, in the Encoder Space Nightly
job of the Fuzz workflow. See
tools/fuzz/README.md.
- The encoder/decoder mirror self-check (
iclforge::ac3::verify, opt-in). Not an oracle: it compares this project against itself. What it compares is the model rather than the audio. An encoder carries a picture of the decoder it is writing for — the exponents that decoder will reconstruct, the bit allocation it will derive, the delta correction it is holding, the AHT gains and coupling/spectral-extension coordinates it will apply — and every mantissa field's width comes out of that picture.MirrorEncoder(AC-3) andEac3MirrorEncoder(E-AC-3) decode every frame the encoder just emitted and diff the two pictures per block, per coded stream, per substream, starting from the bit offset at each block boundary.
What that adds over a round trip is the case where the two sides differ but the audio
survives it — an AHT gain one side recovered differently, a coordinate quantized against a
different band structure, a delta correction one side is still holding — which a decode-and-
compare passes and an SNR gate does not notice, and which a third-party decoder would
nevertheless render differently. It also localises an outright desync: the AC-3 half fired
four frames before the deltbaie bug produced its own §7.10.2 symptom, in the right file
rather than two blocks downstream in the wrong one. What it cannot see is a misreading the two
sides make identically — anything decided in code they share (compute_bit_allocation,
group_bands, decode_coordinate) is shared by construction, and only checks 2–4 above reach
that. Off by default at the cost of one branch per block; forge eac3-encode … verify turns
it on for a whole encode, and tools/ci/run_codec_matrix.sh runs it across the tool matrix,
both in FFmpeg Validate and on the sanitizer leg. The AC-4 encoder has no mirror; the decoder's
trace, the encoder's own and the Python parser's, which must agree, do that job there
(The encoder).
Contributor-facing detail on which oracle to reach for and how — including the exact FFmpeg flags and the CI jobs that run them — is in Oracles.
Where each check runs¶
CI has three stages (CI for many agents): the pull-request gate, which builds
Linux GCC and runs every ctest case and the gold-reference gate (the merge queue adds Windows
MSVC, the Qt GUI, and for a change under src/ the
performance and memory comparisons); the run after each merge to main,
which covers the compilers, operating systems and architectures the gate does not; and the
nightly run, which adds the sanitizers, coverage and FFmpeg Validate. Fuzzing and the other
scheduled workflows are separate.
| Check | Codecs | Runs |
|---|---|---|
The Catch2 suites, the example programs and the Qt Quick tests (ctest); the AC-4 tests named in the AC-4 section are among them, apart from those that read local streams, and the tests that read the owner's AC-4 content-signature sample skip when ICLFORGE_CONTENT_SIGNATURE_SAMPLE is unset |
AC-3, E-AC-3, AC-4, TrueHD | Gate, queue, after a merge, nightly |
The unit tests of the oracle scripts (tools/checks, tools/ci), which include the AC-4 syntax digests and presentation tables |
all | The gate's static job |
The gold-reference gate, tools/checks/verify_gold_reference.sh: our decode against FFmpeg's, per-channel floors, the committed DEE and FFmpeg streams, the cross-platform bitstream hashes (three gold streams and sixteen real-programme ones), and for TrueHD a bit-exact comparison with FFmpeg's strict decode of the committed fixtures and of forge truehd-encode's stream |
AC-3, E-AC-3, TrueHD | Gate on Linux GCC, queue on Windows MSVC, up to six legs after a merge, nine nightly |
FFmpeg Validate: the codec matrix, the metadata and coupling checks, quality_race.py ci, the encoder-space searches, the AC-4 scorers (score_ac4_decode.py, score_ac4_encode.py, gain_ac4_decode.py, mix_ac4_decode.py, check_ac4_decode_scalar_snr.py), and the TrueHD checks against FFmpeg's strict decode (verify_truehd_interop.py with --handbuilt, verify_truehd_encode_interop.py, verify_truehd_containers.py, verify_crucible_truehd_leg.py, the codec matrix's TrueHD legs) |
all | Nightly, and on request (the ci:deep label, gh workflow run ci.yml) |
Hearth's engine against the AC-4 gain formulas (gain_ac4_decode.py --engine) |
AC-4 | After a merge, nightly |
| The ASan + UBSan leg with the codec matrix, and the TSan leg | all | Nightly |
Fuzz Regress |
all | Every push to main, and every pull request unless the repository variable PAUSE_NONESSENTIAL_CI is true |
Fuzz Short and Fuzz Differential (the latter AC-3 and E-AC-3 only) |
all | Every push to main |
Fuzz Nightly, Fuzz ADM Nightly and Encoder Space Nightly |
all | Daily |
Interop: eight FATE excerpts |
AC-3, E-AC-3 | Daily, and on pull requests that change the decode path |
tools/checks/ac4_syntax_differential.py, 3,000 mutated DEE frames and 800 synthetic tables of contents at a fixed seed |
AC-4 | Daily, in the SonarCloud workflow, where it feeds the coverage scan and does not gate |
tools/checks/check_install_consumer.sh, and the ABI gate (advisory until the API freeze) |
all | Nightly |
Dolby Encoding Engine, MediaInfo, librempeg and the Reference Player; the --gold races and the census; check_ac4_encode_readers.py; race_ac4_presentations.py; check_ac4_kit_streams.py on Dolby's kit streams and check_dolby_spott_streams.py on the Spott files (both are Dolby's and not in the tree); score_truehd_decode.py on DEE's TrueHD streams (kept on the owner's machine; DEE's licence ends on 2026-11-06); listening |
AC-4 mostly, TrueHD for the DEE scorer | Locally, by hand |
Dolby's Online Delivery Kit tools, check_dolby_*.py (below) |
AC-3, E-AC-3, AC-4 containers | Locally, by hand; skip when the tools are absent |
PAUSE_NONESSENTIAL_CI is a pause the workflows describe as temporary: while it is true, pull
requests skip Fuzz Regress, OSV Scanner and Zizmor, which leaves the hosted runners to the
merge queue, and runs on main and on a schedule are unaffected. It was true on 2026-09-30.
A failure in the run after a merge or in the nightly run reaches Main health,
which reruns a known flake or opens the main-red issue. The trend series are published by
jobs of those runs: Where the data lives says which.
Quality¶
tools/ci/quality_race.py synthesizes stereo programme material, encodes it with both ICL Forge
and FFmpeg at matched bit rates, decodes both with FFmpeg as a neutral referee, aligns by
cross-correlation, and reports SNR against the original:
| Bit rate | ICL Forge | FFmpeg | Difference |
|---|---|---|---|
| 192 kbps | 41.23 dB | 40.98 dB | +0.25 |
| 256 kbps | 44.00 dB | 42.85 dB | +1.15 |
| 320 kbps | 45.09 dB | 44.15 dB | +0.94 |
| 448 kbps | 51.05 dB | 47.60 dB | +3.46 |
Measured with FFmpeg 8.0.1 on 2026-08-09; reproduce with python tools/ci/quality_race.py ac3.
Unlike the trend pages beside it, this table is a point measurement rather than a gated series:
no CI run repeats it, so nothing would notice these four numbers drifting. The nearest series is
Tool comparison trend, which scores this encoder on fixed legs and
reports its difference from FFmpeg's and Dolby's encodes of the same legs, made once and
committed under testdata/external-baseline/.
SNR on synthetic material is a narrow metric — it says the waveform is closer, not that it
sounds better, and no subjective listening test has been run. quality_race.py's tables (and
Tool comparison trend/Landscape) also carry an
objective perceptual-quality prediction alongside SNR, ViSQOL's
MOS-LQO — narrower than a real listening panel, but closer to "how it would sound" than a
waveform-distance number, and something SNR alone cannot claim. See perceptual_score() in
tools/ci/quality_race.py.
That column used to be empty everywhere it was published: CI deliberately did not install
visqol-python, so every row on the quality-history branch carried mos_lqo: null and every
MOS cell rendered n/a. It is installed now, hash-pinned like every other Python dependency, so
the trend pages carry real MOS numbers. It stays optional for a local run — not installed
still shows -, never a failure — which is why the one-off snapshot above has no MOS column.
Both the table above and everything the trend pages plot come from the fixture corpus in
testdata/audio/, which is versioned and hash-checked as a unit
(tools/checks/check_corpus.py). Two of those fixtures are synthesized from sin(),
pseudo-random noise and FIR smoothing, and two are 30 s CC0 recordings of real speech and music.
Both kinds are kept, and the distinction matters when reading any number on this page: the
synthetic pair carries a flat noise plateau across its whole top octave that no real material
has, and tuning the encoder's bandwidth against it once produced a measured 2.1 dB "win" that was
an artefact of the fixture. See tools/generators/README.md
for the measured spectra, the licences, and which fixture is evidence about what.
That is a one-off snapshot. Quality trend tracks a different measure, the gold-reference gate's per-channel agreement between this decoder and FFmpeg's on fixed fixtures, for each commit a run publishes, so a regression shows up as a trend line rather than only in that run's CI log. AC-4's decode has a series of its own on the same page, scored against the sources Dolby's encoder was given (AC-4 decode quality).
The object layer has its own series, Object quality trend: a fixed five-object Atmos scene encoded and decoded by a nightly run, one delay-compensated SNR/LSD/leakage row per object per rate. It is a self-consistency series throughout — see "Where the oracles don't reach" below for why no other kind is available. AC-4's objects have no series.
One floor per channel, not one per file¶
Every SNR gate here is stated per channel. That is worth spelling out, because the alternative looks equivalent and is not.
A 5.1 fixture's six channels do not sit anywhere near each other. On
ac3-51-448/dee.ac3 — Dolby's own encoder, decoded by this project and by FFmpeg and the
two decodes compared — the measured agreement is:
| L | R | C | LFE | Ls | Rs |
|---|---|---|---|---|---|
| 57.5 dB | 63.8 dB | 58.1 dB | 82.2 dB | 22.8 dB | 22.7 dB |
The surrounds are 35 dB below the front channels, and legitimately so — though the
mechanism is not the obvious one. §7.3.4 leaves the values a decoder substitutes for
zero-bit bins unspecified ("any reasonably random sequence"), so two spec-correct
decoders are required to disagree in those bins; the question is where they fall.
Measured with forge decode … bap-census=, the surrounds' own basebands are almost
fully coded on this fixture — 1.8–2.2% zero-bit bins, against 80–90% for the
front channels. What is heavily zero-bit is the coupling channel, at 59.7%, and
§7.3.4 dither for coupled bins is applied per receiving channel after decoupling. So
the same absolute dither lands in every coupled channel, and it dominates whichever ones
are quietest: Ls and Rs sit at −33 and −29 dBFS where L and R sit at −13. The low
surround agreement here is a signal-level effect on a shared error, not a sparser
allocation — the reading this page carried before the census existed to check it.
A single floor for this fixture therefore had to clear 22.7 dB, and it was set at 22.
Which meant the centre channel was gated at 22 dB while measuring 58.1 — it could have
lost 36 dB, more than the entire dynamic range of the surround channels, without
failing anything. The LFE had 60 dB of slack. That gated one channel and left a rounding error
on the other five, and it was blind to precisely the
per-channel syntax defects the third-party fixtures were added to catch (one of the
five found there, firstcplcos[ch], is per channel by nature).
Each channel now carries its own floor, derived as floor(min_observed − 1.0) from
that channel's lowest value across every CI leg and every recorded commit —
tools/checks/derive_channel_floors.py is the derivation, kept as a script so a floor
move is reviewable against evidence rather than asserted.
The 1.0 dB covers commit-to-commit noise and nothing else, because min_observed has
already absorbed everything else. Measured when the floors were derived, over 520 (check, leg,
channel) series, one leg's own number moves by a median of 0.000 dB across the whole recorded history,
and 495 of them stay under 0.5 dB; the 25 that do not are a single real step change on
one check, not noise. A new leg landing below a floor is not a false alarm under this
policy — it is platform behaviour nobody has reviewed, and stopping to look at it is the
right outcome rather than something to pre-authorise with margin.
One pair of floors went down in the change: this fixture's Ls/Rs, from 22 to 21,
because 22 was never derived for those channels — it was the one floor the whole
fixture had to share. Its other four channels gained 34–59 dB of gate. The check went
from catching only a total surround collapse to catching a 1 dB move in any channel,
and tools/checks/test_compare_wav.py holds that property down with a test that fails
if the single-floor form is ever restored.
Why arm64 and x86-64 disagree¶
The legs split into two groups on the high-SNR channels, ~6.02 dB apart, and this was carried for a long time as an unexplained effect attributed to "arm64 and macOS" legs. Two things are now settled.
It is architecture, not OS or compiler. macos-llvm (arm64) sits with the arm64
group; macos-llvm-x64 sits with the x86-64 group. Same OS, same Homebrew LLVM, opposite
sides. That rules out the "macOS libm" reading directly.
It is one bit of arithmetic, not a codec error. 20·log₁₀2 is 6.02 dB whether the bit is an AC-3 exponent step or a floating-point rounding bit, so the number alone cannot tell them apart — but the prediction can. A systematic exponent error would be level-independent and shift every channel equally. Rounding is only visible where the measurement is already rounding-dominated. Sorting all 52 (check, channel) pairs by their x86-64 SNR gives a step, not a gradient:
| x86-64 SNR of the channel | arm64 difference |
|---|---|
| 18.3 – 66.7 dB (32 pairs) | 0.00 – 0.11 dB |
| 67.8 – 88.3 dB (20 pairs) | 5.85 – 6.05 dB |
Nothing lands in between. Below ~67 dB the disagreement between the two decoders is dominated by real coding differences and by §7.3.4 dither, and one extra rounding bit is buried in it. Above ~67 dB the two decoders agree so closely that arithmetic is all that is left to disagree about, and the bit becomes the whole signal. That is also why the LFE is the only channel to split on the fixed third-party fixtures: at 88 dB it is the one channel there whose comparison is rounding-limited.
The practical consequence is the floors above. min_observed is a minimum across
legs, so wherever this split appears the minimum is already the arm64 value — the low
side. The first version of these floors subtracted a further 6.02 dB on top of that,
counting the same margin twice and costing about 5 dB of sensitivity on every channel.
Removing the double-count is what took the headroom to 1.0 dB.
The encoder is bit-exact across architectures; the gap is entirely decode-side. The
cross-platform hash gate had never pinned aarch64-neon — it printed [unpinned] and passed,
so every arm64 run had compared its encoder's output to nothing. Pinned now from the real arm64
CI legs (PR #503, run 33635430769), and all three streams come back byte-identical to
x86_64-sse2. So the same bitstream goes in on both architectures and different PCM comes out:
whatever the last-bit difference is, it is in the decode path, not the encode path.
That also settles a discrepancy that looked like it needed two mechanisms. On the fixed
third-party fixtures only the LFE splits, but on this project's own gold-reference streams
every channel does — which invited the inference that the arm64 encoder must produce a
different bitstream. It does not. The gold-reference streams are encoded dither=off
(nodither for E-AC-3), so no channel's comparison is dither-limited and all of them sit in
the rounding-limited regime above 67 dB, where the last-bit difference is the whole remaining
signal. The third-party fixtures carry dither, which dominates every channel except the LFE.
One mechanism, two fixture populations.
What is not yet answered is why arm64 is the worse of the two — it agrees with FFmpeg's decode less closely than x86-64 does, consistently, by one bit. The search space is now much smaller: the encoder is excluded by the hashes above, the reference side is excluded by the FFmpeg kernel test, and contraction and libm were excluded before that. What remains is the decode path on real arm64 silicon, which is also the one thing no emulated run has reproduced.
The same reasoning now applies to the trend check as well as the gate:
tools/ci/append_quality_history.py compares each channel against its own trailing
average, where it previously watched only the worst channel — which, on these fixtures,
was the same dither-dominated surround every single run.
What would make these numbers excellent¶
-
~~The 6.02 dB headroom is set by something unexplained.~~ Closed. It was not an exponent step and it was not unexplained once the split was sorted by level — see "Why arm64 and x86-64 disagree" above. The headroom it was forcing turned out to be a double-count on top of an already-cross-platform minimum, and the floors are now derived at 1.0 dB, catching a 1 dB per-channel regression where they previously needed 6. The follow-on question — why arm64 is the less accurate of the two — remains open and is tracked separately.
-
Spec-permitted dither divergence is still inside the measurement. The surrounds score ~22 dB not because either decoder is wrong but because §7.3.4 lets them differ in the zero-bit bins. A comparison that excluded those bins — masking on the
bapvalues the decoder already records iniclforge::ac3::verify::FrameTrace(DecoderConfig::trace, exported byiclforge/ac3/verify/trace_export.hpp) — would measure only the bins that were actually coded, and the surrounds would be expected to join the front channels in the 50–90 dB band. That needs the comparison moved into the MDCT domain, with block alignment and the coupling-region indirection (a coupled channel's bap-0 decision lives on the coupling stream, not its own) handled correctly; it is a real piece of work, not a flag. It would also produce a new metric on a new scale, so it belongs beside the current series rather than replacing it.
Neither gap is a defect in the codec. Both are limits on how sharply the current instruments can see it, which is the more useful thing to report.
Performance and reference modes¶
Both transform hot spots — the forward MDCT (§8.2.3.2) and the inverse transform's step-3
complex sum (§7.9.4) — exist in two evaluations: the spec's own direct form, and a fast path
through a shared FFT kernel. The direct forms are the reference: they are what the standard
states, and every fast path is validated against its direct counterpart by the test suite (max
peak-normalized relative error 1.3e-13 forward, 7.8e-14 inverse, 1.7e-15 for dft512
against its own O(N²) summation; end-to-end agreement 331 dB direct-vs-fast for encode, and
232.1 dB (AC-3) / 208.2 dB (E-AC-3, every Annex E tool) / 217.9 dB (E-AC-3, enhanced coupling)
for a decode over 180 seconds of real material). The fast paths are the default, because that
evidence was reviewed and accepted before each default flipped.
The kernel itself is radix-4 with a trailing radix-2 stage where log2(P) is odd, specialised at compile time for the three sizes the codec uses (P = 64, 128, 512), with the first stage's unit twiddles eliminated and the digit-reversal permutation folded into each caller's own input-producing loop rather than run as a pass — 1.6–1.75× the throughput of the generic radix-2 core it replaced, at the same tolerances.
Both evaluations are gated end to end, not only at the transform level. The linux-gcc leg
runs tools/checks/verify_gold_reference.sh twice — once as it stands, once with
TRANSFORM_MODE=reference — so the direct forms face the same FFmpeg-oracle SNR floors on the
same real streams as the fast paths, and tools/ci/run_codec_matrix.sh carries fast-mdct=off
and fast-imdct=off rows through the sanitizers. Without that, a change to a fast path could
take its own reference with it and nothing outside the transform unit tests would notice.
One nearby switch is deliberately not part of this pair: joc-domain=qmf|mdct, which selects
where JOC's reconstruction matrix is estimated and applied. The two transforms above are the same
answer computed two ways; the two JOC domains are different answers about 5 dB apart, so folding
them into a speed preference would make mode=performance quietly pick the worse one. The default
is already the domain TS 103 420 §6.6.6 states, so mode=reference has nothing to add either. See
Atmos & JOC.
forge exposes the pair as one intent-level switch: mode=reference runs every transform in
the command on the direct evaluations — for regenerating fixtures, comparing sample-for-sample
against an external decoder, or isolating a suspected transform defect — and mode=performance
(the default state) names the fast paths. The per-transform escape hatches fast-mdct=off and
fast-imdct=off adjust one half at a time; see
Options & grammars for the full token
semantics. At the library level the same pair is EncoderConfig::fast_mdct /
eac3::FrameConfig::fast_mdct for the forward transform and DecoderConfig::fast_imdct for the
inverse.
Encoded output never depends on DecoderConfig. An enhanced-coupling encode does run an
inverse transform of its own — ecpl_channel_spectrum reconstructs the spectrum the decoder
will hold — and that one follows eac3::FrameConfig::fast_mdct, which makes that field the
encoder's fast-transform switch in both directions and keeps mode=reference direct end to
end. It is byte-identical either way on the encode corpus at the tolerances above, so it is a
speed choice, not an output one.
One decode-side case runs the FORWARD transform too: JOC's own bed analysis under
joc-domain=mdct (PF8) has to re-express the decoded bed in the same 256-bin MDCT domain the
transmitted matrix was estimated in before it can apply §6.6.6's per-band combination — the one
place a decode ever needs the fold mode=/fast-mdct=off otherwise only reach on the encode
side. DecoderConfig::fast_mdct carries it (oba::joc::reconstruct's own fast_mdct parameter,
threaded from decode/monitor/live), defaulted ON by the same evidence gate as every other
fast path here: 1.3e-13 worst relative error at the transform level (the same forward kernel
EncoderConfig::fast_mdct already validates), full oba::joc::reconstruct output agreeing
321-325 dB SNR against the direct form over three real encoded-and-decoded objects
(libs/ac3/tests/oba/test_atmos.cpp), and the bed analysis kernel itself — isolated from object
synthesis, which this switch does not touch — measured 11.0x, 238 to 2628 microseconds per
block's five-channel analysis on a release build (iclforge-kernelbench's
joc_reconstruct_mdct_4obj/_direct): a fixed ~2.4 ms saved per frame regardless of object
count, ~2.2 s over a 30 s kMdctBand decode. It has no effect under the default
joc-domain=qmf, whose filterbank has only the one evaluation, and — like
DecoderConfig::fast_imdct — never reaches an encoder.
Test suite¶
The Catch2 suites (a binary per project, iclforge-<project>-tests, plus the iclforge-perf throughput suite) plus one ctest entry per
example program, run per platform. The Qt Quick Test harnesses add one entry per tst_*.qml
suite on a build with the application enabled: forge_gui_qmltests for apps/forge/gui/tests/qml/ (36
today), Hearth's for apps/hearth/ui/tests/qml/ (15) and Crucible's for
apps/crucible/ui/tests/qml/ (16). The audio backend's device-free tests
(libs/audio/tests/backend/<backend>/) join iclforge-audio-tests for whichever backend the build selected, ALSA,
PipeWire, macOS, Windows or Android, and an ALSA build also runs
libs/audio/tests/test_alsa_null_backend.cpp against software ALSA devices, so its success paths run
without a card. ctest runs whatever the configuration registered:
examples/CMakeLists.txt registers 22 example programs as their own ctest cases, plus
mux_iamf, iamf_objects and read_iab (their libraries build by default), decode_ac4 (given a committed DEE
stream), read_adm, encode_adm and encode_iab under ICLFORGE_BUILD_ADM and the two C-API
examples under ICLFORGE_BUILD_CAPI. The ones that touch the filesystem (wav_roundtrip,
read_adm, encode_adm) write scratch files under a name unique to that run, not a fixed name
in the OS temp directory — two checkouts running ctest at once would otherwise read and delete
each other's fixture.
Third-party bitstreams¶
There are no free AC-3 or E-AC-3 conformance bitstreams. ATSC A/52 and ETSI TS 102 366 are both freely downloadable documents, but neither body publishes conformance vectors for these codecs the way MPEG does for its own, and Dolby's verification material ships under licence with its professional tools. Everything below is the substitute, and it is worth being explicit that it is one: a corpus of real third-party encoder output with no normative expected decode attached to it, not a conformance suite.
Two tiers, both gated in CI:
- Committed —
testdata/external-baseline/holds 14 AC-3 and E-AC-3 streams from Dolby Encoding Engine 6.5.4 and FFmpeg 8.0.1 across 8 codec/layout/bitrate legs (manifest.json,baseline_version2), each encoded from this repository's own source WAVs (seetools/generators/gen_external_baseline.py) and each carrying the DEE, FFmpeg and ours-at-baseline-time scores it was measured at. Beside them sit the transient pre-noise stream described under Where the oracles don't reach and AC-4's 16 DEE streams (ac4-manifest.json; see AC-4).tools/checks/verify_gold_reference.shgates on a six-stream subset of the 14: it decodes all six withforgeon every gold-reference leg and diffs each against FFmpeg's own decode, with per-fixture floors quoted beside the measured numbers in the script. The other eight are not gated:tools/ci/append_external_comparison_history.pywalks every leg in the manifest for the tool-comparison trend. They also seed the decoder fuzzers, so mutation starts from third-party structure rather than only from this project's own encoder output. - Fetched —
tools/checks/verify_fate_interop.pypulls eight SHA-256-pinned samples from FFmpeg's FATE archive and holds each against FFmpeg's own decode. These are excerpts of commercially mastered programme material, encoded years ago by whatever encoder the mastering house used, and they exercise choices neither this project's encoder nor FFmpeg's makes: spectral extension at 128 and 256 kbit/s, 1536 kbit/s, a director's-commentary track, dither in use, a 3/1 acmod that this encoder reaches only through a Table E2.5 list, and an A/52 Annex E §E2.3.1.2 legacy-core delivery (below). Fetched at run time and never committed — they are film excerpts, and pinning by hash is what keeps an upstream change from quietly moving the numbers. Runs nightly in theInteropworkflow, and on a pull request that changes the decode path or the harness. The archive is volunteer-run and can be down for days, so a download is retried and cached, and when it is still unreachable a pull request checks what it holds and warns about the rest, while the nightly run on main fails: an outage is seen there, not on every pull request that happens to touch the decode path.
A third set is neither committed nor gated. tools/generators/gen_dee_gold.py keeps 1,086 of
DEE's own streams on a local disk, made before DEE's licence ends on 2026-11-06, each rebuildable
from the committed programme fixtures: AC-3 and E-AC-3 at every layout and data rate DEE lists
(mono, 2.0, 5.1, 5.1 without its LFE, and 5.1 at 64 to 160 kbit/s through its hybrid downmix),
7.1 as Blu-ray carries it (an AC-3 core and an E-AC-3 dependent substream, from DEE's bluray
encoder mode, which its help does not list), E-AC-3 JOC from 5.1.4, 7.1.4 and 9.1.6 beds at every
rate, TrueHD at 2, 6 and 8 channels, 48 and 96 kHz and 16 and 24 bits, each metadata option DEE
takes, and 60 and 300 s programmes. Each keeps MediaInfo's trace, DEE's MP4 of it, and what
forge and FFmpeg make of it. forge's decoder reads every AC-3 and E-AC-3 elementary stream
in it, the 23 that use transient pre-noise processing included since the decoder began to hold a
correction until the frame its transient falls in has decoded (below); FFmpeg
reports errors in 67 of the E-AC-3 streams, most of them exponents out of range, as below. DEE
uses coupling, spectral extension and the AHT by rate and never enhanced coupling. At 48 kHz,
FFmpeg's decode of each TrueHD stream DEE was not asked to alter equals its source sample for
sample, but for one LSB at −1 dBFS; at 96 kHz it matches to 24 kHz and rolls off above, 14 dB
down by 30 to 40 kHz.
Wiring up the first tier found five separate Annex E decoder defects in a single sitting, on
syntax that no stream this project can encode is able to reach — the three AHT-in-use flags read
unconditionally, cplfgaincod/cplfsnroffst not read at all, the three band-structure default
tables applied in the wrong blocks, the first* per-frame coordinate states approximated as
"block 0", and a missing coupling-state reset. Four of the six fixtures did not decode at all
before that. It is the clearest evidence on this page for why a self-consistent round trip, an
independent transcription and a second decoder driven by the same encoder are all still not the
same thing as reading somebody else's bitstream.
One arrangement fetched third-party structure led to being added rather than recorded or
gated: the_great_wall_7.1.eac3 is not a plain E-AC-3 elementary stream. Each 4608-byte access
unit is an AC-3 core syncframe (bsid 6, 3/2+LFE, no E-AC-3 header at all) followed by a
2304-byte E-AC-3 DEPENDENT substream (chanmap 0x1A00: Ls/Rs replaced, Lrs/Rrs added) - a
legacy-core-plus-extension delivery, and A/52 Annex E sanctions it explicitly: §E2.3.1.2 states
"If an AC-3 bit stream is present in the E-AC-3 bit stream, then the AC-3 bit stream shall be
processed as an independent substream assigned substream ID 0", and §E3.8.2's combining rule
(bed locations, then each dependent's chanmap overwriting and extending them) does not care
whether that independent substream happens to be AC-3 syntax or Annex E syntax - only that
dependents "shall immediately follow the independent substream with which they are associated"
and agree with it on sample rate and block count, both of which this arrangement satisfies (an
AC-3 syncframe is always six audblks, matching Annex E's numblkscod 3).
Before this, iclforge::ac3::io::scan() and forge decode both dispatched on the first frame's bsid
alone: an AC-3 frame sent the stream down the AC-3 path, which read the core cleanly and then
refused the following bsid-16 dependent as "valid AC-3 this decoder does not implement (bsid >
8)". iclforge::ac3::split_access_units had the same gap from the other direction - it read strmtyp
out of byte 2's top two bits unconditionally, which in an AC-3 syncframe are crc1's, not a
stream-type field, so a core's own checksum could accidentally look like kIndependent or
kDependent regardless of what actually followed it.
Both are fixed: iclforge::ac3::io::StreamKind gained kAc3CoreEac3Extension, iclforge::ac3::io::scan()
recognises the alternating bsid pattern as one access unit per core-plus-dependents group, and
iclforge::ac3::has_eac3_extension_substreams() lets forge decode route such a stream to
Eac3Decoder even though its first frame is AC-3. There, Eac3Decoder::decode_substream reads
an AC-3 frame through a private iclforge::ac3::FrameDecoder and presents the result as substream
(independent, 0), and decode_access_unit_core's existing §E3.8.2 combining - unchanged - lays
the dependent's channels over it exactly as it would a normal Annex E bed. Measured against
FFmpeg's own decode of the real FATE sample: 41.69 dB on the worst of the eight rendered
channels, in the same range as every other spectral-extension-free sample in this corpus.
Carrying one in a container was refused at first, on the reading that no box could describe it: a
dac3 has no field for the dependents and a dec3 would have to call the core Annex E syntax.
ETSI TS 102 366 Annex F says otherwise on both counts. F.1 asks for an EC3SampleEntry for every
E-AC-3 bit stream, F.6.2.5 sets the box's bsid to "the same value as the bsid field in the
independent substream" without limiting it to 16, and §E2.3.1.2 makes the core that independent
substream. So build_codec_config_box writes the ordinary dec3 with the core's bsid, and forge
mp4, fmp4 and ts carry the arrangement. FFmpeg 8.0.1 opens the MP4 as ec-3, 7.1, 672
kbit/s and the transport streams as E-AC-3 7.1 in both profiles; forge demux returns the
stream's bytes unchanged from each. What FFmpeg does not do is read the box's chan_loc (the
layout comes out the same with the field zeroed), so that field is held to Table F.6.1's text and the unit test alone. Matroska stays
refused: its registry has A_AC3 for bsid 10 and below and A_EAC3 for 11 to 16 (checked
2026-10-10 against the codec registry on the specification's main branch), and no ID for a stream
that is both.
One more divergence was found and fixed rather than recorded:
wav_channel_orderused to write acmods 2/1 and 3/1 in bitstream order (L C R S), on the stated grounds that no WAV convention claims a mono-surround slot, while FFmpeg mapped 3/1 ontoWAVEFORMATEXTENSIBLE's FL/FR/FC/BC and wrote L R C S. That premise was wrong:WAVE_FORMAT_EXTENSIBLEdoes defineSPEAKER_BACK_CENTER(0x100), which is exactly FFmpeg's mono-surround slot for both 2/1 and 3/1.wav_channel_ordernow places every acmod by WAV speaker position rather than bitstream order — the practical effect is C swapping with R and the LFE moving up to fourth, on top of the mono-surround fix — and the FATE sample that exercises 3/1 (millers_crossing_4.0.ac3) went from decode-and-parse-only to a compared sample once the two decoders' channel orders agreed: channel 0 (L) at 48.93 dB, and a near-silent surround channel gated on absolute difference at a −46.0 dBFS floor (measured −55.31 dBFS).
Annex C's karaoke reproduction is informative, and there is no karaoke stream from anyone else
(Dolby's encoder cannot write bsmod 7). It is held to the annex's own tables first - Table
C.2.2's 3/0 columns coefficient by coefficient off an
impulse in every karaoke acmod (and its 2/0 column against the Lo/Ro fold), then a coded 3/2
stream flagged bsmod 7 decoded as coded and as Lk, Ck, Rk, sample for sample, and a 3/2 stream
flagged as a main service shown to ignore the request. The karaoke-capable decoder's Table C.2.3
is held the same way: its four listener choices, in both the 3/0 and the 2/0 reproduction (and the
mono sum), are transcribed from the specification's page 105-106 into the tests and compared
coefficient by coefficient, with a level pair (clev 0.5, slev 0.25) no cell could be mistaken for,
and again over a coded stream through the decoder and through forge decode. That checks the code
against the reading of the table, not the reading against anyone's decoder. For that there is one
outside decoder: Dolby's reference decoder reproduces karaoke for AC-3 and, though Annex E defines
no reproduction, for E-AC-3. tools/checks/verify_karaoke_oracle.py encodes a tone-per-channel
stream both ways, decodes it with forge decode and with the Reference Player's dlbac3dec, and
compares what each output channel carries as ratios, because the scale-down that keeps a sum
under 1 is an implementation's choice. The player is licensed, so the script runs locally and not
in CI; its measured ratios are constants in libs/ac3/tests/decoder/test_eac3_karaoke.cpp, so
the evidence outlives the installed player. The part-to-speaker
table the Forge GUI's Karaoke flow shows is held to the decoder the same way: every mode is
encoded with a tone in each part and decoded as coded, aware and capable for each choice of
vocals, and in the Lo/Ro fold, and the tones on each output are compared (this found that a
single vocal under capable, both, is on the left alone, not in the centre).
The four modes with no preset were measured the same way against FFmpeg's decode of this
encoder's own streams (a tone per channel, 192 kbit/s): 3/0 at 98.7 to 101.1 dB, 2/1 at 98.7 to
101.1, 3/1 at 86.6 to 94.8, 2/2 at 86.6 to 94.8 and 3/0 with an LFE at 97.5 to 140.4, per
channel, at zero lag. FFmpeg's channel masks for them (0x7, 0x103, 0x107, 0x603, 0xF)
are the ones decode writes, except 2/2, which decode states with the back pair (0x33) and
FFmpeg with the sides; both read back as L R Ls Rs.
Two divergences are recorded rather than resolved:
- FFmpeg fails frame 0 of DEE's stereo E-AC-3 stream. Exactly one frame, from cold, with
exponent 25 is out-of-range; the other 93 read cleanly, and FFmpeg conceals the failure by repeating block 0 across blocks 1-4 rather than dropping the frame. Whole-file, that costs it a lot: against the source WAV FFmpeg's decode scores 14.30 dB whereforge's scores 33.72 dB — andforgelands within 0.6 dB of its own score on FFmpeg's encode of the same source at the same rate, so the gap is FFmpeg's concealment, not DEE's encoding. The gate here compares whole files, so that one fixture has no usable FFmpeg reference and is scored against the source WAV instead. (manifest.json's 33.32 dB for the same leg is not in conflict with this:quality_race.py'sscore_fixedskips the first 0.2 s, which is exactly where the failing frame sits — seetools/generators/gen_external_baseline.py's module docstring.) the_great_wall_7.1.eac3's OAMD payload does not decode. FFmpeg reports the file as "Dolby Digital Plus + Dolby Atmos", and its arrangement is the real Annex E structure described above, buticlforge::objects::oba::parse_payloadrefuses severalobject_elementfields (num_obj_info_blocks,sample_offset_code,b_object_not_activeamong them) to exactly the shape this project's ownAtmosEncoderemits, and Dolby's commercial encoder does not produce that same shape. This is a pre-existing, generic scope limit of the OAMD parser - equally true of the same payload riding in an ordinary Annex E independent substream - not something the legacy-core support above introduced or could fix on its own, so only the eight rendered audio channels are gated.
Where the oracles don't reach¶
FFmpeg and the in-repo decoder are complementary, not redundant, and neither covers everything
alone. FFmpeg reads Annex E coupling, spectral extension and AHT (98+ dB SNR for coupling and
spectral extension; 62–89 dB for AHT, which recodes mantissas rather than scaling or
synthesizing around already-decoded content, so a wider margin from bit-exact is expected there)
— but it refuses any substream whose substreamid != 0 (ff_ac3_parse_header), which rules out
both the second dependent substream 7.1.4 needs and the second independent one a
multi-programme stream carries. The in-repo decoder reads every Annex E
tool combination at every layout, 7.1.4 included, so it backstops FFmpeg's one gap — but a stream
only the in-repo decoder can read is checked against itself, not against anything external.
| Stream | FFmpeg | In-repo decoder |
|---|---|---|
| AC-3, any supported mode | yes | yes |
| E-AC-3 up to 5.1.4 (one dependent), no Annex E tools | yes | yes |
| E-AC-3 7.1.4 (two dependents) | no | yes |
| E-AC-3 with cpl / spx / aht | yes | yes |
| E-AC-3 7.1.4 with Annex E tools | no | yes |
E-AC-3 with enhanced coupling (ecpl) |
no | yes |
E-AC-3 with transient pre-noise processing (tpn) |
yes, without applying the correction | yes |
E-AC-3 fscod2 half rates (24/22.05/16 kHz) |
header only | yes |
E-AC-3 type 2 substream (strmtyp 2, "previously coded in AC-3") |
yes | yes |
| E-AC-3 with a second independent substream (two programmes) | no — and it poisons the first programme too | yes |
| E-AC-3 with JOC objects (Atmos) | 5.1 bed only | yes, including the objects |
| TrueHD and MLP, 1 to 6 channels, as FFmpeg's encoders write them | yes | yes |
TrueHD with an IIR filter, LSB bypass, noise generator 0 or 1, a negative output shift, a permuted ch_assign or the block data check |
yes, on hand-built streams (its encoders do not write them) | yes (TrueHD and MLP) |
TrueHD with the 16-channel substream (restart sync 0x31EC) |
no, it refuses it | yes, held to a hand-built stream only |
| TrueHD 7.1, as this library's encoder writes it | yes | yes |
| A TrueHD MAT burst, read | no: FFmpeg's spdif demuxer reads no stream from its own TrueHD MAT |
yes, to the access units that went in |
| The TrueHD Atmos substream's objects, and the evolution frame | refused or not read | not built: the frame's bytes are carried |
AC-4 is not in this table because FFmpeg has no AC-4 decoder: every AC-4 stream is a "no" for its audio, and FFmpeg's demuxers are the only outside reader of its framing (AC-4).
TrueHD's containers are not in this table either. FFmpeg's muxers write MP4, Matroska, MPEG-TS and MAT for it, and
tools/checks/verify_truehd_containers.py has FFmpeg read what this project writes and this project read what FFmpeg
writes, bit for bit (decoded PCM for the first three, the elementary stream for the second direction; MAT is compared
as bytes). Each layout therefore has one oracle and no document: FFmpeg's spdif demuxer reads no stream from its own
TrueHD MAT, so reading MAT has no oracle at all, and no receiver or disc player has read any of it
(libs/containers/ERRATA.md).
The AC-4 content signature has an oracle for its cryptography and none for its meaning.
OpenSSL checks what it can check without forge: that the certificates the blob carries parse and
chain, that the ECDSA signature verifies over the bytes of the signed information, that it does not
verify over the content digest (the reading CS spec v2.6 gives; v2.3 said the content digest), and that one changed bit is
refused (tools/checks/check_content_signature_openssl.py, on a signature forge wrote and on the
owner's sample blob, kept out of the repository and read through
ICLFORGE_CONTENT_SIGNATURE_SAMPLE). What v2.5 and v2.6 added is held by signatures written by hand in the
library tests (the signer information of §5.3 with a nonce, a publisher UUID and the accounts a verifier
expects in every combination, and a certificate that carries another UUID or none; the signature checked before the digests; every wire version field 1) and by the CLI tests, each
with a mutation that fails it; the sample is held to what v2.5 states of it (version fields, nonce, raw r and s)
and to not being refused for a publisher UUID that none of its certificates carries (it passes with its own
UUID as the expected account and is refused with another). What no oracle reaches is whether a Dolby verifier accepts
what forge writes: the structure is that of one sample and one specification
(the open questions),
and the chain it was written for ends in roots this project does not hold. FFmpeg's raw AC-4
demuxer takes the trailer for five more packets, so ffprobe does not agree with forge's frame count on
a signed file; forge's own decode of the signed and unsigned stream is what is compared. TrueHD has no counterpart for the content
signature: the owner's specification lists the evolution frame's signature layout as unconfirmed (the per-frame protection tag is iclforge's own scheme, checked against an independent Python transcription, and is not a Dolby tag)
(Object signing).
A type 2 substream (§E2.3.1.1) is a "yes" in both columns, and was a bug in one of them before
it was checked: it swaps convsync for blkid and frmsizecod and, per Table E1.2 and E1.3's
strmtyp == 0x0 gates, sends neither the programme-mixing group nor the converter exponent and SNR
elements, and this decoder read it with a type 0's gates. An encoder-written type 2 stream decodes
in ffmpeg 8.0.1 to the samples of the same coding as type 0 (every sample within 2e-6, which is
the mantissas the rate loop spends the saved bsi bits on) and tools/references/eac3_parse.py
walks it consistently; the in-repo decoder, scan, accumulator and metadata editor now agree with
both on where it begins and what it carries. The conversion to and from AC-3 that gives the type
its name is not built, so there is nothing of it to check.
Every "no" in that column is a cell where a generated stream has to be checked some other way,
which is what tools/ci/fuzz_eac3_encoder_space.py
is built around: it classifies every case it draws by which of these rows it lands
on, and checks the framing of the ones FFmpeg cannot decode — which needs no decode at all. Two
things do it: a walk over the four fields that fix E-AC-3's framing (syncword, strmtyp,
substreamid, frmsiz, all at fixed bit offsets), which shares nothing with the encoder and
works at every layout; and ffprobe's own syncframe walk, where FFmpeg can be trusted to do one.
It is not asked about a two-dependent layout, because it demonstrably cannot: on one 7.1.4 stream
it reported 19 access units where 18 were written, splitting one at an offset that is not a
syncframe boundary — it had lost sync inside the very substream this table's "no" row is about.
None of this closes the gap — the paragraphs below still stand, and a misreading shared by this
project's encoder and its decoder would survive a framing check as easily as it survives the
round trip — but it is more than nothing, and it is where a bit-offset defect shows up first: a
syncframe written at the wrong offset is a syncframe whose frmsiz no longer lands the next
syncword where it promised. The harness's --check-oracles re-measures this table's own claims
against the installed FFmpeg, so a row that stops being true is reported rather than quietly
assumed.
7.1.4 has no external oracle at all. For that one layout, encoder and decoder are checked against each other and nothing else — the round trip below, plus the mirror self-check, which diffs both dependent substreams' own models block by block rather than only the assembled audio:
$ forge eac3-sine out.ec3 1 384 1000 50 714
$ ffmpeg -v error -i out.ec3 -f null -
[dec:eac3] Error submitting packet to decoder: Error number -84085770 occurred
$ forge decode out.ec3 out.wav
decoded 32 E-AC-3 access units (3 substreams each) -> out.wav
12 channels, 48000 Hz: L R C LFE Lrs Rrs Ls Rs Vhl Vhr Lts Rts
Fourteen channels are coded and twelve are rendered: per §E3.8.2 the dependent's Ls and Rs replace the bed's rather than adding to them.
A second independent substream has no external oracle either, and it is worse than 7.1.4's
gap — FFmpeg decodes nothing at all, not even the main programme. ff_ac3_parse_header's
substreamid != 0 check does not distinguish strmtyp, so §E2.3.1.2's I1 is rejected exactly as
a second dependent substream is. What makes this case worse is where the refusal lands: the raw
E-AC-3 demuxer hands the decoder one frame period as a single packet, I0 and I1 concatenated, so
the second programme's presence fails the whole packet. Measured against ffmpeg 8.0.1 on a
125-access-unit two-programme stream (5.1 main plus a mono commentary):
$ forge eac3-encode main51.wav two.ec3 448 none 51 off programme2=commentary.wav programme2-layout=mono programme2-bitrate=96
$ ffmpeg -v error -f eac3 -i two.ec3 -f null -
[dec:eac3] Error submitting packet to decoder: Error number -84085770 occurred
Last message repeated 124 times
[dec:eac3] Decode error rate 1 exceeds maximum 0.666667
Every one of the 125 packets is refused and the output file is zero bytes, even though those
packets carry a main programme FFmpeg reads perfectly well on its own — splitting the stream by
programme first and handing FFmpeg only I0's access units strict-decodes clean, while I1's alone
give invalid frame type / unable to determine channel mode. So FFmpeg remains usable as an
oracle on each programme's frames, but only after the stream has been demultiplexed by programme,
which is what iclforge::ac3::split_access_units(stream, programme) does.
That demultiplexing is what a single-programme container does — a Matroska track carries one
programme, so forge mkv writes the first programme's access units (and warns about the rest), and
forge mp4 programme=N writes programme N alone — and FFmpeg strict-decodes the result cleanly.
tools/ci/run_codec_matrix.sh therefore skips the FFmpeg check on the raw two-programme stream,
the same way it does for 7.1.4, but keeps it on the Matroska file and on each programme's MP4:
that check is a direct guard on the access-unit boundaries, since a programme's unit has to end at
the next independent substream of any programme rather than at its own next frame, or each span
swallows the other programme's frame and FFmpeg refuses the container too. An MP4 written without
programme= carries every programme in each sample (TS 102 366 F.2), which FFmpeg refuses for the
reason it refuses the raw stream, so the matrix does not hand it to FFmpeg: it holds that file to
forge demux returning the stream byte for byte. The matrix did hand it to FFmpeg until
2026-10-10, when mp4 began to keep every programme, and the nightly FFmpeg Validate failed there
until the row was split this way.
Enhanced coupling has no external oracle at all — not even the partial one 7.1.4 gets.
FFmpeg's own Annex E parser was never written to read its syntax, so it doesn't reject these
streams the way it does a second dependent substream — it has no model of the bits at all, which
makes -xerror unusable as a check here rather than merely unavailable.
tools/ci/quality_race.py's CI gate (decode_scores_ours) scores it through this project's own
decoder instead, the same self-consistency posture 7.1.4 falls back to, with one weaker guarantee
than 7.1.4 has: a defect both the encoder and decoder agree on — a misreading of the spec shared
by both sides rather than a one-sided bug — is not caught by either the CI gate or the round-trip
unit tests in libs/ac3/tests/decoder/test_eac3_decoder.cpp.
Transient pre-noise processing had the same gap, and it hid a defect of exactly that kind.
The decoder counted transprocloc from the first sample of a frame's decoded output, one block
before where A/52 counts it from, and refused any correction whose transient lay past the frame
that signalled it. This project's own encoder never places a transient there, and on its streams
block switching leaves little pre-noise for a misplaced correction to show against, so nothing
here noticed until the Dolby Encoding Engine's streams did: DEE puts most of its transients in the
next frame. Both are fixed (a correction now waits until the frame its transient falls in has
decoded). What closed the gap is a third-party stream and a reference decoder. FFmpeg's strict
decode reads transient pre-noise streams — DEE's and this project's own — without error but does
not apply the correction, so it checks everything except the correction: below 4 kHz and outside
the corrected regions it agrees with this decoder to 37–40 dB on DEE's stream. Dolby's own decoder
(the Reference Player, run locally, never in CI) does apply it, and where its corrections land is
what settled the origin (iclforge/ac3/decoder/transient_prenoise.hpp); on the same comparison it agrees
with this decoder to about 70 dB. tools/checks/verify_gold_reference.sh scores a five-second
excerpt of the DEE stream against its source and against FFmpeg, and
libs/ac3/tests/decoder/test_eac3_transient_prenoise.cpp holds the corrections to the places Dolby's
decoder puts them.
The E-AC-3 mirror self-check (#6 above) narrows that, and is worth being exact about what it
narrows. It compares the encoder's and the decoder's models of each block — bit offsets,
exponents, bap, delta, AHT gain mode and gains, and the coupling, enhanced-coupling and
spectral-extension coordinates — for every substream of an access unit. The emit side and the
parse side are separate implementations of the same Annex E text, so a misreading in one of them
is caught there even when the audio round-trips cleanly and the SNR gate is happy: an
ecplchaos index fitted against a different band structure than the one transmitted, an AHT
gain the decoder recovers differently from the one the encoder chose, a spxblnd that
persisted on one side and not the other. What it still cannot see is a misreading the two sides
make identically, which for anything decided in code they share (compute_bit_allocation,
group_bands, coupling::decode_coordinate) is by construction. That residue is real, and only
an external oracle or an independent transcription of the same spec text closes it — neither of
which exists for ecpl, and for tpn only as far as the paragraph above says.
tools/ci/run_codec_matrix.sh runs the check over both tools, in FFmpeg Validate and on the
sanitizer leg.
fscod2 audio content has no external decode oracle at all — not even Dolby's own.
ffprobe walks every syncframe of a reduced-rate stream correctly (frame count, exact byte size,
exact spacing, and sample_rate all confirmed against all three rates), so the framing and
header are cross-checked externally. But actually decoding the audio is refused by both
real-world implementations available here: FFmpeg's E-AC-3 decoder (Not yet implemented in
FFmpeg, patches welcome) and, more surprisingly, Dolby's own Reference Player — dlbac3parse
reports No valid frames found before end of stream on a stream ffprobe reads frame-by-frame
without complaint, using the same pipeline (tools/ci/quality_race.py's dolby_decode) that decodes
a normal-rate stream from this encoder without issue. fscod2 appears to be a coding tool whose
own reference implementation does not support it. So the coded audio is verified only by this
project's own encoder/decoder round trip, the mirror self-check over that round trip (all three
rates, with and without the Annex E tools, in tools/ci/run_codec_matrix.sh and
libs/ac3/tests/verify/test_eac3_selfcheck.cpp), and the independent Python parser
(tools/references/eac3_parse.py) — the last of which is the only one of the three written from
the spec separately from the codec.
Object decode has no external oracle at all, and for once that is not FFmpeg's gap alone.
FFmpeg implements no JOC reconstruction: it reads these streams correctly and renders the 5.1
bed, which is the designed fallback, but it never produces objects to compare against. Dolby's
own decoder does implement reconstruction — and gates it on a keyed authenticity tag this
project ships no key for (Atmos & JOC), so it
plays them as the bed too. Nothing outside this repository can currently produce an independent
object decode of an ICL Forge stream, which makes this the one layer where even the partial
oracle 7.1.4 gets is unavailable. What covers it instead is a self-consistency series with real
resolution: Object quality trend scores each of a fixed scene's five
objects, in each nightly run, at two rates. The same caveat as ecpl/tpn applies with full
force — a defect the encoder and decoder share is invisible to it. AC-4's objects are in the same
position, without the series: librempeg refuses object coding, and DEE writes no AC-4 objects from
this project's masters (The decoder's objects).
Containers and manifests are checked externally where a reader exists, and only there.
iclforge::containers::mp4::fragment's and iclforge::containers::mp4::FragmentWriter's CMAF output both pass FFmpeg 8.0.1's strict decode
(ffmpeg -v error -xerror -err_detect crccheck+bitstream+buffer+explode) over the init segment
concatenated with every media segment, and both the HLS media playlist and the DASH MPD read back
through FFmpeg's own hls and dash demuxers at the exact original access-unit count —
confirmed on a session written segment-by-segment by the streaming writer, not only on the batch
form. The ceao compatibility brand is present in the ftyp and every styp of an
object-audio track and does not disturb that decode.
The manifests' structure is held to ISO/IEC 23009-1's own schema. tools/checks/verify_dash_schema.py
fetches MPEG's DASHSchema at a pinned commit (with the two W3C schemas it imports, all
SHA-256-pinned, never committed), writes the manifests forge fmp4 produces - an AC-3 5.1, an
E-AC-3 stereo, a Dolby Atmos JOC stream with and without the 5.1 fallback, and an AC-4 from the
committed baseline - and validates each, with a deliberately corrupted copy that the same validator
must reject (a validator that cannot fail proves nothing). Checked 2026-10-10 against commit
cc941bd with .NET's XSD 1.0 validator on Windows, and in interop.yml with xmllint (libxml2)
the same day: all five valid and the control rejected under each. That covers element order and nesting, attribute types, required
attributes and the URI and duration patterns - the parts FFmpeg's demuxer, which takes what it
needs and ignores the rest, never tests.
What has not been checked against anything external is the meaning of the DASH signalling,
which the schema cannot see: it leaves a descriptor's schemeIdUri and value as free strings.
EC3_ExtensionType/EC3_ExtensionComplexityIndex and the Dolby
audio_channel_configuration:2011 @value are transcribed from ETSI TS 103 420 clause D.2 and
TS 102 366 clause I.1.2.1 (via DASH-IF IOP Part 8 v5.0.0 §5.3.2–5.3.3) and asserted against those
clause texts in libs/ac3/tests/test_fmp4.cpp, including the element order ISO/IEC 23009-1's
RepresentationBaseType sequence requires — but FFmpeg's DASH demuxer ignores supplemental
descriptors entirely, so it confirms only that the manifest still parses and plays, not that a
JOC-aware player would read the right complexity index from it. No real DASH player has been run
against these manifests. The same gap applies to the HLS CHANNELS="<N>/JOC" attribute, which
predates this work.
The incremental writers are held to a stronger in-repo standard instead: iclforge::containers::mp4::FragmentWriter's
media segments are asserted byte-identical to iclforge::containers::mp4::fragment's over the same frames, and its
initialization segment byte-identical once the three duration fields a live session cannot know
are patched back — the same equality contract iclforge::containers::mpegts::Writer has against iclforge::containers::mpegts::mux. That
makes the batch form's own external validation carry over to the streamed one by construction
rather than by re-measuring it.
compr in E-AC-3 has no external oracle. FFmpeg's Annex E header parser reads compre and
then skips the word, so -heavy_compr changes nothing on an E-AC-3 stream however good the
metadata is. It is covered bit-by-bit instead
(libs/ac3/tests/meta/test_drc.cpp,
tools/references/eac3_parse.py).
IMF IAB Track Files¶
write_mxf_iab() is checked three ways: by a reader written separately from ST 377-1 and the standards it
cites (libs/iab/tests/test_mxf_writer.cpp), by FFmpeg's MXF demuxer (partitions, Header Metadata,
timecode, duration; it does not know the IAB descriptor, so it reports the audio as unsupported), and by
Netflix Photon, the open-source IMF validator Netflix publishes. Photon is the only outside tool this
project has found that implements ST 2067-201 and ST 2067-2's Track File constraints, which makes it the
one oracle that can say a Track File is wrong where the in-repo reader and FFmpeg both read it.
It did, twice, on the first file it saw:
- the File Package's Package UID had material type
09hwhere ST 2067-2:2020 5.1.5 requires0Fh; and RFC5646SpokenLanguagewas written as UTF-16 where the SMPTE Elements register types it ISO7.
Both are fixed and recorded in libs/iab/ERRATA.md; the writer's test asserts each. The corrected file
gives no error from IMPAnalyzer and none from IMFTrackFileReader (which runs the IAB checks), with and
without the IAB Channel SubDescriptors and with the optional MCA labels set. With them unset Photon warns,
correctly, that MCA Content, MCA Use Class and MCA Title Version "should" be present.
Photon's IMFTrackFileCPLBuilder also derives a Composition Playlist from the file: an IABSequence
at edit rate 24/1 with a source duration of 48, which are the frame rate and frame count written, and the
File Package's UUID as the track file ID. (That app then fails in its own closing dump of the reader's
state when it shares one working directory with the reader it built; the standalone reader's identical
dump succeeds on the same file, and no check named the file.)
What this does not cover: Photon was given the Track File alone. No Composition Playlist, Packing List or
Asset Map names one, because this project writes none, so the checks that run across an IMP (the CPL's
IABSequence, the track file's place in an Application) have not run. Photon 5.1.0-rc.3 is a pre-release
with no published binary; it was built from its tag with its own Gradle wrapper.
java -cp "<photon>/build/libs/*" com.netflix.imflibrary.app.IMPAnalyzer track.mxf
java -cp "<photon>/build/libs/*" com.netflix.imflibrary.app.IMFTrackFileReader track.mxf <empty working dir>
Dolby's Online Delivery Kit tools¶
Dolby publishes, free of charge on ott.dolby.com, kits for delivering Dolby Digital Plus and Dolby
AC-4 online. The AC-4 kit (1.5) has a Test_Tools folder with two programs that read what this
project writes. streamdemuxer (1.0.0.5519896, built 14 September 2020) demultiplexes MP4,
fragmented MP4, DASH, HLS and MPEG-2 TS into elementary streams and takes --decryption-keys
<kid>:<key>. mp4drop dumps the boxes of an ISO base media file as XML. Both are written by the
format's owner, so they are the strongest outside reader of the container layer this project has:
FFmpeg and GPAC read the same files, but neither is Dolby's. Neither decodes audio, so they sit
beside the decoder oracles and not above them.
They are optional and local. Nothing from the kit is committed (not the programs, not Dolby's streams, not XML dumps of them) and CI does not fetch it. The project has not read the kit's licence terms in full, and whether CI may download the kit is the owner's decision. A check skips with exit status 77 when the tools are absent.
python3 tools/checks/dolby_odk.py fetch dolby-odk-tools
export ICLFORGE_DOLBY_ODK_TOOLS=$PWD/dolby-odk-tools
python3 tools/checks/check_dolby_mp4_boxes.py --cli build/bin/forge
python3 tools/checks/check_dolby_demux_roundtrip.py --cli build/bin/forge
python3 tools/checks/check_dolby_cenc.py --cli build/bin/forge
fetch is the only step that touches the network. It reads the two tool archives (1.3 MB) out of
the kit's 1.1 GB zip with HTTP range requests, checks each against a SHA-256 recorded in the
script and extracts the program for this platform. dolby-odk-tools/ is in .gitignore. The
first two checks also take --samples DIR (or ICLFORGE_DOLBY_ODK_SAMPLES), a directory of MP4
files from the kit itself, which stay on the machine that downloaded them. The programs are run
the careful way, because they are Dolby's and not this project's: an empty environment, no
network where unshare -n works, a temporary working directory, a time limit and a cap on what
they may print.
| Check | What it compares | Result, 2026-10-29 |
|---|---|---|
check_dolby_mp4_boxes.py |
mp4drop's reading of dac3, dec3 (with the JOC flag and complexity index) and dac4 in the MP4 and the init segment forge writes for AC-3, E-AC-3, E-AC-3 JOC and AC-4, against forge probe of the stream the box was made from; then forge probe of the box in Dolby's two sample MP4s against mp4drop |
10 pass, 1 note |
check_dolby_demux_roundtrip.py |
forge's MP4, fragmented MP4 (init, DASH and HLS media), and MPEG-2 TS (DVB and ATSC) of the same four streams, through streamdemuxer, against the stream put in (AC-4 by raw frame, since two writers may frame the same frames differently); then forge's demux of Dolby's two sample MP4s against streamdemuxer's | 23 pass, 2 skip (AC-3 in TS: the tool does not list AC-3) |
check_dolby_cenc.py |
108 protected files (tools/generators/cenc_make_protected.py and GPAC's MP4Box -crypt; four codecs, four schemes, clear-lead, key-rotation and 16-byte-IV layouts): mp4drop's reading of the protection boxes against what the generator wrote, then streamdemuxer's decryption against the clear stream |
108 box legs pass; the 108 decryption legs skip |
Findings from Dolby's tools¶
Each of these has one oracle, Dolby's tool, and is recorded as such. None is a defect found in forge; they are the places the tools say something forge's own tests could not.
Agreement. On forge's containers the two programs read what forge wrote. streamdemuxer's elementary stream equals the stream that went in for 21 of 21 legs (MP4, DASH, HLS media and master, and TS for AC-3, E-AC-3, JOC and AC-4, less AC-3 in TS, which the tool does not list), and mp4drop's configuration-box fields equal what forge reads from the stream in 8 of 8 files (MP4 and init segment, four streams). The other way, forge reads Dolby's two sample MP4s (a stereo and a 5.1 JOC E-AC-3 file) as streamdemuxer and mp4drop do. A reader written by the format's owner finds the output well formed.
Two framings of AC-4. streamdemuxer writes an AC-4 elementary stream with sync word 0xAC40,
no CRC and, on every frame, the 0xFFFF escape followed by a 24-bit length. forge writes 0xAC41, a
CRC-16 and a 16-bit length. Both carry the same 73 raw frames and forge probe reads the tool's
file, so the checks compare raw frames and not framing. ETSI TS 103 190-1 Annex G allows either; a
consumer that needs one form should say so. Single oracle: Dolby's tool.
The channelcount of a JOC entry. forge writes 6 in the channelcount of the ec-3 sample
entry for a 5.1 JOC stream; the kit's 5.1 JOC sample, made by Dolby's muxer, writes 2. The field
is the player's hint, and the project has not established which value ETSI TS 103 420 asks for.
The check prints it as a note, not a failure. Single oracle: a Dolby sample and Dolby's muxer. The
owner decides whether the writer follows it; read the text before changing the writer.
The cipher is not checked. streamdemuxer answered "Need a key for decryption" for 76 of the
108 protected files with the matching key supplied (the other 32 are below). Trying the key in
lower case, upper case, dashed and 0x prefixed, with --track-id, and with two key pairs made no
difference, nor did a control file FFmpeg had encrypted. The tool stops after the moov box. Whatever the cause, a tool that cannot be told from "ignores the key"
proves nothing, so the check reports one skip for the decryption legs and --require-decrypt turns
it into an error. No cipher output of forge's generator has been decrypted by a Dolby tool, and
GPAC and FFmpeg remain the only decryption oracles. Two ways to settle it: a newer streamdemuxer (the tested one is the AC-4 kit's; the
Dolby Digital Plus kit was not examined), or a protected stream from Dolby with a published key.
Layouts the tool does not read. For the 32 files that put a clear sample entry beside an
enca entry, in either order, streamdemuxer exits 0 and writes no stream. It crashes (SIGSEGV) on
a clear or protected MP4 that GPAC fragmented with MP4Box -frag, for E-AC-3 and for AC-4, though
it reads the fragmented MP4 forge writes. Neither is a reason to change forge. They are why those
legs are skipped, and the second was seen while exploring and is not one of the checks.
The protection boxes. mp4drop reads enca, sinf, frma, schm, schi and tenc in all
108 files and reports the scheme, the original format, the default KID, the IV size, the
constant IV and the pattern the generator wrote, and a senc entry count equal to the trun
sample count in each fragment that sends IVs. That puts the layout of the protection boxes (the
order Dolby's AC-4 page gives: the configuration box, then sinf) under a Dolby parser. It says
nothing about the cipher. The 1:9 pattern files are among the 108 and pass this leg for the same
reason: it reads fields, not audio.
StreamValidator¶
The kit also points at a hosted StreamValidator (and an MPD validator) on ott.dolby.com. It runs
in a browser, takes .mpd, .m3u8, .mp4, .m4a, .ts or a zip of manifests and media, and has
a Decryption box for kid:key pairs. Nothing here drives it. From the environment this project's
automated work runs in, a default headless Chromium (no changed headers, one navigation each) was
refused at both addresses the kit names:
| Address | Answer |
|---|---|
https://ott.dolby.com/OnDel_Tools/validator/Start_Here.html |
HTTP 403, AccessDenied |
https://ott.dolby.com/OnDelKits_dev/StreamValidator/Start_Here.html |
HTTP 403, AccessDenied |
The attempt stopped there. python3 tools/checks/dolby_validator_bundle.py --cli build/bin/forge
--out DIR writes validator-bundle.zip, which a person opens from their own browser: forge's
elementary streams, MP4, DASH and HLS sets and TS files, the protected files, a keys.txt of
made-up test values, and a checklist. Run it, then add one line per run below. Say whether the
validator printed PASSED or FAILED and copy the error class and message.
| File | Validator version and date | Result | Error class and message |
|---|---|---|---|
| (not run) |
Going the other way: published conformance vectors¶
Everything above consumes someone else's streams as an oracle. Every release also publishes a
set this project produces — 60 AC-3 and E-AC-3 streams covering each coding tool, layout and
sample rate the AC-3 and E-AC-3 encoders can emit, each with the source PCM it was encoded from,
the expected decode hashes and per-channel levels, and a manifest saying what each vector
exercises. It ships as iclforge-conformance-vectors-<version>.tar.gz, signed and attested like
every other release asset. It has no AC-4 vector.
The ffmpeg field on each vector is derived from the table above rather than typed in, so the
published set cannot drift out of step with what this page says the oracles reach: full where
FFmpeg decodes the audio, header_only for the fscod2 rates, none for 7.1.4 and for enhanced
coupling / transient pre-noise processing.
Two limits are worth stating on this page rather than only in the bundle: the source material is
synthetic, and the hashes are per-toolchain. On the first, the CC0
speech and music fixtures are committed (testdata/audio/programme_{speech,music}_stereo.flac),
but the vector generator was never pointed at them: tools/generators/gen_conformance_vectors.py
still synthesizes its own sources and marks the spot where those files would join the set. Wiring
this bundle to that material is outstanding work. On the second, the decoded-PCM hashes differ
between x86-64 and arm64, where the decoder's last bit differs (the 6.02 dB offset above, still
unexplained: both hypotheses its investigation proposed were falsified by direct measurement),
and the encoded bytes are pinned across toolchains for three streams only, so a bundle
regenerated elsewhere may differ from the published one for the same correct streams.
Regenerating with the toolchain the manifest names reproduces every hash exactly, and the
generator asserts that with --check-determinism rather than assuming it.
See Conformance vectors.
AC-4¶
Four libraries read and write AC-4 (ETSI TS 103 190-1/-2). iclforge::ac4, the inspector, parses the
sync frame, table of contents, presentation and substream-group framing — channel-coded,
A-JOC-coded, direct-coded-object and OAMD alike — and reports audio_data/metadata() payloads
as byte ranges. iclforge::ac4 decodes them, from The decoder's syntax
on, iclforge::ac4 writes AC-4 (The encoder), and iclforge::ac4 holds the
transforms, QMF banks and A-SPX, A-CPL, A-JCC and A-JOC kernels the decoder and the encoder
share.
With no reference decoder, AC-4's correctness rests on several checks, each weaker than a comparison with one. What each outside program can check:
| Oracle | For the decoder | For the encoder | Runs |
|---|---|---|---|
Two transcriptions of the syntax, in C++ and in tools/references/ac4_syntax.py |
Every syntax element of DEE's, third-party and constructed streams | Every stream it writes, against the encoder's own write trace as well | The gate |
| Dolby Encoding Engine (DEE) | Its streams, scored against their sources | The race: the same sources at the same settings | Locally; the licence ends on 2026-11-06 |
| librempeg, an experimental second decoder | Its decode of the same streams | Its decode of the encoder's streams | Locally |
| MediaInfo | Table of contents, presentation substream, metadata(), EMDF payloads and crc_word, frame by frame |
Each value the encoder was asked to write | Locally |
| FFmpeg 8.0.1 | Framing only: it has no AC-4 decoder | Framing of raw and MP4 output | FFmpeg Validate |
| DEE's MP4 muxer | The encoder's raw output muxes, and the dac4 it writes equals the encoder's |
Locally | |
| This project's decoder | PCM from every stream the encoder writes | The gate, FFmpeg Validate | |
| Listening | Rendering and objects | Objects | Locally |
The rest of this section takes them in the order the libraries were built: the inspector's framing, then the decoder, then the encoder, then IEC 61937 and Hearth's engine. What comes first is the inspector's, and its narrower scope changes which of this page's usual checks apply.
Where real AC-4 streams come from. Nothing open encodes AC-4 — the same gap this page states
for AC-3/E-AC-3, just with no third-party corpus to fall back on either, since neither ATSC nor
ETSI publish AC-4 conformance vectors. The substitute is the same tool this project already
treats as a licensed, local-only, never-in-CI oracle for the AC-3/E-AC-3 "Committed" tier: Dolby
Encoding Engine 6.5.4, whose install here also carries dee_ac4_encoder.exe (2.0, 5.1 and 5.1.4
channel-based-immersive; 7.1 input is written as 5.1), dee_ac4ims_encoder.exe (immersive stereo,
which stays channel-coded) and dee_ac4ajoc_encoder.exe (A-JOC, which takes only an Atmos master
no master this project writes satisfies — see below). tools/generators/gen_ac4_baseline.py
generates testdata/external-baseline/ac4-*/dee.ac4 from it, the same local-generation,
committed-output pattern gen_external_baseline.py uses.
What the inspector's framing is checked against, in the same "how much does this prove" ordering CONTRIBUTING.md's Oracles list uses:
- Annex G's CRC-16, over every sync frame of the committed DEE fixtures — not a
self-consistency check, since the polynomial, initial state and no-reflection/no-final-XOR are
transcribed from the standard and computed independently of whatever produced the bytes. A
frame this project did not write passing this check is real evidence the sync-frame layer
(
sync_word,frame_size,crc_word) is read correctly. - MediaInfo, bundled with the same DEE install, reads the committed fixtures through its own
dlb_ac4lib-based AC-4 support (channel count, channel layout, bitstream_version, presentation and substream-group counts).libs/ac4/tests/core/test_toc.cppassertsiclforge::ac4::parse_raw_frame's fields against exactly what MediaInfo reports for the same file — an independent second reader, not just a self-consistent round trip. tools/references/ac4_parse.py, an independent Python transcription of the same clauses, used the same wayeac3_parse.pyis: to catch a transcription slip a self-consistent parse cannot. It is what caught three of this parser's own bugs during development — a missingemdf_reserved()call,substream_index_table()'sb_more_bits-before-substream_sizefield order, and a Table 56 extendedchannel_modeprefix code that read a fixed-width chunk regardless of which 7-bit prefix it followed, silently misreading every 9.x/22.2 layout — each found by disagreeing with what the real DEE fixture actually contained, not by inspection.
What is not verified, and why. Dolby's own AC-4 decoder — the Reference Player's
dlbac4dec GStreamer element, the same install's dlbac3dec already used as an AC-3/E-AC-3
oracle — parses a real DEE-encoded frame's framing cleanly (dlbac4parse reports correct
audio/x-ac4-raw caps, no CRC or sync errors) but returns zero PCM samples for every frame in
testing, with and without explicit out-ch-config/out-cplx-level/main-assoc-mode overrides.
Whether that is a license/entitlement gap specific to AC-4 decode (as opposed to AC-3/E-AC-3
decode, confirmed working on the same install) or something else was not resolved. It does not
block the inspector's scope, since parse-and-inspect never claims to decode audio content. The
decoder's output is checked against the sources DEE encoded and against librempeg's AC-4 decoder,
run as a command-line oracle (The decoder's output).
A-JOC / direct-coded-object / OAMD substream groups (b_channel_coded == 0, TS 103 190-2
clause 6.3.2.8-6.3.2.12 — ac4_substream_info_ajoc(), ac4_substream_info_obj(),
bed_dyn_obj_assignment(), oamd_substream_info()) are parsed the same way the channel-coded
path is. Their verification story is narrower than tier 1/2/3 above, though, because no DEE stream
reaches this path: dee_ac4ajoc_encoder.exe accepts only an Atmos ADM BWF mezzanine as input, and
this project has no tooling that produces one DEE accepts (the same "gates on content provenance,
not syntax" limit this page already states for the AC-3/E-AC-3 JOC side); dee_ac4ims_encoder.exe
— the other locally available object-adjacent encoder, despite its "immersive stereo" name — was
confirmed to stay channel-coded regardless of input. What stands in for a DEE fixture is a set of
synthetic, hand-built bitstreams (libs/ac4/tests/core/test_toc.cpp), each assembled by a from-scratch
BitWriter sharing no code with either iclforge::ac4 or tools/references/ac4_parse.py, field-traced
against the spec text (including Table 64/65's array-position-to-bit-index mapping, cross-checked
against §6.3.2.10.8's own worked EXAMPLE 2/3 values) rather than against an external reader. Two
streams from elsewhere now go through the same framing: Chromium's public A-JOC test file, which
sets b_oamd_common_data_present in every frame and whose substreams both transcriptions read to
their ends, and the object streams the encoder writes since phase E9, four of them committed
(The decoder's objects). This is weaker evidence than tiers 2-3 — a
shared misreading of the spec between this parser and its own test vectors cannot be ruled out
the way MediaInfo or DEE's own output rules it out for the channel-coded path — but it is
stronger than self-consistency alone: the vectors caught two real bugs during construction (an
array-index formula that was reversed for one of the two flag-array widths, and this parser's own
handling of LFE at the same array position - included for ac4_substream_info_obj()'s std-flags
branch but excluded for bed_dyn_obj_assignment()'s, a spec difference this project's
first draft assumed away). If dee_ac4ajoc_encoder.exe's provenance gate or dee_ac4ims_encoder.exe's
behavior changes, that would upgrade this to a tier 2/3 check. oamd_common_data() (§6.2.8.1) is
transcribed at the one TOC-level site that reaches it, ac4_substream_info_ajoc()'s own
b_oamd_common_data_present flag — bed render info, trim and headphone metadata, plus the
declared-length add_data tail a nested element that reads past its own byte budget fails against,
the same synthetic-vector evidence as the rest of this section. The inspector reports the OAMD
substream DATA payload itself (oamd_substream(), §6.2.2.4, which embeds a second, independent
oamd_common_data() of its own) as a byte range like every other non-audio substream; the
decoder reads it.
The bitstream_version <= 1 legacy path
(ac4_toc()/ac4_presentation_info() as TS 103 190-1 alone defines them) is transcribed and
checked against the published spec text (including a page-rendered visual check of Table 4/5,
not just the PDF's extracted text) but never against a real stream — every DEE 6.5.4 encode
observed writes bitstream_version == 2, so no sample exercises this branch. It is exactly the
kind of gap tier 3 above exists to narrow and tier 1/2 cannot: two transcriptions can share a
misreading neither catches.
EMDF-only presentations (presentation_config 6) have no real stream either: no DEE encode
writes one. iclforge::ac4 used to stop reading such a presentation before the n_add_emdf_substreams
loop that TS 103 190-1 §4.2.3.2 and TS 103 190-2 §6.2.1.3 place after the config-6 branch, on both
TOC paths. tools/references/ac4_parse.py did the same on the bitstream_version 2 path. Every
later presentation, the substream groups and substream_index_table() were then read from the
wrong bit, and on that path the two transcriptions agreed: the shared-misreading case described
above. libs/ac4/tests/core/test_toc.cpp now builds an EMDF-only presentation ahead of an ordinary one on
both paths, and the same frames, built again with a separate Python bit writer, parse the same way
in tools/references/ac4_parse.py.
The decoder's syntax¶
libs/ac4/src/decoder is an AC-4 decoder written from the same two standards. It reads every
syntax element of a frame's substreams and decodes their audio (see "The decoder's
output" below): the presentation substream,
channel-coded audio substreams in the Part 1 channel elements (ASF spectral data, stereo processing,
companding, A-SPX and A-CPL data, and metadata() with its DRC and dialogue enhancement), a
channel-coded substream's HSF extension substream where one resolves to a distinct, readable
substream (the additional scale factor bands, spectral data and noise fill above 24 kHz a 96 kHz or
192 kHz substream carries, which it decodes to PCM at that rate in the SIMPLE codec mode), the immersive element of the 7.X.4 and 9.X.4 channel modes, object substreams
(A-JOC and direct-coded objects, with their object audio metadata), and EMDF payload substreams.
It decodes the speech spectral frontend (Part 1 clause 5.2) from the text alone, the syntax and
the arithmetic coded data in one pass, checked against a second transcription
(tools/references/ssf_ref.py) on random streams. The decode at 96 and 192 kHz is checked on streams built from the text alone (libs/ac4/tests/decoder/hsf.cpp): tones above 24 kHz come back at their frequency and level through every transform length, grouping and channel element, the second transcription reads the committed streams alike, and no real stream at these rates exists. It refuses, with a named reason, core decoding of the 22.2 channel element and its rendering to any layout but as coded (Part 2 has neither), an intermediate spatial format mixed into channels Annex A.2.1 has no
matrix for, a 96/192 kHz substream whose HSF extension substream could not be resolved, at 96 and 192 kHz A-SPX and A-CPL, the speech spectral frontend, the immersive and 22.2 elements, objects, mixing, dialogue enhancement and DRC's compression, and a
substream no element of the table of contents names.
With no reference output to compare against, the syntax is transcribed twice, separately, from the
text: in C++ in the decoder, and in Python in tools/references/ac4_syntax.py, which takes its table
of contents from ac4_parse.py. Each writes a trace of every element it reads, and the traces are
compared. A reading both transcriptions share passes this check, so the places where the text is
ambiguous or defective, the reading taken for each and the evidence for it are recorded in
libs/ac4/ERRATA.md.
The trace. One record per syntax element (an entry with a bit count in a syntax table of either part), holding the bit offset from the start of its substream, the width and the value:
| Element | Width | Value |
|---|---|---|
| A fixed-width or computed-width field | its width | the bits, MSB first |
An element listed with a variable width, such as aspx_int_class |
the bits read | the code read |
variable_bits(n) |
every bit, continuation flags included | the decoded value, modulo 2^64 |
| A Huffman codeword | its length | its index in the codebook, before cb_off |
quad_sign_bits, pair_sign_bits |
one bit per nonzero line | the bits |
ext_code |
the whole escape | the magnitude, 2^(N_ext+4) + ext_val |
add_data, extensions_bits, drc2_bits |
the width, in 65535-bit records when longer | its last 64 bits |
A byte of a run, such as emdf_payload_byte or presentation_name |
8 | the byte |
byte_align, fill_bits, bits skipped by a size, zero-width elements and any element that runs past
the end of its substream are not recorded. A loop records each read, and a field read and then
extended (audio_size_value and its variable_bits(7)) is two records.
Digests, in CI. For each frame and substream with records, one line: frame, substream, kind
(presentation, audio or emdf_payloads), record count, the bit where the last record ends, and
zlib's CRC-32 over the records packed as struct.pack('<IHQ', offset, width, value).
testdata/ac4/ holds the Python parser's digests of the committed DEE streams: SIMPLE, ASPX,
ASPX_ACPL_2 and ASPX_ACPL_3 at 2.0 and 5.1, one tone per channel at 2.0 and 5.1, DRC curves with an
Lt/Rt downmix, immersive stereo at three frame rates, and 5.1.4, one tone per channel in each
immersive codec mode DEE writes. libs/ac4/tests/decoder/test_syntax.cpp requires
the decoder to produce the same lines, to read every substream to its exact end and to refuse nothing,
and tools/checks/test_ac4_syntax_digests.py requires the Python parser to reproduce the same files, so
neither transcription can change alone.
The committed streams can be scored. Every committed stream but ac4-stereo-64 is made with DEE's
loudness measured and not corrected (gen_ac4_baseline.py's baseline version 3): DEE's default
normalises to −24 LKFS and runs a true-peak limiter, which changes the audio in a way a gain fit does
not undo. ac4-manifest.json records each stream's source, rebuilt by the generator from the committed
programme fixtures, with its SHA-256, so a decode can be scored against the exact source DEE encoded.
The generator also makes a larger local set, never committed. Phase G0 made every layout and rate DEE
writes, from 2.0 at 48 kbps to 5.1.4 at 768, immersive stereo at every frame rate, and DRC, downmix,
loudness and I-frame settings, each with MediaInfo's frame-by-frame trace beside it. Phase G1 added
the streams the phases still to come test against, since DEE's licence ends on 2026-11-06: sweeps,
noise and transients at every 2.0, 5.1 and 5.1.4 rate, film and speech at 5.1.4, 7.1 input, immersive
stereo at every rate and frame rate and in gapless parts, metadata at 2.0, 5.1, 5.1.4 and immersive
stereo, substreams for presentations, 60 s programmes, and E-AC-3 and E-AC-3 JOC from the same
sources, each with DEE's MP4 of it and what forge made of it. DEE writes no AC-4 from objects: its
object encoders take only an Atmos master, and refuse every master this project writes as "not
authored with Dolby tools".
The decoder's output¶
The decoder turns a mono, stereo, 3.0, 5.X or 7.X substream in any of Part 1's codec modes (SIMPLE,
ASPX and the three A-CPL modes), at frame_rate_index 13 and, through the sample rate converter of
the next section, at every other index, into PCM: the audio spectral frontend, stereo
and multichannel processing, the inverse transform with block switching and frame alignment (Part 1
clauses 5.1, 5.3, 5.5 and 5.6), then the QMF domain (5.7): the analysis bank, companding, A-SPX, A-CPL
and the synthesis bank. Every codec
mode passes through the QMF banks, SIMPLE included, as Part 1 Figure 9 draws the chain, so the decoder
has one delay, 1,313 samples at index 13: d_pcm's 352, the banks' 577 and six QMF slots of history.
The LFE passes through the banks with the other channels and nothing else touches it there. The
transforms, the QMF banks, A-SPX's tables and high frequency generator, and A-CPL's decorrelators,
transient ducker, interpolation and dequantisation tables are in libs/ac4/src/core, the core the decoder
shares with the encoder. Six checks stand in for the reference output neither part defines:
- Each transform against its formula (
libs/dsp/tests/tiered/test_dsp.cpp): the FFT against the DFT; the inverse MDCT against a verbatim transcription of Pseudocodes 60 to 63 and against the cosine sum they come to, at every transform length of clause 5.5.3; the forward MDCT against its own sum; the KBD windows against numpy's Kaiser window, cumulated; the QMF analysis and synthesis banks against Pseudocodes 65 and 66 as printed; all to 1e-12. Blocks windowed and transformed by an analysis written in the test from the same windows reconstruct their input to 1e-12 across every block transition Part 1 Table 187 allows, within a frame and across frames, and the QMF pair gives back its input 577 samples later to 78 dB, a property of its window,QWIN. - A-SPX's parts on known input (
libs/ac4/tests/core/test_aspx.cpp,libs/ac4/tests/decoder/test_aspx.cpp): the subband group, patch and limiter tables of DEE's two 2.0 configurations, worked through Pseudocodes 67 to 74 by hand, and their invariants over all 2,811 configurations a stream can select; the linear prediction finding a two-slot recursion; pre-flattening an envelope that is a cubic in dB; Table 195's chirp factors; and, on hand-built A-SPX data, the paths DEE's streams do not take: frequency and time interleaved waveform coding, a balanced pair, the tone generator's phase, the noise generator's index across intervals, an interval running past its frame, and companding's gains. - A-CPL's parts on known input (
libs/ac4/tests/core/test_acpl.cpp,libs/ac4/tests/decoder/test_acpl.cpp): each of the three decorrelators, in each of Table 198's regions, has the impulse response of its difference equation to 1e-12, run through 32 or 16 slots at a time, and a magnitude response flat to 1e-9; the transient ducker leaves a steady signal alone and ducks a decaying one by the gain Pseudocode 112 gives, worked by hand. The dequantisation tables hold their printed entries and the structure they share: the fine alpha and beta tables step through one sequence, each fine beta row is a multiple of the last to the table's seven decimals, and the coarse tables are the fine ones at even indices. Differential decoding runs along frequency, along time and across frames, and a value outside its table refuses the frame; interpolation is worked smooth and steep, with one and two parameter sets; ASPX_ACPL_3 makes its centre of gamma5 and gamma6. - The multichannel matrices against the printed tables, and the elements DEE does not write
(
libs/ac4/tests/decoder/test_multichannel.cpp,test_constructed.cpp): the matrices of Part 1 Tables 178 and 179 and clause 5.3.3.4 equal the tables' printed entries, 300 of them for Table 179 alone, held in the test as a transcription of their own. DEE's 5.1 streams use one form of the 5.X element,coding_config0 with2ch_mode0. The others, the 3.0 element and the 7.X element in its three channel modes are read from streams built with the encoder's writer, one tone per channel, whose tracks are the channels through the inverse of the printed matrix: everycoding_config, both2ch_modes, everychel_matsel, stereo processing on and off,b_use_sap_add_ch, SIMPLE and ASPX. Each reads with the writer's trace, record for record, and puts each tone back on its channel, 60 dB over the other tones there. On the ASPX streams, one aspx_data element sent loud fills its own channels' high band alone, andb_compand_onchanges only the channel Table 212 gives it. The A-CPL modes are built the same way, with A-CPL's syntax written by the encoder's writer: the channel pair in ASPX_ACPL_1 and 2, the 5.X element in all three, and the 7.X element in ASPX_ACPL_1 and 2 in its three channel modes, with both of Table 202's pairings. Their parameters send each module's downmix wholly to one of its two outputs, and ASPX_ACPL_1's residuals carry the other belowacpl_qmf_band, so each tone comes back on its channel and the channels A-CPL leaves out stay 60 dB under -20 dBFS. A pair in ASPX_ACPL_2 with beta 1.4 puts the decorrelated part in L and R with opposite signs: it cancels in their sum to 0.1 dB and is the tone 1.4 times over in their difference. Twenty of the streams are committed, with the Python parser's digests, which both transcriptions reproduce. - DEE's streams against their sources (
tools/checks/score_ac4_decode.py): pinned floors gate FFmpeg Validate, a nightly job;--json-outfeedsac4-quality-main.jsonlon thequality-historybranch for AC-4 decode quality trend. The decoded output is aligned with the source by cross-correlation and fitted with a gain per channel. Every leg must lag its source by the same 4,385 samples (DEE's encoder's 3,072 and this decoder's 1,313; DEE's immersive stereo encoder runs a frame shorter, 2,337), sit within 0.2 dB of unity gain, and meet floors pinned at the first measurement: per-channel SNR over the whole band for SIMPLE and below the A-SPX crossover for ASPX; above the crossover, each frame's energy in each A-SPX subband group against the source's; log-spectral distance and ViSQOL. Each tone must land on its own channel. FFmpeg Validate runs it on the 15 committed legs, every committed DEE stream butac4-stereo-64: three at 2.0, six at 5.1 (two of them A-CPL), three immersive stereo and three 5.1.4. Locally it runs over phase G0's 99 legs at index 13: 2.0 from 48 to 768 kbps, 5.1 from 96 to 768 and immersive stereo from 64 to 320, every 2.0 channel within 0.17 dB of unity and every 5.1 channel but the LFE within 0.11 dB in SIMPLE and ASPX. DEE low-passes the LFE before it codes it: from the source to the decoded LFE the level runs 0.25 to 0.31 dB under unity to 100 Hz and falls 12 dB by 120 to 160 Hz, with the phase of a filter near 120 Hz, so the LFE's level is checked from 20 to 100 Hz within 0.5 dB and its SNR against the source, -2.2 dB on music, is only pinned. Where the source has content above the crossover, the A-SPX tiles' energy sits 0.5 to 1.0 dB below the source's on average on 2.0 music at 48 kbps and speech at 48, 64 and 128. That is with the pre-flattening phase D4 reads (libs/ac4/ERRATA.md, "Pre-flattening's direction"). As printed, the patch's slope doubles and those tiles sat 0.9 to 2.3 dB below; film's 5.1 centre sat 4.6 dB below in the top group of its first patch at 256 kbps, all of it lost to the limiter, and 10.9 dB below at 192. The immersive stereo legs, made from 5.1, are compared with the source's Lo/Ro downmix, which they must correlate with at 0.95 or better (IMS_CORRELATION) and do, at 0.977 to 0.984. DEE's 2.0 streams carry the same audio from 256 kbps up, the rest of each frame being fill, so those rates decode to the same samples. DEE's 5.1 streams at 96 kbps (ASPX_ACPL_3) and at 128 and 144 (ASPX_ACPL_2) code a pair of downmixes, and A-CPL makes the surrounds of them, and the centre in ASPX_ACPL_3, so they are scored as A-CPL rebuilds them. The coded downmixes, recovered from the output, meet the source's as waveforms below the crossover: in ASPX_ACPL_2 (L + Ls / sqrt 2) / 2 and its mirror, which the upmix keeps exactly, at 21 to 23 dB SNR on music, 17 to 20 on film and 48 on tones, and in ASPX_ACPL_3 the Lo/Ro downmix, which it keeps as closely as gamma's quantisation allows, at 22 to 25 dB on music and film; C in ASPX_ACPL_2 and the LFE are scored as they are. Per A-CPL parameter band and pair, (L, Ls) and (R, Rs), the output's level difference and correlation are held to the source's: over 2,048-sample frames their mean distances run 1.8 to 4.0 dB and 0.18 to 0.47, pinned band by band. Applying each frame's parameters a frame early or late takes the level difference's distance on music at 128 kbps from 2.6 dB to 3.8 and 3.6 (libs/ac4/ERRATA.md, "When A-CPL's parameters apply"). On the tone legs each tone is at least 15 dB over the others in its channel in ASPX_ACPL_2 and 8 dB in ASPX_ACPL_3: the parameters are per band, and a tone 44 Hz from a band's edge, L's at 331 Hz, reaches the next band, whose parameters serve another channel's tone. - librempeg on the same streams: its output is 736 samples earlier than this decoder's on SIMPLE and ASPX streams alike, the 352 of frame alignment and the 384 of history it does not delay by, and on SIMPLE streams the two agree to 83 to 90 dB SNR at unity gain, on each of 5.1's six channels as on stereo's two. Below an ASPX stream's crossover they agree to 83 dB where companding is off and to 33 to 35 dB where it is on, where this decoder's output is 0.5 to 0.9 dB closer to the source. Above the crossover they part: on DEE's 2.0 music and speech at 48 and 64 kbps, librempeg's A-SPX tiles sit 2.3 to 7.5 dB below the source's on average, and 10.1 dB on music at 64, where this decoder's sit 0.5 to 0.9 dB below, and 5.5. Over the whole band of DEE's 5.1 ASPX streams the two agree to 67 to 75 dB, and to 48 dB on film's centre, whose band above the crossover carries the dialogue. On the tone legs, where A-SPX adds noise alone, the two agree to 30 dB, noise included: they index the noise table alike. On DEE's 5.1 streams in ASPX_ACPL_2 librempeg puts out the coded pair as L and R and leaves Ls and Rs silent, so it is no reference for A-CPL.
The level check settled one question the text leaves open in phase D2: the pseudocode as printed,
without the factor of two its informative example mentions, decodes DEE's streams at unity gain with
full scale at 2^15. Phase D3 settled two more: A-SPX's envelopes read at that scale, and companding
measures its levels against full scale 1.0. Those and the other readings reconstruction takes are in
libs/ac4/ERRATA.md, under "Reconstruction" and "The QMF domain". None of the streams here, from DEE
or anyone else, sets b_snf_data_exists, so the noise fill is decoded from the text alone. A unit
test (libs/ac4/tests/decoder/test_noise_fill.cpp) holds its levels, escape and draw order to
Pseudocodes 22 and 23 on a hand-built track. The encoder's experimental.noise_fill writes it
since, and the decoder brings back a band the rate quantised to zero to within 2 dB of the
source's level and leaves a coded tone at unity gain (libs/ac4/tests/encoder/test_encoder.cpp),
which checks the decoder against a writer built from the same reading, not an outside one.
Locally, over the census. With AC4_GOLDEN_DIR and AC4_STREAM_DIR set, the same test
compares the decoder with the Python parser's digests of any other set of streams. Over the 107 DEE
streams of the local census (50,728 frames of 2.0, 5.1, 5.1.4 and immersive stereo) every digest
agrees, and every substream is read to its exact end or, for 5.1.4's audio, refused at the immersive
element, as it was before phase D9. Over the gold set's 527 AC-4 streams (G0's and G1's, 162,813
frames, 127 of the streams 5.1.4) every digest agrees and every substream is read to its exact end,
the immersive element's included. The same holds for the public channel-based streams other
encoders wrote: DASH-IF's Dolby
test vectors (2.0 and 5.1 at 25 and 29.97 fps), CTA WAVE's ca4s sets (2.0 at 30 fps) and Chromium's
channel-based and immersive-stereo test files, 6,670 frames in all, taken out of their MP4 and CMAF
segments with forge demux and kept out of the tree. Chromium's A-JOC file is refused at the same
table of contents by both. AC4_TRACE_DIR writes the decoder's full trace, one record per line as
frame substream bit_offset width value name, the shape ac4_syntax.py trace prints.
Where no stream reaches. No stream of DEE's reaches most of the syntax: noise fill, VARVAR framing,
time-interleaved A-SPX, the mono, 3.0 and 7.X elements, ASPX_ACPL_1 and A-CPL in a channel pair,
transmitted DRC gains, dialogue enhancement methods 1 to 3 and alternative presentations among it. The
constructed streams above reach the 3.0 and 7.X elements in the SIMPLE and ASPX modes, and every A-CPL
mode. tools/checks/ac4_syntax_differential.py reads streams made
for this through both transcriptions: DEE frames with one substream altered (a random tail from a
random bit, a few flipped bits, or a random codec mode), tables of contents for the channel modes no
encoder here writes over random payloads, and, with --inputs, a corpus fuzz_ac4_decode grew, which
reaches syntax random bits rarely do. Where both read a substream to its end their traces must agree
record for record, and where either stops they must agree up to that point; a table of contents the two
read differently is reported apart. It found a limit on variable_bits() groups in the decoder that
the text does not set, and fuzz_ac4_decode found an escape code the decoder did not bound.
Comparing the two transcriptions' notes found that they had framed ASPX_ACPL_1's residuals and
b_use_sap_add_ch's parameters differently, each against the channel mapping of Part 1 clause 5.3.4;
both now follow that mapping. The check shows that the two transcriptions read these paths alike,
which a shared misreading still passes.
The decoder's output processing¶
Phase D6 adds the sample rate converter for every frame rate but index 13, the output processing a
system configures through iclforge::ac4::OutputConfig (the output level and DRC, dialogue enhancement and the
downmix), and what the decoder does at I-frames, at a change of source and with a frame that does not
decode. Where the text leaves a choice open, the reading is in libs/ac4/ERRATA.md, under "Output
processing" and in "A change of source" and "What an I-frame does not restore".
- The sample rate converter (
libs/dsp/tests/tiered/test_resampler.cpp): over 100,000 frames at each of the decoder's three ratios and the encoder's inverses the output count is exact, frame by frame in Part 2 Table 47's sequence at the 1000/1001 rates and from any starting frame, and a converter whose phase jumps goes on converting at the new phase's counts. Tones in the passband come out flat to 0.001 dB with everything else 100 dB under them, and converting down, a tone between the two Nyquist frequencies comes out 100 dB down. DEE's immersive stereo at 23.976, 24, 25 and 29.97 fps decodes at Table 47's counts, andscore_ac4_decode.pyscores it as it scores index 13: each rate lags its source by a constant, within 1.3 samples of DEE's half frame plus the decoder's delay. Atfloatthe tables of the three ratios are the compiler's (D14a5,dsp/resampler_design.hpp): the FNV-1a image of each is pinned and equal to the C library's design rounded once tofloat, every coefficient of it; the phases the table keeps and the ones it reads backwards agree with each other and with a copy written out; the compiler's evaluation equals the same function run on the machine, bit for bit; and the dot product that reads a phase backwards equals the four-lane sum of that phase written out.libs/dsp/tests/tiered/test_portable_math.cppholds the functions the design calls without a library (sin, cos, sqrt, ceil and the Kaiser window's I0) to their definitions, to the C library's values and to their own values at compile time. - The output level and DRC (
libs/ac4/tests/decoder/test_drc.cpp): Table 162's profiles and the curves DEE transmits are the compression curves the text defines; stepped tones at steady state follow each profile's static curve within 0.5 dB, and a step in level moves the gain at the attack and release time constants. Table 161 chooses the mode for the output level. The output level gain equals 2^((Lout - dialnorm) / 6) to 0.01 dB on streams the encoder writes at dialnorms from -31 to -17. Transmitted gains apply by channel group, band and subframe on constructed data, and DEE's 5.1 stream compresses within its own curves in each mode it configures. - Dialogue enhancement (
libs/ac4/tests/decoder/test_de.cpp): at 0 dB the output is the output with the tool bypassed, sample for sample; at the stream's cap the channel-independent method, its mid and side form and the cross-channel method apply the gains their parameters give to 0.01 dB on known input, and a frame's matrix moves to the next slot by slot. DEE's speech comes out raised at its cap and unchanged at 0 dB. - The downmix (
libs/ac4/tests/decoder/test_downmix.cpp): Tables 149 and 149a give the mix gains, 5.1's downmixes are Table 218's with the stream's gains, the LFE and the loudness corrections, 7.X folds to 5.X by Table 219 for each additional pair, and 3.0, stereo and mono take Table 217, the sum and the 0.707 upmix; the gains hold from the frame that sends them until another does. DEE's 5.1 tones come out of each downmix at the stream's gains to 0.01 dB. - The gains on DEE's streams (
tools/checks/gain_ac4_decode.py): each stream decoded as coded and again at output levels of -31, -24 and -17 dBFS with DRC off gives the coded output times 2^((Lout - dialnorm) / 6) to 0.01 dB, with what is left beside that gain 100 dB down; each 5.1 stream's two-channel, Lo/Ro, Lt/Rt and mono outputs are clause 6.2.17's matrix, with the stream's own values read from its syntax trace, applied to its coded output, to 80 dB. Both hold to the output's rounding. FFmpeg Validate runs the committed streams, dialnorms from -26 to -16 dBFS; locally the 115 legs of the gold set, dialnorms from -24 (the ATSC A/85 preset) to -16, with DEE's own Lo/Ro and Lt/Rt gains, each preferred downmix method and Lt/Rt's Pro Logic II form. DEE's immersive stereo at 24 and 25 fps sends a dialnorm of -24 dBFS in its last frame, so the checks stop before it. - Start-up, splices and damaged frames (
libs/ac4/tests/decoder/test_decoder.cpp): decoded from each of their I-frames, the committed streams give the whole stream's output from the frame after the I-frame, whose own audio overlaps a frame the decoder never had: to under -100 dBFS in SIMPLE, to -50 dBFS in ASPX, whose noise and tone generators run at another phase, and in A-CPL within -54 dBFS by the fourth frame, as its decorrelators settle. Spliced at an I-frame, marked 0 or with the counter jumping, two streams come out as each decodes alone, the first up to the joint and the second from the frame after it, overlapping across the joint frame; spliced between I-frames, the output resumes at the next I-frame as the second stream decoded alone. At 29.97 fps the counts follow the new counter's phase across a jump and the old sequence across a 0. Under either concealment policy each of three damaged frames in a row comes out at its length with the damage reported, and the output is the undamaged decode's up to the lost audio and again from the second good frame after it; muted frames are silent, repeated ones fade by more than 20 dB a frame, and a frame whose table of contents does not read keeps the stream's counter and the converter's counts.
Dolby's Online Delivery Kit streams¶
Dolby's AC-4 Online Delivery Kit (1.5, from ott.dolby.com) has a folder of test streams,
Test_Signals/elementary_streams/Audio, that Dolby made to check playback and content-creation
products. The kit is Dolby's, so none of it is committed; tools/checks/check_ac4_kit_streams.py
reads the folder from ICLFORGE_DOLBY_AC4_KIT_STREAMS and prints SKIP when the variable is unset.
Audio.zip, beside the folder, holds the same 14 files, byte for byte (SHA-256 compared member by
member).
| File | Bytes | SHA-256 |
|---|---|---|
Audio_ID_2ch_64kbps_25fps_ac4.ac4 |
263,586 | cb6c8cd2fa7a6ac3225e98663a84088b0df52bc89ba8754b540f30c5b34d5b4e |
Audio_ID_2ch_64kbps_2997fps_ac4.ac4 |
265,240 | 68a99f710967fb8fe007ac3bae9696cbf6851220ab74afafaa56ebf5743b9663 |
Audio_ID_514ch_192kbps_25fps_ac4.ac4 |
773,600 | aacf8e50363def6ae7d2d89e595ff4d3319096a8209b74ddbe4d78fa2b35faff |
Audio_ID_514ch_192kbps_2997fps_ac4.ac4 |
775,488 | 958b18e481ed88bd1ecbd5f772076920f8259ca8c3f14ffbe2a4c29f854ffdc3 |
Audio_ID_6ch_128kbps_25fps_ac4.ac4 |
520,816 | 5634921ddb5b14e32dce026f13a80b1e31d349059eb898f369c9350ac5616855 |
Audio_ID_6ch_128kbps_2997fps_ac4.ac4 |
522,319 | 6de4fb2662a3122d377f66df47f8566b3221eba8053d5c3653f867d7ce510a11 |
Audio_ID_ims_112kbps_25fps_ac4.ac4 |
452,800 | 714b599950526c207144c57915dbf2e2dcf58c5c675cf47bab984c1755cb7ebf |
Audio_ID_ims_112kbps_2997fps_ac4.ac4 |
454,208 | 772c24599837598879f60316f1c496191e4a71515dd0d0c776a63e61ad779292 |
Holi_en_6ch_128kbps_25fps_ac4.ac4 |
1,374,688 | 1b43b761e10909da9b1b16d4c1f8433cd26b73ebbf00aee04153795e867eded5 |
Holi_en_6ch_128kbps_2997fps_ac4.ac4 |
1,377,740 | 8c3451f20fc4b916e80ae375b21188ddf35e3f65b1068da26770845b70fbd6be |
Holi_fr_6ch_128kbps_25fps_ac4.ac4 |
1,374,688 | 33f4c6331485e773ad96bcb9a53a156b7710c82ba8486d57b84178ed552779fc |
Holi_fr_6ch_128kbps_2997fps_ac4.ac4 |
1,377,740 | 83484674fa8389b3ab01dcac25e753c91490d243c6a8674c13bff084e30dbc0c |
Audio_ID_6ch_256kbps_ddp.ec3 (E-AC-3) |
1,024,000 | 62b463a20ab6ef89562c198ad451f3ae5badb80049f7293cc8312029b1bf764e |
Audio_ID_2ch_64kbps_aac.aac (AAC, not read) |
256,238 | c81f7b3d189150fdd5a505ba27c01596850130b35dc9f06b1f643e21202184c7 |
Audio_ID_* is a 32 s programme, 800 frames at 25 fps or 960 at 29.97, in 2.0, 5.1, 5.1.4 and
immersive stereo; Holi_en and Holi_fr are one 5.1 programme in two languages, 2,128 or 2,552
frames. The sync words are 0xAC41 except in the 5.1.4 pair (0xAC40, no CRC), and the frame size is
the two-byte form in the immersive stereo and Holi streams and the 0xFFFF escape with three more
bytes in the rest, on frames of 330 to 970 bytes. The kit comes with no PCM and no second AC-4
decoder is installed, so the decode is not scored against a known answer. The check holds it to what
the streams and their siblings make checkable, 134 lines over the 12 AC-4 streams, none failing:
- forge decodes every frame, the CRC of every frame is valid, the sample count is the frame count times the frame length at the stream's exact rate (30000/1001 at "29.97"), no sample is NaN or over full scale, and the programme is not silent.
- The WAV has the channels the decode reports, and those are the channels the probe names, in the same order. (The probe once named 12 channels for a 5.1.4 stream, Table 56's 7.1.4 with Lb and Rb, where the decode writes 10; it lists the source layout's now, and the check still accepts the decode's names as an ordered subset of the probe's.)
- The LFE holds at most 0.04 % of its energy above 200 Hz; the four heights of 5.1.4 carry signal in 88 to 89 % of the loud windows; the immersive stereo and the 2.0 streams are not dual mono.
- The integrated loudness (BS.1770-4, measured with its own K-weighting) of every 2.0 and 5.1 decode is within 0.2 LU of the LKFS the stream declares (immersive stereo -18.4 against -18.5, the rest -23.1 or -23.2 against -23.0). The 5.1.4 pair declares -16.0 and is not measured: BS.1770 gives heights no weight.
- The 25 and 29.97 fps versions of a programme match in level per channel to 0.5 dB,
Holi_enandHoli_frcorrelate above 0.98 in every channel but the centre (0.04), andAudio_ID_6ch_256kbps_ddp.ec3decoded by forge lines up with the AC-4 5.1 stream at a 1,982-sample lag, with the same loud and quiet stretches in every window and a centre at 0.9967 and an LFE at 0.9957 correlation. Its L, R, Ls and Rs correlate at 0.87 to 0.92, which two lossy codings at 256 and 128 kbps can account for; that is a measurement and not a proof that those channels are right. Forge's decode of the E-AC-3 file and FFmpeg's, run once with both DRCs off, agree at lag 0 and at 0.9995 to 1.0 per channel but are not the same samples (the difference is 57 to 94 dB below full scale; the stream uses dither and spectral extension in nearly every block, and the cause was not isolated). Nothing here rests on that comparison.
The immersive stereo pair did not decode before this check: Dolby labels immersive stereo made from
Dolby Atmos content channel_mode 0b1111001, and the decoder read only 0b1111000 as stereo. The
reading, the evidence and the test (which builds the second kind from a DEE stream by setting one
bit per frame) are in libs/ac4/ERRATA.md, "presentation_version 2 is read as immersive stereo".
No signature, no protection. The kit does not say its streams are signed and a stream's
content_signature trailer would show in three ways, each checked. Each of the 12 AC-4 files is a
whole number of sync frames, found by walking sync_word, frame_size and the CRC of a 0xAC41 frame
from byte 0 to the end of the file, with no byte after the last frame; a trailer, which
signing appends there, would leave bytes. None of the 14 files holds the
content-signature UUID (as text or as 16 bytes), pace-ccjf1, ecc_r_value or ContentSignature.
Nor does any of the 538 DASH, HLS and MP4 files fetched from the kit (audio-only DASH and HLS, and ten
MP4 examples with video) hold those markers, a protection box (sinf, schm, schi, tenc, pssh,
senc, enca, saiz, saio, frma) or manifest signalling (EXT-X-KEY, ContentProtection,
cenc:default_KID, urn:mpeg:dash:mp4protection). The streams are neither signed nor encrypted, so
they test the decoder and not the verifier or the CENC reader.
Carriage. The kit's topics codec_c_ac4_sync_frames, ac4_c_raw_ac4_frame and
ac4_in_mpeg_dash_c_mp4_samp say that an elementary stream (and HLS packed audio) is AC-4 sync
frames, with a two-byte frame size or 0xFF 0xFF and three more bytes, and that an MP4 sample is one
raw AC-4 frame, so it has no sync word, size or CRC. The files agree. Decoded by forge, the DASH Live
files (init segment and media segments joined, which make a fragmented MP4), DASH On Demand and HLS
fMP4 audio of each of the 12 streams, and the ten MP4 examples (H.265 video at 720p, 25 to 59.94
fps, plain and fragmented), give the same samples, to the last bit, as the elementary stream.
Forge cannot read the 12 HLS packed-audio files (HLS/Audio_ID3/*_sub.ac4). Each has an ID3v2 tag
before every segment, 200 frames at 25 fps and 240 at 29.97, and forge, finding no AC-4 sync word at
byte 0, tries the file as AC-3 and stops. With the tags skipped, the frames are the elementary
stream's, byte for byte. The gap is in format detection and not in the decoder.
A second source: Dolby's Spott reference files. Thirteen audio-only MP4 files from Dolby's public test
application (not in the kit, not committed, local only), each a codecs string in its name: four E-AC-3
(OTTEP00104 to OTTEP00107, ec-3: stereo, 5.1 and Atmos JOC 5.1.4 and 16 objects) and nine AC-4. The
full SHA-256 of each:
| File | SHA-256 |
|---|---|
OTT00232_ac-4-02-01-03.mp4 |
5be9f9cd8a3677ae57aa764b851ea6e000e50b31c709aa30229649c326dda4fd |
OTT00234_ac-4-02-01-01.mp4 |
fbff5c71109be23f887f515540754a0f29587080fb2289daf6b77f16d84c0738 |
OTT00236_ac-4-02-01-02.mp4 |
7c11949f25ca7c3a34ed7858d66876ef0987945f8ad00381b636ecd26a57290e |
OTTEP00104_ec-3.mp4 |
3094de6b7b70e1be7a8175d7368d265ef0247afc082672adbaa52bbf2dec1dd0 |
OTTEP00105_ec-3.mp4 |
150f99900ecbe00e5ceab707387689f9d50b2a87bcbe0f535b76b84e81fe5d5e |
OTTEP00106_ec-3.mp4 |
49bba472ab6b6e77e263766334d7b17a9a2d6170a68360b851c4cb7b5754d96e |
OTTEP00107_ec-3.mp4 |
9f901a50d1e8d86935ae55bc9ceb1af1df8f38f3c6a042bbae2bbdc3e296f15b |
OTTEP00124_ac-4-02-02-00.mp4 |
2476c74cf1571fdd317d3c784e3170782992b39186fd7555405a6713ed92f012 |
OTTEP00125_ac-4-02-01-02.mp4 |
8f52849d67cfde99ea002709d5ae9511fa7d82c1922a48fafe7687737289f716 |
OTTEP00126_ac-4-02-01-00.mp4 |
62714617e177366413afbe41f2ed05a8dddc131934dcd7e6b5a24df96dcd1943 |
OTTEP00127_ac-4-02-01-01.mp4 |
08d7efce67fcbd4652603263f972cd6877229aa4bdb45a1ea71f3c89306b8f2e |
OTTEP00128_ac-4-02-01-03.mp4 |
6ac2f5887a5122e83849d160233cfa7fa480dad50363e86fcd76ac7cc6b76d42 |
OTTEP00129_ac-4-02-01-04.mp4 |
deb68aa1d5f60b8f7ef4edddc7ce1a192d1b05fc15c0e34a7fef61c7cd42376d |
| AC-4 stream | Result | Evidence |
|---|---|---|
OTTEP00124 (02-02-00, immersive stereo), OTTEP00126 (02-01-00, 2.0), OTTEP00127 (02-01-01, 5.1), OTTEP00125 (02-01-02, 5.1.4), OTT00236 (02-01-02, 5 presentations) |
decode in full | 800 frames each (2,000 for OTT00236); per-channel levels plausible |
OTT00232 (02-01-03, A-JOC 7 downmix + 9 upmix) |
decodes in full since 2026-10-29 | 2,000 of 2,000 frames; it decoded the 80 I-frames before |
OTTEP00128 (02-01-03, "OBI L3", 16 objects) |
decodes in full since 2026-10-29 | 750 of 750 frames; it decoded 32 before; traces of the two transcriptions agree |
OTTEP00129 (02-01-04, "OBI L4", 5 downmix + 20 upmix) |
decodes in full since 2026-10-29 | 4,450 of 4,450 frames, 21 objects; traces agree; refused before as no selectable presentation. Its 7.1.4 render peaks at +1.5 dBFS in float: the renderer is not normative, and check_dolby_spott_streams.py notes it and does not fail |
OTT00234 (02-01-01, 4 presentations over one pair of dialogue objects) |
decodes in full since 2026-10-29 | 1,861 of 1,861 frames; it stopped at frame 1 ("tools_metadata_size does not match") because the pair's metadata is read as stereo's, as audio_data_objs() sets the channel mode (libs/ac4/ERRATA.md) |
The four E-AC-3 files decode in full (the integration build's run), and the stereo and 5.1 ones agree
with FFmpeg's decode at lag 0, at 23.8 and 27.9 dB overall (FFmpeg's default dynamic range control on,
forge's off) and at 31.7 and 33.1 dB with both off, which is the range this project's dither-on
third-party E-AC-3 streams give and not a failure. Dolby's muxer (Bento4 here) writes channelcount 2 in
every ec-3 sample entry, the 5.1 and JOC files included, so a reader must take the channel count from the
stream and not from the sample entry. tools/checks/check_dolby_spott_streams.py reads them from
ICLFORGE_DOLBY_SPOTT_STREAMS (SKIP when unset): every access unit decoded and none left waiting for an
I-frame, the sample count, the channels, no NaN or clipping, not silent, no signature or protection marker,
and as notes the sample entry's channel count and FFmpeg's agreement.
The decoder's presentations¶
Phase D7 adds the choice among a stream's presentations (Part 2 4.8.2) and the mixing of a
presentation's substreams (Part 1 6.2.16, Part 2 4.8.3.15 to 4.8.5). DEE writes no stream of several
presentations or substreams, so a test multiplexer (libs/ac4/tests/decoder/mux.hpp) builds them from
DEE's 5.1 and 2.0 tone legs and the encoder's mono and stereo tone streams
(tools/generators/gen_ac4_presentation_sources.py), each substream carrying tones of its own, and
writes their tables of contents with the encoder's writer. Where the text leaves a choice open, the
reading is in libs/ac4/ERRATA.md, under "Presentations".
- The selection (
libs/ac4/tests/decoder/test_presentations.cpp,tools/checks/test_ac4_presentation_selection.py): a table of 30 cases, each a constructed table of contents of version 0 or version 1 presentations, a system's choice and a level, committed astestdata/ac4/presentations/presentation-selection.tsv; the decoder and the Python reference (tools/references/ac4_presentations.py, written from the text separately) select as the table says. - The multiplexed streams (
testdata/ac4/presentations/): music and effects with dialogue, main with associated audio, both, by content classifier and at every pan; main substreams whose dialogue enhancement is a hybrid method, with their dialogue enhancement substream; and version 0 presentations, whose substreams carry their own dialnorms. The committed bytes are the builder's, both transcriptions read every frame to its end, and the Python parser's digests are beside the others intestdata/ac4/. MediaInfo reads their tables of contents, 17, 9 and 10 presentations, and flagstools_metadatawhere a substream sends the Mid's one parameter set (the errata register, "de_ms_proc_flag leaves one parameter set"). - The mixes: in the decoder's tests each substream's tones come out of each mix at their formula's
gain to 0.01 dB and 60 dB under that everywhere else, and the formula applied to the substreams
decoded alone leaves the whole output 100 dB under it or more.
tools/checks/mix_ac4_decode.py, in FFmpeg Validate, reads each stream's gains, pans and dialogue enhancement fromforge's syntax trace and fits each output channel on the substreams decoded alone: over 68 mixes (the three streams, g_dialog and g_assoc at 0, -6 and -10 dB and +9 dB, and at an output level of -31 dBFS) every coefficient equals its formula to 0.01 dB, and the formula leaves the output 110 dB under it or more. Mono associated audio pans to 330, 0 and 30 degrees as Table 216 has it, and at 0 degrees into 2.0, 0.5 to each side. A decoder that divides by the number of substreams, or pans at constant power, fails these checks. - A lost frame: a mixed presentation conceals a frame whose table of contents does not read, with all of its substreams, and goes on.
- librempeg (git 2026-09-24): of a presentation it decodes the first group's substream alone,
whichever presentation
-presentationnames, so its output has no dialogue, associated audio or dialogue enhancement waveform in it; that substream agrees with this decoder's to 85 dB. It refuses every frame of a table of contents of more than 16 presentations, which the 5.1 stream's 17 are, puts out silence for 15 and 16 presentations over 22 and 23 substreams, and refusesbitstream_version1 ("not yet implemented"), which the version 0 stream is. Part 2 bounds none of these counts.
The decoder's 9.X.4 modes¶
The 9.X.4 modes (Part 2 6.2.4.1 with b_5fronts) have no oracle outside the project. Five constructed
streams (testdata/ac4/constructed/9_*.ac4) carry a distinct tone per channel; both transcriptions
of the syntax read them to the same digests, and the decoder puts each tone on its channel in full and core
decoding. The differential check compares the transcriptions on 600 streams. Unit tests hold S-CPL, A-SPX
gains, A-CPL's six modules, the core dialogue enhancement interpolation, the renderer's 9.X rows (a second
transcription, as printed) and DRC's groups, and each was mutation-checked. The float and fixed-point
agreement floors are in testdata/ac4/scalar-agreement*.json. These show the decoder does what the
readings in libs/ac4/ERRATA.md ("The 9.X.4 element") say, not that they are what an encoder meant.
The decoder's 22.2 element¶
The 22.2 element (Part 2 6.2.4.3, Tables 8 and 21 and Annex A.3) has no oracle outside the project: DEE does not write it, no stream of it is public, and librempeg does not decode it. What checks it is the standard's own tables and the project's two transcriptions:
- The syntax, in both transcriptions (
libs/ac4/tests/decoder/test_channel_elements.cpp,test_syntax.cpp): the element in SIMPLE and ASPX, with 24 tracks, elevenaspx_data_2ch()and the stereo flags of each pair, and two constructed streams (22_2-simple-alternating,22_2-aspx-unit7-lr) whose digeststools/references/ac4_syntax.pywrote and the decoder reproduces.ac4_syntax_differential.pyincludes the channel mode among its synthetic tables of contents. - Each tone on its channel (
libs/ac4/tests/decoder/test_constructed.cpp): the 24 tones are coded by the test's own transcription of Table 21, with every pair's stereo processing on, off and alternating, and each decodes on its own channel in Table A.27's order, the LFEs included, 60 dB over the others. A-SPX fills the two channels of theaspx_data_2ch()that asks for it and no other, by Table 8's pairs. The refusals (core decoding and everyDownmixTargetbut as coded) are tested by name. - DRC and levels (
libs/ac4/tests/decoder/test_drc.cpp): transmitted gains apply by Table 69's four groups to the 24 channels, and neither LFE moves the level detector.
These show that the decoder does what the readings in libs/ac4/ERRATA.md ("The 22.2 element") say,
not that they are what an encoder meant.
The decoder's immersive element¶
Phase D9 adds the immersive channel element of 7.0.4 and 7.1.4 (Part 2 6.2.4 to 6.2.6, and 5.2 to
5.6 for its tools), in full decoding and in core decoding, and Part 2's channel renderer (5.10.2),
which takes it to the layout a system asks for. Where the text leaves a choice open, the reading is in
libs/ac4/ERRATA.md, under "The immersive element", "Immersive decoding" and "The channel renderer".
- The syntax, in both transcriptions: the element,
immers_cfgand A-JCC'sajcc_data()with Annex A's codebooks, in the decoder and inac4_syntax.py. DEE's three 5.1.4 legs (G1's, one per immersive codec mode DEE writes) and five constructed streams carry the Python parser's digests, which the decoder reproduces, and 3,000 mutations of them find the two transcriptions agreeing. - DEE's 5.1.4 legs, as coded (
libs/ac4/tests/decoder/test_pcm.cpp,score_ac4_decode.py): DEE's 5.1.4 is 7.1.4 with its back channels silent, which the decoder gives as 5.1.4. SCPL at 768 kbps and ASPX_SCPL at 512 put each of the ten tones on its own channel to 0.02 dB (the LFE 0.26 dB down, DEE's low-pass), 50 dB over every other channel. ASPX_ACPL_2, at 192 to 448 kbps, codes each top pair's sum and A-CPL makes the pair, so a top tone spreads over its pair and the pair's sum carries it at its level; the other channels are coded channel by channel. In core decoding each tone lands on its core channel: L, R, C and the LFE as in full decoding, Ls and Rs at 0 dB (Table 45's +3 dB over the core's -3 dB, the source having no backs), and each top pair's two tones in its top side channel at -3 dB, to 0.2 dB. The scorer holds each leg's channels to the source's, the top pairs of ASPX_ACPL_2 as their sums and core decoding's to the source's 5.1.2 by Table 42, below the lowest A-SPX crossover or, in SCPL, which codes to about 17 kHz, below 16 kHz, over the committed three and 54 of the gold set's (G0's tones and music at every rate and its height legs, G1's film, speech, sweeps and transients at every rate), in both modes: every leg lags by 4,385 samples, as the 2.0 and 5.1 legs do, every channel sits within 0.25 dB of unity (0.21 dB down in film's sides at 192 kbps, the most), and each tone leg's tones are 64 dB over the others in their channels. G1's noise legs are left out: white noise codes at 7 to 13 dB SNR, and its level falls 0.3 to 0.7 dB with the bands the encoder leaves empty, at every rate. - The constructed streams (
libs/ac4/tests/decoder/test_immersive.cpp): the element in its five codec modes, everycore_5ch_groupingand2ch_mode, step 4's and Table 20's parameters and 7.1.4 with its back channels, built with the encoder's writer from tones worked back through S-CPL, A-CPL or A-JCC by the text; each decodes with every tone on its own channel, and in core decoding on its core channel at the core's gain. A-SPX fills the channels Part 2 Table 8 pairs, the first of a coupled pair alone in core decoding. - A-JCC on known input: its full and core reconstructions (Part 2 Pseudocodes 8 and 12) equal the printed sums on known QMF input, in both core modes, to 1e-9.
- The renderer (
libs/ac4/tests/decoder/test_renderer.cpp): Tables 38 to 43, 45 and 46, transcribed again in the test, hold against the renderer's matrices for every input and output configuration, each custom downmix gain a distinct value, so that one in the wrong place shows; Table 130's defaults, 6.3.10.3.10's exception, the persistence of the custom downmix data and the loudness corrections, and the steps to two channels and one after 5.X.0 hold on their own. DRC's transmitted gains take Part 2 Table 69's groups (test_drc.cpp). - The renders on DEE's streams (
libs/ac4/tests/decoder/test_pcm.cpp,gain_ac4_decode.py): each render's tones equal the renderer's matrix applied to the as-coded decode, to 0.01 dB, in full decoding to 5.1 and to Lo/Ro in the tests, and in the gain script to every layout the renderer gives, in full and core decoding, with the stream's custom downmix data, its stereo coefficients and its corrections read from the syntax trace: what the matrix leaves is 149 dB under the output, its rounding. FFmpeg Validate runs the committed legs; locally 77 of the gold set's, G1's 23 height downmixes among them, which send custom downmix data from 0 dB to silence in I-frames alone, its 24 stereo downmix legs and its film at every rate, and G0's 22. - librempeg (git 2026-09-24) does not decode the element: on the 5.1.4 tone legs its L, R and C come out 6 to 9 dB down, its surrounds 12 to 15 dB down, all four top tones in its Lb at about -15 dB, and its top channels silent.
- Dolby's AC-4 Online Delivery Kit 1.5 (local only): its two 5.1.4 streams, ASPX_ACPL_2 at 192
kbps at 25 and 29.97 fps, decode in full and core decoding with
forge, every frame (800 and 960) with no error, to ten channels as coded and eight in core decoding, 1,920 samples a frame and 1,601 or 1,602.
The decoder's API and packaging¶
Phase D8 gives the decoder's API its form for channel-based streams, reports
what a stream carries through it, and installs the inspector, the decoder and the core
(AC-4 decoding). The tests are in libs/ac4/tests/decoder/test_api.cpp unless
named otherwise.
- Through the public API alone: a test standing in for Hearth's engine decodes every committed
AC-4 stream (those under
testdata/external-baseline/ac4-*andtestdata/ac4/: 66 today) by block throughiclforge/ac4/decoder/decoder.hppalone, placing each block's channels by their speakers and changing the output level and dialogue enhancement half way through. No frame is refused, only a frame before a stream's first I-frame comes out empty, a stream ends in one short block at most, and the output equalsdecode()'s configured the same way, sample for sample. Pointed at a directory of local streams withAC4_API_STREAM_DIR, the same test reports how many decode and counts the refusals by reason. When phase D8 wrote it, before the immersive element and the objects were decoded, it decoded 406 of DEE's 533 local streams and refused the 127 5.1.4 ones by name, and of 13 third-party streams it decoded 12 and refused the A-JOC one; The decoder's objects has the count now. - By block:
decode_by_block()hands over the same samples asdecode()in blocks of 256, on 2 048-sample frames and on the 2 000-sample and alternating 1 601/1 602-sample frames of 24 and 29.97 fps, and a change of layout hands over what it holds first, as a shorter block. - While a stream plays:
set_output()at a frame that is not an I-frame loses no frame; the output before it is the old configuration's and from two frames after it, once the control data has reached the QMF domain, the new one's, sample for sample. A decoder built afresh at the same frame puts out nothing until the next I-frame, which is why Hearth's rebuild-and-prime cannot serve AC-4.set_presentation()switches presentation from the next frame, and three frames later the output is within 1e-4 of the peak of a decoder that decoded that presentation from the start. - Reports:
presentations()lists the 17 presentations of the multiplexer's 5.1 stream with their members and languages;metadata()holds, after the last frame of five DEE streams, the last value the syntax trace shows for each element it reports, and at an output level of −20 dBFS names the flat panel TV mode as the one applied;latency_samples()equals the delay the encoder counts on at every frame rate, 1 313 samples at index 13. - A presentation name in chunks (Part 2 clause 6.3.3.1.4): 14 cases of frames' name bytes and
the name they give, committed as
testdata/ac4/presentations/presentation-names.tsv, which the decoder andtools/references/ac4_presentations.pyboth reproduce (tools/checks/test_ac4_presentation_names.py); the reading is inlibs/ac4/ERRATA.md, "A presentation name in chunks". - The splitter (
libs/ac4/tests/io/test_splitter.cpp):iclforge::ac4::SyncFrameSplitterhands over the framesiclforge::ac4::scanfinds in three committed streams fed in pieces from 1 byte to 64 KiB, skips and counts what is not a frame before and between frames, drops a partial last frame, reports storage too small, and reads an escaped frame size.fuzz_ac4_parseholds it toiclforge::ac4::scanon every input, at two storage sizes, andfuzz_ac4_decodechanges the output and the presentation half way and alternatesdecode()withdecode_by_block(). - The package (
tools/checks/check_install_consumer.sh, in the shared-library pass of the Linux LLVM leg, which runs nightly): each tree it installs, with both linkages, shared and static-only, is consumed by a C++ program that decodes a committed stream through the installed inspector and decoder, linked throughfind_package(iclforge)for each exported decoder target and again throughpkg-config --cflags --libs iclforge-ac4. Every installed archive links whole with nothing undefined, and each.pcnaming one links its archives whole on its own.
Four items of the review of #700 have a test each, and each test failed before its fix:
- The syntax trace's lifetime.
DecoderConfig::syntaxheld only its callable's address, so a lambda written in place, in a class's constructor in phase D7, was gone before the first record and crashed MSVC's Release build.iclforge::ac4::SyntaxTracenow owns a copy, and the decoder and the encoder keep one of their own;iclforge::ac4::SyntaxSink, the non-owning reference the readers hold, no longer compiles from a temporary. The two tests of the copies ("a decoder keeps its own copy of the syntax callable it is configured with", and its encoder twin) fail at their first check with a non-owning trace, and static assertions hold the rest. - One error for a Huffman miss. A codeword the substream ends inside was
kTruncatedin A-SPX, A-CPL and dialogue enhancement andkInvalidStreamin the audio spectral frontend. Every tool now reads its codewords through one function, and a codeword cut short iskTruncatedwhichever tool reads it (libs/ac4/tests/decoder/test_asf.cpp, each ASF codeword and each codebook's longest codeword). - An HSF extension substream nothing claims used to go unreported. Every substream of
substream_index_table()is in the frame's report now, and one that no element of the table of contents names is refused as unread (libs/ac4/tests/decoder/test_decoder.cpp,libs/ac4/tests/decoder/test_frames.cpp). - Android, WebAssembly and the Python wheel compiled the AC-4 library and linked nothing of
them. Each turned
ICLFORGE_BUILD_AC4off until phase I4 bound them, andtools/checks/test_ac4_build_configurations.pyreads the configurations: the wheel and the WebAssembly module now link AC-4, the Android app builds the libraries and its CMake wrapper links none, and the minimum-footprint profile takes the decoder throughICLFORGE_MINIMAL_AC4.
The decoder's objects¶
Phase D10 adds object audio (Part 2 4.8.3): A-JOC substreams in full and core decoding (5.7),
direct-coded objects, their object audio metadata (6.3.9, 5.9) and the intermediate spatial format
renderer (5.10.3). Where the text leaves a choice open, the reading is in libs/ac4/ERRATA.md,
under "Object audio syntax", "A-JOC" and "Object audio metadata and the ISF renderer".
- The syntax, in both transcriptions:
audio_data_ajoc()withvar_channel_element()andajoc(),audio_data_objs(), the metadata of 6.2.8 andoamd_substream(), in the decoder and inac4_syntax.py, each read against what the encoder's writer wrote, record for record, on constructed streams of everyvar_channel_element()shape (one to seven signals, SIMPLE and ASPX, eachvar_coding_config, with and without the LFE). Eight of them are committed with the Python parser's digests, and the differential check mutates them. Chromium'sac4-ajoc.ac4, the one encoded A-JOC stream here, reads to the end of every substream of its 64 frames in both. - A-JOC on known input (
libs/ac4/tests/core/test_ajoc.cpp): Table 28's bands, Tables 29 to 32's dequantisation, Pseudocode 16's differential decoding, the ramp of Pseudocodes 17 and 18 over one and two data points and across frames, the decorrelation input matrix of objects of different band counts, the wet path against the decorrelators and duckers run by hand, and dialogue enhancement in both modes, each against its formula. - The constructed streams (
libs/ac4/tests/decoder/test_objects.cpp): each object's coefficients are whole quantisation steps, so each object is a known sum of the downmix's tones; in full decoding every object carries its tones to 0.1 dB and no other, through Pseudocode 14a's order, several bands, two data points, differential decoding in time and an object not present, and in core decoding every object is its downmix signal, or the static bed's channel. Direct-coded dynamic objects, a 5.1 bed and an SR3.1.0.0 intermediate spatial format, over two substreams with an OAMD substream, carry their own tones. Each block's update comes out at its sample plus the decoder's delay of 1,313 samples, with the position 6.3.9.8.4 gives it, differences and extended precision included. Dialogue enhancement raises A-JOC's dialogue object by 10^(G_DE/20) in full decoding and adds its share to the downmix in core decoding, and a direct-coded dialogue substream's objects by the same gain, each capped by the stream. - The intermediate spatial format: rendered to 7.X.4, 7.X.2, 7.X.0, 5.X.4, 5.X.2, 5.X, two channels and mono, each object's tone reaches each speaker at its coefficient in the attachment's matrix, and 5 dB up where its metadata sets that gain.
- Chromium's
ac4-ajoc.ac4(a local test,AC4_AJOC_STREAM): every frame decodes in both modes, seventeen objects in full decoding and ten in core, the kinds and speakers its table of contents lists, each a frame long and finite, its updates inside the frame and in order. Its metadata puts every object at the front of the room on the floor (X 0.5, Y 0, Z −1) in every frame. The public API's engine test decodes it and the other 15 third-party streams, 16 of 16. - Rendered (
libs/ac4/tests/decoder/test_object_render.cpp):forge decode's rendering, through the layout renderer Hearth plays E-AC-3's objects with, puts each tone at each speaker at the sum of the objects' components at the gains the layout renderer gives their positions, frame by frame, in full and core decoding, as object 0 crosses the front from the left wall to the right. Whether it sounds right is for a listener to judge, on ten-second versions the test writes withAC4_DECODER_WRITE_LISTENING. - No second decoder. librempeg (git 2026-09-24) refuses every object substream ("object coding is not implemented"), Chromium's and the eight constructed ones alike, and DEE's A-JOC encoder takes no master this project writes, so no reading here rests on another decoder.
The decoder in float, and on small targets¶
Phase D14a gives the decoder's arithmetic a scalar seam: ICLFORGE_DECODE_SCALAR builds the
transforms, QMF banks and the A-SPX, A-CPL, A-JCC and A-JOC kernels of libs/ac4/src/core and
libs/ac4/src/decoder/pcm in double, the default, or float, and phase D14d adds fixed
(Fixed32 with a block exponent per transform block and per QMF slot). The encoder is double in
every build. What is checked:
- The float decode against the double one (
tools/checks/check_ac4_decode_scalar_snr.py, in FFmpeg Validate; the floors are intestdata/ac4/scalar-agreement.json): every committed AC-4 stream, 67 with the GUI's fixture, is decoded by a float CLI and a double CLI, and the float decode is held to the double one in two regions, below the lowest A-SPX crossover and above the highest, by the worst channel's SNR over half-overlapped Hann frames of 2 048 samples. When the floors were pinned, below the crossover the two agreed to 109.4 to 136.0 dB (132.1 to 136.0 on DEE's streams), and above it to 37.5 to 102.1 dB where a stream has A-SPX (47.2 to 102.1 on DEE's; the constructed streams, whose payloads are random, and the A-SPX object streams are the low end). The floors are 3 dB under those figures. The high band is where the builds part, and the cause is open: accumulating the predictor's covariances indoublein a float build moved no figure by 0.1 dB on eight of the streams, so the prediction is not it. MSVC, GCC 16 and Clang 22 agree to 0.1 dB. The check says the two builds agree, not that either is right. - The scorers with a float CLI: FFmpeg Validate runs
score_ac4_decode.pyandscore_ac4_encode.pyagain with a float CLI, at the same pins, and the encoder's streams are decoded by the float decoder. - What the scalar work moved: 61 of the 66 streams under
testdatadecode with a few samples different in the float32 output, by at most 2.3e-10 (about −193 dBFS), and the encoder's output is byte-identical on the five encodes checked, so nothing of the encoder's was re-pinned. - The bare-metal probe (
tools/checks/run_baremetal_probe.sh --ac4, in the ESP lane'sbuild-footprintjob, which the run after a merge lights for a change to the lane's trees (CI lane partitions) and the nightly run lights always): six committed streams (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 with companding;firmware/baremetal/ac4_fixture.hpp, made bytools/generators/gen_baremetal_ac4_fixture.py) decode in float on the Cortex-M3 leg under QEMU with each channel's level checked, and the image, the peak heap, the allocations a frame, the stack and the bytes retained after teardown are held to ceilings about a tenth over the measured figures;--icountcounts instructions a frame the same way. The PCM of every fixture is bit-identical between the x86-64 host (GCC 16, SSE) and the Cortex-M3 (soft float, the generic seam), and the hashes are pinned intestdata/ac4-probe-pcm-hashes.json(tools/checks/check_probe_hashes.py). Thelinux-gccleg also runs the probe natively on x86-64 after a merge and in the nightly run, and holds its hashes to the same pins. The rows are in Performance trend. - The fixed-point tier (phase D14d): FFmpeg Validate builds a fixed CLI, runs both scorers with
it at their pins, and holds its decode to the double one as above, at the floors in
testdata/ac4/scalar-agreement-fixed.json. When they were pinned the two agreed to 105.7 to 132.1 dB below the crossover and 34.2 to 97.2 dB above it where a stream has A-SPX. The probe runs at the tier on the Cortex-M3 leg with--icountand natively on thelinux-gccleg, and both are held totestdata/ac4-fixed-probe-pcm-hashes.json; integer arithmetic, so the hashes are the same on every architecture, RV32IMC included, where they were checked by hand. - On the ESP32-P4 (phase D14b,
CONFIG_ICLFORGE_AC4): no QEMU runs the P4, so CI buildshearth_sinkwith AC-4 in it and does not run it, and the checks are on a board. Twenty plays of DEE's streams (2.0, 5.1 and 5.1.4 in full decoding, the three 5.1.4 modes in core decoding and the converter's four frame rates) measured time, heap, stack and a PCM hash. The board's float output equals the probe's pinned hashes on the six fixtures (the sixth, with companding, since D14a4), and the host's (MSVC, GCC 16 and Clang 22) and the Cortex-M3 leg's on the 20 plays, the six core plays and their cuts. D14b found it different on the five plays with companding, wherestd::powandstd::exp2atfloatgave a different last bit in each C library, and D14a4 took those calls out of libm. ESP32-P4 has the times: the P4 decodes 2.0 in SIMPLE and in A-SPX mode, and through the frame-rate converter at 24 and 25 fps, in real time and nothing wider. On the S3 the AC-4 probe's six fixtures decode under QEMU in CI to the pinned hashes, with the decoder's state in PSRAM; no board has timed it (ESP32-S3). The C6 builds the decoder in the fixed-point tier, checked by the fixed-point gate above and the probe's hashes on the Cortex-M3 leg and RV32IMC (ESP32-C6); no board has run it.
The encoder¶
libs/ac4/src/encoder writes AC-4 from the same two standards: mono, stereo, 5.0 or 5.1, and 5.0.4 or 5.1.4
in the immersive element (phase E8), at 48 kHz at every
frame rate of Part 1 Table 83 or at 44.1 kHz at frame_rate_index 13, at a constant, average or
variable rate, with I-frames where a caller asks for them, the loudness values, DRC's decoder modes,
the stereo downmix's values and dialogue enhancement, as one substream or as several in the
presentations of Part 2 Table 53, in the SIMPLE codec mode or the ASPX mode, with A-SPX
above a crossover: below 96 kbps a channel in mono and stereo, with companding below 64, and below
76.8 kbps a channel in 5.X, as DEE's 5.1 streams switch between 320 and 384 kbps. Below 33.6 kbps a
channel in 5.X it writes ASPX_ACPL_2, and below 22.4 ASPX_ACPL_3, as DEE's 5.1 streams are at 128
and 96 kbps: a downmix coded in the ASPX way and A-CPL's parameters, from which the decoder rebuilds
the channels. 5.0 and 5.1 take the 5.X element in the one form DEE's streams have (coding_config 0
and 2ch_mode 0: L and R a pair, Ls and Rs a pair, C alone, the LFE); its other coding
configurations, chosen frame by frame by the bits they save, 7.0 and 7.1 in the 7.X element,
ASPX_ACPL_1 and A-CPL in stereo, and 7.0.4 and 7.1.4 with the back pair, 9.0.4 and 9.1.4 with the
screen pair (b_5fronts, in every immersive mode but A-JCC), ASPX_ACPL_1 and A-JCC in the immersive
element are experimental options. Objects, as an A-JOC substream or direct-coded, are
an experimental option too (phase E9), as is spectral noise fill, which gives each band that
quantises to zero a level of its own (experimental.noise_fill), the efficient high frame rate
mode, which sends each codec frame as two or four transmission frames
(experimental.frame_rate_fraction; a constant rate; the decoder reassembles each unit into the
frame the codec coded, and a test holds its output to the plain stream's at the audio frame rate),
and 22.2 (experimental.twenty_two_two), the 22_2_channel_element of Part 2 clause 6.2.4.3 in
SIMPLE and ASPX. It shares
libs/ac4/src/core's transforms, windows, codebooks, QMF banks and A-SPX tables and high frequency
generator with the decoder, and writes the syntax through a transcription of the tables of its own.
forge ac4-encode writes it raw or in MP4, with an option for each setting. Ten checks stand
behind it, and a
paragraph on the objects follows them:
- Three transcriptions agree. The encoder records each element it writes in the shape the decoder
records what it reads. The encoder's tests and the fuzz target
fuzz_ac4_encoderequire the decoder to read every frame to the end of every substream with the encoder's trace, record for record; the fuzz target also decodes every frame and encodes the input a second time, which must give the same bytes. The encoder-space harness (tools/ci/fuzz_ac4_encoder_space.py) draws configurations and adversarial PCM, and compares the encoder's trace, the decoder's andtools/references/ac4_syntax.py's throughforge'ssyntax-trace=option; it draws mono to 5.1 and the 7.X layouts, the codec mode the rate picks, SIMPLE or ASPX forced or an A-CPL mode forced, the experimental tools, every frame rate, the rate modes, the I-frame options and each metadata option, in a case in eight the immersive layouts in each of their codec modes, and in a case in twenty 22.2, and in a case in ten one to twelve objects, and its--check-envelopeholds each A-CPL mode's least rate. A refusal of a rate as too low for the frame rate and metadata counts only for frames under 400 bytes, and only if the same case at 400 bytes a frame encodes. The fuzz target reaches every A-CPL mode too, and phase E6's substreams and presentations: each of Table 53's configurations over a second or third substream, a hybrid method's dialogue enhancement substream, 3.0 dialogue, a presentation of each substream alone, names, languages, levels, group gains, the associated audio's values and EMDF payloads. Since phase E7 the harness draws them as well, throughforge ac4-encode'ssubstreamN=andpresentationN=: one case in five has further substreams in one of those configurations, or a presentation of each, with rate shares, dialogue mixing values, ids, levels, names and payloads, now and then an EMDF-only presentation, and decodes the first presentation at level 7. It found a frame at an average rate that gave the substream taking what the others leave less than its least frame, and a frame between I-frames sized for a dialogue stem's parameters where it falls back to the last frame's, neither of which the encoder could then write; each substream now keeps its least frame first, and a frame is sized for the metadata it falls back to. FFmpeg Validate, a nightly job, runs it for 120 seconds, and the Fuzz workflow'sEncoder Space Nightlyjob for 900. The A-SPX writer's tests read every interval class, balance, sinusoids and both kinds of interleaving back through the decoder's parser, and hold the encoder's reading of the interval borders, envelope resolutions and noise borders to the parser's. The encoder undoes the three, four and five channel matrices as the 2 x 2 steps they cascade, in a transcription of Tables 178 and 179 and clause 5.3.3.4 of its own, whichtest_multichannel.cppholds to every printed matrix for everychel_matsel, with the steps' parameters chosen or drawn at random. - One tone per channel. Encoded and decoded, each channel's tone comes back at unity gain on its
own channel, 60 dB or more over every other tone there, the LFE's 47 Hz included: 5.0 and 5.1 in
SIMPLE and ASPX, and 7.0 and 7.1 in each of the three 7.X layouts (
test_encoder.cpp, and throughforgein the WAV orderdecodewrites); and 22.2, 24 tones that are primes, none on another's harmonic, in SIMPLE and ASPX at native, 25 and 50 fps and at 44.1 kHz, each at unity gain within 0.2 dB and 60 dB over the 23 others (test_twenty_two_two.cpp), and throughforge ac4-encodeanddecodeatmd-compat=7in the WAV order. Music-like noise (a falling spectrum, each pair sharing 0 to 100 % of its power) decodes in 22.2 with an SNR floor per pair of Table 21 of 11 to 12 dB in SIMPLE at 70 kbps a channel and 6 to 8 dB in ASPX at 40, and 32 and 25 dB for the LFEs, which is where the 5.1 path lands on the same noise (11.8 to 12.9 dB at 70 kbps a channel). Noise above the crossover in one channel comes back in that channel alone, so eachaspx_dataelement carries the channels Part 1 Table 213 gives it. In the A-CPL modes, whose parameters rebuild the channels band by band, a tone at the centre of each channel's own parameter band comes back within 0.5 dB, 40 dB over every other tone, in ASPX_ACPL_1 to 3 and in stereo. A pair's level difference and correlation come back with it: for one noise at a 6 dB difference within 1 dB and above 0.9, and for two independent noises within 1 dB and under 0.3. A 9.0.4 and a 9.1.4 stream in SCPL, ASPX_SCPL, ASPX_ACPL_1 and ASPX_ACPL_2 decode with each of the 13 or 14 tones on its own channel at unity (the A-CPL pairs by the same rule as above), in Part 2 Table A.27's order, and the decoder's renderer folds them to 7.X.4, 5.X.4 and 5.X by the 9.X rows of Tables 38 to 43 (test_nine_x_four.cpp).tools/checks/ac4_syntax_differential.pyreads eight such streams (those four modes at both layouts, 28 frames each) through both transcriptions with no finding; no stream of another encoder reaches the element. - Readers outside the project. FFmpeg's raw AC-4 demuxer finds every frame at the size written,
and its mov demuxer reads the MP4 track (the harness and the codec matrix). Locally,
tools/checks/check_ac4_encode_readers.pyholds MediaInfo's frame-by-frame trace to the configuration, field by field, CRC included, and has DEE's MP4 muxer mux the raw output: thedac4it writes is the encoder's, byte for byte, for mono and stereo at both sample rates, 5.0 and 5.1, the experimental coding configurations and the 7.X layouts 3/4/0 and 5/2/0, and every substream field MediaInfo shows holds the value the encoder's syntax trace wrote. For 3/2/2 the muxer leaves out channel group 4, which Part 2 Table A.27 and Pseudocode E.3 both give its top front pair, and MediaInfo's summary names that pair Tfc (libs/ac4/ERRATA.md). MediaInfo and the muxer read the A-CPL streams as configured as well, ASPX_ACPL_1 and A-CPL in stereo included. The muxer refuses a stream of several presentations, and does not finish one of an alternative presentation; for those thedac4(Part 2 Annex E.10) is held to the text and to MediaInfo's trace, which reads every configuration's substream groups as written, andlibs/ac4/tests/core/test_toc.cppholdsbuild_dac4()to the muxer's box byte for byte for Chromium's A-JOC stream and DASH-IF's 5.1 test vectors, whose program identifier it copies. librempeg decodes the 5.X element's ASPX_ACPL_2 and ASPX_ACPL_3 streams' coded channels to within 69 dB of the decoder's recovered downmixes, and stereo ASPX_ACPL_2's to 45 dB, and leaves the channels A-CPL rebuilds silent, as it does DEE's; it refuses the ASPX_ACPL_1 streams, whose residuals and side send fewer bands than the channels they pair with, and reads D5's constructed ones, which send as many. - Decoded against the sources (
tools/checks/score_ac4_encode.py, in FFmpeg Validate): the programme fixtures, one tone per channel, a sweep, noise, castanet-like bursts and a panned source, mono, stereo, 5.0 and 5.1 (music and film mixes), 48 and 44.1 kHz, 24 to 384 kbps, encoded and decoded by the decoder. Every leg lags its source by 4,385 samples, sits within 0.2 dB of unity where its SNR is 20 dB or more, and meets SNR, log-spectral distance and ViSQOL floors pinned at the first measurement; in the ASPX legs SNR and gain are measured below the crossover of theaspx_dataelement that carries each channel, and above it each A-SPX tile's energy against the source's, as the decoder's scorer measures DEE's streams. A 5.1 leg's LFE is scored over its whole band: it is coded to 140.6 Hz, its first three scale factor bands, as DEE codes it, so what the source's 120 Hz low-pass leaves above that counts as noise. librempeg decodes every one of these streams, its output 736 samples earlier than the decoder's. In SIMPLE, and below the crossover of the ASPX streams without companding, it agrees with the decoder to 83 dB or better, 5.0 and 5.1 included (82.5 to 90 dB on every channel, the LFE's too); with companding, to 35 to 36 dB, as on DEE's companded streams. On the experimental options it does not agree. On the coding configurations' streams its channels sit 2 to 42 dB under the decoder's; on D4's constructed streams it readscoding_config0 with2ch_mode1 as the decoder does, to 81 dB or better, and parts from it on every three, four and five channel matrix and on the 3.0 element's pair, 6 to 19 dB down, where its pairs of the 5.X element match. It refuses the 5/2/0 and 3/2/2 layouts ("Not yet implemented"), and writes a 3/4/0 stream's L on every channel. Above the crossover its A-SPX band strays further from the source than the decoder's, as it does on DEE's streams: on the castanet-like bursts at 64 kbps it arrives a block of 1,024 samples after each burst and trails it, 27 dB from the source's energy per loud block, where the decoder's output is 1.7 dB from it. The A-CPL legs, 5.1 at 96 and 128 kbps, 5.0 at 112, 5.1 in ASPX_ACPL_1 at 160 and stereo in both modes, are scored asscore_ac4_decode.pyscores DEE's: the coded downmixes, recovered from the output, as waveforms below the crossover, each parameter band's level difference and correlation against the source's, and on the tones the routing margin.--json-outwrites the scores of 24 of its 72 legs, the programme content at the options a rate alone gives, and FFmpeg Validate uploads them: the job that publishes the external-encoder comparison appends them toac4-encode-quality-main.jsonl, which AC-4 encode quality charts and the Listening quality card reads. Its only tier is a warning, when a leg's MOS falls 0.1 under its own trailing mean; the pinned floors are what fail a run. - Frame rates, rates and metadata (phase E5). At every frame rate each frame decodes to the
samples Part 2 clause 5.11 gives it, over a second in
test_frame_rates.cpp, and over 100 000 frames at every rate, across 98 wraps ofsequence_counter, in a test run on demand; the decoded output lags the input bydelay_samples()anddecoder_delay_samples(), found by correlation, to within a sample.score_ac4_encode.py's frame-rate legs hold music and speech in stereo and music in 5.1 at the other frame rates within pinned allowances of the same source at index 13 on the log-spectral distance and ViSQOL: to 60 fps within 0.17 dB and 0.012, and at 100 to 120 fps music at 128 kbps 0.63 to 0.87 dB over and 0.09 to 0.18 under, where the frames' fixed side information takes five times its share of the rate. An average-rate stream never needs more than the input buffer it signals:test_rates.cppstarts a decoder at every frame and runs its buffer. Through the decoder's output processing (gain_ac4_decode.py --encoder, in FFmpeg Validate) the output level, each downmix and dialogue enhancement's gains on the encoder's streams equal their formulas to 0.01 dB. MediaInfo reads every loudness, DRC, downmix and dialogue enhancement field of 23 further configurations as the encoder wrote it, and the table of contents'wait_frames, frame rate and I-frames as configured; it reads a DRC gainset no further thandrc_gain_val, and withde_ms_proc_flagtwice the parameters Part 1 Table 78 reads. The harness found I-frames at the least rate a configuration takes that the encoder could not write: their A-CPL values, a VARFIX interval and per-frame metadata cost more than the framecreate()checked. A frame that holds nothing more now sends each as a stream starts it, andcreate()sizes it with the costlier interval, which takes stereo at 48 kHz in the ASPX mode from 8 kbps to 9. - Presentations and several substreams (phase E6,
libs/ac4/tests/encoder/test_presentations.cpp). Four committed streams, each with its configuration beside it as JSON (testdata/ac4/presentations/encoder-*.ac4): a broadcast of 5.1 music and effects, English and German mono dialogue, a mono audio description, a stereo commentary and stereo French dialogue, in 15 presentations of configurations 0, 2, 3 and 5, with an alternative presentation and its name, each substream alone, and one presentation disabled and pre-virtualized; hybrid dialogue enhancement in 5.1 (channel independent) and in stereo (the Mid), each with its dialogue enhancement substream, in configurations 1 and 4 with audio description; a configuration 6 presentation of EMDF payloads beside a stereo one; and, experimental, 3.0 dialogue with 5.1 music and effects, and a 5.1 main's hybrid waveform in 3.0. Their tables of contents hold the configuration in every frame, both transcriptions read every frame with the encoder's trace, and the Python parser's digests are with the others intestdata/ac4/. Through D7's selection and mixing, with one tone per substream, each presentation is selected as configured, bypresentation_id, language, associated audio and level, and every mix comes out at its formula's gains to 0.01 dB: g_dialog against each dialogue's cap, pans, group gains, the main audio's scaling under associated audio, and each hybrid method's waveform beside its parameters.mix_ac4_decode.py, in FFmpeg Validate, fits the encoder's 46 mixes to their formulas with 120 dB or more left over. A table of refusals holds the rules: dialogue or associated audio with a channel the main audio lacks but for mono, 3.0 where Part 1 4.3.3.7.1 does not allow it, more than 64 presentations, apresentation_idtwice, a level below the tracks' or reserved, a name over 31 bytes, and gains or associated audio's values the syntax cannot send. MediaInfo (check_ac4_encode_readers.py --only presentations) lists the presentations and groups as configured, with their configurations, classifiers, languages, levels and the name's bytes, and 128 substream fields as the encoder's trace wrote them. It reads no audio substream of a stream with a configuration 6 presentation, so that one is a stream of its own, gives no language to a presentation whose one group is associated audio, and shows the EMDF payloads substream framed but not detailed. DEE's MP4 muxer takes a stream of one presentation only. librempeg decodes a presentation's first group alone, as D7 found: the hybrid stream's main substreams to 78 to 86 dB of the decoder's, the EMDF stream's companded stereo to 33 to 40 dB, and silence for the broadcast stream's 15 presentations over 22 substreams, the counts at which D7 found it silent. - The presentations' race (
tools/checks/race_ac4_presentations.py, locally): G1's legs of music, dialogue and associated audio, which DEE encoded one at a time, multiplexed by D7's multiplexer into music and effects with dialogue, with associated audio as well, and each alone, against the encoder's encode of the same sources into the same presentations at the legs' rates, both decoded by the decoder and scored against the sources' mix. With music at 128 kbps and dialogue and associated audio at 64 the encoder's SNR is DEE's to within 0.1 dB or above it (by up to 1.1 dB on the music alone) and ViSQOL within 0.03; at 192 and 128 kbps its SNR leads DEE's by 5.5 to 6.3 dB on every presentation, ViSQOL within 0.02; on the tones it leads by 10 to 32 dB. librempeg gives the music and effects alone of either stream's mixes. - The API, the command and the package (phase E7).
Encoder::refusal_reason()names the rule a refused configuration breaks, and a table of refusals holds each reason to its rule (test_encoder.cpp), as the configuration's designated initializers hold its defaults;fuzz_ac4_encodeholds it tocreate()on every configuration it draws, andfuzz_ac4_parseholdsdac4_refusal()tobuild_dac4()on every table of contents that reads. Every option offorge ac4-encodehas a test:apps/forge/cli/tests/test_cli_ac4_encode.cppreads what each writes back from the table of contents and the encoder's syntax trace (the codec modes, the downmix, DRC and loudness values, the dialogue enhancement methods and the hybrid ones' waveform, the I-frame options, each experimental tool,crc=, and everysubstreamN-andpresentationN-key), andtest_cli_options.cppholds each spelling's parse and each malformed value's refusal.tools/checks/check_install_consumer.shinstalls each build and encodes a second of tone through the installed encoder, by CMake and by pkg-config, static and shared, reading every sync frame and its CRC back with the installed inspector; the ABI gate compareslibiclforge_ac4.so's exports with the headers' API (tools/ci/abi-allowlist/libiclforge_ac4.so.txt), and is advisory until the API freeze. Both run nightly. - The immersive element (phase E8,
libs/ac4/tests/encoder/test_immersive.cpp). 5.0.4 and 5.1.4 are written in the immersive element as DEE writes it: SCPL from 640 kbps, ASPX_SCPL from 480 and ASPX_ACPL_2 below, each coupled pair coded as its sum and difference; 7.0.4 and 7.1.4 with the back pair, ASPX_ACPL_1 and A-JCC are experimental options. Each stream reads back with the trace the encoder recorded, every channel's tone decodes on its own channel in full decoding and at the core's gain in core decoding, in each mode, and the height downmix sends DEE's custom downmix data, which the renderer applies.score_ac4_encode.pyholds 12 immersive legs, tones and music at 5.1.4 from 192 to 768 kbps and ASPX_ACPL_1 and A-JCC by name, to floors pinned at the first measurement, in full and in core decoding, in FFmpeg Validate. Against DEE's 5.1.4 legs from 192 to 768 kbps (score_ac4_encode.py --gold, locally) ViSQOL is within 0.035 of DEE's or over it on music, film and speech, and the SNR below the crossover up to 10.5 dB under DEE's from 192 to 320 kbps and within 1.4 dB of it or over it from 384; on sweeps it was 0.03 to 0.18 under until phase E10, described under the race below. librempeg does not decode the immersive element. - The race against DEE (
score_ac4_encode.py --gold, locally): phase G0's 2.0 legs of music, speech and tones from 48 to 768 kbps, encoded again here in the mode DEE writes at each rate, and both decoded by the decoder. In ASPX, from 48 to 144 kbps, ViSQOL is within 0.03 of DEE's or above it from 64 kbps up, 0.05 above on music at 64 kbps and 0.04 at 96, and 0.06 and 0.09 under DEE's on music and speech at 48 kbps. Below the crossover the encoder's SNR is 1.4 to 3.6 dB under DEE's at 48 and 64 kbps and on music at 96, where its rate loop spends bits where ViSQOL marks the noise, and 0.6 to 8.2 dB over it on speech at 96 kbps and at 128 and 144; above it the A-SPX tiles sit within 0.35 dB of DEE's distance from the source or closer. The decoder's pre-flattening, which phase D4 turned round, raised both encoders' speech at 48 kbps, DEE's by more; before it, this encoder led DEE there by 0.02. In SIMPLE, at 192 kbps the encoder's SNR is 5.6 dB above DEE's on music, 14.9 dB on speech and 32 dB on the tones, its log-spectral distance is lower on each (1.04 against 1.17 dB on music), and ViSQOL is within 0.01 of DEE's. DEE's 2.0 audio stops changing from 256 kbps; the encoder's goes on improving with the rate, to 74 dB on music at 768 kbps, where the QMF banks' reconstruction bounds it. At 5.1, G0's film, music and tones from 192 to 768 kbps, ASPX to 320 as DEE writes them: below the crossover the encoder's SNR is 7.3 to 11.6 dB under DEE's at 192 kbps and 1.9 to 3.7 under at 256, since DEE keeps 21 to 27 dB below 2 kHz and lets the band from 8 kHz fall to 3 dB and under, where this encoder spreads its noise across the band; from 288 kbps it is within 1.6 dB of DEE's, and from 320 above it, by 3.2 to 3.8 dB at 384 and 15 to 19 at 768. ViSQOL is at or above DEE's at 192 and 256 kbps, and from 288 up to 0.05 under it on film and 0.02 on music, within 0.01 at 768. The log-spectral distance is lower on every leg, and the A-SPX tiles within 0.07 dB of DEE's distance from the source or closer. At 96, 128 and 144 kbps, in DEE's A-CPL modes, each band's level difference lands 0.02 to 0.13 dB nearer the source's than DEE's on music and film, the correlation within 0.007 of DEE's distance, the log-spectral distance lower on every leg, and ViSQOL 0.01 to 0.06 above DEE's but for film at 128 kbps, 0.12 under, where the coded centre's band below 2 kHz trails DEE's by 9.5 dB of SNR; the tones route 1.2 to 2.9 dB more cleanly than DEE's. The coded downmixes' SNR trails DEE's by 3.4 to 9.5 dB, the same spread of noise across the band as at 192 kbps. Its scores are pinned. Phase G1's sweeps, each channel's tone from 20 Hz to 20 kHz in turn, race at 2.0 from 48 to 144 kbps, at 5.1 from 96 to 320 and at 5.1.4 from 192 to 512, the rates DEE codes with A-SPX. A tone above the crossover leaves A-SPX's patch nothing to copy, and the decoder's noise is then all that fills the band, so the encoder sends noise floors for a group its patch cannot fill (phase E10). Before, the band above the crossover came back 30 to 68 dB under the source's energy where DEE's came back 15 to 17, and ViSQOL was up to 0.18 under DEE's at 5.1.4; now it is over DEE's on every leg, by 0.15 to 0.28 at 2.0, 0.05 to 0.48 at 5.1 and 0.13 to 0.66 at 5.1.4 (0.05 to 0.65 in core decoding), the A-SPX tiles 3.5 to 7 dB nearer the source's energy than DEE's, and the log-spectral distance 0.55 to 1.14 dB over DEE's at 2.0 from 48 to 96 kbps and under it on the others. The music, film, speech, noise, transient and tone legs encode to the same bytes as they did before phase E10.
The race changed the encoder before it was pinned. Its first version trailed DEE by 11.7 dB of SNR
on music at 192 kbps, and removed the top octave of speech and music: its rate loop spent a frame's
bits beyond the masking thresholds in proportion to each band's signal, and Terhardt's threshold in
quiet, taken with a full-scale sine at 96 dB SPL, zeroed content DEE keeps. The loop now spends those
bits where the noise is loudest first, and the model has no threshold in quiet. The ASPX race changed
it again: below 64 kbps a channel no frame can hold its bands at their masking thresholds, and
raising every band's noise over its threshold together left music at 48 kbps with 6 dB of SNR in
every band, where DEE keeps 19 dB in the bass. Such frames now pull every band toward one level of
noise and cap each band's noise at 0.7 to 2 times its energy, the tightest cap the frame holds, since
ViSQOL marks the holes a looser cap leaves more than the noise a tighter one spreads. At 5.1 the race
showed DEE splitting a fifth of its frames into two blocks of 1,024 samples, where this encoder's
transient detector splits under one in a hundred; splitting on a 3 or 6 dB rise as well moved
ViSQOL by 0.02 at most, up on some legs and down on others, and was left out. The A-CPL race
changed the estimate. Estimating each band from its subbands' whole spectrum, the encoder's
ASPX_ACPL_3 routed the 5.1 tones at -3.7 dB, a channel carrying another's tone louder than its own:
the L and Ls tones, within 44 Hz of subband 1's edges, reach into it through the QMF prototype's
transition band, and the centre's prediction there came out 0.5 and 0.2 where C alone is in Lo. A
subband's own band lies in half of its spectrum, so the estimate now takes a DFT of each subband's
slots and reads the bins of its own band, all of them where its neighbours' components carry the
band; the prediction is 1 and 0 there (DEE's 0.9 and 0), and the routing 9.7 dB. The readings the
writer takes, and those it shares with the decoder, are in libs/ac4/ERRATA.md.
The encoder's objects (phase E9, behind experimental.objects) are checked against the decoder
alone, since no reader outside the project decodes them: DEE writes no A-JOC from this project's
masters and librempeg refuses object coding. libs/ac4/tests/encoder/test_objects.cpp codes an A-JOC
substream over a computed downmix of four signals for eight objects, over a static 5.1 bed for six
objects and the LFE, and with bed objects, the LFE and decorrelators, and direct-coded dynamic objects
with the LFE, each object a tone at the middle of a QMF subband of a parameter band of its own. Decoded
in full, each object comes back at 40 to 75 dB SNR against its source with a correlation above 0.99999;
floors at the first measurement less 1 dB and 0.02 are pinned. Core decoding gives each downmix signal,
the sum of its group, at 71 to 75 dB SNR and at its group's centre. A moving object's updates come out
at the sample their input samples do, to within 32 samples, in both codings; a second encode is byte
for byte the first; and the encoder's trace, the decoder's and the Python parser's agree on the four
committed streams (testdata/ac4/objects/encoder-*.ac4, with their digests) and on the
encoder-space harness's object draws. MediaInfo's reading of the object count and the bed
(tools/checks/check_ac4_encode_readers.py --only objects, which needs MediaInfo from DEE's
install) reads the four committed streams as configured, run on 2026-10-10 against MediaInfoLib
26.05: 8 objects for the A-JOC stream over a computed downmix, 7 with its static 5.1 bed named, 6
with two bed objects, and 5 for the direct-coded stream. Whether the objects
move as their metadata says is the listener's to hear, from the streams the test writes with
AC4_ENCODER_WRITE_LISTENING set.
The encoder's efficient high frame rate mode (experimental.frame_rate_fraction,
libs/ac4/tests/encoder/test_encoder.cpp) is checked against the decoder's reassembly alone, which
libs/ac4/tests/decoder/test_ehfr.cpp holds to DEE's streams cut into fragments by a test helper: at 120 fps in quarters, 60 fps in
halves and 119.88 fps in quarters, every transmission frame carries the stream's index and the
fraction, the counters run on from a multiple of it, only the first of a unit is an I-frame, the
decoder's units are as many as the codec frames and hold the tone at unity gain and the plain
stream's quality at the audio frame rate, and its syntax trace reads back as the encoder's. MediaInfo
(MediaInfoLib 26.05, --Details=1) reads the table of contents of each frame of such a stream, the
frame_rate_index 12 with b_frame_rate_fraction and b_frame_rate_fraction_is_4, and gives the
frame rate as 120 fps of 400 samples; it details no audio. DEE's dee_mp4muxer muxes a plain 120 fps
stream and crashes (a segmentation fault, exit 139) on both a 120 fps stream in quarters and a 60 fps
stream in halves, so it does not take the mode's fragments (checked by hand on 2026-10-10, not by
a script). No decoder other than this project's has read one.
IEC 61937¶
AC-4's burst types (IEC 61937-14, phase D11) have no oracle: nothing else here writes or reads
them, and no receiver found accepts AC-4. They are checked against the standard's text.
libs/containers/tests/iec61937/test_iec61937_ac4.cpp transcribes Part 14's repetition periods, burst sequences,
Pc codes and maximum lengths a second time, row by row as printed, and holds the library's
tables to that transcription and both to the arithmetic the standard implies: five bursts of a
sequence span five frames exactly, each burst starts at the IEC 60958 frame nearest its frame's
exact start, and each maximum length is the period less the preamble and the two IEC 60958 frames
of spacing between bursts. A stream packed and read back returns every frame unchanged at every
frame rate of every type, with each burst's period, measured from the carrier as a receiver would
measure it, its place in its sequence and its Pc fields as the tables give them; DEE's streams
at four frame rates do the same. For the extension role, a loopback test
(apps/hearth/engine/tests/test_group.cpp) sends DEE's 2.0 stream at 48 kHz through _iclforge_player@v1
to a test sink, whose output equals the local decode, rendered the same way, sample for sample.
The two readings Part 14 leaves open, which frame starts a burst sequence and whether Pd counts
bits or bytes, are given in libs/containers/src/iec61937/iec61937.cpp.
Hearth's engine¶
Phase I2 plays AC-4 in Hearth through the decoder's public API. The tests are in
apps/hearth/engine/tests/test_ac4_engine.cpp unless named otherwise.
- Every committed stream: the engine plays each committed stream the decoder decodes onto a
layout with a slot for each speaker, and its output equals
iclforge::ac4::Decoder's owndecode()of the same frames, sample for sample. A stream none of whose presentations the build decodes is refused when it opens, with the decoder's reason, and the test reports how many played and why the rest did not. When phase I2 wrote it that was 46 of 49, the three refused being the 5.1.4 legs, which the decoder did not yet read (phase D9); the test requires at least the 42 phase D8 decoded through the API. Each unit lasts what the decoder puts out for it, 1 601 or 1 602 samples at 29.97 fps as Table 47 gives them, and a seek to 500 ms plays on within 1e-6 of an unbroken decode. - Each control, on streams of tones the encoder writes with the values the control reads: the output level against 2^((Lout − dialnorm) / 6) at −31, −24, −17 and −6 dBFS; dialogue enhancement on the centre, up to the stream's cap; Lo/Ro, Lt/Rt with its surrounds' sign, the LFE in and out, the stream's preferred downmix and mono against Tables 217 and 218 with the stream's gains; the presentation chosen; the dialogue level up to its maximum; audio description at its level and off; and each DRC mode against the decoder's own. Each holds to 0.01 dB. A change of settings while an item plays applies from the next frame, and nothing is lost or decoded twice.
- From the page:
apps/hearth/ui/tests/qml/tst_decoder_ac4.qmldrives each control on the Decoder page's AC-4 tab with a click, a press or a key, and measures each tone's level at the fake device, a Hann-windowed DFT over the last 16 384 samples the engine handed it, against the same formulas, to 0.1 dB. - The gain script through the engine:
hearth-renderplays an item through the player, session and stream decoder into a WAV file, andtools/checks/gain_ac4_decode.py --engineholds it to the formulas it holdsforge decodeto, with each of forge's options given as the Decoder page's setting for it. On the committed legs and the encoder's, every gain was within 0.0001 dB of its formula and what it left was 148 dB or more under the output when phase I2 wrote it; the Hearth CI job runs both, after each merge and nightly. - To a network group (
apps/hearth/engine/tests/test_engine_network_group.cpp): the engine plays an AC-4 item to a group of a player@v1 sink, which is sent the decoded PCM, and a test sink on the extension role that lists AC-4, which is sent each sync frame as a burst and decodes it. The second's output equalsiclforge::ac4::Decoder's decode of the frames, rendered on its layout, sample for sample, and every burst puts the stream's first frame at the same time, within 1 ms. A presentation the listener chose that a sink would not choose itself reaches the group as PCM alone.
TrueHD and MLP¶
iclforge::truehd (TrueHD and MLP) is checked in three tiers. The third is scored on the owner's machine
only, and part of the second has no outside reader.
- FFmpeg's strict decode (
-err_detect crccheck+bitstream+buffer+explode) of the streams itstruehdandmlpencoders write. The codec is lossless, so a decode either equals FFmpeg's sample for sample or is wrong: 25 committed fixtures (testdata/truehd/, 1 to 6 channels, 44.1 to 192 kHz, 16, 20 and 24 bits, both stream types, restart intervals of 8, 16 and 128 units) are held to the SHA-256 of FFmpeg's decode by the library's test, byforge decode(tools/checks/verify_truehd_interop.py --forge) and bytools/references/truehd_syntax.py, an independent transcription. Nineteen more streams were compared while the decoder was written. That comparison found the check values, the matrix scaling, the lossless check's fold and a marker FFmpeg's decoder obeys and the specification does not describe (libs/truehd/ERRATA.md): the last access unit of a stream whose length is not a multiple of the unit carries a 32-bit marker with the number of padding samples, which FFmpeg removes from its output. Without it a 44.1 kHz fixture decoded 15 samples longer than FFmpeg's. The encoder is held to the same oracle the other way round: FFmpeg's strict decode of whatforge truehd-encodewrites must equal the samples that went in (tools/checks/verify_truehd_encode_interop.py --forge, 32 cases of rates (43 with--full), 1 to 8 channels, 16, 20 and 24 bits and signals, and the encode legs oftools/ci/run_codec_matrix.sh, which also read the same streams back out of Matroska, MP4 and MPEG-TS), and the encoder's size is recorded beside FFmpeg's. - Hand-built streams (
tools/references/truehd_writer.py,testdata/truehd/handbuilt/) for what FFmpeg's encoders do not write: an IIR filter and itsnew_states, LSB bypass (under either restart sync), noise generators 0 and 1, several matrices with a permutedch_assignand an output shift (also a negative one, and one on a moved channel), 16 bit MLP words, the block data check, terminators, the marker in every unit, extra data, the directory's DRC word, a 7.1 stream in three substreams, every IIR order and a 16-channel fourth substream. Each stream is held to the signal it was made from, by the library and by the Python transcription. Their major sync is one FFmpeg accepts, sotools/checks/verify_truehd_interop.py --handbuiltalso holds FFmpeg's strict decode to the manifest's account of it: for nineteen of the thirty-three it returns exactly that signal (and the bed of four more) (an IIR filter and Huffman codebooks 1 and 3, every IIR order, itsnew_states, LSB bypass under either restart sync, three matrices with a permutedch_assign(also one that changes at each restart) and an output shift (also on a moved channel), noise generator 0, noise generator 1 at 48, 96 and 192 kHz, the block data length, the marker in the last unit, extra data present, the directory's DRC word present, and the 7.1 stream, whose channels FFmpeg returns in its own order). The other ten: with the marker in every unit FFmpeg returns two of the twenty units; it refuses the 16-channel streams and the one at substream 3's limits, whose substreams 2 and 3 use restart sync0x31EC, and a stream with a terminator after the last block; it does not apply a negative output shift; and it clears the low bits of a 16 bit MLP word. The noise generator 1 streams carry the readings of ERRATA entry 44 (the buffer size, start index and stride), which FFmpeg's decode fixed. Comparing found four readings the first writer and the library had wrong, each now FFmpeg's and marked provisional in ERRATA.md: the lossless check's channel shift (question 6), the filter histories across a restart (question 18), the width ofshr7in noise generator 0 (question 5) and the block data length (entry 21). What FFmpeg does not read stays without an outside reader: the layout of the extra data, the values of the DRC word, the block data CRC, and the 16-channel substream; for those a misreading of the specification is in the writer and in both decoders alike.tools/checks/check_truehd_coverage.pyreads every committed stream with the Python transcription and fails when a feature (72 are listed: rates, channel counts, restart gaps, each FIR and IIR order, the codebooks, matrices, shifts, noise, the data check, the marker, extra data, the DRC word, word sizes) is carried by none, so deleting or regenerating a fixture into something plainer is a failing check. - DEE's TrueHD streams of known sources, scored on the owner's machine by
tools/checks/score_truehd_decode.py(the full set is not committed, 13 of its streams are intestdata/truehd-dee, and DEE's licence ends on 2026-11-06). Not run in CI. A DEE stream with the sixteen-channel substream would be the only outside check of that substream. Scoring DEE's TrueHD streams says how.
The encoder is held to the first tier from the other side. tools/checks/verify_truehd_encode_interop.py encodes 43 cases
(real music, speech and 5.1 programme material and synthetic signals that are hard for a lossless coder: full-scale squares and
alternating extremes, impulses, silence, DC, noise, a level that steps inside a restart interval; stereo to 7.1, 44.1 to 192 kHz,
16, 20 and 24 bits, restart intervals of 1, 8 and 128 units, lengths that are not whole units, the downmix presentations) and
requires FFmpeg's strict decode to return every sample, with the library's own decoder reading every unit back as it is written.
That is a stronger test of a reading of the specification than decoding FFmpeg's streams, because the encoder writes things
FFmpeg's never do and FFmpeg's decoder says whether they are right; it added nine entries to libs/truehd/ERRATA.md (30 to 38),
among them the scale of peak_data_rate, how channels are spread over
substreams, that a substream reads its predecessor's rows before that predecessor's matrices, and that FFmpeg's decoder takes a
substream of more than 6 channels only under restart sync 0x31EB. tools/ci/fuzz_truehd_encoder_space.py draws random legal
configurations against adversarial PCM (about 800 cases in 100 s) and the same check; its first run found an encoder that never
finished on a constant block far from zero, which is now a regression seed and a unit test. Streams are 0.85 to 0.96 times the size of FFmpeg's encoder's
at 44.1 to 96 kHz and larger at 192 kHz, with DEE's and the programme material in the measured table, and its decode is held to FFmpeg's strict decode, which a bit flipped in a payload does not fail. The downmix presentations are the exception: FFmpeg's decoder returns the last substream only, so nothing
outside the library reads the 2 and 6 channel presentations.
Not covered: the details of noise generator 1 that the specification leaves out (the buffer size, start index and stride are measured
against FFmpeg and wait for the owner: libs/truehd/ERRATA.md, entry 44), heavy DRC (not read, and not written)
and the block data CRC (the length is checked, the algorithm is not known); and, in the encoder, the IIR filter, LSB bypass
and a negative output shift, which it does not write.
Scoring DEE's TrueHD streams¶
DEE's licence ends on 2026-11-06, and after that no stream of this kind can be made. The TrueHD legs of the gold set
(tools/generators/gen_dee_gold.py, the truehd group: 2, 6 and 8 channels at 48 and 96 kHz, 16 and 24 bits, from tones,
music, film, noise and sweeps, with downmix and independent presentations, DRC profiles, dialnorm and loudness presets) are
streams of known sources, and a lossless decoder has to give each source back. On the machine that has DEE, with a forge
built from the tree under test:
python tools/generators/gen_dee_gold.py --gold-set D:/ac3bld/dee-gold --cli build/config-windows-msvc/bin/forge.exe --only thd-
python tools/checks/score_truehd_decode.py --set D:/ac3bld/dee-gold --forge build/config-windows-msvc/bin/forge.exe --report truehd-scores.json
The first makes, or tops up, the TrueHD legs and records what FFmpeg's decode of each gives against its source in the
manifest (DIR/dee-gold-manifest.json); it needs DEE and runs once. The second needs only the set: it decodes each leg's
stream with forge decode under the strict checks (CRCs, parity and the lossless check of every restart interval) and
compares the result with the leg's first source, sample for sample. The decoder's channels are matched to the source's by
content and a delay of the first samples is allowed, because DEE's channel order and delay are not in the source. A leg is
- PASS when the decode succeeds and equals the source bit for bit;
- ALTER when the leg's DEE options change the audio (loudness correction, the surround attenuation,
--optimize-data-rate), so the decode is held to nothing but succeeding, and the number of values that differ is shown; - UNEXPLAINED when the decode is not the source and no option of the leg says why, but the stream's own lossless check passes on every restart interval (and on at least one): the decoder returned what the encoder coded, so the difference arose before coding. The leg is listed and does not fail the run; the report keeps the check's counts and whether FFmpeg's decode is the source;
- FAIL when the decoder stops on a check, a lossless check fails, or a lossless leg decodes to something else (the report says whether FFmpeg's decode is the source either);
- SKIP when a stream or source is not on disk, or the source is over
--max-seconds(120; the 300 s soak programmes).
The 13 streams in testdata/truehd-dee (0.25 s each: 2.0, 5.1 and 7.1 with three presentations, 48 and 96 kHz, 16, 20 and 24 bits, one DRC profile,
an embedded timecode, and four lengths that are not a whole number of access units) are scored the same way with --set testdata/truehd-dee. On
2026-10-31, with forge built from 1e4ee5c3e, they give 11 PASS, 2 UNEXPLAINED (the two 96 kHz legs) and 0 FAIL.
The full set was scored on 2026-10-29 before the decoder fixes (26 PASS, 5 ALTER, 97 FAIL of 128). Rescored on 2026-10-31 with forge at 1e4ee5c3e plus the alternative-reading
switches (142 legs: the 128 of the set and the 14 of the group truehd-last, made the same day): 87 PASS, 9 ALTER,
46 UNEXPLAINED, 0 FAIL, 34,600 lossless-check intervals ok and none failed; the three 300 s programmes (2.0, 5.1 and 7.1) 3 PASS (16,872 intervals ok, none failed). The five Atmos legs made
from the owner's DAMF master (obj-thd-atmos-sollevante, -dmx, -e12, -e14, -e16) have no PCM source for the scorer and are test inputs for the decoder only (SKIP). The 46 UNEXPLAINED
are 25 legs at 96 kHz and 21 stepped-tone legs at 48 kHz (a difference of one 24-bit step in 52,022 to 182,077 values whatever the DRC profile, the data-rate option or the loudness path), every
one with its own lossless check ok on every interval and FFmpeg's decode not the source either; ERRATA question 50 has the figures and the diagnostic legs. The 9 ALTER are the legs whose DEE
option alters the audio.
What the set scores of the provisional readings (forge decode truehd-reading=, ERRATA question 101): the output shift and the lossless fold indexed by matrix channel are scored (with the
shift by output position 32 of the 87 PASS legs stop being the source, 44 legs FAIL and 4,961 of 34,600 intervals fail; with the fold by position 13,320 intervals in 77 legs fail; with the
library's reading none fails); noise generator 1's details are scored (the 76 legs the decoder stopped on on 2026-10-29 now decode with every interval ok, 49 of them the source); the 16-bit
seed_shr7 and the filter histories surviving a restart are not scored (no leg, short or 300 s, changes under the other reading: no DEE stream draws on generator 0's noise or filters from
the first sample after a restart). To repeat it: score_truehd_decode.py --decoder 'forge decode truehd-reading=zero-histories truehd-check=lenient' and the like.
The exit status is 1 if any leg fails. Another decoder is scored with --decoder 'PROGRAM [ARGS]', run as
PROGRAM [ARGS] STREAM OUT.wav. After the licence ends the script needs no DEE and reads the set as it is left. The
script's own test (python -m unittest tools.checks.test_score_truehd_decode) uses made-up streams and a decoder of a few
lines of Python.
The streams are test inputs only (the decision of 2026-09-26): they are decoded and compared with the PCM that went in, and
no one reads a stream to learn how DEE wrote it. A FAIL is therefore not a reason to change the decoder to fit one stream;
it is an entry in libs/truehd/ERRATA.md (the leg, the check that failed, what the specification says) and, if it is the
sixteen-channel substream, the terminators or the evolution payload (open questions 1 and 3), a question for the owner.
Checking your own Blu-ray soundtracks¶
The codec is lossless, so two correct decoders return the same samples. tools/checks/verify_truehd_local_streams.py holds
forge decode to FFmpeg's strict decode on TrueHD tracks you ripped from your own discs. They are never committed or copied:
the script reads them where they are.
Put the tracks in one directory (BDAV .m2ts, .ts, Matroska, MP4 or a raw .thd), have ffmpeg and ffprobe on PATH
and run, with a forge built from this tree:
ICLFORGE_TRUEHD_STREAMS=/path/to/tracks ICLFORGE_CLI=build/bin/forge \
python3 tools/checks/verify_truehd_local_streams.py --anonymous --report truehd-local.txt
With the variable unset it prints SKIP and exits 0. --self-test runs it on stand-ins built from the committed fixtures instead
(a BDAV .m2ts, Matroska, MP4, and transport streams with AC-3 frames in the stream), which is also a test of the script itself.
For each TrueHD or MLP track, FFmpeg extracts the stream, and FFmpeg's strict decode and forge decode of it are compared
channel by channel, sample for sample (FFmpeg returns the channels of a 7 or 8 channel stream in its own order, so they are
matched by content and the order is reported). FFmpeg only warns when a lossless check fails, so its warnings are counted. When
the file is not over --max-container-mib (2048) and forge's first stream in it is this track, forge decode of the file as it
is must give the same samples, which tests the container reader and the handling of an AC-3 core. The table has the container,
rate, channel layout, sample width, duration, access units, restart headers, mean and peak rate, the AC-3 frames that share the
stream, access units with extra data (evolution frames), whether an object substream (Atmos) is present, each decoder's
lossless-check failures, and anything forge refused. A track with an object substream is decoded as its 7.1 bed; the objects
and the payload are carried, not read (libs/truehd/ERRATA.md, question 1), and FFmpeg may refuse such a track outright.
The script writes a copy of each track and its decode to the system temporary directory and removes them; keep free space
for about the size of the largest decoded track (a two-hour 5.1 film is several gigabytes). forge reads a stream whole, so its
memory is of that order too. The output is names (or numbers with --anonymous), counts and rates, never samples.
Send back the table (--report), the "Transport stream layout" lines it ends with for a .m2ts or .ts file, and the first
lines of ffmpeg -version and forge --version. The layout lines say, for a track's PID, which PES packets hold access units
(T), AC-3 frames (A) or both (M) and what their headers say; they answer how a disc lays out its AC-3 core
(libs/containers/ERRATA.md, open question 9). A row that says DIFFERENT, or a lossless-check count that is not zero, is a
defect in one decoder: send the row, not the audio.
What untrusted input is checked against¶
Correctness and robustness are different questions, and this page answers only the first. What happens when the bytes are hostile rather than merely wrong — the trust boundary, the memory-safety posture, the per-access-unit resource limits, and the gaps — is Threat model.
What's confirmed against real hardware, and what isn't¶
The codec itself is platform-independent; only capture, monitor playback and IEC 61937 passthrough touch sound hardware, and how far each is verified differs by platform and by sink — covered where it's most relevant rather than repeated here:
- Windows —
MonitorSinkand exclusive-mode passthrough bitstreaming (AC-3, E-AC-3 and signed Atmos) are both confirmed against real hardware, an Onkyo TX-RZ740 over HDMI. - Linux — the ALSA backend is verified headless only; no real S/PDIF or HDMI output has been tried.
- macOS — the CoreAudio backend is CI-verified
only: its device-free logic runs under
iclforge-audio-testson hosted runners, but no real Mac hardware has ever run it. - Raspberry Pi — real-hardware validation on
a Pi 4B: the full suite on both compilers, ALSA device enumeration against the Pi's real
vc4hdmiHDMI outputs, an inspected arm64.deb, and live HDMI passthrough to a real Atmos-capable AVR — every stream shape tried, including signed Atmos with height channels, locked correctly at zero underruns. - Android (Shield Atmos Demo) — real E-AC-3/Atmos passthrough over HDMI to a real AV receiver, with object audio confirmed reconstructable (not just the panned bed). Verification specific to this one Android app on this one Shield + receiver pair, not a general claim about Android as a platform.
- TrueHD and MLP — nothing has reached hardware: no Dolby decoder, disc player or receiver has read a
TrueHD stream or a MAT burst this project wrote, no sound device is sent one (
PassthroughSinkhas no TrueHD format), and Hearth and Crucible do not link the library. Its only outside reader is FFmpeg. - AC-4 passthrough — no receiver found accepts AC-4, so no AC-4
burst has reached hardware; ALSA's and Android's paths send the bursts as opaque data (ALSA's
runs against ALSA's
nulldevice), and Windows, PipeWire and macOS cannot send AC-4 at all. The AC-4 decoder on an ESP32-P4 board is checked on hardware (above). - ESP32 boards (S3, P4, C6) — the decoders and the Sendspin sink are measured on boards; those pages give the boards, the figures and what only QEMU covers, and QEMU runs no P4 or C6.
- Atmos & JOC — Dolby's own decoder gates object
decoding on a keyed authenticity tag; the signer ships in-tree (
iclforge::ac3::signing) but this project ships no key for it, so its streams are unsigned unless an operator supplies one. Objects sharing a direction also can't be perfectly separated. Neither is a conformance gap.