Skip to content

Commit

Permalink
#2728 Upgrade libjpeg-turbo to 2.1.5.1 (#2768)
Browse files Browse the repository at this point in the history
Summary:
Thanks for submitting a PR! Please read these instructions carefully:

- [x] Explain the **motivation** for making this change.
- [x] Provide a **test plan** demonstrating that the code is solid.
- [x] Match the **code formatting** of the rest of the codebase.
- [x] Target the `main` branch

## Motivation (required)

#2728

## Test Plan (required)

Test passed when it ran `createNativeLibrariesTasks`

## Next Steps

Sign the [CLA][2], if you haven't already.

Small pull requests are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.

Make sure all **tests pass** on [Circle CI][4]. PRs that break tests are unlikely to be merged.

For more info, see the [Contributing guide][4].

[1]: https://medium.com/martinkonicek/what-is-a-test-plan-8bfc840ec171#.y9lcuqqi9
[2]: https://code.facebook.com/cla
[3]: https://circleci.com/gh/facebook/fresco
[4]: https://github.com/facebook/fresco/blob/main/CONTRIBUTING.md

Pull Request resolved: #2768

Reviewed By: defHLT

Differential Revision: D57862576

Pulled By: steelrooter

fbshipit-source-id: 3f86c92c27db26e8f9596d227eb0f2184578a9e1
  • Loading branch information
mnt authored and facebook-github-bot committed May 29, 2024
1 parent 97320b8 commit 13909e8
Show file tree
Hide file tree
Showing 17 changed files with 446 additions and 85 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ android.useAndroidX=true
android.enableJetifier=true

# Deps for native libraries
LIBJPEG_TURBO_VERSION=1.5.3
LIBJPEG_TURBO_VERSION=2.1.5.1
# When updating this also change the version in static-webp/src/main/jni/static-webp/Android.mk
LIBPNG_VERSION=1.6.37
GIFLIB_VERSION=5.2.1
Expand Down
2 changes: 1 addition & 1 deletion native-imagetranscoder/src/main/jni/Application.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ NDK_TOOLCHAIN_VERSION := clang
# coming from other stl implementations as well

# This hides all symbols exported from libgnustl_static
FRESCO_CPP_LDFLAGS := -Wl,--gc-sections
FRESCO_CPP_LDFLAGS := -Wl,--gc-sections
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ LOCAL_STATIC_LIBRARIES += fb_jpegturbo
LOCAL_LDFLAGS += -Wl,--exclude-libs,libfb_jpegturbo.a

include $(BUILD_SHARED_LIBRARY)
$(call import-module,libjpeg-turbo-1.5.3)
$(call import-module,libjpeg-turbo-2.1.5.1)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
LOCAL_PATH:= $(call my-dir)

JPEGTURBO_CFLAGS := -DJPEG_LIB_VERSION=80 -Wno-attributes

JPEGTURBO_SRC_FILES := \
jaricom.c \
jcapimin.c \
jcapistd.c \
jcarith.c \
jccoefct.c \
jccolor.c \
jcdctmgr.c \
jchuff.c \
jcicc.c \
jcinit.c \
jcmainct.c \
jcmarker.c \
jcmaster.c \
jcomapi.c \
jcparam.c \
jcphuff.c \
jcprepct.c \
jcsample.c \
jctrans.c \
jdapimin.c \
jdapistd.c \
jdarith.c \
jdatadst.c \
jdatasrc.c \
jdcoefct.c \
jdcolor.c \
jddctmgr.c \
jdhuff.c \
jdicc.c \
jdinput.c \
jdmainct.c \
jdmarker.c \
jdmaster.c \
jdmerge.c \
jdphuff.c \
jdpostct.c \
jdsample.c \
jdtrans.c \
jerror.c \
jfdctflt.c \
jfdctfst.c \
jfdctint.c \
jidctflt.c \
jidctfst.c \
jidctint.c \
jidctred.c \
jmemmgr.c \
jmemnobs.c \
jquant1.c \
jquant2.c \
jutils.c \
transupp.c

