The warp-sample top-right probe needs libaom's rect shape refinements, not just the longer side
Browse files at this commit00aa4498c0f89da2f4321bea1562572089789fc5Parent: 91fac5a- fix
- the warp-sample top-right probe needs libaom's rect shape refinements, not just the longer side
2 changed files +26 -6
crates/ec-av1/src/decode.rsmodified+1 -1
| @@ -18991,7 +18991,7 @@ fn find_samples( | ||
| 18991 | 18991 | // `num_proj_ref >= 1` picked the 3-symbol `motion_mode_cdf` where |
| 18992 | 18992 | // libaom reads the 2-symbol `obmc_cdf` (class |
| 18993 | 18993 | // wrong-alphabet-same-value). |
| 18994 | - let tr_reach = has_top_right(mi_row, mi_col, bw4.max(bh4)); | |
| 18994 | + let tr_reach = crate::mvstack::has_top_right(mi_row, mi_col, bw4, bh4); | |
| 18995 | 18995 | if do_tr && bw4 != bh4 && tr_reach != has_top_right(mi_row, mi_col, bw4) { |
| 18996 | 18996 | TR_REACH_LONGER_SIDE_HITS.with(|c| c.set(c.get() + 1)); |
| 18997 | 18997 | } |
crates/ec-av1/src/mvstack.rsmodified+25 -5
| @@ -688,11 +688,13 @@ fn top_right_scan_allowed(bw4: usize, bh4: usize) -> bool { | ||
| 688 | 688 | /// (what this module did before lane-sb128 r2) cannot see. It cost frame 6 of |
| 689 | 689 | /// the 128 inter gate 380 wrong luma bytes with the entropy stream in sync. |
| 690 | 690 | /// |
| 691 | -/// corner-cut: libaom's three shape refinements (`is_last_vertical_rect`, | |
| 692 | -/// `is_first_horizontal_rect`, the `PARTITION_VERT_A` bottom-left square) are | |
| 693 | -/// not ported -- the ceiling is rectangular and AB-partitioned INTER leaves, | |
| 694 | -/// which this decoder refuses by name today; port them with the rect inter | |
| 695 | -/// leaf. | |
| 691 | +/// lane-t900 r10 ports `is_last_vertical_rect` and `is_first_horizontal_rect` | |
| 692 | +/// (both derivable from `mi_row`/`mi_col`/`bw4`/`bh4` alone). | |
| 693 | +/// corner-cut: libaom's third refinement (the `PARTITION_VERT_A` bottom-left | |
| 694 | +/// SQUARE, which needs the parent partition type this port does not thread | |
| 695 | +/// here) is still missing -- ceiling is a square INTER leaf inside a VERT_A | |
| 696 | +/// partition whose warp-sample top-right probe may answer 1 where libaom says | |
| 697 | +/// 0; upgrade path = thread `partition` into this call. | |
| 696 | 698 | pub(crate) fn has_top_right(mi_row: usize, mi_col: usize, bw4: usize, bh4: usize) -> bool { |
| 697 | 699 | let sb_mi_size = crate::decode::sb_mi_cur() as usize; |
| 698 | 700 | let bs0 = bw4.max(bh4); |
| @@ -713,6 +715,24 @@ pub(crate) fn has_top_right(mi_row: usize, mi_col: usize, bw4: usize, bh4: usize | ||
| 713 | 715 | } |
| 714 | 716 | bs <<= 1; |
| 715 | 717 | } |
| 718 | + // lane-t900 r10: two of libaom's three shape refinements, computed from | |
| 719 | + // the block's own position and side (`av1_common_int.h:1419-1428` sets | |
| 720 | + // `is_last_vertical_rect` / `is_first_horizontal_rect` from exactly these | |
| 721 | + // terms, no partition context). They only bite when `bw4 != bh4`, which is | |
| 722 | + // also the only case where `bs0` differs from the block's width -- probing | |
| 723 | + // at the longer side WITHOUT them is half a port and moved the first | |
| 724 | + // divergence of the 10-bit 1080p cut EARLIER (r9). | |
| 725 | + if bw4 < bh4 { | |
| 726 | + let is_last_vertical_rect = (mi_col + bw4) & (bh4 - 1) == 0; | |
| 727 | + if !is_last_vertical_rect { | |
| 728 | + has_tr = true; | |
| 729 | + } | |
| 730 | + } else if bw4 > bh4 { | |
| 731 | + let is_first_horizontal_rect = mi_row & (bw4 - 1) == 0; | |
| 732 | + if !is_first_horizontal_rect { | |
| 733 | + has_tr = false; | |
| 734 | + } | |
| 735 | + } | |
| 716 | 736 | has_tr |
| 717 | 737 | } |
| 718 | 738 |