shithub: libvpx

Download patch

ref: cb671194c9ac4068922a971318670c91bf96c906
parent: e196a6ae71507969c7bb2a048322f743e4a950fc
author: Liu Peng <pengliu.mail@gmail.com>
date: Fri Sep 14 12:25:44 EDT 2018

fix a bug of tiny_ssim to handle odd frame sizes

Change-Id: Id8ef0eb211517a8f8ec764ec398d16efb9320540

--- a/tools/tiny_ssim.c
+++ b/tools/tiny_ssim.c
@@ -121,7 +121,7 @@
         input->w = w;
         input->h = h;
         // handle odd frame sizes
-        input->frame_size = w * h + ((w + 1) / 2 * (h + 1) / 2) * 2;
+        input->frame_size = w * h + ((w + 1) / 2) * ((h + 1) / 2) * 2;
         if (bit_depth > 8) {
           input->frame_size *= 2;
         }
@@ -156,12 +156,12 @@
         r1 = fread(in->buf, in->frame_size, 1, in->file);
         *y = in->buf;
         *u = in->buf + in->w * in->h;
-        *v = *u + (1 + in->w) / 2 * (1 + in->h) / 2;
+        *v = *u + ((1 + in->w) / 2) * ((1 + in->h) / 2);
       } else {
         r1 = fread(in->buf, in->frame_size, 1, in->file);
         *y = in->buf;
         *u = in->buf + (in->w * in->h) * 2;
-        *v = *u + 2 * ((1 + in->w) / 2 * (1 + in->h) / 2);
+        *v = *u + 2 * ((1 + in->w) / 2) * ((1 + in->h) / 2);
       }
       break;
   }