From 8d5ce819dd8c4f7f121c55ebcd3552aba36740e0 Mon Sep 17 00:00:00 2001 From: James Berry Date: Fri, 22 Apr 2011 11:54:18 -0400 Subject: [PATCH] bug fix possible keyframe context divide by zero vp8_adjust_key_frame_context() divides by estimate_keyframe_frequency() which can return 0 in the case where --kf-max-dist=0. Change-Id: Idfc59653478a0073187cd2aa420e98a321103daa --- vp8/encoder/ratectrl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vp8/encoder/ratectrl.c b/vp8/encoder/ratectrl.c index 9c8e86b..2c1051f 100644 --- a/vp8/encoder/ratectrl.c +++ b/vp8/encoder/ratectrl.c @@ -1468,8 +1468,10 @@ static int estimate_keyframe_frequency(VP8_COMP *cpi) /* Assume a default of 1 kf every 2 seconds, or the max kf interval, * whichever is smaller. */ + int key_freq = cpi->oxcf.key_freq>0 ? cpi->oxcf.key_freq : 1; av_key_frame_frequency = (int)cpi->output_frame_rate * 2; - if (av_key_frame_frequency > cpi->oxcf.key_freq) + + if (cpi->oxcf.auto_key && av_key_frame_frequency > key_freq) av_key_frame_frequency = cpi->oxcf.key_freq; cpi->prior_key_frame_distance[KEY_FRAME_CONTEXT - 1] -- 2.7.4