a set of minor fixes
This commit tries to address an issue related to the oddity shown on HD _mobcal clip, where some rather ugly blocks shown in the second frame at low-mid bit rates if the third frame is not made a key frame by he encoder. The fixes include: 1) made calls to sad_16x16 to be consistent with function prototype. 2) remove the error bias to intra and golden in mbgraph search. 3) changed the error accumulation on inter_segment encoding to avoid potential out-of-range. 1) has no effect on encoding results. Encoding test show that the overall effect of the commit helps about .2%(HD) to .3%(cif) Change-Id: I930975a2d0c06252f01c39e0a02351529774e30b
This commit is contained in:
parent
d6f4b71d9f
commit
636b2f385e
@ -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;
|
||||
|
||||
|
@ -911,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);
|
||||
|
||||
@ -1437,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;
|
||||
|
||||
@ -1652,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;
|
||||
@ -1663,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;
|
||||
}
|
||||
|
||||
@ -1916,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;
|
||||
|
Loading…
Reference in New Issue
Block a user