]> granicus.if.org Git - libjpeg-turbo/log
libjpeg-turbo
6 years agoMMI: Use unaligned stores w/ merged upsampling
DRC [Fri, 1 Feb 2019 06:42:09 +0000 (00:42 -0600)]
MMI: Use unaligned stores w/ merged upsampling

... when necessary.  This was an oversight from
2f9e7c84d1a95c1bae8bb8d38fbc2adaeecf4d41

6 years agoMerge branch 'master' into dev
DRC [Fri, 1 Feb 2019 07:01:38 +0000 (01:01 -0600)]
Merge branch 'master' into dev

6 years agoMMI: Fix unaligned comp. perf. for 32-bit PFs also
DRC [Fri, 1 Feb 2019 06:56:02 +0000 (00:56 -0600)]
MMI: Fix unaligned comp. perf. for 32-bit PFs also

(Oversight from 1c2d3cfaaf7324d9091ba3cc4e900f60a16fe1aa)

6 years agoMMI: Fix formatting issue detected by checkstyle
DRC [Fri, 1 Feb 2019 06:24:09 +0000 (00:24 -0600)]
MMI: Fix formatting issue detected by checkstyle

6 years agoLoongson MMI h2v1 and h2v2 merged upsampling
DRC [Fri, 1 Feb 2019 03:24:13 +0000 (21:24 -0600)]
Loongson MMI h2v1 and h2v2 merged upsampling

Based on:
https://github.com/zhanglixia-hf/libjpeg-turbo/commit/e8f5cee5aa83e2d1b0af3a7bd0aaa2391c930fb2

6 years agoLoongson MMI h2v1 fancy upsampling
DRC [Thu, 31 Jan 2019 22:22:31 +0000 (16:22 -0600)]
Loongson MMI h2v1 fancy upsampling

Based on:
https://github.com/zhanglixia-hf/libjpeg-turbo/commit/e8f5cee5aa83e2d1b0af3a7bd0aaa2391c930fb2

6 years agoLoongson MMI RGB-to-Grayscale conversion
DRC [Thu, 31 Jan 2019 19:54:46 +0000 (13:54 -0600)]
Loongson MMI RGB-to-Grayscale conversion

Based on:
https://github.com/zhanglixia-hf/libjpeg-turbo/commit/e8f5cee5aa83e2d1b0af3a7bd0aaa2391c930fb2

6 years agoImprove readability of Loongson MMI code
DRC [Thu, 31 Jan 2019 04:41:57 +0000 (22:41 -0600)]
Improve readability of Loongson MMI code

We have more than eight registers to work with, as well as three-operand
intrinsics, so there's no need for the implementation to be such a
literal port of the MMX code.

6 years agoMMI: Use aligned store instructions when possible
DRC [Wed, 30 Jan 2019 20:12:06 +0000 (14:12 -0600)]
MMI: Use aligned store instructions when possible

This improves decompression performance by 2-5%.

6 years agoLoongson MMI fast forward/inverse DCT
DRC [Wed, 30 Jan 2019 01:51:08 +0000 (19:51 -0600)]
Loongson MMI fast forward/inverse DCT

Based on:
https://github.com/zhanglixia-hf/libjpeg-turbo/commit/32a9ca222d7e4c8e01bb75cd137f204a0587b383

6 years agoMerge branch 'master' into dev
DRC [Thu, 31 Jan 2019 21:30:25 +0000 (15:30 -0600)]
Merge branch 'master' into dev

6 years agoMMI: Fix comp. perf. issue w/ unaligned image rows
DRC [Wed, 30 Jan 2019 18:43:45 +0000 (12:43 -0600)]
MMI: Fix comp. perf. issue w/ unaligned image rows

Using ldc1 with a non-64-bit-aligned memory location causes as much as a
10x slow-down in overall compression performance.

6 years agoBuild: Fix install of static build w/ VStudio IDE
DRC [Fri, 25 Jan 2019 22:46:02 +0000 (16:46 -0600)]
Build: Fix install of static build w/ VStudio IDE

Unfortunately, this hack is necessary because:
- install(TARGETS, ...) doesn't support the RENAME option.
- We can't modify OUTPUT_NAME for the "-static" targets without breaking
  the regression tests.
- ${CMAKE_CFG_INTDIR} doesn't seem to work properly in an install()
  command.

Refer to #307

6 years agowrbmp.c, wrtarga.c: Remove unused variables
DRC [Wed, 23 Jan 2019 22:18:41 +0000 (16:18 -0600)]
wrbmp.c, wrtarga.c: Remove unused variables

(should have been done with the previous commit)

6 years agoEliminate support for compilers w/o unsigned char
DRC [Wed, 23 Jan 2019 20:58:24 +0000 (14:58 -0600)]
Eliminate support for compilers w/o unsigned char

libjpeg-turbo has never really supported such compilers, since (AFAIK)
they are non-existent on any modern computing platform and thus
impossible for us to test.  (Also, the TurboJPEG API would break without
unsigned chars.)

Furthermore, the unified CMake-based build system introduced in 2.0
always defines HAVE_UNSIGNED_CHAR, so retaining other code paths is
pointless.  Eliminating support for compilers without unsigned char
eliminates the need for the GETJSAMPLE() macro, which improves the
readability of many parts of the code as well as improving the
performance of writing Targa and Windows BMP files.

