S7: vp8 mc uses the one mb_edges in modes.rs (same values; was a duplicate with vis-size arguments)
Browse files at this commit91fc6e60e84fc8b46cc352e747a4e89a1fab7c0dParent: 4452a0c1 changed file +3 -25
- crates/ec-vp8/src/mc.rs +3 -25
crates/ec-vp8/src/mc.rsmodified+3 -25
| @@ -23,6 +23,7 @@ | ||
| 23 | 23 | //! [RFC 6386]: https://www.rfc-editor.org/rfc/rfc6386 |
| 24 | 24 | use archmage::SimdToken; |
| 25 | 25 | use multiversion::target::match_target; |
| 26 | +use crate::modes; | |
| 26 | 27 | |
| 27 | 28 | /// `VP8_FILTER_WEIGHT` (filter.c): tap weights sum to this, DC passes. |
| 28 | 29 | const VP8_FILTER_WEIGHT: i32 = 128; |
| @@ -755,29 +756,6 @@ fn clamp_read_origin( | ||
| 755 | 756 | (sx.clamp(2, max_x) as usize, sy.clamp(2, max_y) as usize) |
| 756 | 757 | } |
| 757 | 758 | |
| 758 | -/// The macroblock-level UMV border edges in eighth-pel units, exactly the | |
| 759 | -/// decoder's `xd->mb_to_{left,right,top,bottom}_edge` (decodeframe.c:503-532): | |
| 760 | -/// | |
| 761 | -/// ```c | |
| 762 | -/// xd->mb_to_top_edge = -((mb_row * 16) << 3); | |
| 763 | -/// xd->mb_to_bottom_edge = ((mb_rows - 1 - mb_row) * 16) << 3; | |
| 764 | -/// xd->mb_to_left_edge = -((mb_col * 16) << 3); | |
| 765 | -/// xd->mb_to_right_edge = ((mb_cols - 1 - mb_col) * 16) << 3; | |
| 766 | -/// ``` | |
| 767 | -/// | |
| 768 | -/// with `mb_rows`/`mb_cols` the full (partial MB inclusive) MB counts of the | |
| 769 | -/// visible frame. Returns `(left, right, top, bottom)`. | |
| 770 | -fn mb_edges(mb_col: usize, mb_row: usize, vis_w: usize, vis_h: usize) -> (i32, i32, i32, i32) { | |
| 771 | - let mb_cols = (vis_w + 15) >> 4; | |
| 772 | - let mb_rows = (vis_h + 15) >> 4; | |
| 773 | - debug_assert!(mb_col < mb_cols && mb_row < mb_rows); | |
| 774 | - let left = -(((mb_col * 16) as i32) << 3); | |
| 775 | - let right = (((mb_cols - 1 - mb_col) * 16) as i32) << 3; | |
| 776 | - let top = -(((mb_row * 16) as i32) << 3); | |
| 777 | - let bottom = (((mb_rows - 1 - mb_row) * 16) as i32) << 3; | |
| 778 | - (left, right, top, bottom) | |
| 779 | -} | |
| 780 | - | |
| 781 | 759 | /// Port of `clamp_mv_to_umv_border` (reconinter.c:257-278), luma MV in |
| 782 | 760 | /// eighth-pel units: |
| 783 | 761 | /// |
| @@ -797,7 +775,7 @@ fn mb_edges(mb_col: usize, mb_row: usize, vis_w: usize, vis_h: usize) -> (i32, i | ||
| 797 | 775 | /// when `need_to_clamp_mvs` is set, for each SPLITMV subblock MV too |
| 798 | 776 | /// (reconinter.c:370-375, 397-400). |
| 799 | 777 | fn clamp_mv_to_umv_border(mv: &mut (i32, i32), mb_col: usize, mb_row: usize, vis_w: usize, vis_h: usize) { |
| 800 | - let (left, right, top, bottom) = mb_edges(mb_col, mb_row, vis_w, vis_h); | |
| 778 | + let (left, right, top, bottom) = modes::mb_edges(mb_col, mb_row, (vis_w + 15) >> 4, (vis_h + 15) >> 4); | |
| 801 | 779 | if mv.1 < left - (19 << 3) { |
| 802 | 780 | mv.1 = left - (16 << 3); |
| 803 | 781 | } else if mv.1 > right + (18 << 3) { |
| @@ -836,7 +814,7 @@ fn clamp_mv_to_umv_border(mv: &mut (i32, i32), mb_col: usize, mb_row: usize, vis | ||
| 836 | 814 | /// (reconinter.c:336-339 — the 16x16 path clamps the chroma MV |
| 837 | 815 | /// unconditionally for exactly this reason). |
| 838 | 816 | fn clamp_uvmv_to_umv_border(mv: &mut (i32, i32), mb_col: usize, mb_row: usize, vis_w: usize, vis_h: usize) { |
| 839 | - let (left, right, top, bottom) = mb_edges(mb_col, mb_row, vis_w, vis_h); | |
| 817 | + let (left, right, top, bottom) = modes::mb_edges(mb_col, mb_row, (vis_w + 15) >> 4, (vis_h + 15) >> 4); | |
| 840 | 818 | |
| 841 | 819 | if 2 * mv.1 < left - (19 << 3) { |
| 842 | 820 | mv.1 = (left - (16 << 3)) >> 1; |