//! DTS Coherent Acoustics decoding, from ETSI TS 102 114. //! //! - [`DtsDecoder`] takes core frames (with or without a DTS-HD extension //! substream behind them) and hands back interleaved `f32` audio frames in //! the coded channel layout. //! - [`parse_frame_header`] and [`frame_size`] read the core header alone, //! which is what a container or a raw `.dts` sniffer needs to state a //! track's sample rate, channel count and frame length before decoding. //! - [`exss::parse_exss`] reads a DTS-HD extension substream header. //! //! Contracts worth knowing before implementing against this crate: //! //! - **Every stream word order is accepted**: 16-bit big endian (canonical), //! 16-bit little endian, and 14-bit-in-16 in either byte order. They are //! converted to the canonical bit string before anything is parsed. //! - **Decoding is integer and exact.** The subband samples, the quantizers //! and the synthesis bank are fixed point with 24-bit saturation, so the //! same stream gives the same 24-bit samples everywhere. Output is `f32` //! with 24-bit samples scaled by 2^-23, which `f32` holds without loss. //! - **DTS-HD**: the output is always the backward compatible core. XLL //! (lossless) is not decoded; it is named in [`FrameInfo::xll`] and //! [`Options::refuse_xll`] turns it into an explicit [`Error::Unsupported`]. //! XBR, XXCH and LBR layers are ignored by name in //! [`FrameInfo::hd_extensions_ignored`]. //! - **Downmix flags, dialogue normalisation and dynamic range data are //! surfaced where they are in the header and never applied.** //! - **Truncated input is [`Error::NeedMore`]**, a broken bit stream is //! [`Error::Corrupt`] and a construct this build does not implement is //! [`Error::Unsupported`] naming what and why. No input panics. //! //! The constant tables in [`tables_data`] are generated by //! `tools/gen_dts_tables.py` from the numeric tables printed in ETSI TS 102 114 //! V1.6.1 and checked against them by `tests/spec_tables.rs`; the few tables //! the standard does not print usably are in `tables_residual.rs`. #![forbid(unsafe_code)] #![warn(missing_docs)] #![allow(clippy::needless_range_loop)] mod bits; mod core; mod dct; mod decoder; pub mod exss; mod header; mod huff; mod math; #[allow(missing_docs, clippy::excessive_precision)] pub mod tables_data; mod tables_residual; pub use crate::core::Extensions; pub use decoder::{DtsDecoder, FrameInfo, Options}; pub use ec_core::Error; pub use header::{ find_sync, frame_size, parse_frame_header, to_canonical, FrameHeader, StreamFormat, BIT_RATES, CHANNELS, PCM_RESOLUTION, SAMPLE_RATES, SYNC_CORE, SYNC_CORE_14_BE, SYNC_CORE_14_LE, SYNC_CORE_LE, SYNC_EXSS, };