/*
- * Copyright (C)2009-2014 D. R. Commander. All Rights Reserved.
+ * Copyright (C)2009-2014, 2016 D. R. Commander. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
class TJBench {
static int flags = 0, quiet = 0, pf = TJ.PF_BGR, yuvpad = 1, warmup = 1;
- static boolean compOnly, decompOnly, doTile, doYUV;
+ static boolean compOnly, decompOnly, doTile, doYUV, write;
static final String[] pixFormatStr = {
"RGB", "BGR", "RGBX", "BGRX", "XBGR", "XRGB", "GRAY"
}
}
+ if (!write) return;
+
if (sf.getNum() != 1 || sf.getDenom() != 1)
sizeStr = new String(sf.getNum() + "_" + sf.getDenom());
else if (tilew != w || tileh != h)
System.out.format(" Output bit stream: %f Megabits/sec\n",
(double)totalJpegSize * 8. / 1000000. * (double)iter / elapsed);
}
- if (tilew == w && tileh == h) {
+ if (tilew == w && tileh == h && write) {
String tempStr = fileName + "_" + subName[subsamp] + "_" + "Q" +
jpegQual + ".jpg";
FileOutputStream fos = new FileOutputStream(tempStr);
System.out.println("-benchtime <t> = Run each benchmark for at least <t> seconds (default = 5.0)");
System.out.println("-warmup <w> = Execute each benchmark <w> times to prime the cache before");
System.out.println(" taking performance measurements (default = 1)");
- System.out.println("-componly = Stop after running compression tests. Do not test decompression.\n");
+ System.out.println("-componly = Stop after running compression tests. Do not test decompression.");
+ System.out.println("-nowrite = Do not write reference or output images (improves consistency");
+ System.out.println(" of performance measurements.)\n");
System.out.println("NOTE: If the quality is specified as a range (e.g. 90-100), a separate");
System.out.println("test will be performed for all quality values in the range.\n");
System.exit(1);
}
if (argv[i].equalsIgnoreCase("-componly"))
compOnly = true;
+ if (argv[i].equalsIgnoreCase("-nowrite"))
+ write = false;
if (argv[i].equalsIgnoreCase("-warmup") && i < argv.length - 1) {
int temp = -1;
try {
/*
- * Copyright (C)2009-2015 D. R. Commander. All Rights Reserved.
+ * Copyright (C)2009-2016 D. R. Commander. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
#define _throwbmp(m) _throw(m, bmpgeterr())
int flags=TJFLAG_NOREALLOC, componly=0, decomponly=0, doyuv=0, quiet=0,
- dotile=0, pf=TJPF_BGR, yuvpad=1, warmup=1;
+ dotile=0, pf=TJPF_BGR, yuvpad=1, warmup=1, write=1;
char *ext="ppm";
const char *pixFormatStr[TJ_NUMPF]=
{
snprintf(tempstr, 1024, "%s_%s%s_%s.%s", filename, subName[subsamp],
qualstr, sizestr, ext);
- if(savebmp(tempstr, dstbuf, scaledw, scaledh, pf,
+ if(write && savebmp(tempstr, dstbuf, scaledw, scaledh, pf,
(flags&TJFLAG_BOTTOMUP)!=0)==-1)
_throwbmp("saving bitmap");
ptr=strrchr(tempstr, '.');
dstbuf[pitch*row+col]
=abs(dstbuf[pitch*row+col]-srcbuf[pitch*row+col]);
}
- if(savebmp(tempstr, dstbuf, w, h, pf,
+ if(write && savebmp(tempstr, dstbuf, w, h, pf,
(flags&TJFLAG_BOTTOMUP)!=0)==-1)
_throwbmp("saving bitmap");
}
printf(" Output bit stream: %f Megabits/sec\n",
(double)totaljpegsize*8./1000000.*(double)iter/elapsed);
}
- if(tilew==w && tileh==h)
+ if(tilew==w && tileh==h && write)
{
snprintf(tempstr, 1024, "%s_%s_Q%d.jpg", filename, subName[subsamp],
jpegqual);
printf("-benchtime <t> = Run each benchmark for at least <t> seconds (default = 5.0)\n");
printf("-warmup <w> = Execute each benchmark <w> times to prime the cache before\n");
printf(" taking performance measurements (default = 1)\n");
- printf("-componly = Stop after running compression tests. Do not test decompression.\n\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("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);
}
}
if(!strcasecmp(argv[i], "-componly")) componly=1;
+ if(!strcasecmp(argv[i], "-nowrite")) write=0;
}
}