summaryrefslogtreecommitdiff
path: root/vp8
diff options
context:
space:
mode:
Diffstat (limited to 'vp8')
-rw-r--r--vp8/encoder/bitstream.c3
-rw-r--r--vp8/encoder/firstpass.c3
-rw-r--r--vp8/encoder/mbgraph.c14
-rw-r--r--vp8/encoder/onyx_if.c60
-rw-r--r--vp8/encoder/rdopt.c65
5 files changed, 49 insertions, 96 deletions
diff --git a/vp8/encoder/bitstream.c b/vp8/encoder/bitstream.c
index 8691ba356..8ad7ad2db 100644
--- a/vp8/encoder/bitstream.c
+++ b/vp8/encoder/bitstream.c
@@ -145,7 +145,6 @@ void update_skip_probs(VP8_COMP *cpi)
prob_skip_false[k] = 128;
pc->mbskip_pred_probs[k] = prob_skip_false[k];
- vp8_write_literal(w, prob_skip_false[k], 8);
}
#else
@@ -765,7 +764,7 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
update_skip_probs( cpi );
for (k=0;k<MBSKIP_CONTEXTS;++k)
- vp8_write_literal(w, cpi->prob_skip_false[k], 8);
+ vp8_write_literal(w, pc->mbskip_pred_probs[k], 8);
#else
update_skip_probs( cpi );
vp8_write_literal(w, cpi->prob_skip_false, 8);
diff --git a/vp8/encoder/firstpass.c b/vp8/encoder/firstpass.c
index 1e8594d7b..5212007d8 100644
--- a/vp8/encoder/firstpass.c
+++ b/vp8/encoder/firstpass.c
@@ -2648,8 +2648,7 @@ static void find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
&& lookup_next_frame_stats(cpi, &next_frame) != EOF)
{
// Normal scene cut check
- if ( ( i >= MIN_GF_INTERVAL ) &&
- test_candidate_kf(cpi, &last_frame, this_frame, &next_frame) )
+ if ( test_candidate_kf(cpi, &last_frame, this_frame, &next_frame) )
{
break;
}
diff --git a/vp8/encoder/mbgraph.c b/vp8/encoder/mbgraph.c
index 3089be893..ebdb9b504 100644
--- a/vp8/encoder/mbgraph.c
+++ b/vp8/encoder/mbgraph.c
@@ -109,7 +109,7 @@ static unsigned int do_16x16_motion_iteration
//VARIANCE_INVOKE(&cpi->rtcd.variance, satd16x16)
best_err = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x16)
(xd->dst.y_buffer, xd->dst.y_stride,
- xd->predictor, 16, best_err);
+ xd->predictor, 16, INT_MAX);
/* restore UMV window */
x->mv_col_min = tmp_col_min;
@@ -255,7 +255,7 @@ static int find_best_16x16_intra
err = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x16)
(xd->predictor, 16,
buf->y_buffer + mb_y_offset,
- buf->y_stride, err);
+ buf->y_stride, best_err);
// find best
if (err < best_err)
{
@@ -454,12 +454,8 @@ void separate_arf_mbs
&frame_stats->mb_stats[offset + mb_col];
int altref_err = mb_stats->ref[ALTREF_FRAME].err;
-
- int intra_err =
- mb_stats->ref[INTRA_FRAME ].err + 250;
-
- int golden_err =
- mb_stats->ref[GOLDEN_FRAME].err + 250;
+ int intra_err = mb_stats->ref[INTRA_FRAME ].err;
+ int golden_err = mb_stats->ref[GOLDEN_FRAME].err;
// Test for altref vs intra and gf and that its mv was 0,0.
if ( (altref_err > 1000) ||
@@ -531,6 +527,8 @@ void vp8_update_mbgraph_stats
// being a GF - so exit if we don't look ahead beyond that
if (n_frames <= cpi->frames_till_gf_update_due)
return;
+ if( n_frames > cpi->common.frames_till_alt_ref_frame)
+ n_frames = cpi->common.frames_till_alt_ref_frame;
if (n_frames > MAX_LAG_BUFFERS)
n_frames = MAX_LAG_BUFFERS;
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index e547c9ddf..e2fed8ed1 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -3022,7 +3022,7 @@ static void encode_frame_to_data_rate
#if CONFIG_HIGH_PRECISION_MV || CONFIG_ENHANCED_INTERP
if (cm->frame_type != KEY_FRAME)
{
- double e = compute_edge_pixel_proportion(cpi->Source);
+ double e = 0; //compute_edge_pixel_proportion(cpi->Source);
#if CONFIG_HIGH_PRECISION_MV
/* TODO: Decide this more intelligently */
xd->allow_high_precision_mv = (Q < HIGH_PRECISION_MV_QTHRESH);
@@ -3765,64 +3765,6 @@ static void encode_frame_to_data_rate
}
}
-
-static void check_gf_quality(VP8_COMP *cpi)
-{
- VP8_COMMON *cm = &cpi->common;
- int gf_active_pct = (100 * cpi->gf_active_count) / (cm->mb_rows * cm->mb_cols);
- int gf_ref_usage_pct = (cpi->count_mb_ref_frame_usage[GOLDEN_FRAME] * 100) / (cm->mb_rows * cm->mb_cols);
- int last_ref_zz_useage = (cpi->inter_zz_count * 100) / (cm->mb_rows * cm->mb_cols);
-
- // Gf refresh is not currently being signalled
- if (cpi->gf_update_recommended == 0)
- {
- if (cpi->common.frames_since_golden > 7)
- {
- // Low use of gf
- if ((gf_active_pct < 10) || ((gf_active_pct + gf_ref_usage_pct) < 15))
- {
- // ...but last frame zero zero usage is reasonable
- // so a new gf might be appropriate
- if (last_ref_zz_useage >= 25)
- {
- cpi->gf_bad_count ++;
-
- // Check that the condition is stable
- if (cpi->gf_bad_count >= 8)
- {
- cpi->gf_update_recommended = 1;
- cpi->gf_bad_count = 0;
- }
- }
- else
- cpi->gf_bad_count = 0; // Restart count as the background
- // is not stable enough
- }
- else
- cpi->gf_bad_count = 0; // Gf usage has picked up so reset count
- }
- }
- // If the signal is set but has not been read should we cancel it.
- else if (last_ref_zz_useage < 15)
- {
- cpi->gf_update_recommended = 0;
- cpi->gf_bad_count = 0;
- }
-
-#if 0
- {
- FILE *f = fopen("gfneeded.stt", "a");
- fprintf(f, "%10d %10d %10d %10d %10ld \n",
- cm->current_video_frame,
- cpi->common.frames_since_golden,
- gf_active_pct, gf_ref_usage_pct,
- cpi->gf_update_recommended);
- fclose(f);
- }
-
-#endif
-}
-
static void Pass2Encode(VP8_COMP *cpi, unsigned long *size, unsigned char *dest, unsigned int *frame_flags)
{
diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c
index 19d0c60fc..44782065f 100644
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -626,7 +626,7 @@ static int vp8_rdcost_mby(MACROBLOCK *mb)
static void macro_block_yrd( MACROBLOCK *mb,
int *Rate,
int *Distortion,
- const vp8_encodemb_rtcd_vtable_t *rtcd)
+ const VP8_ENCODER_RTCD *rtcd)
{
int b;
MACROBLOCKD *const x = &mb->e_mbd;
@@ -636,8 +636,11 @@ static void macro_block_yrd( MACROBLOCK *mb,
BLOCK *beptr;
int d;
- ENCODEMB_INVOKE(rtcd, submby)( mb->src_diff, *(mb->block[0].base_src),
- mb->e_mbd.predictor, mb->block[0].src_stride );
+ ENCODEMB_INVOKE(&rtcd->encodemb, submby)(
+ mb->src_diff,
+ *(mb->block[0].base_src),
+ mb->e_mbd.predictor,
+ mb->block[0].src_stride );
// Fdct and building the 2nd order block
for (beptr = mb->block; beptr < mb->block + 16; beptr += 2)
@@ -660,11 +663,11 @@ static void macro_block_yrd( MACROBLOCK *mb,
mb->quantize_b(mb_y2, x_y2);
// Distortion
- d = ENCODEMB_INVOKE(rtcd, mberr)(mb, 1) << 2;
+ d = ENCODEMB_INVOKE(&rtcd->encodemb, mberr)(mb, 1);
- d += ENCODEMB_INVOKE(rtcd, berr)(mb_y2->coeff, x_y2->dqcoeff)<<2;
+ d += ENCODEMB_INVOKE(&rtcd->encodemb, berr)(mb_y2->coeff, x_y2->dqcoeff);
- *Distortion = (d >> 4);
+ *Distortion = (d >> 2);
// rate
*Rate = vp8_rdcost_mby(mb);
}
@@ -772,9 +775,11 @@ static void macro_block_yrd_8x8( MACROBLOCK *mb,
short *Y2DCPtr = mb_y2->src_diff;
int d;
- ENCODEMB_INVOKE(&rtcd->encodemb, submby)
- ( mb->src_diff, *(mb->block[0].base_src),
- mb->e_mbd.predictor, mb->block[0].src_stride );
+ ENCODEMB_INVOKE(&rtcd->encodemb, submby)(
+ mb->src_diff,
+ *(mb->block[0].base_src),
+ mb->e_mbd.predictor,
+ mb->block[0].src_stride );
vp8_transform_mby_8x8(mb);
vp8_quantize_mby_8x8(mb);
@@ -788,11 +793,11 @@ static void macro_block_yrd_8x8( MACROBLOCK *mb,
mb->e_mbd.dqcoeff[64] = 0;
mb->e_mbd.dqcoeff[128] = 0;
mb->e_mbd.dqcoeff[192] = 0;
- d = ENCODEMB_INVOKE(&rtcd->encodemb, mberr)(mb, 0) << 2;
- d += ENCODEMB_INVOKE(&rtcd->encodemb, berr)(mb_y2->coeff, x_y2->dqcoeff)<<2;
+ d = ENCODEMB_INVOKE(&rtcd->encodemb, mberr)(mb, 0);
+ d += ENCODEMB_INVOKE(&rtcd->encodemb, berr)(mb_y2->coeff, x_y2->dqcoeff);
- *Distortion = (d >> 4);
+ *Distortion = (d >> 2);
// rate
*Rate = vp8_rdcost_mby_8x8(mb);
}
@@ -906,7 +911,8 @@ static int rd_pick_intra4x4block(
ratey = cost_coeffs(x, b, PLANE_TYPE_Y_WITH_DC, &tempa, &templ);
rate += ratey;
- distortion = ENCODEMB_INVOKE(IF_RTCD(&cpi->rtcd.encodemb), berr)(be->coeff, b->dqcoeff) >> 2;
+ distortion = ENCODEMB_INVOKE(IF_RTCD(&cpi->rtcd.encodemb), berr)(
+ be->coeff, b->dqcoeff) >> 2;
this_rd = RDCOST(x->rdmult, x->rddiv, rate, distortion);
@@ -1066,7 +1072,7 @@ static int rd_pick_intra16x16mby_mode(VP8_COMP *cpi,
}
#endif
- macro_block_yrd(x, &ratey, &distortion, IF_RTCD(&cpi->rtcd.encodemb));
+ macro_block_yrd(x, &ratey, &distortion, IF_RTCD(&cpi->rtcd));
// FIXME add compoundmode cost
// FIXME add rate for mode2
rate = ratey + x->mbmode_cost[x->e_mbd.frame_type]
@@ -1432,7 +1438,9 @@ static void rd_pick_intra_mbuv_mode(VP8_COMP *cpi,
vp8_quantize_mbuv(x);
rate_to = rd_cost_mbuv(x);
- rate = rate_to + x->intra_uv_mode_cost[x->e_mbd.frame_type][x->e_mbd.mode_info_context->mbmi.uv_mode];
+ rate = rate_to
+ + x->intra_uv_mode_cost[x->e_mbd.frame_type]
+ [x->e_mbd.mode_info_context->mbmi.uv_mode];
distortion = ENCODEMB_INVOKE(&cpi->rtcd.encodemb, mbuverr)(x) / 4;
@@ -1647,7 +1655,11 @@ static int rdcost_mbsegment_y(MACROBLOCK *mb, const int *labels,
return cost;
}
-static unsigned int vp8_encode_inter_mb_segment(MACROBLOCK *x, int const *labels, int which_label, const vp8_encodemb_rtcd_vtable_t *rtcd)
+static unsigned int vp8_encode_inter_mb_segment(
+ MACROBLOCK *x,
+ int const *labels,
+ int which_label,
+ const VP8_ENCODER_RTCD *rtcd)
{
int i;
unsigned int distortion = 0;
@@ -1658,20 +1670,21 @@ static unsigned int vp8_encode_inter_mb_segment(MACROBLOCK *x, int const *labels
{
BLOCKD *bd = &x->e_mbd.block[i];
BLOCK *be = &x->block[i];
-
+ int thisdistortion;
vp8_build_inter_predictors_b(bd, 16, x->e_mbd.subpixel_predict);
- ENCODEMB_INVOKE(rtcd, subb)(be, bd, 16);
+ ENCODEMB_INVOKE(&rtcd->encodemb, subb)(be, bd, 16);
x->vp8_short_fdct4x4(be->src_diff, be->coeff, 32);
// set to 0 no way to account for 2nd order DC so discount
//be->coeff[0] = 0;
x->quantize_b(be, bd);
-
- distortion += ENCODEMB_INVOKE(rtcd, berr)(be->coeff, bd->dqcoeff);
+ thisdistortion = ENCODEMB_INVOKE(&rtcd->encodemb,berr)(
+ be->coeff,
+ bd->dqcoeff)/4;
+ distortion += thisdistortion;
}
}
-
return distortion;
}
@@ -1911,7 +1924,9 @@ static void rd_check_segment(VP8_COMP *cpi, MACROBLOCK *x,
continue;
}
- distortion = vp8_encode_inter_mb_segment(x, labels, i, IF_RTCD(&cpi->rtcd.encodemb)) / 4;
+ distortion = vp8_encode_inter_mb_segment(
+ x, labels, i,
+ IF_RTCD(&cpi->rtcd));
labelyrate = rdcost_mbsegment_y(x, labels, i, ta_s, tl_s);
rate += labelyrate;
@@ -2867,7 +2882,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
IF_RTCD(&cpi->rtcd)) ;
else
macro_block_yrd(x, &rate_y, &distortion,
- IF_RTCD(&cpi->rtcd.encodemb)) ;
+ IF_RTCD(&cpi->rtcd)) ;
rate2 += rate_y;
distortion2 += distortion;
rate2 += x->mbmode_cost[x->e_mbd.frame_type][x->e_mbd.mode_info_context->mbmi.mode];
@@ -3119,7 +3134,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
IF_RTCD(&cpi->rtcd));
else
macro_block_yrd(x, &rate_y, &distortion,
- IF_RTCD(&cpi->rtcd.encodemb));
+ IF_RTCD(&cpi->rtcd));
rate2 += rate_y;
distortion2 += distortion;
@@ -3227,7 +3242,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
IF_RTCD(&cpi->rtcd));
else
macro_block_yrd(x, &rate_y, &distortion,
- IF_RTCD(&cpi->rtcd.encodemb));
+ IF_RTCD(&cpi->rtcd));
rate2 += rate_y;
distortion2 += distortion;