TJBench: More argument consistification

-copynone --> -copy none

Add '-copy all', even though it's the default.

-rgb, -bgr, -rgbx, -bgrx, -xbgr, -xrgb, -gray, -cmyk -->
-pixelformat {rgb|bgr|rgbx|bgrx|xbgr|xrgb|gray|cmyk}
(This is mainly so -gray won't interfere with -grayscale.)

Fix an ArrayIndexOutOfBoundsException that occurred when passing -dct
to the Java version without specifying the DCT algorithm (oversight from
24fbf64d31a0758c63bcc27cf5d92fc5611717d0.)
This commit is contained in:
DRC
2024-09-04 12:06:42 -04:00
parent d43ed7a1ff
commit e4c67aff50
4 changed files with 101 additions and 45 deletions

View File

@@ -797,10 +797,10 @@ final class TJBench {
System.out.println("-nowrite");
System.out.println(" Do not write reference or output images (improves consistency of benchmark");
System.out.println(" results)");
System.out.println("-rgb, -bgr, -rgbx, -bgrx, -xbgr, -xrgb, -gray");
System.out.println("-pixelformat {rgb|bgr|rgbx|bgrx|xbgr|xrgb|gray}");
System.out.println(" Use the specified pixel format for packed-pixel source/destination buffers");
System.out.println(" [default = BGR]");
System.out.println("-cmyk");
System.out.println("-pixelformat cmyk");
System.out.println(" Indirectly test YCCK JPEG compression/decompression (use the CMYK pixel");
System.out.println(" format for packed-pixel source/destination buffers)");
System.out.println("-precision N");
@@ -829,9 +829,11 @@ final class TJBench {
System.out.println("-arithmetic");
System.out.println(" Use arithmetic entropy coding in JPEG images generated by compression and");
System.out.println(" transform operations (can be combined with -progressive)");
System.out.println("-copynone");
System.out.println(" Do not copy any extra markers (including Exif and ICC profile data) when");
System.out.println(" transforming the input image");
System.out.println("-copy all");
System.out.println(" Copy all extra markers (including comments, JFIF thumbnails, Exif data, and");
System.out.println(" ICC profile data) when transforming the input image [default]");
System.out.println("-copy none");
System.out.println(" Do not copy any extra markers when transforming the input image");
System.out.println("-crop WxH+X+Y");
System.out.println(" Decompress only the specified region of the JPEG image, where W and H are");
System.out.println(" the width and height of the region (0 = maximum possible width or height)");
@@ -973,7 +975,7 @@ final class TJBench {
pf = TJ.PF_CMYK;
else if (matchArg(argv[i], "-componly", 4))
compOnly = true;
else if (matchArg(argv[i], "-copynone", 4))
else if (matchArg(argv[i], "-copynone", 6))
xformOpt |= TJTransform.OPT_COPYNONE;
else if (matchArg(argv[i], "-crop", 3) && i < argv.length - 1) {
int temp1 = -1, temp2 = -1, temp3 = -1, temp4 = -1;
@@ -991,7 +993,13 @@ final class TJBench {
cr.width = temp1; cr.height = temp2; cr.x = temp3; cr.y = temp4;
} else if (matchArg(argv[i], "-custom", 3))
customFilter = new DummyDCTFilter();
else if (matchArg(argv[i], "-dct", 2)) {
else if (matchArg(argv[i], "-copy", 2)) {
i++;
if (matchArg(argv[i], "none", 1))
xformOpt |= TJTransform.OPT_COPYNONE;
else if (!matchArg(argv[i], "all", 1))
usage();
} else if (matchArg(argv[i], "-dct", 2) && i < argv.length - 1) {
i++;
if (matchArg(argv[i], "fast", 1)) {
System.out.println("Using less accurate DCT/IDCT algorithm\n");
@@ -1012,11 +1020,8 @@ final class TJBench {
xformOp = TJTransform.OP_VFLIP;
else
usage();
} else if (argv[i].equalsIgnoreCase("-gray") ||
argv[i].equalsIgnoreCase("-grey"))
pf = TJ.PF_GRAY;
else if (matchArg(argv[i], "-grayscale", 2) ||
matchArg(argv[i], "-greyscale", 2))
} else if (matchArg(argv[i], "-grayscale", 2) ||
matchArg(argv[i], "-greyscale", 2))
xformOpt |= TJTransform.OPT_GRAY;
else if (matchArg(argv[i], "-hflip", 2))
xformOp = TJTransform.OP_HFLIP;
@@ -1064,6 +1069,28 @@ final class TJBench {
matchArg(argv[i], "-optimise", 2)) {
optimize = true;
xformOpt |= TJTransform.OPT_OPTIMIZE;
} else if (matchArg(argv[i], "-pixelformat", 3) &&
i < argv.length - 1) {
i++;
if (argv[i].equalsIgnoreCase("bgr"))
pf = TJ.PF_BGR;
else if (argv[i].equalsIgnoreCase("bgrx"))
pf = TJ.PF_BGRX;
else if (matchArg(argv[i], "cmyk", 1))
pf = TJ.PF_CMYK;
else if (matchArg(argv[i], "gray", 1) ||
matchArg(argv[i], "grey", 1))
pf = TJ.PF_GRAY;
else if (argv[i].equalsIgnoreCase("rgb"))
pf = TJ.PF_RGB;
else if (argv[i].equalsIgnoreCase("rgbx"))
pf = TJ.PF_RGBX;
else if (argv[i].equalsIgnoreCase("xbgr"))
pf = TJ.PF_XBGR;
else if (argv[i].equalsIgnoreCase("xrgb"))
pf = TJ.PF_XRGB;
else
usage();
} else if (matchArg(argv[i], "-precision", 4) &&
i < argv.length - 1) {
int temp = 0;