Merge branch 'master' into dev

This commit is contained in:
DRC
2018-03-17 00:27:49 -05:00
11 changed files with 52 additions and 7 deletions

View File

@@ -119,6 +119,9 @@ When using the slow integer DCT/IDCT, this speeds up the compression of RGB
images by approximately 70-100% and the decompression of RGB images by images by approximately 70-100% and the decompression of RGB images by
approximately 2-3.5x. approximately 2-3.5x.
14. Fixed a build error when building with older MinGW releases (regression
caused by 1.5.1[7].)
1.5.3 1.5.3
===== =====

View File

@@ -32,7 +32,7 @@
#include "jinclude.h" #include "jinclude.h"
#include "jpeglib.h" #include "jpeglib.h"
#include "jmemsys.h" /* import the system-dependent declarations */ #include "jmemsys.h" /* import the system-dependent declarations */
#ifndef _WIN32 #if !defined(_MSC_VER) || _MSC_VER > 1600
#include <stdint.h> #include <stdint.h>
#endif #endif
#include <limits.h> #include <limits.h>

View File

@@ -1,7 +1,7 @@
!include x64.nsh !include x64.nsh
Name "@CMAKE_PROJECT_NAME@ SDK for @INST_PLATFORM@" Name "@CMAKE_PROJECT_NAME@ SDK for @INST_PLATFORM@"
OutFile "@CMAKE_CURRENT_BINARY_DIR@\${BUILDDIR}@INST_NAME@.exe" OutFile "@CMAKE_CURRENT_BINARY_DIR@\${BUILDDIR}@INST_NAME@.exe"
InstallDir @INST_DIR@ InstallDir "@INST_DIR@"
SetCompressor bzip2 SetCompressor bzip2

View File

@@ -3,7 +3,7 @@
* *
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
* Copyright (C) 2011, Nokia Corporation and/or its subsidiary(-ies). * Copyright (C) 2011, Nokia Corporation and/or its subsidiary(-ies).
* Copyright (C) 2009-2011, 2013-2014, 2016, D. R. Commander. * Copyright (C) 2009-2011, 2013-2014, 2016, 2018, D. R. Commander.
* Copyright (C) 2015-2016, Matthieu Darbois. * Copyright (C) 2015-2016, Matthieu Darbois.
* *
* Based on the x86 SIMD extension for IJG JPEG library, * Based on the x86 SIMD extension for IJG JPEG library,
@@ -102,7 +102,9 @@ parse_proc_cpuinfo(int bufsize)
LOCAL(void) LOCAL(void)
init_simd(void) init_simd(void)
{ {
#ifndef NO_GETENV
char *env = NULL; char *env = NULL;
#endif
#if !defined(__ARM_NEON__) && defined(__linux__) || defined(ANDROID) || defined(__ANDROID__) #if !defined(__ARM_NEON__) && defined(__linux__) || defined(ANDROID) || defined(__ANDROID__)
int bufsize = 1024; /* an initial guess for the line buffer size limit */ int bufsize = 1024; /* an initial guess for the line buffer size limit */
#endif #endif
@@ -125,6 +127,7 @@ init_simd(void)
} }
#endif #endif
#ifndef NO_GETENV
/* Force different settings through environment variables */ /* Force different settings through environment variables */
env = getenv("JSIMD_FORCENEON"); env = getenv("JSIMD_FORCENEON");
if ((env != NULL) && (strcmp(env, "1") == 0)) if ((env != NULL) && (strcmp(env, "1") == 0))
@@ -135,6 +138,7 @@ init_simd(void)
env = getenv("JSIMD_NOHUFFENC"); env = getenv("JSIMD_NOHUFFENC");
if ((env != NULL) && (strcmp(env, "1") == 0)) if ((env != NULL) && (strcmp(env, "1") == 0))
simd_huffman = 0; simd_huffman = 0;
#endif
} }
GLOBAL(int) GLOBAL(int)

View File

