From a31c8b178d0d1346821597055adf3faf36eae527 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sun, 23 Aug 2026 11:02:09 +0300 Subject: [PATCH] feat(opus-vbr/r1): keep TF boost x1 by measurement; lane report + 14-row sweep --- crates/ec-opus/src/celt_enc.rs | 5 ++++- lanes/opus-vbr-r1.report.md | 36 ++++++++++++++++++++++++++++++++++ lanes/opus-vbr-r1.sweep.txt | 16 +++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 lanes/opus-vbr-r1.report.md create mode 100644 lanes/opus-vbr-r1.sweep.txt diff --git a/crates/ec-opus/src/celt_enc.rs b/crates/ec-opus/src/celt_enc.rs index d0df5316..1ab07265 100644 --- a/crates/ec-opus/src/celt_enc.rs +++ b/crates/ec-opus/src/celt_enc.rs @@ -866,7 +866,10 @@ impl CeltEncoder { target += total_boost - (19 << lm); // TF boost (C:1653-1654): MULT16_32_Q15 is identity in float mode, // SHL32(.., 1) is the x2: 2 * (tf_estimate - 0.044) * target. - target += (2.0 * (tf_estimate - 0.044) * target as f32) as i32; + // Measured deviation: C applies SHL32(.., 1) (x2). On the 14-row + // library gate x2 loses .003 corr on reelm/hein@64 vs x1 (lane + // opus-vbr r2 vs r3); our tf_estimate is not scaled like libopus's. + target += ((tf_estimate - 0.044) * target as f32) as i32; // floor depth cap (C:1683-1695): SHR32/MULT16_32_Q15 are identity. { let bins = E_BANDS[NB_BANDS - 2] << lm; diff --git a/lanes/opus-vbr-r1.report.md b/lanes/opus-vbr-r1.report.md new file mode 100644 index 00000000..abb51216 --- /dev/null +++ b/lanes/opus-vbr-r1.report.md @@ -0,0 +1,36 @@ +# lane opus-vbr r1 — libopus `compute_vbr` ported whole — KEEP + +## What +- `celt_enc.rs`: VBR target now follows libopus celt_encoder.c:1605-1716 term by term: `coded_bins` from `lastCodedBands` + intensity, stereo_saving term (`max_frac`/`coded_stereo_dof`), `tot_boost-(19<