int intra_mode_stats[VP8_BINTRAMODES]
[VP8_BINTRAMODES]
[VP8_BINTRAMODES];
-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};
+unsigned int tree_update_hist [BLOCK_TYPES]
+ [COEF_BANDS]
+ [PREV_COEF_CONTEXTS]
+ [ENTROPY_NODES][2];
+unsigned int tree_update_hist_8x8 [BLOCK_TYPES_8X8]
+ [COEF_BANDS]
+ [PREV_COEF_CONTEXTS]
+ [ENTROPY_NODES] [2];
extern unsigned int active_section;
#endif
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");
+ fprintf(f, "const vp8_prob\n"
+ "vp8_coef_update_probs[BLOCK_TYPES]\n"
+ " [COEF_BANDS]\n"
+ " [PREV_COEF_CONTEXTS]\n"
+ " [ENTROPY_NODES] = {\n");
for (i = 0; i < BLOCK_TYPES; i++)
{
fprintf(f, "};\n");
- fprintf(f, "const vp8_prob tree_update_probs_8x8[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES] = {\n");
+ fprintf(f, "const vp8_prob\n"
+ "vp8_coef_update_probs_8x8[BLOCK_TYPES_8X8]\n"
+ " [COEF_BANDS]\n"
+ " [PREV_COEF_CONTEXTS]\n"
+ " [ENTROPY_NODES] = {\n");
+
for (i = 0; i < BLOCK_TYPES_8X8; i++)
{
fprintf(f, " },\n");
}
fclose(f);
+ f = fopen("treeupdate.bin", "wb");
+ fwrite(tree_update_hist, sizeof(tree_update_hist), 1, f);
+ fwrite(tree_update_hist_8x8, sizeof(tree_update_hist_8x8), 1, f);
+ fclose(f);
+
}
#endif
#ifdef ENTROPY_STATS
INT64 context_counters[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
INT64 context_counters_8x8[BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
+extern unsigned int tree_update_hist [BLOCK_TYPES]
+ [COEF_BANDS]
+ [PREV_COEF_CONTEXTS]
+ [ENTROPY_NODES][2];
+extern unsigned int tree_update_hist_8x8 [BLOCK_TYPES_8X8]
+ [COEF_BANDS]
+ [PREV_COEF_CONTEXTS]
+ [ENTROPY_NODES] [2];
#endif
void vp8_stuff_mb(VP8_COMP *cpi, MACROBLOCKD *x, TOKENEXTRA **t) ;
void vp8_stuff_mb_8x8(VP8_COMP *cpi, MACROBLOCKD *x, TOKENEXTRA **t) ;
void init_context_counters(void)
{
- vpx_memset(context_counters, 0, sizeof(context_counters));
- vpx_memset(context_counters_8x8, 0, sizeof(context_counters_8x8));
+ FILE *f = fopen("context.bin", "rb");
+ if(!f)
+ {
+ vpx_memset(context_counters, 0, sizeof(context_counters));
+ vpx_memset(context_counters_8x8, 0, sizeof(context_counters_8x8));
+ }
+ else
+ {
+ fread(context_counters, sizeof(context_counters), 1, f);
+ fread(context_counters_8x8, sizeof(context_counters_8x8), 1, f);
+ fclose(f);
+ }
+
+ f = fopen("treeupdate.bin", "rb");
+ if(!f)
+ {
+ vpx_memset(tree_update_hist, 0, sizeof(tree_update_hist));
+ vpx_memset(tree_update_hist_8x8, 0, sizeof(tree_update_hist_8x8));
+ }
+ else
+ {
+ fread(tree_update_hist, sizeof(tree_update_hist), 1, f);
+ fread(tree_update_hist_8x8, sizeof(tree_update_hist_8x8), 1, f);
+ fclose(f);
+ }
}
void print_context_counters()
{
int type, band, pt, t;
-
- FILE *const f = fopen("context.c", "w");
+ FILE *f = fopen("context.c", "w");
fprintf(f, "#include \"entropy.h\"\n");
-
fprintf(f, "\n/* *** GENERATED FILE: DO NOT EDIT *** */\n\n");
-
- fprintf(f, "static const unsigned int\nvp8_default_coef_counts[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS] = {");
+ fprintf(f, "static const unsigned int\n"
+ "vp8_default_coef_counts[BLOCK_TYPES]\n"
+ " [COEF_BANDS]\n"
+ " [PREV_COEF_CONTEXTS]\n"
+ " [MAX_ENTROPY_TOKENS]={\n");
# define Comma( X) (X? ",":"")
-
type = 0;
do
{
do
{
fprintf(f, "%s\n { /* Coeff Band %d */", Comma(band), band);
-
pt = 0;
do
{
fprintf(f, "\n};\n");
fclose(f);
+
+ f = fopen("context.bin", "wb");
+ fwrite(context_counters, sizeof(context_counters), 1, f);
+ fwrite(context_counters_8x8, sizeof(context_counters_8x8), 1, f);
+ fclose(f);
}
#endif