cjpeg: Don't enable lossless until precision known
jpeg_enable_lossless() checks the point transform value against the data precision, so we need to defer calling jpeg_enable_lossless() until after all command-line options have been parsed.
This commit is contained in:
10
cjpeg.c
10
cjpeg.c
@@ -290,7 +290,7 @@ parse_switches(j_compress_ptr cinfo, int argc, char **argv,
|
||||
int argn;
|
||||
char *arg;
|
||||
#ifdef C_LOSSLESS_SUPPORTED
|
||||
int psv, pt = 0;
|
||||
int psv = 0, pt = 0;
|
||||
#endif
|
||||
boolean force_baseline;
|
||||
boolean simple_progressive;
|
||||
@@ -403,7 +403,8 @@ parse_switches(j_compress_ptr cinfo, int argc, char **argv,
|
||||
string */
|
||||
if (*ptr)
|
||||
sscanf(ptr, "%d", &pt);
|
||||
jpeg_enable_lossless(cinfo, psv, pt);
|
||||
|
||||
/* We must postpone execution until data_precision is known. */
|
||||
#else
|
||||
fprintf(stderr, "%s: sorry, lossless output was not compiled\n",
|
||||
progname);
|
||||
@@ -589,6 +590,11 @@ parse_switches(j_compress_ptr cinfo, int argc, char **argv,
|
||||
jpeg_simple_progression(cinfo);
|
||||
#endif
|
||||
|
||||
#ifdef C_LOSSLESS_SUPPORTED
|
||||
if (psv != 0) /* process -lossless */
|
||||
jpeg_enable_lossless(cinfo, psv, pt);
|
||||
#endif
|
||||
|
||||
#ifdef C_MULTISCAN_FILES_SUPPORTED
|
||||
if (scansarg != NULL) /* process -scans if it was present */
|
||||
if (!read_scan_script(cinfo, scansarg))
|
||||
|
||||
Reference in New Issue
Block a user