Commit 813c6c39 authored by Deb Mukherjee's avatar Deb Mukherjee

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
parent 3b909a6f
......@@ -226,6 +226,7 @@ EXPERIMENT_LIST="
newentropy
newupdate
superblocks
expanded_coef_context
"
CONFIG_LIST="
external_build
......
......@@ -72,7 +72,6 @@ extern const unsigned char vp8_block2above[25];
extern const unsigned char vp8_block2left_8x8[25];
extern const unsigned char vp8_block2above_8x8[25];
#define VP8_COMBINEENTROPYCONTEXTS( Dest, A, B) \
Dest = ((A)!=0) + ((B)!=0);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -51,7 +51,11 @@ DECLARE_ALIGNED(16, cuchar, vp8_coef_bands[16]) =
{ 0, 1, 2, 3, 6, 4, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7};
DECLARE_ALIGNED(16, cuchar, vp8_prev_token_class[MAX_ENTROPY_TOKENS]) =
#if CONFIG_EXPANDED_COEF_CONTEXT
{ 0, 1, 2, 2, 3, 3, 3, 3, 3, 3, 3, 0};
#else
{ 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0};
#endif
DECLARE_ALIGNED(16, const int, vp8_default_zig_zag1d[16]) =
{
......
......@@ -82,12 +82,18 @@ extern DECLARE_ALIGNED(64, const unsigned char, vp8_coef_bands_8x8[64]);
distinct bands). */
/*# define DC_TOKEN_CONTEXTS 3*/ /* 00, 0!0, !0!0 */
#define PREV_COEF_CONTEXTS 3
#if CONFIG_EXPANDED_COEF_CONTEXT
#define PREV_COEF_CONTEXTS 4
#else
#define PREV_COEF_CONTEXTS 3
#endif
#if CONFIG_NEWUPDATE
#define SUBEXP_PARAM 1 /* Subexponential code parameter */
#define COEFUPDATETYPE 2 /* coef update type to use (1/2/3) */
#define SUBEXP_PARAM 1 /* Subexponential code parameter */
#define COEFUPDATETYPE 2 /* coef update type to use (1/2/3) */
#endif
extern DECLARE_ALIGNED(16, const unsigned char, vp8_prev_token_class[MAX_ENTROPY_TOKENS]);
extern const vp8_prob vp8_coef_update_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
......
......@@ -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));
......
......@@ -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; \
......
......@@ -1424,6 +1424,10 @@ static int default_coef_context_savings(VP8_COMP *cpi)
//unsigned int branch_ct [ENTROPY_NODES] [2];
int t = 0; /* token/prob index */
#if CONFIG_EXPANDED_COEF_CONTEXT
if (k >=3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
continue;
#endif
vp8_tree_probs_from_distribution(
MAX_ENTROPY_TOKENS, vp8_coef_encodings, vp8_coef_tree,
......@@ -1473,6 +1477,10 @@ void build_coeff_contexts(VP8_COMP *cpi)
do
{
int t;
#if CONFIG_EXPANDED_COEF_CONTEXT
if (k >=3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
continue;
#endif
vp8_tree_probs_from_distribution(
MAX_ENTROPY_TOKENS, vp8_coef_encodings, vp8_coef_tree,
cpi->frame_coef_probs [i][j][k],
......@@ -1512,6 +1520,10 @@ void build_coeff_contexts(VP8_COMP *cpi)
//vp8_prob new_p [ENTROPY_NODES];
//unsigned int branch_ct [ENTROPY_NODES] [2];
int t = 0; /* token/prob index */
#if CONFIG_EXPANDED_COEF_CONTEXT
if (k >=3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
continue;
#endif
vp8_tree_probs_from_distribution(
MAX_ENTROPY_TOKENS, vp8_coef_encodings, vp8_coef_tree,
cpi->frame_coef_probs_8x8 [i][j][k],
......@@ -1569,6 +1581,10 @@ static void update_coef_probs3(VP8_COMP *cpi)
const vp8_prob upd = vp8_coef_update_probs [i][j][k][t];
int s;
int u = 0;
#if CONFIG_EXPANDED_COEF_CONTEXT
if (k >=3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
continue;
#endif
#if defined(SEARCH_NEWP)
s = prob_update_savings_search(
......@@ -1605,6 +1621,10 @@ static void update_coef_probs3(VP8_COMP *cpi)
int s;
int u = 0;
#if CONFIG_EXPANDED_COEF_CONTEXT
if (k >=3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
continue;
#endif
#if defined(SEARCH_NEWP)
s = prob_update_savings_search(
cpi->frame_branch_ct [i][j][k][t], *Pold, &newp, upd);
......@@ -1650,6 +1670,10 @@ static void update_coef_probs3(VP8_COMP *cpi)
int s;
int u = 0;
#if CONFIG_EXPANDED_COEF_CONTEXT
if (k >=3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
continue;
#endif
#if defined(SEARCH_NEWP)
s = prob_update_savings_search(
cpi->frame_branch_ct_8x8 [i][j][k][t],
......@@ -1688,6 +1712,10 @@ static void update_coef_probs3(VP8_COMP *cpi)
int s;
int u = 0;
#if CONFIG_EXPANDED_COEF_CONTEXT
if (k >=3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
continue;
#endif
#if defined(SEARCH_NEWP)
s = prob_update_savings_search(
cpi->frame_branch_ct_8x8 [i][j][k][t],
......@@ -1742,6 +1770,10 @@ static void update_coef_probs2(VP8_COMP *cpi)
{
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 newp = cpi->frame_coef_probs [i][j][k][t];
vp8_prob *Pold = cpi->common.fc.coef_probs [i][j][k] + t;
const vp8_prob upd = vp8_coef_update_probs [i][j][k][t];
......@@ -1785,7 +1817,10 @@ static void update_coef_probs2(VP8_COMP *cpi)
const vp8_prob upd = vp8_coef_update_probs [i][j][k][t];
int s;
int u = 0;
#if CONFIG_EXPANDED_COEF_CONTEXT
if (k >=3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
continue;
#endif
#if defined(SEARCH_NEWP)
s = prob_update_savings_search(
cpi->frame_branch_ct [i][j][k][t], *Pold, &newp, upd);
......@@ -1829,7 +1864,10 @@ static void update_coef_probs2(VP8_COMP *cpi)
const vp8_prob upd = vp8_coef_update_probs_8x8 [i][j][k][t];
int s;
int u = 0;
#if CONFIG_EXPANDED_COEF_CONTEXT
if (k >=3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
continue;
#endif
#if defined(SEARCH_NEWP)
s = prob_update_savings_search(
cpi->frame_branch_ct_8x8 [i][j][k][t],
......@@ -1870,7 +1908,10 @@ static void update_coef_probs2(VP8_COMP *cpi)
const vp8_prob upd = vp8_coef_update_probs_8x8 [i][j][k][t];
int s;
int u = 0;
#if CONFIG_EXPANDED_COEF_CONTEXT
if (k >=3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
continue;
#endif
#if defined(SEARCH_NEWP)
s = prob_update_savings_search(
cpi->frame_branch_ct_8x8 [i][j][k][t],
......@@ -1939,7 +1980,10 @@ static void update_coef_probs(VP8_COMP *cpi)
const vp8_prob upd = vp8_coef_update_probs [i][j][k][t];
int s = prev_coef_savings[t];
int u = 0;
#if CONFIG_EXPANDED_COEF_CONTEXT
if (k >=3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
continue;
#endif
#if CONFIG_NEWUPDATE && defined(SEARCH_NEWP)
s = prob_update_savings_search(
cpi->frame_branch_ct [i][j][k][t],
......@@ -2007,6 +2051,10 @@ static void update_coef_probs(VP8_COMP *cpi)
const vp8_prob upd = vp8_coef_update_probs [i][j][k][t];
int s = prev_coef_savings[t];
int u = 0;
#if CONFIG_EXPANDED_COEF_CONTEXT
if (k >=3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
continue;
#endif
#if CONFIG_NEWUPDATE && defined(SEARCH_NEWP)
s = prob_update_savings_search(
......@@ -2088,6 +2136,10 @@ static void update_coef_probs(VP8_COMP *cpi)
vp8_prob *Pold = cpi->common.fc.coef_probs_8x8 [i][j][k] + t;
const vp8_prob oldp = *Pold;
const vp8_prob upd = vp8_coef_update_probs_8x8 [i][j][k][t];
#if CONFIG_EXPANDED_COEF_CONTEXT
if (k >=3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
continue;
#endif
#if CONFIG_NEWUPDATE && defined(SEARCH_NEWP)
const int s = prob_update_savings_search(ct, oldp, &newp, upd);
const int u = s > 0 && newp != oldp ? 1 : 0;
......@@ -2165,6 +2217,11 @@ static void update_coef_probs(VP8_COMP *cpi)
#else
const int s = prob_update_savings(ct, oldp, newp, upd);
const int u = s > 0 ? 1 : 0;
#if CONFIG_EXPANDED_COEF_CONTEXT
if (k >=3 && ((i == 0 && j == 1) ||
(i > 0 && j == 0)))
continue;
#endif
#endif
vp8_write(w, u, upd);
#ifdef ENTROPY_STATS
......
......@@ -229,7 +229,6 @@ static void fill_token_costs(
for (j = 0; j < COEF_BANDS; j++)
for (k = 0; k < PREV_COEF_CONTEXTS; k++)
{
if(k == 0 && ((j > 0 && i > 0) || (j > 1 && i == 0)))
vp8_cost_tokens_skip((int *)(c [i][j][k]), p [i][j][k], vp8_coef_tree);
else
......@@ -371,12 +370,12 @@ void vp8_initialize_rd_consts(VP8_COMP *cpi, int QIndex)
fill_token_costs(
cpi->mb.token_costs,
(const vp8_prob( *)[8][3][11]) cpi->common.fc.coef_probs
(const vp8_prob( *)[8][PREV_COEF_CONTEXTS][11]) cpi->common.fc.coef_probs
);
fill_token_costs(
cpi->mb.token_costs_8x8,
(const vp8_prob( *)[8][3][11]) cpi->common.fc.coef_probs_8x8
(const vp8_prob( *)[8][PREV_COEF_CONTEXTS][11]) cpi->common.fc.coef_probs_8x8
);
/*rough estimate for costing*/
cpi->common.kf_ymode_probs_index = cpi->common.base_qindex>>4;
......
......@@ -629,9 +629,7 @@ void print_context_counters()
fprintf(f, "\n/* *** GENERATED FILE: DO NOT EDIT *** */\n\n");
fprintf(f, "int Contexts[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];\n\n");
fprintf(f, "const int default_contexts[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS] = {");
fprintf(f, "static const unsigned int\nvp8_default_coef_counts[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS] = {");
# define Comma( X) (X? ",":"")
......@@ -678,10 +676,11 @@ void print_context_counters()
fprintf(f, "\n }");
}
while (++type < BLOCK_TYPES);
fprintf(f, "\n};\n");
fprintf(f, "int Contexts_8x8[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];\n\n");
fprintf(f, "const int default_contexts_8x8[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS] = {");
fprintf(f, "static const unsigned int\nvp8_default_coef_counts_8x8"
"[BLOCK_TYPES] [COEF_BANDS]"
"[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS] = {");
type = 0;
......@@ -705,7 +704,7 @@ void print_context_counters()
do
{
const INT64 x = context_counters [type] [band] [pt] [t];
const INT64 x = context_counters_8x8 [type] [band] [pt] [t];
const int y = (int) x;
assert(x == (INT64) y); /* no overflow handling yet */
......@@ -728,6 +727,113 @@ void print_context_counters()
while (++type < BLOCK_TYPES);
fprintf(f, "\n};\n");
fprintf(f, "static const vp8_prob\n"
"vp8_default_coef_probs[BLOCK_TYPES] [COEF_BANDS] \n"
"[PREV_COEF_CONTEXTS] [ENTROPY_NODES] = {");
type = 0;
do
{
fprintf(f, "%s\n { /* block Type %d */", Comma(type), type);
band = 0;
do
{
fprintf(f, "%s\n { /* Coeff Band %d */", Comma(band), band);
pt = 0;
do
{
fprintf(f, "%s\n {", Comma(pt));
unsigned int branch_ct [ENTROPY_NODES] [2];
unsigned int coef_counts[MAX_ENTROPY_TOKENS];
vp8_prob coef_probs[ENTROPY_NODES];
for (t=0; t<MAX_ENTROPY_TOKENS; ++t)
coef_counts[t]=context_counters [type] [band] [pt] [t];
vp8_tree_probs_from_distribution(
MAX_ENTROPY_TOKENS, vp8_coef_encodings, vp8_coef_tree,
coef_probs, branch_ct, coef_counts, 256, 1);
t = 0;
do
{
fprintf(f, "%s %d", Comma(t), coef_probs[t]);
}
while (++t < ENTROPY_NODES);
fprintf(f, "}");
}
while (++pt < PREV_COEF_CONTEXTS);
fprintf(f, "\n }");
}
while (++band < COEF_BANDS);
fprintf(f, "\n }");
}
while (++type < BLOCK_TYPES);
fprintf(f, "\n};\n");
fprintf(f, "static const vp8_prob\n"
"vp8_default_coef_probs_8x8[BLOCK_TYPES] [COEF_BANDS]\n"
"[PREV_COEF_CONTEXTS] [ENTROPY_NODES] = {");
type = 0;
do
{
fprintf(f, "%s\n { /* block Type %d */", Comma(type), type);
band = 0;
do
{
fprintf(f, "%s\n { /* Coeff Band %d */", Comma(band), band);
pt = 0;
do
{
fprintf(f, "%s\n {", Comma(pt));
unsigned int branch_ct [ENTROPY_NODES] [2];
unsigned int coef_counts[MAX_ENTROPY_TOKENS];
vp8_prob coef_probs[ENTROPY_NODES];
for (t=0; t<MAX_ENTROPY_TOKENS; ++t)
coef_counts[t]=context_counters_8x8[type] [band] [pt] [t];
vp8_tree_probs_from_distribution(
MAX_ENTROPY_TOKENS, vp8_coef_encodings, vp8_coef_tree,
coef_probs, branch_ct, coef_counts, 256, 1);
t = 0;
do
{
fprintf(f, "%s %d", Comma(t), coef_probs[t]);
}
while (++t < ENTROPY_NODES);
fprintf(f, "}");
}
while (++pt < PREV_COEF_CONTEXTS);
fprintf(f, "\n }");
}
while (++band < COEF_BANDS);
fprintf(f, "\n }");
}
while (++type < BLOCK_TYPES);
fprintf(f, "\n};\n");
fclose(f);
}
......
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