]> granicus.if.org Git - libjpeg-turbo/log
libjpeg-turbo
7 years agoTravis/OS X: Use 'brew bundle' + Brewfile
Stephen [Wed, 3 Jan 2018 15:56:12 +0000 (07:56 -0800)]
Travis/OS X: Use 'brew bundle' + Brewfile

This ensures that the build script will not fail if the Homebrew
dependencies are already installed.

7 years agojdarith.c: Fix two signed integer overflows
DRC [Sat, 16 Dec 2017 02:37:02 +0000 (20:37 -0600)]
jdarith.c: Fix two signed integer overflows

I guess I have to fix these, or Google Autofuzz is going to keep bugging
me about them.

Fixes #171
Fixes #197
Fixes #198

7 years agoBump version to 1.5.4 to prepare for new commits
DRC [Sat, 16 Dec 2017 02:05:58 +0000 (20:05 -0600)]
Bump version to 1.5.4 to prepare for new commits

7 years agoBUILDING.md: Adjust Android recipes for NDK r16+
DRC [Fri, 15 Dec 2017 22:45:25 +0000 (16:45 -0600)]
BUILDING.md: Adjust Android recipes for NDK r16+

NDK r16b moved some things around, so modify the Android build recipes
to take that into account while preserving compatibility with previous
NDK releases.

NOTE: the GCC 4.9 NDK toolchain is deprecated, so we will need to
develop new Android build recipes for libjpeg-turbo 1.6 that use the
Clang toolchain.

Closes #196

7 years agoFix whitespace errors 1.5.3
DRC [Fri, 8 Dec 2017 01:29:42 +0000 (19:29 -0600)]
Fix whitespace errors

7 years agojpeg_crop_scanlines: Handle gray images w/ samp!=1
DRC [Wed, 6 Dec 2017 17:59:04 +0000 (11:59 -0600)]
jpeg_crop_scanlines: Handle gray images w/ samp!=1

Since the sampling factor has no meaning for single-component images,
the decompressor ignores it, and jpeg_crop_scanlines() should as well.

Fixes #195

7 years agoFix lib state when skipping to end of 1-scan image
DRC [Tue, 5 Dec 2017 21:27:34 +0000 (15:27 -0600)]
Fix lib state when skipping to end of 1-scan image

If jpeg_skip_scanlines() is used to skip to the end of a single-scan
image, then we need to change the library state such that subsequent
calls to jpeg_consume_input() will return JPEG_REACHED_EOI rather than
JPEG_SUSPENDED.  (NOTE: not necessary for multi-scan images, since the
scans are processed prior to any call to jpeg_skip_scanlines().)

Unless I miss my guess, using jpeg_skip_scanlines() in this manner
will prevent any markers at the end of the JPEG image from being
read, but I don't think there is any way around that without actually
reading the data, which would defeat the purpose of
jpeg_skip_scanlines().

Fixes #194

7 years agoTravis: Work around xcode7.3 image bug
DRC [Wed, 29 Nov 2017 20:23:31 +0000 (14:23 -0600)]
Travis: Work around xcode7.3 image bug

Refer to travis-ci/travis-ci#8552.  This was supposed to be fixed on
November 15, then on November 28.  Travis blew through both deadlines,
so I have no confidence that the issue will be fixed as promised in a
timely manner.  Adding 'brew update' to .travis.yml slows the OS X
build, but there is no choice at the moment.

7 years agoTJExample: Fix array index OOB w/ 4:1:1 JPEG input
DRC [Sat, 18 Nov 2017 00:45:08 +0000 (18:45 -0600)]
TJExample: Fix array index OOB w/ 4:1:1 JPEG input

7 years agoCode formatting tweaks
DRC [Sat, 18 Nov 2017 00:15:42 +0000 (18:15 -0600)]
Code formatting tweaks

7 years agoUniquify tjbenchtest log file names based on args
DRC [Thu, 16 Nov 2017 01:39:45 +0000 (19:39 -0600)]
Uniquify tjbenchtest log file names based on args

+ clean up log files when 'make testclean' is invoked
+ fix 'tjbenchtest -yuv -alloc'
+ fix tjexampletest so that it creates images under /tmp
+ clean up tjexampletest

7 years agoTJExample.java: Don't ignore mistyped args
DRC [Thu, 16 Nov 2017 01:33:06 +0000 (19:33 -0600)]
TJExample.java: Don't ignore mistyped args

7 years agoDoc tweak: TJFLAG_ACCURATEDCT is the first flag
DRC [Tue, 14 Nov 2017 22:12:13 +0000 (16:12 -0600)]
Doc tweak: TJFLAG_ACCURATEDCT is the first flag

7 years agotjbench.exe: Fix decompression access violation
DRC [Tue, 14 Nov 2017 21:30:06 +0000 (15:30 -0600)]
tjbench.exe: Fix decompression access violation

The program crashed when a JPEG image was passed on the command line,
because we were mixing our metaphors vis-a-vis malloc()/free() and
tjAlloc()/tjFree() (malloc()/free() uses the tjbench.exe heap,
whereas tjAlloc()/tjFree() uses the turbojpeg.dll heap.)

7 years agoChangeLog.md: buglet
DRC [Tue, 14 Nov 2017 03:46:07 +0000 (21:46 -0600)]
ChangeLog.md: buglet

7 years agoBuild: Fix `make dist`
DRC [Tue, 14 Nov 2017 03:24:05 +0000 (21:24 -0600)]
Build: Fix `make dist`

