Commit a1dc97be authored by Dmitry Kovalev's avatar Dmitry Kovalev

Using pd->dqcoeff instead of pd->qcoeff in the decoder.

It is more logical to use dqcoeff buffer to put there *dequantized*
transform coefficients (inside inverse_transform_block and
decode_coefs functions). Dequantization happens inside WRITE_COEF_CONTINUE
macro.

qcoeff buffer should be only used in the encoder for *quantized*
transform coefficients.

Change-Id: Ifd54bef272bbf5311ced6669c4f1079f998af5d7
parent 00adebd1
......@@ -248,7 +248,7 @@ static void alloc_tile_storage(VP9D_COMP *pbi, int tile_cols) {
static void inverse_transform_block(MACROBLOCKD* xd, int plane, int block,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
struct macroblockd_plane *const pd = &xd->plane[plane];
int16_t* const qcoeff = BLOCK_OFFSET(pd->qcoeff, block);
int16_t* const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
const int stride = pd->dst.stride;
const int eob = pd->eobs[block];
if (eob > 0) {
......@@ -261,35 +261,35 @@ static void inverse_transform_block(MACROBLOCKD* xd, int plane, int block,
case TX_4X4:
tx_type = get_tx_type_4x4(pd->plane_type, xd, raster_block);
if (tx_type == DCT_DCT)
xd->itxm_add(qcoeff, dst, stride, eob);
xd->itxm_add(dqcoeff, dst, stride, eob);
else
vp9_iht4x4_16_add(qcoeff, dst, stride, tx_type);
vp9_iht4x4_16_add(dqcoeff, dst, stride, tx_type);
break;
case TX_8X8:
tx_type = get_tx_type_8x8(pd->plane_type, xd);
vp9_iht8x8_add(tx_type, qcoeff, dst, stride, eob);
vp9_iht8x8_add(tx_type, dqcoeff, dst, stride, eob);
break;
case TX_16X16:
tx_type = get_tx_type_16x16(pd->plane_type, xd);
vp9_iht16x16_add(tx_type, qcoeff, dst, stride, eob);
vp9_iht16x16_add(tx_type, dqcoeff, dst, stride, eob);
break;
case TX_32X32:
tx_type = DCT_DCT;
vp9_idct32x32_add(qcoeff, dst, stride, eob);
vp9_idct32x32_add(dqcoeff, dst, stride, eob);
break;
default:
assert(!"Invalid transform size");
}
if (eob == 1) {
vpx_memset(qcoeff, 0, 2 * sizeof(qcoeff[0]));
vpx_memset(dqcoeff, 0, 2 * sizeof(dqcoeff[0]));
} else {
if (tx_type == DCT_DCT && tx_size <= TX_16X16 && eob <= 10)
vpx_memset(qcoeff, 0, 4 * (4 << tx_size) * sizeof(qcoeff[0]));
vpx_memset(dqcoeff, 0, 4 * (4 << tx_size) * sizeof(dqcoeff[0]));
else if (tx_size == TX_32X32 && eob <= 34)
vpx_memset(qcoeff, 0, 256 * sizeof(qcoeff[0]));
vpx_memset(dqcoeff, 0, 256 * sizeof(dqcoeff[0]));
else
vpx_memset(qcoeff, 0, (16 << (tx_size << 1)) * sizeof(qcoeff[0]));
vpx_memset(dqcoeff, 0, (16 << (tx_size << 1)) * sizeof(dqcoeff[0]));
}
}
}
......@@ -1335,7 +1335,7 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
cm->fc = cm->frame_contexts[cm->frame_context_idx];
vp9_zero(cm->counts);
for (i = 0; i < MAX_MB_PLANE; ++i)
vp9_zero(xd->plane[i].qcoeff);
vp9_zero(xd->plane[i].dqcoeff);
xd->corrupted = 0;
new_fb->corrupted = read_compressed_header(pbi, data, first_partition_size);
......
......@@ -74,7 +74,7 @@ static const vp9_prob cat6_prob[15] = {
#define WRITE_COEF_CONTINUE(val, token) \
{ \
qcoeff_ptr[scan[c]] = vp9_read_and_apply_sign(r, val) * \
dqcoeff_ptr[scan[c]] = vp9_read_and_apply_sign(r, val) * \
dq[c > 0] / (1 + (tx_size == TX_32X32)); \
INCREMENT_COUNT(token); \
token_cache[scan[c]] = vp9_pt_energy_class[token]; \
......@@ -89,7 +89,7 @@ static const vp9_prob cat6_prob[15] = {
static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
vp9_reader *r, int block_idx,
PLANE_TYPE type, int seg_eob, int16_t *qcoeff_ptr,
PLANE_TYPE type, int seg_eob, int16_t *dqcoeff_ptr,
TX_SIZE tx_size, const int16_t *dq, int pt,
uint8_t *token_cache) {
const FRAME_CONTEXT *const fc = &cm->fc;
......@@ -223,7 +223,7 @@ int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd,
pd->left_context + loff);
eob = decode_coefs(cm, xd, r, block,
pd->plane_type, seg_eob, BLOCK_OFFSET(pd->qcoeff, block),
pd->plane_type, seg_eob, BLOCK_OFFSET(pd->dqcoeff, block),
tx_size, pd->dequant, pt, token_cache);
set_contexts(xd, pd, plane_bsize, tx_size, eob > 0, aoff, loff);
......
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