Fix issue with jpegtran and RGB/CMYK colorspaces

Fixes issues #23 #24 #31
Note that the original jpgcrush script optimizes scans only for YCbCr
and grayscale color spaces. Scan optimization is thus disabled for RGB
and CMYK color spaces and behavior reverts to the fast mode of jpgcrush
which uses predefined scans
This commit is contained in:
Frank Bossen
2014-03-27 11:57:22 +01:00
parent 7b66e2fa25
commit 2906cbf6ed

View File

@@ -38,6 +38,10 @@ LOCAL(void) transencode_coef_controller
GLOBAL(void)
jpeg_write_coefficients (j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays)
{
/* setting up scan optimisation pattern failed, disable scan optimisation */
if (cinfo->num_scans_luma == 0)
cinfo->optimize_scans = FALSE;
if (cinfo->global_state != CSTATE_START)
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
/* Mark all tables to be written */