Broken by previous commit

7 years agoFurther partial image decompression fixes
DRC [Tue, 14 Nov 2017 03:01:53 +0000 (21:01 -0600)]
Further partial image decompression fixes

- Referring to 073b0e88a192adebbb479ee2456beb089d8b5de7 and #185, the
  reason why BMP and RLE didn't (and won't) work with partial image
  decompression is that the output engines for both formats maintain a
  whole-image buffer, which is used to reverse the order of scanlines.
  However, it was straightforward to add -crop support for GIF and
  Targa, which is useful for testing partial image decompression along
  with color quantization.
- Such testing reproduced a bug reported by Mozilla (refer to PR #182)
  whereby jpeg_skip_scanlines() would segfault if color quantization was
  enabled.  To fix this issue, read_and_discard_scanlines() now sets up
  a dummy quantize function in the same manner that it sets up a dummy
  color conversion function.

Closes #182

7 years agoTJBench/TJUnitTest: Don't ignore mistyped args
DRC [Mon, 13 Nov 2017 22:00:35 +0000 (16:00 -0600)]
TJBench/TJUnitTest: Don't ignore mistyped args

7 years agoTurboJPEG C: Code formatting tweaks
DRC [Mon, 13 Nov 2017 14:15:50 +0000 (08:15 -0600)]
TurboJPEG C: Code formatting tweaks

7 years agodjpeg -crop: Exit gracefully with non-PPM formats
DRC [Thu, 9 Nov 2017 03:01:57 +0000 (21:01 -0600)]
djpeg -crop: Exit gracefully with non-PPM formats

... and document that only PPM/PGM output images are supported with the
-crop option for the moment.

I investigated the possibility of supporting -crop with -bmp, but even
after resetting the buffer dimensions, I still kept getting virtual
array access errors.  It seems that doing this the "right way" would
require creating a re-initialization function for each image format's
destination manager.  I'm disinclined to do that right now, given that
this feature was Google's baby (developed as a prerequisite for
including libjpeg-turbo in Android), and the -crop option in djpeg is
intended only as an example of how to use the partial image
decompression API.  Real-world applications would need to handle this
in their own destination managers.

It would probably be possible to make this work with Targa by employing
a similar hack to the one we used with PPM, but Targa isn't popular
enough to bother.

Fixes #185

7 years agoPrevent "unmappable character" error in Java build
DRC [Wed, 20 Sep 2017 16:52:48 +0000 (16:52 +0000)]
Prevent "unmappable character" error in Java build

This was causing the build to fail when rebuilding libjpeg-turbo from
a source RPM.

7 years agoFix PowerPC 32-bit RPM build
DRC [Tue, 19 Sep 2017 20:01:34 +0000 (20:01 +0000)]
Fix PowerPC 32-bit RPM build

7 years agoFix 32-bit RPM build w/ newer RHEL/Fedora releases
DRC [Tue, 19 Sep 2017 18:03:49 +0000 (13:03 -0500)]
Fix 32-bit RPM build w/ newer RHEL/Fedora releases

The version of RPM on RHEL 5 and older platforms defines _libdir
as %{_exec_prefix}/%{_lib}, so defining _lib in the spec file redefined
_libdir.  However, newer versions of RPM (probably >= 4.6, since that
was the version that introduced the ISA macros) define _libdir as either
%{_prefix}/lib or %{_prefix}/lib64.  Thus, we need to explicitly
override _libdir in our spec file.

7 years agoPackaging: Use parallel make when rebuilding SRPM
DRC [Mon, 11 Sep 2017 15:06:22 +0000 (10:06 -0500)]
Packaging: Use parallel make when rebuilding SRPM

7 years agoTravis: Limit parallel make jobs to # of CPU cores
DRC [Mon, 11 Sep 2017 14:48:33 +0000 (09:48 -0500)]
Travis: Limit parallel make jobs to # of CPU cores

This tends to be faster than 'make -j', since it is making more wise
use of the available resources.

7 years agowrjpgcom: Fix comment typo
nyg [Tue, 5 Sep 2017 16:23:04 +0000 (18:23 +0200)]
wrjpgcom: Fix comment typo

Comment was copied/pasted from skip_variable() without making the
necessary modifications.

7 years agoTJUnitTest: Usage formatting tweaks
DRC [Sat, 2 Sep 2017 04:08:06 +0000 (04:08 +0000)]
TJUnitTest: Usage formatting tweaks

7 years agoJava: Fix TJUnitTest on big endian platforms
DRC [Sat, 2 Sep 2017 03:40:46 +0000 (03:40 +0000)]
Java: Fix TJUnitTest on big endian platforms

