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:
@@ -19,6 +19,11 @@ prefetching caused a segfault if the `fill_input_buffer()` method in the
|
|||||||
calling application's custom source manager incorrectly returned `FALSE` in
|
calling application's custom source manager incorrectly returned `FALSE` in
|
||||||
response to a prematurely-terminated JPEG data stream.
|
response to a prematurely-terminated JPEG data stream.
|
||||||
|
|
||||||
|
3. Fixed an issue in cjpeg whereby, when generating a 12-bit-per-sample or
|
||||||
|
16-bit-per-sample lossless JPEG image, specifying a point transform value
|
||||||
|
greater than 7 resulted in an error ("Invalid progressive/lossless parameters")
|
||||||
|
unless the `-precision` option was specified before the `-lossless` option.
|
||||||
|
|
||||||
|
|
||||||
3.0.3
|
3.0.3
|
||||||
=====
|
=====
|
||||||
|
|||||||
10
cjpeg.c
10
cjpeg.c
@@ -290,7 +290,7 @@ parse_switches(j_compress_ptr cinfo, int argc, char **argv,
|
|||||||
int argn;
|
int argn;
|
||||||
char *arg;
|
char *arg;
|
||||||
#ifdef C_LOSSLESS_SUPPORTED
|
#ifdef C_LOSSLESS_SUPPORTED
|
||||||
int psv, pt = 0;
|
int psv = 0, pt = 0;
|
||||||
#endif
|
#endif
|
||||||
boolean force_baseline;
|
boolean force_baseline;
|
||||||
boolean simple_progressive;
|
boolean simple_progressive;
|
||||||
@@ -403,7 +403,8 @@ parse_switches(j_compress_ptr cinfo, int argc, char **argv,
|
|||||||
string */
|
string */
|
||||||
if (*ptr)
|
if (*ptr)
|
||||||
sscanf(ptr, "%d", &pt);
|
sscanf(ptr, "%d", &pt);
|
||||||
jpeg_enable_lossless(cinfo, psv, pt);
|
|
||||||
|
/* We must postpone execution until data_precision is known. */
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, "%s: sorry, lossless output was not compiled\n",
|
fprintf(stderr, "%s: sorry, lossless output was not compiled\n",
|
||||||
progname);
|
progname);
|
||||||
@@ -589,6 +590,11 @@ parse_switches(j_compress_ptr cinfo, int argc, char **argv,
|
|||||||
jpeg_simple_progression(cinfo);
|
jpeg_simple_progression(cinfo);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef C_LOSSLESS_SUPPORTED
|
||||||
|
if (psv != 0) /* process -lossless */
|
||||||
|
jpeg_enable_lossless(cinfo, psv, pt);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef C_MULTISCAN_FILES_SUPPORTED
|
#ifdef C_MULTISCAN_FILES_SUPPORTED
|
||||||
if (scansarg != NULL) /* process -scans if it was present */
|
if (scansarg != NULL) /* process -scans if it was present */
|
||||||
if (!read_scan_script(cinfo, scansarg))
|
if (!read_scan_script(cinfo, scansarg))
|
||||||
|
|||||||
Reference in New Issue
Block a user