Merge branch 'master' into dev

This commit is contained in:
DRC
2018-11-12 14:40:19 -06:00
11 changed files with 70 additions and 32 deletions

View File

@@ -79,7 +79,9 @@ script:
- if [ "${BUILD_OFFICIAL:-}" != "" ]; then
mkdir -p ~/src/ljt.nightly &&
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
docker run -v $HOME/src/ljt.nightly:/root/src/ljt.nightly -v $HOME/src/buildscripts:/root/src/buildscripts -v $TRAVIS_BUILD_DIR:/root/src/libjpeg-turbo -v $HOME/.gnupg:/root/.gnupg -t dcommander/buildljt:latest bash -c "rpm --import http://pool.sks-keyservers.net/pks/lookup?op=get\&search=0x0575F26BD5B3FDB1 && ~/src/buildscripts/buildljt -d /root/src/libjpeg-turbo -v" &&
mkdir $HOME/rpmkeys &&
wget --no-check-certificate "http://ha.pool.sks-keyservers.net/pks/lookup?op=get&search=0x0575F26BD5B3FDB1" -O $HOME/rpmkeys/LJTPR-GPG-KEY &&
docker run -v $HOME/src/ljt.nightly:/root/src/ljt.nightly -v $HOME/src/buildscripts:/root/src/buildscripts -v $TRAVIS_BUILD_DIR:/root/src/libjpeg-turbo -v $HOME/.gnupg:/root/.gnupg -v $HOME/rpmkeys:/rpmkeys -t dcommander/buildljt:latest bash -c "rpm --import /rpmkeys/LJTPR-GPG-KEY && ~/src/buildscripts/buildljt -d /root/src/libjpeg-turbo -v" &&
sudo chown -R travis:travis ~/src/ljt.nightly &&
mv ~/src/ljt.nightly/latest/log-$TRAVIS_OS_NAME.txt ~/src/ljt.nightly/latest/files/;
else

View File

@@ -48,8 +48,9 @@ Build Requirements
install the Java Developer Package, which can be downloaded from
<http://developer.apple.com/downloads> (Apple ID required.) For other
systems, you can obtain the Oracle Java Development Kit from
<http://www.java.com>.
<http://www.oracle.com/technetwork/java/javase/downloads>.
* If using JDK 11 or later, CMake 3.10.x or later must also be used.
### Windows
@@ -83,7 +84,10 @@ Build Requirements
appropriate compiler paths automatically set.
- If building the TurboJPEG Java wrapper, JDK 1.5 or later is required. This
can be downloaded from <http://www.java.com>.
can be downloaded from
<http://www.oracle.com/technetwork/java/javase/downloads>.
* If using JDK 11 or later, CMake 3.10.x or later must also be used.
Out-of-Tree Builds

View File

@@ -111,7 +111,9 @@ endif()
include(cmakescripts/GNUInstallDirs.cmake)
if(ENABLE_SHARED)
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR})
endif()
macro(report_directory var)
if(CMAKE_INSTALL_${var} STREQUAL CMAKE_INSTALL_FULL_${var})
@@ -1379,10 +1381,10 @@ if(UNIX OR MINGW)
${CMAKE_CURRENT_SOURCE_DIR}/rdjpgcom.1
${CMAKE_CURRENT_SOURCE_DIR}/wrjpgcom.1
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
endif()
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgscripts/libjpeg.pc
${CMAKE_CURRENT_BINARY_DIR}/pkgscripts/libturbojpeg.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/jconfig.h
${CMAKE_CURRENT_SOURCE_DIR}/jerror.h ${CMAKE_CURRENT_SOURCE_DIR}/jmorecfg.h

View File

@@ -33,6 +33,19 @@ functions in the MIPS DSPr2 SIMD extensions are now disabled at compile time
if the soft float ABI is enabled. Those functions use instructions that are
incompatible with the soft float ABI.
3. Fixed a regression in the SIMD feature detection code, introduced by
the AVX2 SIMD extensions (2.0 beta1[1]), that caused libjpeg-turbo to crash on
Windows 7 if Service Pack 1 was not installed.
4. Fixed out-of-bounds read in cjpeg that occurred when attempting to compress
a specially-crafted malformed color-index (8-bit-per-sample) Targa file in
which some of the samples (color indices) exceeded the bounds of the Targa
file's color table.
5. Fixed an issue whereby installing a fully static build of libjpeg-turbo
(a build in which `CFLAGS` contains `-static` and `ENABLE_SHARED` is `0`) would
fail with "No valid ELF RPATH or RUNPATH entry exists in the file."
2.0.0
=====

View File

