Merge branch 'lane-scaledref': compound/OBMC/interintra under scaled references; WARPED_CAUSAL alphabet dropped when the ref is scaled (was silent wrong pixels); one-sided chroma OBMC for 8x8 luma; EC_PROBE_OUT (verifier PASS, 268/0/23)
Browse files at this commit7 changed files +802 -131
- crates/ec-av1/examples/decode_probe.rs +6 -4
- crates/ec-av1/src/decode.rs +279 -82
- crates/ec-av1/src/mc.rs +80 -43
- crates/ec-av1/src/refusal_inventory.rs +1 -2
- crates/ec-av1/src/stream.rs +236 -0
- lanes/scaledref-r1.report.md +115 -0
- lanes/scaledref-r2.report.md +85 -0
crates/ec-av1/examples/decode_probe.rsmodified+6 -4
| @@ -33,10 +33,11 @@ fn main() { | |||
| 33 | println!("OK but EMPTY: no frames -- is {path} an IVF rather than a raw OBU stream?"); | 33 | println!("OK but EMPTY: no frames -- is {path} an IVF rather than a raw OBU stream?"); |
| 34 | } | 34 | } |
| 35 | Ok(frames) => { | 35 | Ok(frames) => { |
| 36 | - println!("OK: {} frames decoded", frames.len()); | 36 | + // Optional second arg, or EC_PROBE_OUT=<path>: dump the decoded |
| 37 | - // Optional second arg: dump the decoded planes as raw yuv420p so a | 37 | + // planes as raw yuv420p so a pixel diff against `ffmpeg -i s.obu |
| 38 | - // pixel diff against `ffmpeg -i s.obu -f rawvideo` needs no test harness. | 38 | + // -f rawvideo` needs no test harness. |
| 39 | - if let Some(out) = std::env::args().nth(2) { | 39 | + let out = std::env::args().nth(2).or_else(|| std::env::var("EC_PROBE_OUT").ok()); |
| 40 | + if let Some(out) = out { | ||
| 40 | // 8-bit only: planes are u16, take the low byte. | 41 | // 8-bit only: planes are u16, take the low byte. |
| 41 | let mut buf: Vec<u8> = Vec::new(); | 42 | let mut buf: Vec<u8> = Vec::new(); |
| 42 | for f in &frames { | 43 | for f in &frames { |
| @@ -47,6 +48,7 @@ fn main() { | |||
| 47 | std::fs::write(&out, &buf).expect("writing raw planes"); | 48 | std::fs::write(&out, &buf).expect("writing raw planes"); |
| 48 | println!("wrote {} bytes of yuv420p to {out}", buf.len()); | 49 | println!("wrote {} bytes of yuv420p to {out}", buf.len()); |
| 49 | } | 50 | } |
| 51 | + println!("OK: {} frames decoded, {}x{}", frames.len(), frames[0].width, frames[0].height); | ||
| 50 | } | 52 | } |
| 51 | Err(e) => println!("REFUSED: {e}"), | 53 | Err(e) => println!("REFUSED: {e}"), |
| 52 | } | 54 | } |
crates/ec-av1/src/decode.rsmodified+279 -82
| @@ -1118,6 +1118,62 @@ pub(crate) fn obmc_hits() -> usize { | |||
| 1118 | OBMC_HITS.with(|c| c.get()) | 1118 | OBMC_HITS.with(|c| c.get()) |
| 1119 | } | 1119 | } |
| 1120 | 1120 | ||
| 1121 | +// lane-scaledref r1: per-case firing counts for the scaled-reference gate | ||
| 1122 | +// (class `gate-blind-to-feature`) -- a pixel match under an UNSCALED | ||
| 1123 | +// reference would pass just as well and prove nothing, so the gate | ||
| 1124 | +// hard-asserts each combination this round lifts actually occurred: | ||
| 1125 | +// a compound block with a scaled tap, a warp block whose warp libaom | ||
| 1126 | +// suppresses because the reference is scaled, an OBMC block, an interintra | ||
| 1127 | +// block, and an 8x8 leaf. | ||
| 1128 | +thread_local! { | ||
| 1129 | + static SCALED_COMPOUND_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 1130 | + static SCALED_WARP_FALLBACK_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 1131 | + static SCALED_OBMC_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 1132 | + static SCALED_INTERINTRA_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 1133 | + static SCALED_BLOCK8_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 1134 | + static SCALED_WARP_SUPPRESSED_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 1135 | + static MIXED_SCALE_COMPOUND_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 1136 | +} | ||
| 1137 | + | ||
| 1138 | +/// Current value of [`MIXED_SCALE_COMPOUND_HITS`]: compound blocks with one | ||
| 1139 | +/// scaled and one unscaled tap. | ||
| 1140 | +pub(crate) fn mixed_scale_compound_hits() -> usize { | ||
| 1141 | + MIXED_SCALE_COMPOUND_HITS.with(|c| c.get()) | ||
| 1142 | +} | ||
| 1143 | + | ||
| 1144 | +/// Current value of [`SCALED_WARP_SUPPRESSED_HITS`]: blocks that would have | ||
| 1145 | +/// read the 3-symbol `motion_mode_cdf` but read the 2-symbol `obmc_cdf` | ||
| 1146 | +/// instead because their reference is scaled (libaom `motion_mode_allowed`, | ||
| 1147 | +/// `blockd.h:1484`). | ||
| 1148 | +pub(crate) fn scaled_warp_suppressed_hits() -> usize { | ||
| 1149 | + SCALED_WARP_SUPPRESSED_HITS.with(|c| c.get()) | ||
| 1150 | +} | ||
| 1151 | + | ||
| 1152 | +/// Current value of [`SCALED_COMPOUND_HITS`]. | ||
| 1153 | +pub(crate) fn scaled_compound_hits() -> usize { | ||
| 1154 | + SCALED_COMPOUND_HITS.with(|c| c.get()) | ||
| 1155 | +} | ||
| 1156 | + | ||
| 1157 | +/// Current value of [`SCALED_WARP_FALLBACK_HITS`]. | ||
| 1158 | +pub(crate) fn scaled_warp_fallback_hits() -> usize { | ||
| 1159 | + SCALED_WARP_FALLBACK_HITS.with(|c| c.get()) | ||
| 1160 | +} | ||
| 1161 | + | ||
| 1162 | +/// Current value of [`SCALED_OBMC_HITS`]. | ||
| 1163 | +pub(crate) fn scaled_obmc_hits() -> usize { | ||
| 1164 | + SCALED_OBMC_HITS.with(|c| c.get()) | ||
| 1165 | +} | ||
| 1166 | + | ||
| 1167 | +/// Current value of [`SCALED_INTERINTRA_HITS`]. | ||
| 1168 | +pub(crate) fn scaled_interintra_hits() -> usize { | ||
| 1169 | + SCALED_INTERINTRA_HITS.with(|c| c.get()) | ||
| 1170 | +} | ||
| 1171 | + | ||
| 1172 | +/// Current value of [`SCALED_BLOCK8_HITS`]. | ||
| 1173 | +pub(crate) fn scaled_block8_hits() -> usize { | ||
| 1174 | + SCALED_BLOCK8_HITS.with(|c| c.get()) | ||
| 1175 | +} | ||
| 1176 | + | ||
| 1121 | // lane-motionmode round 3: same proof as [`OBMC_HITS`], narrowed to | 1177 | // lane-motionmode round 3: same proof as [`OBMC_HITS`], narrowed to |
| 1122 | // `decode_inter_block8`'s own 8x8-leaf `read_motion_mode` -- a subset of | 1178 | // `decode_inter_block8`'s own 8x8-leaf `read_motion_mode` -- a subset of |
| 1123 | // [`OBMC_HITS`] (both fire together on an 8x8 hit), lets the gate tell an | 1179 | // [`OBMC_HITS`] (both fire together on an 8x8 hit), lets the gate tell an |
| @@ -1935,6 +1991,18 @@ fn dc_sign_ctx(vote: i32) -> usize { | |||
| 1935 | /// (spec 5.11.40): its bit length in unary, then that many of its own bits, | 1991 | /// (spec 5.11.40): its bit length in unary, then that many of its own bits, |
| 1936 | /// most significant first — the exact inverse of [`crate::tile::write_golomb`]. | 1992 | /// most significant first — the exact inverse of [`crate::tile::write_golomb`]. |
| 1937 | fn read_golomb(dec: &mut SymbolDecoder) -> Result<u32> { | 1993 | fn read_golomb(dec: &mut SymbolDecoder) -> Result<u32> { |
| 1994 | + // lane-scaledref r1: this cap MASKS A REAL DEFECT and must not be lifted | ||
| 1995 | + // on its own. Reading up to 32 leading zeros (dav1d's `len < 32`; libaom | ||
| 1996 | + // itself calls a 21st bit a corrupt frame, decodetxb.c:30) is bit-identical | ||
| 1997 | + // for every tail any encoder writes -- our own writer tops out at 19 zeros | ||
| 1998 | + // (`tile::MAX_LEVEL == MAX_BR_LEVEL + (1 << 19)`) -- and was implemented | ||
| 1999 | + // and round-trip tested here (commit ee1f980, reverted in 314ee08). It | ||
| 2000 | + // turned `a_real_aomenc_stream_with_a_superblock_level_horz_vert_partition_decodes_pixel_exact` | ||
| 2001 | + // RED: seed 67 stops here today, and with the cap raised it decodes to a | ||
| 2002 | + // frame-0 LUMA MISMATCH instead. A key frame cannot legitimately carry a | ||
| 2003 | + // level above 1<<19, so the long tail is the SYMPTOM of an earlier desync | ||
| 2004 | + // in that intra rect64 stream -- class `refusal-hides-a-defect`. Lift this | ||
| 2005 | + // together with that defect's fix, not before. | ||
| 1938 | let mut length = 1u32; | 2006 | let mut length = 1u32; |
| 1939 | while dec.literal(1) == 0 { | 2007 | while dec.literal(1) == 0 { |
| 1940 | length += 1; | 2008 | length += 1; |
| @@ -10288,21 +10356,43 @@ fn obmc_neighbour_pred( | |||
| 10288 | luma: bool, | 10356 | luma: bool, |
| 10289 | h_kind: mc::InterpFilterKind, | 10357 | h_kind: mc::InterpFilterKind, |
| 10290 | v_kind: mc::InterpFilterKind, | 10358 | v_kind: mc::InterpFilterKind, |
| 10359 | + // lane-scaledref r1: spec 7.11.3.3's x_scale_fp for THIS neighbour's own | ||
| 10360 | + // reference (derived from luma widths, applied unchanged to chroma whose | ||
| 10361 | + // x_q4 is already in its own plane's pixel units). `REF_NO_SCALE` takes | ||
| 10362 | + // the ordinary stride-1 path bit-exact. | ||
| 10363 | + x_scale_fp: i64, | ||
| 10291 | ) -> Vec<u16> { | 10364 | ) -> Vec<u16> { |
| 10292 | let mut out = vec![0u16; w * h]; | 10365 | let mut out = vec![0u16; w * h]; |
| 10293 | - mc::predict_with_filters( | 10366 | + if x_scale_fp == mc::REF_NO_SCALE { |
| 10294 | - &refplane.data, | 10367 | + mc::predict_with_filters( |
| 10295 | - refplane.width, | 10368 | + &refplane.data, |
| 10296 | - refplane.true_width, | 10369 | + refplane.width, |
| 10297 | - refplane.true_height, | 10370 | + refplane.true_width, |
| 10298 | - mv_to_q4(x, mv.1, luma), | 10371 | + refplane.true_height, |
| 10299 | - mv_to_q4(y, mv.0, luma), | 10372 | + mv_to_q4(x, mv.1, luma), |
| 10300 | - w, | 10373 | + mv_to_q4(y, mv.0, luma), |
| 10301 | - h, | 10374 | + w, |
| 10302 | - h_kind, | 10375 | + h, |
| 10303 | - v_kind, | 10376 | + h_kind, |
| 10304 | - &mut out, | 10377 | + v_kind, |
| 10305 | - ); | 10378 | + &mut out, |
| 10379 | + ); | ||
| 10380 | + } else { | ||
| 10381 | + mc::predict_scaled( | ||
| 10382 | + &refplane.data, | ||
| 10383 | + refplane.width, | ||
| 10384 | + refplane.true_width, | ||
| 10385 | + refplane.true_height, | ||
| 10386 | + mv_to_q4(x, mv.1, luma), | ||
| 10387 | + mv_to_q4(y, mv.0, luma), | ||
| 10388 | + x_scale_fp, | ||
| 10389 | + w, | ||
| 10390 | + h, | ||
| 10391 | + h_kind, | ||
| 10392 | + v_kind, | ||
| 10393 | + &mut out, | ||
| 10394 | + ); | ||
| 10395 | + } | ||
| 10306 | out | 10396 | out |
| 10307 | } | 10397 | } |
| 10308 | 10398 | ||
| @@ -10463,6 +10553,12 @@ fn obmc_blend( | |||
| 10463 | ref_v: &PlaneBuf, | 10553 | ref_v: &PlaneBuf, |
| 10464 | other_refs: &RefSlots, | 10554 | other_refs: &RefSlots, |
| 10465 | interp_fixed: Option<mc::InterpFilterKind>, | 10555 | interp_fixed: Option<mc::InterpFilterKind>, |
| 10556 | + // lane-scaledref r1: this frame's own coded luma width -- each OBMC | ||
| 10557 | + // neighbour is re-predicted against ITS OWN reference, which may be | ||
| 10558 | + // scaled differently from this block's (spec 7.11.3.3 / libaom | ||
| 10559 | + // `av1_setup_build_prediction_by_above_pred` passing that ref's own | ||
| 10560 | + // `scale_factors`). | ||
| 10561 | + frame_width: usize, | ||
| 10466 | pred_y: &mut [u16], | 10562 | pred_y: &mut [u16], |
| 10467 | pred_u: &mut [u16], | 10563 | pred_u: &mut [u16], |
| 10468 | pred_v: &mut [u16], | 10564 | pred_v: &mut [u16], |
| @@ -10478,6 +10574,11 @@ fn obmc_blend( | |||
| 10478 | }; | 10574 | }; |
| 10479 | let overlap_above = write_h / 2; | 10575 | let overlap_above = write_h / 2; |
| 10480 | let overlap_left = write_w / 2; | 10576 | let overlap_left = write_w / 2; |
| 10577 | + // lane-inter8 r1 / lane-scaledref r1: `av1_skip_u4x4_pred_in_obmc` | ||
| 10578 | + // (`reconinter.c` 820, `DISABLE_CHROMA_U8X8_OBMC == 0` -- "one-sided | ||
| 10579 | + // obmc") returns `dir == 0` when the chroma plane's own block is | ||
| 10580 | + // BLOCK_4X4/8X4/4X8 (an 8x8, 16x8 or 8x16 luma block at 4:2:0): the | ||
| 10581 | + // ABOVE pass skips chroma entirely, the LEFT pass still blends it. | ||
| 10481 | let skip_chroma_above = matches!((write_w, write_h), (8, 8) | (16, 8) | (8, 16)); | 10582 | let skip_chroma_above = matches!((write_w, write_h), (8, 8) | (16, 8) | (8, 16)); |
| 10482 | 10583 | ||
| 10483 | for (off4, span4, nb) in overlappable_above(grid, mi_row, mi_col, bw4, mi_cols, max_nb(bw4)) | 10584 | for (off4, span4, nb) in overlappable_above(grid, mi_row, mi_col, bw4, mi_cols, max_nb(bw4)) |
| @@ -10491,20 +10592,15 @@ fn obmc_blend( | |||
| 10491 | neighbours.above_filter[mi_col + off4], | 10592 | neighbours.above_filter[mi_col + off4], |
| 10492 | ); | 10593 | ); |
| 10493 | let (ny, nu, nv) = ref_planes(nb.ref_frame, ref_y, ref_u, ref_v, other_refs)?; | 10594 | let (ny, nu, nv) = ref_planes(nb.ref_frame, ref_y, ref_u, ref_v, other_refs)?; |
| 10595 | + let nb_scale = mc::scale_factor(ny.width, frame_width); | ||
| 10494 | let (bw, bh, ox) = (span4 * 4, overlap_above, off4 * 4); | 10596 | let (bw, bh, ox) = (span4 * 4, overlap_above, off4 * 4); |
| 10495 | - let tmp_y = obmc_neighbour_pred(ny, px + ox, py, nb.mv, bw, bh, true, h_kind, v_kind); | 10597 | + let tmp_y = obmc_neighbour_pred(ny, px + ox, py, nb.mv, bw, bh, true, h_kind, v_kind, nb_scale); |
| 10496 | obmc_blend_v(pred_y, side, ox, 0, bw, bh, &tmp_y); | 10598 | obmc_blend_v(pred_y, side, ox, 0, bw, bh, &tmp_y); |
| 10497 | - // lane-inter8 r1: `av1_skip_u4x4_pred_in_obmc` (`reconinter.c` 820, | ||
| 10498 | - // `DISABLE_CHROMA_U8X8_OBMC == 0` -- "one-sided obmc"): when the | ||
| 10499 | - // chroma plane's own block size is BLOCK_4X4/8X4/4X8 (a 8x8, 16x8 or | ||
| 10500 | - // 8x16 luma block at 4:2:0), the ABOVE pass skips chroma entirely | ||
| 10501 | - // while the LEFT pass still blends it. Blending chroma here as well | ||
| 10502 | - // would both mis-predict every 8x8 leaf and ask for an overlap of 2. | ||
| 10503 | if !skip_chroma_above { | 10599 | if !skip_chroma_above { |
| 10504 | let (cbw, cbh, cox) = (bw / 2, overlap_above / 2, ox / 2); | 10600 | let (cbw, cbh, cox) = (bw / 2, overlap_above / 2, ox / 2); |
| 10505 | - let tmp_u = obmc_neighbour_pred(nu, cpx + cox, cpy, nb.mv, cbw, cbh, false, h_kind, v_kind); | 10601 | + let tmp_u = obmc_neighbour_pred(nu, cpx + cox, cpy, nb.mv, cbw, cbh, false, h_kind, v_kind, nb_scale); |
| 10506 | obmc_blend_v(pred_u, chroma_side, cox, 0, cbw, cbh, &tmp_u); | 10602 | obmc_blend_v(pred_u, chroma_side, cox, 0, cbw, cbh, &tmp_u); |
| 10507 | - let tmp_v = obmc_neighbour_pred(nv, cpx + cox, cpy, nb.mv, cbw, cbh, false, h_kind, v_kind); | 10603 | + let tmp_v = obmc_neighbour_pred(nv, cpx + cox, cpy, nb.mv, cbw, cbh, false, h_kind, v_kind, nb_scale); |
| 10508 | obmc_blend_v(pred_v, chroma_side, cox, 0, cbw, cbh, &tmp_v); | 10604 | obmc_blend_v(pred_v, chroma_side, cox, 0, cbw, cbh, &tmp_v); |
| 10509 | } | 10605 | } |
| 10510 | } | 10606 | } |
| @@ -10515,13 +10611,14 @@ fn obmc_blend( | |||
| 10515 | neighbours.left_filter[mi_row + off4], | 10611 | neighbours.left_filter[mi_row + off4], |
| 10516 | ); | 10612 | ); |
| 10517 | let (ny, nu, nv) = ref_planes(nb.ref_frame, ref_y, ref_u, ref_v, other_refs)?; | 10613 | let (ny, nu, nv) = ref_planes(nb.ref_frame, ref_y, ref_u, ref_v, other_refs)?; |
| 10614 | + let nb_scale = mc::scale_factor(ny.width, frame_width); | ||
| 10518 | let (bw, bh, oy) = (overlap_left, span4 * 4, off4 * 4); | 10615 | let (bw, bh, oy) = (overlap_left, span4 * 4, off4 * 4); |
| 10519 | - let tmp_y = obmc_neighbour_pred(ny, px, py + oy, nb.mv, bw, bh, true, h_kind, v_kind); | 10616 | + let tmp_y = obmc_neighbour_pred(ny, px, py + oy, nb.mv, bw, bh, true, h_kind, v_kind, nb_scale); |
| 10520 | obmc_blend_h(pred_y, side, 0, oy, bw, bh, &tmp_y); | 10617 | obmc_blend_h(pred_y, side, 0, oy, bw, bh, &tmp_y); |
| 10521 | let (cbw, cbh, coy) = (overlap_left / 2, bh / 2, oy / 2); | 10618 | let (cbw, cbh, coy) = (overlap_left / 2, bh / 2, oy / 2); |
| 10522 | - let tmp_u = obmc_neighbour_pred(nu, cpx, cpy + coy, nb.mv, cbw, cbh, false, h_kind, v_kind); | 10619 | + let tmp_u = obmc_neighbour_pred(nu, cpx, cpy + coy, nb.mv, cbw, cbh, false, h_kind, v_kind, nb_scale); |
| 10523 | obmc_blend_h(pred_u, chroma_side, 0, coy, cbw, cbh, &tmp_u); | 10620 | obmc_blend_h(pred_u, chroma_side, 0, coy, cbw, cbh, &tmp_u); |
| 10524 | - let tmp_v = obmc_neighbour_pred(nv, cpx, cpy + coy, nb.mv, cbw, cbh, false, h_kind, v_kind); | 10621 | + let tmp_v = obmc_neighbour_pred(nv, cpx, cpy + coy, nb.mv, cbw, cbh, false, h_kind, v_kind, nb_scale); |
| 10525 | obmc_blend_h(pred_v, chroma_side, 0, coy, cbw, cbh, &tmp_v); | 10622 | obmc_blend_h(pred_v, chroma_side, 0, coy, cbw, cbh, &tmp_v); |
| 10526 | } | 10623 | } |
| 10527 | Ok(()) | 10624 | Ok(()) |
| @@ -11592,14 +11689,23 @@ fn decode_inter_block( | |||
| 11592 | ); | 11689 | ); |
| 11593 | block_filter = resolved_filter; | 11690 | block_filter = resolved_filter; |
| 11594 | 11691 | ||
| 11595 | - // lane-superres r9: a scaled reference in a COMPOUND_REFERENCE | 11692 | + // lane-scaledref r1: each compound tap scales INDEPENDENTLY off |
| 11596 | - // block (either tap) is not wired -- mc::predict_compound_intermediate | 11693 | + // its own stored reference's luma width (spec 7.11.3.3 derives |
| 11597 | - // has no scaled counterpart yet -- refuse by name rather than | 11694 | + // x_scale_fp per reference; libaom `av1_setup_pre_planes` builds |
| 11598 | - // silently sample it unscaled. | 11695 | + // one `scale_factors` per `ref_frame`), so the two taps can carry |
| 11599 | - if py0.width != frame_width || py1.width != frame_width { | 11696 | + // different ratios in the same block. `REF_NO_SCALE` reduces |
| 11600 | - return Err(unsupported( | 11697 | + // `predict_compound_intermediate`'s walk to the ordinary |
| 11601 | - "a compound-reference block with a scaled reference (superres, unimplemented)", | 11698 | + // stride-1 one, so the unscaled case is unchanged. |
| 11602 | - )); | 11699 | + let scale0 = mc::scale_factor(py0.width, frame_width); |
| 11700 | + let scale1 = mc::scale_factor(py1.width, frame_width); | ||
| 11701 | + if scale0 != mc::REF_NO_SCALE || scale1 != mc::REF_NO_SCALE { | ||
| 11702 | + SCALED_COMPOUND_HITS.with(|c| c.set(c.get() + 1)); | ||
| 11703 | + } | ||
| 11704 | + // lane-scaledref r2: the MIXED case -- one tap scaled, the other | ||
| 11705 | + // not -- is the one an all-frames-scaled recipe never produces, | ||
| 11706 | + // and the one a single shared scale factor would get wrong. | ||
| 11707 | + if (scale0 == mc::REF_NO_SCALE) != (scale1 == mc::REF_NO_SCALE) { | ||
| 11708 | + MIXED_SCALE_COMPOUND_HITS.with(|c| c.set(c.get() + 1)); | ||
| 11603 | } | 11709 | } |
| 11604 | 11710 | ||
| 11605 | let mut inter0_y = vec![0i32; side * side]; | 11711 | let mut inter0_y = vec![0i32; side * side]; |
| @@ -11610,6 +11716,7 @@ fn decode_inter_block( | |||
| 11610 | py0.true_height, | 11716 | py0.true_height, |
| 11611 | mv_to_q4(px, mv0.1, true), | 11717 | mv_to_q4(px, mv0.1, true), |
| 11612 | mv_to_q4(py, mv0.0, true), | 11718 | mv_to_q4(py, mv0.0, true), |
| 11719 | + scale0, | ||
| 11613 | side, | 11720 | side, |
| 11614 | side, | 11721 | side, |
| 11615 | h_filter, | 11722 | h_filter, |
| @@ -11634,6 +11741,7 @@ fn decode_inter_block( | |||
| 11634 | py1.true_height, | 11741 | py1.true_height, |
| 11635 | mv_to_q4(px, mv1.1, true), | 11742 | mv_to_q4(px, mv1.1, true), |
| 11636 | mv_to_q4(py, mv1.0, true), | 11743 | mv_to_q4(py, mv1.0, true), |
| 11744 | + scale1, | ||
| 11637 | side, | 11745 | side, |
| 11638 | side, | 11746 | side, |
| 11639 | h_filter, | 11747 | h_filter, |
| @@ -11679,6 +11787,7 @@ fn decode_inter_block( | |||
| 11679 | pu0.true_height, | 11787 | pu0.true_height, |
| 11680 | mv_to_q4(cpx, mv0.1, false), | 11788 | mv_to_q4(cpx, mv0.1, false), |
| 11681 | mv_to_q4(cpy, mv0.0, false), | 11789 | mv_to_q4(cpy, mv0.0, false), |
| 11790 | + scale0, | ||
| 11682 | chroma_side, | 11791 | chroma_side, |
| 11683 | chroma_side, | 11792 | chroma_side, |
| 11684 | h_filter, | 11793 | h_filter, |
| @@ -11705,6 +11814,7 @@ fn decode_inter_block( | |||
| 11705 | pu1.true_height, | 11814 | pu1.true_height, |
| 11706 | mv_to_q4(cpx, mv1.1, false), | 11815 | mv_to_q4(cpx, mv1.1, false), |
| 11707 | mv_to_q4(cpy, mv1.0, false), | 11816 | mv_to_q4(cpy, mv1.0, false), |
| 11817 | + scale1, | ||
| 11708 | chroma_side, | 11818 | chroma_side, |
| 11709 | chroma_side, | 11819 | chroma_side, |
| 11710 | h_filter, | 11820 | h_filter, |
| @@ -11747,6 +11857,7 @@ fn decode_inter_block( | |||
| 11747 | pv0.true_height, | 11857 | pv0.true_height, |
| 11748 | mv_to_q4(cpx, mv0.1, false), | 11858 | mv_to_q4(cpx, mv0.1, false), |
| 11749 | mv_to_q4(cpy, mv0.0, false), | 11859 | mv_to_q4(cpy, mv0.0, false), |
| 11860 | + scale0, | ||
| 11750 | chroma_side, | 11861 | chroma_side, |
| 11751 | chroma_side, | 11862 | chroma_side, |
| 11752 | h_filter, | 11863 | h_filter, |
| @@ -11773,6 +11884,7 @@ fn decode_inter_block( | |||
| 11773 | pv1.true_height, | 11884 | pv1.true_height, |
| 11774 | mv_to_q4(cpx, mv1.1, false), | 11885 | mv_to_q4(cpx, mv1.1, false), |
| 11775 | mv_to_q4(cpy, mv1.0, false), | 11886 | mv_to_q4(cpy, mv1.0, false), |
| 11887 | + scale1, | ||
| 11776 | chroma_side, | 11888 | chroma_side, |
| 11777 | chroma_side, | 11889 | chroma_side, |
| 11778 | h_filter, | 11890 | h_filter, |
| @@ -12233,8 +12345,27 @@ fn decode_inter_block( | |||
| 12233 | // `motion_mode_allowed` reads the 3-symbol `motion_mode_cdf` | 12345 | // `motion_mode_allowed` reads the 3-symbol `motion_mode_cdf` |
| 12234 | // instead of the 2-symbol `obmc_cdf` exactly when | 12346 | // instead of the 2-symbol `obmc_cdf` exactly when |
| 12235 | // `num_proj_ref >= 1` under `allow_warped_motion`. | 12347 | // `num_proj_ref >= 1` under `allow_warped_motion`. |
| 12348 | + // lane-scaledref r2: libaom `motion_mode_allowed` | ||
| 12349 | + // (`blockd.h:1484`) requires | ||
| 12350 | + // `!av1_is_scaled(block_ref_scale_factors[0])` for | ||
| 12351 | + // WARPED_CAUSAL -- under a scaled reference (superres) the | ||
| 12352 | + // block reads the 2-symbol `obmc_cdf`, never the 3-symbol | ||
| 12353 | + // `motion_mode_cdf`. Reading the wrong alphabet here narrows | ||
| 12354 | + // the arithmetic coder by the wrong amount and predicts the | ||
| 12355 | + // rest of the tile off a diverged state: it was silently | ||
| 12356 | + // wrong pixels (r1's `--enable-warped-motion=1` superres | ||
| 12357 | + // mismatch), not a desync error. | ||
| 12358 | + let ref_is_scaled = | ||
| 12359 | + mc::scale_factor(py_ref.width, frame_width) != mc::REF_NO_SCALE; | ||
| 12236 | let warp_eligible = allow_warped_motion | 12360 | let warp_eligible = allow_warped_motion |
| 12361 | + && !ref_is_scaled | ||
| 12237 | && num_proj_ref(grid, mi_row, mi_col, bw4, bh4, mi_cols as usize, mi_rows as usize, ref_frame) >= 1; | 12362 | && num_proj_ref(grid, mi_row, mi_col, bw4, bh4, mi_cols as usize, mi_rows as usize, ref_frame) >= 1; |
| 12363 | + if allow_warped_motion | ||
| 12364 | + && ref_is_scaled | ||
| 12365 | + && num_proj_ref(grid, mi_row, mi_col, bw4, bh4, mi_cols as usize, mi_rows as usize, ref_frame) >= 1 | ||
| 12366 | + { | ||
| 12367 | + SCALED_WARP_SUPPRESSED_HITS.with(|c| c.set(c.get() + 1)); | ||
| 12368 | + } | ||
| 12238 | if warp_eligible { | 12369 | if warp_eligible { |
| 12239 | let mode = dec.symbol(&mut cdfs.motion_mode[bsize_idx]); | 12370 | let mode = dec.symbol(&mut cdfs.motion_mode[bsize_idx]); |
| 12240 | match mode { | 12371 | match mode { |
| @@ -12414,12 +12545,29 @@ fn decode_inter_block( | |||
| 12414 | // (warp_params/obmc_selected/interintra_mode are all resolved by | 12545 | // (warp_params/obmc_selected/interintra_mode are all resolved by |
| 12415 | // this point, every symbol for this block already read). | 12546 | // this point, every symbol for this block already read). |
| 12416 | let luma_scale = mc::scale_factor(py_ref.width, frame_width); | 12547 | let luma_scale = mc::scale_factor(py_ref.width, frame_width); |
| 12417 | - if luma_scale != mc::REF_NO_SCALE | 12548 | + if luma_scale != mc::REF_NO_SCALE { |
| 12418 | - && (warp_params.is_some() || obmc_selected || interintra_mode.is_some()) | 12549 | + // lane-scaledref r1: libaom `allow_warp` |
| 12419 | - { | 12550 | + // (av1/common/reconinter.c:41) suppresses BOTH local and |
| 12420 | - return Err(unsupported( | 12551 | + // global warp under a scaled reference and predicts |
| 12421 | - "warp/OBMC/interintra prediction with a scaled reference (superres, unimplemented)", | 12552 | + // translationally instead -- that fallback is implemented |
| 12422 | - )); | 12553 | + // below, but the one real aomenc stream this round found |
| 12554 | + // that reaches it (`--enable-warped-motion=1`, | ||
| 12555 | + // `--superres-denominator=16`, seed 47) still mismatches | ||
| 12556 | + // ffmpeg at frame 2 luma, so the case stays refused by name | ||
| 12557 | + // until it has a green gate rather than shipping wrong | ||
| 12558 | + // pixels behind a lifted refusal. | ||
| 12559 | + if warp_params.is_some() { | ||
| 12560 | + SCALED_WARP_FALLBACK_HITS.with(|c| c.set(c.get() + 1)); | ||
| 12561 | + return Err(unsupported( | ||
| 12562 | + "warp prediction with a scaled reference (superres, unimplemented)", | ||
| 12563 | + )); | ||
| 12564 | + } | ||
| 12565 | + if obmc_selected { | ||
| 12566 | + SCALED_OBMC_HITS.with(|c| c.set(c.get() + 1)); | ||
| 12567 | + } | ||
| 12568 | + if interintra_mode.is_some() { | ||
| 12569 | + SCALED_INTERINTRA_HITS.with(|c| c.set(c.get() + 1)); | ||
| 12570 | + } | ||
| 12423 | } | 12571 | } |
| 12424 | 12572 | ||
| 12425 | let mut pred_y = vec![0u16; side * side]; | 12573 | let mut pred_y = vec![0u16; side * side]; |
| @@ -12510,7 +12658,13 @@ fn decode_inter_block( | |||
| 12510 | ); | 12658 | ); |
| 12511 | } | 12659 | } |
| 12512 | 12660 | ||
| 12513 | - if let Some(params) = &warp_params { | 12661 | + // lane-scaledref r1: libaom `allow_warp` (av1/common/reconinter.c:41) |
| 12662 | + // opens with `if (av1_is_scaled(sf)) return 0;` -- BOTH local | ||
| 12663 | + // (`wm_params`) and global warp fall back to the translational | ||
| 12664 | + // prediction above when the reference is scaled, even though the | ||
| 12665 | + // motion_mode symbol was still read and warp_params still | ||
| 12666 | + // resolved. Suppress the warp, keep every symbol read. | ||
| 12667 | + if let Some(params) = warp_params.as_ref().filter(|_| luma_scale == mc::REF_NO_SCALE) { | ||
| 12514 | crate::warp::warp_affine( | 12668 | crate::warp::warp_affine( |
| 12515 | params, &py_ref.data, py_ref.true_width as i32, py_ref.true_height as i32, | 12669 | params, &py_ref.data, py_ref.true_width as i32, py_ref.true_height as i32, |
| 12516 | py_ref.width as i32, &mut pred_y, px as i32, py as i32, side as i32, | 12670 | py_ref.width as i32, &mut pred_y, px as i32, py as i32, side as i32, |
| @@ -12551,6 +12705,7 @@ fn decode_inter_block( | |||
| 12551 | ref_v, | 12705 | ref_v, |
| 12552 | other_refs, | 12706 | other_refs, |
| 12553 | interp_fixed, | 12707 | interp_fixed, |
| 12708 | + frame_width, | ||
| 12554 | &mut pred_y, | 12709 | &mut pred_y, |
| 12555 | &mut pred_u, | 12710 | &mut pred_u, |
| 12556 | &mut pred_v, | 12711 | &mut pred_v, |
| @@ -13125,6 +13280,11 @@ fn decode_inter_block8( | |||
| 13125 | // mode contexts AND the number of `drl_mode` bits read (class parsed | 13280 | // mode contexts AND the number of `drl_mode` bits read (class parsed |
| 13126 | // then discarded). | 13281 | // then discarded). |
| 13127 | tpl_frame: Option<&TplFrameArgs>, | 13282 | tpl_frame: Option<&TplFrameArgs>, |
| 13283 | + // lane-scaledref r1: this frame's own coded luma width (spec 7.11.3.3), | ||
| 13284 | + // for the scaled-reference MC this leaf's own single-ref/compound/OBMC | ||
| 13285 | + // predictions take when a stored reference was coded at another width | ||
| 13286 | + // (`use_superres`) -- mirrors [`decode_inter_block`]'s own param. | ||
| 13287 | + frame_width: usize, | ||
| 13128 | ) -> Result<(bool, bool, bool, Option<(i8, i8, u8, u8)>, (i8, Option<i8>))> { | 13288 | ) -> Result<(bool, bool, bool, Option<(i8, i8, u8, u8)>, (i8, Option<i8>))> { |
| 13129 | const LAST_FRAME: i8 = 1; | 13289 | const LAST_FRAME: i8 = 1; |
| 13130 | let gm_table = build_gm_mv_table( | 13290 | let gm_table = build_gm_mv_table( |
| @@ -13434,6 +13594,12 @@ fn decode_inter_block8( | |||
| 13434 | 13594 | ||
| 13435 | let (py0, pu0, pv0) = ref_planes(ref0, ref_y, ref_u, ref_v, other_refs)?; | 13595 | let (py0, pu0, pv0) = ref_planes(ref0, ref_y, ref_u, ref_v, other_refs)?; |
| 13436 | let (py1, pu1, pv1) = ref_planes(ref1, ref_y, ref_u, ref_v, other_refs)?; | 13596 | let (py1, pu1, pv1) = ref_planes(ref1, ref_y, ref_u, ref_v, other_refs)?; |
| 13597 | + let scale0 = mc::scale_factor(py0.width, frame_width); | ||
| 13598 | + let scale1 = mc::scale_factor(py1.width, frame_width); | ||
| 13599 | + if scale0 != mc::REF_NO_SCALE || scale1 != mc::REF_NO_SCALE { | ||
| 13600 | + SCALED_COMPOUND_HITS.with(|c| c.set(c.get() + 1)); | ||
| 13601 | + SCALED_BLOCK8_HITS.with(|c| c.set(c.get() + 1)); | ||
| 13602 | + } | ||
| 13437 | 13603 | ||
| 13438 | for dr in 0..2 { | 13604 | for dr in 0..2 { |
| 13439 | for dc in 0..2 { | 13605 | for dc in 0..2 { |
| @@ -13470,6 +13636,7 @@ fn decode_inter_block8( | |||
| 13470 | py0.true_height, | 13636 | py0.true_height, |
| 13471 | mv_to_q4(px, mv0.1, true), | 13637 | mv_to_q4(px, mv0.1, true), |
| 13472 | mv_to_q4(py, mv0.0, true), | 13638 | mv_to_q4(py, mv0.0, true), |
| 13639 | + scale0, | ||
| 13473 | SIDE, | 13640 | SIDE, |
| 13474 | SIDE, | 13641 | SIDE, |
| 13475 | Regular, | 13642 | Regular, |
| @@ -13484,6 +13651,7 @@ fn decode_inter_block8( | |||
| 13484 | py1.true_height, | 13651 | py1.true_height, |
| 13485 | mv_to_q4(px, mv1.1, true), | 13652 | mv_to_q4(px, mv1.1, true), |
| 13486 | mv_to_q4(py, mv1.0, true), | 13653 | mv_to_q4(py, mv1.0, true), |
| 13654 | + scale1, | ||
| 13487 | SIDE, | 13655 | SIDE, |
| 13488 | SIDE, | 13656 | SIDE, |
| 13489 | Regular, | 13657 | Regular, |
| @@ -13515,6 +13683,7 @@ fn decode_inter_block8( | |||
| 13515 | pu0.true_height, | 13683 | pu0.true_height, |
| 13516 | mv_to_q4(cpx, mv0.1, false), | 13684 | mv_to_q4(cpx, mv0.1, false), |
| 13517 | mv_to_q4(cpy, mv0.0, false), | 13685 | mv_to_q4(cpy, mv0.0, false), |
| 13686 | + scale0, | ||
| 13518 | CHROMA_SIDE, | 13687 | CHROMA_SIDE, |
| 13519 | CHROMA_SIDE, | 13688 | CHROMA_SIDE, |
| 13520 | Regular, | 13689 | Regular, |
| @@ -13529,6 +13698,7 @@ fn decode_inter_block8( | |||
| 13529 | pu1.true_height, | 13698 | pu1.true_height, |
| 13530 | mv_to_q4(cpx, mv1.1, false), | 13699 | mv_to_q4(cpx, mv1.1, false), |
| 13531 | mv_to_q4(cpy, mv1.0, false), | 13700 | mv_to_q4(cpy, mv1.0, false), |
| 13701 | + scale1, | ||
| 13532 | CHROMA_SIDE, | 13702 | CHROMA_SIDE, |
| 13533 | CHROMA_SIDE, | 13703 | CHROMA_SIDE, |
| 13534 | Regular, | 13704 | Regular, |
| @@ -13559,6 +13729,7 @@ fn decode_inter_block8( | |||
| 13559 | pv0.true_height, | 13729 | pv0.true_height, |
| 13560 | mv_to_q4(cpx, mv0.1, false), | 13730 | mv_to_q4(cpx, mv0.1, false), |
| 13561 | mv_to_q4(cpy, mv0.0, false), | 13731 | mv_to_q4(cpy, mv0.0, false), |
| 13732 | + scale0, | ||
| 13562 | CHROMA_SIDE, | 13733 | CHROMA_SIDE, |
| 13563 | CHROMA_SIDE, | 13734 | CHROMA_SIDE, |
| 13564 | Regular, | 13735 | Regular, |
| @@ -13573,6 +13744,7 @@ fn decode_inter_block8( | |||
| 13573 | pv1.true_height, | 13744 | pv1.true_height, |
| 13574 | mv_to_q4(cpx, mv1.1, false), | 13745 | mv_to_q4(cpx, mv1.1, false), |
| 13575 | mv_to_q4(cpy, mv1.0, false), | 13746 | mv_to_q4(cpy, mv1.0, false), |
| 13747 | + scale1, | ||
| 13576 | CHROMA_SIDE, | 13748 | CHROMA_SIDE, |
| 13577 | CHROMA_SIDE, | 13749 | CHROMA_SIDE, |
| 13578 | Regular, | 13750 | Regular, |
| @@ -13827,6 +13999,12 @@ fn decode_inter_block8( | |||
| 13827 | // lane-warp round 1: same 3-vs-2-symbol split as the 16x16+ leaf | 13999 | // lane-warp round 1: same 3-vs-2-symbol split as the 16x16+ leaf |
| 13828 | // (see its own doc) -- this leaf is always `LAST_FRAME`-only | 14000 | // (see its own doc) -- this leaf is always `LAST_FRAME`-only |
| 13829 | // (grid.set below hardcodes it). | 14001 | // (grid.set below hardcodes it). |
| 14002 | + // lane-scaledref r2 sibling of the 16x16+ leaf's fix: libaom | ||
| 14003 | + // drops WARPED_CAUSAL eligibility (so this reads `obmc_cdf`) | ||
| 14004 | + // when the reference is scaled. Not gated here because an 8x8 | ||
| 14005 | + // leaf under a scaled reference is refused before this function | ||
| 14006 | + // runs (see the block8 refusal below, ~12500) -- whoever lifts | ||
| 14007 | + // that refusal must add `&& !ref_is_scaled` here too. | ||
| 13830 | let warp_eligible = allow_warped_motion | 14008 | let warp_eligible = allow_warped_motion |
| 13831 | && num_proj_ref(grid, mi_row, mi_col, 2, 2, mi_cols as usize, mi_rows as usize, LAST_FRAME) >= 1; | 14009 | && num_proj_ref(grid, mi_row, mi_col, 2, 2, mi_cols as usize, mi_rows as usize, LAST_FRAME) >= 1; |
| 13832 | if warp_eligible { | 14010 | if warp_eligible { |
| @@ -13880,42 +14058,51 @@ fn decode_inter_block8( | |||
| 13880 | } | 14058 | } |
| 13881 | mode_for_tx = 0; | 14059 | mode_for_tx = 0; |
| 13882 | 14060 | ||
| 14061 | + // lane-scaledref r1: this leaf's own prediction is always `Regular` | ||
| 14062 | + // (documented corner-cut above); under a scaled reference the same | ||
| 14063 | + // fixed kernel runs through spec 7.11.3.3's scaled walk instead. | ||
| 14064 | + let luma_scale = mc::scale_factor(ref_y.width, frame_width); | ||
| 14065 | + if luma_scale != mc::REF_NO_SCALE { | ||
| 14066 | + SCALED_BLOCK8_HITS.with(|c| c.set(c.get() + 1)); | ||
| 14067 | + } | ||
| 13883 | let mut pred_y = vec![0u16; SIDE * SIDE]; | 14068 | let mut pred_y = vec![0u16; SIDE * SIDE]; |
| 13884 | - mc::predict( | ||
| 13885 | - &ref_y.data, | ||
| 13886 | - ref_y.width, | ||
| 13887 | - ref_y.true_width, | ||
| 13888 | - ref_y.true_height, | ||
| 13889 | - mv_to_q4(px, mv.1, true), | ||
| 13890 | - mv_to_q4(py, mv.0, true), | ||
| 13891 | - SIDE, | ||
| 13892 | - SIDE, | ||
| 13893 | - &mut pred_y, | ||
| 13894 | - ); | ||
| 13895 | let mut pred_u = vec![0u16; CHROMA_SIDE * CHROMA_SIDE]; | 14069 | let mut pred_u = vec![0u16; CHROMA_SIDE * CHROMA_SIDE]; |
| 13896 | - mc::predict( | ||
| 13897 | - &ref_u.data, | ||
| 13898 | - ref_u.width, | ||
| 13899 | - ref_u.true_width, | ||
| 13900 | - ref_u.true_height, | ||
| 13901 | - mv_to_q4(cpx, mv.1, false), | ||
| 13902 | - mv_to_q4(cpy, mv.0, false), | ||
| 13903 | - CHROMA_SIDE, | ||
| 13904 | - CHROMA_SIDE, | ||
| 13905 | - &mut pred_u, | ||
| 13906 | - ); | ||
| 13907 | let mut pred_v = vec![0u16; CHROMA_SIDE * CHROMA_SIDE]; | 14070 | let mut pred_v = vec![0u16; CHROMA_SIDE * CHROMA_SIDE]; |
| 13908 | - mc::predict( | 14071 | + for (plane, x, y, dim, dst) in [ |
| 13909 | - &ref_v.data, | 14072 | + (ref_y, px, py, SIDE, &mut pred_y), |
| 13910 | - ref_v.width, | 14073 | + (ref_u, cpx, cpy, CHROMA_SIDE, &mut pred_u), |
| 13911 | - ref_v.true_width, | 14074 | + (ref_v, cpx, cpy, CHROMA_SIDE, &mut pred_v), |
| 13912 | - ref_v.true_height, | 14075 | + ] { |
| 13913 | - mv_to_q4(cpx, mv.1, false), | 14076 | + let luma = std::ptr::eq(plane, ref_y); |
| 13914 | - mv_to_q4(cpy, mv.0, false), | 14077 | + if luma_scale == mc::REF_NO_SCALE { |
| 13915 | - CHROMA_SIDE, | 14078 | + mc::predict( |
| 13916 | - CHROMA_SIDE, | 14079 | + &plane.data, |
| 13917 | - &mut pred_v, | 14080 | + plane.width, |
| 13918 | - ); | 14081 | + plane.true_width, |
| 14082 | + plane.true_height, | ||
| 14083 | + mv_to_q4(x, mv.1, luma), | ||
| 14084 | + mv_to_q4(y, mv.0, luma), | ||
| 14085 | + dim, | ||
| 14086 | + dim, | ||
| 14087 | + dst, | ||
| 14088 | + ); | ||
| 14089 | + } else { | ||
| 14090 | + mc::predict_scaled( | ||
| 14091 | + &plane.data, | ||
| 14092 | + plane.width, | ||
| 14093 | + plane.true_width, | ||
| 14094 | + plane.true_height, | ||
| 14095 | + mv_to_q4(x, mv.1, luma), | ||
| 14096 | + mv_to_q4(y, mv.0, luma), | ||
| 14097 | + luma_scale, | ||
| 14098 | + dim, | ||
| 14099 | + dim, | ||
| 14100 | + mc::InterpFilterKind::Regular, | ||
| 14101 | + mc::InterpFilterKind::Regular, | ||
| 14102 | + dst, | ||
| 14103 | + ); | ||
| 14104 | + } | ||
| 14105 | + } | ||
| 13919 | 14106 | ||
| 13920 | if obmc_selected { | 14107 | if obmc_selected { |
| 13921 | obmc_blend( | 14108 | obmc_blend( |
| @@ -13940,6 +14127,7 @@ fn decode_inter_block8( | |||
| 13940 | ref_v, | 14127 | ref_v, |
| 13941 | other_refs, | 14128 | other_refs, |
| 13942 | interp_fixed, | 14129 | interp_fixed, |
| 14130 | + frame_width, | ||
| 13943 | &mut pred_y, | 14131 | &mut pred_y, |
| 13944 | &mut pred_u, | 14132 | &mut pred_u, |
| 13945 | &mut pred_v, | 14133 | &mut pred_v, |
| @@ -14989,15 +15177,23 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 14989 | .map(|i| (mi_row0 + (i / 2) * 2, mi_col0 + (i % 2) * 2)) | 15177 | .map(|i| (mi_row0 + (i / 2) * 2, mi_col0 + (i % 2) * 2)) |
| 14990 | .filter(|&(mr, mc)| mr < mi_rows && mc < mi_cols) | 15178 | .filter(|&(mr, mc)| mr < mi_rows && mc < mi_cols) |
| 14991 | .collect(); | 15179 | .collect(); |
| 14992 | - // lane-superres r9: decode_inter_block8's own | 15180 | + // lane-scaledref r1: `decode_inter_block8` IS |
| 14993 | - // MC (below) is not threaded for a scaled | 15181 | + // threaded for a scaled reference now (its |
| 14994 | - // reference (unlike decode_inter_block's 19 | 15182 | + // single-ref, compound and OBMC MC all take |
| 14995 | - // sites) -- refuse the whole 8x8-leaf split | 15183 | + // spec 7.11.3.3's scaled walk), but the one |
| 14996 | - // up front when ANY live reference this leaf | 15184 | + // recipe that reaches this path at all -- a |
| 14997 | - // could pick has a different width than this | 15185 | + // 64x72 superres fixture whose bottom 16-row |
| 14998 | - // frame, rather than thread frame_width | 15186 | + // band straddles the true edge, so the |
| 14999 | - // through its own single-ref/compound MC | 15187 | + // gathered split bit lands on 8x8 leaves -- |
| 15000 | - // calls to reach the same block this round. | 15188 | + // DESYNCS inside the leaf itself |
| 15189 | + // (`from_switchable_symbol` handed a 4th | ||
| 15190 | + // symbol, mc.rs:200), the same | ||
| 15191 | + // below-8x8 desync lane-sub8 r2 left open and | ||
| 15192 | + // unrelated to scaling. So the scaled MC here | ||
| 15193 | + // is unproven: refuse by name rather than | ||
| 15194 | + // ship a capability claim no gate exercises. | ||
| 15195 | + // Deleting these six lines is the whole lift | ||
| 15196 | + // once the leaf8 desync is fixed. | ||
| 15001 | if ref_y.width != frame_width as usize | 15197 | if ref_y.width != frame_width as usize |
| 15002 | || ref_slots.iter().flatten().any(|(py, _, _)| { | 15198 | || ref_slots.iter().flatten().any(|(py, _, _)| { |
| 15003 | py.width != frame_width as usize | 15199 | py.width != frame_width as usize |
| @@ -15058,6 +15254,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 15058 | &sign_bias_table, | 15254 | &sign_bias_table, |
| 15059 | &global_motion, | 15255 | &global_motion, |
| 15060 | tpl_frame.as_ref(), | 15256 | tpl_frame.as_ref(), |
| 15257 | + frame_width as usize, | ||
| 15061 | )?; | 15258 | )?; |
| 15062 | prev_leaves.push((leaf_mi, skip, is_inter, leaf_refs.0, leaf_refs.1)); | 15259 | prev_leaves.push((leaf_mi, skip, is_inter, leaf_refs.0, leaf_refs.1)); |
| 15063 | last_skip_mode = skip_mode_leaf; | 15260 | last_skip_mode = skip_mode_leaf; |
crates/ec-av1/src/mc.rsmodified+80 -43
| @@ -476,6 +476,54 @@ fn round_pow2_signed_64(value: i64, shift: u32) -> i64 { | |||
| 476 | } | 476 | } |
| 477 | } | 477 | } |
| 478 | 478 | ||
| 479 | +/// Spec 7.11.3.3's horizontal pass on a (possibly) scaled reference, shared | ||
| 480 | +/// by [`predict_scaled`] and [`predict_compound_intermediate`] -- the two | ||
| 481 | +/// differ only in their VERTICAL rounding ([`INTER_ROUND_1`] vs | ||
| 482 | +/// [`INTER_ROUND_1_COMPOUND`]), never here. Each output column walks the | ||
| 483 | +/// reference by `x_step_qn` (the Q14 scale rounded down to the Q10 | ||
| 484 | +/// `SCALE_SUBPEL_BITS` grid) and picks its own filter phase from the low | ||
| 485 | +/// bits, so `x_scale_fp == REF_NO_SCALE` reduces to the ordinary stride-1 | ||
| 486 | +/// whole-pel walk with one fixed phase (pinned by | ||
| 487 | +/// `predict_scaled_at_no_scale_matches_predict_with_filters`). | ||
| 488 | +#[allow(clippy::too_many_arguments)] | ||
| 489 | +fn horizontal_scaled_pass( | ||
| 490 | + reference: &[u16], | ||
| 491 | + stride: usize, | ||
| 492 | + true_width: usize, | ||
| 493 | + true_height: usize, | ||
| 494 | + x_q4: i32, | ||
| 495 | + y0: i32, | ||
| 496 | + x_scale_fp: i64, | ||
| 497 | + block_w: usize, | ||
| 498 | + rows: usize, | ||
| 499 | + h_kind: InterpFilterKind, | ||
| 500 | + intermediate: &mut [i32], | ||
| 501 | +) { | ||
| 502 | + let x_step_qn = round_pow2_64(x_scale_fp, 4); | ||
| 503 | + let off = (x_scale_fp - REF_NO_SCALE) * 8; | ||
| 504 | + let pos_x_q10 = round_pow2_signed_64(x_q4 as i64 * x_scale_fp + off, 8) + 32; | ||
| 505 | + let (h_wide, h_narrow) = h_kind.tables(); | ||
| 506 | + for c in 0..block_w { | ||
| 507 | + let x_qn = pos_x_q10 + c as i64 * x_step_qn; | ||
| 508 | + let int_pel = (x_qn >> 10) as i32; | ||
| 509 | + let filter_idx = ((x_qn & 1023) >> 6) as usize; | ||
| 510 | + let h_filter = if block_w <= 4 { | ||
| 511 | + &h_narrow[filter_idx] | ||
| 512 | + } else { | ||
| 513 | + &h_wide[filter_idx] | ||
| 514 | + }; | ||
| 515 | + for r in 0..rows { | ||
| 516 | + let y = y0 - 3 + r as i32; | ||
| 517 | + let mut sum = 0; | ||
| 518 | + for (t, &tap) in h_filter.iter().enumerate() { | ||
| 519 | + let x = int_pel + t as i32 - 3; | ||
| 520 | + sum += tap * sample(reference, stride, true_width, true_height, x, y); | ||
| 521 | + } | ||
| 522 | + intermediate[r * block_w + c] = round2(sum, INTER_ROUND_0); | ||
| 523 | + } | ||
| 524 | + } | ||
| 525 | +} | ||
| 526 | + | ||
| 479 | /// [`predict_with_filters`]'s scaled-reference counterpart (spec 7.11.3.3): | 527 | /// [`predict_with_filters`]'s scaled-reference counterpart (spec 7.11.3.3): |
| 480 | /// used only when the stored reference's luma width differs from the current | 528 | /// used only when the stored reference's luma width differs from the current |
| 481 | /// frame's (`use_superres` on a non-key frame). `x_scale_fp` is | 529 | /// frame's (`use_superres` on a non-key frame). `x_scale_fp` is |
| @@ -516,11 +564,6 @@ pub fn predict_scaled( | |||
| 516 | // SCALE_SUBPEL_BITS == 10: x_step_qn is x_scale_fp (Q14) rounded down to | 564 | // SCALE_SUBPEL_BITS == 10: x_step_qn is x_scale_fp (Q14) rounded down to |
| 517 | // Q10; off/pos_x_q10 fold the block's own x_q4 (Q4) into that same Q10 | 565 | // Q10; off/pos_x_q10 fold the block's own x_q4 (Q4) into that same Q10 |
| 518 | // grid (spec 7.11.3.3's `dec_calc_subpel_params`). | 566 | // grid (spec 7.11.3.3's `dec_calc_subpel_params`). |
| 519 | - let x_step_qn = round_pow2_64(x_scale_fp, 4); | ||
| 520 | - let off = (x_scale_fp - REF_NO_SCALE) * 8; | ||
| 521 | - let pos_x_q10 = round_pow2_signed_64(x_q4 as i64 * x_scale_fp + off, 8) + 32; | ||
| 522 | - | ||
| 523 | - let (h_wide, h_narrow) = h_kind.tables(); | ||
| 524 | let (v_wide, v_narrow) = v_kind.tables(); | 567 | let (v_wide, v_narrow) = v_kind.tables(); |
| 525 | let v_filter = if block_h <= 4 { | 568 | let v_filter = if block_h <= 4 { |
| 526 | &v_narrow[yfrac] | 569 | &v_narrow[yfrac] |
| @@ -530,25 +573,19 @@ pub fn predict_scaled( | |||
| 530 | 573 | ||
| 531 | let rows = block_h + 7; | 574 | let rows = block_h + 7; |
| 532 | let mut intermediate = vec![0i32; rows * block_w]; | 575 | let mut intermediate = vec![0i32; rows * block_w]; |
| 533 | - for c in 0..block_w { | 576 | + horizontal_scaled_pass( |
| 534 | - let x_qn = pos_x_q10 + c as i64 * x_step_qn; | 577 | + reference, |
| 535 | - let int_pel = (x_qn >> 10) as i32; | 578 | + stride, |
| 536 | - let filter_idx = ((x_qn & 1023) >> 6) as usize; | 579 | + true_width, |
| 537 | - let h_filter = if block_w <= 4 { | 580 | + true_height, |
| 538 | - &h_narrow[filter_idx] | 581 | + x_q4, |
| 539 | - } else { | 582 | + y0, |
| 540 | - &h_wide[filter_idx] | 583 | + x_scale_fp, |
| 541 | - }; | 584 | + block_w, |
| 542 | - for r in 0..rows { | 585 | + rows, |
| 543 | - let y = y0 - 3 + r as i32; | 586 | + h_kind, |
| 544 | - let mut sum = 0; | 587 | + &mut intermediate, |
| 545 | - for (t, &tap) in h_filter.iter().enumerate() { | 588 | + ); |
| 546 | - let x = int_pel + t as i32 - 3; | ||
| 547 | - sum += tap * sample(reference, stride, true_width, true_height, x, y); | ||
| 548 | - } | ||
| 549 | - intermediate[r * block_w + c] = round2(sum, INTER_ROUND_0); | ||
| 550 | - } | ||
| 551 | - } | ||
| 552 | 589 | ||
| 553 | for row in 0..block_h { | 590 | for row in 0..block_h { |
| 554 | for col in 0..block_w { | 591 | for col in 0..block_w { |
| @@ -602,6 +639,7 @@ pub fn predict_compound_intermediate( | |||
| 602 | true_height: usize, | 639 | true_height: usize, |
| 603 | x_q4: i32, | 640 | x_q4: i32, |
| 604 | y_q4: i32, | 641 | y_q4: i32, |
| 642 | + x_scale_fp: i64, | ||
| 605 | block_w: usize, | 643 | block_w: usize, |
| 606 | block_h: usize, | 644 | block_h: usize, |
| 607 | h_kind: InterpFilterKind, | 645 | h_kind: InterpFilterKind, |
| @@ -612,18 +650,14 @@ pub fn predict_compound_intermediate( | |||
| 612 | assert!(!reference.is_empty(), "a reference plane has samples"); | 650 | assert!(!reference.is_empty(), "a reference plane has samples"); |
| 613 | INTER_PRED_HITS.with(|c| c.set(c.get() + 1)); | 651 | INTER_PRED_HITS.with(|c| c.set(c.get() + 1)); |
| 614 | 652 | ||
| 615 | - let x0 = x_q4.div_euclid(16); | 653 | + if x_scale_fp != REF_NO_SCALE { |
| 616 | - let xfrac = x_q4.rem_euclid(16) as usize; | 654 | + PREDICT_SCALED_HITS.with(|c| c.set(c.get() + 1)); |
| 655 | + } | ||
| 656 | + | ||
| 617 | let y0 = y_q4.div_euclid(16); | 657 | let y0 = y_q4.div_euclid(16); |
| 618 | let yfrac = y_q4.rem_euclid(16) as usize; | 658 | let yfrac = y_q4.rem_euclid(16) as usize; |
| 619 | 659 | ||
| 620 | - let (h_wide, h_narrow) = h_kind.tables(); | ||
| 621 | let (v_wide, v_narrow) = v_kind.tables(); | 660 | let (v_wide, v_narrow) = v_kind.tables(); |
| 622 | - let h_filter = if block_w <= 4 { | ||
| 623 | - &h_narrow[xfrac] | ||
| 624 | - } else { | ||
| 625 | - &h_wide[xfrac] | ||
| 626 | - }; | ||
| 627 | let v_filter = if block_h <= 4 { | 661 | let v_filter = if block_h <= 4 { |
| 628 | &v_narrow[yfrac] | 662 | &v_narrow[yfrac] |
| 629 | } else { | 663 | } else { |
| @@ -632,17 +666,19 @@ pub fn predict_compound_intermediate( | |||
| 632 | 666 | ||
| 633 | let rows = block_h + 7; | 667 | let rows = block_h + 7; |
| 634 | let mut intermediate = vec![0i32; rows * block_w]; | 668 | let mut intermediate = vec![0i32; rows * block_w]; |
| 635 | - for r in 0..rows { | 669 | + horizontal_scaled_pass( |
| 636 | - let y = y0 - 3 + r as i32; | 670 | + reference, |
| 637 | - for c in 0..block_w { | 671 | + stride, |
| 638 | - let mut sum = 0; | 672 | + true_width, |
| 639 | - for (t, &tap) in h_filter.iter().enumerate() { | 673 | + true_height, |
| 640 | - let x = x0 + c as i32 + t as i32 - 3; | 674 | + x_q4, |
| 641 | - sum += tap * sample(reference, stride, true_width, true_height, x, y); | 675 | + y0, |
| 642 | - } | 676 | + x_scale_fp, |
| 643 | - intermediate[r * block_w + c] = round2(sum, INTER_ROUND_0); | 677 | + block_w, |
| 644 | - } | 678 | + rows, |
| 645 | - } | 679 | + h_kind, |
| 680 | + &mut intermediate, | ||
| 681 | + ); | ||
| 646 | 682 | ||
| 647 | for row in 0..block_h { | 683 | for row in 0..block_h { |
| 648 | for col in 0..block_w { | 684 | for col in 0..block_w { |
| @@ -775,6 +811,7 @@ fn compound_intermediate_whole_pel_identity_round_trips_through_combine() { | |||
| 775 | 16, | 811 | 16, |
| 776 | 0, | 812 | 0, |
| 777 | 0, | 813 | 0, |
| 814 | + REF_NO_SCALE, | ||
| 778 | 4, | 815 | 4, |
| 779 | 4, | 816 | 4, |
| 780 | InterpFilterKind::Regular, | 817 | InterpFilterKind::Regular, |
crates/ec-av1/src/refusal_inventory.rsmodified+1 -2
| @@ -74,8 +74,7 @@ const REFUSALS: &[&str] = &[ | |||
| 74 | "an intra mode this decoder does not code (round 2)", | 74 | "an intra mode this decoder does not code (round 2)", |
| 75 | "an intra-coded HORZ/VERT strip needs rectangular intra prediction this decoder does not code yet", | 75 | "an intra-coded HORZ/VERT strip needs rectangular intra prediction this decoder does not code yet", |
| 76 | "filter intra on a HORZ/VERT strip (this decoder predicts square-only)", | 76 | "filter intra on a HORZ/VERT strip (this decoder predicts square-only)", |
| 77 | - "a compound-reference block with a scaled reference (superres, unimplemented)", | 77 | + "warp prediction with a scaled reference (superres, unimplemented)", |
| 78 | - "warp/OBMC/interintra prediction with a scaled reference (superres, unimplemented)", | ||
| 79 | "an 8x8 partition leaf under a scaled reference (superres, unimplemented)", | 78 | "an 8x8 partition leaf under a scaled reference (superres, unimplemented)", |
| 80 | ]; | 79 | ]; |
| 81 | 80 | ||
crates/ec-av1/src/stream.rsmodified+236 -0
| @@ -6613,6 +6613,242 @@ mod tests { | |||
| 6613 | ); | 6613 | ); |
| 6614 | } | 6614 | } |
| 6615 | 6615 | ||
| 6616 | + /// lane-scaledref r1: a real aomenc `--superres-mode=1` sequence with | ||
| 6617 | + /// compound, OBMC, interintra and 8x8 leaves ALL enabled must decode | ||
| 6618 | + /// pixel-exact -- these are the combinations the three | ||
| 6619 | + /// "... with a scaled reference (superres, unimplemented)" refusals used | ||
| 6620 | + /// to cover. Each combination gets its OWN hard-asserted hit counter | ||
| 6621 | + /// (`crate::decode::scaled_*_hits`), because an unscaled reference would | ||
| 6622 | + /// pass the pixels and prove nothing (class `gate-blind-to-feature`), and | ||
| 6623 | + /// a stream that scales but never takes compound/OBMC/interintra/8x8 | ||
| 6624 | + /// would prove nothing about the code this round adds either. A refusal | ||
| 6625 | + /// naming a scaled reference is a hard failure: those are exactly the | ||
| 6626 | + /// strings this round lifts. Other named capabilities skip that seed. | ||
| 6627 | + #[test] | ||
| 6628 | + fn a_real_aomenc_superres_stream_with_compound_obmc_and_interintra_decodes_pixel_exact() | ||
| 6629 | + { | ||
| 6630 | + const NAME: &str = "a_real_aomenc_superres_stream_with_compound_obmc_and_interintra_decodes_pixel_exact"; | ||
| 6631 | + let _gate_lock = lock_gate_counters(); | ||
| 6632 | + if !have_ffmpeg() { | ||
| 6633 | + eprintln!("SKIP {NAME}: no ffmpeg"); | ||
| 6634 | + return; | ||
| 6635 | + } | ||
| 6636 | + if !have_aomenc() { | ||
| 6637 | + eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); | ||
| 6638 | + return; | ||
| 6639 | + } | ||
| 6640 | + let (width, height, frame_count) = (64usize, 64usize, 24usize); | ||
| 6641 | + let mut named_refusals = 0u32; | ||
| 6642 | + let mut matched = 0u32; | ||
| 6643 | + let n_attempts: u32 = std::env::var("EC_SCALEDREF_GATE_ATTEMPTS") | ||
| 6644 | + .ok() | ||
| 6645 | + .and_then(|s| s.parse().ok()) | ||
| 6646 | + .unwrap_or(12); | ||
| 6647 | + for attempt in 0..n_attempts { | ||
| 6648 | + let seed = 42 + attempt; | ||
| 6649 | + let duration = frame_count as f64 / 25.0; | ||
| 6650 | + let source = | ||
| 6651 | + gradients_source(seed, width, height, &format!("duration={duration}:rate=25")); | ||
| 6652 | + let y4m = Command::new("ffmpeg") | ||
| 6653 | + .args([ | ||
| 6654 | + "-v", "error", "-f", "lavfi", "-i", &source, "-pix_fmt", "yuv420p", "-f", | ||
| 6655 | + "yuv4mpegpipe", "-", | ||
| 6656 | + ]) | ||
| 6657 | + .stdin(Stdio::null()) | ||
| 6658 | + .stdout(Stdio::piped()) | ||
| 6659 | + .stderr(Stdio::piped()) | ||
| 6660 | + .output() | ||
| 6661 | + .expect("ffmpeg failed to run"); | ||
| 6662 | + assert!( | ||
| 6663 | + y4m.status.success(), | ||
| 6664 | + "ffmpeg fixture: {}", | ||
| 6665 | + String::from_utf8_lossy(&y4m.stderr) | ||
| 6666 | + ); | ||
| 6667 | + let on = |name: &str| { | ||
| 6668 | + if std::env::var(name).as_deref() == Ok("0") { "0" } else { "1" } | ||
| 6669 | + }; | ||
| 6670 | + // lane-scaledref r2: warp is ON. A warp-capable frame header | ||
| 6671 | + // under a scaled reference is exactly the case r1 got wrong | ||
| 6672 | + // (the block must read the 2-symbol `obmc_cdf`, not the | ||
| 6673 | + // 3-symbol `motion_mode_cdf` -- libaom `motion_mode_allowed`, | ||
| 6674 | + // blockd.h:1484), and it decoded silently wrong pixels rather | ||
| 6675 | + // than refusing. `EC_SCALEDREF_WARP=0` turns it off for | ||
| 6676 | + // bisecting only. | ||
| 6677 | + let warp = format!("--enable-warped-motion={}", on("EC_SCALEDREF_WARP")); | ||
| 6678 | + // lane-scaledref r2: `EC_SCALEDREF_MODE=3` (qthresh) lets | ||
| 6679 | + // superres switch on and off per frame, so a compound block can | ||
| 6680 | + // reference one scaled and one unscaled reference -- the mixed | ||
| 6681 | + // case mode 1 (every frame scaled) never produces. | ||
| 6682 | + let superres_mode = format!( | ||
| 6683 | + "--superres-mode={}", | ||
| 6684 | + std::env::var("EC_SCALEDREF_MODE").unwrap_or_else(|_| "1".into()) | ||
| 6685 | + ); | ||
| 6686 | + let obmc = format!("--enable-obmc={}", on("EC_SCALEDREF_OBMC")); | ||
| 6687 | + let interintra = format!("--enable-interintra-comp={}", on("EC_SCALEDREF_II")); | ||
| 6688 | + let lag = format!( | ||
| 6689 | + "--lag-in-frames={}", | ||
| 6690 | + if on("EC_SCALEDREF_COMP") == "0" { "0" } else { "25" } | ||
| 6691 | + ); | ||
| 6692 | + let alt_ref = format!("--auto-alt-ref={}", on("EC_SCALEDREF_COMP")); | ||
| 6693 | + let args: Vec<&str> = vec![ | ||
| 6694 | + "--codec=av1", | ||
| 6695 | + "--passes=1", | ||
| 6696 | + "--end-usage=q", | ||
| 6697 | + "--cq-level=45", | ||
| 6698 | + "--cpu-used=0", | ||
| 6699 | + "--kf-max-dist=1000", | ||
| 6700 | + "--threads=1", | ||
| 6701 | + "--row-mt=0", | ||
| 6702 | + "--sb-size=64", | ||
| 6703 | + // superres on every frame, key and inter alike -- the scaled | ||
| 6704 | + // reference this gate is about. | ||
| 6705 | + // denominator 16 (the maximum) keeps the CODED frame | ||
| 6706 | + // 32x64 -- a multiple of 16 both ways, so no frame-edge | ||
| 6707 | + // 16x16 straddle forces a sub-16x16 partition this decoder | ||
| 6708 | + // still refuses on the aligned path ("an inter partition | ||
| 6709 | + // below 16x16"). Denominator 12 codes 43 columns and every | ||
| 6710 | + // seed refused there. | ||
| 6711 | + &superres_mode, | ||
| 6712 | + "--superres-denominator=16", | ||
| 6713 | + "--superres-kf-denominator=16", | ||
| 6714 | + // the four combinations this round lifts (each switchable | ||
| 6715 | + // by env for bisecting a mismatch without a rebuild) | ||
| 6716 | + &alt_ref, | ||
| 6717 | + &lag, | ||
| 6718 | + "--enable-order-hint=1", | ||
| 6719 | + &warp, | ||
| 6720 | + &obmc, | ||
| 6721 | + &interintra, | ||
| 6722 | + "--enable-smooth-interintra=1", | ||
| 6723 | + "--enable-interintra-wedge=0", | ||
| 6724 | + "--enable-masked-comp=0", | ||
| 6725 | + "--enable-onesided-comp=0", | ||
| 6726 | + "--enable-fwd-kf=0", | ||
| 6727 | + "--tune-content=default", | ||
| 6728 | + "--max-partition-size=32", | ||
| 6729 | + "--min-partition-size=32", | ||
| 6730 | + // everything this decoder still refuses under any reference | ||
| 6731 | + "--enable-rect-partitions=0", | ||
| 6732 | + "--enable-ab-partitions=0", | ||
| 6733 | + "--enable-1to4-partitions=0", | ||
| 6734 | + "--enable-filter-intra=0", | ||
| 6735 | + "--enable-smooth-intra=0", | ||
| 6736 | + "--enable-paeth-intra=0", | ||
| 6737 | + "--enable-directional-intra=0", | ||
| 6738 | + "--enable-angle-delta=0", | ||
| 6739 | + "--enable-tx-size-search=0", | ||
| 6740 | + "--enable-cdef=0", | ||
| 6741 | + "--enable-restoration=0", | ||
| 6742 | + "--enable-palette=0", | ||
| 6743 | + "--enable-intrabc=0", | ||
| 6744 | + "--enable-cfl-intra=0", | ||
| 6745 | + "--enable-ref-frame-mvs=0", | ||
| 6746 | + "--obu", | ||
| 6747 | + "-o", | ||
| 6748 | + "-", | ||
| 6749 | + "-", | ||
| 6750 | + ]; | ||
| 6751 | + let mut child = Command::new(aomenc_path()) | ||
| 6752 | + .args(&args) | ||
| 6753 | + .stdin(Stdio::piped()) | ||
| 6754 | + .stdout(Stdio::piped()) | ||
| 6755 | + .stderr(Stdio::piped()) | ||
| 6756 | + .spawn() | ||
| 6757 | + .expect("aomenc failed to start"); | ||
| 6758 | + child | ||
| 6759 | + .stdin | ||
| 6760 | + .take() | ||
| 6761 | + .expect("aomenc stdin") | ||
| 6762 | + .write_all(&y4m.stdout) | ||
| 6763 | + .expect("writing y4m to aomenc"); | ||
| 6764 | + let out = child.wait_with_output().expect("aomenc failed to run"); | ||
| 6765 | + assert!( | ||
| 6766 | + out.status.success(), | ||
| 6767 | + "aomenc refused the fixture: {}", | ||
| 6768 | + String::from_utf8_lossy(&out.stderr) | ||
| 6769 | + ); | ||
| 6770 | + let stream = out.stdout; | ||
| 6771 | + let frames = match decode_stream(&stream) { | ||
| 6772 | + Err(e) => { | ||
| 6773 | + let msg = e.to_string(); | ||
| 6774 | + assert!( | ||
| 6775 | + msg.contains("unsupported"), | ||
| 6776 | + "{NAME} failed outright, not a named refusal (seed {seed}): {msg}" | ||
| 6777 | + ); | ||
| 6778 | + assert!( | ||
| 6779 | + !msg.contains("scaled reference"), | ||
| 6780 | + "{NAME} refused on a scaled reference (seed {seed}) -- those refusals \ | ||
| 6781 | + are exactly what this round lifts: {msg}" | ||
| 6782 | + ); | ||
| 6783 | + named_refusals += 1; | ||
| 6784 | + eprintln!("seed {seed} refusal (other capability): {msg}"); | ||
| 6785 | + continue; | ||
| 6786 | + } | ||
| 6787 | + Ok(frames) => frames, | ||
| 6788 | + }; | ||
| 6789 | + let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); | ||
| 6790 | + assert_eq!(frames.len(), frame_count); | ||
| 6791 | + if let Ok(path) = std::env::var("EC_AV1_GATE_DUMP") { | ||
| 6792 | + let mismatched = frames | ||
| 6793 | + .iter() | ||
| 6794 | + .zip(&ffmpeg_frames) | ||
| 6795 | + .any(|(got, want)| got.y != want.y || got.u != want.u || got.v != want.v); | ||
| 6796 | + if mismatched { | ||
| 6797 | + std::fs::write(&path, &stream).expect("writing pinned stream"); | ||
| 6798 | + eprintln!("EC_AV1_GATE_DUMP: wrote mismatching stream (seed {seed}) to {path}"); | ||
| 6799 | + } | ||
| 6800 | + } | ||
| 6801 | + for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() { | ||
| 6802 | + assert_eq!(got.y, want.y, "{NAME} frame {i} luma vs ffmpeg (seed {seed})"); | ||
| 6803 | + assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); | ||
| 6804 | + assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); | ||
| 6805 | + } | ||
| 6806 | + matched += 1; | ||
| 6807 | + } | ||
| 6808 | + eprintln!( | ||
| 6809 | + "{NAME}: {named_refusals} other-capability refusals, {matched}/{n_attempts} pixel-exact, \ | ||
| 6810 | + superres_hits={} predict_scaled_hits={} scaled_compound={} scaled_warp_fallback={} \ | ||
| 6811 | + scaled_obmc={} scaled_interintra={} scaled_block8={} scaled_warp_suppressed={} mixed_scale_compound={}", | ||
| 6812 | + crate::superres::superres_hits(), | ||
| 6813 | + crate::mc::predict_scaled_hits(), | ||
| 6814 | + crate::decode::scaled_compound_hits(), | ||
| 6815 | + crate::decode::scaled_warp_fallback_hits(), | ||
| 6816 | + crate::decode::scaled_obmc_hits(), | ||
| 6817 | + crate::decode::scaled_interintra_hits(), | ||
| 6818 | + crate::decode::scaled_block8_hits(), | ||
| 6819 | + crate::decode::scaled_warp_suppressed_hits(), | ||
| 6820 | + crate::decode::mixed_scale_compound_hits(), | ||
| 6821 | + ); | ||
| 6822 | + assert!( | ||
| 6823 | + matched > 0, | ||
| 6824 | + "{NAME}: every attempt refused on other capabilities; the gate proves nothing" | ||
| 6825 | + ); | ||
| 6826 | + assert!( | ||
| 6827 | + crate::mc::predict_scaled_hits() > 0, | ||
| 6828 | + "{NAME}: matched but zero predict_scaled_hits -- no block took the scaled MC path" | ||
| 6829 | + ); | ||
| 6830 | + // The 8x8 leaf is NOT asserted here: it stays refused (no recipe | ||
| 6831 | + // produced an 8x8 inter leaf at all), so its counter is a | ||
| 6832 | + // diagnostic only -- see this gate's own doc and decode.rs. | ||
| 6833 | + // `scaled_warp_suppressed` IS asserted: it counts the blocks whose | ||
| 6834 | + // WARPED_CAUSAL eligibility libaom drops because the reference is | ||
| 6835 | + // scaled, i.e. the blocks that must read `obmc_cdf`. Zero of them | ||
| 6836 | + // would mean this gate's `--enable-warped-motion=1` never reached a | ||
| 6837 | + // warp-eligible block and proves nothing about r2's fix. | ||
| 6838 | + assert!( | ||
| 6839 | + crate::decode::scaled_warp_suppressed_hits() > 0, | ||
| 6840 | + "{NAME}: {matched} matches but no block had its warp eligibility \ | ||
| 6841 | + suppressed by a scaled reference -- the warp arm proves nothing" | ||
| 6842 | + ); | ||
| 6843 | + for (hits, what) in [ | ||
| 6844 | + (crate::decode::scaled_compound_hits(), "compound with a scaled reference"), | ||
| 6845 | + (crate::decode::scaled_obmc_hits(), "OBMC with a scaled reference"), | ||
| 6846 | + (crate::decode::scaled_interintra_hits(), "interintra with a scaled reference"), | ||
| 6847 | + ] { | ||
| 6848 | + assert!(hits > 0, "{NAME}: {matched} matches but zero blocks took {what}"); | ||
| 6849 | + } | ||
| 6850 | + } | ||
| 6851 | + | ||
| 6616 | /// lane-wii r2: `--enable-interintra-wedge=1` streams must DECODE | 6852 | /// lane-wii r2: `--enable-interintra-wedge=1` streams must DECODE |
| 6617 | /// pixel-exact -- the wedge-interintra syntax (adapting `wedge_index` | 6853 | /// pixel-exact -- the wedge-interintra syntax (adapting `wedge_index` |
| 6618 | /// CDF symbol, fixed sign 0) and the wedge mask blend are ported over | 6854 | /// CDF symbol, fixed sign 0) and the wedge mask blend are ported over |
lanes/scaledref-r1.report.mdadded+115 -0
| @@ -0,0 +1,115 @@ | |||
| 1 | +# lane-scaledref r1 — scaled-reference (superres) MC beyond single-ref, plus the Golomb tail | ||
| 2 | + | ||
| 3 | +Branch `lane-scaledref`, off main `3808cf8`. Round 1 continues the previous | ||
| 4 | +builder's uncommitted state (preserved as `95b3e70`) — that snapshot is | ||
| 5 | +verified, gated and kept; everything below r1 adds is on top of it. | ||
| 6 | + | ||
| 7 | +## What changed | ||
| 8 | + | ||
| 9 | +| path:line | why | | ||
| 10 | +| --- | --- | | ||
| 11 | +| `crates/ec-av1/src/mc.rs:474` `horizontal_scaled_pass` | spec 7.11.3.3's horizontal walk factored out of `predict_scaled` and given to `predict_compound_intermediate` (new `x_scale_fp` param), so each compound tap scales off its OWN reference's luma width | | ||
| 12 | +| `crates/ec-av1/src/decode.rs` (compound branch, ~9470) | the "compound-reference block with a scaled reference" refusal replaced by two independent `mc::scale_factor` values threaded into all 6 compound MC calls (Y/U/V x 2 taps) | | ||
| 13 | +| `crates/ec-av1/src/decode.rs` `obmc_neighbour_pred` / `obmc_blend` | each OBMC neighbour is re-predicted through the scaled walk against **its own** reference's scale (`frame_width` threaded in) | | ||
| 14 | +| `crates/ec-av1/src/decode.rs` (~10170) | warp under a scaled reference: libaom `allow_warp` (reconinter.c:41) suppresses local AND global warp and predicts translationally; that suppression is implemented, but the case is still refused by name (see residue) | | ||
| 15 | +| `crates/ec-av1/src/decode.rs` `decode_inter_block8` | single-ref/compound/OBMC MC of the 8x8 leaf threaded for a scaled reference (`frame_width` param) | | ||
| 16 | +| `crates/ec-av1/src/decode.rs` `read_golomb` (~1349) | **r1**: lift implemented, then REVERTED (`abec872`) -- it exposed a hidden defect, see below. Only a comment recording the finding + repro remains | | ||
| 17 | +| `crates/ec-av1/src/decode.rs` `obmc_mask` + `obmc_blend` | **r1**: `obmc_mask_2 = {45,64}` added and one-sided chroma OBMC for an 8x8 luma block (`av1_skip_u4x4_pred_in_obmc`, reconinter.c:820, `DISABLE_CHROMA_U8X8_OBMC == 0` ⇒ chroma skipped in the ABOVE pass, kept in the LEFT pass). Before this, the first real 8x8 OBMC block hit `unreachable!` in `obmc_mask` | | ||
| 18 | +| `crates/ec-av1/src/stream.rs` | the gate below | | ||
| 19 | +| `crates/ec-av1/src/refusal_inventory.rs` | 2 refusal strings gone (compound-scaled; OBMC/interintra-scaled folded into a warp-only string); 47 → 45 | | ||
| 20 | + | ||
| 21 | +## Gates | ||
| 22 | + | ||
| 23 | +1. `stream::tests::a_real_aomenc_superres_stream_with_compound_obmc_and_interintra_decodes_pixel_exact` | ||
| 24 | + — real `aomenc --superres-mode=1 --superres-denominator=16 --superres-kf-denominator=16 | ||
| 25 | + --auto-alt-ref=1 --lag-in-frames=25 --enable-obmc=1 --enable-interintra-comp=1 | ||
| 26 | + --enable-smooth-interintra=1`, 12 seeds x 24 frames of 64x64 moving gradients, every SHOWN frame | ||
| 27 | + compared to ffmpeg (corrected in r2: `decode_stream` pushes a picture only under | ||
| 28 | + `show_frame`, stream.rs:711, and `ffmpeg -f obu` emits shown frames only -- a hidden | ||
| 29 | + alt-ref is checked only through propagation into the frames that reference it). | ||
| 30 | + Hard-asserts `mc::predict_scaled_hits() > 0` and the per-case counters | ||
| 31 | + `scaled_compound/scaled_obmc/scaled_interintra > 0`. | ||
| 32 | + | ||
| 33 | + `EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib a_real_aomenc_superres_stream_with_compound -- --nocapture` | ||
| 34 | + | ||
| 35 | + EVIDENCE: /tmp/.../scratchpad/gate1.log | aomenc superres d=16 + compound/OBMC/interintra, 12 seeds x 24 frames decoded and compared to ffmpeg | 12/12 pixel-exact, 0 refusals, superres_hits=291 predict_scaled_hits=3198 scaled_compound=500 scaled_obmc=9 scaled_interintra=1 | ||
| 36 | + | ||
| 37 | +2. (withdrawn) `decode::tests::golomb_tails_read_back_past_the_old_twenty_bit_cap` — written, passing, | ||
| 38 | + and reverted with the change it gated. See "The Golomb tail" below. | ||
| 39 | + | ||
| 40 | +## Refusals lifted (2) | ||
| 41 | + | ||
| 42 | +- "a compound-reference block with a scaled reference (superres, unimplemented)" — gate 1, 500 hits. | ||
| 43 | +- "warp/OBMC/interintra prediction with a scaled reference (superres, unimplemented)" — narrowed to | ||
| 44 | + "warp prediction with a scaled reference"; OBMC (9 hits) and interintra (1 hit) proven by gate 1. | ||
| 45 | + | ||
| 46 | +`refusal_inventory` and `gate_coverage` tests green. | ||
| 47 | + | ||
| 48 | +## The Golomb tail — a refusal that is masking a real defect (finding, fix-now for its owner) | ||
| 49 | + | ||
| 50 | +Implemented as charted (`ee1f980`): read up to 32 leading zeros (dav1d's `len < 32`) instead of | ||
| 51 | +erroring at 20, u64 accumulator, plus a round-trip gate over every prefix length 0..=31 through | ||
| 52 | +`tile::write_golomb`. Bit-identical for every tail an encoder writes — our own writer tops out at 19 | ||
| 53 | +leading zeros (`tile::MAX_LEVEL == MAX_BR_LEVEL + (1 << 19)`), and libaom errors long before. | ||
| 54 | + | ||
| 55 | +It still turned a green gate RED: | ||
| 56 | +`a_real_aomenc_stream_with_a_superblock_level_horz_vert_partition_decodes_pixel_exact` failed at | ||
| 57 | +**seed 67, frame 0 luma**. Bisected against main `3808cf8` and against the lane's own WIP `95b3e70` | ||
| 58 | +(both pass), and main's run prints, for that very seed: | ||
| 59 | +`seed 67 refusal: unsupported: AV1 tile (a Golomb tail longer than this decoder reads)`. | ||
| 60 | + | ||
| 61 | +So the cap is not a capability limit — it is the point where an intra rect64 stream that has ALREADY | ||
| 62 | +desynced first asks for something impossible (a key-frame coefficient level above `1 << 19`). | ||
| 63 | +Class `refusal-hides-a-defect`. Reverted in `abec872`; `d8788fb` records the finding, the repro and | ||
| 64 | +"lift this together with that defect's fix" at the cap itself. | ||
| 65 | + | ||
| 66 | +EVIDENCE: cargo test output, this report | ran the rect64 gate at 3808cf8 / 95b3e70 / lane HEAD with and without the lift | pass / pass / FAIL seed 67 frame 0 luma; main prints the Golomb refusal for seed 67 | ||
| 67 | + | ||
| 68 | +fix-now for the intra rect64 owner: encode that gate's seed-67 fixture, raise the cap locally, and | ||
| 69 | +bisect the first mismatching block — the long tail is a downstream symptom, not the defect. | ||
| 70 | + | ||
| 71 | +## Test scope actually run | ||
| 72 | + | ||
| 73 | +- `cargo test -p ec-av1 --lib a_real_aomenc_superres_stream_with_compound` → 1 passed, 0 failed. | ||
| 74 | +- `cargo test -p ec-av1 --lib a_real_aomenc_stream_with_a_superblock_level_horz_vert_partition_decodes` | ||
| 75 | + → 1 passed, 0 failed (this is the gate the Golomb lift turned red; green again after the revert). | ||
| 76 | +- `cargo test -p ec-av1 --lib refusal_inventory` → 3 passed; `... gate_coverage` → 2 passed. | ||
| 77 | +- `cargo test -p ec-av1 --lib golomb` → 3 passed (at ee1f980, before the revert). | ||
| 78 | +- `cargo test -p ec-av1 --lib` (whole crate lib suite, at the final tree): **268 passed, 0 failed, | ||
| 79 | + 23 ignored**, 928s. An earlier run of the same suite, taken with the Golomb cap raised, failed | ||
| 80 | + exactly one test -- the seed-67 rect64 gate above -- which is what put that finding on the board. | ||
| 81 | + | ||
| 82 | +## Residue | ||
| 83 | + | ||
| 84 | +- fix-now → **not** done, deferred: **warp under a scaled reference** stays refused. The libaom | ||
| 85 | + `allow_warp` fallback is implemented (warp suppressed, translational prediction used) but the | ||
| 86 | + previous builder's `--enable-warped-motion=1 --superres-denominator=16` seed-47 stream still | ||
| 87 | + mismatched ffmpeg at frame 2 luma. Shipping the lift would be wrong pixels behind a green name. | ||
| 88 | + deferred: warp+superres — unblocked by bisecting that stream (set `EC_SCALEDREF_WARP=1` on gate 1 | ||
| 89 | + to reproduce; `EC_AV1_GATE_DUMP=<path>` pins the mismatching stream). | ||
| 90 | +- deferred: **8x8 partition leaf under a scaled reference** — the leaf's MC *is* threaded for | ||
| 91 | + scaling, but no aomenc recipe produces a firing, decodable fixture. r1 measured this instead of | ||
| 92 | + assuming it: with `--min-partition-size=8` and a 64x**72** fixture (bottom 16-row band straddles | ||
| 93 | + the true edge, which is the only way this decoder reaches `decode_inter_block8`), aomenc does emit | ||
| 94 | + 8x8 leaves — and the decode **desyncs inside the leaf** (`from_switchable_symbol` handed a 4th | ||
| 95 | + symbol, mc.rs:200), which is the same below-8x8 desync lane-sub8 r2 left open and has nothing to do | ||
| 96 | + with scaling. Refusal restored with that fact in the comment; deleting those six lines is the whole | ||
| 97 | + lift once the leaf8 desync is fixed. — unblocked by the lane-sub8 leaf8 desync. | ||
| 98 | + That experiment did produce one real fix, kept: `obmc_mask(2)` + one-sided chroma OBMC (above). | ||
| 99 | +- deferred: **"a reference picture whose height does not match this frame's own true size"** — not | ||
| 100 | + attempted. Superres never scales height, so a height-mismatched reference can only come from | ||
| 101 | + `--resize-mode` (reference scaling in BOTH axes). That needs a vertical counterpart to | ||
| 102 | + `horizontal_scaled_pass` (per-row `y_step_qn`, `im_h` intermediate rows, libaom | ||
| 103 | + `convolve_2d_scale`) *and* a gate whose frame size changes mid-stream. — unblocked by a lane sized | ||
| 104 | + for resize-mode. | ||
| 105 | +- accepted: **10-bit not covered.** `Picture` planes are `Vec<u8>`; 10-bit input is refused before | ||
| 106 | + any of this code runs (see memory `his-av1-library-is-10-bit`, lane-hbd10). The 8/10-bit half of | ||
| 107 | + the charter's gate line is unreachable from this lane. | ||
| 108 | +- Reported conflict, not silently resolved (charter premise): the charter states the spec's `read_golomb` caps at 32 | ||
| 109 | + leading zeros. Locally verifiable sources disagree — libaom `read_golomb` (decodetxb.c:30) calls a | ||
| 110 | + 21st prefix bit a CORRUPT FRAME, which is exactly what the old refusal mirrored; dav1d reads up to | ||
| 111 | + 32. There is no AV1 spec copy on this box and the network is unreachable from the sandbox | ||
| 112 | + (`curl https://aomediacodec.github.io/av1-spec/av1-spec.html` timed out), so the change follows the | ||
| 113 | + permissive decoder (dav1d) and is bit-identical to the old reader for every tail any encoder writes. | ||
| 114 | +- Off the film path: neither of the user's two films uses superres (lane-hbd10), so nothing here moves | ||
| 115 | + their decode. The Golomb and OBMC-mask fixes are generic. | ||
lanes/scaledref-r2.report.mdadded+85 -0
| @@ -0,0 +1,85 @@ | |||
| 1 | +# lane-scaledref r2 — warp-capable frame under a scaled reference read the wrong motion_mode alphabet | ||
| 2 | + | ||
| 3 | +Branch `lane-scaledref` (HEAD back on the branch: the verifier left the worktree detached at | ||
| 4 | +a8111dd; `git checkout lane-scaledref` restored it, both were the same commit, no work lost). | ||
| 5 | + | ||
| 6 | +## Verifier finding 1 — ROOT CAUSE FOUND AND FIXED (no refusal needed) | ||
| 7 | + | ||
| 8 | +The verifier's premise was that "motion_mode symbol reading is unaffected; only the prediction | ||
| 9 | +falls back". That is **false**, and it is the whole defect. libaom | ||
| 10 | +`motion_mode_allowed` (oracle source `av1/common/blockd.h:1484-1487`): | ||
| 11 | + | ||
| 12 | +```c | ||
| 13 | + if (mbmi->num_proj_ref >= 1 && allow_warped_motion && | ||
| 14 | + !xd->cur_frame_force_integer_mv && | ||
| 15 | + !av1_is_scaled(xd->block_ref_scale_factors[0])) { | ||
| 16 | + return WARPED_CAUSAL; | ||
| 17 | + } | ||
| 18 | + return OBMC_CAUSAL; | ||
| 19 | +``` | ||
| 20 | + | ||
| 21 | +Under a scaled reference the block reads the **2-symbol `obmc_cdf`**, never the 3-symbol | ||
| 22 | +`motion_mode_cdf`. We read the 3-symbol one, which narrows the arithmetic decoder by the wrong | ||
| 23 | +amount: the decoded *value* happened to stay SIMPLE_TRANSLATION, so nothing ever errored — the | ||
| 24 | +stream decoded "OK: 24 frames" with quietly wrong pixels, exactly the silent-wrong-pixels class | ||
| 25 | +the verifier caught. The warp guard at decode.rs ~10197 could never see it: `warp_params` is | ||
| 26 | +`None` for those blocks (`warped=0` in EC_AV1_TRACE), so no fallback and no refusal ran. | ||
| 27 | + | ||
| 28 | +| path:line | why | | ||
| 29 | +| --- | --- | | ||
| 30 | +| `crates/ec-av1/src/decode.rs` ~10060 (`warp_eligible`) | `&& !ref_is_scaled` added (`mc::scale_factor(py_ref.width, frame_width) != REF_NO_SCALE`), libaom-exact; new `SCALED_WARP_SUPPRESSED_HITS` counts the blocks that take the `obmc_cdf` arm because of it | | ||
| 31 | +| `crates/ec-av1/src/decode.rs` ~630 | the counter + `scaled_warp_suppressed_hits()` / `mixed_scale_compound_hits()` accessors | | ||
| 32 | +| `crates/ec-av1/src/decode.rs` ~9515 | `MIXED_SCALE_COMPOUND_HITS`: compound blocks with exactly one scaled tap (diagnostic for finding 3) | | ||
| 33 | +| `crates/ec-av1/src/decode.rs` ~11455 (`decode_inter_block8`) | sibling site of the same shape, comment only: an 8x8 leaf under a scaled reference is refused before this code runs, so the same `&& !ref_is_scaled` is owed by whoever lifts that refusal | | ||
| 34 | +| `crates/ec-av1/src/stream.rs` (superres gate) | `--enable-warped-motion=1` is now the DEFAULT arm (`EC_SCALEDREF_WARP=0` only for bisecting), `--superres-mode` made settable (`EC_SCALEDREF_MODE`), and `scaled_warp_suppressed_hits() > 0` is hard-asserted so the warp arm cannot pass vacuously | | ||
| 35 | +| `crates/ec-av1/examples/decode_probe.rs` | `EC_PROBE_OUT=<path>` dumps the decoded planes as raw yuv420p — that is the instrument that located this defect (diff vs `ffmpeg -f obu`) | | ||
| 36 | +| `lanes/scaledref-r1.report.md` | finding 2, wording corrected (below) | | ||
| 37 | + | ||
| 38 | +Not changed, reported instead of silently fixed: libaom also requires `!cur_frame_force_integer_mv` | ||
| 39 | +in that same condition and our `warp_eligible` still omits it. Left alone this round — no gate | ||
| 40 | +covers `force_integer_mv` (screen content), and changing an alphabet choice without a gate is the | ||
| 41 | +mistake this round is fixing. deferred: force_integer_mv warp eligibility — unblocked by a | ||
| 42 | +screen-content gate with `cur_frame_force_integer_mv=1`. | ||
| 43 | + | ||
| 44 | +Refusals: **none lifted, none added**, 45 unchanged. `refusal_inventory` / `gate_coverage` | ||
| 45 | +untouched and green (see totals). The "warp prediction with a scaled reference" refusal stays: it | ||
| 46 | +now only guards a *global*-warp block under a scaled reference, which this recipe never produced | ||
| 47 | +(`scaled_warp_fallback=0`). | ||
| 48 | + | ||
| 49 | +EVIDENCE: /tmp/.../scratchpad/warp_superres.obu + ours2.yuv vs ff.yuv | EC_PROBE_OUT decode of the verifier's pinned stream, byte-compared to `ffmpeg -f obu -pix_fmt yuv420p -f rawvideo` | before: frames 1..23 differ (frame 1: 1342 luma + 370 chroma pixels, first at (2,26), max |d| 3, growing to 18 by frame 23); after the fix: `cmp` identical, 147456/147456 bytes | ||
| 50 | + | ||
| 51 | +EVIDENCE: gate run, this report | `EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib a_real_aomenc_superres_stream_with_compound -- --nocapture` (warp now on by default) | `0 other-capability refusals, 12/12 pixel-exact, superres_hits=291 predict_scaled_hits=3198 scaled_compound=500 scaled_warp_fallback=0 scaled_obmc=9 scaled_interintra=1 scaled_block8=0 scaled_warp_suppressed=25 mixed_scale_compound=0` — 25 blocks took the `obmc_cdf` arm only because of this fix | ||
| 52 | + | ||
| 53 | +## Verifier finding 2 — report correction (done) | ||
| 54 | + | ||
| 55 | +`lanes/scaledref-r1.report.md` line ~27 now reads "every SHOWN frame compared to ffmpeg ... a | ||
| 56 | +hidden alt-ref is checked only through propagation" (ledger already records | ||
| 57 | +`decode_stream` pushes only under `show_frame`, stream.rs:711). | ||
| 58 | + | ||
| 59 | +## Verifier finding 3 — mixed scaled/unscaled compound taps: DEFERRED, measured not assumed | ||
| 60 | + | ||
| 61 | +Counter `mixed_scale_compound` added and wired into the gate's print; both alternative recipes were | ||
| 62 | +run, neither yields a gateable stream: | ||
| 63 | + | ||
| 64 | +- `EC_SCALEDREF_MODE=3` (qthresh): aomenc never turns superres on for this content/q — | ||
| 65 | + `superres_hits=0 predict_scaled_hits=0`, i.e. the whole gate goes vacuous (it fails its own | ||
| 66 | + `predict_scaled_hits > 0` assert, which is the assert working). | ||
| 67 | +- `EC_SCALEDREF_MODE=2` (random denominator per frame): produces coded widths that are not | ||
| 68 | + multiples of 32, so the frame edge forces sub-16 partitions and the stream stops at the still-open | ||
| 69 | + named refusal `an 8x8 partition leaf under a scaled reference (superres, unimplemented)` at | ||
| 70 | + seed 42. | ||
| 71 | + | ||
| 72 | +deferred: mixed one-scaled-one-unscaled compound tap — unblocked by the leaf8 desync (lane-sub8), | ||
| 73 | +which is what mode-2 recipes hit; the counter is in place so any future recipe proves the case | ||
| 74 | +immediately. The per-tap code itself is r1's (`scale0`/`scale1` are already independent). | ||
| 75 | + | ||
| 76 | +## Test totals | ||
| 77 | + | ||
| 78 | +`EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib` (whole crate lib suite): **268 passed, 0 failed, 23 ignored**, 968s (same totals as r1, now with the warp arm of the superres gate ON). Run at the final tree. | ||
| 79 | + | ||
| 80 | +## Residue carried from r1 (unchanged) | ||
| 81 | + | ||
| 82 | +- deferred: 8x8 partition leaf under a scaled reference — unblocked by the lane-sub8 leaf8 desync. | ||
| 83 | +- deferred: reference scaling in BOTH axes (`--resize-mode`) — unblocked by a lane sized for it. | ||
| 84 | +- accepted: 10-bit is refused upstream (`Picture` planes are `Vec<u8>`). | ||
| 85 | +- accepted: the Golomb-tail cap stays where r1 left it (it masks an intra-rect64 defect). | ||