Commit 740a8c55 authored by Anton Mitrofanov's avatar Anton Mitrofanov Committed by Henrik Gramner
Browse files

Apply zone options a little bit earlier

This way things like SAR changes will have full effect from the start frame.
parent 928bd9d5
......@@ -3344,6 +3344,7 @@ int x264_encoder_encode( x264_t *h,
h->fenc->param = NULL;
}
}
x264_ratecontrol_zone_init( h );
// ok to call this before encoding any frames, since the initial values of fdec have b_kept_as_ref=0
if( x264_reference_update( h ) )
......
......@@ -1409,6 +1409,15 @@ static void accum_p_qp_update( x264_t *h, float qp )
rc->accum_p_qp += qp;
}
void x264_ratecontrol_zone_init( x264_t *h )
{
x264_ratecontrol_t *rc = h->rc;
x264_zone_t *zone = get_zone( h, h->fenc->i_frame );
if( zone && (!rc->prev_zone || zone->param != rc->prev_zone->param) )
x264_encoder_reconfig_apply( h, zone->param );
rc->prev_zone = zone;
}
/* Before encoding a frame, choose a QP for it */
void x264_ratecontrol_start( x264_t *h, int i_force_qp, int overhead )
{
......@@ -1419,10 +1428,6 @@ void x264_ratecontrol_start( x264_t *h, int i_force_qp, int overhead )
x264_emms();
if( zone && (!rc->prev_zone || zone->param != rc->prev_zone->param) )
x264_encoder_reconfig_apply( h, zone->param );
rc->prev_zone = zone;
if( h->param.rc.b_stat_read )
{
int frame = h->fenc->i_frame;
......
......@@ -49,6 +49,7 @@ void x264_adaptive_quant_frame( x264_t *h, x264_frame_t *frame, float *quant_off
int x264_macroblock_tree_read( x264_t *h, x264_frame_t *frame, float *quant_offsets );
int x264_reference_build_list_optimal( x264_t *h );
void x264_thread_sync_ratecontrol( x264_t *cur, x264_t *prev, x264_t *next );
void x264_ratecontrol_zone_init( x264_t * );
void x264_ratecontrol_start( x264_t *, int i_force_qp, int overhead );
int x264_ratecontrol_slice_type( x264_t *, int i_frame );
void x264_ratecontrol_set_weights( x264_t *h, x264_frame_t *frm );
......
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