@@ -3,7 +3,7 @@
* *
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
* Copyright (C) 2011, Nokia Corporation and/or its subsidiary(-ies). * Copyright (C) 2011, Nokia Corporation and/or its subsidiary(-ies).
* Copyright (C) 2009-2011, 2013-2014, 2016, D. R. Commander. * Copyright (C) 2009-2011, 2013-2014, 2016, 2018, D. R. Commander.
* Copyright (C) 2015-2016, Matthieu Darbois. * Copyright (C) 2015-2016, Matthieu Darbois.
* *
* Based on the x86 SIMD extension for IJG JPEG library, * Based on the x86 SIMD extension for IJG JPEG library,
@@ -122,7 +122,9 @@ parse_proc_cpuinfo(int bufsize)
LOCAL(void) LOCAL(void)
init_simd(void) init_simd(void)
{ {
#ifndef NO_GETENV
char *env = NULL; char *env = NULL;
#endif
#if defined(__linux__) || defined(ANDROID) || defined(__ANDROID__) #if defined(__linux__) || defined(ANDROID) || defined(__ANDROID__)
int bufsize = 1024; /* an initial guess for the line buffer size limit */ int bufsize = 1024; /* an initial guess for the line buffer size limit */
#endif #endif
@@ -141,6 +143,7 @@ init_simd(void)
} }
#endif #endif
#ifndef NO_GETENV
/* Force different settings through environment variables */ /* Force different settings through environment variables */
env = getenv("JSIMD_FORCENEON"); env = getenv("JSIMD_FORCENEON");
if ((env != NULL) && (strcmp(env, "1") == 0)) if ((env != NULL) && (strcmp(env, "1") == 0))
@@ -161,6 +164,7 @@ init_simd(void)
simd_features |= JSIMD_FASTST3; simd_features |= JSIMD_FASTST3;
if ((env != NULL) && (strcmp(env, "0") == 0)) if ((env != NULL) && (strcmp(env, "0") == 0))
simd_features &= ~JSIMD_FASTST3; simd_features &= ~JSIMD_FASTST3;
#endif
} }
GLOBAL(int) GLOBAL(int)

View File

@@ -42,13 +42,16 @@ static unsigned int simd_huffman = 1;
LOCAL(void) LOCAL(void)
init_simd(void) init_simd(void)
{ {
#ifndef NO_GETENV
char *env = NULL; char *env = NULL;
#endif
if (simd_support != ~0U) if (simd_support != ~0U)
return; return;
simd_support = jpeg_simd_cpu_support(); simd_support = jpeg_simd_cpu_support();
#ifndef NO_GETENV
/* Force different settings through environment variables */ /* Force different settings through environment variables */
env = getenv("JSIMD_FORCEMMX"); env = getenv("JSIMD_FORCEMMX");
if ((env != NULL) && (strcmp(env, "1") == 0)) if ((env != NULL) && (strcmp(env, "1") == 0))
@@ -71,6 +74,7 @@ init_simd(void)
env = getenv("JSIMD_NOHUFFENC"); env = getenv("JSIMD_NOHUFFENC");
if ((env != NULL) && (strcmp(env, "1") == 0)) if ((env != NULL) && (strcmp(env, "1") == 0))
simd_huffman = 0; simd_huffman = 0;
#endif
} }
GLOBAL(int) GLOBAL(int)

View File

@@ -2,7 +2,7 @@
* jsimd_loongson.c * jsimd_loongson.c
* *
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
* Copyright (C) 2009-2011, 2014, 2016, D. R. Commander. * Copyright (C) 2009-2011, 2014, 2016, 2018, D. R. Commander.
* Copyright (C) 2013-2014, MIPS Technologies, Inc., California. * Copyright (C) 2013-2014, MIPS Technologies, Inc., California.
* Copyright (C) 2015, Matthieu Darbois. * Copyright (C) 2015, Matthieu Darbois.
* Copyright (C) 2016-2017, Loongson Technology Corporation Limited, BeiJing. * Copyright (C) 2016-2017, Loongson Technology Corporation Limited, BeiJing.
@@ -34,17 +34,21 @@ static unsigned int simd_support = ~0;
LOCAL(void) LOCAL(void)
init_simd(void) init_simd(void)
{ {
#ifndef NO_GETENV
char *env = NULL; char *env = NULL;
#endif
if (simd_support != ~0U) if (simd_support != ~0U)
return; return;
simd_support |= JSIMD_MMI; simd_support |= JSIMD_MMI;
#ifndef NO_GETENV
/* Force different settings through environment variables */ /* Force different settings through environment variables */
env = getenv("JSIMD_FORCENONE"); env = getenv("JSIMD_FORCENONE");
if ((env != NULL) && (strcmp(env, "1") == 0)) if ((env != NULL) && (strcmp(env, "1") == 0))
simd_support = 0; simd_support = 0;
#endif
} }
GLOBAL(int) GLOBAL(int)

View File

