Commit e732bc29 authored by Scott LaVarnway's avatar Scott LaVarnway

Moved dequantization into the token decoder

Mostly for cleanup purposes.  Now we should be able to rework
the encoder/decoder to use a common idct/add function.

Change-Id: I1597cc59812f362ecec0a3493b6101a6cc6fa7ff
parent fbe9098c
...@@ -440,12 +440,11 @@ typedef struct macroblockd { ...@@ -440,12 +440,11 @@ typedef struct macroblockd {
/* Inverse transform function pointers. */ /* Inverse transform function pointers. */
void (*inv_txm4x4_1)(int16_t *input, int16_t *output, int pitch); void (*inv_txm4x4_1)(int16_t *input, int16_t *output, int pitch);
void (*inv_txm4x4)(int16_t *input, int16_t *output, int pitch); void (*inv_txm4x4)(int16_t *input, int16_t *output, int pitch);
void (*itxm_add)(int16_t *input, const int16_t *dq, uint8_t *dest, void (*itxm_add)(int16_t *input, uint8_t *dest, int stride, int eob);
int stride, int eob); void (*itxm_add_y_block)(int16_t *q, uint8_t *dst, int stride,
void (*itxm_add_y_block)(int16_t *q, const int16_t *dq, struct macroblockd *xd);
uint8_t *dst, int stride, struct macroblockd *xd); void (*itxm_add_uv_block)(int16_t *q, uint8_t *dst, int stride,
void (*itxm_add_uv_block)(int16_t *q, const int16_t *dq, uint16_t *eobs);
uint8_t *dst, int stride, uint16_t *eobs);
struct subpix_fn_table subpix; struct subpix_fn_table subpix;
......
...@@ -27,26 +27,26 @@ forward_decls vp9_common_forward_decls ...@@ -27,26 +27,26 @@ forward_decls vp9_common_forward_decls
# #
# Dequant # Dequant
# #
prototype void vp9_dequant_idct_add_y_block_8x8 "int16_t *q, const int16_t *dq, uint8_t *dst, int stride, struct macroblockd *xd" prototype void vp9_idct_add_y_block_8x8 "int16_t *q, uint8_t *dst, int stride, struct macroblockd *xd"
specialize vp9_dequant_idct_add_y_block_8x8 specialize vp9_idct_add_y_block_8x8
prototype void vp9_dequant_idct_add_16x16 "int16_t *input, const int16_t *dq, uint8_t *dest, int stride, int eob" prototype void vp9_idct_add_16x16 "int16_t *input, uint8_t *dest, int stride, int eob"
specialize vp9_dequant_idct_add_16x16 specialize vp9_idct_add_16x16
prototype void vp9_dequant_idct_add_8x8 "int16_t *input, const int16_t *dq, uint8_t *dest, int stride, int eob" prototype void vp9_idct_add_8x8 "int16_t *input, uint8_t *dest, int stride, int eob"
specialize vp9_dequant_idct_add_8x8 specialize vp9_idct_add_8x8
prototype void vp9_dequant_idct_add "int16_t *input, const int16_t *dq, uint8_t *dest, int stride, int eob" prototype void vp9_idct_add "int16_t *input, uint8_t *dest, int stride, int eob"
specialize vp9_dequant_idct_add specialize vp9_idct_add
prototype void vp9_dequant_idct_add_y_block "int16_t *q, const int16_t *dq, uint8_t *dst, int stride, struct macroblockd *xd" prototype void vp9_idct_add_y_block "int16_t *q, uint8_t *dst, int stride, struct macroblockd *xd"
specialize vp9_dequant_idct_add_y_block specialize vp9_idct_add_y_block
prototype void vp9_dequant_idct_add_uv_block "int16_t *q, const int16_t *dq, uint8_t *dst, int stride, uint16_t *eobs" prototype void vp9_idct_add_uv_block "int16_t *q, uint8_t *dst, int stride, uint16_t *eobs"
specialize vp9_dequant_idct_add_uv_block specialize vp9_idct_add_uv_block
prototype void vp9_dequant_idct_add_32x32 "int16_t *q, const int16_t *dq, uint8_t *dst, int stride, int eob" prototype void vp9_idct_add_32x32 "int16_t *q, uint8_t *dst, int stride, int eob"
specialize vp9_dequant_idct_add_32x32 specialize vp9_idct_add_32x32
# #
# RECON # RECON
......
...@@ -208,15 +208,15 @@ static void mb_init_dequantizer(VP9D_COMP *pbi, MACROBLOCKD *mb) { ...@@ -208,15 +208,15 @@ static void mb_init_dequantizer(VP9D_COMP *pbi, MACROBLOCKD *mb) {
assert(qindex == 0); assert(qindex == 0);
mb->inv_txm4x4_1 = vp9_short_iwalsh4x4_1; mb->inv_txm4x4_1 = vp9_short_iwalsh4x4_1;
mb->inv_txm4x4 = vp9_short_iwalsh4x4; mb->inv_txm4x4 = vp9_short_iwalsh4x4;
mb->itxm_add = vp9_dequant_idct_add_lossless_c; mb->itxm_add = vp9_idct_add_lossless_c;
mb->itxm_add_y_block = vp9_dequant_idct_add_y_block_lossless_c; mb->itxm_add_y_block = vp9_idct_add_y_block_lossless_c;
mb->itxm_add_uv_block = vp9_dequant_idct_add_uv_block_lossless_c; mb->itxm_add_uv_block = vp9_idct_add_uv_block_lossless_c;
} else { } else {
mb->inv_txm4x4_1 = vp9_short_idct4x4_1; mb->inv_txm4x4_1 = vp9_short_idct4x4_1;
mb->inv_txm4x4 = vp9_short_idct4x4; mb->inv_txm4x4 = vp9_short_idct4x4;
mb->itxm_add = vp9_dequant_idct_add; mb->itxm_add = vp9_idct_add;
mb->itxm_add_y_block = vp9_dequant_idct_add_y_block; mb->itxm_add_y_block = vp9_idct_add_y_block;
mb->itxm_add_uv_block = vp9_dequant_idct_add_uv_block; mb->itxm_add_uv_block = vp9_idct_add_uv_block;
} }
} }
...@@ -249,17 +249,14 @@ static void propagate_nzcs(VP9_COMMON *cm, MACROBLOCKD *xd) { ...@@ -249,17 +249,14 @@ static void propagate_nzcs(VP9_COMMON *cm, MACROBLOCKD *xd) {
static void decode_16x16(MACROBLOCKD *xd) { static void decode_16x16(MACROBLOCKD *xd) {
const TX_TYPE tx_type = get_tx_type_16x16(xd, 0); const TX_TYPE tx_type = get_tx_type_16x16(xd, 0);
vp9_dequant_iht_add_16x16_c(tx_type, xd->plane[0].qcoeff, vp9_iht_add_16x16_c(tx_type, xd->plane[0].qcoeff, xd->plane[0].dst.buf,
xd->block[0].dequant, xd->plane[0].dst.buf, xd->plane[0].dst.stride, xd->plane[0].eobs[0]);
xd->plane[0].dst.stride, xd->plane[0].eobs[0]);
vp9_dequant_idct_add_8x8(xd->plane[1].qcoeff, xd->block[16].dequant, vp9_idct_add_8x8(xd->plane[1].qcoeff, xd->plane[1].dst.buf,
xd->plane[1].dst.buf, xd->plane[1].dst.stride, xd->plane[1].dst.stride, xd->plane[1].eobs[0]);
xd->plane[1].eobs[0]);
vp9_dequant_idct_add_8x8(xd->plane[2].qcoeff, xd->block[20].dequant, vp9_idct_add_8x8(xd->plane[2].qcoeff, xd->plane[2].dst.buf,
xd->plane[2].dst.buf, xd->plane[1].dst.stride, xd->plane[1].dst.stride, xd->plane[2].eobs[0]);
xd->plane[2].eobs[0]);
} }
static void decode_8x8(MACROBLOCKD *xd) { static void decode_8x8(MACROBLOCKD *xd) {
...@@ -273,7 +270,6 @@ static void decode_8x8(MACROBLOCKD *xd) { ...@@ -273,7 +270,6 @@ static void decode_8x8(MACROBLOCKD *xd) {
int ib = vp9_i8x8_block[i]; int ib = vp9_i8x8_block[i];
int idx = (ib & 0x02) ? (ib + 2) : ib; int idx = (ib & 0x02) ? (ib + 2) : ib;
int16_t *q = BLOCK_OFFSET(xd->plane[0].qcoeff, idx, 16); int16_t *q = BLOCK_OFFSET(xd->plane[0].qcoeff, idx, 16);
int16_t *dq = xd->block[0].dequant;
uint8_t *dst = *(xd->block[ib].base_dst) + xd->block[ib].dst; uint8_t *dst = *(xd->block[ib].base_dst) + xd->block[ib].dst;
int stride = xd->plane[0].dst.stride; int stride = xd->plane[0].dst.stride;
if (mode == I8X8_PRED) { if (mode == I8X8_PRED) {
...@@ -282,13 +278,11 @@ static void decode_8x8(MACROBLOCKD *xd) { ...@@ -282,13 +278,11 @@ static void decode_8x8(MACROBLOCKD *xd) {
vp9_intra8x8_predict(xd, b, i8x8mode, dst, stride); vp9_intra8x8_predict(xd, b, i8x8mode, dst, stride);
} }
tx_type = get_tx_type_8x8(xd, ib); tx_type = get_tx_type_8x8(xd, ib);
vp9_dequant_iht_add_8x8_c(tx_type, q, dq, dst, stride, vp9_iht_add_8x8_c(tx_type, q, dst, stride, xd->plane[0].eobs[idx]);
xd->plane[0].eobs[idx]);
} }
} else { } else {
vp9_dequant_idct_add_y_block_8x8(xd->plane[0].qcoeff, vp9_idct_add_y_block_8x8(xd->plane[0].qcoeff, xd->plane[0].dst.buf,
xd->block[0].dequant, xd->plane[0].dst.buf, xd->plane[0].dst.stride, xd);
xd->plane[0].dst.stride, xd);
} }
// chroma // chroma
...@@ -303,29 +297,27 @@ static void decode_8x8(MACROBLOCKD *xd) { ...@@ -303,29 +297,27 @@ static void decode_8x8(MACROBLOCKD *xd) {
vp9_intra_uv4x4_predict(xd, b, i8x8mode, *(b->base_dst) + b->dst, vp9_intra_uv4x4_predict(xd, b, i8x8mode, *(b->base_dst) + b->dst,
b->dst_stride); b->dst_stride);
xd->itxm_add(BLOCK_OFFSET(xd->plane[1].qcoeff, i, 16), xd->itxm_add(BLOCK_OFFSET(xd->plane[1].qcoeff, i, 16),
b->dequant, *(b->base_dst) + b->dst, b->dst_stride, *(b->base_dst) + b->dst, b->dst_stride,
xd->plane[1].eobs[i]); xd->plane[1].eobs[i]);
b = &xd->block[20 + i]; b = &xd->block[20 + i];
vp9_intra_uv4x4_predict(xd, b, i8x8mode, *(b->base_dst) + b->dst, vp9_intra_uv4x4_predict(xd, b, i8x8mode, *(b->base_dst) + b->dst,
b->dst_stride); b->dst_stride);
xd->itxm_add(BLOCK_OFFSET(xd->plane[2].qcoeff, i, 16), xd->itxm_add(BLOCK_OFFSET(xd->plane[2].qcoeff, i, 16),
b->dequant, *(b->base_dst) + b->dst, b->dst_stride, *(b->base_dst) + b->dst, b->dst_stride,
xd->plane[2].eobs[i]); xd->plane[2].eobs[i]);
} }
} else if (mode == SPLITMV) { } else if (mode == SPLITMV) {
xd->itxm_add_uv_block(xd->plane[1].qcoeff, xd->block[16].dequant, xd->itxm_add_uv_block(xd->plane[1].qcoeff, xd->plane[1].dst.buf,
xd->plane[1].dst.buf, xd->plane[1].dst.stride, xd->plane[1].eobs); xd->plane[1].dst.stride, xd->plane[1].eobs);
xd->itxm_add_uv_block(xd->plane[2].qcoeff, xd->block[16].dequant, xd->itxm_add_uv_block(xd->plane[2].qcoeff, xd->plane[2].dst.buf,
xd->plane[2].dst.buf, xd->plane[1].dst.stride, xd->plane[2].eobs); xd->plane[1].dst.stride, xd->plane[2].eobs);
} else { } else {
vp9_dequant_idct_add_8x8(xd->plane[1].qcoeff, xd->block[16].dequant, vp9_idct_add_8x8(xd->plane[1].qcoeff, xd->plane[1].dst.buf,
xd->plane[1].dst.buf, xd->plane[1].dst.stride, xd->plane[1].dst.stride, xd->plane[1].eobs[0]);
xd->plane[1].eobs[0]);
vp9_dequant_idct_add_8x8(xd->plane[2].qcoeff, xd->block[16].dequant, vp9_idct_add_8x8(xd->plane[2].qcoeff, xd->plane[2].dst.buf,
xd->plane[2].dst.buf, xd->plane[1].dst.stride, xd->plane[1].dst.stride, xd->plane[2].eobs[0]);
xd->plane[2].eobs[0]);
} }
} }
...@@ -333,13 +325,10 @@ static INLINE void dequant_add_y(MACROBLOCKD *xd, TX_TYPE tx_type, int idx) { ...@@ -333,13 +325,10 @@ static INLINE void dequant_add_y(MACROBLOCKD *xd, TX_TYPE tx_type, int idx) {
BLOCKD *const b = &xd->block[idx]; BLOCKD *const b = &xd->block[idx];
struct mb_plane *const y = &xd->plane[0]; struct mb_plane *const y = &xd->plane[0];
if (tx_type != DCT_DCT) { if (tx_type != DCT_DCT) {
vp9_dequant_iht_add_c(tx_type, vp9_iht_add_c(tx_type, BLOCK_OFFSET(y->qcoeff, idx, 16),
BLOCK_OFFSET(y->qcoeff, idx, 16), *(b->base_dst) + b->dst, b->dst_stride, y->eobs[idx]);
b->dequant, *(b->base_dst) + b->dst,
b->dst_stride, y->eobs[idx]);
} else { } else {
xd->itxm_add(BLOCK_OFFSET(y->qcoeff, idx, 16), xd->itxm_add(BLOCK_OFFSET(y->qcoeff, idx, 16), *(b->base_dst) + b->dst,
b->dequant, *(b->base_dst) + b->dst,
b->dst_stride, y->eobs[idx]); b->dst_stride, y->eobs[idx]);
} }
} }
...@@ -366,13 +355,13 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd, vp9_reader *r) { ...@@ -366,13 +355,13 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd, vp9_reader *r) {
vp9_intra_uv4x4_predict(xd, b, i8x8mode, *(b->base_dst) + b->dst, vp9_intra_uv4x4_predict(xd, b, i8x8mode, *(b->base_dst) + b->dst,
b->dst_stride); b->dst_stride);
xd->itxm_add(BLOCK_OFFSET(xd->plane[1].qcoeff, i, 16), xd->itxm_add(BLOCK_OFFSET(xd->plane[1].qcoeff, i, 16),
b->dequant, *(b->base_dst) + b->dst, b->dst_stride, *(b->base_dst) + b->dst, b->dst_stride,
xd->plane[1].eobs[i]); xd->plane[1].eobs[i]);
b = &xd->block[20 + i]; b = &xd->block[20 + i];
vp9_intra_uv4x4_predict(xd, b, i8x8mode, *(b->base_dst) + b->dst, vp9_intra_uv4x4_predict(xd, b, i8x8mode, *(b->base_dst) + b->dst,
b->dst_stride); b->dst_stride);
xd->itxm_add(BLOCK_OFFSET(xd->plane[2].qcoeff, i, 16), xd->itxm_add(BLOCK_OFFSET(xd->plane[2].qcoeff, i, 16),
b->dequant, *(b->base_dst) + b->dst, b->dst_stride, *(b->base_dst) + b->dst, b->dst_stride,
xd->plane[2].eobs[i]); xd->plane[2].eobs[i]);
} }
} else if (mode == I4X4_PRED) { } else if (mode == I4X4_PRED) {
...@@ -383,7 +372,7 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd, vp9_reader *r) { ...@@ -383,7 +372,7 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd, vp9_reader *r) {
xd->mode_info_context->bmi[i].as_mode.context = b->bmi.as_mode.context = xd->mode_info_context->bmi[i].as_mode.context = b->bmi.as_mode.context =
vp9_find_bpred_context(xd, b); vp9_find_bpred_context(xd, b);
if (!xd->mode_info_context->mbmi.mb_skip_coeff) if (!xd->mode_info_context->mbmi.mb_skip_coeff)
vp9_decode_coefs_4x4(pbi, xd, r, PLANE_TYPE_Y_WITH_DC, i); vp9_decode_coefs_4x4(pbi, xd, r, PLANE_TYPE_Y_WITH_DC, i, b->dequant);
#endif #endif
vp9_intra4x4_predict(xd, b, b_mode, *(b->base_dst) + b->dst, vp9_intra4x4_predict(xd, b, b_mode, *(b->base_dst) + b->dst,
b->dst_stride); b->dst_stride);
...@@ -392,32 +381,29 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd, vp9_reader *r) { ...@@ -392,32 +381,29 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd, vp9_reader *r) {
} }
#if CONFIG_NEWBINTRAMODES #if CONFIG_NEWBINTRAMODES
if (!xd->mode_info_context->mbmi.mb_skip_coeff) if (!xd->mode_info_context->mbmi.mb_skip_coeff)
vp9_decode_mb_tokens_4x4_uv(pbi, xd, r); vp9_decode_mb_tokens_4x4_uv(pbi, xd, r, xd->block[16].dequant);
#endif #endif
vp9_build_intra_predictors_sbuv_s(xd, BLOCK_SIZE_MB16X16); vp9_build_intra_predictors_sbuv_s(xd, BLOCK_SIZE_MB16X16);
xd->itxm_add_uv_block(xd->plane[1].qcoeff, xd->block[16].dequant, xd->itxm_add_uv_block(xd->plane[1].qcoeff, xd->plane[1].dst.buf,
xd->plane[1].dst.buf, xd->plane[1].dst.stride, xd->plane[1].eobs); xd->plane[1].dst.stride, xd->plane[1].eobs);
xd->itxm_add_uv_block(xd->plane[2].qcoeff, xd->block[16].dequant, xd->itxm_add_uv_block(xd->plane[2].qcoeff, xd->plane[2].dst.buf,
xd->plane[2].dst.buf, xd->plane[1].dst.stride, xd->plane[2].eobs); xd->plane[1].dst.stride, xd->plane[2].eobs);
} else if (mode == SPLITMV || get_tx_type_4x4(xd, 0) == DCT_DCT) { } else if (mode == SPLITMV || get_tx_type_4x4(xd, 0) == DCT_DCT) {
xd->itxm_add_y_block(xd->plane[0].qcoeff, xd->itxm_add_y_block(xd->plane[0].qcoeff, xd->plane[0].dst.buf,
xd->block[0].dequant, xd->plane[0].dst.stride, xd);
xd->plane[0].dst.buf, xd->plane[0].dst.stride, xd); xd->itxm_add_uv_block(xd->plane[1].qcoeff, xd->plane[1].dst.buf,
xd->itxm_add_uv_block(xd->plane[1].qcoeff, xd->block[16].dequant, xd->plane[1].dst.stride, xd->plane[1].eobs);
xd->plane[1].dst.buf, xd->plane[1].dst.stride, xd->plane[1].eobs); xd->itxm_add_uv_block(xd->plane[2].qcoeff, xd->plane[2].dst.buf,
xd->itxm_add_uv_block(xd->plane[2].qcoeff, xd->block[16].dequant, xd->plane[1].dst.stride, xd->plane[2].eobs);
xd->plane[2].dst.buf, xd->plane[1].dst.stride, xd->plane[2].eobs);
} else { } else {
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
tx_type = get_tx_type_4x4(xd, i); tx_type = get_tx_type_4x4(xd, i);
dequant_add_y(xd, tx_type, i); dequant_add_y(xd, tx_type, i);
} }
xd->itxm_add_uv_block(xd->plane[1].qcoeff, xd->block[16].dequant, xd->itxm_add_uv_block(xd->plane[1].qcoeff, xd->plane[1].dst.buf,
xd->plane[1].dst.buf, xd->plane[1].dst.stride, xd->plane[1].dst.stride, xd->plane[1].eobs);
xd->plane[1].eobs); xd->itxm_add_uv_block(xd->plane[2].qcoeff, xd->plane[2].dst.buf,
xd->itxm_add_uv_block(xd->plane[2].qcoeff, xd->block[16].dequant, xd->plane[1].dst.stride, xd->plane[2].eobs);
xd->plane[2].dst.buf, xd->plane[1].dst.stride,
xd->plane[2].eobs);
} }
} }
...@@ -431,11 +417,10 @@ static INLINE void decode_sby_32x32(MACROBLOCKD *mb, BLOCK_SIZE_TYPE bsize) { ...@@ -431,11 +417,10 @@ static INLINE void decode_sby_32x32(MACROBLOCKD *mb, BLOCK_SIZE_TYPE bsize) {
const int x_idx = n & (bw - 1); const int x_idx = n & (bw - 1);
const int y_idx = n >> bwl; const int y_idx = n >> bwl;
const int y_offset = (y_idx * 32) * mb->plane[0].dst.stride + (x_idx * 32); const int y_offset = (y_idx * 32) * mb->plane[0].dst.stride + (x_idx * 32);
vp9_dequant_idct_add_32x32(BLOCK_OFFSET(mb->plane[0].qcoeff, n, 1024), vp9_idct_add_32x32(BLOCK_OFFSET(mb->plane[0].qcoeff, n, 1024),
mb->block[0].dequant , mb->plane[0].dst.buf + y_offset,
mb->plane[0].dst.buf + y_offset, mb->plane[0].dst.stride,
mb->plane[0].dst.stride, mb->plane[0].eobs[n * 64]);
mb->plane[0].eobs[n * 64]);
} }
} }
...@@ -449,16 +434,14 @@ static INLINE void decode_sbuv_32x32(MACROBLOCKD *mb, BLOCK_SIZE_TYPE bsize) { ...@@ -449,16 +434,14 @@ static INLINE void decode_sbuv_32x32(MACROBLOCKD *mb, BLOCK_SIZE_TYPE bsize) {
const int y_idx = n >> (bwl - 1); const int y_idx = n >> (bwl - 1);
const int uv_offset = (y_idx * 32) * mb->plane[1].dst.stride + const int uv_offset = (y_idx * 32) * mb->plane[1].dst.stride +
(x_idx * 32); (x_idx * 32);
vp9_dequant_idct_add_32x32(BLOCK_OFFSET(mb->plane[1].qcoeff, n, 1024), vp9_idct_add_32x32(BLOCK_OFFSET(mb->plane[1].qcoeff, n, 1024),
mb->block[16].dequant, mb->plane[1].dst.buf + uv_offset,
mb->plane[1].dst.buf + uv_offset, mb->plane[1].dst.stride,
mb->plane[1].dst.stride, mb->plane[1].eobs[n * 64]);
mb->plane[1].eobs[n * 64]); vp9_idct_add_32x32(BLOCK_OFFSET(mb->plane[2].qcoeff, n, 1024),
vp9_dequant_idct_add_32x32(BLOCK_OFFSET(mb->plane[2].qcoeff, n, 1024), mb->plane[2].dst.buf + uv_offset,
mb->block[20].dequant, mb->plane[1].dst.stride,
mb->plane[2].dst.buf + uv_offset, mb->plane[2].eobs[n * 64]);
mb->plane[1].dst.stride,
mb->plane[2].eobs[n * 64]);
} }
} }
...@@ -474,12 +457,9 @@ static INLINE void decode_sby_16x16(MACROBLOCKD *mb, BLOCK_SIZE_TYPE bsize) { ...@@ -474,12 +457,9 @@ static INLINE void decode_sby_16x16(MACROBLOCKD *mb, BLOCK_SIZE_TYPE bsize) {
const int y_offset = (y_idx * 16) * mb->plane[0].dst.stride + (x_idx * 16); const int y_offset = (y_idx * 16) * mb->plane[0].dst.stride + (x_idx * 16);
const TX_TYPE tx_type = get_tx_type_16x16(mb, const TX_TYPE tx_type = get_tx_type_16x16(mb,
(y_idx * (4 * bw) + x_idx) * 4); (y_idx * (4 * bw) + x_idx) * 4);
vp9_dequant_iht_add_16x16_c(tx_type, vp9_iht_add_16x16_c(tx_type, BLOCK_OFFSET(mb->plane[0].qcoeff, n, 256),
BLOCK_OFFSET(mb->plane[0].qcoeff, n, 256), mb->plane[0].dst.buf + y_offset,
mb->block[0].dequant, mb->plane[0].dst.stride, mb->plane[0].eobs[n * 16]);
mb->plane[0].dst.buf + y_offset,
mb->plane[0].dst.stride,
mb->plane[0].eobs[n * 16]);
} }
} }
...@@ -495,16 +475,12 @@ static INLINE void decode_sbuv_16x16(MACROBLOCKD *mb, BLOCK_SIZE_TYPE bsize) { ...@@ -495,16 +475,12 @@ static INLINE void decode_sbuv_16x16(MACROBLOCKD *mb, BLOCK_SIZE_TYPE bsize) {
const int x_idx = n & (bw - 1); const int x_idx = n & (bw - 1);
const int y_idx = n >> (bwl - 1); const int y_idx = n >> (bwl - 1);
const int uv_offset = (y_idx * 16) * mb->plane[1].dst.stride + (x_idx * 16); const int uv_offset = (y_idx * 16) * mb->plane[1].dst.stride + (x_idx * 16);
vp9_dequant_idct_add_16x16(BLOCK_OFFSET(mb->plane[1].qcoeff, n, 256), vp9_idct_add_16x16(BLOCK_OFFSET(mb->plane[1].qcoeff, n, 256),
mb->block[16].dequant, mb->plane[1].dst.buf + uv_offset,
mb->plane[1].dst.buf + uv_offset, mb->plane[1].dst.stride, mb->plane[1].eobs[n * 16]);
mb->plane[1].dst.stride, vp9_idct_add_16x16(BLOCK_OFFSET(mb->plane[2].qcoeff, n, 256),
mb->plane[1].eobs[n * 16]); mb->plane[2].dst.buf + uv_offset,
vp9_dequant_idct_add_16x16(BLOCK_OFFSET(mb->plane[2].qcoeff, n, 256), mb->plane[1].dst.stride, mb->plane[2].eobs[n * 16]);
mb->block[20].dequant,
mb->plane[2].dst.buf + uv_offset,
mb->plane[1].dst.stride,
mb->plane[2].eobs[n * 16]);
} }
} }
...@@ -522,12 +498,9 @@ static INLINE void decode_sby_8x8(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) { ...@@ -522,12 +498,9 @@ static INLINE void decode_sby_8x8(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
const TX_TYPE tx_type = get_tx_type_8x8(xd, const TX_TYPE tx_type = get_tx_type_8x8(xd,
(y_idx * (2 * bw) + x_idx) * 2); (y_idx * (2 * bw) + x_idx) * 2);
vp9_dequant_iht_add_8x8_c(tx_type, vp9_iht_add_8x8_c(tx_type, BLOCK_OFFSET(xd->plane[0].qcoeff, n, 64),
BLOCK_OFFSET(xd->plane[0].qcoeff, n, 64), xd->plane[0].dst.buf + y_offset, xd->plane[0].dst.stride,
xd->block[0].dequant, xd->plane[0].eobs[n * 4]);
xd->plane[0].dst.buf + y_offset,
xd->plane[0].dst.stride,
xd->plane[0].eobs[n * 4]);
} }
} }
...@@ -542,16 +515,12 @@ static INLINE void decode_sbuv_8x8(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) { ...@@ -542,16 +515,12 @@ static INLINE void decode_sbuv_8x8(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
const int x_idx = n & (bw - 1); const int x_idx = n & (bw - 1);
const int y_idx = n >> (bwl - 1); const int y_idx = n >> (bwl - 1);
const int uv_offset = (y_idx * 8) * xd->plane[1].dst.stride + (x_idx * 8); const int uv_offset = (y_idx * 8) * xd->plane[1].dst.stride + (x_idx * 8);
vp9_dequant_idct_add_8x8(BLOCK_OFFSET(xd->plane[1].qcoeff, n, 64), vp9_idct_add_8x8(BLOCK_OFFSET(xd->plane[1].qcoeff, n, 64),
xd->block[16].dequant, xd->plane[1].dst.buf + uv_offset, xd->plane[1].dst.stride,
xd->plane[1].dst.buf + uv_offset, xd->plane[1].eobs[n * 4]);
xd->plane[1].dst.stride, vp9_idct_add_8x8(BLOCK_OFFSET(xd->plane[2].qcoeff, n, 64),
xd->plane[1].eobs[n * 4]); xd->plane[2].dst.buf + uv_offset, xd->plane[1].dst.stride,
vp9_dequant_idct_add_8x8(BLOCK_OFFSET(xd->plane[2].qcoeff, n, 64), xd->plane[2].eobs[n * 4]);
xd->block[20].dequant,
xd->plane[2].dst.buf + uv_offset,
xd->plane[1].dst.stride,
xd->plane[2].eobs[n * 4]);
} }
} }
...@@ -568,15 +537,12 @@ static INLINE void decode_sby_4x4(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) { ...@@ -568,15 +537,12 @@ static INLINE void decode_sby_4x4(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
const TX_TYPE tx_type = get_tx_type_4x4(xd, n); const TX_TYPE tx_type = get_tx_type_4x4(xd, n);
if (tx_type == DCT_DCT) { if (tx_type == DCT_DCT) {
xd->itxm_add(BLOCK_OFFSET(xd->plane[0].qcoeff, n, 16), xd->itxm_add(BLOCK_OFFSET(xd->plane[0].qcoeff, n, 16),
xd->block[0].dequant,
xd->plane[0].dst.buf + y_offset, xd->plane[0].dst.stride, xd->plane[0].dst.buf + y_offset, xd->plane[0].dst.stride,
xd->plane[0].eobs[n]); xd->plane[0].eobs[n]);
} else { } else {
vp9_dequant_iht_add_c(tx_type, vp9_iht_add_c(tx_type, BLOCK_OFFSET(xd->plane[0].qcoeff, n, 16),
BLOCK_OFFSET(xd->plane[0].qcoeff, n, 16), xd->plane[0].dst.buf + y_offset, xd->plane[0].dst.stride,
xd->block[0].dequant, xd->plane[0].eobs[n]);
xd->plane[0].dst.buf + y_offset,
xd->plane[0].dst.stride, xd->plane[0].eobs[n]);
} }
} }
} }
...@@ -592,11 +558,9 @@ static INLINE void decode_sbuv_4x4(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) { ...@@ -592,11 +558,9 @@ static INLINE void decode_sbuv_4x4(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
const int y_idx = n >> (bwl - 1); const int y_idx = n >> (bwl - 1);
const int uv_offset = (y_idx * 4) * xd->plane[1].dst.stride + (x_idx * 4); const int uv_offset = (y_idx * 4) * xd->plane[1].dst.stride + (x_idx * 4);
xd->itxm_add(BLOCK_OFFSET(xd->plane[1].qcoeff, n, 16), xd->itxm_add(BLOCK_OFFSET(xd->plane[1].qcoeff, n, 16),
xd->block[16].dequant,
xd->plane[1].dst.buf + uv_offset, xd->plane[1].dst.stride, xd->plane[1].dst.buf + uv_offset, xd->plane[1].dst.stride,
xd->plane[1].eobs[n]); xd->plane[1].eobs[n]);
xd->itxm_add(BLOCK_OFFSET(xd->plane[2].qcoeff, n, 16), xd->itxm_add(BLOCK_OFFSET(xd->plane[2].qcoeff, n, 16),
xd->block[20].dequant,
xd->plane[2].dst.buf + uv_offset, xd->plane[1].dst.stride, xd->plane[2].dst.buf + uv_offset, xd->plane[1].dst.stride,
xd->plane[2].eobs[n]); xd->plane[2].eobs[n]);
} }
...@@ -653,7 +617,7 @@ static void decode_sb(VP9D_COMP *pbi, MACROBLOCKD *xd, int mb_row, int mb_col, ...@@ -653,7 +617,7 @@ static void decode_sb(VP9D_COMP *pbi, MACROBLOCKD *xd, int mb_row, int mb_col,
mb_init_dequantizer(pbi, xd); mb_init_dequantizer(pbi, xd);
// dequantization and idct // dequantization and idct
eobtotal = vp9_decode_tokens(pbi, xd, r, bsize); eobtotal = vp9_decode_tokens(pbi, xd, r, bsize, xd->block[0].dequant);
if (eobtotal == 0) { // skip loopfilter if (eobtotal == 0) { // skip loopfilter
for (n = 0; n < bw * bh; n++) { for (n = 0; n < bw * bh; n++) {
const int x_idx = n & (bw - 1), y_idx = n >> bwl; const int x_idx = n & (bw - 1), y_idx = n >> bwl;
...@@ -731,7 +695,8 @@ static void decode_mb(VP9D_COMP *pbi, MACROBLOCKD *xd, ...@@ -731,7 +695,8 @@ static void decode_mb(VP9D_COMP *pbi, MACROBLOCKD *xd,
#if CONFIG_NEWBINTRAMODES #if CONFIG_NEWBINTRAMODES
if (mode != I4X4_PRED) if (mode != I4X4_PRED)
#endif #endif
eobtotal = vp9_decode_tokens(pbi, xd, r, BLOCK_SIZE_MB16X16); eobtotal = vp9_decode_tokens(pbi, xd, r, BLOCK_SIZE_MB16X16,
xd->block[0].dequant);
} }
} }
......
/*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "vp9_rtcd.h"
#include "vp9/decoder/vp9_dequantize.h"
#include "vpx_mem/vpx_mem.h"
#include "vp9/decoder/vp9_onyxd_int.h"
#include "vp9/common/vp9_common.h"
static void add_residual(const int16_t *diff, uint8_t *dest, int stride,
int width, int height) {
int r, c;
for (r = 0; r < height; r++) {
for (c = 0; c < width; c++)
dest[c] = clip_pixel(diff[c] + dest[c]);
dest += stride;
diff += width;
}
}
void vp9_add_residual_4x4_c(const int16_t *diff, uint8_t *dest, int stride) {
add_residual(diff, dest, stride, 4, 4);
}
void vp9_add_residual_8x8_c(const int16_t *diff, uint8_t *dest, int stride) {
add_residual(diff, dest, stride, 8, 8);
}
void vp9_add_residual_16x16_c(const int16_t *diff, uint8_t *dest, int stride) {
add_residual(diff, dest, stride, 16, 16);
}
void vp9_add_residual_32x32_c(const int16_t *diff,uint8_t *dest, int stride) {
add_residual(diff, dest, stride,