summaryrefslogtreecommitdiff
path: root/vp9
diff options
context:
space:
mode:
Diffstat (limited to 'vp9')
-rw-r--r--vp9/decoder/vp9_decodframe.c61
-rw-r--r--vp9/decoder/vp9_detokenize.c10
-rw-r--r--vp9/decoder/vp9_detokenize.h5
-rw-r--r--vp9/encoder/vp9_rdopt.c6
4 files changed, 55 insertions, 27 deletions
diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c
index b17ba290e..f6f87efae 100644
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -353,7 +353,7 @@ static void decode_8x8(VP9D_COMP *pbi, MACROBLOCKD *xd,
static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd,
BOOL_DECODER* const bc) {
TX_TYPE tx_type;
- int i;
+ int i = 0;
MB_PREDICTION_MODE mode = xd->mode_info_context->mbmi.mode;
#if 0 // def DEC_DEBUG
if (dec_debug) {
@@ -404,6 +404,8 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd,
#if CONFIG_NEWBINTRAMODES
xd->mode_info_context->bmi[i].as_mode.context = b->bmi.as_mode.context =
vp9_find_bpred_context(xd, b);
+ if (!xd->mode_info_context->mbmi.mb_skip_coeff)
+ vp9_decode_coefs_4x4(pbi, xd, bc, PLANE_TYPE_Y_WITH_DC, i);
#endif
vp9_intra4x4_predict(xd, b, b_mode, b->predictor);
tx_type = get_tx_type_4x4(xd, i);
@@ -417,6 +419,10 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd,
*(b->base_dst) + b->dst, 16, b->dst_stride, xd->eobs[i]);
}
}
+#if CONFIG_NEWBINTRAMODES
+ if (!xd->mode_info_context->mbmi.mb_skip_coeff)
+ vp9_decode_mb_tokens_4x4_uv(pbi, xd, bc);
+#endif
vp9_build_intra_predictors_mbuv(xd);
xd->itxm_add_uv_block(xd->qcoeff + 16 * 16,
xd->block[16].dequant,
@@ -480,7 +486,7 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd,
}
}
-static INLINE void decode_sb_16x16(MACROBLOCKD *mb, int y_size) {
+static void decode_sb_16x16(MACROBLOCKD *mb, int y_size) {
const int y_count = y_size * y_size;
const int uv_size = y_size / 2;
const int uv_count = uv_size * uv_size;
@@ -495,8 +501,8 @@ static INLINE void decode_sb_16x16(MACROBLOCKD *mb, int y_size) {
const int x_idx = n % y_size;
const int y_idx = n / y_size;
const int y_offset = (y_idx * 16) * mb->dst.y_stride + (x_idx * 16);
- const TX_TYPE tx_type = get_tx_type_16x16(mb, (y_idx * (4 * y_size) +
- x_idx) * 4);
+ const TX_TYPE tx_type = get_tx_type_16x16(mb,
+ (y_idx * (4 * y_size) + x_idx) * 4);
if (tx_type == DCT_DCT) {
vp9_dequant_idct_add_16x16(mb->qcoeff + n * 16 * 16,
mb->block[0].dequant ,
@@ -534,13 +540,13 @@ static INLINE void decode_sb_16x16(MACROBLOCKD *mb, int y_size) {
}
}
-static INLINE void decode_sb_8x8(MACROBLOCKD *mb, int y_size) {
+static void decode_sb_8x8(MACROBLOCKD *mb, int y_size) {
const int y_count = y_size * y_size;
const int uv_size = y_size / 2;
const int uv_count = uv_size * uv_size;
- const int u_qcoeff_offset = 64 * y_count;
- const int v_qcoeff_offset = u_qcoeff_offset + 64 * uv_count;
+ const int u_qcoeff_offset = (8 * 8) * y_count;
+ const int v_qcoeff_offset = u_qcoeff_offset + (8 * 8) * uv_count;
const int u_eob_offset = 4 * y_count;
const int v_eob_offset = u_eob_offset + 4 * uv_count;
int n;
@@ -560,7 +566,8 @@ static INLINE void decode_sb_8x8(MACROBLOCKD *mb, int y_size) {
mb->dst.y_stride, mb->dst.y_stride,
mb->eobs[n * 4]);
} else {
- vp9_ht_dequant_idct_add_8x8_c(tx_type, mb->qcoeff + n * 8 * 8,
+ vp9_ht_dequant_idct_add_8x8_c(tx_type,
+ mb->qcoeff + n * 8 * 8,
mb->block[0].dequant,
mb->dst.y_buffer + y_offset,
mb->dst.y_buffer + y_offset,
@@ -595,18 +602,17 @@ static void decode_sb_4x4(MACROBLOCKD *mb, int y_size) {
const int uv_size = y_size / 2;
const int uv_count = uv_size * uv_size;
- const int u_qcoeff_offset = y_count * 4 * 4;
- const int v_qcoeff_offset = u_qcoeff_offset + uv_count * 4 * 4;
+ const int u_qcoeff_offset = (4 * 4) * y_count;
+ const int v_qcoeff_offset = u_qcoeff_offset + (4 * 4) * uv_count;
const int u_eob_offset = y_count;
const int v_eob_offset = u_eob_offset + uv_count;
-
int n;
for (n = 0; n < y_count; n++) {
const int x_idx = n % y_size;
const int y_idx = n / y_size;
const int y_offset = (y_idx * 4) * mb->dst.y_stride + (x_idx * 4);
- const TX_TYPE tx_type = get_tx_type_4x4(mb, y_idx * (2 * y_size) + x_idx);
+ const TX_TYPE tx_type = get_tx_type_4x4(mb, y_idx * y_size + x_idx);
if (tx_type == DCT_DCT) {
mb->itxm_add(mb->qcoeff + n * 4 * 4,
mb->block[0].dequant,
@@ -615,12 +621,12 @@ static void decode_sb_4x4(MACROBLOCKD *mb, int y_size) {
mb->dst.y_stride, mb->dst.y_stride,
mb->eobs[n]);
} else {
- vp9_ht_dequant_idct_add_c(tx_type, mb->qcoeff + n * 4 * 4,
+ vp9_ht_dequant_idct_add_c(tx_type,
+ mb->qcoeff + n * 4 * 4,
mb->block[0].dequant,
mb->dst.y_buffer + y_offset,
mb->dst.y_buffer + y_offset,
- mb->dst.y_stride,
- mb->dst.y_stride,
+ mb->dst.y_stride, mb->dst.y_stride,
mb->eobs[n]);
}
}
@@ -630,17 +636,17 @@ static void decode_sb_4x4(MACROBLOCKD *mb, int y_size) {
const int y_idx = n / uv_size;
const int uv_offset = (y_idx * 4) * mb->dst.uv_stride + (x_idx * 4);
mb->itxm_add(mb->qcoeff + u_qcoeff_offset + n * 4 * 4,
- mb->block[16].dequant,
- mb->dst.u_buffer + uv_offset,
- mb->dst.u_buffer + uv_offset,
- mb->dst.uv_stride, mb->dst.uv_stride,
- mb->eobs[u_eob_offset + n]);
+ mb->block[16].dequant,
+ mb->dst.u_buffer + uv_offset,
+ mb->dst.u_buffer + uv_offset,
+ mb->dst.uv_stride, mb->dst.uv_stride,
+ mb->eobs[u_eob_offset + n]);
mb->itxm_add(mb->qcoeff + v_qcoeff_offset + n * 4 * 4,
- mb->block[20].dequant,
- mb->dst.v_buffer + uv_offset,
- mb->dst.v_buffer + uv_offset,
- mb->dst.uv_stride, mb->dst.uv_stride,
- mb->eobs[v_eob_offset + n]);
+ mb->block[20].dequant,
+ mb->dst.v_buffer + uv_offset,
+ mb->dst.v_buffer + uv_offset,
+ mb->dst.uv_stride, mb->dst.uv_stride,
+ mb->eobs[v_eob_offset + n]);
}
}
@@ -813,7 +819,10 @@ static void decode_mb(VP9D_COMP *pbi, MACROBLOCKD *xd,
if (xd->mode_info_context->mbmi.mb_skip_coeff) {
vp9_reset_mb_tokens_context(xd);
} else if (!bool_error(bc)) {
- eobtotal = vp9_decode_mb_tokens(pbi, xd, bc);
+#if CONFIG_NEWBINTRAMODES
+ if (mode != B_PRED)
+#endif
+ eobtotal = vp9_decode_mb_tokens(pbi, xd, bc);
}
//mode = xd->mode_info_context->mbmi.mode;
diff --git a/vp9/decoder/vp9_detokenize.c b/vp9/decoder/vp9_detokenize.c
index 9db9d42c1..e55826379 100644
--- a/vp9/decoder/vp9_detokenize.c
+++ b/vp9/decoder/vp9_detokenize.c
@@ -584,3 +584,13 @@ int vp9_decode_mb_tokens(VP9D_COMP* const dx,
return vp9_decode_mb_tokens_4x4(dx, xd, bc);
}
}
+
+#if CONFIG_NEWBINTRAMODES
+int vp9_decode_coefs_4x4(VP9D_COMP *dx, MACROBLOCKD *xd,
+ BOOL_DECODER* const bc,
+ PLANE_TYPE type, int i) {
+ const int segment_id = xd->mode_info_context->mbmi.segment_id;
+ const int seg_eob = get_eob(xd, segment_id, 16);
+ return decode_coefs_4x4(dx, xd, bc, type, i, seg_eob);
+}
+#endif
diff --git a/vp9/decoder/vp9_detokenize.h b/vp9/decoder/vp9_detokenize.h
index c9569bf34..97de72b9a 100644
--- a/vp9/decoder/vp9_detokenize.h
+++ b/vp9/decoder/vp9_detokenize.h
@@ -27,5 +27,10 @@ int vp9_decode_sb64_tokens(VP9D_COMP* const pbi,
int vp9_decode_mb_tokens_4x4_uv(VP9D_COMP* const dx, MACROBLOCKD* const xd,
BOOL_DECODER* const bc);
+#if CONFIG_NEWBINTRAMODES
+int vp9_decode_coefs_4x4(VP9D_COMP *dx, MACROBLOCKD *xd,
+ BOOL_DECODER* const bc,
+ PLANE_TYPE type, int i);
+#endif
#endif // VP9_DECODER_VP9_DETOKENIZE_H_
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index e66f6a2f5..34adc9915 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -573,6 +573,10 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP))
seg_eob = 0;
+ /* sanity check to ensure that we do not have spurious non-zero q values */
+ if (eob < seg_eob)
+ assert(qcoeff_ptr[scan[eob]] == 0);
+
{
#if CONFIG_CODE_NONZEROCOUNT
int nzc = 0;
@@ -2562,7 +2566,7 @@ static int64_t encode_inter_mb_segment_8x8(VP9_COMMON *const cm,
BLOCKD *bd = &xd->block[ib + iblock[j]];
BLOCK *be = &x->block[ib + iblock[j]];
x->fwd_txm8x4(be->src_diff, be->coeff, 32);
- x->quantize_b_4x4_pair(x, ib + iblock[j], ib + iblock[j]);
+ x->quantize_b_4x4_pair(x, ib + iblock[j], ib + iblock[j] + 1);
thisdistortion = vp9_block_error_c(be->coeff, bd->dqcoeff, 32);
otherdist += thisdistortion;
xd->mode_info_context->mbmi.txfm_size = TX_4X4;