Merge "Update encoder mb_skip_coeff and prob_skip_false calculation"

This commit is contained in:
John Koleszar 2012-02-21 09:48:26 -08:00 committed by Gerrit Code Review
commit 02360dd2c2
4 changed files with 14 additions and 19 deletions

View File

@ -925,7 +925,9 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
if (pc->mb_no_coeff_skip)
{
prob_skip_false = cpi->skip_false_count * 256 / (cpi->skip_false_count + cpi->skip_true_count);
int total_mbs = pc->mb_rows * pc->mb_cols;
prob_skip_false = (total_mbs - cpi->skip_true_count ) * 256 / total_mbs;
if (prob_skip_false <= 1)
prob_skip_false = 1;
@ -1112,7 +1114,9 @@ static void write_kfmodes(VP8_COMP *cpi)
if (c->mb_no_coeff_skip)
{
prob_skip_false = cpi->skip_false_count * 256 / (cpi->skip_false_count + cpi->skip_true_count);
int total_mbs = c->mb_rows * c->mb_cols;
prob_skip_false = (total_mbs - cpi->skip_true_count ) * 256 / total_mbs;
if (prob_skip_false <= 1)
prob_skip_false = 1;

View File

@ -696,7 +696,6 @@ void vp8_encode_frame(VP8_COMP *cpi)
cpi->prediction_error = 0;
cpi->intra_error = 0;
cpi->skip_true_count = 0;
cpi->skip_false_count = 0;
#if 0
// Experimental code
@ -1094,6 +1093,7 @@ int vp8cx_encode_intra_macro_block(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t,
vp8_encode_intra16x16mbuv(x);
sum_intra_stats(cpi, x);
vp8_tokenize_mb(cpi, &x->e_mbd, t);
if (xd->mode_info_context->mbmi.mode != B_PRED)
@ -1260,11 +1260,6 @@ int vp8cx_encode_inter_macroblock
if (!x->skip)
{
vp8_encode_inter16x16(x);
// Clear mb_skip_coeff if mb_no_coeff_skip is not set
if (!cpi->common.mb_no_coeff_skip)
xd->mode_info_context->mbmi.mb_skip_coeff = 0;
}
else
vp8_build_inter16x16_predictors_mb(xd, xd->dst.y_buffer,
@ -1287,17 +1282,17 @@ int vp8cx_encode_inter_macroblock
}
else
{
/* always set mb_skip_coeff as it is needed by the loopfilter */
xd->mode_info_context->mbmi.mb_skip_coeff = 1;
if (cpi->common.mb_no_coeff_skip)
{
xd->mode_info_context->mbmi.mb_skip_coeff = 1;
cpi->skip_true_count ++;
vp8_fix_contexts(xd);
}
else
{
vp8_stuff_mb(cpi, xd, t);
xd->mode_info_context->mbmi.mb_skip_coeff = 0;
cpi->skip_false_count ++;
}
}

View File

@ -504,7 +504,6 @@ typedef struct VP8_COMP
int gf_bad_count;
int gf_update_recommended;
int skip_true_count;
int skip_false_count;
unsigned char *segmentation_map;
signed char segment_feature_data[MB_LVL_MAX][MAX_MB_SEGMENTS]; // Segment data (can be deltas or absolute values)

View File

@ -378,30 +378,27 @@ void vp8_tokenize_mb(VP8_COMP *cpi, MACROBLOCKD *x, TOKENEXTRA **t)
x->mode_info_context->mbmi.mb_skip_coeff = mb_is_skippable(x, has_y2_block);
if (x->mode_info_context->mbmi.mb_skip_coeff)
{
cpi->skip_true_count++;
if (!cpi->common.mb_no_coeff_skip)
vp8_stuff_mb(cpi, x, t) ;
{
vp8_stuff_mb(cpi, x, t);
}
else
{
vp8_fix_contexts(x);
cpi->skip_true_count++;
}
return;
}
cpi->skip_false_count++;
plane_type = 3;
if(has_y2_block)
{
tokenize2nd_order_b(x, t, cpi);
plane_type = 0;
}
tokenize1st_order_b(x, t, plane_type, cpi);
}