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