Fixes #317

6 years agoMerge branch 'master' into dev
DRC [Wed, 23 Jan 2019 17:20:11 +0000 (11:20 -0600)]
Merge branch 'master' into dev

6 years agoLICENSE.md: Clarifications RE: BSD & zlib licenses
DRC [Wed, 23 Jan 2019 14:27:45 +0000 (08:27 -0600)]
LICENSE.md: Clarifications RE: BSD & zlib licenses

Including the license templates was confusing to some, since it made
it appear as if the copyright year and author were unspecified for the
libjpeg-turbo source.  Thus, rather than include the zlib License
template, link to that template on opensource.org.  For the Modified BSD
License, include a roll-up of copyright years and authors, since the
terms of that license require the text of it to be included in product
documentation for binary distributions without accompanying source code.

6 years agoBUILDING.md: Update/simplify Android build instr.
DRC [Tue, 22 Jan 2019 18:11:03 +0000 (12:11 -0600)]
BUILDING.md: Update/simplify Android build instr.

Use the android.toolchain.cmake toolchain file in the NDK (v13b or
later), since this toolchain file generally takes care of setting the
approprate compiler flags and dealing with the differences between
GCC and Clang.  Our custom Android build procedure did not work with
Clang-based NDK toolchains, which meant that it could not be made to
work with NDK v18b or later.

Fixes #309

6 years agoBuild: Fix regression test failure w/ ctest -j
Orivej Desh [Mon, 21 Jan 2019 22:56:56 +0000 (22:56 +0000)]
Build: Fix regression test failure w/ ctest -j

The djpeg rgb-islow-icc-cmp test must run after the djpeg rgb-islow
test, since the latter generates testout_rgb_islow.icc.

6 years agodjpeg: Fix PPM output regression w/ color quant.
DRC [Mon, 21 Jan 2019 22:25:02 +0000 (16:25 -0600)]
djpeg: Fix PPM output regression w/ color quant.

Regression caused by aa7459050d7a50e1d8a99488902d41fbc118a50f

Fix based on:
https://github.com/sinic/libjpeg-turbo/commit/03fbacb8ebf1fffc3f2d2db26ddf4db8b1f6aa7b

Closes #310

6 years agoTurboJPEG: Decompress 4:4:4 JPEGs with unusual SFs
DRC [Mon, 21 Jan 2019 19:57:55 +0000 (13:57 -0600)]
TurboJPEG: Decompress 4:4:4 JPEGs with unusual SFs

Normally, 4:4:4 JPEGs have horizontal x vertical luminance & chrominance
sampling factors of 1x1.  However, it is technically legal to create
4:4:4 JPEGs with sampling factors of 2x1, 1x2, 3x1, or 1x3, since the
sums of the products of those sampling factors are still <= 10.  The
libjpeg API correctly decodes such images, so the TurboJPEG API should
as well.

Fixes #323

6 years agoMerge branch 'master' into dev
DRC [Wed, 2 Jan 2019 03:53:19 +0000 (21:53 -0600)]
Merge branch 'master' into dev

6 years agoMerge branch 'master' into dev
DRC [Wed, 2 Jan 2019 03:52:21 +0000 (21:52 -0600)]
Merge branch 'master' into dev

6 years agoTravis: Use Homebrew addon to improve performance
Stephen [Wed, 2 Jan 2019 03:36:03 +0000 (19:36 -0800)]
Travis: Use Homebrew addon to improve performance

6 years agoTJBench Java: Properly handle transform warnings
DRC [Wed, 2 Jan 2019 03:16:33 +0000 (21:16 -0600)]
TJBench Java: Properly handle transform warnings

+ warnings from TJDecompressor.decompressHeader()

6 years agoTJBench: Fix FPE when decompressing 0-width JPEG
DRC [Wed, 2 Jan 2019 03:08:27 +0000 (21:08 -0600)]
TJBench: Fix FPE when decompressing 0-width JPEG

Fixes #319

6 years agowrbmp.c: Don't allow quantization w/ non-RGB CS
DRC [Wed, 2 Jan 2019 02:32:40 +0000 (20:32 -0600)]
wrbmp.c: Don't allow quantization w/ non-RGB CS

If cinfo->quantize_colors == 1, then jpeg_calc_output_dimensions() will
set cinfo->output_components to 1, and if cinfo->out_color_space is not
RGB (or extended RGB), hilarity will ensue.

Fixes #305

6 years agowrbmp.c: Use IsExtRGB() macro where appropriate
DRC [Wed, 2 Jan 2019 02:15:25 +0000 (20:15 -0600)]
wrbmp.c: Use IsExtRGB() macro where appropriate

(to improve readability)

6 years agotjLoadImage(): Fix int overflow/segfault w/big BMP
DRC [Wed, 2 Jan 2019 00:57:36 +0000 (18:57 -0600)]
tjLoadImage(): Fix int overflow/segfault w/big BMP

Fixes #304

6 years agojversion.h: Bump copyright year to 2019
DRC [Wed, 2 Jan 2019 00:29:55 +0000 (18:29 -0600)]
jversion.h: Bump copyright year to 2019

