lane-av1422warp: the chroma-above reference is one mi column right of libaom's
Browse files at this commitcc66ecf830aa575318dce979ae5656b058894c77Parent: 16a2dff1 changed file +26 -16
- crates/ec-av1/src/decode.rs +26 -16
crates/ec-av1/src/decode.rsmodified+26 -16
| @@ -8953,24 +8953,17 @@ impl Neighbours { | |||
| 8953 | // mi(5,15): left neighbour SMOOTH_V at mi(5,14), read at mi(4,13)). | 8953 | // mi(5,15): left neighbour SMOOTH_V at mi(5,14), read at mi(4,13)). |
| 8954 | let snap_y = (1usize << ss_y(fctx)) - 1; | 8954 | let snap_y = (1usize << ss_y(fctx)) - 1; |
| 8955 | let snap_x = (1usize << ss_x(fctx)) - 1; | 8955 | let snap_x = (1usize << ss_x(fctx)) - 1; |
| 8956 | - // `set_mi_row_col` (libaom `av1_common_int.h:1395-1412`) puts the two | 8956 | + // The snap IS libaom's `base_mi` de-offsetting (`set_mi_row_col`, |
| 8957 | - // chroma references at `base_mi[-stride + ss_x]` and | 8957 | + // `av1_common_int.h:1395-1412`): `base_mi` is the block's own mi moved |
| 8958 | - // `base_mi[ss_y*stride - 1]`, with `base_mi` the block's own mi already | 8958 | + // by `-(mi_row & ss_y) * stride - (mi_col & ss_x)`. The helper applies |
| 8959 | - // de-offset by `(mi_row & ss_y)` / `(mi_col & ss_x)`. The snap above IS | 8959 | + // the two chroma-reference offsets on top of it -- see its own comment |
| 8960 | - // that de-offsetting, so the references are | 8960 | + // for which axis each one moves. |
| 8961 | - // `(snapped_r + ss_y - 1, snapped_c + ss_x)` and | ||
| 8962 | - // `(snapped_r, snapped_c - 1)` -- NOT `(snapped_r - 1, snapped_c)` / | ||
| 8963 | - // `(snapped_r, snapped_c - 1)` as this used to read them. At 4:4:4 | ||
| 8964 | - // both shifts vanish; at 4:2:0 and 4:2:2 the above reference sits one | ||
| 8965 | - // mi column further right (one chroma column spans two luma mi | ||
| 8966 | - // columns, so the chroma edge reaches into the right-hand luma block) | ||
| 8967 | - // and the left reference one mi row further up. | ||
| 8968 | self.smooth_uv_neighbour_unsnapped( | 8961 | self.smooth_uv_neighbour_unsnapped( |
| 8969 | mi_r & !snap_y, | 8962 | mi_r & !snap_y, |
| 8970 | mi_c & !snap_x, | 8963 | mi_c & !snap_x, |
| 8971 | r, | 8964 | r, |
| 8972 | c, | 8965 | c, |
| 8973 | - (ss_x(fctx), ss_y(fctx)), | 8966 | + ss_x(fctx), |
| 8974 | ) | 8967 | ) |
| 8975 | } | 8968 | } |
| 8976 | 8969 | ||
| @@ -8985,7 +8978,7 @@ impl Neighbours { | |||
| 8985 | mi_c: usize, | 8978 | mi_c: usize, |
| 8986 | r: usize, | 8979 | r: usize, |
| 8987 | c: usize, | 8980 | c: usize, |
| 8988 | - (ss_x, ss_y): (usize, usize), | 8981 | + ss_x: usize, |
| 8989 | ) -> bool { | 8982 | ) -> bool { |
| 8990 | // lane-mtfix r1: availability is TILE-relative on BOTH axes and on the | 8983 | // lane-mtfix r1: availability is TILE-relative on BOTH axes and on the |
| 8991 | // coarse fallback too. `above_uv_mode` is a frame-wide [`SUB`]-grid | 8984 | // coarse fallback too. `above_uv_mode` is a frame-wide [`SUB`]-grid |
| @@ -9018,7 +9011,24 @@ impl Neighbours { | |||
| 9018 | // identity on the values this already read (measured: the 4:2:0 | 9011 | // identity on the values this already read (measured: the 4:2:0 |
| 9019 | // control stream is byte-exact with them folded in), and at 4:4:4 | 9012 | // control stream is byte-exact with them folded in), and at 4:4:4 |
| 9020 | // `ss_x == 0` does the same -- so only 4:2:2 takes the new column. | 9013 | // `ss_x == 0` does the same -- so only 4:2:2 takes the new column. |
| 9021 | - let above_mi = (mi_r.saturating_sub(1), mi_c); | 9014 | + // `set_mi_row_col` (libaom `av1_common_int.h:1395-1412`), with `mi_r`/ |
| 9015 | + // `mi_c` already de-offset by the caller's `(mi_row & ss_y)` / | ||
| 9016 | + // `(mi_col & ss_x)` snap, i.e. already libaom's `base_mi`: | ||
| 9017 | + // chroma_above_mi = base_mi[-stride + ss_x] | ||
| 9018 | + // chroma_left_mi = base_mi[ss_y*stride - 1] | ||
| 9019 | + // The second offset is `ss_y` ROWS down and one COLUMN left; at every | ||
| 9020 | + // subsampling `ss_y*stride - 1` lands on `base_mi`'s OWN row (the row | ||
| 9021 | + // term is at most `stride - 1` elements, so its row delta is 0), so | ||
| 9022 | + // the left read is `(mi_r, mi_c - 1)` -- unchanged. The first offset | ||
| 9023 | + // is one row up and `ss_x` columns right, and the `ss_x` COLUMN was | ||
| 9024 | + // what this dropped: one chroma column spans two luma mi columns, so | ||
| 9025 | + // the chroma edge reaches into the right-hand luma block and that is | ||
| 9026 | + // where its reference lives. | ||
| 9027 | + // | ||
| 9028 | + // Measured: the column term is right at EVERY subsampling -- the | ||
| 9029 | + // 4:2:0 control is byte-exact with it folded in, and 4:4:4 is | ||
| 9030 | + // untouched because `ss_x == 0` there. | ||
| 9031 | + let above_mi = (mi_r.saturating_sub(1), mi_c + ss_x); | ||
| 9022 | let left_mi = (mi_r, mi_c.saturating_sub(1)); | 9032 | let left_mi = (mi_r, mi_c.saturating_sub(1)); |
| 9023 | let above = match self.uv_mode_col.get(above_mi.1) { | 9033 | let above = match self.uv_mode_col.get(above_mi.1) { |
| 9024 | _ if have_above && let Some(m) = cell(&self.uv_mode_grid, above_mi.0, above_mi.1) => m, | 9034 | _ if have_above && let Some(m) = cell(&self.uv_mode_grid, above_mi.0, above_mi.1) => m, |
| @@ -15505,7 +15515,7 @@ fn decode_rect4_16_strip( | |||
| 15505 | // directional chroma strip, moving 4 samples by 1. | 15515 | // directional chroma strip, moving 4 samples by 1. |
| 15506 | let smooth_neighbor_uv = | 15516 | let smooth_neighbor_uv = |
| 15507 | neighbours.smooth_uv_neighbour(pair_mi.0, pair_mi.1, r, c, fctx); | 15517 | neighbours.smooth_uv_neighbour(pair_mi.0, pair_mi.1, r, c, fctx); |
| 15508 | - if smooth_neighbor_uv != neighbours.smooth_uv_neighbour_unsnapped(lmi.0, lmi.1, r, c, (ss_x(fctx), ss_y(fctx))) | 15518 | + if smooth_neighbor_uv != neighbours.smooth_uv_neighbour_unsnapped(lmi.0, lmi.1, r, c, ss_x(fctx)) |
| 15509 | { | 15519 | { |
| 15510 | hit!(RECT4_16_UV_PAIR_FILT_HITS); | 15520 | hit!(RECT4_16_UV_PAIR_FILT_HITS); |
| 15511 | } | 15521 | } |