From 9c8cee8c29a863d5c7ebd8bf21bdcf0c370c6730 Mon Sep 17 00:00:00 2001 From: DRC Date: Wed, 13 Jan 2016 13:01:45 -0600 Subject: [PATCH] tjbench: Further tweaks to -nowrite feature * Do not compute compression error if -nowrite is specified * Adjust formatting of -nowrite usage description --- tjbench.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tjbench.c b/tjbench.c index d04786c..036d631 100644 --- a/tjbench.c +++ b/tjbench.c @@ -213,6 +213,9 @@ int decomp(unsigned char *srcbuf, unsigned char **jpegbuf, (double)(w*h)/1000000.*(double)iter/elapsedDecode); } } + + if (!write) goto bailout; + if(sf.num!=1 || sf.denom!=1) snprintf(sizestr, 20, "%d_%d", sf.num, sf.denom); else if(tilew!=w || tileh!=h) @@ -224,7 +227,7 @@ int decomp(unsigned char *srcbuf, unsigned char **jpegbuf, snprintf(tempstr, 1024, "%s_%s%s_%s.%s", filename, subName[subsamp], qualstr, sizestr, ext); - if(write && savebmp(tempstr, dstbuf, scaledw, scaledh, pf, + if(savebmp(tempstr, dstbuf, scaledw, scaledh, pf, (flags&TJFLAG_BOTTOMUP)!=0)==-1) _throwbmp("saving bitmap"); ptr=strrchr(tempstr, '.'); @@ -259,7 +262,7 @@ int decomp(unsigned char *srcbuf, unsigned char **jpegbuf, dstbuf[pitch*row+col] =abs(dstbuf[pitch*row+col]-srcbuf[pitch*row+col]); } - if(write && savebmp(tempstr, dstbuf, w, h, pf, + if(savebmp(tempstr, dstbuf, w, h, pf, (flags&TJFLAG_BOTTOMUP)!=0)==-1) _throwbmp("saving bitmap"); } @@ -758,7 +761,7 @@ void usage(char *progname) printf(" taking performance measurements (default = 1)\n"); printf("-componly = Stop after running compression tests. Do not test decompression.\n"); printf("-nowrite = Do not write reference or output images (improves consistency of\n"); - printf(" performance measurements.)\n\n"); + printf(" performance measurements.)\n\n"); printf("NOTE: If the quality is specified as a range (e.g. 90-100), a separate\n"); printf("test will be performed for all quality values in the range.\n\n"); exit(1); -- 2.49.0