Don't allow 12-bit JPEG support to be disabled
In libjpeg-turbo 2.1.x and prior, the WITH_12BIT CMake variable was used to enable 12-bit JPEG support at compile time, because the libjpeg API library could not handle multiple JPEG data precisions at run time. The initial approach to handling multiple JPEG data precisions at run time (7fec5074f9) created a whole new API, library, and applications for 12-bit data precision, so it made sense to repurpose WITH_12BIT to allow 12-bit data precision to be disabled.e8b40f3c2bmade it so that the libjpeg API library can handle multiple JPEG data precisions at run time via a handful of straightforward API extensions. Referring to6c2bc901e2, it hasn't been possible to build libjpeg-turbo with both forward and backward libjpeg API/ABI compatibility since libjpeg-turbo 1.4.x. Thus, whereas we retain full backward API/ABI compatibility with libjpeg v6b-v8, forward libjpeg API/ABI compatibility ceased being realistic years ago, so it no longer makes sense to provide compile-time options that give a false sense of forward API/ABI compatibility by allowing some (but not all) of our libjpeg API extensions to be disabled. Such options are difficult to maintain and clutter the code with #ifdefs.
This commit is contained in:
21
djpeg.c
21
djpeg.c
@@ -660,11 +660,9 @@ main(int argc, char **argv)
|
||||
#endif
|
||||
#ifdef GIF_SUPPORTED
|
||||
case FMT_GIF:
|
||||
#ifdef WITH_12BIT
|
||||
if (cinfo.data_precision == 12)
|
||||
dest_mgr = j12init_write_gif(&cinfo, TRUE);
|
||||
else
|
||||
#endif
|
||||
dest_mgr = jinit_write_gif(&cinfo, TRUE);
|
||||
break;
|
||||
case FMT_GIF0:
|
||||
@@ -673,11 +671,9 @@ main(int argc, char **argv)
|
||||
#endif
|
||||
#ifdef PPM_SUPPORTED
|
||||
case FMT_PPM:
|
||||
#ifdef WITH_12BIT
|
||||
if (cinfo.data_precision == 12)
|
||||
dest_mgr = j12init_write_ppm(&cinfo);
|
||||
else
|
||||
#endif
|
||||
dest_mgr = jinit_write_ppm(&cinfo);
|
||||
break;
|
||||
#endif
|
||||
@@ -717,7 +713,6 @@ main(int argc, char **argv)
|
||||
(*dest_mgr->start_output) (&cinfo, dest_mgr);
|
||||
cinfo.output_height = tmp;
|
||||
|
||||
#ifdef WITH_12BIT
|
||||
if (cinfo.data_precision == 12) {
|
||||
/* Process data */
|
||||
while (cinfo.output_scanline < skip_start) {
|
||||
@@ -736,9 +731,7 @@ main(int argc, char **argv)
|
||||
dest_mgr->buffer_height);
|
||||
(*dest_mgr->put_pixel_rows) (&cinfo, dest_mgr, num_scanlines);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
} else {
|
||||
/* Process data */
|
||||
while (cinfo.output_scanline < skip_start) {
|
||||
num_scanlines = jpeg_read_scanlines(&cinfo, dest_mgr->buffer,
|
||||
@@ -772,11 +765,9 @@ main(int argc, char **argv)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
#ifdef WITH_12BIT
|
||||
if (cinfo.data_precision == 12)
|
||||
jpeg12_crop_scanline(&cinfo, &crop_x, &crop_width);
|
||||
else
|
||||
#endif
|
||||
jpeg_crop_scanline(&cinfo, &crop_x, &crop_width);
|
||||
if (dest_mgr->calc_buffer_dimensions)
|
||||
(*dest_mgr->calc_buffer_dimensions) (&cinfo, dest_mgr);
|
||||
@@ -791,7 +782,6 @@ main(int argc, char **argv)
|
||||
(*dest_mgr->start_output) (&cinfo, dest_mgr);
|
||||
cinfo.output_height = tmp;
|
||||
|
||||
#ifdef WITH_12BIT
|
||||
if (cinfo.data_precision == 12) {
|
||||
/* Process data */
|
||||
if ((tmp = jpeg12_skip_scanlines(&cinfo, crop_y)) != crop_y) {
|
||||
@@ -812,9 +802,7 @@ main(int argc, char **argv)
|
||||
progname, tmp, cinfo.output_height - crop_y - crop_height);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
} else {
|
||||
/* Process data */
|
||||
if ((tmp = jpeg_skip_scanlines(&cinfo, crop_y)) != crop_y) {
|
||||
fprintf(stderr, "%s: jpeg_skip_scanlines() returned %u rather than %u\n",
|
||||
@@ -841,7 +829,6 @@ main(int argc, char **argv)
|
||||
/* Write output file header */
|
||||
(*dest_mgr->start_output) (&cinfo, dest_mgr);
|
||||
|
||||
#ifdef WITH_12BIT
|
||||
if (cinfo.data_precision == 12) {
|
||||
/* Process data */
|
||||
while (cinfo.output_scanline < cinfo.output_height) {
|
||||
@@ -849,9 +836,7 @@ main(int argc, char **argv)
|
||||
dest_mgr->buffer_height);
|
||||
(*dest_mgr->put_pixel_rows) (&cinfo, dest_mgr, num_scanlines);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
} else {
|
||||
/* Process data */
|
||||
while (cinfo.output_scanline < cinfo.output_height) {
|
||||
num_scanlines = jpeg_read_scanlines(&cinfo, dest_mgr->buffer,
|
||||
|
||||
Reference in New Issue
Block a user