TJBench: Don't override subsamp until args parsed
Otherwise, passing -subsamp after -lossless might cause the worst-case JPEG buffer size to be too small.
This commit is contained in:
@@ -936,10 +936,9 @@ final class TJBench {
|
||||
System.out.println("Using arithmetic entropy coding\n");
|
||||
arithmetic = true;
|
||||
xformOpt |= TJTransform.OPT_ARITHMETIC;
|
||||
} else if (argv[i].equalsIgnoreCase("-lossless")) {
|
||||
} else if (argv[i].equalsIgnoreCase("-lossless"))
|
||||
lossless = true;
|
||||
subsamp = TJ.SAMP_444;
|
||||
} else if (argv[i].equalsIgnoreCase("-rgb"))
|
||||
else if (argv[i].equalsIgnoreCase("-rgb"))
|
||||
pf = TJ.PF_RGB;
|
||||
else if (argv[i].equalsIgnoreCase("-rgbx"))
|
||||
pf = TJ.PF_RGBX;
|
||||
@@ -1130,6 +1129,9 @@ final class TJBench {
|
||||
precision != 12)
|
||||
System.out.println("Computing optimal Huffman tables\n");
|
||||
|
||||
if (lossless)
|
||||
subsamp = TJ.SAMP_444;
|
||||
|
||||
if (precision == 16 && !lossless)
|
||||
throw new Exception("-lossless must be specified along with -precision 16");
|
||||
if (precision != 8 && doYUV)
|
||||
|
||||
@@ -1057,10 +1057,9 @@ int main(int argc, char *argv[])
|
||||
printf("Using arithmetic entropy coding\n\n");
|
||||
arithmetic = 1;
|
||||
xformOpt |= TJXOPT_ARITHMETIC;
|
||||
} else if (!strcasecmp(argv[i], "-lossless")) {
|
||||
} else if (!strcasecmp(argv[i], "-lossless"))
|
||||
lossless = 1;
|
||||
subsamp = TJSAMP_444;
|
||||
} else if (!strcasecmp(argv[i], "-rgb"))
|
||||
else if (!strcasecmp(argv[i], "-rgb"))
|
||||
pf = TJPF_RGB;
|
||||
else if (!strcasecmp(argv[i], "-rgbx"))
|
||||
pf = TJPF_RGBX;
|
||||
@@ -1200,6 +1199,9 @@ int main(int argc, char *argv[])
|
||||
if (optimize && !progressive && !arithmetic && !lossless && precision != 12)
|
||||
printf("Computing optimal Huffman tables\n\n");
|
||||
|
||||
if (lossless)
|
||||
subsamp = TJSAMP_444;
|
||||
|
||||
if (precision == 16 && !lossless) {
|
||||
printf("ERROR: -lossless must be specified along with -precision 16\n");
|
||||
retval = -1; goto bailout;
|
||||
|
||||
Reference in New Issue
Block a user