From 9904c28f5b421592db61b337cd7700544820ba26 Mon Sep 17 00:00:00 2001 From: Yunqing Wang Date: Thu, 7 Jun 2012 11:26:47 -0400 Subject: [PATCH] Remove unused code in drop_frame Removed unused parameters and code related to drop_frame. Change-Id: I594e050d49b1805c6f72abf06005ef624256bb57 --- vp8/encoder/onyx_if.c | 27 --------------------------- vp8/encoder/onyx_int.h | 4 ---- vp8/encoder/ratectrl.c | 18 +----------------- 3 files changed, 1 insertion(+), 48 deletions(-) diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index df1252f81..57183d02b 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -1889,9 +1889,6 @@ struct VP8_COMP* vp8_create_compressor(VP8_CONFIG *oxcf) cpi->total_byte_count = 0; cpi->drop_frame = 0; - cpi->drop_count = 0; - cpi->max_drop_count = 0; - cpi->max_consec_dropped_frames = 4; cpi->rate_correction_factor = 1.0; cpi->key_frame_rate_correction_factor = 1.0; @@ -4313,30 +4310,6 @@ static void encode_frame_to_data_rate } } -#if 0 - - // If the frame was massively oversize and we are below optimal buffer level drop next frame - if ((cpi->drop_frames_allowed) && - (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) && - (cpi->buffer_level < cpi->oxcf.drop_frames_water_mark * cpi->oxcf.optimal_buffer_level / 100) && - (cpi->projected_frame_size > (4 * cpi->this_frame_target))) - { - cpi->drop_frame = 1; - } - -#endif - - // Set the count for maximum consecutive dropped frames based upon the ratio of - // this frame size to the target average per frame bandwidth. - // (cpi->av_per_frame_bandwidth > 0) is just a sanity check to prevent / 0. - if (cpi->drop_frames_allowed && (cpi->av_per_frame_bandwidth > 0)) - { - cpi->max_drop_count = cpi->projected_frame_size / cpi->av_per_frame_bandwidth; - - if (cpi->max_drop_count > cpi->max_consec_dropped_frames) - cpi->max_drop_count = cpi->max_consec_dropped_frames; - } - // Update the buffer level variable. // Non-viewable frames are a special case and are treated as pure overhead. if ( !cm->show_frame ) diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h index 8deee3481..3b202c941 100644 --- a/vp8/encoder/onyx_int.h +++ b/vp8/encoder/onyx_int.h @@ -436,10 +436,6 @@ typedef struct VP8_COMP int drop_frames_allowed; // Are we permitted to drop frames? int drop_frame; // Drop this frame? - int drop_count; // How many frames have we dropped? - int max_drop_count; // How many frames should we drop? - int max_consec_dropped_frames; // Limit number of consecutive frames that can be dropped. - int ymode_count [VP8_YMODES]; /* intra MB type cts this frame */ int uv_mode_count[VP8_UV_MODES]; /* intra MB type cts this frame */ diff --git a/vp8/encoder/ratectrl.c b/vp8/encoder/ratectrl.c index 04fd2d05b..f6baf4c7e 100644 --- a/vp8/encoder/ratectrl.c +++ b/vp8/encoder/ratectrl.c @@ -966,7 +966,7 @@ static void calc_pframe_target_size(VP8_COMP *cpi) // In unbufferd mode (eg vide conferencing) the descision to // code or drop a frame is made outside the codec in response to real // world comms or buffer considerations. - if (cpi->drop_frames_allowed && cpi->buffered_mode && + if (cpi->drop_frames_allowed && (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) && ((cpi->common.frame_type != KEY_FRAME))) //|| !cpi->oxcf.allow_spatial_resampling) ) { @@ -984,28 +984,13 @@ static void calc_pframe_target_size(VP8_COMP *cpi) //vpx_log("Decoder: Drop frame due to bandwidth: %d \n",cpi->buffer_level, cpi->av_per_frame_bandwidth); cpi->drop_frame = 1; - } -#if 0 - // Check for other drop frame crtieria (Note 2 pass cbr uses decimation on whole KF sections) - else if ((cpi->buffer_level < cpi->oxcf.drop_frames_water_mark * cpi->oxcf.optimal_buffer_level / 100) && - (cpi->drop_count < cpi->max_drop_count) && (cpi->pass == 0)) - { - cpi->drop_frame = 1; - } - -#endif - - if (cpi->drop_frame) - { // Update the buffer level variable. cpi->bits_off_target += cpi->av_per_frame_bandwidth; if (cpi->bits_off_target > cpi->oxcf.maximum_buffer_size) cpi->bits_off_target = cpi->oxcf.maximum_buffer_size; cpi->buffer_level = cpi->bits_off_target; } - else - cpi->drop_count = 0; } // Adjust target frame size for Golden Frames: @@ -1554,7 +1539,6 @@ int vp8_pick_frame_size(VP8_COMP *cpi) if (cpi->drop_frame) { cpi->drop_frame = 0; - cpi->drop_count++; return 0; } }