diff options
author | Chris Liddell <chris.liddell@artifex.com> | 2018-03-27 16:26:13 +0100 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2018-03-29 13:44:03 +0100 |
commit | 25971c91d6433b0249d3b721b75ef704afe0a09c (patch) | |
tree | f4d198f921ffeaa89ed6c63190db1820401494dc /jpeg/jctrans.c | |
parent | d8a919d4b45097a527f6f39d509b920d285d709b (diff) | |
download | ghostpdl-25971c91d6433b0249d3b721b75ef704afe0a09c.tar.gz |
Update libjpeg to 9c
Plus re-applying:
Bug 697186: Workaround JPEG lib bug.
8dcec8cc076a0cf8350ca7a6ec1d3136812e2a24
Bug 697186: Tweak to previous JPEG fix.
dc62c90930512f4b571f68c9110022b234cbd411
Diffstat (limited to 'jpeg/jctrans.c')
-rw-r--r-- | jpeg/jctrans.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/jpeg/jctrans.c b/jpeg/jctrans.c index 7cd077e4f..5780de42e 100644 --- a/jpeg/jctrans.c +++ b/jpeg/jctrans.c @@ -2,7 +2,7 @@ * jctrans.c * * Copyright (C) 1995-1998, Thomas G. Lane. - * Modified 2000-2013 by Guido Vollbeding. + * Modified 2000-2017 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -85,12 +85,15 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo, jpeg_set_defaults(dstinfo); /* jpeg_set_defaults may choose wrong colorspace, eg YCbCr if input is RGB. * Fix it to get the right header markers for the image colorspace. - * Note: Entropy table assignment in jpeg_set_colorspace depends - * on color_transform. + * Note: Entropy table assignment in jpeg_set_colorspace + * depends on color_transform. + * Adaption is also required for setting the appropriate + * entropy coding mode dependent on image data precision. */ dstinfo->color_transform = srcinfo->color_transform; jpeg_set_colorspace(dstinfo, srcinfo->jpeg_color_space); dstinfo->data_precision = srcinfo->data_precision; + dstinfo->arith_code = srcinfo->data_precision > 8 ? TRUE : FALSE; dstinfo->CCIR601_sampling = srcinfo->CCIR601_sampling; /* Copy the source's quantization tables. */ for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) { @@ -157,6 +160,18 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo, } +LOCAL(void) +jpeg_calc_trans_dimensions (j_compress_ptr cinfo) +/* Do computations that are needed before master selection phase */ +{ + if (cinfo->min_DCT_h_scaled_size != cinfo->min_DCT_v_scaled_size) + ERREXIT2(cinfo, JERR_BAD_DCTSIZE, + cinfo->min_DCT_h_scaled_size, cinfo->min_DCT_v_scaled_size); + + cinfo->block_size = cinfo->min_DCT_h_scaled_size; +} + + /* * Master selection of compression modules for transcoding. * This substitutes for jcinit.c's initialization of the full compressor. @@ -166,6 +181,9 @@ LOCAL(void) transencode_master_selection (j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays) { + /* Do computations that are needed before master selection phase */ + jpeg_calc_trans_dimensions(cinfo); + /* Initialize master control (includes parameter checking/processing) */ jinit_c_master_control(cinfo, TRUE /* transcode only */); |