Clean up the output of tjunittest and TJUnitTest

git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.3.x@980 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
DRC
2013-05-04 23:31:32 +00:00
parent 04e0a0293a
commit 49df783743
2 changed files with 17 additions and 19 deletions

View File

@@ -260,8 +260,8 @@ public class TJUnitTest {
throws Exception { throws Exception {
v = (v < 0) ? v + 256 : v; v = (v < 0) ? v + 256 : v;
if (v < cv - 1 || v > cv + 1) { if (v < cv - 1 || v > cv + 1) {
throw new Exception("\nComp. " + vname + " at " + row + "," + col + throw new Exception("Comp. " + vname + " at " + row + "," + col +
" should be " + cv + ", not " + v + "\n"); " should be " + cv + ", not " + v);
} }
} }
@@ -269,8 +269,8 @@ public class TJUnitTest {
throws Exception { throws Exception {
v = (v < 0) ? v + 256 : v; v = (v < 0) ? v + 256 : v;
if (v > 1) { if (v > 1) {
throw new Exception("\nComp. " + vname + " at " + row + "," + col + throw new Exception("Comp. " + vname + " at " + row + "," + col +
" should be 0, not " + v + "\n"); " should be 0, not " + v);
} }
} }
@@ -278,8 +278,8 @@ public class TJUnitTest {
throws Exception { throws Exception {
v = (v < 0) ? v + 256 : v; v = (v < 0) ? v + 256 : v;
if (v < 254) { if (v < 254) {
throw new Exception("\nComp. " + vname + " at " + row + "," + col + throw new Exception("Comp. " + vname + " at " + row + "," + col +
" should be 255, not " + v + "\n"); " should be 255, not " + v);
} }
} }
@@ -341,12 +341,11 @@ public class TJUnitTest {
} }
} }
} catch(Exception e) { } catch(Exception e) {
System.out.println(e); System.out.println("\n" + e.getMessage());
retval = 0; retval = 0;
} }
if (retval == 0) { if (retval == 0) {
System.out.print("\n");
for (row = 0; row < h; row++) { for (row = 0; row < h; row++) {
for (col = 0; col < w; col++) { for (col = 0; col < w; col++) {
int r = buf[pitch * row + col * ps + roffset]; int r = buf[pitch * row + col * ps + roffset];
@@ -420,12 +419,11 @@ public class TJUnitTest {
} }
} }
} catch(Exception e) { } catch(Exception e) {
System.out.println(e); System.out.println("\n" + e.getMessage());
retval = 0; retval = 0;
} }
if (retval == 0) { if (retval == 0) {
System.out.print("\n");
for (row = 0; row < h; row++) { for (row = 0; row < h; row++) {
for (col = 0; col < w; col++) { for (col = 0; col < w; col++) {
int r = (buf[pitch * row + col] >> rshift) & 0xFF; int r = (buf[pitch * row + col] >> rshift) & 0xFF;
@@ -485,7 +483,7 @@ public class TJUnitTest {
try { try {
if (size != correctsize) if (size != correctsize)
throw new Exception("\nIncorrect size " + size + ". Should be " + throw new Exception("Incorrect size " + size + ". Should be " +
correctsize); correctsize);
for (row = 0; row < ph; row++) { for (row = 0; row < ph; row++) {
@@ -526,7 +524,7 @@ public class TJUnitTest {
} }
} }
} catch(Exception e) { } catch(Exception e) {
System.out.println(e); System.out.println("\n" + e.getMessage());
retval = 0; retval = 0;
} }
@@ -557,7 +555,6 @@ public class TJUnitTest {
} }
System.out.print("\n"); System.out.print("\n");
} }
System.out.print("\n");
} }
return retval; return retval;
@@ -680,7 +677,7 @@ public class TJUnitTest {
System.out.print("JPEG -> "); System.out.print("JPEG -> ");
if (yuv == YUVDECODE) if (yuv == YUVDECODE)
System.out.print("YUV " + subName[subsamp] + " ... "); System.out.print("YUV " + subNameLong[subsamp] + " ... ");
else { else {
System.out.print(pfStr + " "); System.out.print(pfStr + " ");
if (bi) if (bi)
@@ -760,7 +757,6 @@ public class TJUnitTest {
} else } else
decompTest(tjd, jpegBuf, jpegSize, w, h, pf, baseName, subsamp, decompTest(tjd, jpegBuf, jpegSize, w, h, pf, baseName, subsamp,
flags, new TJScalingFactor(1, 1)); flags, new TJScalingFactor(1, 1));
System.out.print("\n");
} }
private static void doTest(int w, int h, int[] formats, int subsamp, private static void doTest(int w, int h, int[] formats, int subsamp,
@@ -799,8 +795,10 @@ public class TJUnitTest {
if (pf >= TJ.PF_RGBX && pf <= TJ.PF_XRGB && !bi) if (pf >= TJ.PF_RGBX && pf <= TJ.PF_XRGB && !bi)
decompTest(tjd, dstBuf, size, w, h, pf + (TJ.PF_RGBA - TJ.PF_RGBX), decompTest(tjd, dstBuf, size, w, h, pf + (TJ.PF_RGBA - TJ.PF_RGBX),
baseName, subsamp, flags); baseName, subsamp, flags);
System.out.print("\n");
} }
} }
System.out.print("--------------------\n\n");
} catch(Exception e) { } catch(Exception e) {
if (tjc != null) tjc.close(); if (tjc != null) tjc.close();
if (tjd != null) tjd.close(); if (tjd != null) tjd.close();

View File

@@ -219,7 +219,6 @@ int checkBuf(unsigned char *buf, int w, int h, int pf, int subsamp,
bailout: bailout:
if(retval==0) if(retval==0)
{ {
printf("\n");
for(row=0; row<h; row++) for(row=0; row<h; row++)
{ {
for(col=0; col<w; col++) for(col=0; col<w; col++)
@@ -312,7 +311,6 @@ int checkBufYUV(unsigned char *buf, int w, int h, int subsamp)
printf("%.3d ", buf[ypitch*ph + uvpitch*ch + (uvpitch*row+col)]); printf("%.3d ", buf[ypitch*ph + uvpitch*ch + (uvpitch*row+col)]);
printf("\n"); printf("\n");
} }
printf("\n");
} }
return retval; return retval;
@@ -405,7 +403,7 @@ void _decompTest(tjhandle handle, unsigned char *jpegBuf,
if(yuv==YUVENCODE) return; if(yuv==YUVENCODE) return;
if(yuv==YUVDECODE) if(yuv==YUVDECODE)
printf("JPEG -> YUV %s ... ", subName[subsamp]); printf("JPEG -> YUV %s ... ", subNameLong[subsamp]);
else else
{ {
printf("JPEG -> %s %s ", pixFormatStr[pf], printf("JPEG -> %s %s ", pixFormatStr[pf],
@@ -475,7 +473,7 @@ void decompTest(tjhandle handle, unsigned char *jpegBuf,
sf1); sf1);
bailout: bailout:
printf("\n"); return;
} }
@@ -517,8 +515,10 @@ void doTest(int w, int h, const int *formats, int nformats, int subsamp,
if(pf>=TJPF_RGBX && pf<=TJPF_XRGB) if(pf>=TJPF_RGBX && pf<=TJPF_XRGB)
decompTest(dhandle, dstBuf, size, w, h, pf+(TJPF_RGBA-TJPF_RGBX), decompTest(dhandle, dstBuf, size, w, h, pf+(TJPF_RGBA-TJPF_RGBX),
basename, subsamp, flags); basename, subsamp, flags);
printf("\n");
} }
} }
printf("--------------------\n\n");
bailout: bailout:
if(chandle) tjDestroy(chandle); if(chandle) tjDestroy(chandle);