diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index 935b9265..a9dbb46c 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -8119,12 +8119,12 @@ fn decode_intra_rect_in_inter( // reference holds (a fresh smooth ramp) in exactly those two bands of an // inter frame and the encoder codes those forced halves INTRA. if bw.max(bh) == 128 { - if allow_screen_content_tools { - return Err(unsupported( - "a HORZ/VERT intra strip in a screen-content frame (palette syntax \ - is consumed for square blocks only)", - )); - } + // lane-t900 r32: no screen-content refusal here. `av1_allow_palette` + // rejects every footprint with a 128-pixel side (`bw > 64 || bh > 64`, + // enumerated by `no_block_footprint_with_a_128_pixel_side_can_carry_\ + // palette_syntax`), so a 128-root half consumes no palette syntax and + // a screen-content frame's half is syntactically identical to the + // non-screen one this arm already decodes byte-exact. if coeff_trace_on() { // lane-t900 r16: which decode-order frame this arm fires in -- // interleaved with the `EC_COEFF_FRAME` markers, this is what diff --git a/crates/ec-av1/src/refusal_inventory.rs b/crates/ec-av1/src/refusal_inventory.rs index 52653ad3..056dd777 100644 --- a/crates/ec-av1/src/refusal_inventory.rs +++ b/crates/ec-av1/src/refusal_inventory.rs @@ -56,7 +56,6 @@ const REFUSALS: &[&str] = &[ "a block that actually uses a palette (Y) -- reconstruction is out of scope", "intra block copy on a HORZ/VERT/1:4 rect intra strip (reconstruction is not ported at this shape)", "a sub-8x8 leaf that uses intrabc (this reader has no block-vector path; the 8x8-and-up reader reconstructs one)", - "an intrabc block under TxMode::Select (its transform size is coded by the inter var-tx partition tree, which this decoder never reads)", "a bit depth of 12 (this decoder is gated at 8 and 10 only: warp/MC/wiener rounding shifts change at 12-bit and no 12-bit gate exists)", "a frame OBU with no tile group", "a frame naming primary_ref_frame at a reference slot with no saved CDF state", @@ -124,37 +123,21 @@ const REFUSALS: &[&str] = &[ // What still refuses is the 128-root half of a screen-content frame, whose // body (`decode_block_128rect`) reads no palette syntax and for which no // `--sb-size=128` screen witness exists yet. - // lane-t900 r23 CENSUS for this string's remaining 128-root arm (the - // 16x4/4x16 arm was lifted in r22): its premise is already known to be - // false by the spec -- `read_palette_mode_info` (5.11.46) codes palette - // only for `Block_Width <= 64 && Block_Height <= 64`, so a 128x64/64x128 - // half consumes NO palette syntax and the screen flag changes nothing - // about it. It stays because nothing witnesses it: 6 aomenc encodes at - // `--sb-size=128 --tune-content=screen` (704x320 = 5*128+64 by 2*128+64, - // the edge-forced size r18 proved for the non-screen twin; screen cell - // content at cq 10/20/40, and r18's own panning-texture-plus-fresh-ramp - // shape with `--max-partition-size=128 --enable-ab-partitions=0 - // --enable-1to4-partitions=0`) code ZERO 128-root halves of any kind - // (`intra128_in_inter` and `sb128_rect` both 0 in every stream), so - // lifting it would be a capability claim no gate exercises (class - // `refusal-lifted-without-a-gate`). What is still untried: a 10-bit - // source, and screen content in the forced bands with a NON-screen - // interior. - // lane-t900 r31, ENUMERATION: the premise is DISPROVED -- `av1_allow_palette`'s - // bound (`palette_bsize_ctx_wh`: `bw > 64 || bh > 64`) rejects every - // footprint with a 128-pixel side, so a screen-content frame codes no - // palette syntax on a 128-root half and that half decodes exactly like the - // non-screen twin r18 already witnesses (test - // `no_block_footprint_with_a_128_pixel_side_can_carry_palette_syntax`). - // The string is a claim about the SYNTAX, and the syntax it fears does not - // exist at this size. It stays UNPROVEN and live for two reasons: the - // guarded condition is reachable (proving the lift safe is not proving the - // case absent), and lifting it is a `decode.rs` edit -- delete the - // `if allow_screen_content_tools { return Err(unsupported(..)) }` block - // inside the `bw.max(bh) == 128` branch of `decode_intra_rect_in_inter` - // -- which needs a `--sb-size=128 --tune-content=screen` witness that - // actually codes a 128-root half (r23's census found none). - "a HORZ/VERT intra strip in a screen-content frame (palette syntax is consumed for square blocks only)", + // lane-t900 r32: the 128-root arm is LIFTED. r31's enumeration + // (`no_block_footprint_with_a_128_pixel_side_can_carry_palette_syntax`) is + // its proof -- `av1_allow_palette`'s `bw > 64 || bh > 64` bound means a + // 128x64/64x128 half codes NO palette syntax at all, so a screen-content + // frame's half is byte-identical in syntax to the non-screen twin gate + // `an_intra_coded_128_half_inside_an_inter_frame_decodes_pixel_exact` + // already decodes pixel-exact. Nothing of this string remains. + // lane-t900 r32: the residue of the LIFTED "an intrabc block under + // TxMode::Select". The inter var-tx tree is read in full, but the intra + // luma reconstruct loop it feeds is a UNIFORM grid of one square + // transform, so a tree resolving to mixed leaf sizes would be + // reconstructed at the wrong stride. Neither arm of + // `an_intrabc_block_under_tx_mode_select_decodes_pixel_exact` reaches it + // (both resolve uniform), so it is unwitnessed and stays live. + "an intrabc block whose var-tx tree resolved to mixed leaf transform sizes", "a motion_mode symbol for a block shape with no CDF row here", ]; @@ -374,20 +357,6 @@ const PROVEN: &[(&str, &str)] = &[ "a frame naming primary_ref_frame at a reference slot with no saved CDF state", "an_inter_frame_naming_an_unrefreshed_primary_ref_slot_is_refused_by_name", ), - // lane-t900 r31, census + refusal-by-name: 13 real `--tune-content=screen - // --enable-intrabc=1` key frames measure this string instead of assuming - // it. The refusal is NOT unreachable -- an exact-repetition source - // (a 2x2 tiling of one bar pattern) with the rect/1:4 partitions off codes - // an unskipped intrabc block on a square block of a TX_MODE_SELECT frame, - // and exactly that arm refuses by name while the other twelve decode - // pixel-exact. So it is a real capability gap with a waiting witness gate - // (`an_intrabc_block_under_tx_mode_select_decodes_pixel_exact`, ignored), - // and libaom does not couple the two bits: `select_tx_mode` - // (encodeframe.c:2355) never reads `allow_intrabc`. - ( - "an intrabc block under TxMode::Select (its transform size is coded by the inter var-tx partition tree, which this decoder never reads)", - "an_intrabc_census_over_screen_key_frames_measures_the_tx_select_refusal", - ), ]; /// Gates whose `Err` arm turns a decode failure into a printed SKIP rather than diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index e94d35e9..e0d7d070 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -4370,7 +4370,7 @@ mod tests { const TILE: &str = "smptebars=size=128x96:rate=25"; let (width, height) = (256usize, 192usize); // (arm, source, cq, tx-size-search, tiled, square_only) - let arms: [(&str, &str, &str, &str, bool, bool); 13] = [ + let arms: [(&str, &str, &str, &str, bool, bool); 14] = [ ("smptebars-cq40-txs1", SB, "40", "1", false, false), ("smptebars-cq45-txs1", SB, "45", "1", false, false), ("smptebars-cq55-txs1", SB, "55", "1", false, false), @@ -4384,13 +4384,11 @@ mod tests { ("tiled-cq30-txs1", TILE, "30", "1", true, false), ("tiled-cq45-txs1", TILE, "45", "1", true, false), ("tiled-square-cq30-txs1", TILE, "30", "1", true, true), - // `tiled-square-cq45-txs1` belongs here too and is NOT in this - // table: its intrabc blocks are all `skip`, so the `&& !skip` - // guard lets them through -- and the frame decodes WRONG against - // ffmpeg. A refusal one `&&` narrower than the hole it guards - // (class `refusal-hides-a-defect`); that arm lives in the ignored - // gate below with the unskipped one, and the guard itself is a - // `decode.rs` edit this round could not make. + // lane-t900 r32: both square arms are now ORDINARY census members + // -- cq30 (unskipped intrabc, the inter var-tx tree) and cq45 + // (all-skip intrabc, `maxRectTxSize` with no symbol at all) decode + // pixel-exact, so nothing here reaches the lifted refusal. + ("tiled-square-cq45-txs1", TILE, "45", "1", true, true), ]; let (mut select_arms, mut premise_arms, mut intrabc_arms, mut blocks_total) = (0u32, 0u32, 0u32, 0usize); @@ -4468,9 +4466,9 @@ mod tests { tx_mode == Select, so the refusal's own premise was never within reach" ); assert_eq!( - refused_tx_select, 1, - "{NAME}: exactly one arm (tiled-square-cq30-txs1) must reach the refusal -- if \ - none does, the census no longer measures it; if more do, say so here" + refused_tx_select, 0, + "{NAME}: lane-t900 r32 lifted this refusal -- an intrabc block now reads the \ + INTER tx-size syntax, so no arm may reach it again" ); assert!(frames_compared > 0, "{NAME}: no frame was compared pixel-exact"); } @@ -4484,13 +4482,17 @@ mod tests { /// (`read_var_tx_size`), which this decoder reads nowhere on the intra /// path -- reading the intra `tx_depth` symbol instead desyncs. /// - /// Two arms of the same recipe: `cq=30`, whose intrabc block is unskipped - /// and refused by name, and `cq=45`, whose intrabc blocks are all `skip` - /// and therefore pass the `&& !skip` guard -- and decode WRONG (frame 0 - /// mismatches ffmpeg). So the refusal is one `&&` narrower than the hole: - /// until the var-tx read lands, the skipped case needs the same refusal. + /// lane-t900 r32 closed both arms. A SKIPPED intrabc block reads no + /// tx-size symbol at all (`allowSelect = !skip || !is_inter`, false for an + /// intrabc block since libaom's `is_inter_block` counts one); reading the + /// intra `tx_depth` for it consumed a symbol libaom never wrote and + /// desynced the tile a whole block later, at the superblock corner + /// (192,64) (class `equal-range-means-unread`). An UNSKIPPED one reads the + /// inter var-tx tree (`read_var_tx_size`). r31's note that cq=45's blocks + /// are all `skip` was read off that desynced decode: with the tx-size read + /// corrected, cq=45 carries 3 unskipped intrabc blocks of 10 and cq=30 + /// carries 1 of 16, so both arms exercise both sides of the split. #[test] - #[ignore = "capability gap: an intrabc block's tx size is coded by the inter var-tx tree"] fn an_intrabc_block_under_tx_mode_select_decodes_pixel_exact() { const NAME: &str = "an_intrabc_block_under_tx_mode_select_decodes_pixel_exact"; if !have_ffmpeg() || !have_aomenc() { @@ -4507,11 +4509,21 @@ mod tests { (select={select} premise={premise})" ); crate::decode::reset_intrabc_hits(); + crate::decode::reset_intrabc_vartx_hits(); let frames = decode_stream(&stream).unwrap_or_else(|e| panic!("{NAME}: cq={cq}: {e}")); + let (blocks, vartx) = + (crate::decode::intrabc_hits(), crate::decode::intrabc_vartx_hits()); + assert!(blocks > 0, "{NAME}: cq={cq} no longer decodes an intrabc block"); + // r31 recorded cq=45's intrabc blocks as ALL skip; that was read + // off the desynced decode. With the tx-size read corrected both + // arms carry unskipped ones (cq30 1 of 16, cq45 3 of 10), so both + // must reach the var-tx tree or the gate is blind to the lift + // (class `gate-blind-to-feature`). assert!( - crate::decode::intrabc_hits() > 0, - "{NAME}: cq={cq} no longer decodes an intrabc block" + vartx > 0, + "{NAME}: cq={cq} no longer reads the inter var-tx tree for an intrabc block" ); + eprintln!("{NAME}: cq={cq} {blocks} intrabc block(s), {vartx} through var-tx"); let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len()); assert_eq!(frames.len(), theirs.len(), "{NAME}: cq={cq} frame count"); for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() {