shithub: libvpx

Download patch

ref: c382136122ce7bb96e207e9f7ae646c656f7ff73
parent: 3b83a395da0e8e992d1ebc510d8dab425c87ccdd
author: Paul Wilkins <paulwilkins@google.com>
date: Wed Jan 29 09:59:04 EST 2014

Trap divide by 0.

Trap divide by 0 that could occur with a 0 rate target
in aq mode COMPLEXITY_AQ.

Change-Id: I034514f512b2a0db470ae8d37ea395278bf473cf

--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -380,8 +380,10 @@
       segment = 0;
     }
 
-    complexity_metric =
-      clamp((int)((projected_rate * 64) / target_rate), 16, 255);
+    if (target_rate > 0) {
+      complexity_metric =
+        clamp((int)((projected_rate * 64) / target_rate), 16, 255);
+    }
   }
 
   // Fill in the entires in the segment map corresponding to this SB64