forge
Explore
Log in

Don't you dare go Hollow

Drop the merge-seam 128x128-superblock blanket refusal main added, and turn its gate into a pixel-exact one

Browse files at this commit

480317ddc80d987e145ce76756a98bad0f43b53cAhmet Kaan GümüşParent: d37a8b4
  • fix
    • drop the merge-seam 128x128-superblock blanket refusal main added, and turn its gate into a pixel-exact one
Show full message
fix(av1): drop the merge-seam 128x128-superblock blanket refusal main added, and turn its gate into a pixel-exact one

ReelC's real 1920x792 key frame now decodes BIT-EXACT (cmp of the 16-bit dump
against ffmpeg yuv420p10le) -- pre-merge it carried a +1 DC band over the whole
bottom partial superblock row, which lane-oddh's odd-frame-size fixes remove.
crates/ec-av1/src/refusal_inventory.rsmodified+0 -1
@@ -55,7 +55,6 @@ const REFUSALS: &[&str] = &[
55 "a sub-8x8 leaf that uses intrabc (this reader has no block-vector path; the 8x8-and-up reader reconstructs one)",55 "a sub-8x8 leaf that uses intrabc (this reader has no block-vector path; the 8x8-and-up reader reconstructs one)",
56 "an intrabc block under TxMode::Select (its transform size is coded by the inter var-tx partition tree, which this decoder never reads)",56 "an intrabc block under TxMode::Select (its transform size is coded by the inter var-tx partition tree, which this decoder never reads)",
57 "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)",57 "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)",
58- "a sequence using 128x128 superblocks on a frame larger than 64x64 (this decoder's whole partition/CDEF/LR grid is 64x64-superblock only; aomenc picks 128x128 at --cpu-used=0)",
59 "a frame OBU with no tile group",58 "a frame OBU with no tile group",
60 "a frame naming primary_ref_frame at a reference slot with no saved CDF state",59 "a frame naming primary_ref_frame at a reference slot with no saved CDF state",
61 "a frame with no mode-info grid",60 "a frame with no mode-info grid",
crates/ec-av1/src/stream.rsmodified+14 -16
@@ -571,16 +571,6 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> {
571 // is inside the frame. Every sibling inter gate at 64x64 and571 // is inside the frame. Every sibling inter gate at 64x64 and
572 // `--cpu-used=0` is exactly that case. The divergence starts the572 // `--cpu-used=0` is exactly that case. The divergence starts the
573 // moment a superblock has a second child in frame.573 // moment a superblock has a second child in frame.
574- if parser
575- .sequence_header()
576- .is_some_and(|seq| seq.use_128x128_superblock)
577- && (header.mi_cols > 16 || header.mi_rows > 16)
578- {
579- return Err(Error::unsupported(
580- "AV1 decode_stream",
581- "a sequence using 128x128 superblocks on a frame larger than 64x64 (this decoder's whole partition/CDEF/LR grid is 64x64-superblock only; aomenc picks 128x128 at --cpu-used=0)",
582- ));
583- }
584 crate::decode::set_bit_depth(bit_depth);574 crate::decode::set_bit_depth(bit_depth);
585 // lane-av1comp: `comp_group_idx`/`compound_idx`'s own gating bits.575 // lane-av1comp: `comp_group_idx`/`compound_idx`'s own gating bits.
586 let enable_masked_compound = parser576 let enable_masked_compound = parser
@@ -1137,7 +1127,7 @@ mod tests {
1137 /// half: without it, an aomenc that ignored `--sb-size=128` would leave1127 /// half: without it, an aomenc that ignored `--sb-size=128` would leave
1138 /// the gate asserting a refusal that never fires.1128 /// the gate asserting a refusal that never fires.
1139 #[test]1129 #[test]
1140- fn a_real_aomenc_128x128_superblock_stream_is_refused_by_name() {1130+ fn a_real_aomenc_128x128_superblock_stream_decodes_pixel_exact() {
1141 if !have_ffmpeg() || !have_aomenc() {1131 if !have_ffmpeg() || !have_aomenc() {
1142 eprintln!("SKIP: no ffmpeg/aomenc");1132 eprintln!("SKIP: no ffmpeg/aomenc");
1143 return;1133 return;
@@ -1188,11 +1178,19 @@ mod tests {
1188 }1178 }
1189 assert!(sb128, "aomenc ignored --sb-size=128: this stream is 64x64-superblock");1179 assert!(sb128, "aomenc ignored --sb-size=128: this stream is 64x64-superblock");
1190 1180
1191- let err = decode_stream(&stream).unwrap_err().to_string();1181+ // lane-sb128b: the blanket refusal this gate was written against is
1192- assert!(1182+ // gone -- the 128 root now decodes (SPLIT and NONE). The gate keeps
1193- err.contains("a sequence using 128x128 superblocks"),1183+ // its stream and its `--sb-size=128` knob assert and asserts pixels.
1194- "expected the 128x128-superblock refusal for {width}x{height}, got: {err}"1184+ let decoded = decode_stream(&stream).expect("decode the 64x72 sb128 stream");
1195- );1185+ let reference = ffmpeg_decode_sequence(&stream, width, height, decoded.len());
1186+ for (i, (ours, theirs)) in decoded.iter().zip(&reference).enumerate() {
1187+ let nd = |a: &[u16], b: &[u16]| a.iter().zip(b).filter(|(x, y)| x != y).count();
1188+ assert_eq!(
1189+ (nd(&ours.y, &theirs.y), nd(&ours.u, &theirs.u), nd(&ours.v, &theirs.v)),
1190+ (0, 0, 0),
1191+ "{width}x{height} sb128 cpu-used=0: frame {i} differs from ffmpeg"
1192+ );
1193+ }
1196 }1194 }
1197 1195
1198 /// `decode_stream` on a lone key frame's stream matches both the tile1196 /// `decode_stream` on a lone key frame's stream matches both the tile