6 years agoBuild: Fix regr. that nuked RPATH in Mac/iOS build
DRC [Tue, 1 Jan 2019 20:26:48 +0000 (14:26 -0600)]
Build: Fix regr. that nuked RPATH in Mac/iOS build

Caused by 950580eb0c020598a4c6c8aa46c86e31062e1ddc.  Since the code that
sets CMAKE_INSTALL_RPATH now depends on ENABLE_SHARED, that code needed
to be moved to after the point at which ENABLE_SHARED is defined.

6 years agoBump version to 2.0.2 to prepare for new commits
DRC [Tue, 1 Jan 2019 19:55:01 +0000 (13:55 -0600)]
Bump version to 2.0.2 to prepare for new commits

6 years agoTravis: Fetch GPG key from libjpeg-turbo.org
DRC [Wed, 21 Nov 2018 04:52:36 +0000 (22:52 -0600)]
Travis: Fetch GPG key from libjpeg-turbo.org

I give up on the public keyserver.  It inexplicably just fails
sometimes.  I was trying to use it out of an abundance of caution
(<cough> paranoia <cough>), but it seems like most open source projects
just serve up their public keys from their project web sites.  The
private and public pre-release keys are still stored on separate sites,
the private key is still strongly encrypted by Travis, and we use a
separate key for pre-releases anyhow, so even if it's compromised, we
can quickly and easily deploy a new one.

6 years agoBuild: Fix issue with HAVE_MAPFILE test on Solaris
DRC [Thu, 15 Nov 2018 17:54:20 +0000 (11:54 -0600)]
Build: Fix issue with HAVE_MAPFILE test on Solaris

We have to link the test code into a shared library, or else the mapfile
prevents necessary libc symbols from being exposed.

6 years agoMerge branch 'master' into dev
DRC [Mon, 12 Nov 2018 20:40:19 +0000 (14:40 -0600)]
Merge branch 'master' into dev

6 years agoTravis: Try high-availability SKS keyserver pool 2.0.1
DRC [Mon, 12 Nov 2018 19:20:28 +0000 (13:20 -0600)]
Travis: Try high-availability SKS keyserver pool

The saga continues ...

6 years agotjbench.c: Fix compiler warnings with GCC 8
DRC [Mon, 12 Nov 2018 18:27:23 +0000 (12:27 -0600)]
tjbench.c: Fix compiler warnings with GCC 8

strncpy() may fail to truncate dst if len == strlen(dst).

6 years agoBuild: Fix install error with fully static build
DRC [Mon, 12 Nov 2018 17:22:07 +0000 (11:22 -0600)]
Build: Fix install error with fully static build

Closes #273

6 years agoTravis: Don't check key server SSL certificate
DRC [Fri, 2 Nov 2018 16:55:29 +0000 (11:55 -0500)]
Travis: Don't check key server SSL certificate

... when downloading the RPM signing key.  Apparently the key server
URL sometimes redirects to an https URL, which may explain why fetching
the RPM signing keys failed frequently when we used to run wget inside
of the CentOS 5 Docker container.

6 years agoTravis: Work around frequent build failures
DRC [Fri, 26 Oct 2018 14:29:09 +0000 (09:29 -0500)]
Travis: Work around frequent build failures

The build will consistently fail for days at a time with:

error: http://pool.sks-keyservers.net/pks/lookup?op=get&search=0x0575F26BD5B3FDB1: import read failed(-1).

I have a hunch that this is related to the CentOS 5 Docker container, so
this commit causes Travis to download the RPM signing key outside of
the container and share it with the container.

6 years agoAndroid: Fix "using JNI after critical get" error
DRC [Fri, 26 Oct 2018 13:55:22 +0000 (08:55 -0500)]
Android: Fix "using JNI after critical get" error

We shouldn't be making JNI calls between GetPrimitiveArrayCritical() and
ReleasePrimitiveArrayCritical().  Apparently Android is stricter about
this than desktop Java.

Issue was introduced in 0713c1bb542672257c08782a5a930a577eb20167.

Fixes #300

6 years agoInclude .pc files in LJT SDKs for Visual C++
DRC [Thu, 11 Oct 2018 20:13:34 +0000 (15:13 -0500)]
Include .pc files in LJT SDKs for Visual C++

These are apparently useful in certain esoteric build environments.

Closes #296

6 years agocjpeg: Fix OOB read caused by malformed 8-bit TGA
DRC [Fri, 5 Oct 2018 21:13:07 +0000 (16:13 -0500)]
cjpeg: Fix OOB read caused by malformed 8-bit TGA

... in which one or more of the color indices is out of range for the
number of palette entries.

Fix partly borrowed from jpeg-9c.

Fixes #295

6 years agoClarify that Win7 SP0 crash was a regression
DRC [Sun, 30 Sep 2018 16:56:08 +0000 (11:56 -0500)]
Clarify that Win7 SP0 crash was a regression

6 years agoSIMD: Fix c000001d exception on Win 7 w/o SP1
DRC [Fri, 28 Sep 2018 20:46:35 +0000 (15:46 -0500)]
SIMD: Fix c000001d exception on Win 7 w/o SP1

Apparently Windows 7 without SP1 has O/S support for XSAVE but not for
YMM registers, and this exposed a bug in our usage of xgetbv.  The test
instruction will set ZF only if none of the bits match between the two
operarands, so in effect, we were enabling AVX2 instructions if the O/S
supported XSAVE and the CPU supported AVX2 but the O/S only supported
XMM registers.  This bug was not exposed on, for instance, Windows XP or
RHEL 5 because those O/S's do not support XSAVE.