@@ -58,11 +58,21 @@ endif()
add_custom_target(javadoc COMMAND
javadoc -notimestamp -d ${CMAKE_CURRENT_SOURCE_DIR}/doc -sourcepath ${CMAKE_CURRENT_SOURCE_DIR} org.libjpegturbo.turbojpeg)
set(JAVACLASSPATH ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/turbojpeg-java.dir)
if(Java_VERSION_MAJOR GREATER 9)
add_custom_target(javah
COMMAND javac -h ${CMAKE_CURRENT_SOURCE_DIR} -classpath ${JAVACLASSPATH}
-d ${CMAKE_CURRENT_BINARY_DIR}/__unused
${CMAKE_CURRENT_SOURCE_DIR}/org/libjpegturbo/turbojpeg/TJ.java
${CMAKE_CURRENT_SOURCE_DIR}/org/libjpegturbo/turbojpeg/TJCompressor.java
${CMAKE_CURRENT_SOURCE_DIR}/org/libjpegturbo/turbojpeg/TJDecompressor.java
${CMAKE_CURRENT_SOURCE_DIR}/org/libjpegturbo/turbojpeg/TJTransformer.java)
else()
add_custom_target(javah
COMMAND javah -d ${CMAKE_CURRENT_SOURCE_DIR} -classpath ${JAVACLASSPATH} org.libjpegturbo.turbojpeg.TJ
COMMAND javah -d ${CMAKE_CURRENT_SOURCE_DIR} -classpath ${JAVACLASSPATH} org.libjpegturbo.turbojpeg.TJCompressor
COMMAND javah -d ${CMAKE_CURRENT_SOURCE_DIR} -classpath ${JAVACLASSPATH} org.libjpegturbo.turbojpeg.TJDecompressor
COMMAND javah -d ${CMAKE_CURRENT_SOURCE_DIR} -classpath ${JAVACLASSPATH} org.libjpegturbo.turbojpeg.TJTransformer)
endif()
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_JAVADIR)
set(CMAKE_INSTALL_DEFAULT_JAVADIR "<CMAKE_INSTALL_DATAROOTDIR>/java")

View File

