Update bundled libjpeg-turbo to version 2.1.5

[ChangeLog][Third-Party Code] libjpeg-turbo was updated to version 2.1.5

Task-number: QTBUG-110336
Change-Id: Ifc08ad7f1a3c5b3e66b11e5a51d523b091288790
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 94efcf9be4c5e46dff463806e278fcee90ff4d53)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Eirik Aavitsland 2023-02-03 09:34:03 +01:00 committed by Qt Cherry-pick Bot
parent 0cbc91d65d
commit d656fde77e
21 changed files with 154 additions and 87 deletions

View File

@ -1,4 +1,4 @@
Copyright (C) 2009-2022 D. R. Commander Copyright (C) 2009-2023 D. R. Commander
Copyright (C) 2015, 2020 Google, Inc. Copyright (C) 2015, 2020 Google, Inc.
Copyright (C) 2019-2020 Arm Limited Copyright (C) 2019-2020 Arm Limited
Copyright (C) 2015-2016, 2018 Matthieu Darbois Copyright (C) 2015-2016, 2018 Matthieu Darbois

View File

@ -91,7 +91,7 @@ best of our understanding.
The Modified (3-clause) BSD License The Modified (3-clause) BSD License
=================================== ===================================
Copyright (C)2009-2022 D. R. Commander. All Rights Reserved.<br> Copyright (C)2009-2023 D. R. Commander. All Rights Reserved.<br>
Copyright (C)2015 Viktor Szathmáry. All Rights Reserved. Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without

View File

@ -6,7 +6,7 @@
"Description": "The Independent JPEG Group's JPEG software", "Description": "The Independent JPEG Group's JPEG software",
"Homepage": "http://libjpeg-turbo.virtualgl.org/", "Homepage": "http://libjpeg-turbo.virtualgl.org/",
"Version": "2.1.4", "Version": "2.1.5",
"License": "Independent JPEG Group License and BSD 3-Clause \"New\" or \"Revised\" License and zlib License", "License": "Independent JPEG Group License and BSD 3-Clause \"New\" or \"Revised\" License and zlib License",
"LicenseId": "IJG AND BSD-3-Clause AND Zlib", "LicenseId": "IJG AND BSD-3-Clause AND Zlib",
"LicenseFiles": [ "LICENSE", "ijg-license.txt", "zlib-license.txt"], "LicenseFiles": [ "LICENSE", "ijg-license.txt", "zlib-license.txt"],

View File

