]> granicus.if.org Git - libjpeg-turbo/commitdiff
tjbench: Further tweaks to -nowrite feature
authorDRC <information@libjpeg-turbo.org>
Wed, 13 Jan 2016 19:01:45 +0000 (13:01 -0600)
committerDRC <information@libjpeg-turbo.org>
Thu, 14 Jan 2016 04:32:19 +0000 (22:32 -0600)
* Do not compute compression error if -nowrite is specified
* Adjust formatting of -nowrite usage description

tjbench.c

index d04786ccdd67b0bc96e6949aff945299136cf05a..036d631e06347dd1ae28936ce7e3706c2e13e78e 100644 (file)
--- 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);