From dddbe2263214fe847fa693c11288e8faf03150de Mon Sep 17 00:00:00 2001 From: Ravi Chaudhary Date: Mon, 4 Mar 2019 10:57:17 +0530 Subject: [PATCH] Fix update of mb_smooth_pct and mb_av_energy Values of mb_smooth_pct and mb_av_energy have been updated correctly in vp9_rc_get_second_pass_params for higher layer ARF frames. Change-Id: Ic176e393eb8cc5f418235fee9accee84e9809607 --- vp9/encoder/vp9_firstpass.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c index 97c6e8cd7..ee22d488b 100644 --- a/vp9/encoder/vp9_firstpass.c +++ b/vp9/encoder/vp9_firstpass.c @@ -3216,6 +3216,11 @@ void vp9_rc_get_second_pass_params(VP9_COMP *cpi) { if (gf_group->update_type[gf_group->index] == ARF_UPDATE) { int target_rate; + vp9_zero(this_frame); + this_frame = + cpi->twopass.stats_in_start[cm->current_video_frame + + gf_group->arf_src_offset[gf_group->index]]; + vp9_configure_buffer_updates(cpi, gf_group->index); target_rate = gf_group->bit_allocation[gf_group->index]; @@ -3231,6 +3236,11 @@ void vp9_rc_get_second_pass_params(VP9_COMP *cpi) { cpi->partition_search_skippable_frame = is_skippable_frame(cpi); } + // The multiplication by 256 reverses a scaling factor of (>> 8) + // applied when combining MB error values for the frame. + twopass->mb_av_energy = log((this_frame.intra_error * 256.0) + 1.0); + twopass->mb_smooth_pct = this_frame.intra_smooth_pct; + return; } -- 2.40.0