Commit 74c9802f authored by David Michael Barr's avatar David Michael Barr Committed by Ronald S. Bultje

Remove DC row buffer for CfL prediction

parent b865e6c7
......@@ -881,14 +881,13 @@ cfl_ac_fn(32, 32, 32, 32, 0, 0, 10)
static NOINLINE void
cfl_pred_1_c(pixel *dst, const ptrdiff_t stride, const int16_t *ac,
const pixel *const dc_pred, const int8_t alpha,
const int width, const int height)
const int8_t alpha, const int width, const int height)
{
const pixel dc = *dst;
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
const int diff = alpha * ac[x];
dst[x] = iclip_pixel(dc_pred[0] + apply_sign((abs(diff) + 32) >> 6,
diff));
dst[x] = iclip_pixel(dc + apply_sign((abs(diff) + 32) >> 6, diff));
}
ac += width;
dst += PXSTRIDE(stride);
......@@ -899,11 +898,10 @@ cfl_pred_1_c(pixel *dst, const ptrdiff_t stride, const int16_t *ac,
static void cfl_pred_1_##width##xN_c(pixel *const dst, \
const ptrdiff_t stride, \
const int16_t *const ac, \
const pixel *const dc_pred, \
const int8_t alpha, \
const int height) \
{ \
cfl_pred_1_c(dst, stride, ac, dc_pred, alpha, width, height); \
cfl_pred_1_c(dst, stride, ac, alpha, width, height); \
}
cfl_pred_1_fn( 4)
......@@ -912,18 +910,16 @@ cfl_pred_1_fn(16)
cfl_pred_1_fn(32)
static NOINLINE void
cfl_pred_c(pixel *dstU, pixel *dstV, const ptrdiff_t stride,
const int16_t *ac, const pixel *const dc_pred,
cfl_pred_c(pixel *dstU, pixel *dstV, const ptrdiff_t stride, const int16_t *ac,
const int8_t *const alphas, const int width, const int height)
{
const pixel dcU = *dstU, dcV = *dstV;
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
const int diff1 = alphas[0] * ac[x];
dstU[x] = iclip_pixel(dc_pred[ 0] + apply_sign((abs(diff1) + 32) >> 6,
diff1));
dstU[x] = iclip_pixel(dcU + apply_sign((abs(diff1) + 32) >> 6, diff1));
const int diff2 = alphas[1] * ac[x];
dstV[x] = iclip_pixel(dc_pred[32] + apply_sign((abs(diff2) + 32) >> 6,
diff2));
dstV[x] = iclip_pixel(dcV + apply_sign((abs(diff2) + 32) >> 6, diff2));
}
ac += width;
dstU += PXSTRIDE(stride);
......@@ -936,11 +932,10 @@ static void cfl_pred_##width##xN_c(pixel *const dstU, \
pixel *const dstV, \
const ptrdiff_t stride, \
const int16_t *const ac, \
const pixel *const dc_pred, \
const int8_t *const alphas, \
const int height) \
{ \
cfl_pred_c(dstU, dstV, stride, ac, dc_pred, alphas, width, height); \
cfl_pred_c(dstU, dstV, stride, ac, alphas, width, height); \
}
cfl_pred_fn( 4)
......
......@@ -55,26 +55,23 @@ void (name)(int16_t *ac, const pixel *y, ptrdiff_t stride, \
typedef decl_cfl_ac_fn(*cfl_ac_fn);
/*
* dst[x,y] = dc + alpha * ac[x,y]
* dst[x,y] += alpha * ac[x,y]
* - alpha contains a q3 scalar in [-16,16] range;
* - dc_pred[] is the first line of the plane's DC prediction
*/
#define decl_cfl_pred_1_fn(name) \
void (name)(pixel *dst, ptrdiff_t stride, \
const int16_t *ac, const pixel *dc_pred, \
const int8_t alpha, const int height)
const int16_t *ac, const int8_t alpha, \
const int height)
typedef decl_cfl_pred_1_fn(*cfl_pred_1_fn);
/*
* dst[plane][x,y] = dc[plane] + alpha[plane] * ac[x,y]
* dst[plane][x,y] += alpha[plane] * ac[x,y]
* - alphas contains two q3 scalars (one for each plane) in [-16,16] range;
* - dc_pred[] is the first line of each plane's DC prediction, the second plane
* starting at an offset of 16 * sizeof(pixel) bytes.
*/
#define decl_cfl_pred_fn(name) \
void (name)(pixel *u_dst, pixel *v_dst, ptrdiff_t stride, \
const int16_t *ac, const pixel *dc_pred, \
const int8_t *const alphas, const int height)
const int16_t *ac, const int8_t *const alphas, \
const int height)
typedef decl_cfl_pred_fn(*cfl_pred_fn);
/*
......
......@@ -836,7 +836,6 @@ void bytefn(recon_b_intra)(Dav1dTileContext *const t, const enum BlockSize bs,
assert(!init_x && !init_y);
int16_t *const ac = t->scratch.ac;
ALIGN_STK_32(pixel, uv_pred, 2 * 32,);
pixel *y_src = ((pixel *) f->cur.p.data[0]) + 4 * (t->bx & ~ss_hor) +
4 * (t->by & ~ss_ver) * PXSTRIDE(f->cur.p.stride[0]);
const ptrdiff_t uv_off = 4 * ((t->bx >> ss_hor) +
......@@ -870,13 +869,7 @@ void bytefn(recon_b_intra)(Dav1dTileContext *const t, const enum BlockSize bs,
top_sb_edge, DC_PRED, &angle,
cfl_uv_t_dim->w,
cfl_uv_t_dim->h, edge);
if (b->cfl_alpha[pl]) {
dsp->ipred.intra_pred[cfl_uvtx][m](&uv_pred[32 * pl],
0, edge, 0);
} else {
dsp->ipred.intra_pred[cfl_uvtx][m](uv_dst[pl], stride,
edge, 0);
}
dsp->ipred.intra_pred[cfl_uvtx][m](uv_dst[pl], stride, edge, 0);
}
const int furthest_r =
((cw4 << ss_hor) + t_dim->w - 1) & ~(t_dim->w - 1);
......@@ -889,14 +882,12 @@ void bytefn(recon_b_intra)(Dav1dTileContext *const t, const enum BlockSize bs,
if (b->cfl_alpha[0] && b->cfl_alpha[1]) {
dsp->ipred.cfl_pred[cfl_uv_t_dim->lw](uv_dst[0],
uv_dst[1], stride,
ac, uv_pred,
b->cfl_alpha,
ac, b->cfl_alpha,
cbh4 * 4);
} else {
const int pl = !b->cfl_alpha[0];
dsp->ipred.cfl_pred_1[cfl_uv_t_dim->lw](uv_dst[pl],
stride, ac,
&uv_pred[32 * pl],
b->cfl_alpha[pl],
cbh4 * 4);
}
......
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