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:
9
cjpeg.c
9
cjpeg.c
@@ -103,20 +103,16 @@ select_file_type(j_compress_ptr cinfo, FILE *infile)
|
||||
#endif
|
||||
#ifdef GIF_SUPPORTED
|
||||
case 'G':
|
||||
#ifdef WITH_12BIT
|
||||
if (cinfo->data_precision == 12)
|
||||
return j12init_read_gif(cinfo);
|
||||
else
|
||||
#endif
|
||||
return jinit_read_gif(cinfo);
|
||||
#endif
|
||||
#ifdef PPM_SUPPORTED
|
||||
case 'P':
|
||||
#ifdef WITH_12BIT
|
||||
if (cinfo->data_precision == 12)
|
||||
return j12init_read_ppm(cinfo);
|
||||
else
|
||||
#endif
|
||||
return jinit_read_ppm(cinfo);
|
||||
#endif
|
||||
#ifdef TARGA_SUPPORTED
|
||||
@@ -743,15 +739,12 @@ main(int argc, char **argv)
|
||||
jpeg_write_icc_profile(&cinfo, icc_profile, (unsigned int)icc_len);
|
||||
|
||||
/* Process data */
|
||||
#ifdef WITH_12BIT
|
||||
if (cinfo.data_precision == 12) {
|
||||
while (cinfo.next_scanline < cinfo.image_height) {
|
||||
num_scanlines = (*src_mgr->get_pixel_rows) (&cinfo, src_mgr);
|
||||
(void)jpeg12_write_scanlines(&cinfo, src_mgr->buffer12, num_scanlines);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
} else {
|
||||
while (cinfo.next_scanline < cinfo.image_height) {
|
||||
num_scanlines = (*src_mgr->get_pixel_rows) (&cinfo, src_mgr);
|
||||
(void)jpeg_write_scanlines(&cinfo, src_mgr->buffer, num_scanlines);
|
||||
|
||||
Reference in New Issue
Block a user