Maintain DC_SCAN_OPT_MODE if subsampling is > 2. Fixes #1129 (#1130)

This commit is contained in:
Jake Archibald
2021-08-26 14:29:13 +01:00
committed by GitHub
parent 6e427f9208
commit a547491146
3 changed files with 5 additions and 0 deletions

View File

@ -158,6 +158,11 @@ val encode(std::string image_in, int image_width, int image_height, MozJpegOptio
if (!opts.auto_subsample && opts.color_space == JCS_YCbCr) {
cinfo.comp_info[0].h_samp_factor = opts.chroma_subsample;
cinfo.comp_info[0].v_samp_factor = opts.chroma_subsample;
if (opts.chroma_subsample > 2) {
// Otherwise encoding fails.
jpeg_c_set_int_param(&cinfo, JINT_DC_SCAN_OPT_MODE, 1);
}
}
if (!opts.baseline && opts.progressive) {

Binary file not shown.