Error map generalised to any gate source
Browse files at this commit19ef3ae00b46e38d0c440e42a065c97b4e144acaParent: f521fd8- test
- error map generalised to any gate source
2 changed files +15 -9
crates/ec-opus/tests/conformance.rsmodified+12 -6
| @@ -5282,31 +5282,37 @@ fn short_block_bits_vs_libopus() { | ||
| 5282 | 5282 | // error share) are printed with our encoder flags plus both encoders' coded |
| 5283 | 5283 | // decisions — libopus's packets decoded with our decoder, the reell-r2 method. |
| 5284 | 5284 | // Frame mapping is in source-sample time (±1 frame of codec delay). |
| 5285 | -// Output: lanes/opus-her-r1.map.txt. HER_KBPS overrides the rate (default 96). | |
| 5285 | +// Output: lanes/<EC_ERRMAP_TAG>.map.txt (default `opus-her-r1`). HER_KBPS (or | |
| 5286 | +// EC_ERRMAP_KBPS) overrides the rate, EC_ERRMAP_SRC the source file: the map is | |
| 5287 | +// the same analysis for any row of the library gate, not just her@96. | |
| 5286 | 5288 | // --------------------------------------------------------------------------- |
| 5287 | 5289 | |
| 5288 | 5290 | #[test] |
| 5289 | 5291 | #[ignore] |
| 5290 | -fn her_err_map_96k() { | |
| 5292 | +fn err_map_vs_libopus() { | |
| 5291 | 5293 | const SECS: f64 = 120.0; |
| 5292 | 5294 | const FRAME: usize = 960; |
| 5293 | 5295 | const CH: usize = 2; |
| 5294 | 5296 | const HOP: usize = 120; // WIN_STEP: one opus_compare hop = 2.5 ms |
| 5295 | 5297 | const HOPS_PER_WIN: usize = 48_000 / HOP; // 1 s window = 400 hops |
| 5296 | - let kbps_env: u32 = std::env::var("HER_KBPS") | |
| 5298 | + let kbps_env: u32 = std::env::var("EC_ERRMAP_KBPS") | |
| 5299 | + .or_else(|_| std::env::var("HER_KBPS")) | |
| 5297 | 5300 | .ok() |
| 5298 | 5301 | .and_then(|v| v.parse().ok()) |
| 5299 | 5302 | .unwrap_or(96); |
| 5303 | + let tag = std::env::var("EC_ERRMAP_TAG").unwrap_or_else(|_| "opus-her-r1".to_string()); | |
| 5300 | 5304 | |
| 5301 | - let src = shellexpand("~/Music/reeli.mp3"); | |
| 5305 | + let src = shellexpand( | |
| 5306 | + &std::env::var("EC_ERRMAP_SRC").unwrap_or_else(|_| "~/Music/reeli.mp3".to_string()), | |
| 5307 | + ); | |
| 5302 | 5308 | if !src.exists() { |
| 5303 | 5309 | eprintln!("SKIP: missing {}", src.display()); |
| 5304 | 5310 | return; |
| 5305 | 5311 | } |
| 5306 | 5312 | let lanes_dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../lanes"); |
| 5307 | 5313 | fs::create_dir_all(&lanes_dir).unwrap(); |
| 5308 | - let scratch = lanes_dir.join("opus-her-r1.scratch.ogg"); | |
| 5309 | - let out_path = lanes_dir.join("opus-her-r1.map.txt"); | |
| 5314 | + let scratch = lanes_dir.join(format!("{tag}.scratch.ogg")); | |
| 5315 | + let out_path = lanes_dir.join(format!("{tag}.map.txt")); | |
| 5310 | 5316 | |
| 5311 | 5317 | let source_pcm = ffmpeg_decode_pcm(&src, SECS); |
| 5312 | 5318 | let source_frames = source_pcm.len() / CH; |
lanes/opus-her-r1.report.mdmodified+3 -3
| @@ -3,13 +3,13 @@ | ||
| 3 | 3 | **Verdict: no fix. The charter's premise (her@96 err_ratio 10.126, target < 5) is |
| 4 | 4 | superseded — `706596b` (lane-opus-64, transient_analysis port) already took her@96 |
| 5 | 5 | from 10.1 → 1.05 and her@64 from 4.65 → 1.10.** This lane delivers the requested |
| 6 | -error map (`lanes/opus-her-r1.map.txt`, test `her_err_map_96k`) and the certified | |
| 6 | +error map (`lanes/opus-her-r1.map.txt`, test `err_map_vs_libopus` (was `her_err_map_96k`, renamed in r3)) and the certified | |
| 7 | 7 | current 14-row baseline. No `src` change: the gate target is met and a change would |
| 8 | 8 | be tuning a passing row. |
| 9 | 9 | |
| 10 | 10 | ## What the map is |
| 11 | 11 | |
| 12 | -`her_err_map_96k` (`#[ignore]`, `crates/ec-opus/tests/conformance.rs`, 30 s): the | |
| 12 | +`err_map_vs_libopus` (was `her_err_map_96k`, renamed in r3) (`#[ignore]`, `crates/ec-opus/tests/conformance.rs`, 30 s): the | |
| 13 | 13 | gate's exact encode path for both encoders (ffmpeg libopus ref → realised ref_kbps |
| 14 | 14 | → ours CVBR at that rate), `opus_compare_err_parts` per-2.5 ms-hop ef² bucketed |
| 15 | 15 | 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. | ||
| 66 | 66 | |
| 67 | 67 | ## Files |
| 68 | 68 | |
| 69 | -- `crates/ec-opus/tests/conformance.rs` — `her_err_map_96k` (commit 233d47e). | |
| 69 | +- `crates/ec-opus/tests/conformance.rs` — `err_map_vs_libopus` (was `her_err_map_96k`, renamed in r3) (commit 233d47e). | |
| 70 | 70 | - `lanes/opus-her-r1.map.txt` — the map (commit 233d47e). |
| 71 | 71 | - `lanes/` gate artifacts restored via `git checkout --` after the runs. |