|
1 | 1 | /* |
2 | | - * Copyright (C)2009-2015 D. R. Commander. All Rights Reserved. |
| 2 | + * Copyright (C)2009-2016 D. R. Commander. All Rights Reserved. |
3 | 3 | * |
4 | 4 | * Redistribution and use in source and binary forms, with or without |
5 | 5 | * modification, are permitted provided that the following conditions are met: |
|
46 | 46 | #define _throwbmp(m) _throw(m, bmpgeterr()) |
47 | 47 |
|
48 | 48 | int flags=TJFLAG_NOREALLOC, componly=0, decomponly=0, doyuv=0, quiet=0, |
49 | | - dotile=0, pf=TJPF_BGR, yuvpad=1, warmup=1; |
| 49 | + dotile=0, pf=TJPF_BGR, yuvpad=1, warmup=1, write=1; |
50 | 50 | char *ext="ppm"; |
51 | 51 | const char *pixFormatStr[TJ_NUMPF]= |
52 | 52 | { |
@@ -224,7 +224,7 @@ int decomp(unsigned char *srcbuf, unsigned char **jpegbuf, |
224 | 224 | snprintf(tempstr, 1024, "%s_%s%s_%s.%s", filename, subName[subsamp], |
225 | 225 | qualstr, sizestr, ext); |
226 | 226 |
|
227 | | - if(savebmp(tempstr, dstbuf, scaledw, scaledh, pf, |
| 227 | + if(write && savebmp(tempstr, dstbuf, scaledw, scaledh, pf, |
228 | 228 | (flags&TJFLAG_BOTTOMUP)!=0)==-1) |
229 | 229 | _throwbmp("saving bitmap"); |
230 | 230 | ptr=strrchr(tempstr, '.'); |
@@ -259,7 +259,7 @@ int decomp(unsigned char *srcbuf, unsigned char **jpegbuf, |
259 | 259 | dstbuf[pitch*row+col] |
260 | 260 | =abs(dstbuf[pitch*row+col]-srcbuf[pitch*row+col]); |
261 | 261 | } |
262 | | - if(savebmp(tempstr, dstbuf, w, h, pf, |
| 262 | + if(write && savebmp(tempstr, dstbuf, w, h, pf, |
263 | 263 | (flags&TJFLAG_BOTTOMUP)!=0)==-1) |
264 | 264 | _throwbmp("saving bitmap"); |
265 | 265 | } |
@@ -422,7 +422,7 @@ int fullTest(unsigned char *srcbuf, int w, int h, int subsamp, int jpegqual, |
422 | 422 | printf(" Output bit stream: %f Megabits/sec\n", |
423 | 423 | (double)totaljpegsize*8./1000000.*(double)iter/elapsed); |
424 | 424 | } |
425 | | - if(tilew==w && tileh==h) |
| 425 | + if(tilew==w && tileh==h && write) |
426 | 426 | { |
427 | 427 | snprintf(tempstr, 1024, "%s_%s_Q%d.jpg", filename, subName[subsamp], |
428 | 428 | jpegqual); |
@@ -756,7 +756,9 @@ void usage(char *progname) |
756 | 756 | printf("-benchtime <t> = Run each benchmark for at least <t> seconds (default = 5.0)\n"); |
757 | 757 | printf("-warmup <w> = Execute each benchmark <w> times to prime the cache before\n"); |
758 | 758 | printf(" taking performance measurements (default = 1)\n"); |
759 | | - printf("-componly = Stop after running compression tests. Do not test decompression.\n\n"); |
| 759 | + printf("-componly = Stop after running compression tests. Do not test decompression.\n"); |
| 760 | + printf("-nowrite = Do not write reference or output images (improves consistency of\n"); |
| 761 | + printf(" performance measurements.)\n\n"); |
760 | 762 | printf("NOTE: If the quality is specified as a range (e.g. 90-100), a separate\n"); |
761 | 763 | printf("test will be performed for all quality values in the range.\n\n"); |
762 | 764 | exit(1); |
@@ -906,6 +908,7 @@ int main(int argc, char *argv[]) |
906 | 908 | } |
907 | 909 | } |
908 | 910 | if(!strcasecmp(argv[i], "-componly")) componly=1; |
| 911 | + if(!strcasecmp(argv[i], "-nowrite")) write=0; |
909 | 912 | } |
910 | 913 | } |
911 | 914 |
|
|
0 commit comments