Merge branch 'lane-fimv': motion_mode alphabet drops WARPED_CAUSAL under cur_frame_force_integer_mv (libaom motion_mode_allowed); screen-content warp gate 8/10-bit
Browse files at this commit3 changed files +387 -17
- crates/ec-av1/src/decode.rs +80 -17
- crates/ec-av1/src/stream.rs +233 -0
- lanes/fimv-r1.report.md +74 -0
crates/ec-av1/src/decode.rsmodified+80 -17
| @@ -1130,6 +1130,42 @@ thread_local! { | |||
| 1130 | const { std::cell::Cell::new(0) }; | 1130 | const { std::cell::Cell::new(0) }; |
| 1131 | } | 1131 | } |
| 1132 | 1132 | ||
| 1133 | +// lane-fimv r1 (class wrong-alphabet-same-value): how many blocks took the | ||
| 1134 | +// 2-symbol `obmc_cdf` alphabet *because* `force_integer_mv` (or a scaled | ||
| 1135 | +// reference) vetoed `WARPED_CAUSAL` in libaom `motion_mode_allowed`, while | ||
| 1136 | +// `allow_warped_motion == 1` and `num_proj_ref >= 1` would otherwise have | ||
| 1137 | +// picked the 3-symbol `motion_mode_cdf`. These are exactly the blocks this | ||
| 1138 | +// decoder used to read with the wrong alphabet, so a gate that asserts this | ||
| 1139 | +// counter advanced proves the fixed path fired (class | ||
| 1140 | +// `gate-blind-to-feature`). | ||
| 1141 | +thread_local! { | ||
| 1142 | + static FIMV_ALPHABET_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 1143 | +} | ||
| 1144 | + | ||
| 1145 | +/// Current value of [`FIMV_ALPHABET_HITS`]. | ||
| 1146 | +pub fn fimv_alphabet_hits() -> usize { | ||
| 1147 | + FIMV_ALPHABET_HITS.with(|c| c.get()) | ||
| 1148 | +} | ||
| 1149 | + | ||
| 1150 | +// lane-fimv r1: how many frame headers this decoder has decoded with | ||
| 1151 | +/// `force_integer_mv == 1` (bumped by `stream.rs` per frame). Lets a gate | ||
| 1152 | +// prove the encoder really produced the header state under test rather than | ||
| 1153 | +// assume it. | ||
| 1154 | +thread_local! { | ||
| 1155 | + static FIMV_FRAME_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 1156 | +} | ||
| 1157 | + | ||
| 1158 | +/// Current value of [`FIMV_FRAME_HITS`]. | ||
| 1159 | +pub fn fimv_frame_hits() -> usize { | ||
| 1160 | + FIMV_FRAME_HITS.with(|c| c.get()) | ||
| 1161 | +} | ||
| 1162 | + | ||
| 1163 | +/// Bump [`FIMV_FRAME_HITS`] -- called once per decoded frame header whose | ||
| 1164 | +/// `force_integer_mv` bit is set. | ||
| 1165 | +pub fn note_force_integer_mv_frame() { | ||
| 1166 | + FIMV_FRAME_HITS.with(|c| c.set(c.get() + 1)); | ||
| 1167 | +} | ||
| 1168 | + | ||
| 1133 | /// Current value of [`OBMC_HITS`]. | 1169 | /// Current value of [`OBMC_HITS`]. |
| 1134 | pub(crate) fn obmc_hits() -> usize { | 1170 | pub(crate) fn obmc_hits() -> usize { |
| 1135 | OBMC_HITS.with(|c| c.get()) | 1171 | OBMC_HITS.with(|c| c.get()) |
| @@ -14192,27 +14228,46 @@ fn decode_inter_block( | |||
| 14192 | // `motion_mode_allowed` reads the 3-symbol `motion_mode_cdf` | 14228 | // `motion_mode_allowed` reads the 3-symbol `motion_mode_cdf` |
| 14193 | // instead of the 2-symbol `obmc_cdf` exactly when | 14229 | // instead of the 2-symbol `obmc_cdf` exactly when |
| 14194 | // `num_proj_ref >= 1` under `allow_warped_motion`. | 14230 | // `num_proj_ref >= 1` under `allow_warped_motion`. |
| 14195 | - // lane-scaledref r2: libaom `motion_mode_allowed` | 14231 | + // lane-scaledref r2 + lane-fimv r1: libaom |
| 14196 | - // (`blockd.h:1484`) requires | 14232 | + // `motion_mode_allowed` (`blockd.h:1484`) requires BOTH |
| 14197 | - // `!av1_is_scaled(block_ref_scale_factors[0])` for | 14233 | + // `!av1_is_scaled(block_ref_scale_factors[0])` and |
| 14198 | - // WARPED_CAUSAL -- under a scaled reference (superres) the | 14234 | + // `!xd->cur_frame_force_integer_mv` for WARPED_CAUSAL -- |
| 14199 | - // block reads the 2-symbol `obmc_cdf`, never the 3-symbol | 14235 | + // under a scaled reference (superres) OR on a frame whose |
| 14236 | + // header set `force_integer_mv` (screen content) the block | ||
| 14237 | + // reads the 2-symbol `obmc_cdf`, never the 3-symbol | ||
| 14200 | // `motion_mode_cdf`. Reading the wrong alphabet here narrows | 14238 | // `motion_mode_cdf`. Reading the wrong alphabet here narrows |
| 14201 | // the arithmetic coder by the wrong amount and predicts the | 14239 | // the arithmetic coder by the wrong amount and predicts the |
| 14202 | - // rest of the tile off a diverged state: it was silently | 14240 | + // rest of the tile off a diverged state: silently wrong |
| 14203 | - // wrong pixels (r1's `--enable-warped-motion=1` superres | 14241 | + // pixels, not a desync error. `force_integer_mv` is the |
| 14204 | - // mismatch), not a desync error. | 14242 | + // per-frame value (spec 5.9.2: coded per frame only when |
| 14243 | + // `seq_force_integer_mv == SELECT_INTEGER_MV`, threaded from | ||
| 14244 | + // `FrameHeader::force_integer_mv`). | ||
| 14245 | + // libaom `av1_is_scaled` is `x_scale_fp != REF_NO_SCALE || | ||
| 14246 | + // y_scale_fp != REF_NO_SCALE`; the y half is unreachable here | ||
| 14247 | + // because a reference whose height differs from this frame's | ||
| 14248 | + // true size is refused before any tile decodes ("a reference | ||
| 14249 | + // picture whose height does not match this frame's own true | ||
| 14250 | + // size", ~14681). Whoever lifts that refusal adds the y term. | ||
| 14205 | let ref_is_scaled = | 14251 | let ref_is_scaled = |
| 14206 | mc::scale_factor(py_ref.width, frame_width) != mc::REF_NO_SCALE; | 14252 | mc::scale_factor(py_ref.width, frame_width) != mc::REF_NO_SCALE; |
| 14207 | - let warp_eligible = allow_warped_motion | 14253 | + let proj_ok = num_proj_ref( |
| 14208 | - && !ref_is_scaled | 14254 | + grid, |
| 14209 | - && num_proj_ref(grid, mi_row, mi_col, bw4, bh4, mi_cols as usize, mi_rows as usize, ref_frame) >= 1; | 14255 | + mi_row, |
| 14210 | - if allow_warped_motion | 14256 | + mi_col, |
| 14211 | - && ref_is_scaled | 14257 | + bw4, |
| 14212 | - && num_proj_ref(grid, mi_row, mi_col, bw4, bh4, mi_cols as usize, mi_rows as usize, ref_frame) >= 1 | 14258 | + bh4, |
| 14213 | - { | 14259 | + mi_cols as usize, |
| 14260 | + mi_rows as usize, | ||
| 14261 | + ref_frame, | ||
| 14262 | + ) >= 1; | ||
| 14263 | + let warp_eligible = | ||
| 14264 | + allow_warped_motion && !ref_is_scaled && !force_integer_mv && proj_ok; | ||
| 14265 | + if allow_warped_motion && proj_ok && ref_is_scaled { | ||
| 14214 | SCALED_WARP_SUPPRESSED_HITS.with(|c| c.set(c.get() + 1)); | 14266 | SCALED_WARP_SUPPRESSED_HITS.with(|c| c.set(c.get() + 1)); |
| 14215 | } | 14267 | } |
| 14268 | + if allow_warped_motion && proj_ok && !ref_is_scaled && force_integer_mv { | ||
| 14269 | + FIMV_ALPHABET_HITS.with(|c| c.set(c.get() + 1)); | ||
| 14270 | + } | ||
| 14216 | if warp_eligible { | 14271 | if warp_eligible { |
| 14217 | let mode = dec.symbol(&mut cdfs.motion_mode[bsize_idx]); | 14272 | let mode = dec.symbol(&mut cdfs.motion_mode[bsize_idx]); |
| 14218 | match mode { | 14273 | match mode { |
| @@ -15924,8 +15979,16 @@ fn decode_inter_block8( | |||
| 15924 | // leaf under a scaled reference is refused before this function | 15979 | // leaf under a scaled reference is refused before this function |
| 15925 | // runs (see the block8 refusal below, ~12500) -- whoever lifts | 15980 | // runs (see the block8 refusal below, ~12500) -- whoever lifts |
| 15926 | // that refusal must add `&& !ref_is_scaled` here too. | 15981 | // that refusal must add `&& !ref_is_scaled` here too. |
| 15927 | - let warp_eligible = allow_warped_motion | 15982 | + // lane-fimv r1: libaom `motion_mode_allowed` also requires |
| 15928 | - && num_proj_ref(grid, mi_row, mi_col, 2, 2, mi_cols as usize, mi_rows as usize, ref_frame) >= 1; | 15983 | + // `!xd->cur_frame_force_integer_mv`, so a screen-content frame |
| 15984 | + // that set `force_integer_mv` reads the 2-symbol `obmc_cdf` here | ||
| 15985 | + // (class wrong-alphabet-same-value). | ||
| 15986 | + let proj_ok = | ||
| 15987 | + num_proj_ref(grid, mi_row, mi_col, 2, 2, mi_cols as usize, mi_rows as usize, ref_frame) >= 1; | ||
| 15988 | + let warp_eligible = allow_warped_motion && !force_integer_mv && proj_ok; | ||
| 15989 | + if allow_warped_motion && proj_ok && force_integer_mv { | ||
| 15990 | + FIMV_ALPHABET_HITS.with(|c| c.set(c.get() + 1)); | ||
| 15991 | + } | ||
| 15929 | if warp_eligible { | 15992 | if warp_eligible { |
| 15930 | let mode = dec.symbol(&mut cdfs.motion_mode[0]); | 15993 | let mode = dec.symbol(&mut cdfs.motion_mode[0]); |
| 15931 | match mode { | 15994 | match mode { |
crates/ec-av1/src/stream.rsmodified+233 -0
| @@ -620,6 +620,11 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> { | |||
| 620 | // refuses by name there if the slot is still empty -- widened | 620 | // refuses by name there if the slot is still empty -- widened |
| 621 | // (lane-av1refs) from `GOLDEN_FRAME`'s own slot alone to every | 621 | // (lane-av1refs) from `GOLDEN_FRAME`'s own slot alone to every |
| 622 | // one of the 7 single-reference slots. | 622 | // one of the 7 single-reference slots. |
| 623 | + // lane-fimv r1: record the header state the fimv gate asserts on | ||
| 624 | + // (`motion_mode_allowed`'s `!cur_frame_force_integer_mv` clause). | ||
| 625 | + if header.force_integer_mv { | ||
| 626 | + decode::note_force_integer_mv_frame(); | ||
| 627 | + } | ||
| 623 | let other_refs: [Option<&Picture>; 8] = std::array::from_fn(|ref_frame| { | 628 | let other_refs: [Option<&Picture>; 8] = std::array::from_fn(|ref_frame| { |
| 624 | if ref_frame == 0 { | 629 | if ref_frame == 0 { |
| 625 | None | 630 | None |
| @@ -9230,6 +9235,234 @@ mod tests { | |||
| 9230 | assert!(matched > 0, "{name}: every attempt refused -- no pixel comparison ran"); | 9235 | assert!(matched > 0, "{name}: every attempt refused -- no pixel comparison ran"); |
| 9231 | } | 9236 | } |
| 9232 | 9237 | ||
| 9238 | + /// lane-fimv r1 (class `wrong-alphabet-same-value`): libaom | ||
| 9239 | + /// `motion_mode_allowed` (blockd.h ~1484) only returns `WARPED_CAUSAL` | ||
| 9240 | + /// when `!xd->cur_frame_force_integer_mv`, so on a frame whose header set | ||
| 9241 | + /// `force_integer_mv` an otherwise warp-eligible block reads the 2-symbol | ||
| 9242 | + /// `obmc_cdf`, not the 3-symbol `motion_mode_cdf`. This decoder read the | ||
| 9243 | + /// 3-symbol alphabet there (silent tile desync, no refusal named it). | ||
| 9244 | + /// | ||
| 9245 | + /// The fixture is screen content that is mostly static with only | ||
| 9246 | + /// whole-pixel motion, which is exactly what aomenc's own | ||
| 9247 | + /// `av1_is_integer_mv` (`encoder_utils.c:1357`, >=80% of blocks matching | ||
| 9248 | + /// their collocated block) needs to set `cur_frame_force_integer_mv` | ||
| 9249 | + /// under `--tune-content=screen` (seq `force_integer_mv == 2`, adaptive: | ||
| 9250 | + /// `encoder.c:4171`). Two hard asserts, both class | ||
| 9251 | + /// `gate-blind-to-feature`: at least one decoded frame header carried | ||
| 9252 | + /// `force_integer_mv = 1`, and at least one block took the 2-symbol | ||
| 9253 | + /// alphabet where `allow_warped_motion = 1` and `num_proj_ref >= 1` would | ||
| 9254 | + /// have picked the 3-symbol one. A decode error or a pixel mismatch is a | ||
| 9255 | + /// FAILURE, never a skip. | ||
| 9256 | + #[track_caller] | ||
| 9257 | + fn run_fimv_motion_mode_gate(name: &str, ten_bit: bool) { | ||
| 9258 | + let _gate_lock = lock_gate_counters(); | ||
| 9259 | + assert!(have_ffmpeg(), "{name}: ffmpeg required"); | ||
| 9260 | + assert!(have_aomenc(), "{name}: no aomenc at {}", aomenc_path().display()); | ||
| 9261 | + let (width, height, frame_count) = (64usize, 64usize, 20usize); | ||
| 9262 | + let fimv_frames_before = crate::decode::fimv_frame_hits(); | ||
| 9263 | + let alphabet_before = crate::decode::fimv_alphabet_hits(); | ||
| 9264 | + let mut matched = 0u32; | ||
| 9265 | + let mut named_refusals = 0u32; | ||
| 9266 | + let mut attempts = 0u32; | ||
| 9267 | + let mut refusals = Vec::new(); | ||
| 9268 | + for cq in [32u32, 45, 55] { | ||
| 9269 | + for step in [4u32, 8] { | ||
| 9270 | + attempts += 1; | ||
| 9271 | + // lane-fimv r1: per-attempt snapshots. The aggregate | ||
| 9272 | + // assertions below are satisfied by a single lucky cq/step | ||
| 9273 | + // cell; these prove EVERY attempt that decoded and | ||
| 9274 | + // pixel-compared really carried the header state and the | ||
| 9275 | + // forced alphabet under test (class gate-blind-to-feature). | ||
| 9276 | + let attempt_fimv_before = crate::decode::fimv_frame_hits(); | ||
| 9277 | + let attempt_alphabet_before = crate::decode::fimv_alphabet_hits(); | ||
| 9278 | + let duration = frame_count as f64 / 25.0; | ||
| 9279 | + // Flat screen-content tiles with hard edges, translating by a | ||
| 9280 | + // whole number of pixels per frame: static enough for | ||
| 9281 | + // `av1_is_integer_mv`, moving enough for a real inter block | ||
| 9282 | + // with overlappable neighbours. | ||
| 9283 | + let source = format!( | ||
| 9284 | + "color=c=black:s={width}x{height}:r=25,\ | ||
| 9285 | + drawbox=x='8+{step}*mod(trunc(t*25)\\,3)':y=8:w=20:h=20:color=white:t=fill,\ | ||
| 9286 | + drawbox=x=36:y='6+{step}*mod(trunc(t*25)+1\\,3)':w=16:h=16:color=0x808080:t=fill,\ | ||
| 9287 | + drawbox=x=4:y=44:w=56:h=12:color=0xC0C0C0:t=fill" | ||
| 9288 | + ); | ||
| 9289 | + let pix_fmt = if ten_bit { "yuv420p10le" } else { "yuv420p" }; | ||
| 9290 | + let y4m = Command::new("ffmpeg") | ||
| 9291 | + .args([ | ||
| 9292 | + "-v", "error", "-f", "lavfi", "-i", &source, "-t", | ||
| 9293 | + &duration.to_string(), "-pix_fmt", pix_fmt, "-strict", "-1", | ||
| 9294 | + "-f", "yuv4mpegpipe", "-", | ||
| 9295 | + ]) | ||
| 9296 | + .stdin(Stdio::null()) | ||
| 9297 | + .stdout(Stdio::piped()) | ||
| 9298 | + .stderr(Stdio::piped()) | ||
| 9299 | + .output() | ||
| 9300 | + .expect("ffmpeg failed to run"); | ||
| 9301 | + assert!( | ||
| 9302 | + y4m.status.success(), | ||
| 9303 | + "ffmpeg fixture: {}", | ||
| 9304 | + String::from_utf8_lossy(&y4m.stderr) | ||
| 9305 | + ); | ||
| 9306 | + let cq_arg = format!("--cq-level={cq}"); | ||
| 9307 | + let mut args: Vec<&str> = vec![ | ||
| 9308 | + "--codec=av1", | ||
| 9309 | + "--passes=1", | ||
| 9310 | + "--end-usage=q", | ||
| 9311 | + &cq_arg, | ||
| 9312 | + "--cpu-used=0", | ||
| 9313 | + "--kf-max-dist=1000", | ||
| 9314 | + "--threads=1", | ||
| 9315 | + "--row-mt=0", | ||
| 9316 | + // single reference only: the 10-bit compound MC defect | ||
| 9317 | + // (see `a_real_compound_global_warp_10bit_stream_...`) | ||
| 9318 | + // is unrelated to this lane and would mask it. | ||
| 9319 | + "--auto-alt-ref=0", | ||
| 9320 | + "--lag-in-frames=0", | ||
| 9321 | + "--enable-fwd-kf=0", | ||
| 9322 | + "--enable-order-hint=1", | ||
| 9323 | + // the flag combination this gate exists for: warp allowed | ||
| 9324 | + // by the header, OBMC available, global motion off (so the | ||
| 9325 | + // GLOBALMV suppression is not what picks the alphabet). | ||
| 9326 | + "--tune-content=screen", | ||
| 9327 | + "--enable-warped-motion=1", | ||
| 9328 | + "--enable-obmc=1", | ||
| 9329 | + "--enable-global-motion=0", | ||
| 9330 | + "--enable-masked-comp=0", | ||
| 9331 | + "--enable-onesided-comp=0", | ||
| 9332 | + "--enable-interintra-comp=0", | ||
| 9333 | + "--enable-interintra-wedge=0", | ||
| 9334 | + "--enable-smooth-interintra=0", | ||
| 9335 | + "--enable-dist-wtd-comp=0", | ||
| 9336 | + // partition/intra tools this decoder does not code yet -- | ||
| 9337 | + // the same exclusion list every inter gate here carries. | ||
| 9338 | + "--enable-rect-partitions=0", | ||
| 9339 | + "--enable-ab-partitions=0", | ||
| 9340 | + "--enable-1to4-partitions=0", | ||
| 9341 | + "--enable-filter-intra=0", | ||
| 9342 | + "--enable-smooth-intra=0", | ||
| 9343 | + "--enable-paeth-intra=0", | ||
| 9344 | + "--enable-directional-intra=0", | ||
| 9345 | + "--enable-angle-delta=0", | ||
| 9346 | + "--enable-tx-size-search=0", | ||
| 9347 | + "--enable-cdef=0", | ||
| 9348 | + "--enable-restoration=0", | ||
| 9349 | + "--max-partition-size=32", | ||
| 9350 | + "--min-partition-size=32", | ||
| 9351 | + "--enable-palette=0", | ||
| 9352 | + "--enable-intrabc=0", | ||
| 9353 | + "--enable-cfl-intra=0", | ||
| 9354 | + "--enable-ref-frame-mvs=0", | ||
| 9355 | + ]; | ||
| 9356 | + if ten_bit { | ||
| 9357 | + args.extend_from_slice(&["--input-bit-depth=10", "--bit-depth=10"]); | ||
| 9358 | + } | ||
| 9359 | + args.extend_from_slice(&["--obu", "-o", "-", "-"]); | ||
| 9360 | + let mut child = Command::new(aomenc_path()) | ||
| 9361 | + .args(&args) | ||
| 9362 | + .stdin(Stdio::piped()) | ||
| 9363 | + .stdout(Stdio::piped()) | ||
| 9364 | + .stderr(Stdio::piped()) | ||
| 9365 | + .spawn() | ||
| 9366 | + .expect("aomenc failed to start"); | ||
| 9367 | + child | ||
| 9368 | + .stdin | ||
| 9369 | + .take() | ||
| 9370 | + .expect("aomenc stdin") | ||
| 9371 | + .write_all(&y4m.stdout) | ||
| 9372 | + .expect("writing y4m to aomenc"); | ||
| 9373 | + let out = child.wait_with_output().expect("aomenc failed to run"); | ||
| 9374 | + assert!( | ||
| 9375 | + out.status.success(), | ||
| 9376 | + "aomenc refused the fixture: {}", | ||
| 9377 | + String::from_utf8_lossy(&out.stderr) | ||
| 9378 | + ); | ||
| 9379 | + let stream = out.stdout; | ||
| 9380 | + let frames = match decode_stream(&stream) { | ||
| 9381 | + Err(e) => { | ||
| 9382 | + let msg = e.to_string(); | ||
| 9383 | + assert!( | ||
| 9384 | + msg.contains("unsupported"), | ||
| 9385 | + "{name} failed outright (cq {cq} step {step}): {msg}" | ||
| 9386 | + ); | ||
| 9387 | + named_refusals += 1; | ||
| 9388 | + refusals.push(format!("cq {cq} step {step}: {msg}")); | ||
| 9389 | + continue; | ||
| 9390 | + } | ||
| 9391 | + Ok(frames) => frames, | ||
| 9392 | + }; | ||
| 9393 | + let want = if ten_bit { | ||
| 9394 | + ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count) | ||
| 9395 | + } else { | ||
| 9396 | + ffmpeg_decode_sequence(&stream, width, height, frame_count) | ||
| 9397 | + }; | ||
| 9398 | + assert_eq!(frames.len(), frame_count); | ||
| 9399 | + if let Ok(path) = std::env::var("EC_AV1_GATE_DUMP") | ||
| 9400 | + && frames | ||
| 9401 | + .iter() | ||
| 9402 | + .zip(&want) | ||
| 9403 | + .any(|(g, w)| g.y != w.y || g.u != w.u || g.v != w.v) | ||
| 9404 | + { | ||
| 9405 | + std::fs::write(&path, &stream).expect("writing pinned stream"); | ||
| 9406 | + eprintln!("EC_AV1_GATE_DUMP: wrote mismatching stream (cq {cq}) to {path}"); | ||
| 9407 | + } | ||
| 9408 | + for (i, (got, want)) in frames.iter().zip(&want).enumerate() { | ||
| 9409 | + assert_eq!(got.y, want.y, "{name} frame {i} luma vs ffmpeg (cq {cq} step {step})"); | ||
| 9410 | + assert_eq!(got.u, want.u, "{name} frame {i} U vs ffmpeg (cq {cq} step {step})"); | ||
| 9411 | + assert_eq!(got.v, want.v, "{name} frame {i} V vs ffmpeg (cq {cq} step {step})"); | ||
| 9412 | + } | ||
| 9413 | + assert!( | ||
| 9414 | + crate::decode::fimv_frame_hits() > attempt_fimv_before, | ||
| 9415 | + "{name} (cq {cq} step {step}): decoded and compared all \ | ||
| 9416 | + frames but no frame header had force_integer_mv=1 -- \ | ||
| 9417 | + this attempt is vacuous" | ||
| 9418 | + ); | ||
| 9419 | + assert!( | ||
| 9420 | + crate::decode::fimv_alphabet_hits() > attempt_alphabet_before, | ||
| 9421 | + "{name} (cq {cq} step {step}): no block was forced onto the \ | ||
| 9422 | + 2-symbol obmc alphabet by force_integer_mv while \ | ||
| 9423 | + allow_warped_motion=1 and num_proj_ref>=1 -- this attempt \ | ||
| 9424 | + is vacuous" | ||
| 9425 | + ); | ||
| 9426 | + matched += 1; | ||
| 9427 | + } | ||
| 9428 | + } | ||
| 9429 | + let fimv_frames = crate::decode::fimv_frame_hits() - fimv_frames_before; | ||
| 9430 | + let alphabet = crate::decode::fimv_alphabet_hits() - alphabet_before; | ||
| 9431 | + eprintln!( | ||
| 9432 | + "{name}: {matched}/{attempts} pixel-exact, {named_refusals} named refusals, \ | ||
| 9433 | + force_integer_mv frames={fimv_frames}, forced-2-symbol blocks={alphabet}\n{}", | ||
| 9434 | + refusals.join("\n") | ||
| 9435 | + ); | ||
| 9436 | + assert!(matched > 0, "{name}: every attempt refused -- no pixel comparison ran"); | ||
| 9437 | + assert!( | ||
| 9438 | + fimv_frames > 0, | ||
| 9439 | + "{name}: no decoded frame header had force_integer_mv=1 \ | ||
| 9440 | + ({matched} matches of {attempts}) -- gate vacuous" | ||
| 9441 | + ); | ||
| 9442 | + assert!( | ||
| 9443 | + alphabet > 0, | ||
| 9444 | + "{name}: no block read the 2-symbol obmc alphabet where \ | ||
| 9445 | + allow_warped_motion=1 and num_proj_ref>=1 would have picked the \ | ||
| 9446 | + 3-symbol motion_mode alphabet -- gate vacuous" | ||
| 9447 | + ); | ||
| 9448 | + } | ||
| 9449 | + | ||
| 9450 | + /// 8-bit arm of [`run_fimv_motion_mode_gate`]. | ||
| 9451 | + #[test] | ||
| 9452 | + fn a_real_force_integer_mv_warp_stream_decodes_pixel_exact() { | ||
| 9453 | + run_fimv_motion_mode_gate("a_real_force_integer_mv_warp_stream_decodes_pixel_exact", false); | ||
| 9454 | + } | ||
| 9455 | + | ||
| 9456 | + /// 10-bit arm of [`run_fimv_motion_mode_gate`] -- both of his films are | ||
| 9457 | + /// `yuv420p10le`. | ||
| 9458 | + #[test] | ||
| 9459 | + fn a_real_force_integer_mv_warp_10bit_stream_decodes_pixel_exact() { | ||
| 9460 | + run_fimv_motion_mode_gate( | ||
| 9461 | + "a_real_force_integer_mv_warp_10bit_stream_decodes_pixel_exact", | ||
| 9462 | + true, | ||
| 9463 | + ); | ||
| 9464 | + } | ||
| 9465 | + | ||
| 9233 | /// 8-bit arm of [`run_compound_global_warp_gate`]. | 9466 | /// 8-bit arm of [`run_compound_global_warp_gate`]. |
| 9234 | #[test] | 9467 | #[test] |
| 9235 | fn a_real_compound_global_warp_stream_decodes_pixel_exact() { | 9468 | fn a_real_compound_global_warp_stream_decodes_pixel_exact() { |
lanes/fimv-r1.report.mdadded+74 -0
| @@ -0,0 +1,74 @@ | |||
| 1 | +# lane-fimv r1 report | ||
| 2 | + | ||
| 3 | +Branch `lane-fimv`, rebased onto main `df5d630`. Commits: | ||
| 4 | + | ||
| 5 | +- `0fea969` (rebased `7513e53`) `fix(av1): motion_mode alphabet ignored force_integer_mv (and scaled refs)` | ||
| 6 | +- `fc8b30e` `test(av1): force_integer_mv motion-mode gate asserts non-vacuity per attempt` | ||
| 7 | + | ||
| 8 | +## Root cause (r1, first commit -- verified this round, not re-derived) | ||
| 9 | + | ||
| 10 | +libaom `motion_mode_allowed` (`blockd.h` ~1484) returns `WARPED_CAUSAL` only when | ||
| 11 | +`!xd->cur_frame_force_integer_mv && !av1_is_scaled(...)`. Our `warp_eligible` | ||
| 12 | +(`crates/ec-av1/src/decode.rs:12417`) had neither clause, so a screen-content frame whose | ||
| 13 | +header set `force_integer_mv` read the 3-symbol `motion_mode_cdf` where libaom wrote the | ||
| 14 | +2-symbol `obmc_cdf` -- a wrong-alphabet msac narrowing, silently wrong pixels with no | ||
| 15 | +refusal naming it (class `wrong-alphabet-same-value`). Same clause in | ||
| 16 | +`decode_inter_block8`'s 8x8-leaf read (`decode.rs:14071`). | ||
| 17 | + | ||
| 18 | +## What this round added | ||
| 19 | + | ||
| 20 | +- `crates/ec-av1/src/stream.rs:8180,8316` -- the gate's `force_integer_mv frames > 0` and | ||
| 21 | + `forced-2-symbol blocks > 0` assertions were AGGREGATE over the 6 cq/step cells, so one | ||
| 22 | + live cell could have hidden five vacuous ones (class `gate-blind-to-feature`). Both | ||
| 23 | + counters are now snapshotted per attempt and asserted right after that attempt's pixel | ||
| 24 | + compare. Both arms stay green => all 6/6 cells of each arm really carry the header state | ||
| 25 | + and the forced alphabet. | ||
| 26 | +- `crates/ec-av1/src/decode.rs:12398` -- charter asked for `ref_is_scaled` to become | ||
| 27 | + `x || y` like `av1_is_scaled`. NOT DONE as code, deliberately: a reference whose height | ||
| 28 | + differs from this frame's true size is refused before any tile decodes | ||
| 29 | + ("a reference picture whose height does not match this frame's own true size", | ||
| 30 | + `decode.rs:14681`), so the y term is unreachable dead code today. Recorded as a comment | ||
| 31 | + at the site naming the refusal and handing the y term to whoever lifts it | ||
| 32 | + (ladder rung 1: does not need to exist). | ||
| 33 | + | ||
| 34 | +## Gate | ||
| 35 | + | ||
| 36 | +`a_real_force_integer_mv_warp_stream_decodes_pixel_exact` (8-bit) and | ||
| 37 | +`a_real_force_integer_mv_warp_10bit_stream_decodes_pixel_exact` (10-bit), | ||
| 38 | +`crates/ec-av1/src/stream.rs:8160`. Real `aomenc` (`~/.cache/aom-oracle/build/aomenc`), | ||
| 39 | +`--tune-content=screen --enable-warped-motion=1 --enable-obmc=1 --enable-global-motion=0`, | ||
| 40 | +64x64x20 translating screen-content tiles, 6 cells (`cq` 32/45/55 x `step` 4/8), every | ||
| 41 | +decoded frame pixel-compared against ffmpeg. | ||
| 42 | + | ||
| 43 | +``` | ||
| 44 | +EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-fimv \ | ||
| 45 | + cargo test -p ec-av1 --lib -- force_integer_mv --nocapture --test-threads=1 | ||
| 46 | +``` | ||
| 47 | + | ||
| 48 | +EVIDENCE: $HOME/.cache/fimv-suite.log | aomenc --tune-content=screen --enable-warped-motion=1 --enable-obmc=1 --enable-global-motion=0, 6 cq/step cells x 20 frames, each frame Y/U/V compared to ffmpeg | 8-bit 6/6 pixel-exact, 0 refusals, force_integer_mv frames=114, forced-2-symbol blocks=342; 10-bit identical 6/6 / 114 / 342 | ||
| 49 | +EVIDENCE: $HOME/.cache/fimv-suite.log | sibling re-run `cargo test -p ec-av1 --lib -- warp obmc superres scaled` | 20 passed, 0 failed, 2 ignored (pre-existing: 10-bit compound MC defect; pinned-fixture test) | ||
| 50 | + | ||
| 51 | +## Refusals | ||
| 52 | + | ||
| 53 | +None lifted this lane -- the defect was a wrong CDF alphabet, not a refused capability. | ||
| 54 | +`refusal_inventory` (3 tests) and `gate_coverage` (9 tests) stay green with no edit needed. | ||
| 55 | + | ||
| 56 | +## Suite totals | ||
| 57 | + | ||
| 58 | +`EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib -- --test-threads=3`, log | ||
| 59 | +`$HOME/.cache/fimv-suite.log`: **300 passed, 1 failed, 27 ignored, 0 filtered out** (933s). The single failure is the pre-existing-on-main one below. | ||
| 60 | + | ||
| 61 | +`decode::tests::nz_map_ctx_offset_tables_match_the_rect_rule` fails, and is PRE-EXISTING ON | ||
| 62 | +MAIN: reproduced at `df5d630` in a detached verify worktree with its own target dir -- | ||
| 63 | +`32x64 nz_map offset at display (row 0, col 2) left: 6 right: 11` (`decode.rs:16315`). This | ||
| 64 | +lane's diff never touches `nz_map` (`git diff df5d630..HEAD -- decode.rs | grep -c nz_map` | ||
| 65 | += 0). | ||
| 66 | + | ||
| 67 | +## Residue | ||
| 68 | + | ||
| 69 | +- deferred(whoever lifts the reference-height refusal at `decode.rs:14681`): the | ||
| 70 | + `av1_is_scaled` y_scale_fp term in `warp_eligible`. Unreachable today, documented at the | ||
| 71 | + site. | ||
| 72 | +- accepted (not this lane): `nz_map_ctx_offset_tables_match_the_rect_rule` red on main. | ||
| 73 | +- accepted: `a_real_compound_global_warp_10bit_stream_decodes_pixel_exact` stays `#[ignore]` | ||
| 74 | + (pre-existing 10-bit compound MC defect). | ||