Fix build if UPSAMPLE_MERGING_SUPPORTED undefined
Although it is uncommon, some downstream implementations undefine one or more of the *_SUPPORTED macros in jmorecfg.h in order to reduce the size of the library. In the interest of maintaining backward compatibility with libjpeg, this is still a supported use case. Regression introduced by9120a24743Based on:74c4d032f0Closes #601
This commit is contained in:
@@ -159,7 +159,9 @@ jpeg_crop_scanline(j_decompress_ptr cinfo, JDIMENSION *xoffset,
|
|||||||
JDIMENSION input_xoffset;
|
JDIMENSION input_xoffset;
|
||||||
boolean reinit_upsampler = FALSE;
|
boolean reinit_upsampler = FALSE;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
|
#ifdef UPSAMPLE_MERGING_SUPPORTED
|
||||||
my_master_ptr master = (my_master_ptr)cinfo->master;
|
my_master_ptr master = (my_master_ptr)cinfo->master;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (cinfo->global_state != DSTATE_SCANNING || cinfo->output_scanline != 0)
|
if (cinfo->global_state != DSTATE_SCANNING || cinfo->output_scanline != 0)
|
||||||
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
||||||
@@ -209,11 +211,13 @@ jpeg_crop_scanline(j_decompress_ptr cinfo, JDIMENSION *xoffset,
|
|||||||
*/
|
*/
|
||||||
*width = *width + input_xoffset - *xoffset;
|
*width = *width + input_xoffset - *xoffset;
|
||||||
cinfo->output_width = *width;
|
cinfo->output_width = *width;
|
||||||
|
#ifdef UPSAMPLE_MERGING_SUPPORTED
|
||||||
if (master->using_merged_upsample && cinfo->max_v_samp_factor == 2) {
|
if (master->using_merged_upsample && cinfo->max_v_samp_factor == 2) {
|
||||||
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||||
upsample->out_row_width =
|
upsample->out_row_width =
|
||||||
cinfo->output_width * cinfo->out_color_components;
|
cinfo->output_width * cinfo->out_color_components;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Set the first and last iMCU columns that we must decompress. These values
|
/* Set the first and last iMCU columns that we must decompress. These values
|
||||||
* will be used in single-scan decompressions.
|
* will be used in single-scan decompressions.
|
||||||
@@ -324,7 +328,9 @@ LOCAL(void)
|
|||||||
read_and_discard_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
read_and_discard_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
||||||
{
|
{
|
||||||
JDIMENSION n;
|
JDIMENSION n;
|
||||||
|
#ifdef UPSAMPLE_MERGING_SUPPORTED
|
||||||
my_master_ptr master = (my_master_ptr)cinfo->master;
|
my_master_ptr master = (my_master_ptr)cinfo->master;
|
||||||
|
#endif
|
||||||
JSAMPLE dummy_sample[1] = { 0 };
|
JSAMPLE dummy_sample[1] = { 0 };
|
||||||
JSAMPROW dummy_row = dummy_sample;
|
JSAMPROW dummy_row = dummy_sample;
|
||||||
JSAMPARRAY scanlines = NULL;
|
JSAMPARRAY scanlines = NULL;
|
||||||
@@ -348,10 +354,12 @@ read_and_discard_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
|||||||
cinfo->cquantize->color_quantize = noop_quantize;
|
cinfo->cquantize->color_quantize = noop_quantize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef UPSAMPLE_MERGING_SUPPORTED
|
||||||
if (master->using_merged_upsample && cinfo->max_v_samp_factor == 2) {
|
if (master->using_merged_upsample && cinfo->max_v_samp_factor == 2) {
|
||||||
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||||
scanlines = &upsample->spare_row;
|
scanlines = &upsample->spare_row;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
for (n = 0; n < num_lines; n++)
|
for (n = 0; n < num_lines; n++)
|
||||||
jpeg_read_scanlines(cinfo, scanlines, 1);
|
jpeg_read_scanlines(cinfo, scanlines, 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user