Commit 50910f60 authored by Angie Chiang's avatar Angie Chiang

Empty the dst buffer before inv txfm when PVQ on

Change-Id: I35b2b69e3937e70a7923ba76735f035f366de27f
parent 57605531
......@@ -2785,6 +2785,25 @@ void av1_inverse_transform_block(MACROBLOCKD *xd, const tran_low_t *dqcoeff,
const TX_TYPE tx_type, const TX_SIZE tx_size,
uint8_t *dst, int stride, int eob) {
if (!eob) return;
#if CONFIG_PVQ
const BLOCK_SIZE tx_bsize = txsize_to_bsize[tx_size];
const int txb_width = block_size_wide[tx_bsize];
const int txb_height = block_size_high[tx_bsize];
int r, c;
#if CONFIG_AOM_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
uint16_t *dst16 = CONVERT_TO_SHORTPTR(dst);
for (r = 0; r < txb_height; r++)
for (c = 0; c < txb_width; c++)
CONVERT_TO_SHORTPTR(dst)[r * stride + c] = 0;
} else {
#endif // CONFIG_AOM_HIGHBITDEPTH
for (r = 0; r < txb_height; r++)
for (c = 0; c < txb_width; c++) dst[r * stride + c] = 0;
#if CONFIG_AOM_HIGHBITDEPTH
}
#endif // CONFIG_AOM_HIGHBITDEPTH
#endif // CONFIG_PVQ
INV_TXFM_PARAM inv_txfm_param;
inv_txfm_param.tx_type = tx_type;
inv_txfm_param.tx_size = tx_size;
......
......@@ -496,22 +496,6 @@ static int av1_pvq_decode_helper2(AV1_COMMON *cm, MACROBLOCKD *const xd,
eob = av1_pvq_decode_helper(xd, pvq_ref_coeff, dqcoeff, quant, plane,
tx_size, tx_type, xdec, ac_dc_coded);
// Since av1 does not have separate inverse transform
// but also contains adding to predicted image,
// pass blank dummy image to av1_inv_txfm_add_*x*(), i.e. set dst as zeros
#if CONFIG_AOM_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
for (j = 0; j < tx_blk_size; j++)
for (i = 0; i < tx_blk_size; i++)
CONVERT_TO_SHORTPTR(dst)[j * pd->dst.stride + i] = 0;
} else {
#endif
for (j = 0; j < tx_blk_size; j++)
for (i = 0; i < tx_blk_size; i++) dst[j * pd->dst.stride + i] = 0;
#if CONFIG_AOM_HIGHBITDEPTH
}
#endif
inverse_transform_block(xd, plane, tx_type, tx_size, dst, pd->dst.stride,
max_scan_line, eob);
}
......
......@@ -1105,10 +1105,6 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
const int dst_stride = pd->dst.stride;
uint8_t *dst =
&pd->dst.buf[(blk_row * dst_stride + blk_col) << tx_size_wide_log2[0]];
#if CONFIG_PVQ
int tx_blk_size;
int i, j;
#endif
av1_predict_intra_block_facade(xd, plane, block_raster_idx, blk_col, blk_row,
tx_size);
......@@ -1133,27 +1129,7 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
if (!x->pvq_skip[plane]) *(args->skip) = 0;
if (x->pvq_skip[plane]) return;
// transform block size in pixels
tx_blk_size = tx_size_wide[tx_size];
// Since av1 does not have separate function which does inverse transform
// but av1_inv_txfm_add_*x*() also does addition of predicted image to
// inverse transformed image,
// pass blank dummy image to av1_inv_txfm_add_*x*(), i.e. set dst as zeros
#if CONFIG_AOM_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
for (j = 0; j < tx_blk_size; j++)
for (i = 0; i < tx_blk_size; i++)
CONVERT_TO_SHORTPTR(dst)[j * dst_stride + i] = 0;
} else {
#endif // CONFIG_AOM_HIGHBITDEPTH
for (j = 0; j < tx_blk_size; j++)
for (i = 0; i < tx_blk_size; i++) dst[j * dst_stride + i] = 0;
#if CONFIG_AOM_HIGHBITDEPTH
}
#endif // CONFIG_AOM_HIGHBITDEPTH
#endif // #if CONFIG_PVQ
#endif // CONFIG_PVQ
av1_inverse_transform_block(xd, dqcoeff, tx_type, tx_size, dst, dst_stride,
*eob);
#if !CONFIG_PVQ
......
......@@ -1419,8 +1419,10 @@ static void dist_block(const AV1_COMP *cpi, MACROBLOCK *x, int plane,
*out_sse = this_sse >> shift;
} else {
const BLOCK_SIZE tx_bsize = txsize_to_bsize[tx_size];
#if !CONFIG_PVQ || CONFIG_DAALA_DIST
const int bsw = block_size_wide[tx_bsize];
const int bsh = block_size_high[tx_bsize];
#endif
const int src_stride = x->plane[plane].src.stride;
const int dst_stride = xd->plane[plane].dst.stride;
// Scale the transform block index to pixel unit.
......@@ -1460,6 +1462,7 @@ static void dist_block(const AV1_COMP *cpi, MACROBLOCK *x, int plane,
DECLARE_ALIGNED(16, uint8_t, recon[MAX_TX_SQUARE]);
#endif // CONFIG_AOM_HIGHBITDEPTH
#if !CONFIG_PVQ
#if CONFIG_AOM_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
aom_highbd_convolve_copy(dst, dst_stride, recon, MAX_TX_SIZE, NULL, 0,
......@@ -1467,16 +1470,10 @@ static void dist_block(const AV1_COMP *cpi, MACROBLOCK *x, int plane,
} else
#endif // CONFIG_AOM_HIGHBITDEPTH
{
#if !CONFIG_PVQ
aom_convolve_copy(dst, dst_stride, recon, MAX_TX_SIZE, NULL, 0, NULL, 0,
bsw, bsh);
#else
int i, j;
for (j = 0; j < bsh; j++)
for (i = 0; i < bsw; i++) recon[j * MAX_TX_SIZE + i] = 0;
#endif // !CONFIG_PVQ
}
#endif // !CONFIG_PVQ
const int block_raster_idx =
av1_block_index_to_raster_order(tx_size, block);
......
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