forge
Explore
Log in

Don't you dare go Hollow

E3: per-region RMS — regressed (gap 0.073, better than geomean but 4.8x baseline)

Browse files at this commit

32bafc88378c699fc2db5b0c4c0ddb7986e98990Ahmet Kaan GümüşParent: 133bf01
crates/ec-vorbis/src/encode.rsmodified+9 -10
@@ -935,15 +935,14 @@ impl VorbisEncoder {
935 /// the whole spectrum is covered exactly once and a peak between two points935 /// the whole spectrum is covered exactly once and a peak between two points
936 /// still raises the floor that has to carry it.936 /// still raises the floor that has to carry it.
937 ///937 ///
938-/// E2 (lane-vorbis-floor r2): returns the per-region geometric mean of |bin|938+/// E3 (lane-vorbis-floor r2): returns the per-region **RMS** of |bin| instead
939-/// (≡ mean dB) **plus `ENVELOPE_MARGIN_DB`** — halfway between the pure939+/// of the max. RMS sits between the geometric mean (E1, dominated by
940-/// envelope (E1, too low → clamp-lift saturation) and the peak (baseline,940+/// noise-floor bins → too low) and the peak (baseline, follows only the
941-/// too high → sparse large q). The margin lifts the floor enough that the941+/// loudest bin). Tried because E1/E2 moved the gap (in the wrong direction):
942-/// loudest bins in each region stay within the residue-book range without the942+/// the trend k=0→6→12→peak was monotonically better, so RMS is expected to
943-/// refit loop, while quieter bins still get a small non-zero q.943+/// land above geomean but still below peak.
944 fn peaks_of(floor: &Floor1, half: usize, spectra: &[&Vec<f32>]) -> Vec<f64> {944 fn peaks_of(floor: &Floor1, half: usize, spectra: &[&Vec<f32>]) -> Vec<f64> {
945 let x = &floor.x_list;945 let x = &floor.x_list;
946- let margin = 10.0_f64.powf(ENVELOPE_MARGIN_DB / 20.0);
947 x.iter()946 x.iter()
948 .map(|&centre| {947 .map(|&centre| {
949 let below = x.iter().filter(|&&o| o < centre).max().copied();948 let below = x.iter().filter(|&&o| o < centre).max().copied();
@@ -952,15 +951,15 @@ fn peaks_of(floor: &Floor1, half: usize, spectra: &[&Vec<f32>]) -> Vec<f64> {
952 let hi = above.map_or(half, |a| ((a + centre) / 2) as usize + 1);951 let hi = above.map_or(half, |a| ((a + centre) / 2) as usize + 1);
953 let lo = lo.min(half - 1);952 let lo = lo.min(half - 1);
954 let hi = hi.clamp(lo + 1, half);953 let hi = hi.clamp(lo + 1, half);
955- let mut sum_log = 0.0f64;954+ let mut sum_sq = 0.0f64;
956 let mut count = 0usize;955 let mut count = 0usize;
957 for spectrum in spectra {956 for spectrum in spectra {
958 for &value in &spectrum[lo..hi] {957 for &value in &spectrum[lo..hi] {
959- sum_log += f64::from(value.abs()).max(1e-9).ln();958+ sum_sq += f64::from(value) * f64::from(value);
960 count += 1;959 count += 1;
961 }960 }
962 }961 }
963- (sum_log / count as f64).exp() * margin962+ (sum_sq / count as f64).sqrt()
964 })963 })
965 .collect()964 .collect()
966 }965 }
lanes/vorbis-psy-r1.sweep.txtmodified+8 -8
@@ -1,9 +1,9 @@
1 source kbps ours_kbps ref_kbps rate% corr_ours corr_ref gap verdict1 source kbps ours_kbps ref_kbps rate% corr_ours corr_ref gap verdict
2-nik 96 83.6 84.5 -1.11 0.7706 0.9903 0.2197 FAIL2+nik 96 83.5 84.5 -1.22 0.9102 0.9903 0.0801 FAIL
3-nik 128 114.1 115.8 -1.45 0.8434 0.9951 0.1517 FAIL3+nik 128 114.6 115.8 -0.96 0.9601 0.9951 0.0351 FAIL
4-her 96 87.3 89.9 -2.80 0.7320 0.9867 0.2547 FAIL4+her 96 88.8 89.9 -1.22 0.8206 0.9867 0.1661 FAIL
5-her 128 119.9 124.9 -4.04 0.8235 0.9927 0.1692 FAIL5+her 128 122.4 124.9 -2.02 0.9238 0.9927 0.0689 FAIL
6-reell 96 84.9 85.5 -0.66 0.8176 0.9923 0.1747 FAIL6+reell 96 84.9 85.5 -0.70 0.9224 0.9923 0.0699 FAIL
7-reell 128 120.8 120.9 -0.01 0.9127 0.9968 0.0841 FAIL7+reell 128 121.0 120.9 +0.13 0.9701 0.9968 0.0267 FAIL
8-dl8a 96 85.9 86.9 -1.18 0.8241 0.9916 0.1675 FAIL8+dl8a 96 85.9 86.9 -1.13 0.8993 0.9916 0.0923 FAIL
9-dl8a 128 116.5 117.8 -1.12 0.8922 0.9957 0.1035 FAIL9+dl8a 128 116.8 117.8 -0.86 0.9520 0.9957 0.0437 FAIL