lane-av1422warp: clamp the OBMC pair-merge snap so it cannot land below the block
Browse files at this commit2375b81ae41184ef9cb6ce5602519ba9c583bad4Parent: 650ffb21 changed file +11 -2
- crates/ec-av1/src/decode.rs +11 -2
crates/ec-av1/src/decode.rsmodified+11 -2
| @@ -31471,7 +31471,10 @@ fn overlappable_above( | |||
| 31471 | // The pair merge: the walk snaps back to the pair's even column | 31471 | // The pair merge: the walk snaps back to the pair's even column |
| 31472 | // and the ODD half (the chroma-carrying one) is the neighbour for | 31472 | // and the ODD half (the chroma-carrying one) is the neighbour for |
| 31473 | // both -- a 4-wide 1:4 strip is never an OBMC source on its own. | 31473 | // both -- a 4-wide 1:4 strip is never an OBMC source on its own. |
| 31474 | - col &= !1; | 31474 | + // lane-av1422warp r25: as in `overlappable_left`, snapping down |
| 31475 | + // lands on `mi_col - 1` at an ODD `mi_col` and the offsets below | ||
| 31476 | + // underflow (debug-build panic; `usize::MAX` in release). Clamp. | ||
| 31477 | + col = (col & !1).max(mi_col); | ||
| 31475 | src = col + 1; | 31478 | src = col + 1; |
| 31476 | nb = grid.get(mi_row - 1, src); | 31479 | nb = grid.get(mi_row - 1, src); |
| 31477 | step = 2; | 31480 | step = 2; |
| @@ -31524,7 +31527,13 @@ fn overlappable_left( | |||
| 31524 | // The pair merge, left-column mirror: a 4-TALL neighbour (a 16x4 | 31527 | // The pair merge, left-column mirror: a 4-TALL neighbour (a 16x4 |
| 31525 | // strip) is half of a chroma pair and the pair's SECOND row is the | 31528 | // strip) is half of a chroma pair and the pair's SECOND row is the |
| 31526 | // neighbour for both. | 31529 | // neighbour for both. |
| 31527 | - row &= !1; | 31530 | + // lane-av1422warp r25: `row &= !1` rounds DOWN, so at an ODD |
| 31531 | + // `mi_row` it lands on `mi_row - 1` and the `row - mi_row` | ||
| 31532 | + // offsets below underflow -- `usize::MAX` in release, and a | ||
| 31533 | + // debug-build panic ("attempt to subtract with overflow", | ||
| 31534 | + // `overlappable_left` called from `decode_inter_block`) with | ||
| 31535 | + // EC_TRACE_MODE_STEP set. Clamp: the offset can never be negative. | ||
| 31536 | + row = (row & !1).max(mi_row); | ||
| 31528 | src = row + 1; | 31537 | src = row + 1; |
| 31529 | nb = grid.get(src, mi_col - 1); | 31538 | nb = grid.get(src, mi_col - 1); |
| 31530 | step = 2; | 31539 | step = 2; |