No block footprint with a 128-pixel side can carry palette syntax
Browse files at this commit552edc4cede0dfd9bebbc4e344242802802d15ccParent: c72e315- test
- no block footprint with a 128-pixel side can carry palette syntax
1 changed file +101 -0
crates/ec-av1/src/refusal_inventory.rsmodified+101 -0
| @@ -140,6 +140,20 @@ const REFUSALS: &[&str] = &[ | |||
| 140 | // `refusal-lifted-without-a-gate`). What is still untried: a 10-bit | 140 | // `refusal-lifted-without-a-gate`). What is still untried: a 10-bit |
| 141 | // source, and screen content in the forced bands with a NON-screen | 141 | // source, and screen content in the forced bands with a NON-screen |
| 142 | // interior. | 142 | // interior. |
| 143 | + // lane-t900 r31, ENUMERATION: the premise is DISPROVED -- `av1_allow_palette`'s | ||
| 144 | + // bound (`palette_bsize_ctx_wh`: `bw > 64 || bh > 64`) rejects every | ||
| 145 | + // footprint with a 128-pixel side, so a screen-content frame codes no | ||
| 146 | + // palette syntax on a 128-root half and that half decodes exactly like the | ||
| 147 | + // non-screen twin r18 already witnesses (test | ||
| 148 | + // `no_block_footprint_with_a_128_pixel_side_can_carry_palette_syntax`). | ||
| 149 | + // The string is a claim about the SYNTAX, and the syntax it fears does not | ||
| 150 | + // exist at this size. It stays UNPROVEN and live for two reasons: the | ||
| 151 | + // guarded condition is reachable (proving the lift safe is not proving the | ||
| 152 | + // case absent), and lifting it is a `decode.rs` edit -- delete the | ||
| 153 | + // `if allow_screen_content_tools { return Err(unsupported(..)) }` block | ||
| 154 | + // inside the `bw.max(bh) == 128` branch of `decode_intra_rect_in_inter` | ||
| 155 | + // -- which needs a `--sb-size=128 --tune-content=screen` witness that | ||
| 156 | + // actually codes a 128-root half (r23's census found none). | ||
| 143 | "a HORZ/VERT intra strip in a screen-content frame (palette syntax is consumed for square blocks only)", | 157 | "a HORZ/VERT intra strip in a screen-content frame (palette syntax is consumed for square blocks only)", |
| 144 | "a motion_mode symbol for a block shape with no CDF row here", | 158 | "a motion_mode symbol for a block shape with no CDF row here", |
| 145 | ]; | 159 | ]; |
| @@ -360,6 +374,20 @@ const PROVEN: &[(&str, &str)] = &[ | |||
| 360 | "a frame naming primary_ref_frame at a reference slot with no saved CDF state", | 374 | "a frame naming primary_ref_frame at a reference slot with no saved CDF state", |
| 361 | "an_inter_frame_naming_an_unrefreshed_primary_ref_slot_is_refused_by_name", | 375 | "an_inter_frame_naming_an_unrefreshed_primary_ref_slot_is_refused_by_name", |
| 362 | ), | 376 | ), |
| 377 | + // lane-t900 r31, census + refusal-by-name: 13 real `--tune-content=screen | ||
| 378 | + // --enable-intrabc=1` key frames measure this string instead of assuming | ||
| 379 | + // it. The refusal is NOT unreachable -- an exact-repetition source | ||
| 380 | + // (a 2x2 tiling of one bar pattern) with the rect/1:4 partitions off codes | ||
| 381 | + // an unskipped intrabc block on a square block of a TX_MODE_SELECT frame, | ||
| 382 | + // and exactly that arm refuses by name while the other twelve decode | ||
| 383 | + // pixel-exact. So it is a real capability gap with a waiting witness gate | ||
| 384 | + // (`an_intrabc_block_under_tx_mode_select_decodes_pixel_exact`, ignored), | ||
| 385 | + // and libaom does not couple the two bits: `select_tx_mode` | ||
| 386 | + // (encodeframe.c:2355) never reads `allow_intrabc`. | ||
| 387 | + ( | ||
| 388 | + "an intrabc block under TxMode::Select (its transform size is coded by the inter var-tx partition tree, which this decoder never reads)", | ||
| 389 | + "an_intrabc_census_over_screen_key_frames_measures_the_tx_select_refusal", | ||
| 390 | + ), | ||
| 363 | ]; | 391 | ]; |
| 364 | 392 | ||
| 365 | /// Gates whose `Err` arm turns a decode failure into a printed SKIP rather than | 393 | /// Gates whose `Err` arm turns a decode failure into a printed SKIP rather than |
| @@ -975,6 +1003,79 @@ mod tests { | |||
| 975 | assert_eq!(sites, 3, "the intra-mode guard is at three sites, found {sites}"); | 1003 | assert_eq!(sites, 3, "the intra-mode guard is at three sites, found {sites}"); |
| 976 | } | 1004 | } |
| 977 | 1005 | ||
| 1006 | + /// lane-t900 r31, ENUMERATION for "a HORZ/VERT intra strip in a | ||
| 1007 | + /// screen-content frame (palette syntax is consumed for square blocks | ||
| 1008 | + /// only)". | ||
| 1009 | + /// | ||
| 1010 | + /// That refusal guards the 128-root HORZ/VERT arm of the intra-in-inter | ||
| 1011 | + /// path (`decode.rs`, the `bw.max(bh) == 128` branch): the body it calls, | ||
| 1012 | + /// `decode_block_128rect`, reads no palette syntax, so a screen-content | ||
| 1013 | + /// frame was assumed to code some there. It cannot. `av1_allow_palette` | ||
| 1014 | + /// (spec 5.11.46 `read_palette_mode_info`: `bsize` between `BLOCK_8X8` | ||
| 1015 | + /// and `BLOCK_64X64` by side) is what this decoder mirrors in | ||
| 1016 | + /// `palette_bsize_ctx_wh`, whose bound is `bw > 64 || bh > 64 || | ||
| 1017 | + /// bw * bh < 64`. Every footprint with a 128-pixel side fails it, so the | ||
| 1018 | + /// screen flag changes NOTHING a 128-root half codes -- the refusal's | ||
| 1019 | + /// stated premise is false, and the string is a claim about the SYNTAX | ||
| 1020 | + /// (provable, and disproved here) rather than about libaom. | ||
| 1021 | + /// | ||
| 1022 | + /// It is deliberately NOT registered in [`PROVEN`]: the guarded condition | ||
| 1023 | + /// is still reachable (a screen frame CAN code a 128-root half), so this | ||
| 1024 | + /// test proves the LIFT is safe, not that the case never happens. Lifting | ||
| 1025 | + /// it is a `decode.rs` edit plus a witness stream, and no `--sb-size=128 | ||
| 1026 | + /// --tune-content=screen` encode found so far codes a 128-root half at all | ||
| 1027 | + /// (lane-t900 r23's census). | ||
| 1028 | + /// | ||
| 1029 | + /// The bound is asserted against `decode.rs`'s own source rather than a | ||
| 1030 | + /// copy of it here, so a change to the predicate breaks this test rather | ||
| 1031 | + /// than silently invalidating it (class `table-and-reader-move-together`). | ||
| 1032 | + #[test] | ||
| 1033 | + fn no_block_footprint_with_a_128_pixel_side_can_carry_palette_syntax() { | ||
| 1034 | + const BOUND: &str = "if bw > 64 || bh > 64 || bw * bh < 64 {"; | ||
| 1035 | + let src = include_str!("decode.rs"); | ||
| 1036 | + assert!( | ||
| 1037 | + src.contains("fn palette_bsize_ctx_wh(bw: usize, bh: usize) -> Option<usize> {"), | ||
| 1038 | + "palette_bsize_ctx_wh is gone -- this enumeration no longer names the predicate \ | ||
| 1039 | + the decoder gates every palette read on" | ||
| 1040 | + ); | ||
| 1041 | + assert_eq!( | ||
| 1042 | + src.matches(BOUND).count(), | ||
| 1043 | + 1, | ||
| 1044 | + "av1_allow_palette's size bound is no longer spelled {BOUND:?} exactly once in \ | ||
| 1045 | + decode.rs -- re-derive this enumeration from the new spelling" | ||
| 1046 | + ); | ||
| 1047 | + // `palette_bsize_ctx_wh`'s own bound, applied to every AV1 block | ||
| 1048 | + // footprint (both sides a power of two from 4 to 128). | ||
| 1049 | + let allows_palette = |bw: usize, bh: usize| !(bw > 64 || bh > 64 || bw * bh < 64); | ||
| 1050 | + let (mut with_128, mut allowed_at_128) = (0u32, 0u32); | ||
| 1051 | + for wl in 2..=7u32 { | ||
| 1052 | + for hl in 2..=7u32 { | ||
| 1053 | + let (bw, bh) = (1usize << wl, 1usize << hl); | ||
| 1054 | + if bw.max(bh) != 128 { | ||
| 1055 | + continue; | ||
| 1056 | + } | ||
| 1057 | + with_128 += 1; | ||
| 1058 | + if allows_palette(bw, bh) { | ||
| 1059 | + allowed_at_128 += 1; | ||
| 1060 | + } | ||
| 1061 | + } | ||
| 1062 | + } | ||
| 1063 | + assert!(with_128 > 0, "enumeration is vacuous -- no 128-sided footprint was tried"); | ||
| 1064 | + assert_eq!( | ||
| 1065 | + allowed_at_128, 0, | ||
| 1066 | + "a footprint with a 128-pixel side passed av1_allow_palette's bound -- the \ | ||
| 1067 | + 128-root HORZ/VERT arm really would have to read palette syntax" | ||
| 1068 | + ); | ||
| 1069 | + // And the guarded shapes specifically: the two 128-root HORZ/VERT | ||
| 1070 | + // halves the refusal names. | ||
| 1071 | + for (bw, bh) in [(128usize, 64usize), (64, 128)] { | ||
| 1072 | + assert!( | ||
| 1073 | + !allows_palette(bw, bh), | ||
| 1074 | + "a {bw}x{bh} half can carry a palette after all" | ||
| 1075 | + ); | ||
| 1076 | + } | ||
| 1077 | + } | ||
| 1078 | + | ||
| 978 | /// Every entry of [`PROVEN`] must still name a live refusal and a test | 1079 | /// Every entry of [`PROVEN`] must still name a live refusal and a test |
| 979 | /// that exists, and the count it prints is the inventory's numerator. | 1080 | /// that exists, and the count it prints is the inventory's numerator. |
| 980 | #[test] | 1081 | #[test] |