Minor modification on key frame decision

This change makes sure that no key frame recoding in real-time mode
even if CONFIG_REALTIME_ONLY is not configured.

Change-Id: Ifc34141f3217a6bb63cc087d78b111fadb35eec2
This commit is contained in:
Yunqing Wang 2011-08-25 16:54:45 -04:00
parent 4797a97215
commit 1f20202e2c
2 changed files with 12 additions and 13 deletions

View File

@ -3237,16 +3237,17 @@ static void encode_frame_to_data_rate
// Test code for segmentation of gf/arf (0,0) // Test code for segmentation of gf/arf (0,0)
//segmentation_test_function((VP8_PTR) cpi); //segmentation_test_function((VP8_PTR) cpi);
#if CONFIG_REALTIME_ONLY if (cpi->compressor_speed == 2)
if(cpi->oxcf.auto_key && cm->frame_type != KEY_FRAME)
{ {
if(cpi->force_next_frame_intra) if(cpi->oxcf.auto_key && cm->frame_type != KEY_FRAME)
{ {
cm->frame_type = KEY_FRAME; /* delayed intra frame */ if(cpi->force_next_frame_intra)
{
cm->frame_type = KEY_FRAME; /* delayed intra frame */
}
} }
cpi->force_next_frame_intra = 0;
} }
cpi->force_next_frame_intra = 0;
#endif
// For an alt ref frame in 2 pass we skip the call to the second pass function that sets the target bandwidth // For an alt ref frame in 2 pass we skip the call to the second pass function that sets the target bandwidth
#if !(CONFIG_REALTIME_ONLY) #if !(CONFIG_REALTIME_ONLY)
@ -3775,15 +3776,15 @@ static void encode_frame_to_data_rate
// (assuming that we didn't)! // (assuming that we didn't)!
if (cpi->pass != 2 && cpi->oxcf.auto_key && cm->frame_type != KEY_FRAME) if (cpi->pass != 2 && cpi->oxcf.auto_key && cm->frame_type != KEY_FRAME)
{ {
int key_frame_decision = decide_key_frame(cpi);
#if CONFIG_REALTIME_ONLY if (cpi->compressor_speed == 2)
{ {
/* we don't do re-encoding in realtime mode /* we don't do re-encoding in realtime mode
* if key frame is decided than we force it on next frame */ * if key frame is decided than we force it on next frame */
cpi->force_next_frame_intra = decide_key_frame(cpi); cpi->force_next_frame_intra = key_frame_decision;
} }
#else else if (key_frame_decision)
if (decide_key_frame(cpi))
{ {
// Reset all our sizing numbers and recode // Reset all our sizing numbers and recode
cm->frame_type = KEY_FRAME; cm->frame_type = KEY_FRAME;
@ -3820,7 +3821,6 @@ static void encode_frame_to_data_rate
continue; continue;
} }
#endif
} }
vp8_clear_system_state(); vp8_clear_system_state();

View File

@ -609,9 +609,8 @@ typedef struct VP8_COMP
int *lf_ref_frame_sign_bias; int *lf_ref_frame_sign_bias;
int *lf_ref_frame; int *lf_ref_frame;
#if CONFIG_REALTIME_ONLY
int force_next_frame_intra; /* force next frame to intra when kf_auto says so */ int force_next_frame_intra; /* force next frame to intra when kf_auto says so */
#endif
int droppable; int droppable;
} VP8_COMP; } VP8_COMP;