Commit 51bc4bf4 authored by Paul Wilkins's avatar Paul Wilkins
Browse files

Remove MODE_STATS flag and code

Change-Id: I6c70a8a8a4633399842ac74792003ae5f7859ffa
parent f0ab155e
......@@ -21,8 +21,6 @@
#include "vp9/common/vp9_common.h"
#include "vp9/common/vp9_enums.h"
// #define MODE_STATS
#define MAX_MB_SEGMENTS 8
#define MB_SEG_TREE_PROBS (MAX_MB_SEGMENTS-1)
#define PREDICTION_PROBS 3
......
......@@ -409,27 +409,6 @@ void vp9_adapt_mode_context(VP9_COMMON *pc) {
}
}
#ifdef MODE_STATS
#include "vp9/common/vp9_modecont.h"
void print_mode_contexts(VP9_COMMON *pc) {
int j, i;
printf("\n====================\n");
for (j = 0; j < INTER_MODE_CONTEXTS; j++) {
for (i = 0; i < 4; i++) {
printf("%4d ", pc->fc.mode_context[j][i]);
}
printf("\n");
}
printf("====================\n");
for (j = 0; j < INTER_MODE_CONTEXTS; j++) {
for (i = 0; i < 4; i++) {
printf("%4d ", pc->fc.mode_context_a[j][i]);
}
printf("\n");
}
}
#endif
#define MODE_COUNT_SAT 20
#define MODE_MAX_UPDATE_FACTOR 144
static void update_mode_probs(int n_modes,
......
......@@ -50,10 +50,6 @@ vp9_coeff_stats tree_update_hist_32x32[BLOCK_TYPES];
extern unsigned int active_section;
#endif
#ifdef MODE_STATS
int count_mb_seg[4] = { 0, 0, 0, 0 };
#endif
#define vp9_cost_upd ((int)(vp9_cost_one(upd) - vp9_cost_zero(upd)) >> 8)
#define vp9_cost_upd256 ((int)(vp9_cost_one(upd) - vp9_cost_zero(upd)))
......@@ -702,10 +698,6 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
case SPLITMV: {
int j = 0;
#ifdef MODE_STATS
++count_mb_seg[mi->partitioning];
#endif
do {
B_PREDICTION_MODE blockmode;
int_mv blockmv;
......
......@@ -52,18 +52,6 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t,
static void adjust_act_zbin(VP9_COMP *cpi, MACROBLOCK *x);
#ifdef MODE_STATS
unsigned int inter_y_modes[MB_MODE_COUNT];
unsigned int inter_uv_modes[VP9_UV_MODES];
unsigned int inter_b_modes[B_MODE_COUNT];
unsigned int y_modes[VP9_YMODES];
unsigned int i8x8_modes[VP9_I8X8_MODES];
unsigned int uv_modes[VP9_UV_MODES];
unsigned int uv_modes_y[VP9_YMODES][VP9_UV_MODES];
unsigned int b_modes[B_MODE_COUNT];
#endif
/* activity_avg must be positive, or flat regions could get a zero weight
* (infinite lambda), which confounds analysis.
* This also avoids the need for divide by zero checks in
......@@ -661,11 +649,7 @@ static void update_stats(VP9_COMP *cpi, int mi_row, int mi_col) {
MODE_INFO *mi = xd->mode_info_context;
MB_MODE_INFO *const mbmi = &mi->mbmi;
if (cm->frame_type == KEY_FRAME) {
#ifdef MODE_STATS
y_modes[mbmi->mode]++;
#endif
} else {
if (cm->frame_type != KEY_FRAME) {
int segment_id, seg_ref_active;
if (mbmi->ref_frame) {
......@@ -677,18 +661,6 @@ static void update_stats(VP9_COMP *cpi, int mi_row, int mi_col) {
cpi->comp_pred_count[pred_context]++;
}
#ifdef MODE_STATS
inter_y_modes[mbmi->mode]++;
if (mbmi->mode == SPLITMV) {
int b;
for (b = 0; b < x->partition_info->count; b++) {
inter_b_modes[x->partition_info->bmi[b].mode]++;
}
}
#endif
// If we have just a single reference frame coded for a segment then
// exclude from the reference frame counts used to work out
// probabilities. NOTE: At the moment we dont support custom trees
......@@ -1634,23 +1606,6 @@ static void sum_intra_stats(VP9_COMP *cpi, MACROBLOCK *x) {
const MB_PREDICTION_MODE m = xd->mode_info_context->mbmi.mode;
const MB_PREDICTION_MODE uvm = xd->mode_info_context->mbmi.uv_mode;
#ifdef MODE_STATS
const int is_key = cpi->common.frame_type == KEY_FRAME;
++ (is_key ? uv_modes : inter_uv_modes)[uvm];
++ uv_modes_y[m][uvm];
if (m == I4X4_PRED) {
unsigned int *const bct = is_key ? b_modes : inter_b_modes;
int b = 0;
do {
++ bct[xd->block[b].bmi.as_mode.first];
} while (++b < 4);
}
#endif
#if CONFIG_AB4X4
if (xd->mode_info_context->mbmi.sb_type >= BLOCK_SIZE_SB8X8) {
#else
......
......@@ -120,17 +120,6 @@ unsigned int frames_at_speed[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
#if defined(SECTIONBITS_OUTPUT)
extern unsigned __int64 Sectionbits[500];
#endif
#ifdef MODE_STATS
extern int64_t Sectionbits[500];
extern unsigned int y_modes[VP9_YMODES];
extern unsigned int i8x8_modes[VP9_I8X8_MODES];
extern unsigned int uv_modes[VP9_UV_MODES];
extern unsigned int uv_modes_y[VP9_YMODES][VP9_UV_MODES];
extern unsigned int b_modes[B_MODE_COUNT];
extern unsigned int inter_y_modes[MB_MODE_COUNT];
extern unsigned int inter_uv_modes[VP9_UV_MODES];
extern unsigned int inter_b_modes[B_MODE_COUNT];
#endif
extern void vp9_init_quantizer(VP9_COMP *cpi);
......@@ -1396,16 +1385,7 @@ VP9_PTR vp9_create_compressor(VP9_CONFIG *oxcf) {
if (cpi->pass != 1)
init_context_counters();
#endif
#ifdef MODE_STATS
vp9_zero(y_modes);
vp9_zero(i8x8_modes);
vp9_zero(uv_modes);
vp9_zero(uv_modes_y);
vp9_zero(b_modes);
vp9_zero(inter_y_modes);
vp9_zero(inter_uv_modes);
vp9_zero(inter_b_modes);
#endif
#ifdef NMV_STATS
init_nmvstats();
#endif
......@@ -1669,9 +1649,7 @@ void vp9_remove_compressor(VP9_PTR *ptr) {
- cpi->first_time_stamp_ever) / 10000000.000;
double total_encode_time = (cpi->time_receive_data + cpi->time_compress_data) / 1000.000;
double dr = (double)cpi->bytes * (double) 8 / (double)1000 / time_encoded;
#if defined(MODE_STATS)
print_mode_contexts(&cpi->common);
#endif
if (cpi->b_calculate_psnr) {
YV12_BUFFER_CONFIG *lst_yv12 =
&cpi->common.yv12_fb[cpi->common.ref_frame_map[cpi->lst_fb_idx]];
......@@ -1711,88 +1689,6 @@ void vp9_remove_compressor(VP9_PTR *ptr) {
#endif
#ifdef MODE_STATS
{
extern int count_mb_seg[4];
char modes_stats_file[250];
FILE *f;
double dr = (double)cpi->oxcf.frame_rate * (double)cpi->bytes * (double)8 / (double)cpi->count / (double)1000;
sprintf(modes_stats_file, "modes_q%03d.stt", cpi->common.base_qindex);
f = fopen(modes_stats_file, "w");
fprintf(f, "intra_mode in Intra Frames:\n");
{
int i;
fprintf(f, "Y: ");
for (i = 0; i < VP9_YMODES; i++) fprintf(f, " %8d,", y_modes[i]);
fprintf(f, "\n");
}
{
int i;
fprintf(f, "I8: ");
for (i = 0; i < VP9_I8X8_MODES; i++) fprintf(f, " %8d,", i8x8_modes[i]);
fprintf(f, "\n");
}
{
int i;
fprintf(f, "UV: ");
for (i = 0; i < VP9_UV_MODES; i++) fprintf(f, " %8d,", uv_modes[i]);
fprintf(f, "\n");
}
{
int i, j;
fprintf(f, "KeyFrame Y-UV:\n");
for (i = 0; i < VP9_YMODES; i++) {
fprintf(f, "%2d:", i);
for (j = 0; j < VP9_UV_MODES; j++) fprintf(f, "%8d, ", uv_modes_y[i][j]);
fprintf(f, "\n");
}
}
{
int i, j;
fprintf(f, "Inter Y-UV:\n");
for (i = 0; i < VP9_YMODES; i++) {
fprintf(f, "%2d:", i);
for (j = 0; j < VP9_UV_MODES; j++) fprintf(f, "%8d, ", cpi->y_uv_mode_count[i][j]);
fprintf(f, "\n");
}
}
{
int i;
fprintf(f, "B: ");
for (i = 0; i < VP9_NKF_BINTRAMODES; i++)
fprintf(f, "%8d, ", b_modes[i]);
fprintf(f, "\n");
}
fprintf(f, "Modes in Inter Frames:\n");
{
int i;
fprintf(f, "Y: ");
for (i = 0; i < MB_MODE_COUNT; i++) fprintf(f, " %8d,", inter_y_modes[i]);
fprintf(f, "\n");
}
{
int i;
fprintf(f, "UV: ");
for (i = 0; i < VP9_UV_MODES; i++) fprintf(f, " %8d,", inter_uv_modes[i]);
fprintf(f, "\n");
}
{
int i;
fprintf(f, "B: ");
for (i = 0; i < B_MODE_COUNT; i++) fprintf(f, "%8d, ", inter_b_modes[i]);
fprintf(f, "\n");
}
fprintf(f, "P:%8d, %8d, %8d, %8d\n", count_mb_seg[0], count_mb_seg[1], count_mb_seg[2], count_mb_seg[3]);
fprintf(f, "PB:%8d, %8d, %8d, %8d\n", inter_b_modes[LEFT4X4], inter_b_modes[ABOVE4X4], inter_b_modes[ZERO4X4], inter_b_modes[NEW4X4]);
fclose(f);
}
#endif
#ifdef ENTROPY_STATS
{
int i, j, k;
......
......@@ -64,16 +64,6 @@ typedef struct {
int nmvcosts[2][MV_VALS];
int nmvcosts_hp[2][MV_VALS];
#ifdef MODE_STATS
// Stats
int y_modes[VP9_YMODES];
int uv_modes[VP9_UV_MODES];
int b_modes[B_MODE_COUNT];
int inter_y_modes[MB_MODE_COUNT];
int inter_uv_modes[VP9_UV_MODES];
int inter_b_modes[B_MODE_COUNT];
#endif
vp9_prob segment_pred_probs[PREDICTION_PROBS];
unsigned char ref_pred_probs_update[PREDICTION_PROBS];
vp9_prob ref_pred_probs[PREDICTION_PROBS];
......
......@@ -30,16 +30,6 @@
#define MIN_BPB_FACTOR 0.005
#define MAX_BPB_FACTOR 50
#ifdef MODE_STATS
extern unsigned int y_modes[VP9_YMODES];
extern unsigned int uv_modes[VP9_UV_MODES];
extern unsigned int b_modes[B_MODE_COUNT];
extern unsigned int inter_y_modes[MB_MODE_COUNT];
extern unsigned int inter_uv_modes[VP9_UV_MODES];
extern unsigned int inter_b_modes[B_MODE_COUNT];
#endif
// Bits Per MB at different Q (Multiplied by 512)
#define BPER_MB_NORMBITS 9
......@@ -141,16 +131,6 @@ void vp9_save_coding_context(VP9_COMP *cpi) {
vp9_copy(cc->sub_mv_ref_prob, cm->fc.sub_mv_ref_prob);
vp9_copy(cc->partition_prob, cm->fc.partition_prob);
// Stats
#ifdef MODE_STATS
vp9_copy(cc->y_modes, y_modes);
vp9_copy(cc->uv_modes, uv_modes);
vp9_copy(cc->b_modes, b_modes);
vp9_copy(cc->inter_y_modes, inter_y_modes);
vp9_copy(cc->inter_uv_modes, inter_uv_modes);
vp9_copy(cc->inter_b_modes, inter_b_modes);
#endif
vp9_copy(cc->segment_pred_probs, cm->segment_pred_probs);
vp9_copy(cc->ref_pred_probs_update, cpi->ref_pred_probs_update);
vp9_copy(cc->ref_pred_probs, cm->ref_pred_probs);
......@@ -191,16 +171,6 @@ void vp9_restore_coding_context(VP9_COMP *cpi) {
vp9_copy(cm->fc.sub_mv_ref_prob, cc->sub_mv_ref_prob);
vp9_copy(cm->fc.partition_prob, cc->partition_prob);
// Stats
#ifdef MODE_STATS
vp9_copy(y_modes, cc->y_modes);
vp9_copy(uv_modes, cc->uv_modes);
vp9_copy(b_modes, cc->b_modes);
vp9_copy(inter_y_modes, cc->inter_y_modes);
vp9_copy(inter_uv_modes, cc->inter_uv_modes);
vp9_copy(inter_b_modes, cc->inter_b_modes);
#endif
vp9_copy(cm->segment_pred_probs, cc->segment_pred_probs);
vp9_copy(cpi->ref_pred_probs_update, cc->ref_pred_probs_update);
vp9_copy(cm->ref_pred_probs, cc->ref_pred_probs);
......
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