Encoder: Update scene cut detection logic

Encoder detects scene cut based on number of Intra MBs in the current
frame. For frames which contain plane areas which are different from
reference frames, encoder might encode these MBs as intra because of
lower SAD when compared with inter SAD.
Such cases were detected as scene cuts and RC model was being reset.

To fix this, scene cut is rejected if the current picture did not consume
all the bits that were allocated to it. In an actual scene cut where RC
needs to be reset, current frame consumes more than what is allocated to it.

Bug: 36814430
Change-Id: Ifa904fbaf28481f4762a23bb63e013fd37ec8942
This commit is contained in:
Harish Mahendrakar 2017-04-29 16:00:02 +05:30 committed by Chong Zhang
parent 0627bf0405
commit 14187ea720

View file

@ -756,6 +756,16 @@ void irc_update_frame_level_info(rate_control_api_t *ps_rate_control_api,
{
u1_is_scd = 0;
}
/* For frames that contain plane areas that differ from reference frames, encoder
* might generate more INTRA MBs because of lower SAD compared with INTER MBs.
* Such cases should not be treated as scene change.
* For such frames bits consumed will be lesser than the allocated bits.
*/
if(i4_total_frame_bits < ps_rate_control_api->i4_prev_frm_est_bits)
{
u1_is_scd = 0;
}
trace_printf((const WORD8*)"i4_total_frame_bits %d\n", i4_total_frame_bits);
if(!i4_is_it_a_skip && !i4_is_pic_handling_done)