TJComp: Explicitly specify data precision

This is just a code readability thing.  The logic effectively caused the
data precision to default to 8 if -precision was not specified, but that
was not obvious.

This commit also modifies tjcomptest so that it tests TJComp with no
-precision argument, to ensure that the data precision defaults to 8.
This commit is contained in:
DRC
2024-09-23 15:18:53 -04:00
parent ad9c02c6f5
commit 1b1356a565
3 changed files with 32 additions and 29 deletions

View File

@@ -145,7 +145,7 @@ final class TJComp {
int i;
int arithmetic = -1, colorspace = -1, fastDCT = -1, losslessPSV = -1,
losslessPt = -1, maxMemory = -1, optimize = -1,
pixelFormat = TJ.PF_UNKNOWN, precision = -1, progressive = -1,
pixelFormat = TJ.PF_UNKNOWN, precision = 8, progressive = -1,
quality = DEFAULT_QUALITY, restartIntervalBlocks = -1,
restartIntervalRows = -1, subsamp = DEFAULT_SUBSAMP;
String iccFilename = null;
@@ -247,16 +247,14 @@ final class TJComp {
if (i != argv.length - 2)
usage();
if (losslessPSV == -1 && precision != -1 && precision != 8 &&
precision != 12)
if (losslessPSV == -1 && precision != 8 && precision != 12)
usage();
tjc = new TJCompressor();
tjc.set(TJ.PARAM_QUALITY, quality);
tjc.set(TJ.PARAM_SUBSAMP, subsamp);
if (precision >= 0)
tjc.set(TJ.PARAM_PRECISION, precision);
tjc.set(TJ.PARAM_PRECISION, precision);
if (fastDCT >= 0)
tjc.set(TJ.PARAM_FASTDCT, fastDCT);
if (optimize >= 0)