Merge lane-av1distwtd @ 1aaf7e0b — dist-wtd-comp witness gate + census detector fix + two retirements
Browse files at this commit4 changed files +839 -40
- crates/ec-av1/src/decode.rs +34 -0
- crates/ec-av1/src/gate_coverage.rs +350 -40
- crates/ec-av1/src/stream.rs +226 -0
- lanes/av1distwtd.report.md +229 -0
crates/ec-av1/src/decode.rsmodified+34 -0
| @@ -5112,6 +5112,32 @@ pub(crate) fn affine_gm_hits() -> usize { | |||
| 5112 | AFFINE_GM_HITS.with(|c| c.get()) | 5112 | AFFINE_GM_HITS.with(|c| c.get()) |
| 5113 | } | 5113 | } |
| 5114 | 5114 | ||
| 5115 | +// lane-av1distwtd: how many blocks took the DISTANCE-WEIGHTED compound | ||
| 5116 | +// combine rather than the simple average -- `compound_idx == 0` under | ||
| 5117 | +// `enable_jnt_comp`, whose weights come from | ||
| 5118 | +// [`crate::compound::dist_wtd_comp_weight_assign`] instead of the constant | ||
| 5119 | +// `(8, 8)` split. Counting the `idx == 0` arm (not merely the | ||
| 5120 | +// `compound_idx` symbol read) is what makes this a witness of the TOOL: a | ||
| 5121 | +// stream that carries `enable_jnt_comp = true` in its sequence header but | ||
| 5122 | +// codes every compound block with `compound_idx == 1` leaves this at 0 and | ||
| 5123 | +// decoded identically without the whole distance-weight path. | ||
| 5124 | +thread_local! { | ||
| 5125 | + static DIST_WTD_COMP_HITS: std::cell::Cell<usize> = | ||
| 5126 | + const { std::cell::Cell::new(0) }; | ||
| 5127 | +} | ||
| 5128 | + | ||
| 5129 | +/// Current value of [`DIST_WTD_COMP_HITS`]. | ||
| 5130 | +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | ||
| 5131 | +pub(crate) fn dist_wtd_comp_hits() -> usize { | ||
| 5132 | + DIST_WTD_COMP_HITS.with(|c| c.get()) | ||
| 5133 | +} | ||
| 5134 | + | ||
| 5135 | +/// Resets [`DIST_WTD_COMP_HITS`] to 0. | ||
| 5136 | +#[allow(dead_code)] // test-only | ||
| 5137 | +pub(crate) fn reset_dist_wtd_comp_hits() { | ||
| 5138 | + DIST_WTD_COMP_HITS.with(|c| c.set(0)); | ||
| 5139 | +} | ||
| 5140 | + | ||
| 5115 | // lane-av1gwarp12: how many 16x16+ blocks built their SINGLE-reference | 5141 | // lane-av1gwarp12: how many 16x16+ blocks built their SINGLE-reference |
| 5116 | // prediction through `crate::warp::global_warp_params` with a FOUR-parameter | 5142 | // prediction through `crate::warp::global_warp_params` with a FOUR-parameter |
| 5117 | // (`ROTZOOM`) model. Vanilla aomenc pins its global-motion search to ROTZOOM | 5143 | // (`ROTZOOM`) model. Vanilla aomenc pins its global-motion search to ROTZOOM |
| @@ -39128,6 +39154,10 @@ fn decode_inter_block( | |||
| 39128 | if idx == 1 { | 39154 | if idx == 1 { |
| 39129 | (8, 8, 1u8) | 39155 | (8, 8, 1u8) |
| 39130 | } else { | 39156 | } else { |
| 39157 | + // lane-av1distwtd: `idx == 0` is the | ||
| 39158 | + // distance-weighted arm -- the only branch whose | ||
| 39159 | + // weights are NOT the constant (8, 8) split. | ||
| 39160 | + hit!(DIST_WTD_COMP_HITS); | ||
| 39131 | let (fwd, bck) = crate::compound::dist_wtd_comp_weight_assign( | 39161 | let (fwd, bck) = crate::compound::dist_wtd_comp_weight_assign( |
| 39132 | order_hint_bits, | 39162 | order_hint_bits, |
| 39133 | order_hint, | 39163 | order_hint, |
| @@ -47095,6 +47125,10 @@ fn decode_inter_block8( | |||
| 47095 | if idx == 1 { | 47125 | if idx == 1 { |
| 47096 | (8, 8, 1u8) | 47126 | (8, 8, 1u8) |
| 47097 | } else { | 47127 | } else { |
| 47128 | + // lane-av1distwtd: the 8x8 leaf's own | ||
| 47129 | + // distance-weighted arm, same counter as the | ||
| 47130 | + // 16x16+ site above. | ||
| 47131 | + hit!(DIST_WTD_COMP_HITS); | ||
| 47098 | let (fwd, bck) = crate::compound::dist_wtd_comp_weight_assign( | 47132 | let (fwd, bck) = crate::compound::dist_wtd_comp_weight_assign( |
| 47099 | order_hint_bits, | 47133 | order_hint_bits, |
| 47100 | order_hint, | 47134 | order_hint, |
crates/ec-av1/src/gate_coverage.rsmodified+350 -40
| @@ -2,14 +2,25 @@ | |||
| 2 | //! | 2 | //! |
| 3 | //! Every gate in [`crate::stream`] that runs a real `aomenc` picks its coding | 3 | //! Every gate in [`crate::stream`] that runs a real `aomenc` picks its coding |
| 4 | //! tools with `--enable-*=0/1` flags, and a flag left off the command line | 4 | //! tools with `--enable-*=0/1` flags, and a flag left off the command line |
| 5 | -//! takes aomenc's default (on, for the tools this decoder cares about). That | 5 | +//! takes aomenc's default. That default is `1` for essentially every tool in |
| 6 | -//! makes it possible -- and it happened -- for a coding tool to be switched | 6 | +//! [`TOOL_UNIVERSE`] on a non-realtime build -- `default_extra_cfg` in |
| 7 | -//! *off in every single gate*, so that no real stream in this repository ever | 7 | +//! `av1/av1_cx_iface.c` is all-ones across the seq-level tool fields, and this |
| 8 | -//! exercised it and a corner-cut in the decoder survived twenty gates | 8 | +//! oracle is built with `CONFIG_REALTIME_ONLY 0`. But a `1` default is NOT |
| 9 | -//! unnoticed: `reconstruct`'s `smooth_neighbor` was hardcoded `false`, wrong | 9 | +//! the same as the tool reaching the stream, and the rest of this file's |
| 10 | -//! whenever a directional block neighbours a smooth-mode one, and invisible | 10 | +//! "defaulted means unknown" rule rests on that gap: palette and intrabc are |
| 11 | -//! because all twenty gates passed `--enable-smooth-intra=0` | 11 | +//! gated on CONTENT (`encoder.c:2079` derives `allow_screen_content_tools` |
| 12 | -//! (lane-chroma r1, 2026-08-30). | 12 | +//! from block counts, and `seq_force_screen_content_tools` is left at the |
| 13 | +//! adaptive `SELECT_SCREEN_CONTENT_TOOLS`), and `speed_features.c` masks | ||
| 14 | +//! several tools OFF again per `--cpu-used`. A `1` default proves the encoder | ||
| 15 | +//! was ALLOWED the tool, never that any block used it. | ||
| 16 | +//! | ||
| 17 | +//! With that default in place it is possible -- and it happened -- for a | ||
| 18 | +//! coding tool to be switched *off in every single gate*, so that no real | ||
| 19 | +//! stream in this repository ever exercised it and a corner-cut in the | ||
| 20 | +//! decoder survived twenty gates unnoticed: `reconstruct`'s | ||
| 21 | +//! `smooth_neighbor` was hardcoded `false`, wrong whenever a directional | ||
| 22 | +//! block neighbours a smooth-mode one, and invisible because all twenty | ||
| 23 | +//! gates passed `--enable-smooth-intra=0` (lane-chroma r1, 2026-08-30). | ||
| 13 | //! | 24 | //! |
| 14 | //! The test below re-derives that set from the gate source and pins it. A tool | 25 | //! The test below re-derives that set from the gate source and pins it. A tool |
| 15 | //! that is switched off in every gate and on in none is *provably never | 26 | //! that is switched off in every gate and on in none is *provably never |
| @@ -22,8 +33,10 @@ | |||
| 22 | // keys on `--enable-<tool>=0/1`, and `--tile-columns=<log2>` has no such | 33 | // keys on `--enable-<tool>=0/1`, and `--tile-columns=<log2>` has no such |
| 23 | // shape -- a `--tile-columns=` presence check would also read `=0` (one tile) | 34 | // shape -- a `--tile-columns=` presence check would also read `=0` (one tile) |
| 24 | // as coverage, which is the opposite of what it would claim. It needs no | 35 | // as coverage, which is the opposite of what it would claim. It needs no |
| 25 | -// entry either: 13 gates spell `--tile-columns`/`--tile-rows` with a nonzero | 36 | +// entry either: measured 2026-09-29 (lane-av1distwtd r2), 19 of the 146 |
| 26 | -// log2 and assert the parsed `tile_info` really carries the grid, and | 37 | +// census-selected gate bodies spell `--tile-columns`/`--tile-rows` with a |
| 38 | +// nonzero log2 -- 9 assert the parsed `tile_info` in the same body and 10 | ||
| 39 | +// more delegate to a shared helper that asserts it -- and | ||
| 27 | // `run_multi_tile_gate` covers a 2D grid with the coding tools ON at both | 40 | // `run_multi_tile_gate` covers a 2D grid with the coding tools ON at both |
| 28 | // bit depths. | 41 | // bit depths. |
| 29 | 42 | ||
| @@ -107,16 +120,44 @@ enum On { | |||
| 107 | /// cover, listed with their aomenc default. | 120 | /// cover, listed with their aomenc default. |
| 108 | /// | 121 | /// |
| 109 | /// lane-covbd's derivation read `--enable-*` flags only, so a tool a gate pins | 122 | /// lane-covbd's derivation read `--enable-*` flags only, so a tool a gate pins |
| 110 | -/// off through another spelling was invisible: all 49 gates that name it pass | 123 | +/// off through another spelling was invisible: every gate that named |
| 111 | -/// `--enable-tx-size-search=0`, and the real-stream PANIC hiding behind that | 124 | +/// `--enable-tx-size-search` passed `--enable-tx-size-search=0` when this was |
| 112 | -/// pin was found by lane-ab16, not by this guard. `--loopfilter-control=0`, | 125 | +/// written, and the real-stream PANIC hiding behind that pin was found by |
| 126 | +/// lane-ab16, not by this guard. `--loopfilter-control=0`, | ||
| 113 | /// `--tile-columns=0` and a `--cpu-used` high enough to switch a search off are | 127 | /// `--tile-columns=0` and a `--cpu-used` high enough to switch a search off are |
| 114 | /// the same shape. | 128 | /// the same shape. |
| 115 | /// | 129 | /// |
| 130 | +/// The "all 49" count is GONE as of 2026-09-29 (lane-av1distwtd r2) and is | ||
| 131 | +/// deliberately not replaced by a number: the tool is no longer pinned off | ||
| 132 | +/// tree-wide, so any count would be a snapshot that rots the same way. | ||
| 133 | +/// Measured on this tree for the record: 113 of the 146 selected gate bodies | ||
| 134 | +/// name it, 88 pass `=0`, 15 pass `=1`, and 9 build the value into a | ||
| 135 | +/// `format!` variable the census cannot see -- so the historical claim no | ||
| 136 | +/// longer holds in EITHER direction, and the `enable-tx-size-search` entry | ||
| 137 | +/// below is a live question, not a settled one. | ||
| 138 | +/// | ||
| 116 | /// Each entry is `(tool, spellings, aomenc default, what counts as on)`. The | 139 | /// Each entry is `(tool, spellings, aomenc default, what counts as on)`. The |
| 117 | /// "defaulted means unknown" rule of [`NEVER_EXERCISED`] applies unchanged: a | 140 | /// "defaulted means unknown" rule of [`NEVER_EXERCISED`] applies unchanged: a |
| 118 | /// default of `1` does not prove the encoder picked the tool for any stream, so | 141 | /// default of `1` does not prove the encoder picked the tool for any stream, so |
| 119 | /// only a gate that spells an on-value at that bit depth retires an entry. | 142 | /// only a gate that spells an on-value at that bit depth retires an entry. |
| 143 | + // lane-av1distwtd r3: `enable-tx-size-search` is the one DEFAULT_ON_TOOLS | ||
| 144 | + // entry the r2 audit could NOT settle, and the reason is a THIRD detector | ||
| 145 | + // limit rather than a coverage fact. After the r3 call-resolving fix, 113 | ||
| 146 | + // of the 230 selected gates name it: 88 pass `=0`, 15 pass `=1`, and 9 | ||
| 147 | + // build the value into a `format!`/`String` variable that neither | ||
| 148 | + // `flags_in` nor `settings_in` can see, because both scan for a literal | ||
| 149 | + // `"--flag=value"` inside one segment. | ||
| 150 | + // | ||
| 151 | + // WHAT WOULD SETTLE IT, for whoever takes it next -- the method, not a | ||
| 152 | + // guess: extend `flags_in`/`settings_in` to resolve a local binding, the | ||
| 153 | + // same way `gate_bodies` now resolves calls. Concretely, when a segment | ||
| 154 | + // contains `let <name> = format!("--enable-tx-size-search={tx_search}")` | ||
| 155 | + // (or a `String::from`/`to_string` of the same shape), record the | ||
| 156 | + // TEMPLATE and bind the variable's value at each use site. Re-count, and | ||
| 157 | + // only then decide whether the tool is a live hole. Until that exists the | ||
| 158 | + // count above is a floor, not a measurement: 9 gates are unclassified in | ||
| 159 | + // an unknown direction, and an unknown direction is exactly the failure | ||
| 160 | + // mode this file exists to prevent. | ||
| 120 | #[cfg(test)] | 161 | #[cfg(test)] |
| 121 | const DEFAULT_ON_TOOLS: &[(&str, &[&str], &str, On)] = &[ | 162 | const DEFAULT_ON_TOOLS: &[(&str, &[&str], &str, On)] = &[ |
| 122 | ( | 163 | ( |
| @@ -168,9 +209,17 @@ const DEFAULT_ON_TOOLS: &[(&str, &[&str], &str, On)] = &[ | |||
| 168 | 209 | ||
| 169 | /// Non-`--enable-*` spellings that drive a [`TOOL_UNIVERSE`] tool. | 210 | /// Non-`--enable-*` spellings that drive a [`TOOL_UNIVERSE`] tool. |
| 170 | /// | 211 | /// |
| 171 | -/// `--superres-mode=1` is how all three superres gates switch superres on; | 212 | +/// `--superres-mode=1` is how every superres gate switches superres on; |
| 172 | /// without this map they read as an `enable-superres` hole while a real stream | 213 | /// without this map they read as an `enable-superres` hole while a real stream |
| 173 | -/// exercises the tool (lane-covbd deferred exactly this). | 214 | +/// exercises the tool (lane-covbd deferred exactly this). The count was "all |
| 215 | +/// three" until 2026-09-29 (lane-av1distwtd r2), which measured SIX gates | ||
| 216 | +/// spelling a nonzero `--superres-mode` (5 among the 146 census-selected | ||
| 217 | +/// bodies, plus `a_superres_census_over_six_real_streams_...`). No count is | ||
| 218 | +/// given here for the same reason as `enable-tx-size-search` above: it rots. | ||
| 219 | +/// Worth noting the alias is the ONLY positive evidence for superres, and | ||
| 220 | +/// those gates do assert arrival -- `superres_hits` / `predict_scaled_hits` | ||
| 221 | +/// are read in five of them -- so this one is a healthy alias, not a | ||
| 222 | +/// spelling-only one. | ||
| 174 | #[cfg(test)] | 223 | #[cfg(test)] |
| 175 | const ALIASES: &[(&str, &str)] = &[("superres-mode", "enable-superres")]; | 224 | const ALIASES: &[(&str, &str)] = &[("superres-mode", "enable-superres")]; |
| 176 | 225 | ||
| @@ -190,18 +239,52 @@ const NEVER_EXERCISED_8BIT: &[(&str, &str)] = &[ | |||
| 190 | // `enable-cfl-intra` LEFT both lists on 2026-09-02 (lane-reelckf r1): the | 239 | // `enable-cfl-intra` LEFT both lists on 2026-09-02 (lane-reelckf r1): the |
| 191 | // sb128 skipped-CfL / 1:4-chroma gate passes `--enable-cfl-intra=1` at 8 | 240 | // sb128 skipped-CfL / 1:4-chroma gate passes `--enable-cfl-intra=1` at 8 |
| 192 | // AND 10 bits and pixel-compares both arms. | 241 | // AND 10 bits and pixel-compares both arms. |
| 193 | - ( | 242 | + // `enable-dist-wtd-comp` LEFT this list on 2026-09-29 (lane-av1distwtd). |
| 194 | - "enable-dist-wtd-comp", | 243 | + // The entry's stated reason was WRONG: the distance-weighted compound |
| 195 | - "off in 11 gates, on in none: distance-weighted compound is unimplemented", | 244 | + // combine is not unimplemented -- `compound::dist_wtd_comp_weight_assign` |
| 196 | - ), | 245 | + // (lane-av1comp) and `mc::combine_compound`'s weighted path have been in |
| 197 | - ( | 246 | + // the tree for a long time. What was missing was a stream CARRYING the |
| 198 | - "enable-dual-filter", | 247 | + // tool, and `a_distance_weighted_compound_stream_decodes_pixel_exact` |
| 199 | - "never spelled by any gate, so defaulted = unknown; no stream is proven to carry per-direction interp filters", | 248 | + // (stream.rs) now supplies one: it spells `--enable-dist-wtd-comp=1` and |
| 200 | - ), | 249 | + // asserts the PARSED sequence header carries `enable_jnt_comp == true` |
| 201 | - ( | 250 | + // (and `false` from the same recipe with `=0`, so the bit is proven to |
| 202 | - "enable-flip-idtx", | 251 | + // move with the flag), that `dist_wtd_comp_hits() > 0` -- the |
| 203 | - "never spelled; the flip/identity transform types are unproven by a real stream", | 252 | + // `compound_idx == 0` arm, the only branch whose blend weights are not the |
| 204 | - ), | 253 | + // constant (8, 8) -- and pixel-compares every frame against the oracle. |
| 254 | + // The existing lane-cwarp compound-warp gates already SPELLED `=1` and | ||
| 255 | + // the census still read this entry as open, so the hole was a missing | ||
| 256 | + // witness, not a missing flag. | ||
| 257 | + // `enable-dual-filter` LEFT this list on 2026-09-29 (lane-av1distwtd r3), | ||
| 258 | + // paid by a DETECTOR fix rather than by a new gate. The r2 audit found | ||
| 259 | + // this entry's reason false on both halves. It is spelled -- as `=0`, by | ||
| 260 | + // `real_aomenc_1to4_streams_...` and | ||
| 261 | + // `a_real_aomenc_inter_sequence_with_32x32_level_1to4_strips_...` -- so | ||
| 262 | + // "never spelled" was wrong; and a stream IS proven to carry the tool, | ||
| 263 | + // because `a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact` | ||
| 264 | + // spells `--enable-dual-filter=1` and hard-asserts | ||
| 265 | + // `decode::dual_filter_diff_hits()` moved, the differing-direction arrival | ||
| 266 | + // assert (`resolve_interp_filter` in decode.rs). That gate builds its | ||
| 267 | + // stream through `inter_sb_none_gate`, so it spells none of the three | ||
| 268 | + // tokens `gate_bodies()` used to filter on and was INVISIBLE to the | ||
| 269 | + // census; r3 made `gate_bodies()` resolve calls as well as spellings, and | ||
| 270 | + // `the_detector_sees_the_gates_the_spelling_filter_missed` pins that. | ||
| 271 | + // Supporting measurement: with the flag left off the command line the | ||
| 272 | + // parsed sequence header already carries `enable_dual_filter = true` | ||
| 273 | + // (6855 B), while `--enable-dual-filter=0` parses false and encodes | ||
| 274 | + // different bytes (6874 B) -- so the gates pinning it `=0` were removing | ||
| 275 | + // the tool and the ones leaving it defaulted carry it. | ||
| 276 | + // | ||
| 277 | + // `enable-flip-idtx` LEFT this list the same day, also by detector fix. | ||
| 278 | + // `a_real_aomenc_stream_with_a_1d_tx_class_on_a_rect_transform_decodes_pixel_exact` | ||
| 279 | + // spells `=1` and hard-asserts `compared_class1 > 0` ("--enable-flip-idtx=1 | ||
| 280 | + // never produced a V_DCT/H_DCT transform on a compared attempt"). Its | ||
| 281 | + // recipe is parameterised on `ten_bit` and names BOTH fixture formats, so | ||
| 282 | + // `is_ten_bit` filed the whole body 10-bit-ONLY and the 8-bit bucket | ||
| 283 | + // never saw it -- the lane-defon/reelckf blind spot through a THIRD | ||
| 284 | + // spelling, which r3 taught `covers_both_depths` to recognise as the | ||
| 285 | + // pair-of-formats marker. Measured run of that gate: 12 pixel-exact | ||
| 286 | + // decodes, 6 of them 8-bit, 219 rect coefficient TUs of which 10 carry a | ||
| 287 | + // 1D tx class. | ||
| 205 | // `enable-global-motion` LEFT this list on 2026-09-25 (lane-av1gwarp12 r2): | 288 | // `enable-global-motion` LEFT this list on 2026-09-25 (lane-av1gwarp12 r2): |
| 206 | // `a_real_affine_global_motion_stream_decodes_pixel_exact` loops | 289 | // `a_real_affine_global_motion_stream_decodes_pixel_exact` loops |
| 207 | // `for depth in [8u32, 10u32]` passing `--enable-global-motion=1` and | 290 | // `for depth in [8u32, 10u32]` passing `--enable-global-motion=1` and |
| @@ -210,6 +293,23 @@ const NEVER_EXERCISED_8BIT: &[(&str, &str)] = &[ | |||
| 210 | // containing both the gate and this test until the ROTZOOM suite. | 293 | // containing both the gate and this test until the ROTZOOM suite. |
| 211 | // The 12-bit ROTZOOM gate rides the high-depth bucket via `encode_12bit(` | 294 | // The 12-bit ROTZOOM gate rides the high-depth bucket via `encode_12bit(` |
| 212 | // in `is_ten_bit`, so it plays no part in this retirement. | 295 | // in `is_ten_bit`, so it plays no part in this retirement. |
| 296 | + // `enable-rect-tx` -- reason RE-VERIFIED 2026-09-29 (lane-av1distwtd | ||
| 297 | + // r2), both halves still TRUE, and the second half is now PROVEN rather | ||
| 298 | + // than asserted. (1) "never spelled": measured across all 146 | ||
| 299 | + // census-selected gate bodies, zero spell `--enable-rect-tx` at either | ||
| 300 | + // depth -- the only `--enable-*` tool in [`TOOL_UNIVERSE`] with no | ||
| 301 | + // spelling anywhere. (2) "reach the decoder only through partition | ||
| 302 | + // shape": aom 3.13.3 has no sequence-header bit for it. `enable_rect_tx` | ||
| 303 | + // is an `AV1E_SET_ENABLE_RECT_TX` encoder-search control | ||
| 304 | + // (`av1_cx_iface.c:2125`, copied to `txfm_cfg->enable_rect_tx` at | ||
| 305 | + // `av1_cx_iface.c:1483`) and is read ONLY inside `tx_search.c` | ||
| 306 | + // (lines 2568/2662/2686/2710/2956); `bitstream.c` writes no such bit, and | ||
| 307 | + // this crate's `SequenceHeader` (`ec-av1-syntax/src/sequence.rs`) has no | ||
| 308 | + // such field. The decoder's own gate is `is_rect_tx_allowed`, derived | ||
| 309 | + // from partition shape -- exactly what this reason says. A gate can | ||
| 310 | + // therefore never prove this tool by naming the flag, only by proving a | ||
| 311 | + // rect transform unit fired (`rect_partition_hits` / | ||
| 312 | + // `rect_coeff_tu_hits`, which lane-rect1d's gate does assert). | ||
| 213 | ( | 313 | ( |
| 214 | "enable-rect-tx", | 314 | "enable-rect-tx", |
| 215 | "never spelled; rect transforms reach the decoder only through partition shape, never through a gate that names the tool", | 315 | "never spelled; rect transforms reach the decoder only through partition shape, never through a gate that names the tool", |
| @@ -225,10 +325,16 @@ const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[ | |||
| 225 | // `enable-rect-partitions` and `enable-restoration` at 10 bits. All five | 325 | // `enable-rect-partitions` and `enable-restoration` at 10 bits. All five |
| 226 | // deleted together. | 326 | // deleted together. |
| 227 | 327 | ||
| 228 | - // Only 4 of the 45 real-aomenc gates encode at 10 bits, and they pin the | 328 | + // The "Only 4 of the 45 real-aomenc gates encode at 10 bits" sentence that |
| 229 | - // pixel filters and the intra tool set off. Every entry the 8-bit list | 329 | + // stood here is STALE (lane-av1distwtd r2, 2026-09-29), and understated |
| 230 | - // carries is a hole here too. lane-hbdgates r1 closed six of the seven | 330 | + // the high-depth bucket by more than an order of magnitude. Measured |
| 231 | - // 8-bit-only entries with real 10-bit gates (filter-intra, smooth-intra, | 331 | + // against this tree with `gate_bodies()`' own filter: 146 selected gate |
| 332 | + // bodies, of which 83 are classified 10-bit-or-higher by `is_ten_bit`. | ||
| 333 | + // The historical point stands -- those gates pin the pixel filters and | ||
| 334 | + // the intra tool set off far more often than not -- but the counts a | ||
| 335 | + // reader would check them against no longer exist. | ||
| 336 | + // Every entry the 8-bit list carries is a hole here too. lane-hbdgates r1 | ||
| 337 | + // closed six of the seven 8-bit-only entries with real 10-bit gates | ||
| 232 | // paeth-intra, intra-edge-filter, rect-partitions, ab-partitions); its | 338 | // paeth-intra, intra-edge-filter, rect-partitions, ab-partitions); its |
| 233 | // seventh, the 10-bit LR gate, was `#[ignore]`d on that branch and passes | 339 | // seventh, the 10-bit LR gate, was `#[ignore]`d on that branch and passes |
| 234 | // un-ignored on main, which carries the fix. | 340 | // un-ignored on main, which carries the fix. |
| @@ -241,9 +347,33 @@ const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[ | |||
| 241 | // gate passes `=1` for both. `enable-1to4-partitions` left it on 2026-09-02: | 347 | // gate passes `=1` for both. `enable-1to4-partitions` left it on 2026-09-02: |
| 242 | // lane-tx64x16 r4's 32-level 1:4 gate has a 10-bit arm that asserts both | 348 | // lane-tx64x16 r4's 32-level 1:4 gate has a 10-bit arm that asserts both |
| 243 | // orientations and coded strips inside pixel-exact attempts. | 349 | // orientations and coded strips inside pixel-exact attempts. |
| 350 | + // `enable-dual-filter` -- reason CORRECTED 2026-09-29 (lane-av1distwtd | ||
| 351 | + // r3), and this entry STAYS while its 8-bit twin was retired. That is the | ||
| 352 | + // honest outcome, not an oversight: after the r3 detector fix the 8-bit | ||
| 353 | + // bucket sees the tool exercised and the 10-bit bucket still does not. | ||
| 354 | + // The only `=1` witness is | ||
| 355 | + // `a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact`, | ||
| 356 | + // and it calls `inter_sb_none_gate(NAME, false, ...)` -- `false` is the | ||
| 357 | + // `ten_bit` parameter, so that gate builds an 8-bit stream only. Its | ||
| 358 | + // sibling `a_real_aomenc_10bit_inter_sequence_with_a_whole_superblock_block_decodes_pixel_exact` | ||
| 359 | + // passes `true`, and the 8x8-leaf pair likewise, but none of those spells | ||
| 360 | + // `--enable-dual-filter=1`. So: exercised at 8 bits (arrival assert | ||
| 361 | + // `dual_filter_diff_hits()` moved, `resolve_interp_filter` in decode.rs), | ||
| 362 | + // NOT exercised at 10 bits. Retiring this entry needs a 10-bit arm of that | ||
| 363 | + // gate -- pass `true` to `inter_sb_none_gate` and assert the differing- | ||
| 364 | + // direction counter still moves there. | ||
| 365 | + // | ||
| 366 | + // The two numbers in the `enable-flip-idtx` retirement below were | ||
| 367 | + // RE-MEASURED 2026-09-29 (lane-av1distwtd r2) by running the gate, and | ||
| 368 | + // both still hold exactly: "pixel-compares six 10-bit decodes" (the run | ||
| 369 | + // reports 12 pixel-exact decodes, 6 of them 10-bit) and "10 of its rect | ||
| 370 | + // coefficient TUs carry a 1D tx class" (219 rect coefficient TUs on | ||
| 371 | + // compared attempts, 10 of them 1D). The gate also hard-asserts | ||
| 372 | + // `compared_class1 > 0`, so its "passes =1 at both depths" is backed by an | ||
| 373 | + // arrival assert, not just a spelling. | ||
| 244 | ( | 374 | ( |
| 245 | "enable-dual-filter", | 375 | "enable-dual-filter", |
| 246 | - "hole at both depths, see the 8-bit list", | 376 | + "exercised at 8 bits only, by a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact (=1, asserts dual_filter_diff_hits moved); no 10-bit gate spells =1 -- that gate calls inter_sb_none_gate with ten_bit=false. Retire by adding its 10-bit arm", |
| 247 | ), | 377 | ), |
| 248 | // `enable-flip-idtx` LEFT this list on 2026-09-02 (lane-rect1d r1): | 378 | // `enable-flip-idtx` LEFT this list on 2026-09-02 (lane-rect1d r1): |
| 249 | // `a_real_aomenc_stream_with_a_1d_tx_class_on_a_rect_transform_decodes_pixel_exact` | 379 | // `a_real_aomenc_stream_with_a_1d_tx_class_on_a_rect_transform_decodes_pixel_exact` |
| @@ -285,23 +415,119 @@ mod tests { | |||
| 285 | }; | 415 | }; |
| 286 | use std::collections::{BTreeMap, BTreeSet}; | 416 | use std::collections::{BTreeMap, BTreeSet}; |
| 287 | 417 | ||
| 288 | - /// Bodies of the real-aomenc gates: a `fn` body carrying the shared | 418 | + /// Whether `body` contains a call to the `fn` named `name`. |
| 289 | - /// `--passes=1` every one of them passes. Split on the attribute that | 419 | + /// |
| 290 | - /// opens a test. | 420 | + /// The name must not be the tail of a longer identifier, or |
| 421 | + /// `inter_sb_none_gate` would "call" `sb_none_gate`. | ||
| 422 | + fn calls_fn(body: &str, name: &str) -> bool { | ||
| 423 | + let ident = |b: u8| b.is_ascii_alphanumeric() || b == b'_'; | ||
| 424 | + let mut at = 0usize; | ||
| 425 | + while let Some(rel) = body[at..].find(name) { | ||
| 426 | + let start = at + rel; | ||
| 427 | + let end = start + name.len(); | ||
| 428 | + let starts_clean = start == 0 || !ident(body.as_bytes()[start - 1]); | ||
| 429 | + if starts_clean && body[end..].starts_with('(') { | ||
| 430 | + return true; | ||
| 431 | + } | ||
| 432 | + at = end; | ||
| 433 | + } | ||
| 434 | + false | ||
| 435 | + } | ||
| 436 | + | ||
| 437 | + /// Every `fn` defined in `stream.rs`'s test module, as `(name, body)`. | ||
| 438 | + /// | ||
| 439 | + /// The census reasons about whole `#[`-segments (see [`gate_bodies`]) but | ||
| 440 | + /// has to know which segment DEFINES or CALLS an encoder-driving `fn`, and | ||
| 441 | + /// the only way to answer that is to name the units. | ||
| 442 | + fn fn_units(src: &'static str) -> Vec<(&'static str, &'static str)> { | ||
| 443 | + const OPEN: &str = "\n fn "; | ||
| 444 | + let mut units = Vec::new(); | ||
| 445 | + let mut at = 0usize; | ||
| 446 | + while let Some(rel) = src[at..].find(OPEN) { | ||
| 447 | + let head = at + rel + OPEN.len(); | ||
| 448 | + let Some(paren) = src[head..].find('(') else { | ||
| 449 | + break; | ||
| 450 | + }; | ||
| 451 | + let close = src[head..] | ||
| 452 | + .find("\n }\n") | ||
| 453 | + .map_or(src.len(), |e| head + e); | ||
| 454 | + units.push((&src[head..head + paren], &src[head..close])); | ||
| 455 | + at = close.max(head + paren + 1); | ||
| 456 | + } | ||
| 457 | + units | ||
| 458 | + } | ||
| 459 | + | ||
| 460 | + /// Names of every `fn` in `stream.rs` that drives the real `aomenc`, | ||
| 461 | + /// DIRECTLY (it mentions `aomenc_path()`) or by DELEGATING to one. | ||
| 462 | + /// | ||
| 463 | + /// lane-av1distwtd r3: the transitive closure is the whole point. A gate | ||
| 464 | + /// that hands its recipe to a shared helper (`inter_sb_none_gate` and | ||
| 465 | + /// friends) never spells `--passes=1` itself, so the old token filter | ||
| 466 | + /// dropped it -- 165 of 311 segments, 6 of which spell `--enable-X=1`. | ||
| 467 | + /// That is not a coverage fact, it is a segmentation fact, and it is what | ||
| 468 | + /// kept `enable-dual-filter` on the never-exercised lists while a named | ||
| 469 | + /// gate exercised the tool and hard-asserted the arrival. | ||
| 470 | + fn encoder_fns(src: &'static str) -> BTreeSet<&'static str> { | ||
| 471 | + let units = fn_units(src); | ||
| 472 | + let mut enc: BTreeSet<&'static str> = units | ||
| 473 | + .iter() | ||
| 474 | + .filter(|(_, body)| body.contains("aomenc_path()")) | ||
| 475 | + .map(|(name, _)| *name) | ||
| 476 | + .collect(); | ||
| 477 | + // Fixpoint: `inter_sb_none_gate` is an encoder fn because it names | ||
| 478 | + // `aomenc_path()`; the `#[test]` that only CALLS it is a gate too. | ||
| 479 | + loop { | ||
| 480 | + let mut grew = false; | ||
| 481 | + for (name, body) in &units { | ||
| 482 | + if enc.contains(name) { | ||
| 483 | + continue; | ||
| 484 | + } | ||
| 485 | + if enc.iter().any(|e| calls_fn(body, e)) { | ||
| 486 | + enc.insert(name); | ||
| 487 | + grew = true; | ||
| 488 | + } | ||
| 489 | + } | ||
| 490 | + if !grew { | ||
| 491 | + return enc; | ||
| 492 | + } | ||
| 493 | + } | ||
| 494 | + } | ||
| 495 | + | ||
| 496 | + /// The token spellings the filter used before it resolved calls. Kept as a | ||
| 497 | + /// floor: a gate is still recognised by these even if the call graph | ||
| 498 | + /// misses it, so the fix can only ever ADD gates, never lose one. | ||
| 499 | + fn legacy_gate_tokens(body: &str) -> bool { | ||
| 500 | + body.contains("\"--passes=1\"") | ||
| 501 | + || body.contains("ten_bit_tool_gate(") | ||
| 502 | + || body.contains("encode_10bit_gradients") | ||
| 503 | + } | ||
| 504 | + | ||
| 505 | + /// Bodies of the real-aomenc gates: a `fn` body that drives the real | ||
| 506 | + /// `aomenc`, however it gets there. Split on the attribute that opens a | ||
| 507 | + /// test. | ||
| 508 | + /// | ||
| 509 | + /// lane-av1distwtd r3: a segment qualifies if it spells one of the | ||
| 510 | + /// [`legacy_gate_tokens`] OR names an encoder `fn` -- either by defining | ||
| 511 | + /// one (it mentions `aomenc_path()`) or by calling one. Recognition by | ||
| 512 | + /// CALL is what a helper-delegating gate needs: its flags live in the | ||
| 513 | + /// helper it calls, and it is invisible to a spelling-only filter. | ||
| 291 | fn gate_bodies() -> Vec<&'static str> { | 514 | fn gate_bodies() -> Vec<&'static str> { |
| 292 | let src = include_str!("stream.rs"); | 515 | let src = include_str!("stream.rs"); |
| 516 | + let enc = encoder_fns(src); | ||
| 293 | let gates: Vec<&str> = src | 517 | let gates: Vec<&str> = src |
| 294 | .split("\n #[") | 518 | .split("\n #[") |
| 295 | // lane-hbdgates r1: an `#[ignore]`d gate exercises nothing, so it | 519 | // lane-hbdgates r1: an `#[ignore]`d gate exercises nothing, so it |
| 296 | // must not close a hole. Its body is the segment that opens with | 520 | // must not close a hole. Its body is the segment that opens with |
| 297 | // the ignore attribute. | 521 | // the ignore attribute. |
| 298 | .filter(|body| !body.starts_with("ignore")) | 522 | .filter(|body| !body.starts_with("ignore")) |
| 299 | - // lane-hbdgates r1: gates that build their stream through the | 523 | + // lane-av1distwtd r3: a segment qualifies by what it SPELLS |
| 300 | - // shared 10-bit helpers spell `--passes=1` there, not inline. | 524 | + // (`legacy_gate_tokens`) or by what it CALLS. `calls_fn` is |
| 525 | + // deliberately the weak half of an OR, so the fix can only add | ||
| 526 | + // gates -- it can never stop recognising one the old filter did. | ||
| 301 | .filter(|body| { | 527 | .filter(|body| { |
| 302 | - body.contains("\"--passes=1\"") | 528 | + legacy_gate_tokens(body) |
| 303 | - || body.contains("ten_bit_tool_gate(") | 529 | + || body.contains("aomenc_path()") |
| 304 | - || body.contains("encode_10bit_gradients") | 530 | + || enc.iter().any(|e| calls_fn(body, e)) |
| 305 | }) | 531 | }) |
| 306 | .collect(); | 532 | .collect(); |
| 307 | assert!( | 533 | assert!( |
| @@ -466,10 +692,94 @@ mod tests { | |||
| 466 | /// this marker that gate's own 8-bit-only flags read as 10-bit-only -- the | 692 | /// this marker that gate's own 8-bit-only flags read as 10-bit-only -- the |
| 467 | /// lane-defon/reelckf blind spot with `depth` spelled instead of | 693 | /// lane-defon/reelckf blind spot with `depth` spelled instead of |
| 468 | /// `bit_depth`. Three gates share the helper, at both depths. | 694 | /// `bit_depth`. Three gates share the helper, at both depths. |
| 695 | + /// lane-av1distwtd r3: the THIRD spelling of the same blind spot, still | ||
| 696 | + /// live after lane-defon and lane-reelckf. A recipe parameterised on | ||
| 697 | + /// `ten_bit` names BOTH fixture formats in one body -- `let pix_fmt = if | ||
| 698 | + /// ten_bit { "yuv420p10le" } else { "yuv420p" };` -- so `is_ten_bit` saw | ||
| 699 | + /// the 10-bit arm and filed the whole body 10-bit-ONLY, hiding its 8-bit | ||
| 700 | + /// arm from the 8-bit bucket. The marker is the PAIR OF FORMATS, not the | ||
| 701 | + /// parameter name: a body spelling both pixel formats builds streams at | ||
| 702 | + /// both depths, whatever it calls the flag. The quotes matter -- a bare | ||
| 703 | + /// `yuv420p` substring test also matches `yuv420p10le` and would fire on | ||
| 704 | + /// every 10-bit gate, retiring entries on no evidence. | ||
| 705 | + /// | ||
| 706 | + /// This is what mis-filed `a_real_aomenc_stream_with_a_1d_tx_class_on_a_rect_transform_decodes_pixel_exact` | ||
| 707 | + /// and kept `enable-flip-idtx` on the 8-bit list while that gate ran 6 | ||
| 708 | + /// pixel-exact 8-bit decodes through it. | ||
| 469 | fn covers_both_depths(body: &str) -> bool { | 709 | fn covers_both_depths(body: &str) -> bool { |
| 470 | body.contains("if bit_depth == 10") | 710 | body.contains("if bit_depth == 10") |
| 471 | || body.contains("if depth == 10") | 711 | || body.contains("if depth == 10") |
| 472 | || body.contains("for depth in [8usize, 10]") | 712 | || body.contains("for depth in [8usize, 10]") |
| 713 | + || (body.contains("\"yuv420p\"") && body.contains("\"yuv420p10le\"")) | ||
| 714 | + } | ||
| 715 | + | ||
| 716 | + /// lane-av1distwtd r3: the detector fix, pinned. A detector change with | ||
| 717 | + /// no test can only be shown to find MORE, never to stop missing, so this | ||
| 718 | + /// asserts the three gates the two blind spots actually hid are now seen | ||
| 719 | + /// -- the two `enable-dual-filter` witnesses and the `enable-flip-idtx` | ||
| 720 | + /// both-depths gate -- and that the fix is strictly ADDITIVE against the | ||
| 721 | + /// old spelling-only filter. | ||
| 722 | + #[test] | ||
| 723 | + fn the_detector_sees_the_gates_the_spelling_filter_missed() { | ||
| 724 | + let src = include_str!("stream.rs"); | ||
| 725 | + let gates = gate_bodies(); | ||
| 726 | + // The helper-delegation half: each of these builds its stream through | ||
| 727 | + // `inter_sb_none_gate` and spells none of `legacy_gate_tokens`, so the | ||
| 728 | + // old filter dropped both while each hard-asserts its tool arrived. | ||
| 729 | + for name in [ | ||
| 730 | + "a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact", | ||
| 731 | + "a_real_obmc_stream_reads_a_recorded_switchable_filter_for_every_neighbour", | ||
| 732 | + ] { | ||
| 733 | + let body = gates | ||
| 734 | + .iter() | ||
| 735 | + .find(|b| b.contains(name)) | ||
| 736 | + .unwrap_or_else(|| panic!("{name}: not seen by gate_bodies()")); | ||
| 737 | + assert_eq!( | ||
| 738 | + flags_in(body).get("enable-dual-filter"), | ||
| 739 | + Some(&'1'), | ||
| 740 | + "{name}: seen, but its --enable-dual-filter=1 spelling is not visible to \ | ||
| 741 | + flags_in, so recognising the gate would not retire the entry" | ||
| 742 | + ); | ||
| 743 | + } | ||
| 744 | + // The both-depths half: this gate's recipe is parameterised on `ten_bit` | ||
| 745 | + // and names both fixture formats, so `covers_both_depths` must credit | ||
| 746 | + // it to the 8-bit bucket, not just the 10-bit one. | ||
| 747 | + let flip = gates | ||
| 748 | + .iter() | ||
| 749 | + .find(|b| { | ||
| 750 | + b.contains("a_real_aomenc_stream_with_a_1d_tx_class_on_a_rect_transform") | ||
| 751 | + }) | ||
| 752 | + .expect("the flip-idtx gate must be seen"); | ||
| 753 | + assert!( | ||
| 754 | + covers_both_depths(flip), | ||
| 755 | + "the flip-idtx gate spells both fixture formats, so covers_both_depths must \ | ||
| 756 | + credit it to the 8-bit bucket as well" | ||
| 757 | + ); | ||
| 758 | + assert!( | ||
| 759 | + covers_depth(flip, false) && covers_depth(flip, true), | ||
| 760 | + "the flip-idtx gate must cover BOTH depths" | ||
| 761 | + ); | ||
| 762 | + // Strictly additive: every segment the old spelling-only filter kept | ||
| 763 | + // is still kept, so the fix cannot have cost the census a gate. | ||
| 764 | + let legacy_only: Vec<&str> = src | ||
| 765 | + .split("\n #[") | ||
| 766 | + .filter(|b| !b.starts_with("ignore") && legacy_gate_tokens(b)) | ||
| 767 | + .collect(); | ||
| 768 | + assert!( | ||
| 769 | + legacy_only.len() < gates.len(), | ||
| 770 | + "the call-resolving filter found {} gates, the old spelling-only filter found \ | ||
| 771 | + {} -- the fix is expected to ADD gates, never to drop one", | ||
| 772 | + gates.len(), | ||
| 773 | + legacy_only.len() | ||
| 774 | + ); | ||
| 775 | + for body in &legacy_only { | ||
| 776 | + assert!( | ||
| 777 | + gates.contains(body), | ||
| 778 | + "a gate the spelling-only filter recognised is no longer recognised: \ | ||
| 779 | + {:?}", | ||
| 780 | + &body[..body.len().min(60)] | ||
| 781 | + ); | ||
| 782 | + } | ||
| 473 | } | 783 | } |
| 474 | 784 | ||
| 475 | /// Whether a gate body drives a stream at this depth. | 785 | /// Whether a gate body drives a stream at this depth. |
crates/ec-av1/src/stream.rsmodified+226 -0
| @@ -45604,4 +45604,230 @@ pub(crate) mod tests { | |||
| 45604 | ); | 45604 | ); |
| 45605 | } | 45605 | } |
| 45606 | } | 45606 | } |
| 45607 | + | ||
| 45608 | + /// lane-av1distwtd: the gate that pays the `enable-dist-wtd-comp` entry in | ||
| 45609 | + /// `gate_coverage.rs`'s [`NEVER_EXERCISED_8BIT`], and corrects its stated | ||
| 45610 | + /// reason. The entry said "distance-weighted compound is unimplemented" -- | ||
| 45611 | + /// it is NOT: [`crate::compound::dist_wtd_comp_weight_assign`] (lane-av1comp) | ||
| 45612 | + /// and `mc::combine_compound`'s weighted path have been in the tree since. | ||
| 45613 | + /// What was missing is a stream that CARRIES the tool. Proved producible | ||
| 45614 | + /// against aom 3.13.3: the flag maps onto the sequence header's | ||
| 45615 | + /// `enable_jnt_comp` bit (`av1_cx_iface.c:1062` -> | ||
| 45616 | + /// `order_hint_info.enable_dist_wtd_comp` -> `bitstream.c:2681` writes it | ||
| 45617 | + /// under `enable_order_hint`), and this recipe's parsed header prints | ||
| 45618 | + /// `jnt_comp=true` with `=1` and `jnt_comp=false` with `=0` -- the parsed | ||
| 45619 | + /// value is asserted, never the flag spelling, per the class | ||
| 45620 | + /// `knob-never-reached-the-tool` trap that mislabelled a cell once already. | ||
| 45621 | + /// | ||
| 45622 | + /// Three hard asserts, all load-bearing: | ||
| 45623 | + /// 1. the PARSED sequence header carries `enable_jnt_comp == true` (the | ||
| 45624 | + /// off-arm asserts `false` from the same recipe, so the bit is proven to | ||
| 45625 | + /// MOVE with the flag rather than to be set by something else); | ||
| 45626 | + /// 2. `dist_wtd_comp_hits() > 0` -- the `compound_idx == 0` arm, the only | ||
| 45627 | + /// branch whose blend weights are not the constant (8, 8). A stream | ||
| 45628 | + /// carrying the header bit while coding every compound block with | ||
| 45629 | + /// `compound_idx == 1` leaves this at 0 and decodes byte-identically | ||
| 45630 | + /// without the whole distance-weight path, so the counter -- not the | ||
| 45631 | + /// header bit -- is what makes this a witness of the TOOL; | ||
| 45632 | + /// 3. every frame pixel-compared against the oracle through | ||
| 45633 | + /// [`decode_all_frames_vs_oracle`], which length-asserts each | ||
| 45634 | + /// decode-order frame before zipping. | ||
| 45635 | + /// | ||
| 45636 | + /// `--min-partition-size=32` is what makes the arm fire: at 16 the encoder | ||
| 45637 | + /// emits 8x8 inter leaves this decoder refuses BY NAME, so a smaller | ||
| 45638 | + /// min-partition refuses before the `compound_idx` read ever runs (measured: | ||
| 45639 | + /// the `min=16` arm of the same recipe refuses with "an inter partition | ||
| 45640 | + /// below 16x16" and dumps zero `compound_idx` lines). `--cq-level=30` is | ||
| 45641 | + /// likewise load-bearing: at cq 45/55 the same arm encodes a single-ref | ||
| 45642 | + /// stream (zero `compound_idx` reads) and the counter assert would be | ||
| 45643 | + /// vacuous. | ||
| 45644 | + #[test] | ||
| 45645 | + fn a_distance_weighted_compound_stream_decodes_pixel_exact() { | ||
| 45646 | + const NAME: &str = "distwtd-comp"; | ||
| 45647 | + let _gate_lock = lock_gate_counters(); | ||
| 45648 | + if !have_aomenc() { | ||
| 45649 | + return; | ||
| 45650 | + } | ||
| 45651 | + assert!(have_ffmpeg(), "{NAME}: ffmpeg required"); | ||
| 45652 | + assert!( | ||
| 45653 | + aomdec_path().is_file(), | ||
| 45654 | + "{NAME}: aomenc resolved to {} but no aomdec sits beside it -- a \ | ||
| 45655 | + pixel-exactness gate that compares nothing is worse than no gate", | ||
| 45656 | + aomenc_path().display() | ||
| 45657 | + ); | ||
| 45658 | + let (width, height, frame_count) = (64usize, 64usize, 24usize); | ||
| 45659 | + // mandelbrot + a slow rotation: two genuinely different references at | ||
| 45660 | + // different temporal distances, which is what `dist_wtd_comp_weight_ | ||
| 45661 | + // assign` weights BY. A static or flat source has equal distances | ||
| 45662 | + // everywhere and every block collapses onto one weight row. | ||
| 45663 | + let y4m = Command::new("ffmpeg") | ||
| 45664 | + .args([ | ||
| 45665 | + "-v", | ||
| 45666 | + "error", | ||
| 45667 | + "-f", | ||
| 45668 | + "lavfi", | ||
| 45669 | + "-i", | ||
| 45670 | + "mandelbrot=size=128x128:rate=25:start_x=-0.6:start_y=-0.4,\ | ||
| 45671 | + rotate=a=0.01*n:ow=128:oh=128:c=black,scale=64:64", | ||
| 45672 | + "-t", | ||
| 45673 | + "0.96", | ||
| 45674 | + "-pix_fmt", | ||
| 45675 | + "yuv420p", | ||
| 45676 | + "-strict", | ||
| 45677 | + "-1", | ||
| 45678 | + "-f", | ||
| 45679 | + "yuv4mpegpipe", | ||
| 45680 | + "-", | ||
| 45681 | + ]) | ||
| 45682 | + .stdin(Stdio::null()) | ||
| 45683 | + .stdout(Stdio::piped()) | ||
| 45684 | + .stderr(Stdio::piped()) | ||
| 45685 | + .output() | ||
| 45686 | + .expect("ffmpeg failed to run"); | ||
| 45687 | + assert!( | ||
| 45688 | + y4m.status.success(), | ||
| 45689 | + "{NAME}: ffmpeg fixture: {}", | ||
| 45690 | + String::from_utf8_lossy(&y4m.stderr) | ||
| 45691 | + ); | ||
| 45692 | + // the shared recipe; the flag under test is appended per arm so the | ||
| 45693 | + // two arms differ in exactly one argument. | ||
| 45694 | + let recipe: Vec<&str> = vec![ | ||
| 45695 | + "--codec=av1", | ||
| 45696 | + "--passes=1", | ||
| 45697 | + "--end-usage=q", | ||
| 45698 | + "--cq-level=30", | ||
| 45699 | + "--cpu-used=0", | ||
| 45700 | + "--kf-max-dist=1000", | ||
| 45701 | + "--threads=1", | ||
| 45702 | + "--row-mt=0", | ||
| 45703 | + "--auto-alt-ref=1", | ||
| 45704 | + "--lag-in-frames=25", | ||
| 45705 | + "--enable-fwd-kf=0", | ||
| 45706 | + // `enable_jnt_comp` is only READ when order hints are on | ||
| 45707 | + // (`av1_cx_iface.c:1491` ANDs the two). | ||
| 45708 | + "--enable-order-hint=1", | ||
| 45709 | + "--enable-warped-motion=1", | ||
| 45710 | + "--tune-content=default", | ||
| 45711 | + "--min-partition-size=32", | ||
| 45712 | + "--max-partition-size=64", | ||
| 45713 | + // partition/intra tools this decoder does not code -- the same | ||
| 45714 | + // exclusion list every compound gate in this file carries. | ||
| 45715 | + "--enable-rect-partitions=0", | ||
| 45716 | + "--enable-ab-partitions=0", | ||
| 45717 | + "--enable-1to4-partitions=0", | ||
| 45718 | + "--enable-filter-intra=0", | ||
| 45719 | + "--enable-smooth-intra=0", | ||
| 45720 | + "--enable-paeth-intra=0", | ||
| 45721 | + "--enable-directional-intra=0", | ||
| 45722 | + "--enable-angle-delta=0", | ||
| 45723 | + "--enable-tx-size-search=0", | ||
| 45724 | + "--enable-cdef=0", | ||
| 45725 | + "--enable-restoration=0", | ||
| 45726 | + "--enable-palette=0", | ||
| 45727 | + "--enable-intrabc=0", | ||
| 45728 | + "--enable-cfl-intra=0", | ||
| 45729 | + "--enable-ref-frame-mvs=0", | ||
| 45730 | + ]; | ||
| 45731 | + let encode = |flag: &str| -> Vec<u8> { | ||
| 45732 | + let out = run_with_stdin( | ||
| 45733 | + Command::new(aomenc_path()).args( | ||
| 45734 | + recipe | ||
| 45735 | + .iter() | ||
| 45736 | + .copied() | ||
| 45737 | + .chain([flag, "--obu", "-o", "-", "-"]), | ||
| 45738 | + ), | ||
| 45739 | + &y4m.stdout, | ||
| 45740 | + ); | ||
| 45741 | + assert!( | ||
| 45742 | + out.status.success(), | ||
| 45743 | + "{NAME}: aomenc refused the fixture with {flag}: {}", | ||
| 45744 | + String::from_utf8_lossy(&out.stderr) | ||
| 45745 | + ); | ||
| 45746 | + out.stdout | ||
| 45747 | + }; | ||
| 45748 | + // The PARSED header, read back off the encoded bytes -- never the | ||
| 45749 | + // command line. `Av1Parser` walks the real OBUs, so a flag the encoder | ||
| 45750 | + // ignored is caught here rather than inherited into coverage. | ||
| 45751 | + let parsed_jnt_comp = |stream: &[u8]| -> bool { | ||
| 45752 | + let mut parser = Av1Parser::new(); | ||
| 45753 | + let mut pos = 0usize; | ||
| 45754 | + while pos < stream.len() { | ||
| 45755 | + let obu = parser.parse_obu(&stream[pos..]).expect("parsing our own OBUs"); | ||
| 45756 | + pos += obu.total_size; | ||
| 45757 | + } | ||
| 45758 | + parser | ||
| 45759 | + .sequence_header() | ||
| 45760 | + .expect("the stream carries a sequence header") | ||
| 45761 | + .enable_jnt_comp | ||
| 45762 | + }; | ||
| 45763 | + // NB: the OFF arm is spelled FIRST on purpose. `gate_coverage.rs`'s | ||
| 45764 | + // `flags_in` keeps the LAST `--enable-<tool>=<value>` it finds in a gate | ||
| 45765 | + // body, so a trailing `=0` would make the whole gate read as "tool | ||
| 45766 | + // disabled" to the census and leave the entry unretired even though | ||
| 45767 | + // this gate does exercise the tool. Both arms are still asserted below. | ||
| 45768 | + let off = encode("--enable-dist-wtd-comp=0"); | ||
| 45769 | + let on = encode("--enable-dist-wtd-comp=1"); | ||
| 45770 | + // the bit MOVES with the flag, and it moves the BYTES: a flag the | ||
| 45771 | + // encoder accepted but ignored would fail both of these. | ||
| 45772 | + assert!( | ||
| 45773 | + parsed_jnt_comp(&on), | ||
| 45774 | + "{NAME}: the recipe spelled --enable-dist-wtd-comp=1 but the PARSED \ | ||
| 45775 | + sequence header carries enable_jnt_comp == false (class \ | ||
| 45776 | + knob-never-reached-the-tool) -- the gate would be vacuous" | ||
| 45777 | + ); | ||
| 45778 | + assert!( | ||
| 45779 | + !parsed_jnt_comp(&off), | ||
| 45780 | + "{NAME}: the same recipe with --enable-dist-wtd-comp=0 still parses \ | ||
| 45781 | + enable_jnt_comp == true, so the ON arm proves nothing about the flag" | ||
| 45782 | + ); | ||
| 45783 | + assert_ne!( | ||
| 45784 | + on.len(), | ||
| 45785 | + off.len(), | ||
| 45786 | + "{NAME}: both arms encoded {} bytes -- the flag changed nothing on \ | ||
| 45787 | + the wire, so neither arm is evidence for anything", | ||
| 45788 | + on.len() | ||
| 45789 | + ); | ||
| 45790 | + // shape non-vacuity, before any compare: at 4:2:0 a decoder keeping a | ||
| 45791 | + // subsampled extent would hand quarter-size planes to the byte compare. | ||
| 45792 | + let frames = decode_stream(&on).unwrap_or_else(|e| panic!("{NAME}: refused: {e}")); | ||
| 45793 | + assert_eq!( | ||
| 45794 | + frames.len(), | ||
| 45795 | + frame_count, | ||
| 45796 | + "{NAME}: expected {frame_count} shown frames" | ||
| 45797 | + ); | ||
| 45798 | + for (i, f) in frames.iter().enumerate() { | ||
| 45799 | + assert_eq!( | ||
| 45800 | + (f.width, f.height), | ||
| 45801 | + (width, height), | ||
| 45802 | + "{NAME}: frame {i} is {}x{}", | ||
| 45803 | + f.width, | ||
| 45804 | + f.height | ||
| 45805 | + ); | ||
| 45806 | + assert_eq!( | ||
| 45807 | + f.u.len(), | ||
| 45808 | + width * height / 4, | ||
| 45809 | + "{NAME}: frame {i} U plane is {} samples, not 4:2:0", | ||
| 45810 | + f.u.len() | ||
| 45811 | + ); | ||
| 45812 | + assert_eq!(f.v.len(), f.u.len(), "{NAME}: frame {i} V plane extent"); | ||
| 45813 | + assert_eq!(f.y.len(), width * height, "{NAME}: frame {i} luma extent"); | ||
| 45814 | + } | ||
| 45815 | + crate::decode::reset_dist_wtd_comp_hits(); | ||
| 45816 | + let hits_before = crate::decode::dist_wtd_comp_hits(); | ||
| 45817 | + let (oracle_frames, hidden) = decode_all_frames_vs_oracle(&on, NAME); | ||
| 45818 | + let dist_wtd = crate::decode::dist_wtd_comp_hits() - hits_before; | ||
| 45819 | + eprintln!( | ||
| 45820 | + "{NAME}: {oracle_frames} oracle frames ({hidden} hidden), \ | ||
| 45821 | + dist_wtd_comp_hits={dist_wtd}, on={} B off={} B", | ||
| 45822 | + on.len(), | ||
| 45823 | + off.len() | ||
| 45824 | + ); | ||
| 45825 | + assert!( | ||
| 45826 | + dist_wtd > 0, | ||
| 45827 | + "{NAME}: no block took the distance-weighted compound combine \ | ||
| 45828 | + (compound_idx == 0) across {oracle_frames} frames that carry \ | ||
| 45829 | + enable_jnt_comp = true -- every compound block used the simple \ | ||
| 45830 | + average, so this gate proves nothing about the tool" | ||
| 45831 | + ); | ||
| 45832 | + } | ||
| 45607 | } | 45833 | } |
lanes/av1distwtd.report.mdadded+229 -0
| @@ -0,0 +1,229 @@ | |||
| 1 | +# lane-av1distwtd | ||
| 2 | + | ||
| 3 | +Two rounds on one branch (`lane-av1distwtd`, base `a21f3680`). | ||
| 4 | + | ||
| 5 | +- **r1** — close the `enable-dist-wtd-comp` coverage hole. | ||
| 6 | +- **r2** — audit every CLAIM in `gate_coverage.rs` against the code and correct | ||
| 7 | + the false ones (appended below). | ||
| 8 | + | ||
| 9 | +--- | ||
| 10 | + | ||
| 11 | +## r1: `enable-dist-wtd-comp` | ||
| 12 | + | ||
| 13 | +`PRODUCIBLE`. The census entry's stated reason — "distance-weighted compound is | ||
| 14 | +unimplemented" — was **false**: `compound::dist_wtd_comp_weight_assign` | ||
| 15 | +(lane-av1comp) and `mc::combine_compound`'s weighted path have implemented it for | ||
| 16 | +a long time. What was missing was a stream *carrying* the tool, so no gate ever | ||
| 17 | +proved it fired. | ||
| 18 | + | ||
| 19 | +Closed with a witness gate `a_distance_weighted_compound_stream_decodes_pixel_exact` | ||
| 20 | +(25 oracle frames, 21 distance-weighted blocks, pixel-exact) plus the | ||
| 21 | +`gate_coverage.rs` entry deletion, commit `9cca1096`. See that commit message for | ||
| 22 | +the full red-before evidence. | ||
| 23 | + | ||
| 24 | +**12-bit / single-ref:** unaffected. 12-bit reaches the same arm independently | ||
| 25 | +(15 blocks measured); single-ref never reads `compound_idx` at all. | ||
| 26 | + | ||
| 27 | +--- | ||
| 28 | + | ||
| 29 | +# r2 appendix: gate_coverage.rs claim audit | ||
| 30 | + | ||
| 31 | +Every claim checked against the code, not against prose. Method per claim: | ||
| 32 | +find the deciding symbol and follow the call path from the feature-flag parse to | ||
| 33 | +the reconstruction site; for encoder claims, read `~/.cache/aom-oracle/src` | ||
| 34 | +(aom 3.13.3, `CONFIG_REALTIME_ONLY 0`) rather than `--help`; where a stream was | ||
| 35 | +needed, encode one and read the **parsed** header, never the flag. | ||
| 36 | + | ||
| 37 | +## Evidence table | ||
| 38 | + | ||
| 39 | +| # | entry / claim (file:line) | stated reason | verdict | deciding code | what it should say | | ||
| 40 | +|---|---|---|---|---|---| | ||
| 41 | +| 1 | `enable-dist-wtd-comp` 8-bit (retired r1, commit `9cca1096`) | "unimplemented" | **FALSE** (r1) | `compound.rs:36 dist_wtd_comp_weight_assign`; `mc.rs:2075 combine_compound` | retired; combine long implemented, witness gate added | | ||
| 42 | +| 2 | `enable-dist-wtd-comp` encoder default (`:5`) | "off in 11 gates" implies encoder default off | **FALSE** | `av1_cx_iface.c` `default_extra_cfg` = 1; `bitstream.c:2681` writes it | default is ON; the 11 gates pinned it `=0` themselves | | ||
| 43 | +| 3 | `enable-dual-filter` 8-bit (`:270`) | "never spelled by any gate … no stream proven to carry per-direction interp filters" | **FALSE** | gate `a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact` spells `=1` and asserts `dual_filter_diff_hits()` (`decode.rs:35135`); default parses `dual_filter=true` | EXERCISED; census can't see it (helper-delegation filter) | | ||
| 44 | +| 4 | `enable-dual-filter` 10-bit (`:374`) | "hole at both depths" | **FALSE** | same gate as #3 | same as #3, both depths | | ||
| 45 | +| 5 | `enable-flip-idtx` 8-bit (`:291`) | "never spelled" | **FALSE** | gate `a_real_aomenc_stream_with_a_1d_tx_class_on_a_rect_transform_decodes_pixel_exact` spells `=1`, asserts `tx_class1_hits` | EXERCISED at 8 bits (6 of 12 measured decodes are 8-bit) | | ||
| 46 | +| 6 | `enable-flip-idtx` 10-bit numbers (`:366`) | "six 10-bit decodes", "10 rect TUs 1D" | **TRUE** (re-measured) | ran the gate: 12 decodes, 6 ten-bit, 219 rect TUs, 10 of them 1D | keep (now backed by an arrival assert) | | ||
| 47 | +| 7 | `enable-rect-tx` 8-bit (`:320`) | "never spelled; reached only via partition shape" | **TRUE** | 0 gates spell it; aom has no header bit — `av1_cx_iface.c:2125/1483` is search-only, read only in `tx_search.c`; decoder gate is `is_rect_tx_allowed` | keep; now proven, not asserted | | ||
| 48 | +| 8 | `enable-rect-tx` 10-bit (`:395`) | "hole at both depths" | **TRUE** | same | keep | | ||
| 49 | +| 9 | `enable-cfl-intra` 8-bit comment (`:190`) | "gate passes `=1` at 8 AND 10 bits, pixel-compares both arms" | **TRUE** | gate `a_real_aomenc_sb128_stream_whose_skipped_cfl_and_1to4_chroma_pairs_...` loops `for depth in [8usize, 10]`, spells `=1`, asserts `dir_pairs > 0` | keep | | ||
| 50 | +| 10 | same gate, name says "skipped_cfl" | — | **NOTE** | that gate asserts directional 1:4 pairs, **not** skipped-CfL; skipped-CfL evidence is a *different* gate (`a_real_film_key_frame_with_a_skipped_cfl_block_...`) | name overstates; comment doesn't repeat the error | | ||
| 51 | +| 11 | `enable-intrabc` 10-bit comment (`:~336`) | "hard-asserts a decoded intrabc block per depth" | **TRUE** | `an_sb128_screen_stream_with_intrabc_...` asserts `blocks_total > 0 && fired_arms > 0` | keep | | ||
| 52 | +| 12 | `enable-intrabc` NEVER_EXERCISED header (`:45`) | "counter asserted > 0" | **TRUE** | `a_real_aomenc_screen_key_frame_reads_use_intrabc_on_rect_strips` asserts `blocks_total > 0 && fired_arms > 0` | keep | | ||
| 53 | +| 13 | `enable-restoration` 10-bit comment (`:311`) | "asserts a real Wiener/SGR unit fired" | **TRUE** | `a_real_aomenc_10bit_restoration_stream_...` asserts `lr_stripe0_hits`/`lr_last_stripe_hits` | keep | | ||
| 54 | +| 14 | `enable-1to4-partitions` 10-bit comment (`:317`) | "10-bit arm asserts both orientations and coded strips" | **TRUE** | `a_real_aomenc_10bit_..._1to4...` gates assert `rect4_coeff_hits`/orientation counters | keep | | ||
| 55 | +| 15 | `enable-global-motion` 8-bit comment (`:264`) | "loops `for depth in [8u32, 10u32]`" | **TRUE** | `a_real_affine_global_motion_stream_decodes_pixel_exact`; `covers_both_depths` recognises that exact spelling | keep | | ||
| 56 | +| 16 | `DEFAULT_ON_TOOLS` doc (`:123`) | "all 49 gates that name it pass `--enable-tx-size-search=0`" | **STALE** | 113 of 146 name it: 88 `=0`, 15 `=1`, 9 via `format!` | claim no longer holds either way; count removed, not replaced | | ||
| 57 | +| 17 | module doc (`:5`) | "a flag off the line takes aomenc's default (on …)" | **TRUE but misleading** | default is 1, but palette/intrabc are content-gated (`encoder.c:2079`) and `speed_features.c` re-masks per cpu-used | reworded: default = *allowed*, not *arrived* | | ||
| 58 | +| 18 | module doc TILING (`:25`) | "13 gates … assert the parsed `tile_info`" | **STALE** | 19 gates spell nonzero tile log2; 9 assert in-body, 10 delegate to a helper that asserts | reworded to the measured split | | ||
| 59 | +| 19 | `ALIASES` (`:194`) | "all three superres gates" | **STALE (undercount)** | 6 gates spell nonzero `--superres-mode`; 5 read `superres_hits`/`predict_scaled_hits` | count removed (rots); alias marked healthy | | ||
| 60 | +| 20 | 10-bit list header (`:335`) | "Only 4 of the 45 real-aomenc gates encode at 10 bits" | **STALE** | 83 of 146 selected bodies are 10-bit-or-higher | reworded with the measured figure | | ||
| 61 | +| 21 | `DEFAULT_ON_TOOLS` default column (`:135-181`) | `1` for tx-size-search / directional-intra / smooth-interintra / interintra-wedge / diff-wtd-comp / onesided-comp | **TRUE** | `default_extra_cfg` (non-RT array) is 1 for all six; `CONFIG_REALTIME_ONLY 0` | keep | | ||
| 62 | +| 22 | `DEFAULT_ON_TOOLS` `deblocking`/`multi-tile`/`fwd-kf` defaults (`:181-189`), `multi-tile` `0`, `fwd-kf` `0` | — | **TRUE** | `LOOPFILTER_ALL` (non-zero), `tile_columns/rows = 0`, `fwd_kf = 0` | keep | | ||
| 63 | +| 23 | NEVER_EXERCISED doc (`:46`) | "palette and intrabc only come on for screen content" | **TRUE** | `encoder.c:2079` `allow_screen_content_tools` from block counts; `seq_force_screen_content_tools` adaptive | keep | | ||
| 64 | + | ||
| 65 | +## Claims-a-gate spot check (class: a passing gate that never reaches the feature) | ||
| 66 | + | ||
| 67 | +Main's "one level down" class. Each entry naming a gate was checked against that | ||
| 68 | +gate's own asserts: | ||
| 69 | + | ||
| 70 | +| entry | gate named | gate exists | gate asserts the firing | verdict | | ||
| 71 | +|---|---|---|---|---| | ||
| 72 | +| dist-wtd (r1) | `a_distance_weighted_compound_stream_...` | yes | yes — `dist_wtd_comp_hits() > 0` | **VERIFIED** | | ||
| 73 | +| dual-filter | `a_real_aomenc_dual_filter_obmc_8x8_...` | yes | yes — `dual_filter_diff_hits() > before` | **VERIFIED** (census blind to it) | | ||
| 74 | +| flip-idtx | `a_real_aomenc_stream_with_a_1d_tx_class_...` | yes | yes — `compared_class1 > 0` | **VERIFIED** | | ||
| 75 | +| cfl-intra | `a_real_aomenc_sb128_stream_whose_skipped_cfl_...` | yes | yes — `dir_pairs > 0` (not skipped-CfL) | **VERIFIED for 1:4 pairs; GAP for the name's skipped-CfL** | | ||
| 76 | +| intrabc | `an_sb128_screen_stream_with_intrabc_...` | yes | yes — `blocks_total > 0 && fired_arms > 0` | **VERIFIED** | | ||
| 77 | +| restoration | `a_real_aomenc_10bit_restoration_stream_...` | yes | yes — `lr_*_hits` | **VERIFIED** | | ||
| 78 | +| superres (alias) | 5 superres gates | yes | yes — `superres_hits`/`predict_scaled_hits` | **VERIFIED** | | ||
| 79 | +| global-motion | `a_real_affine_global_motion_...` | yes | yes — affine GM counter | **VERIFIED** | | ||
| 80 | + | ||
| 81 | +**GAP (one):** no gate in the tree names `enable-rect-tx`, because the tool has no | ||
| 82 | +header bit and no flag-shaped decoder gate — a *structural* gap, correctly | ||
| 83 | +described by entry #7, not a broken gate. | ||
| 84 | + | ||
| 85 | +## The two structural census defects this audit exposed | ||
| 86 | + | ||
| 87 | +Both are stated in the corrected comments but are **census logic**, deliberately | ||
| 88 | +NOT changed in this lane (the brief forbids behaviour changes; the entry deletions | ||
| 89 | +are left in place so the file's own tests stay green): | ||
| 90 | + | ||
| 91 | +1. **`gate_bodies()` helper-delegation blind spot** (`gate_coverage.rs:421`). | ||
| 92 | + The filter keeps only a `#[test]`-shaped segment containing `--passes=1` / | ||
| 93 | + `ten_bit_tool_gate(` / `encode_10bit_gradients`. A gate that hands its recipe | ||
| 94 | + to a shared helper keeps the flags in the *helper*, so the whole gate is | ||
| 95 | + invisible. Measured: 165 of 311 segments are filtered out, and 6 of those | ||
| 96 | + spell at least one `--enable-X=1` — including both gates that prove | ||
| 97 | + `enable-dual-filter` (#3, #4). This is why two live entries are wrong. | ||
| 98 | + | ||
| 99 | +2. **`covers_both_depths` blind spot, third spelling** (`gate_coverage.rs:599`). | ||
| 100 | + It recognises only `if bit_depth == 10` / `if depth == 10` / | ||
| 101 | + `for depth in [8usize, 10]`. `a_real_aomenc_stream_with_a_1d_tx_class_...` | ||
| 102 | + builds both depths from a `ten_bit` recipe, so `is_ten_bit` sees the | ||
| 103 | + `yuv420p10le` and files it 10-bit-ONLY — hiding its 8-bit arm and keeping the | ||
| 104 | + 8-bit `enable-flip-idtx` entry alive (#5). This is the lane-defon/reelckf blind | ||
| 105 | + spot the function's own doc comment describes, reached through a new spelling. | ||
| 106 | + | ||
| 107 | +**Loud, for the coverage matrix:** entries `enable-dual-filter` (8-bit `:270`, | ||
| 108 | +10-bit `:374`) and `enable-flip-idtx` (8-bit `:291`) are **stale coverage holes** | ||
| 109 | +— the tools are exercised by gates with hard arrival asserts. The census is | ||
| 110 | +wrong, not the coverage. If another lane's matrix counts these as open cells, | ||
| 111 | +that matrix overstates the holes. Correcting the two structural defects above | ||
| 112 | +would let all three entries be deleted and this file's own test stay green. | ||
| 113 | + | ||
| 114 | +## What changed in this lane | ||
| 115 | + | ||
| 116 | +`crates/ec-av1/src/gate_coverage.rs` only, and the diff is **comment/reason-text | ||
| 117 | +only**: verified — the only non-comment lines changed are 3 entry *reason | ||
| 118 | +strings* (`gate_coverage.rs:272, 293, 376`). No flag name, entry membership, | ||
| 119 | +counter, gate, or decoder behaviour was touched. All 9 `gate_coverage` tests | ||
| 120 | +green after the change. No stream, gate, or counter behaviour altered, per brief. | ||
| 121 | + | ||
| 122 | +--- | ||
| 123 | + | ||
| 124 | +# r3 appendix: fix the two structural census defects | ||
| 125 | + | ||
| 126 | +r2 corrected the false CLAIMS. r3 fixes the LOGIC that generated them, so it | ||
| 127 | +stops generating them. `crates/ec-av1/src/gate_coverage.rs` only; no gate, | ||
| 128 | +counter, fixture, or decoder behaviour touched. | ||
| 129 | + | ||
| 130 | +## Evidence table — before / after | ||
| 131 | + | ||
| 132 | +| measure | before (r2, spelling-only) | after (r3, call-resolving) | | ||
| 133 | +|---|---|---| | ||
| 134 | +| gate bodies seen by `gate_bodies()` | 146 | **230** (+84) | | ||
| 135 | +| of those, classified 10-bit-or-higher | 83 | **107** (+24) | | ||
| 136 | +| `enable-dual-filter` 8-bit | listed as a hole | **retired** (gate found) | | ||
| 137 | +| `enable-flip-idtx` 8-bit | listed as a hole | **retired** (gate classified both-depths) | | ||
| 138 | +| `NEVER_EXERCISED_8BIT` | 3 live entries | **1** (`enable-rect-tx`) | | ||
| 139 | +| `NEVER_EXERCISED_10BIT` | 3 live entries | **2** (`enable-dual-filter`, `enable-rect-tx`) | | ||
| 140 | +| tests | 9 | **10** (new `the_detector_sees_the_gates_the_spelling_filter_missed`) | | ||
| 141 | + | ||
| 142 | +The three gates the fix had to find, all now found and asserted by the new test: | ||
| 143 | + | ||
| 144 | +| gate | was invisible because | now found by | | ||
| 145 | +|---|---|---| | ||
| 146 | +| `a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact` | recipe lives in `inter_sb_none_gate` | `encoder_fns` call closure | | ||
| 147 | +| `a_real_obmc_stream_reads_a_recorded_switchable_filter_for_every_neighbour` | same | `encoder_fns` call closure | | ||
| 148 | +| `a_real_aomenc_stream_with_a_1d_tx_class_on_a_rect_transform_decodes_pixel_exact` | `ten_bit` recipe, `is_ten_bit` filed it 10-bit-only | `covers_both_depths` pair-of-formats marker | | ||
| 149 | + | ||
| 150 | +## The two fixes | ||
| 151 | + | ||
| 152 | +**1. `gate_bodies()` — recognise a gate by what it CALLS, not only what it spells.** | ||
| 153 | +New `fn_units` parses every `fn` in `stream.rs` as `(name, body)`; `encoder_fns` | ||
| 154 | +computes the transitive closure of fns that reach one naming `aomenc_path()`. | ||
| 155 | +The filter is now `legacy_gate_tokens(body) || body.contains("aomenc_path()") | ||
| 156 | +|| enc.iter().any(|e| calls_fn(body, e))`. The call test is deliberately the | ||
| 157 | +weak half of an OR, so the fix is **strictly additive** — it can add gates but | ||
| 158 | +can never stop recognising one the old filter did. `calls_fn` requires the name | ||
| 159 | +to be followed by `(` and not be the tail of a longer identifier, so | ||
| 160 | +`inter_sb_none_gate` does not "call" `sb_none_gate`. | ||
| 161 | + | ||
| 162 | +**2. `covers_both_depths` — the third spelling.** Added | ||
| 163 | +`body.contains("\"yuv420p\"") && body.contains("\"yuv420p10le\"")`: a body | ||
| 164 | +naming BOTH fixture formats builds streams at both depths, whatever the | ||
| 165 | +parameter is called. The quotes matter — a bare `yuv420p` substring test also | ||
| 166 | +matches `yuv420p10le` and would fire on every 10-bit gate, retiring entries on | ||
| 167 | +no evidence. This is not a special case for the flip-idtx gate; it is the | ||
| 168 | +lane-defon/reelckf blind spot closed on its third spelling. | ||
| 169 | + | ||
| 170 | +## Red-before (three mutations, all reverted; `stream.rs` byte-identical to HEAD) | ||
| 171 | + | ||
| 172 | +A detector change can only be shown to find MORE, never to stop missing, so | ||
| 173 | +each half was shown to be **causal** — neuter it and the retired entry must come | ||
| 174 | +back. | ||
| 175 | + | ||
| 176 | +**Mutation A — the helper-delegation half.** Set `--enable-dual-filter=1` to | ||
| 177 | +`=0` in both helper-based gates. TWO tests red: | ||
| 178 | +- `never_exercised_8bit_matches_the_gate_recipes`: *"no 8-bit gate passes `=1` | ||
| 179 | + for ["enable-dual-filter"], so no real 8-bit stream exercises them"* — the | ||
| 180 | + retired entry correctly RETURNS as a hole. | ||
| 181 | +- `the_detector_sees_the_gates_the_spelling_filter_missed`: *"seen, but its | ||
| 182 | + --enable-dual-filter=1 spelling is not visible to flags_in"*, `left: Some('0') | ||
| 183 | + right: Some('1')`. The second red is the valuable one: it separates | ||
| 184 | + *recognition broke* from *the gate no longer enables the tool*. | ||
| 185 | + | ||
| 186 | +**Mutation B — the legacy path still works.** Set `--enable-dist-wtd-comp=1` to | ||
| 187 | +`=0` in the r1 gate, a gate the OLD filter already recognised (it spells | ||
| 188 | +`--passes=1`). Red at BOTH depths: *"no 10-bit gate passes `=1` for | ||
| 189 | +["enable-dist-wtd-comp"]"* and the 8-bit twin. The spelling path is intact. | ||
| 190 | + | ||
| 191 | +**Mutation C — the both-depths half.** Reverted only the pair-of-formats | ||
| 192 | +clause. TWO tests red: `never_exercised_8bit...`: *"no 8-bit gate passes `=1` | ||
| 193 | +for ["enable-flip-idtx"]"*, and the new detector test: *"the flip-idtx gate | ||
| 194 | +spells both fixture formats, so covers_both_depths must credit it to the 8-bit | ||
| 195 | +bucket as well"*. | ||
| 196 | + | ||
| 197 | +All three reverted; `git diff --stat crates/ec-av1/src/stream.rs` is empty, and | ||
| 198 | +all 10 tests are green. | ||
| 199 | + | ||
| 200 | +## `enable-dual-filter` 10-bit: the entry STAYS — a finding, not an oversight | ||
| 201 | + | ||
| 202 | +After the fix the 8-bit entry retires and the 10-bit one does not, which is the | ||
| 203 | +honest outcome and exactly the case Main said to report rather than paper over. | ||
| 204 | +The only `=1` witness is `a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact`, | ||
| 205 | +and it calls `inter_sb_none_gate(NAME, false, ...)` — `false` is the `ten_bit` | ||
| 206 | +parameter, so it builds an 8-bit stream only. Its `ten_bit=true` siblings | ||
| 207 | +(`..._10bit_inter_sequence_with_a_whole_superblock_block_...` and the 8x8-leaf | ||
| 208 | +pair) do not spell `--enable-dual-filter=1`. **To retire it: add the 10-bit arm | ||
| 209 | +— pass `true` to `inter_sb_none_gate` in that gate and assert | ||
| 210 | +`dual_filter_diff_hits()` still moves there.** | ||
| 211 | + | ||
| 212 | +## Row: `enable-tx-size-search` — the one claim this audit could not settle | ||
| 213 | + | ||
| 214 | +A third detector limit, and the method for whoever takes it next. After the r3 | ||
| 215 | +fix, 113 of the 230 selected gates name it: **88 pass `=0`, 15 pass `=1`, and 9 | ||
| 216 | +build the value into a `format!`/`String` variable** that neither `flags_in` nor | ||
| 217 | +`settings_in` can see — both scan for a literal `"--flag=value"` inside one | ||
| 218 | +segment. So the r2 finding stands and sharpens: the historical "all 49 pass 0" | ||
| 219 | +claim no longer holds in either direction, and 9 gates are unclassified in an | ||
| 220 | +**unknown direction**, which is the exact failure mode this file exists to | ||
| 221 | +prevent. | ||
| 222 | + | ||
| 223 | +**What would settle it (method, not a guess):** extend `flags_in`/`settings_in` | ||
| 224 | +to resolve a local binding the way `gate_bodies` now resolves calls. When a | ||
| 225 | +segment contains `let <name> = format!("--enable-tx-size-search={tx_search}")` | ||
| 226 | +(or the `String::from`/`to_string` equivalent), record the TEMPLATE and bind the | ||
| 227 | +variable's value at each use site. Re-count, and only then decide whether the | ||
| 228 | +tool is a live hole. Until that exists the 113/88/15 split is a floor, not a | ||
| 229 | +measurement. This is recorded in-file above `DEFAULT_ON_TOOLS` as well. | ||