Skip to content

Commit fb16334

Browse files
authored
Merge pull request #210 from pornel/turbo150
Libjpeg-turbo 1.5.0
2 parents e4e091a + dbbf618 commit fb16334

116 files changed

Lines changed: 292 additions & 278 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

BUILDING.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ Build Requirements
1313
[MacPorts](http://www.MacPorts.org).
1414

1515
- NASM or YASM (if building x86 or x86-64 SIMD extensions)
16-
* NASM 0.98, or 2.01 or later is required for an x86 build (0.99 and 2.00 do
17-
not work properly with libjpeg-turbo's x86 SIMD code.)
18-
* NASM 2.00 or later is required for an x86-64 build.
19-
* NASM 2.07, or 2.11.09 or later is required for an x86-64 Mac build
20-
(2.11.08 does not work properly with libjpeg-turbo's x86-64 SIMD code when
21-
building macho64 objects.) NASM or YASM can be obtained from
22-
[MacPorts](http://www.MacPorts.org).
16+
* If using NASM, 0.98, or 2.01 or later is required for an x86 build (0.99
17+
and 2.00 do not work properly with libjpeg-turbo's x86 SIMD code.)
18+
* If using NASM, 2.00 or later is required for an x86-64 build.
19+
* If using NASM, 2.07 or later (except 2.11.08) is required for an x86-64
20+
Mac build (2.11.08 does not work properly with libjpeg-turbo's x86-64 SIMD
21+
code when building macho64 objects.) NASM or YASM can be obtained from
22+
[MacPorts](http://www.macports.org/).
2323

2424
The binary RPMs released by the NASM project do not work on older Linux
2525
systems, such as Red Hat Enterprise Linux 4. On such systems, you can
@@ -458,11 +458,12 @@ Building on Windows (Visual C++ or MinGW)
458458
Build Requirements
459459
------------------
460460

461-
- [CMake](http://www.cmake.org) v2.8.8 or later
461+
- [CMake](http://www.cmake.org) v2.8.11 or later
462462

463-
- [NASM](http://www.nasm.us/) 0.98 or later (NASM 2.05 or later is required for
464-
a 64-bit build)
465-
* nasm.exe should be in your `PATH`.
463+
- [NASM](http://www.nasm.us) or [YASM](http://yasm.tortall.net)
464+
* If using NASM, 0.98 or later is required for an x86 build.
465+
* If using NASM, 2.05 or later is required for an x86-64 build.
466+
* nasm.exe/yasm.exe should be in your `PATH`.
466467

467468
- Microsoft Visual C++ 2005 or later
468469

@@ -668,11 +669,11 @@ front-end classes to support it. This allows the TurboJPEG shared library to
668669
be used directly from Java applications. See [java/README](java/README) for
669670
more details.
670671

671-
If you are using CMake 2.8, you can set the `Java_JAVAC_EXECUTABLE`,
672-
`Java_JAVA_EXECUTABLE`, and `Java_JAR_EXECUTABLE` CMake variables to specify
673-
alternate commands or locations for javac, jar, and java (respectively.) You
674-
can also set the `JAVACFLAGS` CMake variable to specify arguments that should
675-
be passed to the Java compiler when building the front-end classes.
672+
You can set the `Java_JAVAC_EXECUTABLE`, `Java_JAVA_EXECUTABLE`, and
673+
`Java_JAR_EXECUTABLE` CMake variables to specify alternate commands or
674+
locations for javac, jar, and java (respectively.) You can also set the
675+
`JAVACFLAGS` CMake variable to specify arguments that should be passed to the
676+
Java compiler when building the front-end classes.
676677

677678

678679
Installing libjpeg-turbo

CMakeLists.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Setup
33
#
44

5-
cmake_minimum_required(VERSION 2.8.8)
5+
cmake_minimum_required(VERSION 2.8.11)
66
# Use LINK_INTERFACE_LIBRARIES instead of INTERFACE_LINK_LIBRARIES
77
if(POLICY CMP0022)
88
cmake_policy(SET CMP0022 OLD)
@@ -11,20 +11,12 @@ endif()
1111
project(mozjpeg C)
1212
set(VERSION 3.1)
1313

14-
if(WIN32)
15-
execute_process(COMMAND "wmic.exe" "os" "get" "LocalDateTime" OUTPUT_VARIABLE
16-
BUILD)
17-
string(REGEX REPLACE "[^0-9]" "" BUILD "${BUILD}")
18-
if (BUILD STREQUAL "")
19-
execute_process(COMMAND "cmd.exe" "/C" "DATE" "/T" OUTPUT_VARIABLE BUILD)
20-
string(REGEX REPLACE ".*[ ]([0-9]*)[/.]([0-9]*)[/.]([0-9]*).*" "\\3\\2\\1" BUILD "${BUILD}")
21-
else()
22-
string(SUBSTRING "${BUILD}" 0 8 BUILD)
23-
endif()
24-
else()
14+
if(NOT WIN32)
2515
message(FATAL_ERROR "Platform not supported by this build system. Use autotools instead.")
2616
endif()
2717

18+
string(TIMESTAMP BUILD "%Y%m%d")
19+
2820
# This does nothing except when using MinGW. CMAKE_BUILD_TYPE has no meaning
2921
# in Visual Studio, and it always defaults to Debug when using NMake.
3022
if(NOT CMAKE_BUILD_TYPE)
@@ -65,6 +57,14 @@ else()
6557
set(BITS_IN_JSAMPLE 8)
6658
endif()
6759

60+
if(WITH_JPEG8 OR WITH_JPEG7)
61+
set(WITH_ARITH_ENC 1)
62+
set(WITH_ARITH_DEC 1)
63+
endif()
64+
if(WITH_JPEG8)
65+
set(WITH_MEM_SRCDST 1)
66+
endif()
67+
6868
if(WITH_ARITH_ENC)
6969
set(C_ARITH_CODING_SUPPORTED 1)
7070
message(STATUS "Arithmetic encoding support enabled")

ChangeLog.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ calling `tjDecompressHeader3()`, or if the return value from
2727
`tjDecompressHeader3()` was ignored (both cases represent incorrect usage of
2828
the TurboJPEG API.)
2929

30+
5. Fixed an issue in the ARM 32-bit SIMD-accelerated Huffman encoder that
31+
prevented the code from assembling properly with clang.
32+
33+
6. The `jpeg_stdio_src()`, `jpeg_mem_src()`, `jpeg_stdio_dest()`, and
34+
`jpeg_mem_dest()` functions in the libjpeg API will now throw an error if a
35+
source/destination manager has already been assigned to the compress or
36+
decompress object by a different function or by the calling program. This
37+
prevents these functions from attempting to reuse a source/destination manager
38+
structure that was allocated elsewhere, because there is no way to ensure that
39+
it would be big enough to accommodate the new source/destination manager.
40+
3041

3142
1.4.90 (1.5 beta1)
3243
==================

configure.ac

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,16 @@ AC_SUBST(MEM_SRCDST_FUNCTIONS)
232232

233233
AC_DEFINE_UNQUOTED(MOZJPEG_VERSION, [$VERSION], [mozjpeg version])
234234

235+
m4_define(version_triplet,m4_split(AC_PACKAGE_VERSION,[[.]]))
236+
m4_define(version_major,m4_argn(1,version_triplet))
237+
m4_define(version_minor,m4_argn(2,version_triplet))
238+
m4_define(version_revision,m4_argn(3,version_triplet))
239+
VERSION_MAJOR=version_major
240+
VERSION_MINOR=version_minor
241+
VERSION_REVISION=version_revision
242+
LIBJPEG_TURBO_VERSION_NUMBER=`printf "%d%03d%03d" $VERSION_MAJOR $VERSION_MINOR $VERSION_REVISION`
243+
AC_DEFINE_UNQUOTED(LIBJPEG_TURBO_VERSION_NUMBER, [$LIBJPEG_TURBO_VERSION_NUMBER], [libjpeg-turbo version in integer form])
244+
235245
VERSION_SCRIPT=yes
236246
AC_ARG_ENABLE([ld-version-script],
237247
AS_HELP_STRING([--disable-ld-version-script],
@@ -287,10 +297,13 @@ AC_DEFINE_UNQUOTED([INLINE],[$ljt_cv_inline],[How to obtain function inlining.])
287297
AC_MSG_CHECKING([whether to include arithmetic encoding support])
288298
AC_ARG_WITH([arith-enc],
289299
AC_HELP_STRING([--without-arith-enc],
290-
[Do not include arithmetic encoding support]))
300+
[Do not include arithmetic encoding support when emulating the libjpeg v6b API/ABI]))
291301
if test "x$with_12bit" = "xyes"; then
292302
with_arith_enc=no
293303
fi
304+
if test "x${with_jpeg8}" = "xyes" -o "x${with_jpeg7}" = "xyes"; then
305+
with_arith_enc=yes
306+
fi
294307
if test "x$with_arith_enc" = "xno"; then
295308
AC_MSG_RESULT(no)
296309
RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-arith-enc"
@@ -303,10 +316,13 @@ AM_CONDITIONAL([WITH_ARITH_ENC], [test "x$with_arith_enc" != "xno"])
303316
AC_MSG_CHECKING([whether to include arithmetic decoding support])
304317
AC_ARG_WITH([arith-dec],
305318
AC_HELP_STRING([--without-arith-dec],
306-
[Do not include arithmetic decoding support]))
319+
[Do not include arithmetic decoding support when emulating the libjpeg v6b API/ABI]))
307320
if test "x$with_12bit" = "xyes"; then
308321
with_arith_dec=no
309322
fi
323+
if test "x${with_jpeg8}" = "xyes" -o "x${with_jpeg7}" = "xyes"; then
324+
with_arith_dec=yes
325+
fi
310326
if test "x$with_arith_dec" = "xno"; then
311327
AC_MSG_RESULT(no)
312328
RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-arith-dec"

jccolor.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* Copyright (C) 1991-1996, Thomas G. Lane.
66
* libjpeg-turbo Modifications:
77
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
8-
* Copyright (C) 2009-2012, 2015 D. R. Commander.
9-
* Copyright (C) 2014, MIPS Technologies, Inc., California
8+
* Copyright (C) 2009-2012, 2015, D. R. Commander.
9+
* Copyright (C) 2014, MIPS Technologies, Inc., California.
1010
* For conditions of distribution and use, see the accompanying README.ijg
1111
* file.
1212
*

jchuff.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* This file was part of the Independent JPEG Group's software:
55
* Copyright (C) 1991-1997, Thomas G. Lane.
66
* libjpeg-turbo Modifications:
7-
* Copyright (C) 2009-2011, 2014-2016 D. R. Commander.
8-
* Copyright (C) 2015 Matthieu Darbois.
7+
* Copyright (C) 2009-2011, 2014-2016, D. R. Commander.
8+
* Copyright (C) 2015, Matthieu Darbois.
99
* For conditions of distribution and use, see the accompanying README.ijg
1010
* file.
1111
*

jconfig.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
/* libjpeg-turbo version */
77
#define LIBJPEG_TURBO_VERSION 0
88

9+
/* libjpeg-turbo version in integer form */
10+
#define LIBJPEG_TURBO_VERSION_NUMBER 0
11+
912
/* Support arithmetic encoding */
1013
#undef C_ARITH_CODING_SUPPORTED
1114

jcsample.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Copyright (C) 1991-1996, Thomas G. Lane.
66
* libjpeg-turbo Modifications:
77
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
8-
* Copyright (C) 2014, MIPS Technologies, Inc., California
8+
* Copyright (C) 2014, MIPS Technologies, Inc., California.
99
* Copyright (C) 2015, D. R. Commander.
1010
* For conditions of distribution and use, see the accompanying README.ijg
1111
* file.

jdatadst-tj.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Copyright (C) 1994-1996, Thomas G. Lane.
66
* Modified 2009-2012 by Guido Vollbeding.
77
* libjpeg-turbo Modifications:
8-
* Copyright (C) 2011, 2014 D. R. Commander.
8+
* Copyright (C) 2011, 2014, 2016, D. R. Commander.
99
* For conditions of distribution and use, see the accompanying README.ijg
1010
* file.
1111
*
@@ -167,6 +167,11 @@ jpeg_mem_dest_tj (j_compress_ptr cinfo,
167167
dest = (my_mem_dest_ptr) cinfo->dest;
168168
dest->newbuffer = NULL;
169169
dest->buffer = NULL;
170+
} else if (cinfo->dest->init_destination != init_mem_destination) {
171+
/* It is unsafe to reuse the existing destination manager unless it was
172+
* created by this function.
173+
*/
174+
ERREXIT(cinfo, JERR_BUFFER_SIZE);
170175
}
171176

172177
dest = (my_mem_dest_ptr) cinfo->dest;

jdatadst.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Copyright (C) 1994-1996, Thomas G. Lane.
66
* Modified 2009-2012 by Guido Vollbeding.
77
* libjpeg-turbo Modifications:
8-
* Copyright (C) 2013, D. R. Commander.
8+
* Copyright (C) 2013, 2016, D. R. Commander.
99
* For conditions of distribution and use, see the accompanying README.ijg
1010
* file.
1111
*
@@ -210,14 +210,19 @@ jpeg_stdio_dest (j_compress_ptr cinfo, FILE *outfile)
210210

211211
/* The destination object is made permanent so that multiple JPEG images
212212
* can be written to the same file without re-executing jpeg_stdio_dest.
213-
* This makes it dangerous to use this manager and a different destination
214-
* manager serially with the same JPEG object, because their private object
215-
* sizes may be different. Caveat programmer.
216213
*/
217214
if (cinfo->dest == NULL) { /* first time for this JPEG object? */
218215
cinfo->dest = (struct jpeg_destination_mgr *)
219216
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
220217
sizeof(my_destination_mgr));
218+
} else if (cinfo->dest->init_destination != init_destination) {
219+
/* It is unsafe to reuse the existing destination manager unless it was
220+
* created by this function. Otherwise, there is no guarantee that the
221+
* opaque structure is the right size. Note that we could just create a
222+
* new structure, but the old structure would not be freed until
223+
* jpeg_destroy_compress() was called.
224+
*/
225+
ERREXIT(cinfo, JERR_BUFFER_SIZE);
221226
}
222227

223228
dest = (my_dest_ptr) cinfo->dest;
@@ -259,6 +264,11 @@ jpeg_mem_dest (j_compress_ptr cinfo,
259264
cinfo->dest = (struct jpeg_destination_mgr *)
260265
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
261266
sizeof(my_mem_destination_mgr));
267+
} else if (cinfo->dest->init_destination != init_mem_destination) {
268+
/* It is unsafe to reuse the existing destination manager unless it was
269+
* created by this function.
270+
*/
271+
ERREXIT(cinfo, JERR_BUFFER_SIZE);
262272
}
263273

264274
dest = (my_mem_dest_ptr) cinfo->dest;

0 commit comments

Comments
 (0)