ref: 6aea309a93d31d775642c6d2b66bc51db6adcbea
parent: 4797a972158db967f255e173ba0b37d47420f803
author: John Koleszar <jkoleszar@google.com>
date: Wed Sep 14 07:25:24 EDT 2011
Fix odd-sized image support in decoder examples Odd sized images need their chroma plane sizes rounded up. Change-Id: I3cd6fa60551f05697b67ece5b6928bef2a41bad8
--- a/examples/decode_to_md5.txt
+++ b/examples/decode_to_md5.txt
@@ -34,8 +34,8 @@
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];
}
}
--- a/examples/decoder_tmpl.txt
+++ b/examples/decoder_tmpl.txt
@@ -47,8 +47,9 @@
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];
}
}
--
⑨