# switch between SIMD supported and non supported architectures
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
JPEGTURBO_SRC_FILES += \
simd/arm/aarch32/jchuff-neon.c \
simd/arm/aarch32/jsimd.c \
simd/arm/jccolor-neon.c \
simd/arm/jcgray-neon.c \
simd/arm/jcphuff-neon.c \
simd/arm/jcsample-neon.c \
simd/arm/jdcolor-neon.c \
simd/arm/jdmerge-neon.c \
simd/arm/jdsample-neon.c \
simd/arm/jfdctfst-neon.c \
simd/arm/jfdctint-neon.c \
simd/arm/jidctfst-neon.c \
simd/arm/jidctint-neon.c \
simd/arm/jidctred-neon.c \
simd/arm/jquanti-neon.c
JPEGTURBO_CFLAGS += \
-DNEON_INTRINSICS=1
else ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
JPEGTURBO_SRC_FILES += \
simd/arm/aarch64/jchuff-neon.c \
simd/arm/aarch64/jsimd.c \
simd/arm/jccolor-neon.c \
simd/arm/jcgray-neon.c \
simd/arm/jcphuff-neon.c \
simd/arm/jcsample-neon.c \
simd/arm/jdcolor-neon.c \
simd/arm/jdmerge-neon.c \
simd/arm/jdsample-neon.c \
simd/arm/jfdctfst-neon.c \
simd/arm/jfdctint-neon.c \
simd/arm/jidctfst-neon.c \
simd/arm/jidctint-neon.c \
simd/arm/jidctred-neon.c \
simd/arm/jquanti-neon.c
JPEGTURBO_CFLAGS += \
-DNEON_INTRINSICS=1
else
JPEGTURBO_SRC_FILES += jsimd_none.c
endif

# fb_jpegturbo module
include $(CLEAR_VARS)
LOCAL_MODULE:= fb_jpegturbo
LOCAL_SRC_FILES := $(JPEGTURBO_SRC_FILES)
LOCAL_CFLAGS := $(JPEGTURBO_CFLAGS)
LOCAL_CFLAGS += -mfpu=neon -mfloat-abi=softfp
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
include $(BUILD_STATIC_LIBRARY)
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@
#define JPEG_LIB_VERSION 80

/* libjpeg-turbo version */
#define LIBJPEG_TURBO_VERSION 1.5.3
#define LIBJPEG_TURBO_VERSION 2.1.5.1

/* libjpeg-turbo version in integer form */
#define LIBJPEG_TURBO_VERSION_NUMBER 1005003
#define LIBJPEG_TURBO_VERSION_NUMBER 2001005

/* Define to the sub-directory where libtool stores uninstalled libraries. */
#define LT_OBJDIR ".libs/"
Expand All @@ -101,7 +101,7 @@
#define PACKAGE_NAME "libjpeg-turbo"

/* Define to the full name and version of this package. */
#define PACKAGE_STRING "libjpeg-turbo 1.5.3"
#define PACKAGE_STRING "libjpeg-turbo 2.1.5.1"

/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "libjpeg-turbo"
Expand All @@ -110,7 +110,7 @@
#define PACKAGE_URL ""

/* Define to the version of this package. */
#define PACKAGE_VERSION "1.5.3"
#define PACKAGE_VERSION "2.1.5.1"

/* Define if your (broken) compiler shifts signed values as if they were
unsigned. */
Expand All @@ -127,7 +127,7 @@
#define STDC_HEADERS 1

/* Version number of package */
#define VERSION "1.5.3"
#define VERSION "2.1.5.1"

/* Use accelerated SIMD routines. */
#define WITH_SIMD 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
#define JPEG_LIB_VERSION 80 /* Version 6b */

/* libjpeg-turbo version */
#define LIBJPEG_TURBO_VERSION 1.5.3
#define LIBJPEG_TURBO_VERSION 2.1.5.1

/* libjpeg-turbo version in integer form */
#define LIBJPEG_TURBO_VERSION_NUMBER 1005003
#define LIBJPEG_TURBO_VERSION_NUMBER 2001005

