From fe739656f93f2dce37182bfeac10a0acd95be5a4 Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 31 Oct 2013 04:53:27 +0000 Subject: [PATCH] Clean up formatting code and rename the JPEG files generated during the YUV decode tests to reflect the fact that they are being generated from YUV source images. git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1068 632fc199-4ca6-4c93-a231-07263d6284db --- tjunittest.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tjunittest.c b/tjunittest.c index 77ccb5d..519686f 100644 --- a/tjunittest.c +++ b/tjunittest.c @@ -452,12 +452,15 @@ void compTest(tjhandle handle, unsigned char **dstBuf, int subsamp, int jpegQual, int flags) { char tempStr[1024]; unsigned char *srcBuf=NULL; + const char *pfStr=(yuv==YUVDECODE)? "YUV":pixFormatStr[pf]; + const char *buStrLong=(flags&TJFLAG_BOTTOMUP)? "Bottom-Up":"Top-Down "; + const char *buStr=(flags&TJFLAG_BOTTOMUP)? "BU":"TD"; double t; if(yuv==YUVDECODE) { - printf("YUV %s %s -> JPEG Q%d ... ", subNameLong[subsamp], - (flags&TJFLAG_BOTTOMUP)? "Bottom-Up":"Top-Down ", jpegQual); + printf("YUV %s %s -> JPEG Q%d ... ", subNameLong[subsamp], buStrLong, + jpegQual); if((srcBuf=(unsigned char *)malloc(tjBufSizeYUV2(w, pad, h, subsamp))) ==NULL) _throw("Memory allocation failure"); @@ -466,11 +469,9 @@ void compTest(tjhandle handle, unsigned char **dstBuf, else { if(yuv==YUVENCODE) - printf("%s %s -> %s YUV ... ", pixFormatStr[pf], - (flags&TJFLAG_BOTTOMUP)? "Bottom-Up":"Top-Down ", subNameLong[subsamp]); + printf("%s %s -> %s YUV ... ", pfStr, buStrLong, subNameLong[subsamp]); else - printf("%s %s -> %s Q%d ... ", pixFormatStr[pf], - (flags&TJFLAG_BOTTOMUP)? "Bottom-Up":"Top-Down ", subNameLong[subsamp], + printf("%s %s -> %s Q%d ... ", pfStr, buStrLong, subNameLong[subsamp], jpegQual); if((srcBuf=(unsigned char *)malloc(w*h*tjPixelSize[pf]))==NULL) _throw("Memory allocation failure"); @@ -502,12 +503,11 @@ void compTest(tjhandle handle, unsigned char **dstBuf, t=gettime()-t; if(yuv==YUVENCODE) - snprintf(tempStr, 1024, "%s_enc_%s_%s_%s.yuv", basename, pixFormatStr[pf], - (flags&TJFLAG_BOTTOMUP)? "BU":"TD", subName[subsamp]); + snprintf(tempStr, 1024, "%s_enc_%s_%s_%s.yuv", basename, pfStr, buStr, + subName[subsamp]); else - snprintf(tempStr, 1024, "%s_enc_%s_%s_%s_Q%d.jpg", basename, - pixFormatStr[pf], (flags&TJFLAG_BOTTOMUP)? "BU":"TD", subName[subsamp], - jpegQual); + snprintf(tempStr, 1024, "%s_enc_%s_%s_%s_Q%d.jpg", basename, pfStr, buStr, + subName[subsamp], jpegQual); writeJPEG(*dstBuf, *dstSize, tempStr); if(yuv==YUVENCODE) { -- 2.40.0