From bd0a79977117047305c53dbf4b3b1afdf49a302a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sun, 6 Sep 2026 11:50:02 +0300 Subject: [PATCH] chore(av1): drop the stray duplicated bd_rate doc block and the dead-code warning --- crates/ec-av1/src/encode.rs | 75 ------------------------------------- crates/ec-av1/src/tile.rs | 1 + 2 files changed, 1 insertion(+), 75 deletions(-) diff --git a/crates/ec-av1/src/encode.rs b/crates/ec-av1/src/encode.rs index ae79ebdf..7481b423 100644 --- a/crates/ec-av1/src/encode.rs +++ b/crates/ec-av1/src/encode.rs @@ -8985,81 +8985,6 @@ mod tests { } } - /// The missing instrument: what this encoder costs against libaom and - /// rav1e at matched fidelity, and how long it takes to get there. - /// - /// Recipe, identical on all three sides: 12 consecutive frames of each - /// clip scaled to 640x384 (a whole number of superblocks), one key frame - /// then 11 inter frames (`-g 12`, matching our own sequence shape), one - /// tile, `-threads 1`, no film grain synthesis (neither reference enables - /// it by default), 4:2:0 8-bit in and out. Reference points: - /// libaom-av1: `-cpu-used 6 -b:v 0 -crf {5,20,35,45}` - /// librav1e: `-rav1e-params speed=6:quantizer={50,100,150,200}: - /// tile_cols=1:tile_rows=1:threads=1` - /// ours: `base_q_idx {60,90,120,150}`. Every PSNR is all-plane, on - /// ffmpeg-decoded frames of each encoder's own stream. - /// - /// Measured 2026-09-06 after the in-loop filters (lane-av1filt: per-frame - /// deblocking levels and CDEF strengths, both chosen by re-decoding the - /// coded tile -- `crate::filter_search`), 12 frames, this box (wall = the - /// four encodes of that ladder together): - /// - /// | clip | ours (q 150/120/90/60) | BD-rate vs libaom | vs rav1e | wall ours:aom:rav1e | - /// |---|---|---|---|---| - /// | 1080p fixture | 42.11 dB/17774 B .. 50.99 dB/76838 B | +143.6% | +94.0% | 9.2s:1.1s:2.6s | - /// | 2160p fixture | 42.84 dB/12480 B .. 51.43 dB/46557 B | +179.5% | +128.8% | 8.6s:1.0s:2.2s | - /// | screen capture | 39.76 dB/9536 B .. 48.87 dB/29189 B | +88.0% | +21.5% | 7.2s:1.0s:2.1s | - /// - /// Re-measured 2026-09-06 after lane-av1fwd, which changed only how long - /// the encoder takes -- every stream it writes is byte-identical, so the - /// BD columns are this box's own re-run of the same recipe rather than a - /// quality move (+141.3/+174.2/+88.9 vs libaom, +91.9/+124.5/+21.6 vs - /// rav1e). What moved is the wall of the four encodes: - /// - /// | clip | wall ours before | after | instructions:u before -> after | - /// |---|---|---|---| - /// | 1080p fixture | 9.2s | 7.2s | 191.5G -> 139.8G (-27.0%) | - /// | 2160p fixture | 8.6s | 6.9s | 183.5G -> 136.4G (-25.6%) | - /// | screen capture | 7.2s | 6.7s | 157.2G -> 122.5G (-22.1%) | - /// - /// Three exact steps, none of which touches a coded bit: the coefficient - /// rate pricer stopped rebuilding every CDF table per candidate - /// (`tile::coeff_bits`), the filter search stopped re-decoding its own - /// tile once per candidate (`decode::FilterReplay`), and the forward - /// transform stopped transforming the all-zero residual that 70% of its - /// calls carry. - /// - /// The three steps of that lane, same recipe (vs libaom, then vs rav1e): - /// - /// | step | 1080p | 2160p | screen | - /// |---|---|---|---| - /// | no in-loop filter | +234.0 / +171.9 | +260.3 / +203.2 | +318.5 / +155.3 | - /// | + deblocking | +198.2 / +143.1 | +218.1 / +162.4 | +136.9 / +52.7 | - /// | + CDEF | +143.6 / +94.0 | +179.5 / +128.8 | +88.0 / +21.5 | - /// - /// Loop restoration is NOT in yet: it is the one filter whose parameters - /// are per restoration UNIT inside the tile payload, so it needs both - /// tile writers to code `lr` syntax and an encoder-visible post-CDEF - /// buffer to solve against -- neither of which this frame-header-level - /// search reaches. - /// - /// The baseline it replaced, before an inter frame's blocks chose their - /// own partition, was +501.4/+504.4/+440.9 against libaom and - /// +364.4/+401.0/+206.0 against rav1e at 5.1/4.6/5.9 s. - /// - /// So: roughly 2.5-3x libaom's rate and 1.5-2x rav1e's at matched - /// fidelity, while spending far more time than either (the partition - /// search's own cost, uncut: see the two intra-pruning variants measured - /// and rejected in the lane report). No - /// threshold is asserted yet -- this run sets the baseline; the gate - /// asserts only four monotone points per ladder and that ffmpeg decodes - /// our stream sample-exact against our reconstruction. - /// - /// Run: - /// cargo test -p ec-av1 --release --lib -- --ignored \ - /// bd_rate_vs_libaom_and_rav1e --nocapture - #[test] - #[ignore = "the encoder BD-rate baseline: minutes per clip, needs ffmpeg"] /// The sweep behind [`screen_content`]'s two constants /// (`unswept-decision-constants`): the share of 16x16 luma blocks with at /// most N distinct colours, per gate clip, at the size the gate codes. diff --git a/crates/ec-av1/src/tile.rs b/crates/ec-av1/src/tile.rs index d50629cd..431df26a 100644 --- a/crates/ec-av1/src/tile.rs +++ b/crates/ec-av1/src/tile.rs @@ -2692,6 +2692,7 @@ fn note_palette(n: usize) { /// Reads [`PALETTE_HITS`] and zeroes it, so a gate can attribute the counts to /// its own encode. +#[cfg(test)] pub(crate) fn take_palette_hits() -> [usize; 9] { std::array::from_fn(|i| PALETTE_HITS[i].swap(0, std::sync::atomic::Ordering::Relaxed)) }