The intra-1:4-in-inter gate's r2 blocker was our own desync, and its real blocker is the recipe
Browse files at this commitc8d21c157ab55c0d3b6546fe7527d69c75cc57cfParent: 2c0dd84- test
- the intra-1:4-in-inter gate's r2 blocker was our own desync, and its real blocker is the recipe
1 changed file +69 -55
- crates/ec-av1/src/stream.rs +69 -55
crates/ec-av1/src/stream.rsmodified+69 -55
| @@ -4699,56 +4699,38 @@ mod tests { | ||
| 4699 | 4699 | /// [[gate-skips-on-its-own-failure]]); exhausting every attempt without a |
| 4700 | 4700 | /// counted strip is a FAILURE, never a SKIP. |
| 4701 | 4701 | #[test] |
| 4702 | - // r1 `#[ignore]`d this gate on "every stream with an intra 1:4 strip also | |
| 4703 | - // hits the inter rect-strip refusal". r2 merged main 18bf7dc (lane-r14 | |
| 4704 | - // a2e2e29 lifts exactly that refusal) and re-ran it: 3 of 40 attempts now | |
| 4705 | - // decode whole and reach the pixel compare (0 before), one of them firing | |
| 4706 | - // 64x16=4 16x64=3. But the compare fails on a defect this lane does not | |
| 4707 | - // own -- MEASURED (r2, $HOME/.cache/intra14-r2-*.log): | |
| 4708 | - // * seeds 46 and 54 fire ZERO 1:4 strips (`intra_rect4_strip_in_inter_hits` | |
| 4709 | - // delta 0/0/0/0) and mismatch ffmpeg the same way as the firing seed 52: | |
| 4710 | - // decode-order frame 3/4 luma ~3.7-4.5k samples, max |d| 6..17, then | |
| 4711 | - // frames 5-7 drift to ~24k samples, max |d| ~220 as the references | |
| 4712 | - // carry the error forward. | |
| 4713 | - // * with `--enable-1to4-partitions=0` aomenc emits a BYTE-IDENTICAL | |
| 4714 | - // stream at this recipe (same hits, same per-frame diff counts), so | |
| 4715 | - // the 1:4 shape is not the discriminator either. | |
| 4716 | - // i.e. this mandelbrot 192x128 source has a pre-existing INTER-frame | |
| 4717 | - // pixel defect on this tree (r1 already recorded it as "open, NOT mine" | |
| 4718 | - // with rect partitions off; it is now this gate's blocker). testsrc2 at | |
| 4719 | - // 192x128 decodes pixel-exact on the same recipe but fires no 1:4 strip | |
| 4720 | - // in 4 of 12 attempts that decode whole. So the gate stays `#[ignore]`d | |
| 4721 | - // rather than weakened: a source whose baseline is exact AND that fires | |
| 4722 | - // an intra 1:4 strip has not been found yet. | |
| 4723 | - #[ignore = "blocked: the mandelbrot gate source has a pre-existing inter-frame pixel defect on this tree (zero-hit streams mismatch identically) -- see the MEASURED note above"] | |
| 4702 | + // r3 re-measured this gate on the merged tree (main 48b35ab + lane-sqdrift | |
| 4703 | + // 7d498c0). The r2 blocker is GONE: the "pre-existing inter-frame pixel | |
| 4704 | + // defect" was lane-sqdrift's -- a 64x64 intra block in an inter frame | |
| 4705 | + // reading uv_mode off the CFL alphabet -- and with that fix all 40 | |
| 4706 | + // mandelbrot attempts now decode PIXEL-EXACT (0 diff samples over | |
| 4707 | + // 40 streams x 8 frames x 3 planes, $HOME/.cache/intra14-r3-8bit.log). | |
| 4708 | + // The r2 counter reading "seed 52: 64x16=4 16x64=3" was produced by our own | |
| 4709 | + // desynced decode of a MISMATCHING stream (class counter-from-refused- | |
| 4710 | + // stream): on the correct decode that same stream fires 0/0/0/0. | |
| 4711 | + // The remaining blocker is a RECIPE gap, not a decoder gap: no source found | |
| 4712 | + // this round makes aomenc code an INTRA block on a 1:4 partition inside an | |
| 4713 | + // INTER frame -- see the MEASURED note in `intra_rect4_in_inter_gate`. | |
| 4714 | + #[ignore = "blocked on the recipe, not the decoder: no aomenc source found yet codes an INTRA block on a 1:4 partition inside an INTER frame (mandelbrot = intra-in-inter but zero 1:4 partitions; gradients = 1:4 partitions but all inter; blend = neither) -- see the MEASURED note in intra_rect4_in_inter_gate"] | |
| 4724 | 4715 | fn a_real_aomenc_inter_sequence_with_an_intra_1to4_strip_decodes_pixel_exact() { |
| 4725 | 4716 | intra_rect4_in_inter_gate(8); |
| 4726 | 4717 | } |
| 4727 | 4718 | |
| 4728 | 4719 | /// The 10-bit arm (both of the user's films are `yuv420p10le`). |
| 4729 | 4720 | #[test] |
| 4730 | - // r1 `#[ignore]`d this gate on "every stream with an intra 1:4 strip also | |
| 4731 | - // hits the inter rect-strip refusal". r2 merged main 18bf7dc (lane-r14 | |
| 4732 | - // a2e2e29 lifts exactly that refusal) and re-ran it: 3 of 40 attempts now | |
| 4733 | - // decode whole and reach the pixel compare (0 before), one of them firing | |
| 4734 | - // 64x16=4 16x64=3. But the compare fails on a defect this lane does not | |
| 4735 | - // own -- MEASURED (r2, $HOME/.cache/intra14-r2-*.log): | |
| 4736 | - // * seeds 46 and 54 fire ZERO 1:4 strips (`intra_rect4_strip_in_inter_hits` | |
| 4737 | - // delta 0/0/0/0) and mismatch ffmpeg the same way as the firing seed 52: | |
| 4738 | - // decode-order frame 3/4 luma ~3.7-4.5k samples, max |d| 6..17, then | |
| 4739 | - // frames 5-7 drift to ~24k samples, max |d| ~220 as the references | |
| 4740 | - // carry the error forward. | |
| 4741 | - // * with `--enable-1to4-partitions=0` aomenc emits a BYTE-IDENTICAL | |
| 4742 | - // stream at this recipe (same hits, same per-frame diff counts), so | |
| 4743 | - // the 1:4 shape is not the discriminator either. | |
| 4744 | - // i.e. this mandelbrot 192x128 source has a pre-existing INTER-frame | |
| 4745 | - // pixel defect on this tree (r1 already recorded it as "open, NOT mine" | |
| 4746 | - // with rect partitions off; it is now this gate's blocker). testsrc2 at | |
| 4747 | - // 192x128 decodes pixel-exact on the same recipe but fires no 1:4 strip | |
| 4748 | - // in 4 of 12 attempts that decode whole. So the gate stays `#[ignore]`d | |
| 4749 | - // rather than weakened: a source whose baseline is exact AND that fires | |
| 4750 | - // an intra 1:4 strip has not been found yet. | |
| 4751 | - #[ignore = "blocked: the mandelbrot gate source has a pre-existing inter-frame pixel defect on this tree (zero-hit streams mismatch identically) -- see the MEASURED note above"] | |
| 4721 | + // r3 re-measured this gate on the merged tree (main 48b35ab + lane-sqdrift | |
| 4722 | + // 7d498c0). The r2 blocker is GONE: the "pre-existing inter-frame pixel | |
| 4723 | + // defect" was lane-sqdrift's -- a 64x64 intra block in an inter frame | |
| 4724 | + // reading uv_mode off the CFL alphabet -- and with that fix all 40 | |
| 4725 | + // mandelbrot attempts now decode PIXEL-EXACT (0 diff samples over | |
| 4726 | + // 40 streams x 8 frames x 3 planes, $HOME/.cache/intra14-r3-8bit.log). | |
| 4727 | + // The r2 counter reading "seed 52: 64x16=4 16x64=3" was produced by our own | |
| 4728 | + // desynced decode of a MISMATCHING stream (class counter-from-refused- | |
| 4729 | + // stream): on the correct decode that same stream fires 0/0/0/0. | |
| 4730 | + // The remaining blocker is a RECIPE gap, not a decoder gap: no source found | |
| 4731 | + // this round makes aomenc code an INTRA block on a 1:4 partition inside an | |
| 4732 | + // INTER frame -- see the MEASURED note in `intra_rect4_in_inter_gate`. | |
| 4733 | + #[ignore = "blocked on the recipe, not the decoder: no aomenc source found yet codes an INTRA block on a 1:4 partition inside an INTER frame (mandelbrot = intra-in-inter but zero 1:4 partitions; gradients = 1:4 partitions but all inter; blend = neither) -- see the MEASURED note in intra_rect4_in_inter_gate"] | |
| 4752 | 4734 | fn a_real_aomenc_inter_sequence_with_an_intra_1to4_strip_decodes_pixel_exact_10bit() { |
| 4753 | 4735 | intra_rect4_in_inter_gate(10); |
| 4754 | 4736 | } |
| @@ -4775,10 +4757,31 @@ mod tests { | ||
| 4775 | 4757 | // zoom (`end_scale`/`end_pts`) so consecutive frames share almost |
| 4776 | 4758 | // no content and aomenc's RD codes blocks INTRA inside INTER |
| 4777 | 4759 | // frames, with `--kf-min-dist=1000` forbidding a new key frame. |
| 4778 | - let source = format!( | |
| 4779 | - "mandelbrot=size={width}x{height}:start_scale={}:end_scale=0.004:end_pts=8:rate=25", | |
| 4780 | - 5.0 - f64::from(attempt) * 0.06 | |
| 4781 | - ); | |
| 4760 | + // MEASURED (r3, $HOME/.cache/intra14-r3-*.log; the per-attempt | |
| 4761 | + // "intra14 probe" line below prints the raw counters): the two | |
| 4762 | + // ingredients this gate needs come from DIFFERENT sources. | |
| 4763 | + // * the mandelbrot zoom this gate used through r2 makes aomenc | |
| 4764 | + // code intra blocks inside inter frames (589 2:1 intra strips | |
| 4765 | + // over 40 streams) but yields ZERO 1:4 partitions of any kind | |
| 4766 | + // (`sb_rect4_*`/`rect4_32_*` all 0, at min-partition-size 32 | |
| 4767 | + // AND 16, cpu 0..4, with every intra tool enabled); | |
| 4768 | + // * `gradients` (the source the repo's PROVEN 1:4 gates use) | |
| 4769 | + // yields 1:4 partitions (sb_rect4 h=4 v=16) but aomenc codes | |
| 4770 | + // every one of them INTER; | |
| 4771 | + // * blending the two loses the 1:4 partitions again (0/0) while | |
| 4772 | + // keeping the intra strips (683). | |
| 4773 | + // `gradients` is kept here as the closest recipe: it is the only | |
| 4774 | + // one of the three that reaches a 1:4 partition at all. | |
| 4775 | + // Odd attempts render it transposed so HORZ_4 and VERT_4 are both | |
| 4776 | + // sampled (class scan-weights-cross-axis). | |
| 4777 | + let source = if attempt % 2 == 0 { | |
| 4778 | + gradients_source(seed, width, height, "duration=0.32:rate=25") | |
| 4779 | + } else { | |
| 4780 | + format!( | |
| 4781 | + "{},transpose=1", | |
| 4782 | + gradients_source(seed, height, width, "duration=0.32:rate=25") | |
| 4783 | + ) | |
| 4784 | + }; | |
| 4782 | 4785 | let y4m = Command::new("ffmpeg") |
| 4783 | 4786 | .args([ |
| 4784 | 4787 | "-v", "error", "-f", "lavfi", "-i", &source, "-vf", "hue=s=0", "-pix_fmt", |
| @@ -4803,7 +4806,7 @@ mod tests { | ||
| 4803 | 4806 | // MEASURED (r1, 40 attempts): `--cpu-used=0` makes aomenc pick |
| 4804 | 4807 | // 128x128 superblocks on this frame size, which decode_stream |
| 4805 | 4808 | // refuses by name, so the preset sweep starts at 1. |
| 4806 | - let cpu = format!("--cpu-used={}", 1 + attempt % 4); | |
| 4809 | + let cpu = format!("--cpu-used={}", attempt % 2); | |
| 4807 | 4810 | // The higher the quantiser the more 1:4 intra strips inside inter |
| 4808 | 4811 | // frames, so the sweep walks cq 63 first. |
| 4809 | 4812 | let cq = format!("--cq-level={}", [63u32, 55, 45, 35][(attempt / 4) as usize % 4]); |
| @@ -4816,6 +4819,7 @@ mod tests { | ||
| 4816 | 4819 | // [[aomenc-last-flag-wins]]). These are what the gate is |
| 4817 | 4820 | // about: 1:4 partitions ON, min size 16 so the 16x16-level |
| 4818 | 4821 | // 1:4 (refused elsewhere) is out of reach. |
| 4822 | + "--sb-size=64", | |
| 4819 | 4823 | "--enable-rect-partitions=1", |
| 4820 | 4824 | "--enable-1to4-partitions=1", |
| 4821 | 4825 | // MEASURED (r1): at `--min-partition-size=16` aomenc codes |
| @@ -4824,7 +4828,7 @@ mod tests { | ||
| 4824 | 4828 | // surface) in 12/40 attempts. 32 keeps this gate's two |
| 4825 | 4829 | // reachable levels -- the 32-level 32x8/8x32 and the |
| 4826 | 4830 | // superblock-level 64x16/16x64 -- and nothing else. |
| 4827 | - "--min-partition-size=32", | |
| 4831 | + "--min-partition-size=16", | |
| 4828 | 4832 | "--max-partition-size=64", |
| 4829 | 4833 | // MEASURED (r1): with tx-size search ON, 8/40 attempts stop |
| 4830 | 4834 | // at the 2:1 strip's own split-tx refusal (merge-cross-product, |
| @@ -4852,10 +4856,10 @@ mod tests { | ||
| 4852 | 4856 | "--enable-interintra-wedge=0", |
| 4853 | 4857 | "--enable-smooth-interintra=0", |
| 4854 | 4858 | "--enable-ab-partitions=0", |
| 4855 | - "--enable-smooth-intra=0", | |
| 4856 | - "--enable-paeth-intra=0", | |
| 4857 | - "--enable-directional-intra=0", | |
| 4858 | - "--enable-angle-delta=0", | |
| 4859 | + "--enable-smooth-intra=1", | |
| 4860 | + "--enable-paeth-intra=1", | |
| 4861 | + "--enable-directional-intra=1", | |
| 4862 | + "--enable-angle-delta=1", | |
| 4859 | 4863 | "--enable-cdef=0", |
| 4860 | 4864 | "--enable-restoration=0", |
| 4861 | 4865 | // Ledger dead-end (lane-r14): a NEW gate spelling |
| @@ -4867,7 +4871,7 @@ mod tests { | ||
| 4867 | 4871 | // would buy no coverage. |
| 4868 | 4872 | "--enable-palette=0", |
| 4869 | 4873 | "--enable-intrabc=0", |
| 4870 | - "--enable-cfl-intra=0", | |
| 4874 | + "--enable-cfl-intra=1", | |
| 4871 | 4875 | "--enable-ref-frame-mvs=0", |
| 4872 | 4876 | "--obu", |
| 4873 | 4877 | "-o", |
| @@ -4920,6 +4924,16 @@ mod tests { | ||
| 4920 | 4924 | frames 64x16={} 16x64={} 32x8={} 8x32={}", |
| 4921 | 4925 | delta[0], delta[1], delta[2], delta[3] |
| 4922 | 4926 | ); |
| 4927 | + eprintln!( | |
| 4928 | + "intra14 probe seed={seed}: sb_rect4 h={} v={} | rect4_32 h={} v={} hi={} vi={} | intra_rect h={:?}", | |
| 4929 | + crate::decode::sb_rect4_horz_hits(), | |
| 4930 | + crate::decode::sb_rect4_vert_hits(), | |
| 4931 | + crate::decode::rect4_32_horz_hits(), | |
| 4932 | + crate::decode::rect4_32_vert_hits(), | |
| 4933 | + crate::decode::rect4_32_horz_inter_hits(), | |
| 4934 | + crate::decode::rect4_32_vert_inter_hits(), | |
| 4935 | + (0..3).map(crate::decode::intra_rect_strip_in_inter_hits).collect::<Vec<_>>(), | |
| 4936 | + ); | |
| 4923 | 4937 | for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() { |
| 4924 | 4938 | for (plane, (g, w)) in [ |
| 4925 | 4939 | ("Y", (&got.y, &want.y)), |