@@ -3,8 +3,9 @@
*
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1991-1996, Thomas G. Lane.
* It was modified by The libjpeg-turbo Project to include only code relevant
* to libjpeg-turbo.
* Modified 2017 by Guido Vollbeding.
* libjpeg-turbo Modifications:
* Copyright (C) 2018, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@@ -66,6 +67,7 @@ typedef struct _tga_source_struct {
U_CHAR tga_pixel[4];
int pixel_size; /* Bytes per Targa pixel (1 to 4) */
int cmap_length; /* colormap length */
/* State info for reading RLE-coded pixels; both counts must be init to 0 */
int block_count; /* # of pixels remaining in RLE block */
@@ -196,11 +198,14 @@ get_8bit_row(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
register JSAMPROW ptr;
register JDIMENSION col;
register JSAMPARRAY colormap = source->colormap;
int cmaplen = source->cmap_length;
ptr = source->pub.buffer[0];
for (col = cinfo->image_width; col > 0; col--) {
(*source->read_pixel) (source); /* Load next pixel into tga_pixel */
t = UCH(source->tga_pixel[0]);
if (t >= cmaplen)
ERREXIT(cinfo, JERR_TGA_BADPARMS);
*ptr++ = colormap[0][t];
*ptr++ = colormap[1][t];
*ptr++ = colormap[2][t];
@@ -452,12 +457,14 @@ start_input_tga(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
/* Allocate space to store the colormap */
source->colormap = (*cinfo->mem->alloc_sarray)
((j_common_ptr)cinfo, JPOOL_IMAGE, (JDIMENSION)maplen, (JDIMENSION)3);
source->cmap_length = (int)maplen;
/* and read it from the file */
read_colormap(source, (int)maplen, UCH(targaheader[7]));
} else {
if (cmaptype) /* but you promised a cmap! */
ERREXIT(cinfo, JERR_TGA_BADPARMS);
source->colormap = NULL;
source->cmap_length = 0;
}
cinfo->input_components = components;

View File

@@ -62,15 +62,15 @@ Section "@CMAKE_PROJECT_NAME@ SDK for @INST_PLATFORM@ (required)"
File "@CMAKE_CURRENT_BINARY_DIR@\libturbojpeg.a"
File "@CMAKE_CURRENT_BINARY_DIR@\libjpeg.dll.a"
File "@CMAKE_CURRENT_BINARY_DIR@\libjpeg.a"
SetOutPath $INSTDIR\lib\pkgconfig
File "@CMAKE_CURRENT_BINARY_DIR@\pkgscripts\libjpeg.pc"
File "@CMAKE_CURRENT_BINARY_DIR@\pkgscripts\libturbojpeg.pc"
!else
File "@CMAKE_CURRENT_BINARY_DIR@\${BUILDDIR}turbojpeg.lib"
File "@CMAKE_CURRENT_BINARY_DIR@\${BUILDDIR}turbojpeg-static.lib"
File "@CMAKE_CURRENT_BINARY_DIR@\${BUILDDIR}jpeg.lib"
File "@CMAKE_CURRENT_BINARY_DIR@\${BUILDDIR}jpeg-static.lib"
!endif
SetOutPath $INSTDIR\lib\pkgconfig
File "@CMAKE_CURRENT_BINARY_DIR@\pkgscripts\libjpeg.pc"
File "@CMAKE_CURRENT_BINARY_DIR@\pkgscripts\libturbojpeg.pc"
!ifdef JAVA
SetOutPath $INSTDIR\classes
File "@CMAKE_CURRENT_BINARY_DIR@\java\turbojpeg.jar"
@@ -130,8 +130,6 @@ Section "Uninstall"
Delete $INSTDIR\lib\libturbojpeg.a
Delete $INSTDIR\lib\libjpeg.dll.a
Delete $INSTDIR\lib\libjpeg.a
Delete $INSTDIR\lib\pkgconfig\libjpeg.pc
Delete $INSTDIR\lib\pkgconfig\libturbojpeg.pc
!else
Delete $INSTDIR\bin\jpeg@SO_MAJOR_VERSION@.dll
Delete $INSTDIR\bin\turbojpeg.dll
@@ -141,6 +139,8 @@ Section "Uninstall"
Delete $INSTDIR\lib\turbojpeg.lib
Delete $INSTDIR\lib\turbojpeg-static.lib
!endif
Delete $INSTDIR\lib\pkgconfig\libjpeg.pc
Delete $INSTDIR\lib\pkgconfig\libturbojpeg.pc
!ifdef JAVA
Delete $INSTDIR\classes\turbojpeg.jar
!endif
@@ -175,9 +175,7 @@ Section "Uninstall"
!endif
RMDir "$INSTDIR\include"
!ifdef GCC
RMDir "$INSTDIR\lib\pkgconfig"
!endif
RMDir "$INSTDIR\lib"
RMDir "$INSTDIR\doc"
!ifdef GCC

View File

@@ -94,9 +94,10 @@ EXTN(jpeg_simd_cpu_support):
xor ecx, ecx
xgetbv
test eax, 6 ; O/S does not manage XMM/YMM state
and eax, 6
cmp eax, 6 ; O/S does not manage XMM/YMM state
; using XSAVE
jz short .no_avx2
jnz short .no_avx2
or edi, JSIMD_AVX2
.no_avx2:

View File

@@ -60,9 +60,10 @@ EXTN(jpeg_simd_cpu_support):
xor rcx, rcx
xgetbv
test rax, 6 ; O/S does not manage XMM/YMM state
and rax, 6
cmp rax, 6 ; O/S does not manage XMM/YMM state
; using XSAVE
jz short .return
jnz short .return
or rdi, JSIMD_AVX2

View File

@@ -60,8 +60,8 @@ int tjErrorLine = -1, tjErrorCode = -1;
if (strncmp(tjErrorStr, _tjErrorStr, JMSG_LENGTH_MAX) || \
strncmp(tjErrorMsg, m, JMSG_LENGTH_MAX) || \
tjErrorCode != _tjErrorCode || tjErrorLine != __LINE__) { \
strncpy(tjErrorStr, _tjErrorStr, JMSG_LENGTH_MAX); \
strncpy(tjErrorMsg, m, JMSG_LENGTH_MAX); \
strncpy(tjErrorStr, _tjErrorStr, JMSG_LENGTH_MAX - 1); \
strncpy(tjErrorMsg, m, JMSG_LENGTH_MAX - 1); \
tjErrorCode = _tjErrorCode; \
tjErrorLine = __LINE__; \
printf("WARNING in line %d while %s:\n%s\n", __LINE__, m, _tjErrorStr); \

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C)2011-2017 D. R. Commander. All Rights Reserved.
* Copyright (C)2011-2018 D. R. Commander. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -235,11 +235,11 @@ static jint TJCompressor_compress
if ((*env)->GetArrayLength(env, dst) < (jsize)jpegSize)
_throwarg("Destination buffer is not large enough");
if (ProcessSystemProperties(env) < 0) goto bailout;
bailif0(srcBuf = (*env)->GetPrimitiveArrayCritical(env, src, 0));
bailif0(jpegBuf = (*env)->GetPrimitiveArrayCritical(env, dst, 0));
if (ProcessSystemProperties(env) < 0) goto bailout;
if (tjCompress2(handle, &srcBuf[y * actualPitch + x * tjPixelSize[pf]],
width, pitch, height, pf, &jpegBuf, &jpegSize, jpegSubsamp,
jpegQual, flags | TJFLAG_NOREALLOC) == -1)
@@ -341,6 +341,8 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFrom
if ((*env)->GetArrayLength(env, dst) < (jsize)jpegSize)
_throwarg("Destination buffer is not large enough");
if (ProcessSystemProperties(env) < 0) goto bailout;
bailif0(srcOffsets = (*env)->GetPrimitiveArrayCritical(env, jSrcOffsets, 0));
bailif0(srcStrides = (*env)->GetPrimitiveArrayCritical(env, jSrcStrides, 0));
for (i = 0; i < nc; i++) {
@@ -365,8 +367,6 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFrom
}
bailif0(jpegBuf = (*env)->GetPrimitiveArrayCritical(env, dst, 0));
if (ProcessSystemProperties(env) < 0) goto bailout;
if (tjCompressFromYUVPlanes(handle, srcPlanes, width, srcStrides, height,
subsamp, &jpegBuf, &jpegSize, jpegQual,
flags | TJFLAG_NOREALLOC) == -1)