Capabilities and limitations¶
What the library encodes, decodes, inspects and measures, with the spec sections each claim comes from, and the two limitations that shape how the output can be used. These tables are the project's capability record: CONTRIBUTING.md makes this page and Validation the authority, so a new capability or a newly found limitation lands here first and everything else summarises it.
For a compact done / partial / not-started view across every codec and bitstream feature, see Development status — a parallel summary of this page, not a second authority. That page also carries a standards cross-check register of open gaps against the cited specs.
Everything below is the library and the shared audio layer beneath it — iclforge::ac3, its
siblings, and iclforge::audio, which belongs to the family rather than to any one member and is
never installed. Forge (forge and forge-gui) and
Crucible reach the codec through the public API described under
What it is, and link iclforge::audio directly.
The application coverage matrix shows which of these broad
capabilities each application exposes.
What it does¶
Encoding¶
This table is AC-3 and E-AC-3. The AC-4 encoder is the iclforge::ac4, the encoder row of Other; the TrueHD encoder is in TrueHD and MLP.
| AC-3 (bsid 8) | E-AC-3 (bsid 16) | |
|---|---|---|
| Coding modes | 1+1 dual mono, 1/0, 2/0, 3/0, 2/1, 3/1, 2/2, 3/2, each with or without LFE (1+1 never carries one) | the same, plus 7.1, 5.1.2, 5.1.4 and 7.1.4 through dependent substreams |
| Programmes per stream | one | up to eight independent substreams can be authored (§E2.3.1.2's I0–I7) — each with its own layout, dialnorm and full mixmdate/bsmod metadata via programmeN= (sample rate and block count are shared across every programme in a stream — §E2.3.1.2 requires it). Receiver-side use of that metadata - combining an associated service with the main programme - is AssociatedServiceMixer (§E3.10; see Decoding) |
| Sample rates | 48, 44.1, 32 kHz | 48, 44.1, 32 kHz, plus the fscod2 half rates 24, 22.05, 16 kHz (Annex E only) |
| Bit rates | CBR only — the 19 nominal rates of Table 5.18, 32–640 kbps | CBR (the same 19, per substream) or VBR — a quality target with optional min/max kbps bounds, per substream |
| Transform | long (512-point) or short (2x256-point) blocks, KBD window, chosen per block per channel by a §8.2.2 transient detector | same |
| Exponents | D15 / D25 / D45, strategy chosen per block from the reuse span (§8.2.8) | the same span rule, per channel per frame, written either as a Table E2.10 code (expstre 0) or as per-block strategies (expstre 1) — whichever the plan needs |
| Coupling | yes (§7.4), begin and end frequencies auto or pinned | yes (§E3.3) |
| Tool selection | coupling/rematrixing/delta always automatic, no toggle | auto picks coupling, spectral extension and AHT per frame from the per-channel rate and the frame's own spectrum — see Encoding E-AC-3 |
| Bit allocation parameters | §8.2.12's basic-encoder set with one measured departure, dbpbcod 3 |
the same set, transmitted rather than inherited (bamode 1, 17 bits a frame) — Table E1.4's own defaults differ from §8.2.12's |
| Delta bit allocation | automatic (§7.2.2.6), like rematrixing below — no toggle | automatic, same as AC-3 |
| Dither substitution | dithflag decided per channel per block from content (§7.3.4) |
the same, except in a frame using spectral extension |
| Rematrixing | yes, 2/0 (§7.5.3 minimum-power rule) | yes, 2/0 — the same rule, over Table 7.25's bands clamped to wherever coupling or spectral extension takes over |
| Annex E tools | — | spectral extension (§E3.6), enhanced coupling (§E3.5), adaptive hybrid transform with GAQ (§E3.4), transient pre-noise processing (§3.7) |
| Objects | panned to a 5.1 bed (no metadata survives) | OAMD + JOC in an EMDF container (TS 103 420) |
Which coding mode a WAV is. A channel count does not say: three channels are 3/0 as FL FR FC
and 2/1 as FL FR BC, four are 2/2 as FL FR BL BR and 3/1 as FL FR FC BC. The header's
dwChannelMask does, and an unnamed [layout] follows it: those four encode as 3/0, 2/1, 2/2
and 3/1, with or without the LFE, and fold to a narrower layout by §7.8's coefficients for the
mode they are (a 2/1 file's lone surround at 0.707 × surmixlev, not at the centre level its
width would suggest). decode writes the mask from three channels up, so its own output
encodes back into the mode it came from, and a transcode keeps a stream's own mode. A file with
no mask is read by its width as it always was (3: L R C, 4: L R Ls Rs, 5: L R C Ls Rs, 6: 5.1),
and a 2/1 or 3/1 programme in one is named with a Table E2.5 list (layout=L,R,Cs).
At 44.1 kHz, CBR needs non-integral frame sizes; the AC-3 encoder alternates between the two
Table 5.18 lengths on a Bresenham accumulator so the long-run rate is exact. E-AC-3 signals
frmsiz directly and needs no such alternation.
Block switching's scope: a §8.2.2 transient detector (cascaded biquad 8 kHz high-pass, a
256/128/64-sample peak-ratio tree) runs per full-bandwidth channel per block; a channel that
switches anywhere in the frame is excluded from coupling for that whole frame. On AC-3 that
exclusion is per channel — chincpl is a per-channel field, so the rest of the frame still
couples — while E-AC-3's coupling decision, and AHT on both, remain frame-wide all-or-nothing.
The LFE never switches (§8.2.2 defines the detector over full-bandwidth channels only).
Dither's scope: a bin the allocator gave no bits to is not transmitted, so the decoder
invents it — a true zero when dithflag is clear, a random sample scaled to that bin's own
exponent when it is set (§7.3.4). Both are wrong, in opposite directions: a run of true zeros is
a hole in the spectrum, and dither over a bin that really was near-silent is noise added to
nothing. The encoders decide per channel per block by comparing the two — the energy the decoder
will not receive against the energy the dither would put there instead — and dither only where
what is being replaced was at least as loud as the substitute. Digital silence is the limiting
case and always reads clear. A block-switched channel never dithers either, on the same grounds
Dolby's own encoder appears to use (dithflag is exactly !blksw in every block of the
reference stream in testdata/external-baseline/): a switched block's coefficient set is two
interleaved half transforms, so filling a zero-bit slot spreads noise across the transient the
switch exists to resolve. On E-AC-3 dither also stays off for any frame using spectral
extension — the encoder holds a reconstruction of the decoder's output there to scale the
extension bands, and the decoder's dither sequence is not reproducible from the encoder's side.
Delta bit allocation's scope: the encoder compares the coarse exponent-only masking curve
§7.2.2.2-7.2.2.5 derive against one built from the real, pre-quantization coefficient magnitude,
and corrects bands where the two clearly diverge (at least a full 6 dB Table 5.17 step). It is
skipped for the LFE channel (no such field exists for it). The coupling channel is in
§7.2.2.6's scope like any full-bandwidth channel on both generations, and cpldeltbae is
emitted whenever correction segments exist. Coupling no longer suppresses it on E-AC-3: a
coupled channel's own below-cplstrtmant baseband carries corrections like any other region.
Two narrowings remain there. An AHT stream carries none — the comparison was put on the AHT
axis, where its exponents actually live, and measured worse on every AHT-carrying point, because
the transform's job is to concentrate six blocks into one coefficient and the gap that opens is
that concentration rather than quantization error. And whether corrections are sent at all is
decided per frame against the rate fit: the frame is fitted with and without them and the higher
composite SNR offset wins, which is what keeps their side information from eating a 128 kbit/s
5.1 frame whose mantissas are already down to about a quarter of it. The decoder accepts delta
bit allocation on any channel, either generation, from any encoder.
Metadata¶
These fields are AC-3 and E-AC-3's. AC-4's loudness, DRC, downmix, dialogue enhancement and presentation metadata is under AC-4 and, for the encoder, Encoding a stream.
| Field | Section | What it does here |
|---|---|---|
dynrng |
§7.7.1 | Per-block dynamic range control from an RMS-detected compressor on a piecewise-linear curve. Five profiles: film-standard, film-light, music-standard, music-light, speech. A/52 fixes the wire format and the intent but not the curve, so the profiles are this project's, not the standard's. |
compr |
§7.7.2 | Heavy compression as a limiter guaranteeing a peak ceiling in the §7.8 mono downmix. Rounds down, because nearest-code rounding can overshoot a ceiling by half a step. Its peak detector includes the previous frame's MDCT overlap. |
dialnorm |
§5.4.2.8 | Measured with ITU-R BS.1770-4 gated loudness and negated, or set directly. A/52 predates BS.1770 and leaves the measurement open. |
| Downmix levels | Tables 5.9/5.10, E1.2, D2.2–D2.6 | cmixlev/surmixlev in AC-3's own bsi; separate Lt/Rt and Lo/Ro levels plus a preferred-downmix indication in E-AC-3's mixmdate and in AC-3's Annex D xbsi1. |
| Programme mixing | Table E1.2, §E2.3.1.12–61 | The rest of mixmdate, written by the independent substream: programme and external-programme scale factors, the mixdef mixing-parameter block (premix compression, per-channel external scales, speech enhancement data), pan position for a mono or 1+1 programme, and per-block mixing configuration. This is what a receiver mixes an audio-description or commentary service against the main programme with, and AssociatedServiceMixer does (see Decoding). |
| Service and production | §5.4.2.2–28, Table E1.2 | bsmod (complete main through commentary and emergency — what ATSC A/53 and DVB key associated-service handling off), dsurmod, dsurexmod, dheadphonmod, adconvtyp, audprodie's mixing level and room type, copyrightb, origbs, langcod, the 28-bit time code, and E-AC-3's sourcefscod. AC-3 carries them in bsi (the Surround EX, Headphone and A/D flags only under Annex D); E-AC-3 gathers the same set into infomdat. |
| Annex D alternate syntax | Annex D, bsid 6 |
AC-3's two 14-bit timecod fields "have never been applied for their originally anticipated purpose" (§D1), so a bsid-6 stream spends them on xbsi1/xbsi2 instead. Encode and decode both sides; §D3.2's promise holds, in that a legacy reader takes those bits for a time code it already ignores. |
Decoding¶
This section is the AC-3 and E-AC-3 decoders. AC-4 has its own, the iclforge::ac4, the decoder row of
Other; TrueHD and MLP have theirs in TrueHD and MLP.
The in-repo decoder shares its tables, bit-allocation engine, exponent decoding and IMDCT with
the encoder. It reads AC-3 (bsid ≤ 8) and E-AC-3 (bsid 11–16), including dependent substreams,
chanmap, and the §E3.8.2 render that lays a dependent's channels over the bed. A stream
carrying more than one programme is decoded one programme at a time — DecoderConfig::programme
picks which — since independent substreams are alternatives rather than layers; an associated service (a description, a commentary) is mixed into the main afterwards by AssociatedServiceMixer, with the gains, per-channel trims and pan §E3.10 gives it. Every Annex E
coding tool decodes too — standard coupling (§E3.3), enhanced coupling (§E3.5, a full FFT-based
phase-restoring reconstruction over 22 sub-bands), spectral extension (§E3.6, including the
pseudo-random noise blend the standard requires but leaves the exact generator unspecified), the
adaptive hybrid transform with GAQ (§E3.4), and transient pre-noise processing (§3.7) —
individually or all stacked together, at every channel layout including 7.1.4.
Transient pre-noise processing holds 1536 samples back per substream that uses it - one frame at
six blocks a syncframe (see What it does not do) - and that holding-back
is not just a decode_substream detail:
Eac3Decoder::decode_access_unit assembles a whole access unit correctly even when only some of
its substreams set the flag, queuing whichever substreams release early rather than losing or
misaligning them against the one still catching up.
Downstream of the coded channels there is an output stage (iclforge/ac3/decoder/output.hpp), off by
default so the decoders stay usable as a reference: §5.4.2.8 dialnorm normalisation onto the
−31 dBFS reference, §7.8's Lo/Ro, Lt/Rt and mono downmixes driven by the stream's own
cmixlev/surmixlev or mixmdate levels, optional LFE mixing, and §7.7's line and RF operating
modes — RF including the overload protection a fold needs but compr (which is computed for the
mono downmix) does not provide. Lt/Rt's surround sum is phase shifted 90°. Layouts
§7.8 has no fold for, because they predate nothing that could code them, are reduced to the
nearest acmod layout first rather than having their extra channels dropped. Verified against
FFmpeg's -ac 2 decode of the same stream.
§7.10 error concealment is opt-in on the same config. A frame that will not decode can be reconstructed from the previous block's overlap — repeated and faded, or muted through the codec's own window — instead of leaving a hard discontinuity in the PCM, with the substitution reported on the result. For E-AC-3, an access unit whose dependent substream will not decode renders its bed rather than failing outright.
DecoderConfig::diagnostics is a consumer-facing diagnostic sink — a plain function pointer,
no allocation, usable from the minimum-footprint decoder profile — for the recoverable events
that concealment's own return value does not carry: a CRC that failed (reported the moment the
check runs, whether or not concealment goes on to recover the frame) and an EMDF payload id this
decoder does not interpret (§H.2.2, skipped without failing the frame). Null by default, at the
cost of one branch per occurrence when it is not set.
TrueHD and MLP¶
iclforge::truehd reads and decodes TrueHD and MLP elementary streams losslessly (TrueHD and MLP). It is written
from the owner's TrueHD (MLP) Reference Specification v3.9; libs/truehd/ERRATA.md records where that and the streams disagree.
| Capability | Status | Checked against |
|---|---|---|
| Access units, major sync (CRC-16), substream directory, restart header (CRC-8), segment parity and CRC-8 | read and written | FFmpeg's strict decode of its encoders' streams |
| Substreams 0 to 2 (up to 8 channels), 44.1 to 192 kHz, 16 and 24 bits, MLP and TrueHD | decoded | FFmpeg: 25 fixtures, sample for sample |
| FIR prediction, Huffman and raw residuals, one matrix set, quantiser step, output shift, lossless check | decoded | FFmpeg |
IIR filter (with its new_states), LSB bypass, several matrices, a permuted ch_assign (also one that changes at each restart), an output shift (also negative, and on a moved channel), 16 bit MLP words, block data length |
decoded | FFmpeg's strict decode of hand-built streams, sample for sample, except the negative shift and the low bits of 16 bit MLP words, which FFmpeg does not apply (verify_truehd_interop.py --handbuilt) |
| Extra data, the directory's DRC word | decoded; the extra data is carried as bytes | FFmpeg decodes the streams that carry them and returns neither: the layouts have no oracle |
| End-of-stream marker in every unit, terminators of both kinds, 16-channel substream 3 | decoded | none: FFmpeg returns two of twenty units, refuses a stream with the shifted terminator, and refuses the substream's restart sync; hand-built streams only |
Noise generator 0 (0x31EA): two noise channels through matrix coefficients |
decoded | FFmpeg's strict decode of a hand-built stream, sample for sample (shr7 is 16 bits as FFmpeg reads it; provisional) |
Noise generator 1 (0x31EB): the table of TH spec §17.4, a non-zero matrix noise shift, LSB bypass |
decoded | FFmpeg's strict decode of hand-built streams at 48, 96 and 192 kHz, sample for sample; the buffer size, start index and stride are measured against FFmpeg (ERRATA entry 44, question 43) |
| Leading bytes before the first major sync | skipped (at most 64 KiB), with a warning; the next unit has to read too | a hand-built stream with junk in front; the owner's fixture with a 16 byte packet in front |
| Heavy DRC in the restart header | not read | the specification does not place it in the header |
| Encoder: 1 to 8 channels, 44.1 to 192 kHz, 16, 20 and 24 bits, restart intervals, an output shift and quantiser step for each channel, pair matrices, FIR prediction up to order 8, codebook and offset choice, the declared peak rate and 75 ms latency, extra data framing, self-verification | written (forge truehd-encode, iclforge_truehd_encoder_*) |
FFmpeg's strict decode, sample for sample (43 cases and a fuzzer) |
Encoder: the 2 and 6 channel presentations as downmixes (DownmixMode::kStandard) |
written | FFmpeg for the full presentation; nothing checks the downmix itself |
| Encoder: IIR filter, LSB bypass, negative output shift, heavy DRC, noise, MLP | refused with a reason | no oracle |
| Containers: MP4, Matroska, MPEG-TS (Blu-ray), IEC 61937 MAT | written and read | FFmpeg's muxers and demuxers, bit-exact; MAT reading has none |
forge: decode, probe, levels, loudness, mkv, mp4, ts, spdif, unspdif, demux, remux, truehd-encode, truehd-atmos |
built | the codec matrix, the gold-reference gate and FFmpeg Validate, against FFmpeg's strict decode |
forge: metadata, normalize, qc and probe's channel meaning, truehd-encode's channel meaning options (TH spec §14) |
built, provisional | FFmpeg's strict decode for "the audio is the same"; no oracle for what the values mean until the DEE set |
forge: transcode, fmp4, monitor, play; MLP encoding; the project file |
refused (exit 1) or not named | no oracle |
| C API: decode and encode | iclforge_truehd_* |
the fixtures through the C API, to FFmpeg's SHA-256 |
| Atmos substream (16 channels) and object audio metadata, the evolution frame | the 16 channel substream is decoded as 16 channels (frac_bits to 15); the evolution frame is read, provisionally, and forge decode truehd-presentation=all writes the channels, the objects (objects_dir, adm_out) and the objects placed on a speaker layout (truehd-render=); forge truehd-atmos and EncoderConfig::object_channels write a 7.1 bed and up to 16 object channels with the metadata. Provisional, and the owner's discs' substream 3 does not decode yet |
the stream's own lossless check and the Python reference for the objects, FFmpeg's strict decode for the bed; none outside this repository for substream 3 or the metadata (libs/truehd/ERRATA.md entries 60 to 64) |
| Content signing of the evolution frame | not built; iclforge::base::crypto is the codec-neutral core it would use |
none; the specification lists the frame's layout and the digest scope as unconfirmed (Signing) |
Protected (Common Encryption) mlpa tracks |
refused by the same reader code as the other codecs | by reading the code only: no fixture or test covers a protected mlpa track |
| Python, JavaScript (WebAssembly) and Rust bindings | not built | follow-ups on the C API |
| Forge GUI, Hearth, Crucible, the ESP32 firmware, the Android demo, the browser modules | not built: none links iclforge::truehd |
ROADMAP |
Inspection¶
Decoding a stream and describing one are different jobs. iclforge::ac3::io::probe (forge probe)
does the second: it reads the bitstream and reports what the stream declares — bsid, sample
rate including Annex E's fscod2 half rates, acmod/lfeon and the resolved layout, bsmod,
chanmap, the substream map, numblkscod, frame and access-unit counts, duration, measured bit
rate and VBR spread, dialnorm/compr/dynrng presence and ranges, EMDF payload ids, OAMD/JOC
with complexity_index and the object/bed configuration, whether an authenticity tag is present,
CRC validity per frame, and how often each coding tool was used — without reconstructing a single
sample.
It reads in two tiers. iclforge::ac3::io::read_frame_header answers for every syncframe whether or not
its audio is readable, so a stream this decoder refuses is still described in full; the real
decoders then run under DecoderConfig::skip_reconstruction, which parses every field exactly
as a full decode does but stops before the inverse transform, for everything only the bitstream
body carries. An opt-in per-block dump reports which Annex E tools each block used and what
exponent strategy each stream carried — the in-repo counterpart of
tools/references/eac3_parse.py, which until now was the only field-level dump in the project
and shipped with nothing.
json=1 emits a versioned JSON document instead of the table; its schema is a stable contract,
documented in Commands. Memory is flat in the length of the stream on both
sides — the input is pulled through a fixed window and the per-frame dump is written as the walk
produces it.
Research trace export¶
iclforge::ac3::verify::FrameTrace/Eac3AccessUnitTrace (iclforge/ac3/verify/mirror.hpp, .../eac3_mirror.hpp)
were built for the in-repo encoder/decoder mirror self-check, but a decode alone fills them just
as well — attach one to DecoderConfig::trace/eac3_trace and it comes back holding per-block,
per-stream exponents, bit allocation pointers, the §7.2.2.6 masking curve and the composite SNR
offset. iclforge/ac3/verify/trace_export.hpp's append_trace_csv/append_trace_json_lines turn that into
one tidy row per (frame, substream, block, stream, kind, index, value) — kind distinguishes the
per-bin exponent/bap curves from the per-band mask one and the per-stream snr_offset
scalar, rather than forcing three different-length arrays into one fixed-width record. Reachable
from Python as ac3.verify.trace_to_csv/trace_to_json_lines; from there,
pandas.read_csv/read_json(lines=True) followed by .to_parquet() is how Parquet is reached —
this library does not carry its own Parquet writer for one research-only export path.
Other¶
| Component | What it is |
|---|---|
iclforge::ac3::io::scan |
Finds access-unit boundaries in a raw elementary stream and reports what it renders, without being told — grouped by programme, so a stream with two independent substreams describes both rather than one at twice the frame rate. iclforge::ac3::io::read_frame_header is the same per-syncframe walk exposed on its own. |
iclforge::ac3::io::probe |
The stream description above (forge probe), as a human table or a versioned JSON contract. |
iclforge::ac4, the inspector |
An AC-4 (ETSI TS 103 190-1/-2) sync-frame/TOC/presentation/substream-group bitstream inspector — channel-coded, A-JOC-coded, direct-coded-object and OAMD substream groups alike — the same probe/JSON contract extended to a second codec (forge probe auto-detects it). It splits sync frames from a whole buffer or from a stream that arrives in pieces (SyncFrameSplitter), and gives the frame rate, the dac4 box describing every presentation (or what it cannot describe), the rule of Annex H.1.2.1 a stream breaks for a CMAF track, the RFC 6381 codec string, and the values an HLS playlist and a DASH manifest state of a track. Audio content it reports by byte range, for iclforge::ac4 to decode. Installed and exported. An A-JOC substream's oamd_common_data() is parsed with the TOC; an OAMD substream's payload, which can carry a second oamd_common_data(), is reported by byte range like audio content. Links nothing from iclforge::ac3 and knows nothing about AC-3 — a peer codec, not an extension. See Validation. |
iclforge::ac4, the decoder |
An AC-4 decoder (libs/ac4/src/decoder, iclforge::ac4::Decoder), written from ETSI TS 103 190-1 and -2 with a second transcription of the syntax in Python: channel-coded substreams from mono to 7.1 in the SIMPLE, ASPX and A-CPL codec modes at every frame rate, with the output level, DRC, dialogue enhancement, the downmix and concealment, streams of several presentations, the presentation chosen as Part 2 4.8.2 has it and its substreams mixed, the immersive elements of 7.0.4, 7.1.4, 9.0.4 and 9.1.4 in every immersive codec mode, in full or core decoding, rendered to the layout asked for by Part 2's channel renderer, the 22.2 element in full decoding as coded (24 channels, checked on constructed streams alone) and the 9.X.4 modes (13 or 14 channels in Table A.27's order, the screen pair folded by Tables 38 to 43's 9.X rows, checked on constructed streams alone), and object audio: A-JOC substreams in full and core decoding and direct-coded objects, each object handed over with its PCM and the Annex F properties its metadata sets for the application to render, and the intermediate spatial format rendered by Part 2's ISF renderer. It reports each presentation and the metadata of the one decoded, and hands its output over a frame or 256 samples at a time. Core decoding and any layout but as coded of a 22.2 source are refused. A SIMPLE-mode substream with an HSF extension decodes at 96 or 192 kHz, with the output level and the downmix (from the text alone: no stream here uses it); A-SPX, A-CPL, the speech spectral frontend, the immersive and 22.2 elements, objects, mixing, dialogue enhancement and DRC's compression are refused at those rates. It builds at ICLFORGE_DECODE_SCALAR=float for a part with a floating-point unit, and in the minimum-footprint decode profile without exceptions; the float decode agrees with the double one to 109 dB or better below A-SPX's crossover and 37 dB or better above it, on every committed stream (testdata/ac4/scalar-agreement.json pins floors 3 dB under those figures). Installed and exported with iclforge::ac4; see AC-4 and Validation. forge-gui's QC, stream player and object page read AC-4 through it, with a presentation of the stream's choosing on the first two (QC), and Hearth's engine plays it. On the ESP32-P4 it builds in the minimum-footprint profile in single precision, behind CONFIG_ICLFORGE_AC4, and plays channel-based AC-4 in hearth_sink: 2.0 in SIMPLE and A-SPX modes in real time, wider layouts slower than that (ESP32-P4). |
iclforge::ac4, the encoder |
An AC-4 encoder (libs/ac4/src/encoder, iclforge::ac4::Encoder), written from the same two standards: mono, stereo, 5.0 and 5.1, and 5.0.4 and 5.1.4 in the immersive element (7.0, 7.1, 7.0.4, 7.1.4 and a 3.0 dialogue substream experimental), in the SIMPLE, ASPX and A-CPL codec modes and, in the immersive layouts, S-CPL and A-SPX with S-CPL, at 48 kHz at every frame rate or at 44.1 kHz, at a constant, average or variable rate, with I-frames where a container needs them, the loudness, DRC, downmix and dialogue enhancement metadata, and several substreams and the presentations of Part 2 Table 53 made of them. Behind experimental.objects it codes objects with their Annex F metadata over time, as an A-JOC substream over a computed downmix or a static 5.0 or 5.1 bed, or as direct-coded object substreams (encoding objects). Encoder::refusal_reason() names the rule a configuration it refuses breaks; each frame comes out as an MP4 sample, and sync_frame() wraps it for a raw file or MPEG-2 TS. Installed and exported with iclforge::ac4; see AC-4 and Validation. forge-gui's AC-4 tab encodes one source through it and echoes the forge ac4-encode line that writes the same bytes (Format and channels), and its Objects tab writes AC-4 objects the same way. |
iclforge::base::crypto content signature + iclforge::ac4 io/content_signature.hpp |
An AC-4 content signature (the pace-ccjf1 scheme of the owner-supplied CS spec v2.6): ECDSA P-256 over SHA-256, the signer information, signed information and certificate chain serialised with Thrift binary, appended after the last sync frame of a raw .ac4 stream, which is otherwise untouched. The core under iclforge::base::crypto (SHA-1/256, ECDSA with RFC 6979 nonces, DER, X.509, PEM, chain validation, the Thrift reader and writer, the signature itself) knows no codec; iclforge::ac4 adds where the blob sits and what the digest covers. Opt-in at every call and bring your own key: the operator's private key and certificate chain, from files, never stored, and no key, certificate or fingerprint of any issuer ships. A verdict is kValid only when the chain leads to a trust_anchors certificate or pin the caller names; one that checks out against nothing the caller trusts is kChecksChainUnanchored, never valid. Certificates are judged at now, the signed date, a given instant or not at all (TimeBasis). Raw .ac4 only: signing an MP4 is out of scope (CS spec v2.6 §8.3.2) and is refused by name; a second signature entry, revocation and digests other than SHA-256 are not implemented. The signer information of §5.3 (publisher UUID and name, product, platform, a 128-byte nonce) is written from the caller's SignerMetadata and reported on verifying; a verifier may require it (OperatorMetadata::kRequire). A signer may also be trusted by its P-256 public key alone (VerifyPolicy::trust_keys, forge ... trust-key=), and a report reduces to one outcome (classify: valid, untrusted, no-signature, unreadable, chain-rejected, signature-invalid, content-altered, metadata-altered, refused-by-policy), printed as result: by forge ac4-verify and returned by the C functions iclforge_ac4_sign_stream / iclforge_ac4_verify_stream. A signature made with your own key does not chain to Dolby's or PACE's trust root, so a licensed Dolby decoder will not treat it as Dolby-authentic (Object signing). See Signing and the open questions in libs/ac4/ERRATA.md. |
iclforge::truehd, the decoder and the encoder |
TrueHD and MLP: a lossless decoder and a TrueHD encoder, in TrueHD and MLP above and TrueHD and MLP in the library. |
iclforge::containers::matroska |
A standalone MKV muxer. Links nothing from iclforge::ac3 and knows nothing about AC-3. Matroska registers no codec ID for AC-4, so it carries none, and none that names an AC-3 core with E-AC-3 dependents (A_AC3 is bsid 10 and below, A_EAC3 is 11 to 16), so it refuses that too. One track, so a stream with several programmes keeps one. Its reader refuses an audio track that declares ContentEncryption (kEncryptedTrack) and decrypts nothing. |
iclforge::containers::mp4 |
A standalone MP4/ISOBMFF muxer, same shape as iclforge::containers::matroska. iclforge::ac3::io::build_codec_config_box builds a spec-correct dac3/dec3 sample-entry box (ETSI TS 102 366 Annex F), Dolby Atmos extension included, straight off the bitstream, and iclforge::ac4::build_dac4() the AC-4 dac4 box from a stream's table of contents. The dec3 describes the lead programme, which is what ScannedStream::access_units holds; build_codec_config_box(stream, BoxProgrammes::kAll) writes one block per independent substream for a track that holds every programme (iclforge::ac3::io::all_programme_access_units() is its samples, one frame period each, in wire order; extract_programme() makes one programme a stream of its own, renumbered as substream 0), and its chan_loc is read from the dependents' chanmap (ETSI TS 102 366 Table F.6.1). An AC-3 core with E-AC-3 dependents (§E2.3.1.2) gets the dec3 too, with the core's bsid. Reading: demux() takes a whole buffer, Reader a stream of chunks, and demux_seekable() a file or any source that can be read at an offset - the way to read an MP4 whose moov follows its mdat in bounded memory, which a stream cannot do. A protected track (an enca sample entry with a sinf: Common Encryption, ISO/IEC 23001-7) is refused with DemuxError::kProtectedTrack and is never read as audio; describe_refusal() names its scheme, original format and default KID, and a track that holds a clear sample entry beside a protected one is refused whole. Nothing decrypts. |
iclforge::containers::mpegts |
A standalone MPEG-2 Transport Stream muxer (PAT + PMT + one PES-wrapped elementary stream — see Out of scope for the multi-service multiplex this deliberately does not build), identifying AC-3/E-AC-3 per either broadcast profile: DVB's ETSI EN 300 468 Annex D descriptors, or ATSC's stream_type 0x81/0x87 with A/52 Annex A and Annex G's own, and AC-4 under DVB's extension descriptor (ATSC never registered AC-4 for MPEG-2 TS - A/342-2 packages it in ISO BMFF segments for ATSC 3.0 - and the muxer refuses the pair). Both descriptors' identification fields are filled in from what iclforge::ac3::io::scan reads off the bitstream, mainid/asvc from the operator (forge ts ... mainid=3, asvc=0,2) and checked against the stream's own bsmod for consistency. iclforge::containers::mpegts::parse_service_descriptor (iclforge::containers::mpegts::demux/Reader's own ReadStream::service) is the read side: a real transport stream's PMT descriptor decodes back into the same field values, not just the codec identification alone. Links nothing from iclforge::ac3 beyond the A/52 field values it is handed. Its reader refuses an audio PID whose packets carry transport_scrambling_control (kScrambled) and descrambles nothing. |
iclforge::ac3::io::strip_objects |
Removes the JOC/OAMD object layer from a Dolby Digital Plus stream at the bitstream level — no decode, no re-encode, bit-identical bed audio — turning a DD+ JOC stream into the plain DD+ 5.1 rendition HLS delivery wants beside it. forge strip-objects. |
iclforge::iab |
A standalone reader for SMPTE ST 2098-2's Immersive Audio Bitstream (IAB) — the format Dolby Atmos cinema masters carry, and that Netflix's IMF pipeline delivers inside MXF track files (SMPTE ST 2067-201). Reads a bare elementary .iab file or a real MXF Track File alike, decodes its lossless AudioDataDLC essence (Annex B, 48 and 96 kHz), and writes elementary IABitstreams, including DLC encoding, and IMF IAB Track Files (ST 2067-201). Links nothing from iclforge::ac3 and knows nothing about AC-3 — on by default, no third-party dependency. See IAB reading. |
iclforge::adm |
A standalone BW64/RF64 + Audio Definition Model reader (container and metadata parsing only — codec-blind by design). Parses the container (ITU-R BS.2088-1) and the ADM XML graph (ITU-R BS.2076-2) on top of the vendored libbw64/libadm (github.com/ebu); links nothing from iclforge::ac3 and knows nothing about AC-3. iclforge::adm maps its object/bed graph, with size, channel lock and TS 103 420 Annex B zone constraints, onto iclforge::ac3::oba::AtmosEncoder's input shape, driven end to end by forge atmos-adm, and lists what it cannot carry per channel — see ADM bridging. Opt-in (-DICLFORGE_BUILD_ADM=ON, needs Boost) — the one component in this project with a third-party dependency. |
iclforge::containers::iamf |
A standalone reader and writer for AOM's IAMF (Immersive Audio Model and Formats) v2.0.0 — codec-blind, same shape as iclforge::containers::mp4/iclforge::containers::matroska. Writes ipcm channel-based Audio Elements (mux(): 7.1.4ch) and object-based ones (mux_objects(), with Parameter Block OBUs animating positions), with trimming, Temporal Delimiters and the Mix Presentation's loudness, as an ISO-BMFF file, a raw OBU stream or movie fragments (FragmentedWriter), and reads all three back, down to the ipcm samples, rebuilding the layers of a scalable channel element (Gain, De-mixer and Recon Gain of section 7.2; reconstruct_channels() does the same for substreams a caller's own Opus, AAC-LC or FLAC decoder produced) and reading the expanded loudspeaker layouts. E-AC-3 can never be an IAMF codec, so the channel-based route is a decode → rewrap bridge — see IAMF and examples/mux_iamf.cpp for the Eac3Decoder round trip. Carries Opus, AAC-LC and FLAC packets a caller's encoder made (mux_coded(), with the decoder_config builders and the roll sample group), reads every IA track of a file, and writes a 64-bit mdat when the media data needs one. It does not encode or decode those codecs, does not apply Common Encryption (a protected track is refused as unsupported) and does not render. |
iclforge::containers::mp4::fragment + iclforge/containers/mp4/hls.hpp + iclforge/containers/mp4/dash.hpp |
Fragmented MP4/CMAF segmenting (init segment + media segments, ISO/IEC 14496-12 §8.8 / ISO/IEC 23000-19) plus HLS media/master playlist and DASH AdaptationSet signaling helpers for the same segments — correct CODECS/codecs (RFC 6381) and, for Dolby Atmos, HLS's CHANNELS="<N>/JOC" (Apple's HLS Authoring Specification), with a multi-rendition master playlist for the paired 5.1 fallback that specification asks for. AC-4 tracks fragment by TS 103 190-2 Annex H, each fragment starting at an I-frame, with the ca4m/ca4s brands and Annex G's DASH descriptors. forge fmp4 wraps the whole thing. |
iclforge::containers::iec61937 |
S/PDIF burst packing: AC-3 byte-exact against FFmpeg's spdif muxer; E-AC-3 (Eac3BurstPacker) verified against FFmpeg's spdif_header_eac3 and Microsoft's own IEC 61937 documentation (both independently fetched, not recalled — see the caveats below). AC-4 (Ac4BurstPacker) in IEC 61937-14's four burst types, written from the standard, its repetition periods and burst sequences checked in iclforge-containers-tests against a second transcription of its tables; no device here accepts AC-4, so none has received it. |
iclforge::containers, TrueHD |
MP4 (mlpa, dmlp), Matroska (A_TRUEHD), MPEG-TS (stream_type 0x83 with the HDMV registration, 188- and 192-byte packets read, 188 written) and MAT (24 access units to a 61,440-byte burst of IEC 61937 data type 22). The layouts are FFmpeg's, a single oracle in each direction, bit-exact over the committed fixtures; no document was found for MP4 and MAT, and no receiver or disc player has read either. See TrueHD in the containers. |
iclforge::audio |
Live input/loopback capture — WASAPI on Windows, ALSA or PipeWire on Linux, CoreAudio on macOS (input only, no loopback) — through a lock-free SPSC ring. |
iclforge::audio::PassthroughSink |
Exclusive-mode/direct bitstream output, AC-3 or E-AC-3 — WASAPI on Windows, ALSA or PipeWire on Linux, CoreAudio on macOS, JNI-bridged AudioTrack on Android. AC-4 on ALSA and Android, whose APIs take IEC 61937 bursts as opaque two-channel data; WASAPI, PipeWire and CoreAudio name the codec, have no AC-4 to name, and refuse it with kUnsupportedFormat. See the caveats below (Windows, Android and Raspberry Pi hardware-confirmed; the CoreAudio backend is not, and PipeWire's negotiation needs a compressed codec enabled on the target node — see Linux audio). |
iclforge::audio::MonitorSink |
Shared-mode PCM playback — WASAPI, ALSA, PipeWire, CoreAudio or AAudio on Android: a non-bitstreamed preview/monitor path that decodes what is being encoded and plays it back on an ordinary output. Confirmed against real Windows hardware. |
iclforge::audio::LivePositionSource |
A live object-position source over OSC 1.0/UDP, draining into iclforge::objects::oba::SceneCursor once per encode frame — for forge live mode=atmos positions=osc:<port> and the GUI live room's "Drive objects from OSC" toggle, replacing the built-in synthetic orbit for whichever objects it drives. Binds loopback (127.0.0.1) unless the operator opts into osc:any:<port> (CLI) or the "any interface" checkbox (GUI). osc is the only implemented positions= scheme — the grammar is scheme-prefixed so MIDI and a game controller could land later without a grammar change, but neither exists yet. This project's first network-facing parser; see Threat model. |
iclforge::ac3::analysis |
Peak/RMS metering with console ballistics, and the Gerzon energy vector over the BS.775 ring. |
iclforge::ac3::meta::qc |
Bitstream-aware loudness QC (forge qc): decodes a stream, measures it with the real BS.1770-4/EBU Tech 3342 meter, and compares against the stream's own embedded dialnorm/compr and, optionally, a named delivery-spec gate — EBU R 128 s2, ATSC A/85, or Netflix's Sound Mix Specifications, each preset's target/tolerance/true-peak ceiling cited from its own primary source. |
What it does not do¶
The full picture — verification gaps, quality numbers, and exactly what has and has not been confirmed against real hardware — is Validation, not here. Three gaps are load-bearing enough to flag up front:
Objects will not decode as objects in Dolby's decoder
DD+ JOC gates object decoding on a keyed, sequence-bound HMAC-SHA-256 tag in the EMDF
protection field — which the standard itself leaves "implementation dependent and not
defined" — keyed on a secret embedded in decoder binaries. Streams from here are
spec-correct (FFmpeg validates them, the bed decodes bit-exactly, Dolby's own parser reports
atmos=true) but this project ships no key, so by default they are unsigned and Dolby's
decoder falls back to the 5.1 bed; an operator who has a key can sign with it — see
Object signing. The gate is authenticity, not conformance. "Protection" here
names that authenticity tag. It encrypts nothing and has no relation to content protection
(Common Encryption, DRM) or to a Common Encryption key ID. Forging
the tag is deliberately not attempted. What is verified about reconstruction is the
mathematics: §6.6.6 applied per band recovers each object to better than −20 dB.
Linux audio output has reached a real receiver on one machine only
The ALSA backend was verified headless (including against ALSA's software null device,
under ASan+UBSan), and has since bitstreamed to a real receiver for real on exactly one
machine: a Raspberry Pi 4B driving an Atmos-capable AVR over HDMI, everything from plain AC-3
through signed Atmos/JOC locking correctly (see
Raspberry Pi, which is
also where the vc4-hdmi device-classifier bug that run found is written up). The PipeWire
backend reached the same receiver on 2026-09-05, on the same Pi: a pre-encoded 5.1 fixture
that the receiver's front panel read as "5.1 DD+", and Crucible's own live engine with a
placed object, read as "Atmos/DD+" at 7.1 — see
the promotion record. PipeWire needs a compressed codec enabled
on the target node by the session manager first, which WirePlumber filled there from the
receiver's EDID. No other Linux machine, sound card or receiver has been tried: treat this as
two confirmed configurations on one box, not as Linux generally.
TrueHD has one independent reference, and nothing outside this project has played it
FFmpeg's truehd and mlp encoders and its decoder are the only independent check of the
library: the decoder returns FFmpeg's samples on its fixtures, and FFmpeg's strict decode
returns the encoder's input. The MP4, Matroska, MPEG-TS and IEC 61937 (MAT) layouts are
FFmpeg's, because the specification gives none; reading MAT has no reference at all, and no
Dolby decoder, disc player or receiver has read a stream or a burst written here. The
16-channel substream, the extra data and the end-of-stream marker in every unit were checked
only against streams built for the purpose. The Atmos substream, heavy DRC, content signing and every binding but the C API are not built.
AC-4 objects have no second decoder, and no receiver has taken AC-4
The decoder refuses core decoding and any layout but as coded of a 22.2 source, and, at 96 or
192 kHz, everything but the SIMPLE codec mode with the output level and the downmix. It decodes
the speech spectral frontend, the efficient high frame rate mode, the 9.X.4 modes and 96 and
192 kHz from the text alone: no stream from outside the project uses any of them (the encoder
writes the efficient high frame rate mode, the 9.X.4 modes and 22.2, behind experimental
options). Object audio has no reference decode to compare with: librempeg
refuses object coding, and DEE writes no A-JOC from this project's masters, so A-JOC is
checked against constructed streams and one third-party file, Chromium's ac4-ajoc.ac4, which
is kept out of the tree. The encoder's objects are experimental, and no reader outside the
project has checked them. AC-4 over IEC 61937 is written from the standard, and no device
here accepts AC-4, so no receiver has been sent it. Of the microcontrollers, only the
ESP32-P4 plays AC-4.
Enhanced coupling has no external decode oracle at all — not even the
FFmpeg-can't-but-the-in-repo-decoder-can situation 7.1.4 is in, since FFmpeg's own Annex E parser
has never read its syntax — so tools/ci/quality_race.py's CI gate scores it through this
project's own decoder instead (see Validation).
Transient pre-noise processing has a partial one: FFmpeg reads its streams but does not apply the
correction, and a Dolby Encoding Engine stream that uses the tool is scored in the gold-reference
gate. Neither tool is in the auto tool set: enhanced coupling measures better than standard
coupling on real programme material at every bitrate and layout tried and is kept out purely so
auto produces streams FFmpeg can read, while transient pre-noise processing measured 6.5–24 dB
worse than leaving the audio alone over exactly the samples it touches, at every bitrate, with no
perceptual movement either way — a reference-correctness tool rather than a quality one.
Encoding E-AC-3 carries both measurements, and says
what the second predates. Transient pre-noise processing's 1536-sample decoder hold-back is an API
characteristic, not a gap; Decoding covers it. Variable bit rate is E-AC-3 only — AC-3's frame size indexes Table 5.18 rather than
stating a word count directly, so it has no equivalent and stays CBR.