mirror of
https://github.com/libjpeg-turbo/libjpeg-turbo.git
synced 2026-01-18 21:41:20 +01:00
TJBench: Consistify args with cjpeg/djpeg/jpegtran
-hflip --> -flip horizontal -limitscans --> -maxscans N -rot90 --> -rotate 90 -rot180 --> -rotate 180 -rot270 --> -rotate 270 -stoponwarning --> -strict -vflip --> -flip vertical
This commit is contained in:
@@ -40,9 +40,9 @@ final class TJBench {
|
||||
private TJBench() {}
|
||||
|
||||
private static boolean stopOnWarning, bottomUp, fastUpsample, fastDCT,
|
||||
optimize, progressive, limitScans, arithmetic, lossless;
|
||||
private static int maxMemory = 0, maxPixels = 0, precision = 8, quiet = 0,
|
||||
pf = TJ.PF_BGR, yuvAlign = 1, restartIntervalBlocks = 0,
|
||||
optimize, progressive, arithmetic, lossless;
|
||||
private static int maxMemory = 0, maxPixels = 0, maxScans = 0, precision = 8,
|
||||
quiet = 0, pf = TJ.PF_BGR, yuvAlign = 1, restartIntervalBlocks = 0,
|
||||
restartIntervalRows = 0;
|
||||
private static boolean compOnly, decompOnly, doTile, doYUV, write = true;
|
||||
private static String ext = null;
|
||||
@@ -183,7 +183,7 @@ final class TJBench {
|
||||
tjd.set(TJ.PARAM_BOTTOMUP, bottomUp ? 1 : 0);
|
||||
tjd.set(TJ.PARAM_FASTUPSAMPLE, fastUpsample ? 1 : 0);
|
||||
tjd.set(TJ.PARAM_FASTDCT, fastDCT ? 1 : 0);
|
||||
tjd.set(TJ.PARAM_SCANLIMIT, limitScans ? 500 : 0);
|
||||
tjd.set(TJ.PARAM_SCANLIMIT, maxScans);
|
||||
tjd.set(TJ.PARAM_MAXMEMORY, maxMemory);
|
||||
tjd.set(TJ.PARAM_MAXPIXELS, maxPixels);
|
||||
|
||||
@@ -553,7 +553,7 @@ final class TJBench {
|
||||
tjt.set(TJ.PARAM_BOTTOMUP, bottomUp ? 1 : 0);
|
||||
tjt.set(TJ.PARAM_FASTUPSAMPLE, fastUpsample ? 1 : 0);
|
||||
tjt.set(TJ.PARAM_FASTDCT, fastDCT ? 1 : 0);
|
||||
tjt.set(TJ.PARAM_SCANLIMIT, limitScans ? 500 : 0);
|
||||
tjt.set(TJ.PARAM_SCANLIMIT, maxScans);
|
||||
tjt.set(TJ.PARAM_MAXMEMORY, maxMemory);
|
||||
tjt.set(TJ.PARAM_MAXPIXELS, maxPixels);
|
||||
|
||||
@@ -801,7 +801,7 @@ final class TJBench {
|
||||
System.out.println(" N sample rows (lossless) [default = 0 (no restart markers)]. Append 'B'");
|
||||
System.out.println(" to specify the restart marker interval in MCU blocks (lossy) or samples");
|
||||
System.out.println(" (lossless).");
|
||||
System.out.println("-stoponwarning = Immediately discontinue the current");
|
||||
System.out.println("-strict = Immediately discontinue the current");
|
||||
System.out.println(" compression/decompression/transform operation if a warning (non-fatal");
|
||||
System.out.println(" error) occurs");
|
||||
System.out.println("-tile = Compress/transform the input image into separate JPEG tiles of varying");
|
||||
@@ -814,6 +814,8 @@ final class TJBench {
|
||||
System.out.println("---------------------------------------");
|
||||
System.out.println("-arithmetic = Use arithmetic entropy coding in JPEG images generated by");
|
||||
System.out.println(" compression and transform operations (can be combined with -progressive)");
|
||||
System.out.println("-copynone = Do not copy any extra markers (including EXIF and ICC profile data)");
|
||||
System.out.println(" when transforming the input image");
|
||||
System.out.println("-crop WxH+X+Y = Decompress only the specified region of the JPEG image, where W");
|
||||
System.out.println(" and H are the width and height of the region (0 = maximum possible width");
|
||||
System.out.println(" or height) and X and Y are the left and upper boundary of the region, all");
|
||||
@@ -821,13 +823,18 @@ final class TJBench {
|
||||
System.out.println(" the scaled MCU width.");
|
||||
System.out.println("-fastdct = Use the fastest DCT/IDCT algorithm available");
|
||||
System.out.println("-fastupsample = Use the fastest chrominance upsampling algorithm available");
|
||||
System.out.println("-flip {horizontal|vertical}, -rotate {90|180|270}, -transpose, -transverse =");
|
||||
System.out.println(" Perform the specified lossless transform operation on the input image");
|
||||
System.out.println(" prior to decompression (these operations are mutually exclusive)");
|
||||
System.out.println("-grayscale = Transform the input image into a grayscale JPEG image prior to");
|
||||
System.out.println(" decompression (can be combined with the other transform operations above)");
|
||||
System.out.println("-maxscans N = Refuse to decompress or transform progressive JPEG images that");
|
||||
System.out.println(" have more than N scans");
|
||||
System.out.println("-optimize = Compute optimal Huffman tables for JPEG images generated by");
|
||||
System.out.println(" compession and transform operations");
|
||||
System.out.println("-progressive = Generate progressive JPEG images when compressing or");
|
||||
System.out.println(" transforming (can be combined with -arithmetic; implies -optimize unless");
|
||||
System.out.println(" -arithmetic is also specified)");
|
||||
System.out.println("-limitscans = Refuse to decompress or transform progressive JPEG images that");
|
||||
System.out.println(" have an unreasonably large number of scans");
|
||||
System.out.println("-scale M/N = When decompressing, scale the width/height of the JPEG image by a");
|
||||
System.out.print(" factor of M/N (M/N = ");
|
||||
for (i = 0; i < nsf; i++) {
|
||||
@@ -848,13 +855,6 @@ final class TJBench {
|
||||
System.out.println("-subsamp S = When compressing, use the specified level of chrominance");
|
||||
System.out.println(" subsampling (S = 444, 422, 440, 420, 411, 441, or GRAY) [default = test");
|
||||
System.out.println(" Grayscale, 4:2:0, 4:2:2, and 4:4:4 in sequence]");
|
||||
System.out.println("-hflip, -vflip, -transpose, -transverse, -rot90, -rot180, -rot270 =");
|
||||
System.out.println(" Perform the specified lossless transform operation on the input image");
|
||||
System.out.println(" prior to decompression (these operations are mutually exclusive)");
|
||||
System.out.println("-grayscale = Transform the input image into a grayscale JPEG image prior to");
|
||||
System.out.println(" decompression (can be combined with the other transform operations above)");
|
||||
System.out.println("-copynone = Do not copy any extra markers (including EXIF and ICC profile data)");
|
||||
System.out.println(" when transforming the input image");
|
||||
System.out.println("-yuv = Compress from/decompress to intermediate planar YUV images");
|
||||
System.out.println(" ** 8-bit data precision only **");
|
||||
System.out.println("-yuvpad N = The number of bytes by which each row in each plane of an");
|
||||
@@ -969,6 +969,14 @@ final class TJBench {
|
||||
} else if (matchArg(argv[i], "-fastupsample", 6)) {
|
||||
System.out.println("Using fastest upsampling algorithm\n");
|
||||
fastUpsample = true;
|
||||
} else if (matchArg(argv[i], "-flip", 2) && i < argv.length - 1) {
|
||||
i++;
|
||||
if (matchArg(argv[i], "horizontal", 1))
|
||||
xformOp = TJTransform.OP_HFLIP;
|
||||
else if (matchArg(argv[i], "vertical", 1))
|
||||
xformOp = TJTransform.OP_VFLIP;
|
||||
else
|
||||
usage();
|
||||
} else if (argv[i].equalsIgnoreCase("-gray"))
|
||||
pf = TJ.PF_GRAY;
|
||||
else if (matchArg(argv[i], "-grayscale", 2))
|
||||
@@ -976,7 +984,7 @@ final class TJBench {
|
||||
else if (matchArg(argv[i], "-hflip", 2))
|
||||
xformOp = TJTransform.OP_HFLIP;
|
||||
else if (matchArg(argv[i], "-limitscans", 3))
|
||||
limitScans = true;
|
||||
maxScans = 500;
|
||||
else if (matchArg(argv[i], "-lossless", 2)) {
|
||||
lossless = true;
|
||||
subsamp = TJ.SAMP_444;
|
||||
@@ -990,6 +998,16 @@ final class TJBench {
|
||||
if (temp < 0)
|
||||
usage();
|
||||
maxPixels = temp;
|
||||
} else if (matchArg(argv[i], "-maxscans", 5) &&
|
||||
i < argv.length - 1) {
|
||||
int temp = -1;
|
||||
|
||||
try {
|
||||
temp = Integer.parseInt(argv[++i]);
|
||||
} catch (NumberFormatException e) {}
|
||||
if (temp < 0)
|
||||
usage();
|
||||
maxScans = temp;
|
||||
} else if (matchArg(argv[i], "-maxmemory", 4) &&
|
||||
i < argv.length - 1) {
|
||||
int temp = -1;
|
||||
@@ -1036,7 +1054,17 @@ final class TJBench {
|
||||
xformOp = TJTransform.OP_ROT180;
|
||||
else if (argv[i].equalsIgnoreCase("-rot270"))
|
||||
xformOp = TJTransform.OP_ROT270;
|
||||
else if (matchArg(argv[i], "-restart", 2) && i < argv.length - 1) {
|
||||
else if (matchArg(argv[i], "-rotate", 3) && i < argv.length - 1) {
|
||||
i++;
|
||||
if (matchArg(argv[i], "90", 2))
|
||||
xformOp = TJTransform.OP_ROT90;
|
||||
else if (matchArg(argv[i], "180", 3))
|
||||
xformOp = TJTransform.OP_ROT180;
|
||||
else if (matchArg(argv[i], "270", 3))
|
||||
xformOp = TJTransform.OP_ROT270;
|
||||
else
|
||||
usage();
|
||||
} else if (matchArg(argv[i], "-restart", 2) && i < argv.length - 1) {
|
||||
int temp = -1;
|
||||
String arg = argv[++i];
|
||||
Scanner scanner = new Scanner(arg).useDelimiter("b|B");
|
||||
@@ -1051,7 +1079,8 @@ final class TJBench {
|
||||
restartIntervalBlocks = temp;
|
||||
else
|
||||
restartIntervalRows = temp;
|
||||
} else if (matchArg(argv[i], "-stoponwarning", 3))
|
||||
} else if (matchArg(argv[i], "-strict", 3) ||
|
||||
matchArg(argv[i], "-stoponwarning", 3))
|
||||
stopOnWarning = true;
|
||||
else if (matchArg(argv[i], "-subsamp", 3) && i < argv.length - 1) {
|
||||
i++;
|
||||
|
||||
Reference in New Issue
Block a user