Switch the spectral extension noise with the dither option
Browse files at this commit6432e088c0dc1d9bc768d2bc01f6010bfcb54bafParent: 9a40807- fix
- switch the spectral extension noise with the dither option
2 changed files +17 -14
crates/ec-ac3/src/decoder.rsmodified+9 -6
| @@ -38,13 +38,16 @@ pub struct Options { | |||
| 38 | pub drc_scale: f32, | 38 | pub drc_scale: f32, |
| 39 | /// Channel folding, off by default. | 39 | /// Channel folding, off by default. |
| 40 | pub downmix: Downmix, | 40 | pub downmix: Downmix, |
| 41 | - /// Substitute pseudo-random noise for zero-bit mantissas (§7.3.4), which | 41 | + /// Generate the pseudo-random noise the format asks for: dither in place |
| 42 | - /// is what the standard asks a decoder to do and what this defaults to. | 42 | + /// of zero-bit mantissas (§7.3.4) and the blend that fills the spectral |
| 43 | + /// extension band (§E3.6.4.2.4). On by default, because both are what the | ||
| 44 | + /// standard asks a decoder to do. | ||
| 43 | /// | 45 | /// |
| 44 | - /// The sequence itself is implementation-defined ("any reasonably random | 46 | + /// Neither sequence is specified — §7.3.4 says "any reasonably random |
| 45 | - /// sequence"), so two conformant decoders differ by exactly this noise; | 47 | + /// sequence" and §E3.6.4.2.4 just names a zero-mean unit-variance source — |
| 46 | - /// turning it off is how a comparison against another decoder isolates | 48 | + /// so two conformant decoders differ by exactly this noise and nothing |
| 47 | - /// everything else. | 49 | + /// else. Turning it off is how a comparison against another decoder |
| 50 | + /// isolates everything that *is* specified. | ||
| 48 | pub dither: bool, | 51 | pub dither: bool, |
| 49 | } | 52 | } |
| 50 | 53 | ||
crates/ec-ac3/src/lib.rsmodified+8 -8
| @@ -24,19 +24,19 @@ | |||
| 24 | //! it down or off. | 24 | //! it down or off. |
| 25 | //! - **Dialogue normalisation is surfaced, never applied.** §7.6 puts | 25 | //! - **Dialogue normalisation is surfaced, never applied.** §7.6 puts |
| 26 | //! `dialnorm` in the volume control, which is not in this crate. | 26 | //! `dialnorm` in the volume control, which is not in this crate. |
| 27 | -//! - **Dither is on by default** (§7.3.4) but its sequence is | 27 | +//! - **The noise this format asks for is on by default**: dither for zero-bit |
| 28 | -//! implementation-defined, so two conformant decoders differ by exactly that | 28 | +//! mantissas (§7.3.4) and the spectral extension blend (§E3.6.4.2.4). Neither |
| 29 | -//! noise; [`Options::dither`] turns it off when a comparison needs to | 29 | +//! sequence is specified, so two conformant decoders differ by exactly that |
| 30 | +//! noise; [`Options::dither`] turns both off when a comparison needs to | ||
| 30 | //! isolate everything else. | 31 | //! isolate everything else. |
| 31 | //! | 32 | //! |
| 32 | //! Annex E coverage: the adaptive hybrid transform (with its vector and | 33 | //! Annex E coverage: the adaptive hybrid transform (with its vector and |
| 33 | //! gain-adaptive quantizers) and spectral extension are decoded; enhanced | 34 | //! gain-adaptive quantizers) and spectral extension are decoded; enhanced |
| 34 | //! coupling and dependent substreams above 5.1 are refused by name rather than | 35 | //! coupling and dependent substreams above 5.1 are refused by name rather than |
| 35 | -//! decoded wrongly. On a real Dolby Digital Plus stream that uses AHT and | 36 | +//! decoded wrongly. On a real Dolby Digital Plus stream that uses both, the |
| 36 | -//! spectral extension the output tracks ffmpeg's to a per-channel correlation | 37 | +//! coded bins land within 0.01% of ffmpeg's energy and the whole channel within |
| 37 | -//! of 0.994 rather than the 0.9999 the rest of the format reaches — the | 38 | +//! 0.999 correlation once the two decoders' independent noise is taken out of |
| 38 | -//! remaining difference is in the AHT quantizer detail and the two decoders' | 39 | +//! the comparison ([`Options::dither`]). |
| 39 | -//! independent noise sources. | ||
| 40 | //! | 40 | //! |
| 41 | //! No unsafe, no allocation on the block path beyond the output buffer, and no | 41 | //! No unsafe, no allocation on the block path beyond the output buffer, and no |
| 42 | //! dependencies beyond the family IR and DSP crates. | 42 | //! dependencies beyond the family IR and DSP crates. |