From 54e03017b64f516f22954952b917a240ecad6c44 Mon Sep 17 00:00:00 2001 From: Debargha Mukherjee Date: Wed, 26 Oct 2016 22:40:59 -0700 Subject: [PATCH] Force recode if framesize exceeds max allowed size Fixes a case where recode is not triggered based on the value of maxq passed into the recode loop test function. BUG=b/32375284 Change-Id: I15ad985d0525c68e0443cfaf842440d2754b2266 --- vp9/encoder/vp9_encoder.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 4aa24b4e4..c12f95c51 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -2441,6 +2441,8 @@ static int recode_loop_test(VP9_COMP *cpi, int high_limit, int low_limit, int q, cpi->resize_pending = 1; return 1; } + // Force recode if projected_frame_size > max_frame_bandwidth + if (rc->projected_frame_size >= rc->max_frame_bandwidth) return 1; // TODO(agrange) high_limit could be greater than the scale-down threshold. if ((rc->projected_frame_size > high_limit && q < maxq) ||