Commit 66220021 authored by Ronald S. Bultje's avatar Ronald S. Bultje Committed by Luc Trudeau

Use picture, not block, boundaries for edge extension conditions.

parent 9075f0ee
......@@ -220,12 +220,14 @@ void bytefn(dav1d_loopfilter_sbrow)(const Dav1dFrameContext *const f,
int sby, const int start_of_tile_row)
{
int x, have_left;
// Don't filter outside the frame
const int hy4 = (f->cur.p.p.h + 3) >> 2;
const int have_top = sby > 0;
const int is_sb64 = !f->seq_hdr.sb128;
const int starty4 = (sby & is_sb64) << 4;
const int sbsz = 32 >> is_sb64;
const int sbl2 = 5 - is_sb64;
const int endy4 = starty4 + imin(f->bh - sby * f->sb_step, sbsz);
const int endy4 = starty4 + imin(hy4 - sby * f->sb_step, sbsz);
const int halign = (f->bh + 31) & ~31;
const int ss_ver = f->cur.p.p.layout == DAV1D_PIXEL_LAYOUT_I420;
const int ss_hor = f->cur.p.p.layout != DAV1D_PIXEL_LAYOUT_I444;
......
......@@ -284,8 +284,8 @@ void bytefn(dav1d_lr_sbrow)(Dav1dFrameContext *const f, pixel *const dst[3],
((f->frame_hdr.restoration.type[2] != RESTORATION_NONE) << 2);
if (restore_planes & LR_RESTORE_Y) {
const int h = f->bh << 2;
const int w = f->bw << 2;
const int h = f->cur.p.p.h;
const int w = f->cur.p.p.w;
const int row_h = imin((sby + 1) << (6 + f->seq_hdr.sb128), h);
const int y_stripe = (sby << (6 + f->seq_hdr.sb128)) - offset_y;
lr_sbrow(f, dst[0] - offset_y * PXSTRIDE(dst_stride[0]), y_stripe, w,
......@@ -294,8 +294,8 @@ void bytefn(dav1d_lr_sbrow)(Dav1dFrameContext *const f, pixel *const dst[3],
if (restore_planes & (LR_RESTORE_U | LR_RESTORE_V)) {
const int ss_ver = f->cur.p.p.layout == DAV1D_PIXEL_LAYOUT_I420;
const int ss_hor = f->cur.p.p.layout != DAV1D_PIXEL_LAYOUT_I444;
const int h = f->bh << (2 - ss_ver);
const int w = f->bw << (2 - ss_hor);
const int h = (f->cur.p.p.h + ss_ver) >> ss_ver;
const int w = (f->cur.p.p.w + ss_hor) >> ss_hor;
const int row_h = imin((sby + 1) << ((6 - ss_ver) + f->seq_hdr.sb128), h);
const ptrdiff_t offset_uv = offset_y >> ss_ver;
const int y_stripe =
......
......@@ -521,11 +521,13 @@ static void mc(Dav1dTileContext *const t,
if (refp != &f->cur) // i.e. not for intrabc
dav1d_thread_picture_wait(refp, dy + bh4 * v_mul + !!my * 4,
PLANE_TYPE_Y + !!pl);
if (dx < 3 || dx + bw4 * h_mul + 4 > f->bw * h_mul ||
dy < 3 || dy + bh4 * v_mul + 4 > f->bh * v_mul)
if (dx < 3 || dx + bw4 * h_mul + 4 > ((f->cur.p.p.w + ss_hor) >> ss_hor) ||
dy < 3 || dy + bh4 * v_mul + 4 > ((f->cur.p.p.h + ss_ver) >> ss_ver))
{
emu_edge(t->emu_edge, 160 * sizeof(pixel), refp->p.data[pl], ref_stride,
bw4 * h_mul + 7, bh4 * v_mul + 7, f->bw * h_mul, f->bh * v_mul,
bw4 * h_mul + 7, bh4 * v_mul + 7,
(f->cur.p.p.w + ss_hor) >> ss_hor,
(f->cur.p.p.h + ss_ver) >> ss_ver,
dx - 3, dy - 3);
ref = &t->emu_edge[160 * 3 + 3];
ref_stride = 160 * sizeof(pixel);
......@@ -632,7 +634,8 @@ static void warp_affine(Dav1dTileContext *const t,
const int h_mul = 4 >> ss_hor, v_mul = 4 >> ss_ver;
assert(!((b_dim[0] * h_mul) & 7) && !((b_dim[1] * v_mul) & 7));
const int32_t *const mat = wmp->matrix;
const int width = f->bw * h_mul, height = f->bh * v_mul;
const int width = (f->cur.p.p.w + ss_hor) >> ss_hor;
const int height = (f->cur.p.p.h + ss_ver) >> ss_ver;
for (int y = 0; y < b_dim[1] * v_mul; y += 8) {
for (int x = 0; x < b_dim[0] * h_mul; x += 8) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment