The 1:4 rect var-tx gate asserted leaves its recipe never coded
Browse files at this commit303234190a270daffedf7a1c4a4cad50e1a4bec8Parent: 4730c95- test
- the 1:4 rect var-tx gate asserted leaves its recipe never coded
2 changed files +44 -20
- crates/ec-av1/src/decode.rs +3 -0
- crates/ec-av1/src/stream.rs +41 -20
crates/ec-av1/src/decode.rsmodified+3 -0
| @@ -1107,6 +1107,9 @@ pub(crate) fn vartx_rect_leaf4_hits() -> [usize; 2] { | |||
| 1107 | 1107 | ||
| 1108 | /// Records one rectangular var-tx leaf. | 1108 | /// Records one rectangular var-tx leaf. |
| 1109 | fn vartx_rect_leaf_hit(tw: usize, th: usize) { | 1109 | fn vartx_rect_leaf_hit(tw: usize, th: usize) { |
| 1110 | + if std::env::var_os("EC_VARTXLEAF").is_some() { | ||
| 1111 | + eprintln!("EC_VARTXLEAF tw={tw} th={th}"); | ||
| 1112 | + } | ||
| 1110 | let cell = if tw.min(th) == 4 { &VARTX_RECT_LEAF4_HITS } else { &VARTX_RECT_LEAF_HITS }; | 1113 | let cell = if tw.min(th) == 4 { &VARTX_RECT_LEAF4_HITS } else { &VARTX_RECT_LEAF_HITS }; |
| 1111 | cell.with(|c| { | 1114 | cell.with(|c| { |
| 1112 | let mut h = c.get(); | 1115 | let mut h = c.get(); |
crates/ec-av1/src/stream.rsmodified+41 -20
| @@ -8718,8 +8718,18 @@ mod tests { | |||
| 8718 | let (width, height) = | 8718 | let (width, height) = |
| 8719 | if firing { (384usize, 256usize) } else { (192usize, 128usize) }; | 8719 | if firing { (384usize, 256usize) } else { (192usize, 128usize) }; |
| 8720 | let vertical = attempt % 2 == 1; | 8720 | let vertical = attempt % 2 == 1; |
| 8721 | + // lane-vartxsplit r2, MEASURED against the oracle | ||
| 8722 | + // (`EC_VARTX` histogram, ~40 aomenc runs): at cq 10 this | ||
| 8723 | + // source splits NO rectangular transform at all -- aomdec | ||
| 8724 | + // reads only TX_8X8/TX_16X16/TX_8X16/TX_16X8 split symbols, | ||
| 8725 | + // so the leaves gaterecipe r1 counted here came out of a | ||
| 8726 | + // stream our decoder was already desynced on (class | ||
| 8727 | + // counter-from-refused-stream). cq 44 and 46 are the two | ||
| 8728 | + // quantisers of that sweep whose stream really carries | ||
| 8729 | + // `TX_32X8`/`TX_8X32` splits (16x8 and 8x16 rectangular | ||
| 8730 | + // var-tx leaves) AND decodes pixel-exact on all six frames. | ||
| 8721 | let cq = if firing { | 8731 | let cq = if firing { |
| 8722 | - 10 | 8732 | + if attempt == 16 { 44 } else { 46 } |
| 8723 | } else { | 8733 | } else { |
| 8724 | [30, 36, 44, 52][(attempt / 2 % 4) as usize] | 8734 | [30, 36, 44, 52][(attempt / 2 % 4) as usize] |
| 8725 | }; | 8735 | }; |
| @@ -8744,9 +8754,17 @@ mod tests { | |||
| 8744 | // the RD case for `txfm_partition`. | 8754 | // the RD case for `txfm_partition`. |
| 8745 | "128+90*sin((X+N*3)/6)*sin(Y/2)+50*sin((X*Y)/37)".to_string() | 8755 | "128+90*sin((X+N*3)/6)*sin(Y/2)+50*sin((X*Y)/37)".to_string() |
| 8746 | } else if firing { | 8756 | } else if firing { |
| 8747 | - // The transposed twin (a one-sided gate could never | 8757 | + // lane-vartxsplit r2: BOTH leaf orientations come out of |
| 8748 | - // separate 32x16 from 16x32). | 8758 | + // this one source (three 16x8 leaves and one 8x16 on |
| 8749 | - "128+90*sin((Y+N*3)/6)*sin(X/2)+50*sin((X*Y)/37)".to_string() | 8759 | + // attempt 16), so the firing pair is the same texture at |
| 8760 | + // two quantisers. Its transposed twin was measured over | ||
| 8761 | + // cq 40..56 and splits no rectangular transform at all; | ||
| 8762 | + // at cq 56 it also mismatches ffmpeg from decode-order | ||
| 8763 | + // frame 2 with ZERO rect var-tx leaves in it -- an open | ||
| 8764 | + // reconstruction defect (8-pixel-wide luma column, see | ||
| 8765 | + // lanes/vartxsplit-r2.report.md), not something to hide | ||
| 8766 | + // inside this gate's attempt list. | ||
| 8767 | + "128+90*sin((X+N*3)/6)*sin(Y/2)+50*sin((X*Y)/37)".to_string() | ||
| 8750 | } else if vertical { | 8768 | } else if vertical { |
| 8751 | format!( | 8769 | format!( |
| 8752 | "128+60*sin((Y+N*({sp}+9*mod(floor(X/16),2)))/7)+25*sin(X/11)" | 8770 | "128+60*sin((Y+N*({sp}+9*mod(floor(X/16),2)))/7)+25*sin(X/11)" |
| @@ -8900,24 +8918,27 @@ mod tests { | |||
| 8900 | compared + out_of_scope > 0, | 8918 | compared + out_of_scope > 0, |
| 8901 | "{NAME} ({bit_depth}-bit): every attempt refused -- the gate compared no pixels" | 8919 | "{NAME} ({bit_depth}-bit): every attempt refused -- the gate compared no pixels" |
| 8902 | ); | 8920 | ); |
| 8903 | - // The firing half. MEASURED on the merged tree (lane-r14 r4, ~70 | 8921 | + // The firing half. lane-vartxsplit r2 re-measured it against |
| 8904 | - // aomenc runs): the 8-bit 384x256 banded recipe codes BOTH | 8922 | + // the oracle: attempts 16/17 (384x256 product texture, cq 44/46, |
| 8905 | - // orientations of the split -- cq 38 gives four 32x16 leaves (out | 8923 | + // `--min-partition-size=8 --enable-tx-size-search=1`) are the only |
| 8906 | - // of four 64x16 strips), cq 32 one 16x32 leaf (out of four 16x64 | 8924 | + // recipes of a ~40-run sweep whose stream carries `TX_32X8` / |
| 8907 | - // strips). Those two streams stop LATER on another lane's live | 8925 | + // `TX_8X32` split symbols, i.e. RECTANGULAR var-tx leaves (16x8 |
| 8908 | - // refusal ("an inter 16x16-level AB or 1:4 partition", "a non-skip | 8926 | + // and 8x16, both orientations out of the same stream). They now |
| 8909 | - // rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual | 8927 | + // decode PIXEL-EXACT on all six frames, so the assert is on the |
| 8910 | - // coding"), so the leaves are proved DECODED, not proved | 8928 | + // pixel-compared tally, not on the "decoded anywhere" one -- |
| 8911 | - // pixel-exact; every attempt that ran to the end is compared | 8929 | + // `fired_*` stays only to separate a refused stream's leaves from |
| 8912 | - // frame by frame above. At 10 bits the same sweep fires nothing | 8930 | + // a proved one (class counter-from-refused-stream). At 10 bits |
| 8913 | - // (aomenc picks other shapes), so the firing assert is 8-bit only | 8931 | + // the same sweep either fires nothing or mismatches on a |
| 8914 | - // -- and it is a hard assert, never a print. | 8932 | + // reconstruction defect of another shape (report), so the firing |
| 8933 | + // assert stays 8-bit -- and it is a hard assert, never a print. | ||
| 8915 | if bit_depth == 8 { | 8934 | if bit_depth == 8 { |
| 8916 | assert!( | 8935 | assert!( |
| 8917 | - fired_32x16 > 0 && fired_16x32 > 0, | 8936 | + leaf_32x16 > 0 && leaf_16x32 > 0, |
| 8918 | - "{NAME}: the rectangular var-tx leaf arm never fired (32x16={fired_32x16}, \ | 8937 | + "{NAME}: the rectangular var-tx leaf arm never fired on a pixel-exact \ |
| 8919 | - 16x32={fired_16x32}, {named_refusals} refusals, {compared} compared) -- \ | 8938 | + attempt (pixel-compared 32x16={leaf_32x16}, 16x32={leaf_16x32}, decoded \ |
| 8920 | - `sub_tx_size_map[TX_64X16] == TX_32X16` is unproved by this gate" | 8939 | + anywhere 32x16={fired_32x16} 16x32={fired_16x32}, {named_refusals} \ |
| 8940 | + refusals, {compared} compared) -- the rectangular sub-transform path is \ | ||
| 8941 | + unproved by this gate" | ||
| 8921 | ); | 8942 | ); |
| 8922 | } | 8943 | } |
| 8923 | } | 8944 | } |