diff options
Diffstat (limited to 'vp9')
-rw-r--r-- | vp9/encoder/vp9_encoder.c | 1 | ||||
-rw-r--r-- | vp9/encoder/vp9_ratectrl.c | 10 | ||||
-rw-r--r-- | vp9/encoder/vp9_ratectrl.h | 1 |
3 files changed, 9 insertions, 3 deletions
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 69445af64..4e5377889 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -1687,6 +1687,7 @@ VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf, cpi->common.buffer_pool = pool; cpi->rc.high_source_sad = 0; + cpi->rc.count_last_scene_change = 0; init_config(cpi, oxcf); vp9_rc_init(&cpi->oxcf, oxcf->pass, &cpi->rc); diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c index e06d56be4..dab7f6730 100644 --- a/vp9/encoder/vp9_ratectrl.c +++ b/vp9/encoder/vp9_ratectrl.c @@ -835,8 +835,8 @@ static int get_active_cq_level_two_pass( int active_cq_level = oxcf->cq_level; if (oxcf->rc_mode == VPX_CQ) { if (twopass->mb_smooth_pct > SMOOTH_PCT_MIN) { - active_cq_level -= (twopass->mb_smooth_pct - SMOOTH_PCT_MIN) / - SMOOTH_PCT_DIV; + active_cq_level -= (int)((twopass->mb_smooth_pct - SMOOTH_PCT_MIN) / + SMOOTH_PCT_DIV); active_cq_level = VPXMAX(active_cq_level, 0); } if (rc->total_target_bits > 0) { @@ -2084,10 +2084,11 @@ void vp9_avg_source_sad(VP9_COMP *cpi) { else rc->high_source_sad = 0; if (avg_sad > 0 || cpi->oxcf.rc_mode == VPX_CBR) - rc->avg_source_sad = (rc->avg_source_sad + avg_sad) >> 1; + rc->avg_source_sad = (3 * rc->avg_source_sad + avg_sad) >> 2; // For VBR, under scene change/high content change, force golden refresh. if (cpi->oxcf.rc_mode == VPX_VBR && rc->high_source_sad && + rc->count_last_scene_change > 4 && cpi->ext_refresh_frame_flags_pending == 0) { int target; cpi->refresh_golden_frame = 1; @@ -2099,6 +2100,9 @@ void vp9_avg_source_sad(VP9_COMP *cpi) { rc->frames_till_gf_update_due = rc->frames_to_key; target = calc_pframe_target_size_one_pass_vbr(cpi); vp9_rc_set_frame_target(cpi, target); + rc->count_last_scene_change = 0; + } else { + rc->count_last_scene_change++; } } } diff --git a/vp9/encoder/vp9_ratectrl.h b/vp9/encoder/vp9_ratectrl.h index 3df909cb1..4cd4b12ab 100644 --- a/vp9/encoder/vp9_ratectrl.h +++ b/vp9/encoder/vp9_ratectrl.h @@ -161,6 +161,7 @@ typedef struct { uint64_t avg_source_sad; int high_source_sad; + int count_last_scene_change; } RATE_CONTROL; struct VP9_COMP; |