summaryrefslogtreecommitdiff
path: root/vp9/decoder
diff options
context:
space:
mode:
authorYaowu Xu <yaowu@google.com>2012-11-28 15:15:51 -0800
committerYaowu Xu <yaowu@google.com>2012-12-07 17:25:45 -0800
commitab480cede582e1ef102a0e04b61cb755df4781b7 (patch)
tree5175ef5369b7ff0d7a8214815ec8c0e9dd4ecd57 /vp9/decoder
parentfbf052df4246bb4886d055f0fcda7c97de90d360 (diff)
downloadlibvpx-ab480cede582e1ef102a0e04b61cb755df4781b7.tar
libvpx-ab480cede582e1ef102a0e04b61cb755df4781b7.tar.gz
libvpx-ab480cede582e1ef102a0e04b61cb755df4781b7.tar.bz2
libvpx-ab480cede582e1ef102a0e04b61cb755df4781b7.zip
experiment with CONTEXT conversion
This commit changed the ENTROPY_CONTEXT conversion between MBs that have different transform sizes. In additioin, this commit also did a number of cleanup/bug fix: 1. removed duplicate function vp9_fix_contexts() and changed to use vp8_reset_mb_token_contexts() for both encoder and decoder 2. fixed a bug in stuff_mb_16x16 where wrong context was used for the UV. 3. changed reset all context to 0 if a MB is skipped to simplify the logic. Change-Id: I7bc57a5fb6dbf1f85eac1543daaeb3a61633275c
Diffstat (limited to 'vp9/decoder')
-rw-r--r--vp9/decoder/vp9_decodframe.c5
-rw-r--r--vp9/decoder/vp9_detokenize.c87
2 files changed, 53 insertions, 39 deletions
diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c
index ffdf9f371..d72d08698 100644
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -14,6 +14,7 @@
#include "vp9/common/vp9_reconintra.h"
#include "vp9/common/vp9_reconintra4x4.h"
#include "vp9/common/vp9_reconinter.h"
+#include "vp9/common/vp9_entropy.h"
#include "vp9/decoder/vp9_decodframe.h"
#include "vp9/decoder/vp9_detokenize.h"
#include "vp9/common/vp9_invtrans.h"
@@ -443,12 +444,12 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd,
vp9_dequant_idct_add(b->qcoeff, b->dequant, b->predictor,
*(b->base_dst) + b->dst, 16, b->dst_stride);
}
- xd->above_context->y2 = 1;
- xd->left_context->y2 = 1;
}
if (!xd->mode_info_context->mbmi.mb_skip_coeff) {
vp9_decode_mb_tokens_4x4_uv(pbi, xd, bc);
}
+ xd->above_context->y2 = 0;
+ xd->left_context->y2 = 0;
vp9_build_intra_predictors_mbuv(xd);
pbi->idct_add_uv_block(xd->qcoeff + 16 * 16,
xd->block[16].dequant,
diff --git a/vp9/decoder/vp9_detokenize.c b/vp9/decoder/vp9_detokenize.c
index 7434bd5f9..32746d5a0 100644
--- a/vp9/decoder/vp9_detokenize.c
+++ b/vp9/decoder/vp9_detokenize.c
@@ -15,7 +15,6 @@
#include "vpx_mem/vpx_mem.h"
#include "vpx_ports/mem.h"
#include "vp9/decoder/vp9_detokenize.h"
-
#include "vp9/common/vp9_seg_common.h"
#define EOB_CONTEXT_NODE 0
@@ -59,22 +58,6 @@ static const unsigned char cat6_prob[15] = {
254, 254, 254, 252, 249, 243, 230, 196, 177, 153, 140, 133, 130, 129, 0
};
-void vp9_reset_mb_tokens_context(MACROBLOCKD* const xd) {
- /* Clear entropy contexts */
- if ((xd->mode_info_context->mbmi.mode != B_PRED &&
- xd->mode_info_context->mbmi.mode != I8X8_PRED &&
- xd->mode_info_context->mbmi.mode != SPLITMV)
- || xd->mode_info_context->mbmi.txfm_size == TX_16X16) {
- vpx_memset(xd->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES));
- vpx_memset(xd->left_context, 0, sizeof(ENTROPY_CONTEXT_PLANES));
- } else {
- vpx_memset(xd->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) - 1);
- vpx_memset(xd->left_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) - 1);
- xd->above_context->y2 = 1;
- xd->left_context->y2 = 1;
- }
-}
-
DECLARE_ALIGNED(16, extern const unsigned char, vp9_norm[256]);
static int get_signed(BOOL_DECODER *br, int value_to_sign) {
@@ -321,15 +304,23 @@ static int vp9_decode_mb_tokens_16x16(VP9D_COMP* const pbi,
unsigned short* const eobs = xd->eobs;
const int segment_id = xd->mode_info_context->mbmi.segment_id;
int c, i, eobtotal = 0, seg_eob;
-
// Luma block
- eobs[0] = c = decode_coefs(pbi, xd, bc, A, L, PLANE_TYPE_Y_WITH_DC,
+
+#if CONFIG_CNVCONTEXT
+ ENTROPY_CONTEXT above_ec = (A[0] + A[1] + A[2] + A[3]) != 0;
+ ENTROPY_CONTEXT left_ec = (L[0] + L[1] + L[2] + L[3]) != 0;
+#else
+ ENTROPY_CONTEXT above_ec = A[0];
+ ENTROPY_CONTEXT left_ec = L[0];
+#endif
+ eobs[0] = c = decode_coefs(pbi, xd, bc, &above_ec, &left_ec,
+ PLANE_TYPE_Y_WITH_DC,
get_tx_type(xd, &xd->block[0]),
get_eob(xd, segment_id, 256),
xd->qcoeff, vp9_default_zig_zag1d_16x16,
TX_16X16, vp9_coef_bands_16x16);
- A[1] = A[2] = A[3] = A[0];
- L[1] = L[2] = L[3] = L[0];
+ A[1] = A[2] = A[3] = A[0] = above_ec;
+ L[1] = L[2] = L[3] = L[0] = left_ec;
eobtotal += c;
// 8x8 chroma blocks
@@ -337,13 +328,21 @@ static int vp9_decode_mb_tokens_16x16(VP9D_COMP* const pbi,
for (i = 16; i < 24; i += 4) {
ENTROPY_CONTEXT* const a = A + vp9_block2above_8x8[i];
ENTROPY_CONTEXT* const l = L + vp9_block2left_8x8[i];
-
- eobs[i] = c = decode_coefs(pbi, xd, bc, a, l, PLANE_TYPE_UV,
+#if CONFIG_CNVCONTEXT
+ above_ec = (a[0] + a[1]) != 0;
+ left_ec = (l[0] + l[1]) != 0;
+#else
+ above_ec = a[0];
+ left_ec = l[0];
+#endif
+ eobs[i] = c = decode_coefs(pbi, xd, bc,
+ &above_ec, &left_ec,
+ PLANE_TYPE_UV,
DCT_DCT, seg_eob, xd->block[i].qcoeff,
vp9_default_zig_zag1d_8x8,
TX_8X8, vp9_coef_bands_8x8);
- a[1] = a[0];
- l[1] = l[0];
+ a[1] = a[0] = above_ec;
+ l[1] = l[0] = left_ec;
eobtotal += c;
}
A[8] = 0;
@@ -374,8 +373,8 @@ static int vp9_decode_mb_tokens_8x8(VP9D_COMP* const pbi,
eobtotal += c - 4;
type = PLANE_TYPE_Y_NO_DC;
} else {
- xd->above_context->y2 = 1;
- xd->left_context->y2 = 1;
+ xd->above_context->y2 = 0;
+ xd->left_context->y2 = 0;
eobs[24] = 0;
type = PLANE_TYPE_Y_WITH_DC;
}
@@ -385,15 +384,21 @@ static int vp9_decode_mb_tokens_8x8(VP9D_COMP* const pbi,
for (i = 0; i < 16; i += 4) {
ENTROPY_CONTEXT *const a = A + vp9_block2above_8x8[i];
ENTROPY_CONTEXT *const l = L + vp9_block2left_8x8[i];
-
- eobs[i] = c = decode_coefs(pbi, xd, bc, a, l, type,
+#if CONFIG_CNVCONTEXT
+ ENTROPY_CONTEXT above_ec = (a[0] + a[1]) != 0;
+ ENTROPY_CONTEXT left_ec = (l[0] + l[1]) != 0;
+#else
+ ENTROPY_CONTEXT above_ec = a[0];
+ ENTROPY_CONTEXT left_ec = l[0];
+#endif
+ eobs[i] = c = decode_coefs(pbi, xd, bc, &above_ec, &left_ec, type,
type == PLANE_TYPE_Y_WITH_DC ?
get_tx_type(xd, xd->block + i) : DCT_DCT,
seg_eob, xd->block[i].qcoeff,
vp9_default_zig_zag1d_8x8,
TX_8X8, vp9_coef_bands_8x8);
- a[1] = a[0];
- l[1] = l[0];
+ a[1] = a[0] = above_ec;
+ l[1] = l[0] = left_ec;
eobtotal += c;
}
@@ -415,13 +420,21 @@ static int vp9_decode_mb_tokens_8x8(VP9D_COMP* const pbi,
for (i = 16; i < 24; i += 4) {
ENTROPY_CONTEXT *const a = A + vp9_block2above_8x8[i];
ENTROPY_CONTEXT *const l = L + vp9_block2left_8x8[i];
-
- eobs[i] = c = decode_coefs(pbi, xd, bc, a, l, PLANE_TYPE_UV,
+#if CONFIG_CNVCONTEXT
+ ENTROPY_CONTEXT above_ec = (a[0] + a[1]) != 0;
+ ENTROPY_CONTEXT left_ec = (l[0] + l[1]) != 0;
+#else
+ ENTROPY_CONTEXT above_ec = a[0];
+ ENTROPY_CONTEXT left_ec = l[0];
+#endif
+ eobs[i] = c = decode_coefs(pbi, xd, bc,
+ &above_ec, &left_ec,
+ PLANE_TYPE_UV,
DCT_DCT, seg_eob, xd->block[i].qcoeff,
vp9_default_zig_zag1d_8x8,
TX_8X8, vp9_coef_bands_8x8);
- a[1] = a[0];
- l[1] = l[0];
+ a[1] = a[0] = above_ec;
+ l[1] = l[0] = left_ec;
eobtotal += c;
}
}
@@ -517,8 +530,8 @@ static int vp9_decode_mb_tokens_4x4(VP9D_COMP* const dx,
DCT_DCT, vp9_default_zig_zag1d) - 16;
type = PLANE_TYPE_Y_NO_DC;
} else {
- xd->above_context->y2 = 1;
- xd->left_context->y2 = 1;
+ xd->above_context->y2 = 0;
+ xd->left_context->y2 = 0;
xd->eobs[24] = 0;
type = PLANE_TYPE_Y_WITH_DC;
}