summaryrefslogtreecommitdiff
path: root/vp8/decoder
diff options
context:
space:
mode:
authorDeb Mukherjee <debargha@google.com>2012-03-21 15:22:21 -0700
committerDeb Mukherjee <debargha@google.com>2012-05-04 07:11:38 -0700
commit813c6c3925186d3cc0b5fc8221d88ef2ceab878f (patch)
tree8f52e7970aac5680214c77078a17946bd741553c /vp8/decoder
parent3b909a6f037d69c896c00ec33b782adf68fb148a (diff)
downloadlibvpx-813c6c3925186d3cc0b5fc8221d88ef2ceab878f.tar
libvpx-813c6c3925186d3cc0b5fc8221d88ef2ceab878f.tar.gz
libvpx-813c6c3925186d3cc0b5fc8221d88ef2ceab878f.tar.bz2
libvpx-813c6c3925186d3cc0b5fc8221d88ef2ceab878f.zip
Expanding the coefficient encoding contexts
This patch expands the set of prev contexts used for video coding from 3 to 4. There is a small improvement of the order of 0.08% for derf and 0.15% on the HD set. The tests were rerun after the various merges last week. There are two columns in each test - the first are the results with the mbskip change, and the second with expanded contexts added on top of that. Derf: http://www.corp.google.com/~debargha/vp8_results/explibvpx_newentropy_expcontext.html HD: http://www.corp.google.com/~debargha/vp8_results/explibvpx_hd_newentropy_expcontext.html Rebased. Broke up 80 char lines. Change-Id: I82d2e72d054e530cbf5ce9aa0e6d85c582965675
Diffstat (limited to 'vp8/decoder')
-rw-r--r--vp8/decoder/decodframe.c43
-rw-r--r--vp8/decoder/detokenize.c26
2 files changed, 64 insertions, 5 deletions
diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c
index 7cc917d09..35353805b 100644
--- a/vp8/decoder/decodframe.c
+++ b/vp8/decoder/decodframe.c
@@ -803,6 +803,12 @@ static void read_coef_probs3(VP8D_COMP *pbi)
for (j = !i; j < COEF_BANDS; j++)
for (k = 0; k < PREV_COEF_CONTEXTS; k++)
{
+#if CONFIG_EXPANDED_COEF_CONTEXT
+ if (k >= 3 && ((i == 0 && j == 1) ||
+ (i > 0 && j == 0)))
+ continue;
+#endif
+ {
vp8_prob *const p = pc->fc.coef_probs [i][j][k] + l;
int u = vp8_read(bc, vp8_coef_update_probs [i][j][k][l]);
if (u)
@@ -810,6 +816,7 @@ static void read_coef_probs3(VP8D_COMP *pbi)
int delp = vp8_decode_term_subexp(bc, SUBEXP_PARAM, 255);
*p = (vp8_prob)inv_remap_prob(delp, *p);
}
+ }
}
}
}
@@ -824,6 +831,12 @@ static void read_coef_probs3(VP8D_COMP *pbi)
for (j = !i; j < COEF_BANDS; j++)
for (k = 0; k < PREV_COEF_CONTEXTS; k++)
{
+#if CONFIG_EXPANDED_COEF_CONTEXT
+ if (k >= 3 && ((i == 0 && j == 1) ||
+ (i > 0 && j == 0)))
+ continue;
+#endif
+ {
vp8_prob *const p = pc->fc.coef_probs_8x8 [i][j][k] + l;
int u = vp8_read(bc, vp8_coef_update_probs_8x8 [i][j][k][l]);
if (u)
@@ -831,6 +844,7 @@ static void read_coef_probs3(VP8D_COMP *pbi)
int delp = vp8_decode_term_subexp(bc, SUBEXP_PARAM, 255);
*p = (vp8_prob)inv_remap_prob(delp, *p);
}
+ }
}
}
}
@@ -852,6 +866,12 @@ static void read_coef_probs2(VP8D_COMP *pbi)
for (j = !i; j < COEF_BANDS; j++)
for (k = 0; k < PREV_COEF_CONTEXTS; k++)
{
+#if CONFIG_EXPANDED_COEF_CONTEXT
+ if (k >= 3 && ((i == 0 && j == 1) ||
+ (i > 0 && j == 0)))
+ continue;
+#endif
+ {
vp8_prob *const p = pc->fc.coef_probs [i][j][k] + l;
int u = vp8_read(bc, vp8_coef_update_probs [i][j][k][l]);
if (u)
@@ -859,6 +879,7 @@ static void read_coef_probs2(VP8D_COMP *pbi)
int delp = vp8_decode_term_subexp(bc, SUBEXP_PARAM, 255);
*p = (vp8_prob)inv_remap_prob(delp, *p);
}
+ }
}
}
}
@@ -872,6 +893,12 @@ static void read_coef_probs2(VP8D_COMP *pbi)
for (j = !i; j < COEF_BANDS; j++)
for (k = 0; k < PREV_COEF_CONTEXTS; k++)
{
+#if CONFIG_EXPANDED_COEF_CONTEXT
+ if (k >= 3 && ((i == 0 && j == 1) ||
+ (i > 0 && j == 0)))
+ continue;
+#endif
+ {
vp8_prob *const p = pc->fc.coef_probs_8x8 [i][j][k] + l;
int u = vp8_read(bc, vp8_coef_update_probs_8x8 [i][j][k][l]);
@@ -880,6 +907,7 @@ static void read_coef_probs2(VP8D_COMP *pbi)
int delp = vp8_decode_term_subexp(bc, SUBEXP_PARAM, 255);
*p = (vp8_prob)inv_remap_prob(delp, *p);
}
+ }
}
}
}
@@ -904,6 +932,12 @@ static void read_coef_probs(VP8D_COMP *pbi)
for (j = 0; j < COEF_BANDS; j++)
#endif
for (k = 0; k < PREV_COEF_CONTEXTS; k++)
+ {
+#if CONFIG_EXPANDED_COEF_CONTEXT
+ if (k >= 3 && ((i == 0 && j == 1) ||
+ (i > 0 && j == 0)))
+ continue;
+#endif
for (l = 0; l < ENTROPY_NODES; l++)
{
vp8_prob *const p = pc->fc.coef_probs [i][j][k] + l;
@@ -920,6 +954,7 @@ static void read_coef_probs(VP8D_COMP *pbi)
#endif
}
}
+ }
}
}
@@ -933,6 +968,12 @@ static void read_coef_probs(VP8D_COMP *pbi)
for (j = 0; j < COEF_BANDS; j++)
#endif
for (k = 0; k < PREV_COEF_CONTEXTS; k++)
+ {
+#if CONFIG_EXPANDED_COEF_CONTEXT
+ if (k >= 3 && ((i == 0 && j == 1) ||
+ (i > 0 && j == 0)))
+ continue;
+#endif
for (l = 0; l < ENTROPY_NODES; l++)
{
@@ -948,6 +989,7 @@ static void read_coef_probs(VP8D_COMP *pbi)
#endif
}
}
+ }
}
}
@@ -1390,7 +1432,6 @@ int vp8_decode_frame(VP8D_COMP *pbi)
read_coef_probs(pbi);
#endif
-
vpx_memcpy(&xd->pre, &pc->yv12_fb[pc->lst_fb_idx], sizeof(YV12_BUFFER_CONFIG));
vpx_memcpy(&xd->dst, &pc->yv12_fb[pc->new_fb_idx], sizeof(YV12_BUFFER_CONFIG));
diff --git a/vp8/decoder/detokenize.c b/vp8/decoder/detokenize.c
index 106e09663..966c0f127 100644
--- a/vp8/decoder/detokenize.c
+++ b/vp8/decoder/detokenize.c
@@ -21,14 +21,24 @@
#define BOOL_DATA UINT8
#define OCB_X PREV_COEF_CONTEXTS * ENTROPY_NODES
+
+#if CONFIG_EXPANDED_COEF_CONTEXT
+DECLARE_ALIGNED(16, static const unsigned short, coef_bands_x[16]) =
+#else
DECLARE_ALIGNED(16, static const unsigned char, coef_bands_x[16]) =
+#endif
{
0 * OCB_X, 1 * OCB_X, 2 * OCB_X, 3 * OCB_X,
6 * OCB_X, 4 * OCB_X, 5 * OCB_X, 6 * OCB_X,
6 * OCB_X, 6 * OCB_X, 6 * OCB_X, 6 * OCB_X,
6 * OCB_X, 7 * OCB_X, 7 * OCB_X, 7 * OCB_X
};
-DECLARE_ALIGNED(64, static const unsigned char, coef_bands_x_8x8[64]) = {
+#if CONFIG_EXPANDED_COEF_CONTEXT
+DECLARE_ALIGNED(16, static const unsigned short, coef_bands_x_8x8[64]) =
+#else
+DECLARE_ALIGNED(64, static const unsigned char, coef_bands_x_8x8[64]) =
+#endif
+{
0 * OCB_X, 1 * OCB_X, 2 * OCB_X, 3 * OCB_X, 5 * OCB_X, 4 * OCB_X, 4 * OCB_X, 5 * OCB_X,
5 * OCB_X, 3 * OCB_X, 6 * OCB_X, 3 * OCB_X, 5 * OCB_X, 4 * OCB_X, 6 * OCB_X, 6 * OCB_X,
6 * OCB_X, 5 * OCB_X, 5 * OCB_X, 6 * OCB_X, 6 * OCB_X, 6 * OCB_X, 6 * OCB_X, 6 * OCB_X,
@@ -208,9 +218,17 @@ DECLARE_ALIGNED(16, extern const unsigned char, vp8_norm[256]);
NORMALIZE \
}
+//#define PREV_CONTEXT_INC(val) (2+((val)>2))
+//#define PREV_CONTEXT_INC(val) (vp8_prev_token_class[(val)])
+#if CONFIG_EXPANDED_COEF_CONTEXT
+#define PREV_CONTEXT_INC(val) (vp8_prev_token_class[(val)>10?10:(val)])
+#else
+#define PREV_CONTEXT_INC(val) (2)
+#endif
+
#define DECODE_SIGN_WRITE_COEFF_AND_CHECK_EXIT(val) \
DECODE_AND_APPLYSIGN(val) \
- Prob = coef_probs + (ENTROPY_NODES*2); \
+ Prob = coef_probs + (ENTROPY_NODES*PREV_CONTEXT_INC(val)); \
if(c < 15){\
qcoeff_ptr [ scan[c] ] = (INT16) v; \
++c; \
@@ -221,7 +239,7 @@ DECLARE_ALIGNED(16, extern const unsigned char, vp8_norm[256]);
#define DECODE_SIGN_WRITE_COEFF_AND_CHECK_EXIT_8x8_2(val) \
DECODE_AND_APPLYSIGN(val) \
- Prob = coef_probs + (ENTROPY_NODES*2); \
+ Prob = coef_probs + (ENTROPY_NODES*PREV_CONTEXT_INC(val)); \
if(c < 3){\
qcoeff_ptr [ scan[c] ] = (INT16) v; \
++c; \
@@ -230,7 +248,7 @@ DECLARE_ALIGNED(16, extern const unsigned char, vp8_norm[256]);
goto BLOCK_FINISHED_8x8;
#define DECODE_SIGN_WRITE_COEFF_AND_CHECK_EXIT_8x8(val) \
DECODE_AND_APPLYSIGN(val) \
- Prob = coef_probs + (ENTROPY_NODES*2); \
+ Prob = coef_probs + (ENTROPY_NODES*PREV_CONTEXT_INC(val)); \
if(c < 63){\
qcoeff_ptr [ scan[c] ] = (INT16) v; \
++c; \