forge
Explore
Log in

Don't you dare go Hollow

Correct three stale claims about the encoder

Browse files at this commit

f8b6839f28f0828627df5884ac5a976feb471648Ahmet Kaan GümüşParent: 1466a62
  • docs
    • correct three stale claims about the encoder
Show full message
docs(ac3-enc): correct three stale claims about the encoder

Module doc still called the encoder a "fixed-allocation skeleton" with a
"constant exponent strategy" -- it now runs transient-driven block
switching, a D15/D25/D45/reuse exponent planner and a binary-searched
rate loop. plan()'s docstring said block-switched blocks send D15; the
code sends D25 there (D15 is LFE-only) because the short transform's
interleaved halves make D15 too expensive per block. Replaced both with
what the code does and the fill ratios actually measured (roughly
93-99.6%, not a flat >97%).
crates/ec-ac3/src/encode.rsmodified+5 -3
@@ -507,9 +507,11 @@ impl Ac3Encoder {
507 /// send; otherwise it reuses. Each run of507 /// send; otherwise it reuses. Each run of
508 /// blocks sharing one set codes the run's loudest magnitude per bin, so no508 /// blocks sharing one set codes the run's loudest magnitude per bin, so no
509 /// block's mantissa is asked for more than its exponent's headroom. The509 /// block's mantissa is asked for more than its exponent's headroom. The
510- /// sending block uses D15 when block-switched, D45 for a run of 3+ blocks510+ /// sending block uses D15 for the LFE channel, D25 when block-switched
511- /// (stationary), D25 otherwise. `conservative` forces one D45 set per channel for the511+ /// (the short transform's interleaved halves make D15's per-bin cost too
512- /// whole frame: the cheapest legal side information.512+ /// high — see the D25-vs-D15 note below), D45 for a run of 3+ blocks
513+ /// (stationary), D25 otherwise. `conservative` forces one D45 set per
514+ /// channel for the whole frame: the cheapest legal side information.
513 fn plan(&self, coeffs: &[Vec<[f32; COEFFS]>], blksw: &[Vec<bool>], endmant: &[usize], conservative: bool) -> Plan {515 fn plan(&self, coeffs: &[Vec<[f32; COEFFS]>], blksw: &[Vec<bool>], endmant: &[usize], conservative: bool) -> Plan {
514 let ideal: Vec<Vec<[u8; COEFFS]>> = coeffs516 let ideal: Vec<Vec<[u8; COEFFS]>> = coeffs
515 .iter()517 .iter()
crates/ec-ac3/src/lib.rsmodified+7 -4
@@ -10,10 +10,13 @@
10 //!10 //!
11 //! Contracts worth knowing before implementing against this crate:11 //! Contracts worth knowing before implementing against this crate:
12 //!12 //!
13-//! - **Encoding is a fixed-allocation skeleton so far.** [`Ac3Encoder`] writes13+//! - **Encoding has no psychoacoustic model yet.** [`Ac3Encoder`] writes
14-//! spec-valid syncframes — real MDCT, real bit allocation, real CRCs — but14+//! spec-valid syncframes — real MDCT, per-block/channel transient-driven
15-//! with a constant exponent strategy and bit allocation curve rather than a15+//! block switching, an exponent planner (D15/D25/D45/reuse) and a
16-//! psychoacoustic search; see [`encode`] for exactly what is and is not16+//! binary-searched SNR-offset rate loop that fills a frame to roughly
17+//! 93-99.6% of its budget depending on content and bit rate — but the bit
18+//! allocation curve itself is the standard's masking model rather than a
19+//! perceptual search; see [`encode`] for exactly what is and is not
17 //! adaptive yet.20 //! adaptive yet.
18 //! - **Truncated input is [`Error::NeedMore`]**, a broken bit stream is21 //! - **Truncated input is [`Error::NeedMore`]**, a broken bit stream is
19 //! [`Error::Corrupt`], and a construct this build does not implement is22 //! [`Error::Corrupt`], and a construct this build does not implement is