From ffa06b37083d028b50f27e67ae6ed0c6ee9953bb Mon Sep 17 00:00:00 2001 From: Yaowu Xu Date: Tue, 18 Nov 2014 08:52:21 -0800 Subject: Prevent severe rate control errors in CBR mode In rare cases, the interaction between rate correction factor and Q choices may cause severe oscillating frame sizes that are way off target bandwidth. This commit adds tracking of rate control results for last two frames, and use the information to prevent oscillating Q choices. Change-Id: I9a6d125a15652b9bcac0e1fec6d7a1aedc4ed97e --- vp9/encoder/vp9_ratectrl.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'vp9/encoder/vp9_ratectrl.h') diff --git a/vp9/encoder/vp9_ratectrl.h b/vp9/encoder/vp9_ratectrl.h index 2bc5b59f2..6200b396c 100644 --- a/vp9/encoder/vp9_ratectrl.h +++ b/vp9/encoder/vp9_ratectrl.h @@ -99,7 +99,14 @@ typedef struct { int64_t starting_buffer_level; int64_t optimal_buffer_level; int64_t maximum_buffer_size; - // int active_best_quality; + // rate control history for last frame(1) and the frame before(2). + // -1: undershot + // 1: overshoot + // 0: not initialized. + int rc_1_frame; + int rc_2_frame; + int q_1_frame; + int q_2_frame; } RATE_CONTROL; struct VP9_COMP; -- cgit v1.2.3