forge
Explore
Log in

Don't you dare go Hollow

E3: HF per-region RMS refuted (gap 0.0073, rate +2.8%) — revert to peak-hold, keep E2 tilt

Browse files at this commit

63444aad29b5d4e16e97e520e60bdbb74c681bd8Ahmet Kaan GümüşParent: 8c3661e
crates/ec-vorbis/src/encode.rsmodified+12 -5
@@ -718,17 +718,20 @@ impl VorbisEncoder {
718718 } else {
719719 MASKING_OFFSET_DB
720720 };
721- // Per-post headroom tilt: LF boost, HF cut, long blocks only — the
722- // rate loop's global headroom rebalances the total bitrate.
723- let tilt: Vec<f64> = if plan.is_long {
721+ // Per-post frequency, headroom tilt, and (for HF) the RMS-vs-peak
722+ // choice: long blocks only — the rate loop's global headroom
723+ // rebalances the total bitrate. Short blocks get a flat zero tilt and
724+ // pure peak-hold (hz set to 0 so no post crosses the HF threshold).
725+ let post_hz: Vec<f64> = if plan.is_long {
724726 bc.floor
725727 .x_list
726728 .iter()
727- .map(|&x| headroom_tilt(x as f64 * f64::from(self.config.sample_rate) / (2.0 * half as f64)))
729+ .map(|&x| x as f64 * f64::from(self.config.sample_rate) / (2.0 * half as f64))
728730 .collect()
729731 } else {
730732 vec![0.0; bc.floor.x_list.len()]
731733 };
734+ let tilt: Vec<f64> = post_hz.iter().map(|&hz| headroom_tilt(hz)).collect();
732735 let (floor_values, quantised) = loop {
733736 let mut curves: Vec<Vec<f32>> = vec![Vec::new(); channels];
734737 let mut floor_values: Vec<Vec<i32>> = vec![Vec::new(); channels];
@@ -971,7 +974,11 @@ impl VorbisEncoder {
971974 ///
972975 /// Each point owns the coefficients halfway to its neighbours either side, so
973976 /// the whole spectrum is covered exactly once and a peak between two points
974-/// still raises the floor that has to carry it.
977+/// still raises the floor that has to carry it. Peak-hold is used at every
978+/// frequency: per-region RMS was tried at HF (>6 kHz, r3 E3) but it lowers the
979+/// floor estimate, promoting noise-like HF bins to residue and regressing
980+/// correlation — peak-hold plus the HF headroom tilt zeros them instead, which
981+/// matches the reference. See lanes/vorbis-floor-r3.report.md.
975982 fn peaks_of(floor: &Floor1, half: usize, spectra: &[&Vec<f32>]) -> Vec<f64> {
976983 let x = &floor.x_list;
977984 x.iter()
lanes/vorbis-psy-r1.sweep.txtmodified+5 -5
@@ -1,9 +1,9 @@
11 source kbps ours_kbps ref_kbps rate% corr_ours corr_ref gap verdict
22 nik 96 83.5 84.5 -1.20 0.9863 0.9903 0.0040 PASS
3-nik 128 115.0 115.8 -0.63 0.9927 0.9951 0.0024 PASS
4-her 96 88.1 89.9 -1.98 0.9879 0.9867 -0.0012 PASS
5-her 128 121.8 124.9 -2.46 0.9917 0.9927 0.0010 PASS
3+nik 128 115.0 115.8 -0.64 0.9927 0.9951 0.0024 PASS
4+her 96 88.1 89.9 -1.96 0.9879 0.9867 -0.0012 PASS
5+her 128 121.8 124.9 -2.49 0.9917 0.9927 0.0011 PASS
66 reell 96 84.6 85.5 -1.08 0.9932 0.9923 -0.0009 PASS
77 reell 128 120.6 120.9 -0.18 0.9969 0.9968 -0.0001 PASS
8-dl8a 96 86.1 86.9 -0.95 0.9880 0.9916 0.0036 PASS
9-dl8a 128 117.7 117.8 -0.08 0.9940 0.9957 0.0018 PASS
8+dl8a 96 86.1 86.9 -0.96 0.9878 0.9916 0.0038 PASS
9+dl8a 128 117.6 117.8 -0.12 0.9938 0.9957 0.0019 PASS