It is necessary for the C code to be aware of the machine's endianness,
which is why the TurboJPEG Java wrapper sets a different pixel format
for integer BufferedImages depending on ByteOrder.nativeOrder().
However, it isn't necessary to handle endianness in pure Java code such
as TJUnitTest (d'oh!)  This was a product of porting the C version of
TJUnitTest too literally, and of insufficient testing (historically,
the big endian systems I had available for testing didn't have Java.)

7 years agoBuild: Change ppc64le DEB arch to ppc64el
DRC [Fri, 1 Sep 2017 21:57:48 +0000 (21:57 +0000)]
Build: Change ppc64le DEB arch to ppc64el

This is the convention among Debian-based distros.

7 years agoBuild: Fix AltiVec detection on OS X Leopard
DRC [Fri, 1 Sep 2017 14:01:00 +0000 (09:01 -0500)]
Build: Fix AltiVec detection on OS X Leopard

The ability to directly access elements of an AltiVec vector is
apparently a more recent thing.

7 years agoFix build on PowerPC SPE systems
DRC [Fri, 1 Sep 2017 01:10:08 +0000 (01:10 +0000)]
Fix build on PowerPC SPE systems

SPE systems don't support AltiVec instructions.

Fixes #172

7 years agoJava: Fix NullPointerException in YUVImage
DRC [Mon, 14 Aug 2017 15:54:27 +0000 (10:54 -0500)]
Java: Fix NullPointerException in YUVImage

planes == null is a valid argument to setBuf() if alloc == true, so we
need to make sure that planes is non-null before validating its length.
We also need to allocate one dimension of the planes array if it's null.

Fixes #168

7 years agoBump version to 1.5.3 to prepare for new commits
DRC [Mon, 14 Aug 2017 16:18:35 +0000 (11:18 -0500)]
Bump version to 1.5.3 to prepare for new commits

7 years agox86: Fix "short jump is out of range" w/ NASM<2.04 1.5.2
DRC [Fri, 7 Jul 2017 20:15:19 +0000 (15:15 -0500)]
x86: Fix "short jump is out of range" w/ NASM<2.04

7 years agoTurboJPEG: Document xform issue w/ big marker data
DRC [Wed, 28 Jun 2017 19:47:45 +0000 (14:47 -0500)]
TurboJPEG: Document xform issue w/ big marker data

If the source image for a transform operation has a lot of EXIF or ICC
data embedded in it, then it may cause the output image size to exceed
the worst-case size returned by tjBufSize() (because tjTransform()
transfers all markers to the output image.)  This is only a problem if
TJFLAG_NOREALLOC is passed to the function.  Since the TurboJPEG C API
doesn't require the destination image size to be set in this case, it
makes the documented assumption that the calling program has allocated
the destination buffer to exactly the size returned by tjBufSize().
Changing this assumption would change the API behavior and necessitate
a new function name (tjTransform2().)  At the moment, it's easier to
just document this as a known issue, since it's easy to work around in
the C API.

The Java API is unfortunately a different story, since it must always
use TJFLAG_NOREALLOC (because, when using the TurboJPEG Java API, all
buffers are allocated on the Java heap, and thus they can't be
reallocated by the C code.)  There is no easy way to work around this
without changing the C API as discussed above, because if the source
image contains large amounts of marker data, it's virtually impossible
to determine how big the output image will be.

7 years agoJava TJBench: Fix parsing of -warmup argument
DRC [Wed, 28 Jun 2017 19:40:35 +0000 (14:40 -0500)]
Java TJBench: Fix parsing of -warmup argument

Due to an oversight, this wasn't included in
1db1ce45da2e78d87ff05119b674c71d630926aa.

7 years agoBuild: Disable warmup in TJBench regression tests
DRC [Wed, 28 Jun 2017 00:45:35 +0000 (19:45 -0500)]
Build: Disable warmup in TJBench regression tests

Fixes slow-down in 'make test' caused by previous commit.

7 years agoTJBench: Improve consistency of results
DRC [Tue, 27 Jun 2017 19:22:39 +0000 (14:22 -0500)]
TJBench: Improve consistency of results

Given that libjpeg-turbo can often process hundreds of megapixels/second
on modern hardware, the default of one warmup iteration was essentially
meaningless.  Furthermore, the -warmup option was a bit clunky, since
it required some foreknowledge of how fast the benchmarks were going to
execute.

This commit introduces a 1-second warmup interval for each benchmark by
default, and the -warmup option has been retasked to control the length
of that interval.

7 years agoTurboJPEG: C API documentation buglet
DRC [Tue, 27 Jun 2017 16:36:25 +0000 (11:36 -0500)]
TurboJPEG: C API documentation buglet

TJFLAG_NOREALLOC, tjAlloc(), and tjFree() apply to all TurboJPEG
compression functions, not just tjCompress2().

7 years agoTJBench: Code formatting tweaks
DRC [Thu, 11 May 2017 23:33:47 +0000 (18:33 -0500)]
TJBench: Code formatting tweaks

Spaces-->tab + remove stray control character that was introduced in
95e4cb206085c3a715f0f017c174fdf367a2c1ff

7 years agoTJBench: Fix errors when decomp. files w/ ICC data
DRC [Tue, 27 Jun 2017 01:48:02 +0000 (20:48 -0500)]
TJBench: Fix errors when decomp. files w/ ICC data

Embedded ICC profiles can cause the size of a JPEG file to exceed the
size returned by tjBufSize() (which is really meant to be used for
compression anyhow, not for decompression), and this was causing a
segfault (C) or an ArrayIndexOutOfBoundsException (Java) when
decompressing such files with TJBench.  This commit modifies the
benchmark such that, when tiled decompression is disabled, it re-uses
the source buffer as the primary JPEG buffer.

7 years agoBUILDING.md: Include Android/x86 build recipes
DRC [Mon, 26 Jun 2017 20:15:08 +0000 (15:15 -0500)]
BUILDING.md: Include Android/x86 build recipes

Addresses a concern raised in #155.

7 years agoTravis: Fix OS X build
DRC [Mon, 8 May 2017 13:15:11 +0000 (08:15 -0500)]
Travis: Fix OS X build

The Travis xcode7.3 image now apparently includes GnuPG 1.4.x by
default, so use it instead of installing GnuPG 2.  Using GnuPG 2.1.x,
the default version in Homebrew as of this writing, is problematic for
this reason:
https://wiki.archlinux.org/index.php/GnuPG#Unattended_passphrase

7 years agoRestore compatibility with older autoconf releases
DRC [Sat, 6 May 2017 01:45:40 +0000 (20:45 -0500)]
Restore compatibility with older autoconf releases

(broken by f06cc1200fd5f61b63479d7099ccf4a7457a89bd)

Fixes #149

7 years agoAttribute ARM runtime detection code to Nokia
DRC [Mon, 24 Apr 2017 19:42:58 +0000 (14:42 -0500)]
Attribute ARM runtime detection code to Nokia

This code was submitted in the initial ARM NEON patches
(https://sourceforge.net/p/libjpeg-turbo/patches/7/) by Siarhei while he
was still a Nokia employee.

7 years agoHonor max_memory_to_use/JPEGMEM/-maxmemory
DRC [Sat, 18 Mar 2017 21:15:14 +0000 (16:15 -0500)]
Honor max_memory_to_use/JPEGMEM/-maxmemory

This re-introduces a feature of the obsolete system-specific libjpeg
memory managers-- namely the ability to limit the amount of main memory
used by the library during decompression or multi-pass compression.
This is mainly beneficial for two reasons:

- Works around a 2 GB limit in libFuzzer
- Allows security-sensitive applications to set a memory limit for the
  JPEG decoder so as to work around the progressive JPEG exploit
  (LJT-01-004) described here:
  http://www.libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf

This commit also removes obsolete documentation regarding the MS-DOS
memory manager (which itself was removed long ago) and changes the
documentation of the -maxmemory switch and JPEGMEM environment variable
to reflect the fact that backing stores are never used in libjpeg-turbo.

Inspired by:
https://github.com/caolanm/libjpeg-turbo/commit/066fee2e7d6834f24838bc1896aa38ca77209e3c

Closes #143

8 years agoAppVeyor: Fix CI build
DRC [Sat, 18 Mar 2017 18:24:50 +0000 (13:24 -0500)]
AppVeyor: Fix CI build

Something changed in the CI build environment, and our previous trick of
setting the Git URL to file://c:/projects/libjpeg-turbo no longer works.
Using cygpath to translate the Windows path to a MinGW-friendly format
is a better solution anyhow.

8 years agoTurboJPEG: Fix potential memory leaks
DRC [Sat, 18 Mar 2017 17:56:36 +0000 (12:56 -0500)]
TurboJPEG: Fix potential memory leaks

Referring to https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=746,
it seems that the values of local buffer pointers in TurboJPEG API
functions aren't always preserved if longjmp() returns control to a
point prior to the allocation of the local buffers.  This is known to
be an issue with GCC 4.x and clang with -O1 and higher optimization
levels but not with GCC 5.x and later.  It is unknown why GCC 5.x and
6.x do not suffer from the issue, but possibly the local buffer pointers
are not allocated on the stack when using those more recent compilers.

In any case, this commit modifies the TurboJPEG API library code such
that the jump buffer is always updated after any local buffer pointers
are allocated but before any subsequent libjpeg API functions are
called.

8 years agoAlways tweak EXIF w/h tags w/ lossless transforms
DRC [Fri, 20 Jan 2017 00:51:41 +0000 (18:51 -0600)]
Always tweak EXIF w/h tags w/ lossless transforms

... even if using libjpeg v6b emulation.  Previously
adjust_exif_parameters() was only called with libjpeg v7/v8 emulation,
but due to a bug (which this commit also fixes), it only worked properly
with libjpeg v8 emulation.

8 years agoFix error w/ lossless crop & libjpeg v7 emulation
DRC [Thu, 19 Jan 2017 23:50:59 +0000 (17:50 -0600)]
Fix error w/ lossless crop & libjpeg v7 emulation

The JPEG_LIB_VERSION #ifdef in jtransform_adjust_parameters() was
incorrect, which caused a "Bogus virtual array access" error when
attempting to use the lossless crop feature.

Introduced in c04bd3cc97f44fd9030de1e141754c8775d4e5a5.

This also adds libjpeg v7 API/ABI emulation to the Travis CI tests.

8 years agoInclude jpeg_skip/crop_scanlines() in jpeg7.dll
DRC [Thu, 19 Jan 2017 22:44:10 +0000 (16:44 -0600)]
Include jpeg_skip/crop_scanlines() in jpeg7.dll

... when the in-memory source/destination managers are included.
Oversight in 306e1d2d778cf5a4d2a22ac847a31722b9fc2845 and
3ab68cf563f6edc2608c085f5c8b2d5d5c61157e.

8 years agolibjpeg.txt: Include partial decomp. in TOC
DRC [Thu, 19 Jan 2017 21:36:58 +0000 (15:36 -0600)]
libjpeg.txt: Include partial decomp. in TOC

(oversight)

8 years agoSlightly de-confusify cjpeg, jpegtran usage info
DRC [Thu, 19 Jan 2017 21:33:48 +0000 (15:33 -0600)]
Slightly de-confusify cjpeg, jpegtran usage info

+ bump copyright year

8 years agoLICENSE.md: Include text of BSD/zlib licenses
DRC [Sat, 10 Dec 2016 15:32:23 +0000 (09:32 -0600)]
LICENSE.md: Include text of BSD/zlib licenses

LICENSE.md is included in the binary distributions as well, so it
doesn't make much sense to refer to license headers in source files that
aren't necessarily going to be there.

8 years agoFix build when CFLAGS contains -std=c89 (or -ansi)
DRC [Mon, 5 Dec 2016 20:02:59 +0000 (14:02 -0600)]
Fix build when CFLAGS contains -std=c89 (or -ansi)

This is a subtle point, but AC_C_INLINE defines "inline" to be either
"inline", "__inline__", or "__inline".  The subsequent test for
"inline __attribute__((always_inline))" uses this definition.  The
attribute is irrespective of the inline keyword, so whereas
"__inline__ __attribute__((always_inline))" works under C89,
"inline __attribute__((always_inline))" doesn't, and defining INLINE to
the latter causes the build to fail.  The easiest way around this is
simply to define "inline" ahead of "INLINE" in jconfigint.h,
which causes the inline keyword detected by AC_C_INLINE to modify the
INLINE macro if necessary.

8 years agoReorg AltiVec detection code
DRC [Mon, 5 Dec 2016 18:39:49 +0000 (12:39 -0600)]
Reorg AltiVec detection code

+ advertise that full AltiVec SIMD acceleration is now available on
OpenBSD.

The relevant compilers probably all support C99 or GNU's variation of
C90 that allows variables to be declared anywhere, but our policy is to
conform to the C90 standard, if for no other reason than that it
improves code readability.

8 years agoDetect AltiVec support on OpenBSD
Donovan Watteau [Sat, 3 Dec 2016 14:46:49 +0000 (15:46 +0100)]
Detect AltiVec support on OpenBSD

8 years agoFix sign mismatch comparison warnings
Colin Cross [Fri, 2 Dec 2016 00:56:18 +0000 (16:56 -0800)]
Fix sign mismatch comparison warnings

Fixes:
rdppm.c:257:14: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
    if (temp > maxval)
        ~~~~ ^ ~~~~~~
rdppm.c:284:14: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
    if (temp > maxval)
        ~~~~ ^ ~~~~~~
rdppm.c:289:14: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
    if (temp > maxval)
        ~~~~ ^ ~~~~~~
rdppm.c:294:14: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
    if (temp > maxval)

8 years agoFix md5cmp on AmigaOS 4 (PowerPC big-endian)
DRC [Fri, 2 Dec 2016 00:23:32 +0000 (18:23 -0600)]
Fix md5cmp on AmigaOS 4 (PowerPC big-endian)

+ Document AmigaOS support in the change log.

Based on:
https://github.com/chris-y/libjpeg-turbo/commit/b4f3b757970cd9dd448af9d2713b6bcdd9929147

Closes #119

8 years agoTravis: Use xcode7.3 image
DRC [Thu, 1 Dec 2016 07:58:34 +0000 (01:58 -0600)]
Travis: Use xcode7.3 image

The xcode7.2 image is verfallen, verlumpt, verblunget, verkackt

This also ensures that the build scripts are checked out from a
branch matching the libjpeg-turbo repository branch (not strictly
necessary when building from master, but it keeps the code in sync with
dev.)

8 years agoAppVeyor: Use built-in MSYS2 MinGW compilers
DRC [Tue, 22 Nov 2016 04:58:18 +0000 (22:58 -0600)]
AppVeyor: Use built-in MSYS2 MinGW compilers

AppVeyor already has MinGW32 and MinGW64 flavors of GCC 5.3.0
installed under MSYS2, so there is no need to install our own builds of
MinGW.  MinGW-builds is no longer an active project, and we were getting
occasional timeouts while wgetting those files from SourceForge.
Furthermore, GCC 5.3.0 should produce faster code than GCC 4.8.1.

8 years agoBUILDING.md: Clarifications and wordsmithing
DRC [Mon, 21 Nov 2016 02:59:55 +0000 (20:59 -0600)]
BUILDING.md: Clarifications and wordsmithing

Updated out-of-date information, wordsmithed and clarified many
sections, and generally cleaned up the build recipes (including a
complete overhaul of the iOS recipes.)

8 years agoWindows build: Add an "uninstall" target
DRC [Mon, 21 Nov 2016 01:10:54 +0000 (19:10 -0600)]
Windows build: Add an "uninstall" target

8 years agoBUILDING.md/README.md: Increment libjpeg SO age
DRC [Fri, 18 Nov 2016 15:09:41 +0000 (09:09 -0600)]
BUILDING.md/README.md: Increment libjpeg SO age

Documentation buglet.  This should have been changed in
6ed4d9d11085acd04dc7f2f899848693976dc010 to reflect the addition of
libjpeg API functions in libjpeg-turbo 1.5.

8 years agoREADME.md: Don't use trailing spaces as line break
DRC [Fri, 18 Nov 2016 15:08:52 +0000 (09:08 -0600)]
README.md: Don't use trailing spaces as line break

Makes it easier to maintain this file using editors that automatically
remove trailing spaces.

8 years agoTJBench: Fix regression/-nowrite always enabled
DRC [Wed, 16 Nov 2016 21:08:16 +0000 (15:08 -0600)]
TJBench: Fix regression/-nowrite always enabled

Introduced by eb59b6e72d8098a1f7b8c7e0c710b32eb6f5dc45

8 years agoBUILDING.md: Don't use trailing spaces as line break
DRC [Tue, 15 Nov 2016 15:52:49 +0000 (09:52 -0600)]
BUILDING.md: Don't use trailing spaces as line break

Makes it easier to maintain this file using editors that automatically
remove trailing spaces.

8 years agoCMake build system: Fix the "testclean" target
DRC [Tue, 15 Nov 2016 14:37:04 +0000 (08:37 -0600)]
CMake build system: Fix the "testclean" target

Regression caused by f9134384b728d8943f252b27464d83c4b7b2d159

This commit also makes the "testclean" target clean up the 4:1:1 test
images.  This was implemented in the autotools build system in
1f3635c4969f2319a01c9fe561958815b733227f but was left out of the CMake
build system due to an oversight.

8 years agoDetect AltiVec support on AmigaOS 4
Chris Young [Fri, 18 Nov 2016 19:03:28 +0000 (19:03 +0000)]
Detect AltiVec support on AmigaOS 4

8 years agoTravis: Deploy to S3 rather than SourceForge
DRC [Thu, 20 Oct 2016 22:55:55 +0000 (17:55 -0500)]
Travis: Deploy to S3 rather than SourceForge

This has the following advantages:
-- It doesn't require checking a private SSH key into the repository.
(With SourceForge, an SSH key is the "keys to the kingdom".)
-- If the S3 key is compromised, it is very easy to revoke it and
generate a new one.
-- The S3 bucket is isolated, so even if it becomes compromised, then
the damage that one could do is limited.
-- It's much easier to manage files through S3's web interface than
through SourceForge.
-- The files are served via HTTPS.
-- Travis fully supports S3 as a deployment target, so this simplifies
.travis.yml somewhat.

8 years agoTravis: GPG sign Linux binaries/source tarballs
DRC [Thu, 20 Oct 2016 06:01:27 +0000 (01:01 -0500)]
Travis: GPG sign Linux binaries/source tarballs

Since we're still deploying our Linux/macOS CI artifacts to a web server
(specifically SourceForge Project Web Services) that doesn't support
HTTPS, it's a good idea to sign them.  But since the private key has to
be checked into the repository, we use a different key for signing the
pre-releases (per project policy, the private signing keys for our
release binaries are never made available on any public server.)

8 years agoWin: Use YASM if it is in the PATH and NASM isn't
DRC [Tue, 11 Oct 2016 16:58:20 +0000 (11:58 -0500)]
Win: Use YASM if it is in the PATH and NASM isn't

Previously, simd/CMakeLists.txt was hard-coded to use NASM, and it was
necessary to override the NASM variable in order to use YASM.  This
commit changes the behavior such that NASM is still preferred, but YASM
will be used if it is in the PATH and NASM isn't available.  This brings
the actual behavior in line with the behavior described in BUILDING.md.

Based on
https://github.com/xpol/libjpeg-turbo/commit/b0799a1598782799d4876538eddca7ad8438d8a6

Closes #107

8 years agoTravis: Fix deployment issue (2nd attempt)
DRC [Fri, 7 Oct 2016 17:54:55 +0000 (12:54 -0500)]
Travis: Fix deployment issue (2nd attempt)

8 years agoTravis: Fix deployment issue
DRC [Fri, 7 Oct 2016 10:34:11 +0000 (05:34 -0500)]
Travis: Fix deployment issue

"Skipping a deployment with the script provider because this branch is
not permitted"

8 years agoFix AppVeyor build on non-master branches
DRC [Fri, 7 Oct 2016 10:07:22 +0000 (05:07 -0500)]
Fix AppVeyor build on non-master branches

buildljt will clone the Git repository into the temp. directory, even if
the repository is really a local sandbox, so we need to specify the
branch.

8 years agoTravis: Use existing sandbox for official builds
DRC [Fri, 7 Oct 2016 10:07:11 +0000 (05:07 -0500)]
Travis: Use existing sandbox for official builds

This eliminates the need to specify the remote repository and branch,
and it prevents the code from being checked out twice.

8 years agoAdd AppVeyor config for Windows pre-release builds
DRC [Fri, 7 Oct 2016 09:28:02 +0000 (04:28 -0500)]
Add AppVeyor config for Windows pre-release builds

8 years agoTravis: use correct repo/branch for off. builds
DRC [Wed, 5 Oct 2016 19:36:46 +0000 (14:36 -0500)]
Travis: use correct repo/branch for off. builds

Pass the actual repository and branch that Travis is using into the
builtljt script, so the official builds it generates will come from
the same code base as the other tested builds.

8 years agoTravis CI: Use correct key for this repository
DRC [Wed, 5 Oct 2016 17:38:59 +0000 (12:38 -0500)]
Travis CI: Use correct key for this repository

8 years agoAdd Travis CI config for Un*x pre-release builds
DRC [Sun, 2 Oct 2016 14:13:23 +0000 (09:13 -0500)]
Add Travis CI config for Un*x pre-release builds

8 years agoFix 32-bit non-SIMD FP regression tests
DRC [Tue, 4 Oct 2016 18:41:48 +0000 (13:41 -0500)]
Fix 32-bit non-SIMD FP regression tests

- Introduce a new FLOATTEST value ("387") on Un*x systems that will
  compare the floating point DCT/IDCT algorithms against the expected
  results from the C algorithms when built using 32-bit code and
  -mfpmath=387.
- Extend the Windows regression tests so that they work properly when
  building libjpeg-turbo with 32-bit code and without SIMD, using either
  Visual C++ (tested with 2008, 2010, 2015) or MinGW.

8 years agoFix broken build w/ Visual C++ < 2010
DRC [Tue, 4 Oct 2016 18:25:34 +0000 (13:25 -0500)]
Fix broken build w/ Visual C++ < 2010

Regression introduced by dfefba77520ded5c5fd4864e76352a5f3eb23e74
(Windows doesn't always have stdint.h.)

8 years agoFix broken MIPS build
DRC [Mon, 26 Sep 2016 22:59:14 +0000 (17:59 -0500)]
Fix broken MIPS build

Regression introduced by 9055fb408dcb585ce9392d395e16630d51002152

Fixes #104

8 years agoFix UBSan warning in arithmetic decoder
DRC [Thu, 22 Sep 2016 19:38:51 +0000 (14:38 -0500)]
Fix UBSan warning in arithmetic decoder

Very similar to the ones that were fixed in the Huffman decoders in
8e9cef2e6f5156c4b055a04a8f979b7291fc6b7a.  These are innocuous.

Refer to https://bugzilla.mozilla.org/show_bug.cgi?id=1304567.

8 years agoFix broken build with NDK platforms < android-21
DRC [Thu, 22 Sep 2016 19:19:29 +0000 (14:19 -0500)]
Fix broken build with NDK platforms < android-21

Regression introduced by a09ba29a55b9a43d346421210d94370065eeaf53

Fixes #103

8 years agoBump version to 1.5.2 to prepare for new commits
DRC [Thu, 22 Sep 2016 19:14:05 +0000 (14:14 -0500)]
Bump version to 1.5.2 to prepare for new commits

8 years agoREADME.md: Fix typo
Roberto Civille Rodrigues [Thu, 22 Sep 2016 03:42:25 +0000 (00:42 -0300)]
README.md: Fix typo

Introduced in 17de51835735e319ada5ca139a64227423946a8a

Closes #102

8 years agoARM64 NEON: Fix another ABI conformance issue 1.5.1
mayeut [Tue, 20 Sep 2016 19:06:24 +0000 (21:06 +0200)]
ARM64 NEON: Fix another ABI conformance issue

Based on
https://github.com/mayeut/libjpeg-turbo/commit/98a5a9dc899aa9265858a3cbe0a96289a31a1322
with wordsmithing by DRC.

In the AArch64 ABI, as in many others, it's forbidden to read/store data
below the stack pointer.  Some SIMD functions were doing just that
(stack pointer misuse) when trying to preserve callee-saved registers,
and this resulted in those registers being restored with incorrect
contents under certain circumstances.

This patch fixes that behavior, and callee-saved registers are now
stored above the stack pointer throughout the function call.  The patch
also removes register saving in places where it is unnecessary for this
ABI, or it makes use of unused scratch regiters instead of callee-saved
registers.

Fixes #97.  Closes #101.

Refer also to https://bugzilla.redhat.com/show_bug.cgi?id=1368569

8 years agoBuild: Remove ARMv6 support from 'make iosdmg'
DRC [Tue, 20 Sep 2016 03:47:18 +0000 (22:47 -0500)]
Build: Remove ARMv6 support from 'make iosdmg'

The last iDevice to require ARMv6 was the iPhone 3G, which required iOS
4.2.1 or older.  Our binaries have always required iOS 4.3 or newer,
so I'm not sure if the ARMv6 fork of our binaries was ever useful to
begin with.  In any case, if it ever was useful, it no longer is.  Fat
binaries can still be generated with ARMv6 support by invoking
{build_directory}/pkgscripts/makemacpkg manually.

8 years agoFix out-of-bounds write in partial decomp. feature
DRC [Fri, 9 Sep 2016 02:49:02 +0000 (21:49 -0500)]
Fix out-of-bounds write in partial decomp. feature

Reported by Clang UBSan (refer to
https://bugzilla.mozilla.org/show_bug.cgi?id=1301252 for test image.)
This appears to be a legitimate bug introduced by
3ab68cf563f6edc2608c085f5c8b2d5d5c61157e.  Any component array, such
as first_MCU_col and last_MCU_col, should always be able to accommodate
MAX_COMPONENTS values.  The aforementioned test image had 8 components,
which was not enough to make the out-of-bounds write bust out of the
jpeg_decomp_master struct (and fortunately the memory after last_MCU_col
is an integer used as a boolean, so stomping on it will do nothing other
than change the decoder state.)  I crafted another special image that
has 10 components (the maximum allowable), but that was apparently not
enough to bust out of the allocated memory, either.  Thus, it is
posited that the security threat posed by this bug is either extremely
minimal or non-existent.

8 years agoSilence additional UBSan warnings
DRC [Fri, 9 Sep 2016 02:29:58 +0000 (21:29 -0500)]
Silence additional UBSan warnings

NOTE: The jdhuff.c/jdphuff.c warnings should have already been silenced
by 8e9cef2e6f5156c4b055a04a8f979b7291fc6b7a, but apparently I need to
be REALLY clear that I'm trying to do pointer arithmetic rather than
dereference an array.  Grrr...

Refer to:
https://bugzilla.mozilla.org/show_bug.cgi?id=1301250
https://bugzilla.mozilla.org/show_bug.cgi?id=1301256

8 years agoFix unsigned int overflow in libjpeg memory mgr.
DRC [Wed, 7 Sep 2016 21:40:10 +0000 (16:40 -0500)]
Fix unsigned int overflow in libjpeg memory mgr.

When attempting to decode a malformed JPEG image (refer to
https://bugzilla.mozilla.org/show_bug.cgi?id=1295044) with dimensions
61472 x 32800, the maximum_space variable within the
realize_virt_arrays() function will exceed the maximum value of a 32-bit
integer and will wrap around.  The memory manager subsequently fails
with an "Insufficient memory" error (case 4, in alloc_large()), so this
commit simply causes that error to be triggered earlier, before UBSan
has a chance to complain.

Note that this issue did not ever represent an exploitable security
threat, because the POSIX-based memory manager that we use doesn't ever
do anything meaningful with the value of maximum_space.
jpeg_mem_available() simply sets avail_mem = maximum_space, so the
subsequent behavior of the memory manager is the same regardless of
whether maximum_space is correct or not.  This commit simply removes a
UBSan warning in order to make it easier to detect actual security
issues.

8 years agoTurboJPEG: Decomp. 4:2:2/4:4:0 JPEGs w/unusual SFs
DRC [Mon, 1 Aug 2016 16:22:24 +0000 (11:22 -0500)]
TurboJPEG: Decomp. 4:2:2/4:4:0 JPEGs w/unusual SFs

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

Fixes #92

8 years agoSilence pedantic GCC6 code formatting warnings
DRC [Thu, 14 Jul 2016 18:36:47 +0000 (13:36 -0500)]
Silence pedantic GCC6 code formatting warnings

Apparently it's "misleading" to put two self-contained if statements
on a single line.  Who knew?

8 years agoUse plain upsampling if merged isn't accelerated
DRC [Thu, 14 Jul 2016 01:39:11 +0000 (20:39 -0500)]
Use plain upsampling if merged isn't accelerated

Currently, this only affects ARM, since it is the only platform that
accelerates YCbCr-to-RGB conversion but not merged upsampling.  Even if
"plain" upsampling isn't accelerated, the combination of accelerated
color conversion + unaccelerated plain upsampling is still faster than
the unaccelerated merged upsampling algorithms.

Closes #81

8 years agoImplement h1v2 fancy upsampling
Kornel Lesiński [Sun, 10 Jul 2016 18:01:51 +0000 (19:01 +0100)]
Implement h1v2 fancy upsampling

This allows fancy upsampling to be used when decompressing 4:2:2 images
that have been losslessly rotated or transposed.

(docs and comments added by DRC)

Based on https://github.com/pornel/libjpeg-turbo/commit/f63aca945debde07e7c6476a1f667b71728c3d44

Closes #89

8 years agoFix AArch64 ABI conformance issue in SIMD code
DRC [Wed, 13 Jul 2016 17:15:02 +0000 (12:15 -0500)]
Fix AArch64 ABI conformance issue in SIMD code

In the AArch64 ABI, the high (unused) DWORD of a 32-bit argument's
register is undefined, so it was incorrect to use 64-bit
instructions to transfer a JDIMENSION argument in the 64-bit NEON SIMD
functions.  The code worked thus far only because the existing compiler
optimizers weren't smart enough to do anything else with the register in
question, so the upper 32 bits happened to be all zeroes.

The latest builds of Clang/LLVM have a smarter optimizer, and under
certain circumstances, it will attempt to load-combine adjacent 32-bit
integers from one of the libjpeg structures into a single 64-bit integer
and pass that 64-bit integer as a 32-bit argument to one of the SIMD
functions (which is allowed by the ABI, since the upper 32 bits of the
32-bit argument's register are undefined.)  This caused the
libjpeg-turbo regression tests to crash.

This patch tries to use the Wn registers whenever possible.  Otherwise,
it uses a zero-extend instruction to avoid using the upper 32 bits of
the 64-bit registers, which are not guaranteed to be valid for 32-bit
arguments.

Based on https://github.com/sebpop/libjpeg-turbo/commit/1fbae13021eb98f6fffdfaf8678fcdb00b0b04d9

Closes #91.  Refer also to android-ndk/ndk#110 and
https://llvm.org/bugs/show_bug.cgi?id=28393

8 years agoDon't install libturbojpeg.pc if TJPEG disabled
DRC [Wed, 13 Jul 2016 03:21:20 +0000 (22:21 -0500)]
Don't install libturbojpeg.pc if TJPEG disabled

8 years agoLinux/PPC: Only enable AltiVec if CPU supports it
DRC [Wed, 6 Jul 2016 16:58:28 +0000 (16:58 +0000)]
Linux/PPC: Only enable AltiVec if CPU supports it

This eliminates "illegal instruction" errors when running libjpeg-turbo
under Linux on PowerPC chips that lack AltiVec support (e.g. the old
7XX/G3 models but also the newer e5500 series.)

8 years agoARM/MIPS: Change the behavior of JSIMD_FORCE*
DRC [Thu, 7 Jul 2016 18:10:30 +0000 (13:10 -0500)]
ARM/MIPS: Change the behavior of JSIMD_FORCE*

The JSIMD_FORCE* environment variables previously meant "force the use
of this instruction set if it is available but others are available as
well", but that did nothing on ARM platforms, since there is only ever
one instruction set available.  Since the ARM and MIPS CPU feature
detection code is less than bulletproof, and since there is only one
SIMD instruction set (currently) supported on those platforms, it makes
sense for the JSIMD_FORCE* environment variables on those platforms to
actually force the use of the SIMD instruction set, thus bypassing the
CPU feature detection code.

This addresses a concern raised in #88 whereby parsing /proc/cpuinfo
didn't work within a QEMU environment.  This at least provides a
workaround, allowing users to force-enable or force-disable SIMD
instructions for ARM and MIPS builds of libjpeg-turbo.