From 63444aad29b5d4e16e97e520e60bdbb74c681bd8 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 04:41:41 +0300 Subject: [PATCH] =?UTF-8?q?E3:=20HF=20per-region=20RMS=20refuted=20(gap=20?= =?UTF-8?q?0.0073,=20rate=20+2.8%)=20=E2=80=94=20revert=20to=20peak-hold,?= =?UTF-8?q?=20keep=20E2=20tilt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/ec-vorbis/src/encode.rs | 17 ++++++++++++----- lanes/vorbis-psy-r1.sweep.txt | 10 +++++----- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/crates/ec-vorbis/src/encode.rs b/crates/ec-vorbis/src/encode.rs index a7a492e4..12f0309c 100644 --- a/crates/ec-vorbis/src/encode.rs +++ b/crates/ec-vorbis/src/encode.rs @@ -718,17 +718,20 @@ impl VorbisEncoder { } else { MASKING_OFFSET_DB }; - // Per-post headroom tilt: LF boost, HF cut, long blocks only — the - // rate loop's global headroom rebalances the total bitrate. - let tilt: Vec = if plan.is_long { + // Per-post frequency, headroom tilt, and (for HF) the RMS-vs-peak + // choice: long blocks only — the rate loop's global headroom + // rebalances the total bitrate. Short blocks get a flat zero tilt and + // pure peak-hold (hz set to 0 so no post crosses the HF threshold). + let post_hz: Vec = if plan.is_long { bc.floor .x_list .iter() - .map(|&x| headroom_tilt(x as f64 * f64::from(self.config.sample_rate) / (2.0 * half as f64))) + .map(|&x| x as f64 * f64::from(self.config.sample_rate) / (2.0 * half as f64)) .collect() } else { vec![0.0; bc.floor.x_list.len()] }; + let tilt: Vec = post_hz.iter().map(|&hz| headroom_tilt(hz)).collect(); let (floor_values, quantised) = loop { let mut curves: Vec> = vec![Vec::new(); channels]; let mut floor_values: Vec> = vec![Vec::new(); channels]; @@ -971,7 +974,11 @@ impl VorbisEncoder { /// /// Each point owns the coefficients halfway to its neighbours either side, so /// the whole spectrum is covered exactly once and a peak between two points -/// still raises the floor that has to carry it. +/// still raises the floor that has to carry it. Peak-hold is used at every +/// frequency: per-region RMS was tried at HF (>6 kHz, r3 E3) but it lowers the +/// floor estimate, promoting noise-like HF bins to residue and regressing +/// correlation — peak-hold plus the HF headroom tilt zeros them instead, which +/// matches the reference. See lanes/vorbis-floor-r3.report.md. fn peaks_of(floor: &Floor1, half: usize, spectra: &[&Vec]) -> Vec { let x = &floor.x_list; x.iter() diff --git a/lanes/vorbis-psy-r1.sweep.txt b/lanes/vorbis-psy-r1.sweep.txt index fbd9c151..cc79d74e 100644 --- a/lanes/vorbis-psy-r1.sweep.txt +++ b/lanes/vorbis-psy-r1.sweep.txt @@ -1,9 +1,9 @@ source kbps ours_kbps ref_kbps rate% corr_ours corr_ref gap verdict nik 96 83.5 84.5 -1.20 0.9863 0.9903 0.0040 PASS -nik 128 115.0 115.8 -0.63 0.9927 0.9951 0.0024 PASS -her 96 88.1 89.9 -1.98 0.9879 0.9867 -0.0012 PASS -her 128 121.8 124.9 -2.46 0.9917 0.9927 0.0010 PASS +nik 128 115.0 115.8 -0.64 0.9927 0.9951 0.0024 PASS +her 96 88.1 89.9 -1.96 0.9879 0.9867 -0.0012 PASS +her 128 121.8 124.9 -2.49 0.9917 0.9927 0.0011 PASS reell 96 84.6 85.5 -1.08 0.9932 0.9923 -0.0009 PASS reell 128 120.6 120.9 -0.18 0.9969 0.9968 -0.0001 PASS -dl8a 96 86.1 86.9 -0.95 0.9880 0.9916 0.0036 PASS -dl8a 128 117.7 117.8 -0.08 0.9940 0.9957 0.0018 PASS +dl8a 96 86.1 86.9 -0.96 0.9878 0.9916 0.0038 PASS +dl8a 128 117.6 117.8 -0.12 0.9938 0.9957 0.0019 PASS