ef9a4e05ba(libjpeg-turbo 1.4.x), which was based on https://bug815473.bmoattachments.org/attachment.cgi?id=692126 (https://bugzilla.mozilla.org/show_bug.cgi?id=815473), modified the C baseline Huffman encoder so that it precomputes jpeg_nbits_table, in order to facilitate sharing the table among multiple processes. However, libjpeg-turbo never shared the table, and because the table was implemented as a static array,f3a8684cd1(libjpeg-turbo 1.5.x) and37bae1a0e9(libjpeg-turbo 2.0.x) each introduced a duplicate copy of the table for (respectively) the SSE2 baseline Huffman encoder and the C progressive Huffman encoder. This commit does the following: - Move the duplicated code in jchuff.c and jcphuff.c, originally introduced in0cfc4c17b7and37bae1a0e9, into a header (jpeg_nbits.h). - Credit the co-author of0cfc4c17b7. (Refer to https://sourceforge.net/p/libjpeg-turbo/patches/57). - Modify the SSE2 baseline Huffman encoder so that the C Huffman encoders can share its definition of jpeg_nbits_table. - Move the definition of jpeg_nbits_table into a C source file (jpeg_nbits.c) rather than a header, and define the table only if USE_CLZ_INTRINSIC is undefined and the SSE2 baseline Huffman encoder will not be built. - Apply hidden symbol visibility to the shared definition of jpeg_nbits_table, if the compiler supports the necessary attribute. (In practice, only Visual C++ doesn't.) Closes #114 See also: https://bugzilla.mozilla.org/show_bug.cgi?id=1501523
77 lines
1.8 KiB
C
77 lines
1.8 KiB
C
/* libjpeg-turbo build number */
|
|
#define BUILD "@BUILD@"
|
|
|
|
/* How to hide global symbols. */
|
|
#define HIDDEN @HIDDEN@
|
|
|
|
/* Compiler's inline keyword */
|
|
#undef inline
|
|
|
|
/* How to obtain function inlining. */
|
|
#define INLINE @INLINE@
|
|
|
|
/* How to obtain thread-local storage */
|
|
#define THREAD_LOCAL @THREAD_LOCAL@
|
|
|
|
/* Define to the full name of this package. */
|
|
#define PACKAGE_NAME "@CMAKE_PROJECT_NAME@"
|
|
|
|
/* Version number of package */
|
|
#define VERSION "@VERSION@"
|
|
|
|
/* The size of `size_t', as computed by sizeof. */
|
|
#define SIZEOF_SIZE_T @SIZE_T@
|
|
|
|
/* Define if your compiler has __builtin_ctzl() and sizeof(unsigned long) == sizeof(size_t). */
|
|
#cmakedefine HAVE_BUILTIN_CTZL
|
|
|
|
/* Define to 1 if you have the <intrin.h> header file. */
|
|
#cmakedefine 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
|
|
|
|
/*
|
|
* 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!
|
|
*/
|
|
|
|
#ifndef BITS_IN_JSAMPLE
|
|
#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */
|
|
#endif
|
|
|
|
#undef C_ARITH_CODING_SUPPORTED
|
|
#undef D_ARITH_CODING_SUPPORTED
|
|
#undef WITH_SIMD
|
|
|
|
#if BITS_IN_JSAMPLE == 8
|
|
|
|
/* Support arithmetic encoding */
|
|
#cmakedefine C_ARITH_CODING_SUPPORTED 1
|
|
|
|
/* Support arithmetic decoding */
|
|
#cmakedefine D_ARITH_CODING_SUPPORTED 1
|
|
|
|
/* Use accelerated SIMD routines. */
|
|
#cmakedefine WITH_SIMD 1
|
|
|
|
#endif
|