forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB8fd360cTahinli2 months ago2655 commits

lib.rs48 lines, 2.3 KiBHistoryRawDownload
1//! Dolby TrueHD and MLP decoding for the edith_codecs family.
2//!
3//! Written from Dolby's public TrueHD/MLP documentation of the bitstream's
4//! *shape* — major sync, per-substream access-unit directory, FIR/IIR filter
5//! parameters, the Huffman/LSB entropy coder and matrixing — not from any
6//! third party's source. The syntax layer ([`sync`]) and the lossless
7//! substream decode ([`decode`], reached through
8//! [`TrueHdDecoder::decode_access_unit`]) are both verified bit-exact
9//! against an external decoder on a real 7.1 Blu-ray remux (first 60 s,
10//! 23 040 000 of 23 040 000 samples) and on externally encoded MLP/TrueHD
11//! mono, stereo and 5.1 streams.
12//!
13//! Scope, stated once so a caller knows what to expect:
14//!
15//! - **In scope**: major sync detection and parsing (format id, sample rate,
16//! channel presentations), the access-unit header's per-substream
17//! directory (end pointers, checksum/parity), and the
18//! three PCM-presentation substreams a real Blu-ray track carries: 2-ch,
19//! 6-ch (5.1) and 8-ch (7.1), each built from restart headers, FIR/IIR
20//! predictor filters, Huffman/LSB residual entropy and the channel
21//! matrixing that turns decorrelated substream channels back into PCM,
22//! plus the stream's own lossless check.
23//! - **Out of scope, refused by name via [`Error::Unsupported`]**: the 4th
24//! substream (16-channel object/Atmos audio) — a different, unrelated
25//! payload riding the same container, not a bigger version of the 3 PCM
26//! presentations above — and any metadata semantics beyond parsing the
27//! bytes (dialogue normalisation curves, downmix hints and the like stay
28//! unopinionated data on the parsed structs, same as this family treats
29//! AC-3's `dialnorm`).
30//!
31//! No unsafe, no panics on malformed input: truncated data is
32//! [`Error::NeedMore`], a bitstream that violates its own rules is
33//! [`Error::Corrupt`], and a construct this build does not implement is
34//! [`Error::Unsupported`] naming *what* and *why*.
35
36#![forbid(unsafe_code)]
37#![warn(missing_docs)]
38
39pub mod decode;
40pub mod encode;
41pub mod sync;
42
43pub use decode::CheckStats;
44pub use ec_core::Error;
45pub use encode::TrueHdEncoder;
46pub use sync::{
47 AccessUnitHeader, MajorSyncFormat, MajorSyncInfo, SubstreamInfo, TrueHdDecoder, frame_length,
48};