From f3dbe98dca58731ff98dff3cc9111a8252f8e1e6 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Wed, 23 Oct 2019 16:30:29 +0200 Subject: Update bundled libjpeg-turbo to version 2.0.3 [ChangeLog][Third-Party Code] libjpeg-turbo was updated to version 2.0.3 Task-number: QTBUG-79420 Change-Id: I9f9b8b3a913fd5843759c0610f43b22c5bee67dc Reviewed-by: Allan Sandfeld Jensen --- src/3rdparty/libjpeg/jconfig.h | 2 +- src/3rdparty/libjpeg/jconfigint.h | 2 +- src/3rdparty/libjpeg/qt_attribution.json | 2 +- src/3rdparty/libjpeg/src/ChangeLog.md | 38 ++++++++++++++++++++++++++++++++ src/3rdparty/libjpeg/src/README.md | 28 +++++++++++++++-------- src/3rdparty/libjpeg/src/jchuff.c | 6 ++++- src/3rdparty/libjpeg/src/jcmaster.c | 2 +- src/3rdparty/libjpeg/src/jdhuff.c | 10 ++++++--- src/3rdparty/libjpeg/src/jdmerge.c | 2 -- src/3rdparty/libjpeg/src/jdsample.c | 14 +++++++----- 10 files changed, 82 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/3rdparty/libjpeg/jconfig.h b/src/3rdparty/libjpeg/jconfig.h index 3f6a7f6b3c..fb1e88ae29 100644 --- a/src/3rdparty/libjpeg/jconfig.h +++ b/src/3rdparty/libjpeg/jconfig.h @@ -2,7 +2,7 @@ #define JPEG_LIB_VERSION 80 -#define LIBJPEG_TURBO_VERSION 2.0.2 +#define LIBJPEG_TURBO_VERSION 2.0.3 #define LIBJPEG_TURBO_VERSION_NUMBER 2000002 diff --git a/src/3rdparty/libjpeg/jconfigint.h b/src/3rdparty/libjpeg/jconfigint.h index c3549bfd25..6616918509 100644 --- a/src/3rdparty/libjpeg/jconfigint.h +++ b/src/3rdparty/libjpeg/jconfigint.h @@ -8,7 +8,7 @@ #define PACKAGE_NAME "libjpeg-turbo" -#define VERSION "2.0.0" +#define VERSION "2.0.3" #if SIZE_MAX == 0xffffffff #define SIZEOF_SIZE_T 4 diff --git a/src/3rdparty/libjpeg/qt_attribution.json b/src/3rdparty/libjpeg/qt_attribution.json index d1497bc20f..fa81529968 100644 --- a/src/3rdparty/libjpeg/qt_attribution.json +++ b/src/3rdparty/libjpeg/qt_attribution.json @@ -6,7 +6,7 @@ "Description": "The Independent JPEG Group's JPEG software", "Homepage": "http://libjpeg-turbo.virtualgl.org/", - "Version": "2.0.2", + "Version": "2.0.3", "License": "Independent JPEG Group License", "LicenseId": "IJG", "LicenseFile": "LICENSE", diff --git a/src/3rdparty/libjpeg/src/ChangeLog.md b/src/3rdparty/libjpeg/src/ChangeLog.md index 7cf92c30fd..3667d120b1 100644 --- a/src/3rdparty/libjpeg/src/ChangeLog.md +++ b/src/3rdparty/libjpeg/src/ChangeLog.md @@ -1,3 +1,41 @@ +2.0.3 +===== + +### Significant changes relative to 2.0.2: + +1. Fixed "using JNI after critical get" errors that occurred on Android +platforms when passing invalid arguments to certain methods in the TurboJPEG +Java API. + +2. Fixed a regression in the SIMD feature detection code, introduced by +the AVX2 SIMD extensions (2.0 beta1[1]), that was known to cause an illegal +instruction exception, in rare cases, on CPUs that lack support for CPUID leaf +07H (or on which the maximum CPUID leaf has been limited by way of a BIOS +setting.) + +3. The 4:4:0 (h1v2) fancy (smooth) chroma upsampling algorithm in the +decompressor now uses a similar bias pattern to that of the 4:2:2 (h2v1) fancy +chroma upsampling algorithm, rounding up or down the upsampled result for +alternate pixels rather than always rounding down. This ensures that, +regardless of whether a 4:2:2 JPEG image is rotated or transposed prior to +decompression (in the frequency domain) or after decompression (in the spatial +domain), the final image will be similar. + +4. Fixed an integer overflow and subsequent segfault that occurred when +attempting to compress or decompress images with more than 1 billion pixels +using the TurboJPEG API. + +5. Fixed a regression introduced by 2.0 beta1[15] whereby attempting to +generate a progressive JPEG image on an SSE2-capable CPU using a scan script +containing one or more scans with lengths divisible by 16 would result in an +error ("Missing Huffman code table entry") and an invalid JPEG image. + +6. Fixed an issue whereby `tjDecodeYUV()` and `tjDecodeYUVPlanes()` would throw +an error ("Invalid progressive parameters") or a warning ("Inconsistent +progression sequence") if passed a TurboJPEG instance that was previously used +to decompress a progressive JPEG image. + + 2.0.2 ===== diff --git a/src/3rdparty/libjpeg/src/README.md b/src/3rdparty/libjpeg/src/README.md index a769259891..c61b855644 100644 --- a/src/3rdparty/libjpeg/src/README.md +++ b/src/3rdparty/libjpeg/src/README.md @@ -135,12 +135,11 @@ without recompiling. libjpeg-turbo does not claim to support all of the libjpeg v7+ features, nor to produce identical output to libjpeg v7+ in all cases (see below.) -By passing an argument of `--with-jpeg7` or `--with-jpeg8` to `configure`, or -an argument of `-DWITH_JPEG7=1` or `-DWITH_JPEG8=1` to `cmake`, you can build a -version of libjpeg-turbo that emulates the libjpeg v7 or v8 ABI, so that -programs that are built against libjpeg v7 or v8 can be run with libjpeg-turbo. -The following section describes which libjpeg v7+ features are supported and -which aren't. +By passing an argument of `-DWITH_JPEG7=1` or `-DWITH_JPEG8=1` to `cmake`, you +can build a version of libjpeg-turbo that emulates the libjpeg v7 or v8 ABI, so +that programs that are built against libjpeg v7 or v8 can be run with +libjpeg-turbo. The following section describes which libjpeg v7+ features are +supported and which aren't. ### Support for libjpeg v7 and v8 Features @@ -247,9 +246,8 @@ don't, and it allows those functions to be provided in the "official" libjpeg-turbo binaries. Those who are concerned about maintaining strict conformance with the libjpeg -v6b or v7 API can pass an argument of `--without-mem-srcdst` to `configure` or -an argument of `-DWITH_MEM_SRCDST=0` to `cmake` prior to building -libjpeg-turbo. This will restore the pre-1.3 behavior, in which +v6b or v7 API can pass an argument of `-DWITH_MEM_SRCDST=0` to `cmake` prior to +building libjpeg-turbo. This will restore the pre-1.3 behavior, in which `jpeg_mem_src()` and `jpeg_mem_dest()` are only included when emulating the libjpeg v8 API/ABI. @@ -344,3 +342,15 @@ quality of 98-100. Thus, libjpeg-turbo must use the non-SIMD quantization function in those cases. This causes performance to drop by as much as 40%. It is therefore strongly advised that you use the slow integer forward DCT whenever encoding images with a JPEG quality of 98 or higher. + + +Memory Debugger Pitfalls +======================== + +Valgrind and Memory Sanitizer (MSan) can generate false positives +(specifically, incorrect reports of uninitialized memory accesses) when used +with libjpeg-turbo's SIMD extensions. It is generally recommended that the +SIMD extensions be disabled, either by passing an argument of `-DWITH_SIMD=0` +to `cmake` when configuring the build or by setting the environment variable +`JSIMD_FORCENONE` to `1` at run time, when testing libjpeg-turbo with Valgrind, +MSan, or other memory debuggers. diff --git a/src/3rdparty/libjpeg/src/jchuff.c b/src/3rdparty/libjpeg/src/jchuff.c index 939b3e76a1..526203e3db 100644 --- a/src/3rdparty/libjpeg/src/jchuff.c +++ b/src/3rdparty/libjpeg/src/jchuff.c @@ -4,7 +4,7 @@ * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1997, Thomas G. Lane. * libjpeg-turbo Modifications: - * Copyright (C) 2009-2011, 2014-2016, 2018, D. R. Commander. + * Copyright (C) 2009-2011, 2014-2016, 2018-2019, D. R. Commander. * Copyright (C) 2015, Matthieu Darbois. * For conditions of distribution and use, see the accompanying README.ijg * file. @@ -356,6 +356,8 @@ dump_buffer(working_state *state) put_buffer = (put_buffer << size) | code; \ } +#if SIZEOF_SIZE_T != 8 && !defined(_WIN64) + #define CHECKBUF15() { \ if (put_bits > 15) { \ EMIT_BYTE() \ @@ -363,6 +365,8 @@ dump_buffer(working_state *state) } \ } +#endif + #define CHECKBUF31() { \ if (put_bits > 31) { \ EMIT_BYTE() \ diff --git a/src/3rdparty/libjpeg/src/jcmaster.c b/src/3rdparty/libjpeg/src/jcmaster.c index 93b3de6826..998dc40a5c 100644 --- a/src/3rdparty/libjpeg/src/jcmaster.c +++ b/src/3rdparty/libjpeg/src/jcmaster.c @@ -492,8 +492,8 @@ prepare_for_pass(j_compress_ptr cinfo) */ master->pass_type = output_pass; master->pass_number++; - /*FALLTHROUGH*/ #endif + /*FALLTHROUGH*/ case output_pass: /* Do a data-output pass. */ /* We need not repeat per-scan setup if prior optimization pass did it. */ diff --git a/src/3rdparty/libjpeg/src/jdhuff.c b/src/3rdparty/libjpeg/src/jdhuff.c index 95f38e547e..a1128178b0 100644 --- a/src/3rdparty/libjpeg/src/jdhuff.c +++ b/src/3rdparty/libjpeg/src/jdhuff.c @@ -4,7 +4,7 @@ * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1997, Thomas G. Lane. * libjpeg-turbo Modifications: - * Copyright (C) 2009-2011, 2016, 2018, D. R. Commander. + * Copyright (C) 2009-2011, 2016, 2018-2019, D. R. Commander. * For conditions of distribution and use, see the accompanying README.ijg * file. * @@ -589,7 +589,11 @@ decode_mcu_slow(j_decompress_ptr cinfo, JBLOCKROW *MCU_data) if (entropy->dc_needed[blkn]) { /* Convert DC difference to actual value, update last_dc_val */ int ci = cinfo->MCU_membership[blkn]; - s += state.last_dc_val[ci]; + /* This is really just + * s += state.last_dc_val[ci]; + * It is written this way in order to shut up UBSan. + */ + s = (int)((unsigned int)s + (unsigned int)state.last_dc_val[ci]); state.last_dc_val[ci] = s; if (block) { /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */ @@ -684,7 +688,7 @@ decode_mcu_fast(j_decompress_ptr cinfo, JBLOCKROW *MCU_data) if (entropy->dc_needed[blkn]) { int ci = cinfo->MCU_membership[blkn]; - s += state.last_dc_val[ci]; + s = (int)((unsigned int)s + (unsigned int)state.last_dc_val[ci]); state.last_dc_val[ci] = s; if (block) (*block)[0] = (JCOEF)s; diff --git a/src/3rdparty/libjpeg/src/jdmerge.c b/src/3rdparty/libjpeg/src/jdmerge.c index b3fec04f71..dff5a35087 100644 --- a/src/3rdparty/libjpeg/src/jdmerge.c +++ b/src/3rdparty/libjpeg/src/jdmerge.c @@ -429,8 +429,6 @@ h2v2_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, #define PACK_TWO_PIXELS_LE(l, r) ((r << 16) | l) #define PACK_TWO_PIXELS_BE(l, r) ((l << 16) | r) -#define PACK_NEED_ALIGNMENT(ptr) (((size_t)(ptr)) & 3) - #define WRITE_TWO_PIXELS_LE(addr, pixels) { \ ((INT16 *)(addr))[0] = (INT16)(pixels); \ ((INT16 *)(addr))[1] = (INT16)((pixels) >> 16); \ diff --git a/src/3rdparty/libjpeg/src/jdsample.c b/src/3rdparty/libjpeg/src/jdsample.c index 52ee9af49b..50a68b3013 100644 --- a/src/3rdparty/libjpeg/src/jdsample.c +++ b/src/3rdparty/libjpeg/src/jdsample.c @@ -8,6 +8,7 @@ * Copyright (C) 2010, 2015-2016, D. R. Commander. * Copyright (C) 2014, MIPS Technologies, Inc., California. * Copyright (C) 2015, Google, Inc. + * Copyright (C) 2019, Arm Limited. * For conditions of distribution and use, see the accompanying README.ijg * file. * @@ -315,9 +316,9 @@ h1v2_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY output_data = *output_data_ptr; JSAMPROW inptr0, inptr1, outptr; #if BITS_IN_JSAMPLE == 8 - int thiscolsum; + int thiscolsum, bias; #else - JLONG thiscolsum; + JLONG thiscolsum, bias; #endif JDIMENSION colctr; int inrow, outrow, v; @@ -327,15 +328,18 @@ h1v2_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr, for (v = 0; v < 2; v++) { /* inptr0 points to nearest input row, inptr1 points to next nearest */ inptr0 = input_data[inrow]; - if (v == 0) /* next nearest is row above */ + if (v == 0) { /* next nearest is row above */ inptr1 = input_data[inrow - 1]; - else /* next nearest is row below */ + bias = 1; + } else { /* next nearest is row below */ inptr1 = input_data[inrow + 1]; + bias = 2; + } outptr = output_data[outrow++]; for (colctr = 0; colctr < compptr->downsampled_width; colctr++) { thiscolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++); - *outptr++ = (JSAMPLE)((thiscolsum + 1) >> 2); + *outptr++ = (JSAMPLE)((thiscolsum + bias) >> 2); } } inrow++; -- cgit v1.2.3