forge
Explore
Log in

Don't you dare go Hollow

Lift the sub-8x8 inter HORZ refusal (two BLOCK_8X4 leaves)

Browse files at this commit

4496b6d61903935afe4dc8783148525dae53f845Ahmet Kaan GümüşParent: a2059e0
  • feat
    • lift the sub-8x8 inter HORZ refusal (two BLOCK_8X4 leaves)
Show full message
feat(av1): lift the sub-8x8 inter HORZ refusal (two BLOCK_8X4 leaves)

The |d|<=2 luma band that kept HORZ refused through r4 was the merged
lane-cdef defect: the 8x8 inter leaf never wrote the CDEF skip band, so
8x8 groups next to an 8x4 pair were filtered where libaom skips them.
A 56-arm sweep (7 cq x 4 sp x 2 depths, transposed source, rect on) now
has zero mismatching arms; the three that were red are pixel-exact.

The gate grows attempts 16..23 on the transposed source (aomenc picks HORZ
below 8x8 there, VERT on the untransposed one), counts the two axes apart
and asserts each fired on >=2 pixel-compared attempts, and asserts a
non-square masked-compound block (new RECT_MASKED_COMPOUND_HITS) so r4's
compound_type/wedge_idx CDF-row fix stops being unexercised.
crates/ec-av1/src/decode.rsmodified+28 -31
@@ -1838,6 +1838,21 @@ pub(crate) fn masked_compound_hits() -> usize {
1838 MASKED_COMPOUND_HITS.with(|c| c.get())1838 MASKED_COMPOUND_HITS.with(|c| c.get())
1839 }1839 }
1840 1840
1841+// lane-intersub8 r4/r5: the NON-SQUARE half of `MASKED_COMPOUND_HITS` -- a
1842+// masked-compound block whose true footprint is rectangular, i.e. the case
1843+// whose `compound_type`/`wedge_idx` CDF row r4 fixed (it used to read the
1844+// square envelope's `BLOCK_SIZES_ALL` index). Square blocks cannot show that
1845+// defect, so a gate asserting `masked_compound_hits` alone stays vacuous for it.
1846+thread_local! {
1847+ static RECT_MASKED_COMPOUND_HITS: std::cell::Cell<usize> =
1848+ const { std::cell::Cell::new(0) };
1849+}
1850+
1851+/// Current value of [`RECT_MASKED_COMPOUND_HITS`].
1852+pub(crate) fn rect_masked_compound_hits() -> usize {
1853+ RECT_MASKED_COMPOUND_HITS.with(|c| c.get())
1854+}
1855+
1841 // How many blocks decoded a real `COMPOUND_WEDGE` block (`comp_group_idx ==1856 // How many blocks decoded a real `COMPOUND_WEDGE` block (`comp_group_idx ==
1842 // 1`, `compound_type == 0`) -- lane-wedge r3's proof a gate fixture1857 // 1`, `compound_type == 0`) -- lane-wedge r3's proof a gate fixture
1843 // actually exercised the wedge blend, not just the DIFFWTD half of1858 // actually exercised the wedge blend, not just the DIFFWTD half of
@@ -16995,6 +17010,9 @@ fn decode_inter_block(
16995 }17010 }
16996 }17011 }
16997 MASKED_COMPOUND_HITS.with(|c| c.set(c.get() + 1));17012 MASKED_COMPOUND_HITS.with(|c| c.set(c.get() + 1));
17013+ if write_w != write_h {
17014+ RECT_MASKED_COMPOUND_HITS.with(|c| c.set(c.get() + 1));
17015+ }
16998 }17016 }
16999 // corner-cut (lane-av1comp r16/r17, lane-av1blend r1): r16/r1717017 // corner-cut (lane-av1comp r16/r17, lane-av1blend r1): r16/r17
17000 // called this a `predict_compound_intermediate`/`combine_compound`17018 // called this a `predict_compound_intermediate`/`combine_compound`
@@ -22835,38 +22853,17 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
22835 )?;22853 )?;
22836 continue;22854 continue;
22837 }22855 }
22838- if part8 == PARTITION_HORZ
22839- && std::env::var_os("EC_AV1_SUB8_HORZ").is_none()
22840- {
22841- // lane-intersub8 r4: the r3 desync IS
22842- // root-caused and fixed (rect masked
22843- // compound read `BLOCK_16X16`'s
22844- // `compound_type`/`wedge_idx` CDF row
22845- // for a 16x8 block); every mode-info
22846- // range on the 28-arm transposed
22847- // sweep now matches aomdec element
22848- // for element. What is left is a
22849- // POST-ENTROPY pixel band: 3 of 28
22850- // arms (8-bit cq32 sp9, 10-bit cq12
22851- // sp3, 10-bit cq16 sp3) differ by
22852- // |d| <= 2 in luma only, scattered
22853- // over the bottom-left corner
22854- // (x < 48, y >= 112) from the first
22855- // frame that references an 8x4 group
22856- // -- a filter/reconstruction defect,
22857- // not a desync. Still refused by name
22858- // rather than shipped as silent pixel
22859- // drift; `EC_AV1_SUB8_HORZ=1` decodes
22860- // it for the r5 bisect.
22861- return Err(unsupported(
22862- "an inter 8x8 HORZ partition (two BLOCK_8X4 inter leaves; entropy-exact now, but a measured sweep still drifts |d|<=2 in luma after the filters)",
22863- ));
22864- }
22865 if part8 == PARTITION_VERT || part8 == PARTITION_HORZ {22856 if part8 == PARTITION_VERT || part8 == PARTITION_HORZ {
22866- // lane-intersub8 r3/r4: two BLOCK_8X422857+ // lane-intersub8 r3/r4/r5: two
22867- // (HORZ) / BLOCK_4X8 (VERT) inter22858+ // BLOCK_8X4 (HORZ) / BLOCK_4X8 (VERT)
22868- // leaves, chroma once per 8x8 on the22859+ // inter leaves, chroma once per 8x8 on
22869- // second of them.22860+ // the second of them. HORZ was refused
22861+ // by name through r4 over a |d| <= 2
22862+ // luma band; r5 merged lane-cdef
22863+ // 8c6065e, whose `decode_inter_block8`
22864+ // skip-band write is that band's root
22865+ // cause, and the 56-arm sweep went 3
22866+ // mismatching arms -> 0.
22870 decode_inter_sub8_rect2(22867 decode_inter_sub8_rect2(
22871 &mut dec,22868 &mut dec,
22872 &mut cdfs,22869 &mut cdfs,
crates/ec-av1/src/refusal_inventory.rsmodified+0 -1
@@ -36,7 +36,6 @@ const REFUSALS: &[&str] = &[
36 "an intra 4x4 block inside an inter frame's sub-8x8 split (this decoder codes only inter 4x4 sub-blocks there)",36 "an intra 4x4 block inside an inter frame's sub-8x8 split (this decoder codes only inter 4x4 sub-blocks there)",
37 "an intra 8x4/4x8 block inside an inter frame's sub-8x8 HORZ/VERT partition (this decoder codes only inter sub-blocks there)",37 "an intra 8x4/4x8 block inside an inter frame's sub-8x8 HORZ/VERT partition (this decoder codes only inter sub-blocks there)",
38 "a sub-8x8 inter block under a scaled reference (superres, unimplemented)",38 "a sub-8x8 inter block under a scaled reference (superres, unimplemented)",
39- "an inter 8x8 HORZ partition (two BLOCK_8X4 inter leaves; entropy-exact now, but a measured sweep still drifts |d|<=2 in luma after the filters)",
40 "a COMPOUND_WEDGE mask on a non-square inter block (rect wedge codebook unimplemented)",39 "a COMPOUND_WEDGE mask on a non-square inter block (rect wedge codebook unimplemented)",
41 "a 1:4 rect strip that actually uses a palette (reconstruction is not ported at this shape)",40 "a 1:4 rect strip that actually uses a palette (reconstruction is not ported at this shape)",
42 "a 16x16 block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet",41 "a 16x16 block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet",
crates/ec-av1/src/stream.rsmodified+72 -8
@@ -7586,11 +7586,24 @@ mod tests {
7586 // 8x8 (two BLOCK_4X8 inter leaves, one shared 4x4 chroma unit predicted7586 // 8x8 (two BLOCK_4X8 inter leaves, one shared 4x4 chroma unit predicted
7587 // from BOTH sub-blocks' mvs). The HORZ twin is still refused by name.7587 // from BOTH sub-blocks' mvs). The HORZ twin is still refused by name.
7588 let mut rect_fired = 0u32;7588 let mut rect_fired = 0u32;
7589+ // lane-intersub8 r5: the two rect axes counted apart. Attempts 16..23
7590+ // are the same recipe family with the geq source TRANSPOSED (the sine
7591+ // that moves runs along Y, not X): measured over a 56-arm sweep
7592+ // (~/.cache/intersub8-sweep-r5.log, cq {8,12,14,16,20,26,32} x sp
7593+ // {3,6,9,12} x both depths, rect on), aomenc picks PARTITION_HORZ
7594+ // below 8x8 on that source and PARTITION_VERT on the untransposed one
7595+ // -- neither schedule reaches the other axis, so both are needed.
7596+ let (mut horz_fired, mut vert_fired) = (0u32, 0u32);
7597+ // Rect (non-square) masked-compound blocks on attempts that DECODED
7598+ // and were pixel-compared -- never off a refused stream (class
7599+ // counter-from-refused-stream). This is the shape whose
7600+ // `compound_type`/`wedge_idx` CDF row lane-intersub8 r4 fixed.
7601+ let mut rect_masked = 0usize;
7589 let mut refusals: Vec<String> = Vec::new();7602 let mut refusals: Vec<String> = Vec::new();
7590 let mut out_of_scope_mismatch = 0u32;7603 let mut out_of_scope_mismatch = 0u32;
7591 for bit_depth in [8u32, 10u32] {7604 for bit_depth in [8u32, 10u32] {
7592- for attempt in 0..16u32 {7605+ for attempt in 0..24u32 {
7593- let rect = attempt / 8;7606+ let rect = if attempt >= 16 { 1 } else { attempt / 8 };
7594 let rect_arg = format!("--enable-rect-partitions={rect}");7607 let rect_arg = format!("--enable-rect-partitions={rect}");
7595 // lane-intersub8 r2, measured schedule (sweep of cq7608 // lane-intersub8 r2, measured schedule (sweep of cq
7596 // {8,10,12,14,16,18,20} x sp {3,6,9,12} x both depths,7609 // {8,10,12,14,16,18,20} x sp {3,6,9,12} x both depths,
@@ -7606,13 +7619,30 @@ mod tests {
7606 // rather than hidden: cq 16..20 are all exact, so this gate7619 // rather than hidden: cq 16..20 are all exact, so this gate
7607 // is not selecting quantizers that hide a defect of its own7620 // is not selecting quantizers that hide a defect of its own
7608 // shape.7621 // shape.
7609- let cq = [12, 14][(attempt % 2) as usize];7622+ // Attempts 16..23: the (cq, sp) pairs the r5 sweep measured
7610- let sp = 3 + ((attempt % 8) / 2) * 3;7623+ // as HORZ-firing on the transposed source -- 8-bit
7624+ // (14,3)/(20,3)/(32,9), 10-bit (12,3)/(16,3); the rest of the
7625+ // eight are non-firing neighbours kept so a schedule that
7626+ // stops firing shows up as out-of-scope, not as a silent pass.
7627+ const HORZ_SCHEDULE: [(u32, u32); 8] =
7628+ [(14, 3), (20, 3), (32, 9), (12, 3), (16, 3), (12, 9), (14, 9), (26, 3)];
7629+ let (cq, sp) = if attempt >= 16 {
7630+ HORZ_SCHEDULE[(attempt - 16) as usize]
7631+ } else {
7632+ ([12, 14][(attempt % 2) as usize], 3 + ((attempt % 8) / 2) * 3)
7633+ };
7611 let duration = frame_count as f64 / 25.0;7634 let duration = frame_count as f64 / 25.0;
7612- let source = format!(7635+ let source = if attempt >= 16 {
7613- "color=c=gray:s={width}x{height}:d={duration}:r=25,format=gray,\7636+ format!(
7614- geq=lum='128+58*sin((X+N*{sp})/6)+18*sin(Y/23)',format=yuv420p"7637+ "color=c=gray:s={width}x{height}:d={duration}:r=25,format=gray,\
7615- );7638+ geq=lum='128+58*sin((Y+N*{sp})/6)+18*sin(X/23)',format=yuv420p"
7639+ )
7640+ } else {
7641+ format!(
7642+ "color=c=gray:s={width}x{height}:d={duration}:r=25,format=gray,\
7643+ geq=lum='128+58*sin((X+N*{sp})/6)+18*sin(Y/23)',format=yuv420p"
7644+ )
7645+ };
7616 let pix_fmt = if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" };7646 let pix_fmt = if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" };
7617 let y4m = Command::new("ffmpeg")7647 let y4m = Command::new("ffmpeg")
7618 .args([7648 .args([
@@ -7667,6 +7697,7 @@ mod tests {
7667 let stream = out.stdout;7697 let stream = out.stdout;
7668 let before = decode::sub8_inter_split_hits();7698 let before = decode::sub8_inter_split_hits();
7669 let before_rect = decode::sub8_inter_rect_hits();7699 let before_rect = decode::sub8_inter_rect_hits();
7700+ let before_masked = decode::rect_masked_compound_hits();
7670 let frames = match decode_stream(&stream) {7701 let frames = match decode_stream(&stream) {
7671 Err(e) => {7702 Err(e) => {
7672 let msg = e.to_string();7703 let msg = e.to_string();
@@ -7721,8 +7752,20 @@ mod tests {
7721 if rect_groups > 0 {7752 if rect_groups > 0 {
7722 rect_fired += 1;7753 rect_fired += 1;
7723 }7754 }
7755+ if rect_now.0 - before_rect.0 > 0 {
7756+ horz_fired += 1;
7757+ }
7758+ if rect_now.1 - before_rect.1 > 0 {
7759+ vert_fired += 1;
7760+ }
7761+ // Only now, past the pixel compare, is this attempt's
7762+ // masked-compound count admissible.
7763+ rect_masked += decode::rect_masked_compound_hits() - before_masked;
7724 }7764 }
7725 }7765 }
7766+ eprintln!(
7767+ "{NAME}: fired={fired} horz={horz_fired} vert={vert_fired} rect_masked={rect_masked}"
7768+ );
7726 assert_eq!(7769 assert_eq!(
7727 out_of_scope_mismatch, 0,7770 out_of_scope_mismatch, 0,
7728 "{NAME}: attempts mismatched with no sub-8x8 inter group"7771 "{NAME}: attempts mismatched with no sub-8x8 inter group"
@@ -7738,6 +7781,27 @@ mod tests {
7738 inter leaf (4x8):\n{}",7781 inter leaf (4x8):\n{}",
7739 refusals.join("\n")7782 refusals.join("\n")
7740 );7783 );
7784+ assert!(
7785+ vert_fired >= 2,
7786+ "{NAME}: fewer than 2 firing+pixel-exact attempts with a sub-8x8 inter VERT \
7787+ pair (two BLOCK_4X8 leaves):\n{}",
7788+ refusals.join("\n")
7789+ );
7790+ // lane-intersub8 r5, measured `rect_masked=2` over the 48 attempts:
7791+ // the rect masked-compound blocks whose `compound_type`/`wedge_idx`
7792+ // CDF row r4 corrected, counted only on pixel-compared attempts.
7793+ assert!(
7794+ rect_masked >= 1,
7795+ "{NAME}: no RECTANGULAR masked-compound block on any pixel-compared attempt -- \
7796+ the r4 compound_type/wedge_idx CDF-row fix is unexercised:\n{}",
7797+ refusals.join("\n")
7798+ );
7799+ assert!(
7800+ horz_fired >= 2,
7801+ "{NAME}: fewer than 2 firing+pixel-exact attempts with a sub-8x8 inter HORZ \
7802+ pair (two BLOCK_8X4 leaves):\n{}",
7803+ refusals.join("\n")
7804+ );
7741 }7805 }
7742 7806
7743 #[test]7807 #[test]