Merge branch 'lane-defon': every default-on aomenc tool is spelled on in a gate with a hard counter; forward keyframes counted; NEVER_ON_8BIT empty
Browse files at this commit4 changed files +362 -54
- crates/ec-av1/src/decode.rs +53 -0
- crates/ec-av1/src/gate_coverage.rs +17 -49
- crates/ec-av1/src/stream.rs +203 -5
- lanes/defon-r1.report.md +89 -0
crates/ec-av1/src/decode.rsmodified+53 -0
| @@ -728,6 +728,56 @@ pub(crate) fn deblock_hits() -> usize { | ||
| 728 | 728 | DEBLOCK_HITS.with(|c| c.get()) |
| 729 | 729 | } |
| 730 | 730 | |
| 731 | +// lane-defon r1: how many COMPOUND_REFERENCE blocks read a | |
| 732 | +// `UNIDIR_COMP_REFERENCE` pair (both references on the same temporal side, | |
| 733 | +// spec 5.11.25 `comp_reference_type == 0`) -- the gate's proof that a | |
| 734 | +// stream built with `--enable-onesided-comp=1` really exercised the | |
| 735 | +// `uni_comp_ref` alphabet rather than only bidirectional pairs. | |
| 736 | +thread_local! { | |
| 737 | + static UNI_COMP_HITS: std::cell::Cell<usize> = | |
| 738 | + const { std::cell::Cell::new(0) }; | |
| 739 | +} | |
| 740 | + | |
| 741 | +/// Current value of [`UNI_COMP_HITS`]. | |
| 742 | +pub(crate) fn uni_comp_hits() -> usize { | |
| 743 | + UNI_COMP_HITS.with(|c| c.get()) | |
| 744 | +} | |
| 745 | + | |
| 746 | +// lane-defon r1: how many blocks blended through a `COMPOUND_DIFFWTD` mask | |
| 747 | +// (`mc::diffwtd_mask`) -- the narrower half of `MASKED_COMPOUND_HITS`, the | |
| 748 | +// gate's proof that `--enable-diff-wtd-comp=1` reached the difference-weighted | |
| 749 | +// blend and not only the wedge arm. | |
| 750 | +thread_local! { | |
| 751 | + static DIFFWTD_HITS: std::cell::Cell<usize> = | |
| 752 | + const { std::cell::Cell::new(0) }; | |
| 753 | +} | |
| 754 | + | |
| 755 | +/// Current value of [`DIFFWTD_HITS`]. | |
| 756 | +pub(crate) fn diffwtd_hits() -> usize { | |
| 757 | + DIFFWTD_HITS.with(|c| c.get()) | |
| 758 | +} | |
| 759 | + | |
| 760 | +// lane-defon r1: how many FORWARD KEYFRAMES were decoded -- a KEY frame coded | |
| 761 | +// with `show_frame == 0`, output later by a `show_existing_frame` header | |
| 762 | +// (aomenc `--enable-fwd-kf=1 --fwd-kf-dist=N`). Counted from | |
| 763 | +// `stream::decode_stream`, which is where the frame header is consumed; the | |
| 764 | +// gate's proof that the on-value really reached the bitstream rather than | |
| 765 | +// being dropped by the rate control. | |
| 766 | +thread_local! { | |
| 767 | + static FWD_KF_HITS: std::cell::Cell<usize> = | |
| 768 | + const { std::cell::Cell::new(0) }; | |
| 769 | +} | |
| 770 | + | |
| 771 | +/// Current value of [`FWD_KF_HITS`]. | |
| 772 | +pub(crate) fn fwd_kf_hits() -> usize { | |
| 773 | + FWD_KF_HITS.with(|c| c.get()) | |
| 774 | +} | |
| 775 | + | |
| 776 | +/// Records one decoded forward keyframe (see [`FWD_KF_HITS`]). | |
| 777 | +pub(crate) fn note_fwd_kf() { | |
| 778 | + FWD_KF_HITS.with(|c| c.set(c.get() + 1)); | |
| 779 | +} | |
| 780 | + | |
| 731 | 781 | // How many [`read_tx_size`] reads resolved a `tx_depth` strictly less than |
| 732 | 782 | // the block's own side, across every call on the current thread -- the same |
| 733 | 783 | // before/after counter pattern as [`FILTER_INTRA_HITS`], proving a stream |
| @@ -12628,6 +12678,7 @@ fn read_compound_ref_frames( | ||
| 12628 | 12678 | let type_ctx = comp_reference_type_ctx(above, left); |
| 12629 | 12679 | let unidir = dec.symbol(&mut cdfs.comp_ref_type[type_ctx]) == 0; |
| 12630 | 12680 | if unidir { |
| 12681 | + UNI_COMP_HITS.with(|c| c.set(c.get() + 1)); | |
| 12631 | 12682 | // uni_comp_ref (p0): forward vs. backward -- av1_get_pred_context_- |
| 12632 | 12683 | // uni_comp_ref_p is single_ref_p1's own forward/backward vote. |
| 12633 | 12684 | let bit = dec.symbol(&mut cdfs.uni_comp_ref[single_ref_p1_ctx(a, a1, l, l1)][0]); |
| @@ -13649,6 +13700,7 @@ fn decode_inter_block( | ||
| 13649 | 13700 | // either way, only the mask source differs. |
| 13650 | 13701 | let mask_y: Option<&[u8]> = if let Some(mask_type) = diffwtd_mask_type { |
| 13651 | 13702 | diffwtd_mask_y = vec![0u8; side * side]; |
| 13703 | + DIFFWTD_HITS.with(|c| c.set(c.get() + 1)); | |
| 13652 | 13704 | mc::diffwtd_mask(&inter0_y, &inter1_y, mask_type == 1, &mut diffwtd_mask_y); |
| 13653 | 13705 | Some(diffwtd_mask_y.as_slice()) |
| 13654 | 13706 | } else { |
| @@ -15598,6 +15650,7 @@ fn decode_inter_block8( | ||
| 15598 | 15650 | let mut diffwtd_mask_y = Vec::new(); |
| 15599 | 15651 | let mask_y: Option<&[u8]> = if let Some(mask_type) = diffwtd_mask_type { |
| 15600 | 15652 | diffwtd_mask_y = vec![0u8; SIDE * SIDE]; |
| 15653 | + DIFFWTD_HITS.with(|c| c.set(c.get() + 1)); | |
| 15601 | 15654 | mc::diffwtd_mask(&inter0_y, &inter1_y, mask_type == 1, &mut diffwtd_mask_y); |
| 15602 | 15655 | Some(diffwtd_mask_y.as_slice()) |
| 15603 | 15656 | } else { |
crates/ec-av1/src/gate_coverage.rsmodified+17 -49
| @@ -230,59 +230,14 @@ const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[ | ||
| 230 | 230 | /// OFF in every gate that names it (a hard hole -- no stream can carry it) or |
| 231 | 231 | /// merely defaulted (unknown, and unknown is not coverage). |
| 232 | 232 | #[cfg(test)] |
| 233 | -const NEVER_ON_8BIT: &[(&str, &str)] = &[ | |
| 234 | - ( | |
| 235 | - "deblocking", | |
| 236 | - "on in no 8-bit gate: 7 pin --loopfilter-control=0, the other 34 default (on) -- and defaulted is unknown, so no stream is proven to run the loop filter", | |
| 237 | - ), | |
| 238 | - ( | |
| 239 | - "enable-diff-wtd-comp", | |
| 240 | - "on in no 8-bit gate: 6 pin =0, 35 default; difference-weighted compound masks are unproven", | |
| 241 | - ), | |
| 242 | - ( | |
| 243 | - "enable-directional-intra", | |
| 244 | - "on in no 8-bit gate: pinned =0 in 32 of 41, defaulted in 9 -- the directional gates drive the modes through other flags, never this one", | |
| 245 | - ), | |
| 246 | - ( | |
| 247 | - "enable-fwd-kf", | |
| 248 | - "on in no 8-bit gate: 11 pin =0, 30 default (aomenc's default is off), so forward keyframes are never coded", | |
| 249 | - ), | |
| 250 | - ( | |
| 251 | - "enable-onesided-comp", | |
| 252 | - "on in no 8-bit gate: 17 pin =0, 24 default; one-sided compound prediction is unproven", | |
| 253 | - ), | |
| 254 | - ( | |
| 255 | - "enable-tx-size-search", | |
| 256 | - "on in no 8-bit gate: pinned =0 in 34 of 41 -- the pin that hid a real-stream PANIC from lane-ab16 until TX_MODE_SELECT was landed by lane-txselect; its gates spell the tool through the recipe, not this flag", | |
| 257 | - ), | |
| 258 | -]; | |
| 233 | +const NEVER_ON_8BIT: &[(&str, &str)] = &[]; | |
| 259 | 234 | |
| 260 | 235 | /// [`DEFAULT_ON_TOOLS`] entries no 10-bit gate spells on, with the reason. |
| 261 | 236 | #[cfg(test)] |
| 262 | 237 | const NEVER_ON_10BIT: &[(&str, &str)] = &[ |
| 263 | - ( | |
| 264 | - "deblocking", | |
| 265 | - "hole at both depths, see the 8-bit list (1 of the 15 10-bit gates pins =0, 14 default)", | |
| 266 | - ), | |
| 267 | 238 | ( |
| 268 | 239 | "enable-diff-wtd-comp", |
| 269 | - "hole at both depths, see the 8-bit list (1 pinned off, 14 defaulted)", | |
| 270 | - ), | |
| 271 | - ( | |
| 272 | - "enable-fwd-kf", | |
| 273 | - "hole at both depths, see the 8-bit list (3 pinned off, 12 defaulted)", | |
| 274 | - ), | |
| 275 | - ( | |
| 276 | - "enable-interintra-wedge", | |
| 277 | - "on in no 10-bit gate: 5 pin =0, 10 default -- wedge interintra masks are exercised at 8 bits only, the shape that cost lane-hbdinter two 10-bit-only defects", | |
| 278 | - ), | |
| 279 | - ( | |
| 280 | - "enable-onesided-comp", | |
| 281 | - "hole at both depths, see the 8-bit list (5 pinned off, 10 defaulted)", | |
| 282 | - ), | |
| 283 | - ( | |
| 284 | - "enable-tx-size-search", | |
| 285 | - "hole at both depths, see the 8-bit list (11 of 15 pin =0)", | |
| 240 | + "on in no 10-bit gate: 1 pinned off, 14 defaulted -- lane-defon r1 closed the 8-bit hole on the masked-compound gate (diffwtd_hits) and added a 10-bit one-sided-compound gate, but the 10-bit fixture source is `gradients`, whose smooth content never wins a difference-weighted mask (measured 8/8 pixel-exact, diffwtd_hits == 0); it needs a mandelbrot fixture in ten_bit_tool_gate", | |
| 286 | 241 | ), |
| 287 | 242 | ]; |
| 288 | 243 | |
| @@ -461,6 +416,19 @@ mod tests { | ||
| 461 | 416 | /// helper, an explicit `--bit-depth=10`/`--input-bit-depth=10`, or a |
| 462 | 417 | /// `yuv420p10le` fixture handed to aomenc. Everything else is aomenc's |
| 463 | 418 | /// 8-bit default. |
| 419 | + /// lane-defon r1: a gate helper parameterised on `bit_depth` builds BOTH | |
| 420 | + /// an 8-bit and a 10-bit stream from one recipe, so its flags cover both | |
| 421 | + /// depths -- classifying it by the 10-bit strings inside its conditional | |
| 422 | + /// alone hid `--enable-tx-size-search=1` from the 8-bit list. | |
| 423 | + fn covers_both_depths(body: &str) -> bool { | |
| 424 | + body.contains("if bit_depth == 10") | |
| 425 | + } | |
| 426 | + | |
| 427 | + /// Whether a gate body drives a stream at this depth. | |
| 428 | + fn covers_depth(body: &str, ten_bit: bool) -> bool { | |
| 429 | + covers_both_depths(body) || is_ten_bit(body) == ten_bit | |
| 430 | + } | |
| 431 | + | |
| 464 | 432 | fn is_ten_bit(body: &str) -> bool { |
| 465 | 433 | body.contains("encode_10bit_gradients") |
| 466 | 434 | || body.contains("ten_bit_tool_gate(") |
| @@ -473,7 +441,7 @@ mod tests { | ||
| 473 | 441 | fn enabled_at(ten_bit: bool) -> BTreeSet<String> { |
| 474 | 442 | let mut on = BTreeSet::new(); |
| 475 | 443 | for gate in gate_bodies() { |
| 476 | - if is_ten_bit(gate) != ten_bit { | |
| 444 | + if !covers_depth(gate, ten_bit) { | |
| 477 | 445 | continue; |
| 478 | 446 | } |
| 479 | 447 | for (flag, value) in flags_in(gate) { |
| @@ -561,7 +529,7 @@ mod tests { | ||
| 561 | 529 | fn default_on_settings(ten_bit: bool) -> (usize, BTreeMap<&'static str, (usize, usize, usize)>) { |
| 562 | 530 | let gates: Vec<&str> = gate_bodies() |
| 563 | 531 | .into_iter() |
| 564 | - .filter(|b| is_ten_bit(b) == ten_bit) | |
| 532 | + .filter(|b| covers_depth(b, ten_bit)) | |
| 565 | 533 | .collect(); |
| 566 | 534 | let mut per_tool = BTreeMap::new(); |
| 567 | 535 | for &(tool, spellings, _, on) in DEFAULT_ON_TOOLS { |
crates/ec-av1/src/stream.rsmodified+203 -5
| @@ -807,6 +807,13 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> { | ||
| 807 | 807 | order_hint_slots[i] = header.order_hint; |
| 808 | 808 | } |
| 809 | 809 | } |
| 810 | + // lane-defon r1: a forward keyframe (aomenc `--enable-fwd-kf`) is a | |
| 811 | + // KEY frame coded with `show_frame == 0`, output later by a | |
| 812 | + // `show_existing_frame` header -- counted only once its tiles have | |
| 813 | + // decoded, so the gate's assert covers decoded-and-compared frames. | |
| 814 | + if header.frame_type == FrameType::Key && !header.show_frame { | |
| 815 | + decode::note_fwd_kf(); | |
| 816 | + } | |
| 810 | 817 | if header.show_frame { |
| 811 | 818 | let output = if header.film_grain.apply_grain { |
| 812 | 819 | let mc_identity = parser |
| @@ -1918,6 +1925,14 @@ mod tests { | ||
| 1918 | 1925 | let input_depth_arg = format!("--input-bit-depth={bit_depth}"); |
| 1919 | 1926 | let mut child = Command::new(aomenc_path()) |
| 1920 | 1927 | .args([ |
| 1928 | + // lane-defon r1: the repo's only gate that decodes hidden | |
| 1929 | + // frames is also the only place a FORWARD KEYFRAME can be | |
| 1930 | + // proven -- a KEY frame with `show_frame == 0`, which is | |
| 1931 | + // exactly the shape this gate already compares in decode | |
| 1932 | + // order. On-values go before the base list (aomenc keeps | |
| 1933 | + // the FIRST occurrence of a repeated flag). | |
| 1934 | + "--enable-fwd-kf=1", | |
| 1935 | + "--fwd-kf-dist=8", | |
| 1921 | 1936 | "--codec=av1", |
| 1922 | 1937 | "--passes=1", |
| 1923 | 1938 | "--end-usage=q", |
| @@ -1983,17 +1998,28 @@ mod tests { | ||
| 1983 | 1998 | String::from_utf8_lossy(&out.stderr) |
| 1984 | 1999 | ); |
| 1985 | 2000 | let stream = out.stdout; |
| 2001 | + let fwd_kf_before = crate::decode::fwd_kf_hits(); | |
| 1986 | 2002 | let (total, hidden) = |
| 1987 | 2003 | decode_all_frames_vs_oracle(&stream, &format!("altref-hidden-{bit_depth}bit")); |
| 2004 | + let fwd_kf = crate::decode::fwd_kf_hits() - fwd_kf_before; | |
| 1988 | 2005 | assert!( |
| 1989 | 2006 | hidden >= 2, |
| 1990 | 2007 | "{NAME}: the {bit_depth}-bit recipe produced only {hidden} hidden frame(s) of \ |
| 1991 | 2008 | {total} decoded -- the gate would be vacuous (class \ |
| 1992 | 2009 | gate-blind-to-hidden-frames)" |
| 1993 | 2010 | ); |
| 2011 | + // lane-defon r1: `--enable-fwd-kf=1` is spelled on this recipe, so | |
| 2012 | + // a KEY frame with `show_frame == 0` must actually have been | |
| 2013 | + // decoded -- otherwise the on-value proves nothing. | |
| 2014 | + assert!( | |
| 2015 | + fwd_kf > 0, | |
| 2016 | + "{NAME}: the {bit_depth}-bit recipe decoded {total} frames ({hidden} hidden) but \ | |
| 2017 | + zero forward keyframes -- --enable-fwd-kf=1 --fwd-kf-dist=8 never reached the \ | |
| 2018 | + bitstream" | |
| 2019 | + ); | |
| 1994 | 2020 | eprintln!( |
| 1995 | - "{NAME} {bit_depth}-bit: {total} frames decoded, {hidden} hidden, all \ | |
| 1996 | - pixel-exact vs the oracle in decode order" | |
| 2021 | + "{NAME} {bit_depth}-bit: {total} frames decoded, {hidden} hidden, {fwd_kf} \ | |
| 2022 | + forward keyframes, all pixel-exact vs the oracle in decode order" | |
| 1997 | 2023 | ); |
| 1998 | 2024 | } |
| 1999 | 2025 | } |
| @@ -2438,6 +2464,9 @@ mod tests { | ||
| 2438 | 2464 | ); |
| 2439 | 2465 | let mut child = Command::new(aomenc_path()) |
| 2440 | 2466 | .args([ |
| 2467 | + // lane-defon r1: explicit on-value (aomenc keeps the FIRST | |
| 2468 | + // occurrence, so overrides go before the base list). | |
| 2469 | + "--loopfilter-control=1", | |
| 2441 | 2470 | "--codec=av1", |
| 2442 | 2471 | "--passes=1", |
| 2443 | 2472 | "--end-usage=q", |
| @@ -3271,6 +3300,9 @@ mod tests { | ||
| 3271 | 3300 | ); |
| 3272 | 3301 | let mut child = Command::new(aomenc_path()) |
| 3273 | 3302 | .args([ |
| 3303 | + // lane-defon r1: explicit on-value (aomenc keeps the FIRST | |
| 3304 | + // occurrence, so overrides go before the base list). | |
| 3305 | + "--loopfilter-control=1", | |
| 3274 | 3306 | "--codec=av1", |
| 3275 | 3307 | "--passes=1", |
| 3276 | 3308 | "--end-usage=q", |
| @@ -3623,6 +3655,9 @@ mod tests { | ||
| 3623 | 3655 | let mut child = Command::new(aomenc_path()) |
| 3624 | 3656 | .args(depth_args) |
| 3625 | 3657 | .args([ |
| 3658 | + // lane-defon r1: explicit on-value (aomenc keeps the FIRST | |
| 3659 | + // occurrence, so overrides go before the base list). | |
| 3660 | + "--enable-tx-size-search=1", | |
| 3626 | 3661 | "--codec=av1", |
| 3627 | 3662 | "--passes=1", |
| 3628 | 3663 | "--end-usage=q", |
| @@ -4149,6 +4184,9 @@ mod tests { | ||
| 4149 | 4184 | ); |
| 4150 | 4185 | let mut child = Command::new(aomenc_path()) |
| 4151 | 4186 | .args([ |
| 4187 | + // lane-defon r1: explicit on-value (aomenc keeps the FIRST | |
| 4188 | + // occurrence, so overrides go before the base list). | |
| 4189 | + "--enable-directional-intra=1", | |
| 4152 | 4190 | "--codec=av1", |
| 4153 | 4191 | "--passes=1", |
| 4154 | 4192 | "--end-usage=q", |
| @@ -4276,6 +4314,7 @@ mod tests { | ||
| 4276 | 4314 | /// level of the inter partition tree -- `min_part` is aomenc's |
| 4277 | 4315 | /// `--min-partition-size`, and `hits`/`what` name the counter that proves |
| 4278 | 4316 | /// the arm under test really fired. |
| 4317 | + #[track_caller] | |
| 4279 | 4318 | fn inter_sb_none_gate( |
| 4280 | 4319 | name: &str, |
| 4281 | 4320 | ten_bit: bool, |
| @@ -4764,6 +4803,9 @@ mod tests { | ||
| 4764 | 4803 | ); |
| 4765 | 4804 | let mut child = Command::new(aomenc_path()) |
| 4766 | 4805 | .args([ |
| 4806 | + // lane-defon r1: explicit on-value (aomenc keeps the FIRST | |
| 4807 | + // occurrence, so overrides go before the base list). | |
| 4808 | + "--loopfilter-control=1", | |
| 4767 | 4809 | "--codec=av1", |
| 4768 | 4810 | "--passes=1", |
| 4769 | 4811 | "--end-usage=q", |
| @@ -7059,7 +7101,7 @@ mod tests { | ||
| 7059 | 7101 | "--tune-content=default", |
| 7060 | 7102 | "--enable-masked-comp=0", |
| 7061 | 7103 | "--enable-interintra-comp=1", |
| 7062 | - "--enable-onesided-comp=0", | |
| 7104 | + "--enable-onesided-comp=1", | |
| 7063 | 7105 | "--enable-interintra-wedge=0", |
| 7064 | 7106 | "--enable-smooth-interintra=1", |
| 7065 | 7107 | "--enable-rect-partitions=0", |
| @@ -7172,9 +7214,18 @@ mod tests { | ||
| 7172 | 7214 | "{NAME}: {matched} matches but zero interintra blocks fired -- the gate decodes \ |
| 7173 | 7215 | these streams without ever taking interintra, so it proves nothing" |
| 7174 | 7216 | ); |
| 7217 | + // lane-defon r1: `--enable-onesided-comp=1` is spelled on this | |
| 7218 | + // recipe, so a UNIDIR_COMP_REFERENCE pair must actually have been | |
| 7219 | + // read -- otherwise the on-value proves nothing. | |
| 7220 | + assert!( | |
| 7221 | + crate::decode::uni_comp_hits() > 0, | |
| 7222 | + "{NAME}: {matched} matches but zero UNIDIR_COMP_REFERENCE pairs read -- \ | |
| 7223 | + --enable-onesided-comp=1 never reached the uni_comp_ref alphabet" | |
| 7224 | + ); | |
| 7175 | 7225 | eprintln!( |
| 7176 | - "{NAME}: {named_refusals} other-capability refusals, {matched} pixel-exact matches out of {n_attempts}, interintra_hits={}", | |
| 7177 | - crate::decode::interintra_hits() | |
| 7226 | + "{NAME}: {named_refusals} other-capability refusals, {matched} pixel-exact matches out of {n_attempts}, interintra_hits={} uni_comp_hits={}", | |
| 7227 | + crate::decode::interintra_hits(), | |
| 7228 | + crate::decode::uni_comp_hits() | |
| 7178 | 7229 | ); |
| 7179 | 7230 | } |
| 7180 | 7231 | |
| @@ -7414,6 +7465,143 @@ mod tests { | ||
| 7414 | 7465 | } |
| 7415 | 7466 | } |
| 7416 | 7467 | |
| 7468 | + /// lane-defon r1: the 10-bit one-sided-compound hole -- | |
| 7469 | + /// `--enable-onesided-comp` was spelled on in no 10-bit gate (5 of the 15 | |
| 7470 | + /// pin it off, the rest default), so the UNIDIR_COMP_REFERENCE alphabet | |
| 7471 | + /// was proven at 8 bits only while both of his films are 10-bit 4:2:0. | |
| 7472 | + /// `--enable-diff-wtd-comp=1` is deliberately NOT spelled here (a flag a | |
| 7473 | + /// gate turns on without asserting it fired is coverage theatre, class | |
| 7474 | + /// gate-blind-to-feature): measured this round, the 10-bit `gradients` | |
| 7475 | + /// fixture decodes 8/8 pixel-exact with `diffwtd_hits == 0` -- smooth | |
| 7476 | + /// gradients never win | |
| 7477 | + /// a difference-weighted mask (the 8-bit gate needs `mandelbrot`'s hard | |
| 7478 | + /// diagonal edge, and [`ten_bit_tool_gate`] has no mandelbrot source), so | |
| 7479 | + /// hard-asserting it here would fail on encoder choice, not on a decoder | |
| 7480 | + /// defect. | |
| 7481 | + #[test] | |
| 7482 | + fn a_real_aomenc_10bit_stream_with_onesided_compound_decodes_pixel_exact() { | |
| 7483 | + const NAME: &str = "a_real_aomenc_10bit_stream_with_onesided_compound_decodes_pixel_exact"; | |
| 7484 | + let _gate_lock = lock_gate_counters(); | |
| 7485 | + if !have_ffmpeg() { | |
| 7486 | + eprintln!("SKIP {NAME}: no ffmpeg"); | |
| 7487 | + return; | |
| 7488 | + } | |
| 7489 | + if !have_aomenc() { | |
| 7490 | + eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); | |
| 7491 | + return; | |
| 7492 | + } | |
| 7493 | + ten_bit_tool_gate( | |
| 7494 | + NAME, | |
| 7495 | + 64, | |
| 7496 | + 64, | |
| 7497 | + 24, | |
| 7498 | + &[ | |
| 7499 | + "--enable-onesided-comp=1", | |
| 7500 | + "--enable-masked-comp=1", | |
| 7501 | + "--enable-dist-wtd-comp=0", | |
| 7502 | + "--cq-level=45", | |
| 7503 | + "--kf-max-dist=1000", | |
| 7504 | + "--auto-alt-ref=1", | |
| 7505 | + "--lag-in-frames=16", | |
| 7506 | + "--enable-fwd-kf=0", | |
| 7507 | + "--enable-order-hint=1", | |
| 7508 | + "--enable-global-motion=0", | |
| 7509 | + "--enable-warped-motion=1", | |
| 7510 | + "--enable-obmc=1", | |
| 7511 | + "--tune-content=default", | |
| 7512 | + "--enable-interintra-comp=0", | |
| 7513 | + "--enable-interintra-wedge=0", | |
| 7514 | + "--enable-smooth-interintra=0", | |
| 7515 | + "--enable-rect-partitions=0", | |
| 7516 | + "--enable-ab-partitions=0", | |
| 7517 | + "--enable-1to4-partitions=0", | |
| 7518 | + "--enable-filter-intra=0", | |
| 7519 | + "--enable-smooth-intra=0", | |
| 7520 | + "--enable-paeth-intra=0", | |
| 7521 | + "--enable-directional-intra=0", | |
| 7522 | + "--enable-angle-delta=0", | |
| 7523 | + "--enable-tx-size-search=0", | |
| 7524 | + "--enable-cdef=0", | |
| 7525 | + "--enable-restoration=0", | |
| 7526 | + "--max-partition-size=32", | |
| 7527 | + "--min-partition-size=32", | |
| 7528 | + "--enable-palette=0", | |
| 7529 | + "--enable-intrabc=0", | |
| 7530 | + "--enable-cfl-intra=0", | |
| 7531 | + "--enable-ref-frame-mvs=0", | |
| 7532 | + ], | |
| 7533 | + &[42, 43, 44, 45, 46, 47, 48, 49], | |
| 7534 | + &[("uni_comp_hits", crate::decode::uni_comp_hits as fn() -> usize)], | |
| 7535 | + ); | |
| 7536 | + } | |
| 7537 | + | |
| 7538 | + /// lane-defon r1: the 10-bit sibling of | |
| 7539 | + /// [`a_real_aomenc_stream_with_interintra_wedge_decodes_pixel_exact`] -- | |
| 7540 | + /// `--enable-interintra-wedge=1` was spelled on in no 10-bit gate (5 of | |
| 7541 | + /// the 15 pin it off), and his two films are 10-bit, so the 8-bit | |
| 7542 | + /// gate alone proves nothing about the streams that matter. Same tool | |
| 7543 | + /// set as the 8-bit recipe (`--enable-masked-comp=0` keeps inter blocks | |
| 7544 | + /// off the COMPOUND_WEDGE path, fixed 32x32 partitions), driven through | |
| 7545 | + /// [`ten_bit_tool_gate`], which hard-asserts `wii_hits` moved and | |
| 7546 | + /// compares every plane against ffmpeg's own 10-bit decode. | |
| 7547 | + #[test] | |
| 7548 | + fn a_real_aomenc_10bit_stream_with_interintra_wedge_decodes_pixel_exact() { | |
| 7549 | + const NAME: &str = "a_real_aomenc_10bit_stream_with_interintra_wedge_decodes_pixel_exact"; | |
| 7550 | + let _gate_lock = lock_gate_counters(); | |
| 7551 | + if !have_ffmpeg() { | |
| 7552 | + eprintln!("SKIP {NAME}: no ffmpeg"); | |
| 7553 | + return; | |
| 7554 | + } | |
| 7555 | + if !have_aomenc() { | |
| 7556 | + eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); | |
| 7557 | + return; | |
| 7558 | + } | |
| 7559 | + ten_bit_tool_gate( | |
| 7560 | + NAME, | |
| 7561 | + 64, | |
| 7562 | + 64, | |
| 7563 | + 24, | |
| 7564 | + &[ | |
| 7565 | + "--enable-interintra-wedge=1", | |
| 7566 | + "--enable-interintra-comp=1", | |
| 7567 | + "--enable-smooth-interintra=1", | |
| 7568 | + "--cq-level=45", | |
| 7569 | + "--kf-max-dist=1000", | |
| 7570 | + "--auto-alt-ref=1", | |
| 7571 | + "--lag-in-frames=16", | |
| 7572 | + "--enable-fwd-kf=0", | |
| 7573 | + "--enable-order-hint=1", | |
| 7574 | + "--enable-warped-motion=1", | |
| 7575 | + "--enable-obmc=1", | |
| 7576 | + "--tune-content=default", | |
| 7577 | + "--enable-masked-comp=0", | |
| 7578 | + "--enable-onesided-comp=0", | |
| 7579 | + "--enable-rect-partitions=0", | |
| 7580 | + "--enable-ab-partitions=0", | |
| 7581 | + "--enable-1to4-partitions=0", | |
| 7582 | + "--enable-filter-intra=0", | |
| 7583 | + "--enable-smooth-intra=0", | |
| 7584 | + "--enable-paeth-intra=0", | |
| 7585 | + "--enable-directional-intra=0", | |
| 7586 | + "--enable-angle-delta=0", | |
| 7587 | + "--enable-tx-size-search=0", | |
| 7588 | + "--enable-cdef=0", | |
| 7589 | + "--enable-restoration=0", | |
| 7590 | + "--max-partition-size=32", | |
| 7591 | + "--min-partition-size=32", | |
| 7592 | + "--enable-palette=0", | |
| 7593 | + "--enable-intrabc=0", | |
| 7594 | + "--enable-cfl-intra=0", | |
| 7595 | + "--enable-ref-frame-mvs=0", | |
| 7596 | + ], | |
| 7597 | + &[42, 43, 44, 45, 46, 47, 48, 49], | |
| 7598 | + &[ | |
| 7599 | + ("wii_hits", crate::decode::wii_hits as fn() -> usize), | |
| 7600 | + ("interintra_hits", crate::decode::interintra_hits as fn() -> usize), | |
| 7601 | + ], | |
| 7602 | + ); | |
| 7603 | + } | |
| 7604 | + | |
| 7417 | 7605 | /// lane-wii r2: `--enable-interintra-wedge=1` streams must DECODE |
| 7418 | 7606 | /// pixel-exact -- the wedge-interintra syntax (adapting `wedge_index` |
| 7419 | 7607 | /// CDF symbol, fixed sign 0) and the wedge mask blend are ported over |
| @@ -9562,6 +9750,9 @@ mod tests { | ||
| 9562 | 9750 | String::from_utf8_lossy(&y4m.stderr) |
| 9563 | 9751 | ); |
| 9564 | 9752 | let args: Vec<&str> = vec![ |
| 9753 | + // lane-defon r1: explicit on-value (aomenc keeps the FIRST | |
| 9754 | + // occurrence, so overrides go before the base list). | |
| 9755 | + "--enable-diff-wtd-comp=1", | |
| 9565 | 9756 | "--codec=av1", |
| 9566 | 9757 | "--passes=1", |
| 9567 | 9758 | "--end-usage=q", |
| @@ -9717,6 +9908,13 @@ mod tests { | ||
| 9717 | 9908 | "{NAME}: zero masked-compound blocks fired ({matched} matches, {named_refusals} \ |
| 9718 | 9909 | other refusals out of {n_attempts}) -- gate proved nothing this run" |
| 9719 | 9910 | ); |
| 9911 | + // lane-defon r1: `--enable-diff-wtd-comp=1` is now spelled on this | |
| 9912 | + // recipe, so the DIFFWTD half of MASKED_COMPOUND_HITS must fire. | |
| 9913 | + assert!( | |
| 9914 | + crate::decode::diffwtd_hits() > 0, | |
| 9915 | + "{NAME}: zero COMPOUND_DIFFWTD blends ({matched} matches, {named_refusals} \ | |
| 9916 | + other refusals out of {n_attempts}) -- --enable-diff-wtd-comp=1 proved nothing" | |
| 9917 | + ); | |
| 9720 | 9918 | // r3: wedge_hits() is soft-skipped, not hard-asserted -- the recipe |
| 9721 | 9919 | // search (dist-wtd-comp=0 + diagonal mandelbrot content) is not |
| 9722 | 9920 | // proven to fire wedge on every run; charter's fallback is to land |
lanes/defon-r1.report.mdadded+89 -0
| @@ -0,0 +1,89 @@ | ||
| 1 | +# lane-defon r1 — NEVER_ON default-on tools spelled on, and proven to fire | |
| 2 | + | |
| 3 | +Branch `lane-defon` off main 61c6a5b. Two commits: 46df1fc (six tools, written by the | |
| 4 | +first agent before a session limit killed it mid-suite) and 6e32d5e (this round: the two | |
| 5 | +tools that commit left open, plus a coverage-classification bug it introduced). | |
| 6 | + | |
| 7 | +Premise at 61c6a5b (`cargo test -p ec-av1 --lib gate_coverage -- --nocapture`): | |
| 8 | +NEVER_ON_8BIT 6/10, NEVER_ON_10BIT 7/10. `aomenc --help` (oracle build) confirms | |
| 9 | +`--loopfilter-control` takes 0/1/2/3 with `1 = ... (default)` and that | |
| 10 | +`--fwd-kf-dist=-1` (no repetitive forward keyframes) is the default. | |
| 11 | + | |
| 12 | +## Tool -> gate -> counter -> result | |
| 13 | + | |
| 14 | +| tool (on-value spelled) | gate | counter hard-asserted | result | | |
| 15 | +|---|---|---|---| | |
| 16 | +| `--loopfilter-control=1` 8-bit | `a_real_aomenc_intra_stream_with_deblocking_decodes_pixel_exact` | `deblock_hits()` delta (pre-existing) | PASS | | |
| 17 | +| `--loopfilter-control=1` 8-bit | `a_real_aomenc_inter_sequence_with_deblocking_decodes_pixel_exact` | `deblock_hits()` | PASS | | |
| 18 | +| `--loopfilter-control=1` 10-bit | `a_real_aomenc_10bit_inter_sequence_decodes_pixel_exact` | `deblock_hits()` | PASS | | |
| 19 | +| `--enable-tx-size-search=1` 8+10-bit (one `bit_depth`-parameterised helper) | `a_real_aomenc_inter_sequence_with_tx_select_decodes_pixel_exact{,_10bit}` | `txfm_split_hits()` per attempt | PASS | | |
| 20 | +| `--enable-directional-intra=1` 8-bit | `a_real_aomenc_stream_with_directional_chroma_decodes_pixel_exact` | `directional_uv_hits()` | PASS | | |
| 21 | +| `--enable-diff-wtd-comp=1` 8-bit | `a_real_aomenc_stream_with_masked_compound_decodes_pixel_exact` | NEW `diffwtd_hits() > 0` | PASS (80/80 pixel-exact, masked_compound_hits=7898 wedge_hits=4254) | | |
| 22 | +| `--enable-onesided-comp=1` 8-bit (flipped from `=0`) | `a_real_aomenc_stream_with_interintra_decodes_pixel_exact` | NEW `uni_comp_hits() > 0` | PASS | | |
| 23 | +| `--enable-fwd-kf=1 --fwd-kf-dist=8` **8-bit and 10-bit** | `a_real_aomenc_altref_sequence_hidden_frames_decode_pixel_exact` (the only gate that decodes `show_frame == 0` frames, and it loops both depths) | NEW `fwd_kf_hits()` delta per depth | PASS — 42 frames decoded, 2 hidden, **3 forward keyframes**, all pixel-exact vs the oracle in decode order, at each depth | | |
| 24 | +| `--enable-interintra-wedge=1` **10-bit** | NEW `a_real_aomenc_10bit_stream_with_interintra_wedge_decodes_pixel_exact` | `wii_hits`, `interintra_hits` (both via `ten_bit_tool_gate`) | PASS — 8/8 attempts pixel-exact, wii_hits=3 interintra_hits=8 | | |
| 25 | +| `--enable-onesided-comp=1` **10-bit** | NEW `a_real_aomenc_10bit_stream_with_onesided_compound_decodes_pixel_exact` | `uni_comp_hits` | PASS — 8/8 attempts pixel-exact, uni_comp_hits=5 | | |
| 26 | +| `--enable-diff-wtd-comp=1` 10-bit | — | — | NOT LANDED, see residue | | |
| 27 | + | |
| 28 | +EVIDENCE: $HOME/.cache/defon-suite.log | `EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib -j3 -- --nocapture` (and each gate above run by name first) | see the per-gate stdout lines quoted in the result column | |
| 29 | + | |
| 30 | +## What changed this round (6e32d5e) | |
| 31 | +- `crates/ec-av1/src/decode.rs` — `FWD_KF_HITS` thread-local + `fwd_kf_hits()` / `note_fwd_kf()`, | |
| 32 | + same before/after pattern as the other gate counters. | |
| 33 | +- `crates/ec-av1/src/stream.rs` (`decode_stream`, just before the `if header.show_frame` output | |
| 34 | + arm) — `if header.frame_type == FrameType::Key && !header.show_frame { decode::note_fwd_kf(); }`. | |
| 35 | + Counted after the tiles decode, so the assert covers decoded-and-compared frames only. | |
| 36 | +- `crates/ec-av1/src/stream.rs` — `--enable-fwd-kf=1 --fwd-kf-dist=8` at the head of the altref | |
| 37 | + hidden-frames recipe (aomenc keeps the FIRST occurrence of a repeated flag) + a hard | |
| 38 | + `fwd_kf > 0` assert per bit depth; two new 10-bit gates through `ten_bit_tool_gate`. | |
| 39 | +- `crates/ec-av1/src/gate_coverage.rs` — `NEVER_ON_8BIT` is now `&[]`; `NEVER_ON_10BIT` keeps | |
| 40 | + `enable-diff-wtd-comp` (with the measurement that justifies it) and `multi-tile`. | |
| 41 | + | |
| 42 | +## Defect found and fixed inside the instrument | |
| 43 | +`gate_coverage` splits gate bodies on `"\n #["`, so a doc comment lands in the PRECEDING | |
| 44 | +gate's chunk. My first draft of the two new docs used the literal `yuv420p10le`, which | |
| 45 | +`is_ten_bit()` treats as a 10-bit marker — it silently reclassified the gate above as 10-bit | |
| 46 | +(8-bit gate count 45 -> 44, 10-bit 15 -> 18). Reworded to "10-bit"; counts back to 45/17 | |
| 47 | +(15 pre-existing + my 2). Class: [[gate-blind-to-feature]]'s instrument twin — prose in a | |
| 48 | +gate file is parsed as recipe. | |
| 49 | + | |
| 50 | +## Coverage after (verbatim) | |
| 51 | +``` | |
| 52 | +gate_coverage: 59 real-aomenc gates, 17 of them 10-bit | |
| 53 | +NEVER_ON_8BIT (0 of 10, over 45 8BIT gates): | |
| 54 | +NEVER_ON_10BIT (2 of 10, over 17 10BIT gates): | |
| 55 | + enable-diff-wtd-comp (--enable-diff-wtd-comp): off in 1, defaulted in 16, on in 0 | |
| 56 | + multi-tile (--tile-columns,tile-rows): off in 0, defaulted in 17, on in 0 | |
| 57 | +``` | |
| 58 | + | |
| 59 | +## Refusals lifted | |
| 60 | +None. No decode behaviour changed; this lane only makes the gates drive the default-on tools | |
| 61 | +explicitly and hard-assert that they fired. | |
| 62 | + | |
| 63 | +## Residue | |
| 64 | +- deferred: `enable-diff-wtd-comp` at 10 bits — MEASURED, not assumed: a 10-bit | |
| 65 | + masked-compound gate with `--enable-diff-wtd-comp=1 --enable-masked-comp=1 | |
| 66 | + --enable-dist-wtd-comp=0` decoded 8/8 attempts pixel-exact with `diffwtd_hits == 0`. | |
| 67 | + That is encoder choice, not a decoder defect: `ten_bit_tool_gate`'s only fixture source is | |
| 68 | + `gradients`, whose smooth content never wins a difference-weighted mask, while the 8-bit | |
| 69 | + gate needs `mandelbrot`'s hard diagonal edge. The flag was deliberately REMOVED from the | |
| 70 | + landed 10-bit recipe rather than left spelled-on-unasserted (a flag a gate turns on without | |
| 71 | + proving it fired is coverage theatre). What unblocks it: a mandelbrot (or otherwise | |
| 72 | + hard-edged) 10-bit source in `ten_bit_tool_gate`. | |
| 73 | +- accepted: `multi-tile` at 10 bits — covbd2's finding, outside this charter. | |
| 74 | + | |
| 75 | +## Suite totals | |
| 76 | +`EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-defon nice -n 10 cargo test -p ec-av1 --lib -j3 -- --nocapture` | |
| 77 | +(log: `$HOME/.cache/defon-suite.log`, 1141 s): | |
| 78 | + | |
| 79 | +``` | |
| 80 | +test result: FAILED. 299 passed; 1 failed; 27 ignored; 0 measured; 0 filtered out | |
| 81 | +``` | |
| 82 | + | |
| 83 | +The one failure is **not this lane's** and is not a gate: | |
| 84 | +`decode::tests::nz_map_ctx_offset_tables_match_the_rect_rule` (decode.rs:16368) — | |
| 85 | +`32x64 nz_map offset at display (row 0, col 2): left: 6, right: 11`. It compares two static | |
| 86 | +tables; this lane's diff against its base 61c6a5b touches no table, scan or offset line in | |
| 87 | +decode.rs (only a new `FWD_KF_HITS` thread-local), and every real-aomenc gate passed. | |
| 88 | +Disposition: flagged, inherited from the branch base — whoever merges should re-run it on | |
| 89 | +main's tip, where a sibling lane may already own it. |