The 64-axis 1:4 var-tx gate now HARD-ASSERTS its arm fires -- rect var-tx leaves decoded out of two real aomenc streams (32x16=4, 16x32=1 at 8-bit)
Browse files at this commitadb8dd932f3e1917114409821bbbb26e86b020bcParent: e79f672- test
- the 64-axis 1:4 var-tx gate now HARD-ASSERTS its arm fires -- rect var-tx leaves decoded out of two real aomenc streams (32x16=4, 16x32=1 at 8-bit)
1 changed file +66 -32
- crates/ec-av1/src/stream.rs +66 -32
crates/ec-av1/src/stream.rsmodified+66 -32
| @@ -6749,9 +6749,9 @@ mod tests { | |||
| 6749 | /// SKIPped), attempts that carried no rectangular var-tx leaf counted | 6749 | /// SKIPped), attempts that carried no rectangular var-tx leaf counted |
| 6750 | /// separately and still required pixel-exact. | 6750 | /// separately and still required pixel-exact. |
| 6751 | #[test] | 6751 | #[test] |
| 6752 | - fn a_real_aomenc_inter_1to4_recipe_decodes_pixel_exact_or_refuses_by_name() { | 6752 | + fn real_aomenc_1to4_streams_decode_pixel_exact_and_rect_vartx_leaves_fire_before_a_named_refusal() { |
| 6753 | const NAME: &str = | 6753 | const NAME: &str = |
| 6754 | - "a_real_aomenc_inter_1to4_recipe_decodes_pixel_exact_or_refuses_by_name"; | 6754 | + "real_aomenc_1to4_streams_decode_pixel_exact_and_rect_vartx_leaves_fire_before_a_named_refusal"; |
| 6755 | let _gate_lock = lock_gate_counters(); | 6755 | let _gate_lock = lock_gate_counters(); |
| 6756 | if !have_ffmpeg() { | 6756 | if !have_ffmpeg() { |
| 6757 | eprintln!("SKIP {NAME}: no ffmpeg"); | 6757 | eprintln!("SKIP {NAME}: no ffmpeg"); |
| @@ -6761,16 +6761,35 @@ mod tests { | |||
| 6761 | eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); | 6761 | eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); |
| 6762 | return; | 6762 | return; |
| 6763 | } | 6763 | } |
| 6764 | - let (width, height, frame_count) = (192usize, 128usize, 6usize); | 6764 | + let frame_count = 6usize; |
| 6765 | for bit_depth in [8u32, 10u32] { | 6765 | for bit_depth in [8u32, 10u32] { |
| 6766 | let (mut named_refusals, mut compared, mut out_of_scope, mut oos_mismatch) = | 6766 | let (mut named_refusals, mut compared, mut out_of_scope, mut oos_mismatch) = |
| 6767 | (0u32, 0u32, 0u32, 0u32); | 6767 | (0u32, 0u32, 0u32, 0u32); |
| 6768 | let (mut leaf_32x16, mut leaf_16x32) = (0usize, 0usize); | 6768 | let (mut leaf_32x16, mut leaf_16x32) = (0usize, 0usize); |
| 6769 | - for attempt in 0..16u32 { | 6769 | + // Leaves decoded on ANY attempt, including one whose stream hits a |
| 6770 | + // later named refusal: the firing half of this gate, kept apart | ||
| 6771 | + // from `leaf_32x16`/`leaf_16x32` (pixel-compared attempts only) so | ||
| 6772 | + // a refused stream is never counted as a pixel proof | ||
| 6773 | + // (class counter-from-refused-stream). | ||
| 6774 | + let (mut fired_32x16, mut fired_16x32) = (0usize, 0usize); | ||
| 6775 | + for attempt in 0..18u32 { | ||
| 6770 | // Two orientations (the transposed pair a one-sided gate could | 6776 | // Two orientations (the transposed pair a one-sided gate could |
| 6771 | // never separate) x four quantisers x two motion steps. | 6777 | // never separate) x four quantisers x two motion steps. |
| 6778 | + // lane-r14 r4 recipe hunt (~70 aomenc runs on the merged | ||
| 6779 | + // tree: testsrc2 / life / mandelbrot / banded motion, 64x64 up | ||
| 6780 | + // to 384x256, cq 20..58): attempts 16-17 carry the only recipe | ||
| 6781 | + // found that makes aomenc code a 64-axis 1:4 strip whose | ||
| 6782 | + // transform SPLITS -- 384x256, per-16-column band motion, | ||
| 6783 | + // cq 32 (16x32 leaves) and cq 38 (32x16 leaves). | ||
| 6784 | + let firing = attempt >= 16; | ||
| 6785 | + let (width, height) = | ||
| 6786 | + if firing { (384usize, 256usize) } else { (192usize, 128usize) }; | ||
| 6772 | let vertical = attempt % 2 == 1; | 6787 | let vertical = attempt % 2 == 1; |
| 6773 | - let cq = [30, 36, 44, 52][(attempt / 2 % 4) as usize]; | 6788 | + let cq = if firing { |
| 6789 | + [32, 38][(attempt - 16) as usize] | ||
| 6790 | + } else { | ||
| 6791 | + [30, 36, 44, 52][(attempt / 2 % 4) as usize] | ||
| 6792 | + }; | ||
| 6774 | let sp = 3 + (attempt / 8) * 3; | 6793 | let sp = 3 + (attempt / 8) * 3; |
| 6775 | // 16-pixel bands, each band translating at its OWN speed | 6794 | // 16-pixel bands, each band translating at its OWN speed |
| 6776 | // across the other axis: that is what makes aomenc's RD split | 6795 | // across the other axis: that is what makes aomenc's RD split |
| @@ -6778,7 +6797,10 @@ mod tests { | |||
| 6778 | // / `VERT_4`) with distinct motion vectors, and the texture | 6797 | // / `VERT_4`) with distinct motion vectors, and the texture |
| 6779 | // inside a band is what keeps the strip non-skip and its | 6798 | // inside a band is what keeps the strip non-skip and its |
| 6780 | // transform split. | 6799 | // transform split. |
| 6781 | - let geq = if vertical { | 6800 | + let geq = if firing { |
| 6801 | + "128+60*sin((Y-N*(1+0.37*mod(floor(X/16),4)))/3)+45*sin(Y/17+X/23)" | ||
| 6802 | + .to_string() | ||
| 6803 | + } else if vertical { | ||
| 6782 | format!( | 6804 | format!( |
| 6783 | "128+60*sin((Y+N*({sp}+9*mod(floor(X/16),2)))/7)+25*sin(X/11)" | 6805 | "128+60*sin((Y+N*({sp}+9*mod(floor(X/16),2)))/7)+25*sin(X/11)" |
| 6784 | ) | 6806 | ) |
| @@ -6822,7 +6844,7 @@ mod tests { | |||
| 6822 | "--enable-tx64=1", "--enable-rect-partitions=1", | 6844 | "--enable-tx64=1", "--enable-rect-partitions=1", |
| 6823 | "--enable-ab-partitions=0", "--enable-1to4-partitions=1", | 6845 | "--enable-ab-partitions=0", "--enable-1to4-partitions=1", |
| 6824 | "--enable-dual-filter=0", "--enable-obmc=0", | 6846 | "--enable-dual-filter=0", "--enable-obmc=0", |
| 6825 | - "--min-partition-size=32", "--max-partition-size=64", | 6847 | + "--min-partition-size=16", "--max-partition-size=64", |
| 6826 | "--obu", "-o", "-", "-", | 6848 | "--obu", "-o", "-", "-", |
| 6827 | ]; | 6849 | ]; |
| 6828 | let mut child = Command::new(aomenc_path()) | 6850 | let mut child = Command::new(aomenc_path()) |
| @@ -6854,14 +6876,24 @@ mod tests { | |||
| 6854 | "{NAME} failed outright, not a named refusal ({bit_depth}-bit, \ | 6876 | "{NAME} failed outright, not a named refusal ({bit_depth}-bit, \ |
| 6855 | attempt {attempt}): {msg}" | 6877 | attempt {attempt}): {msg}" |
| 6856 | ); | 6878 | ); |
| 6879 | + let after = crate::stream::vartx_rect_leaf_hits(); | ||
| 6880 | + fired_32x16 += after[0] - before[0]; | ||
| 6881 | + fired_16x32 += after[1] - before[1]; | ||
| 6857 | named_refusals += 1; | 6882 | named_refusals += 1; |
| 6858 | - eprintln!("{bit_depth}-bit attempt {attempt} refusal: {msg}"); | 6883 | + eprintln!( |
| 6884 | + "{bit_depth}-bit attempt {attempt} refusal (rect var-tx leaves \ | ||
| 6885 | + decoded before it: 32x16={}, 16x32={}): {msg}", | ||
| 6886 | + after[0] - before[0], | ||
| 6887 | + after[1] - before[1] | ||
| 6888 | + ); | ||
| 6859 | continue; | 6889 | continue; |
| 6860 | } | 6890 | } |
| 6861 | Ok(frames) => frames, | 6891 | Ok(frames) => frames, |
| 6862 | }; | 6892 | }; |
| 6863 | let after = crate::stream::vartx_rect_leaf_hits(); | 6893 | let after = crate::stream::vartx_rect_leaf_hits(); |
| 6864 | let (h32, v32) = (after[0] - before[0], after[1] - before[1]); | 6894 | let (h32, v32) = (after[0] - before[0], after[1] - before[1]); |
| 6895 | + fired_32x16 += h32; | ||
| 6896 | + fired_16x32 += v32; | ||
| 6865 | let ffmpeg_frames = if bit_depth == 10 { | 6897 | let ffmpeg_frames = if bit_depth == 10 { |
| 6866 | ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count) | 6898 | ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count) |
| 6867 | } else { | 6899 | } else { |
| @@ -6896,8 +6928,9 @@ mod tests { | |||
| 6896 | } | 6928 | } |
| 6897 | eprintln!( | 6929 | eprintln!( |
| 6898 | "{NAME} ({bit_depth}-bit): {named_refusals} named refusals, {compared} \ | 6930 | "{NAME} ({bit_depth}-bit): {named_refusals} named refusals, {compared} \ |
| 6899 | - pixel-exact attempts carrying the arm, 32x16 var-tx leaves={leaf_32x16}, \ | 6931 | + pixel-exact attempts carrying the arm, pixel-compared rect var-tx leaves \ |
| 6900 | - 16x32 var-tx leaves={leaf_16x32}, {out_of_scope} attempts carried none \ | 6932 | + 32x16={leaf_32x16} 16x32={leaf_16x32}, leaves decoded anywhere in the sweep \ |
| 6933 | + 32x16={fired_32x16} 16x32={fired_16x32}, {out_of_scope} attempts carried none \ | ||
| 6901 | ({oos_mismatch} of them mismatched)" | 6934 | ({oos_mismatch} of them mismatched)" |
| 6902 | ); | 6935 | ); |
| 6903 | assert_eq!( | 6936 | assert_eq!( |
| @@ -6905,29 +6938,30 @@ mod tests { | |||
| 6905 | "{NAME}: {oos_mismatch} attempt(s) with no rectangular var-tx leaf decoded \ | 6938 | "{NAME}: {oos_mismatch} attempt(s) with no rectangular var-tx leaf decoded \ |
| 6906 | but mismatched ffmpeg -- a defect of another shape, not a pass" | 6939 | but mismatched ffmpeg -- a defect of another shape, not a pass" |
| 6907 | ); | 6940 | ); |
| 6908 | - // MEASURED, lane-r14 r3 (5 recipe sweeps, 60+ aomenc runs over | ||
| 6909 | - // lavfi banded-motion / testsrc2 / life / mandelbrot, 192x128 and | ||
| 6910 | - // 384x256, cq 26..58, both min-partition-size arms): aomenc picks a | ||
| 6911 | - // superblock-level 1:4 partition ONLY on content rich enough that | ||
| 6912 | - // the same stream also contains at least one of {an intra HORZ/VERT | ||
| 6913 | - // strip, a 16x16-level AB/1:4 partition, an SB-level AB partition, | ||
| 6914 | - // an inter partition below 8x8, a 32x8/8x32 rect residual}, each of | ||
| 6915 | - // which is ANOTHER lane's live refusal and stops the decode first. | ||
| 6916 | - // So this gate cannot yet assert the arm FIRED on a pixel-exact | ||
| 6917 | - // attempt; it asserts what it can (nothing mis-decodes silently), | ||
| 6918 | - // prints the leaf counters, and the firing proof for this round is | ||
| 6919 | - // the real film (lanes/r14-r3.report.md: 14 rectangular 16x32 | ||
| 6920 | - // var-tx leaves decoded out of the ReelB -ss 4500 segment). | ||
| 6921 | - // Restore the hard assert below the moment one of those refusals | ||
| 6922 | - // lifts -- do not weaken it further. | ||
| 6923 | assert!( | 6941 | assert!( |
| 6924 | - compared + u32::from(named_refusals > 0) > 0, | 6942 | + compared + out_of_scope > 0, |
| 6925 | - "{NAME} ({bit_depth}-bit): no attempt produced anything at all" | 6943 | + "{NAME} ({bit_depth}-bit): every attempt refused -- the gate compared no pixels" |
| 6926 | - ); | 6944 | + ); |
| 6927 | - eprintln!( | 6945 | + // The firing half. MEASURED on the merged tree (lane-r14 r4, ~70 |
| 6928 | - "{NAME} ({bit_depth}-bit): arm-firing assert PARKED (see the comment at this \ | 6946 | + // aomenc runs): the 8-bit 384x256 banded recipe codes BOTH |
| 6929 | - line): 32x16={leaf_32x16}, 16x32={leaf_16x32}" | 6947 | + // orientations of the split -- cq 38 gives four 32x16 leaves (out |
| 6930 | - ); | 6948 | + // of four 64x16 strips), cq 32 one 16x32 leaf (out of four 16x64 |
| 6949 | + // strips). Those two streams stop LATER on another lane's live | ||
| 6950 | + // refusal ("an inter 16x16-level AB or 1:4 partition", "a non-skip | ||
| 6951 | + // rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual | ||
| 6952 | + // coding"), so the leaves are proved DECODED, not proved | ||
| 6953 | + // pixel-exact; every attempt that ran to the end is compared | ||
| 6954 | + // frame by frame above. At 10 bits the same sweep fires nothing | ||
| 6955 | + // (aomenc picks other shapes), so the firing assert is 8-bit only | ||
| 6956 | + // -- and it is a hard assert, never a print. | ||
| 6957 | + if bit_depth == 8 { | ||
| 6958 | + assert!( | ||
| 6959 | + fired_32x16 > 0 && fired_16x32 > 0, | ||
| 6960 | + "{NAME}: the rectangular var-tx leaf arm never fired (32x16={fired_32x16}, \ | ||
| 6961 | + 16x32={fired_16x32}, {named_refusals} refusals, {compared} compared) -- \ | ||
| 6962 | + `sub_tx_size_map[TX_64X16] == TX_32X16` is unproved by this gate" | ||
| 6963 | + ); | ||
| 6964 | + } | ||
| 6931 | } | 6965 | } |
| 6932 | } | 6966 | } |
| 6933 | 6967 | ||