diff --git a/crates/ec-vorbis/src/decode.rs b/crates/ec-vorbis/src/decode.rs index 29e7ec8c..0c451599 100644 --- a/crates/ec-vorbis/src/decode.rs +++ b/crates/ec-vorbis/src/decode.rs @@ -47,6 +47,14 @@ pub struct VorbisDecoder { next_pts: Option, frames: VecDeque, drained: bool, + /// Per-block captured decoded residue: (half, per-channel integer residue). + /// Populated only when `enable_residue_capture` is set. + residue_capture: Vec<(usize, Vec>)>, + /// Per-block bit split captured alongside: (floor bits, residue bits, packet bits). + bit_split: Vec<(u64, u64, u64)>, + /// When true, `decode_audio` copies each block's residue (after inverse + /// coupling, before floor multiply) into `residue_capture`. + enable_residue_capture: bool, } impl VorbisDecoder { @@ -85,6 +93,9 @@ impl VorbisDecoder { next_pts: None, frames: VecDeque::new(), drained: false, + residue_capture: Vec::new(), + bit_split: Vec::new(), + enable_residue_capture: false, ident, comments, setup, @@ -146,6 +157,8 @@ impl VorbisDecoder { } let mapping = &self.setup.mappings[mode.mapping]; + let packet_bits = u64::from(data.len() as u64) * 8; + let before_floors = bits.remaining(); let mut floors = Vec::with_capacity(channels); let mut no_residue = Vec::with_capacity(channels); for &submap in mapping.mux.iter().take(channels) { @@ -160,6 +173,7 @@ impl VorbisDecoder { no_residue.push(state.is_unused()); floors.push(state); } + let after_floors = bits.remaining(); // A coupled pair shares its residue, so one live channel keeps both. for &(magnitude, angle) in &mapping.coupling { if !no_residue[magnitude] || !no_residue[angle] { @@ -224,6 +238,20 @@ impl VorbisDecoder { spectra[angle] = angles; } + if self.enable_residue_capture { + let after_residues = bits.remaining(); + self.bit_split.push(( + before_floors - after_floors, + after_floors - after_residues, + packet_bits, + )); + let captured: Vec> = spectra + .iter() + .map(|ch| ch.iter().map(|&v| v.round() as i32).collect()) + .collect(); + self.residue_capture.push((half, captured)); + } + // Floor times residue, then out of the frequency domain. let window = self.windows.get(mode.block_flag, previous_long, next_long); let mdct = match mode.block_flag { @@ -320,8 +348,23 @@ impl VorbisDecoder { self.frames.clear(); self.drained = false; } -} + /// Enable per-block residue capture for offline histogram analysis. + pub fn enable_residue_capture(&mut self) { + self.enable_residue_capture = true; + } + + /// Take the captured per-block residue: each entry is `(half, per-channel integer residue)`. + pub fn take_residue_capture(&mut self) -> Vec<(usize, Vec>)> { + std::mem::take(&mut self.residue_capture) + } + + /// Take the per-block (floor bits, residue bits, packet bits) captured with the residue. + pub fn take_bit_split(&mut self) -> Vec<(u64, u64, u64)> { + std::mem::take(&mut self.bit_split) + } + +} /// Vorbis channel order (§4.3.9) mapped onto [`ChannelLayout`]'s order. /// /// Vorbis orders a 5.1 stream FL, FC, FR, BL, BR, LFE and a 7.1 stream FL, FC, diff --git a/crates/ec-vorbis/src/encode.rs b/crates/ec-vorbis/src/encode.rs index 71884236..c0ebafbd 100644 --- a/crates/ec-vorbis/src/encode.rs +++ b/crates/ec-vorbis/src/encode.rs @@ -262,6 +262,12 @@ pub struct VorbisEncoder { reservoir_debt: f64, finished: bool, packets: std::collections::VecDeque, + /// Per-block captured quantised residue: (half, per-channel quantised). + /// Populated only when `enable_residue_capture` is set. + residue_capture: Vec<(usize, Vec>)>, + /// When true, `encode_block` copies each block's quantised residue into + /// `residue_capture` for offline histogram analysis. + enable_residue_capture: bool, } impl VorbisEncoder { @@ -358,6 +364,8 @@ impl VorbisEncoder { class_book, residue_books, coupling, + residue_capture: Vec::new(), + enable_residue_capture: false, }) } @@ -376,6 +384,21 @@ impl VorbisEncoder { &self.params } + /// Enable per-block quantised-residue capture for offline histogram analysis. + pub fn enable_residue_capture(&mut self) { + self.enable_residue_capture = true; + } + + /// Take the captured per-block quantised residue: each entry is `(half, per-channel quantised)`. + pub fn take_residue_capture(&mut self) -> Vec<(usize, Vec>)> { + std::mem::take(&mut self.residue_capture) + } + + /// Frequency in Barks for a given Hz — public so tests can bin by band. + pub fn bark_hz(hz: f64) -> f64 { + bark(hz) + } + /// Push planar samples, one slice per channel in [`ec_core::ChannelLayout`] order. pub fn push_planar(&mut self, channels: &[&[f32]]) -> Result<()> { if channels.len() != usize::from(self.config.channels) { @@ -801,6 +824,37 @@ impl VorbisEncoder { break (floor_values, quantised); } }; + if self.enable_residue_capture { + // The bitstream stores the coupled magnitude/angle form; the + // decoder inverse-couples before floor multiply. Capture in that + // same per-channel domain so the histogram matches the decoder- + // side reference capture exactly (sanity: decoding our own .ogg + // reproduces these vectors). + // Main codes the full `half * channels` interleaved region (no + // HF truncation), so every bin below `half` is coded and the + // capture keeps the whole per-channel vector. + let coded = half; + let mut per_channel: Vec> = quantised + .iter() + .map(|ch| { + let mut v = ch[..coded].to_vec(); + v.resize(half, 0); + v + }) + .collect(); + for &(magnitude, angle) in &self.coupling { + let mut mags = std::mem::take(&mut per_channel[magnitude]); + let mut angs = std::mem::take(&mut per_channel[angle]); + for (m, a) in mags.iter_mut().zip(angs.iter_mut()) { + let (l, r) = decouple(*m, *a); + *m = l; + *a = r; + } + per_channel[magnitude] = mags; + per_channel[angle] = angs; + } + self.residue_capture.push((half, per_channel)); + } let mut out = BitsOut::new(); out.bit(false); @@ -1088,6 +1142,18 @@ fn couple(left: i32, right: i32) -> (i32, i32) { }, } } +/// Inverse square-polar coupling on integer residue — the exact inverse of +/// [`couple`] and the integer form of the decoder's §9.4.2 step. Used only to +/// bring the residue capture back to per-channel (magnitude/angle undone) so it +/// matches the decoder-side capture domain. +fn decouple(m: i32, a: i32) -> (i32, i32) { + match (m > 0, a > 0) { + (true, true) => (m, m - a), + (true, false) => (m + a, m), + (false, true) => (m, m + a), + (false, false) => (m - a, m), + } +} /// §7.2.2 `render_point`, which both sides of the floor coding need. fn predict(x0: u32, y0: i32, x1: u32, y1: i32, x: u32) -> i32 { diff --git a/crates/ec-vorbis/tests/oracle.rs b/crates/ec-vorbis/tests/oracle.rs index c0b2766e..73c711c2 100644 --- a/crates/ec-vorbis/tests/oracle.rs +++ b/crates/ec-vorbis/tests/oracle.rs @@ -748,7 +748,337 @@ fn quiet_content_reaches_the_target_or_is_transparent() { } } +/// Per-Bark-band quantised-residue histogram comparison: ours vs libvorbis +/// reference. We encode the source with our encoder (capturing residue), then +/// encode the same source with libvorbis and decode that stream with our own +/// decoder, capturing its decoded residue (after inverse coupling, before +/// floor multiply — the same domain as the encoder's `quantised`). The +/// reference is libvorbis's own residue, so per-band divergence names where +/// our psy spends differently from libvorbis. +#[test] +#[ignore = "slow: encodes 7 sources × 128k, needs ffmpeg/libvorbis"] +fn residue_histogram_vs_reference() { + use std::io::Write; + + let sources: &[(&str, &str)] = &[ + ("nik", "~/Music/reeln.mp4"), + ("reelo", "~/Music/reelo.mp3"), + ("her", "~/Music/reeli.mp3"), + ("reell", "~/Music/reell.mp4"), + ("reelm", "~/Music/reelm.wav"), + ("dl8a", "~/Downloads/8a3b6d1d19.mp3"), + ("hein", "~/Downloads/reelm.mp3"), + ]; + let bitrate = 128_000i32; + let rate = 48_000u32; + let channels = 2u16; + // Limit to ~12 s for speed — enough blocks for a stable histogram. + let max_samples = rate as usize * 12; + + let out_dir = scratch().join("vorbis7"); + std::fs::create_dir_all(&out_dir).expect("out dir"); + let mut report = String::new(); + report.push_str("# Residue histogram: ours vs libvorbis reference\n\n"); + report.push_str(&format!("Bitrate: {} kbps, {} Hz, {}ch, {} s max\n\n", + bitrate / 1000, rate, channels, max_samples / rate as usize)); + let mut total_ours_bytes = 0u64; + let mut total_ref_bytes = 0u64; + + for &(name, src_path) in sources { + let expanded = shellexpand(src_path); + let src = PathBuf::from(&expanded); + if !src.exists() { + report.push_str(&format!("## {name}: SKIP (file not found: {expanded})\n\n")); + continue; + } + // Decode source with ffmpeg, limit duration. + let Some((source_pcm, src_rate)) = ffmpeg_decode_limited(&src, rate, max_samples) else { + report.push_str(&format!("## {name}: SKIP (ffmpeg decode failed)\n\n")); + continue; + }; + if source_pcm.len() < 2 || source_pcm[0].is_empty() { + report.push_str(&format!("## {name}: SKIP (empty decode)\n\n")); + continue; + } + // Resample to 48k if needed — ffmpeg_decode_limited already targets 48k. + let _ = src_rate; + + // --- Ours: encode source with our encoder, capture residue, keep the ogg --- + let ours_ogg = out_dir.join(format!("ours-{name}-128k.ogg")); + let (ours_residue, ours_bytes) = + encode_and_capture(&source_pcm, rate, channels, bitrate, &ours_ogg); + + // --- Sanity: decoding our own ogg with capture on must reproduce the + // encoder's capture band for band, or the two captures are not in the + // same domain and the table below means nothing. --- + let (roundtrip, ours_split) = decode_capture_with_bits(&ours_ogg); + let (sanity_ok, sanity_detail) = compare_captures(&ours_residue, &roundtrip, rate); + let ours_bits = bit_split_summary(&ours_split, &roundtrip); + + // --- Reference: encode with libvorbis, decode with OUR decoder, capture --- + let ref_ogg = out_dir.join(format!("ref-{name}-128k.ogg")); + let ref_status = Command::new("ffmpeg") + // `-vn`: with the video stream still attached (reell, h264+aac mp4) + // ffmpeg's libvorbis wrapper ignores -b:a and encodes at ~3.2x the + // target; audio-only input encodes at the requested rate. + .args(["-y", "-v", "error", "-i"]) + .arg(&src) + .args(["-vn", "-t", &format!("{}", max_samples / rate as usize), + "-ac", "2", "-ar", "48000", + "-c:a", "libvorbis", "-b:a", "128k"]) + .arg(&ref_ogg) + .status(); + let (ref_residue, ref_split) = match ref_status { + Ok(s) if s.success() => decode_capture_with_bits(&ref_ogg), + _ => { + report.push_str(&format!("## {name}: libvorbis encode failed\n\n")); + continue; + } + }; + let ref_bytes = std::fs::metadata(&ref_ogg).expect("ref ogg").len(); + total_ours_bytes += ours_bytes; + total_ref_bytes += ref_bytes; + + // --- Build per-Bark-band histograms --- + let bins = 6; // |q|: 0, 1, 2, 3-4, 5-8, 9+ + let max_bark = 25; + let mut ours_hist = vec![vec![0u64; bins]; max_bark]; + let mut ref_hist = vec![vec![0u64; bins]; max_bark]; + for (half, quantised) in &ours_residue { + accumulate(quantised, *half, rate, &mut ours_hist, max_bark); + } + for (half, quantised) in &ref_residue { + accumulate(quantised, *half, rate, &mut ref_hist, max_bark); + } + + report.push_str(&format!( + "## {name} — sanity {}: {} — ours {} B vs ref {} B ({:.2}x)\n\n", + if sanity_ok { "PASS" } else { "FAIL" }, + sanity_detail, + ours_bytes, + ref_bytes, + ours_bytes as f64 / ref_bytes as f64 + )); + let ref_bits = bit_split_summary(&ref_split, &ref_residue); + for (who, b) in [("ours", ours_bits), ("ref", ref_bits)] { + let (f, r, p, nz) = b; + report.push_str(&format!( + "bits {who}: floor {f} ({:.1}%), residue {r} ({:.1}%), other {}, packet {p}; non-zero {nz}, residue bits/non-zero {:.2}\n", + 100.0 * f as f64 / p.max(1) as f64, + 100.0 * r as f64 / p.max(1) as f64, + p.saturating_sub(f + r), + r as f64 / nz.max(1) as f64 + )); + } + report.push('\n'); + report.push_str("| Bark | q=0 ours/ref | q=1 | q=2 | q=3-4 | q=5-8 | q=9+ | total ours/ref | spend ratio |\n"); + report.push_str("|------|-------------|-----|-----|-------|-------|------|-----------------|-------------|\n"); + for band in 0..max_bark { + let o = &ours_hist[band]; + let r = &ref_hist[band]; + let o_total: u64 = o.iter().sum(); + let r_total: u64 = r.iter().sum(); + if o_total == 0 && r_total == 0 { + continue; + } + // "Spend" = non-zero entries (bins 1..) — proxy for bits spent. + let o_spend: u64 = o[1..].iter().sum(); + let r_spend: u64 = r[1..].iter().sum(); + let ratio = if r_spend > 0 { + o_spend as f64 / r_spend as f64 + } else { f64::INFINITY }; + report.push_str(&format!( + "| {} | {}/{} | {}/{} | {}/{} | {}/{} | {}/{} | {}/{} | {}/{} | {:.2} |\n", + band, o[0], r[0], o[1], r[1], o[2], r[2], o[3], r[3], o[4], r[4], o[5], r[5], + o_total, r_total, ratio, + )); + } + + // Fraction table: per-band share of entries in each |q| class and the + // shape distance = sum |f_ours - f_ref| over the four classes + // (0 = identical spend shape; convergence target < 0.15 in Bark 3-22). + report.push_str("| Bark | f0 ours | f0 ref | f1 ours | f1 ref | f2 ours | f2 ref | f3+ ours | f3+ ref | dist |\n"); + report.push_str("|------|---------|--------|---------|--------|---------|--------|----------|---------|------|\n"); + let frac = |h: &[u64], total: u64| { + vec![ + h[0] as f64 / total as f64, + h[1] as f64 / total as f64, + h[2] as f64 / total as f64, + (h[3] + h[4] + h[5]) as f64 / total as f64, + ] + }; + let mut band_dist: Vec<(usize, f64)> = Vec::new(); + for band in 0..max_bark { + let o_total: u64 = ours_hist[band].iter().sum(); + let r_total: u64 = ref_hist[band].iter().sum(); + if o_total == 0 || r_total == 0 { + continue; + } + let fo = frac(&ours_hist[band], o_total); + let fr = frac(&ref_hist[band], r_total); + let dist: f64 = fo.iter().zip(&fr).map(|(a, b)| (a - b).abs()).sum(); + band_dist.push((band, dist)); + report.push_str(&format!( + "| {} | {:.3} | {:.3} | {:.3} | {:.3} | {:.3} | {:.3} | {:.3} | {:.3} | {:.3} |\n", + band, fo[0], fr[0], fo[1], fr[1], fo[2], fr[2], fo[3], fr[3], dist, + )); + } + let in_scope: Vec<(usize, f64)> = band_dist + .iter() + .filter(|(b, _)| (3..=22).contains(b)) + .cloned() + .collect(); + if !in_scope.is_empty() { + let max_d = in_scope.iter().map(|(_, d)| *d).fold(f64::MIN, f64::max); + let over = in_scope.iter().filter(|(_, d)| *d >= 0.15).count(); + report.push_str(&format!( + "\nshape Bark 3-22: max dist {max_d:.3}, bands >= 0.15: {over}/{} — {}\n", + in_scope.len(), + if over == 0 { "SHAPE PASS" } else { "shape fail" }, + )); + } + report.push_str("\n"); + } + + report.push_str(&format!( + "\nTotal bytes: ours {total_ours_bytes} vs ref {total_ref_bytes} ({:.2}x)\n", + total_ours_bytes as f64 / total_ref_bytes as f64, + )); + let report_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .join("../../lanes/vorbis-psy-r1.histogram.txt"); + let mut f = File::create(&report_path).expect("create report"); + f.write_all(report.as_bytes()).expect("write report"); + println!("Histogram report: {}", report_path.display()); + // Also print to stdout for immediate viewing. + print!("{report}"); +} + +/// Encode PCM with our encoder, capturing per-block quantised residue, and mux +/// the result to `out` so it can be decoded back (sanity check + rate). +fn encode_and_capture( + source: &[Vec], + rate: u32, + channels: u16, + bitrate: i32, + out: &Path, +) -> (Vec<(usize, Vec>)>, u64) { + let mut encoder = VorbisEncoder::new(EncoderConfig { + sample_rate: rate, + channels, + bitrate_bps: bitrate, + quality: 0.6, + }) + .expect("encoder"); + encoder.enable_residue_capture(); + let borrowed: Vec<&[f32]> = source.iter().map(|c| &c[..]).collect(); + encoder.push_planar(&borrowed).expect("push"); + encoder.finish(); + let mut packets = Vec::new(); + loop { + match encoder.next_packet() { + Ok(packet) => packets.push((packet.data, packet.granule)), + Err(e) if e.is_eof() => break, + Err(e) => panic!("encode: {e}"), + } + } + mux(out, &encoder, &packets, rate, channels); + let bytes = std::fs::metadata(out).expect("muxed file").len(); + (encoder.take_residue_capture(), bytes) +} + +/// Decode with ours, capturing per-block residue (after inverse coupling, +/// before floor multiply) — the decoder-side view of the same domain the +/// encoder captures. +fn decode_capture(path: &Path) -> Vec<(usize, Vec>)> { + decode_capture_with_bits(path).0 +} + +/// Bit split summed over the stream: (floor bits, residue bits, packet bits, +/// non-zero residue count) — bits per coded value is the coding-efficiency oracle. +fn bit_split_summary(split: &[(u64, u64, u64)], residue: &[(usize, Vec>)]) -> (u64, u64, u64, u64) { + let (mut f, mut r, mut p) = (0u64, 0u64, 0u64); + for &(a, b, c) in split { + f += a; + r += b; + p += c; + } + let nz: u64 = residue + .iter() + .map(|(_, chs)| chs.iter().map(|c| c.iter().filter(|&&v| v != 0).count() as u64).sum::()) + .sum(); + (f, r, p, nz) +} + +fn decode_capture_with_bits(path: &Path) -> (Vec<(usize, Vec>)>, Vec<(u64, u64, u64)>) { + let mut demuxer = OggDemuxer::open(File::open(path).expect("open")).expect("ogg"); + let stream = demuxer + .streams() + .iter() + .find(|s| s.params.codec == ec_core::CodecId::Vorbis) + .expect("a Vorbis stream") + .clone(); + let extradata = stream.params.extradata.clone().expect("headers"); + let mut decoder = VorbisDecoder::from_extradata(&extradata).expect("headers parse"); + decoder.enable_residue_capture(); + loop { + let packet = match demuxer.next_packet() { + Ok(packet) => packet, + Err(e) if e.is_eof() => break, + Err(e) => panic!("demux {}: {e}", path.display()), + }; + if packet.stream != stream.index { + continue; + } + // A packet the decoder cannot use is skipped, like in `our_decode`. + if decoder.decode_audio(&packet.data).is_err() { + continue; + } + } + let residue = decoder.take_residue_capture(); + let bits = decoder.take_bit_split(); + (residue, bits) +} +/// Bin two captures by Bark and compare every histogram cell. +fn compare_captures( + a: &[(usize, Vec>)], + b: &[(usize, Vec>)], + rate: u32, +) -> (bool, String) { + let bins = 6; + let max_bark = 25; + let mut ha = vec![vec![0u64; bins]; max_bark]; + let mut hb = vec![vec![0u64; bins]; max_bark]; + for (half, q) in a { + accumulate(q, *half, rate, &mut ha, max_bark); + } + for (half, q) in b { + accumulate(q, *half, rate, &mut hb, max_bark); + } + let mut diffs = Vec::new(); + for band in 0..max_bark { + for bucket in 0..bins { + if ha[band][bucket] != hb[band][bucket] { + diffs.push(format!( + "bark {band} q{bucket}: {} vs {}", + ha[band][bucket], hb[band][bucket] + )); + } + } + } + if diffs.is_empty() { + (true, format!("identical histograms ({} vs {} blocks)", a.len(), b.len())) + } else { + (false, format!( + "{} vs {} blocks; first diffs: {}", + a.len(), + b.len(), + diffs.iter().take(5).cloned().collect::>().join("; ") + )) + } +} + +/// Decode with ffmpeg into planar f32, resampled to `rate`, limited to `max_samples`. fn ffmpeg_decode_limited(path: &Path, rate: u32, max_samples: usize) -> Option<(Vec>, u32)> { let out = Command::new("ffmpeg") .args(["-v", "error", "-i"]) @@ -777,8 +1107,36 @@ fn ffmpeg_decode_limited(path: &Path, rate: u32, max_samples: usize) -> Option<( Some((planes, rate)) } +/// Accumulate per-Bark-band |q| histograms from quantised residue. +fn accumulate( + quantised: &[Vec], + half: usize, + rate: u32, + hist: &mut [Vec], + max_bark: usize, +) { + for channel in quantised { + for (bin, &q) in channel.iter().enumerate() { + if bin >= half { + break; + } + let hz = bin as f64 * f64::from(rate) / (2.0 * half as f64); + let bark = VorbisEncoder::bark_hz(hz) as usize; + let band = bark.min(max_bark - 1); + let bucket = match q.abs() { + 0 => 0, + 1 => 1, + 2 => 2, + 3..=4 => 3, + 5..=8 => 4, + _ => 5, + }; + hist[band][bucket] += 1; + } + } +} - +/// Expand `~` in a path string. fn shellexpand(path: &str) -> String { if let Some(rest) = path.strip_prefix("~/") { let home = std::env::var("HOME").unwrap_or_else(|_| "/home".to_string()); @@ -794,7 +1152,7 @@ fn shellexpand(path: &str) -> String { /// unmanaged VBR, 10-30% under nominal on real music), bytes within ±3% of /// it and correlation-to-source within .005 of it. Both encodes decode /// through our decoder so the gap measures the encoders, not the decoders. -/// Writes `lanes/vorbis-reservoir.sweep.txt`. +/// Writes `lanes/vorbis-psy-r1.sweep.txt`. #[test] #[ignore = "slow: encodes 7 full sources × 2 rates, needs ffmpeg/libvorbis"] fn real_library_sweep_vs_reference() { @@ -867,8 +1225,252 @@ fn real_library_sweep_vs_reference() { } eprintln!("\n{table}"); let _ = std::fs::write( - Path::new(env!("CARGO_MANIFEST_DIR")).join("../../lanes/vorbis7-bisect.sweep.txt"), + Path::new(env!("CARGO_MANIFEST_DIR")).join("../../lanes/vorbis-psy-r1.sweep.txt"), &table, ); assert!(failures.is_empty(), "sweep failures: {failures:?}"); } + +/// In-place radix-2 FFT. Only magnitudes and differences of identically +/// transformed spectra are used, so the twiddle sign convention is irrelevant. +fn fft(re: &mut [f64], im: &mut [f64]) { + let n = re.len(); + assert!(n.is_power_of_two()); + let bits = n.trailing_zeros(); + for i in 0..n { + let j = ((i as u32).reverse_bits() >> (32 - bits)) as usize; + if j > i { + re.swap(i, j); + im.swap(i, j); + } + } + let mut len = 2; + while len <= n { + let half = len / 2; + let step = std::f64::consts::TAU / len as f64; + for start in (0..n).step_by(len) { + for k in 0..half { + let angle = step * k as f64; + let (wr, wi) = (angle.cos(), angle.sin()); + let i = start + k; + let j = i + half; + let tr = re[j] * wr - im[j] * wi; + let ti = re[j] * wi + im[j] * wr; + re[j] = re[i] - tr; + im[j] = im[i] - ti; + re[i] += tr; + im[i] += ti; + } + } + len *= 2; + } +} + +/// Per-Bark-band spectral error, ours vs libvorbis, both decoded through our +/// decoder (so the gap measures encoders, not decoders): every 2048-sample +/// Hann frame (hop 1024) of the 48 kHz source, band edges in Hz (25 edges → +/// 24 bands), energies summed over frames and both channels. +/// NSR = 10log10(Σ|X_sig−X_src|²/Σ|X_src|²), E = 10log10(Σ|X_sig|²/Σ|X_src|²). +/// The same pass records the bit split of both streams (the decode-side +/// capture `decode_capture_with_bits` provides), so the bits table covers the +/// same rows without a second encode pass. Writes +/// `lanes/vorbis-psy-r1.bands.txt` and `lanes/vorbis-psy-r1.bits.txt`. +#[test] +#[ignore = "slow: encodes 7 full sources × 2 rates, needs ffmpeg/libvorbis"] +fn band_error_vs_reference() { + use std::io::Write; + + let sources: &[(&str, &str)] = &[ + ("nik", "~/Music/reeln.mp4"), + ("reelo", "~/Music/reelo.mp3"), + ("her", "~/Music/reeli.mp3"), + ("reell", "~/Music/reell.mp4"), + ("reelm", "~/Music/reelm.wav"), + ("dl8a", "~/Downloads/8a3b6d1d19.mp3"), + ("hein", "~/Downloads/reelm.mp3"), + ]; + let rate = 48_000u32; + let max_samples = rate as usize * 600; + let out_dir = scratch().join("vorbis7-bands"); + std::fs::create_dir_all(&out_dir).expect("out dir"); + + const FRAME: usize = 2048; + const HOP: usize = 1024; + const EDGES: [f64; 25] = [ + 100.0, 200.0, 300.0, 400.0, 510.0, 630.0, 770.0, 920.0, 1080.0, 1270.0, 1480.0, 1720.0, + 2000.0, 2320.0, 2700.0, 3150.0, 3700.0, 4400.0, 5300.0, 6400.0, 7700.0, 9500.0, 12000.0, + 15500.0, 24000.0, + ]; + let band_of: Vec> = (0..=FRAME / 2) + .map(|bin| { + let hz = bin as f64 * f64::from(rate) / FRAME as f64; + EDGES.windows(2).position(|w| hz >= w[0] && hz < w[1]) + }) + .collect(); + let window: Vec = (0..FRAME) + .map(|i| 0.5 - 0.5 * (std::f64::consts::TAU * i as f64 / FRAME as f64).cos()) + .collect(); + + let mut bands = String::from("# Band error: ours vs libvorbis, both via our decoder\n\n"); + let mut bits = String::from("# Bit split over full sources, same rows as the band error\n\n"); + let only = std::env::var("SWEEP_ONLY").ok(); + for &(name, src_path) in sources { + if only.as_deref().is_some_and(|o| !o.split(',').any(|n| n == name)) { + continue; + } + let src = PathBuf::from(shellexpand(src_path)); + if !src.exists() { + bands.push_str(&format!("## {name}: SKIP (missing)\n\n")); + continue; + } + let Some((source_pcm, _)) = ffmpeg_decode_limited(&src, rate, max_samples) else { + bands.push_str(&format!("## {name}: SKIP (decode)\n\n")); + continue; + }; + let seconds = source_pcm[0].len() as f64 / f64::from(rate); + let bytes = |p: &Path| std::fs::metadata(p).expect("size").len() as f64; + for &kbps in &[96i32, 128] { + let t0 = std::time::Instant::now(); + let reference = out_dir.join(format!("ref-{name}-{kbps}k.ogg")); + let status = Command::new("ffmpeg") + .args(["-y", "-v", "error", "-i"]) + .arg(&src) + .args(["-vn", "-t", "600", "-ac", "2", "-ar", "48000", "-c:a", "libvorbis", "-b:a", &format!("{kbps}k")]) + .arg(&reference) + .status() + .expect("ffmpeg runs"); + assert!(status.success(), "libvorbis encode of {name} at {kbps}k"); + let ref_kbps = bytes(&reference) * 8.0 / seconds / 1000.0; + // Ours at the size libvorbis actually produced, exactly as the sweep. + let ours = encode_to_file( + &source_pcm, + rate, + (ref_kbps * 1000.0).round() as i32, + &format!("vorbis7-bands/ours-{name}-{kbps}k.ogg"), + ); + let ours_kbps = bytes(&ours) * 8.0 / seconds / 1000.0; + + // PCM through our decoder for the band error; bit split from the + // same file's residue-domain capture (decode twice — the capture + // path returns no PCM). + let (ours_pcm, ours_split) = { + let (residue, split) = decode_capture_with_bits(&ours); + (our_decode(&ours).0, bit_split_summary(&split, &residue)) + }; + let (ref_pcm, ref_split) = { + let (residue, split) = decode_capture_with_bits(&reference); + (our_decode(&reference).0, bit_split_summary(&split, &residue)) + }; + + // Bit-split block: (floor, residue, packet, non-zero) per stream. + let (of, ores, op, onz) = ours_split; + let (rf, rres, rp, rnz) = ref_split; + bits.push_str(&format!( + "## {name} @ {kbps}k (ours {ours_kbps:.1} vs ref {ref_kbps:.1} kbps)\n" + )); + for (who, f, r, p, nz) in [("ours", of, ores, op, onz), ("ref ", rf, rres, rp, rnz)] { + bits.push_str(&format!( + "{who} floor {fb:>10.1}/s ({fpc:5.1}%) residue {rb:>10.1}/s ({rpc:5.1}%) other {ob:>8.1}/s nz {nz:>10} bits/nz {bnz:.2}\n", + fb = f as f64 / seconds, + fpc = 100.0 * f as f64 / p.max(1) as f64, + rb = r as f64 / seconds, + rpc = 100.0 * r as f64 / p.max(1) as f64, + ob = p.saturating_sub(f + r) as f64 / seconds, + bnz = r as f64 / nz.max(1) as f64, + )); + } + bits.push_str(&format!( + "ratio floor {:.3} residue {:.3} bits/nz {:.3}\n\n", + of as f64 / rf.max(1) as f64, + ores as f64 / rres.max(1) as f64, + (ores as f64 / onz.max(1) as f64) / (rres as f64 / rnz.max(1) as f64), + )); + + // Band error: align to the source exactly as the sweep does — + // common length from sample 0 (pre-roll trim inside `our_decode`). + let n = source_pcm[0] + .len() + .min(ours_pcm[0].len()) + .min(ref_pcm[0].len()); + let nb = EDGES.len() - 1; + let (mut e_src, mut e_ours, mut e_ref) = + (vec![0f64; nb], vec![0f64; nb], vec![0f64; nb]); + let (mut err_ours, mut err_ref) = (vec![0f64; nb], vec![0f64; nb]); + let mut spec: Vec<(Vec, Vec)> = + (0..3).map(|_| (vec![0.0; FRAME], vec![0.0; FRAME])).collect(); + let mut start = 0; + while start + FRAME <= n { + for ch in 0..2 { + for (sig, pcm) in [&source_pcm, &ours_pcm, &ref_pcm].iter().enumerate() { + let s = &mut spec[sig]; + for i in 0..FRAME { + s.0[i] = f64::from(pcm[ch][start + i]) * window[i]; + s.1[i] = 0.0; + } + fft(&mut s.0, &mut s.1); + } + for k in 0..=FRAME / 2 { + let Some(b) = band_of[k] else { continue }; + let (sr, si) = (spec[0].0[k], spec[0].1[k]); + e_src[b] += sr * sr + si * si; + let (ur, ui) = (spec[1].0[k], spec[1].1[k]); + e_ours[b] += ur * ur + ui * ui; + let (dr, di) = (ur - sr, ui - si); + err_ours[b] += dr * dr + di * di; + let (vr, vi) = (spec[2].0[k], spec[2].1[k]); + e_ref[b] += vr * vr + vi * vi; + let (er, ei) = (vr - sr, vi - si); + err_ref[b] += er * er + ei * ei; + } + } + start += HOP; + } + let db = |e: f64, s: f64| if s > 0.0 { 10.0 * (e / s).log10() } else { f64::NAN }; + bands.push_str(&format!( + "## {name} @ {kbps}k (ours {ours_kbps:.1} vs ref {ref_kbps:.1} kbps)\n" + )); + bands.push_str("band NSR_ours NSR_ref dNSR E_ours E_ref\n"); + for b in 0..nb { + if e_src[b] == 0.0 { + continue; // no source energy: NSR/E undefined + } + let (nsr_o, nsr_r) = (db(err_ours[b], e_src[b]), db(err_ref[b], e_src[b])); + bands.push_str(&format!( + "{:<8} {:7.1} {:7.1} {:6.1} {:7.1} {:7.1}\n", + format!("{}-{}", EDGES[b] as usize, EDGES[b + 1] as usize), + nsr_o, + nsr_r, + nsr_o - nsr_r, + db(e_ours[b], e_src[b]), + db(e_ref[b], e_src[b]), + )); + } + let corr = |pcm: &[Vec]| { + (0..2) + .map(|c| correlation(&pcm[c][..n], &source_pcm[c][..n])) + .sum::() + / 2.0 + }; + bands.push_str(&format!( + "broadband corr: ours {:.4} ref {:.4}\n\n", + corr(&ours_pcm), + corr(&ref_pcm), + )); + eprintln!( + "{name}@{kbps}k: ours {ours_kbps:.1} ref {ref_kbps:.1} kbps, {:.1} s", + t0.elapsed().as_secs_f32() + ); + } + } + for (text, file) in [ + (&bands, "vorbis-psy-r1.bands.txt"), + (&bits, "vorbis-psy-r1.bits.txt"), + ] { + let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .join("../../lanes") + .join(file); + let mut f = File::create(&path).expect("create report"); + f.write_all(text.as_bytes()).expect("write report"); + println!("{file}: {}", path.display()); + } +} diff --git a/lanes/vorbis-psy-r1.bands.txt b/lanes/vorbis-psy-r1.bands.txt new file mode 100644 index 00000000..f1559dfe --- /dev/null +++ b/lanes/vorbis-psy-r1.bands.txt @@ -0,0 +1,394 @@ +# Band error: ours vs libvorbis, both via our decoder + +## nik @ 96k (ours 84.0 vs ref 84.5 kbps) +band NSR_ours NSR_ref dNSR E_ours E_ref +100-200 -15.5 -21.8 6.3 -0.0 -0.1 +200-300 -12.4 -19.6 7.2 -0.1 -0.1 +300-400 -13.3 -22.8 9.5 -0.2 -0.1 +400-510 -10.6 -20.2 9.6 -0.3 -0.1 +510-630 -9.9 -19.5 9.5 -0.3 -0.1 +630-770 -12.2 -23.3 11.0 -0.2 -0.0 +770-920 -11.4 -21.3 9.8 -0.3 -0.1 +920-1080 -12.6 -22.2 9.6 -0.1 -0.0 +1080-1270 -8.3 -13.9 5.6 -0.5 -0.2 +1270-1480 -9.5 -15.4 5.9 -0.4 -0.2 +1480-1720 -8.9 -13.0 4.2 -0.5 -0.3 +1720-2000 -8.1 -12.8 4.8 -0.7 -0.3 +2000-2320 -6.5 -10.1 3.6 -0.9 -0.3 +2320-2700 -8.6 -12.1 3.6 -0.5 -0.4 +2700-3150 -8.6 -11.0 2.4 -0.6 -0.3 +3150-3700 -9.5 -12.9 3.4 -0.4 -0.3 +3700-4400 -7.9 -11.5 3.6 -0.6 -0.3 +4400-5300 -7.0 -10.6 3.6 -0.4 -0.3 +5300-6400 -3.8 -6.6 2.8 -1.1 -0.2 +6400-7700 -4.9 -6.7 1.7 -1.0 -0.0 +7700-9500 -5.7 -5.8 0.1 -0.6 0.2 +9500-12000 -6.5 -6.2 -0.3 -0.4 0.0 +12000-15500 -4.5 -4.5 -0.1 -1.2 0.5 +15500-24000 0.1 2.0 -1.9 -19.0 -2.3 +broadband corr: ours 0.9690 ref 0.9903 + +## nik @ 128k (ours 115.5 vs ref 115.8 kbps) +band NSR_ours NSR_ref dNSR E_ours E_ref +100-200 -19.5 -24.8 5.3 -0.0 -0.1 +200-300 -15.9 -23.5 7.6 -0.1 -0.1 +300-400 -16.8 -26.6 9.8 -0.1 -0.0 +400-510 -13.6 -24.5 10.9 -0.1 -0.0 +510-630 -12.7 -24.1 11.5 -0.1 -0.0 +630-770 -15.4 -27.5 12.1 -0.1 0.0 +770-920 -14.3 -25.9 11.6 -0.1 -0.0 +920-1080 -15.5 -27.3 11.8 -0.0 0.0 +1080-1270 -10.3 -19.2 8.9 -0.3 -0.1 +1270-1480 -12.0 -20.3 8.3 -0.2 -0.1 +1480-1720 -11.4 -17.4 6.0 -0.2 -0.1 +1720-2000 -10.5 -16.0 5.5 -0.4 -0.2 +2000-2320 -8.8 -12.9 4.2 -0.5 -0.2 +2320-2700 -11.2 -15.1 3.9 -0.3 -0.2 +2700-3150 -11.6 -14.0 2.4 -0.3 -0.2 +3150-3700 -12.6 -15.6 3.0 -0.2 -0.2 +3700-4400 -10.4 -14.1 3.7 -0.2 -0.2 +4400-5300 -8.7 -13.8 5.1 -0.1 -0.2 +5300-6400 -5.3 -9.8 4.5 -0.4 -0.3 +6400-7700 -7.0 -9.9 3.0 -0.3 -0.4 +7700-9500 -7.2 -7.5 0.3 -0.0 -0.3 +9500-12000 -8.0 -8.1 0.0 0.1 -0.4 +12000-15500 -6.4 -6.4 0.1 -0.4 -0.3 +15500-24000 0.1 2.2 -2.2 -19.0 -1.8 +broadband corr: ours 0.9838 ref 0.9951 + +## reelo @ 96k (ours 81.5 vs ref 81.8 kbps) +band NSR_ours NSR_ref dNSR E_ours E_ref +100-200 -14.6 -18.8 4.3 -0.1 -0.1 +200-300 -14.5 -21.5 7.0 -0.1 -0.1 +300-400 -11.7 -21.0 9.3 -0.2 -0.1 +400-510 -11.0 -20.2 9.3 -0.3 -0.1 +510-630 -12.8 -23.8 11.0 -0.1 -0.0 +630-770 -10.4 -20.6 10.2 -0.3 -0.0 +770-920 -10.0 -19.5 9.5 -0.3 -0.1 +920-1080 -8.8 -15.8 7.0 -0.4 -0.2 +1080-1270 -11.0 -16.3 5.4 -0.3 -0.2 +1270-1480 -10.8 -14.0 3.2 -0.3 -0.3 +1480-1720 -10.3 -12.2 2.0 -0.3 -0.3 +1720-2000 -8.1 -11.4 3.3 -0.6 -0.4 +2000-2320 -6.3 -9.8 3.6 -1.0 -0.4 +2320-2700 -5.7 -9.9 4.3 -1.2 -0.3 +2700-3150 -7.2 -11.4 4.2 -0.8 -0.4 +3150-3700 -6.0 -9.9 3.9 -1.1 -0.4 +3700-4400 -6.8 -11.0 4.2 -0.7 -0.4 +4400-5300 -5.4 -8.9 3.5 -1.0 -0.4 +5300-6400 -7.6 -9.1 1.4 -0.6 -0.2 +6400-7700 -7.5 -9.0 1.5 -0.6 -0.1 +7700-9500 -6.4 -7.2 0.8 -0.9 0.2 +9500-12000 -6.4 -7.1 0.7 -1.0 0.2 +12000-15500 -4.7 -5.5 0.8 -1.6 0.6 +15500-24000 -4.1 -8.2 4.0 -1.6 -0.2 +broadband corr: ours 0.9739 ref 0.9922 + +## reelo @ 128k (ours 109.1 vs ref 108.6 kbps) +band NSR_ours NSR_ref dNSR E_ours E_ref +100-200 -18.3 -22.7 4.4 -0.0 -0.1 +200-300 -18.2 -25.3 7.1 -0.0 -0.0 +300-400 -15.1 -25.0 9.9 -0.1 -0.1 +400-510 -13.9 -24.8 10.9 -0.1 -0.0 +510-630 -15.9 -28.4 12.5 -0.0 0.0 +630-770 -13.0 -25.1 12.1 -0.1 -0.0 +770-920 -12.7 -23.5 10.8 -0.2 -0.0 +920-1080 -11.3 -19.0 7.7 -0.2 -0.1 +1080-1270 -13.9 -19.5 5.5 -0.1 -0.1 +1270-1480 -13.7 -16.9 3.2 -0.1 -0.2 +1480-1720 -12.9 -14.5 1.5 -0.1 -0.3 +1720-2000 -10.7 -13.3 2.6 -0.3 -0.3 +2000-2320 -8.6 -11.2 2.6 -0.5 -0.3 +2320-2700 -7.9 -11.4 3.4 -0.7 -0.3 +2700-3150 -9.7 -13.1 3.4 -0.4 -0.3 +3150-3700 -8.4 -11.6 3.2 -0.6 -0.3 +3700-4400 -9.2 -12.4 3.3 -0.3 -0.4 +4400-5300 -7.7 -10.2 2.5 -0.4 -0.4 +5300-6400 -10.1 -10.5 0.3 -0.2 -0.4 +6400-7700 -10.2 -10.6 0.4 -0.2 -0.4 +7700-9500 -9.0 -8.3 -0.7 -0.4 -0.3 +9500-12000 -9.0 -8.4 -0.7 -0.4 -0.3 +12000-15500 -6.7 -7.6 0.9 -0.9 -0.3 +15500-24000 -5.6 -12.3 6.7 -1.2 -0.3 +broadband corr: ours 0.9868 ref 0.9955 + +## her @ 96k (ours 89.9 vs ref 89.9 kbps) +band NSR_ours NSR_ref dNSR E_ours E_ref +100-200 -13.9 -21.6 7.7 -0.0 -0.1 +200-300 -11.4 -20.8 9.4 -0.2 -0.1 +300-400 -10.5 -21.8 11.3 -0.4 -0.1 +400-510 -8.5 -20.3 11.8 -0.6 -0.1 +510-630 -7.6 -17.9 10.2 -0.7 -0.1 +630-770 -9.5 -21.6 12.1 -0.5 -0.1 +770-920 -6.5 -15.2 8.7 -1.0 -0.2 +920-1080 -11.1 -20.8 9.7 -0.2 -0.1 +1080-1270 -6.1 -12.6 6.5 -1.1 -0.4 +1270-1480 -5.6 -10.3 4.7 -1.2 -0.4 +1480-1720 -6.2 -9.9 3.7 -1.1 -0.4 +1720-2000 -5.9 -9.4 3.5 -1.2 -0.5 +2000-2320 -5.3 -7.7 2.4 -1.3 -0.5 +2320-2700 -5.9 -8.5 2.5 -1.2 -0.5 +2700-3150 -5.8 -9.1 3.4 -1.2 -0.5 +3150-3700 -4.7 -7.8 3.1 -1.7 -0.5 +3700-4400 -3.6 -7.5 4.0 -1.6 -0.5 +4400-5300 -2.8 -6.7 3.9 -1.8 -0.5 +5300-6400 -3.1 -4.2 1.1 -1.3 -0.2 +6400-7700 -3.7 -3.1 -0.7 -0.9 -0.1 +7700-9500 -3.1 -1.3 -1.8 -1.2 0.6 +9500-12000 -3.0 -1.3 -1.7 -1.6 0.7 +12000-15500 -3.0 -1.6 -1.4 -1.6 0.7 +15500-24000 -2.3 -0.9 -1.4 -2.4 -3.0 +broadband corr: ours 0.9668 ref 0.9867 + +## her @ 128k (ours 123.5 vs ref 124.9 kbps) +band NSR_ours NSR_ref dNSR E_ours E_ref +100-200 -17.5 -25.0 7.4 -0.0 -0.1 +200-300 -14.7 -24.7 10.0 -0.1 -0.0 +300-400 -13.5 -25.6 12.1 -0.2 -0.0 +400-510 -11.6 -24.3 12.7 -0.2 -0.1 +510-630 -10.2 -22.5 12.2 -0.3 -0.1 +630-770 -12.4 -25.4 13.0 -0.2 -0.0 +770-920 -8.8 -19.8 11.0 -0.5 -0.1 +920-1080 -13.9 -24.6 10.8 -0.1 -0.0 +1080-1270 -8.5 -16.3 7.8 -0.6 -0.3 +1270-1480 -7.7 -14.1 6.4 -0.7 -0.3 +1480-1720 -8.5 -13.9 5.4 -0.6 -0.3 +1720-2000 -8.1 -13.2 5.1 -0.6 -0.3 +2000-2320 -7.5 -11.0 3.5 -0.7 -0.4 +2320-2700 -8.3 -11.6 3.3 -0.6 -0.4 +2700-3150 -8.2 -12.0 3.8 -0.6 -0.4 +3150-3700 -6.8 -10.3 3.4 -0.9 -0.4 +3700-4400 -4.9 -10.1 5.2 -0.9 -0.4 +4400-5300 -3.8 -9.8 5.9 -0.9 -0.4 +5300-6400 -3.5 -10.1 6.6 -0.5 -0.4 +6400-7700 -4.0 -10.9 6.9 -0.2 -0.5 +7700-9500 -3.4 -2.7 -0.6 -0.3 -0.1 +9500-12000 -3.6 -2.1 -1.5 -0.6 -0.0 +12000-15500 -3.9 -2.8 -1.2 -0.8 -0.1 +15500-24000 -3.4 -6.3 2.8 -1.5 -0.4 +broadband corr: ours 0.9810 ref 0.9927 + +## reell @ 96k (ours 85.4 vs ref 85.5 kbps) +band NSR_ours NSR_ref dNSR E_ours E_ref +100-200 -15.4 -20.2 4.7 -0.1 -0.1 +200-300 -14.2 -20.5 6.3 -0.1 -0.1 +300-400 -14.7 -22.9 8.2 -0.1 -0.1 +400-510 -14.0 -22.5 8.4 -0.1 -0.0 +510-630 -11.0 -20.1 9.1 -0.3 -0.1 +630-770 -9.5 -18.2 8.7 -0.4 -0.1 +770-920 -14.2 -22.8 8.7 -0.1 -0.0 +920-1080 -11.7 -19.0 7.3 -0.2 -0.1 +1080-1270 -8.6 -13.3 4.7 -0.5 -0.2 +1270-1480 -11.6 -15.6 4.0 -0.2 -0.2 +1480-1720 -10.6 -13.1 2.5 -0.2 -0.2 +1720-2000 -12.8 -15.4 2.6 -0.2 -0.2 +2000-2320 -7.9 -9.6 1.7 -0.6 -0.4 +2320-2700 -7.9 -10.1 2.2 -0.6 -0.4 +2700-3150 -9.5 -11.5 1.9 -0.4 -0.3 +3150-3700 -8.5 -10.2 1.6 -0.5 -0.3 +3700-4400 -8.6 -10.3 1.7 -0.2 -0.3 +4400-5300 -8.4 -10.5 2.0 0.1 -0.3 +5300-6400 -5.4 -7.0 1.6 -0.6 -0.3 +6400-7700 -5.0 -4.7 -0.2 -0.8 0.1 +7700-9500 -8.0 -5.8 -2.2 -0.2 0.3 +9500-12000 -7.0 -5.7 -1.3 -0.5 0.0 +12000-15500 -1.9 -1.5 -0.4 -2.4 0.8 +15500-24000 -1.5 -5.9 4.3 -3.1 -0.1 +broadband corr: ours 0.9792 ref 0.9923 + +## reell @ 128k (ours 121.3 vs ref 120.9 kbps) +band NSR_ours NSR_ref dNSR E_ours E_ref +100-200 -20.6 -23.6 3.1 -0.0 -0.1 +200-300 -19.2 -24.5 5.3 -0.0 -0.1 +300-400 -19.3 -27.3 8.0 -0.0 -0.0 +400-510 -18.4 -27.2 8.8 -0.0 -0.0 +510-630 -14.9 -25.1 10.1 -0.1 -0.0 +630-770 -13.1 -23.3 10.2 -0.1 -0.0 +770-920 -18.1 -28.0 9.9 -0.0 0.0 +920-1080 -15.1 -24.6 9.5 -0.1 -0.0 +1080-1270 -11.3 -18.8 7.5 -0.2 -0.1 +1270-1480 -14.8 -21.1 6.3 -0.1 -0.1 +1480-1720 -13.8 -18.7 5.0 -0.1 -0.1 +1720-2000 -16.2 -20.3 4.2 -0.1 -0.1 +2000-2320 -11.0 -14.0 3.1 -0.3 -0.2 +2320-2700 -11.1 -14.4 3.3 -0.3 -0.2 +2700-3150 -12.6 -15.5 2.9 -0.2 -0.1 +3150-3700 -11.7 -14.6 2.9 -0.2 -0.2 +3700-4400 -11.0 -14.6 3.6 0.1 -0.2 +4400-5300 -10.5 -14.5 4.0 0.2 -0.2 +5300-6400 -7.3 -11.0 3.7 -0.1 -0.3 +6400-7700 -6.7 -9.3 2.6 -0.2 -0.4 +7700-9500 -9.8 -7.5 -2.3 0.0 -0.3 +9500-12000 -8.7 -7.2 -1.5 -0.1 -0.3 +12000-15500 -2.8 -2.8 0.0 -1.6 -0.1 +15500-24000 -2.6 -9.3 6.7 -2.7 -0.2 +broadband corr: ours 0.9914 ref 0.9968 + +## reelm @ 96k (ours 80.5 vs ref 79.3 kbps) +band NSR_ours NSR_ref dNSR E_ours E_ref +100-200 -19.2 -29.7 10.5 -0.0 0.0 +200-300 -18.7 -30.8 12.2 0.0 0.0 +300-400 -17.4 -27.9 10.5 0.0 0.0 +400-510 -17.7 -28.5 10.8 0.0 0.0 +510-630 -16.6 -28.0 11.4 -0.0 0.0 +630-770 -14.0 -24.1 10.1 -0.1 -0.0 +770-920 -14.9 -23.0 8.1 -0.1 -0.1 +920-1080 -13.4 -19.3 5.8 -0.1 -0.2 +1080-1270 -13.4 -17.1 3.6 -0.1 -0.2 +1270-1480 -14.0 -15.7 1.7 -0.1 -0.3 +1480-1720 -13.4 -13.8 0.4 -0.1 -0.4 +1720-2000 -13.2 -14.0 0.8 -0.1 -0.4 +2000-2320 -11.7 -12.7 0.9 -0.2 -0.4 +2320-2700 -12.0 -11.9 -0.1 -0.2 -0.4 +2700-3150 -12.7 -12.2 -0.5 -0.2 -0.5 +3150-3700 -10.0 -10.6 0.5 -0.4 -0.5 +3700-4400 -10.4 -11.3 1.0 -0.4 -0.4 +4400-5300 -9.9 -9.6 -0.3 -0.4 -0.4 +5300-6400 -11.7 -9.8 -1.9 -0.2 -0.3 +6400-7700 -8.5 -9.4 0.9 -0.6 -0.1 +7700-9500 -8.8 -8.0 -0.8 -0.5 0.1 +9500-12000 -8.2 -9.6 1.4 -0.6 -0.3 +12000-15500 -1.8 -5.6 3.8 -3.2 0.6 +15500-24000 -0.7 -5.5 4.8 -7.0 -0.1 +broadband corr: ours 0.9796 ref 0.9865 + +## reelm @ 128k (ours 93.5 vs ref 91.0 kbps) +band NSR_ours NSR_ref dNSR E_ours E_ref +100-200 -22.4 -34.2 11.8 -0.0 0.0 +200-300 -21.5 -35.3 13.9 0.0 0.1 +300-400 -20.2 -32.9 12.8 0.0 0.0 +400-510 -20.5 -33.3 12.8 0.0 0.0 +510-630 -19.7 -32.2 12.5 0.0 0.0 +630-770 -16.8 -27.5 10.7 -0.0 0.0 +770-920 -17.7 -26.1 8.3 -0.0 -0.0 +920-1080 -16.0 -22.1 6.1 -0.0 -0.1 +1080-1270 -16.2 -19.8 3.6 -0.0 -0.1 +1270-1480 -16.9 -18.2 1.3 -0.0 -0.2 +1480-1720 -16.2 -15.7 -0.5 -0.0 -0.2 +1720-2000 -15.8 -15.9 0.1 -0.0 -0.3 +2000-2320 -14.3 -14.0 -0.3 -0.1 -0.3 +2320-2700 -14.7 -13.1 -1.6 -0.1 -0.4 +2700-3150 -15.6 -13.2 -2.3 -0.1 -0.4 +3150-3700 -12.5 -11.0 -1.5 -0.2 -0.4 +3700-4400 -13.0 -11.7 -1.3 -0.2 -0.4 +4400-5300 -12.6 -10.5 -2.1 -0.2 -0.4 +5300-6400 -14.5 -11.2 -3.3 -0.1 -0.4 +6400-7700 -11.0 -11.0 0.0 -0.3 -0.4 +7700-9500 -11.3 -9.7 -1.6 -0.3 -0.3 +9500-12000 -10.4 -11.2 0.8 -0.3 -0.4 +12000-15500 -2.7 -7.4 4.6 -2.5 -0.2 +15500-24000 -1.0 -7.8 6.8 -5.3 -0.2 +broadband corr: ours 0.9890 ref 0.9906 + +## dl8a @ 96k (ours 86.9 vs ref 86.9 kbps) +band NSR_ours NSR_ref dNSR E_ours E_ref +100-200 -12.7 -21.2 8.5 -0.1 -0.1 +200-300 -13.3 -22.7 9.5 -0.2 -0.1 +300-400 -10.2 -20.8 10.7 -0.3 -0.1 +400-510 -9.9 -21.1 11.2 -0.4 -0.1 +510-630 -11.1 -23.8 12.7 -0.2 -0.0 +630-770 -12.2 -24.1 11.9 -0.2 -0.0 +770-920 -11.1 -21.1 10.0 -0.2 -0.1 +920-1080 -7.9 -15.7 7.9 -0.6 -0.2 +1080-1270 -9.2 -15.3 6.2 -0.5 -0.2 +1270-1480 -10.5 -14.6 4.1 -0.3 -0.3 +1480-1720 -9.2 -12.1 2.9 -0.5 -0.3 +1720-2000 -7.9 -11.5 3.6 -0.7 -0.3 +2000-2320 -6.6 -9.7 3.1 -0.9 -0.3 +2320-2700 -6.6 -9.8 3.2 -1.0 -0.4 +2700-3150 -6.1 -9.8 3.7 -1.1 -0.4 +3150-3700 -6.7 -9.7 3.0 -1.0 -0.4 +3700-4400 -6.4 -9.1 2.7 -0.7 -0.4 +4400-5300 -7.1 -9.5 2.4 -0.1 -0.4 +5300-6400 -5.7 -7.8 2.1 -0.6 -0.2 +6400-7700 -5.4 -7.1 1.7 -0.8 0.0 +7700-9500 -5.7 -6.6 0.8 -0.8 0.2 +9500-12000 -6.2 -7.3 1.1 -0.7 0.0 +12000-15500 -4.3 -5.6 1.3 -1.2 0.4 +15500-24000 -3.4 -1.9 -1.5 -2.1 -3.3 +broadband corr: ours 0.9655 ref 0.9916 + +## dl8a @ 128k (ours 118.7 vs ref 117.8 kbps) +band NSR_ours NSR_ref dNSR E_ours E_ref +100-200 -16.2 -24.7 8.6 -0.0 -0.1 +200-300 -16.9 -26.2 9.3 -0.1 -0.0 +300-400 -13.2 -24.9 11.7 -0.1 -0.0 +400-510 -12.9 -25.7 12.8 -0.2 -0.0 +510-630 -13.9 -28.5 14.6 -0.1 0.0 +630-770 -15.1 -28.7 13.6 -0.1 0.0 +770-920 -14.0 -25.7 11.6 -0.1 -0.0 +920-1080 -10.4 -20.0 9.6 -0.3 -0.1 +1080-1270 -12.0 -19.6 7.6 -0.3 -0.1 +1270-1480 -13.2 -18.9 5.7 -0.2 -0.2 +1480-1720 -11.9 -15.8 3.9 -0.2 -0.2 +1720-2000 -10.3 -14.6 4.3 -0.3 -0.2 +2000-2320 -9.1 -12.3 3.2 -0.4 -0.3 +2320-2700 -9.2 -12.5 3.3 -0.5 -0.3 +2700-3150 -8.8 -12.1 3.3 -0.5 -0.4 +3150-3700 -9.3 -11.8 2.5 -0.5 -0.3 +3700-4400 -8.9 -11.2 2.3 -0.2 -0.3 +4400-5300 -9.3 -11.7 2.5 0.2 -0.4 +5300-6400 -8.1 -10.0 1.9 -0.0 -0.3 +6400-7700 -7.8 -9.2 1.4 -0.1 -0.4 +7700-9500 -8.2 -7.8 -0.4 -0.2 -0.3 +9500-12000 -8.9 -8.5 -0.4 -0.2 -0.4 +12000-15500 -6.2 -6.6 0.4 -0.5 -0.3 +15500-24000 -4.8 -9.9 5.0 -1.4 -0.4 +broadband corr: ours 0.9826 ref 0.9957 + +## hein @ 96k (ours 80.3 vs ref 79.1 kbps) +band NSR_ours NSR_ref dNSR E_ours E_ref +100-200 -17.8 -26.8 8.9 -0.0 0.0 +200-300 -17.9 -28.2 10.3 0.0 0.0 +300-400 -16.4 -26.2 9.8 -0.0 -0.0 +400-510 -17.4 -27.6 10.2 -0.0 -0.0 +510-630 -15.9 -26.8 10.9 -0.0 -0.0 +630-770 -13.3 -23.6 10.4 -0.1 -0.0 +770-920 -14.0 -22.5 8.6 -0.1 -0.1 +920-1080 -12.7 -19.3 6.6 -0.1 -0.1 +1080-1270 -12.8 -17.1 4.3 -0.2 -0.2 +1270-1480 -13.5 -15.1 1.5 -0.1 -0.4 +1480-1720 -13.7 -12.9 -0.8 -0.1 -0.4 +1720-2000 -11.9 -12.3 0.4 -0.2 -0.4 +2000-2320 -11.2 -11.7 0.5 -0.3 -0.4 +2320-2700 -9.9 -11.3 1.3 -0.4 -0.4 +2700-3150 -12.3 -11.9 -0.4 -0.2 -0.5 +3150-3700 -9.9 -11.4 1.5 -0.4 -0.5 +3700-4400 -9.5 -11.0 1.5 -0.4 -0.5 +4400-5300 -10.0 -9.8 -0.1 -0.4 -0.4 +5300-6400 -11.1 -9.6 -1.4 -0.3 -0.3 +6400-7700 -8.6 -9.3 0.8 -0.6 -0.1 +7700-9500 -9.2 -8.1 -1.1 -0.5 0.1 +9500-12000 -8.3 -9.4 1.1 -0.6 -0.2 +12000-15500 -2.1 -5.8 3.6 -2.9 0.5 +15500-24000 -0.7 -4.9 4.2 -6.8 -0.0 +broadband corr: ours 0.9789 ref 0.9869 + +## hein @ 128k (ours 92.8 vs ref 90.7 kbps) +band NSR_ours NSR_ref dNSR E_ours E_ref +100-200 -20.5 -30.4 9.8 0.0 0.0 +200-300 -20.7 -32.2 11.6 0.0 0.0 +300-400 -19.1 -30.6 11.5 0.0 0.0 +400-510 -20.2 -31.8 11.6 0.0 0.0 +510-630 -18.7 -30.6 11.9 -0.0 0.0 +630-770 -15.9 -26.6 10.8 -0.0 -0.0 +770-920 -16.4 -25.1 8.7 -0.0 -0.0 +920-1080 -15.2 -21.8 6.6 -0.1 -0.1 +1080-1270 -15.5 -19.5 4.0 -0.1 -0.1 +1270-1480 -16.3 -17.0 0.7 -0.1 -0.3 +1480-1720 -16.6 -14.4 -2.2 -0.1 -0.3 +1720-2000 -14.7 -13.7 -1.0 -0.1 -0.3 +2000-2320 -14.0 -12.8 -1.1 -0.1 -0.4 +2320-2700 -12.4 -12.1 -0.4 -0.2 -0.3 +2700-3150 -15.1 -12.6 -2.4 -0.1 -0.4 +3150-3700 -12.3 -12.0 -0.4 -0.2 -0.4 +3700-4400 -11.7 -11.4 -0.3 -0.2 -0.5 +4400-5300 -12.5 -10.6 -1.9 -0.2 -0.4 +5300-6400 -13.6 -10.9 -2.6 -0.2 -0.4 +6400-7700 -10.8 -10.9 0.1 -0.3 -0.4 +7700-9500 -11.5 -9.8 -1.6 -0.2 -0.3 +9500-12000 -10.4 -11.0 0.7 -0.3 -0.4 +12000-15500 -3.2 -7.6 4.4 -2.2 -0.3 +15500-24000 -1.0 -6.6 5.6 -5.3 -0.3 +broadband corr: ours 0.9883 ref 0.9906 + diff --git a/lanes/vorbis-psy-r1.bits.txt b/lanes/vorbis-psy-r1.bits.txt new file mode 100644 index 00000000..4ff1390f --- /dev/null +++ b/lanes/vorbis-psy-r1.bits.txt @@ -0,0 +1,72 @@ +# Bit split over full sources, same rows as the band error + +## nik @ 96k (ours 84.0 vs ref 84.5 kbps) +ours floor 9723.2/s ( 11.7%) residue 72917.0/s ( 87.9%) other 355.3/s nz 2560721 bits/nz 5.42 +ref floor 10286.2/s ( 12.3%) residue 73047.7/s ( 87.3%) other 388.4/s nz 4760782 bits/nz 2.92 +ratio floor 0.945 residue 0.998 bits/nz 1.856 + +## nik @ 128k (ours 115.5 vs ref 115.8 kbps) +ours floor 9645.0/s ( 8.5%) residue 103989.2/s ( 91.2%) other 353.9/s nz 3814314 bits/nz 5.19 +ref floor 10077.0/s ( 8.8%) residue 104124.4/s ( 90.9%) other 389.7/s nz 5632447 bits/nz 3.52 +ratio floor 0.957 residue 0.999 bits/nz 1.475 + +## reelo @ 96k (ours 81.5 vs ref 81.8 kbps) +ours floor 9806.9/s ( 12.2%) residue 70346.3/s ( 87.4%) other 355.5/s nz 2986413 bits/nz 5.29 +ref floor 9941.3/s ( 12.3%) residue 70612.8/s ( 87.2%) other 398.4/s nz 5777660 bits/nz 2.74 +ratio floor 0.986 residue 0.996 bits/nz 1.927 + +## reelo @ 128k (ours 109.1 vs ref 108.6 kbps) +ours floor 9691.2/s ( 9.0%) residue 97679.6/s ( 90.7%) other 353.8/s nz 4295299 bits/nz 5.11 +ref floor 9747.6/s ( 9.1%) residue 97310.8/s ( 90.6%) other 403.0/s nz 6673503 bits/nz 3.27 +ratio floor 0.994 residue 1.004 bits/nz 1.560 + +## her @ 96k (ours 89.9 vs ref 89.9 kbps) +ours floor 9524.9/s ( 10.7%) residue 78889.0/s ( 88.9%) other 354.8/s nz 1787297 bits/nz 6.60 +ref floor 10153.8/s ( 11.4%) residue 78231.6/s ( 88.1%) other 424.2/s nz 3760403 bits/nz 3.11 +ratio floor 0.938 residue 1.008 bits/nz 2.122 + +## her @ 128k (ours 123.5 vs ref 124.9 kbps) +ours floor 9533.5/s ( 7.8%) residue 112062.4/s ( 91.9%) other 352.8/s nz 2722388 bits/nz 6.16 +ref floor 10767.4/s ( 8.7%) residue 112414.2/s ( 90.9%) other 440.5/s nz 4510184 bits/nz 3.73 +ratio floor 0.885 residue 0.997 bits/nz 1.652 + +## reell @ 96k (ours 85.4 vs ref 85.5 kbps) +ours floor 9711.2/s ( 11.5%) residue 74235.7/s ( 88.1%) other 352.0/s nz 1543184 bits/nz 6.13 +ref floor 10298.1/s ( 12.2%) residue 73899.0/s ( 87.4%) other 385.7/s nz 3052428 bits/nz 3.09 +ratio floor 0.943 residue 1.005 bits/nz 1.987 + +## reell @ 128k (ours 121.3 vs ref 120.9 kbps) +ours floor 9566.1/s ( 8.0%) residue 109816.9/s ( 91.7%) other 355.4/s nz 2371325 bits/nz 5.91 +ref floor 9762.0/s ( 8.2%) residue 109419.2/s ( 91.5%) other 383.9/s nz 3707113 bits/nz 3.76 +ratio floor 0.980 residue 1.004 bits/nz 1.569 + +## reelm @ 96k (ours 80.5 vs ref 79.3 kbps) +ours floor 11985.8/s ( 15.1%) residue 66845.4/s ( 84.3%) other 478.7/s nz 8155330 bits/nz 4.92 +ref floor 13236.4/s ( 16.9%) residue 64513.7/s ( 82.4%) other 554.2/s nz 16100264 bits/nz 2.40 +ratio floor 0.906 residue 1.036 bits/nz 2.046 + +## reelm @ 128k (ours 93.5 vs ref 91.0 kbps) +ours floor 11796.9/s ( 12.8%) residue 79906.7/s ( 86.7%) other 478.6/s nz 9867445 bits/nz 4.86 +ref floor 15532.3/s ( 17.3%) residue 73887.6/s ( 82.1%) other 577.2/s nz 17166019 bits/nz 2.58 +ratio floor 0.760 residue 1.081 bits/nz 1.881 + +## dl8a @ 96k (ours 86.9 vs ref 86.9 kbps) +ours floor 9898.8/s ( 11.5%) residue 75451.0/s ( 88.0%) other 361.4/s nz 1070509 bits/nz 5.22 +ref floor 10220.4/s ( 11.9%) residue 75065.3/s ( 87.6%) other 450.2/s nz 2007693 bits/nz 2.77 +ratio floor 0.969 residue 1.005 bits/nz 1.885 + +## dl8a @ 128k (ours 118.7 vs ref 117.8 kbps) +ours floor 9770.3/s ( 8.3%) residue 106984.6/s ( 91.3%) other 362.3/s nz 1586225 bits/nz 5.00 +ref floor 10898.1/s ( 9.4%) residue 104859.0/s ( 90.2%) other 461.9/s nz 2355540 bits/nz 3.30 +ratio floor 0.897 residue 1.020 bits/nz 1.515 + +## hein @ 96k (ours 80.3 vs ref 79.1 kbps) +ours floor 11754.1/s ( 14.8%) residue 66934.3/s ( 84.6%) other 464.2/s nz 8280099 bits/nz 4.85 +ref floor 13269.0/s ( 17.0%) residue 64324.4/s ( 82.3%) other 542.5/s nz 16037649 bits/nz 2.41 +ratio floor 0.886 residue 1.041 bits/nz 2.015 + +## hein @ 128k (ours 92.8 vs ref 90.7 kbps) +ours floor 11598.0/s ( 12.7%) residue 79463.3/s ( 86.8%) other 463.7/s nz 9964341 bits/nz 4.78 +ref floor 15672.4/s ( 17.5%) residue 73426.1/s ( 81.9%) other 577.8/s nz 17055459 bits/nz 2.58 +ratio floor 0.740 residue 1.082 bits/nz 1.852 + diff --git a/lanes/vorbis-psy-r1.histogram.txt b/lanes/vorbis-psy-r1.histogram.txt new file mode 100644 index 00000000..46daef12 --- /dev/null +++ b/lanes/vorbis-psy-r1.histogram.txt @@ -0,0 +1,440 @@ +# Residue histogram: ours vs libvorbis reference + +Bitrate: 128 kbps, 48000 Hz, 2ch, 12 s max + +## nik — sanity PASS: identical histograms (578 vs 578 blocks) — ours 199539 B vs ref 167577 B (1.19x) + +bits ours: floor 242916 (16.4%), residue 1236957 (83.3%), other 4287, packet 1484160; non-zero 153776, residue bits/non-zero 8.04 +bits ref: floor 137211 (10.6%), residue 1150746 (89.0%), other 4875, packet 1292832; non-zero 306824, residue bits/non-zero 3.75 + +| Bark | q=0 ours/ref | q=1 | q=2 | q=3-4 | q=5-8 | q=9+ | total ours/ref | spend ratio | +|------|-------------|-----|-----|-------|-------|------|-----------------|-------------| +| 0 | 1779/1818 | 2538/1565 | 716/634 | 418/605 | 157/547 | 44/563 | 5652/5732 | 0.99 | +| 1 | 1840/1030 | 1543/990 | 388/696 | 357/772 | 304/607 | 96/547 | 4528/4642 | 0.74 | +| 2 | 2166/781 | 1583/1002 | 390/693 | 472/920 | 509/709 | 500/1345 | 5620/5450 | 0.74 | +| 3 | 2476/1356 | 1388/968 | 210/586 | 160/703 | 122/531 | 172/498 | 4528/4642 | 0.62 | +| 4 | 2760/1631 | 1522/1305 | 387/715 | 274/737 | 294/501 | 383/561 | 5620/5450 | 0.75 | +| 5 | 2845/1411 | 1653/1240 | 372/782 | 330/933 | 257/732 | 195/634 | 5652/5732 | 0.65 | +| 6 | 2930/1293 | 2060/1118 | 439/828 | 413/1197 | 408/1185 | 526/1201 | 6776/6822 | 0.70 | +| 7 | 4390/2583 | 1599/1596 | 279/858 | 208/805 | 170/473 | 98/225 | 6744/6540 | 0.59 | +| 8 | 4051/2245 | 1877/2127 | 474/1023 | 436/999 | 503/680 | 559/838 | 7900/7912 | 0.68 | +| 9 | 5343/3880 | 1495/2225 | 280/891 | 262/475 | 255/219 | 265/222 | 7900/7912 | 0.63 | +| 10 | 5234/4171 | 2776/3298 | 741/1278 | 613/658 | 446/391 | 338/296 | 10148/10092 | 0.83 | +| 11 | 6527/6581 | 2893/3540 | 668/838 | 644/337 | 405/134 | 167/34 | 11304/11464 | 0.98 | +| 12 | 7056/6125 | 3351/4072 | 745/1174 | 624/545 | 402/241 | 218/115 | 12396/12272 | 0.87 | +| 13 | 10667/9208 | 3550/4845 | 836/1293 | 804/811 | 579/476 | 488/281 | 16924/16914 | 0.81 | +| 14 | 10482/8505 | 5221/6094 | 1251/2199 | 1023/1280 | 749/693 | 446/323 | 19172/19094 | 0.82 | +| 15 | 17576/14460 | 5040/6699 | 1035/2006 | 709/1081 | 273/457 | 191/123 | 24824/24826 | 0.70 | +| 16 | 18181/13185 | 7011/8726 | 1650/3440 | 1323/2150 | 809/1150 | 346/535 | 29320/29186 | 0.70 | +| 17 | 28416/22448 | 5549/8977 | 519/2099 | 292/895 | 128/396 | 68/103 | 34972/34918 | 0.53 | +| 18 | 33016/21107 | 6947/14454 | 339/3464 | 188/1092 | 78/223 | 24/28 | 40592/40368 | 0.39 | +| 19 | 42329/29783 | 5717/16177 | 239/2096 | 140/440 | 74/56 | 25/10 | 48524/48562 | 0.33 | +| 20 | 47727/30397 | 10268/21738 | 379/4825 | 142/1292 | 70/117 | 54/3 | 58640/58372 | 0.39 | +| 21 | 64255/50609 | 9784/20844 | 204/2285 | 115/438 | 55/20 | 27/0 | 74440/74196 | 0.43 | +| 22 | 92299/60977 | 15411/40956 | 352/4454 | 146/1485 | 70/151 | 10/1 | 108288/108024 | 0.34 | +| 23 | 175565/139308 | 17118/47091 | 201/4981 | 23/1134 | 1/80 | 0/0 | 192908/192594 | 0.33 | +| 24 | 411386/410540 | 314/0 | 0/0 | 0/0 | 0/0 | 0/0 | 411700/410540 | inf | +| Bark | f0 ours | f0 ref | f1 ours | f1 ref | f2 ours | f2 ref | f3+ ours | f3+ ref | dist | +|------|---------|--------|---------|--------|---------|--------|----------|---------|------| +| 0 | 0.315 | 0.317 | 0.449 | 0.273 | 0.127 | 0.111 | 0.110 | 0.299 | 0.384 | +| 1 | 0.406 | 0.222 | 0.341 | 0.213 | 0.086 | 0.150 | 0.167 | 0.415 | 0.624 | +| 2 | 0.385 | 0.143 | 0.282 | 0.184 | 0.069 | 0.127 | 0.264 | 0.546 | 0.680 | +| 3 | 0.547 | 0.292 | 0.307 | 0.209 | 0.046 | 0.126 | 0.100 | 0.373 | 0.705 | +| 4 | 0.491 | 0.299 | 0.271 | 0.239 | 0.069 | 0.131 | 0.169 | 0.330 | 0.446 | +| 5 | 0.503 | 0.246 | 0.292 | 0.216 | 0.066 | 0.136 | 0.138 | 0.401 | 0.667 | +| 6 | 0.432 | 0.190 | 0.304 | 0.164 | 0.065 | 0.121 | 0.199 | 0.525 | 0.766 | +| 7 | 0.651 | 0.395 | 0.237 | 0.244 | 0.041 | 0.131 | 0.071 | 0.230 | 0.512 | +| 8 | 0.513 | 0.284 | 0.238 | 0.269 | 0.060 | 0.129 | 0.190 | 0.318 | 0.458 | +| 9 | 0.676 | 0.490 | 0.189 | 0.281 | 0.035 | 0.113 | 0.099 | 0.116 | 0.372 | +| 10 | 0.516 | 0.413 | 0.274 | 0.327 | 0.073 | 0.127 | 0.138 | 0.133 | 0.214 | +| 11 | 0.577 | 0.574 | 0.256 | 0.309 | 0.059 | 0.073 | 0.108 | 0.044 | 0.134 | +| 12 | 0.569 | 0.499 | 0.270 | 0.332 | 0.060 | 0.096 | 0.100 | 0.073 | 0.194 | +| 13 | 0.630 | 0.544 | 0.210 | 0.286 | 0.049 | 0.076 | 0.111 | 0.093 | 0.207 | +| 14 | 0.547 | 0.445 | 0.272 | 0.319 | 0.065 | 0.115 | 0.116 | 0.120 | 0.203 | +| 15 | 0.708 | 0.582 | 0.203 | 0.270 | 0.042 | 0.081 | 0.047 | 0.067 | 0.251 | +| 16 | 0.620 | 0.452 | 0.239 | 0.299 | 0.056 | 0.118 | 0.085 | 0.131 | 0.337 | +| 17 | 0.813 | 0.643 | 0.159 | 0.257 | 0.015 | 0.060 | 0.014 | 0.040 | 0.339 | +| 18 | 0.813 | 0.523 | 0.171 | 0.358 | 0.008 | 0.086 | 0.007 | 0.033 | 0.581 | +| 19 | 0.872 | 0.613 | 0.118 | 0.333 | 0.005 | 0.043 | 0.005 | 0.010 | 0.518 | +| 20 | 0.814 | 0.521 | 0.175 | 0.372 | 0.006 | 0.083 | 0.005 | 0.024 | 0.586 | +| 21 | 0.863 | 0.682 | 0.131 | 0.281 | 0.003 | 0.031 | 0.003 | 0.006 | 0.362 | +| 22 | 0.852 | 0.564 | 0.142 | 0.379 | 0.003 | 0.041 | 0.002 | 0.015 | 0.576 | +| 23 | 0.910 | 0.723 | 0.089 | 0.245 | 0.001 | 0.026 | 0.000 | 0.006 | 0.374 | +| 24 | 0.999 | 1.000 | 0.001 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.002 | + +shape Bark 3-22: max dist 0.766, bands >= 0.15: 19/20 — shape fail + +## reelo — sanity PASS: identical histograms (592 vs 592 blocks) — ours 209457 B vs ref 184427 B (1.14x) + +bits ours: floor 241792 (15.5%), residue 1316635 (84.2%), other 4445, packet 1562872; non-zero 161883, residue bits/non-zero 8.13 +bits ref: floor 135587 (9.5%), residue 1285442 (90.1%), other 5707, packet 1426736; non-zero 324226, residue bits/non-zero 3.96 + +| Bark | q=0 ours/ref | q=1 | q=2 | q=3-4 | q=5-8 | q=9+ | total ours/ref | spend ratio | +|------|-------------|-----|-----|-------|-------|------|-----------------|-------------| +| 0 | 1394/1032 | 1378/1046 | 1089/716 | 996/1123 | 485/997 | 322/970 | 5664/5884 | 0.88 | +| 1 | 1545/612 | 1454/837 | 665/683 | 473/827 | 200/824 | 207/1057 | 4544/4840 | 0.71 | +| 2 | 2148/607 | 1711/873 | 784/726 | 543/1026 | 269/1149 | 145/839 | 5600/5220 | 0.75 | +| 3 | 1847/652 | 1261/800 | 597/572 | 453/802 | 203/905 | 183/1109 | 4544/4840 | 0.64 | +| 4 | 3182/1089 | 1289/1376 | 484/666 | 381/745 | 167/723 | 97/621 | 5600/5220 | 0.59 | +| 5 | 2891/913 | 1515/1362 | 582/889 | 351/1049 | 150/917 | 175/754 | 5664/5884 | 0.56 | +| 6 | 3151/1298 | 1802/1892 | 784/1075 | 607/1232 | 249/883 | 191/548 | 6784/6928 | 0.65 | +| 7 | 3754/1861 | 1834/2224 | 577/1015 | 307/763 | 139/296 | 109/105 | 6720/6264 | 0.67 | +| 8 | 4605/2582 | 1856/2631 | 622/1108 | 451/928 | 189/488 | 181/235 | 7904/7972 | 0.61 | +| 9 | 3844/1953 | 2140/2373 | 858/1253 | 592/1162 | 242/756 | 228/475 | 7904/7972 | 0.67 | +| 10 | 6133/4348 | 2354/3464 | 787/1137 | 547/697 | 197/301 | 126/113 | 10144/10060 | 0.70 | +| 11 | 6552/5386 | 2660/4041 | 916/1163 | 718/640 | 264/377 | 218/161 | 11328/11768 | 0.75 | +| 12 | 7592/5676 | 2965/4280 | 818/1120 | 553/662 | 272/302 | 184/108 | 12384/12148 | 0.74 | +| 13 | 10324/9058 | 3996/5711 | 1267/1285 | 797/556 | 308/294 | 236/84 | 16928/16988 | 0.83 | +| 14 | 10444/9017 | 5269/6939 | 1723/1726 | 1024/878 | 429/416 | 279/100 | 19168/19076 | 0.87 | +| 15 | 15492/13139 | 5936/8452 | 1650/1937 | 1126/939 | 349/381 | 279/112 | 24832/24960 | 0.79 | +| 16 | 19045/14579 | 6979/10089 | 1774/2465 | 973/1310 | 292/479 | 249/214 | 29312/29136 | 0.71 | +| 17 | 24736/18304 | 7505/11969 | 1628/2833 | 670/1302 | 167/470 | 270/142 | 34976/35020 | 0.61 | +| 18 | 31569/21460 | 6793/13368 | 1287/3123 | 560/1593 | 120/553 | 247/143 | 40576/40240 | 0.48 | +| 19 | 39748/28785 | 6733/15061 | 1132/3060 | 482/1344 | 137/483 | 312/143 | 48544/48876 | 0.44 | +| 20 | 48355/33901 | 7976/18736 | 1190/3522 | 581/1453 | 203/543 | 319/117 | 58624/58272 | 0.42 | +| 21 | 63134/43095 | 8841/25794 | 1336/3394 | 560/1374 | 242/478 | 319/81 | 74432/74216 | 0.36 | +| 22 | 95348/71142 | 10267/32152 | 1511/3241 | 585/1339 | 326/295 | 251/23 | 108288/108192 | 0.35 | +| 23 | 175995/132157 | 13633/54547 | 1839/4454 | 845/1559 | 412/396 | 204/19 | 192928/193132 | 0.28 | +| 24 | 410361/407176 | 1193/3280 | 91/267 | 26/169 | 9/44 | 0/4 | 411680/410940 | 0.35 | +| Bark | f0 ours | f0 ref | f1 ours | f1 ref | f2 ours | f2 ref | f3+ ours | f3+ ref | dist | +|------|---------|--------|---------|--------|---------|--------|----------|---------|------| +| 0 | 0.246 | 0.175 | 0.243 | 0.178 | 0.192 | 0.122 | 0.318 | 0.525 | 0.414 | +| 1 | 0.340 | 0.126 | 0.320 | 0.173 | 0.146 | 0.141 | 0.194 | 0.560 | 0.732 | +| 2 | 0.384 | 0.116 | 0.306 | 0.167 | 0.140 | 0.139 | 0.171 | 0.577 | 0.813 | +| 3 | 0.406 | 0.135 | 0.278 | 0.165 | 0.131 | 0.118 | 0.185 | 0.582 | 0.794 | +| 4 | 0.568 | 0.209 | 0.230 | 0.264 | 0.086 | 0.128 | 0.115 | 0.400 | 0.719 | +| 5 | 0.510 | 0.155 | 0.267 | 0.231 | 0.103 | 0.151 | 0.119 | 0.462 | 0.783 | +| 6 | 0.464 | 0.187 | 0.266 | 0.273 | 0.116 | 0.155 | 0.154 | 0.384 | 0.554 | +| 7 | 0.559 | 0.297 | 0.273 | 0.355 | 0.086 | 0.162 | 0.083 | 0.186 | 0.523 | +| 8 | 0.583 | 0.324 | 0.235 | 0.330 | 0.079 | 0.139 | 0.104 | 0.207 | 0.517 | +| 9 | 0.486 | 0.245 | 0.271 | 0.298 | 0.109 | 0.157 | 0.134 | 0.300 | 0.483 | +| 10 | 0.605 | 0.432 | 0.232 | 0.344 | 0.078 | 0.113 | 0.086 | 0.110 | 0.345 | +| 11 | 0.578 | 0.458 | 0.235 | 0.343 | 0.081 | 0.099 | 0.106 | 0.100 | 0.253 | +| 12 | 0.613 | 0.467 | 0.239 | 0.352 | 0.066 | 0.092 | 0.081 | 0.088 | 0.292 | +| 13 | 0.610 | 0.533 | 0.236 | 0.336 | 0.075 | 0.076 | 0.079 | 0.055 | 0.202 | +| 14 | 0.545 | 0.473 | 0.275 | 0.364 | 0.090 | 0.090 | 0.090 | 0.073 | 0.179 | +| 15 | 0.624 | 0.526 | 0.239 | 0.339 | 0.066 | 0.078 | 0.071 | 0.057 | 0.221 | +| 16 | 0.650 | 0.500 | 0.238 | 0.346 | 0.061 | 0.085 | 0.052 | 0.069 | 0.299 | +| 17 | 0.707 | 0.523 | 0.215 | 0.342 | 0.047 | 0.081 | 0.032 | 0.055 | 0.369 | +| 18 | 0.778 | 0.533 | 0.167 | 0.332 | 0.032 | 0.078 | 0.023 | 0.057 | 0.489 | +| 19 | 0.819 | 0.589 | 0.139 | 0.308 | 0.023 | 0.063 | 0.019 | 0.040 | 0.460 | +| 20 | 0.825 | 0.582 | 0.136 | 0.322 | 0.020 | 0.060 | 0.019 | 0.036 | 0.486 | +| 21 | 0.848 | 0.581 | 0.119 | 0.348 | 0.018 | 0.046 | 0.015 | 0.026 | 0.535 | +| 22 | 0.881 | 0.658 | 0.095 | 0.297 | 0.014 | 0.030 | 0.011 | 0.015 | 0.446 | +| 23 | 0.912 | 0.684 | 0.071 | 0.282 | 0.010 | 0.023 | 0.008 | 0.010 | 0.456 | +| 24 | 0.997 | 0.991 | 0.003 | 0.008 | 0.000 | 0.001 | 0.000 | 0.001 | 0.012 | + +shape Bark 3-22: max dist 0.794, bands >= 0.15: 20/20 — shape fail + +## her — sanity PASS: identical histograms (578 vs 578 blocks) — ours 200318 B vs ref 144837 B (1.38x) + +bits ours: floor 222012 (14.9%), residue 1263990 (84.8%), other 4302, packet 1490304; non-zero 106384, residue bits/non-zero 11.88 +bits ref: floor 124059 (11.2%), residue 981117 (88.4%), other 4704, packet 1109880; non-zero 152528, residue bits/non-zero 6.43 + +| Bark | q=0 ours/ref | q=1 | q=2 | q=3-4 | q=5-8 | q=9+ | total ours/ref | spend ratio | +|------|-------------|-----|-----|-------|-------|------|-----------------|-------------| +| 0 | 819/3538 | 1337/1464 | 982/332 | 1079/215 | 822/106 | 613/61 | 5652/5716 | 2.22 | +| 1 | 265/380 | 411/633 | 393/576 | 671/944 | 919/970 | 1869/1111 | 4528/4614 | 1.01 | +| 2 | 391/394 | 657/643 | 539/552 | 836/886 | 1074/1209 | 2123/1826 | 5620/5510 | 1.02 | +| 3 | 302/230 | 435/361 | 390/286 | 597/532 | 835/799 | 1969/2406 | 4528/4614 | 0.96 | +| 4 | 811/972 | 1176/1460 | 781/970 | 858/997 | 900/692 | 1094/419 | 5620/5510 | 1.06 | +| 5 | 779/1641 | 1200/2120 | 855/827 | 983/569 | 867/328 | 968/231 | 5652/5716 | 1.20 | +| 6 | 546/761 | 766/1217 | 683/847 | 1015/1059 | 1223/1070 | 2543/1864 | 6776/6818 | 1.03 | +| 7 | 1918/2525 | 1822/2294 | 965/727 | 926/452 | 665/319 | 448/295 | 6744/6612 | 1.18 | +| 8 | 1436/2124 | 1680/2497 | 942/1145 | 1106/936 | 1112/640 | 1624/578 | 7900/7920 | 1.12 | +| 9 | 1475/2407 | 1917/2563 | 1052/977 | 1134/763 | 930/538 | 1392/672 | 7900/7920 | 1.17 | +| 10 | 2827/4779 | 2747/3390 | 1370/777 | 1192/462 | 871/344 | 1141/372 | 10148/10124 | 1.37 | +| 11 | 2617/4276 | 2774/3774 | 1607/1330 | 1586/863 | 1193/689 | 1527/500 | 11304/11432 | 1.21 | +| 12 | 4010/5980 | 3801/3813 | 1594/942 | 1299/692 | 890/575 | 802/326 | 12396/12328 | 1.32 | +| 13 | 7890/9445 | 4990/4918 | 1599/1147 | 1176/729 | 793/530 | 476/173 | 16924/16942 | 1.21 | +| 14 | 11516/10689 | 4390/5122 | 1353/1384 | 1075/1043 | 576/689 | 262/219 | 19172/19146 | 0.91 | +| 15 | 18683/14563 | 3949/6550 | 947/1499 | 655/1137 | 414/777 | 176/336 | 24824/24862 | 0.60 | +| 16 | 25456/18248 | 2716/7204 | 571/1619 | 357/1204 | 190/732 | 30/263 | 29320/29270 | 0.35 | +| 17 | 33232/21808 | 1391/9341 | 229/1894 | 98/1204 | 19/605 | 3/134 | 34972/34986 | 0.13 | +| 18 | 39983/27296 | 560/9816 | 41/1851 | 7/965 | 1/468 | 0/100 | 40592/40496 | 0.05 | +| 19 | 48326/36349 | 193/9229 | 4/1659 | 1/878 | 0/419 | 0/88 | 48524/48622 | 0.02 | +| 20 | 58518/51394 | 120/5857 | 2/748 | 0/397 | 0/139 | 0/5 | 58640/58540 | 0.02 | +| 21 | 74294/70756 | 146/3216 | 0/289 | 0/112 | 0/7 | 0/0 | 74440/74380 | 0.04 | +| 22 | 108112/107377 | 176/847 | 0/34 | 0/6 | 0/0 | 0/0 | 108288/108264 | 0.20 | +| 23 | 192782/192860 | 126/112 | 0/2 | 0/0 | 0/0 | 0/0 | 192908/192974 | 1.11 | +| 24 | 411700/411496 | 0/4 | 0/0 | 0/0 | 0/0 | 0/0 | 411700/411500 | 0.00 | +| Bark | f0 ours | f0 ref | f1 ours | f1 ref | f2 ours | f2 ref | f3+ ours | f3+ ref | dist | +|------|---------|--------|---------|--------|---------|--------|----------|---------|------| +| 0 | 0.145 | 0.619 | 0.237 | 0.256 | 0.174 | 0.058 | 0.445 | 0.067 | 0.987 | +| 1 | 0.059 | 0.082 | 0.091 | 0.137 | 0.087 | 0.125 | 0.764 | 0.656 | 0.217 | +| 2 | 0.070 | 0.072 | 0.117 | 0.117 | 0.096 | 0.100 | 0.718 | 0.712 | 0.012 | +| 3 | 0.067 | 0.050 | 0.096 | 0.078 | 0.086 | 0.062 | 0.751 | 0.810 | 0.118 | +| 4 | 0.144 | 0.176 | 0.209 | 0.265 | 0.139 | 0.176 | 0.507 | 0.383 | 0.250 | +| 5 | 0.138 | 0.287 | 0.212 | 0.371 | 0.151 | 0.145 | 0.499 | 0.197 | 0.616 | +| 6 | 0.081 | 0.112 | 0.113 | 0.178 | 0.101 | 0.124 | 0.706 | 0.586 | 0.240 | +| 7 | 0.284 | 0.382 | 0.270 | 0.347 | 0.143 | 0.110 | 0.302 | 0.161 | 0.349 | +| 8 | 0.182 | 0.268 | 0.213 | 0.315 | 0.119 | 0.145 | 0.486 | 0.272 | 0.429 | +| 9 | 0.187 | 0.304 | 0.243 | 0.324 | 0.133 | 0.123 | 0.437 | 0.249 | 0.396 | +| 10 | 0.279 | 0.472 | 0.271 | 0.335 | 0.135 | 0.077 | 0.316 | 0.116 | 0.515 | +| 11 | 0.232 | 0.374 | 0.245 | 0.330 | 0.142 | 0.116 | 0.381 | 0.179 | 0.455 | +| 12 | 0.323 | 0.485 | 0.307 | 0.309 | 0.129 | 0.076 | 0.241 | 0.129 | 0.328 | +| 13 | 0.466 | 0.557 | 0.295 | 0.290 | 0.094 | 0.068 | 0.144 | 0.085 | 0.183 | +| 14 | 0.601 | 0.558 | 0.229 | 0.268 | 0.071 | 0.072 | 0.100 | 0.102 | 0.085 | +| 15 | 0.753 | 0.586 | 0.159 | 0.263 | 0.038 | 0.060 | 0.050 | 0.090 | 0.334 | +| 16 | 0.868 | 0.623 | 0.093 | 0.246 | 0.019 | 0.055 | 0.020 | 0.075 | 0.490 | +| 17 | 0.950 | 0.623 | 0.040 | 0.267 | 0.007 | 0.054 | 0.003 | 0.056 | 0.654 | +| 18 | 0.985 | 0.674 | 0.014 | 0.242 | 0.001 | 0.046 | 0.000 | 0.038 | 0.622 | +| 19 | 0.996 | 0.748 | 0.004 | 0.190 | 0.000 | 0.034 | 0.000 | 0.028 | 0.497 | +| 20 | 0.998 | 0.878 | 0.002 | 0.100 | 0.000 | 0.013 | 0.000 | 0.009 | 0.240 | +| 21 | 0.998 | 0.951 | 0.002 | 0.043 | 0.000 | 0.004 | 0.000 | 0.002 | 0.094 | +| 22 | 0.998 | 0.992 | 0.002 | 0.008 | 0.000 | 0.000 | 0.000 | 0.000 | 0.013 | +| 23 | 0.999 | 0.999 | 0.001 | 0.001 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | +| 24 | 1.000 | 1.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | + +shape Bark 3-22: max dist 0.654, bands >= 0.15: 16/20 — shape fail + +## reell — sanity PASS: identical histograms (578 vs 578 blocks) — ours 205448 B vs ref 179730 B (1.14x) + +bits ours: floor 260600 (17.0%), residue 1266166 (82.7%), other 4290, packet 1531056; non-zero 173005, residue bits/non-zero 7.32 +bits ref: floor 122706 (8.8%), residue 1262884 (90.8%), other 4634, packet 1390224; non-zero 349421, residue bits/non-zero 3.61 + +| Bark | q=0 ours/ref | q=1 | q=2 | q=3-4 | q=5-8 | q=9+ | total ours/ref | spend ratio | +|------|-------------|-----|-----|-------|-------|------|-----------------|-------------| +| 0 | 1893/1466 | 2252/1071 | 975/673 | 330/918 | 134/833 | 68/741 | 5652/5702 | 0.89 | +| 1 | 2409/663 | 1637/1012 | 351/726 | 75/950 | 27/784 | 29/467 | 4528/4602 | 0.54 | +| 2 | 2806/617 | 1908/1068 | 652/727 | 188/976 | 48/919 | 18/1193 | 5620/5500 | 0.58 | +| 3 | 2706/742 | 1353/1027 | 322/630 | 88/759 | 28/720 | 31/724 | 4528/4602 | 0.47 | +| 4 | 2952/734 | 1719/1141 | 647/827 | 212/959 | 61/846 | 29/993 | 5620/5500 | 0.56 | +| 5 | 4006/1345 | 1195/1666 | 295/883 | 84/936 | 41/620 | 31/252 | 5652/5702 | 0.38 | +| 6 | 3787/1150 | 2056/1639 | 690/1093 | 146/1190 | 52/915 | 45/815 | 6776/6802 | 0.53 | +| 7 | 4619/1498 | 1513/2008 | 394/1065 | 164/997 | 48/530 | 6/502 | 6744/6600 | 0.42 | +| 8 | 5298/2075 | 1744/2421 | 580/1204 | 179/1095 | 53/617 | 46/490 | 7900/7902 | 0.45 | +| 9 | 6380/3118 | 1222/2915 | 219/915 | 43/561 | 8/239 | 28/154 | 7900/7902 | 0.32 | +| 10 | 7509/4355 | 1794/3012 | 590/943 | 143/702 | 73/582 | 39/508 | 10148/10102 | 0.46 | +| 11 | 8027/4791 | 2445/3845 | 586/1259 | 154/784 | 42/443 | 50/282 | 11304/11404 | 0.50 | +| 12 | 9178/5756 | 2400/4123 | 522/1049 | 201/716 | 64/369 | 31/289 | 12396/12302 | 0.49 | +| 13 | 12083/8033 | 3670/5908 | 812/1458 | 219/813 | 71/521 | 69/171 | 16924/16904 | 0.55 | +| 14 | 14003/8938 | 4058/6779 | 792/1751 | 178/915 | 72/497 | 69/224 | 19172/19104 | 0.51 | +| 15 | 18680/12383 | 4977/8770 | 870/1873 | 180/990 | 40/515 | 77/275 | 24824/24806 | 0.49 | +| 16 | 22384/15396 | 5943/10614 | 690/1919 | 187/753 | 30/397 | 86/127 | 29320/29206 | 0.50 | +| 17 | 24031/16094 | 9095/13587 | 1466/3191 | 228/1250 | 36/546 | 116/240 | 34972/34908 | 0.58 | +| 18 | 29431/20726 | 9771/15496 | 1021/2878 | 208/877 | 67/319 | 94/112 | 40592/40408 | 0.57 | +| 19 | 35601/24174 | 11406/19024 | 1091/3973 | 260/1110 | 62/186 | 104/45 | 48524/48512 | 0.53 | +| 20 | 47913/37355 | 9692/18150 | 738/2257 | 185/517 | 27/114 | 85/19 | 58640/58412 | 0.51 | +| 21 | 55627/42699 | 16895/26845 | 1521/3405 | 246/1044 | 45/212 | 106/11 | 74440/74216 | 0.60 | +| 22 | 78714/53020 | 26597/43249 | 2520/7985 | 307/3166 | 66/570 | 84/34 | 108288/108024 | 0.54 | +| 23 | 171914/128851 | 19622/51392 | 1104/8395 | 216/3435 | 38/467 | 14/4 | 192908/192544 | 0.33 | +| 24 | 410116/406856 | 1526/2829 | 49/679 | 6/211 | 3/15 | 0/0 | 411700/410590 | 0.42 | +| Bark | f0 ours | f0 ref | f1 ours | f1 ref | f2 ours | f2 ref | f3+ ours | f3+ ref | dist | +|------|---------|--------|---------|--------|---------|--------|----------|---------|------| +| 0 | 0.335 | 0.257 | 0.398 | 0.188 | 0.173 | 0.118 | 0.094 | 0.437 | 0.686 | +| 1 | 0.532 | 0.144 | 0.362 | 0.220 | 0.078 | 0.158 | 0.029 | 0.478 | 1.059 | +| 2 | 0.499 | 0.112 | 0.340 | 0.194 | 0.116 | 0.132 | 0.045 | 0.561 | 1.065 | +| 3 | 0.598 | 0.161 | 0.299 | 0.223 | 0.071 | 0.137 | 0.032 | 0.479 | 1.024 | +| 4 | 0.525 | 0.133 | 0.306 | 0.207 | 0.115 | 0.150 | 0.054 | 0.509 | 0.980 | +| 5 | 0.709 | 0.236 | 0.211 | 0.292 | 0.052 | 0.155 | 0.028 | 0.317 | 0.946 | +| 6 | 0.559 | 0.169 | 0.303 | 0.241 | 0.102 | 0.161 | 0.036 | 0.429 | 0.905 | +| 7 | 0.685 | 0.227 | 0.224 | 0.304 | 0.058 | 0.161 | 0.032 | 0.307 | 0.916 | +| 8 | 0.671 | 0.263 | 0.221 | 0.306 | 0.073 | 0.152 | 0.035 | 0.279 | 0.816 | +| 9 | 0.808 | 0.395 | 0.155 | 0.369 | 0.028 | 0.116 | 0.010 | 0.121 | 0.826 | +| 10 | 0.740 | 0.431 | 0.177 | 0.298 | 0.058 | 0.093 | 0.025 | 0.177 | 0.618 | +| 11 | 0.710 | 0.420 | 0.216 | 0.337 | 0.052 | 0.110 | 0.022 | 0.132 | 0.580 | +| 12 | 0.740 | 0.468 | 0.194 | 0.335 | 0.042 | 0.085 | 0.024 | 0.112 | 0.545 | +| 13 | 0.714 | 0.475 | 0.217 | 0.350 | 0.048 | 0.086 | 0.021 | 0.089 | 0.477 | +| 14 | 0.730 | 0.468 | 0.212 | 0.355 | 0.041 | 0.092 | 0.017 | 0.086 | 0.525 | +| 15 | 0.752 | 0.499 | 0.200 | 0.354 | 0.035 | 0.076 | 0.012 | 0.072 | 0.507 | +| 16 | 0.763 | 0.527 | 0.203 | 0.363 | 0.024 | 0.066 | 0.010 | 0.044 | 0.473 | +| 17 | 0.687 | 0.461 | 0.260 | 0.389 | 0.042 | 0.091 | 0.011 | 0.058 | 0.452 | +| 18 | 0.725 | 0.513 | 0.241 | 0.383 | 0.025 | 0.071 | 0.009 | 0.032 | 0.424 | +| 19 | 0.734 | 0.498 | 0.235 | 0.392 | 0.022 | 0.082 | 0.009 | 0.028 | 0.471 | +| 20 | 0.817 | 0.640 | 0.165 | 0.311 | 0.013 | 0.039 | 0.005 | 0.011 | 0.355 | +| 21 | 0.747 | 0.575 | 0.227 | 0.362 | 0.020 | 0.046 | 0.005 | 0.017 | 0.344 | +| 22 | 0.727 | 0.491 | 0.246 | 0.400 | 0.023 | 0.074 | 0.004 | 0.035 | 0.472 | +| 23 | 0.891 | 0.669 | 0.102 | 0.267 | 0.006 | 0.044 | 0.001 | 0.020 | 0.444 | +| 24 | 0.996 | 0.991 | 0.004 | 0.007 | 0.000 | 0.002 | 0.000 | 0.001 | 0.010 | + +shape Bark 3-22: max dist 1.024, bands >= 0.15: 20/20 — shape fail + +## reelm — sanity PASS: identical histograms (718 vs 718 blocks) — ours 201941 B vs ref 131152 B (1.54x) + +bits ours: floor 264080 (17.6%), residue 1234391 (82.1%), other 4777, packet 1503248; non-zero 205447, residue bits/non-zero 6.01 +bits ref: floor 152371 (15.2%), residue 847801 (84.3%), other 5452, packet 1005624; non-zero 325636, residue bits/non-zero 2.60 + +| Bark | q=0 ours/ref | q=1 | q=2 | q=3-4 | q=5-8 | q=9+ | total ours/ref | spend ratio | +|------|-------------|-----|-----|-------|-------|------|-----------------|-------------| +| 0 | 1888/1766 | 1682/1840 | 900/734 | 614/700 | 294/440 | 394/344 | 5772/5824 | 0.96 | +| 1 | 1717/526 | 1149/753 | 540/499 | 452/810 | 312/878 | 518/1296 | 4688/4762 | 0.70 | +| 2 | 2698/924 | 1365/1110 | 559/728 | 354/946 | 234/692 | 210/910 | 5420/5310 | 0.62 | +| 3 | 2037/795 | 1063/886 | 478/677 | 390/742 | 280/680 | 440/982 | 4688/4762 | 0.67 | +| 4 | 2708/1059 | 1370/1256 | 504/774 | 388/938 | 212/682 | 238/601 | 5420/5310 | 0.64 | +| 5 | 2570/983 | 1442/1348 | 584/825 | 448/1088 | 302/906 | 426/674 | 5772/5824 | 0.66 | +| 6 | 3254/1625 | 1644/1833 | 728/1096 | 504/1329 | 295/713 | 431/290 | 6856/6886 | 0.68 | +| 7 | 2844/1534 | 1758/1749 | 758/1079 | 564/1128 | 308/499 | 272/383 | 6504/6372 | 0.76 | +| 8 | 3462/2164 | 2044/2596 | 910/1359 | 646/1167 | 400/432 | 478/230 | 7940/7948 | 0.77 | +| 9 | 3830/2682 | 2084/2961 | 796/1240 | 518/719 | 332/220 | 380/126 | 7940/7948 | 0.78 | +| 10 | 5041/4200 | 2747/3745 | 978/1275 | 568/492 | 332/222 | 442/138 | 10108/10072 | 0.86 | +| 11 | 5608/5461 | 3022/4475 | 1109/1244 | 747/336 | 378/110 | 680/22 | 11544/11648 | 0.96 | +| 12 | 5874/5552 | 3332/4890 | 1293/1140 | 873/416 | 472/154 | 432/44 | 12276/12196 | 0.96 | +| 13 | 8056/8347 | 4708/6713 | 1656/1334 | 1145/378 | 584/156 | 815/30 | 16964/16958 | 1.03 | +| 14 | 8804/9071 | 5595/7730 | 2012/1607 | 1264/460 | 649/150 | 808/64 | 19132/19082 | 1.03 | +| 15 | 11939/11800 | 6905/10169 | 2334/2161 | 1637/602 | 852/136 | 1237/38 | 24904/24906 | 0.99 | +| 16 | 16012/15187 | 8020/11512 | 2139/1909 | 1321/440 | 703/96 | 1045/10 | 29240/29154 | 0.95 | +| 17 | 18264/16760 | 9678/13885 | 2931/3141 | 1896/925 | 851/203 | 1392/64 | 35012/34978 | 0.92 | +| 18 | 23219/20447 | 11049/16111 | 2794/2928 | 1485/668 | 698/126 | 1187/8 | 40432/40288 | 0.87 | +| 19 | 31743/24789 | 11438/19562 | 2595/3557 | 1188/740 | 608/94 | 1152/8 | 48724/48750 | 0.71 | +| 20 | 47466/36010 | 7906/20479 | 1498/1631 | 714/170 | 414/16 | 482/2 | 58480/58308 | 0.49 | +| 21 | 58502/45136 | 11448/26055 | 2054/2549 | 982/406 | 504/56 | 870/2 | 74360/74204 | 0.55 | +| 22 | 91160/67588 | 12404/34429 | 2126/4665 | 1164/1280 | 710/154 | 724/4 | 108288/108120 | 0.42 | +| 23 | 180013/135228 | 10829/52781 | 1080/4184 | 618/669 | 374/44 | 194/4 | 193108/192910 | 0.23 | +| 24 | 410916/408010 | 560/2630 | 18/110 | 4/10 | 0/0 | 2/0 | 411500/410760 | 0.21 | +| Bark | f0 ours | f0 ref | f1 ours | f1 ref | f2 ours | f2 ref | f3+ ours | f3+ ref | dist | +|------|---------|--------|---------|--------|---------|--------|----------|---------|------| +| 0 | 0.327 | 0.303 | 0.291 | 0.316 | 0.156 | 0.126 | 0.226 | 0.255 | 0.108 | +| 1 | 0.366 | 0.110 | 0.245 | 0.158 | 0.115 | 0.105 | 0.273 | 0.627 | 0.706 | +| 2 | 0.498 | 0.174 | 0.252 | 0.209 | 0.103 | 0.137 | 0.147 | 0.480 | 0.733 | +| 3 | 0.435 | 0.167 | 0.227 | 0.186 | 0.102 | 0.142 | 0.237 | 0.505 | 0.617 | +| 4 | 0.500 | 0.199 | 0.253 | 0.237 | 0.093 | 0.146 | 0.155 | 0.418 | 0.633 | +| 5 | 0.445 | 0.169 | 0.250 | 0.231 | 0.101 | 0.142 | 0.204 | 0.458 | 0.590 | +| 6 | 0.475 | 0.236 | 0.240 | 0.266 | 0.106 | 0.159 | 0.179 | 0.339 | 0.477 | +| 7 | 0.437 | 0.241 | 0.270 | 0.274 | 0.117 | 0.169 | 0.176 | 0.315 | 0.393 | +| 8 | 0.436 | 0.272 | 0.257 | 0.327 | 0.115 | 0.171 | 0.192 | 0.230 | 0.328 | +| 9 | 0.482 | 0.337 | 0.262 | 0.373 | 0.100 | 0.156 | 0.155 | 0.134 | 0.332 | +| 10 | 0.499 | 0.417 | 0.272 | 0.372 | 0.097 | 0.127 | 0.133 | 0.085 | 0.260 | +| 11 | 0.486 | 0.469 | 0.262 | 0.384 | 0.096 | 0.107 | 0.156 | 0.040 | 0.266 | +| 12 | 0.478 | 0.455 | 0.271 | 0.401 | 0.105 | 0.093 | 0.145 | 0.050 | 0.259 | +| 13 | 0.475 | 0.492 | 0.278 | 0.396 | 0.098 | 0.079 | 0.150 | 0.033 | 0.271 | +| 14 | 0.460 | 0.475 | 0.292 | 0.405 | 0.105 | 0.084 | 0.142 | 0.035 | 0.256 | +| 15 | 0.479 | 0.474 | 0.277 | 0.408 | 0.094 | 0.087 | 0.150 | 0.031 | 0.262 | +| 16 | 0.548 | 0.521 | 0.274 | 0.395 | 0.073 | 0.065 | 0.105 | 0.019 | 0.241 | +| 17 | 0.522 | 0.479 | 0.276 | 0.397 | 0.084 | 0.090 | 0.118 | 0.034 | 0.253 | +| 18 | 0.574 | 0.508 | 0.273 | 0.400 | 0.069 | 0.073 | 0.083 | 0.020 | 0.260 | +| 19 | 0.651 | 0.508 | 0.235 | 0.401 | 0.053 | 0.073 | 0.061 | 0.017 | 0.372 | +| 20 | 0.812 | 0.618 | 0.135 | 0.351 | 0.026 | 0.028 | 0.028 | 0.003 | 0.437 | +| 21 | 0.787 | 0.608 | 0.154 | 0.351 | 0.028 | 0.034 | 0.032 | 0.006 | 0.408 | +| 22 | 0.842 | 0.625 | 0.115 | 0.318 | 0.020 | 0.043 | 0.024 | 0.013 | 0.455 | +| 23 | 0.932 | 0.701 | 0.056 | 0.274 | 0.006 | 0.022 | 0.006 | 0.004 | 0.467 | +| 24 | 0.999 | 0.993 | 0.001 | 0.006 | 0.000 | 0.000 | 0.000 | 0.000 | 0.011 | + +shape Bark 3-22: max dist 0.633, bands >= 0.15: 20/20 — shape fail + +## dl8a — sanity PASS: identical histograms (606 vs 606 blocks) — ours 208573 B vs ref 180190 B (1.16x) + +bits ours: floor 269080 (17.3%), residue 1282271 (82.4%), other 4401, packet 1555752; non-zero 157846, residue bits/non-zero 8.12 +bits ref: floor 145125 (10.4%), residue 1242969 (89.2%), other 5714, packet 1393808; non-zero 369421, residue bits/non-zero 3.36 + +| Bark | q=0 ours/ref | q=1 | q=2 | q=3-4 | q=5-8 | q=9+ | total ours/ref | spend ratio | +|------|-------------|-----|-----|-------|-------|------|-----------------|-------------| +| 0 | 3059/1819 | 2267/1669 | 189/624 | 17/625 | 8/520 | 136/613 | 5676/5870 | 0.65 | +| 1 | 2868/480 | 1198/958 | 254/612 | 101/760 | 13/774 | 126/1242 | 4560/4826 | 0.39 | +| 2 | 3611/491 | 1652/844 | 248/659 | 16/814 | 2/907 | 51/1505 | 5580/5220 | 0.42 | +| 3 | 3017/531 | 1268/926 | 129/681 | 14/803 | 9/873 | 123/1012 | 4560/4826 | 0.36 | +| 4 | 3872/716 | 1458/1034 | 183/753 | 14/975 | 7/893 | 46/849 | 5580/5220 | 0.38 | +| 5 | 3825/826 | 1521/1154 | 178/891 | 15/1052 | 8/978 | 129/969 | 5676/5870 | 0.37 | +| 6 | 5046/1327 | 1417/1907 | 155/1118 | 16/1328 | 7/697 | 151/537 | 6792/6914 | 0.31 | +| 7 | 4873/1601 | 1466/1833 | 271/918 | 20/805 | 12/482 | 54/625 | 6696/6264 | 0.39 | +| 8 | 5624/2123 | 1903/2668 | 206/1325 | 19/972 | 16/485 | 140/385 | 7908/7958 | 0.39 | +| 9 | 5979/2597 | 1597/2771 | 155/1151 | 18/780 | 16/378 | 143/281 | 7908/7958 | 0.36 | +| 10 | 7355/2933 | 2338/3439 | 230/1626 | 26/1114 | 15/559 | 176/375 | 10140/10046 | 0.39 | +| 11 | 8720/5329 | 2159/4233 | 179/1212 | 18/582 | 24/265 | 252/119 | 11352/11740 | 0.41 | +| 12 | 9515/5654 | 2461/4658 | 179/1067 | 28/414 | 32/232 | 157/109 | 12372/12134 | 0.44 | +| 13 | 12738/8366 | 3648/6366 | 197/1334 | 37/588 | 53/239 | 259/67 | 16932/16960 | 0.49 | +| 14 | 14668/8675 | 3793/7213 | 315/1817 | 37/856 | 42/379 | 309/108 | 19164/19048 | 0.43 | +| 15 | 19639/12059 | 4406/9478 | 260/2081 | 55/841 | 64/335 | 416/124 | 24840/24918 | 0.40 | +| 16 | 22612/13644 | 5859/11423 | 266/2644 | 49/993 | 76/325 | 442/65 | 29304/29094 | 0.43 | +| 17 | 27749/17470 | 6224/13296 | 309/2728 | 48/1015 | 84/366 | 566/89 | 34980/34964 | 0.41 | +| 18 | 30758/18328 | 8540/15684 | 475/3779 | 48/1576 | 94/657 | 645/160 | 40560/40184 | 0.45 | +| 19 | 38744/24380 | 8545/18952 | 279/3648 | 93/1273 | 125/401 | 778/138 | 48564/48792 | 0.40 | +| 20 | 47989/34651 | 9375/20454 | 213/2440 | 140/539 | 197/99 | 694/5 | 58608/58188 | 0.45 | +| 21 | 57801/40840 | 14737/28325 | 515/3573 | 180/1120 | 285/239 | 906/7 | 74424/74104 | 0.50 | +| 22 | 84573/57731 | 20940/41941 | 892/6285 | 240/1736 | 251/327 | 1392/4 | 108288/108024 | 0.47 | +| 23 | 166014/126258 | 23489/60922 | 663/4726 | 431/853 | 460/63 | 1891/2 | 192948/192824 | 0.40 | +| 24 | 406577/394006 | 4344/13784 | 162/1918 | 176/538 | 147/64 | 254/0 | 411660/410310 | 0.31 | +| Bark | f0 ours | f0 ref | f1 ours | f1 ref | f2 ours | f2 ref | f3+ ours | f3+ ref | dist | +|------|---------|--------|---------|--------|---------|--------|----------|---------|------| +| 0 | 0.539 | 0.310 | 0.399 | 0.284 | 0.033 | 0.106 | 0.028 | 0.299 | 0.688 | +| 1 | 0.629 | 0.099 | 0.263 | 0.199 | 0.056 | 0.127 | 0.053 | 0.575 | 1.187 | +| 2 | 0.647 | 0.094 | 0.296 | 0.162 | 0.044 | 0.126 | 0.012 | 0.618 | 1.375 | +| 3 | 0.662 | 0.110 | 0.278 | 0.192 | 0.028 | 0.141 | 0.032 | 0.557 | 1.276 | +| 4 | 0.694 | 0.137 | 0.261 | 0.198 | 0.033 | 0.144 | 0.012 | 0.520 | 1.240 | +| 5 | 0.674 | 0.141 | 0.268 | 0.197 | 0.031 | 0.152 | 0.027 | 0.511 | 1.209 | +| 6 | 0.743 | 0.192 | 0.209 | 0.276 | 0.023 | 0.162 | 0.026 | 0.371 | 1.102 | +| 7 | 0.728 | 0.256 | 0.219 | 0.293 | 0.040 | 0.147 | 0.013 | 0.305 | 0.944 | +| 8 | 0.711 | 0.267 | 0.241 | 0.335 | 0.026 | 0.166 | 0.022 | 0.231 | 0.889 | +| 9 | 0.756 | 0.326 | 0.202 | 0.348 | 0.020 | 0.145 | 0.022 | 0.181 | 0.859 | +| 10 | 0.725 | 0.292 | 0.231 | 0.342 | 0.023 | 0.162 | 0.021 | 0.204 | 0.867 | +| 11 | 0.768 | 0.454 | 0.190 | 0.361 | 0.016 | 0.103 | 0.026 | 0.082 | 0.628 | +| 12 | 0.769 | 0.466 | 0.199 | 0.384 | 0.014 | 0.088 | 0.018 | 0.062 | 0.606 | +| 13 | 0.752 | 0.493 | 0.215 | 0.375 | 0.012 | 0.079 | 0.021 | 0.053 | 0.518 | +| 14 | 0.765 | 0.455 | 0.198 | 0.379 | 0.016 | 0.095 | 0.020 | 0.071 | 0.620 | +| 15 | 0.791 | 0.484 | 0.177 | 0.380 | 0.010 | 0.084 | 0.022 | 0.052 | 0.613 | +| 16 | 0.772 | 0.469 | 0.200 | 0.393 | 0.009 | 0.091 | 0.019 | 0.048 | 0.605 | +| 17 | 0.793 | 0.500 | 0.178 | 0.380 | 0.009 | 0.078 | 0.020 | 0.042 | 0.587 | +| 18 | 0.758 | 0.456 | 0.211 | 0.390 | 0.012 | 0.094 | 0.019 | 0.060 | 0.604 | +| 19 | 0.798 | 0.500 | 0.176 | 0.388 | 0.006 | 0.075 | 0.021 | 0.037 | 0.596 | +| 20 | 0.819 | 0.596 | 0.160 | 0.352 | 0.004 | 0.042 | 0.018 | 0.011 | 0.460 | +| 21 | 0.777 | 0.551 | 0.198 | 0.382 | 0.007 | 0.048 | 0.018 | 0.018 | 0.451 | +| 22 | 0.781 | 0.534 | 0.193 | 0.388 | 0.008 | 0.058 | 0.017 | 0.019 | 0.493 | +| 23 | 0.860 | 0.655 | 0.122 | 0.316 | 0.003 | 0.025 | 0.014 | 0.005 | 0.431 | +| 24 | 0.988 | 0.960 | 0.011 | 0.034 | 0.000 | 0.005 | 0.001 | 0.001 | 0.055 | + +shape Bark 3-22: max dist 1.276, bands >= 0.15: 20/20 — shape fail + +## hein — sanity PASS: identical histograms (634 vs 634 blocks) — ours 212147 B vs ref 136345 B (1.56x) + +bits ours: floor 267358 (16.9%), residue 1312257 (82.8%), other 4545, packet 1584160; non-zero 221920, residue bits/non-zero 5.91 +bits ref: floor 167042 (16.0%), residue 873404 (83.5%), other 5978, packet 1046424; non-zero 333099, residue bits/non-zero 2.62 + +| Bark | q=0 ours/ref | q=1 | q=2 | q=3-4 | q=5-8 | q=9+ | total ours/ref | spend ratio | +|------|-------------|-----|-----|-------|-------|------|-----------------|-------------| +| 0 | 2012/1566 | 1836/1238 | 948/664 | 438/744 | 182/644 | 284/1078 | 5700/5934 | 0.84 | +| 1 | 2094/562 | 1160/832 | 462/622 | 406/856 | 188/782 | 282/1250 | 4592/4904 | 0.58 | +| 2 | 2484/738 | 1544/1110 | 822/780 | 330/910 | 214/814 | 146/798 | 5540/5150 | 0.69 | +| 3 | 2038/740 | 1300/960 | 596/722 | 232/786 | 170/774 | 256/922 | 4592/4904 | 0.61 | +| 4 | 2448/698 | 1770/1010 | 682/802 | 338/994 | 142/916 | 160/730 | 5540/5150 | 0.69 | +| 5 | 2804/1000 | 1660/1480 | 588/958 | 274/1172 | 136/814 | 238/510 | 5700/5934 | 0.59 | +| 6 | 3340/1472 | 2056/1946 | 716/1270 | 272/1328 | 184/722 | 240/226 | 6808/6964 | 0.63 | +| 7 | 2984/1412 | 2132/1784 | 832/1048 | 378/1208 | 180/504 | 142/224 | 6648/6180 | 0.77 | +| 8 | 3696/2190 | 2522/2794 | 830/1456 | 390/1130 | 206/278 | 272/146 | 7916/7994 | 0.73 | +| 9 | 4250/2942 | 2386/3068 | 584/1276 | 328/532 | 140/116 | 228/60 | 7916/7994 | 0.73 | +| 10 | 5084/3882 | 3142/3924 | 954/1404 | 428/572 | 220/196 | 304/76 | 10132/10054 | 0.82 | +| 11 | 5480/5008 | 3628/4702 | 1066/1468 | 436/522 | 290/146 | 500/22 | 11400/11868 | 0.86 | +| 12 | 5906/5354 | 3954/4846 | 1168/1322 | 676/448 | 286/110 | 358/34 | 12348/12114 | 0.95 | +| 13 | 8806/8322 | 4980/6508 | 1468/1462 | 730/542 | 400/136 | 556/48 | 16940/17018 | 0.94 | +| 14 | 10208/9032 | 5372/7646 | 1496/1644 | 838/590 | 492/146 | 750/20 | 19156/19078 | 0.89 | +| 15 | 13520/12021 | 7196/9707 | 1944/2272 | 922/832 | 458/162 | 816/18 | 24856/25012 | 0.87 | +| 16 | 17314/14082 | 7564/11238 | 1932/2436 | 1066/1058 | 586/284 | 826/34 | 29288/29132 | 0.80 | +| 17 | 22188/17498 | 8510/13746 | 1808/2836 | 1050/752 | 586/198 | 846/36 | 34988/35066 | 0.73 | +| 18 | 25778/20414 | 10090/15256 | 2084/3256 | 1088/1090 | 656/176 | 832/24 | 40528/40216 | 0.74 | +| 19 | 31250/24478 | 12404/19088 | 2082/3944 | 1098/1264 | 704/198 | 1066/22 | 48604/48994 | 0.71 | +| 20 | 43114/35263 | 10854/19475 | 1752/2822 | 988/624 | 802/78 | 1066/2 | 58576/58264 | 0.67 | +| 21 | 50372/42313 | 17896/26837 | 3040/4128 | 1206/882 | 686/84 | 1208/8 | 74408/74252 | 0.75 | +| 22 | 84698/70458 | 18256/32232 | 2462/4298 | 1208/1120 | 750/172 | 914/8 | 108288/108288 | 0.62 | +| 23 | 169978/132126 | 19638/56012 | 1590/4570 | 936/624 | 526/46 | 320/0 | 192988/193378 | 0.38 | +| 24 | 411306/408402 | 284/2784 | 22/44 | 8/0 | 0/0 | 0/0 | 411620/411230 | 0.11 | +| Bark | f0 ours | f0 ref | f1 ours | f1 ref | f2 ours | f2 ref | f3+ ours | f3+ ref | dist | +|------|---------|--------|---------|--------|---------|--------|----------|---------|------| +| 0 | 0.353 | 0.264 | 0.322 | 0.209 | 0.166 | 0.112 | 0.159 | 0.416 | 0.514 | +| 1 | 0.456 | 0.115 | 0.253 | 0.170 | 0.101 | 0.127 | 0.191 | 0.589 | 0.849 | +| 2 | 0.448 | 0.143 | 0.279 | 0.216 | 0.148 | 0.151 | 0.125 | 0.490 | 0.736 | +| 3 | 0.444 | 0.151 | 0.283 | 0.196 | 0.130 | 0.147 | 0.143 | 0.506 | 0.761 | +| 4 | 0.442 | 0.136 | 0.319 | 0.196 | 0.123 | 0.156 | 0.116 | 0.513 | 0.859 | +| 5 | 0.492 | 0.169 | 0.291 | 0.249 | 0.103 | 0.161 | 0.114 | 0.421 | 0.730 | +| 6 | 0.491 | 0.211 | 0.302 | 0.279 | 0.105 | 0.182 | 0.102 | 0.327 | 0.604 | +| 7 | 0.449 | 0.228 | 0.321 | 0.289 | 0.125 | 0.170 | 0.105 | 0.313 | 0.505 | +| 8 | 0.467 | 0.274 | 0.319 | 0.350 | 0.105 | 0.182 | 0.110 | 0.194 | 0.386 | +| 9 | 0.537 | 0.368 | 0.301 | 0.384 | 0.074 | 0.160 | 0.088 | 0.089 | 0.338 | +| 10 | 0.502 | 0.386 | 0.310 | 0.390 | 0.094 | 0.140 | 0.094 | 0.084 | 0.251 | +| 11 | 0.481 | 0.422 | 0.318 | 0.396 | 0.094 | 0.124 | 0.108 | 0.058 | 0.216 | +| 12 | 0.478 | 0.442 | 0.320 | 0.400 | 0.095 | 0.109 | 0.107 | 0.049 | 0.189 | +| 13 | 0.520 | 0.489 | 0.294 | 0.382 | 0.087 | 0.086 | 0.100 | 0.043 | 0.177 | +| 14 | 0.533 | 0.473 | 0.280 | 0.401 | 0.078 | 0.086 | 0.109 | 0.040 | 0.257 | +| 15 | 0.544 | 0.481 | 0.290 | 0.388 | 0.078 | 0.091 | 0.088 | 0.040 | 0.222 | +| 16 | 0.591 | 0.483 | 0.258 | 0.386 | 0.066 | 0.084 | 0.085 | 0.047 | 0.290 | +| 17 | 0.634 | 0.499 | 0.243 | 0.392 | 0.052 | 0.081 | 0.071 | 0.028 | 0.356 | +| 18 | 0.636 | 0.508 | 0.249 | 0.379 | 0.051 | 0.081 | 0.064 | 0.032 | 0.320 | +| 19 | 0.643 | 0.500 | 0.255 | 0.390 | 0.043 | 0.080 | 0.059 | 0.030 | 0.344 | +| 20 | 0.736 | 0.605 | 0.185 | 0.334 | 0.030 | 0.048 | 0.049 | 0.012 | 0.335 | +| 21 | 0.677 | 0.570 | 0.241 | 0.361 | 0.041 | 0.056 | 0.042 | 0.013 | 0.271 | +| 22 | 0.782 | 0.651 | 0.169 | 0.298 | 0.023 | 0.040 | 0.027 | 0.012 | 0.292 | +| 23 | 0.881 | 0.683 | 0.102 | 0.290 | 0.008 | 0.024 | 0.009 | 0.003 | 0.407 | +| 24 | 0.999 | 0.993 | 0.001 | 0.007 | 0.000 | 0.000 | 0.000 | 0.000 | 0.012 | + +shape Bark 3-22: max dist 0.859, bands >= 0.15: 20/20 — shape fail + + +Total bytes: ours 1437423 vs ref 1124258 (1.28x) diff --git a/lanes/vorbis-psy-r1.report.md b/lanes/vorbis-psy-r1.report.md new file mode 100644 index 00000000..964804f7 --- /dev/null +++ b/lanes/vorbis-psy-r1.report.md @@ -0,0 +1,88 @@ +byte-identity: IDENTICAL (reelm 120 s 128k, main 4b007cd vs 689cdc9) + +# vorbis-psy r3 — band error + bit split, 7 sources × {96k, 128k} + +Instrument: `band_error_vs_reference` (`crates/ec-vorbis/tests/oracle.rs`), run in +release, full 14 rows (no `SWEEP_ONLY` fallback needed; 163 s total, 3–25 s/row). +Ref = ffmpeg libvorbis `-t 600 -ac 2 -ar 48000`; ours encoded at the ref's measured +kbps; both decoded through **our** decoder, so the gap measures encoders only. +Bands: 2048-pt Hann, hop 1024, 25 edges 100 Hz–24 kHz → 24 bands, both channels +summed. NSR/E in dB vs the source per band; dNSR = NSR_ours − NSR_ref (positive = +we're worse). Raw tables: `vorbis-psy-r1.bands.txt`, `vorbis-psy-r1.bits.txt`. + +## Bit split (floor / residue / bits-per-nonzero, ours vs ref, ratio) + +| row | floor ours/ref b/s | residue ours/ref b/s | nz ours/ref | bits/nz ours vs ref | ratio bits/nz | +|---|---|---|---|---|---| +| nik 96k | 9723 / 10286 | 72917 / 73048 | 2.56M / 4.76M | 5.42 vs 2.92 | **1.86** | +| nik 128k | 9645 / 10077 | 103989 / 104124 | 3.81M / 5.63M | 5.19 vs 3.52 | **1.48** | +| reelo 96k | 9807 / 9941 | 70346 / 70613 | 2.99M / 5.78M | 5.29 vs 2.74 | **1.93** | +| reelo 128k | 9691 / 9748 | 97680 / 97311 | 4.30M / 6.67M | 5.11 vs 3.27 | **1.56** | +| her 96k | 9525 / 10154 | 78889 / 78232 | 1.79M / 3.76M | 6.60 vs 3.11 | **2.12** | +| her 128k | 9534 / 10767 | 112062 / 112414 | 2.72M / 4.51M | 6.16 vs 3.73 | **1.65** | +| reell 96k | 9711 / 10298 | 74236 / 73899 | 1.54M / 3.05M | 6.13 vs 3.09 | **1.99** | +| reell 128k | 9566 / 9762 | 109817 / 109419 | 2.37M / 3.71M | 5.91 vs 3.76 | **1.57** | +| reelm 96k | 11986 / 13236 | 66845 / 64514 | 8.16M / 16.10M | 4.92 vs 2.40 | **2.05** | +| reelm 128k | 11797 / 15532 | 79907 / 73888 | 9.87M / 17.17M | 4.86 vs 2.58 | **1.88** | +| dl8a 96k | 9899 / 10220 | 75451 / 75065 | 1.07M / 2.01M | 5.22 vs 2.77 | **1.89** | +| dl8a 128k | 9770 / 10898 | 106985 / 104859 | 1.59M / 2.36M | 5.00 vs 3.30 | **1.52** | +| hein 96k | 11754 / 13269 | 66934 / 64324 | 8.28M / 16.04M | 4.85 vs 2.41 | **2.02** | +| hein 128k | 11598 / 15672 | 79463 / 73426 | 9.96M / 17.06M | 4.78 vs 2.58 | **1.85** | + +Residue totals land within ±4% of ref at matched rate (ratios 0.996–1.082), but +we spend them on 45–57% as many non-zero coefficients at 1.5–2.1× the bits each. +Floor ratio 0.74–0.99 — ref outspends us on floor most where it wins HF (reelm/ +hein 128k: ref floor 15.5–15.7k b/s vs our 11.6k). + +## Bands summary (per row: 3 largest dNSR bands; E-attenuated bands) + +`E −x.x` = encoder output band energy vs source; "attenuated" lists bands with +E_ours ≤ −3 dB while E_ref > −3 dB. + +| row | top-3 dNSR bands | attenuated bands | corr ours/ref | +|---|---|---|---| +| nik 96k | 630-770 +11.0; 770-920 +9.8; 400-510 +9.6 | 15500-24000 E −19.0 (ref −2.3) | 0.9690 / 0.9903 | +| nik 128k | 630-770 +12.1; 920-1080 +11.8; 770-920 +11.6 | 15500-24000 E −19.0 (ref −1.8) | 0.9838 / 0.9951 | +| reelo 96k | 510-630 +11.0; 630-770 +10.2; 770-920 +9.5 | none | 0.9739 / 0.9922 | +| reelo 128k | 510-630 +12.5; 630-770 +12.1; 400-510 +10.9 | none | 0.9868 / 0.9955 | +| her 96k | 630-770 +12.1; 400-510 +11.8; 300-400 +11.3 | none | 0.9668 / 0.9867 | +| her 128k | 630-770 +13.0; 400-510 +12.7; 510-630 +12.2 | none | 0.9810 / 0.9927 | +| reell 96k | 510-630 +9.1; 630-770 +8.7; 770-920 +8.7 | 15500-24000 E −3.1 (ref −0.1) | 0.9792 / 0.9923 | +| reell 128k | 630-770 +10.2; 510-630 +10.1; 770-920 +9.9 | none | 0.9914 / 0.9968 | +| reelm 96k | 200-300 +12.2; 510-630 +11.4; 400-510 +10.8 | 12000-15500 E −3.2 (ref +0.6); 15500-24000 E −7.0 (ref −0.1) | 0.9796 / 0.9865 | +| reelm 128k | 200-300 +13.9; 300-400 +12.8; 400-510 +12.8 | 15500-24000 E −5.3 (ref −0.2) | 0.9890 / 0.9906 | +| dl8a 96k | 510-630 +12.7; 630-770 +11.9; 400-510 +11.2 | none | 0.9655 / 0.9916 | +| dl8a 128k | 510-630 +14.6; 630-770 +13.6; 400-510 +12.8 | none | 0.9826 / 0.9957 | +| hein 96k | 510-630 +10.9; 630-770 +10.4; 200-300 +10.3 | 15500-24000 E −6.8 (ref −0.0) | 0.9789 / 0.9869 | +| hein 128k | 510-630 +11.9; 200-300 +11.6; 400-510 +11.6 | 15500-24000 E −5.3 (ref −0.3) | 0.9883 / 0.9906 | + +Every row's top-3 dNSR sits in **300–1080 Hz** (dNSR +8.6 to +14.6); in that +region ref reaches NSR −20 to −30 dB while we sit at −8 to −20. + +## Diagnosis (numbers only) + +(a) **Coding efficiency: yes, every row.** bits/non-zero ours/ref = 1.48–2.12, +all 14 rows ≥ 1.3×; we code 45–57% as many non-zeros (e.g. her 96k 1.79M vs +3.76M) at 4.8–6.6 bits each vs ref's 2.4–3.8, from identical residue budgets. +(b) **HF droop: partial.** nik 15500-24000 E −19.0 dB (effective lowpass at both +rates, ref −1.8/−2.3); reell 96k −3.1; reelm −7.0/−5.3 (plus 12000-15500 −3.2 at +96k); hein −6.8/−5.3. reelo, her, dl8a: no band below −3 dB. (c) **Not flat.** +dNSR is frequency-shaped, not broadband: +9 to +15 at 300–1080 Hz, +2 to +8 at +1–5 kHz, ≤ +1.3 (often negative, we win) above 7.7 kHz; broadband corr gap is +0.0016–0.0131 at 128k and 0.0069–0.0261 at 96k, driven by the low bands. +(d) **Tonal mid 1–5 kHz on her/reelo/dl8a: present but secondary** — her 96k +1080-1270 +6.5 / 1270-1480 +4.7 / 1480-1720 +3.7; reelo 96k 2320-2700 +4.3 / +3150-3700 +3.9; dl8a 96k 2700-3150 +3.7 / 1720-2000 +3.6 — each 5–8 dB below the +same row's 510-770 Hz peak. Conclusion: the dominant gap is (a) residue coding +efficiency concentrated at 300–1080 Hz — ref encodes roughly twice the non-zeros +at half the per-coefficient cost there — with (b) HF droop a separate, source- +dependent contributor (nik/reelm/hein), and (d) minor. + +## Deviations from the charter + +- Bit-split oracle folded into `band_error_vs_reference` instead of the existing + 12 s × 128k-only `residue_histogram_vs_reference`: same `decode_capture_with_bits` + + `bit_split_summary` measurement on the same files, one encode pass instead of + two, and extended to all 14 rows (600 s, both rates). +- Task text said "25 Bark bands" but listed 25 edges; edges taken as authoritative + → 24 bands (noted in the test's doc comment). diff --git a/lanes/vorbis-psy-r3.handoff.md b/lanes/vorbis-psy-r3.handoff.md new file mode 100644 index 00000000..ffce0bae --- /dev/null +++ b/lanes/vorbis-psy-r3.handoff.md @@ -0,0 +1,60 @@ +# lane-vorbis-psy — round 3 handoff (2026-08-23) + +Branch `lane-vorbis-psy` @ 689cdc9 + this commit. No merge, no push. + +## What this round did + +- Added `band_error_vs_reference` (ignored instrument test) to + `crates/ec-vorbis/tests/oracle.rs` — 2048-pt Hann STFT, 24 bands from 25 edges + (100 Hz–24 kHz), band NSR + band-energy-vs-source for ours vs ffmpeg libvorbis, + both decoded through our decoder. Bit-split oracle folded into the same pass + (see deviations). +- Ran all 14 rows (7 sources × {96,128} kbps, 600 s each), release mode, 163 s. +- `cargo test -p ec-vorbis` non-ignored: green (13 lib + 8 oracle, 3 ignored). +- Encoder output byte-identical to main — established at 689cdc9 in round 2 + (reelm 120 s 128k, 4b007cd vs 689cdc9), not re-proven this round; this round + touches only `tests/oracle.rs` + lanes files. + +## Findings (numbers in `vorbis-psy-r1.report.md`) + +1. **Residue coding efficiency is the dominant gap.** bits/non-zero = 1.48–2.12× + ref on all 14 rows; we emit 45–57% as many non-zeros at 4.8–6.6 bits each vs + ref's 2.4–3.8, from near-identical residue budgets (±4%). +2. **The error is concentrated at 300–1080 Hz** — dNSR +8.6 to +14.6 dB; ref hits + NSR −20 to −30 there, we sit at −8 to −20. Mid 1–5 kHz +2 to +8. Above 7.7 kHz + we win or tie on most rows. +3. **HF droop is source-dependent, not universal**: nik 15500-24000 E −19 dB + (hard lowpass, both rates; ref −1.8/−2.3), reelm −7.0/−5.3, hein −6.8/−5.3, + reell@96 −3.1. reelo/her/dl8a none. +4. Floor spend: ours 0.74–0.99× ref; ref outspends us most on reelm/hein 128k + (15.5–15.7 k b/s vs 11.6k) — same sources where HF droop shows. + +## Next-round candidates (ranked by measured impact) + +- (1)+(2) Residue: encode ~2× non-zeros at ~half bits each in low bands — + suspect book selection / dimension / amplitude-bit allocation, not psy + (budget already matches). +- (3) nik 15.5 kHz cutoff: look for a frequency-limit or floor1 cutoff in the + psy/floor path that engages on that source; reelm/hein droop likely floor + underspend (finding 4). +- (4) Tonal 1–5 kHz on her/reelo/dl8a — minor (+3.1 to +6.5), fix after (1). + +## Deviations from this round's charter + +- Bit-split oracle measured inside `band_error_vs_reference` rather than the + 12 s × 128k-only `residue_histogram_vs_reference`: same + `decode_capture_with_bits` + `bit_split_summary` on the same files, one encode + pass instead of two, extended to all 14 rows. +- "25 Bark bands" in the charter vs 25 edges listed → 24 bands; edges taken as + authoritative. + +## Files + +- `crates/ec-vorbis/tests/oracle.rs` — new test (+ fft helper), 244 lines. +- `lanes/vorbis-psy-r1.bands.txt` — 394 lines, per-row band tables. +- `lanes/vorbis-psy-r1.bits.txt` — 71 lines, per-row bit split. +- `lanes/vorbis-psy-r1.report.md` — verdict, tables, diagnosis. +- Scratch oggs under `$CARGO_TARGET_DIR/.../scratch/vorbis7-bands/` (not + committed). + +Worktree intentionally live for round 4.