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");
|
System.out.println("Using arithmetic entropy coding\n");
|
||||||
arithmetic = true;
|
arithmetic = true;
|
||||||
xformOpt |= TJTransform.OPT_ARITHMETIC;
|
xformOpt |= TJTransform.OPT_ARITHMETIC;
|
||||||
} else if (argv[i].equalsIgnoreCase("-lossless")) {
|
} else if (argv[i].equalsIgnoreCase("-lossless"))
|
||||||
lossless = true;
|
lossless = true;
|
||||||
subsamp = TJ.SAMP_444;
|
else if (argv[i].equalsIgnoreCase("-rgb"))
|
||||||
} else if (argv[i].equalsIgnoreCase("-rgb"))
|
|
||||||
pf = TJ.PF_RGB;
|
pf = TJ.PF_RGB;
|
||||||
else if (argv[i].equalsIgnoreCase("-rgbx"))
|
else if (argv[i].equalsIgnoreCase("-rgbx"))
|
||||||
pf = TJ.PF_RGBX;
|
pf = TJ.PF_RGBX;
|
||||||
@@ -1130,6 +1129,9 @@ final class TJBench {
|
|||||||
precision != 12)
|
precision != 12)
|
||||||
System.out.println("Computing optimal Huffman tables\n");
|
System.out.println("Computing optimal Huffman tables\n");
|
||||||
|
|
||||||
|
if (lossless)
|
||||||
|
subsamp = TJ.SAMP_444;
|
||||||
|
|
||||||
if (precision == 16 && !lossless)
|
if (precision == 16 && !lossless)
|
||||||
throw new Exception("-lossless must be specified along with -precision 16");
|
throw new Exception("-lossless must be specified along with -precision 16");
|
||||||
if (precision != 8 && doYUV)
|
if (precision != 8 && doYUV)
|
||||||
|
|||||||
@@ -1057,10 +1057,9 @@ int main(int argc, char *argv[])
|
|||||||
printf("Using arithmetic entropy coding\n\n");
|
printf("Using arithmetic entropy coding\n\n");
|
||||||
arithmetic = 1;
|
arithmetic = 1;
|
||||||
xformOpt |= TJXOPT_ARITHMETIC;
|
xformOpt |= TJXOPT_ARITHMETIC;
|
||||||
} else if (!strcasecmp(argv[i], "-lossless")) {
|
} else if (!strcasecmp(argv[i], "-lossless"))
|
||||||
lossless = 1;
|
lossless = 1;
|
||||||
subsamp = TJSAMP_444;
|
else if (!strcasecmp(argv[i], "-rgb"))
|
||||||
} else if (!strcasecmp(argv[i], "-rgb"))
|
|
||||||
pf = TJPF_RGB;
|
pf = TJPF_RGB;
|
||||||
else if (!strcasecmp(argv[i], "-rgbx"))
|
else if (!strcasecmp(argv[i], "-rgbx"))
|
||||||
pf = TJPF_RGBX;
|
pf = TJPF_RGBX;
|
||||||
@@ -1200,6 +1199,9 @@ int main(int argc, char *argv[])
|
|||||||
if (optimize && !progressive && !arithmetic && !lossless && precision != 12)
|
if (optimize && !progressive && !arithmetic && !lossless && precision != 12)
|
||||||
printf("Computing optimal Huffman tables\n\n");
|
printf("Computing optimal Huffman tables\n\n");
|
||||||
|
|
||||||
|
if (lossless)
|
||||||
|
subsamp = TJSAMP_444;
|
||||||
|
|
||||||
if (precision == 16 && !lossless) {
|
if (precision == 16 && !lossless) {
|
||||||
printf("ERROR: -lossless must be specified along with -precision 16\n");
|
printf("ERROR: -lossless must be specified along with -precision 16\n");
|
||||||
retval = -1; goto bailout;
|
retval = -1; goto bailout;
|
||||||
|
|||||||
Reference in New Issue
Block a user