Commit 2f251bd1 authored by Ronald S. Bultje's avatar Ronald S. Bultje

Add a max_width/height argument to angular_ipred_fn

This is used in z2 to limit the number of pixels over which the
filter is applied, as per "numPx" in 7.11.2.4 point 4 in the AV1
specification. This only applies to z2, because in z1/3, the edge
filter is (incomprehensibly) lengtened by the opposite side's edge
length, which undoes the limit on the filter length (like a bug
undoing another bug).

I admit the code is getting rather complex, so we may want to
redesign this to make writing SIMD easier.
parent 4b0683a6
......@@ -41,7 +41,7 @@
*/
#define decl_angular_ipred_fn(name) \
void (name)(pixel *dst, ptrdiff_t stride, const pixel *topleft, \
int width, int height, int angle)
int width, int height, int angle, int max_width, int max_height)
typedef decl_angular_ipred_fn(*angular_ipred_fn);
/*
......
This diff is collapsed.
......@@ -766,7 +766,9 @@ void bytefn(dav1d_recon_b_intra)(Dav1dTileContext *const t, const enum BlockSize
t_dim->w, t_dim->h, edge);
dsp->ipred.intra_pred[m](dst, f->cur.p.stride[0], edge,
t_dim->w * 4, t_dim->h * 4,
angle | sm_fl);
angle | sm_fl,
f->cur.p.p.w - 4 * t->bx,
f->cur.p.p.h - 4 * t->by);
if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS) {
hex_dump(edge - t_dim->h * 4, t_dim->h * 4,
......@@ -981,7 +983,11 @@ void bytefn(dav1d_recon_b_intra)(Dav1dTileContext *const t, const enum BlockSize
dsp->ipred.intra_pred[m](dst, stride, edge,
uv_t_dim->w * 4,
uv_t_dim->h * 4,
angle | sm_uv_fl);
angle | sm_uv_fl,
(f->cur.p.p.w + ss_hor -
4 * (t->bx & ~ss_hor)) >> ss_hor,
(f->cur.p.p.w + ss_ver -
4 * (t->by & ~ss_ver)) >> ss_ver);
if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS) {
hex_dump(edge - uv_t_dim->h * 4, uv_t_dim->h * 4,
uv_t_dim->h * 4, 2, "l");
......@@ -1136,7 +1142,7 @@ int bytefn(dav1d_recon_b_inter)(Dav1dTileContext *const t, const enum BlockSize
0, dst, f->cur.p.stride[0], top_sb_edge,
m, &angle, bw4, bh4, tl_edge);
dsp->ipred.intra_pred[m](tmp, 4 * bw4 * sizeof(pixel),
tl_edge, bw4 * 4, bh4 * 4, 0);
tl_edge, bw4 * 4, bh4 * 4, 0, 0, 0);
const uint8_t *const ii_mask =
b->interintra_type == INTER_INTRA_BLEND ?
dav1d_ii_masks[bs][0][b->interintra_mode] :
......@@ -1273,7 +1279,7 @@ int bytefn(dav1d_recon_b_inter)(Dav1dTileContext *const t, const enum BlockSize
top_sb_edge, m,
&angle, cbw4, cbh4, tl_edge);
dsp->ipred.intra_pred[m](tmp, cbw4 * 4 * sizeof(pixel),
tl_edge, cbw4 * 4, cbh4 * 4, 0);
tl_edge, cbw4 * 4, cbh4 * 4, 0, 0, 0);
dsp->mc.blend(uvdst, f->cur.p.stride[1], tmp,
cbw4 * 4, cbh4 * 4, ii_mask);
}
......
......@@ -68,7 +68,7 @@ static void check_intra_pred(Dav1dIntraPredDSPContext *const c) {
pixel *const topleft = topleft_buf + 128;
declare_func(void, pixel *dst, ptrdiff_t stride, const pixel *topleft,
int width, int height, int angle);
int width, int height, int angle, int max_width, int max_height);
for (int mode = 0; mode < N_IMPL_INTRA_PRED_MODES; mode++)
for (int w = 4; w <= (mode == FILTER_PRED ? 32 : 64); w <<= 1)
......@@ -89,12 +89,13 @@ static void check_intra_pred(Dav1dIntraPredDSPContext *const c) {
for (int i = -h * 2; i <= w * 2; i++)
topleft[i] = rand() & ((1 << BITDEPTH) - 1);
call_ref(c_dst, stride, topleft, w, h, a);
call_new(a_dst, stride, topleft, w, h, a);
const int maxw = 1 + (rand() % 128), maxh = 1 + (rand() % 128);
call_ref(c_dst, stride, topleft, w, h, a, maxw, maxh);
call_new(a_dst, stride, topleft, w, h, a, maxw, maxh);
if (memcmp(c_dst, a_dst, w * h * sizeof(*c_dst)))
fail();
bench_new(a_dst, stride, topleft, w, h, a);
bench_new(a_dst, stride, topleft, w, h, a, 128, 128);
}
}
report("intra_pred");
......
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