diff options
author | dcommander <dcommander@632fc199-4ca6-4c93-a231-07263d6284db> | 2011-05-27 02:10:42 +0000 |
---|---|---|
committer | dcommander <dcommander@632fc199-4ca6-4c93-a231-07263d6284db> | 2011-05-27 02:10:42 +0000 |
commit | 84e5de76c44b484faf371b5234e5e740022653bd (patch) | |
tree | 3bfef48cce254ee473d6aad4870eec098441c491 /tjunittest.c | |
parent | 143c122a9dee07f2d65e40f58d20eb2bbeba13cd (diff) |
Re-factor checkBufYUV() function to more closely resemble re-factored checkBuf() function
git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@654 632fc199-4ca6-4c93-a231-07263d6284db
Diffstat (limited to 'tjunittest.c')
-rw-r--r-- | tjunittest.c | 50 |
1 files changed, 20 insertions, 30 deletions
diff --git a/tjunittest.c b/tjunittest.c index c7a6611..1c6ae97 100644 --- a/tjunittest.c +++ b/tjunittest.c @@ -247,44 +247,27 @@ int checkBufYUV(unsigned char *buf, int w, int h, int subsamp) int cw=pw/hsf, ch=ph/vsf; int ypitch=PAD(pw, 4), uvpitch=PAD(cw, 4); int retval=1; + int halfway=16; - for(row=0; row<16; row++) + for(row=0; row<ph; row++) { for(col=0; col<pw; col++) { unsigned char y=buf[ypitch*row+col]; - if(((row/8)+(col/8))%2==0) checkval255(y) - else checkval(y, 76) - } - } - for(row=16; row<ph; row++) - { - for(col=0; col<pw; col++) - { - unsigned char y=buf[ypitch*row+col]; - if(((row/8)+(col/8))%2==0) checkval0(y) - else checkval(y, 226) + if(((row/8)+(col/8))%2==0) + { + if(row<halfway) checkval255(y) else checkval0(y); + } + else + { + if(row<halfway) checkval(y, 76) else checkval(y, 226); + } } } if(subsamp!=TJSAMP_GRAY) { - for(row=0; row<16/vsf; row++) - { - for(col=0; col<cw; col++) - { - unsigned char u=buf[ypitch*ph + (uvpitch*row+col)], - v=buf[ypitch*ph + uvpitch*ch + (uvpitch*row+col)]; - if(((row*vsf/8)+(col*hsf/8))%2==0) - { - checkval(u, 128); checkval(v, 128); - } - else - { - checkval(u, 85); checkval255(v); - } - } - } - for(row=16/vsf; row<ch; row++) + halfway=16/vsf; + for(row=0; row<ch; row++) { for(col=0; col<cw; col++) { @@ -296,7 +279,14 @@ int checkBufYUV(unsigned char *buf, int w, int h, int subsamp) } else { - checkval0(u); checkval(v, 149); + if(row<halfway) + { + checkval(u, 85); checkval255(v); + } + else + { + checkval0(u); checkval(v, 149); + } } } } |