Commit 54cf1d9a authored by Yaowu Xu's avatar Yaowu Xu
Browse files

a number of fixes to entropy stats collection

1. block types
There are only three types of blocks for 8x8 transformed MBs, i.e. Y
block with DC does not exist for 8x8 transformed MBs as all MB using
8x8 transform have 2nd order haar transform. This commit introduced
a new macro BLOCK_TYPES_8X8 to reflect such fact.

2. context counters
This commit also fixed the mixed of context_counters between 4x4 and
8x8 transformed MBs. The mixed use of the counters leads me to think
the existing the context probabilities were not properly generated
from 8x8 transformed MBs.

3. redundant collecting in recoding
The commit also corrected the code that accumulates entropy stats by
making sure stats only collected for final packing, not during the
recode loop

Change-Id: I029f09f8f60bd0c3240cc392ff5c6d05435e322c
parent 813c6c39
......@@ -279,7 +279,7 @@ const vp8_prob vp8_coef_update_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTE
},
},
};
const vp8_prob vp8_coef_update_probs_8x8 [BLOCK_TYPES]
const vp8_prob vp8_coef_update_probs_8x8 [BLOCK_TYPES_8X8]
[COEF_BANDS]
[PREV_COEF_CONTEXTS]
[ENTROPY_NODES] =
......@@ -482,71 +482,5 @@ const vp8_prob vp8_coef_update_probs_8x8 [BLOCK_TYPES]
{249, 244, 249, 255, 255, 255, 255, 255, 255, 255, 255, },
},
},
{
{
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
{249, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
#if CONFIG_EXPANDED_COEF_CONTEXT
{255, 239, 234, 244, 239, 244, 249, 255, 255, 255, 255, },
#endif
{255, 239, 234, 244, 239, 244, 249, 255, 255, 255, 255, },
},
{
{255, 249, 239, 239, 244, 255, 255, 255, 255, 255, 255, },
{255, 249, 244, 255, 249, 255, 255, 255, 255, 255, 255, },
#if CONFIG_EXPANDED_COEF_CONTEXT
{255, 255, 239, 255, 255, 249, 255, 255, 255, 255, 255, },
#endif
{255, 255, 239, 255, 255, 249, 255, 255, 255, 255, 255, },
},
{
{255, 244, 239, 239, 244, 255, 255, 255, 255, 255, 255, },
{255, 234, 239, 234, 249, 255, 255, 255, 255, 255, 255, },
#if CONFIG_EXPANDED_COEF_CONTEXT
{255, 255, 229, 239, 234, 249, 244, 255, 255, 255, 255, },
#endif
{255, 255, 229, 239, 234, 249, 244, 255, 255, 255, 255, },
},
{
{255, 239, 229, 239, 234, 234, 255, 255, 255, 255, 255, },
{255, 239, 234, 229, 244, 239, 255, 234, 255, 255, 255, },
#if CONFIG_EXPANDED_COEF_CONTEXT
{255, 229, 209, 229, 239, 234, 244, 229, 255, 249, 255, },
#endif
{255, 229, 209, 229, 239, 234, 244, 229, 255, 249, 255, },
},
{
{255, 239, 234, 229, 244, 249, 255, 249, 255, 255, 255, },
{255, 234, 229, 244, 234, 249, 255, 249, 255, 255, 255, },
#if CONFIG_EXPANDED_COEF_CONTEXT
{255, 229, 239, 229, 249, 255, 255, 244, 255, 255, 255, },
#endif
{255, 229, 239, 229, 249, 255, 255, 244, 255, 255, 255, },
},
{
{255, 239, 234, 239, 234, 239, 255, 249, 255, 255, 255, },
{255, 229, 234, 239, 239, 239, 255, 244, 255, 255, 255, },
#if CONFIG_EXPANDED_COEF_CONTEXT
{255, 229, 234, 239, 239, 244, 255, 255, 255, 255, 255, },
#endif
{255, 229, 234, 239, 239, 244, 255, 255, 255, 255, 255, },
},
{
{255, 219, 224, 229, 229, 234, 239, 224, 255, 255, 255, },
{255, 229, 229, 224, 234, 229, 239, 239, 255, 255, 255, },
#if CONFIG_EXPANDED_COEF_CONTEXT
{255, 229, 224, 239, 234, 239, 224, 224, 255, 249, 255, },
#endif
{255, 229, 224, 239, 234, 239, 224, 224, 255, 249, 255, },
},
{
{255, 234, 229, 244, 229, 229, 255, 214, 255, 255, 255, },
{255, 239, 234, 239, 214, 239, 255, 209, 255, 255, 255, },
#if CONFIG_EXPANDED_COEF_CONTEXT
{249, 239, 219, 209, 219, 224, 239, 204, 255, 255, 255, },
#endif
{249, 239, 219, 209, 219, 224, 239, 204, 255, 255, 255, },
},
},
};
......@@ -10,7 +10,7 @@
/* Generated file, included by entropy.c */
static const unsigned int vp8_default_coef_counts_8x8[BLOCK_TYPES]
static const unsigned int vp8_default_coef_counts_8x8[BLOCK_TYPES_8X8]
[COEF_BANDS]
[PREV_COEF_CONTEXTS]
[MAX_ENTROPY_TOKENS] =
......@@ -214,70 +214,4 @@ static const unsigned int vp8_default_coef_counts_8x8[BLOCK_TYPES]
{ 3882867, 3224489, 1052289, 252890, 46967, 8548, 154, 0, 0, 0, 0, 194354},
}
},
{ /* block Type 3 */
{ /* Coeff Band 0 */
{ 10583, 12059, 3155, 1041, 248, 175, 24, 2, 0, 0, 0, 5717},
{ 42461, 41782, 13553, 4966, 1352, 855, 89, 0, 0, 0, 0, 15000},
#if CONFIG_EXPANDED_COEF_CONTEXT
{ 4691125, 5045589, 2673566, 1089317, 378161, 160268, 18252, 813, 69, 13, 0, 49},
#endif
{ 4691125, 5045589, 2673566, 1089317, 378161, 160268, 18252, 813, 69, 13, 0, 49},
},
{ /* Coeff Band 1 */
{ 1535203, 1685686, 924565, 390329, 141709, 60523, 5983, 171, 0, 0, 0, 0},
{ 1594021, 1793276, 1016078, 441332, 164159, 70843, 8098, 311, 0, 0, 0, 11312},
#if CONFIG_EXPANDED_COEF_CONTEXT
{ 1225223, 1430184, 888492, 460713, 203286, 115149, 22061, 804, 7, 0, 0, 0},
#endif
{ 1225223, 1430184, 888492, 460713, 203286, 115149, 22061, 804, 7, 0, 0, 0},
},
{ /* Coeff Band 2 */
{ 1522386, 1590366, 799910, 303691, 96625, 37608, 3637, 180, 33, 11, 0, 0},
{ 1682184, 1793869, 913649, 353520, 113674, 46309, 4736, 221, 18, 3, 0, 963},
#if CONFIG_EXPANDED_COEF_CONTEXT
{ 1574580, 1740474, 954392, 417994, 151400, 67091, 8000, 536, 73, 10, 0, 63},
#endif
{ 1574580, 1740474, 954392, 417994, 151400, 67091, 8000, 536, 73, 10, 0, 63},
},
{ /* Coeff Band 3 */
{ 4963672, 5197790, 2585383, 982161, 313333, 118498, 16014, 536, 62, 0, 0, 0},
{ 5223913, 5569803, 2845858, 1107384, 364949, 147841, 18296, 658, 11, 11, 0, 1866},
#if CONFIG_EXPANDED_COEF_CONTEXT
{ 4042207, 4548894, 2608767, 1154993, 446290, 221295, 41054, 2438, 124, 20, 0, 0},
#endif
{ 4042207, 4548894, 2608767, 1154993, 446290, 221295, 41054, 2438, 124, 20, 0, 0},
},
{ /* Coeff Band 4 */
{ 3857216, 4431325, 2670447, 1330169, 553301, 286825, 46763, 1917, 0, 0, 0, 0},
{ 4226215, 4963701, 3046198, 1523923, 644670, 355519, 58792, 2525, 0, 0, 0, 1298},
#if CONFIG_EXPANDED_COEF_CONTEXT
{ 3831873, 4580350, 3018580, 1660048, 797298, 502983, 123906, 7172, 16, 0, 0, 0},
#endif
{ 3831873, 4580350, 3018580, 1660048, 797298, 502983, 123906, 7172, 16, 0, 0, 0},
},
{ /* Coeff Band 5 */
{ 8524543, 9285149, 4979435, 2039330, 683458, 266032, 22628, 270, 0, 0, 0, 0},
{ 9432163, 10428088, 5715661, 2385738, 838389, 326264, 29981, 361, 0, 0, 0, 884},
#if CONFIG_EXPANDED_COEF_CONTEXT
{ 9039066, 10368964, 6136765, 2862030, 1098269, 511668, 63105, 945, 14, 0, 0, 0},
#endif
{ 9039066, 10368964, 6136765, 2862030, 1098269, 511668, 63105, 945, 14, 0, 0, 0},
},
{ /* Coeff Band 6 */
{ 33222872, 34748297, 17701695, 7214933, 2602336, 1191859, 187873, 12667, 390, 3, 0, 0},
{ 34765051, 37140719, 19525578, 8268934, 3085012, 1473864, 246743, 15258, 736, 3, 0, 8403},
#if CONFIG_EXPANDED_COEF_CONTEXT
{ 28591289, 32252393, 19037068, 9213729, 4020653, 2372354, 586420, 67428, 3920, 92, 7, 3},
#endif
{ 28591289, 32252393, 19037068, 9213729, 4020653, 2372354, 586420, 67428, 3920, 92, 7, 3},
},
{ /* Coeff Band 7 */
{ 68604786, 60777665, 19712887, 5656955, 1520443, 507166, 51829, 2466, 10, 0, 0, 0},
{ 55447403, 51682540, 19008774, 5928582, 1706884, 595531, 65998, 3661, 101, 0, 0, 8468343},
#if CONFIG_EXPANDED_COEF_CONTEXT
{ 28321970, 29149398, 13565882, 5258675, 1868588, 898041, 192023, 21497, 672, 17, 0, 1884921},
#endif
{ 28321970, 29149398, 13565882, 5258675, 1868588, 898041, 192023, 21497, 672, 17, 0, 1884921},
}
}
};
......@@ -204,7 +204,7 @@ void vp8_default_coef_probs(VP8_COMMON *pc)
}
while (++i < COEF_BANDS);
}
while (++h < BLOCK_TYPES);
while (++h < BLOCK_TYPES_8X8);
}
......
......@@ -58,6 +58,8 @@ extern vp8_extra_bit_struct vp8_extra_bits[12]; /* indexed by token value */
#define BLOCK_TYPES 4
#define BLOCK_TYPES_8X8 3
/* Middle dimension is a coarsening of the coefficient's
position within the 4x4 DCT. */
......@@ -97,7 +99,7 @@ extern DECLARE_ALIGNED(64, const unsigned char, vp8_coef_bands_8x8[64]);
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];
extern const vp8_prob vp8_coef_update_probs_8x8 [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
extern const vp8_prob vp8_coef_update_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
struct VP8Common;
void vp8_default_coef_probs(struct VP8Common *);
......
......@@ -49,7 +49,7 @@ typedef struct frame_contexts
vp8_prob uv_mode_prob [VP8_YMODES][VP8_UV_MODES-1];
vp8_prob sub_mv_ref_prob [VP8_SUBMVREFS-1];
vp8_prob coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
vp8_prob coef_probs_8x8 [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
vp8_prob coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
MV_CONTEXT mvc[2];
#if CONFIG_HIGH_PRECISION_MV
MV_CONTEXT_HP mvc_hp[2];
......
......@@ -823,7 +823,7 @@ static void read_coef_probs3(VP8D_COMP *pbi)
if(pbi->common.txfm_mode == ALLOW_8X8)
{
for (i = 0; i < BLOCK_TYPES; i++)
for (i = 0; i < BLOCK_TYPES_8X8; i++)
for (l = 0; l < ENTROPY_NODES; l++)
{
if(vp8_read(bc, grpupd))
......@@ -889,7 +889,7 @@ static void read_coef_probs2(VP8D_COMP *pbi)
{
if(vp8_read(bc, grpupd))
{
for (i = 0; i < BLOCK_TYPES; i++)
for (i = 0; i < BLOCK_TYPES_8X8; i++)
for (j = !i; j < COEF_BANDS; j++)
for (k = 0; k < PREV_COEF_CONTEXTS; k++)
{
......@@ -961,7 +961,7 @@ static void read_coef_probs(VP8D_COMP *pbi)
if(pbi->common.txfm_mode == ALLOW_8X8 && vp8_read_bit(bc))
{
// read coef probability tree
for (i = 0; i < BLOCK_TYPES; i++)
for (i = 0; i < BLOCK_TYPES_8X8; i++)
#if CONFIG_NEWUPDATE
for (j = !i; j < COEF_BANDS; j++)
#else
......
......@@ -35,9 +35,14 @@ unsigned __int64 Sectionbits[500];
#ifdef ENTROPY_STATS
int intra_mode_stats[10][10][10];
static unsigned int tree_update_hist [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES] [2];
static unsigned int tree_update_hist_8x8 [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES] [2];
static unsigned int tree_update_hist [BLOCK_TYPES]
[COEF_BANDS]
[PREV_COEF_CONTEXTS]
[ENTROPY_NODES][2]={0};
static unsigned int tree_update_hist_8x8 [BLOCK_TYPES_8X8]
[COEF_BANDS]
[PREV_COEF_CONTEXTS]
[ENTROPY_NODES] [2]={0};
extern unsigned int active_section;
#endif
......@@ -1383,87 +1388,6 @@ static void print_prob_tree(vp8_prob
fclose(f);
}
static void sum_probs_over_prev_coef_context(
const unsigned int probs[PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS],
unsigned int* out)
{
int i, j;
for (i=0; i < MAX_ENTROPY_TOKENS; ++i)
{
for (j=0; j < PREV_COEF_CONTEXTS; ++j)
{
const int tmp = out[i];
out[i] += probs[j][i];
/* check for wrap */
if (out[i] < tmp)
out[i] = UINT_MAX;
}
}
}
static int default_coef_context_savings(VP8_COMP *cpi)
{
int savings = 0;
int i = 0;
do
{
#if CONFIG_NEWUPDATE
int j = !i;
#else
int j = 0; /* token/prob index */
#endif
do
{
int k = 0;
do
{
/* at every context */
/* calc probs and branch cts for this frame only */
//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 [i][j][k],
cpi->frame_branch_ct [i][j][k],
cpi->coef_counts [i][j][k],
256, 1
);
do
{
const unsigned int *ct = cpi->frame_branch_ct [i][j][k][t];
vp8_prob newp = cpi->frame_coef_probs [i][j][k][t];
const vp8_prob oldp = cpi->common.fc.coef_probs [i][j][k][t];
const vp8_prob upd = vp8_coef_update_probs [i][j][k][t];
#if CONFIG_NEWUPDATE && defined(SEARCH_NEWP)
const int s = prob_update_savings_search(ct, oldp, &newp, upd);
#else
const int s = prob_update_savings(ct, oldp, newp, upd);
#endif
if (s > 0)
{
savings += s;
}
}
while (++t < ENTROPY_NODES);
}
while (++k < PREV_COEF_CONTEXTS);
}
while (++j < COEF_BANDS);
}
while (++i < BLOCK_TYPES);
return savings;
}
void build_coeff_contexts(VP8_COMP *cpi)
{
......@@ -1489,12 +1413,16 @@ void build_coeff_contexts(VP8_COMP *cpi)
256, 1
);
#ifdef ENTROPY_STATS
if(!cpi->dummy_packing)
{
t = 0;
do
{
context_counters [i][j][k][t] += cpi->coef_counts [i][j][k][t];
context_counters [i][j][k][t] +=
cpi->coef_counts [i][j][k][t];
}
while (++t < MAX_ENTROPY_TOKENS);
}
#endif
}
while (++k < PREV_COEF_CONTEXTS);
......@@ -1532,12 +1460,16 @@ void build_coeff_contexts(VP8_COMP *cpi)
256, 1
);
#ifdef ENTROPY_STATS
if(!cpi->dummy_packing)
{
t = 0;
do
{
context_counters [i][j][k][t] += cpi->coef_counts [i][j][k][t];
context_counters_8x8 [i][j][k][t] +=
cpi->coef_counts_8x8 [i][j][k][t];
}
while (++t < MAX_ENTROPY_TOKENS);
}
#endif
}
......@@ -1545,7 +1477,7 @@ void build_coeff_contexts(VP8_COMP *cpi)
}
while (++j < COEF_BANDS);
}
while (++i < BLOCK_TYPES);
while (++i < BLOCK_TYPES_8X8);
}
}
......@@ -1637,6 +1569,7 @@ static void update_coef_probs3(VP8_COMP *cpi)
//printf(" %d %d %d: %d (%d)\n", i, j, k, u, upd);
vp8_write(w, u, upd);
#ifdef ENTROPY_STATS
if(!cpi->dummy_packing)
++ tree_update_hist [i][j][k][t] [u];
#endif
if (u)
......@@ -1653,7 +1586,7 @@ static void update_coef_probs3(VP8_COMP *cpi)
if(cpi->common.txfm_mode != ALLOW_8X8) return;
for (i = 0; i < BLOCK_TYPES; ++i)
for (i = 0; i < BLOCK_TYPES_8X8; ++i)
{
for (t = 0; t < ENTROPY_NODES; ++t)
{
......@@ -1731,6 +1664,7 @@ static void update_coef_probs3(VP8_COMP *cpi)
#endif
vp8_write(w, u, upd);
#ifdef ENTROPY_STATS
if(!cpi->dummy_packing)
++ tree_update_hist_8x8 [i][j][k][t] [u];
#endif
if (u)
......@@ -1853,7 +1787,7 @@ static void update_coef_probs2(VP8_COMP *cpi)
/* dry run to see if there is any udpate at all needed */
savings = 0;
update[0] = update[1] = 0;
for (i = 0; i < BLOCK_TYPES; ++i)
for (i = 0; i < BLOCK_TYPES_8X8; ++i)
{
for (j = !i; j < COEF_BANDS; ++j)
{
......@@ -1897,7 +1831,7 @@ static void update_coef_probs2(VP8_COMP *cpi)
continue;
}
vp8_write(w, 1, grpupd);
for (i = 0; i < BLOCK_TYPES; ++i)
for (i = 0; i < BLOCK_TYPES_8X8; ++i)
{
for (j = !i; j < COEF_BANDS; ++j)
{
......@@ -1927,6 +1861,7 @@ static void update_coef_probs2(VP8_COMP *cpi)
#endif
vp8_write(w, u, upd);
#ifdef ENTROPY_STATS
if(!cpi->dummy_packing)
++ tree_update_hist_8x8 [i][j][k][t] [u];
#endif
if (u)
......@@ -2073,6 +2008,7 @@ static void update_coef_probs(VP8_COMP *cpi)
vp8_write(w, u, upd);
#ifdef ENTROPY_STATS
if(!cpi->dummy_packing)
++ tree_update_hist [i][j][k][t] [u];
#endif
if (u)
......@@ -2090,15 +2026,6 @@ static void update_coef_probs(VP8_COMP *cpi)
}
while (++t < ENTROPY_NODES);
// Accum token counts for generation of default statistics
#if 0//def ENTROPY_STATS
t = 0;
do
{
context_counters [i][j][k][t] += cpi->coef_counts [i][j][k][t];
}
while (++t < MAX_ENTROPY_TOKENS);
#endif
}
while (++k < PREV_COEF_CONTEXTS);
}
......@@ -2154,30 +2081,15 @@ static void update_coef_probs(VP8_COMP *cpi)
savings += s;
#endif
#ifdef ENTROPY_STATS
++ tree_update_hist_8x8 [i][j][k][t] [u];
#endif
update[u]++;
}
while (++t < MAX_ENTROPY_TOKENS - 1);
// Accum token counts for generation of default statistics
#if 0//def ENTROPY_STATS
t = 0;
do
{
context_counters_8x8 [i][j][k][t] += cpi->coef_counts_8x8 [i][j][k][t];
}
while (++t < MAX_ENTROPY_TOKENS - 1);
#endif
}
while (++k < PREV_COEF_CONTEXTS);
}
while (++j < COEF_BANDS);
}
while (++i < BLOCK_TYPES);
while (++i < BLOCK_TYPES_8X8);
#if CONFIG_NEWUPDATE
if (update[1] == 0 || savings < 0)
......@@ -2225,6 +2137,7 @@ static void update_coef_probs(VP8_COMP *cpi)
#endif
vp8_write(w, u, upd);
#ifdef ENTROPY_STATS
if(!cpi->dummy_packing)
++ tree_update_hist_8x8 [i][j][k][t] [u];
#endif
if (u)
......@@ -2240,21 +2153,12 @@ static void update_coef_probs(VP8_COMP *cpi)
}
}
while (++t < MAX_ENTROPY_TOKENS - 1);
// Accum token counts for generation of default statistics
#if 0//def ENTROPY_STATS
t = 0;
do
{
context_counters_8x8 [i][j][k][t] += cpi->coef_counts_8x8 [i][j][k][t];
}
while (++t < MAX_ENTROPY_TOKENS);
#endif
}
while (++k < PREV_COEF_CONTEXTS);
}
while (++j < COEF_BANDS);
}
while (++i < BLOCK_TYPES);
while (++i < BLOCK_TYPES_8X8);
}
}
}
......@@ -2786,7 +2690,7 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size)
void print_tree_update_probs()
{
int i, j, k, l;
FILE *f = fopen("context.c", "a");
FILE *f = fopen("coefupdprob.h", "w");
int Sum;
fprintf(f, "\n/* Update probabilities for token entropy tree. */\n\n");
fprintf(f, "const vp8_prob tree_update_probs[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES] = {\n");
......@@ -2831,7 +2735,7 @@ void print_tree_update_probs()
fprintf(f, "const vp8_prob tree_update_probs_8x8[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES] = {\n");
for (i = 0; i < BLOCK_TYPES; i++)
for (i = 0; i < BLOCK_TYPES_8X8; i++)
{
fprintf(f, " { \n");
......
......@@ -149,7 +149,7 @@ typedef struct
unsigned int token_costs[BLOCK_TYPES] [COEF_BANDS]
[PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS];
unsigned int token_costs_8x8[BLOCK_TYPES] [COEF_BANDS]
unsigned int token_costs_8x8[BLOCK_TYPES_8X8] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
int optimize;
......
......@@ -3279,6 +3279,7 @@ static void encode_frame_to_data_rate
// accurate estimate of output frame size to determine if we need
// to recode.
vp8_save_coding_context(cpi);
cpi->dummy_packing = 1;
vp8_pack_bitstream(cpi, dest, size);
cpi->projected_frame_size = (*size) << 3;
vp8_restore_coding_context(cpi);
......@@ -3604,6 +3605,7 @@ static void encode_frame_to_data_rate
loopfilter_frame(cpi, cm);
// build the bitstream
cpi->dummy_packing = 0;
vp8_pack_bitstream(cpi, dest, size);
update_reference_frames(cm);
......
......@@ -87,7 +87,7 @@ typedef struct
vp8_prob coef_probs[BLOCK_TYPES]
[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
vp8_prob coef_probs_8x8[BLOCK_TYPES]
vp8_prob coef_probs_8x8[BLOCK_TYPES_8X8]
[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
vp8_prob ymode_prob [VP8_YMODES-1]; /* interframe intra mode probs */
......@@ -452,9 +452,9 @@ typedef struct VP8_COMP
//save vp8_tree_probs_from_distribution result for each frame to avoid repeat calculation
vp8_prob frame_coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
unsigned int frame_branch_ct [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES][2];
unsigned int coef_counts_8x8 [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; /* for this frame */
vp8_prob frame_coef_probs_8x8 [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
unsigned int frame_branch_ct_8x8 [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES][2];
unsigned int coef_counts_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; /* for this frame */
vp8_prob frame_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
unsigned int frame_branch_ct_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES][2];
int gfu_boost;
int kf_boost;
......@@ -651,6 +651,8 @@ typedef struct VP8_COMP
// TODO Do we still need this??
int update_context;
int dummy_packing; /* flag to indicate if packing is dummy */
} VP8_COMP;
void control_data_rate(VP8_COMP *cpi);
......
......@@ -218,26 +218,28 @@ const MV_REFERENCE_FRAME vp8_second_ref_frame_order[MAX_MODES] =
};
static void fill_token_costs(
unsigned int c [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS],
const vp8_prob p [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES]
)
unsigned int (*c)[COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS],
const vp8_prob (*p)[COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES],
int block_type_counts)
{
int i, j, k;