diff options
Diffstat (limited to 'tjunittest.c')
-rw-r--r-- | tjunittest.c | 429 |
1 files changed, 335 insertions, 94 deletions
diff --git a/tjunittest.c b/tjunittest.c index da7c6ff..af409a5 100644 --- a/tjunittest.c +++ b/tjunittest.c @@ -46,6 +46,7 @@ #endif +#ifndef GTEST static void usage(char *progName) { printf("\nUSAGE: %s [options]\n\n", progName); @@ -57,44 +58,47 @@ static void usage(char *progName) printf("-bmp = tjLoadImage()/tjSaveImage() unit test\n\n"); exit(1); } +#endif #define THROW_TJ() { \ - printf("TurboJPEG ERROR:\n%s\n", tjGetErrorStr()); \ + fprintf(stderr, "TurboJPEG ERROR:\n%s\n", tjGetErrorStr()); \ BAILOUT() \ } #define TRY_TJ(f) { if ((f) == -1) THROW_TJ(); } #define THROW(m) { printf("ERROR: %s\n", m); BAILOUT() } #define THROW_MD5(filename, md5sum, ref) { \ - printf("\n%s has an MD5 sum of %s.\n Should be %s.\n", filename, md5sum, \ - ref); \ + fprintf(stderr, "\n%s has an MD5 sum of %s.\n Should be %s.\n", filename, \ + md5sum, ref); \ BAILOUT() \ } -const char *subNameLong[TJ_NUMSAMP] = { +static const char *subNameLong[TJ_NUMSAMP] = { "4:4:4", "4:2:2", "4:2:0", "GRAY", "4:4:0", "4:1:1" }; -const char *subName[TJ_NUMSAMP] = { +static const char *subName[TJ_NUMSAMP] = { "444", "422", "420", "GRAY", "440", "411" }; -const char *pixFormatStr[TJ_NUMPF] = { +static const char *pixFormatStr[TJ_NUMPF] = { "RGB", "BGR", "RGBX", "BGRX", "XBGR", "XRGB", "Grayscale", "RGBA", "BGRA", "ABGR", "ARGB", "CMYK" }; -const int _3byteFormats[] = { TJPF_RGB, TJPF_BGR }; -const int _4byteFormats[] = { +static const int _3byteFormats[] = { TJPF_RGB, TJPF_BGR }; +static const int _4byteFormats[] = { TJPF_RGBX, TJPF_BGRX, TJPF_XBGR, TJPF_XRGB, TJPF_CMYK }; -const int _onlyGray[] = { TJPF_GRAY }; -const int _onlyRGB[] = { TJPF_RGB }; +static const int _onlyGray[] = { TJPF_GRAY }; +static const int _onlyRGB[] = { TJPF_RGB }; -int doYUV = 0, alloc = 0, pad = 4; +static int doYUV = 0, alloc = 0, pad = 4; -int exitStatus = 0; +static int exitStatus = 0; #define BAILOUT() { exitStatus = -1; goto bailout; } +static const size_t filePathSize = 1024; + static void initBuf(unsigned char *buf, int w, int h, int pf, int flags) { @@ -153,22 +157,24 @@ static void initBuf(unsigned char *buf, int w, int h, int pf, int flags) #define CHECKVAL(v, cv) { \ if (v < cv - 1 || v > cv + 1) { \ - printf("\nComp. %s at %d,%d should be %d, not %d\n", #v, row, col, cv, \ - v); \ + fprintf(stderr, "\nComp. %s at %d,%d should be %d, not %d\n", #v, row, \ + col, cv, v); \ retval = 0; exitStatus = -1; goto bailout; \ } \ } #define CHECKVAL0(v) { \ if (v > 1) { \ - printf("\nComp. %s at %d,%d should be 0, not %d\n", #v, row, col, v); \ + fprintf(stderr, "\nComp. %s at %d,%d should be 0, not %d\n", #v, row, \ + col, v); \ retval = 0; exitStatus = -1; goto bailout; \ } \ } #define CHECKVAL255(v) { \ if (v < 254) { \ - printf("\nComp. %s at %d,%d should be 255, not %d\n", #v, row, col, v); \ + fprintf(stderr, "\nComp. %s at %d,%d should be 255, not %d\n", #v, row, \ + col, v); \ retval = 0; exitStatus = -1; goto bailout; \ } \ } @@ -253,15 +259,16 @@ bailout: for (row = 0; row < h; row++) { for (col = 0; col < w; col++) { if (pf == TJPF_CMYK) - printf("%.3d/%.3d/%.3d/%.3d ", buf[(row * w + col) * ps], - buf[(row * w + col) * ps + 1], buf[(row * w + col) * ps + 2], - buf[(row * w + col) * ps + 3]); + fprintf(stderr, "%.3d/%.3d/%.3d/%.3d ", buf[(row * w + col) * ps], + buf[(row * w + col) * ps + 1], buf[(row * w + col) * ps + 2], + buf[(row * w + col) * ps + 3]); else - printf("%.3d/%.3d/%.3d ", buf[(row * w + col) * ps + roffset], - buf[(row * w + col) * ps + goffset], - buf[(row * w + col) * ps + boffset]); + fprintf(stderr, "%.3d/%.3d/%.3d ", + buf[(row * w + col) * ps + roffset], + buf[(row * w + col) * ps + goffset], + buf[(row * w + col) * ps + boffset]); } - printf("\n"); + fprintf(stderr, "\n"); } } return retval; @@ -320,21 +327,21 @@ bailout: if (retval == 0) { for (row = 0; row < ph; row++) { for (col = 0; col < pw; col++) - printf("%.3d ", buf[ypitch * row + col]); - printf("\n"); + fprintf(stderr, "%.3d ", buf[ypitch * row + col]); + fprintf(stderr, "\n"); } - printf("\n"); + fprintf(stderr, "\n"); for (row = 0; row < ch; row++) { for (col = 0; col < cw; col++) - printf("%.3d ", buf[ypitch * ph + (uvpitch * row + col)]); - printf("\n"); + fprintf(stderr, "%.3d ", buf[ypitch * ph + (uvpitch * row + col)]); + fprintf(stderr, "\n"); } - printf("\n"); + fprintf(stderr, "\n"); for (row = 0; row < ch; row++) { for (col = 0; col < cw; col++) - printf("%.3d ", - buf[ypitch * ph + uvpitch * ch + (uvpitch * row + col)]); - printf("\n"); + fprintf(stderr, "%.3d ", + buf[ypitch * ph + uvpitch * ch + (uvpitch * row + col)]); + fprintf(stderr, "\n"); } } @@ -345,10 +352,16 @@ bailout: static void writeJPEG(unsigned char *jpegBuf, unsigned long jpegSize, char *filename) { +#if defined(ANDROID) && defined(GTEST) + char path[filePathSize]; + snprintf(path, filePathSize, "/sdcard/%s", filename); + FILE *file = fopen(path, "wb"); +#else FILE *file = fopen(filename, "wb"); - +#endif if (!file || fwrite(jpegBuf, jpegSize, 1, file) != 1) { - printf("ERROR: Could not write to %s.\n%s\n", filename, strerror(errno)); + fprintf(stderr, "ERROR: Could not write to %s.\n%s\n", filename, + strerror(errno)); BAILOUT() } @@ -361,7 +374,7 @@ static void compTest(tjhandle handle, unsigned char **dstBuf, unsigned long *dstSize, int w, int h, int pf, char *basename, int subsamp, int jpegQual, int flags) { - char tempStr[1024]; + char tempStr[filePathSize]; unsigned char *srcBuf = NULL, *yuvBuf = NULL; const char *pfStr = pixFormatStr[pf]; const char *buStrLong = @@ -386,32 +399,33 @@ static void compTest(tjhandle handle, unsigned char **dstBuf, THROW("Memory allocation failure"); memset(yuvBuf, 0, yuvSize); - printf("%s %s -> YUV %s ... ", pfStr, buStrLong, subNameLong[subsamp]); + fprintf(stderr, "%s %s -> YUV %s ... ", pfStr, buStrLong, + subNameLong[subsamp]); TRY_TJ(tjEncodeYUV3(handle2, srcBuf, w, 0, h, pf, yuvBuf, pad, subsamp, flags)); tjDestroy(handle2); - if (checkBufYUV(yuvBuf, w, h, subsamp, sf)) printf("Passed.\n"); - else printf("FAILED!\n"); + if (checkBufYUV(yuvBuf, w, h, subsamp, sf)) fprintf(stderr, "Passed.\n"); + else fprintf(stderr, "FAILED!\n"); - printf("YUV %s %s -> JPEG Q%d ... ", subNameLong[subsamp], buStrLong, - jpegQual); + fprintf(stderr, "YUV %s %s -> JPEG Q%d ... ", subNameLong[subsamp], + buStrLong, jpegQual); TRY_TJ(tjCompressFromYUV(handle, yuvBuf, w, pad, h, subsamp, dstBuf, dstSize, jpegQual, flags)); } else { - printf("%s %s -> %s Q%d ... ", pfStr, buStrLong, subNameLong[subsamp], - jpegQual); + fprintf(stderr, "%s %s -> %s Q%d ... ", pfStr, buStrLong, + subNameLong[subsamp], jpegQual); TRY_TJ(tjCompress2(handle, srcBuf, w, 0, h, pf, dstBuf, dstSize, subsamp, jpegQual, flags)); } - snprintf(tempStr, 1024, "%s_enc_%s_%s_%s_Q%d.jpg", basename, pfStr, buStr, - subName[subsamp], jpegQual); + snprintf(tempStr, filePathSize, "%s_enc_%s_%s_%s_Q%d.jpg", basename, pfStr, + buStr, subName[subsamp], jpegQual); writeJPEG(*dstBuf, *dstSize, tempStr); - printf("Done.\n Result in %s\n", tempStr); + fprintf(stderr, "Done.\n Result in %s\n", tempStr); bailout: - if (yuvBuf) free(yuvBuf); - if (srcBuf) free(srcBuf); + free(yuvBuf); + free(srcBuf); } @@ -447,39 +461,40 @@ static void _decompTest(tjhandle handle, unsigned char *jpegBuf, THROW("Memory allocation failure"); memset(yuvBuf, 0, yuvSize); - printf("JPEG -> YUV %s ", subNameLong[subsamp]); + fprintf(stderr, "JPEG -> YUV %s ", subNameLong[subsamp]); if (sf.num != 1 || sf.denom != 1) - printf("%d/%d ... ", sf.num, sf.denom); - else printf("... "); + fprintf(stderr, "%d/%d ... ", sf.num, sf.denom); + else fprintf(stderr, "... "); TRY_TJ(tjDecompressToYUV2(handle, jpegBuf, jpegSize, yuvBuf, scaledWidth, pad, scaledHeight, flags)); if (checkBufYUV(yuvBuf, scaledWidth, scaledHeight, subsamp, sf)) - printf("Passed.\n"); - else printf("FAILED!\n"); + fprintf(stderr, "Passed.\n"); + else fprintf(stderr, "FAILED!\n"); - printf("YUV %s -> %s %s ... ", subNameLong[subsamp], pixFormatStr[pf], - (flags & TJFLAG_BOTTOMUP) ? "Bottom-Up" : "Top-Down "); + fprintf(stderr, "YUV %s -> %s %s ... ", subNameLong[subsamp], + pixFormatStr[pf], + (flags & TJFLAG_BOTTOMUP) ? "Bottom-Up" : "Top-Down "); TRY_TJ(tjDecodeYUV(handle2, yuvBuf, pad, subsamp, dstBuf, scaledWidth, 0, scaledHeight, pf, flags)); tjDestroy(handle2); } else { - printf("JPEG -> %s %s ", pixFormatStr[pf], - (flags & TJFLAG_BOTTOMUP) ? "Bottom-Up" : "Top-Down "); + fprintf(stderr, "JPEG -> %s %s ", pixFormatStr[pf], + (flags & TJFLAG_BOTTOMUP) ? "Bottom-Up" : "Top-Down "); if (sf.num != 1 || sf.denom != 1) - printf("%d/%d ... ", sf.num, sf.denom); - else printf("... "); + fprintf(stderr, "%d/%d ... ", sf.num, sf.denom); + else fprintf(stderr, "... "); TRY_TJ(tjDecompress2(handle, jpegBuf, jpegSize, dstBuf, scaledWidth, 0, scaledHeight, pf, flags)); } if (checkBuf(dstBuf, scaledWidth, scaledHeight, pf, subsamp, sf, flags)) - printf("Passed."); - else printf("FAILED!"); - printf("\n"); + fprintf(stderr, "Passed."); + else fprintf(stderr, "FAILED!"); + fprintf(stderr, "\n"); bailout: - if (yuvBuf) free(yuvBuf); - if (dstBuf) free(dstBuf); + free(yuvBuf); + free(dstBuf); } @@ -538,19 +553,19 @@ static void doTest(int w, int h, const int *formats, int nformats, int subsamp, flags); decompTest(dhandle, dstBuf, size, w, h, pf, basename, subsamp, flags); if (pf >= TJPF_RGBX && pf <= TJPF_XRGB) { - printf("\n"); + fprintf(stderr, "\n"); decompTest(dhandle, dstBuf, size, w, h, pf + (TJPF_RGBA - TJPF_RGBX), basename, subsamp, flags); } - printf("\n"); + fprintf(stderr, "\n"); } } - printf("--------------------\n\n"); + fprintf(stderr, "--------------------\n\n"); bailout: if (chandle) tjDestroy(chandle); if (dhandle) tjDestroy(dhandle); - if (dstBuf) tjFree(dstBuf); + tjFree(dstBuf); } @@ -567,6 +582,7 @@ bailout: } #endif +#ifndef GTEST static void overflowTest(void) { /* Ensure that the various buffer size functions don't overflow */ @@ -588,6 +604,7 @@ static void overflowTest(void) bailout: return; } +#endif static void bufSizeTest(void) @@ -599,13 +616,14 @@ static void bufSizeTest(void) if ((handle = tjInitCompress()) == NULL) THROW_TJ(); - printf("Buffer size regression test\n"); + fprintf(stderr, "Buffer size regression test\n"); for (subsamp = 0; subsamp < TJ_NUMSAMP; subsamp++) { for (w = 1; w < 48; w++) { int maxh = (w == 1) ? 2048 : 48; for (h = 1; h < maxh; h++) { - if (h % 100 == 0) printf("%.4d x %.4d\b\b\b\b\b\b\b\b\b\b\b", w, h); + if (h % 100 == 0) + fprintf(stderr, "%.4d x %.4d\b\b\b\b\b\b\b\b\b\b\b", w, h); if ((srcBuf = (unsigned char *)malloc(w * h * 4)) == NULL) THROW("Memory allocation failure"); if (!alloc || doYUV) { @@ -662,11 +680,11 @@ static void bufSizeTest(void) } } } - printf("Done. \n"); + fprintf(stderr, "Done. \n"); bailout: - if (srcBuf) free(srcBuf); - if (dstBuf) tjFree(dstBuf); + free(srcBuf); + tjFree(dstBuf); if (handle) tjDestroy(handle); } @@ -759,7 +777,8 @@ static int cmpBitmap(unsigned char *buf, int width, int pitch, int height, static int doBmpTest(const char *ext, int width, int align, int height, int pf, int flags) { - char filename[80], *md5sum, md5buf[65]; + const size_t filenameSize = 80; + char filename[filenameSize], *md5sum, md5buf[65]; int ps = tjPixelSize[pf], pitch = PAD(width * ps, align), loadWidth = 0, loadHeight = 0, retval = 0, pixelFormat = pf; unsigned char *buf = NULL; @@ -777,8 +796,14 @@ static int doBmpTest(const char *ext, int width, int align, int height, int pf, THROW("Could not allocate memory"); initBitmap(buf, width, pitch, height, pf, flags); - snprintf(filename, 80, "test_bmp_%s_%d_%s.%s", pixFormatStr[pf], align, - (flags & TJFLAG_BOTTOMUP) ? "bu" : "td", ext); +#if defined(ANDROID) && defined(GTEST) + snprintf(filename, filenameSize, "/sdcard/test_bmp_%s_%d_%s.%s", + pixFormatStr[pf], align, (flags & TJFLAG_BOTTOMUP) ? "bu" : "td", + ext); +#else + snprintf(filename, filenameSize, "test_bmp_%s_%d_%s.%s", pixFormatStr[pf], + align, (flags & TJFLAG_BOTTOMUP) ? "bu" : "td", ext); +#endif TRY_TJ(tjSaveImage(filename, buf, width, pitch, height, pf, flags)); md5sum = MD5File(filename, md5buf); if (strcasecmp(md5sum, md5ref)) @@ -789,11 +814,11 @@ static int doBmpTest(const char *ext, int width, int align, int height, int pf, flags)) == NULL) THROW_TJ(); if (width != loadWidth || height != loadHeight) { - printf("\n Image dimensions of %s are bogus\n", filename); + fprintf(stderr, "\n Image dimensions of %s are bogus\n", filename); retval = -1; goto bailout; } if (!cmpBitmap(buf, width, pitch, height, pf, flags, 0)) { - printf("\n Pixel data in %s is bogus\n", filename); + fprintf(stderr, "\n Pixel data in %s is bogus\n", filename); retval = -1; goto bailout; } if (pf == TJPF_GRAY) { @@ -804,7 +829,7 @@ static int doBmpTest(const char *ext, int width, int align, int height, int pf, THROW_TJ(); pitch = PAD(width * tjPixelSize[pf], align); if (!cmpBitmap(buf, width, pitch, height, pf, flags, 1)) { - printf("\n Converting %s to RGB failed\n", filename); + fprintf(stderr, "\n Converting %s to RGB failed\n", filename); retval = -1; goto bailout; } @@ -815,7 +840,7 @@ static int doBmpTest(const char *ext, int width, int align, int height, int pf, THROW_TJ(); pitch = PAD(width * tjPixelSize[pf], align); if (!cmpBitmap(buf, width, pitch, height, pf, flags, 1)) { - printf("\n Converting %s to CMYK failed\n", filename); + fprintf(stderr, "\n Converting %s to CMYK failed\n", filename); retval = -1; goto bailout; } } @@ -832,14 +857,15 @@ static int doBmpTest(const char *ext, int width, int align, int height, int pf, pixelFormat != TJPF_BGR) || (pf != TJPF_GRAY && !strcasecmp(ext, "ppm") && pixelFormat != TJPF_RGB)) { - printf("\n tjLoadImage() returned unexpected pixel format: %s\n", - pixFormatStr[pixelFormat]); + fprintf(stderr, + "\n tjLoadImage() returned unexpected pixel format: %s\n", + pixFormatStr[pixelFormat]); retval = -1; } unlink(filename); bailout: - if (buf) tjFree(buf); + tjFree(buf); if (exitStatus < 0) return exitStatus; return retval; } @@ -851,31 +877,31 @@ static int bmpTest(void) for (align = 1; align <= 8; align *= 2) { for (format = 0; format < TJ_NUMPF; format++) { - printf("%s Top-Down BMP (row alignment = %d bytes) ... ", - pixFormatStr[format], align); + fprintf(stderr, "%s Top-Down BMP (row alignment = %d bytes) ... ", + pixFormatStr[format], align); if (doBmpTest("bmp", width, align, height, format, 0) == -1) return -1; - printf("OK.\n"); + fprintf(stderr, "OK.\n"); - printf("%s Top-Down PPM (row alignment = %d bytes) ... ", - pixFormatStr[format], align); + fprintf(stderr, "%s Top-Down PPM (row alignment = %d bytes) ... ", + pixFormatStr[format], align); if (doBmpTest("ppm", width, align, height, format, TJFLAG_BOTTOMUP) == -1) return -1; - printf("OK.\n"); + fprintf(stderr, "OK.\n"); - printf("%s Bottom-Up BMP (row alignment = %d bytes) ... ", - pixFormatStr[format], align); + fprintf(stderr, "%s Bottom-Up BMP (row alignment = %d bytes) ... ", + pixFormatStr[format], align); if (doBmpTest("bmp", width, align, height, format, 0) == -1) return -1; - printf("OK.\n"); + fprintf(stderr, "OK.\n"); - printf("%s Bottom-Up PPM (row alignment = %d bytes) ... ", - pixFormatStr[format], align); + fprintf(stderr, "%s Bottom-Up PPM (row alignment = %d bytes) ... ", + pixFormatStr[format], align); if (doBmpTest("ppm", width, align, height, format, TJFLAG_BOTTOMUP) == -1) return -1; - printf("OK.\n"); + fprintf(stderr, "OK.\n"); } } @@ -883,6 +909,220 @@ static int bmpTest(void) } +#ifdef GTEST +static void initTJUnitTest(int yuv, int noyuvpad, int autoalloc) +{ + doYUV = yuv ? 1 : 0; + pad = noyuvpad ? 1 : 4; + alloc = autoalloc ? 1 : 0; + + exitStatus = 0; +} + + +int testBmp(int yuv, int noyuvpad, int autoalloc) +{ + initTJUnitTest(yuv, noyuvpad, autoalloc); + + return bmpTest(); +} + + +int testThreeByte444(int yuv, int noyuvpad, int autoalloc) +{ + initTJUnitTest(yuv, noyuvpad, autoalloc); + + doTest(35, 39, _3byteFormats, 2, TJSAMP_444, "test"); + return exitStatus; +} + + +int testFourByte444(int yuv, int noyuvpad, int autoalloc) +{ + initTJUnitTest(yuv, noyuvpad, autoalloc); + + int num4bf = doYUV ? 4 : 5; + doTest(39, 41, _4byteFormats, num4bf, TJSAMP_444, "test"); + return exitStatus; +} + + +int testThreeByte422(int yuv, int noyuvpad, int autoalloc) +{ + initTJUnitTest(yuv, noyuvpad, autoalloc); + + doTest(41, 35, _3byteFormats, 2, TJSAMP_422, "test"); + return exitStatus; +} + + +int testFourByte422(int yuv, int noyuvpad, int autoalloc) +{ + initTJUnitTest(yuv, noyuvpad, autoalloc); + + int num4bf = doYUV ? 4 : 5; + doTest(35, 39, _4byteFormats, num4bf, TJSAMP_422, "test"); + return exitStatus; +} + + +int testThreeByte420(int yuv, int noyuvpad, int autoalloc) +{ + initTJUnitTest(yuv, noyuvpad, autoalloc); + + doTest(39, 41, _3byteFormats, 2, TJSAMP_420, "test"); + return exitStatus; +} + + +int testFourByte420(int yuv, int noyuvpad, int autoalloc) +{ + initTJUnitTest(yuv, noyuvpad, autoalloc); + + int num4bf = doYUV ? 4 : 5; + doTest(41, 35, _4byteFormats, num4bf, TJSAMP_420, "test"); + return exitStatus; +} + + +int testThreeByte440(int yuv, int noyuvpad, int autoalloc) +{ + initTJUnitTest(yuv, noyuvpad, autoalloc); + + doTest(35, 39, _3byteFormats, 2, TJSAMP_440, "test"); + return exitStatus; +} + + +int testFourByte440(int yuv, int noyuvpad, int autoalloc) +{ + initTJUnitTest(yuv, noyuvpad, autoalloc); + + int num4bf = doYUV ? 4 : 5; + doTest(39, 41, _4byteFormats, num4bf, TJSAMP_440, "test"); + return exitStatus; +} + + +int testThreeByte411(int yuv, int noyuvpad, int autoalloc) +{ + initTJUnitTest(yuv, noyuvpad, autoalloc); + + doTest(41, 35, _3byteFormats, 2, TJSAMP_411, "test"); + return exitStatus; +} + + +int testFourByte411(int yuv, int noyuvpad, int autoalloc) +{ + initTJUnitTest(yuv, noyuvpad, autoalloc); + + int num4bf = doYUV ? 4 : 5; + doTest(35, 39, _4byteFormats, num4bf, TJSAMP_411, "test"); + return exitStatus; +} + + +int testOnlyGray(int yuv, int noyuvpad, int autoalloc) +{ + initTJUnitTest(yuv, noyuvpad, autoalloc); + + doTest(39, 41, _onlyGray, 1, TJSAMP_GRAY, "test"); + return exitStatus; +} + + +int testThreeByteGray(int yuv, int noyuvpad, int autoalloc) +{ + initTJUnitTest(yuv, noyuvpad, autoalloc); + + doTest(41, 35, _3byteFormats, 2, TJSAMP_GRAY, "test"); + return exitStatus; +} + + +int testFourByteGray(int yuv, int noyuvpad, int autoalloc) +{ + initTJUnitTest(yuv, noyuvpad, autoalloc); + + doTest(35, 39, _4byteFormats, 4, TJSAMP_GRAY, "test"); + return exitStatus; +} + + +int testBufSize(int yuv, int noyuvpad, int autoalloc) +{ + initTJUnitTest(yuv, noyuvpad, autoalloc); + + bufSizeTest(); + return exitStatus; +} + + +int testYUVOnlyRGB444(int noyuvpad, int autoalloc) +{ + initTJUnitTest(1, noyuvpad, autoalloc); + + doTest(48, 48, _onlyRGB, 1, TJSAMP_444, "test_yuv0"); + return exitStatus; +} + + +int testYUVOnlyRGB422(int noyuvpad, int autoalloc) +{ + initTJUnitTest(1, noyuvpad, autoalloc); + + doTest(48, 48, _onlyRGB, 1, TJSAMP_422, "test_yuv0"); + return exitStatus; +} + + +int testYUVOnlyRGB420(int noyuvpad, int autoalloc) +{ + initTJUnitTest(1, noyuvpad, autoalloc); + + doTest(48, 48, _onlyRGB, 1, TJSAMP_420, "test_yuv0"); + return exitStatus; +} + + +int testYUVOnlyRGB440(int noyuvpad, int autoalloc) +{ + initTJUnitTest(1, noyuvpad, autoalloc); + + doTest(48, 48, _onlyRGB, 1, TJSAMP_440, "test_yuv0"); + return exitStatus; +} + + +int testYUVOnlyRGB411(int noyuvpad, int autoalloc) +{ + initTJUnitTest(1, noyuvpad, autoalloc); + + doTest(48, 48, _onlyRGB, 1, TJSAMP_411, "test_yuv0"); + return exitStatus; +} + + +int testYUVOnlyRGBGray(int noyuvpad, int autoalloc) +{ + initTJUnitTest(1, noyuvpad, autoalloc); + + doTest(48, 48, _onlyRGB, 1, TJSAMP_GRAY, "test_yuv0"); + return exitStatus; +} + + +int testYUVOnlyGrayGray(int noyuvpad, int autoalloc) +{ + initTJUnitTest(1, noyuvpad, autoalloc); + + doTest(48, 48, _onlyGray, 1, TJSAMP_GRAY, "test_yuv0"); + return exitStatus; +} + +#else + int main(int argc, char *argv[]) { int i, num4bf = 5; @@ -929,3 +1169,4 @@ int main(int argc, char *argv[]) return exitStatus; } +#endif |