summaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-10-20 16:07:29 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-10-30 11:06:48 +0200
commit1295f497e0cc7fc7cfcb66182496a4d29aa701b3 (patch)
tree3deacf9ec953301037f1c21aa9b756f5ca1fb332 /external
parent45de43ce9f1441735817fa82924ddc4508d221cd (diff)
upgrade libjpeg-turbo to 2.1.1
simd enabled for x86_64 and x86, arm/aarch64 might be worth exploring too Change-Id: Ic2726ee8c6b6e59ca983b977ee2731f5b78b97d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123898 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'external')
-rw-r--r--external/libjpeg-turbo/ExternalProject_libjpeg-turbo.mk43
-rw-r--r--external/libjpeg-turbo/Module_libjpeg-turbo.mk2
-rw-r--r--external/libjpeg-turbo/StaticLibrary_libjpeg-turbo.mk214
-rw-r--r--external/libjpeg-turbo/UnpackedTarball_libjpeg-turbo.mk13
-rw-r--r--external/libjpeg-turbo/jconfig.h86
-rw-r--r--external/libjpeg-turbo/jconfigint.h51
-rw-r--r--external/libjpeg-turbo/jpeg-turbo.build.patch.158
-rw-r--r--external/libjpeg-turbo/jpeg-turbo.win_build.patch.154
-rw-r--r--external/libjpeg-turbo/ubsan.patch39
9 files changed, 358 insertions, 202 deletions
diff --git a/external/libjpeg-turbo/ExternalProject_libjpeg-turbo.mk b/external/libjpeg-turbo/ExternalProject_libjpeg-turbo.mk
deleted file mode 100644
index c5e0556748b4..000000000000
--- a/external/libjpeg-turbo/ExternalProject_libjpeg-turbo.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-
-$(eval $(call gb_ExternalProject_ExternalProject,libjpeg-turbo))
-
-$(eval $(call gb_ExternalProject_use_autoconf,libjpeg-turbo,configure))
-$(eval $(call gb_ExternalProject_use_autoconf,libjpeg-turbo,build))
-
-$(eval $(call gb_ExternalProject_register_targets,libjpeg-turbo,\
- configure \
- build \
-))
-
-$(call gb_ExternalProject_get_state_target,libjpeg-turbo,build) : $(call gb_ExternalProject_get_state_target,libjpeg-turbo,configure)
- $(call gb_Trace_StartRange,libjpeg-turbo,EXTERNAL)
- +$(call gb_ExternalProject_run,build,\
- $(MAKE) \
- )
- $(call gb_Trace_EndRange,libjpeg-turbo,EXTERNAL)
-
-$(call gb_ExternalProject_get_state_target,libjpeg-turbo,configure) :
- $(call gb_Trace_StartRange,libjpeg-turbo,EXTERNAL)
- $(call gb_ExternalProject_run,configure,\
- MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \
- --build=$(BUILD_PLATFORM) \
- --host=$(HOST_PLATFORM) \
- --with-pic \
- --enable-static \
- --disable-shared \
- --without-java \
- --without-turbojpeg \
- $(if $(NASM),,--without-simd) \
- CFLAGS='$(if $(debug),$(gb_DEBUGINFO_FLAGS)) $(if $(ENABLE_OPTIMIZED),$(gb_COMPILEROPTFLAGS),$(gb_COMPILERNOOPTFLAGS)) $(CFLAGS) $(gb_VISIBILITY_FLAGS)' \
- )
- $(call gb_Trace_EndRange,libjpeg-turbo,EXTERNAL)
-
-# vim: set noet sw=4 ts=4:
diff --git a/external/libjpeg-turbo/Module_libjpeg-turbo.mk b/external/libjpeg-turbo/Module_libjpeg-turbo.mk
index 137e7557bacf..29be90155880 100644
--- a/external/libjpeg-turbo/Module_libjpeg-turbo.mk
+++ b/external/libjpeg-turbo/Module_libjpeg-turbo.mk
@@ -10,8 +10,8 @@
$(eval $(call gb_Module_Module,libjpeg-turbo))
$(eval $(call gb_Module_add_targets,libjpeg-turbo,\
- ExternalProject_libjpeg-turbo \
UnpackedTarball_libjpeg-turbo \
+ StaticLibrary_libjpeg-turbo \
))
# vim: set noet sw=4 ts=4:
diff --git a/external/libjpeg-turbo/StaticLibrary_libjpeg-turbo.mk b/external/libjpeg-turbo/StaticLibrary_libjpeg-turbo.mk
new file mode 100644
index 000000000000..0b6b3044d1b2
--- /dev/null
+++ b/external/libjpeg-turbo/StaticLibrary_libjpeg-turbo.mk
@@ -0,0 +1,214 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozillarg/MPL/2.0/.
+#
+
+$(eval $(call gb_StaticLibrary_StaticLibrary,libjpeg-turbo))
+
+$(eval $(call gb_StaticLibrary_use_unpacked,libjpeg-turbo,libjpeg-turbo))
+
+$(eval $(call gb_StaticLibrary_set_warnings_disabled,libjpeg-turbo))
+
+$(eval $(call gb_StaticLibrary_set_include,libjpeg-turbo,\
+ -I$(call gb_UnpackedTarball_get_dir,libjpeg-turbo) \
+ $$(INCLUDE) \
+))
+
+ifeq ($(OS),WNT)
+$(eval $(call gb_StaticLibrary_add_cflags,libjpeg-turbo,\
+ -DHAVE_INTRIN_H=1 \
+))
+endif
+
+$(eval $(call gb_StaticLibrary_add_cflags,libjpeg-turbo,\
+ -DSIZEOF_SIZE_T=$(SIZEOF_SIZE_T) \
+))
+
+ifeq ($(COM),GCC)
+ifneq ($(ENABLE_OPTIMIZED),)
+$(eval $(call gb_StaticLibrary_add_cflags,libjpeg-turbo,\
+ -O3 \
+))
+endif
+endif
+
+$(eval $(call gb_StaticLibrary_add_generated_cobjects,libjpeg-turbo,\
+ UnpackedTarball/libjpeg-turbo/jcapimin \
+ UnpackedTarball/libjpeg-turbo/jcapistd \
+ UnpackedTarball/libjpeg-turbo/jccoefct \
+ UnpackedTarball/libjpeg-turbo/jccolor \
+ UnpackedTarball/libjpeg-turbo/jcdctmgr \
+ UnpackedTarball/libjpeg-turbo/jchuff \
+ UnpackedTarball/libjpeg-turbo/jcicc \
+ UnpackedTarball/libjpeg-turbo/jcinit \
+ UnpackedTarball/libjpeg-turbo/jcmainct \
+ UnpackedTarball/libjpeg-turbo/jcmarker \
+ UnpackedTarball/libjpeg-turbo/jcmaster \
+ UnpackedTarball/libjpeg-turbo/jcomapi \
+ UnpackedTarball/libjpeg-turbo/jcparam \
+ UnpackedTarball/libjpeg-turbo/jcphuff \
+ UnpackedTarball/libjpeg-turbo/jcprepct \
+ UnpackedTarball/libjpeg-turbo/jcsample \
+ UnpackedTarball/libjpeg-turbo/jctrans \
+ UnpackedTarball/libjpeg-turbo/jdapimin \
+ UnpackedTarball/libjpeg-turbo/jdapistd \
+ UnpackedTarball/libjpeg-turbo/jdatadst \
+ UnpackedTarball/libjpeg-turbo/jdatasrc \
+ UnpackedTarball/libjpeg-turbo/jdcoefct \
+ UnpackedTarball/libjpeg-turbo/jdcolor \
+ UnpackedTarball/libjpeg-turbo/jddctmgr \
+ UnpackedTarball/libjpeg-turbo/jdhuff \
+ UnpackedTarball/libjpeg-turbo/jdicc \
+ UnpackedTarball/libjpeg-turbo/jdinput \
+ UnpackedTarball/libjpeg-turbo/jdmainct \
+ UnpackedTarball/libjpeg-turbo/jdmarker \
+ UnpackedTarball/libjpeg-turbo/jdmaster \
+ UnpackedTarball/libjpeg-turbo/jdmerge \
+ UnpackedTarball/libjpeg-turbo/jdphuff \
+ UnpackedTarball/libjpeg-turbo/jdpostct \
+ UnpackedTarball/libjpeg-turbo/jdsample \
+ UnpackedTarball/libjpeg-turbo/jdtrans \
+ UnpackedTarball/libjpeg-turbo/jerror \
+ UnpackedTarball/libjpeg-turbo/jfdctflt \
+ UnpackedTarball/libjpeg-turbo/jfdctfst \
+ UnpackedTarball/libjpeg-turbo/jfdctint \
+ UnpackedTarball/libjpeg-turbo/jidctflt \
+ UnpackedTarball/libjpeg-turbo/jidctfst \
+ UnpackedTarball/libjpeg-turbo/jidctint \
+ UnpackedTarball/libjpeg-turbo/jidctred \
+ UnpackedTarball/libjpeg-turbo/jquant1 \
+ UnpackedTarball/libjpeg-turbo/jquant2 \
+ UnpackedTarball/libjpeg-turbo/jutils \
+ UnpackedTarball/libjpeg-turbo/jmemmgr \
+ UnpackedTarball/libjpeg-turbo/jmemnobs \
+ UnpackedTarball/libjpeg-turbo/jaricom \
+ UnpackedTarball/libjpeg-turbo/jcarith \
+ UnpackedTarball/libjpeg-turbo/jdarith \
+))
+
+ifneq ($(NASM),)
+
+$(eval $(call gb_StaticLibrary_add_nasmflags,libjpeg-turbo,\
+ -I$(call gb_UnpackedTarball_get_dir,libjpeg-turbo)/simd/nasm/ \
+ -I$(dir $(call gb_UnpackedTarball_get_dir,libjpeg-turbo)/$(1)) \
+))
+
+ifeq ($(CPUNAME),X86_64)
+
+$(eval $(call gb_StaticLibrary_add_cflags,libjpeg-turbo,\
+ -DWITH_SIMD \
+))
+
+$(eval $(call gb_StaticLibrary_add_generated_cobjects,libjpeg-turbo,\
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jsimd \
+))
+
+$(eval $(call gb_StaticLibrary_add_generated_nasmobjects,libjpeg-turbo,\
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jsimdcpu.asm \
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jfdctflt-sse.asm \
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jccolor-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jcgray-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jchuff-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jcphuff-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jcsample-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jdcolor-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jdmerge-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jdsample-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jfdctfst-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jfdctint-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jidctflt-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jidctfst-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jidctint-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jidctred-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jquantf-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jquanti-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jccolor-avx2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jcgray-avx2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jcsample-avx2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jdcolor-avx2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jdmerge-avx2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jdsample-avx2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jfdctint-avx2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jidctint-avx2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/x86_64/jquanti-avx2.asm \
+))
+
+else ifeq ($(CPUNAME),INTEL)
+
+$(eval $(call gb_StaticLibrary_add_cflags,libjpeg-turbo,\
+ -DWITH_SIMD \
+))
+
+$(eval $(call gb_StaticLibrary_add_generated_cobjects,libjpeg-turbo,\
+ UnpackedTarball/libjpeg-turbo/simd/i386/jsimd \
+))
+
+$(eval $(call gb_StaticLibrary_add_generated_nasmobjects,libjpeg-turbo,\
+ UnpackedTarball/libjpeg-turbo/simd/i386/jsimdcpu.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jfdctflt-3dn.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jidctflt-3dn.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jquant-3dn.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jccolor-mmx.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jcgray-mmx.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jcsample-mmx.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jdcolor-mmx.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jdmerge-mmx.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jdsample-mmx.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jfdctfst-mmx.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jfdctint-mmx.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jidctfst-mmx.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jidctint-mmx.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jidctred-mmx.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jquant-mmx.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jfdctflt-sse.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jidctflt-sse.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jquant-sse.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jccolor-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jcgray-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jchuff-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jcphuff-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jcsample-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jdcolor-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jdmerge-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jdsample-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jfdctfst-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jfdctint-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jidctflt-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jidctfst-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jidctint-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jidctred-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jquantf-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jquanti-sse2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jccolor-avx2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jcgray-avx2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jcsample-avx2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jdcolor-avx2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jdmerge-avx2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jdsample-avx2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jfdctint-avx2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jidctint-avx2.asm \
+ UnpackedTarball/libjpeg-turbo/simd/i386/jquanti-avx2.asm \
+))
+
+else
+
+$(eval $(call gb_StaticLibrary_add_generated_cobjects,libjpeg-turbo,\
+ UnpackedTarball/libjpeg-turbo/jsimd_none \
+))
+
+endif
+
+else
+
+$(eval $(call gb_StaticLibrary_add_generated_cobjects,libjpeg-turbo,\
+ UnpackedTarball/libjpeg-turbo/jsimd_none \
+))
+
+endif
+
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libjpeg-turbo/UnpackedTarball_libjpeg-turbo.mk b/external/libjpeg-turbo/UnpackedTarball_libjpeg-turbo.mk
index a99df67bb011..22777b863e4c 100644
--- a/external/libjpeg-turbo/UnpackedTarball_libjpeg-turbo.mk
+++ b/external/libjpeg-turbo/UnpackedTarball_libjpeg-turbo.mk
@@ -11,14 +11,13 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,libjpeg-turbo))
$(eval $(call gb_UnpackedTarball_set_tarball,libjpeg-turbo,$(LIBJPEG_TURBO_TARBALL)))
-$(eval $(call gb_UnpackedTarball_update_autoconf_configs,libjpeg-turbo))
-
$(eval $(call gb_UnpackedTarball_set_patchlevel,libjpeg-turbo,0))
-$(eval $(call gb_UnpackedTarball_add_patches,libjpeg-turbo,\
- external/libjpeg-turbo/jpeg-turbo.build.patch.1 \
- $(if $(filter WNT,$(OS)),external/libjpeg-turbo/jpeg-turbo.win_build.patch.1) \
- external/libjpeg-turbo/ubsan.patch \
-))
+# jconfigint.h and jconfig.h generated via
+# cmake -DENABLE_STATIC:BOOL=ON -DENABLE_SHARED:BOOL=NO -DWITH_JAVA:BOOL=OFF -DWITH_TURBOJPEG:BOOL=OFF -DWITH_SIMD:BOOL=ON
+# and then tweaking
+
+$(eval $(call gb_UnpackedTarball_add_file,libjpeg-turbo,jconfigint.h,external/libjpeg-turbo/jconfigint.h))
+$(eval $(call gb_UnpackedTarball_add_file,libjpeg-turbo,jconfig.h,external/libjpeg-turbo/jconfig.h))
# vim: set noet sw=4 ts=4:
diff --git a/external/libjpeg-turbo/jconfig.h b/external/libjpeg-turbo/jconfig.h
new file mode 100644
index 000000000000..7cff688125a9
--- /dev/null
+++ b/external/libjpeg-turbo/jconfig.h
@@ -0,0 +1,86 @@
+/* Version ID for the JPEG library.
+ * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60".
+ */
+#define JPEG_LIB_VERSION 62
+
+/* libjpeg-turbo version */
+#define LIBJPEG_TURBO_VERSION 2.1.1
+
+/* libjpeg-turbo version in integer form */
+#define LIBJPEG_TURBO_VERSION_NUMBER 2001001
+
+/* Support arithmetic encoding */
+#define C_ARITH_CODING_SUPPORTED 1
+
+/* Support arithmetic decoding */
+#define D_ARITH_CODING_SUPPORTED 1
+
+/* Support in-memory source/destination managers */
+#define MEM_SRCDST_SUPPORTED 1
+
+/* Use accelerated SIMD routines. */
+/* #undef WITH_SIMD */
+
+/*
+ * Define BITS_IN_JSAMPLE as either
+ * 8 for 8-bit sample values (the usual setting)
+ * 12 for 12-bit sample values
+ * Only 8 and 12 are legal data precisions for lossy JPEG according to the
+ * JPEG standard, and the IJG code does not support anything else!
+ * We do not support run-time selection of data precision, sorry.
+ */
+
+#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */
+
+/* Define to 1 if you have the <locale.h> header file. */
+/* undef HAVE_LOCALE_H */
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#define HAVE_STDDEF_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define if you need to include <sys/types.h> to get size_t. */
+#define NEED_SYS_TYPES_H 1
+
+/* Define if you have BSD-like bzero and bcopy in <strings.h> rather than
+ memset/memcpy in <string.h>. */
+/* #undef NEED_BSD_STRINGS */
+
+/* Define to 1 if the system has the type `unsigned char'. */
+#define HAVE_UNSIGNED_CHAR 1
+
+/* Define to 1 if the system has the type `unsigned short'. */
+#define HAVE_UNSIGNED_SHORT 1
+
+/* Compiler does not support pointers to undefined structures. */
+/* #undef INCOMPLETE_TYPES_BROKEN */
+
+/* Define if your (broken) compiler shifts signed values as if they were
+ unsigned. */
+/* #undef RIGHT_SHIFT_IS_UNSIGNED */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+/* Extra Libreoffice config for windows */
+#ifdef _MSC_VER
+
+/* Define "boolean" as unsigned char, not int, per Windows custom */
+#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
+typedef unsigned char boolean;
+#endif
+#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
+
+/* Define "INT32" as int, not long, per Windows custom */
+#if !(defined(_BASETSD_H_) || defined(_BASETSD_H)) /* don't conflict if basetsd.h already read */
+typedef short INT16;
+typedef signed int INT32;
+#endif
+#define XMD_H /* prevent jmorecfg.h from redefining it */
+
+#endif /* _MSC_VER */
diff --git a/external/libjpeg-turbo/jconfigint.h b/external/libjpeg-turbo/jconfigint.h
new file mode 100644
index 000000000000..478a4d338b30
--- /dev/null
+++ b/external/libjpeg-turbo/jconfigint.h
@@ -0,0 +1,51 @@
+#include <sal/types.h>
+
+/* libjpeg-turbo build number */
+#define BUILD "20211020"
+
+/* Compiler's inline keyword */
+#undef inline
+
+/* How to obtain function inlining. */
+#if defined _MSC_VER
+#define INLINE __forceinline
+#elif defined __GNUC__
+#define INLINE __attribute__((always_inline)) inline
+#else
+#define INLINE inline
+#endif
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "libjpeg-turbo"
+
+/* Version number of package */
+#define VERSION "2.1.1"
+
+/* The size of `size_t', as computed by sizeof. */
+/* #undef SIZEOF_SIZE_T */
+
+#if defined(__GNUC__) && SAL_TYPES_SIZEOFLONG == SIZEOF_SIZE_T
+/* Define if your compiler has __builtin_ctzl() and sizeof(unsigned long) == sizeof(size_t). */
+#define HAVE_BUILTIN_CTZL
+#endif
+
+/* Define to 1 if you have the <intrin.h> header file. */
+/* #undef HAVE_INTRIN_H */
+
+#if defined(_MSC_VER) && defined(HAVE_INTRIN_H)
+#if (SIZEOF_SIZE_T == 8)
+#define HAVE_BITSCANFORWARD64
+#elif (SIZEOF_SIZE_T == 4)
+#define HAVE_BITSCANFORWARD
+#endif
+#endif
+
+#if defined(__has_attribute)
+#if __has_attribute(fallthrough)
+#define FALLTHROUGH __attribute__((fallthrough));
+#else
+#define FALLTHROUGH
+#endif
+#else
+#define FALLTHROUGH
+#endif
diff --git a/external/libjpeg-turbo/jpeg-turbo.build.patch.1 b/external/libjpeg-turbo/jpeg-turbo.build.patch.1
deleted file mode 100644
index 4d01ad4b9aed..000000000000
--- a/external/libjpeg-turbo/jpeg-turbo.build.patch.1
+++ /dev/null
@@ -1,58 +0,0 @@
-diff -ur jpeg.org/Makefile.am jpeg/Makefile.am
---- jpeg.org/Makefile.am 2014-11-14 12:05:43.349386578 +0100
-+++ jpeg/Makefile.am 2014-11-14 12:06:21.005387021 +0100
-@@ -174,8 +174,6 @@
- rm -rf `find $(distdir) -name .svn`
-
-
--SUBDIRS += md5
--
- if WITH_12BIT
-
- TESTORIG = testorig12.jpg
-diff -ru jpeg-turbo.orig/Makefile.in jpeg-turbo/Makefile.in
---- jpeg-turbo.orig/Makefile.in 2015-09-21 20:48:45.000000000 +0200
-+++ jpeg-turbo/Makefile.in 2015-11-22 16:17:10.326527000 +0100
-@@ -405,7 +405,7 @@
- ETAGS = etags
- CTAGS = ctags
- CSCOPE = cscope
--DIST_SUBDIRS = java simd md5
-+DIST_SUBDIRS = java simd
- am__DIST_COMMON = $(dist_man1_MANS) $(srcdir)/Makefile.in \
- $(srcdir)/config.h.in $(srcdir)/jconfig.h.in \
- $(srcdir)/jconfigint.h.in $(srcdir)/libjpeg.map.in \
-@@ -622,7 +622,7 @@
- jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \
- jquant2.c jutils.c jmemmgr.c jmemnobs.c $(am__append_4) \
- $(am__append_5) $(am__append_6) $(am__append_11)
--SUBDIRS = java $(am__append_10) md5
-+SUBDIRS = java $(am__append_10)
- @WITH_TURBOJPEG_TRUE@libturbojpeg_la_SOURCES = $(libjpeg_la_SOURCES) \
- @WITH_TURBOJPEG_TRUE@ turbojpeg.c turbojpeg.h transupp.c \
- @WITH_TURBOJPEG_TRUE@ transupp.h jdatadst-tj.c jdatasrc-tj.c \
-diff -ru jpeg-turbo.orig/configure jpeg-turbo/configure
---- jpeg-turbo.orig/configure 2015-09-21 20:48:41.000000000 +0200
-+++ jpeg-turbo/configure 2015-11-22 15:23:25.387071000 +0100
-@@ -14630,9 +14630,7 @@
- $as_echo "yes" >&6; }
- else
- rm -rf conftest*
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--$as_echo "no" >&6; }
-- as_fn_error $? "configuration problem: maybe object file format mismatch." "$LINENO" 5
-+ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
- fi
-
-
-@@ -14828,9 +14826,7 @@
- $as_echo "yes" >&6; }
- else
- rm -rf conftest*
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--$as_echo "no" >&6; }
-- as_fn_error $? "configuration problem: maybe object file format mismatch." "$LINENO" 5
-+ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
- fi
-
-
diff --git a/external/libjpeg-turbo/jpeg-turbo.win_build.patch.1 b/external/libjpeg-turbo/jpeg-turbo.win_build.patch.1
deleted file mode 100644
index 00b642703f3a..000000000000
--- a/external/libjpeg-turbo/jpeg-turbo.win_build.patch.1
+++ /dev/null
@@ -1,54 +0,0 @@
-Copy definitions of "boolean", "INT16", "INT32" from win/jconfig.h.in
-
-... into jconfig.h.in, which is the one we use via configure.
-
-diff -ru jpeg-turbo.orig/simd/Makefile.in jpeg-turbo/simd/Makefile.in
---- jpeg-turbo.orig/simd/Makefile.in 2015-09-21 20:48:45.000000000 +0200
-+++ jpeg-turbo/simd/Makefile.in 2015-11-22 10:52:46.975285184 +0100
-@@ -769,8 +769,8 @@
- .asm.lo:
- $(AM_V_GEN) $(LIBTOOL) $(AM_V_lt) --mode=compile --tag NASM $(srcdir)/nasm_lt.sh $(AM_V_lt) $(NASM) $(NAFLAGS) -I$(srcdir) -I. $< -o $@
-
--jsimdcfg.inc: $(srcdir)/jsimdcfg.inc.h ../jpeglib.h ../jconfig.h ../jmorecfg.h
-- $(AM_V_GEN) $(CPP) -I$(top_builddir) -I$(top_builddir)/simd $(srcdir)/jsimdcfg.inc.h | $(EGREP) "^[\;%]|^\ %" | sed 's%_cpp_protection_%%' | sed 's@% define@%define@g' > $@
-+jsimdcfg.inc: $(top_srcdir)/win/jsimdcfg.inc
-+ cp $< $@
-
- # Tell versions [3.59,3.63) of GNU make to not export all variables.
- # Otherwise a system limit (for SysV at least) may be exceeded.
-diff -ru jpeg-turbo.orig/configure jpeg-turbo/configure
---- jpeg-turbo.orig/configure 2015-11-22 15:57:23.702656000 +0100
-+++ jpeg-turbo/configure 2015-11-22 15:59:37.084285000 +0100
-@@ -13931,7 +13931,7 @@
-
- else
-
--$as_echo "#define NEED_BSD_STRINGS 1" >>confdefs.h
-+$as_echo "#undef NEED_BSD_STRINGS" >>confdefs.h
-
- fi
- done
---- jpeg-turbo/jconfig.h.in.orig 2016-11-02 22:43:55.012600000 +0100
-+++ jpeg-turbo/jconfig.h.in 2016-11-02 22:45:01.905400000 +0100
-@@ -71,3 +71,21 @@
-
- /* Define to `unsigned int' if <sys/types.h> does not define. */
- #undef size_t
-+
-+#ifdef _MSC_VER
-+
-+/* Define "boolean" as unsigned char, not int, per Windows custom */
-+#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
-+typedef unsigned char boolean;
-+#endif
-+#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
-+
-+/* Define "INT32" as int, not long, per Windows custom */
-+#if !(defined(_BASETSD_H_) || defined(_BASETSD_H)) /* don't conflict if basetsd.h already read */
-+typedef short INT16;
-+typedef signed int INT32;
-+#endif
-+#define XMD_H /* prevent jmorecfg.h from redefining it */
-+
-+#endif /* _MSC_VER */
-+
diff --git a/external/libjpeg-turbo/ubsan.patch b/external/libjpeg-turbo/ubsan.patch
deleted file mode 100644
index 33d3c15a8b3c..000000000000
--- a/external/libjpeg-turbo/ubsan.patch
+++ /dev/null
@@ -1,39 +0,0 @@
---- jcphuff.c
-+++ jcphuff.c
-@@ -14,6 +14,7 @@
- * suspension.
- */
-
-+#include <stdint.h>
- #define JPEG_INTERNALS
- #include "jinclude.h"
- #include "jpeglib.h"
-@@ -255,7 +256,7 @@
- if (c == 0xFF) { /* need to stuff a zero byte? */
- emit_byte(entropy, 0);
- }
-- put_buffer <<= 8;
-+ put_buffer = (uint_least32_t) put_buffer << 8;
- put_bits -= 8;
- }
-
---- jdarith.c
-+++ jdarith.c
-@@ -306,7 +306,7 @@
- while (m >>= 1)
- if (arith_decode(cinfo, st)) v |= m;
- v += 1; if (sign) v = -v;
-- entropy->last_dc_val[ci] += v;
-+ entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
- }
-
- /* Scale and output the DC coefficient (assumes jpeg_natural_order[0]=0) */
-@@ -564,7 +564,7 @@
- while (m >>= 1)
- if (arith_decode(cinfo, st)) v |= m;
- v += 1; if (sign) v = -v;
-- entropy->last_dc_val[ci] += v;
-+ entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
- }
-
- if (block)