shithub: libvpx

Download patch

ref: f18328cbf15b1a0ce194cea6288011beaa183ee6
parent: 9b78ed8229f8ffe40e0a73d4432e0ff12234e820
author: Deb Mukherjee <[email protected]>
date: Mon Jun 10 13:02:49 EDT 2013

Adds a zero check in model_rd function

Avoids divide-by-zero when variance is 0.

Change-Id: I3c7f526979046ff7d17714ce960fe81d6e1442a0

--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -1803,7 +1803,10 @@
   // TODO(debargha): Implement the functions by interpolating from a
   // look-up table
   vp9_clear_system_state();
-  {
+  if (var == 0 || n == 0) {
+    *rate = 0;
+    *dist = 0;
+  } else {
     double D, R;
     double s2 = (double) var / n;
     double s = sqrt(s2);