From 3e21d703ce0afc3f51ff64280896fb98d6afeae8 Mon Sep 17 00:00:00 2001 From: Jim Bankoski Date: Fri, 14 Oct 2016 06:28:14 -0700 Subject: [PATCH] Drop empty frames. Change-Id: I2d45a6eb3aaca97eb61e8e7ef9e5114221091244 --- vp8/encoder/onyx_if.c | 15 ++++++++++++++- vp8/encoder/onyx_int.h | 3 +++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index 669bc6d..c538959 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -3952,7 +3952,6 @@ static void encode_frame_to_data_rate(VP8_COMP *cpi, size_t *size, #else /* transform / motion compensation build reconstruction frame */ vp8_encode_frame(cpi); - if (cpi->oxcf.screen_content_mode == 2) { if (vp8_drop_encodedframe_overshoot(cpi, Q)) return; } @@ -4230,6 +4229,20 @@ static void encode_frame_to_data_rate(VP8_COMP *cpi, size_t *size, } } while (Loop == 1); +#if defined(DROP_UNCODED_FRAMES) + /* if there are no coded macroblocks at all drop this frame */ + if (cpi->common.MBs == cpi->mb.skip_true_count && + (cpi->drop_frame_count & 7) != 7 && cm->frame_type != KEY_FRAME) { + cpi->common.current_video_frame++; + cpi->frames_since_key++; + cpi->drop_frame_count++; + // We advance the temporal pattern for dropped frames. + cpi->temporal_pattern_counter++; + return; + } + cpi->drop_frame_count = 0; +#endif + #if 0 /* Experimental code for lagged and one pass * Update stats used for one pass GF selection diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h index 0170ff8..bfcc645 100644 --- a/vp8/encoder/onyx_int.h +++ b/vp8/encoder/onyx_int.h @@ -413,6 +413,9 @@ typedef struct VP8_COMP { int drop_frames_allowed; /* Are we permitted to drop frames? */ int drop_frame; /* Drop this frame? */ +#if defined(DROP_UNCODED_FRAMES) + int drop_frame_count; +#endif vp8_prob frame_coef_probs[BLOCK_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS] [ENTROPY_NODES]; -- 2.7.4