From: Deb Mukherjee Date: Tue, 11 Jun 2013 00:02:49 +0000 (-0700) Subject: Adds a zero check in model_rd function X-Git-Tag: v1.3.0~1104^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f18328cbf15b1a0ce194cea6288011beaa183ee6;p=libvpx Adds a zero check in model_rd function Avoids divide-by-zero when variance is 0. Change-Id: I3c7f526979046ff7d17714ce960fe81d6e1442a0 --- diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 1b222429b..7eff2d04d 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -1803,7 +1803,10 @@ static void model_rd_from_var_lapndz(int var, int n, int qstep, // 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);