@ -1,7 +1,62 @@
2.1.5
=====
### Significant changes relative to 2.1.4:
1. Fixed issues in the build system whereby, when using the Ninja Multi-Config
CMake generator, a static build of libjpeg-turbo (a build in which
`ENABLE_SHARED` is `0`) could not be installed, a Windows installer could not
be built, and the Java regression tests failed.
2. Fixed a regression introduced by 2.0 beta1[15] that caused a buffer overrun
in the progressive Huffman encoder when attempting to transform a
specially-crafted malformed 12-bit-per-component JPEG image into a progressive
12-bit-per-component JPEG image using a 12-bit-per-component build of
libjpeg-turbo (`-DWITH_12BIT=1`.) Given that the buffer overrun was fully
contained within the progressive Huffman encoder structure and did not cause a
segfault or other user-visible errant behavior, given that the lossless
transformer (unlike the decompressor) is not generally exposed to arbitrary
data exploits, and given that 12-bit-per-component builds of libjpeg-turbo are
uncommon, this issue did not likely pose a security risk.
3. Fixed an issue whereby, when using a 12-bit-per-component build of
libjpeg-turbo (`-DWITH_12BIT=1`), passing samples with values greater than 4095
or less than 0 to `jpeg_write_scanlines()` caused a buffer overrun or underrun
in the RGB-to-YCbCr color converter.
4. Fixed a floating point exception that occurred when attempting to use the
jpegtran `-drop` and `-trim` options to losslessly transform a
specially-crafted malformed JPEG image.
5. Fixed an issue in `tjBufSizeYUV2()` whereby it returned a bogus result,
rather than throwing an error, if the `align` parameter was not a power of 2.
Fixed a similar issue in `tjCompressFromYUV()` whereby it generated a corrupt
JPEG image in certain cases, rather than throwing an error, if the `align`
parameter was not a power of 2.
6. Fixed an issue whereby `tjDecompressToYUV2()`, which is a wrapper for
`tjDecompressToYUVPlanes()`, used the desired YUV image dimensions rather than
the actual scaled image dimensions when computing the plane pointers and
strides to pass to `tjDecompressToYUVPlanes()`. This caused a buffer overrun
and subsequent segfault if the desired image dimensions exceeded the scaled
image dimensions.
7. Fixed an issue whereby, when decompressing a 12-bit-per-component JPEG image
(`-DWITH_12BIT=1`) using an alpha-enabled output color space such as
`JCS_EXT_RGBA`, the alpha channel was set to 255 rather than 4095.
8. Fixed an issue whereby the Java version of TJBench did not accept a range of
quality values.
9. Fixed an issue whereby, when `-progressive` was passed to TJBench, the JPEG
input image was not transformed into a progressive JPEG image prior to
decompression.
2.1.4 2.1.4
===== =====
### Significant changes relative to 2.1.3 ### Significant changes relative to 2.1.3:
1. Fixed a regression introduced in 2.1.3 that caused build failures with 1. Fixed a regression introduced in 2.1.3 that caused build failures with
Visual Studio 2010. Visual Studio 2010.
@ -36,7 +91,7 @@ virtual array access") under certain circumstances.
2.1.3 2.1.3
===== =====
### Significant changes relative to 2.1.2 ### Significant changes relative to 2.1.2:
1. Fixed a regression introduced by 2.0 beta1[7] whereby cjpeg compressed PGM 1. Fixed a regression introduced by 2.0 beta1[7] whereby cjpeg compressed PGM
input files into full-color JPEG images unless the `-grayscale` option was input files into full-color JPEG images unless the `-grayscale` option was
@ -60,7 +115,7 @@ be reproduced using the libjpeg API, not using djpeg.
2.1.2 2.1.2
===== =====
### Significant changes relative to 2.1.1 ### Significant changes relative to 2.1.1:
1. Fixed a regression introduced by 2.1 beta1[13] that caused the remaining 1. Fixed a regression introduced by 2.1 beta1[13] that caused the remaining
GAS implementations of AArch64 (Arm 64-bit) Neon SIMD functions (which are used GAS implementations of AArch64 (Arm 64-bit) Neon SIMD functions (which are used
@ -92,7 +147,7 @@ image contains incomplete or corrupt image data.
2.1.1 2.1.1
===== =====
### Significant changes relative to 2.1.0 ### Significant changes relative to 2.1.0:
1. Fixed a regression introduced in 2.1.0 that caused build failures with 1. Fixed a regression introduced in 2.1.0 that caused build failures with
non-GCC-compatible compilers for Un*x/Arm platforms. non-GCC-compatible compilers for Un*x/Arm platforms.
@ -121,7 +176,7 @@ transform a specially-crafted malformed JPEG image.
2.1.0 2.1.0
===== =====
### Significant changes relative to 2.1 beta1 ### Significant changes relative to 2.1 beta1:
1. Fixed a regression introduced by 2.1 beta1[6(b)] whereby attempting to 1. Fixed a regression introduced by 2.1 beta1[6(b)] whereby attempting to
decompress certain progressive JPEG images with one or more component planes of decompress certain progressive JPEG images with one or more component planes of
@ -156,10 +211,10 @@ progressive JPEG format described in the report
["Two Issues with the JPEG Standard"](https://libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf). ["Two Issues with the JPEG Standard"](https://libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf).
7. The PPM reader now throws an error, rather than segfaulting (due to a buffer 7. The PPM reader now throws an error, rather than segfaulting (due to a buffer
overrun) or generating incorrect pixels, if an application attempts to use the overrun, CVE-2021-46822) or generating incorrect pixels, if an application
`tjLoadImage()` function to load a 16-bit binary PPM file (a binary PPM file attempts to use the `tjLoadImage()` function to load a 16-bit binary PPM file
with a maximum value greater than 255) into a grayscale image buffer or to load (a binary PPM file with a maximum value greater than 255) into a grayscale
a 16-bit binary PGM file into an RGB image buffer. image buffer or to load a 16-bit binary PGM file into an RGB image buffer.
8. Fixed an issue in the PPM reader that caused incorrect pixels to be 8. Fixed an issue in the PPM reader that caused incorrect pixels to be
generated when using the `tjLoadImage()` function to load a 16-bit binary PPM generated when using the `tjLoadImage()` function to load a 16-bit binary PPM
@ -325,11 +380,11 @@ methods in the TurboJPEG Java API.
2. Fixed or worked around multiple issues with `jpeg_skip_scanlines()`: 2. Fixed or worked around multiple issues with `jpeg_skip_scanlines()`:
- Fixed segfaults or "Corrupt JPEG data: premature end of data segment" - Fixed segfaults (CVE-2020-35538) or "Corrupt JPEG data: premature end of
errors in `jpeg_skip_scanlines()` that occurred when decompressing 4:2:2 or data segment" errors in `jpeg_skip_scanlines()` that occurred when
4:2:0 JPEG images using merged (non-fancy) upsampling/color conversion (that decompressing 4:2:2 or 4:2:0 JPEG images using merged (non-fancy)
is, when setting `cinfo.do_fancy_upsampling` to `FALSE`.) 2.0.0[6] was a upsampling/color conversion (that is, when setting `cinfo.do_fancy_upsampling`
similar fix, but it did not cover all cases. to `FALSE`.) 2.0.0[6] was a similar fix, but it did not cover all cases.
- `jpeg_skip_scanlines()` now throws an error if two-pass color - `jpeg_skip_scanlines()` now throws an error if two-pass color
quantization is enabled. Two-pass color quantization never worked properly quantization is enabled. Two-pass color quantization never worked properly
with `jpeg_skip_scanlines()`, and the issues could not readily be fixed. with `jpeg_skip_scanlines()`, and the issues could not readily be fixed.

View File

@ -4,7 +4,7 @@
* This file was part of the Independent JPEG Group's software: * This file was part of the Independent JPEG Group's software:
* Copyright (C) 1991-1996, Thomas G. Lane. * Copyright (C) 1991-1996, Thomas G. Lane.
* libjpeg-turbo Modifications: * libjpeg-turbo Modifications:
* Copyright (C) 2009-2012, 2015, D. R. Commander. * Copyright (C) 2009-2012, 2015, 2022, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg * For conditions of distribution and use, see the accompanying README.ijg
* file. * file.
* *
@ -48,9 +48,9 @@ rgb_ycc_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf,
outptr2 = output_buf[2][output_row]; outptr2 = output_buf[2][output_row];
output_row++; output_row++;
for (col = 0; col < num_cols; col++) { for (col = 0; col < num_cols; col++) {
r = inptr[RGB_RED]; r = RANGE_LIMIT(inptr[RGB_RED]);
g = inptr[RGB_GREEN]; g = RANGE_LIMIT(inptr[RGB_GREEN]);
b = inptr[RGB_BLUE]; b = RANGE_LIMIT(inptr[RGB_BLUE]);
inptr += RGB_PIXELSIZE; inptr += RGB_PIXELSIZE;
/* If the inputs are 0..MAXJSAMPLE, the outputs of these equations /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations
* must be too; we do not need an explicit range-limiting operation. * must be too; we do not need an explicit range-limiting operation.
@ -100,9 +100,9 @@ rgb_gray_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf,
outptr = output_buf[0][output_row]; outptr = output_buf[0][output_row];
output_row++; output_row++;
for (col = 0; col < num_cols; col++) { for (col = 0; col < num_cols; col++) {
r = inptr[RGB_RED]; r = RANGE_LIMIT(inptr[RGB_RED]);
g = inptr[RGB_GREEN]; g = RANGE_LIMIT(inptr[RGB_GREEN]);
b = inptr[RGB_BLUE]; b = RANGE_LIMIT(inptr[RGB_BLUE]);
inptr += RGB_PIXELSIZE; inptr += RGB_PIXELSIZE;
/* Y */ /* Y */
outptr[col] = (JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] + outptr[col] = (JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +

View File

@ -5,7 +5,7 @@
* Copyright (C) 1991-1996, Thomas G. Lane. * Copyright (C) 1991-1996, Thomas G. Lane.
* libjpeg-turbo Modifications: * libjpeg-turbo Modifications:
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
* Copyright (C) 2009-2012, 2015, D. R. Commander. * Copyright (C) 2009-2012, 2015, 2022, D. R. Commander.
* Copyright (C) 2014, MIPS Technologies, Inc., California. * Copyright (C) 2014, MIPS Technologies, Inc., California.
* For conditions of distribution and use, see the accompanying README.ijg * For conditions of distribution and use, see the accompanying README.ijg
* file. * file.
@ -17,7 +17,6 @@
#include "jinclude.h" #include "jinclude.h"
#include "jpeglib.h" #include "jpeglib.h"
#include "jsimd.h" #include "jsimd.h"
#include "jconfigint.h"
/* Private subobject */ /* Private subobject */
@ -84,6 +83,18 @@ typedef my_color_converter *my_cconvert_ptr;
#define B_CR_OFF (7 * (MAXJSAMPLE + 1)) #define B_CR_OFF (7 * (MAXJSAMPLE + 1))
#define TABLE_SIZE (8 * (MAXJSAMPLE + 1)) #define TABLE_SIZE (8 * (MAXJSAMPLE + 1))
/* 12-bit samples use a 16-bit data type, so it is possible to pass
* out-of-range sample values (< 0 or > 4095) to jpeg_write_scanlines().
* Thus, we mask the incoming 12-bit samples to guard against overrunning
* or underrunning the conversion tables.
*/
#if BITS_IN_JSAMPLE == 12
#define RANGE_LIMIT(value) ((value) & 0xFFF)
#else
#define RANGE_LIMIT(value) (value)
#endif
/* Include inline routines for colorspace extensions */ /* Include inline routines for colorspace extensions */
@ -392,9 +403,9 @@ cmyk_ycck_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
outptr3 = output_buf[3][output_row]; outptr3 = output_buf[3][output_row];
output_row++; output_row++;
for (col = 0; col < num_cols; col++) { for (col = 0; col < num_cols; col++) {
r = MAXJSAMPLE - inptr[0]; r = MAXJSAMPLE - RANGE_LIMIT(inptr[0]);
g = MAXJSAMPLE - inptr[1]; g = MAXJSAMPLE - RANGE_LIMIT(inptr[1]);
b = MAXJSAMPLE - inptr[2]; b = MAXJSAMPLE - RANGE_LIMIT(inptr[2]);
/* K passes through as-is */ /* K passes through as-is */
outptr3[col] = inptr[3]; outptr3[col] = inptr[3];
inptr += 4; inptr += 4;

View File

@ -27,7 +27,6 @@
#include "jinclude.h" #include "jinclude.h"
#include "jpeglib.h" #include "jpeglib.h"
#include "jsimd.h" #include "jsimd.h"
#include "jconfigint.h"
#include <limits.h> #include <limits.h>
/* /*

View File

@ -3,8 +3,8 @@
* *
* This file was part of the Independent JPEG Group's software: * This file was part of the Independent JPEG Group's software:
* Copyright (C) 1991-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* It was modified by The libjpeg-turbo Project to include only code relevant * libjpeg-turbo Modifications:
* to libjpeg-turbo. * Copyright (C) 2022, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg * For conditions of distribution and use, see the accompanying README.ijg
* file. * file.
* *
@ -25,6 +25,14 @@
#define MAX_COEF_BITS 14 #define MAX_COEF_BITS 14
#endif #endif
/* The progressive Huffman encoder uses an unsigned 16-bit data type to store
* absolute values of coefficients, because it is possible to inject a
* coefficient value of -32768 into the encoder by attempting to transform a
* malformed 12-bit JPEG image, and the absolute value of -32768 would overflow
* a signed 16-bit integer.
*/
typedef unsigned short UJCOEF;
/* Derived data constructed for each Huffman table */ /* Derived data constructed for each Huffman table */
typedef struct { typedef struct {

View File

@ -19,7 +19,6 @@
#include "jinclude.h" #include "jinclude.h"
#include "jpeglib.h" #include "jpeglib.h"
#include "jpegcomp.h" #include "jpegcomp.h"
#include "jconfigint.h"
/* Private state */ /* Private state */

View File

@ -2,9 +2,9 @@
#define JPEG_LIB_VERSION 80 #define JPEG_LIB_VERSION 80
#define LIBJPEG_TURBO_VERSION 2.1.4 #define LIBJPEG_TURBO_VERSION 2.1.5
#define LIBJPEG_TURBO_VERSION_NUMBER 2001004 #define LIBJPEG_TURBO_VERSION_NUMBER 2001005
#define C_ARITH_CODING_SUPPORTED 1 #define C_ARITH_CODING_SUPPORTED 1

View File

@ -8,7 +8,7 @@
#define PACKAGE_NAME "libjpeg-turbo" #define PACKAGE_NAME "libjpeg-turbo"
#define VERSION "2.1.4" #define VERSION "2.1.5"
#if SIZE_MAX == 0xffffffff #if SIZE_MAX == 0xffffffff
#define SIZEOF_SIZE_T 4 #define SIZEOF_SIZE_T 4

View File

@ -5,7 +5,7 @@
* Copyright (C) 1995-1997, Thomas G. Lane. * Copyright (C) 1995-1997, Thomas G. Lane.
* libjpeg-turbo Modifications: * libjpeg-turbo Modifications:
* Copyright (C) 2011, 2015, 2018, 2021-2022, D. R. Commander. * Copyright (C) 2011, 2015, 2018, 2021-2022, D. R. Commander.
* Copyright (C) 2016, 2018, Matthieu Darbois. * Copyright (C) 2016, 2018, 2022, Matthieu Darbois.
* Copyright (C) 2020, Arm Limited. * Copyright (C) 2020, Arm Limited.
* Copyright (C) 2021, Alex Richardson. * Copyright (C) 2021, Alex Richardson.
* For conditions of distribution and use, see the accompanying README.ijg * For conditions of distribution and use, see the accompanying README.ijg
@ -22,7 +22,6 @@
#include "jinclude.h" #include "jinclude.h"
#include "jpeglib.h" #include "jpeglib.h"
#include "jsimd.h" #include "jsimd.h"
#include "jconfigint.h"
#include <limits.h> #include <limits.h>
#ifdef HAVE_INTRIN_H #ifdef HAVE_INTRIN_H
@ -83,11 +82,11 @@ typedef struct {
/* Pointer to routine to prepare data for encode_mcu_AC_first() */ /* Pointer to routine to prepare data for encode_mcu_AC_first() */
void (*AC_first_prepare) (const JCOEF *block, void (*AC_first_prepare) (const JCOEF *block,
const int *jpeg_natural_order_start, int Sl, const int *jpeg_natural_order_start, int Sl,
int Al, JCOEF *values, size_t *zerobits); int Al, UJCOEF *values, size_t *zerobits);
/* Pointer to routine to prepare data for encode_mcu_AC_refine() */ /* Pointer to routine to prepare data for encode_mcu_AC_refine() */
int (*AC_refine_prepare) (const JCOEF *block, int (*AC_refine_prepare) (const JCOEF *block,
const int *jpeg_natural_order_start, int Sl, const int *jpeg_natural_order_start, int Sl,
int Al, JCOEF *absvalues, size_t *bits); int Al, UJCOEF *absvalues, size_t *bits);
/* Mode flag: TRUE for optimization, FALSE for actual data output */ /* Mode flag: TRUE for optimization, FALSE for actual data output */
boolean gather_statistics; boolean gather_statistics;
@ -157,14 +156,14 @@ METHODDEF(boolean) encode_mcu_DC_first(j_compress_ptr cinfo,
JBLOCKROW *MCU_data); JBLOCKROW *MCU_data);
METHODDEF(void) encode_mcu_AC_first_prepare METHODDEF(void) encode_mcu_AC_first_prepare
(const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al, (const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al,
JCOEF *values, size_t *zerobits); UJCOEF *values, size_t *zerobits);
METHODDEF(boolean) encode_mcu_AC_first(j_compress_ptr cinfo, METHODDEF(boolean) encode_mcu_AC_first(j_compress_ptr cinfo,
JBLOCKROW *MCU_data); JBLOCKROW *MCU_data);
METHODDEF(boolean) encode_mcu_DC_refine(j_compress_ptr cinfo, METHODDEF(boolean) encode_mcu_DC_refine(j_compress_ptr cinfo,
JBLOCKROW *MCU_data); JBLOCKROW *MCU_data);
METHODDEF(int) encode_mcu_AC_refine_prepare METHODDEF(int) encode_mcu_AC_refine_prepare
(const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al, (const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al,
JCOEF *absvalues, size_t *bits); UJCOEF *absvalues, size_t *bits);
METHODDEF(boolean) encode_mcu_AC_refine(j_compress_ptr cinfo, METHODDEF(boolean) encode_mcu_AC_refine(j_compress_ptr cinfo,
JBLOCKROW *MCU_data); JBLOCKROW *MCU_data);
METHODDEF(void) finish_pass_phuff(j_compress_ptr cinfo); METHODDEF(void) finish_pass_phuff(j_compress_ptr cinfo);
@ -584,8 +583,8 @@ encode_mcu_DC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
continue; \ continue; \
/* For a negative coef, want temp2 = bitwise complement of abs(coef) */ \ /* For a negative coef, want temp2 = bitwise complement of abs(coef) */ \
temp2 ^= temp; \ temp2 ^= temp; \
values[k] = (JCOEF)temp; \ values[k] = (UJCOEF)temp; \
values[k + DCTSIZE2] = (JCOEF)temp2; \ values[k + DCTSIZE2] = (UJCOEF)temp2; \
zerobits |= ((size_t)1U) << k; \ zerobits |= ((size_t)1U) << k; \
} \ } \
} }
@ -593,7 +592,7 @@ encode_mcu_DC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
METHODDEF(void) METHODDEF(void)
encode_mcu_AC_first_prepare(const JCOEF *block, encode_mcu_AC_first_prepare(const JCOEF *block,
const int *jpeg_natural_order_start, int Sl, const int *jpeg_natural_order_start, int Sl,
int Al, JCOEF *values, size_t *bits) int Al, UJCOEF *values, size_t *bits)
{ {
register int k, temp, temp2; register int k, temp, temp2;
size_t zerobits = 0U; size_t zerobits = 0U;
@ -666,9 +665,9 @@ encode_mcu_AC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
register int nbits, r; register int nbits, r;
int Sl = cinfo->Se - cinfo->Ss + 1; int Sl = cinfo->Se - cinfo->Ss + 1;
int Al = cinfo->Al; int Al = cinfo->Al;
JCOEF values_unaligned[2 * DCTSIZE2 + 15]; UJCOEF values_unaligned[2 * DCTSIZE2 + 15];
JCOEF *values; UJCOEF *values;
const JCOEF *cvalue; const UJCOEF *cvalue;
size_t zerobits; size_t zerobits;
size_t bits[8 / SIZEOF_SIZE_T]; size_t bits[8 / SIZEOF_SIZE_T];
@ -681,7 +680,7 @@ encode_mcu_AC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
emit_restart(entropy, entropy->next_restart_num); emit_restart(entropy, entropy->next_restart_num);
#ifdef WITH_SIMD #ifdef WITH_SIMD
cvalue = values = (JCOEF *)PAD((JUINTPTR)values_unaligned, 16); cvalue = values = (UJCOEF *)PAD((JUINTPTR)values_unaligned, 16);
#else #else
/* Not using SIMD, so alignment is not needed */ /* Not using SIMD, so alignment is not needed */
cvalue = values = values_unaligned; cvalue = values = values_unaligned;
@ -815,7 +814,7 @@ encode_mcu_DC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
zerobits |= ((size_t)1U) << k; \ zerobits |= ((size_t)1U) << k; \
signbits |= ((size_t)(temp2 + 1)) << k; \ signbits |= ((size_t)(temp2 + 1)) << k; \
} \ } \
absvalues[k] = (JCOEF)temp; /* save abs value for main pass */ \ absvalues[k] = (UJCOEF)temp; /* save abs value for main pass */ \
if (temp == 1) \ if (temp == 1) \
EOB = k + koffset; /* EOB = index of last newly-nonzero coef */ \ EOB = k + koffset; /* EOB = index of last newly-nonzero coef */ \
} \ } \
@ -824,7 +823,7 @@ encode_mcu_DC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
METHODDEF(int) METHODDEF(int)
encode_mcu_AC_refine_prepare(const JCOEF *block, encode_mcu_AC_refine_prepare(const JCOEF *block,
const int *jpeg_natural_order_start, int Sl, const int *jpeg_natural_order_start, int Sl,
int Al, JCOEF *absvalues, size_t *bits) int Al, UJCOEF *absvalues, size_t *bits)
{ {
register int k, temp, temp2; register int k, temp, temp2;
int EOB = 0; int EOB = 0;
@ -931,9 +930,9 @@ encode_mcu_AC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
unsigned int BR; unsigned int BR;
int Sl = cinfo->Se - cinfo->Ss + 1; int Sl = cinfo->Se - cinfo->Ss + 1;
int Al = cinfo->Al; int Al = cinfo->Al;
JCOEF absvalues_unaligned[DCTSIZE2 + 15]; UJCOEF absvalues_unaligned[DCTSIZE2 + 15];
JCOEF *absvalues; UJCOEF *absvalues;
const JCOEF *cabsvalue, *EOBPTR; const UJCOEF *cabsvalue, *EOBPTR;
size_t zerobits, signbits; size_t zerobits, signbits;
size_t bits[16 / SIZEOF_SIZE_T]; size_t bits[16 / SIZEOF_SIZE_T];
@ -946,7 +945,7 @@ encode_mcu_AC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
emit_restart(entropy, entropy->next_restart_num); emit_restart(entropy, entropy->next_restart_num);
#ifdef WITH_SIMD #ifdef WITH_SIMD
cabsvalue = absvalues = (JCOEF *)PAD((JUINTPTR)absvalues_unaligned, 16); cabsvalue = absvalues = (UJCOEF *)PAD((JUINTPTR)absvalues_unaligned, 16);
#else #else
/* Not using SIMD, so alignment is not needed */ /* Not using SIMD, so alignment is not needed */
cabsvalue = absvalues = absvalues_unaligned; cabsvalue = absvalues = absvalues_unaligned;

View File

@ -23,7 +23,6 @@
#include "jinclude.h" #include "jinclude.h"
#include "jpeglib.h" #include "jpeglib.h"
#include "jdmaster.h" #include "jdmaster.h"
#include "jconfigint.h"
/* /*

View File

@ -4,7 +4,7 @@
* This file was part of the Independent JPEG Group's software: * This file was part of the Independent JPEG Group's software:
* Copyright (C) 1991-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* libjpeg-turbo Modifications: * libjpeg-turbo Modifications:
* Copyright (C) 2009, 2011, 2015, D. R. Commander. * Copyright (C) 2009, 2011, 2015, 2023, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg * For conditions of distribution and use, see the accompanying README.ijg
* file. * file.
* *
@ -62,10 +62,10 @@ ycc_rgb_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
SCALEBITS))]; SCALEBITS))];
outptr[RGB_BLUE] = range_limit[y + Cbbtab[cb]]; outptr[RGB_BLUE] = range_limit[y + Cbbtab[cb]];
/* Set unused byte to 0xFF so it can be interpreted as an opaque */ /* Set unused byte to MAXJSAMPLE so it can be interpreted as an opaque */
/* alpha channel value */ /* alpha channel value */
#ifdef RGB_ALPHA #ifdef RGB_ALPHA
outptr[RGB_ALPHA] = 0xFF; outptr[RGB_ALPHA] = MAXJSAMPLE;
#endif #endif
outptr += RGB_PIXELSIZE; outptr += RGB_PIXELSIZE;
} }
@ -94,10 +94,10 @@ gray_rgb_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
outptr = *output_buf++; outptr = *output_buf++;
for (col = 0; col < num_cols; col++) { for (col = 0; col < num_cols; col++) {
outptr[RGB_RED] = outptr[RGB_GREEN] = outptr[RGB_BLUE] = inptr[col]; outptr[RGB_RED] = outptr[RGB_GREEN] = outptr[RGB_BLUE] = inptr[col];
/* Set unused byte to 0xFF so it can be interpreted as an opaque */ /* Set unused byte to MAXJSAMPLE so it can be interpreted as an opaque */
/* alpha channel value */ /* alpha channel value */
#ifdef RGB_ALPHA #ifdef RGB_ALPHA
outptr[RGB_ALPHA] = 0xFF; outptr[RGB_ALPHA] = MAXJSAMPLE;
#endif #endif
outptr += RGB_PIXELSIZE; outptr += RGB_PIXELSIZE;
} }
@ -130,10 +130,10 @@ rgb_rgb_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
outptr[RGB_RED] = inptr0[col]; outptr[RGB_RED] = inptr0[col];
outptr[RGB_GREEN] = inptr1[col]; outptr[RGB_GREEN] = inptr1[col];
outptr[RGB_BLUE] = inptr2[col]; outptr[RGB_BLUE] = inptr2[col];
/* Set unused byte to 0xFF so it can be interpreted as an opaque */ /* Set unused byte to MAXJSAMPLE so it can be interpreted as an opaque */
/* alpha channel value */ /* alpha channel value */
#ifdef RGB_ALPHA #ifdef RGB_ALPHA
outptr[RGB_ALPHA] = 0xFF; outptr[RGB_ALPHA] = MAXJSAMPLE;
#endif #endif
outptr += RGB_PIXELSIZE; outptr += RGB_PIXELSIZE;
} }

View File

@ -18,7 +18,6 @@
#include "jinclude.h" #include "jinclude.h"
#include "jpeglib.h" #include "jpeglib.h"
#include "jsimd.h" #include "jsimd.h"
#include "jconfigint.h"
/* Private subobject */ /* Private subobject */

View File

@ -18,7 +18,6 @@
#include "jinclude.h" #include "jinclude.h"
#include "jdmainct.h" #include "jdmainct.h"
#include "jconfigint.h"
/* /*

View File

@ -42,7 +42,6 @@
#include "jpeglib.h" #include "jpeglib.h"
#include "jdmerge.h" #include "jdmerge.h"
#include "jsimd.h" #include "jsimd.h"
#include "jconfigint.h"
#ifdef UPSAMPLE_MERGING_SUPPORTED #ifdef UPSAMPLE_MERGING_SUPPORTED

View File

@ -4,7 +4,7 @@
* This file was part of the Independent JPEG Group's software: * This file was part of the Independent JPEG Group's software:
* Copyright (C) 1994-1996, Thomas G. Lane. * Copyright (C) 1994-1996, Thomas G. Lane.
* libjpeg-turbo Modifications: * libjpeg-turbo Modifications:
* Copyright (C) 2011, 2015, 2020, D. R. Commander. * Copyright (C) 2011, 2015, 2020, 2023, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg * For conditions of distribution and use, see the accompanying README.ijg
* file. * file.
* *
@ -57,7 +57,7 @@ h2v1_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
outptr[RGB_GREEN] = range_limit[y + cgreen]; outptr[RGB_GREEN] = range_limit[y + cgreen];
outptr[RGB_BLUE] = range_limit[y + cblue]; outptr[RGB_BLUE] = range_limit[y + cblue];
#ifdef RGB_ALPHA #ifdef RGB_ALPHA
outptr[RGB_ALPHA] = 0xFF; outptr[RGB_ALPHA] = MAXJSAMPLE;
#endif #endif
outptr += RGB_PIXELSIZE; outptr += RGB_PIXELSIZE;
y = *inptr0++; y = *inptr0++;
@ -65,7 +65,7 @@ h2v1_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
outptr[RGB_GREEN] = range_limit[y + cgreen]; outptr[RGB_GREEN] = range_limit[y + cgreen];
outptr[RGB_BLUE] = range_limit[y + cblue]; outptr[RGB_BLUE] = range_limit[y + cblue];
#ifdef RGB_ALPHA #ifdef RGB_ALPHA
outptr[RGB_ALPHA] = 0xFF; outptr[RGB_ALPHA] = MAXJSAMPLE;
#endif #endif
outptr += RGB_PIXELSIZE; outptr += RGB_PIXELSIZE;
} }
@ -81,7 +81,7 @@ h2v1_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
outptr[RGB_GREEN] = range_limit[y + cgreen]; outptr[RGB_GREEN] = range_limit[y + cgreen];
outptr[RGB_BLUE] = range_limit[y + cblue]; outptr[RGB_BLUE] = range_limit[y + cblue];
#ifdef RGB_ALPHA #ifdef RGB_ALPHA
outptr[RGB_ALPHA] = 0xFF; outptr[RGB_ALPHA] = MAXJSAMPLE;
#endif #endif
} }
} }
@ -131,7 +131,7 @@ h2v2_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
outptr0[RGB_GREEN] = range_limit[y + cgreen]; outptr0[RGB_GREEN] = range_limit[y + cgreen];
outptr0[RGB_BLUE] = range_limit[y + cblue]; outptr0[RGB_BLUE] = range_limit[y + cblue];
#ifdef RGB_ALPHA #ifdef RGB_ALPHA
outptr0[RGB_ALPHA] = 0xFF; outptr0[RGB_ALPHA] = MAXJSAMPLE;
#endif #endif
outptr0 += RGB_PIXELSIZE; outptr0 += RGB_PIXELSIZE;
y = *inptr00++; y = *inptr00++;
@ -139,7 +139,7 @@ h2v2_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
outptr0[RGB_GREEN] = range_limit[y + cgreen]; outptr0[RGB_GREEN] = range_limit[y + cgreen];
outptr0[RGB_BLUE] = range_limit[y + cblue]; outptr0[RGB_BLUE] = range_limit[y + cblue];
#ifdef RGB_ALPHA #ifdef RGB_ALPHA
outptr0[RGB_ALPHA] = 0xFF; outptr0[RGB_ALPHA] = MAXJSAMPLE;
#endif #endif
outptr0 += RGB_PIXELSIZE; outptr0 += RGB_PIXELSIZE;
y = *inptr01++; y = *inptr01++;
@ -147,7 +147,7 @@ h2v2_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
outptr1[RGB_GREEN] = range_limit[y + cgreen]; outptr1[RGB_GREEN] = range_limit[y + cgreen];
outptr1[RGB_BLUE] = range_limit[y + cblue]; outptr1[RGB_BLUE] = range_limit[y + cblue];
#ifdef RGB_ALPHA #ifdef RGB_ALPHA
outptr1[RGB_ALPHA] = 0xFF; outptr1[RGB_ALPHA] = MAXJSAMPLE;
#endif #endif
outptr1 += RGB_PIXELSIZE; outptr1 += RGB_PIXELSIZE;
y = *inptr01++; y = *inptr01++;
@ -155,7 +155,7 @@ h2v2_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
outptr1[RGB_GREEN] = range_limit[y + cgreen]; outptr1[RGB_GREEN] = range_limit[y + cgreen];
outptr1[RGB_BLUE] = range_limit[y + cblue]; outptr1[RGB_BLUE] = range_limit[y + cblue];
#ifdef RGB_ALPHA #ifdef RGB_ALPHA
outptr1[RGB_ALPHA] = 0xFF; outptr1[RGB_ALPHA] = MAXJSAMPLE;
#endif #endif
outptr1 += RGB_PIXELSIZE; outptr1 += RGB_PIXELSIZE;
} }
@ -171,14 +171,14 @@ h2v2_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
outptr0[RGB_GREEN] = range_limit[y + cgreen]; outptr0[RGB_GREEN] = range_limit[y + cgreen];
outptr0[RGB_BLUE] = range_limit[y + cblue]; outptr0[RGB_BLUE] = range_limit[y + cblue];
#ifdef RGB_ALPHA #ifdef RGB_ALPHA
outptr0[RGB_ALPHA] = 0xFF; outptr0[RGB_ALPHA] = MAXJSAMPLE;
#endif #endif
y = *inptr01; y = *inptr01;
outptr1[RGB_RED] = range_limit[y + cred]; outptr1[RGB_RED] = range_limit[y + cred];
outptr1[RGB_GREEN] = range_limit[y + cgreen]; outptr1[RGB_GREEN] = range_limit[y + cgreen];
outptr1[RGB_BLUE] = range_limit[y + cblue]; outptr1[RGB_BLUE] = range_limit[y + cblue];
#ifdef RGB_ALPHA #ifdef RGB_ALPHA
outptr1[RGB_ALPHA] = 0xFF; outptr1[RGB_ALPHA] = MAXJSAMPLE;
#endif #endif
} }
} }

View File

@ -2,8 +2,8 @@
* jsimd.h * jsimd.h
* *
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
* Copyright (C) 2011, 2014, D. R. Commander. * Copyright (C) 2011, 2014, 2022, D. R. Commander.
* Copyright (C) 2015-2016, 2018, Matthieu Darbois. * Copyright (C) 2015-2016, 2018, 2022, Matthieu Darbois.
* Copyright (C) 2020, Arm Limited. * Copyright (C) 2020, Arm Limited.
* *
* Based on the x86 SIMD extension for IJG JPEG library, * Based on the x86 SIMD extension for IJG JPEG library,
@ -114,10 +114,10 @@ EXTERN(int) jsimd_can_encode_mcu_AC_first_prepare(void);
EXTERN(void) jsimd_encode_mcu_AC_first_prepare EXTERN(void) jsimd_encode_mcu_AC_first_prepare
(const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al, (const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al,
JCOEF *values, size_t *zerobits); UJCOEF *values, size_t *zerobits);
EXTERN(int) jsimd_can_encode_mcu_AC_refine_prepare(void); EXTERN(int) jsimd_can_encode_mcu_AC_refine_prepare(void);
EXTERN(int) jsimd_encode_mcu_AC_refine_prepare EXTERN(int) jsimd_encode_mcu_AC_refine_prepare
(const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al, (const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al,
JCOEF *absvalues, size_t *bits); UJCOEF *absvalues, size_t *bits);

View File

@ -2,8 +2,8 @@
* jsimd_none.c * jsimd_none.c
* *
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
* Copyright (C) 2009-2011, 2014, D. R. Commander. * Copyright (C) 2009-2011, 2014, 2022, D. R. Commander.
* Copyright (C) 2015-2016, 2018, Matthieu Darbois. * Copyright (C) 2015-2016, 2018, 2022, Matthieu Darbois.
* Copyright (C) 2020, Arm Limited. * Copyright (C) 2020, Arm Limited.
* *
* Based on the x86 SIMD extension for IJG JPEG library, * Based on the x86 SIMD extension for IJG JPEG library,
@ -412,7 +412,7 @@ jsimd_can_encode_mcu_AC_first_prepare(void)
GLOBAL(void) GLOBAL(void)
jsimd_encode_mcu_AC_first_prepare(const JCOEF *block, jsimd_encode_mcu_AC_first_prepare(const JCOEF *block,
const int *jpeg_natural_order_start, int Sl, const int *jpeg_natural_order_start, int Sl,
int Al, JCOEF *values, size_t *zerobits) int Al, UJCOEF *values, size_t *zerobits)
{ {
} }
@ -425,7 +425,7 @@ jsimd_can_encode_mcu_AC_refine_prepare(void)
GLOBAL(int) GLOBAL(int)
jsimd_encode_mcu_AC_refine_prepare(const JCOEF *block, jsimd_encode_mcu_AC_refine_prepare(const JCOEF *block,
const int *jpeg_natural_order_start, int Sl, const int *jpeg_natural_order_start, int Sl,
int Al, JCOEF *absvalues, size_t *bits) int Al, UJCOEF *absvalues, size_t *bits)
{ {
return 0; return 0;
} }

View File

@ -4,7 +4,7 @@
* This file was part of the Independent JPEG Group's software: * This file was part of the Independent JPEG Group's software:
* Copyright (C) 1991-2020, Thomas G. Lane, Guido Vollbeding. * Copyright (C) 1991-2020, Thomas G. Lane, Guido Vollbeding.
* libjpeg-turbo Modifications: * libjpeg-turbo Modifications:
* Copyright (C) 2010, 2012-2022, D. R. Commander. * Copyright (C) 2010, 2012-2023, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg * For conditions of distribution and use, see the accompanying README.ijg
* file. * file.
* *
@ -37,7 +37,7 @@
*/ */
#define JCOPYRIGHT \ #define JCOPYRIGHT \
"Copyright (C) 2009-2022 D. R. Commander\n" \ "Copyright (C) 2009-2023 D. R. Commander\n" \
"Copyright (C) 2015, 2020 Google, Inc.\n" \ "Copyright (C) 2015, 2020 Google, Inc.\n" \
"Copyright (C) 2019-2020 Arm Limited\n" \ "Copyright (C) 2019-2020 Arm Limited\n" \
"Copyright (C) 2015-2016, 2018 Matthieu Darbois\n" \ "Copyright (C) 2015-2016, 2018 Matthieu Darbois\n" \
@ -51,4 +51,4 @@
"Copyright (C) 1991-2020 Thomas G. Lane, Guido Vollbeding" "Copyright (C) 1991-2020 Thomas G. Lane, Guido Vollbeding"
#define JCOPYRIGHT_SHORT \ #define JCOPYRIGHT_SHORT \
"Copyright (C) 1991-2022 The libjpeg-turbo Project and many others" "Copyright (C) 1991-2023 The libjpeg-turbo Project and many others"