diff options
author | David Conrad <david_conrad@apple.com> | 2022-06-08 01:10:39 +0300 |
---|---|---|
committer | David Conrad <david_conrad@apple.com> | 2022-09-15 03:28:22 +0300 |
commit | eb25f00cb16d7d57583ab17678cf25555e9ab81a (patch) | |
tree | 4f3b94126520a312e8c704a71a6c3556643b8c59 | |
parent | 10f5ce5441778a2f1e2bdf8da09395b51d295401 (diff) |
Fix calculation of OBMC lap dimensions
Individual OBMC lapped predictions have a max width of 64 pixels
for the top lap and have a max height of 64 for the left laps
This is 7.11.3.9. Overlapped motion compensation process
step4 = Clip3( 2, 16, Num_4x4_Blocks_Wide[ candSz ] )
dav1d wasn't clipping this as needed, which means that with scaled MC, the
interpolation of the 2nd half of a 128 block was incorrect, since mx/my
for subpel filter selection need to be reset at the 64 pixel boundary
-rw-r--r-- | src/recon_tmpl.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/recon_tmpl.c b/src/recon_tmpl.c index 5f49910..3158ef5 100644 --- a/src/recon_tmpl.c +++ b/src/recon_tmpl.c @@ -1096,9 +1096,10 @@ static int obmc(Dav1dTaskContext *const t, // only odd blocks are considered for overlap handling, hence +1 const refmvs_block *const a_r = &r[-1][t->bx + x + 1]; const uint8_t *const a_b_dim = dav1d_block_dimensions[a_r->bs]; + const int step4 = iclip(a_b_dim[0], 2, 16); if (a_r->ref.ref[0] > 0) { - const int ow4 = iclip(a_b_dim[0], 2, b_dim[0]); + const int ow4 = imin(step4, b_dim[0]); const int oh4 = imin(b_dim[1], 16) >> 1; res = mc(t, lap, NULL, ow4 * h_mul * sizeof(pixel), ow4, (oh4 * 3 + 3) >> 2, t->bx + x, t->by, pl, a_r->mv.mv[0], @@ -1109,7 +1110,7 @@ static int obmc(Dav1dTaskContext *const t, h_mul * ow4, v_mul * oh4); i++; } - x += imax(a_b_dim[0], 2); + x += step4; } } @@ -1118,10 +1119,11 @@ static int obmc(Dav1dTaskContext *const t, // only odd blocks are considered for overlap handling, hence +1 const refmvs_block *const l_r = &r[y + 1][t->bx - 1]; const uint8_t *const l_b_dim = dav1d_block_dimensions[l_r->bs]; + const int step4 = iclip(l_b_dim[1], 2, 16); if (l_r->ref.ref[0] > 0) { const int ow4 = imin(b_dim[0], 16) >> 1; - const int oh4 = iclip(l_b_dim[1], 2, b_dim[1]); + const int oh4 = imin(step4, b_dim[1]); res = mc(t, lap, NULL, h_mul * ow4 * sizeof(pixel), ow4, oh4, t->bx, t->by + y, pl, l_r->mv.mv[0], &f->refp[l_r->ref.ref[0] - 1], l_r->ref.ref[0] - 1, @@ -1131,7 +1133,7 @@ static int obmc(Dav1dTaskContext *const t, dst_stride, lap, h_mul * ow4, v_mul * oh4); i++; } - y += imax(l_b_dim[1], 2); + y += step4; } return 0; } |