]> granicus.if.org Git - libvpx/commitdiff
bug fix possible keyframe context divide by zero
authorJames Berry <jamesberry@google.com>
Fri, 22 Apr 2011 15:54:18 +0000 (11:54 -0400)
committerJames Berry <jamesberry@google.com>
Mon, 25 Apr 2011 16:16:36 +0000 (12:16 -0400)
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

index 9c8e86bb4da783361e29939fc2ce234ab95d514d..2c1051f1a30b0fc1b0548056d21a1788c53cb94b 100644 (file)
@@ -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]