@@ -2,7 +2,7 @@
* jsimd_mips.c * jsimd_mips.c
* *
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
* Copyright (C) 2009-2011, 2014, 2016, D. R. Commander. * Copyright (C) 2009-2011, 2014, 2016, 2018, D. R. Commander.
* Copyright (C) 2013-2014, MIPS Technologies, Inc., California. * Copyright (C) 2013-2014, MIPS Technologies, Inc., California.
* Copyright (C) 2015, Matthieu Darbois. * Copyright (C) 2015, Matthieu Darbois.
* *
@@ -64,7 +64,9 @@ parse_proc_cpuinfo(const char *search_string)
LOCAL(void) LOCAL(void)
init_simd(void) init_simd(void)
{ {
#ifndef NO_GETENV
char *env = NULL; char *env = NULL;
#endif
if (simd_support != ~0U) if (simd_support != ~0U)
return; return;
@@ -81,6 +83,7 @@ init_simd(void)
return; return;
#endif #endif
#ifndef NO_GETENV
/* Force different settings through environment variables */ /* Force different settings through environment variables */
env = getenv("JSIMD_FORCEDSPR2"); env = getenv("JSIMD_FORCEDSPR2");
if ((env != NULL) && (strcmp(env, "1") == 0)) if ((env != NULL) && (strcmp(env, "1") == 0))
@@ -88,6 +91,7 @@ init_simd(void)
env = getenv("JSIMD_FORCENONE"); env = getenv("JSIMD_FORCENONE");
if ((env != NULL) && (strcmp(env, "1") == 0)) if ((env != NULL) && (strcmp(env, "1") == 0))
simd_support = 0; simd_support = 0;
#endif
} }
static const int mips_idct_ifast_coefs[4] = { static const int mips_idct_ifast_coefs[4] = {

View File

@@ -2,7 +2,7 @@
* jsimd_powerpc.c * jsimd_powerpc.c
* *
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
* Copyright (C) 2009-2011, 2014-2016, D. R. Commander. * Copyright (C) 2009-2011, 2014-2016, 2018, D. R. Commander.
* Copyright (C) 2015, Matthieu Darbois. * Copyright (C) 2015, Matthieu Darbois.
* *
* Based on the x86 SIMD extension for IJG JPEG library, * Based on the x86 SIMD extension for IJG JPEG library,
@@ -111,7 +111,9 @@ parse_proc_cpuinfo(int bufsize)
LOCAL(void) LOCAL(void)
init_simd(void) init_simd(void)
{ {
#ifndef NO_GETENV
char *env = NULL; char *env = NULL;
#endif
#if !defined(__ALTIVEC__) && (defined(__linux__) || defined(ANDROID) || defined(__ANDROID__)) #if !defined(__ALTIVEC__) && (defined(__linux__) || defined(ANDROID) || defined(__ANDROID__))
int bufsize = 1024; /* an initial guess for the line buffer size limit */ int bufsize = 1024; /* an initial guess for the line buffer size limit */
#elif defined(__amigaos4__) #elif defined(__amigaos4__)
@@ -144,6 +146,7 @@ init_simd(void)
simd_support |= JSIMD_ALTIVEC; simd_support |= JSIMD_ALTIVEC;
#endif #endif
#ifndef NO_GETENV
/* Force different settings through environment variables */ /* Force different settings through environment variables */
env = getenv("JSIMD_FORCEALTIVEC"); env = getenv("JSIMD_FORCEALTIVEC");
if ((env != NULL) && (strcmp(env, "1") == 0)) if ((env != NULL) && (strcmp(env, "1") == 0))
@@ -151,6 +154,7 @@ init_simd(void)
env = getenv("JSIMD_FORCENONE"); env = getenv("JSIMD_FORCENONE");
if ((env != NULL) && (strcmp(env, "1") == 0)) if ((env != NULL) && (strcmp(env, "1") == 0))
simd_support = 0; simd_support = 0;
#endif
} }
GLOBAL(int) GLOBAL(int)

View File

@@ -42,13 +42,16 @@ static unsigned int simd_huffman = 1;
LOCAL(void) LOCAL(void)
init_simd(void) init_simd(void)
{ {
#ifndef NO_GETENV
char *env = NULL; char *env = NULL;
#endif
if (simd_support != ~0U) if (simd_support != ~0U)
return; return;
simd_support = jpeg_simd_cpu_support(); simd_support = jpeg_simd_cpu_support();
#ifndef NO_GETENV
/* Force different settings through environment variables */ /* Force different settings through environment variables */
env = getenv("JSIMD_FORCESSE2"); env = getenv("JSIMD_FORCESSE2");
if ((env != NULL) && (strcmp(env, "1") == 0)) if ((env != NULL) && (strcmp(env, "1") == 0))
@@ -62,6 +65,7 @@ init_simd(void)
env = getenv("JSIMD_NOHUFFENC"); env = getenv("JSIMD_NOHUFFENC");
if ((env != NULL) && (strcmp(env, "1") == 0)) if ((env != NULL) && (strcmp(env, "1") == 0))
simd_huffman = 0; simd_huffman = 0;
#endif
} }
GLOBAL(int) GLOBAL(int)

View File

@@ -626,9 +626,11 @@ DLLEXPORT int tjCompress2(tjhandle handle, const unsigned char *srcBuf,
cinfo->image_width = width; cinfo->image_width = width;
cinfo->image_height = height; cinfo->image_height = height;
#ifndef NO_PUTENV
if (flags & TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1"); if (flags & TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
else if (flags & TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1"); else if (flags & TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1");
else if (flags & TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1"); else if (flags & TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
#endif
if (flags & TJFLAG_NOREALLOC) { if (flags & TJFLAG_NOREALLOC) {
alloc = 0; *jpegSize = tjBufSize(width, height, jpegSubsamp); alloc = 0; *jpegSize = tjBufSize(width, height, jpegSubsamp);
@@ -724,9 +726,11 @@ DLLEXPORT int tjEncodeYUVPlanes(tjhandle handle, const unsigned char *srcBuf,
cinfo->image_width = width; cinfo->image_width = width;
cinfo->image_height = height; cinfo->image_height = height;
#ifndef NO_PUTENV
if (flags & TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1"); if (flags & TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
else if (flags & TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1"); else if (flags & TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1");
else if (flags & TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1"); else if (flags & TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
#endif
if (setCompDefaults(cinfo, pixelFormat, subsamp, -1, flags) == -1) return -1; if (setCompDefaults(cinfo, pixelFormat, subsamp, -1, flags) == -1) return -1;
@@ -932,9 +936,11 @@ DLLEXPORT int tjCompressFromYUVPlanes(tjhandle handle,
cinfo->image_width = width; cinfo->image_width = width;
cinfo->image_height = height; cinfo->image_height = height;
#ifndef NO_PUTENV
if (flags & TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1"); if (flags & TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
else if (flags & TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1"); else if (flags & TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1");
else if (flags & TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1"); else if (flags & TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
#endif
if (flags & TJFLAG_NOREALLOC) { if (flags & TJFLAG_NOREALLOC) {
alloc = 0; *jpegSize = tjBufSize(width, height, subsamp); alloc = 0; *jpegSize = tjBufSize(width, height, subsamp);
@@ -1210,9 +1216,11 @@ DLLEXPORT int tjDecompress2(tjhandle handle, const unsigned char *jpegBuf,
pitch < 0 || height < 0 || pixelFormat < 0 || pixelFormat >= TJ_NUMPF) pitch < 0 || height < 0 || pixelFormat < 0 || pixelFormat >= TJ_NUMPF)
_throw("tjDecompress2(): Invalid argument"); _throw("tjDecompress2(): Invalid argument");
#ifndef NO_PUTENV
if (flags & TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1"); if (flags & TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
else if (flags & TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1"); else if (flags & TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1");
else if (flags & TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1"); else if (flags & TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
#endif
if (setjmp(this->jerr.setjmp_buffer)) { if (setjmp(this->jerr.setjmp_buffer)) {
/* If we get here, the JPEG code has signaled an error. */ /* If we get here, the JPEG code has signaled an error. */
@@ -1376,9 +1384,11 @@ DLLEXPORT int tjDecodeYUVPlanes(tjhandle handle,
dinfo->image_width = width; dinfo->image_width = width;
dinfo->image_height = height; dinfo->image_height = height;
#ifndef NO_PUTENV
if (flags & TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1"); if (flags & TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
else if (flags & TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1"); else if (flags & TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1");
else if (flags & TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1"); else if (flags & TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
#endif
if (setDecodeDefaults(dinfo, pixelFormat, subsamp, flags) == -1) { if (setDecodeDefaults(dinfo, pixelFormat, subsamp, flags) == -1) {
retval = -1; goto bailout; retval = -1; goto bailout;
@@ -1542,9 +1552,11 @@ DLLEXPORT int tjDecompressToYUVPlanes(tjhandle handle,
width < 0 || height < 0) width < 0 || height < 0)
_throw("tjDecompressToYUVPlanes(): Invalid argument"); _throw("tjDecompressToYUVPlanes(): Invalid argument");
#ifndef NO_PUTENV
if (flags & TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1"); if (flags & TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
else if (flags & TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1"); else if (flags & TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1");
else if (flags & TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1"); else if (flags & TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
#endif
if (setjmp(this->jerr.setjmp_buffer)) { if (setjmp(this->jerr.setjmp_buffer)) {
/* If we get here, the JPEG code has signaled an error. */ /* If we get here, the JPEG code has signaled an error. */
@@ -1796,9 +1808,11 @@ DLLEXPORT int tjTransform(tjhandle handle, const unsigned char *jpegBuf,
dstSizes == NULL || t == NULL || flags < 0) dstSizes == NULL || t == NULL || flags < 0)
_throw("tjTransform(): Invalid argument"); _throw("tjTransform(): Invalid argument");
#ifndef NO_PUTENV
if (flags & TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1"); if (flags & TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
else if (flags & TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1"); else if (flags & TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1");
else if (flags & TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1"); else if (flags & TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
#endif
if ((xinfo = if ((xinfo =
(jpeg_transform_info *)malloc(sizeof(jpeg_transform_info) * n)) == NULL) (jpeg_transform_info *)malloc(sizeof(jpeg_transform_info) * n)) == NULL)