edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiB86fb0f3Tahinli7 days ago3927 commits
| 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 | //! - **Atmos streams are decoded as their PCM presentations**: a TrueHD |
| 24 | //! stream may carry a 4th substream (Dolby Atmos object audio, a 16-channel |
| 25 | //! extension). It is backward compatible: substreams 0..2 are the ordinary |
| 26 | //! 2-ch, 6-ch and 8-ch PCM presentations, and the decoder reconstructs the |
| 27 | //! highest of them (8-ch, 7.1) exactly as it does for a 3-substream stream. |
| 28 | //! The 4th substream is located through its directory end pointer and |
| 29 | //! skipped, not decoded, the way legacy decoders (ffmpeg's included) do. Its |
| 30 | //! bytes are never read, so its parity is not checked. A directory with more |
| 31 | //! than 4 entries is [`Error::Corrupt`]. |
| 32 | //! - **Out of scope, refused by name via [`Error::Unsupported`]**: decoding the |
| 33 | //! Atmos object audio itself (the 16-channel presentation carried by the 4th |
| 34 | //! substream), a different payload riding the same access unit and not a |
| 35 | //! bigger version of the 3 PCM presentations above; a PCM substream asking |
| 36 | //! for more than 8 matrix channels; and any metadata semantics beyond parsing |
| 37 | //! the bytes (dialogue normalisation curves, downmix hints and the like stay |
| 38 | //! unopinionated data on the parsed structs, same as this family treats |
| 39 | //! AC-3's `dialnorm`). |
| 40 | //! |
| 41 | //! No unsafe, no panics on malformed input: truncated data is |
| 42 | //! [`Error::NeedMore`], a bitstream that violates its own rules is |
| 43 | //! [`Error::Corrupt`], and a construct this build does not implement is |
| 44 | //! [`Error::Unsupported`] naming *what* and *why*. |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | pub use CheckStats; |
| 54 | pub use Error; |
| 55 | pub use TrueHdEncoder; |
| 56 | pub use |
| 57 | |
| 58 | ; |