Commit ee28bb87 authored by Scott LaVarnway's avatar Scott LaVarnway
Browse files

Moving _error counts to macroblock struct

Change-Id: I28ac1519d1594801fef9a623cb64598d3d751eb0
parent 01824d18
......@@ -130,10 +130,10 @@ typedef struct macroblock
int skip_true_count;
unsigned int coef_counts [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
unsigned int MVcount [2] [MVvals]; /* (row,col) MV cts this frame */
int ymode_count [VP8_YMODES]; /* intra MB type cts this frame */
int uv_mode_count[VP8_UV_MODES]; /* intra MB type cts this frame */
int64_t prediction_error;
int64_t intra_error;
void (*short_fdct4x4)(short *input, short *output, int pitch);
......
......@@ -676,6 +676,8 @@ static void init_encode_frame_mb_context(VP8_COMP *cpi)
vp8_zero(x->coef_counts);
vp8_zero(x->ymode_count);
vp8_zero(x->uv_mode_count)
x->prediction_error = 0;
x->intra_error = 0;
}
static void sum_coef_counts(MACROBLOCK *x, MACROBLOCK *x_thread)
......@@ -749,8 +751,6 @@ void vp8_encode_frame(VP8_COMP *cpi)
xd->subpixel_predict16x16 = vp8_bilinear_predict16x16;
}
cpi->prediction_error = 0;
cpi->intra_error = 0;
cpi->mb.skip_true_count = 0;
cpi->tok_count = 0;
......@@ -889,6 +889,10 @@ void vp8_encode_frame(VP8_COMP *cpi)
cpi->mb_row_ei[i].mb.MVcount[1][mv_vals];
}
cpi->mb.prediction_error +=
cpi->mb_row_ei[i].mb.prediction_error;
cpi->mb.intra_error += cpi->mb_row_ei[i].mb.intra_error;
/* add up counts for each thread */
sum_coef_counts(x, &cpi->mb_row_ei[i].mb);
}
......@@ -1252,8 +1256,8 @@ int vp8cx_encode_inter_macroblock
&distortion, &intra_error, mb_row, mb_col);
}
cpi->prediction_error += distortion;
cpi->intra_error += intra_error;
x->prediction_error += distortion;
x->intra_error += intra_error;
if(cpi->oxcf.tuning == VP8_TUNE_SSIM)
{
......
......@@ -476,6 +476,8 @@ void vp8cx_init_mbrthread_data(VP8_COMP *cpi,
vp8_zero(x->ymode_count);
mb->skip_true_count = 0;
vp8_zero(mb->MVcount);
mb->prediction_error = 0;
mb->intra_error = 0;
}
}
......
......@@ -2864,38 +2864,17 @@ static int decide_key_frame(VP8_COMP *cpi)
if ((cpi->compressor_speed == 2) && (cpi->Speed >= 5) && (cpi->sf.RD == 0))
{
double change = 1.0 * abs((int)(cpi->intra_error - cpi->last_intra_error)) / (1 + cpi->last_intra_error);
double change2 = 1.0 * abs((int)(cpi->prediction_error - cpi->last_prediction_error)) / (1 + cpi->last_prediction_error);
double change = 1.0 * abs((int)(cpi->mb.intra_error -
cpi->last_intra_error)) / (1 + cpi->last_intra_error);
double change2 = 1.0 * abs((int)(cpi->mb.prediction_error -
cpi->last_prediction_error)) / (1 + cpi->last_prediction_error);
double minerror = cm->MBs * 256;
#if 0
if (10 * cpi->intra_error / (1 + cpi->prediction_error) < 15
&& cpi->prediction_error > minerror
&& (change > .25 || change2 > .25))
{
FILE *f = fopen("intra_inter.stt", "a");
if (cpi->prediction_error <= 0)
cpi->prediction_error = 1;
fprintf(f, "%d %d %d %d %14.4f\n",
cm->current_video_frame,
(int) cpi->prediction_error,
(int) cpi->intra_error,
(int)((10 * cpi->intra_error) / cpi->prediction_error),
change);
fclose(f);
}
#endif
cpi->last_intra_error = cpi->intra_error;
cpi->last_prediction_error = cpi->prediction_error;
cpi->last_intra_error = cpi->mb.intra_error;
cpi->last_prediction_error = cpi->mb.prediction_error;
if (10 * cpi->intra_error / (1 + cpi->prediction_error) < 15
&& cpi->prediction_error > minerror
if (10 * cpi->mb.intra_error / (1 + cpi->mb.prediction_error) < 15
&& cpi->mb.prediction_error > minerror
&& (change > .25 || change2 > .25))
{
/*(change > 1.4 || change < .75)&& cpi->this_frame_percent_intra > cpi->last_frame_percent_intra + 3*/
......
......@@ -363,9 +363,7 @@ typedef struct VP8_COMP
CODING_CONTEXT coding_context;
/* Rate targetting variables */
int64_t prediction_error;
int64_t last_prediction_error;
int64_t intra_error;
int64_t last_intra_error;
int this_frame_target;
......
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