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 {
507507 /// send; otherwise it reuses. Each run of
508508 /// blocks sharing one set codes the run's loudest magnitude per bin, so no
509509 /// 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+ blocks
511- /// (stationary), D25 otherwise. `conservative` forces one D45 set per channel for the
512- /// whole frame: the cheapest legal side information.
510+ /// sending block uses D15 for the LFE channel, D25 when block-switched
511+ /// (the short transform's interleaved halves make D15's per-bin cost too
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.
513515 fn plan(&self, coeffs: &[Vec<[f32; COEFFS]>], blksw: &[Vec<bool>], endmant: &[usize], conservative: bool) -> Plan {
514516 let ideal: Vec<Vec<[u8; COEFFS]>> = coeffs
515517 .iter()
crates/ec-ac3/src/lib.rsmodified+7 -4
@@ -10,10 +10,13 @@
1010 //!
1111 //! Contracts worth knowing before implementing against this crate:
1212 //!
13-//! - **Encoding is a fixed-allocation skeleton so far.** [`Ac3Encoder`] writes
14-//! spec-valid syncframes — real MDCT, real bit allocation, real CRCs — but
15-//! with a constant exponent strategy and bit allocation curve rather than a
16-//! psychoacoustic search; see [`encode`] for exactly what is and is not
13+//! - **Encoding has no psychoacoustic model yet.** [`Ac3Encoder`] writes
14+//! spec-valid syncframes — real MDCT, per-block/channel transient-driven
15+//! block switching, an exponent planner (D15/D25/D45/reuse) and a
16+//! 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
1720 //! adaptive yet.
1821 //! - **Truncated input is [`Error::NeedMore`]**, a broken bit stream is
1922 //! [`Error::Corrupt`], and a construct this build does not implement is