Adds a zero check in model_rd function

Avoids divide-by-zero when variance is 0.

Change-Id: I3c7f526979046ff7d17714ce960fe81d6e1442a0
This commit is contained in:
Deb Mukherjee 2013-06-10 17:02:49 -07:00
parent 9b78ed8229
commit f18328cbf1

View File

@ -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);