/* Support arithmetic encoding */
#define C_ARITH_CODING_SUPPORTED 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
/* libjpeg-turbo build number */
#define BUILD "20180808"
#define BUILD "20240418"

/* Compiler's inline keyword */
/* #undef inline */

/* How to obtain function inlining. */
#define INLINE inline __attribute__((always_inline))

/* How to obtain thread-local storage */
#define THREAD_LOCAL __thread

/* Define to the full name of this package. */
#define PACKAGE_NAME "libjpeg-turbo"

/* Version number of package */
#define VERSION "1.5.3"
#define VERSION "2.1.5.1"

/* The size of `size_t', as computed by sizeof. */
#ifdef __LP64__
# define SIZEOF_SIZE_T 8
#else
# define SIZEOF_SIZE_T 4
#endif

#if defined(__has_attribute)
#if __has_attribute(fallthrough)
#define FALLTHROUGH __attribute__((fallthrough));
#else
#define FALLTHROUGH
#endif
#else
#define FALLTHROUGH
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* jversion.h
*
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1991-2020, Thomas G. Lane, Guido Vollbeding.
* libjpeg-turbo Modifications:
* Copyright (C) 2010, 2012-2023, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
* This file contains software version identification.
*/


#if JPEG_LIB_VERSION >= 80

#define JVERSION "8d 15-Jan-2012"

#elif JPEG_LIB_VERSION >= 70

#define JVERSION "7 27-Jun-2009"

#else

#define JVERSION "6b 27-Mar-1998"

#endif

/*
* NOTE: It is our convention to place the authors in the following order:
* - libjpeg-turbo authors (2009-) in descending order of the date of their
* most recent contribution to the project, then in ascending order of the
* date of their first contribution to the project, then in alphabetical
* order
* - Upstream authors in descending order of the date of the first inclusion of
* their code
*/

#define JCOPYRIGHT \
"Copyright (C) 2009-2023 D. R. Commander\n" \
"Copyright (C) 2015, 2020 Google, Inc.\n" \
"Copyright (C) 2019-2020 Arm Limited\n" \
"Copyright (C) 2015-2016, 2018 Matthieu Darbois\n" \
"Copyright (C) 2011-2016 Siarhei Siamashka\n" \
"Copyright (C) 2015 Intel Corporation\n" \
"Copyright (C) 2013-2014 Linaro Limited\n" \
"Copyright (C) 2013-2014 MIPS Technologies, Inc.\n" \
"Copyright (C) 2009, 2012 Pierre Ossman for Cendio AB\n" \
"Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)\n" \
"Copyright (C) 1999-2006 MIYASAKA Masaru\n" \
"Copyright (C) 1991-2020 Thomas G. Lane, Guido Vollbeding"

#define JCOPYRIGHT_SHORT \
"Copyright (C) @COPYRIGHT_YEAR@ The libjpeg-turbo Project and many others"
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2020, D. R. Commander. All Rights Reserved.
* Copyright (C) 2020-2021, Arm Limited. All Rights Reserved.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
#if defined(__clang__) || defined(_MSC_VER)
#define HAVE_VLD1_S16_X3
#define HAVE_VLD1_U16_X2
#define HAVE_VLD1Q_U8_X4
#endif
/* Define compiler-independent count-leading-zeros and byte-swap macros */
#if defined(_MSC_VER) && !defined(__clang__)
#define BUILTIN_CLZ(x) _CountLeadingZeros(x)
#define BUILTIN_CLZLL(x) _CountLeadingZeros64(x)
#define BUILTIN_BSWAP64(x) _byteswap_uint64(x)
#elif defined(__clang__) || defined(__GNUC__)
#define BUILTIN_CLZ(x) __builtin_clz(x)
#define BUILTIN_CLZLL(x) __builtin_clzll(x)
#define BUILTIN_BSWAP64(x) __builtin_bswap64(x)
#else
#error "Unknown compiler"
#endif

This file was deleted.

Loading

0 comments on commit 13909e8

Please sign in to comment.