From ef01b956d88e68a4cb66b94d6a99a46c6909fa1a Mon Sep 17 00:00:00 2001 From: Paul Wilkins Date: Fri, 15 Feb 2013 11:34:25 +0000 Subject: [PATCH] Entropy stats output code. Fixes to make Entropy stats code work again Change-Id: I62e380481a4eb4c170076ac6ab36f0c2b203e914 --- vp9/encoder/vp9_bitstream.c | 1 - vp9/encoder/vp9_mcomp.c | 54 ++++--------------------------------- vp9/encoder/vp9_mcomp.h | 4 +-- vp9/encoder/vp9_onyx_if.c | 6 +---- 4 files changed, 7 insertions(+), 58 deletions(-) diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c index 8d6cfe96c..af00fe852 100644 --- a/vp9/encoder/vp9_bitstream.c +++ b/vp9/encoder/vp9_bitstream.c @@ -810,7 +810,6 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_mv_ref_probs(&cpi->common, mv_ref_p, mi->mb_mode_context[rf]); #ifdef ENTROPY_STATS - accum_mv_refs(mode, ct); active_section = 3; #endif diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c index 3791737d2..64d8d7d6c 100644 --- a/vp9/encoder/vp9_mcomp.c +++ b/vp9/encoder/vp9_mcomp.c @@ -19,11 +19,6 @@ #include "vp9/common/vp9_findnearmv.h" #include "vp9/common/vp9_common.h" -#ifdef ENTROPY_STATS -static int mv_ref_ct [31] [4] [2]; -static int mv_mode_cts [4] [2]; -#endif - void vp9_clamp_mv_min_max(MACROBLOCK *x, int_mv *ref_mv) { int col_min = (ref_mv->as_mv.col >> 3) - MAX_FULL_PEL_VAL + ((ref_mv->as_mv.col & 7) ? 1 : 0); @@ -2103,21 +2098,22 @@ int vp9_refining_search_sadx4(MACROBLOCK *x, BLOCK *b, BLOCKD *d, #ifdef ENTROPY_STATS -void print_mode_context(void) { +void print_mode_context(VP9_COMMON *pc) { FILE *f = fopen("vp9_modecont.c", "a"); int i, j; fprintf(f, "#include \"vp9_entropy.h\"\n"); - fprintf(f, "const int vp9_mode_contexts[6][4] ="); + fprintf(f, "const int vp9_mode_contexts[INTER_MODE_CONTEXTS][4] ="); fprintf(f, "{\n"); - for (j = 0; j < 6; j++) { + for (j = 0; j < INTER_MODE_CONTEXTS; j++) { fprintf(f, " {/* %d */ ", j); fprintf(f, " "); for (i = 0; i < 4; i++) { int this_prob; // context probs - this_prob = get_binary_prob(mv_ref_ct[j][i][0], mv_ref_ct[j][i][1]); + this_prob = get_binary_prob(pc->fc.mv_ref_ct[j][i][0], + pc->fc.mv_ref_ct[j][i][1]); fprintf(f, "%5d, ", this_prob); } @@ -2128,44 +2124,4 @@ void print_mode_context(void) { fclose(f); } -/* MV ref count ENTROPY_STATS stats code */ -void init_mv_ref_counts() { - vpx_memset(mv_ref_ct, 0, sizeof(mv_ref_ct)); - vpx_memset(mv_mode_cts, 0, sizeof(mv_mode_cts)); -} - -void accum_mv_refs(MB_PREDICTION_MODE m, const int ct[4]) { - if (m == ZEROMV) { - ++mv_ref_ct [ct[0]] [0] [0]; - ++mv_mode_cts[0][0]; - } else { - ++mv_ref_ct [ct[0]] [0] [1]; - ++mv_mode_cts[0][1]; - - if (m == NEARESTMV) { - ++mv_ref_ct [ct[1]] [1] [0]; - ++mv_mode_cts[1][0]; - } else { - ++mv_ref_ct [ct[1]] [1] [1]; - ++mv_mode_cts[1][1]; - - if (m == NEARMV) { - ++mv_ref_ct [ct[2]] [2] [0]; - ++mv_mode_cts[2][0]; - } else { - ++mv_ref_ct [ct[2]] [2] [1]; - ++mv_mode_cts[2][1]; - - if (m == NEWMV) { - ++mv_ref_ct [ct[3]] [3] [0]; - ++mv_mode_cts[3][0]; - } else { - ++mv_ref_ct [ct[3]] [3] [1]; - ++mv_mode_cts[3][1]; - } - } - } - } -} - #endif/* END MV ref count ENTROPY_STATS stats code */ diff --git a/vp9/encoder/vp9_mcomp.h b/vp9/encoder/vp9_mcomp.h index 358d10bc6..06acdbe58 100644 --- a/vp9/encoder/vp9_mcomp.h +++ b/vp9/encoder/vp9_mcomp.h @@ -16,9 +16,7 @@ #include "vp9/encoder/vp9_variance.h" #ifdef ENTROPY_STATS -extern void init_mv_ref_counts(); -extern void accum_mv_refs(MB_PREDICTION_MODE, const int near_mv_ref_cts[4]); -void print_mode_context(void); +void print_mode_context(VP9_COMMON *pc); #endif diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c index 2528122a6..4c73cb5c8 100644 --- a/vp9/encoder/vp9_onyx_if.c +++ b/vp9/encoder/vp9_onyx_if.c @@ -1648,10 +1648,6 @@ VP9_PTR vp9_create_compressor(VP9_CONFIG *oxcf) { cpi->rd_thresh_mult[i] = 128; } -#ifdef ENTROPY_STATS - init_mv_ref_counts(); -#endif - #define BFP(BT, SDF, VF, SVF, SVFHH, SVFHV, SVFHHV, SDX3F, SDX8F, SDX4DF) \ cpi->fn_ptr[BT].sdf = SDF; \ cpi->fn_ptr[BT].vf = VF; \ @@ -1738,7 +1734,7 @@ void vp9_remove_compressor(VP9_PTR *ptr) { if (cpi->pass != 1) { print_context_counters(); print_tree_update_probs(); - print_mode_context(); + print_mode_context(&cpi->common); } #endif #ifdef NMV_STATS