From 19ef3ae00b46e38d0c440e42a065c97b4e144aca 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 16:03:14 +0300 Subject: [PATCH] test(opus-reell/r3): error map generalised to any gate source her_err_map_96k -> err_map_vs_libopus; EC_ERRMAP_SRC / EC_ERRMAP_KBPS / EC_ERRMAP_TAG select source, rate and output file, her@96 defaults kept. --- crates/ec-opus/tests/conformance.rs | 18 ++++++++++++------ lanes/opus-her-r1.report.md | 6 +++--- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/crates/ec-opus/tests/conformance.rs b/crates/ec-opus/tests/conformance.rs index bf0dc568..825b75b6 100644 --- a/crates/ec-opus/tests/conformance.rs +++ b/crates/ec-opus/tests/conformance.rs @@ -5282,31 +5282,37 @@ fn short_block_bits_vs_libopus() { // error share) are printed with our encoder flags plus both encoders' coded // decisions — libopus's packets decoded with our decoder, the reell-r2 method. // Frame mapping is in source-sample time (±1 frame of codec delay). -// Output: lanes/opus-her-r1.map.txt. HER_KBPS overrides the rate (default 96). +// Output: lanes/.map.txt (default `opus-her-r1`). HER_KBPS (or +// EC_ERRMAP_KBPS) overrides the rate, EC_ERRMAP_SRC the source file: the map is +// the same analysis for any row of the library gate, not just her@96. // --------------------------------------------------------------------------- #[test] #[ignore] -fn her_err_map_96k() { +fn err_map_vs_libopus() { const SECS: f64 = 120.0; const FRAME: usize = 960; const CH: usize = 2; const HOP: usize = 120; // WIN_STEP: one opus_compare hop = 2.5 ms const HOPS_PER_WIN: usize = 48_000 / HOP; // 1 s window = 400 hops - let kbps_env: u32 = std::env::var("HER_KBPS") + let kbps_env: u32 = std::env::var("EC_ERRMAP_KBPS") + .or_else(|_| std::env::var("HER_KBPS")) .ok() .and_then(|v| v.parse().ok()) .unwrap_or(96); + let tag = std::env::var("EC_ERRMAP_TAG").unwrap_or_else(|_| "opus-her-r1".to_string()); - let src = shellexpand("~/Music/reeli.mp3"); + let src = shellexpand( + &std::env::var("EC_ERRMAP_SRC").unwrap_or_else(|_| "~/Music/reeli.mp3".to_string()), + ); if !src.exists() { eprintln!("SKIP: missing {}", src.display()); return; } let lanes_dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../lanes"); fs::create_dir_all(&lanes_dir).unwrap(); - let scratch = lanes_dir.join("opus-her-r1.scratch.ogg"); - let out_path = lanes_dir.join("opus-her-r1.map.txt"); + let scratch = lanes_dir.join(format!("{tag}.scratch.ogg")); + let out_path = lanes_dir.join(format!("{tag}.map.txt")); let source_pcm = ffmpeg_decode_pcm(&src, SECS); let source_frames = source_pcm.len() / CH; diff --git a/lanes/opus-her-r1.report.md b/lanes/opus-her-r1.report.md index ed3fdd80..a455d858 100644 --- a/lanes/opus-her-r1.report.md +++ b/lanes/opus-her-r1.report.md @@ -3,13 +3,13 @@ **Verdict: no fix. The charter's premise (her@96 err_ratio 10.126, target < 5) is superseded — `706596b` (lane-opus-64, transient_analysis port) already took her@96 from 10.1 → 1.05 and her@64 from 4.65 → 1.10.** This lane delivers the requested -error map (`lanes/opus-her-r1.map.txt`, test `her_err_map_96k`) and the certified +error map (`lanes/opus-her-r1.map.txt`, test `err_map_vs_libopus` (was `her_err_map_96k`, renamed in r3)) and the certified current 14-row baseline. No `src` change: the gate target is met and a change would be tuning a passing row. ## What the map is -`her_err_map_96k` (`#[ignore]`, `crates/ec-opus/tests/conformance.rs`, 30 s): the +`err_map_vs_libopus` (was `her_err_map_96k`, renamed in r3) (`#[ignore]`, `crates/ec-opus/tests/conformance.rs`, 30 s): the gate's exact encode path for both encoders (ffmpeg libopus ref → realised ref_kbps → ours CVBR at that rate), `opus_compare_err_parts` per-2.5 ms-hop ef² bucketed into 1 s windows. Prints top-10 windows by ours/ref ratio and by ours share, with @@ -66,6 +66,6 @@ Worst row is now **reell@96 at 4.499** — the next gate lane's premise. ## Files -- `crates/ec-opus/tests/conformance.rs` — `her_err_map_96k` (commit 233d47e). +- `crates/ec-opus/tests/conformance.rs` — `err_map_vs_libopus` (was `her_err_map_96k`, renamed in r3) (commit 233d47e). - `lanes/opus-her-r1.map.txt` — the map (commit 233d47e). - `lanes/` gate artifacts restored via `git checkout --` after the runs.