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 ...@@ -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] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [PREV_COEF_CONTEXTS]
[ENTROPY_NODES] = [ENTROPY_NODES] =
...@@ -482,71 +482,5 @@ const vp8_prob vp8_coef_update_probs_8x8 [BLOCK_TYPES] ...@@ -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, }, {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 @@ ...@@ -10,7 +10,7 @@
/* Generated file, included by entropy.c */ /* 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] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [PREV_COEF_CONTEXTS]
[MAX_ENTROPY_TOKENS] = [MAX_ENTROPY_TOKENS] =
...@@ -214,70 +214,4 @@ static const unsigned int vp8_default_coef_counts_8x8[BLOCK_TYPES] ...@@ -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}, { 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) ...@@ -204,7 +204,7 @@ void vp8_default_coef_probs(VP8_COMMON *pc)
} }
while (++i < COEF_BANDS); 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 */ ...@@ -58,6 +58,8 @@ extern vp8_extra_bit_struct vp8_extra_bits[12]; /* indexed by token value */
#define BLOCK_TYPES 4 #define BLOCK_TYPES 4
#define BLOCK_TYPES_8X8 3
/* Middle dimension is a coarsening of the coefficient's /* Middle dimension is a coarsening of the coefficient's
position within the 4x4 DCT. */ position within the 4x4 DCT. */
...@@ -97,7 +99,7 @@ extern DECLARE_ALIGNED(64, const unsigned char, vp8_coef_bands_8x8[64]); ...@@ -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 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 [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; struct VP8Common;
void vp8_default_coef_probs(struct VP8Common *); void vp8_default_coef_probs(struct VP8Common *);
......
...@@ -49,7 +49,7 @@ typedef struct frame_contexts ...@@ -49,7 +49,7 @@ typedef struct frame_contexts
vp8_prob uv_mode_prob [VP8_YMODES][VP8_UV_MODES-1]; vp8_prob uv_mode_prob [VP8_YMODES][VP8_UV_MODES-1];
vp8_prob sub_mv_ref_prob [VP8_SUBMVREFS-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 [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]; MV_CONTEXT mvc[2];
#if CONFIG_HIGH_PRECISION_MV #if CONFIG_HIGH_PRECISION_MV
MV_CONTEXT_HP mvc_hp[2]; MV_CONTEXT_HP mvc_hp[2];
......
...@@ -823,7 +823,7 @@ static void read_coef_probs3(VP8D_COMP *pbi) ...@@ -823,7 +823,7 @@ static void read_coef_probs3(VP8D_COMP *pbi)
if(pbi->common.txfm_mode == ALLOW_8X8) 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++) for (l = 0; l < ENTROPY_NODES; l++)
{ {
if(vp8_read(bc, grpupd)) if(vp8_read(bc, grpupd))
...@@ -889,7 +889,7 @@ static void read_coef_probs2(VP8D_COMP *pbi) ...@@ -889,7 +889,7 @@ static void read_coef_probs2(VP8D_COMP *pbi)
{ {
if(vp8_read(bc, grpupd)) 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 (j = !i; j < COEF_BANDS; j++)
for (k = 0; k < PREV_COEF_CONTEXTS; k++) for (k = 0; k < PREV_COEF_CONTEXTS; k++)
{ {
...@@ -961,7 +961,7 @@ static void read_coef_probs(VP8D_COMP *pbi) ...@@ -961,7 +961,7 @@ static void read_coef_probs(VP8D_COMP *pbi)
if(pbi->common.txfm_mode == ALLOW_8X8 && vp8_read_bit(bc)) if(pbi->common.txfm_mode == ALLOW_8X8 && vp8_read_bit(bc))
{ {
// read coef probability tree // read coef probability tree
for (i = 0; i < BLOCK_TYPES; i++) for (i = 0; i < BLOCK_TYPES_8X8; i++)
#if CONFIG_NEWUPDATE #if CONFIG_NEWUPDATE
for (j = !i; j < COEF_BANDS; j++) for (j = !i; j < COEF_BANDS; j++)
#else #else
......
...@@ -35,9 +35,14 @@ unsigned __int64 Sectionbits[500]; ...@@ -35,9 +35,14 @@ unsigned __int64 Sectionbits[500];
#ifdef ENTROPY_STATS #ifdef ENTROPY_STATS
int intra_mode_stats[10][10][10]; 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 [BLOCK_TYPES]
static unsigned int tree_update_hist_8x8 [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES] [2]; [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; extern unsigned int active_section;
#endif #endif
...@@ -1383,87 +1388,6 @@ static void print_prob_tree(vp8_prob ...@@ -1383,87 +1388,6 @@ static void print_prob_tree(vp8_prob
fclose(f); 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) void build_coeff_contexts(VP8_COMP *cpi)
{ {
...@@ -1489,12 +1413,16 @@ void build_coeff_contexts(VP8_COMP *cpi) ...@@ -1489,12 +1413,16 @@ void build_coeff_contexts(VP8_COMP *cpi)
256, 1 256, 1
); );
#ifdef ENTROPY_STATS #ifdef ENTROPY_STATS
t = 0; if(!cpi->dummy_packing)
do
{ {
context_counters [i][j][k][t] += cpi->coef_counts [i][j][k][t]; t = 0;
do
{
context_counters [i][j][k][t] +=
cpi->coef_counts [i][j][k][t];
}
while (++t < MAX_ENTROPY_TOKENS);
} }
while (++t < MAX_ENTROPY_TOKENS);
#endif #endif
} }
while (++k < PREV_COEF_CONTEXTS); while (++k < PREV_COEF_CONTEXTS);
...@@ -1532,12 +1460,16 @@ void build_coeff_contexts(VP8_COMP *cpi) ...@@ -1532,12 +1460,16 @@ void build_coeff_contexts(VP8_COMP *cpi)
256, 1 256, 1
); );
#ifdef ENTROPY_STATS #ifdef ENTROPY_STATS
t = 0; if(!cpi->dummy_packing)
do
{ {
context_counters [i][j][k][t] += cpi->coef_counts [i][j][k][t]; t = 0;
do
{
context_counters_8x8 [i][j][k][t] +=
cpi->coef_counts_8x8 [i][j][k][t];
}
while (++t < MAX_ENTROPY_TOKENS);
} }
while (++t < MAX_ENTROPY_TOKENS);
#endif #endif
} }
...@@ -1545,7 +1477,7 @@ void build_coeff_contexts(VP8_COMP *cpi) ...@@ -1545,7 +1477,7 @@ void build_coeff_contexts(VP8_COMP *cpi)
} }
while (++j < COEF_BANDS); while (++j < COEF_BANDS);
} }
while (++i < BLOCK_TYPES); while (++i < BLOCK_TYPES_8X8);
} }
} }
...@@ -1637,7 +1569,8 @@ static void update_coef_probs3(VP8_COMP *cpi) ...@@ -1637,7 +1569,8 @@ static void update_coef_probs3(VP8_COMP *cpi)
//printf(" %d %d %d: %d (%d)\n", i, j, k, u, upd); //printf(" %d %d %d: %d (%d)\n", i, j, k, u, upd);
vp8_write(w, u, upd); vp8_write(w, u, upd);
#ifdef ENTROPY_STATS #ifdef ENTROPY_STATS
++ tree_update_hist [i][j][k][t] [u]; if(!cpi->dummy_packing)
++ tree_update_hist [i][j][k][t] [u];
#endif #endif
if (u) if (u)
{ /* send/use new probability */ { /* send/use new probability */
...@@ -1653,7 +1586,7 @@ static void update_coef_probs3(VP8_COMP *cpi) ...@@ -1653,7 +1586,7 @@ static void update_coef_probs3(VP8_COMP *cpi)
if(cpi->common.txfm_mode != ALLOW_8X8) return; 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) for (t = 0; t < ENTROPY_NODES; ++t)
{ {
...@@ -1731,7 +1664,8 @@ static void update_coef_probs3(VP8_COMP *cpi) ...@@ -1731,7 +1664,8 @@ static void update_coef_probs3(VP8_COMP *cpi)
#endif #endif
vp8_write(w, u, upd); vp8_write(w, u, upd);
#ifdef ENTROPY_STATS #ifdef ENTROPY_STATS
++ tree_update_hist_8x8 [i][j][k][t] [u]; if(!cpi->dummy_packing)
++ tree_update_hist_8x8 [i][j][k][t] [u];
#endif #endif
if (u) if (u)
{ {
...@@ -1853,7 +1787,7 @@ static void update_coef_probs2(VP8_COMP *cpi) ...@@ -1853,7 +1787,7 @@ static void update_coef_probs2(VP8_COMP *cpi)
/* dry run to see if there is any udpate at all needed */ /* dry run to see if there is any udpate at all needed */
savings = 0; savings = 0;
update[0] = update[1] = 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) for (j = !i; j < COEF_BANDS; ++j)
{ {
...@@ -1897,7 +1831,7 @@ static void update_coef_probs2(VP8_COMP *cpi) ...@@ -1897,7 +1831,7 @@ static void update_coef_probs2(VP8_COMP *cpi)
continue; continue;
} }
vp8_write(w, 1, grpupd); 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) for (j = !i; j < COEF_BANDS; ++j)
{ {
...@@ -1927,7 +1861,8 @@ static void update_coef_probs2(VP8_COMP *cpi) ...@@ -1927,7 +1861,8 @@ static void update_coef_probs2(VP8_COMP *cpi)
#endif #endif
vp8_write(w, u, upd); vp8_write(w, u, upd);
#ifdef ENTROPY_STATS #ifdef ENTROPY_STATS
++ tree_update_hist_8x8 [i][j][k][t] [u]; if(!cpi->dummy_packing)
++ tree_update_hist_8x8 [i][j][k][t] [u];
#endif #endif
if (u) if (u)
{ {
...@@ -2073,7 +2008,8 @@ static void update_coef_probs(VP8_COMP *cpi) ...@@ -2073,7 +2008,8 @@ static void update_coef_probs(VP8_COMP *cpi)
vp8_write(w, u, upd); vp8_write(w, u, upd);
#ifdef ENTROPY_STATS #ifdef ENTROPY_STATS
++ tree_update_hist [i][j][k][t] [u]; if(!cpi->dummy_packing)
++ tree_update_hist [i][j][k][t] [u];
#endif #endif
if (u) if (u)
{ {
...@@ -2090,15 +2026,6 @@ static void update_coef_probs(VP8_COMP *cpi) ...@@ -2090,15 +2026,6 @@ static void update_coef_probs(VP8_COMP *cpi)
} }
while (++t < ENTROPY_NODES); 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); while (++k < PREV_COEF_CONTEXTS);
} }
...@@ -2154,30 +2081,15 @@ static void update_coef_probs(VP8_COMP *cpi) ...@@ -2154,30 +2081,15 @@ static void update_coef_probs(VP8_COMP *cpi)
savings += s; savings += s;
#endif #endif
#ifdef ENTROPY_STATS
++ tree_update_hist_8x8 [i][j][k][t] [u];
#endif
update[u]++; update[u]++;
} }
while (++t < MAX_ENTROPY_TOKENS - 1); 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];
}