]> granicus.if.org Git - libvpx/commitdiff
Fix odd-sized image support in decoder examples
authorJohn Koleszar <jkoleszar@google.com>
Wed, 14 Sep 2011 15:25:24 +0000 (11:25 -0400)
committerJohn Koleszar <jkoleszar@google.com>
Wed, 14 Sep 2011 15:25:24 +0000 (11:25 -0400)
Odd sized images need their chroma plane sizes rounded up.

Change-Id: I3cd6fa60551f05697b67ece5b6928bef2a41bad8

examples/decode_to_md5.txt
examples/decoder_tmpl.txt

index b3dd56876e2e309487c9865938fd6bbdb511527f..ea0eb69cd8cfcd6fa42c91560c2336df1b8dee18 100644 (file)
@@ -34,8 +34,8 @@ MD5Init(&md5);
 for(plane=0; plane < 3; plane++) {
     unsigned char *buf =img->planes[plane];
 
-    for(y=0; y<img->d_h >> (plane?1:0); y++) {
-        MD5Update(&md5, buf, img->d_w >> (plane?1:0));
+    for(y=0; y < (plane ? (img->d_h + 1) >> 1 : img->d_h); y++) {
+        MD5Update(&md5, buf, (plane ? (img->d_w + 1) >> 1 : img->d_w));
         buf += img->stride[plane];
     }
 }
index 7dd05d1ff5b7af10190ea741892c6f06e8a1987e..92a2c30132ec1cc53e9b0f47f7a90b9870e35833 100644 (file)
@@ -47,8 +47,9 @@ while((img = vpx_codec_get_frame(&codec, &iter))) {
 for(plane=0; plane < 3; plane++) {
     unsigned char *buf =img->planes[plane];
 
-    for(y=0; y<img->d_h >> (plane?1:0); y++) {
-        if(fwrite(buf, 1, img->d_w >> (plane?1:0), outfile));
+    for(y=0; y < (plane ? (img->d_h + 1) >> 1 : img->d_h); y++) {
+        if(fwrite(buf, 1, (plane ? (img->d_w + 1) >> 1 : img->d_w),
+           outfile));
         buf += img->stride[plane];
     }
 }