Fixes #288

6 years agoBuild: Update javah target to work with JDK 10+
DRC [Fri, 21 Sep 2018 20:50:08 +0000 (15:50 -0500)]
Build: Update javah target to work with JDK 10+

javah is no longer a thing, but 'javac -h' can accomplish the same task.

6 years agoBUILDING.md: Correct/update Java information
DRC [Fri, 21 Sep 2018 20:12:38 +0000 (15:12 -0500)]
BUILDING.md: Correct/update Java information

- CMake 3.10.x or later must be used with JDK 11, or an error
  ("regex not supported") will occur when CMake tries to parse the Java
  version number.
- The JDK is no longer available at java.com.

6 years agoAdd x32 ABI support on Linux
DRC [Tue, 4 Sep 2018 21:56:22 +0000 (16:56 -0500)]
Add x32 ABI support on Linux

The x32 ABI is similar to the x86-64 ABI but uses 32-bit pointers.
(Refer to https://sites.google.com/site/x32abi)

Based on:
https://github.com/libjpeg-turbo/libjpeg-turbo/pull/274/commits/8da8fc5213d87336d6c7200aaeeca925603e12cf
https://github.com/libjpeg-turbo/libjpeg-turbo/pull/274/commits/1e33dfea8042230e266b453f53d69a6e37b7f0de
https://github.com/libjpeg-turbo/libjpeg-turbo/pull/274/commits/24ffea78da0f18d0d467d16e02dfb903e6c0181e
https://github.com/libjpeg-turbo/libjpeg-turbo/pull/274/commits/dedcf76753c8913ef5c3c6e4ea329d29494b6065
https://github.com/libjpeg-turbo/libjpeg-turbo/pull/274/commits/d04228a7b58b9aed5bcbec383630ec1a14a3c9ca
https://github.com/libjpeg-turbo/libjpeg-turbo/pull/274/commits/b4ad38316ae1899c8a00b6568bb0325d82edcd7a

Closes #274

6 years agoBump version to 2.1 alpha1
DRC [Tue, 4 Sep 2018 21:57:52 +0000 (16:57 -0500)]
Bump version to 2.1 alpha1

(to prepare for new features)

6 years agoEnable DSPr2 SIMD extensions if CPU type is mipsel
Rosen Penev [Wed, 5 Sep 2018 02:17:58 +0000 (19:17 -0700)]
Enable DSPr2 SIMD extensions if CPU type is mipsel

The DSPr2 extensions have been verified to work with little endian MIPS.
Whether or not CMAKE_SYSTEM_PROCESSOR is set to "mips" or "mipsel" in a
little endian MIPS environment seems to be inconsistent, but our build
system needs to handle both cases.

6 years agoFix MIPS DSPr2 build when using soft float ABI
DRC [Tue, 4 Sep 2018 22:33:12 +0000 (17:33 -0500)]
Fix MIPS DSPr2 build when using soft float ABI

(for instance, when passing -msoft-float to the compiler)

The instructions used by jsimd_quantize_float_dspr2() and
jsimd_convsamp_float_dspr2() don't work with the soft float ABI, so
disable those functions when soft float is enabled.

Based on:
https://github.com/libjpeg-turbo/libjpeg-turbo/pull/272/commits/129a739bfabe1568d078eb2719691a76db128185

Closes #272

6 years agojconfig.h: restore Autotools compatibility
DRC [Fri, 31 Aug 2018 17:55:33 +0000 (12:55 -0500)]
jconfig.h: restore Autotools compatibility

(regression introduced with the CMake-based Un*x build system)

Refer to change log for more details.

Based on:
https://github.com/libjpeg-turbo/libjpeg-turbo/pull/275/commits/d992d12bc7631c29ab4adc42a7c5b4273fe2d56e

Closes #275

6 years agoBump version to 2.0.1 to prepare for new commits
DRC [Fri, 31 Aug 2018 17:54:09 +0000 (12:54 -0500)]
Bump version to 2.0.1 to prepare for new commits

6 years agoCorrect various typos in code comments
luzpaz [Tue, 31 Jul 2018 21:59:16 +0000 (21:59 +0000)]
Correct various typos in code comments

Found via `codespell -q 3`

Closes #263

6 years agoClarify Android Windows build instructions 2.0.0
DRC [Fri, 27 Jul 2018 16:44:46 +0000 (11:44 -0500)]
Clarify Android Windows build instructions

(must add .exe to CMAKE_C_COMPILER)

Addresses a concern raised in #245, #260

6 years agoBump revision to 2.0.0
DRC [Wed, 25 Jul 2018 16:03:20 +0000 (11:03 -0500)]
Bump revision to 2.0.0

6 years agoBuild: Don't use @rpath with OS X 10.4 builds
DRC [Wed, 25 Jul 2018 02:16:00 +0000 (21:16 -0500)]
Build: Don't use @rpath with OS X 10.4 builds

@rpath is only supported with 10.5 and later deployment targets.
libjpeg-turbo hasn't supported 10.4 "Tiger" since prior to 1.4, but I
still sometimes use the 10.4 SDK to test PowerPC code in a Snow Leopard
VM.

6 years agoFix JPEG spec references per ISO/ITU-T suggestions
DRC [Tue, 24 Jul 2018 23:36:51 +0000 (18:36 -0500)]
Fix JPEG spec references per ISO/ITU-T suggestions

- When referring to specific clauses, annexes, tables, and figures, a
  "timed reference" (a reference that includes the year) must be used in
  order to avoid confusion.
- "CCITT" = "ITU-T"
- Replace ambiguous "JPEG spec" with the specific document number.

7 years agoFix int overflow when decompr. corrupt prog. JPEG
Even Rouault [Fri, 20 Jul 2018 16:04:15 +0000 (18:04 +0200)]
Fix int overflow when decompr. corrupt prog. JPEG

No discernible performance regression

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9447
Credit to OSS Fuzz
Closes #259

7 years agocjpeg: Fix OOB read caused by malformed 8-bit BMP
DRC [Fri, 20 Jul 2018 22:21:36 +0000 (17:21 -0500)]
cjpeg: Fix OOB read caused by malformed 8-bit BMP

... in which one or more of the color indices is out of range for the
number of palette entries.

Fix partly borrowed from jpeg-9c.  This commit also adopts Guido's
JERR_PPM_OUTOFRANGE enum value in lieu of our project-specific
JERR_PPM_TOOLARGE enum value.

Fixes #258

7 years agoBuild: Preserve CMake exe suffix from cmd line
DRC [Fri, 20 Jul 2018 16:30:04 +0000 (11:30 -0500)]
Build: Preserve CMake exe suffix from cmd line

Normally the value of CMAKE_EXECUTABLE_SUFFIX is clobbered by project().

This allows for specifying an executable suffix of .html with Emscripten
builds, which causes Emscripten to build standalone HTML versions of the
libjpeg-turbo test programs.

7 years agoHonor CMake exe suffix when inst. static builds
DRC [Thu, 19 Jul 2018 22:01:42 +0000 (17:01 -0500)]
Honor CMake exe suffix when inst. static builds

This specifically allows an Emscripten (WASM) static build (for which
CMAKE_EXECUTABLE_SUFFIX=.js) to be properly installed.

7 years agoREADME.ijg: Clarification regarding JPEG 2000/XR
DRC [Tue, 10 Jul 2018 20:06:46 +0000 (15:06 -0500)]
README.ijg: Clarification regarding JPEG 2000/XR

The sentence:
"Indeed, one of the original reasons for developing this free software
was to help force convergence on common, interoperable format standards
for JPEG files."
might be seen to imply that JPEG 2000 and JPEG XR are not interoperable
with themselves, although it is certainly the case that those formats
are not interoperable with each other, nor with
ITU T.81 | ISO/IEC 10918.  They are also certainly not as common as
ITU T.81 | ISO/IEC 10918, and (as an example) popular web browsers will
not display JPEG 2000 files.

The sentence in question was originally referring to proprietary,
non-standard formats and was meant to provide historical context.
libjpeg was originally released prior to the adoption of JFIF as an
official standard, so it encouraged adoption of JFIF as a de facto
standard by providing, under a business-friendly free software license,
a library for reading and writing images in that format.

7 years agoBUILDING.md: Correct iOS/Android examples
DRC [Mon, 2 Jul 2018 16:42:06 +0000 (11:42 -0500)]
BUILDING.md: Correct iOS/Android examples

toolchain.cmake should be created in the build directory, so the scripts
need to cd to that directory before generating that file.

Closes #254

7 years agoBuild: Detect whether compiler supports DSPr2
DRC [Fri, 29 Jun 2018 17:45:57 +0000 (12:45 -0500)]
Build: Detect whether compiler supports DSPr2

This is basically the same test that was performed in acinclude.m4 in
the old autotools-based build system.  It was not ported to the
CMake-based build system because I previously had no way of testing
a non-DSPr2 build environment.

Fixes #248

7 years agoFix jpeg_skip_scanlines() segfault w/merged upsamp
Darrell Walisser [Sat, 16 Jun 2018 22:31:35 +0000 (18:31 -0400)]
Fix jpeg_skip_scanlines() segfault w/merged upsamp

Fixes NULL pointer reference when decompressing 4:2:2 or 4:2:0 JPEG
images with cinfo.do_fancy_upsampling = FALSE.

Closes #244

7 years agoFix infinite loop in partial image decompression
DRC [Sun, 24 Jun 2018 22:31:15 +0000 (17:31 -0500)]
Fix infinite loop in partial image decompression

... caused by using certain specific combinations of
jpeg_skip_scanlines() and jpeg_read_scanlines() calls with progressive,
vertically-subsampled JPEG images.

Fixes #237

7 years agotjLoadImage(): Fix FPE triggered by malformed BMP
DRC [Wed, 13 Jun 2018 01:27:00 +0000 (20:27 -0500)]
tjLoadImage(): Fix FPE triggered by malformed BMP

In rdbmp.c, it is necessary to guard against 32-bit overflow/wraparound
when allocating the row buffer, because since BMP files have 32-bit
width and height fields, the value of biWidth can be up to 4294967295.
Specifically, if biWidth is 1073741824 and cinfo->input_components = 4,
then the samplesperrow argument in alloc_sarray() would wrap around to
0, and a division by zero error would occur at line 458 in jmemmgr.c.

If biWidth is set to a higher value, then samplesperrow would wrap
around to a small number, which would likely cause a buffer overflow
(this has not been tested or verified.)

7 years agoTurboJPEG: Handle JERR_BMP*,JERR_PPM* error codes
DRC [Tue, 12 Jun 2018 23:49:37 +0000 (18:49 -0500)]
TurboJPEG: Handle JERR_BMP*,JERR_PPM* error codes

... in tjLoadImage()/tjSaveImage().  These error codes require an add-on
message table, and if it isn't initialized, then format_message()
produces "Bogus message code XXXX" instead.

7 years agoFix CVE-2018-11813
DRC [Tue, 12 Jun 2018 21:08:26 +0000 (16:08 -0500)]
Fix CVE-2018-11813

Refer to change log for details.

Fixes #242

7 years agoTravis: Use SKS keyserver pool
DRC [Tue, 22 May 2018 03:52:39 +0000 (22:52 -0500)]
Travis: Use SKS keyserver pool

pgp.mit.edu seems to be frequently down, which was causing the PR builds
to fail.

7 years agoAdditional code formatting tweaks
DRC [Mon, 21 May 2018 17:07:40 +0000 (12:07 -0500)]
Additional code formatting tweaks

... detected with an improved version of our checkstyle script

7 years agoJava: Further style refinements
DRC [Wed, 16 May 2018 15:49:09 +0000 (10:49 -0500)]
Java: Further style refinements

(detected by enabling additional checkstyle modules)

This commit also removes unnecessary uses of the "private" modifier in
the Java tests/examples.  The default access modifier disallows access
outside of the package, and none of these classes is in a package.  The
only reason we use "private" with member variables in these classes is
to make checkstyle happy, because we want it to enforce that behavior in
the TurboJPEG API code.

7 years agoJava: Reformat code per checkstyle recommendations
DRC [Tue, 15 May 2018 19:51:49 +0000 (14:51 -0500)]
Java: Reformat code per checkstyle recommendations

... and modify tjbench.c to match the variable name changes made to
TJBench.java

("checkstyle" = http://checkstyle.sourceforge.net, not our regex-based
checkstyle script)

7 years agoTurboJPEG: Handle CMYK JPEGs w/ subsampled M, Y
DRC [Thu, 26 Apr 2018 23:01:52 +0000 (18:01 -0500)]
TurboJPEG: Handle CMYK JPEGs w/ subsampled M, Y

Arguably it doesn't make much sense for non-chroma components to be
subsampled (which is why this type of image was overlooked in
cd7c3e6672cce3779450c6dd10d0d70b0c2278b2-- I didn't realize it was a
thing), but certain Adobe applications apparently generate these images.

Fixes #236

7 years agoBump revision to 1.5.91 for post-beta fixes
DRC [Thu, 26 Apr 2018 22:33:52 +0000 (17:33 -0500)]
Bump revision to 1.5.91 for post-beta fixes

7 years agoAdditional code formatting tweaks
DRC [Thu, 12 Apr 2018 22:02:10 +0000 (17:02 -0500)]
Additional code formatting tweaks

... detected with an improved version of our checkstyle script

7 years ago"Further" = "Furthermore"
DRC [Wed, 11 Apr 2018 15:47:16 +0000 (10:47 -0500)]
"Further" = "Furthermore"

Grammar Police.  Has Ray Stevens taught me nothing?

7 years agox86[-64] SIMD: Don't auto-generate jsimdcfg.inc
DRC [Tue, 10 Apr 2018 20:50:22 +0000 (15:50 -0500)]
x86[-64] SIMD: Don't auto-generate jsimdcfg.inc

The old Un*x (autotools-based) build system always auto-generated this
file, but that behavior was more or less a relic of the days before the
libjpeg-turbo colorspace extensions were implemented.  The thinking was
that, if a particular developer wanted to change RGB_RED, RGB_GREEN,
RGB_BLUE, or RGB_PIXELSIZE in order to compress from/decompress to
different RGB pixel layouts, then the SIMD extensions should
automatically respond to those changes whenever they were made to
jmorecfg.h.  The modern reality is that changing RGB_* is no longer
necessary because of the libjpeg-turbo colorspace extensions, and
changing any of the other constants in jsimdcfg.inc can't be done
without making deeper modifications to the SIMD extensions.  In general,
we treat RGB_* as a de facto, immutable part of the legacy libpjeg API.
Realistically, since the values of those constants have been the same in
every Un*x distribution released in the past 20-30 years, any software
that uses a system-supplied build of libjpeg must assume that those
constants will have default values.

Furthermore, even if it made sense to auto-generate jsimdcfg.inc, it was
never possible to do so on Windows, so it was always going to be
necessary to manually generate the Windows version of the file whenever
any of the constants changed.  This commit introduces a new custom CMake
target called "jsimdcfg" that can be used, on Un*x platforms, to
generate jsimdcfg.inc on demand, although this should only be necessary
when introducing new x86 SIMD instructions or making other deep
modifications, such as SIMD acceleration for 12-bit JPEGs.

For those who may be wondering why we don't do the same thing for
win/jconfig.h.in, it's because performing all of the necessary CMake
checks to populate that file is very slow on Windows.

7 years agojsimd_can_encode_mcu_AC_*(): Remove useless checks
mayeut [Mon, 9 Apr 2018 22:02:57 +0000 (00:02 +0200)]
jsimd_can_encode_mcu_AC_*(): Remove useless checks

These were necessary for the first iteration of the feature (see #46),
which provided a different C front end for the SIMD version of the
function.  The final version of the feature uses a common C front end
for both SIMD and non-SIMD implementations, so these checks are no
longer necessary.

Closes #231

7 years agoAdditional code formatting tweaks
DRC [Sun, 8 Apr 2018 17:49:05 +0000 (12:49 -0500)]
Additional code formatting tweaks

... detected with an improved version of our checkstyle script

7 years agoREADMEs: Mention that prog JPEG is now accelerated
DRC [Fri, 6 Apr 2018 23:31:17 +0000 (18:31 -0500)]
READMEs: Mention that prog JPEG is now accelerated

7 years agoREADME.ijg: Wordsmith per ISO/ITU-T suggestions
DRC [Fri, 6 Apr 2018 22:07:56 +0000 (17:07 -0500)]
README.ijg: Wordsmith per ISO/ITU-T suggestions

This commit merges the following paragraph from the latest libjpeg
release:
https://github.com/libjpeg-turbo/ijg/blob/jpeg-9c/README#L222-L229
which takes into account the fact that JFIF is now an official ISO/ITU-T
standard.  I also included the ISO/IEC document number for the JFIF spec
(jpeg-9c included only the ITU-T rec number.)

This commit also heavily wordsmiths the "FILE FORMAT WARS" section.
In jpeg-7 and later, this section has become somewhat impolitic,
referring to JPEG 2000 and JPEG XR as "faulty technologies" and
"momentary mistakes."  The original intent of this section, which was
introduced in jpeg-5 and refined in jpeg-6
(https://github.com/libjpeg-turbo/ijg/blob/jpeg-5/README#L317-L338,
https://github.com/libjpeg-turbo/ijg/blob/jpeg-6b/README#L335-L367)
was to highlight the problem of JPEG file format divergence that existed
in the 1990s prior to the adoption of JFIF as an official ISO/ITU-T
standard.  That problem is fortunately no longer a problem, thanks in
part to the existence of libjpeg.  I have attempted to preserve Tom's
intent of using this section to describe which file formats the code is
compatible with and why it isn't compatible with some file formats
bearing the name "JPEG."  Such modifications always put our project in a
very awkward position, because we are not the IJG and do not claim to
be, but it is still necessary for us to modify the IJG README file from
time to time to eliminate obsolete information while attempting to
remain as neutral as possible.

7 years agoFix compiler warning w/ 32-bit MSVC builds
DRC [Sun, 1 Apr 2018 02:48:20 +0000 (21:48 -0500)]
Fix compiler warning w/ 32-bit MSVC builds

7 years agoFix build errors when C flags include -Werror
DRC [Sat, 31 Mar 2018 21:19:01 +0000 (16:19 -0500)]
Fix build errors when C flags include -Werror

Instructing the compiler to treat warnings as errors caused some of the
compiler tests to fail, because the test code was not 100% clean.

Note that we now use check_symbol_exists() to check for memset() and
memcpy(), since the test code for check_function_exists() produces a
compiler warning due to not including <string.h>.

7 years agoCMakeLists.txt: Move intrin.h header check
DRC [Sat, 31 Mar 2018 20:34:23 +0000 (15:34 -0500)]
CMakeLists.txt: Move intrin.h header check

It is more readable for this to be next to the __builtin_ctzl() check,
since both are used by the accelerated progressive Huffman code.

7 years agoEliminate compiler warnings w/ Solaris Studio
DRC [Sat, 31 Mar 2018 18:51:31 +0000 (13:51 -0500)]
Eliminate compiler warnings w/ Solaris Studio

7 years agoPowerPC: Fix comp. warning when built w/ -maltivec
DRC [Sat, 31 Mar 2018 18:25:44 +0000 (13:25 -0500)]
PowerPC: Fix comp. warning when built w/ -maltivec

7 years agoLICENSE.md: Explain why three licenses were used
DRC [Sat, 31 Mar 2018 17:39:04 +0000 (12:39 -0500)]
LICENSE.md: Explain why three licenses were used

7 years agojversion.h: Bump copyright year to 2018
DRC [Sat, 31 Mar 2018 16:33:22 +0000 (11:33 -0500)]
jversion.h: Bump copyright year to 2018

7 years agoBuild: Use Colin Plumb's public domain MD5 code
DRC [Sat, 31 Mar 2018 15:36:06 +0000 (10:36 -0500)]
Build: Use Colin Plumb's public domain MD5 code

... instead of the RSA code, the license for which contains an
advertising clause.  It is strongly believed that the RSA advertising
clause is innocuous, because:

- A clarification from RSA
  (http://www.ietf.org/ietf-ftp/IPR/RSA-MD-all), published in 2000,
  stated:

  "Implementations of these message-digest algorithms, including
  implementations derived from the reference C code in RFC-1319,
  RFC-1320, and RFC-1321, may be made, used, and sold without license
  from RSA for any purpose."

  Referring to the opinion from Fedora's legal team
  (https://fedoraproject.org/wiki/Licensing:FAQ?rd=Licensing/FAQ#What_about_the_RSA_license_on_their_MD5_implementation.3F_Isn.27t_that_GPL-incompatible.3F),
  this means that md5.c and md5.h, which were derived from the original
  RFC 1321 reference code (http://www.faqs.org/rfcs/rfc1321.html), can
  be used without the RSA license.

- In the context of libjpeg-turbo, RSA's MD5 code was used only in the
  build/test system.  It was not part of the libjpeg-turbo binary
  distribution, and thus the only "material mentioning or referencing"
  the MD5 code was the libjpeg-turbo source code, which-- by virtue of
  including RSA's original copyright headers-- properly attributed the
  code as required under the RSA license.

However, in light of the open source community's tendency to have
knee-jerk reactions to stuff like this, it would've been necessary to
include the above explanation in our source tree in order to head off
potential FUD, and a simple fix is always better than a complex
explanation.

This commit also assigns the 3-clause BSD license to my modifications of
the MD5 code.  This license is the same one used by md5cmp and other
parts of the build system.

7 years agoTravis: Deploy only when using official repo
Matthieu Darbois [Thu, 29 Mar 2018 22:33:00 +0000 (00:33 +0200)]
Travis: Deploy only when using official repo

This prevents build failures on forks that contain a master or dev
branch.

7 years agoBuild: Fix rpath in iOS shared libraries 1.5.90
DRC [Sat, 24 Mar 2018 04:17:08 +0000 (23:17 -0500)]
Build: Fix rpath in iOS shared libraries

When attempting to configure an iOS/ARM build with Xcode 7.2 and CMake
2.8.12, I got the following errors:

CMake Error at CMakeLists.txt:560 (add_library):
  Attempting to use MACOSX_RPATH without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG
  being set.  This could be because you are using a Mac OS X version less
  than 10.5 or because CMake's platform configuration is corrupt.
(x 3)

CMake Error at sharedlib/CMakeLists.txt:38 (add_library):
  Attempting to use MACOSX_RPATH without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG
  being set.  This could be because you are using a Mac OS X version less
  than 10.5 or because CMake's platform configuration is corrupt.
(x 3)

Upgrading to CMake 3.x (tried 3.0 and 3.1) got rid of the errors, but
the resulting shared libs still did not use @rpath as expected.  Note
also that CMake 3.x (at least the two versions I tested) does not
automatically set the MACOSX_RPATH property as claimed.  I could find
nothing in the release notes for later CMake releases to indicate that
either problem has been fixed.  What I did find was this little nugget
of code in the Darwin platform module:

https://github.com/Kitware/CMake/blob/f6b93fbf3ae00a9157af2f6497bed074d585cea9/Modules/Platform/Darwin.cmake#L33-L36

This sets CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG="-Wl,-rpath," only if you
are running OS X 10.5 or later.  It makes no such check for iOS, perhaps
because shared libraries aren't much of a thing with iOS apps.  In any
event, this commit simply sets CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG if it
isn't set already, and that fixes all of the aforementioned problems.

7 years agoTravis: Don't build tags
DRC [Fri, 23 Mar 2018 21:11:06 +0000 (16:11 -0500)]
Travis: Don't build tags

7 years agoFix continuous integration of pull requests
DRC [Fri, 23 Mar 2018 18:57:59 +0000 (13:57 -0500)]
Fix continuous integration of pull requests

- Travis doesn't set the $encrypted_* variables for PRs, so disable GPG
signing when building a PR (artifacts aren't deployed for PRs anyhow,
and even if they were, I wouldn't want them to be signed, as they may
contain unvetted code.)
- Take advantage of the new -d option in buildljt, which allows for
building from an existing Git clone directory.  This eliminates the need
to rename and restore .git/shallow, allows the official build scripts to
work properly when building PRs, and prevents 'git clone' being invoked
twice in CI builds.

Refer to #217

7 years agoInclude .pc and man files in MinGW install[er]s
DRC [Fri, 23 Mar 2018 16:14:50 +0000 (11:14 -0500)]
Include .pc and man files in MinGW install[er]s

These files are potentially useful to MinGW users, since MSYS2 MinGW
environments have a man command by default and provide an easy way to
install pkg-config.

Closes #223

7 years agorelease/installer.nsi.in: Remove extraneous quotes
DRC [Fri, 23 Mar 2018 16:04:45 +0000 (11:04 -0500)]
release/installer.nsi.in: Remove extraneous quotes

These don't seem to affect anything, because $INSTDIR is already quoted
per 25758055ac74db8edb0486c256fe11539086498f.

7 years agojcphuff.c: Fix compiler warning
DRC [Fri, 23 Mar 2018 15:41:07 +0000 (10:41 -0500)]
jcphuff.c: Fix compiler warning

Misleading indentation, introduced by
5b177b3cab5cfb661256c1e74df160158ec6c34e

7 years agoREADME.md: clarify where API docs can be found
DRC [Fri, 23 Mar 2018 05:00:58 +0000 (00:00 -0500)]
README.md: clarify where API docs can be found

7 years agoChangeLog.md: bump revision to prepare for beta
DRC [Thu, 22 Mar 2018 22:15:53 +0000 (17:15 -0500)]
ChangeLog.md: bump revision to prepare for beta