diff --git a/BUILDING.md b/BUILDING.md new file mode 100644 index 00000000..04ce30c9 --- /dev/null +++ b/BUILDING.md @@ -0,0 +1,864 @@ +Building on Un*x Platforms (including Cygwin and OS X) +======================================================= + + +Build Requirements +------------------ + +- autoconf 2.56 or later +- automake 1.7 or later +- libtool 1.4 or later + * If using Xcode 4.3 or later on OS X, autoconf and automake are no longer + provided. The easiest way to obtain them is from + [MacPorts](http://www.MacPorts.org). + +- NASM or YASM (if building x86 or x86-64 SIMD extensions) + * NASM 0.98, or 2.01 or later is required for an x86 build (0.99 and 2.00 do + not work properly with libjpeg-turbo's x86 SIMD code.) + * NASM 2.00 or later is required for an x86-64 build. + * NASM 2.07, or 2.11.09 or later is required for an x86-64 Mac build + (2.11.08 does not work properly with libjpeg-turbo's x86-64 SIMD code when + building macho64 objects.) NASM or YASM can be obtained from + [MacPorts](http://www.MacPorts.org). + + The binary RPMs released by the NASM project do not work on older Linux + systems, such as Red Hat Enterprise Linux 4. On such systems, you can + easily build and install NASM from a source RPM by downloading one of the + SRPMs from + + + + and executing the following as root: + + ARCH=`uname -m` + rpmbuild --rebuild nasm-{version}.src.rpm + rpm -Uvh /usr/src/redhat/RPMS/$ARCH/nasm-{version}.$ARCH.rpm + + NOTE: the NASM build will fail if texinfo is not installed. + +- GCC v4.1 (or later) or clang recommended for best performance + +- If building the TurboJPEG Java wrapper, JDK or OpenJDK 1.5 or later is + required. Some systems, such as Solaris 10 and later and Red Hat Enterprise + Linux 5 and later, have this pre-installed. On OS X 10.5 and 10.6, it will + be necessary to install the Java Developer Package, which can be downloaded + from (Apple ID required.) For other + systems, you can obtain the Oracle Java Development Kit from + . + + +Out-of-Tree Builds +------------------ + +Binary objects, libraries, and executables are generated in the same directory +from which `configure` was executed (the "binary directory"), and this +directory need not necessarily be the same as the libjpeg-turbo source +directory. You can create multiple independent binary directories, in which +different versions of libjpeg-turbo can be built from the same source tree +using different compilers or settings. In the sections below, +*{build_directory}* refers to the binary directory, whereas +*{source_directory}* refers to the libjpeg-turbo source directory. For in-tree +builds, these directories are the same. + + +Building libjpeg-turbo +---------------------- + +The following procedure will build libjpeg-turbo on Linux, FreeBSD, Cygwin, and +Solaris/x86 systems (on Solaris, this generates a 32-bit library. See below +for 64-bit build instructions.) + + cd {source_directory} + autoreconf -fiv + cd {build_directory} + sh {source_directory}/configure [additional configure flags] + make + +NOTE: Running autoreconf in the source directory is not necessary if building +libjpeg-turbo from one of the official release tarballs. + +This will generate the following files under .libs/: + +**libjpeg.a** +Static link library for the libjpeg API + +**libjpeg.so.{version}** (Linux, Unix) +**libjpeg.{version}.dylib** (OS X) +**cygjpeg-{version}.dll** (Cygwin) +Shared library for the libjpeg API + +By default, *{version}* is 62.1.0, 7.1.0, or 8.0.2, depending on whether +libjpeg v6b (default), v7, or v8 emulation is enabled. If using Cygwin, +*{version}* is 62, 7, or 8. + +**libjpeg.so** (Linux, Unix) +**libjpeg.dylib** (OS X) +Development symlink for the libjpeg API + +**libjpeg.dll.a** (Cygwin) +Import library for the libjpeg API + +**libturbojpeg.a** +Static link library for the TurboJPEG API + +**libturbojpeg.so.0.1.0** (Linux, Unix) +**libturbojpeg.0.1.0.dylib** (OS X) +**cygturbojpeg-0.dll** (Cygwin) +Shared library for the TurboJPEG API + +**libturbojpeg.so** (Linux, Unix) +**libturbojpeg.dylib** (OS X) +Development symlink for the TurboJPEG API + +**libturbojpeg.dll.a** (Cygwin) +Import library for the TurboJPEG API + + +### libjpeg v7 or v8 API/ABI Emulation + +Add `--with-jpeg7` to the `configure` command line to build a version of +libjpeg-turbo that is API/ABI-compatible with libjpeg v7. Add `--with-jpeg8` +to the `configure` command to build a version of libjpeg-turbo that is +API/ABI-compatible with libjpeg v8. See [README.md](README.md) for more +information on libjpeg v7 and v8 emulation. + + +### In-Memory Source/Destination Managers + +When using libjpeg v6b or v7 API/ABI emulation, add `--without-mem-srcdst` to +the `configure` command line to build a version of libjpeg-turbo that lacks the +`jpeg_mem_src()` and `jpeg_mem_dest()` functions. These functions were not +part of the original libjpeg v6b and v7 APIs, so removing them ensures strict +conformance with those APIs. See [README.md](README.md) for more information. + + +### Arithmetic Coding Support + +Since the patent on arithmetic coding has expired, this functionality has been +included in this release of libjpeg-turbo. libjpeg-turbo's implementation is +based on the implementation in libjpeg v8, but it works when emulating libjpeg +v7 or v6b as well. The default is to enable both arithmetic encoding and +decoding, but those who have philosophical objections to arithmetic coding can +add `--without-arith-enc` or `--without-arith-dec` to the `configure` command +line to disable encoding or decoding (respectively.) + + +### TurboJPEG Java Wrapper + +Add `--with-java` to the `configure` command line to incorporate an optional +Java Native Interface wrapper into the TurboJPEG shared library and build the +Java front-end classes to support it. This allows the TurboJPEG shared library +to be used directly from Java applications. See [java/README](java/README) for +more details. + +You can set the `JAVAC`, `JAR`, and `JAVA` configure variables to specify +alternate commands for javac, jar, and java (respectively.) You can also +set the `JAVACFLAGS` configure variable to specify arguments that should be +passed to the Java compiler when building the front-end classes, and +`JNI_CFLAGS` to specify arguments that should be passed to the C compiler when +building the JNI wrapper. Run `configure --help` for more details. + + +Installing libjpeg-turbo +------------------------ + +If you intend to install these libraries and the associated header files, then +replace 'make' in the instructions above with + + make install prefix={base dir} libdir={library directory} + +For example, + + make install prefix=/usr/local libdir=/usr/local/lib64 + +will install the header files in /usr/local/include and the library files in +/usr/local/lib64. If `prefix` and `libdir` are not specified, then the default +is to install the header files in /opt/libjpeg-turbo/include and the library +files in /opt/libjpeg-turbo/lib32 (32-bit) or /opt/libjpeg-turbo/lib64 +(64-bit.) + +NOTE: You can specify a prefix of /usr and a libdir of, for instance, +/usr/lib64 to overwrite the system's version of libjpeg. If you do this, +however, then be sure to BACK UP YOUR SYSTEM'S INSTALLATION OF LIBJPEG before +overwriting it. It is recommended that you instead install libjpeg-turbo into +a non-system directory and manipulate the `LD_LIBRARY_PATH` or create symlinks +to force applications to use libjpeg-turbo instead of libjpeg. See +[README.md](README.md) for more information. + + +Build Recipes +------------- + + +### 32-bit Build on 64-bit Linux + +Add + + --host i686-pc-linux-gnu CFLAGS='-O3 -m32' LDFLAGS=-m32 + +to the `configure` command line. + + +### 64-bit Build on 64-bit OS X + +Add + + --host x86_64-apple-darwin NASM=/opt/local/bin/nasm + +to the `configure` command line. NASM 2.07 or later from MacPorts must be +installed. + + +### 32-bit Build on 64-bit OS X + +Add + + --host i686-apple-darwin CFLAGS='-O3 -m32' LDFLAGS=-m32 + +to the `configure` command line. + + +### 64-bit Backward-Compatible Build on 64-bit OS X + +Add + + --host x86_64-apple-darwin NASM=/opt/local/bin/nasm \ + CFLAGS='-mmacosx-version-min=10.5 -O3' \ + LDFLAGS='-mmacosx-version-min=10.5' + +to the `configure` command line. NASM 2.07 or later from MacPorts must be +installed. + + +### 32-bit Backward-Compatible Build on OS X + +Add + + --host i686-apple-darwin \ + CFLAGS='-mmacosx-version-min=10.5 -O3 -m32' \ + LDFLAGS='-mmacosx-version-min=10.5 -m32' + +to the `configure` command line. + + +### 64-bit Build on 64-bit Solaris + +Add + + --host x86_64-pc-solaris CFLAGS='-O3 -m64' LDFLAGS=-m64 + +to the `configure` command line. + + +### 32-bit Build on 64-bit FreeBSD + +Add + + --host i386-unknown-freebsd CC='gcc -B /usr/lib32' CFLAGS='-O3 -m32' \ + LDFLAGS='-B/usr/lib32' + +to the `configure` command line. NASM 2.07 or later from FreeBSD ports must be +installed. + + +### Oracle Solaris Studio + +Add + + CC=cc + +to the `configure` command line. libjpeg-turbo will automatically be built +with the maximum optimization level (-xO5) unless you override `CFLAGS`. + +To build a 64-bit version of libjpeg-turbo using Oracle Solaris Studio, add + + --host x86_64-pc-solaris CC=cc CFLAGS='-xO5 -m64' LDFLAGS=-m64 + +to the `configure` command line. + + +### MinGW Build on Cygwin + +Use CMake (see recipes below) + + +ARM Support +----------- + +This release of libjpeg-turbo can use ARM NEON SIMD instructions to accelerate +JPEG compression/decompression by approximately 2-4x on ARMv7 and later +platforms. If libjpeg-turbo is configured on an ARM Linux platform, then the +build system will automatically include the NEON SIMD routines, if they are +supported. Build instructions for other ARM-based platforms follow. + + +### Building libjpeg-turbo for iOS + +iOS platforms, such as the iPhone and iPad, use ARM processors, some of which +support NEON instructions. Additional steps are required in order to build +libjpeg-turbo for these platforms. + + +#### Additional build requirements + +- [gas-preprocessor.pl] + (https://raw.githubusercontent.com/libjpeg-turbo/gas-preprocessor/master/gas-preprocessor.pl) + should be installed in your `PATH`. + + +#### ARM 32-bit Build (Xcode 4.6.x and earlier, LLVM-GCC) + +Set the following shell variables for simplicity: + + *Xcode 4.2 and earlier* + + IOS_PLATFORMDIR=/Developer/Platforms/iPhoneOS.platform` + + *Xcode 4.3 and later* + + IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform + + *All Xcode versions* + + IOS_SYSROOT=$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk + IOS_GCC=$IOS_PLATFORMDIR/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 + + *ARMv6 (code will run on all iOS devices, not SIMD-accelerated)* + [NOTE: Requires Xcode 4.4.x or earlier] + + IOS_CFLAGS="-march=armv6 -mcpu=arm1176jzf-s -mfpu=vfp" + + *ARMv7 (code will run on iPhone 3GS-4S/iPad 1st-3rd Generation and newer)* + + IOS_CFLAGS="-march=armv7 -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon" + + *ARMv7s (code will run on iPhone 5/iPad 4th Generation and newer)* + [NOTE: Requires Xcode 4.5 or later] + + IOS_CFLAGS="-march=armv7s -mcpu=swift -mtune=swift -mfpu=neon" + +Follow the procedure under "Building libjpeg-turbo" above, adding + + --host arm-apple-darwin10 \ + CC="$IOS_GCC" LD="$IOS_GCC" \ + CFLAGS="-mfloat-abi=softfp -isysroot $IOS_SYSROOT -O3 $IOS_CFLAGS" \ + LDFLAGS="-mfloat-abi=softfp -isysroot $IOS_SYSROOT $IOS_CFLAGS" + +to the `configure` command line. + + +#### ARM 32-bit Build (Xcode 5.0.x and later, Clang) + +Set the following shell variables for simplicity: + + IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform + IOS_SYSROOT=$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk + IOS_GCC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang + + *ARMv7 (code will run on iPhone 3GS-4S/iPad 1st-3rd Generation and newer)* + + IOS_CFLAGS="-arch armv7" + + *ARMv7s (code will run on iPhone 5/iPad 4th Generation and newer)* + + IOS_CFLAGS="-arch armv7s" + +Follow the procedure under "Building libjpeg-turbo" above, adding + + --host arm-apple-darwin10 \ + CC="$IOS_GCC" LD="$IOS_GCC" \ + CFLAGS="-mfloat-abi=softfp -isysroot $IOS_SYSROOT -O3 $IOS_CFLAGS" \ + LDFLAGS="-mfloat-abi=softfp -isysroot $IOS_SYSROOT $IOS_CFLAGS" \ + CCASFLAGS="-no-integrated-as $IOS_CFLAGS" + +to the `configure` command line. + + +#### ARMv8 64-bit Build (Xcode 5.0.x and later, Clang) + +Code will run on iPhone 5S/iPad Mini 2/iPad Air and newer. + +Set the following shell variables for simplicity: + + IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform + IOS_SYSROOT=$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk + IOS_GCC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang + IOS_CFLAGS="-arch arm64" + +Follow the procedure under "Building libjpeg-turbo" above, adding + + --host aarch64-apple-darwin \ + CC="$IOS_GCC" LD="$IOS_GCC" \ + CFLAGS="-isysroot $IOS_SYSROOT -O3 $IOS_CFLAGS" \ + LDFLAGS="-isysroot $IOS_SYSROOT $IOS_CFLAGS" + +to the `configure` command line. + + +NOTE: You can also add `-miphoneos-version-min={version}` to `$IOS_CFLAGS` +above in order to support older versions of iOS than the default version +supported by the SDK. + +Once built, lipo can be used to combine the ARMv6, v7, v7s, and/or v8 variants +into a universal library. + + +### Building libjpeg-turbo for Android + +Building libjpeg-turbo for Android platforms requires the +{Android NDK}(https://developer.android.com/tools/sdk/ndk) +and autotools. The following is a general recipe script that can be modified for your specific needs. + + # Set these variables to suit your needs + NDK_PATH={full path to the "ndk" directory-- for example, /opt/android/ndk} + BUILD_PLATFORM={the platform name for the NDK package you installed-- + for example, "windows-x86" or "linux-x86_64" or "darwin-x86_64"} + TOOLCHAIN_VERSION={"4.8", "4.9", "clang3.5", etc. This corresponds to a + toolchain directory under ${NDK_PATH}/toolchains/.} + ANDROID_VERSION={The minimum version of Android to support-- for example, + "16", "19", etc. "21" or later is required for a 64-bit build.} + + # 32-bit ARMv7 build + HOST=arm-linux-androideabi + SYSROOT=${NDK_PATH}/platforms/android-${ANDROID_VERSION}/arch-arm + ANDROID_CFLAGS="-march=armv7-a -mfloat-abi=softfp -fprefetch-loop-arrays \ + --sysroot=${SYSROOT}" + + # 64-bit ARMv8 build + HOST=aarch64-linux-android + SYSROOT=${NDK_PATH}/platforms/android-${ANDROID_VERSION}/arch-arm64 + ANDROID_CFLAGS="--sysroot=${SYSROOT}" + + TOOLCHAIN=${NDK_PATH}/toolchains/${HOST}-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM} + ANDROID_INCLUDES="-I${SYSROOT}/usr/include -I${TOOLCHAIN}/include" + export CPP=${TOOLCHAIN}/bin/${HOST}-cpp + export AR=${TOOLCHAIN}/bin/${HOST}-ar + export AS=${TOOLCHAIN}/bin/${HOST}-as + export NM=${TOOLCHAIN}/bin/${HOST}-nm + export CC=${TOOLCHAIN}/bin/${HOST}-gcc + export LD=${TOOLCHAIN}/bin/${HOST}-ld + export RANLIB=${TOOLCHAIN}/bin/${HOST}-ranlib + export OBJDUMP=${TOOLCHAIN}/bin/${HOST}-objdump + export STRIP=${TOOLCHAIN}/bin/${HOST}-strip + cd {build_directory} + sh {source_directory}/configure --host=${HOST} \ + CFLAGS="${ANDROID_INCLUDES} ${ANDROID_CFLAGS} -O3 -fPIE" \ + CPPFLAGS="${ANDROID_INCLUDES} ${ANDROID_CFLAGS}" \ + LDFLAGS="${ANDROID_CFLAGS} -pie" --with-simd ${1+"$@"} + make + +If building for Android 4.0.x (API level < 16) or earlier, remove `-fPIE` from +`CFLAGS` and `-pie` from `LDFLAGS`. + + +Building on Windows (Visual C++ or MinGW) +========================================= + + +Build Requirements +------------------ + +- [CMake](http://www.cmake.org) v2.8.8 or later + +- [NASM](http://www.nasm.us/) 0.98 or later (NASM 2.05 or later is required for + a 64-bit build) + * nasm.exe should be in your `PATH`. + +- Microsoft Visual C++ 2005 or later + + If you don't already have Visual C++, then the easiest way to get it is by + installing the + [Windows SDK](http://msdn.microsoft.com/en-us/windows/bb980924.aspx). + The Windows SDK includes both 32-bit and 64-bit Visual C++ compilers and + everything necessary to build libjpeg-turbo. + + * You can also use Microsoft Visual Studio Express/Community Edition, which + is a free download. (NOTE: versions prior to 2012 can only be used to + build 32-bit code.) + * If you intend to build libjpeg-turbo from the command line, then add the + appropriate compiler and SDK directories to the `INCLUDE`, `LIB`, and + `PATH` environment variables. This is generally accomplished by + executing `vcvars32.bat` or `vcvars64.bat` and `SetEnv.cmd`. + `vcvars32.bat` and `vcvars64.bat` are part of Visual C++ and are located in + the same directory as the compiler. `SetEnv.cmd` is part of the Windows + SDK. You can pass optional arguments to `SetEnv.cmd` to specify a 32-bit + or 64-bit build environment. + + ... OR ... + +- MinGW + + [MinGW-builds](http://sourceforge.net/projects/mingwbuilds/) or + [tdm-gcc](http://tdm-gcc.tdragon.net/) recommended if building on a Windows + machine. Both distributions install a Start Menu link that can be used to + launch a command prompt with the appropriate compiler paths automatically + set. + +- If building the TurboJPEG Java wrapper, JDK 1.5 or later is required. This + can be downloaded from . + + +Out-of-Tree Builds +------------------ + +Binary objects, libraries, and executables are generated in the same directory +from which `cmake` was executed (the "binary directory"), and this directory +need not necessarily be the same as the libjpeg-turbo source directory. You +can create multiple independent binary directories, in which different versions +of libjpeg-turbo can be built from the same source tree using different +compilers or settings. In the sections below, *{build_directory}* refers to +the binary directory, whereas *{source_directory}* refers to the libjpeg-turbo +source directory. For in-tree builds, these directories are the same. + + +Building libjpeg-turbo +---------------------- + + +### Visual C++ (Command Line) + + cd {build_directory} + cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release {source_directory} + nmake + +This will build either a 32-bit or a 64-bit version of libjpeg-turbo, depending +on which version of cl.exe is in the `PATH`. + +The following files will be generated under *{build_directory}*: + +**jpeg-static.lib** +Static link library for the libjpeg API + +**sharedlib/jpeg{version}.dll** +DLL for the libjpeg API + +**sharedlib/jpeg.lib** +Import library for the libjpeg API + +**turbojpeg-static.lib** +Static link library for the TurboJPEG API + +**turbojpeg.dll** +DLL for the TurboJPEG API + +**turbojpeg.lib** +Import library for the TurboJPEG API + +*{version}* is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or +v8 emulation is enabled. + + +### Visual C++ (IDE) + +Choose the appropriate CMake generator option for your version of Visual Studio +(run `cmake` with no arguments for a list of available generators.) For +instance: + + cd {build_directory} + cmake -G "Visual Studio 10" {source_directory} + +NOTE: Add "Win64" to the generator name (for example, "Visual Studio 10 +Win64") to build a 64-bit version of libjpeg-turbo. Recent versions of CMake +no longer document that. A separate build directory must be used for 32-bit +and 64-bit builds. + +You can then open ALL_BUILD.vcproj in Visual Studio and build one of the +configurations in that project ("Debug", "Release", etc.) to generate a full +build of libjpeg-turbo. + +This will generate the following files under *{build_directory}*: + +**{configuration}/jpeg-static.lib** +Static link library for the libjpeg API + +**sharedlib/{configuration}/jpeg{version}.dll** +DLL for the libjpeg API + +**sharedlib/{configuration}/jpeg.lib** +Import library for the libjpeg API + +**{configuration}/turbojpeg-static.lib** +Static link library for the TurboJPEG API + +**{configuration}/turbojpeg.dll** +DLL for the TurboJPEG API + +**{configuration}/turbojpeg.lib** +Import library for the TurboJPEG API + +*{configuration}* is Debug, Release, RelWithDebInfo, or MinSizeRel, depending +on the configuration you built in the IDE, and *{version}* is 62, 7, or 8, +depending on whether libjpeg v6b (default), v7, or v8 emulation is enabled. + + +### MinGW + +NOTE: This assumes that you are building on a Windows machine. If you are +cross-compiling on a Linux/Unix machine, then see "Build Recipes" below. + + cd {build_directory} + cmake -G "MinGW Makefiles" {source_directory} + mingw32-make + +This will generate the following files under *{build_directory}*: + +**libjpeg.a** +Static link library for the libjpeg API + +**sharedlib/libjpeg-{version}.dll** +DLL for the libjpeg API + +**sharedlib/libjpeg.dll.a** +Import library for the libjpeg API + +**libturbojpeg.a** +Static link library for the TurboJPEG API + +**libturbojpeg.dll** +DLL for the TurboJPEG API + +**libturbojpeg.dll.a** +Import library for the TurboJPEG API + +*{version}* is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or +v8 emulation is enabled. + + +### Debug Build + +Add `-DCMAKE_BUILD_TYPE=Debug` to the `cmake` command line. Or, if building +with NMake, remove `-DCMAKE_BUILD_TYPE=Release` (Debug builds are the default +with NMake.) + + +### libjpeg v7 or v8 API/ABI Emulation + +Add `-DWITH_JPEG7=1` to the `cmake` command line to build a version of +libjpeg-turbo that is API/ABI-compatible with libjpeg v7. Add `-DWITH_JPEG8=1` +to the `cmake` command line to build a version of libjpeg-turbo that is +API/ABI-compatible with libjpeg v8. See [README.md](README.md) for more +information on libjpeg v7 and v8 emulation. + + +### In-Memory Source/Destination Managers + +When using libjpeg v6b or v7 API/ABI emulation, add `-DWITH_MEM_SRCDST=0` to +the `cmake` command line to build a version of libjpeg-turbo that lacks the +`jpeg_mem_src()` and `jpeg_mem_dest()` functions. These functions were not +part of the original libjpeg v6b and v7 APIs, so removing them ensures strict +conformance with those APIs. See [README.md](README.md) for more information. + + +### Arithmetic Coding Support + +Since the patent on arithmetic coding has expired, this functionality has been +included in this release of libjpeg-turbo. libjpeg-turbo's implementation is +based on the implementation in libjpeg v8, but it works when emulating libjpeg +v7 or v6b as well. The default is to enable both arithmetic encoding and +decoding, but those who have philosophical objections to arithmetic coding can +add `-DWITH_ARITH_ENC=0` or `-DWITH_ARITH_DEC=0` to the `cmake` command line to +disable encoding or decoding (respectively.) + + +### TurboJPEG Java Wrapper + +Add `-DWITH_JAVA=1` to the `cmake` command line to incorporate an optional Java +Native Interface wrapper into the TurboJPEG shared library and build the Java +front-end classes to support it. This allows the TurboJPEG shared library to +be used directly from Java applications. See [java/README](java/README) for +more details. + +If you are using CMake 2.8, you can set the `Java_JAVAC_EXECUTABLE`, +`Java_JAVA_EXECUTABLE`, and `Java_JAR_EXECUTABLE` CMake variables to specify +alternate commands or locations for javac, jar, and java (respectively.) You +can also set the `JAVACFLAGS` CMake variable to specify arguments that should +be passed to the Java compiler when building the front-end classes. + + +Installing libjpeg-turbo +------------------------ + +You can use the build system to install libjpeg-turbo into a directory of your +choosing (as opposed to creating an installer.) To do this, add: + + -DCMAKE_INSTALL_PREFIX={install_directory} + +to the cmake command line. + +For example, + + cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=c:\libjpeg-turbo {source_directory} + nmake install + +will install the header files in c:\libjpeg-turbo\include, the library files +in c:\libjpeg-turbo\lib, the DLL's in c:\libjpeg-turbo\bin, and the +documentation in c:\libjpeg-turbo\doc. + + +Build Recipes +------------- + + +### 64-bit MinGW Build on Cygwin + + cd {build_directory} + CC=/usr/bin/x86_64-w64-mingw32-gcc \ + cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \ + -DCMAKE_RC_COMPILER=/usr/bin/x86_64-w64-mingw32-windres.exe \ + {source_directory} + make + +This produces a 64-bit build of libjpeg-turbo that does not depend on +cygwin1.dll or other Cygwin DLL's. The mingw64-x86\_64-gcc-core and +mingw64-x86\_64-gcc-g++ packages (and their dependencies) must be installed. + + +### 32-bit MinGW Build on Cygwin + + cd {build_directory} + CC=/usr/bin/i686-w64-mingw32-gcc \ + cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \ + -DCMAKE_RC_COMPILER=/usr/bin/i686-w64-mingw32-windres.exe \ + {source_directory} + make + +This produces a 32-bit build of libjpeg-turbo that does not depend on +cygwin1.dll or other Cygwin DLL's. The mingw64-i686-gcc-core and +mingw64-i686-gcc-g++ packages (and their dependencies) must be installed. + + +### MinGW Build on Linux + + cd {build_directory} + CC={mingw_binary_path}/i686-pc-mingw32-gcc \ + cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \ + -DCMAKE_RC_COMPILER={mingw_binary_path}/i686-pc-mingw32-windres \ + -DCMAKE_AR={mingw_binary_path}/i686-pc-mingw32-ar \ + -DCMAKE_RANLIB={mingw_binary_path}/i686-pc-mingw32-ranlib \ + {source_directory} + make + + +Creating Release Packages +========================= + +The following commands can be used to create various types of release packages: + + +Unix/Linux +---------- + + make rpm + +Create Red Hat-style binary RPM package. Requires RPM v4 or later. + + make srpm + +This runs `make dist` to create a pristine source tarball, then creates a +Red Hat-style source RPM package from the tarball. Requires RPM v4 or later. + + make deb + +Create Debian-style binary package. Requires dpkg. + + make dmg + +Create Macintosh package/disk image. This requires pkgbuild and +productbuild, which are installed by default on OS X 10.7 and later and which +can be obtained by installing Xcode 3.2.6 (with the "Unix Development" +option) on OS X 10.6. Packages built in this manner can be installed on OS X +10.5 and later, but they must be built on OS X 10.6 or later. + + make udmg [BUILDDIR32={32-bit build directory}] + +On 64-bit OS X systems, this creates a Macintosh package and disk image that +contains universal i386/x86-64 binaries. You should first configure a 32-bit +out-of-tree build of libjpeg-turbo, then configure a 64-bit out-of-tree +build, then run `make udmg` from the 64-bit build directory. The build +system will look for the 32-bit build under *{source_directory}*/osxx86 by +default, but you can override this by setting the `BUILDDIR32` variable on the +make command line as shown above. + + make iosdmg [BUILDDIR32={32-bit build directory}] \ + [BUILDDIRARMV6={ARMv6 build directory}] \ + [BUILDDIRARMV7={ARMv7 build directory}] \ + [BUILDDIRARMV7S={ARMv7s build directory}] \ + [BUILDDIRARMV8={ARMv8 build directory}] + +On OS X systems, this creates a Macintosh package and disk image in which the +libjpeg-turbo static libraries contain ARM architectures necessary to build +iOS applications. If building on an x86-64 system, the binaries will also +contain the i386 architecture, as with `make udmg` above. You should first +configure ARMv6, ARMv7, ARMv7s, and/or ARMv8 out-of-tree builds of +libjpeg-turbo (see "Building libjpeg-turbo for iOS" above.) If you are +building an x86-64 version of libjpeg-turbo, you should configure a 32-bit +out-of-tree build as well. Next, build libjpeg-turbo as you would normally, +using an out-of-tree build. When it is built, run `make iosdmg` from the +build directory. The build system will look for the ARMv6 build under +*{source_directory}*/iosarmv6 by default, the ARMv7 build under +*{source_directory}*/iosarmv7 by default, the ARMv7s build under +*{source_directory}*/iosarmv7s by default, the ARMv8 build under +*{source_directory}*/iosarmv8 by default, and (if applicable) the 32-bit build +under *{source_directory}*/osxx86 by default, but you can override this by +setting the `BUILDDIR32`, `BUILDDIRARMV6`, `BUILDDIRARMV7`, `BUILDDIRARMV7S`, +and/or `BUILDDIRARMV8` variables on the `make` command line as shown above. + +NOTE: If including an ARMv8 build in the package, then you may need to use +Xcode's version of lipo instead of the operating system's. To do this, pass +an argument of `LIPO="xcrun lipo"` on the make command line. + + make cygwinpkg + +Build a Cygwin binary package. + + +Windows +------- + +If using NMake: + + cd {build_directory} + nmake installer + +If using MinGW: + + cd {build_directory} + make installer + +If using the Visual Studio IDE, build the "installer" project. + +The installer package (libjpeg-turbo[-gcc][64].exe) will be located under +*{build_directory}*. If building using the Visual Studio IDE, then the +installer package will be located in a subdirectory with the same name as the +configuration you built (such as *{build_directory}*\Debug\ or +*{build_directory}*\Release\). + +Building a Windows installer requires the Nullsoft Install System +(http://nsis.sourceforge.net/.) makensis.exe should be in your `PATH`. + + +Regression testing +================== + +The most common way to test libjpeg-turbo is by invoking `make test` on +Unix/Linux platforms or `ctest` on Windows platforms, once the build has +completed. This runs a series of tests to ensure that mathematical +compatibility has been maintained between libjpeg-turbo and libjpeg v6b. This +also invokes the TurboJPEG unit tests, which ensure that the colorspace +extensions, YUV encoding, decompression scaling, and other features of the +TurboJPEG C and Java APIs are working properly (and, by extension, that the +equivalent features of the underlying libjpeg API are also working.) + +Invoking `make testclean` or `nmake testclean` (if using NMake) or building +the 'testclean' target (if using the Visual Studio IDE) will clean up the +output images generated by `make test`. + +On Unix/Linux platforms, more extensive tests of the TurboJPEG C and Java +wrappers can be run by invoking `make tjtest`. These extended TurboJPEG tests +essentially iterate through all of the available features of the TurboJPEG APIs +that are not covered by the TurboJPEG unit tests (this includes the lossless +transform options) and compare the images generated by each feature to images +generated using the equivalent feature in the libjpeg API. The extended +TurboJPEG tests are meant to test for regressions in the TurboJPEG wrappers, +not in the underlying libjpeg API library. diff --git a/CMakeLists.txt b/CMakeLists.txt index 5babbd47..14a8d377 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -170,6 +170,14 @@ configure_file(win/jconfigint.h.in jconfigint.h) include_directories("${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_SOURCE_DIR}") +string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UC) + +set(EFFECTIVE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UC}}") +message(STATUS "Compiler flags = ${EFFECTIVE_C_FLAGS}") + +set(EFFECTIVE_LD_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_UC}}") +message(STATUS "Linker flags = ${EFFECTIVE_LD_FLAGS}") + if(WITH_JAVA) find_package(Java) find_package(JNI) @@ -317,6 +325,8 @@ add_executable(wrjpgcom wrjpgcom.c) # Tests # +add_subdirectory(md5) + if(MSVC_IDE) set(OBJDIR "\${CTEST_CONFIGURATION_TYPE}/") else() @@ -353,6 +363,10 @@ if(WITH_12BIT) set(MD5_PPM_420M_ISLOW_3_8 343d19015531b7bbe746124127244fa8) set(MD5_PPM_420M_ISLOW_1_4 35fd59d866e44659edfa3c18db2a3edb) set(MD5_PPM_420M_ISLOW_1_8 ccaed48ac0aedefda5d4abe4013f4ad7) + set(MD5_PPM_420_ISLOW_SKIP15_31 86664cd9dc956536409e44e244d20a97) + set(MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71 452a21656115a163029cfba5c04fa76a) + set(MD5_PPM_444_ISLOW_SKIP1_6 ef63901f71ef7a75cd78253fc0914f84) + set(MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13 15b173fb5872d9575572fbcc1b05956f) set(MD5_JPEG_CROP cdb35ff4b4519392690ea040c56ea99c) else() set(TESTORIG testorig.jpg) @@ -402,6 +416,13 @@ else() set(MD5_BMP_420_ISLOW_565D 6bde71526acc44bcff76f696df8638d2) set(MD5_BMP_420M_ISLOW_565 8dc0185245353cfa32ad97027342216f) set(MD5_BMP_420M_ISLOW_565D d1be3a3339166255e76fa50a0d70d73e) + set(MD5_PPM_420_ISLOW_SKIP15_31 c4c65c1e43d7275cd50328a61e6534f0) + set(MD5_PPM_420_ISLOW_ARI_SKIP16_139 087c6b123db16ac00cb88c5b590bb74a) + set(MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71 26eb36ccc7d1f0cb80cdabb0ac8b5d99) + set(MD5_PPM_420_ISLOW_ARI_CROP53x53_4_4 886c6775af22370257122f8b16207e6d) + set(MD5_PPM_444_ISLOW_SKIP1_6 5606f86874cf26b8fcee1117a0a436a6) + set(MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13 db87dc7ce26bcdc7a6b56239ce2b9d6c) + set(MD5_PPM_444_ISLOW_ARI_CROP37x37_0_0 cb57b32bd6d03e35432362f7bf184b6d) set(MD5_JPEG_CROP b4197f377e621c4e9b1d20471432610d) endif() @@ -440,6 +461,13 @@ if(ENABLE_STATIC) set(TEST_LIBTYPES ${TEST_LIBTYPES} static) endif() +set(TESTIMAGES ${CMAKE_SOURCE_DIR}/testimages) +set(MD5CMP ${CMAKE_CURRENT_BINARY_DIR}/md5/md5cmp) +if(CMAKE_CROSSCOMPILING) + file(RELATIVE_PATH TESTIMAGES ${CMAKE_CURRENT_BINARY_DIR} ${TESTIMAGES}) + file(RELATIVE_PATH MD5CMP ${CMAKE_CURRENT_BINARY_DIR} ${MD5CMP}) +endif() + foreach(libtype ${TEST_LIBTYPES}) if(libtype STREQUAL "shared") set(dir sharedlib/) @@ -461,219 +489,186 @@ foreach(libtype ${TEST_LIBTYPES}) # CC: null SAMP: fullsize FDCT: islow ENT: huff add_test(cjpeg${suffix}-rgb-islow - ${dir}cjpeg${suffix} -revert -rgb -dct int -outfile testout_rgb_islow.jpg - ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) + ${dir}cjpeg${suffix} -revert -rgb -dct int + -outfile testout_rgb_islow.jpg ${TESTIMAGES}/testorig.ppm) add_test(cjpeg${suffix}-rgb-islow-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_RGB_ISLOW} -DFILE=testout_rgb_islow.jpg - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_JPEG_RGB_ISLOW} testout_rgb_islow.jpg) + # CC: null SAMP: fullsize IDCT: islow ENT: huff add_test(djpeg${suffix}-rgb-islow - ${dir}djpeg${suffix} -dct int -ppm -outfile testout_rgb_islow.ppm - testout_rgb_islow.jpg) + ${dir}djpeg${suffix} -dct int -ppm + -outfile testout_rgb_islow.ppm testout_rgb_islow.jpg) add_test(djpeg${suffix}-rgb-islow-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_PPM_RGB_ISLOW} -DFILE=testout_rgb_islow.ppm - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_PPM_RGB_ISLOW} testout_rgb_islow.ppm) + if(NOT WITH_12BIT) # CC: RGB->RGB565 SAMP: fullsize IDCT: islow ENT: huff add_test(djpeg${suffix}-rgb-islow-565 ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp -outfile testout_rgb_islow_565.bmp testout_rgb_islow.jpg) add_test(djpeg${suffix}-rgb-islow-565-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_RGB_ISLOW_565} - -DFILE=testout_rgb_islow_565.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_BMP_RGB_ISLOW_565} testout_rgb_islow_565.bmp) + # CC: RGB->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff add_test(djpeg${suffix}-rgb-islow-565D ${dir}djpeg${suffix} -dct int -rgb565 -bmp -outfile testout_rgb_islow_565D.bmp testout_rgb_islow.jpg) add_test(djpeg${suffix}-rgb-islow-565D-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_RGB_ISLOW_565D} - -DFILE=testout_rgb_islow_565D.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_BMP_RGB_ISLOW_565D} testout_rgb_islow_565D.bmp) endif() # CC: RGB->YCC SAMP: fullsize/h2v1 FDCT: ifast ENT: 2-pass huff add_test(cjpeg${suffix}-422-ifast-opt ${dir}cjpeg${suffix} -revert -sample 2x1 -dct fast -opt - -outfile testout_422_ifast_opt.jpg - ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) + -outfile testout_422_ifast_opt.jpg ${TESTIMAGES}/testorig.ppm) add_test(cjpeg${suffix}-422-ifast-opt-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_422_IFAST_OPT} - -DFILE=testout_422_ifast_opt.jpg - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_JPEG_422_IFAST_OPT} testout_422_ifast_opt.jpg) + # CC: YCC->RGB SAMP: fullsize/h2v1 fancy IDCT: ifast ENT: huff add_test(djpeg${suffix}-422-ifast - ${dir}djpeg${suffix} -dct fast -outfile testout_422_ifast.ppm - testout_422_ifast_opt.jpg) + ${dir}djpeg${suffix} -dct fast + -outfile testout_422_ifast.ppm testout_422_ifast_opt.jpg) add_test(djpeg${suffix}-422-ifast-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_PPM_422_IFAST} -DFILE=testout_422_ifast.ppm - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_PPM_422_IFAST} testout_422_ifast.ppm) + # CC: YCC->RGB SAMP: h2v1 merged IDCT: ifast ENT: huff add_test(djpeg${suffix}-422m-ifast - ${dir}djpeg${suffix} -dct fast -nosmooth -outfile testout_422m_ifast.ppm - testout_422_ifast_opt.jpg) + ${dir}djpeg${suffix} -dct fast -nosmooth + -outfile testout_422m_ifast.ppm testout_422_ifast_opt.jpg) add_test(djpeg${suffix}-422m-ifast-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_PPM_422M_IFAST} -DFILE=testout_422m_ifast.ppm - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_PPM_422M_IFAST} testout_422m_ifast.ppm) + if(NOT WITH_12BIT) # CC: YCC->RGB565 SAMP: h2v1 merged IDCT: ifast ENT: huff add_test(djpeg${suffix}-422m-ifast-565 ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -dither none -bmp -outfile testout_422m_ifast_565.bmp testout_422_ifast_opt.jpg) add_test(djpeg${suffix}-422m-ifast-565-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_422M_IFAST_565} - -DFILE=testout_422m_ifast_565.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_BMP_422M_IFAST_565} testout_422m_ifast_565.bmp) + # CC: YCC->RGB565 (dithered) SAMP: h2v1 merged IDCT: ifast ENT: huff add_test(djpeg${suffix}-422m-ifast-565D ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -bmp -outfile testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg) add_test(djpeg${suffix}-422m-ifast-565D-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_422M_IFAST_565D} - -DFILE=testout_422m_ifast_565D.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_BMP_422M_IFAST_565D} testout_422m_ifast_565D.bmp) endif() # CC: RGB->YCC SAMP: fullsize/h2v2 FDCT: ifast ENT: prog huff add_test(cjpeg${suffix}-420-q100-ifast-prog ${dir}cjpeg${suffix} -revert -sample 2x2 -quality 100 -dct fast -prog - -outfile testout_420_q100_ifast_prog.jpg - ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) + -outfile testout_420_q100_ifast_prog.jpg ${TESTIMAGES}/testorig.ppm) add_test(cjpeg${suffix}-420-q100-ifast-prog-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_420_IFAST_Q100_PROG} - -DFILE=testout_420_q100_ifast_prog.jpg - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_JPEG_420_IFAST_Q100_PROG} testout_420_q100_ifast_prog.jpg) + # CC: YCC->RGB SAMP: fullsize/h2v2 fancy IDCT: ifast ENT: prog huff add_test(djpeg${suffix}-420-q100-ifast-prog - ${dir}djpeg${suffix} -dct fast -outfile testout_420_q100_ifast.ppm - testout_420_q100_ifast_prog.jpg) + ${dir}djpeg${suffix} -dct fast + -outfile testout_420_q100_ifast.ppm testout_420_q100_ifast_prog.jpg) add_test(djpeg${suffix}-420-q100-ifast-prog-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_PPM_420_Q100_IFAST} - -DFILE=testout_420_q100_ifast.ppm - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_PPM_420_Q100_IFAST} testout_420_q100_ifast.ppm) + # CC: YCC->RGB SAMP: h2v2 merged IDCT: ifast ENT: prog huff add_test(djpeg${suffix}-420m-q100-ifast-prog ${dir}djpeg${suffix} -dct fast -nosmooth -outfile testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg) add_test(djpeg${suffix}-420m-q100-ifast-prog-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_PPM_420M_Q100_IFAST} - -DFILE=testout_420m_q100_ifast.ppm - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_PPM_420M_Q100_IFAST} testout_420m_q100_ifast.ppm) # CC: RGB->Gray SAMP: fullsize FDCT: islow ENT: huff add_test(cjpeg${suffix}-gray-islow - ${dir}cjpeg${suffix} -revert -gray -dct int -outfile testout_gray_islow.jpg - ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) + ${dir}cjpeg${suffix} -revert -gray -dct int + -outfile testout_gray_islow.jpg ${TESTIMAGES}/testorig.ppm) add_test(cjpeg${suffix}-gray-islow-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_GRAY_ISLOW} - -DFILE=testout_gray_islow.jpg - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_JPEG_GRAY_ISLOW} testout_gray_islow.jpg) + # CC: Gray->Gray SAMP: fullsize IDCT: islow ENT: huff add_test(djpeg${suffix}-gray-islow - ${dir}djpeg${suffix} -dct int -outfile testout_gray_islow.ppm - testout_gray_islow.jpg) + ${dir}djpeg${suffix} -dct int + -outfile testout_gray_islow.ppm testout_gray_islow.jpg) add_test(djpeg${suffix}-gray-islow-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_PPM_GRAY_ISLOW} - -DFILE=testout_gray_islow.ppm - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_PPM_GRAY_ISLOW} testout_gray_islow.ppm) + # CC: Gray->RGB SAMP: fullsize IDCT: islow ENT: huff add_test(djpeg${suffix}-gray-islow-rgb - ${dir}djpeg${suffix} -dct int -rgb -outfile testout_gray_islow_rgb.ppm - testout_gray_islow.jpg) + ${dir}djpeg${suffix} -dct int -rgb + -outfile testout_gray_islow_rgb.ppm testout_gray_islow.jpg) add_test(djpeg${suffix}-gray-islow-rgb-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_PPM_GRAY_ISLOW_RGB} - -DFILE=testout_gray_islow_rgb.ppm - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_PPM_GRAY_ISLOW_RGB} testout_gray_islow_rgb.ppm) + if(NOT WITH_12BIT) # CC: Gray->RGB565 SAMP: fullsize IDCT: islow ENT: huff add_test(djpeg${suffix}-gray-islow-565 ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp -outfile testout_gray_islow_565.bmp testout_gray_islow.jpg) add_test(djpeg${suffix}-gray-islow-565-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_GRAY_ISLOW_565} - -DFILE=testout_gray_islow_565.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_BMP_GRAY_ISLOW_565} testout_gray_islow_565.bmp) + # CC: Gray->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff add_test(djpeg${suffix}-gray-islow-565D ${dir}djpeg${suffix} -dct int -rgb565 -bmp -outfile testout_gray_islow_565D.bmp testout_gray_islow.jpg) add_test(djpeg${suffix}-gray-islow-565D-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_GRAY_ISLOW_565D} - -DFILE=testout_gray_islow_565D.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_BMP_GRAY_ISLOW_565D} testout_gray_islow_565D.bmp) endif() # CC: RGB->YCC SAMP: fullsize smooth/h2v2 smooth FDCT: islow # ENT: 2-pass huff add_test(cjpeg${suffix}-420s-ifast-opt - ${dir}cjpeg${suffix} -sample 2x2 -smooth 1 -dct int -opt -outfile - testout_420s_ifast_opt.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) + ${dir}cjpeg${suffix} -sample 2x2 -smooth 1 -dct int -opt + -outfile testout_420s_ifast_opt.jpg ${TESTIMAGES}/testorig.ppm) add_test(cjpeg${suffix}-420s-ifast-opt-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_420S_IFAST_OPT} - -DFILE=testout_420s_ifast_opt.jpg - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_JPEG_420S_IFAST_OPT} testout_420s_ifast_opt.jpg) # CC: RGB->YCC SAMP: fullsize/int FDCT: float ENT: prog huff add_test(cjpeg${suffix}-3x2-float-prog ${dir}cjpeg${suffix} -revert -sample 3x2 -dct float -prog - -outfile testout_3x2_float_prog.jpg - ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) + -outfile testout_3x2_float_prog.jpg ${TESTIMAGES}/testorig.ppm) add_test(cjpeg${suffix}-3x2-float-prog-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_3x2_FLOAT_PROG} - -DFILE=testout_3x2_float_prog.jpg - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_JPEG_3x2_FLOAT_PROG} testout_3x2_float_prog.jpg) + # CC: YCC->RGB SAMP: fullsize/int IDCT: float ENT: prog huff add_test(djpeg${suffix}-3x2-float-prog - ${dir}djpeg${suffix} -dct float -outfile testout_3x2_float.ppm - testout_3x2_float_prog.jpg) + ${dir}djpeg${suffix} -dct float + -outfile testout_3x2_float.ppm testout_3x2_float_prog.jpg) add_test(djpeg${suffix}-3x2-float-prog-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_PPM_3x2_FLOAT} -DFILE=testout_3x2_float.ppm - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_PPM_3x2_FLOAT} testout_3x2_float.ppm) if(WITH_ARITH_ENC) # CC: YCC->RGB SAMP: fullsize/h2v2 FDCT: islow ENT: arith add_test(cjpeg${suffix}-420-islow-ari ${dir}cjpeg${suffix} -revert -dct int -arithmetic - -outfile testout_420_islow_ari.jpg - ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) + -outfile testout_420_islow_ari.jpg ${TESTIMAGES}/testorig.ppm) add_test(cjpeg${suffix}-420-islow-ari-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_420_ISLOW_ARI} - -DFILE=testout_420_islow_ari.jpg - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_JPEG_420_ISLOW_ARI} testout_420_islow_ari.jpg) + add_test(jpegtran${suffix}-420-islow-ari ${dir}jpegtran${suffix} -revert -arithmetic - -outfile testout_420_islow_ari.jpg - ${CMAKE_SOURCE_DIR}/testimages/testimgint.jpg) + -outfile testout_420_islow_ari.jpg ${TESTIMAGES}/testimgint.jpg) add_test(jpegtran${suffix}-420-islow-ari-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_420_ISLOW_ARI} - -DFILE=testout_420_islow_ari.jpg - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_JPEG_420_ISLOW_ARI} testout_420_islow_ari.jpg) + # CC: YCC->RGB SAMP: fullsize FDCT: islow ENT: prog arith add_test(cjpeg${suffix}-444-islow-progari - ${dir}cjpeg${suffix} -revert -sample 1x1 -dct int -progressive -arithmetic - -outfile testout_444_islow_progari.jpg - ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) + ${dir}cjpeg${suffix} -revert -sample 1x1 -dct int -prog -arithmetic + -outfile testout_444_islow_progari.jpg ${TESTIMAGES}/testorig.ppm) add_test(cjpeg${suffix}-444-islow-progari-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_444_ISLOW_PROGARI} - -DFILE=testout_444_islow_progari.jpg - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_JPEG_444_ISLOW_PROGARI} testout_444_islow_progari.jpg) endif() + if(WITH_ARITH_DEC) # CC: RGB->YCC SAMP: h2v2 merged IDCT: ifast ENT: arith add_test(djpeg${suffix}-420m-ifast-ari - ${dir}djpeg${suffix} -fast -ppm -outfile testout_420m_ifast_ari.ppm - ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg) + ${dir}djpeg${suffix} -fast -ppm + -outfile testout_420m_ifast_ari.ppm ${TESTIMAGES}/testimgari.jpg) add_test(djpeg${suffix}-420m-ifast-ari-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_PPM_420M_IFAST_ARI} - -DFILE=testout_420m_ifast_ari.ppm - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_PPM_420M_IFAST_ARI} testout_420m_ifast_ari.ppm) + add_test(jpegtran${suffix}-420-islow - ${dir}jpegtran${suffix} -revert -outfile testout_420_islow.jpg - ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg) + ${dir}jpegtran${suffix} -revert + -outfile testout_420_islow.jpg ${TESTIMAGES}/testimgari.jpg) add_test(jpegtran${suffix}-420-islow-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_420_ISLOW} - -DFILE=testout_420_islow.jpg - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_JPEG_420_ISLOW} testout_420_islow.jpg) endif() # 2/1-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 16x16 islow ENT: huff @@ -699,71 +694,139 @@ foreach(libtype ${TEST_LIBTYPES}) string(REGEX REPLACE "_" "/" scalearg ${scale}) add_test(djpeg${suffix}-420m-islow-${scale} ${dir}djpeg${suffix} -dct int -scale ${scalearg} -nosmooth -ppm - -outfile testout_420m_islow_${scale}.ppm - ${CMAKE_SOURCE_DIR}/testimages/${TESTORIG}) + -outfile testout_420m_islow_${scale}.ppm ${TESTIMAGES}/${TESTORIG}) add_test(djpeg${suffix}-420m-islow-${scale}-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_PPM_420M_ISLOW_${scale}} - -DFILE=testout_420m_islow_${scale}.ppm - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_PPM_420M_ISLOW_${scale}} testout_420m_islow_${scale}.ppm) endforeach() if(NOT WITH_12BIT) # CC: YCC->RGB (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff add_test(djpeg${suffix}-420-islow-256 ${dir}djpeg${suffix} -dct int -colors 256 -bmp - -outfile testout_420_islow_256.bmp - ${CMAKE_SOURCE_DIR}/testimages/${TESTORIG}) + -outfile testout_420_islow_256.bmp ${TESTIMAGES}/${TESTORIG}) add_test(djpeg${suffix}-420-islow-256-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420_ISLOW_256} - -DFILE=testout_420_islow_256.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_BMP_420_ISLOW_256} testout_420_islow_256.bmp) + # CC: YCC->RGB565 SAMP: h2v2 fancy IDCT: islow ENT: huff add_test(djpeg${suffix}-420-islow-565 ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp - -outfile testout_420_islow_565.bmp - ${CMAKE_SOURCE_DIR}/testimages/${TESTORIG}) + -outfile testout_420_islow_565.bmp ${TESTIMAGES}/${TESTORIG}) add_test(djpeg${suffix}-420-islow-565-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420_ISLOW_565} - -DFILE=testout_420_islow_565.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_BMP_420_ISLOW_565} testout_420_islow_565.bmp) + # CC: YCC->RGB565 (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff add_test(djpeg${suffix}-420-islow-565D ${dir}djpeg${suffix} -dct int -rgb565 -bmp - -outfile testout_420_islow_565D.bmp - ${CMAKE_SOURCE_DIR}/testimages/${TESTORIG}) + -outfile testout_420_islow_565D.bmp ${TESTIMAGES}/${TESTORIG}) add_test(djpeg${suffix}-420-islow-565D-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420_ISLOW_565D} - -DFILE=testout_420_islow_565D.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_BMP_420_ISLOW_565D} testout_420_islow_565D.bmp) + # CC: YCC->RGB565 SAMP: h2v2 merged IDCT: islow ENT: huff add_test(djpeg${suffix}-420m-islow-565 ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -dither none -bmp - -outfile testout_420m_islow_565.bmp - ${CMAKE_SOURCE_DIR}/testimages/${TESTORIG}) + -outfile testout_420m_islow_565.bmp ${TESTIMAGES}/${TESTORIG}) add_test(djpeg${suffix}-420m-islow-565-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420M_ISLOW_565} - -DFILE=testout_420m_islow_565.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_BMP_420M_ISLOW_565} testout_420m_islow_565.bmp) + # CC: YCC->RGB565 (dithered) SAMP: h2v2 merged IDCT: islow ENT: huff add_test(djpeg${suffix}-420m-islow-565D ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -bmp - -outfile testout_420m_islow_565D.bmp - ${CMAKE_SOURCE_DIR}/testimages/${TESTORIG}) + -outfile testout_420m_islow_565D.bmp ${TESTIMAGES}/${TESTORIG}) add_test(djpeg${suffix}-420m-islow-565D-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420M_ISLOW_565D} - -DFILE=testout_420m_islow_565D.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_BMP_420M_ISLOW_565D} testout_420m_islow_565D.bmp) endif() + + # Partial decode tests. These tests are designed to cover all of the + # possible code paths in jpeg_skip_scanlines(). + + # Context rows: Yes Intra-iMCU row: Yes iMCU row prefetch: No ENT: huff + add_test(djpeg${suffix}-420-islow-skip15_31 + ${dir}djpeg${suffix} -dct int -skip 15,31 -ppm + -outfile testout_420_islow_skip15,31.ppm ${TESTIMAGES}/${TESTORIG}) + add_test(djpeg${suffix}-420-islow-skip15_31-cmp + ${MD5CMP} ${MD5_PPM_420_ISLOW_SKIP15_31} testout_420_islow_skip15,31.ppm) + + # Context rows: Yes Intra-iMCU row: No iMCU row prefetch: Yes ENT: arith + if(WITH_ARITH_DEC) + add_test(djpeg${suffix}-420-islow-ari-skip16_139 + ${dir}djpeg${suffix} -dct int -skip 16,139 -ppm + -outfile testout_420_islow_ari_skip16,139.ppm + ${TESTIMAGES}/testimgari.jpg) + add_test(djpeg${suffix}-420-islow-ari_skip16_139-cmp + ${MD5CMP} ${MD5_PPM_420_ISLOW_ARI_SKIP16_139} + testout_420_islow_ari_skip16,139.ppm) + endif() + + # Context rows: Yes Intra-iMCU row: No iMCU row prefetch: No ENT: prog huff + add_test(cjpeg${suffix}-420-islow-prog + ${dir}cjpeg${suffix} -dct int -prog + -outfile testout_420_islow_prog.jpg ${TESTIMAGES}/testorig.ppm) + add_test(djpeg${suffix}-420-islow-prog-crop62x62_71_71 + ${dir}djpeg${suffix} -dct int -crop 62x62+71+71 -ppm + -outfile testout_420_islow_prog_crop62x62,71,71.ppm + testout_420_islow_prog.jpg) + add_test(djpeg${suffix}-420-islow-prog-crop62x62_71_71-cmp + ${MD5CMP} ${MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71} + testout_420_islow_prog_crop62x62,71,71.ppm) + + # Context rows: Yes Intra-iMCU row: No iMCU row prefetch: No ENT: arith + if(WITH_ARITH_DEC) + add_test(djpeg${suffix}-420-islow-ari-crop53x53_4_4 + ${dir}djpeg${suffix} -dct int -crop 53x53+4+4 -ppm + -outfile testout_420_islow_ari_crop53x53,4,4.ppm + ${TESTIMAGES}/testimgari.jpg) + add_test(djpeg${suffix}-420-islow-ari-crop53x53_4_4-cmp + ${MD5CMP} ${MD5_PPM_420_ISLOW_ARI_CROP53x53_4_4} + testout_420_islow_ari_crop53x53,4,4.ppm) + endif() + + # Context rows: No Intra-iMCU row: Yes ENT: huff + add_test(cjpeg${suffix}-444-islow + ${dir}cjpeg${suffix} -dct int -sample 1x1 + -outfile testout_444_islow.jpg ${TESTIMAGES}/testorig.ppm) + add_test(djpeg${suffix}-444-islow-skip1_6 + ${dir}djpeg${suffix} -dct int -skip 1,6 -ppm + -outfile testout_444_islow_skip1,6.ppm testout_444_islow.jpg) + add_test(djpeg${suffix}-444-islow-skip1_6-cmp + ${MD5CMP} ${MD5_PPM_444_ISLOW_SKIP1_6} testout_444_islow_skip1,6.ppm) + + # Context rows: No Intra-iMCU row: No ENT: prog huff + add_test(cjpeg${suffix}-444-islow-prog + ${dir}cjpeg${suffix} -dct int -prog -sample 1x1 + -outfile testout_444_islow_prog.jpg ${TESTIMAGES}/testorig.ppm) + add_test(djpeg${suffix}-444-islow-prog-crop98x98_13_13 + ${dir}djpeg${suffix} -dct int -crop 98x98+13+13 -ppm + -outfile testout_444_islow_prog_crop98x98,13,13.ppm + testout_444_islow_prog.jpg) + add_test(djpeg${suffix}-444-islow-prog_crop98x98_13_13-cmp + ${MD5CMP} ${MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13} + testout_444_islow_prog_crop98x98,13,13.ppm) + + # Context rows: No Intra-iMCU row: No ENT: arith + if(WITH_ARITH_ENC) + add_test(cjpeg${suffix}-444-islow-ari + ${dir}cjpeg${suffix} -dct int -arithmetic -sample 1x1 + -outfile testout_444_islow_ari.jpg ${TESTIMAGES}/testorig.ppm) + if(WITH_ARITH_DEC) + add_test(djpeg${suffix}-444-islow-ari-crop37x37_0_0 + ${dir}djpeg${suffix} -dct int -crop 37x37+0+0 -ppm + -outfile testout_444_islow_ari_crop37x37,0,0.ppm + testout_444_islow_ari.jpg) + add_test(djpeg${suffix}-444-islow-ari-crop37x37_0_0-cmp + ${MD5CMP} ${MD5_PPM_444_ISLOW_ARI_CROP37x37_0_0} + testout_444_islow_ari_crop37x37,0,0.ppm) + endif() + endif() + add_test(jpegtran${suffix}-crop ${dir}jpegtran${suffix} -revert -crop 120x90+20+50 -transpose -perfect - -outfile testout_crop.jpg ${CMAKE_SOURCE_DIR}/testimages/${TESTORIG}) + -outfile testout_crop.jpg ${TESTIMAGES}/${TESTORIG}) add_test(jpegtran${suffix}-crop-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_CROP} -DFILE=testout_crop.jpg - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + ${MD5CMP} ${MD5_JPEG_CROP} testout_crop.jpg) endforeach() -add_custom_target(testclean COMMAND ${CMAKE_COMMAND} -P +add_custom_target(testclean COMMAND ${MD5CMP} -P ${CMAKE_SOURCE_DIR}/cmakescripts/testclean.cmake) @@ -843,7 +906,7 @@ endif() install(TARGETS rdjpgcom wrjpgcom RUNTIME DESTINATION bin) -install(FILES ${CMAKE_SOURCE_DIR}/README ${CMAKE_SOURCE_DIR}/README-mozilla.txt +install(FILES ${CMAKE_SOURCE_DIR}/README.ijg ${CMAKE_SOURCE_DIR}/README-mozilla.txt ${CMAKE_SOURCE_DIR}/example.c ${CMAKE_SOURCE_DIR}/libjpeg.txt ${CMAKE_SOURCE_DIR}/structure.txt ${CMAKE_SOURCE_DIR}/usage.txt ${CMAKE_SOURCE_DIR}/wizard.txt diff --git a/ChangeLog.md b/ChangeLog.md new file mode 100644 index 00000000..99ab5956 --- /dev/null +++ b/ChangeLog.md @@ -0,0 +1,934 @@ +1.5.0 +===== + +### Significant changes relative to 1.5 beta1: + +1. Fixed an issue whereby a malformed motion-JPEG frame could cause the "fast +path" of libjpeg-turbo's Huffman decoder to read from uninitialized memory. + +2. Added libjpeg-turbo version and build information to the global string table +of the libjpeg and TurboJPEG API libraries. This is a common practice in other +infrastructure libraries, such as OpenSSL and libpng, because it makes it easy +to examine an application binary and determine which version of the library the +application was linked against. + +3. Fixed a couple of issues in the PPM reader that would cause buffer overruns +in cjpeg if one of the values in a binary PPM/PGM input file exceeded the +maximum value defined in the file's header. libjpeg-turbo 1.4.2 already +included a similar fix for ASCII PPM/PGM files. Note that these issues were +not security bugs, since they were confined to the cjpeg program and did not +affect any of the libjpeg-turbo libraries. + +4. Fixed an issue whereby attempting to decompress a JPEG file with a corrupt +header using the `tjDecompressToYUV2()` function would cause the function to +abort without returning an error and, under certain circumstances, corrupt the +stack. This only occurred if `tjDecompressToYUV2()` was called prior to +calling `tjDecompressHeader3()`, or if the return value from +`tjDecompressHeader3()` was ignored (both cases represent incorrect usage of +the TurboJPEG API.) + + +1.4.90 (1.5 beta1) +================== + +### Significant changes relative to 1.4.2: + +1. Added full SIMD acceleration for PowerPC platforms using AltiVec VMX +(128-bit SIMD) instructions. Although the performance of libjpeg-turbo on +PowerPC was already good, due to the increased number of registers available +to the compiler vs. x86, it was still possible to speed up compression by about +3-4x and decompression by about 2-2.5x (relative to libjpeg v6b) through the +use of AltiVec instructions. + +2. Added two new libjpeg API functions (`jpeg_skip_scanlines()` and +`jpeg_crop_scanline()`) that can be used to partially decode a JPEG image. See +[libjpeg.txt](libjpeg.txt) for more details. + +3. The TJCompressor and TJDecompressor classes in the TurboJPEG Java API now +implement the Closeable interface, so those classes can be used with a +try-with-resources statement. + +4. The TurboJPEG Java classes now throw unchecked idiomatic exceptions +(IllegalArgumentException, IllegalStateException) for unrecoverable errors +caused by incorrect API usage, and those classes throw a new checked exception +type (TJException) for errors that are passed through from the C library. + +5. Source buffers for the TurboJPEG C API functions, as well as the +`jpeg_mem_src()` function in the libjpeg API, are now declared as const +pointers. This facilitates passing read-only buffers to those functions and +ensures the caller that the source buffer will not be modified. This should +not create any backward API or ABI incompatibilities with prior libjpeg-turbo +releases. + +6. The MIPS DSPr2 SIMD code can now be compiled to support either FR=0 or FR=1 +FPUs. + +7. Fixed additional negative left shifts and other issues reported by the GCC +and Clang undefined behavior sanitizers. Most of these issues affected only +32-bit code, and none of them was known to pose a security threat, but removing +the warnings makes it easier to detect actual security issues, should they +arise in the future. + +8. Removed the unnecessary `.arch` directive from the ARM64 NEON SIMD code. +This directive was preventing the code from assembling using the clang +integrated assembler. + +9. Fixed a regression caused by 1.4.1[6] that prevented 32-bit and 64-bit +libjpeg-turbo RPMs from being installed simultaneously on recent Red Hat/Fedora +distributions. This was due to the addition of a macro in jconfig.h that +allows the Huffman codec to determine the word size at compile time. Since +that macro differs between 32-bit and 64-bit builds, this caused a conflict +between the i386 and x86_64 RPMs (any differing files, other than executables, +are not allowed when 32-bit and 64-bit RPMs are installed simultaneously.) +Since the macro is used only internally, it has been moved into jconfigint.h. + +10. The x86-64 SIMD code can now be disabled at run time by setting the +`JSIMD_FORCENONE` environment variable to `1` (the other SIMD implementations +already had this capability.) + +11. Added a new command-line argument to TJBench (`-nowrite`) that prevents the +benchmark from outputting any images. This removes any potential operating +system overhead that might be caused by lazy writes to disk and thus improves +the consistency of the performance measurements. + +12. Added SIMD acceleration for Huffman encoding on SSE2-capable x86 and x86-64 +platforms. This speeds up the compression of full-color JPEGs by about 10-15% +on average (relative to libjpeg-turbo 1.4.x) when using modern Intel and AMD +CPUs. Additionally, this works around an issue in the clang optimizer that +prevents it (as of this writing) from achieving the same performance as GCC +when compiling the C version of the Huffman encoder +(). For the purposes of +benchmarking or regression testing, SIMD-accelerated Huffman encoding can be +disabled by setting the `JSIMD_NOHUFFENC` environment variable to `1`. + +13. Added ARM 64-bit (ARMv8) NEON SIMD implementations of the commonly-used +compression algorithms (including the slow integer forward DCT and h2v2 & h2v1 +downsampling algorithms, which are not accelerated in the 32-bit NEON +implementation.) This speeds up the compression of full-color JPEGs by about +75% on average on a Cavium ThunderX processor and by about 2-2.5x on average on +Cortex-A53 and Cortex-A57 cores. + +14. Added SIMD acceleration for Huffman encoding on NEON-capable ARM 32-bit +and 64-bit platforms. + + For 32-bit code, this speeds up the compression of full-color JPEGs by +about 30% on average on a typical iOS device (iPhone 4S, Cortex-A9) and by +about 6-7% on average on a typical Android device (Nexus 5X, Cortex-A53 and +Cortex-A57), relative to libjpeg-turbo 1.4.x. Note that the larger speedup +under iOS is due to the fact that iOS builds use LLVM, which does not optimize +the C Huffman encoder as well as GCC does. + + For 64-bit code, NEON-accelerated Huffman encoding speeds up the +compression of full-color JPEGs by about 40% on average on a typical iOS device +(iPhone 5S, Apple A7) and by about 7-8% on average on a typical Android device +(Nexus 5X, Cortex-A53 and Cortex-A57), in addition to the speedup described in +[13] above. + + For the purposes of benchmarking or regression testing, SIMD-accelerated +Huffman encoding can be disabled by setting the `JSIMD_NOHUFFENC` environment +variable to `1`. + +15. pkg-config (.pc) scripts are now included for both the libjpeg and +TurboJPEG API libraries on Un*x systems. Note that if a project's build system +relies on these scripts, then it will not be possible to build that project +with libjpeg or with a prior version of libjpeg-turbo. + +16. Optimized the ARM 64-bit (ARMv8) NEON SIMD decompression routines to +improve performance on CPUs with in-order pipelines. This speeds up the +decompression of full-color JPEGs by nearly 2x on average on a Cavium ThunderX +processor and by about 15% on average on a Cortex-A53 core. + +17. Fixed an issue in the accelerated Huffman decoder that could have caused +the decoder to read past the end of the input buffer when a malformed, +specially-crafted JPEG image was being decompressed. In prior versions of +libjpeg-turbo, the accelerated Huffman decoder was invoked (in most cases) only +if there were > 128 bytes of data in the input buffer. However, it is possible +to construct a JPEG image in which a single Huffman block is over 430 bytes +long, so this version of libjpeg-turbo activates the accelerated Huffman +decoder only if there are > 512 bytes of data in the input buffer. + +18. Fixed a memory leak in tjunittest encountered when running the program +with the `-yuv` option. + + +1.4.2 +===== + +### Significant changes relative to 1.4.1: + +1. Fixed an issue whereby cjpeg would segfault if a Windows bitmap with a +negative width or height was used as an input image (Windows bitmaps can have +a negative height if they are stored in top-down order, but such files are +rare and not supported by libjpeg-turbo.) + +2. Fixed an issue whereby, under certain circumstances, libjpeg-turbo would +incorrectly encode certain JPEG images when quality=100 and the fast integer +forward DCT were used. This was known to cause `make test` to fail when the +library was built with `-march=haswell` on x86 systems. + +3. Fixed an issue whereby libjpeg-turbo would crash when built with the latest +& greatest development version of the Clang/LLVM compiler. This was caused by +an x86-64 ABI conformance issue in some of libjpeg-turbo's 64-bit SSE2 SIMD +routines. Those routines were incorrectly using a 64-bit `mov` instruction to +transfer a 32-bit JDIMENSION argument, whereas the x86-64 ABI allows the upper +(unused) 32 bits of a 32-bit argument's register to be undefined. The new +Clang/LLVM optimizer uses load combining to transfer multiple adjacent 32-bit +structure members into a single 64-bit register, and this exposed the ABI +conformance issue. + +4. Fixed a bug in the MIPS DSPr2 4:2:0 "plain" (non-fancy and non-merged) +upsampling routine that caused a buffer overflow (and subsequent segfault) when +decompressing a 4:2:0 JPEG image whose scaled output width was less than 16 +pixels. The "plain" upsampling routines are normally only used when +decompressing a non-YCbCr JPEG image, but they are also used when decompressing +a JPEG image whose scaled output height is 1. + +5. Fixed various negative left shifts and other issues reported by the GCC and +Clang undefined behavior sanitizers. None of these was known to pose a +security threat, but removing the warnings makes it easier to detect actual +security issues, should they arise in the future. + + +1.4.1 +===== + +### Significant changes relative to 1.4.0: + +1. tjbench now properly handles CMYK/YCCK JPEG files. Passing an argument of +`-cmyk` (instead of, for instance, `-rgb`) will cause tjbench to internally +convert the source bitmap to CMYK prior to compression, to generate YCCK JPEG +files, and to internally convert the decompressed CMYK pixels back to RGB after +decompression (the latter is done automatically if a CMYK or YCCK JPEG is +passed to tjbench as a source image.) The CMYK<->RGB conversion operation is +not benchmarked. NOTE: The quick & dirty CMYK<->RGB conversions that tjbench +uses are suitable for testing only. Proper conversion between CMYK and RGB +requires a color management system. + +2. `make test` now performs additional bitwise regression tests using tjbench, +mainly for the purpose of testing compression from/decompression to a subregion +of a larger image buffer. + +3. `make test` no longer tests the regression of the floating point DCT/IDCT +by default, since the results of those tests can vary if the algorithms in +question are not implemented using SIMD instructions on a particular platform. +See the comments in [Makefile.am](Makefile.am) for information on how to +re-enable the tests and to specify an expected result for them based on the +particulars of your platform. + +4. The NULL color conversion routines have been significantly optimized, +which speeds up the compression of RGB and CMYK JPEGs by 5-20% when using +64-bit code and 0-3% when using 32-bit code, and the decompression of those +images by 10-30% when using 64-bit code and 3-12% when using 32-bit code. + +5. Fixed an "illegal instruction" error that occurred when djpeg from a +SIMD-enabled libjpeg-turbo MIPS build was executed with the `-nosmooth` option +on a MIPS machine that lacked DSPr2 support. The MIPS SIMD routines for h2v1 +and h2v2 merged upsampling were not properly checking for the existence of +DSPr2. + +6. Performance has been improved significantly on 64-bit non-Linux and +non-Windows platforms (generally 10-20% faster compression and 5-10% faster +decompression.) Due to an oversight, the 64-bit version of the accelerated +Huffman codec was not being compiled in when libjpeg-turbo was built on +platforms other than Windows or Linux. Oops. + +7. Fixed an extremely rare bug in the Huffman encoder that caused 64-bit +builds of libjpeg-turbo to incorrectly encode a few specific test images when +quality=98, an optimized Huffman table, and the slow integer forward DCT were +used. + +8. The Windows (CMake) build system now supports building only static or only +shared libraries. This is accomplished by adding either `-DENABLE_STATIC=0` or +`-DENABLE_SHARED=0` to the CMake command line. + +9. TurboJPEG API functions will now return an error code if a warning is +triggered in the underlying libjpeg API. For instance, if a JPEG file is +corrupt, the TurboJPEG decompression functions will attempt to decompress +as much of the image as possible, but those functions will now return -1 to +indicate that the decompression was not entirely successful. + +10. Fixed a bug in the MIPS DSPr2 4:2:2 fancy upsampling routine that caused a +buffer overflow (and subsequent segfault) when decompressing a 4:2:2 JPEG image +in which the right-most MCU was 5 or 6 pixels wide. + + +1.4.0 +===== + +### Significant changes relative to 1.4 beta1: + +1. Fixed a build issue on OS X PowerPC platforms (md5cmp failed to build +because OS X does not provide the `le32toh()` and `htole32()` functions.) + +2. The non-SIMD RGB565 color conversion code did not work correctly on big +endian machines. This has been fixed. + +3. Fixed an issue in `tjPlaneSizeYUV()` whereby it would erroneously return 1 +instead of -1 if `componentID` was > 0 and `subsamp` was `TJSAMP_GRAY`. + +3. Fixed an issue in `tjBufSizeYUV2()` whereby it would erroneously return 0 +instead of -1 if `width` was < 1. + +5. The Huffman encoder now uses `clz` and `bsr` instructions for bit counting +on ARM64 platforms (see 1.4 beta1[5].) + +6. The `close()` method in the TJCompressor and TJDecompressor Java classes is +now idempotent. Previously, that method would call the native `tjDestroy()` +function even if the TurboJPEG instance had already been destroyed. This +caused an exception to be thrown during finalization, if the `close()` method +had already been called. The exception was caught, but it was still an +expensive operation. + +7. The TurboJPEG API previously generated an error (`Could not determine +subsampling type for JPEG image`) when attempting to decompress grayscale JPEG +images that were compressed with a sampling factor other than 1 (for instance, +with `cjpeg -grayscale -sample 2x2`). Subsampling technically has no meaning +with grayscale JPEGs, and thus the horizontal and vertical sampling factors +for such images are ignored by the decompressor. However, the TurboJPEG API +was being too rigid and was expecting the sampling factors to be equal to 1 +before it treated the image as a grayscale JPEG. + +8. cjpeg, djpeg, and jpegtran now accept an argument of `-version`, which will +print the library version and exit. + +9. Referring to 1.4 beta1[15], another extremely rare circumstance was +discovered under which the Huffman encoder's local buffer can be overrun +when a buffered destination manager is being used and an +extremely-high-frequency block (basically junk image data) is being encoded. +Even though the Huffman local buffer was increased from 128 bytes to 136 bytes +to address the previous issue, the new issue caused even the larger buffer to +be overrun. Further analysis reveals that, in the absolute worst case (such as +setting alternating AC coefficients to 32767 and -32768 in the JPEG scanning +order), the Huffman encoder can produce encoded blocks that approach double the +size of the unencoded blocks. Thus, the Huffman local buffer was increased to +256 bytes, which should prevent any such issue from re-occurring in the future. + +10. The new `tjPlaneSizeYUV()`, `tjPlaneWidth()`, and `tjPlaneHeight()` +functions were not actually usable on any platform except OS X and Windows, +because those functions were not included in the libturbojpeg mapfile. This +has been fixed. + +11. Restored the `JPP()`, `JMETHOD()`, and `FAR` macros in the libjpeg-turbo +header files. The `JPP()` and `JMETHOD()` macros were originally implemented +in libjpeg as a way of supporting non-ANSI compilers that lacked support for +prototype parameters. libjpeg-turbo has never supported such compilers, but +some software packages still use the macros to define their own prototypes. +Similarly, libjpeg-turbo has never supported MS-DOS and other platforms that +have far symbols, but some software packages still use the `FAR` macro. A +pretty good argument can be made that this is a bad practice on the part of the +software in question, but since this affects more than one package, it's just +easier to fix it here. + +12. Fixed issues that were preventing the ARM 64-bit SIMD code from compiling +for iOS, and included an ARMv8 architecture in all of the binaries installed by +the "official" libjpeg-turbo SDK for OS X. + + +1.3.90 (1.4 beta1) +================== + +### Significant changes relative to 1.3.1: + +1. New features in the TurboJPEG API: + + - YUV planar images can now be generated with an arbitrary line padding +(previously only 4-byte padding, which was compatible with X Video, was +supported.) + - The decompress-to-YUV function has been extended to support image +scaling. + - JPEG images can now be compressed from YUV planar source images. + - YUV planar images can now be decoded into RGB or grayscale images. + - 4:1:1 subsampling is now supported. This is mainly included for +compatibility, since 4:1:1 is not fully accelerated in libjpeg-turbo and has no +significant advantages relative to 4:2:0. + - CMYK images are now supported. This feature allows CMYK source images +to be compressed to YCCK JPEGs and YCCK or CMYK JPEGs to be decompressed to +CMYK destination images. Conversion between CMYK/YCCK and RGB or YUV images is +not supported. Such conversion requires a color management system and is thus +out of scope for a codec library. + - The handling of YUV images in the Java API has been significantly +refactored and should now be much more intuitive. + - The Java API now supports encoding a YUV image from an arbitrary +position in a large image buffer. + - All of the YUV functions now have a corresponding function that operates +on separate image planes instead of a unified image buffer. This allows for +compressing/decoding from or decompressing/encoding to a subregion of a larger +YUV image. It also allows for handling YUV formats that swap the order of the +U and V planes. + +2. Added SIMD acceleration for DSPr2-capable MIPS platforms. This speeds up +the compression of full-color JPEGs by 70-80% on such platforms and +decompression by 25-35%. + +3. If an application attempts to decompress a Huffman-coded JPEG image whose +header does not contain Huffman tables, libjpeg-turbo will now insert the +default Huffman tables. In order to save space, many motion JPEG video frames +are encoded without the default Huffman tables, so these frames can now be +successfully decompressed by libjpeg-turbo without additional work on the part +of the application. An application can still override the Huffman tables, for +instance to re-use tables from a previous frame of the same video. + +4. The Mac packaging system now uses pkgbuild and productbuild rather than +PackageMaker (which is obsolete and no longer supported.) This means that +OS X 10.6 "Snow Leopard" or later must be used when packaging libjpeg-turbo, +although the packages produced can be installed on OS X 10.5 "Leopard" or +later. OS X 10.4 "Tiger" is no longer supported. + +5. The Huffman encoder now uses `clz` and `bsr` instructions for bit counting +on ARM platforms rather than a lookup table. This reduces the memory footprint +by 64k, which may be important for some mobile applications. Out of four +Android devices that were tested, two demonstrated a small overall performance +loss (~3-4% on average) with ARMv6 code and a small gain (also ~3-4%) with +ARMv7 code when enabling this new feature, but the other two devices +demonstrated a significant overall performance gain with both ARMv6 and ARMv7 +code (~10-20%) when enabling the feature. Actual mileage may vary. + +6. Worked around an issue with Visual C++ 2010 and later that caused incorrect +pixels to be generated when decompressing a JPEG image to a 256-color bitmap, +if compiler optimization was enabled when libjpeg-turbo was built. This caused +the regression tests to fail when doing a release build under Visual C++ 2010 +and later. + +7. Improved the accuracy and performance of the non-SIMD implementation of the +floating point inverse DCT (using code borrowed from libjpeg v8a and later.) +The accuracy of this implementation now matches the accuracy of the SSE/SSE2 +implementation. Note, however, that the floating point DCT/IDCT algorithms are +mainly a legacy feature. They generally do not produce significantly better +accuracy than the slow integer DCT/IDCT algorithms, and they are quite a bit +slower. + +8. Added a new output colorspace (`JCS_RGB565`) to the libjpeg API that allows +for decompressing JPEG images into RGB565 (16-bit) pixels. If dithering is not +used, then this code path is SIMD-accelerated on ARM platforms. + +9. Numerous obsolete features, such as support for non-ANSI compilers and +support for the MS-DOS memory model, were removed from the libjpeg code, +greatly improving its readability and making it easier to maintain and extend. + +10. Fixed a segfault that occurred when calling `output_message()` with +`msg_code` set to `JMSG_COPYRIGHT`. + +11. Fixed an issue whereby wrjpgcom was allowing comments longer than 65k +characters to be passed on the command line, which was causing it to generate +incorrect JPEG files. + +12. Fixed a bug in the build system that was causing the Windows version of +wrjpgcom to be built using the rdjpgcom source code. + +13. Restored 12-bit-per-component JPEG support. A 12-bit version of +libjpeg-turbo can now be built by passing an argument of `--with-12bit` to +configure (Unix) or `-DWITH_12BIT=1` to cmake (Windows.) 12-bit JPEG support +is included only for convenience. Enabling this feature disables all of the +performance features in libjpeg-turbo, as well as arithmetic coding and the +TurboJPEG API. The resulting library still contains the other libjpeg-turbo +features (such as the colorspace extensions), but in general, it performs no +faster than libjpeg v6b. + +14. Added ARM 64-bit SIMD acceleration for the YCC-to-RGB color conversion +and IDCT algorithms (both are used during JPEG decompression.) For unknown +reasons (probably related to clang), this code cannot currently be compiled for +iOS. + +15. Fixed an extremely rare bug that could cause the Huffman encoder's local +buffer to overrun when a very high-frequency MCU is compressed using quality +100 and no subsampling, and when the JPEG output buffer is being dynamically +resized by the destination manager. This issue was so rare that, even with a +test program specifically designed to make the bug occur (by injecting random +high-frequency YUV data into the compressor), it was reproducible only once in +about every 25 million iterations. + +16. Fixed an oversight in the TurboJPEG C wrapper: if any of the JPEG +compression functions was called repeatedly with the same +automatically-allocated destination buffer, then TurboJPEG would erroneously +assume that the `jpegSize` parameter was equal to the size of the buffer, when +in fact that parameter was probably equal to the size of the most recently +compressed JPEG image. If the size of the previous JPEG image was not as large +as the current JPEG image, then TurboJPEG would unnecessarily reallocate the +destination buffer. + + +1.3.1 +===== + +### Significant changes relative to 1.3.0: + +1. On Un*x systems, `make install` now installs the libjpeg-turbo libraries +into /opt/libjpeg-turbo/lib32 by default on any 32-bit system, not just x86, +and into /opt/libjpeg-turbo/lib64 by default on any 64-bit system, not just +x86-64. You can override this by overriding either the `prefix` or `libdir` +configure variables. + +2. The Windows installer now places a copy of the TurboJPEG DLLs in the same +directory as the rest of the libjpeg-turbo binaries. This was mainly done +to support TurboVNC 1.3, which bundles the DLLs in its Windows installation. +When using a 32-bit version of CMake on 64-bit Windows, it is impossible to +access the c:\WINDOWS\system32 directory, which made it impossible for the +TurboVNC build scripts to bundle the 64-bit TurboJPEG DLL. + +3. Fixed a bug whereby attempting to encode a progressive JPEG with arithmetic +entropy coding (by passing arguments of `-progressive -arithmetic` to cjpeg or +jpegtran, for instance) would result in an error, `Requested feature was +omitted at compile time`. + +4. Fixed a couple of issues whereby malformed JPEG images would cause +libjpeg-turbo to use uninitialized memory during decompression. + +5. Fixed an error (`Buffer passed to JPEG library is too small`) that occurred +when calling the TurboJPEG YUV encoding function with a very small (< 5x5) +source image, and added a unit test to check for this error. + +6. The Java classes should now build properly under Visual Studio 2010 and +later. + +7. Fixed an issue that prevented SRPMs generated using the in-tree packaging +tools from being rebuilt on certain newer Linux distributions. + +8. Numerous minor fixes to eliminate compilation and build/packaging system +warnings, fix cosmetic issues, improve documentation clarity, and other general +source cleanup. + + +1.3.0 +===== + +### Significant changes relative to 1.3 beta1: + +1. `make test` now works properly on FreeBSD, and it no longer requires the +md5sum executable to be present on other Un*x platforms. + +2. Overhauled the packaging system: + + - To avoid conflict with vendor-supplied libjpeg-turbo packages, the +official RPMs and DEBs for libjpeg-turbo have been renamed to +"libjpeg-turbo-official". + - The TurboJPEG libraries are now located under /opt/libjpeg-turbo in the +official Linux and Mac packages, to avoid conflict with vendor-supplied +packages and also to streamline the packaging system. + - Release packages are now created with the directory structure defined +by the configure variables `prefix`, `bindir`, `libdir`, etc. (Un\*x) or by the +`CMAKE_INSTALL_PREFIX` variable (Windows.) The exception is that the docs are +always located under the system default documentation directory on Un\*x and +Mac systems, and on Windows, the TurboJPEG DLL is always located in the Windows +system directory. + - To avoid confusion, official libjpeg-turbo packages on Linux/Unix +platforms (except for Mac) will always install the 32-bit libraries in +/opt/libjpeg-turbo/lib32 and the 64-bit libraries in /opt/libjpeg-turbo/lib64. + - Fixed an issue whereby, in some cases, the libjpeg-turbo executables on +Un*x systems were not properly linking with the shared libraries installed by +the same package. + - Fixed an issue whereby building the "installer" target on Windows when +`WITH_JAVA=1` would fail if the TurboJPEG JAR had not been previously built. + - Building the "install" target on Windows now installs files into the +same places that the installer does. + +3. Fixed a Huffman encoder bug that prevented I/O suspension from working +properly. + + +1.2.90 (1.3 beta1) +================== + +### Significant changes relative to 1.2.1: + +1. Added support for additional scaling factors (3/8, 5/8, 3/4, 7/8, 9/8, 5/4, +11/8, 3/2, 13/8, 7/4, 15/8, and 2) when decompressing. Note that the IDCT will +not be SIMD-accelerated when using any of these new scaling factors. + +2. The TurboJPEG dynamic library is now versioned. It was not strictly +necessary to do so, because TurboJPEG uses versioned symbols, and if a function +changes in an ABI-incompatible way, that function is renamed and a legacy +function is provided to maintain backward compatibility. However, certain +Linux distro maintainers have a policy against accepting any library that isn't +versioned. + +3. Extended the TurboJPEG Java API so that it can be used to compress a JPEG +image from and decompress a JPEG image to an arbitrary position in a large +image buffer. + +4. The `tjDecompressToYUV()` function now supports the `TJFLAG_FASTDCT` flag. + +5. The 32-bit supplementary package for amd64 Debian systems now provides +symlinks in /usr/lib/i386-linux-gnu for the TurboJPEG libraries in /usr/lib32. +This allows those libraries to be used on MultiArch-compatible systems (such as +Ubuntu 11 and later) without setting the linker path. + +6. The TurboJPEG Java wrapper should now find the JNI library on Mac systems +without having to pass `-Djava.library.path=/usr/lib` to java. + +7. TJBench has been ported to Java to provide a convenient way of validating +the performance of the TurboJPEG Java API. It can be run with +`java -cp turbojpeg.jar TJBench`. + +8. cjpeg can now be used to generate JPEG files with the RGB colorspace +(feature ported from jpeg-8d.) + +9. The width and height in the `-crop` argument passed to jpegtran can now be +suffixed with `f` to indicate that, when the upper left corner of the cropping +region is automatically moved to the nearest iMCU boundary, the bottom right +corner should be moved by the same amount. In other words, this feature causes +jpegtran to strictly honor the specified width/height rather than the specified +bottom right corner (feature ported from jpeg-8d.) + +10. JPEG files using the RGB colorspace can now be decompressed into grayscale +images (feature ported from jpeg-8d.) + +11. Fixed a regression caused by 1.2.1[7] whereby the build would fail with +multiple "Mismatch in operand sizes" errors when attempting to build the x86 +SIMD code with NASM 0.98. + +12. The in-memory source/destination managers (`jpeg_mem_src()` and +`jpeg_mem_dest()`) are now included by default when building libjpeg-turbo with +libjpeg v6b or v7 emulation, so that programs can take advantage of these +functions without requiring the use of the backward-incompatible libjpeg v8 +ABI. The "age number" of the libjpeg-turbo library on Un*x systems has been +incremented by 1 to reflect this. You can disable this feature with a +configure/CMake switch in order to retain strict API/ABI compatibility with the +libjpeg v6b or v7 API/ABI (or with previous versions of libjpeg-turbo.) See +[README.md](README.md) for more details. + +13. Added ARMv7s architecture to libjpeg.a and libturbojpeg.a in the official +libjpeg-turbo binary package for OS X, so that those libraries can be used to +build applications that leverage the faster CPUs in the iPhone 5 and iPad 4. + + +1.2.1 +===== + +### Significant changes relative to 1.2.0: + +1. Creating or decoding a JPEG file that uses the RGB colorspace should now +properly work when the input or output colorspace is one of the libjpeg-turbo +colorspace extensions. + +2. When libjpeg-turbo was built without SIMD support and merged (non-fancy) +upsampling was used along with an alpha-enabled colorspace during +decompression, the unused byte of the decompressed pixels was not being set to +0xFF. This has been fixed. TJUnitTest has also been extended to test for the +correct behavior of the colorspace extensions when merged upsampling is used. + +3. Fixed a bug whereby the libjpeg-turbo SSE2 SIMD code would not preserve the +upper 64 bits of xmm6 and xmm7 on Win64 platforms, which violated the Win64 +calling conventions. + +4. Fixed a regression caused by 1.2.0[6] whereby decompressing corrupt JPEG +images (specifically, images in which the component count was erroneously set +to a large value) would cause libjpeg-turbo to segfault. + +5. Worked around a severe performance issue with "Bobcat" (AMD Embedded APU) +processors. The `MASKMOVDQU` instruction, which was used by the libjpeg-turbo +SSE2 SIMD code, is apparently implemented in microcode on AMD processors, and +it is painfully slow on Bobcat processors in particular. Eliminating the use +of this instruction improved performance by an order of magnitude on Bobcat +processors and by a small amount (typically 5%) on AMD desktop processors. + +6. Added SIMD acceleration for performing 4:2:2 upsampling on NEON-capable ARM +platforms. This speeds up the decompression of 4:2:2 JPEGs by 20-25% on such +platforms. + +7. Fixed a regression caused by 1.2.0[2] whereby, on Linux/x86 platforms +running the 32-bit SSE2 SIMD code in libjpeg-turbo, decompressing a 4:2:0 or +4:2:2 JPEG image into a 32-bit (RGBX, BGRX, etc.) buffer without using fancy +upsampling would produce several incorrect columns of pixels at the right-hand +side of the output image if each row in the output image was not evenly +divisible by 16 bytes. + +8. Fixed an issue whereby attempting to build the SIMD extensions with Xcode +4.3 on OS X platforms would cause NASM to return numerous errors of the form +"'%define' expects a macro identifier". + +9. Added flags to the TurboJPEG API that allow the caller to force the use of +either the fast or the accurate DCT/IDCT algorithms in the underlying codec. + + +1.2.0 +===== + +### Significant changes relative to 1.2 beta1: + +1. Fixed build issue with YASM on Unix systems (the libjpeg-turbo build system +was not adding the current directory to the assembler include path, so YASM +was not able to find jsimdcfg.inc.) + +2. Fixed out-of-bounds read in SSE2 SIMD code that occurred when decompressing +a JPEG image to a bitmap buffer whose size was not a multiple of 16 bytes. +This was more of an annoyance than an actual bug, since it did not cause any +actual run-time problems, but the issue showed up when running libjpeg-turbo in +valgrind. See for more information. + +3. Added a compile-time macro (`LIBJPEG_TURBO_VERSION`) that can be used to +check the version of libjpeg-turbo against which an application was compiled. + +4. Added new RGBA/BGRA/ABGR/ARGB colorspace extension constants (libjpeg API) +and pixel formats (TurboJPEG API), which allow applications to specify that, +when decompressing to a 4-component RGB buffer, the unused byte should be set +to 0xFF so that it can be interpreted as an opaque alpha channel. + +5. Fixed regression issue whereby DevIL failed to build against libjpeg-turbo +because libjpeg-turbo's distributed version of jconfig.h contained an `INLINE` +macro, which conflicted with a similar macro in DevIL. This macro is used only +internally when building libjpeg-turbo, so it was moved into config.h. + +6. libjpeg-turbo will now correctly decompress erroneous CMYK/YCCK JPEGs whose +K component is assigned a component ID of 1 instead of 4. Although these files +are in violation of the spec, other JPEG implementations handle them +correctly. + +7. Added ARMv6 and ARMv7 architectures to libjpeg.a and libturbojpeg.a in +the official libjpeg-turbo binary package for OS X, so that those libraries can +be used to build both OS X and iOS applications. + + +1.1.90 (1.2 beta1) +================== + +### Significant changes relative to 1.1.1: + +1. Added a Java wrapper for the TurboJPEG API. See [java/README](java/README) +for more details. + +2. The TurboJPEG API can now be used to scale down images during +decompression. + +3. Added SIMD routines for RGB-to-grayscale color conversion, which +significantly improves the performance of grayscale JPEG compression from an +RGB source image. + +4. Improved the performance of the C color conversion routines, which are used +on platforms for which SIMD acceleration is not available. + +5. Added a function to the TurboJPEG API that performs lossless transforms. +This function is implemented using the same back end as jpegtran, but it +performs transcoding entirely in memory and allows multiple transforms and/or +crop operations to be batched together, so the source coefficients only need to +be read once. This is useful when generating image tiles from a single source +JPEG. + +6. Added tests for the new TurboJPEG scaled decompression and lossless +transform features to tjbench (the TurboJPEG benchmark, formerly called +"jpgtest".) + +7. Added support for 4:4:0 (transposed 4:2:2) subsampling in TurboJPEG, which +was necessary in order for it to read 4:2:2 JPEG files that had been losslessly +transposed or rotated 90 degrees. + +8. All legacy VirtualGL code has been re-factored, and this has allowed +libjpeg-turbo, in its entirety, to be re-licensed under a BSD-style license. + +9. libjpeg-turbo can now be built with YASM. + +10. Added SIMD acceleration for ARM Linux and iOS platforms that support +NEON instructions. + +11. Refactored the TurboJPEG C API and documented it using Doxygen. The +TurboJPEG 1.2 API uses pixel formats to define the size and component order of +the uncompressed source/destination images, and it includes a more efficient +version of `TJBUFSIZE()` that computes a worst-case JPEG size based on the +level of chrominance subsampling. The refactored implementation of the +TurboJPEG API now uses the libjpeg memory source and destination managers, +which allows the TurboJPEG compressor to grow the JPEG buffer as necessary. + +12. Eliminated errors in the output of jpegtran on Windows that occurred when +the application was invoked using I/O redirection +(`jpegtran output.jpg`.) + +13. The inclusion of libjpeg v7 and v8 emulation as well as arithmetic coding +support in libjpeg-turbo v1.1.0 introduced several new error constants in +jerror.h, and these were mistakenly enabled for all emulation modes, causing +the error enum in libjpeg-turbo to sometimes have different values than the +same enum in libjpeg. This represents an ABI incompatibility, and it caused +problems with rare applications that took specific action based on a particular +error value. The fix was to include the new error constants conditionally +based on whether libjpeg v7 or v8 emulation was enabled. + +14. Fixed an issue whereby Windows applications that used libjpeg-turbo would +fail to compile if the Windows system headers were included before jpeglib.h. +This issue was caused by a conflict in the definition of the INT32 type. + +15. Fixed 32-bit supplementary package for amd64 Debian systems, which was +broken by enhancements to the packaging system in 1.1. + +16. When decompressing a JPEG image using an output colorspace of +`JCS_EXT_RGBX`, `JCS_EXT_BGRX`, `JCS_EXT_XBGR`, or `JCS_EXT_XRGB`, +libjpeg-turbo will now set the unused byte to 0xFF, which allows applications +to interpret that byte as an alpha channel (0xFF = opaque). + + +1.1.1 +===== + +### Significant changes relative to 1.1.0: + +1. Fixed a 1-pixel error in row 0, column 21 of the luminance plane generated +by `tjEncodeYUV()`. + +2. libjpeg-turbo's accelerated Huffman decoder previously ignored unexpected +markers found in the middle of the JPEG data stream during decompression. It +will now hand off decoding of a particular block to the unaccelerated Huffman +decoder if an unexpected marker is found, so that the unaccelerated Huffman +decoder can generate an appropriate warning. + +3. Older versions of MinGW64 prefixed symbol names with underscores by +default, which differed from the behavior of 64-bit Visual C++. MinGW64 1.0 +has adopted the behavior of 64-bit Visual C++ as the default, so to accommodate +this, the libjpeg-turbo SIMD function names are no longer prefixed with an +underscore when building with MinGW64. This means that, when building +libjpeg-turbo with older versions of MinGW64, you will now have to add +`-fno-leading-underscore` to the `CFLAGS`. + +4. Fixed a regression bug in the NSIS script that caused the Windows installer +build to fail when using the Visual Studio IDE. + +5. Fixed a bug in `jpeg_read_coefficients()` whereby it would not initialize +`cinfo->image_width` and `cinfo->image_height` if libjpeg v7 or v8 emulation +was enabled. This specifically caused the jpegoptim program to fail if it was +linked against a version of libjpeg-turbo that was built with libjpeg v7 or v8 +emulation. + +6. Eliminated excessive I/O overhead that occurred when reading BMP files in +cjpeg. + +7. Eliminated errors in the output of cjpeg on Windows that occurred when the +application was invoked using I/O redirection (`cjpeg output.jpg`.) + + +1.1.0 +===== + +### Significant changes relative to 1.1 beta1: + +1. The algorithm used by the SIMD quantization function cannot produce correct +results when the JPEG quality is >= 98 and the fast integer forward DCT is +used. Thus, the non-SIMD quantization function is now used for those cases, +and libjpeg-turbo should now produce identical output to libjpeg v6b in all +cases. + +2. Despite the above, the fast integer forward DCT still degrades somewhat for +JPEG qualities greater than 95, so the TurboJPEG wrapper will now automatically +use the slow integer forward DCT when generating JPEG images of quality 96 or +greater. This reduces compression performance by as much as 15% for these +high-quality images but is necessary to ensure that the images are perceptually +lossless. It also ensures that the library can avoid the performance pitfall +created by [1]. + +3. Ported jpgtest.cxx to pure C to avoid the need for a C++ compiler. + +4. Fixed visual artifacts in grayscale JPEG compression caused by a typo in +the RGB-to-luminance lookup tables. + +5. The Windows distribution packages now include the libjpeg run-time programs +(cjpeg, etc.) + +6. All packages now include jpgtest. + +7. The TurboJPEG dynamic library now uses versioned symbols. + +8. Added two new TurboJPEG API functions, `tjEncodeYUV()` and +`tjDecompressToYUV()`, to replace the somewhat hackish `TJ_YUV` flag. + + +1.0.90 (1.1 beta1) +================== + +### Significant changes relative to 1.0.1: + +1. Added emulation of the libjpeg v7 and v8 APIs and ABIs. See +[README.md](README.md) for more details. This feature was sponsored by +CamTrace SAS. + +2. Created a new CMake-based build system for the Visual C++ and MinGW builds. + +3. Grayscale bitmaps can now be compressed from/decompressed to using the +TurboJPEG API. + +4. jpgtest can now be used to test decompression performance with existing +JPEG images. + +5. If the default install prefix (/opt/libjpeg-turbo) is used, then +`make install` now creates /opt/libjpeg-turbo/lib32 and +/opt/libjpeg-turbo/lib64 sym links to duplicate the behavior of the binary +packages. + +6. All symbols in the libjpeg-turbo dynamic library are now versioned, even +when the library is built with libjpeg v6b emulation. + +7. Added arithmetic encoding and decoding support (can be disabled with +configure or CMake options) + +8. Added a `TJ_YUV` flag to the TurboJPEG API, which causes both the compressor +and decompressor to output planar YUV images. + +9. Added an extended version of `tjDecompressHeader()` to the TurboJPEG API, +which allows the caller to determine the type of subsampling used in a JPEG +image. + +10. Added further protections against invalid Huffman codes. + + +1.0.1 +===== + +### Significant changes relative to 1.0.0: + +1. The Huffman decoder will now handle erroneous Huffman codes (for instance, +from a corrupt JPEG image.) Previously, these would cause libjpeg-turbo to +crash under certain circumstances. + +2. Fixed typo in SIMD dispatch routines that was causing 4:2:2 upsampling to +be used instead of 4:2:0 when decompressing JPEG images using SSE2 code. + +3. The configure script will now automatically determine whether the +`INCOMPLETE_TYPES_BROKEN` macro should be defined. + + +1.0.0 +===== + +### Significant changes relative to 0.0.93: + +1. 2983700: Further FreeBSD build tweaks (no longer necessary to specify +`--host` when configuring on a 64-bit system) + +2. Created symlinks in the Unix/Linux packages so that the TurboJPEG +include file can always be found in /opt/libjpeg-turbo/include, the 32-bit +static libraries can always be found in /opt/libjpeg-turbo/lib32, and the +64-bit static libraries can always be found in /opt/libjpeg-turbo/lib64. + +3. The Unix/Linux distribution packages now include the libjpeg run-time +programs (cjpeg, etc.) and man pages. + +4. Created a 32-bit supplementary package for amd64 Debian systems, which +contains just the 32-bit libjpeg-turbo libraries. + +5. Moved the libraries from */lib32 to */lib in the i386 Debian package. + +6. Include distribution package for Cygwin + +7. No longer necessary to specify `--without-simd` on non-x86 architectures, +and unit tests now work on those architectures. + + +0.0.93 +====== + +### Significant changes since 0.0.91: + +1. 2982659: Fixed x86-64 build on FreeBSD systems + +2. 2988188: Added support for Windows 64-bit systems + + +0.0.91 +====== + +### Significant changes relative to 0.0.90: + +1. Added documentation to .deb packages + +2. 2968313: Fixed data corruption issues when decompressing large JPEG images +and/or using buffered I/O with the libjpeg-turbo decompressor + + +0.0.90 +====== + +Initial release diff --git a/ChangeLog.txt b/ChangeLog.txt deleted file mode 100644 index 68261e8a..00000000 --- a/ChangeLog.txt +++ /dev/null @@ -1,791 +0,0 @@ -1.4.3 -===== - -[1] Fixed a regression caused by 1.4.1[6] that prevented 32-bit and 64-bit -libjpeg-turbo RPMs from being installed simultaneously on recent Red Hat/Fedora -distributions. This was due to the addition of a macro in jconfig.h that -allows the Huffman codec to determine the word size at compile time. Since -that macro differs between 32-bit and 64-bit builds, this caused a conflict -between the i386 and x86_64 RPMs (any differing files, other than executables, -are not allowed when 32-bit and 64-bit RPMs are installed simultaneously.) -Since the macro is used only internally, it has been moved into jconfigint.h. - -[2] Fixed an issue in the accelerated Huffman decoder that could have caused -the decoder to read past the end of the input buffer when a malformed, -specially-crafted JPEG image was being decompressed. In prior versions of -libjpeg-turbo, the accelerated Huffman decoder was invoked (in most cases) only -if there were > 128 bytes of data in the input buffer. However, it is possible -to construct a JPEG image in which a single Huffman block is over 430 bytes -long, so this version of libjpeg-turbo activates the accelerated Huffman -decoder only if there are > 512 bytes of data in the input buffer. - -[3] Fixed a memory leak in tjunittest encountered when running the program -with the -yuv option. - -[4] Fixed an issue whereby a malformed motion-JPEG frame could cause the "fast -path" of libjpeg-turbo's Huffman decoder to read from uninitialized memory. - -[5] Added libjpeg-turbo version and build information to the global string -table of the libjpeg and TurboJPEG API libraries. This is a common practice in -other infrastructure libraries, such as OpenSSL and libpng, because it makes it -easy to examine an application binary and determine which version of the -library the application was linked against. - -[6] Fixed a couple of issues in the PPM reader that would cause buffer overruns -in cjpeg if one of the values in a binary PPM/PGM input file exceeded the -maximum value defined in the file's header. libjpeg-turbo 1.4.2 already -included a similar fix for ASCII PPM/PGM files. Note that these issues were -not security bugs, since they were confined to the cjpeg program and did not -affect any of the libjpeg-turbo libraries. - -[7] Fixed an issue whereby attempting to decompress a JPEG file with a corrupt -header using the tjDecompressToYUV2() function would cause the function to -abort without returning an error and, under certain circumstances, corrupt the -stack. This only occurred if tjDecompressToYUV2() was called prior to calling -calling tjDecompressHeader3(), or if the return value from -tjDecompressHeader3() was ignored (both cases represent incorrect usage of the -TurboJPEG API.) - - -1.4.2 -===== - -[1] Fixed an issue whereby cjpeg would segfault if a Windows bitmap with a -negative width or height was used as an input image (Windows bitmaps can have -a negative height if they are stored in top-down order, but such files are -rare and not supported by libjpeg-turbo.) - -[2] Fixed an issue whereby, under certain circumstances, libjpeg-turbo would -incorrectly encode certain JPEG images when quality=100 and the fast integer -forward DCT were used. This was known to cause 'make test' to fail when the -library was built with '-march=haswell' on x86 systems. - -[3] Fixed an issue whereby libjpeg-turbo would crash when built with the latest -& greatest development version of the Clang/LLVM compiler. This was caused by -an x86-64 ABI conformance issue in some of libjpeg-turbo's 64-bit SSE2 SIMD -routines. Those routines were incorrectly using a 64-bit mov instruction to -transfer a 32-bit JDIMENSION argument, whereas the x86-64 ABI allows the upper -(unused) 32 bits of a 32-bit argument's register to be undefined. The new -Clang/LLVM optimizer uses load combining to transfer multiple adjacent 32-bit -structure members into a single 64-bit register, and this exposed the ABI -conformance issue. - -[4] Fixed a bug in the MIPS DSPr2 4:2:0 "plain" (non-fancy and non-merged) -upsampling routine that caused a buffer overflow (and subsequent segfault) when -decompressing a 4:2:0 JPEG image whose scaled output width was less than 16 -pixels. The "plain" upsampling routines are normally only used when -decompressing a non-YCbCr JPEG image, but they are also used when decompressing -a JPEG image whose scaled output height is 1. - -[5] Fixed various negative left shifts and other issues reported by the GCC and -Clang undefined behavior sanitizers. None of these was known to pose a -security threat, but removing the warnings makes it easier to detect actual -security issues, should they arise in the future. - - -1.4.1 -===== - -[1] tjbench now properly handles CMYK/YCCK JPEG files. Passing an argument of --cmyk (instead of, for instance, -rgb) will cause tjbench to internally convert -the source bitmap to CMYK prior to compression, to generate YCCK JPEG files, -and to internally convert the decompressed CMYK pixels back to RGB after -decompression (the latter is done automatically if a CMYK or YCCK JPEG is -passed to tjbench as a source image.) The CMYK<->RGB conversion operation is -not benchmarked. NOTE: The quick & dirty CMYK<->RGB conversions that tjbench -uses are suitable for testing only. Proper conversion between CMYK and RGB -requires a color management system. - -[2] 'make test' now performs additional bitwise regression tests using tjbench, -mainly for the purpose of testing compression from/decompression to a subregion -of a larger image buffer. - -[3] 'make test' no longer tests the regression of the floating point DCT/IDCT -by default, since the results of those tests can vary if the algorithms in -question are not implemented using SIMD instructions on a particular platform. -See the comments in Makefile.am for information on how to re-enable the tests -and to specify an expected result for them based on the particulars of your -platform. - -[4] The NULL color conversion routines have been significantly optimized, -which speeds up the compression of RGB and CMYK JPEGs by 5-20% when using -64-bit code and 0-3% when using 32-bit code, and the decompression of those -images by 10-30% when using 64-bit code and 3-12% when using 32-bit code. - -[5] Fixed an "illegal instruction" error that occurred when djpeg from a -SIMD-enabled libjpeg-turbo MIPS build was executed with the -nosmooth option on -a MIPS machine that lacked DSPr2 support. The MIPS SIMD routines for h2v1 and -h2v2 merged upsampling were not properly checking for the existence of DSPr2. - -[6] Performance has been improved significantly on 64-bit non-Linux and -non-Windows platforms (generally 10-20% faster compression and 5-10% faster -decompression.) Due to an oversight, the 64-bit version of the accelerated -Huffman codec was not being compiled in when libjpeg-turbo was built on -platforms other than Windows or Linux. Oops. - -[7] Fixed an extremely rare bug in the Huffman encoder that caused 64-bit -builds of libjpeg-turbo to incorrectly encode a few specific test images when -quality=98, an optimized Huffman table, and the slow integer forward DCT were -used. - -[8] The Windows (CMake) build system now supports building only static or only -shared libraries. This is accomplished by adding either -DENABLE_STATIC=0 or --DENABLE_SHARED=0 to the CMake command line. - -[9] TurboJPEG API functions will now return an error code if a warning is -triggered in the underlying libjpeg API. For instance, if a JPEG file is -corrupt, the TurboJPEG decompression functions will attempt to decompress -as much of the image as possible, but those functions will now return -1 to -indicate that the decompression was not entirely successful. - -[10] Fixed a bug in the MIPS DSPr2 4:2:2 fancy upsampling routine that caused a -buffer overflow (and subsequent segfault) when decompressing a 4:2:2 JPEG image -in which the right-most MCU was 5 or 6 pixels wide. - - -1.4.0 -===== - -[1] Fixed a build issue on OS X PowerPC platforms (md5cmp failed to build -because OS X does not provide the le32toh() and htole32() functions.) - -[2] The non-SIMD RGB565 color conversion code did not work correctly on big -endian machines. This has been fixed. - -[3] Fixed an issue in tjPlaneSizeYUV() whereby it would erroneously return 1 -instead of -1 if componentID was > 0 and subsamp was TJSAMP_GRAY. - -[3] Fixed an issue in tjBufSizeYUV2() whereby it would erroneously return 0 -instead of -1 if width was < 1. - -[5] The Huffman encoder now uses clz and bsr instructions for bit counting on -ARM64 platforms (see 1.4 beta1 [5].) - -[6] The close() method in the TJCompressor and TJDecompressor Java classes is -now idempotent. Previously, that method would call the native tjDestroy() -function even if the TurboJPEG instance had already been destroyed. This -caused an exception to be thrown during finalization, if the close() method had -already been called. The exception was caught, but it was still an expensive -operation. - -[7] The TurboJPEG API previously generated an error ("Could not determine -subsampling type for JPEG image") when attempting to decompress grayscale JPEG -images that were compressed with a sampling factor other than 1 (for instance, -with 'cjpeg -grayscale -sample 2x2'). Subsampling technically has no meaning -with grayscale JPEGs, and thus the horizontal and vertical sampling factors -for such images are ignored by the decompressor. However, the TurboJPEG API -was being too rigid and was expecting the sampling factors to be equal to 1 -before it treated the image as a grayscale JPEG. - -[8] cjpeg, djpeg, and jpegtran now accept an argument of -version, which will -print the library version and exit. - -[9] Referring to 1.4 beta1 [15], another extremely rare circumstance was -discovered under which the Huffman encoder's local buffer can be overrun -when a buffered destination manager is being used and an -extremely-high-frequency block (basically junk image data) is being encoded. -Even though the Huffman local buffer was increased from 128 bytes to 136 bytes -to address the previous issue, the new issue caused even the larger buffer to -be overrun. Further analysis reveals that, in the absolute worst case (such as -setting alternating AC coefficients to 32767 and -32768 in the JPEG scanning -order), the Huffman encoder can produce encoded blocks that approach double the -size of the unencoded blocks. Thus, the Huffman local buffer was increased to -256 bytes, which should prevent any such issue from re-occurring in the future. - -[10] The new tjPlaneSizeYUV(), tjPlaneWidth(), and tjPlaneHeight() functions -were not actually usable on any platform except OS X and Windows, because -those functions were not included in the libturbojpeg mapfile. This has been -fixed. - -[11] Restored the JPP(), JMETHOD(), and FAR macros in the libjpeg-turbo header -files. The JPP() and JMETHOD() macros were originally implemented in libjpeg -as a way of supporting non-ANSI compilers that lacked support for prototype -parameters. libjpeg-turbo has never supported such compilers, but some -software packages still use the macros to define their own prototypes. -Similarly, libjpeg-turbo has never supported MS-DOS and other platforms that -have far symbols, but some software packages still use the FAR macro. A pretty -good argument can be made that this is a bad practice on the part of the -software in question, but since this affects more than one package, it's just -easier to fix it here. - -[12] Fixed issues that were preventing the ARM 64-bit SIMD code from compiling -for iOS, and included an ARMv8 architecture in all of the binaries installed by -the "official" libjpeg-turbo SDK for OS X. - - -1.3.90 (1.4 beta1) -================== - -[1] New features in the TurboJPEG API: --- YUV planar images can now be generated with an arbitrary line padding -(previously only 4-byte padding, which was compatible with X Video, was -supported.) --- The decompress-to-YUV function has been extended to support image scaling. --- JPEG images can now be compressed from YUV planar source images. --- YUV planar images can now be decoded into RGB or grayscale images. --- 4:1:1 subsampling is now supported. This is mainly included for -compatibility, since 4:1:1 is not fully accelerated in libjpeg-turbo and has no -significant advantages relative to 4:2:0. --- CMYK images are now supported. This feature allows CMYK source images to be -compressed to YCCK JPEGs and YCCK or CMYK JPEGs to be decompressed to CMYK -destination images. Conversion between CMYK/YCCK and RGB or YUV images is not -supported. Such conversion requires a color management system and is thus out -of scope for a codec library. --- The handling of YUV images in the Java API has been significantly refactored -and should now be much more intuitive. --- The Java API now supports encoding a YUV image from an arbitrary position in -a large image buffer. --- All of the YUV functions now have a corresponding function that operates on -separate image planes instead of a unified image buffer. This allows for -compressing/decoding from or decompressing/encoding to a subregion of a larger -YUV image. It also allows for handling YUV formats that swap the order of the -U and V planes. - -[2] Added SIMD acceleration for DSPr2-capable MIPS platforms. This speeds up -the compression of full-color JPEGs by 70-80% on such platforms and -decompression by 25-35%. - -[3] If an application attempts to decompress a Huffman-coded JPEG image whose -header does not contain Huffman tables, libjpeg-turbo will now insert the -default Huffman tables. In order to save space, many motion JPEG video frames -are encoded without the default Huffman tables, so these frames can now be -successfully decompressed by libjpeg-turbo without additional work on the part -of the application. An application can still override the Huffman tables, for -instance to re-use tables from a previous frame of the same video. - -[4] The Mac packaging system now uses pkgbuild and productbuild rather than -PackageMaker (which is obsolete and no longer supported.) This means that -OS X 10.6 "Snow Leopard" or later must be used when packaging libjpeg-turbo, -although the packages produced can be installed on OS X 10.5 "Leopard" or -later. OS X 10.4 "Tiger" is no longer supported. - -[5] The Huffman encoder now uses clz and bsr instructions for bit counting on -ARM platforms rather than a lookup table. This reduces the memory footprint -by 64k, which may be important for some mobile applications. Out of four -Android devices that were tested, two demonstrated a small overall performance -loss (~3-4% on average) with ARMv6 code and a small gain (also ~3-4%) with -ARMv7 code when enabling this new feature, but the other two devices -demonstrated a significant overall performance gain with both ARMv6 and ARMv7 -code (~10-20%) when enabling the feature. Actual mileage may vary. - -[6] Worked around an issue with Visual C++ 2010 and later that caused incorrect -pixels to be generated when decompressing a JPEG image to a 256-color bitmap, -if compiler optimization was enabled when libjpeg-turbo was built. This caused -the regression tests to fail when doing a release build under Visual C++ 2010 -and later. - -[7] Improved the accuracy and performance of the non-SIMD implementation of the -floating point inverse DCT (using code borrowed from libjpeg v8a and later.) -The accuracy of this implementation now matches the accuracy of the SSE/SSE2 -implementation. Note, however, that the floating point DCT/IDCT algorithms are -mainly a legacy feature. They generally do not produce significantly better -accuracy than the slow integer DCT/IDCT algorithms, and they are quite a bit -slower. - -[8] Added a new output colorspace (JCS_RGB565) to the libjpeg API that allows -for decompressing JPEG images into RGB565 (16-bit) pixels. If dithering is not -used, then this code path is SIMD-accelerated on ARM platforms. - -[9] Numerous obsolete features, such as support for non-ANSI compilers and -support for the MS-DOS memory model, were removed from the libjpeg code, -greatly improving its readability and making it easier to maintain and extend. - -[10] Fixed a segfault that occurred when calling output_message() with msg_code -set to JMSG_COPYRIGHT. - -[11] Fixed an issue whereby wrjpgcom was allowing comments longer than 65k -characters to be passed on the command line, which was causing it to generate -incorrect JPEG files. - -[12] Fixed a bug in the build system that was causing the Windows version of -wrjpgcom to be built using the rdjpgcom source code. - -[13] Restored 12-bit-per-component JPEG support. A 12-bit version of -libjpeg-turbo can now be built by passing an argument of --with-12bit to -configure (Unix) or -DWITH_12BIT=1 to cmake (Windows.) 12-bit JPEG support is -included only for convenience. Enabling this feature disables all of the -performance features in libjpeg-turbo, as well as arithmetic coding and the -TurboJPEG API. The resulting library still contains the other libjpeg-turbo -features (such as the colorspace extensions), but in general, it performs no -faster than libjpeg v6b. - -[14] Added ARM 64-bit SIMD acceleration for the YCC-to-RGB color conversion -and IDCT algorithms (both are used during JPEG decompression.) For unknown -reasons (probably related to clang), this code cannot currently be compiled for -iOS. - -[15] Fixed an extremely rare bug that could cause the Huffman encoder's local -buffer to overrun when a very high-frequency MCU is compressed using quality -100 and no subsampling, and when the JPEG output buffer is being dynamically -resized by the destination manager. This issue was so rare that, even with a -test program specifically designed to make the bug occur (by injecting random -high-frequency YUV data into the compressor), it was reproducible only once in -about every 25 million iterations. - -[16] Fixed an oversight in the TurboJPEG C wrapper: if any of the JPEG -compression functions was called repeatedly with the same -automatically-allocated destination buffer, then TurboJPEG would erroneously -assume that the jpegSize parameter was equal to the size of the buffer, when in -fact that parameter was probably equal to the size of the most recently -compressed JPEG image. If the size of the previous JPEG image was not as large -as the current JPEG image, then TurboJPEG would unnecessarily reallocate the -destination buffer. - - -1.3.1 -===== - -[1] On Un*x systems, 'make install' now installs the libjpeg-turbo libraries -into /opt/libjpeg-turbo/lib32 by default on any 32-bit system, not just x86, -and into /opt/libjpeg-turbo/lib64 by default on any 64-bit system, not just -x86-64. You can override this by overriding either the 'prefix' or 'libdir' -configure variables. - -[2] The Windows installer now places a copy of the TurboJPEG DLLs in the same -directory as the rest of the libjpeg-turbo binaries. This was mainly done -to support TurboVNC 1.3, which bundles the DLLs in its Windows installation. -When using a 32-bit version of CMake on 64-bit Windows, it is impossible to -access the c:\WINDOWS\system32 directory, which made it impossible for the -TurboVNC build scripts to bundle the 64-bit TurboJPEG DLL. - -[3] Fixed a bug whereby attempting to encode a progressive JPEG with arithmetic -entropy coding (by passing arguments of -progressive -arithmetic to cjpeg or -jpegtran, for instance) would result in an error, "Requested feature was -omitted at compile time". - -[4] Fixed a couple of issues whereby malformed JPEG images would cause -libjpeg-turbo to use uninitialized memory during decompression. - -[5] Fixed an error ("Buffer passed to JPEG library is too small") that occurred -when calling the TurboJPEG YUV encoding function with a very small (< 5x5) -source image, and added a unit test to check for this error. - -[6] The Java classes should now build properly under Visual Studio 2010 and -later. - -[7] Fixed an issue that prevented SRPMs generated using the in-tree packaging -tools from being rebuilt on certain newer Linux distributions. - -[8] Numerous minor fixes to eliminate compilation and build/packaging system -warnings, fix cosmetic issues, improve documentation clarity, and other general -source cleanup. - - -1.3.0 -===== - -[1] 'make test' now works properly on FreeBSD, and it no longer requires the -md5sum executable to be present on other Un*x platforms. - -[2] Overhauled the packaging system: --- To avoid conflict with vendor-supplied libjpeg-turbo packages, the -official RPMs and DEBs for libjpeg-turbo have been renamed to -"libjpeg-turbo-official". --- The TurboJPEG libraries are now located under /opt/libjpeg-turbo in the -official Linux and Mac packages, to avoid conflict with vendor-supplied -packages and also to streamline the packaging system. --- Release packages are now created with the directory structure defined -by the configure variables "prefix", "bindir", "libdir", etc. (Un*x) or by the -CMAKE_INSTALL_PREFIX variable (Windows.) The exception is that the docs are -always located under the system default documentation directory on Un*x and Mac -systems, and on Windows, the TurboJPEG DLL is always located in the Windows -system directory. --- To avoid confusion, official libjpeg-turbo packages on Linux/Unix platforms -(except for Mac) will always install the 32-bit libraries in -/opt/libjpeg-turbo/lib32 and the 64-bit libraries in /opt/libjpeg-turbo/lib64. --- Fixed an issue whereby, in some cases, the libjpeg-turbo executables on Un*x -systems were not properly linking with the shared libraries installed by the -same package. --- Fixed an issue whereby building the "installer" target on Windows when -WITH_JAVA=1 would fail if the TurboJPEG JAR had not been previously built. --- Building the "install" target on Windows now installs files into the same -places that the installer does. - -[3] Fixed a Huffman encoder bug that prevented I/O suspension from working -properly. - - -1.2.90 (1.3 beta1) -================== - -[1] Added support for additional scaling factors (3/8, 5/8, 3/4, 7/8, 9/8, 5/4, -11/8, 3/2, 13/8, 7/4, 15/8, and 2) when decompressing. Note that the IDCT will -not be SIMD-accelerated when using any of these new scaling factors. - -[2] The TurboJPEG dynamic library is now versioned. It was not strictly -necessary to do so, because TurboJPEG uses versioned symbols, and if a function -changes in an ABI-incompatible way, that function is renamed and a legacy -function is provided to maintain backward compatibility. However, certain -Linux distro maintainers have a policy against accepting any library that isn't -versioned. - -[3] Extended the TurboJPEG Java API so that it can be used to compress a JPEG -image from and decompress a JPEG image to an arbitrary position in a large -image buffer. - -[4] The tjDecompressToYUV() function now supports the TJFLAG_FASTDCT flag. - -[5] The 32-bit supplementary package for amd64 Debian systems now provides -symlinks in /usr/lib/i386-linux-gnu for the TurboJPEG libraries in /usr/lib32. -This allows those libraries to be used on MultiArch-compatible systems (such as -Ubuntu 11 and later) without setting the linker path. - -[6] The TurboJPEG Java wrapper should now find the JNI library on Mac systems -without having to pass -Djava.library.path=/usr/lib to java. - -[7] TJBench has been ported to Java to provide a convenient way of validating -the performance of the TurboJPEG Java API. It can be run with -'java -cp turbojpeg.jar TJBench'. - -[8] cjpeg can now be used to generate JPEG files with the RGB colorspace -(feature ported from jpeg-8d.) - -[9] The width and height in the -crop argument passed to jpegtran can now be -suffixed with "f" to indicate that, when the upper left corner of the cropping -region is automatically moved to the nearest iMCU boundary, the bottom right -corner should be moved by the same amount. In other words, this feature causes -jpegtran to strictly honor the specified width/height rather than the specified -bottom right corner (feature ported from jpeg-8d.) - -[10] JPEG files using the RGB colorspace can now be decompressed into grayscale -images (feature ported from jpeg-8d.) - -[11] Fixed a regression caused by 1.2.1[7] whereby the build would fail with -multiple "Mismatch in operand sizes" errors when attempting to build the x86 -SIMD code with NASM 0.98. - -[12] The in-memory source/destination managers (jpeg_mem_src() and -jpeg_mem_dest()) are now included by default when building libjpeg-turbo with -libjpeg v6b or v7 emulation, so that programs can take advantage of these -functions without requiring the use of the backward-incompatible libjpeg v8 -ABI. The "age number" of the libjpeg-turbo library on Un*x systems has been -incremented by 1 to reflect this. You can disable this feature with a -configure/CMake switch in order to retain strict API/ABI compatibility with the -libjpeg v6b or v7 API/ABI (or with previous versions of libjpeg-turbo.) See -README-turbo.txt for more details. - -[13] Added ARMv7s architecture to libjpeg.a and libturbojpeg.a in the official -libjpeg-turbo binary package for OS X, so that those libraries can be used to -build applications that leverage the faster CPUs in the iPhone 5 and iPad 4. - - -1.2.1 -===== - -[1] Creating or decoding a JPEG file that uses the RGB colorspace should now -properly work when the input or output colorspace is one of the libjpeg-turbo -colorspace extensions. - -[2] When libjpeg-turbo was built without SIMD support and merged (non-fancy) -upsampling was used along with an alpha-enabled colorspace during -decompression, the unused byte of the decompressed pixels was not being set to -0xFF. This has been fixed. TJUnitTest has also been extended to test for the -correct behavior of the colorspace extensions when merged upsampling is used. - -[3] Fixed a bug whereby the libjpeg-turbo SSE2 SIMD code would not preserve the -upper 64 bits of xmm6 and xmm7 on Win64 platforms, which violated the Win64 -calling conventions. - -[4] Fixed a regression caused by 1.2.0[6] whereby decompressing corrupt JPEG -images (specifically, images in which the component count was erroneously set -to a large value) would cause libjpeg-turbo to segfault. - -[5] Worked around a severe performance issue with "Bobcat" (AMD Embedded APU) -processors. The MASKMOVDQU instruction, which was used by the libjpeg-turbo -SSE2 SIMD code, is apparently implemented in microcode on AMD processors, and -it is painfully slow on Bobcat processors in particular. Eliminating the use -of this instruction improved performance by an order of magnitude on Bobcat -processors and by a small amount (typically 5%) on AMD desktop processors. - -[6] Added SIMD acceleration for performing 4:2:2 upsampling on NEON-capable ARM -platforms. This speeds up the decompression of 4:2:2 JPEGs by 20-25% on such -platforms. - -[7] Fixed a regression caused by 1.2.0[2] whereby, on Linux/x86 platforms -running the 32-bit SSE2 SIMD code in libjpeg-turbo, decompressing a 4:2:0 or -4:2:2 JPEG image into a 32-bit (RGBX, BGRX, etc.) buffer without using fancy -upsampling would produce several incorrect columns of pixels at the right-hand -side of the output image if each row in the output image was not evenly -divisible by 16 bytes. - -[8] Fixed an issue whereby attempting to build the SIMD extensions with Xcode -4.3 on OS X platforms would cause NASM to return numerous errors of the form -"'%define' expects a macro identifier". - -[9] Added flags to the TurboJPEG API that allow the caller to force the use of -either the fast or the accurate DCT/IDCT algorithms in the underlying codec. - - -1.2.0 -===== - -[1] Fixed build issue with YASM on Unix systems (the libjpeg-turbo build system -was not adding the current directory to the assembler include path, so YASM -was not able to find jsimdcfg.inc.) - -[2] Fixed out-of-bounds read in SSE2 SIMD code that occurred when decompressing -a JPEG image to a bitmap buffer whose size was not a multiple of 16 bytes. -This was more of an annoyance than an actual bug, since it did not cause any -actual run-time problems, but the issue showed up when running libjpeg-turbo in -valgrind. See http://crbug.com/72399 for more information. - -[3] Added a compile-time macro (LIBJPEG_TURBO_VERSION) that can be used to -check the version of libjpeg-turbo against which an application was compiled. - -[4] Added new RGBA/BGRA/ABGR/ARGB colorspace extension constants (libjpeg API) -and pixel formats (TurboJPEG API), which allow applications to specify that, -when decompressing to a 4-component RGB buffer, the unused byte should be set -to 0xFF so that it can be interpreted as an opaque alpha channel. - -[5] Fixed regression issue whereby DevIL failed to build against libjpeg-turbo -because libjpeg-turbo's distributed version of jconfig.h contained an INLINE -macro, which conflicted with a similar macro in DevIL. This macro is used only -internally when building libjpeg-turbo, so it was moved into config.h. - -[6] libjpeg-turbo will now correctly decompress erroneous CMYK/YCCK JPEGs whose -K component is assigned a component ID of 1 instead of 4. Although these files -are in violation of the spec, other JPEG implementations handle them -correctly. - -[7] Added ARMv6 and ARMv7 architectures to libjpeg.a and libturbojpeg.a in -the official libjpeg-turbo binary package for OS X, so that those libraries can -be used to build both OS X and iOS applications. - - -1.1.90 (1.2 beta1) -================== - -[1] Added a Java wrapper for the TurboJPEG API. See java/README for more -details. - -[2] The TurboJPEG API can now be used to scale down images during -decompression. - -[3] Added SIMD routines for RGB-to-grayscale color conversion, which -significantly improves the performance of grayscale JPEG compression from an -RGB source image. - -[4] Improved the performance of the C color conversion routines, which are used -on platforms for which SIMD acceleration is not available. - -[5] Added a function to the TurboJPEG API that performs lossless transforms. -This function is implemented using the same back end as jpegtran, but it -performs transcoding entirely in memory and allows multiple transforms and/or -crop operations to be batched together, so the source coefficients only need to -be read once. This is useful when generating image tiles from a single source -JPEG. - -[6] Added tests for the new TurboJPEG scaled decompression and lossless -transform features to tjbench (the TurboJPEG benchmark, formerly called -"jpgtest".) - -[7] Added support for 4:4:0 (transposed 4:2:2) subsampling in TurboJPEG, which -was necessary in order for it to read 4:2:2 JPEG files that had been losslessly -transposed or rotated 90 degrees. - -[8] All legacy VirtualGL code has been re-factored, and this has allowed -libjpeg-turbo, in its entirety, to be re-licensed under a BSD-style license. - -[9] libjpeg-turbo can now be built with YASM. - -[10] Added SIMD acceleration for ARM Linux and iOS platforms that support -NEON instructions. - -[11] Refactored the TurboJPEG C API and documented it using Doxygen. The -TurboJPEG 1.2 API uses pixel formats to define the size and component order of -the uncompressed source/destination images, and it includes a more efficient -version of TJBUFSIZE() that computes a worst-case JPEG size based on the level -of chrominance subsampling. The refactored implementation of the TurboJPEG API -now uses the libjpeg memory source and destination managers, which allows the -TurboJPEG compressor to grow the JPEG buffer as necessary. - -[12] Eliminated errors in the output of jpegtran on Windows that occurred when -the application was invoked using I/O redirection -(jpegtran output.jpg). - -[13] The inclusion of libjpeg v7 and v8 emulation as well as arithmetic coding -support in libjpeg-turbo v1.1.0 introduced several new error constants in -jerror.h, and these were mistakenly enabled for all emulation modes, causing -the error enum in libjpeg-turbo to sometimes have different values than the -same enum in libjpeg. This represents an ABI incompatibility, and it caused -problems with rare applications that took specific action based on a particular -error value. The fix was to include the new error constants conditionally -based on whether libjpeg v7 or v8 emulation was enabled. - -[14] Fixed an issue whereby Windows applications that used libjpeg-turbo would -fail to compile if the Windows system headers were included before jpeglib.h. -This issue was caused by a conflict in the definition of the INT32 type. - -[15] Fixed 32-bit supplementary package for amd64 Debian systems, which was -broken by enhancements to the packaging system in 1.1. - -[16] When decompressing a JPEG image using an output colorspace of -JCS_EXT_RGBX, JCS_EXT_BGRX, JCS_EXT_XBGR, or JCS_EXT_XRGB, libjpeg-turbo will -now set the unused byte to 0xFF, which allows applications to interpret that -byte as an alpha channel (0xFF = opaque). - - -1.1.1 -===== - -[1] Fixed a 1-pixel error in row 0, column 21 of the luminance plane generated -by tjEncodeYUV(). - -[2] libjpeg-turbo's accelerated Huffman decoder previously ignored unexpected -markers found in the middle of the JPEG data stream during decompression. It -will now hand off decoding of a particular block to the unaccelerated Huffman -decoder if an unexpected marker is found, so that the unaccelerated Huffman -decoder can generate an appropriate warning. - -[3] Older versions of MinGW64 prefixed symbol names with underscores by -default, which differed from the behavior of 64-bit Visual C++. MinGW64 1.0 -has adopted the behavior of 64-bit Visual C++ as the default, so to accommodate -this, the libjpeg-turbo SIMD function names are no longer prefixed with an -underscore when building with MinGW64. This means that, when building -libjpeg-turbo with older versions of MinGW64, you will now have to add --fno-leading-underscore to the CFLAGS. - -[4] Fixed a regression bug in the NSIS script that caused the Windows installer -build to fail when using the Visual Studio IDE. - -[5] Fixed a bug in jpeg_read_coefficients() whereby it would not initialize -cinfo->image_width and cinfo->image_height if libjpeg v7 or v8 emulation was -enabled. This specifically caused the jpegoptim program to fail if it was -linked against a version of libjpeg-turbo that was built with libjpeg v7 or v8 -emulation. - -[6] Eliminated excessive I/O overhead that occurred when reading BMP files in -cjpeg. - -[7] Eliminated errors in the output of cjpeg on Windows that occurred when the -application was invoked using I/O redirection (cjpeg output.jpg). - - -1.1.0 -===== - -[1] The algorithm used by the SIMD quantization function cannot produce correct -results when the JPEG quality is >= 98 and the fast integer forward DCT is -used. Thus, the non-SIMD quantization function is now used for those cases, -and libjpeg-turbo should now produce identical output to libjpeg v6b in all -cases. - -[2] Despite the above, the fast integer forward DCT still degrades somewhat for -JPEG qualities greater than 95, so the TurboJPEG wrapper will now automatically -use the slow integer forward DCT when generating JPEG images of quality 96 or -greater. This reduces compression performance by as much as 15% for these -high-quality images but is necessary to ensure that the images are perceptually -lossless. It also ensures that the library can avoid the performance pitfall -created by [1]. - -[3] Ported jpgtest.cxx to pure C to avoid the need for a C++ compiler. - -[4] Fixed visual artifacts in grayscale JPEG compression caused by a typo in -the RGB-to-luminance lookup tables. - -[5] The Windows distribution packages now include the libjpeg run-time programs -(cjpeg, etc.) - -[6] All packages now include jpgtest. - -[7] The TurboJPEG dynamic library now uses versioned symbols. - -[8] Added two new TurboJPEG API functions, tjEncodeYUV() and -tjDecompressToYUV(), to replace the somewhat hackish TJ_YUV flag. - - -1.0.90 (1.1 beta1) -================== - -[1] Added emulation of the libjpeg v7 and v8 APIs and ABIs. See -README-turbo.txt for more details. This feature was sponsored by CamTrace SAS. - -[2] Created a new CMake-based build system for the Visual C++ and MinGW builds. - -[3] Grayscale bitmaps can now be compressed from/decompressed to using the -TurboJPEG API. - -[4] jpgtest can now be used to test decompression performance with existing -JPEG images. - -[5] If the default install prefix (/opt/libjpeg-turbo) is used, then -'make install' now creates /opt/libjpeg-turbo/lib32 and -/opt/libjpeg-turbo/lib64 sym links to duplicate the behavior of the binary -packages. - -[6] All symbols in the libjpeg-turbo dynamic library are now versioned, even -when the library is built with libjpeg v6b emulation. - -[7] Added arithmetic encoding and decoding support (can be disabled with -configure or CMake options) - -[8] Added a TJ_YUV flag to the TurboJPEG API, which causes both the compressor -and decompressor to output planar YUV images. - -[9] Added an extended version of tjDecompressHeader() to the TurboJPEG API, -which allows the caller to determine the type of subsampling used in a JPEG -image. - -[10] Added further protections against invalid Huffman codes. - - -1.0.1 -===== - -[1] The Huffman decoder will now handle erroneous Huffman codes (for instance, -from a corrupt JPEG image.) Previously, these would cause libjpeg-turbo to -crash under certain circumstances. - -[2] Fixed typo in SIMD dispatch routines that was causing 4:2:2 upsampling to -be used instead of 4:2:0 when decompressing JPEG images using SSE2 code. - -[3] configure script will now automatically determine whether the -INCOMPLETE_TYPES_BROKEN macro should be defined. - - -1.0.0 -===== - -[1] 2983700: Further FreeBSD build tweaks (no longer necessary to specify ---host when configuring on a 64-bit system) - -[2] Created symlinks in the Unix/Linux packages so that the TurboJPEG -include file can always be found in /opt/libjpeg-turbo/include, the 32-bit -static libraries can always be found in /opt/libjpeg-turbo/lib32, and the -64-bit static libraries can always be found in /opt/libjpeg-turbo/lib64. - -[3] The Unix/Linux distribution packages now include the libjpeg run-time -programs (cjpeg, etc.) and man pages. - -[4] Created a 32-bit supplementary package for amd64 Debian systems, which -contains just the 32-bit libjpeg-turbo libraries. - -[5] Moved the libraries from */lib32 to */lib in the i386 Debian package. - -[6] Include distribution package for Cygwin - -[7] No longer necessary to specify --without-simd on non-x86 architectures, and -unit tests now work on those architectures. - - -0.0.93 -====== - -[1] 2982659, Fixed x86-64 build on FreeBSD systems - -[2] 2988188: Added support for Windows 64-bit systems - - -0.0.91 -====== - -[1] Added documentation to .deb packages - -[2] 2968313: Fixed data corruption issues when decompressing large JPEG images -and/or using buffered I/O with the libjpeg-turbo decompressor - - -0.0.90 -====== - -Initial release diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 00000000..4623e294 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,88 @@ +libjpeg-turbo Licenses +====================== + +libjpeg-turbo is covered by three compatible BSD-style open source licenses: + +- The IJG (Independent JPEG Group) License, which is listed in + [README.ijg](README.ijg) + + This license applies to the libjpeg API library and associated programs + (any code inherited from libjpeg, and any modifications to that code.) + +- The Modified (3-clause) BSD License, which is listed in + [turbojpeg.c](turbojpeg.c) + + This license covers the TurboJPEG API library and associated programs. + +- The zlib License, which is listed in [simd/jsimdext.inc](simd/jsimdext.inc) + + This license is a subset of the other two, and it covers the libjpeg-turbo + SIMD extensions. + + +Complying with the libjpeg-turbo Licenses +========================================= + +This section provides a roll-up of the libjpeg-turbo licensing terms, to the +best of our understanding. + +1. If you are distributing a modified version of the libjpeg-turbo source, + then: + + 1. You cannot alter or remove any existing copyright or license notices + from the source. + + **Origin** + - Clause 1 of the IJG License + - Clause 1 of the Modified BSD License + - Clauses 1 and 3 of the zlib License + + 2. You must add your own copyright notice to the header of each source + file you modified, so others can tell that you modified that file (if + there is not an existing copyright header in that file, then you can + simply add a notice stating that you modified the file.) + + **Origin** + - Clause 1 of the IJG License + - Clause 2 of the zlib License + + 3. You must include the IJG README file, and you must not alter any of the + copyright or license text in that file. + + **Origin** + - Clause 1 of the IJG License + +2. If you are distributing only libjpeg-turbo binaries without the source, or + if you are distributing an application that statically links with + libjpeg-turbo, then: + + 1. Your product documentation must include a message stating: + + This software is based in part on the work of the Independent JPEG + Group. + + **Origin** + - Clause 2 of the IJG license + + 2. If your binary distribution includes or uses the TurboJPEG API, then + your product documentation must include the text of the Modified BSD + License. + + **Origin** + - Clause 2 of the Modified BSD License + +3. You cannot use the name of the IJG or The libjpeg-turbo Project or the + contributors thereof in advertising, publicity, etc. + + **Origin** + - IJG License + - Clause 3 of the Modified BSD License + +4. The IJG and The libjpeg-turbo Project do not warrant libjpeg-turbo to be + free of defects, nor do we accept any liability for undesirable + consequences resulting from your use of the software. + + **Origin** + - IJG License + - Modified BSD License + - zlib License diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index 5cab36ea..00000000 --- a/LICENSE.txt +++ /dev/null @@ -1,79 +0,0 @@ -libjpeg-turbo Licenses ----------------------- - -libjpeg-turbo is covered by three compatible BSD-style open source licenses: - --- The IJG (Independent JPEG Group) License, which is listed in README - - This license applies to the libjpeg API library and associated programs - (any code inherited from libjpeg, and any modifications to that code.) - --- The Modified (3-clause) BSD License, which is listed in turbojpeg.c - - This license covers the TurboJPEG API library and associated programs. - --- The zlib License, which is listed in simd/jsimdext.inc - - This license is a subset of the other two, and it covers the libjpeg-turbo - SIMD extensions. - - -Complying with the libjpeg-turbo Licenses ------------------------------------------ - -This section provides a roll-up of the libjpeg-turbo licensing terms, to the -best of our understanding. - -1. If you are distributing a modified version of the libjpeg-turbo source, - then: - - a. You cannot alter or remove any existing copyright or license notices - from the source. - - Origin: Clause 1 of the IJG License - Clause 1 of the Modified BSD License - Clauses 1 and 3 of the zlib License - - b. You must add your own copyright notice to the header of each source - file you modified, so others can tell that you modified that file (if - there is not an existing copyright header in that file, then you can - simply add a notice stating that you modified the file.) - - Origin: Clause 1 of the IJG License - Clause 2 of the zlib License - - c. You must include the IJG README file, and you must not alter any of the - copyright or license text in that file. - - Origin: Clause 1 of the IJG License - -2. If you are distributing only libjpeg-turbo binaries without the source, or - if you are distributing an application that statically links with - libjpeg-turbo, then: - - a. Your product documentation must include a message stating: - - This software is based in part on the work of the Independent JPEG - Group. - - Origin: Clause 2 of the IJG license - - b. If your binary distribution includes or uses the TurboJPEG API, then - your product documentation must include the text of the Modified BSD - License. - - Origin: Clause 2 of the Modified BSD License - -3. You cannot use the name of the IJG or The libjpeg-turbo Project or the - contributors thereof in advertising, publicity, etc. - - Origin: IJG License - Clause 3 of the Modified BSD License - -4. The IJG and The libjpeg-turbo Project do not warrant libjpeg-turbo to be - free of defects, nor do we accept any liability for undesirable - consequences resulting from your use of the software. - - Origin: IJG License - Modified BSD License - zlib License diff --git a/Makefile.am b/Makefile.am index 3e5e3c35..d0a1bb90 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,6 +10,8 @@ endif nodist_include_HEADERS = jconfig.h +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = pkgscripts/libjpeg.pc pkgscripts/libturbojpeg.pc HDRS = jchuff.h jcmaster.h jdct.h jdhuff.h jerror.h jinclude.h jmemsys.h \ jmorecfg.h jpegint.h jpeglib.h jversion.h jsimd.h jsimddct.h jpegcomp.h \ @@ -169,11 +171,11 @@ yuvjpeg_LDADD = libjpeg.la dist_man1_MANS = cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 wrjpgcom.1 -DOCS= coderules.txt jconfig.txt change.log rdrle.c wrrle.c BUILDING.txt \ - ChangeLog.txt +DOCS= coderules.txt jconfig.txt change.log rdrle.c wrrle.c BUILDING.md \ + ChangeLog.md -dist_doc_DATA = README README-turbo.txt libjpeg.txt structure.txt usage.txt \ - wizard.txt +dist_doc_DATA = README.ijg README.md libjpeg.txt structure.txt usage.txt \ + wizard.txt LICENSE.md exampledir = $(docdir) dist_example_DATA = example.c @@ -182,7 +184,8 @@ dist_example_DATA = example.c EXTRA_DIST = win release $(DOCS) testimages CMakeLists.txt \ sharedlib/CMakeLists.txt cmakescripts libjpeg.map.in doc doxygen.config \ doxygen-extra.css jccolext.c jdcolext.c jdcol565.c jdmrgext.c jdmrg565.c \ - jstdhuff.c LICENSE.txt + jstdhuff.c jdcoefct.h jdmainct.h jdmaster.h jdsample.h wrppm.h \ + md5/CMakeLists.txt dist-hook: rm -rf `find $(distdir) -name .svn` @@ -224,6 +227,10 @@ MD5_PPM_420M_ISLOW_1_2 = b419124dd5568b085787234866102866 MD5_PPM_420M_ISLOW_3_8 = 343d19015531b7bbe746124127244fa8 MD5_PPM_420M_ISLOW_1_4 = 35fd59d866e44659edfa3c18db2a3edb MD5_PPM_420M_ISLOW_1_8 = ccaed48ac0aedefda5d4abe4013f4ad7 +MD5_PPM_420_ISLOW_SKIP15_31 = 86664cd9dc956536409e44e244d20a97 +MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71 = 452a21656115a163029cfba5c04fa76a +MD5_PPM_444_ISLOW_SKIP1_6 = ef63901f71ef7a75cd78253fc0914f84 +MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13 = 15b173fb5872d9575572fbcc1b05956f MD5_JPEG_CROP = cdb35ff4b4519392690ea040c56ea99c else @@ -247,7 +254,7 @@ MD5_PPM_GRAY_ISLOW_RGB = 116424ac07b79e5e801f00508eab48ec MD5_BMP_GRAY_ISLOW_565 = 12f78118e56a2f48b966f792fedf23cc MD5_BMP_GRAY_ISLOW_565D = bdbbd616441a24354c98553df5dc82db MD5_JPEG_420S_IFAST_OPT = 388708217ac46273ca33086b22827ed8 -# See README-turbo.txt for more details on why this next bit is necessary. +# See README.md for more details on why this next bit is necessary. MD5_JPEG_3x2_FLOAT_PROG_SSE = 343e3f8caf8af5986ebaf0bdc13b5c71 MD5_PPM_3x2_FLOAT_SSE = 1a75f36e5904d6fc3a85a43da9ad89bb MD5_JPEG_3x2_FLOAT_PROG_32BIT = 9bca803d2042bd1eb03819e2bf92b3e5 @@ -276,6 +283,13 @@ MD5_BMP_420_ISLOW_565 = bf9d13e16c4923b92e1faa604d7922cb MD5_BMP_420_ISLOW_565D = 6bde71526acc44bcff76f696df8638d2 MD5_BMP_420M_ISLOW_565 = 8dc0185245353cfa32ad97027342216f MD5_BMP_420M_ISLOW_565D =d1be3a3339166255e76fa50a0d70d73e +MD5_PPM_420_ISLOW_SKIP15_31 = c4c65c1e43d7275cd50328a61e6534f0 +MD5_PPM_420_ISLOW_ARI_SKIP16_139 = 087c6b123db16ac00cb88c5b590bb74a +MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71 = 26eb36ccc7d1f0cb80cdabb0ac8b5d99 +MD5_PPM_420_ISLOW_ARI_CROP53x53_4_4 = 886c6775af22370257122f8b16207e6d +MD5_PPM_444_ISLOW_SKIP1_6 = 5606f86874cf26b8fcee1117a0a436a6 +MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13 = db87dc7ce26bcdc7a6b56239ce2b9d6c +MD5_PPM_444_ISLOW_ARI_CROP37x37_0_0 = cb57b32bd6d03e35432362f7bf184b6d MD5_JPEG_CROP = b4197f377e621c4e9b1d20471432610d endif @@ -283,7 +297,11 @@ endif .PHONY: test test: tjquicktest tjbittest bittest +if CROSS_COMPILING +tjquicktest: testclean +else tjquicktest: testclean all +endif if WITH_TURBOJPEG if WITH_JAVA @@ -302,7 +320,11 @@ endif endif echo GREAT SUCCESS! +if CROSS_COMPILING +tjbittest: testclean +else tjbittest: testclean all +endif if WITH_TURBOJPEG @@ -343,7 +365,7 @@ MD5_PPM_444_TILE = 7964e41e67cfb8d0a587c0aa4798f9c3 for i in 8 16 32 64 128; do \ md5/md5cmp $(MD5_PPM_444_TILE) testout_tile_444_Q95_$$i\x$$i.ppm; \ done - rm testout_tile_GRAY_* testout_tile_420_* testout_tile_422_* testout_tile_444_* + rm -f testout_tile_GRAY_* testout_tile_420_* testout_tile_422_* testout_tile_444_* ./tjbench testout_tile.ppm 95 -rgb -fastupsample -quiet -tile -benchtime 0.01 >/dev/null 2>&1 md5/md5cmp $(MD5_PPM_420M_8x8_TILE) testout_tile_420_Q95_8x8.ppm @@ -354,12 +376,16 @@ MD5_PPM_444_TILE = 7964e41e67cfb8d0a587c0aa4798f9c3 for i in 16 32 64 128; do \ md5/md5cmp $(MD5_PPM_422M_TILE) testout_tile_422_Q95_$$i\x$$i.ppm; \ done - rm testout_tile_GRAY_* testout_tile_420_* testout_tile_422_* testout_tile_444_* testout_tile.ppm + rm -f testout_tile_GRAY_* testout_tile_420_* testout_tile_422_* testout_tile_444_* testout_tile.ppm echo GREAT SUCCESS! endif +if CROSS_COMPILING +bittest: testclean +else bittest: testclean all +endif # These tests are carefully crafted to provide full coverage of as many of the # underlying algorithms as possible (including all of the SIMD-accelerated @@ -371,18 +397,18 @@ bittest: testclean all # CC: null SAMP: fullsize IDCT: islow ENT: huff ./djpeg -dct int -ppm -outfile testout_rgb_islow.ppm testout_rgb_islow.jpg md5/md5cmp $(MD5_PPM_RGB_ISLOW) testout_rgb_islow.ppm - rm testout_rgb_islow.ppm + rm -f testout_rgb_islow.ppm if WITH_12BIT - rm testout_rgb_islow.jpg + rm -f testout_rgb_islow.jpg else # CC: RGB->RGB565 SAMP: fullsize IDCT: islow ENT: huff ./djpeg -dct int -rgb565 -dither none -bmp -outfile testout_rgb_islow_565.bmp testout_rgb_islow.jpg md5/md5cmp $(MD5_BMP_RGB_ISLOW_565) testout_rgb_islow_565.bmp - rm testout_rgb_islow_565.bmp + rm -f testout_rgb_islow_565.bmp # CC: RGB->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff ./djpeg -dct int -rgb565 -bmp -outfile testout_rgb_islow_565D.bmp testout_rgb_islow.jpg md5/md5cmp $(MD5_BMP_RGB_ISLOW_565D) testout_rgb_islow_565D.bmp - rm testout_rgb_islow_565D.bmp testout_rgb_islow.jpg + rm -f testout_rgb_islow_565D.bmp testout_rgb_islow.jpg endif # CC: RGB->YCC SAMP: fullsize/h2v1 FDCT: ifast ENT: 2-pass huff @@ -391,22 +417,22 @@ endif # CC: YCC->RGB SAMP: fullsize/h2v1 fancy IDCT: ifast ENT: huff ./djpeg -dct fast -outfile testout_422_ifast.ppm testout_422_ifast_opt.jpg md5/md5cmp $(MD5_PPM_422_IFAST) testout_422_ifast.ppm - rm testout_422_ifast.ppm + rm -f testout_422_ifast.ppm # CC: YCC->RGB SAMP: h2v1 merged IDCT: ifast ENT: huff ./djpeg -dct fast -nosmooth -outfile testout_422m_ifast.ppm testout_422_ifast_opt.jpg md5/md5cmp $(MD5_PPM_422M_IFAST) testout_422m_ifast.ppm - rm testout_422m_ifast.ppm + rm -f testout_422m_ifast.ppm if WITH_12BIT - rm testout_422_ifast_opt.jpg + rm -f testout_422_ifast_opt.jpg else # CC: YCC->RGB565 SAMP: h2v1 merged IDCT: ifast ENT: huff ./djpeg -dct int -nosmooth -rgb565 -dither none -bmp -outfile testout_422m_ifast_565.bmp testout_422_ifast_opt.jpg md5/md5cmp $(MD5_BMP_422M_IFAST_565) testout_422m_ifast_565.bmp - rm testout_422m_ifast_565.bmp + rm -f testout_422m_ifast_565.bmp # CC: YCC->RGB565 (dithered) SAMP: h2v1 merged IDCT: ifast ENT: huff ./djpeg -dct int -nosmooth -rgb565 -bmp -outfile testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg md5/md5cmp $(MD5_BMP_422M_IFAST_565D) testout_422m_ifast_565D.bmp - rm testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg + rm -f testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg endif # CC: RGB->YCC SAMP: fullsize/h2v2 FDCT: ifast ENT: prog huff @@ -415,11 +441,11 @@ endif # CC: YCC->RGB SAMP: fullsize/h2v2 fancy IDCT: ifast ENT: prog huff ./djpeg -dct fast -outfile testout_420_q100_ifast.ppm testout_420_q100_ifast_prog.jpg md5/md5cmp $(MD5_PPM_420_Q100_IFAST) testout_420_q100_ifast.ppm - rm testout_420_q100_ifast.ppm + rm -f testout_420_q100_ifast.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: ifast ENT: prog huff ./djpeg -dct fast -nosmooth -outfile testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg md5/md5cmp $(MD5_PPM_420M_Q100_IFAST) testout_420m_q100_ifast.ppm - rm testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg + rm -f testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg # CC: RGB->Gray SAMP: fullsize FDCT: islow ENT: huff ./cjpeg -revert -gray -dct int -outfile testout_gray_islow.jpg $(srcdir)/testimages/testorig.ppm @@ -427,29 +453,29 @@ endif # CC: Gray->Gray SAMP: fullsize IDCT: islow ENT: huff ./djpeg -dct int -outfile testout_gray_islow.ppm testout_gray_islow.jpg md5/md5cmp $(MD5_PPM_GRAY_ISLOW) testout_gray_islow.ppm - rm testout_gray_islow.ppm + rm -f testout_gray_islow.ppm # CC: Gray->RGB SAMP: fullsize IDCT: islow ENT: huff ./djpeg -dct int -rgb -outfile testout_gray_islow_rgb.ppm testout_gray_islow.jpg md5/md5cmp $(MD5_PPM_GRAY_ISLOW_RGB) testout_gray_islow_rgb.ppm - rm testout_gray_islow_rgb.ppm + rm -f testout_gray_islow_rgb.ppm if WITH_12BIT - rm testout_gray_islow.jpg + rm -f testout_gray_islow.jpg else # CC: Gray->RGB565 SAMP: fullsize IDCT: islow ENT: huff ./djpeg -dct int -rgb565 -dither none -bmp -outfile testout_gray_islow_565.bmp testout_gray_islow.jpg md5/md5cmp $(MD5_BMP_GRAY_ISLOW_565) testout_gray_islow_565.bmp - rm testout_gray_islow_565.bmp + rm -f testout_gray_islow_565.bmp # CC: Gray->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff ./djpeg -dct int -rgb565 -bmp -outfile testout_gray_islow_565D.bmp testout_gray_islow.jpg md5/md5cmp $(MD5_BMP_GRAY_ISLOW_565D) testout_gray_islow_565D.bmp - rm testout_gray_islow_565D.bmp testout_gray_islow.jpg + rm -f testout_gray_islow_565D.bmp testout_gray_islow.jpg endif # CC: RGB->YCC SAMP: fullsize smooth/h2v2 smooth FDCT: islow # ENT: 2-pass huff ./cjpeg -revert -sample 2x2 -smooth 1 -dct int -opt -outfile testout_420s_ifast_opt.jpg $(srcdir)/testimages/testorig.ppm md5/md5cmp $(MD5_JPEG_420S_IFAST_OPT) testout_420s_ifast_opt.jpg - rm testout_420s_ifast_opt.jpg + rm -f testout_420s_ifast_opt.jpg # The output of the floating point tests is not validated by default, because # the output differs depending on the type of floating point math used, and @@ -483,7 +509,7 @@ endif elif [ "${FLOATTEST}" = "64bit" ]; then \ md5/md5cmp $(MD5_PPM_3x2_FLOAT_64BIT) testout_3x2_float.ppm; \ fi - rm testout_3x2_float.ppm testout_3x2_float_prog.jpg + rm -f testout_3x2_float.ppm testout_3x2_float_prog.jpg # CC: RGB->YCC SAMP: fullsize/int FDCT: ifast ENT: prog huff ./cjpeg -revert -sample 3x2 -dct fast -prog -outfile testout_3x2_ifast_prog.jpg $(srcdir)/testimages/testorig.ppm @@ -491,106 +517,151 @@ endif # CC: YCC->RGB SAMP: fullsize/int IDCT: ifast ENT: prog huff ./djpeg -dct fast -outfile testout_3x2_ifast.ppm testout_3x2_ifast_prog.jpg md5/md5cmp $(MD5_PPM_3x2_IFAST) testout_3x2_ifast.ppm - rm testout_3x2_ifast.ppm testout_3x2_ifast_prog.jpg + rm -f testout_3x2_ifast.ppm testout_3x2_ifast_prog.jpg if WITH_ARITH_ENC # CC: YCC->RGB SAMP: fullsize/h2v2 FDCT: islow ENT: arith ./cjpeg -revert -dct int -arithmetic -outfile testout_420_islow_ari.jpg $(srcdir)/testimages/testorig.ppm md5/md5cmp $(MD5_JPEG_420_ISLOW_ARI) testout_420_islow_ari.jpg - rm testout_420_islow_ari.jpg + rm -f testout_420_islow_ari.jpg ./jpegtran -revert -arithmetic -outfile testout_420_islow_ari.jpg $(srcdir)/testimages/testimgint.jpg md5/md5cmp $(MD5_JPEG_420_ISLOW_ARI) testout_420_islow_ari.jpg - rm testout_420_islow_ari.jpg + rm -f testout_420_islow_ari.jpg # CC: YCC->RGB SAMP: fullsize FDCT: islow ENT: prog arith - ./cjpeg -revert -sample 1x1 -dct int -progressive -arithmetic -outfile testout_444_islow_progari.jpg $(srcdir)/testimages/testorig.ppm + ./cjpeg -revert -sample 1x1 -dct int -prog -arithmetic -outfile testout_444_islow_progari.jpg $(srcdir)/testimages/testorig.ppm md5/md5cmp $(MD5_JPEG_444_ISLOW_PROGARI) testout_444_islow_progari.jpg - rm testout_444_islow_progari.jpg + rm -f testout_444_islow_progari.jpg endif if WITH_ARITH_DEC # CC: RGB->YCC SAMP: h2v2 merged IDCT: ifast ENT: arith ./djpeg -fast -ppm -outfile testout_420m_ifast_ari.ppm $(srcdir)/testimages/testimgari.jpg md5/md5cmp $(MD5_PPM_420M_IFAST_ARI) testout_420m_ifast_ari.ppm - rm testout_420m_ifast_ari.ppm + rm -f testout_420m_ifast_ari.ppm ./jpegtran -revert -outfile testout_420_islow.jpg $(srcdir)/testimages/testimgari.jpg md5/md5cmp $(MD5_JPEG_420_ISLOW) testout_420_islow.jpg - rm testout_420_islow.jpg + rm -f testout_420_islow.jpg endif # CC: YCC->RGB SAMP: h2v2 merged IDCT: 16x16 islow ENT: huff ./djpeg -dct int -scale 2/1 -nosmooth -ppm -outfile testout_420m_islow_2_1.ppm $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_PPM_420M_ISLOW_2_1) testout_420m_islow_2_1.ppm - rm testout_420m_islow_2_1.ppm + rm -f testout_420m_islow_2_1.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 15x15 islow ENT: huff ./djpeg -dct int -scale 15/8 -nosmooth -ppm -outfile testout_420m_islow_15_8.ppm $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_PPM_420M_ISLOW_15_8) testout_420m_islow_15_8.ppm - rm testout_420m_islow_15_8.ppm + rm -f testout_420m_islow_15_8.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 13x13 islow ENT: huff ./djpeg -dct int -scale 13/8 -nosmooth -ppm -outfile testout_420m_islow_13_8.ppm $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_PPM_420M_ISLOW_13_8) testout_420m_islow_13_8.ppm - rm testout_420m_islow_13_8.ppm + rm -f testout_420m_islow_13_8.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 11x11 islow ENT: huff ./djpeg -dct int -scale 11/8 -nosmooth -ppm -outfile testout_420m_islow_11_8.ppm $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_PPM_420M_ISLOW_11_8) testout_420m_islow_11_8.ppm - rm testout_420m_islow_11_8.ppm + rm -f testout_420m_islow_11_8.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 9x9 islow ENT: huff ./djpeg -dct int -scale 9/8 -nosmooth -ppm -outfile testout_420m_islow_9_8.ppm $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_PPM_420M_ISLOW_9_8) testout_420m_islow_9_8.ppm - rm testout_420m_islow_9_8.ppm + rm -f testout_420m_islow_9_8.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 7x7 islow/14x14 islow ENT: huff ./djpeg -dct int -scale 7/8 -nosmooth -ppm -outfile testout_420m_islow_7_8.ppm $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_PPM_420M_ISLOW_7_8) testout_420m_islow_7_8.ppm - rm testout_420m_islow_7_8.ppm + rm -f testout_420m_islow_7_8.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 6x6 islow/12x12 islow ENT: huff ./djpeg -dct int -scale 3/4 -nosmooth -ppm -outfile testout_420m_islow_3_4.ppm $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_PPM_420M_ISLOW_3_4) testout_420m_islow_3_4.ppm - rm testout_420m_islow_3_4.ppm + rm -f testout_420m_islow_3_4.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 5x5 islow/10x10 islow ENT: huff ./djpeg -dct int -scale 5/8 -nosmooth -ppm -outfile testout_420m_islow_5_8.ppm $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_PPM_420M_ISLOW_5_8) testout_420m_islow_5_8.ppm - rm testout_420m_islow_5_8.ppm + rm -f testout_420m_islow_5_8.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 4x4 islow/8x8 islow ENT: huff ./djpeg -dct int -scale 1/2 -nosmooth -ppm -outfile testout_420m_islow_1_2.ppm $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_PPM_420M_ISLOW_1_2) testout_420m_islow_1_2.ppm - rm testout_420m_islow_1_2.ppm + rm -f testout_420m_islow_1_2.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 3x3 islow/6x6 islow ENT: huff ./djpeg -dct int -scale 3/8 -nosmooth -ppm -outfile testout_420m_islow_3_8.ppm $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_PPM_420M_ISLOW_3_8) testout_420m_islow_3_8.ppm - rm testout_420m_islow_3_8.ppm + rm -f testout_420m_islow_3_8.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 2x2 islow/4x4 islow ENT: huff ./djpeg -dct int -scale 1/4 -nosmooth -ppm -outfile testout_420m_islow_1_4.ppm $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_PPM_420M_ISLOW_1_4) testout_420m_islow_1_4.ppm - rm testout_420m_islow_1_4.ppm + rm -f testout_420m_islow_1_4.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 1x1 islow/2x2 islow ENT: huff ./djpeg -dct int -scale 1/8 -nosmooth -ppm -outfile testout_420m_islow_1_8.ppm $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_PPM_420M_ISLOW_1_8) testout_420m_islow_1_8.ppm - rm testout_420m_islow_1_8.ppm + rm -f testout_420m_islow_1_8.ppm if WITH_12BIT else # CC: YCC->RGB (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff ./djpeg -dct int -colors 256 -bmp -outfile testout_420_islow_256.bmp $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_BMP_420_ISLOW_256) testout_420_islow_256.bmp - rm testout_420_islow_256.bmp + rm -f testout_420_islow_256.bmp # CC: YCC->RGB565 SAMP: h2v2 fancy IDCT: islow ENT: huff ./djpeg -dct int -rgb565 -dither none -bmp -outfile testout_420_islow_565.bmp $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_BMP_420_ISLOW_565) testout_420_islow_565.bmp - rm testout_420_islow_565.bmp + rm -f testout_420_islow_565.bmp # CC: YCC->RGB565 (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff ./djpeg -dct int -rgb565 -bmp -outfile testout_420_islow_565D.bmp $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_BMP_420_ISLOW_565D) testout_420_islow_565D.bmp - rm testout_420_islow_565D.bmp + rm -f testout_420_islow_565D.bmp # CC: YCC->RGB565 SAMP: h2v2 merged IDCT: islow ENT: huff ./djpeg -dct int -nosmooth -rgb565 -dither none -bmp -outfile testout_420m_islow_565.bmp $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_BMP_420M_ISLOW_565) testout_420m_islow_565.bmp - rm testout_420m_islow_565.bmp + rm -f testout_420m_islow_565.bmp # CC: YCC->RGB565 (dithered) SAMP: h2v2 merged IDCT: islow ENT: huff ./djpeg -dct int -nosmooth -rgb565 -bmp -outfile testout_420m_islow_565D.bmp $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_BMP_420M_ISLOW_565D) testout_420m_islow_565D.bmp - rm testout_420m_islow_565D.bmp + rm -f testout_420m_islow_565D.bmp +endif + +# Partial decode tests. These tests are designed to cover all of the possible +# code paths in jpeg_skip_scanlines(). + +# Context rows: Yes Intra-iMCU row: Yes iMCU row prefetch: No ENT: huff + ./djpeg -dct int -skip 15,31 -ppm -outfile testout_420_islow_skip15,31.ppm $(srcdir)/testimages/$(TESTORIG) + md5/md5cmp $(MD5_PPM_420_ISLOW_SKIP15_31) testout_420_islow_skip15,31.ppm + rm -f testout_420_islow_skip15,31.ppm +# Context rows: Yes Intra-iMCU row: No iMCU row prefetch: Yes ENT: arith +if WITH_ARITH_DEC + ./djpeg -dct int -skip 16,139 -ppm -outfile testout_420_islow_ari_skip16,139.ppm $(srcdir)/testimages/testimgari.jpg + md5/md5cmp $(MD5_PPM_420_ISLOW_ARI_SKIP16_139) testout_420_islow_ari_skip16,139.ppm + rm -f testout_420_islow_ari_skip16,139.ppm +endif +# Context rows: Yes Intra-iMCU row: No iMCU row prefetch: No ENT: prog huff + ./cjpeg -revert -dct int -prog -outfile testout_420_islow_prog.jpg $(srcdir)/testimages/testorig.ppm + ./djpeg -dct int -crop 62x62+71+71 -ppm -outfile testout_420_islow_prog_crop62x62,71,71.ppm testout_420_islow_prog.jpg + md5/md5cmp $(MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71) testout_420_islow_prog_crop62x62,71,71.ppm + rm -f testout_420_islow_prog_crop62x62,71,71.ppm testout_420_islow_prog.jpg +# Context rows: Yes Intra-iMCU row: No iMCU row prefetch: No ENT: arith +if WITH_ARITH_DEC + ./djpeg -dct int -crop 53x53+4+4 -ppm -outfile testout_420_islow_ari_crop53x53,4,4.ppm $(srcdir)/testimages/testimgari.jpg + md5/md5cmp $(MD5_PPM_420_ISLOW_ARI_CROP53x53_4_4) testout_420_islow_ari_crop53x53,4,4.ppm + rm -f testout_420_islow_ari_crop53x53,4,4.ppm +endif +# Context rows: No Intra-iMCU row: Yes ENT: huff + ./cjpeg -revert -dct int -sample 1x1 -outfile testout_444_islow.jpg $(srcdir)/testimages/testorig.ppm + ./djpeg -dct int -skip 1,6 -ppm -outfile testout_444_islow_skip1,6.ppm testout_444_islow.jpg + md5/md5cmp $(MD5_PPM_444_ISLOW_SKIP1_6) testout_444_islow_skip1,6.ppm + rm -f testout_444_islow_skip1,6.ppm testout_444_islow.jpg +# Context rows: No Intra-iMCU row: No ENT: prog huff + ./cjpeg -revert -dct int -prog -sample 1x1 -outfile testout_444_islow_prog.jpg $(srcdir)/testimages/testorig.ppm + ./djpeg -dct int -crop 98x98+13+13 -ppm -outfile testout_444_islow_prog_crop98x98,13,13.ppm testout_444_islow_prog.jpg + md5/md5cmp $(MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13) testout_444_islow_prog_crop98x98,13,13.ppm + rm -f testout_444_islow_prog_crop98x98,13,13.ppm testout_444_islow_prog.jpg +# Context rows: No Intra-iMCU row: No ENT: arith +if WITH_ARITH_ENC + ./cjpeg -revert -dct int -arithmetic -sample 1x1 -outfile testout_444_islow_ari.jpg $(srcdir)/testimages/testorig.ppm +if WITH_ARITH_DEC + ./djpeg -dct int -crop 37x37+0+0 -ppm -outfile testout_444_islow_ari_crop37x37,0,0.ppm testout_444_islow_ari.jpg + md5/md5cmp $(MD5_PPM_444_ISLOW_ARI_CROP37x37_0_0) testout_444_islow_ari_crop37x37,0,0.ppm + rm -f testout_444_islow_ari_crop37x37,0,0.ppm +endif + rm -f testout_444_islow_ari.jpg endif ./jpegtran -revert -crop 120x90+20+50 -transpose -perfect -outfile testout_crop.jpg $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_JPEG_CROP) testout_crop.jpg - rm testout_crop.jpg + rm -f testout_crop.jpg echo GREAT SUCCESS! diff --git a/README-turbo.txt b/README-turbo.txt index 28b6c4db..6a2b595e 100644 --- a/README-turbo.txt +++ b/README-turbo.txt @@ -1,14 +1,13 @@ -******************************************************************************* -** Background -******************************************************************************* +Background +========== libjpeg-turbo is a JPEG image codec that uses SIMD instructions (MMX, SSE2, -NEON) to accelerate baseline JPEG compression and decompression on x86, x86-64, -and ARM systems. On such systems, libjpeg-turbo is generally 2-4x as fast as -libjpeg, all else being equal. On other types of systems, libjpeg-turbo can -still outperform libjpeg by a significant amount, by virtue of its -highly-optimized Huffman coding routines. In many cases, the performance of -libjpeg-turbo rivals that of proprietary high-speed JPEG codecs. +NEON, AltiVec) to accelerate baseline JPEG compression and decompression on +x86, x86-64, ARM, and PowerPC systems. On such systems, libjpeg-turbo is +generally 2-6x as fast as libjpeg, all else being equal. On other types of +systems, libjpeg-turbo can still outperform libjpeg by a significant amount, by +virtue of its highly-optimized Huffman coding routines. In many cases, the +performance of libjpeg-turbo rivals that of proprietary high-speed JPEG codecs. libjpeg-turbo implements both the traditional libjpeg API as well as the less powerful but more straightforward TurboJPEG API. libjpeg-turbo also features @@ -24,59 +23,64 @@ of making high-speed JPEG compression/decompression technology available to a broader range of users and developers. -******************************************************************************* -** License -******************************************************************************* +License +======= libjpeg-turbo is covered by three compatible BSD-style open source licenses. -Refer to LICENSE.txt for a roll-up of license terms. +Refer to [LICENSE.md](LICENSE.md) for a roll-up of license terms. -******************************************************************************* -** Using libjpeg-turbo -******************************************************************************* +Building libjpeg-turbo +====================== + +Refer to [BUILDING.md](BUILDING.md) for complete instructions. + + +Using libjpeg-turbo +=================== libjpeg-turbo includes two APIs that can be used to compress and decompress JPEG images: - TurboJPEG API: This API provides an easy-to-use interface for compressing - and decompressing JPEG images in memory. It also provides some functionality - that would not be straightforward to achieve using the underlying libjpeg - API, such as generating planar YUV images and performing multiple - simultaneous lossless transforms on an image. The Java interface for - libjpeg-turbo is written on top of the TurboJPEG API. +- **TurboJPEG API** + This API provides an easy-to-use interface for compressing and decompressing + JPEG images in memory. It also provides some functionality that would not be + straightforward to achieve using the underlying libjpeg API, such as + generating planar YUV images and performing multiple simultaneous lossless + transforms on an image. The Java interface for libjpeg-turbo is written on + top of the TurboJPEG API. - libjpeg API: This is the de facto industry-standard API for compressing and - decompressing JPEG images. It is more difficult to use than the TurboJPEG - API but also more powerful. The libjpeg API implementation in libjpeg-turbo - is both API/ABI-compatible and mathematically compatible with libjpeg v6b. - It can also optionally be configured to be API/ABI-compatible with libjpeg v7 - and v8 (see below.) +- **libjpeg API** + This is the de facto industry-standard API for compressing and decompressing + JPEG images. It is more difficult to use than the TurboJPEG API but also + more powerful. The libjpeg API implementation in libjpeg-turbo is both + API/ABI-compatible and mathematically compatible with libjpeg v6b. It can + also optionally be configured to be API/ABI-compatible with libjpeg v7 and v8 + (see below.) There is no significant performance advantage to either API when both are used to perform similar operations. -===================== Colorspace Extensions -===================== +--------------------- libjpeg-turbo includes extensions that allow JPEG images to be compressed directly from (and decompressed directly to) buffers that use BGR, BGRX, RGBX, XBGR, and XRGB pixel ordering. This is implemented with ten new colorspace constants: - JCS_EXT_RGB /* red/green/blue */ - JCS_EXT_RGBX /* red/green/blue/x */ - JCS_EXT_BGR /* blue/green/red */ - JCS_EXT_BGRX /* blue/green/red/x */ - JCS_EXT_XBGR /* x/blue/green/red */ - JCS_EXT_XRGB /* x/red/green/blue */ - JCS_EXT_RGBA /* red/green/blue/alpha */ - JCS_EXT_BGRA /* blue/green/red/alpha */ - JCS_EXT_ABGR /* alpha/blue/green/red */ - JCS_EXT_ARGB /* alpha/red/green/blue */ + JCS_EXT_RGB /* red/green/blue */ + JCS_EXT_RGBX /* red/green/blue/x */ + JCS_EXT_BGR /* blue/green/red */ + JCS_EXT_BGRX /* blue/green/red/x */ + JCS_EXT_XBGR /* x/blue/green/red */ + JCS_EXT_XRGB /* x/red/green/blue */ + JCS_EXT_RGBA /* red/green/blue/alpha */ + JCS_EXT_BGRA /* blue/green/red/alpha */ + JCS_EXT_ABGR /* alpha/blue/green/red */ + JCS_EXT_ARGB /* alpha/red/green/blue */ -Setting cinfo.in_color_space (compression) or cinfo.out_color_space +Setting `cinfo.in_color_space` (compression) or `cinfo.out_color_space` (decompression) to one of these values will cause libjpeg-turbo to read the red, green, and blue values from (or write them to) the appropriate position in the pixel when compressing from/decompressing to an RGB buffer. @@ -84,7 +88,7 @@ the pixel when compressing from/decompressing to an RGB buffer. Your application can check for the existence of these extensions at compile time with: - #ifdef JCS_EXTENSIONS + #ifdef JCS_EXTENSIONS At run time, attempting to use these extensions with a libjpeg implementation that does not support them will result in a "Bogus input colorspace" error. @@ -94,21 +98,22 @@ available for the colorspace extensions. When using the RGBX, BGRX, XBGR, and XRGB colorspaces during decompression, the X byte is undefined, and in order to ensure the best performance, libjpeg-turbo can set that byte to whatever value it wishes. If an application expects the X -byte to be used as an alpha channel, then it should specify JCS_EXT_RGBA, -JCS_EXT_BGRA, JCS_EXT_ABGR, or JCS_EXT_ARGB. When these colorspace constants -are used, the X byte is guaranteed to be 0xFF, which is interpreted as opaque. +byte to be used as an alpha channel, then it should specify `JCS_EXT_RGBA`, +`JCS_EXT_BGRA`, `JCS_EXT_ABGR`, or `JCS_EXT_ARGB`. When these colorspace +constants are used, the X byte is guaranteed to be 0xFF, which is interpreted +as opaque. Your application can check for the existence of the alpha channel colorspace extensions at compile time with: - #ifdef JCS_ALPHA_EXTENSIONS + #ifdef JCS_ALPHA_EXTENSIONS -jcstest.c, located in the libjpeg-turbo source tree, demonstrates how to check -for the existence of the colorspace extensions at compile time and run time. +[jcstest.c](jcstest.c), located in the libjpeg-turbo source tree, demonstrates +how to check for the existence of the colorspace extensions at compile time and +run time. -=================================== libjpeg v7 and v8 API/ABI Emulation -=================================== +----------------------------------- With libjpeg v7 and v8, new features were added that necessitated extending the compression and decompression structures. Unfortunately, due to the exposed @@ -125,125 +130,123 @@ without recompiling. libjpeg-turbo does not claim to support all of the libjpeg v7+ features, nor to produce identical output to libjpeg v7+ in all cases (see below.) -By passing an argument of --with-jpeg7 or --with-jpeg8 to configure, or an -argument of -DWITH_JPEG7=1 or -DWITH_JPEG8=1 to cmake, you can build a version -of libjpeg-turbo that emulates the libjpeg v7 or v8 ABI, so that programs -that are built against libjpeg v7 or v8 can be run with libjpeg-turbo. The -following section describes which libjpeg v7+ features are supported and which -aren't. +By passing an argument of `--with-jpeg7` or `--with-jpeg8` to `configure`, or +an argument of `-DWITH_JPEG7=1` or `-DWITH_JPEG8=1` to `cmake`, you can build a +version of libjpeg-turbo that emulates the libjpeg v7 or v8 ABI, so that +programs that are built against libjpeg v7 or v8 can be run with libjpeg-turbo. +The following section describes which libjpeg v7+ features are supported and +which aren't. -Support for libjpeg v7 and v8 Features: ---------------------------------------- +### Support for libjpeg v7 and v8 Features -Fully supported: +#### Fully supported --- libjpeg: IDCT scaling extensions in decompressor - libjpeg-turbo supports IDCT scaling with scaling factors of 1/8, 1/4, 3/8, - 1/2, 5/8, 3/4, 7/8, 9/8, 5/4, 11/8, 3/2, 13/8, 7/4, 15/8, and 2/1 (only 1/4 - and 1/2 are SIMD-accelerated.) +- **libjpeg: IDCT scaling extensions in decompressor** + libjpeg-turbo supports IDCT scaling with scaling factors of 1/8, 1/4, 3/8, + 1/2, 5/8, 3/4, 7/8, 9/8, 5/4, 11/8, 3/2, 13/8, 7/4, 15/8, and 2/1 (only 1/4 + and 1/2 are SIMD-accelerated.) --- libjpeg: arithmetic coding +- **libjpeg: Arithmetic coding** --- libjpeg: In-memory source and destination managers - See notes below. +- **libjpeg: In-memory source and destination managers** + See notes below. --- cjpeg: Separate quality settings for luminance and chrominance - Note that the libpjeg v7+ API was extended to accommodate this feature only - for convenience purposes. It has always been possible to implement this - feature with libjpeg v6b (see rdswitch.c for an example.) +- **cjpeg: Separate quality settings for luminance and chrominance** + Note that the libpjeg v7+ API was extended to accommodate this feature only + for convenience purposes. It has always been possible to implement this + feature with libjpeg v6b (see rdswitch.c for an example.) --- cjpeg: 32-bit BMP support +- **cjpeg: 32-bit BMP support** --- cjpeg: -rgb option +- **cjpeg: `-rgb` option** --- jpegtran: lossless cropping +- **jpegtran: Lossless cropping** --- jpegtran: -perfect option +- **jpegtran: `-perfect` option** --- jpegtran: forcing width/height when performing lossless crop +- **jpegtran: Forcing width/height when performing lossless crop** --- rdjpgcom: -raw option +- **rdjpgcom: `-raw` option** --- rdjpgcom: locale awareness +- **rdjpgcom: Locale awareness** -Not supported: +#### Not supported NOTE: As of this writing, extensive research has been conducted into the usefulness of DCT scaling as a means of data reduction and SmartScale as a means of quality improvement. The reader is invited to peruse the research at -http://www.libjpeg-turbo.org/About/SmartScale and draw his/her own conclusions, + and draw his/her own conclusions, but it is the general belief of our project that these features have not demonstrated sufficient usefulness to justify inclusion in libjpeg-turbo. --- libjpeg: DCT scaling in compressor - cinfo.scale_num and cinfo.scale_denom are silently ignored. - There is no technical reason why DCT scaling could not be supported when - emulating the libjpeg v7+ API/ABI, but without the SmartScale extension (see - below), only scaling factors of 1/2, 8/15, 4/7, 8/13, 2/3, 8/11, 4/5, and - 8/9 would be available, which is of limited usefulness. +- **libjpeg: DCT scaling in compressor** + `cinfo.scale_num` and `cinfo.scale_denom` are silently ignored. + There is no technical reason why DCT scaling could not be supported when + emulating the libjpeg v7+ API/ABI, but without the SmartScale extension (see + below), only scaling factors of 1/2, 8/15, 4/7, 8/13, 2/3, 8/11, 4/5, and + 8/9 would be available, which is of limited usefulness. --- libjpeg: SmartScale - cinfo.block_size is silently ignored. - SmartScale is an extension to the JPEG format that allows for DCT block - sizes other than 8x8. Providing support for this new format would be - feasible (particularly without full acceleration.) However, until/unless - the format becomes either an official industry standard or, at minimum, an - accepted solution in the community, we are hesitant to implement it, as - there is no sense of whether or how it might change in the future. It is - our belief that SmartScale has not demonstrated sufficient usefulness as a - lossless format nor as a means of quality enhancement, and thus, our primary - interest in providing this feature would be as a means of supporting - additional DCT scaling factors. +- **libjpeg: SmartScale** + `cinfo.block_size` is silently ignored. + SmartScale is an extension to the JPEG format that allows for DCT block + sizes other than 8x8. Providing support for this new format would be + feasible (particularly without full acceleration.) However, until/unless + the format becomes either an official industry standard or, at minimum, an + accepted solution in the community, we are hesitant to implement it, as + there is no sense of whether or how it might change in the future. It is + our belief that SmartScale has not demonstrated sufficient usefulness as a + lossless format nor as a means of quality enhancement, and thus our primary + interest in providing this feature would be as a means of supporting + additional DCT scaling factors. --- libjpeg: Fancy downsampling in compressor - cinfo.do_fancy_downsampling is silently ignored. - This requires the DCT scaling feature, which is not supported. +- **libjpeg: Fancy downsampling in compressor** + `cinfo.do_fancy_downsampling` is silently ignored. + This requires the DCT scaling feature, which is not supported. --- jpegtran: Scaling - This requires both the DCT scaling and SmartScale features, which are not - supported. +- **jpegtran: Scaling** + This requires both the DCT scaling and SmartScale features, which are not + supported. --- Lossless RGB JPEG files - This requires the SmartScale feature, which is not supported. +- **Lossless RGB JPEG files** + This requires the SmartScale feature, which is not supported. -What About libjpeg v9? ----------------------- +### What About libjpeg v9? libjpeg v9 introduced yet another field to the JPEG compression structure -(color_transform), thus making the ABI backward incompatible with that of +(`color_transform`), thus making the ABI backward incompatible with that of libjpeg v8. This new field was introduced solely for the purpose of supporting -lossless SmartScale encoding. Further, there was actually no reason to extend -the API in this manner, as the color transform could have just as easily been -activated by way of a new JPEG colorspace constant, thus preserving backward -ABI compatibility. +lossless SmartScale encoding. Furthermore, there was actually no reason to +extend the API in this manner, as the color transform could have just as easily +been activated by way of a new JPEG colorspace constant, thus preserving +backward ABI compatibility. Our research (see link above) has shown that lossless SmartScale does not generally accomplish anything that can't already be accomplished better with -existing, standard lossless formats. Thus, at this time, it is our belief that -there is not sufficient technical justification for software to upgrade from -libjpeg v8 to libjpeg v9, and therefore, not sufficient technical justification -for us to emulate the libjpeg v9 ABI. +existing, standard lossless formats. Therefore, at this time it is our belief +that there is not sufficient technical justification for software projects to +upgrade from libjpeg v8 to libjpeg v9, and thus there is not sufficient +echnical justification for us to emulate the libjpeg v9 ABI. -===================================== In-Memory Source/Destination Managers -===================================== +------------------------------------- -By default, libjpeg-turbo 1.3 and later includes the jpeg_mem_src() and -jpeg_mem_dest() functions, even when not emulating the libjpeg v8 API/ABI. +By default, libjpeg-turbo 1.3 and later includes the `jpeg_mem_src()` and +`jpeg_mem_dest()` functions, even when not emulating the libjpeg v8 API/ABI. Previously, it was necessary to build libjpeg-turbo from source with libjpeg v8 API/ABI emulation in order to use the in-memory source/destination managers, but several projects requested that those functions be included when emulating the libjpeg v6b API/ABI as well. This allows the use of those functions by -programs that need them without breaking ABI compatibility for programs that +programs that need them, without breaking ABI compatibility for programs that don't, and it allows those functions to be provided in the "official" libjpeg-turbo binaries. Those who are concerned about maintaining strict conformance with the libjpeg -v6b or v7 API can pass an argument of --without-mem-srcdst to configure or -an argument of -DWITH_MEM_SRCDST=0 to CMake prior to building libjpeg-turbo. -This will restore the pre-1.3 behavior, in which jpeg_mem_src() and -jpeg_mem_dest() are only included when emulating the libjpeg v8 API/ABI. +v6b or v7 API can pass an argument of `--without-mem-srcdst` to `configure` or +an argument of `-DWITH_MEM_SRCDST=0` to `cmake` prior to building +libjpeg-turbo. This will restore the pre-1.3 behavior, in which +`jpeg_mem_src()` and `jpeg_mem_dest()` are only included when emulating the +libjpeg v8 API/ABI. On Un*x systems, including the in-memory source/destination managers changes the dynamic library version from 62.0.0 to 62.1.0 if using libjpeg v6b API/ABI @@ -251,72 +254,72 @@ emulation and from 7.0.0 to 7.1.0 if using libjpeg v7 API/ABI emulation. Note that, on most Un*x systems, the dynamic linker will not look for a function in a library until that function is actually used. Thus, if a program -is built against libjpeg-turbo 1.3+ and uses jpeg_mem_src() or jpeg_mem_dest(), -that program will not fail if run against an older version of libjpeg-turbo or -against libjpeg v7- until the program actually tries to call jpeg_mem_src() or -jpeg_mem_dest(). Such is not the case on Windows. If a program is built -against the libjpeg-turbo 1.3+ DLL and uses jpeg_mem_src() or jpeg_mem_dest(), -then it must use the libjpeg-turbo 1.3+ DLL at run time. +is built against libjpeg-turbo 1.3+ and uses `jpeg_mem_src()` or +`jpeg_mem_dest()`, that program will not fail if run against an older version +of libjpeg-turbo or against libjpeg v7- until the program actually tries to +call `jpeg_mem_src()` or `jpeg_mem_dest()`. Such is not the case on Windows. +If a program is built against the libjpeg-turbo 1.3+ DLL and uses +`jpeg_mem_src()` or `jpeg_mem_dest()`, then it must use the libjpeg-turbo 1.3+ +DLL at run time. Both cjpeg and djpeg have been extended to allow testing the in-memory source/destination manager functions. See their respective man pages for more details. -******************************************************************************* -** Mathematical Compatibility -******************************************************************************* +Mathematical Compatibility +========================== For the most part, libjpeg-turbo should produce identical output to libjpeg v6b. The one exception to this is when using the floating point DCT/IDCT, in which case the outputs of libjpeg v6b and libjpeg-turbo can differ for the following reasons: --- The SSE/SSE2 floating point DCT implementation in libjpeg-turbo is ever so - slightly more accurate than the implementation in libjpeg v6b, but not by - any amount perceptible to human vision (generally in the range of 0.01 to - 0.08 dB gain in PNSR.) --- When not using the SIMD extensions, libjpeg-turbo uses the more accurate - (and slightly faster) floating point IDCT algorithm introduced in libjpeg - v8a as opposed to the algorithm used in libjpeg v6b. It should be noted, - however, that this algorithm basically brings the accuracy of the floating - point IDCT in line with the accuracy of the slow integer IDCT. The floating - point DCT/IDCT algorithms are mainly a legacy feature, and they do not - produce significantly more accuracy than the slow integer algorithms (to put - numbers on this, the typical difference in PNSR between the two algorithms - is less than 0.10 dB, whereas changing the quality level by 1 in the upper - range of the quality scale is typically more like a 1.0 dB difference.) --- If the floating point algorithms in libjpeg-turbo are not implemented using - SIMD instructions on a particular platform, then the accuracy of the - floating point DCT/IDCT can depend on the compiler settings. +- The SSE/SSE2 floating point DCT implementation in libjpeg-turbo is ever so + slightly more accurate than the implementation in libjpeg v6b, but not by + any amount perceptible to human vision (generally in the range of 0.01 to + 0.08 dB gain in PNSR.) -While libjpeg-turbo does emulate the libjpeg v8 API/ABI, under the hood, it is +- When not using the SIMD extensions, libjpeg-turbo uses the more accurate + (and slightly faster) floating point IDCT algorithm introduced in libjpeg + v8a as opposed to the algorithm used in libjpeg v6b. It should be noted, + however, that this algorithm basically brings the accuracy of the floating + point IDCT in line with the accuracy of the slow integer IDCT. The floating + point DCT/IDCT algorithms are mainly a legacy feature, and they do not + produce significantly more accuracy than the slow integer algorithms (to put + numbers on this, the typical difference in PNSR between the two algorithms + is less than 0.10 dB, whereas changing the quality level by 1 in the upper + range of the quality scale is typically more like a 1.0 dB difference.) + +- If the floating point algorithms in libjpeg-turbo are not implemented using + SIMD instructions on a particular platform, then the accuracy of the + floating point DCT/IDCT can depend on the compiler settings. + +While libjpeg-turbo does emulate the libjpeg v8 API/ABI, under the hood it is still using the same algorithms as libjpeg v6b, so there are several specific cases in which libjpeg-turbo cannot be expected to produce the same output as libjpeg v8: --- When decompressing using scaling factors of 1/2 and 1/4, because libjpeg v8 - implements those scaling algorithms differently than libjpeg v6b does, and - libjpeg-turbo's SIMD extensions are based on the libjpeg v6b behavior. +- When decompressing using scaling factors of 1/2 and 1/4, because libjpeg v8 + implements those scaling algorithms differently than libjpeg v6b does, and + libjpeg-turbo's SIMD extensions are based on the libjpeg v6b behavior. --- When using chrominance subsampling, because libjpeg v8 implements this - with its DCT/IDCT scaling algorithms rather than with a separate - downsampling/upsampling algorithm. In our testing, the subsampled/upsampled - output of libjpeg v8 is less accurate than that of libjpeg v6b for this - reason. +- When using chrominance subsampling, because libjpeg v8 implements this + with its DCT/IDCT scaling algorithms rather than with a separate + downsampling/upsampling algorithm. In our testing, the subsampled/upsampled + output of libjpeg v8 is less accurate than that of libjpeg v6b for this + reason. --- When decompressing using a scaling factor > 1 and merged (AKA "non-fancy" or - "non-smooth") chrominance upsampling, because libjpeg v8 does not support - merged upsampling with scaling factors > 1. +- When decompressing using a scaling factor > 1 and merged (AKA "non-fancy" or + "non-smooth") chrominance upsampling, because libjpeg v8 does not support + merged upsampling with scaling factors > 1. -******************************************************************************* -** Performance Pitfalls -******************************************************************************* +Performance Pitfalls +==================== -=============== Restart Markers -=============== +--------------- The optimized Huffman decoder in libjpeg-turbo does not handle restart markers in a way that makes the rest of the libjpeg infrastructure happy, so it is @@ -327,9 +330,8 @@ libjpeg. Many consumer packages, such as PhotoShop, use restart markers when generating JPEG images, so images generated by those programs will experience this issue. -=============================================== Fast Integer Forward DCT at High Quality Levels -=============================================== +----------------------------------------------- The algorithm used by the SIMD-accelerated quantization function cannot produce correct results whenever the fast integer forward DCT is used along with a JPEG @@ -337,3 +339,4 @@ quality of 98-100. Thus, libjpeg-turbo must use the non-SIMD quantization function in those cases. This causes performance to drop by as much as 40%. It is therefore strongly advised that you use the slow integer forward DCT whenever encoding images with a JPEG quality of 98 or higher. + diff --git a/README b/README.ijg similarity index 94% rename from README rename to README.ijg index e82a095b..9c450ceb 100644 --- a/README +++ b/README.ijg @@ -1,7 +1,7 @@ libjpeg-turbo note: This file has been modified by The libjpeg-turbo Project to include only information relevant to libjpeg-turbo, to wordsmith certain sections, and to remove impolitic language that existed in the libjpeg v8 -README. It is included only for reference. Please see README-turbo.txt for +README. It is included only for reference. Please see README.md for information specific to libjpeg-turbo. @@ -128,7 +128,7 @@ with respect to this software, its quality, accuracy, merchantability, or fitness for a particular purpose. This software is provided "AS IS", and you, its user, assume the entire risk as to its quality and accuracy. -This software is copyright (C) 1991-2012, Thomas G. Lane, Guido Vollbeding. +This software is copyright (C) 1991-2016, Thomas G. Lane, Guido Vollbeding. All Rights Reserved except as specified below. Permission is hereby granted to use, copy, modify, and distribute this @@ -166,11 +166,11 @@ ltmain.sh). Another support script, install-sh, is copyright by X Consortium but is also freely distributable. The IJG distribution formerly included code to read and write GIF files. -To avoid entanglement with the Unisys LZW patent, GIF reading support has -been removed altogether, and the GIF writer has been simplified to produce -"uncompressed GIFs". This technique does not use the LZW algorithm; the -resulting GIF files are larger than usual, but are readable by all standard -GIF decoders. +To avoid entanglement with the Unisys LZW patent (now expired), GIF reading +support has been removed altogether, and the GIF writer has been simplified +to produce "uncompressed GIFs". This technique does not use the LZW +algorithm; the resulting GIF files are larger than usual, but are readable +by all standard GIF decoders. We are required to state that "The Graphics Interchange Format(c) is the Copyright property of @@ -189,8 +189,8 @@ The best short technical introduction to the JPEG compression algorithm is Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44. (Adjacent articles in that issue discuss MPEG motion picture compression, applications of JPEG, and related topics.) If you don't have the CACM issue -handy, a PostScript file containing a revised version of Wallace's article is -available at http://www.ijg.org/files/wallace.ps.gz. The file (actually +handy, a PDF file containing a revised version of Wallace's article is +available at http://www.ijg.org/files/Wallace.JPEG.pdf. The file (actually a preprint for an article that appeared in IEEE Trans. Consumer Electronics) omits the sample images that appeared in CACM, but it includes corrections and some added material. Note: the Wallace article is copyright ACM and IEEE, @@ -246,9 +246,7 @@ ARCHIVE LOCATIONS The "official" archive site for this software is www.ijg.org. The most recent released version can always be found there in -directory "files". This particular version will be archived as -http://www.ijg.org/files/jpegsrc.v8d.tar.gz, and in Windows-compatible -"zip" archive format as http://www.ijg.org/files/jpegsr8d.zip. +directory "files". The JPEG FAQ (Frequently Asked Questions) article is a source of some general information about JPEG. diff --git a/acinclude.m4 b/acinclude.m4 index 4a130825..2c907620 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -3,8 +3,11 @@ # Check that NASM exists and determine flags AC_DEFUN([AC_PROG_NASM],[ -AC_CHECK_PROGS(NASM, [nasm nasmw yasm]) -test -z "$NASM" && AC_MSG_ERROR([no nasm (Netwide Assembler) found]) +AC_ARG_VAR(NASM, [NASM command (used to build the x86/x86-64 SIMD code)]) +if test "x$NASM" = "x"; then + AC_CHECK_PROGS(NASM, [nasm nasmw yasm]) + test -z "$NASM" && AC_MSG_ERROR([no nasm (Netwide Assembler) found]) +fi AC_MSG_CHECKING([for object file format of host system]) case "$host_os" in @@ -219,16 +222,20 @@ AC_DEFUN([AC_CHECK_COMPATIBLE_ARM64_ASSEMBLER_IFELSE],[ CC="$CCAS" AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ .text - .arch armv8-a+fp+simd - movi v0.16b, #100]])], ac_good_gnu_arm_assembler=yes) + MYVAR .req x0 + movi v0.16b, #100 + mov MYVAR, #100 + .unreq MYVAR]])], ac_good_gnu_arm_assembler=yes) ac_use_gas_preprocessor=no if test "x$ac_good_gnu_arm_assembler" = "xno" ; then CC="gas-preprocessor.pl $CCAS" AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ .text - .arch armv8-a+fp+simd - movi v0.16b, #100]])], ac_use_gas_preprocessor=yes) + MYVAR .req x0 + movi v0.16b, #100 + mov MYVAR, #100 + .unreq MYVAR]])], ac_use_gas_preprocessor=yes) fi CFLAGS="$ac_save_CFLAGS" CC="$ac_save_CC" diff --git a/cderror.h b/cderror.h index 77b8eb64..a6875dcd 100644 --- a/cderror.h +++ b/cderror.h @@ -4,7 +4,8 @@ * Copyright (C) 1994-1997, Thomas G. Lane. * Modified 2009 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. + * For conditions of distribution and use, see the accompanying README.ijg + * file. * * This file defines the error and message codes for the cjpeg/djpeg * applications. These strings are not needed as part of the JPEG library diff --git a/cdjpeg.c b/cdjpeg.c index 7cc0d6e8..441d6714 100644 --- a/cdjpeg.c +++ b/cdjpeg.c @@ -5,7 +5,8 @@ * Copyright (C) 1991-1997, Thomas G. Lane. * It was modified by The libjpeg-turbo Project to include only code relevant * to libjpeg-turbo. - * For conditions of distribution and use, see the accompanying README file. + * For conditions of distribution and use, see the accompanying README.ijg + * file. * * This file contains common support routines used by the IJG application * programs (cjpeg, djpeg, jpegtran). @@ -81,7 +82,7 @@ end_progress_monitor (j_common_ptr cinfo) */ GLOBAL(boolean) -keymatch (char * arg, const char * keyword, int minchars) +keymatch (char *arg, const char *keyword, int minchars) { register int ca, ck; register int nmatched = 0; diff --git a/cdjpeg.h b/cdjpeg.h index 92e6e381..720001ea 100644 --- a/cdjpeg.h +++ b/cdjpeg.h @@ -7,7 +7,7 @@ * to libjpeg-turbo. * mozjpeg Modifications: * Copyright (C) 2014, Mozilla Corporation. - * For conditions of distribution and use, see the accompanying README file. + * For conditions of distribution and use, see the accompanying README.ijg file. * * This file contains common declarations for the sample applications * cjpeg and djpeg. It is NOT used by the core JPEG library. @@ -26,7 +26,7 @@ * Object interface for cjpeg's source file decoding modules */ -typedef struct cjpeg_source_struct * cjpeg_source_ptr; +typedef struct cjpeg_source_struct *cjpeg_source_ptr; struct cjpeg_source_struct { void (*start_input) (j_compress_ptr cinfo, cjpeg_source_ptr sinfo); @@ -51,7 +51,7 @@ struct cjpeg_source_struct { * Object interface for djpeg's output file encoding modules */ -typedef struct djpeg_dest_struct * djpeg_dest_ptr; +typedef struct djpeg_dest_struct *djpeg_dest_ptr; struct djpeg_dest_struct { /* start_output is called after jpeg_start_decompress finishes. @@ -65,7 +65,7 @@ struct djpeg_dest_struct { void (*finish_output) (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo); /* Target file spec; filled in by djpeg.c after object is created. */ - FILE * output_file; + FILE *output_file; /* Output pixel-row buffer. Created by module init or start_output. * Width is cinfo->output_width * cinfo->output_components; @@ -92,7 +92,7 @@ struct cdjpeg_progress_mgr { int percent_done; }; -typedef struct cdjpeg_progress_mgr * cd_progress_ptr; +typedef struct cdjpeg_progress_mgr *cd_progress_ptr; /* Module selection routines for I/O modules. */ @@ -113,9 +113,9 @@ EXTERN(djpeg_dest_ptr) jinit_write_targa (j_decompress_ptr cinfo); /* cjpeg support routines (in rdswitch.c) */ -EXTERN(boolean) read_quant_tables (j_compress_ptr cinfo, char * filename, +EXTERN(boolean) read_quant_tables (j_compress_ptr cinfo, char *filename, boolean force_baseline); -EXTERN(boolean) read_scan_script (j_compress_ptr cinfo, char * filename); +EXTERN(boolean) read_scan_script (j_compress_ptr cinfo, char *filename); EXTERN(boolean) set_quality_ratings (j_compress_ptr cinfo, char *arg, boolean force_baseline); EXTERN(boolean) set_quant_slots (j_compress_ptr cinfo, char *arg); @@ -123,7 +123,7 @@ EXTERN(boolean) set_sample_factors (j_compress_ptr cinfo, char *arg); /* djpeg support routines (in rdcolmap.c) */ -EXTERN(void) read_color_map (j_decompress_ptr cinfo, FILE * infile); +EXTERN(void) read_color_map (j_decompress_ptr cinfo, FILE *infile); /* common support routines (in cdjpeg.c) */ @@ -131,7 +131,7 @@ EXTERN(void) enable_signal_catcher (j_common_ptr cinfo); EXTERN(void) start_progress_monitor (j_common_ptr cinfo, cd_progress_ptr progress); EXTERN(void) end_progress_monitor (j_common_ptr cinfo); -EXTERN(boolean) keymatch (char * arg, const char * keyword, int minchars); +EXTERN(boolean) keymatch (char *arg, const char *keyword, int minchars); EXTERN(FILE *) read_stdin (void); EXTERN(FILE *) write_stdout (void); diff --git a/change.log b/change.log index b60ddd68..f090d778 100644 --- a/change.log +++ b/change.log @@ -1,9 +1,28 @@ -NOTE: This file was modified by The libjpeg-turbo Project to include only -information relevant to libjpeg-turbo. +libjpeg-turbo note: This file has been modified by The libjpeg-turbo Project +to include only information relevant to libjpeg-turbo. It is included only for +reference. Please see ChangeLog.md for information specific to libjpeg-turbo. + CHANGE LOG for Independent JPEG Group's JPEG software +Version 9b 17-Jan-2016 +----------------------- + +Document 'f' specifier for jpegtran -crop specification. +Thank to Michele Martone for suggestion. + + +Version 9 13-Jan-2013 +---------------------- + +Add remark for jpeg_mem_dest() in jdatadst.c. +Thank to Elie-Gregoire Khoury for the hint. + +Correct argument type in format string, avoid compiler warnings. +Thank to Vincent Torri for hint. + + Version 8d 15-Jan-2012 ----------------------- diff --git a/cjpeg.1 b/cjpeg.1 index e338c80c..d1dc3041 100644 --- a/cjpeg.1 +++ b/cjpeg.1 @@ -1,4 +1,4 @@ -.TH CJPEG 1 "21 November 2014" +.TH CJPEG 1 "17 February 2016" .SH NAME cjpeg \- compress an image file to a JPEG file .SH SYNOPSIS @@ -85,8 +85,8 @@ reconstructed image: the higher the quality setting, the larger the JPEG file, and the closer the output image will be to the original input. Normally you want to use the lowest quality setting (smallest file) that decompresses into something visually indistinguishable from the original image. For this -purpose the quality setting should be between 50 and 95; the default of 75 is -often about right. If you see defects at +purpose the quality setting should generally be between 50 and 95 (the default +is 75) for photographic images. If you see defects at .B \-quality 75, then go up 5 or 10 counts at a time until you are happy with the output image. (The optimal setting will vary from one image to another.) @@ -94,11 +94,10 @@ image. (The optimal setting will vary from one image to another.) .B \-quality 100 will generate a quantization table of all 1's, minimizing loss in the quantization step (but there is still information loss in subsampling, as well -as roundoff error). This setting is mainly of interest for experimental -purposes. Quality values above about 95 are -.B not -recommended for normal use; the compressed file size goes up dramatically for -hardly any gain in output image quality. +as roundoff error.) For most images, specifying a quality value above +about 95 will increase the size of the compressed file dramatically, and while +the quality gain from these higher quality values is measurable (using metrics +such as PSNR or SSIM), it is rarely perceivable by human vision. .PP In the other direction, quality values below 50 will produce very small files of low image quality. Settings around 5 to 10 might be useful in preparing an @@ -338,11 +337,11 @@ Independent JPEG Group This file was modified by The libjpeg-turbo Project to include only information relevant to libjpeg-turbo, to wordsmith certain sections, and to describe features not present in libjpeg. -.SH BUGS +.SH ISSUES Support for GIF input files was removed in cjpeg v6b due to concerns over the Unisys LZW patent. Although this patent expired in 2006, cjpeg still lacks GIF support, for these historical reasons. (Conversion of GIF files to -JPEG is usually a bad idea anyway.) +JPEG is usually a bad idea anyway, since GIF is a 256-color format.) .PP Not all variants of BMP and Targa file formats are supported. .PP diff --git a/cjpeg.c b/cjpeg.c index bb73ee98..b75f5e6c 100644 --- a/cjpeg.c +++ b/cjpeg.c @@ -83,7 +83,7 @@ static boolean is_targa; /* records user -targa switch */ static boolean is_jpeg; LOCAL(cjpeg_source_ptr) -select_file_type (j_compress_ptr cinfo, FILE * infile) +select_file_type (j_compress_ptr cinfo, FILE *infile) { int c; @@ -146,9 +146,9 @@ select_file_type (j_compress_ptr cinfo, FILE * infile) */ -static const char * progname; /* program name for error messages */ -static char * outfilename; /* for -outfile switch */ -boolean memdst; /* for -memdst switch */ +static const char *progname; /* program name for error messages */ +static char *outfilename; /* for -outfile switch */ +boolean memdst; /* for -memdst switch */ LOCAL(void) @@ -163,7 +163,8 @@ usage (void) #endif fprintf(stderr, "Switches (names may be abbreviated):\n"); - fprintf(stderr, " -quality N[,...] Compression quality (0..100; 5-95 is useful range)\n"); + fprintf(stderr, " -quality N[,...] Compression quality (0..100; 5-95 is most useful range,\n"); + fprintf(stderr, " default is 75)\n"); fprintf(stderr, " -grayscale Create monochrome JPEG file\n"); fprintf(stderr, " -rgb Create RGB JPEG file\n"); #ifdef ENTROPY_OPT_SUPPORTED @@ -250,14 +251,14 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, */ { int argn; - char * arg; + char *arg; boolean force_baseline; boolean simple_progressive; - char * qualityarg = NULL; /* saves -quality parm if any */ - char * qtablefile = NULL; /* saves -qtables filename if any */ - char * qslotsarg = NULL; /* saves -qslots parm if any */ - char * samplearg = NULL; /* saves -sample parm if any */ - char * scansarg = NULL; /* saves -scans parm if any */ + char *qualityarg = NULL; /* saves -quality parm if any */ + char *qtablefile = NULL; /* saves -qtables filename if any */ + char *qslotsarg = NULL; /* saves -qslots parm if any */ + char *samplearg = NULL; /* saves -sample parm if any */ + char *scansarg = NULL; /* saves -scans parm if any */ /* Set up default JPEG parameters. */ @@ -643,8 +644,8 @@ main (int argc, char **argv) #endif int file_index; cjpeg_source_ptr src_mgr; - FILE * input_file; - FILE * output_file = NULL; + FILE *input_file; + FILE *output_file = NULL; unsigned char *outbuffer = NULL; unsigned long outsize = 0; JDIMENSION num_scanlines; diff --git a/cmakescripts/md5cmp.cmake b/cmakescripts/md5cmp.cmake deleted file mode 100644 index c315aa8a..00000000 --- a/cmakescripts/md5cmp.cmake +++ /dev/null @@ -1,15 +0,0 @@ -if(NOT MD5) - message(FATAL_ERROR "MD5 not specified") -endif() - -if(NOT FILE) - message(FATAL_ERROR "FILE not specified") -endif() - -file(MD5 ${FILE} MD5FILE) - -if(NOT MD5 STREQUAL MD5FILE) - message(FATAL_ERROR "MD5 of ${FILE} should be ${MD5}, not ${MD5FILE}.") -else() - message(STATUS "${MD5}: OK") -endif() diff --git a/coderules.txt b/coderules.txt index 8683e9a6..a2f593ad 100644 --- a/coderules.txt +++ b/coderules.txt @@ -4,7 +4,7 @@ This file was part of the Independent JPEG Group's software: Copyright (C) 1991-1996, Thomas G. Lane. It was modified by The libjpeg-turbo Project to include only information relevant to libjpeg-turbo. -For conditions of distribution and use, see the accompanying README file. +For conditions of distribution and use, see the accompanying README.ijg file. Since numerous people will be contributing code and bug fixes, it's important diff --git a/configure.ac b/configure.ac index 97b0dbe2..2d9ce199 100644 --- a/configure.ac +++ b/configure.ac @@ -27,6 +27,8 @@ AC_ARG_WITH([build-date], [Use custom build string to enable reproducible builds [BUILD="$with_build_date"], [BUILD=`date +%Y%m%d`]) +PKG_PROG_PKG_CONFIG + # When the prefix is /opt/libjpeg-turbo, we assume that an "official" binary is # being created, and thus we install things into specific locations. @@ -79,7 +81,7 @@ prefix=${old_prefix} # Check whether compiler supports pointers to undefined structures AC_MSG_CHECKING(whether compiler supports pointers to undefined structures) -AC_TRY_COMPILE([ typedef struct undefined_structure * undef_struct_ptr; ], , +AC_TRY_COMPILE([ typedef struct undefined_structure *undef_struct_ptr; ], , AC_MSG_RESULT(yes), [AC_MSG_RESULT(no) AC_DEFINE([INCOMPLETE_TYPES_BROKEN], [1], @@ -538,6 +540,7 @@ AM_CONDITIONAL([SIMD_MIPS], [test "x$simd_arch" = "xmips"]) AM_CONDITIONAL([SIMD_POWERPC], [test "x$simd_arch" = "xpowerpc"]) AM_CONDITIONAL([X86_64], [test "x$host_cpu" = "xx86_64" -o "x$host_cpu" = "xamd64"]) AM_CONDITIONAL([WITH_TURBOJPEG], [test "x$with_turbojpeg" != "xno"]) +AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = "xyes"]) AC_ARG_VAR(PKGNAME, [distribution package name (default: mozjpeg)]) if test "x$PKGNAME" = "x"; then @@ -584,6 +587,8 @@ AC_CONFIG_FILES([pkgscripts/makecygwinpkg.tmpl:release/makecygwinpkg.in]) AC_CONFIG_FILES([pkgscripts/makedpkg.tmpl:release/makedpkg.in]) AC_CONFIG_FILES([pkgscripts/makemacpkg.tmpl:release/makemacpkg.in]) AC_CONFIG_FILES([pkgscripts/uninstall.tmpl:release/uninstall.in]) +AC_CONFIG_FILES([pkgscripts/libjpeg.pc:release/libjpeg.pc.in]) +AC_CONFIG_FILES([pkgscripts/libturbojpeg.pc:release/libturbojpeg.pc.in]) if test "x$with_turbojpeg" != "xno"; then AC_CONFIG_FILES([tjbenchtest]) fi diff --git a/djpeg.1 b/djpeg.1 index 73d05148..7efde43b 100644 --- a/djpeg.1 +++ b/djpeg.1 @@ -1,4 +1,4 @@ -.TH DJPEG 1 "21 November 2014" +.TH DJPEG 1 "18 February 2016" .SH NAME djpeg \- decompress a JPEG file to an image file .SH SYNOPSIS @@ -194,6 +194,18 @@ Send output image to the named file, not to standard output. Load input file into memory before decompressing. This feature was implemented mainly as a way of testing the in-memory source manager (jpeg_mem_src().) .TP +.BI \-skip " Y0,Y1" +Decompress all rows of the JPEG image except those between Y0 and Y1 +(inclusive.) Note that if decompression scaling is being used, then Y0 and Y1 +are relative to the scaled image dimensions. +.TP +.BI \-crop " WxH+X+Y" +Decompress only a rectangular subregion of the image, starting at point X,Y +with width W and height H. If necessary, X will be shifted left to the nearest +iMCU boundary, and the width will be increased accordingly. Note that if +decompression scaling is being used, then X, Y, W, and H are relative to the +scaled image dimensions. +.TP .B \-verbose Enable debug printout. More .BR \-v 's @@ -271,8 +283,10 @@ Independent JPEG Group This file was modified by The libjpeg-turbo Project to include only information relevant to libjpeg-turbo, to wordsmith certain sections, and to describe features not present in libjpeg. -.SH BUGS -To avoid the Unisys LZW patent, -.B djpeg -produces uncompressed GIF files. These are larger than they should be, but -are readable by standard GIF decoders. +.SH ISSUES +Support for compressed GIF output files was removed in djpeg v6b due to +concerns over the Unisys LZW patent. Although this patent expired in 2006, +djpeg still lacks compressed GIF support, for these historical reasons. +(Conversion of JPEG files to GIF is usually a bad idea anyway, since GIF is a +256-color format.) The uncompressed GIF files that djpeg generates are larger +than they should be, but they are readable by standard GIF decoders. diff --git a/djpeg.c b/djpeg.c index 8ddff96e..54cd525e 100644 --- a/djpeg.c +++ b/djpeg.c @@ -3,9 +3,12 @@ * * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1997, Thomas G. Lane. + * Modified 2013 by Guido Vollbeding. * libjpeg-turbo Modifications: - * Copyright (C) 2010-2011, 2013-2014, D. R. Commander. - * For conditions of distribution and use, see the accompanying README file. + * Copyright (C) 2010-2011, 2013-2016, D. R. Commander. + * Copyright (C) 2015, Google, Inc. + * For conditions of distribution and use, see the accompanying README.ijg + * file. * * This file contains a command-line user interface for the JPEG decompressor. * It should work on any system with Unix- or MS-DOS-style command lines. @@ -28,6 +31,7 @@ #include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ #include "jversion.h" /* for version message */ #include "jconfigint.h" +#include "wrppm.h" #include /* to declare isprint() */ @@ -85,9 +89,12 @@ static IMAGE_FORMATS requested_fmt; */ -static const char * progname; /* program name for error messages */ -static char * outfilename; /* for -outfile switch */ -boolean memsrc; /* for -memsrc switch */ +static const char *progname; /* program name for error messages */ +static char *outfilename; /* for -outfile switch */ +boolean memsrc; /* for -memsrc switch */ +boolean skip, crop; +JDIMENSION skip_start, skip_end; +JDIMENSION crop_x, crop_y, crop_width, crop_height; #define INPUT_BUF_SIZE 4096 @@ -164,6 +171,8 @@ usage (void) fprintf(stderr, " -memsrc Load input file into memory before decompressing\n"); #endif + fprintf(stderr, " -skip Y0,Y1 Decompress all rows except those between Y0 and Y1 (inclusive)\n"); + fprintf(stderr, " -crop WxH+X+Y Decompress only a rectangular subregion of the image\n"); fprintf(stderr, " -verbose or -debug Emit debug output\n"); fprintf(stderr, " -version Print version information and exit\n"); exit(EXIT_FAILURE); @@ -183,12 +192,14 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv, */ { int argn; - char * arg; + char *arg; /* Set up default JPEG parameters. */ requested_fmt = DEFAULT_FMT; /* set default output file format */ outfilename = NULL; memsrc = FALSE; + skip = FALSE; + crop = FALSE; cinfo->err->trace_level = 0; /* Scan command line options, adjust parameters */ @@ -298,7 +309,7 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv, usage(); if (for_real) { /* too expensive to do twice! */ #ifdef QUANT_2PASS_SUPPORTED /* otherwise can't quantize to supplied map */ - FILE * mapfile; + FILE *mapfile; if ((mapfile = fopen(argv[argn], READ_BINARY)) == NULL) { fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]); @@ -361,14 +372,32 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv, /* RLE output format. */ requested_fmt = FMT_RLE; - } else if (keymatch(arg, "scale", 1)) { + } else if (keymatch(arg, "scale", 2)) { /* Scale the output image by a fraction M/N. */ if (++argn >= argc) /* advance to next argument */ usage(); - if (sscanf(argv[argn], "%d/%d", + if (sscanf(argv[argn], "%u/%u", &cinfo->scale_num, &cinfo->scale_denom) != 2) usage(); + } else if (keymatch(arg, "skip", 2)) { + if (++argn >= argc) + usage(); + if (sscanf(argv[argn], "%u,%u", &skip_start, &skip_end) != 2 || + skip_start > skip_end) + usage(); + skip = TRUE; + + } else if (keymatch(arg, "crop", 2)) { + char c; + if (++argn >= argc) + usage(); + if (sscanf(argv[argn], "%u%c%u+%u+%u", &crop_width, &c, &crop_height, + &crop_x, &crop_y) != 5 || + (c != 'X' && c != 'x') || crop_width < 1 || crop_height < 1) + usage(); + crop = TRUE; + } else if (keymatch(arg, "targa", 1)) { /* Targa output format. */ requested_fmt = FMT_TARGA; @@ -393,7 +422,7 @@ LOCAL(unsigned int) jpeg_getc (j_decompress_ptr cinfo) /* Read next byte */ { - struct jpeg_source_mgr * datasrc = cinfo->src; + struct jpeg_source_mgr *datasrc = cinfo->src; if (datasrc->bytes_in_buffer == 0) { if (! (*datasrc->fill_input_buffer) (cinfo)) @@ -408,7 +437,7 @@ METHODDEF(boolean) print_text_marker (j_decompress_ptr cinfo) { boolean traceit = (cinfo->err->trace_level >= 1); - INT32 length; + long length; unsigned int ch; unsigned int lastch = 0; @@ -469,8 +498,8 @@ main (int argc, char **argv) #endif int file_index; djpeg_dest_ptr dest_mgr = NULL; - FILE * input_file; - FILE * output_file; + FILE *input_file; + FILE *output_file; unsigned char *inbuffer = NULL; unsigned long insize = 0; JDIMENSION num_scanlines; @@ -634,14 +663,88 @@ main (int argc, char **argv) /* Start decompressor */ (void) jpeg_start_decompress(&cinfo); - /* Write output file header */ - (*dest_mgr->start_output) (&cinfo, dest_mgr); + /* Skip rows */ + if (skip) { + JDIMENSION tmp; - /* Process data */ - while (cinfo.output_scanline < cinfo.output_height) { - num_scanlines = jpeg_read_scanlines(&cinfo, dest_mgr->buffer, - dest_mgr->buffer_height); - (*dest_mgr->put_pixel_rows) (&cinfo, dest_mgr, num_scanlines); + /* Check for valid skip_end. We cannot check this value until after + * jpeg_start_decompress() is called. Note that we have already verified + * that skip_start <= skip_end. + */ + if (skip_end > cinfo.output_height - 1) { + fprintf(stderr, "%s: skip region exceeds image height %d\n", progname, + cinfo.output_height); + exit(EXIT_FAILURE); + } + + /* Write output file header. This is a hack to ensure that the destination + * manager creates an output image of the proper size. + */ + tmp = cinfo.output_height; + cinfo.output_height -= (skip_end - skip_start + 1); + (*dest_mgr->start_output) (&cinfo, dest_mgr); + cinfo.output_height = tmp; + + /* Process data */ + while (cinfo.output_scanline < skip_start) { + num_scanlines = jpeg_read_scanlines(&cinfo, dest_mgr->buffer, + dest_mgr->buffer_height); + (*dest_mgr->put_pixel_rows) (&cinfo, dest_mgr, num_scanlines); + } + jpeg_skip_scanlines(&cinfo, skip_end - skip_start + 1); + while (cinfo.output_scanline < cinfo.output_height) { + num_scanlines = jpeg_read_scanlines(&cinfo, dest_mgr->buffer, + dest_mgr->buffer_height); + (*dest_mgr->put_pixel_rows) (&cinfo, dest_mgr, num_scanlines); + } + + /* Decompress a subregion */ + } else if (crop) { + JDIMENSION tmp; + + /* Check for valid crop dimensions. We cannot check these values until + * after jpeg_start_decompress() is called. + */ + if (crop_x + crop_width > cinfo.output_width || + crop_y + crop_height > cinfo.output_height) { + fprintf(stderr, "%s: crop dimensions exceed image dimensions %d x %d\n", + progname, cinfo.output_width, cinfo.output_height); + exit(EXIT_FAILURE); + } + + jpeg_crop_scanline(&cinfo, &crop_x, &crop_width); + ((ppm_dest_ptr) dest_mgr)->buffer_width = cinfo.output_width * + cinfo.out_color_components * + sizeof(JSAMPLE); + + /* Write output file header. This is a hack to ensure that the destination + * manager creates an output image of the proper size. + */ + tmp = cinfo.output_height; + cinfo.output_height = crop_height; + (*dest_mgr->start_output) (&cinfo, dest_mgr); + cinfo.output_height = tmp; + + /* Process data */ + jpeg_skip_scanlines(&cinfo, crop_y); + while (cinfo.output_scanline < crop_y + crop_height) { + num_scanlines = jpeg_read_scanlines(&cinfo, dest_mgr->buffer, + dest_mgr->buffer_height); + (*dest_mgr->put_pixel_rows) (&cinfo, dest_mgr, num_scanlines); + } + jpeg_skip_scanlines(&cinfo, cinfo.output_height - crop_y - crop_height); + + /* Normal full-image decompress */ + } else { + /* Write output file header */ + (*dest_mgr->start_output) (&cinfo, dest_mgr); + + /* Process data */ + while (cinfo.output_scanline < cinfo.output_height) { + num_scanlines = jpeg_read_scanlines(&cinfo, dest_mgr->buffer, + dest_mgr->buffer_height); + (*dest_mgr->put_pixel_rows) (&cinfo, dest_mgr, num_scanlines); + } } #ifdef PROGRESS_REPORT diff --git a/doc/html/annotated.html b/doc/html/annotated.html index dad0fb16..d0b0e1eb 100644 --- a/doc/html/annotated.html +++ b/doc/html/annotated.html @@ -24,7 +24,7 @@
TurboJPEG -  1.4 +  1.5
diff --git a/doc/html/classes.html b/doc/html/classes.html index 7720c671..275e96d6 100644 --- a/doc/html/classes.html +++ b/doc/html/classes.html @@ -24,7 +24,7 @@
TurboJPEG -  1.4 +  1.5
diff --git a/doc/html/functions.html b/doc/html/functions.html index b13faed8..31d78f56 100644 --- a/doc/html/functions.html +++ b/doc/html/functions.html @@ -24,7 +24,7 @@
TurboJPEG -  1.4 +  1.5
diff --git a/doc/html/functions_vars.html b/doc/html/functions_vars.html index cca5603f..8373eace 100644 --- a/doc/html/functions_vars.html +++ b/doc/html/functions_vars.html @@ -24,7 +24,7 @@
TurboJPEG -  1.4 +  1.5
diff --git a/doc/html/group___turbo_j_p_e_g.html b/doc/html/group___turbo_j_p_e_g.html index 233fe6c0..4b8d306e 100644 --- a/doc/html/group___turbo_j_p_e_g.html +++ b/doc/html/group___turbo_j_p_e_g.html @@ -24,7 +24,7 @@
TurboJPEG -  1.4 +  1.5
@@ -132,10 +132,10 @@ Macros  The number of transform operations. More...
  #define TJXOPT_PERFECT - This option will cause tjTransform() to return an error if the transform is not perfect. More...
+ This option will cause tjTransform() to return an error if the transform is not perfect. More...
  #define TJXOPT_TRIM - This option will cause tjTransform() to discard any partial MCU blocks that cannot be transformed. More...
+ This option will cause tjTransform() to discard any partial MCU blocks that cannot be transformed. More...
  #define TJXOPT_CROP  This option will enable lossless cropping. More...
@@ -144,7 +144,7 @@ Macros  This option will discard the color data in the input image and produce a grayscale output image. More...
  #define TJXOPT_NOOUTPUT - This option will prevent tjTransform() from outputting a JPEG image for this particular transform (this can be used in conjunction with a custom filter to capture the transformed DCT coefficients without transcoding them.) More...
+ This option will prevent tjTransform() from outputting a JPEG image for this particular transform (this can be used in conjunction with a custom filter to capture the transformed DCT coefficients without transcoding them.) More...
  #define TJPAD(width)  Pad the given width to the nearest 32-bit boundary. More...
@@ -218,7 +218,7 @@ Enumerations TJXOP_ROT270
} - Transform operations for tjTransform() More...
+ Transform operations for tjTransform() More...
  - - - - - - - - - + + + + + + + + + @@ -250,42 +250,42 @@ Functions - - - - - - + + + + + + - - - + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - + + + @@ -455,7 +455,7 @@ Variables

Disable buffer (re)allocation.

-

If passed to tjCompress2() or tjTransform(), this flag will cause those functions to generate an error if the JPEG image buffer is invalid or too small rather than attempting to allocate or reallocate that buffer. This reproduces the behavior of earlier versions of TurboJPEG.

+

If passed to tjCompress2() or tjTransform(), this flag will cause those functions to generate an error if the JPEG image buffer is invalid or too small rather than attempting to allocate or reallocate that buffer. This reproduces the behavior of earlier versions of TurboJPEG.

@@ -517,7 +517,7 @@ Variables

This option will enable lossless cropping.

-

See tjTransform() for more information.

+

See tjTransform() for more information.

@@ -545,7 +545,7 @@ Variables

@@ -226,15 +226,15 @@ Functions

DLLEXPORT tjhandle DLLCALL tjInitCompress (void)
 Create a TurboJPEG compressor instance. More...
 
DLLEXPORT int DLLCALL tjCompress2 (tjhandle handle, unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegSubsamp, int jpegQual, int flags)
 Compress an RGB, grayscale, or CMYK image into a JPEG image. More...
 
DLLEXPORT int DLLCALL tjCompressFromYUV (tjhandle handle, unsigned char *srcBuf, int width, int pad, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags)
 Compress a YUV planar image into a JPEG image. More...
 
DLLEXPORT int DLLCALL tjCompressFromYUVPlanes (tjhandle handle, unsigned char **srcPlanes, int width, int *strides, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags)
 Compress a set of Y, U (Cb), and V (Cr) image planes into a JPEG image. More...
 
DLLEXPORT int DLLCALL tjCompress2 (tjhandle handle, const unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegSubsamp, int jpegQual, int flags)
 Compress an RGB, grayscale, or CMYK image into a JPEG image. More...
 
DLLEXPORT int DLLCALL tjCompressFromYUV (tjhandle handle, const unsigned char *srcBuf, int width, int pad, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags)
 Compress a YUV planar image into a JPEG image. More...
 
DLLEXPORT int DLLCALL tjCompressFromYUVPlanes (tjhandle handle, const unsigned char **srcPlanes, int width, const int *strides, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags)
 Compress a set of Y, U (Cb), and V (Cr) image planes into a JPEG image. More...
 
DLLEXPORT unsigned long DLLCALL tjBufSize (int width, int height, int jpegSubsamp)
 The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters. More...
 
DLLEXPORT int tjPlaneHeight (int componentID, int height, int subsamp)
 The plane height of a YUV image plane with the given parameters. More...
 
DLLEXPORT int DLLCALL tjEncodeYUV3 (tjhandle handle, unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char *dstBuf, int pad, int subsamp, int flags)
 Encode an RGB or grayscale image into a YUV planar image. More...
 
DLLEXPORT int DLLCALL tjEncodeYUVPlanes (tjhandle handle, unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char **dstPlanes, int *strides, int subsamp, int flags)
 Encode an RGB or grayscale image into separate Y, U (Cb), and V (Cr) image planes. More...
 
DLLEXPORT int DLLCALL tjEncodeYUV3 (tjhandle handle, const unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char *dstBuf, int pad, int subsamp, int flags)
 Encode an RGB or grayscale image into a YUV planar image. More...
 
DLLEXPORT int DLLCALL tjEncodeYUVPlanes (tjhandle handle, const unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char **dstPlanes, int *strides, int subsamp, int flags)
 Encode an RGB or grayscale image into separate Y, U (Cb), and V (Cr) image planes. More...
 
DLLEXPORT tjhandle DLLCALL tjInitDecompress (void)
 Create a TurboJPEG decompressor instance. More...
 
DLLEXPORT int DLLCALL tjDecompressHeader3 (tjhandle handle, unsigned char *jpegBuf, unsigned long jpegSize, int *width, int *height, int *jpegSubsamp, int *jpegColorspace)
 Retrieve information about a JPEG image without decompressing it. More...
 
DLLEXPORT int DLLCALL tjDecompressHeader3 (tjhandle handle, const unsigned char *jpegBuf, unsigned long jpegSize, int *width, int *height, int *jpegSubsamp, int *jpegColorspace)
 Retrieve information about a JPEG image without decompressing it. More...
 
DLLEXPORT tjscalingfactor *DLLCALL tjGetScalingFactors (int *numscalingfactors)
 Returns a list of fractional scaling factors that the JPEG decompressor in this implementation of TurboJPEG supports. More...
 
DLLEXPORT int DLLCALL tjDecompress2 (tjhandle handle, unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)
 Decompress a JPEG image to an RGB, grayscale, or CMYK image. More...
 
DLLEXPORT int DLLCALL tjDecompressToYUV2 (tjhandle handle, unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, int width, int pad, int height, int flags)
 Decompress a JPEG image to a YUV planar image. More...
 
DLLEXPORT int DLLCALL tjDecompressToYUVPlanes (tjhandle handle, unsigned char *jpegBuf, unsigned long jpegSize, unsigned char **dstPlanes, int width, int *strides, int height, int flags)
 Decompress a JPEG image into separate Y, U (Cb), and V (Cr) image planes. More...
 
DLLEXPORT int DLLCALL tjDecodeYUV (tjhandle handle, unsigned char *srcBuf, int pad, int subsamp, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)
 Decode a YUV planar image into an RGB or grayscale image. More...
 
DLLEXPORT int DLLCALL tjDecodeYUVPlanes (tjhandle handle, unsigned char **srcPlanes, int *strides, int subsamp, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)
 Decode a set of Y, U (Cb), and V (Cr) image planes into an RGB or grayscale image. More...
 
DLLEXPORT int DLLCALL tjDecompress2 (tjhandle handle, const unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)
 Decompress a JPEG image to an RGB, grayscale, or CMYK image. More...
 
DLLEXPORT int DLLCALL tjDecompressToYUV2 (tjhandle handle, const unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, int width, int pad, int height, int flags)
 Decompress a JPEG image to a YUV planar image. More...
 
DLLEXPORT int DLLCALL tjDecompressToYUVPlanes (tjhandle handle, const unsigned char *jpegBuf, unsigned long jpegSize, unsigned char **dstPlanes, int width, int *strides, int height, int flags)
 Decompress a JPEG image into separate Y, U (Cb), and V (Cr) image planes. More...
 
DLLEXPORT int DLLCALL tjDecodeYUV (tjhandle handle, const unsigned char *srcBuf, int pad, int subsamp, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)
 Decode a YUV planar image into an RGB or grayscale image. More...
 
DLLEXPORT int DLLCALL tjDecodeYUVPlanes (tjhandle handle, const unsigned char **srcPlanes, const int *strides, int subsamp, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)
 Decode a set of Y, U (Cb), and V (Cr) image planes into an RGB or grayscale image. More...
 
DLLEXPORT tjhandle DLLCALL tjInitTransform (void)
 Create a new TurboJPEG transformer instance. More...
 
DLLEXPORT int DLLCALL tjTransform (tjhandle handle, unsigned char *jpegBuf, unsigned long jpegSize, int n, unsigned char **dstBufs, unsigned long *dstSizes, tjtransform *transforms, int flags)
 Losslessly transform a JPEG image into another JPEG image. More...
 
DLLEXPORT int DLLCALL tjTransform (tjhandle handle, const unsigned char *jpegBuf, unsigned long jpegSize, int n, unsigned char **dstBufs, unsigned long *dstSizes, tjtransform *transforms, int flags)
 Losslessly transform a JPEG image into another JPEG image. More...
 
DLLEXPORT int DLLCALL tjDestroy (tjhandle handle)
 Destroy a TurboJPEG compressor, decompressor, or transformer instance. More...
 
-

This option will prevent tjTransform() from outputting a JPEG image for this particular transform (this can be used in conjunction with a custom filter to capture the transformed DCT coefficients without transcoding them.)

+

This option will prevent tjTransform() from outputting a JPEG image for this particular transform (this can be used in conjunction with a custom filter to capture the transformed DCT coefficients without transcoding them.)

@@ -559,7 +559,7 @@ Variables
-

This option will cause tjTransform() to return an error if the transform is not perfect.

+

This option will cause tjTransform() to return an error if the transform is not perfect.

Lossless transforms operate on MCU blocks, whose size depends on the level of chrominance subsampling used (see tjMCUWidth and tjMCUHeight.) If the image's width or height is not evenly divisible by the MCU block size, then there will be partial MCU blocks on the right and/or bottom edges. It is not possible to move these partial MCU blocks to the top or left of the image, so any transform that would require that is "imperfect." If this option is not specified, then any partial MCU blocks that cannot be transformed will be left in place, which will create odd-looking strips on the right or bottom edge of the image.

@@ -574,7 +574,7 @@ Variables
-

This option will cause tjTransform() to discard any partial MCU blocks that cannot be transformed.

+

This option will cause tjTransform() to discard any partial MCU blocks that cannot be transformed.

@@ -761,7 +761,7 @@ Variables
-

Transform operations for tjTransform()

+

Transform operations for tjTransform()

Allocate an image buffer for use with TurboJPEG.

-

You should always use this function to allocate the JPEG destination buffer(s) for tjCompress2() and tjTransform() unless you are disabling automatic buffer (re)allocation (by setting TJFLAG_NOREALLOC.)

+

You should always use this function to allocate the JPEG destination buffer(s) for tjCompress2() and tjTransform() unless you are disabling automatic buffer (re)allocation (by setting TJFLAG_NOREALLOC.)

Parameters
Enumerator
TJXOP_NONE 

Do not transform the position of the image pixels.

@@ -812,7 +812,7 @@ Variables
@@ -918,7 +918,7 @@ Variables - +
bytesthe number of bytes to allocate
@@ -931,7 +931,7 @@ Variables - + @@ -1000,7 +1000,7 @@ Variables
Parameters
unsigned char * const unsigned char *  srcBuf,
- + @@ -1022,7 +1022,7 @@ If you choose option 1, *jpegSize should be set to the size of your - +
handlea handle to a TurboJPEG compressor or transformer instance
srcBufpointer to an image buffer containing RGB, grayscale, or CMYK pixels to be compressed. This buffer is not modified.
srcBufpointer to an image buffer containing RGB, grayscale, or CMYK pixels to be compressed
widthwidth (in pixels) of the source image
pitchbytes per line in the source image. Normally, this should be width * tjPixelSize[pixelFormat] if the image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
heightheight (in pixels) of the source image
@@ -1035,7 +1035,7 @@ If you choose option 1, *jpegSize should be set to the size of your - + @@ -1098,7 +1098,7 @@ If you choose option 1, *jpegSize should be set to the size of your
Parameters
unsigned char * const unsigned char *  srcBuf,
- + @@ -1119,7 +1119,7 @@ If you choose option 1, *jpegSize should be set to the size of your - +
handlea handle to a TurboJPEG compressor or transformer instance
srcBufpointer to an image buffer containing a YUV planar image to be compressed. The size of this buffer should match the value returned by tjBufSizeYUV2() for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer (refer to YUV Image Format Notes.) This buffer is not modified.
srcBufpointer to an image buffer containing a YUV planar image to be compressed. The size of this buffer should match the value returned by tjBufSizeYUV2() for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer (refer to YUV Image Format Notes.)
widthwidth (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG.
padthe line padding used in the source image. For instance, if each line in each plane of the YUV image is padded to the nearest multiple of 4 bytes, then pad should be set to 4.
heightheight (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
@@ -1132,7 +1132,7 @@ If you choose option 1, *jpegSize should be set to the size of your - + @@ -1144,7 +1144,7 @@ If you choose option 1, *jpegSize should be set to the size of your - + @@ -1195,7 +1195,7 @@ If you choose option 1, *jpegSize should be set to the size of your
Parameters
unsigned char ** const unsigned char **  srcPlanes,
int * const int *  strides,
- + @@ -1216,7 +1216,7 @@ If you choose option 1, *jpegSize should be set to the size of your - +
handlea handle to a TurboJPEG compressor or transformer instance
srcPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if compressing a grayscale image) that contain a YUV image to be compressed. These planes can be contiguous or non-contiguous in memory. The size of each plane should match the value returned by tjPlaneSizeYUV() for the given image width, height, strides, and level of chrominance subsampling. Refer to YUV Image Format Notes for more details. These image planes are not modified.
srcPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if compressing a grayscale image) that contain a YUV image to be compressed. These planes can be contiguous or non-contiguous in memory. The size of each plane should match the value returned by tjPlaneSizeYUV() for the given image width, height, strides, and level of chrominance subsampling. Refer to YUV Image Format Notes for more details.
widthwidth (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG.
stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the plane width (see YUV Image Format Notes.) If strides is NULL, then the strides for all planes will be set to their respective plane widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to create a JPEG image from a subregion of a larger YUV planar image.
heightheight (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
@@ -1229,7 +1229,7 @@ If you choose option 1, *jpegSize should be set to the size of your - + @@ -1293,7 +1293,7 @@ If you choose option 1, *jpegSize should be set to the size of your
Parameters
unsigned char * const unsigned char *  srcBuf,
- + @@ -1309,7 +1309,7 @@ If you choose option 1, *jpegSize should be set to the size of your - +
handlea handle to a TurboJPEG decompressor or transformer instance
srcBufpointer to an image buffer containing a YUV planar image to be decoded. The size of this buffer should match the value returned by tjBufSizeYUV2() for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer (refer to YUV Image Format Notes.) This buffer is not modified.
srcBufpointer to an image buffer containing a YUV planar image to be decoded. The size of this buffer should match the value returned by tjBufSizeYUV2() for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer (refer to YUV Image Format Notes.)
padUse this parameter to specify that the width of each line in each plane of the YUV source image is padded to the nearest multiple of this number of bytes (must be a power of 2.)
subsampthe level of chrominance subsampling used in the YUV source image (see Chrominance subsampling options.)
dstBufpointer to an image buffer that will receive the decoded image. This buffer should normally be pitch * height bytes in size, but the dstBuf pointer can also be used to decode into a specific region of a larger buffer.
@@ -1322,13 +1322,13 @@ If you choose option 1, *jpegSize should be set to the size of your - + - + @@ -1386,7 +1386,7 @@ If you choose option 1, *jpegSize should be set to the size of your
Parameters
unsigned char ** const unsigned char **  srcPlanes,
int * const int *  strides,
- + @@ -1402,7 +1402,7 @@ If you choose option 1, *jpegSize should be set to the size of your - +
handlea handle to a TurboJPEG decompressor or transformer instance
srcPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decoding a grayscale image) that contain a YUV image to be decoded. These planes can be contiguous or non-contiguous in memory. The size of each plane should match the value returned by tjPlaneSizeYUV() for the given image width, height, strides, and level of chrominance subsampling. Refer to YUV Image Format Notes for more details. These image planes are not modified.
srcPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decoding a grayscale image) that contain a YUV image to be decoded. These planes can be contiguous or non-contiguous in memory. The size of each plane should match the value returned by tjPlaneSizeYUV() for the given image width, height, strides, and level of chrominance subsampling. Refer to YUV Image Format Notes for more details.
stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the plane width (see YUV Image Format Notes.) If strides is NULL, then the strides for all planes will be set to their respective plane widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to decode a subregion of a larger YUV planar image.
subsampthe level of chrominance subsampling used in the YUV source image (see Chrominance subsampling options.)
dstBufpointer to an image buffer that will receive the decoded image. This buffer should normally be pitch * height bytes in size, but the dstBuf pointer can also be used to decode into a specific region of a larger buffer.
@@ -1415,7 +1415,7 @@ If you choose option 1, *jpegSize should be set to the size of your - + @@ -1472,7 +1472,7 @@ If you choose option 1, *jpegSize should be set to the size of your
Parameters
unsigned char * const unsigned char *  jpegBuf,
- + @@ -1487,7 +1487,7 @@ If you choose option 1, *jpegSize should be set to the size of your - +
handlea handle to a TurboJPEG decompressor or transformer instance
jpegBufpointer to a buffer containing the JPEG image to decompress. This buffer is not modified.
jpegBufpointer to a buffer containing the JPEG image to decompress
jpegSizesize of the JPEG image (in bytes)
dstBufpointer to an image buffer that will receive the decompressed image. This buffer should normally be pitch * scaledHeight bytes in size, where scaledHeight can be determined by calling TJSCALED() with the JPEG image height and one of the scaling factors returned by tjGetScalingFactors(). The dstBuf pointer may also be used to decompress into a specific region of a larger buffer.
widthdesired width (in pixels) of the destination image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If width is set to 0, then only the height will be considered when determining the scaled image size.
@@ -1500,7 +1500,7 @@ If you choose option 1, *jpegSize should be set to the size of your - + @@ -1545,7 +1545,7 @@ If you choose option 1, *jpegSize should be set to the size of your
Parameters
unsigned char * const unsigned char *  jpegBuf,
- + @@ -1558,7 +1558,7 @@ If you choose option 1, *jpegSize should be set to the size of your - +
handlea handle to a TurboJPEG decompressor or transformer instance
jpegBufpointer to a buffer containing a JPEG image. This buffer is not modified.
jpegBufpointer to a buffer containing a JPEG image
jpegSizesize of the JPEG image (in bytes)
widthpointer to an integer variable that will receive the width (in pixels) of the JPEG image
heightpointer to an integer variable that will receive the height (in pixels) of the JPEG image
@@ -1571,7 +1571,7 @@ If you choose option 1, *jpegSize should be set to the size of your - + @@ -1623,7 +1623,7 @@ If you choose option 1, *jpegSize should be set to the size of your
Parameters
unsigned char * const unsigned char *  jpegBuf,
- + @@ -1637,7 +1637,7 @@ If you choose option 1, *jpegSize should be set to the size of your - +
handlea handle to a TurboJPEG decompressor or transformer instance
jpegBufpointer to a buffer containing the JPEG image to decompress. This buffer is not modified.
jpegBufpointer to a buffer containing the JPEG image to decompress
jpegSizesize of the JPEG image (in bytes)
dstBufpointer to an image buffer that will receive the YUV image. Use tjBufSizeYUV2() to determine the appropriate size for this buffer based on the image width, height, padding, and level of subsampling. The Y, U (Cb), and V (Cr) image planes will be stored sequentially in the buffer (refer to YUV Image Format Notes.)
widthdesired width (in pixels) of the YUV image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If width is set to 0, then only the height will be considered when determining the scaled image size. If the scaled width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG.
@@ -1650,7 +1650,7 @@ If you choose option 1, *jpegSize should be set to the size of your - + @@ -1702,7 +1702,7 @@ If you choose option 1, *jpegSize should be set to the size of your
Parameters
unsigned char * const unsigned char *  jpegBuf,
- + @@ -1741,7 +1741,7 @@ If you choose option 1, *jpegSize should be set to the size of your - +
handlea handle to a TurboJPEG decompressor or transformer instance
jpegBufpointer to a buffer containing the JPEG image to decompress. This buffer is not modified.
jpegBufpointer to a buffer containing the JPEG image to decompress
jpegSizesize of the JPEG image (in bytes)
dstPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decompressing a grayscale image) that will receive the YUV image. These planes can be contiguous or non-contiguous in memory. Use tjPlaneSizeYUV() to determine the appropriate size for each plane based on the scaled image width, scaled image height, strides, and level of chrominance subsampling. Refer to YUV Image Format Notes for more details.
widthdesired width (in pixels) of the YUV image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If width is set to 0, then only the height will be considered when determining the scaled image size. If the scaled width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG.
@@ -1754,7 +1754,7 @@ If you choose option 1, *jpegSize should be set to the size of your - + @@ -1818,7 +1818,7 @@ If you choose option 1, *jpegSize should be set to the size of your
Parameters
unsigned char * const unsigned char *  srcBuf,
- + @@ -1834,7 +1834,7 @@ If you choose option 1, *jpegSize should be set to the size of your - +
handlea handle to a TurboJPEG compressor or transformer instance
srcBufpointer to an image buffer containing RGB or grayscale pixels to be encoded. This buffer is not modified.
srcBufpointer to an image buffer containing RGB or grayscale pixels to be encoded
widthwidth (in pixels) of the source image
pitchbytes per line in the source image. Normally, this should be width * tjPixelSize[pixelFormat] if the image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
heightheight (in pixels) of the source image
@@ -1847,7 +1847,7 @@ If you choose option 1, *jpegSize should be set to the size of your - + @@ -1911,7 +1911,7 @@ If you choose option 1, *jpegSize should be set to the size of your
Parameters
unsigned char * const unsigned char *  srcBuf,
- + @@ -1942,7 +1942,7 @@ If you choose option 1, *jpegSize should be set to the size of your

Free an image buffer previously allocated by TurboJPEG.

-

You should always use this function to free JPEG destination buffer(s) that were automatically (re)allocated by tjCompress2() or tjTransform() or that were manually allocated using tjAlloc().

+

You should always use this function to free JPEG destination buffer(s) that were automatically (re)allocated by tjCompress2() or tjTransform() or that were manually allocated using tjAlloc().

Parameters
handlea handle to a TurboJPEG compressor or transformer instance
srcBufpointer to an image buffer containing RGB or grayscale pixels to be encoded. This buffer is not modified.
srcBufpointer to an image buffer containing RGB or grayscale pixels to be encoded
widthwidth (in pixels) of the source image
pitchbytes per line in the source image. Normally, this should be width * tjPixelSize[pixelFormat] if the image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
heightheight (in pixels) of the source image
@@ -2199,7 +2199,7 @@ If you choose option 1, *jpegSize should be set to the size of your - +
bufferaddress of the buffer to free
@@ -2212,7 +2212,7 @@ If you choose option 1, *jpegSize should be set to the size of your - + @@ -2264,7 +2264,7 @@ If you choose option 1, *jpegSize should be set to the size of your
Parameters
unsigned char * const unsigned char *  jpegBuf,
- + diff --git a/doc/html/modules.html b/doc/html/modules.html index 9b41adbd..8e6f815f 100644 --- a/doc/html/modules.html +++ b/doc/html/modules.html @@ -24,7 +24,7 @@ diff --git a/doc/html/search/all_74.js b/doc/html/search/all_74.js index 5b46106f..444aaef2 100644 --- a/doc/html/search/all_74.js +++ b/doc/html/search/all_74.js @@ -8,24 +8,24 @@ var searchData= ['tjblueoffset',['tjBlueOffset',['../group___turbo_j_p_e_g.html#ga84e2e35d3f08025f976ec1ec53693dea',1,'turbojpeg.h']]], ['tjbufsize',['tjBufSize',['../group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b',1,'turbojpeg.h']]], ['tjbufsizeyuv2',['tjBufSizeYUV2',['../group___turbo_j_p_e_g.html#gaf451664a62c1f6c7cc5a6401f32908c9',1,'turbojpeg.h']]], - ['tjcompress2',['tjCompress2',['../group___turbo_j_p_e_g.html#gaba62b7a98f960839b588579898495cf2',1,'turbojpeg.h']]], - ['tjcompressfromyuv',['tjCompressFromYUV',['../group___turbo_j_p_e_g.html#ga0b931126c7a615ddc3bbd0cca6698d67',1,'turbojpeg.h']]], - ['tjcompressfromyuvplanes',['tjCompressFromYUVPlanes',['../group___turbo_j_p_e_g.html#gaa89a1982cb4556b12ae7af4439991af6',1,'turbojpeg.h']]], + ['tjcompress2',['tjCompress2',['../group___turbo_j_p_e_g.html#gaf38f2ed44bdc88e730e08b632fa6e88e',1,'turbojpeg.h']]], + ['tjcompressfromyuv',['tjCompressFromYUV',['../group___turbo_j_p_e_g.html#ga6f6de375d6ec0020faba627e37e5a060',1,'turbojpeg.h']]], + ['tjcompressfromyuvplanes',['tjCompressFromYUVPlanes',['../group___turbo_j_p_e_g.html#ga0b84c682d8accf097d7a743c965d3464',1,'turbojpeg.h']]], ['tjcs',['TJCS',['../group___turbo_j_p_e_g.html#ga4f83ad3368e0e29d1957be0efa7c3720',1,'turbojpeg.h']]], ['tjcs_5fcmyk',['TJCS_CMYK',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a6c8b636152ac8195b869587db315ee53',1,'turbojpeg.h']]], ['tjcs_5fgray',['TJCS_GRAY',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720ab3e7d6a87f695e45b81c1b5262b5a50a',1,'turbojpeg.h']]], ['tjcs_5frgb',['TJCS_RGB',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a677cb7ccb85c4038ac41964a2e09e555',1,'turbojpeg.h']]], ['tjcs_5fycbcr',['TJCS_YCbCr',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a7389b8f65bb387ffedce3efd0d78ec75',1,'turbojpeg.h']]], ['tjcs_5fycck',['TJCS_YCCK',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a53839e0fe867b76b58d16b0a1a7c598e',1,'turbojpeg.h']]], - ['tjdecodeyuv',['tjDecodeYUV',['../group___turbo_j_p_e_g.html#ga132ae2c2cadcf64c8bb0f3bdf69da3ed',1,'turbojpeg.h']]], - ['tjdecodeyuvplanes',['tjDecodeYUVPlanes',['../group___turbo_j_p_e_g.html#ga6cb5b0e1101a2b20edea576e11faf93d',1,'turbojpeg.h']]], - ['tjdecompress2',['tjDecompress2',['../group___turbo_j_p_e_g.html#gada69cc6443d1bb493b40f1626259e5e9',1,'turbojpeg.h']]], - ['tjdecompressheader3',['tjDecompressHeader3',['../group___turbo_j_p_e_g.html#gacd0fac3af74b3511d39b4781b7103086',1,'turbojpeg.h']]], - ['tjdecompresstoyuv2',['tjDecompressToYUV2',['../group___turbo_j_p_e_g.html#ga7c08b340ad7f8e85d407bd9e81d44d07',1,'turbojpeg.h']]], - ['tjdecompresstoyuvplanes',['tjDecompressToYUVPlanes',['../group___turbo_j_p_e_g.html#ga0828a38ae29631ac28b6857cefb0eebf',1,'turbojpeg.h']]], + ['tjdecodeyuv',['tjDecodeYUV',['../group___turbo_j_p_e_g.html#ga077c61027b875afecd5a1613bf18b3c1',1,'turbojpeg.h']]], + ['tjdecodeyuvplanes',['tjDecodeYUVPlanes',['../group___turbo_j_p_e_g.html#gaf42f19b7a496eb18bdc84fe61ee6d3e2',1,'turbojpeg.h']]], + ['tjdecompress2',['tjDecompress2',['../group___turbo_j_p_e_g.html#gad8026a417e16a76313bc0a6c9e8b2ba2',1,'turbojpeg.h']]], + ['tjdecompressheader3',['tjDecompressHeader3',['../group___turbo_j_p_e_g.html#ga3fced455e504e8ff4fbad28ba94a3020',1,'turbojpeg.h']]], + ['tjdecompresstoyuv2',['tjDecompressToYUV2',['../group___turbo_j_p_e_g.html#ga39e08906528db5a764670ea48d344b09',1,'turbojpeg.h']]], + ['tjdecompresstoyuvplanes',['tjDecompressToYUVPlanes',['../group___turbo_j_p_e_g.html#ga38d0ef90692663b3ffb5b16da2541512',1,'turbojpeg.h']]], ['tjdestroy',['tjDestroy',['../group___turbo_j_p_e_g.html#ga674adee917b95ad4a896f1ba39e12540',1,'turbojpeg.h']]], - ['tjencodeyuv3',['tjEncodeYUV3',['../group___turbo_j_p_e_g.html#ga0a5ffbf7cb58a5b6a8201114fe889360',1,'turbojpeg.h']]], - ['tjencodeyuvplanes',['tjEncodeYUVPlanes',['../group___turbo_j_p_e_g.html#gaa791db8598853ddcad24e42897ef1269',1,'turbojpeg.h']]], + ['tjencodeyuv3',['tjEncodeYUV3',['../group___turbo_j_p_e_g.html#gaabe05acd734990053ad1294b5ef239aa',1,'turbojpeg.h']]], + ['tjencodeyuvplanes',['tjEncodeYUVPlanes',['../group___turbo_j_p_e_g.html#ga8a65ed3bd12df57c219d46afbc9008f1',1,'turbojpeg.h']]], ['tjflag_5faccuratedct',['TJFLAG_ACCURATEDCT',['../group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0',1,'turbojpeg.h']]], ['tjflag_5fbottomup',['TJFLAG_BOTTOMUP',['../group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec',1,'turbojpeg.h']]], ['tjflag_5ffastdct',['TJFLAG_FASTDCT',['../group___turbo_j_p_e_g.html#gaabce235db80d3f698b27f36cbd453da2',1,'turbojpeg.h']]], @@ -70,7 +70,7 @@ var searchData= ['tjsamp_5fgray',['TJSAMP_GRAY',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a3f1c9504842ddc7a48d0f690754b6248',1,'turbojpeg.h']]], ['tjscaled',['TJSCALED',['../group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df',1,'turbojpeg.h']]], ['tjscalingfactor',['tjscalingfactor',['../structtjscalingfactor.html',1,'']]], - ['tjtransform',['tjtransform',['../structtjtransform.html',1,'tjtransform'],['../group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616',1,'tjTransform(tjhandle handle, unsigned char *jpegBuf, unsigned long jpegSize, int n, unsigned char **dstBufs, unsigned long *dstSizes, tjtransform *transforms, int flags): turbojpeg.h'],['../group___turbo_j_p_e_g.html#gaa29f3189c41be12ec5dee7caec318a31',1,'tjtransform(): turbojpeg.h']]], + ['tjtransform',['tjtransform',['../structtjtransform.html',1,'tjtransform'],['../group___turbo_j_p_e_g.html#gad02cd42b69f193a0623a9c801788df3a',1,'tjTransform(tjhandle handle, const unsigned char *jpegBuf, unsigned long jpegSize, int n, unsigned char **dstBufs, unsigned long *dstSizes, tjtransform *transforms, int flags): turbojpeg.h'],['../group___turbo_j_p_e_g.html#gaa29f3189c41be12ec5dee7caec318a31',1,'tjtransform(): turbojpeg.h']]], ['tjxop',['TJXOP',['../group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866',1,'turbojpeg.h']]], ['tjxop_5fhflip',['TJXOP_HFLIP',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aa0df69776caa30f0fa28e26332d311ce',1,'turbojpeg.h']]], ['tjxop_5fnone',['TJXOP_NONE',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aad88c0366cd3f7d0eac9d7a3fa1c2c27',1,'turbojpeg.h']]], diff --git a/doc/html/search/functions_74.js b/doc/html/search/functions_74.js index 73b7ee98..69410b05 100644 --- a/doc/html/search/functions_74.js +++ b/doc/html/search/functions_74.js @@ -3,18 +3,18 @@ var searchData= ['tjalloc',['tjAlloc',['../group___turbo_j_p_e_g.html#ga5c9234bda6d993cdaffdd89bf81a00ff',1,'turbojpeg.h']]], ['tjbufsize',['tjBufSize',['../group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b',1,'turbojpeg.h']]], ['tjbufsizeyuv2',['tjBufSizeYUV2',['../group___turbo_j_p_e_g.html#gaf451664a62c1f6c7cc5a6401f32908c9',1,'turbojpeg.h']]], - ['tjcompress2',['tjCompress2',['../group___turbo_j_p_e_g.html#gaba62b7a98f960839b588579898495cf2',1,'turbojpeg.h']]], - ['tjcompressfromyuv',['tjCompressFromYUV',['../group___turbo_j_p_e_g.html#ga0b931126c7a615ddc3bbd0cca6698d67',1,'turbojpeg.h']]], - ['tjcompressfromyuvplanes',['tjCompressFromYUVPlanes',['../group___turbo_j_p_e_g.html#gaa89a1982cb4556b12ae7af4439991af6',1,'turbojpeg.h']]], - ['tjdecodeyuv',['tjDecodeYUV',['../group___turbo_j_p_e_g.html#ga132ae2c2cadcf64c8bb0f3bdf69da3ed',1,'turbojpeg.h']]], - ['tjdecodeyuvplanes',['tjDecodeYUVPlanes',['../group___turbo_j_p_e_g.html#ga6cb5b0e1101a2b20edea576e11faf93d',1,'turbojpeg.h']]], - ['tjdecompress2',['tjDecompress2',['../group___turbo_j_p_e_g.html#gada69cc6443d1bb493b40f1626259e5e9',1,'turbojpeg.h']]], - ['tjdecompressheader3',['tjDecompressHeader3',['../group___turbo_j_p_e_g.html#gacd0fac3af74b3511d39b4781b7103086',1,'turbojpeg.h']]], - ['tjdecompresstoyuv2',['tjDecompressToYUV2',['../group___turbo_j_p_e_g.html#ga7c08b340ad7f8e85d407bd9e81d44d07',1,'turbojpeg.h']]], - ['tjdecompresstoyuvplanes',['tjDecompressToYUVPlanes',['../group___turbo_j_p_e_g.html#ga0828a38ae29631ac28b6857cefb0eebf',1,'turbojpeg.h']]], + ['tjcompress2',['tjCompress2',['../group___turbo_j_p_e_g.html#gaf38f2ed44bdc88e730e08b632fa6e88e',1,'turbojpeg.h']]], + ['tjcompressfromyuv',['tjCompressFromYUV',['../group___turbo_j_p_e_g.html#ga6f6de375d6ec0020faba627e37e5a060',1,'turbojpeg.h']]], + ['tjcompressfromyuvplanes',['tjCompressFromYUVPlanes',['../group___turbo_j_p_e_g.html#ga0b84c682d8accf097d7a743c965d3464',1,'turbojpeg.h']]], + ['tjdecodeyuv',['tjDecodeYUV',['../group___turbo_j_p_e_g.html#ga077c61027b875afecd5a1613bf18b3c1',1,'turbojpeg.h']]], + ['tjdecodeyuvplanes',['tjDecodeYUVPlanes',['../group___turbo_j_p_e_g.html#gaf42f19b7a496eb18bdc84fe61ee6d3e2',1,'turbojpeg.h']]], + ['tjdecompress2',['tjDecompress2',['../group___turbo_j_p_e_g.html#gad8026a417e16a76313bc0a6c9e8b2ba2',1,'turbojpeg.h']]], + ['tjdecompressheader3',['tjDecompressHeader3',['../group___turbo_j_p_e_g.html#ga3fced455e504e8ff4fbad28ba94a3020',1,'turbojpeg.h']]], + ['tjdecompresstoyuv2',['tjDecompressToYUV2',['../group___turbo_j_p_e_g.html#ga39e08906528db5a764670ea48d344b09',1,'turbojpeg.h']]], + ['tjdecompresstoyuvplanes',['tjDecompressToYUVPlanes',['../group___turbo_j_p_e_g.html#ga38d0ef90692663b3ffb5b16da2541512',1,'turbojpeg.h']]], ['tjdestroy',['tjDestroy',['../group___turbo_j_p_e_g.html#ga674adee917b95ad4a896f1ba39e12540',1,'turbojpeg.h']]], - ['tjencodeyuv3',['tjEncodeYUV3',['../group___turbo_j_p_e_g.html#ga0a5ffbf7cb58a5b6a8201114fe889360',1,'turbojpeg.h']]], - ['tjencodeyuvplanes',['tjEncodeYUVPlanes',['../group___turbo_j_p_e_g.html#gaa791db8598853ddcad24e42897ef1269',1,'turbojpeg.h']]], + ['tjencodeyuv3',['tjEncodeYUV3',['../group___turbo_j_p_e_g.html#gaabe05acd734990053ad1294b5ef239aa',1,'turbojpeg.h']]], + ['tjencodeyuvplanes',['tjEncodeYUVPlanes',['../group___turbo_j_p_e_g.html#ga8a65ed3bd12df57c219d46afbc9008f1',1,'turbojpeg.h']]], ['tjfree',['tjFree',['../group___turbo_j_p_e_g.html#ga8c4a1231dc06a450514c835f6471f137',1,'turbojpeg.h']]], ['tjgeterrorstr',['tjGetErrorStr',['../group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf',1,'turbojpeg.h']]], ['tjgetscalingfactors',['tjGetScalingFactors',['../group___turbo_j_p_e_g.html#ga6449044b9af402999ccf52f401333be8',1,'turbojpeg.h']]], @@ -24,5 +24,5 @@ var searchData= ['tjplaneheight',['tjPlaneHeight',['../group___turbo_j_p_e_g.html#ga1a209696c6a80748f20e134b3c64789f',1,'turbojpeg.h']]], ['tjplanesizeyuv',['tjPlaneSizeYUV',['../group___turbo_j_p_e_g.html#ga6f98d977bfa9d167c97172e876ba61e2',1,'turbojpeg.h']]], ['tjplanewidth',['tjPlaneWidth',['../group___turbo_j_p_e_g.html#ga63fb66bb1e36c74008c4634360becbb1',1,'turbojpeg.h']]], - ['tjtransform',['tjTransform',['../group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616',1,'turbojpeg.h']]] + ['tjtransform',['tjTransform',['../group___turbo_j_p_e_g.html#gad02cd42b69f193a0623a9c801788df3a',1,'turbojpeg.h']]] ]; diff --git a/doc/html/structtjregion.html b/doc/html/structtjregion.html index d22c09ed..af2a473f 100644 --- a/doc/html/structtjregion.html +++ b/doc/html/structtjregion.html @@ -24,7 +24,7 @@ diff --git a/doc/html/structtjscalingfactor.html b/doc/html/structtjscalingfactor.html index f7b7c84f..3bb50f5f 100644 --- a/doc/html/structtjscalingfactor.html +++ b/doc/html/structtjscalingfactor.html @@ -24,7 +24,7 @@ diff --git a/doc/html/structtjtransform.html b/doc/html/structtjtransform.html index 7a07c2aa..9fd97f7b 100644 --- a/doc/html/structtjtransform.html +++ b/doc/html/structtjtransform.html @@ -24,7 +24,7 @@ @@ -133,7 +133,7 @@ Data Fields - +
handlea handle to a TurboJPEG transformer instance
jpegBufpointer to a buffer containing the JPEG source image to transform. This buffer is not modified.
jpegBufpointer to a buffer containing the JPEG source image to transform
jpegSizesize of the JPEG source image (in bytes)
nthe number of transformed JPEG images to generate
dstBufspointer to an array of n image buffers. dstBufs[i] will receive a JPEG image that has been transformed using the parameters in transforms[i]. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:
    diff --git a/doc/html/index.html b/doc/html/index.html index ccaa12e4..3cc1b3e2 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -24,7 +24,7 @@
TurboJPEG -  1.4 +  1.5
TurboJPEG -  1.4 +  1.5
TurboJPEG -  1.4 +  1.5
TurboJPEG -  1.4 +  1.5
TurboJPEG -  1.4 +  1.5
arrayRegiontjregion structure containing the width and height of the array pointed to by coeffs as well as its offset relative to the component plane. TurboJPEG implementations may choose to split each component plane into multiple DCT coefficient arrays and call the callback function once for each array.
planeRegiontjregion structure containing the width and height of the component plane to which coeffs belongs
componentIDID number of the component plane to which coeffs belongs (Y, Cb, and Cr have, respectively, ID's of 0, 1, and 2 in typical JPEG images.)
transformIDID number of the transformed image to which coeffs belongs. This is the same as the index of the transform in the transforms array that was passed to tjTransform().
transformIDID number of the transformed image to which coeffs belongs. This is the same as the index of the transform in the transforms array that was passed to tjTransform().
transforma pointer to a tjtransform structure that specifies the parameters and/or cropping region for this transform
diff --git a/doxygen.config b/doxygen.config index 4ffba681..17231237 100644 --- a/doxygen.config +++ b/doxygen.config @@ -1,5 +1,5 @@ PROJECT_NAME = TurboJPEG -PROJECT_NUMBER = 1.4 +PROJECT_NUMBER = 1.5 OUTPUT_DIRECTORY = doc/ USE_WINDOWS_ENCODING = NO OPTIMIZE_OUTPUT_FOR_C = YES diff --git a/example.c b/example.c index 0a65a6cc..ac27f498 100644 --- a/example.c +++ b/example.c @@ -58,7 +58,7 @@ * RGB color and is described by: */ -extern JSAMPLE * image_buffer; /* Points to large array of R,G,B-order data */ +extern JSAMPLE *image_buffer; /* Points to large array of R,G,B-order data */ extern int image_height; /* Number of rows in image */ extern int image_width; /* Number of columns in image */ @@ -69,7 +69,7 @@ extern int image_width; /* Number of columns in image */ */ GLOBAL(void) -write_JPEG_file (char * filename, int quality) +write_JPEG_file (char *filename, int quality) { /* This struct contains the JPEG compression parameters and pointers to * working space (which is allocated as needed by the JPEG library). @@ -88,7 +88,7 @@ write_JPEG_file (char * filename, int quality) */ struct jpeg_error_mgr jerr; /* More stuff */ - FILE * outfile; /* target file */ + FILE *outfile; /* target file */ JSAMPROW row_pointer[1]; /* pointer to JSAMPLE row[s] */ int row_stride; /* physical row width in image buffer */ @@ -253,7 +253,7 @@ struct my_error_mgr { jmp_buf setjmp_buffer; /* for return to caller */ }; -typedef struct my_error_mgr * my_error_ptr; +typedef struct my_error_mgr *my_error_ptr; /* * Here's the routine that will replace the standard error_exit method: @@ -281,7 +281,7 @@ my_error_exit (j_common_ptr cinfo) GLOBAL(int) -read_JPEG_file (char * filename) +read_JPEG_file (char *filename) { /* This struct contains the JPEG decompression parameters and pointers to * working space (which is allocated as needed by the JPEG library). @@ -293,7 +293,7 @@ read_JPEG_file (char * filename) */ struct my_error_mgr jerr; /* More stuff */ - FILE * infile; /* source file */ + FILE *infile; /* source file */ JSAMPARRAY buffer; /* Output row buffer */ int row_stride; /* physical row width in output buffer */ diff --git a/jaricom.c b/jaricom.c index f43e2ea7..3bb557f7 100644 --- a/jaricom.c +++ b/jaricom.c @@ -1,9 +1,12 @@ /* * jaricom.c * + * This file was part of the Independent JPEG Group's software: * Developed 1997-2009 by Guido Vollbeding. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. + * libjpeg-turbo Modifications: + * Copyright (C) 2015, D. R. Commander. + * For conditions of distribution and use, see the accompanying README.ijg + * file. * * This file contains probability estimation tables for common use in * arithmetic entropy encoding and decoding routines. @@ -18,7 +21,7 @@ #include "jpeglib.h" /* The following #define specifies the packing of the four components - * into the compact INT32 representation. + * into the compact JLONG representation. * Note that this formula must match the actual arithmetic encoder * and decoder implementation. The implementation has to be changed * if this formula is changed. @@ -26,9 +29,9 @@ * implementation (jbig_tab.c). */ -#define V(i,a,b,c,d) (((INT32)a << 16) | ((INT32)c << 8) | ((INT32)d << 7) | b) +#define V(i,a,b,c,d) (((JLONG)a << 16) | ((JLONG)c << 8) | ((JLONG)d << 7) | b) -const INT32 jpeg_aritab[113+1] = { +const JLONG jpeg_aritab[113+1] = { /* * Index, Qe_Value, Next_Index_LPS, Next_Index_MPS, Switch_MPS */ diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt index 602a82f7..e21cfa9c 100644 --- a/java/CMakeLists.txt +++ b/java/CMakeLists.txt @@ -5,6 +5,7 @@ set(JAVA_CLASSNAMES org/libjpegturbo/turbojpeg/TJ org/libjpegturbo/turbojpeg/TJCompressor org/libjpegturbo/turbojpeg/TJCustomFilter org/libjpegturbo/turbojpeg/TJDecompressor + org/libjpegturbo/turbojpeg/TJException org/libjpegturbo/turbojpeg/TJScalingFactor org/libjpegturbo/turbojpeg/TJTransform org/libjpegturbo/turbojpeg/TJTransformer diff --git a/java/Makefile.am b/java/Makefile.am index 23e34129..d3fc59c7 100644 --- a/java/Makefile.am +++ b/java/Makefile.am @@ -10,6 +10,7 @@ JAVASOURCES = org/libjpegturbo/turbojpeg/TJ.java \ org/libjpegturbo/turbojpeg/TJCompressor.java \ org/libjpegturbo/turbojpeg/TJCustomFilter.java \ org/libjpegturbo/turbojpeg/TJDecompressor.java \ + org/libjpegturbo/turbojpeg/TJException.java \ org/libjpegturbo/turbojpeg/TJScalingFactor.java \ org/libjpegturbo/turbojpeg/TJTransform.java \ org/libjpegturbo/turbojpeg/TJTransformer.java \ @@ -31,6 +32,7 @@ JAVA_CLASSES = org/libjpegturbo/turbojpeg/TJ.class \ org/libjpegturbo/turbojpeg/TJCompressor.class \ org/libjpegturbo/turbojpeg/TJCustomFilter.class \ org/libjpegturbo/turbojpeg/TJDecompressor.class \ + org/libjpegturbo/turbojpeg/TJException.class \ org/libjpegturbo/turbojpeg/TJLoader.class \ org/libjpegturbo/turbojpeg/TJScalingFactor.class \ org/libjpegturbo/turbojpeg/TJTransform.class \ @@ -42,7 +44,7 @@ JAVA_CLASSES = org/libjpegturbo/turbojpeg/TJ.class \ all: all-am turbojpeg.jar -turbojpeg.jar: $(JAVA_CLASSES) ${srcdir}/MANIFEST.MF +turbojpeg.jar: classnoinst.stamp ${srcdir}/MANIFEST.MF $(JAR) cfm turbojpeg.jar ${srcdir}/MANIFEST.MF $(JAVA_CLASSES) clean-local: diff --git a/java/TJBench.java b/java/TJBench.java index c9d110c3..19db789c 100644 --- a/java/TJBench.java +++ b/java/TJBench.java @@ -1,5 +1,5 @@ /* - * Copyright (C)2009-2014 D. R. Commander. All Rights Reserved. + * Copyright (C)2009-2014, 2016 D. R. Commander. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -35,7 +35,7 @@ import org.libjpegturbo.turbojpeg.*; class TJBench { static int flags = 0, quiet = 0, pf = TJ.PF_BGR, yuvpad = 1, warmup = 1; - static boolean compOnly, decompOnly, doTile, doYUV; + static boolean compOnly, decompOnly, doTile, doYUV, write; static final String[] pixFormatStr = { "RGB", "BGR", "RGBX", "BGRX", "XBGR", "XRGB", "GRAY" @@ -223,6 +223,8 @@ class TJBench { } } + if (!write) return; + if (sf.getNum() != 1 || sf.getDenom() != 1) sizeStr = new String(sf.getNum() + "_" + sf.getDenom()); else if (tilew != w || tileh != h) @@ -394,7 +396,7 @@ class TJBench { System.out.format(" Output bit stream: %f Megabits/sec\n", (double)totalJpegSize * 8. / 1000000. * (double)iter / elapsed); } - if (tilew == w && tileh == h) { + if (tilew == w && tileh == h && write) { String tempStr = fileName + "_" + subName[subsamp] + "_" + "Q" + jpegQual + ".jpg"; FileOutputStream fos = new FileOutputStream(tempStr); @@ -659,7 +661,9 @@ class TJBench { System.out.println("-benchtime = Run each benchmark for at least seconds (default = 5.0)"); System.out.println("-warmup = Execute each benchmark times to prime the cache before"); System.out.println(" taking performance measurements (default = 1)"); - System.out.println("-componly = Stop after running compression tests. Do not test decompression.\n"); + System.out.println("-componly = Stop after running compression tests. Do not test decompression."); + System.out.println("-nowrite = Do not write reference or output images (improves consistency"); + System.out.println(" of performance measurements.)\n"); System.out.println("NOTE: If the quality is specified as a range (e.g. 90-100), a separate"); System.out.println("test will be performed for all quality values in the range.\n"); System.exit(1); @@ -817,6 +821,8 @@ class TJBench { } if (argv[i].equalsIgnoreCase("-componly")) compOnly = true; + if (argv[i].equalsIgnoreCase("-nowrite")) + write = false; if (argv[i].equalsIgnoreCase("-warmup") && i < argv.length - 1) { int temp = -1; try { diff --git a/java/TJExample.java b/java/TJExample.java index 75621143..da098078 100644 --- a/java/TJExample.java +++ b/java/TJExample.java @@ -1,5 +1,5 @@ /* - * Copyright (C)2011-2012, 2014 D. R. Commander. All Rights Reserved. + * Copyright (C)2011-2012, 2014-2015 D. R. Commander. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -351,7 +351,7 @@ public class TJExample implements TJCustomFilter { public void customFilter(ShortBuffer coeffBuffer, Rectangle bufferRegion, Rectangle planeRegion, int componentIndex, int transformIndex, TJTransform transform) - throws Exception { + throws TJException { for (int i = 0; i < bufferRegion.width * bufferRegion.height; i++) { coeffBuffer.put(i, (short)(-coeffBuffer.get(i))); } diff --git a/java/TJUnitTest.java b/java/TJUnitTest.java index d4726b39..444e7985 100644 --- a/java/TJUnitTest.java +++ b/java/TJUnitTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C)2011-2015 D. R. Commander. All Rights Reserved. + * Copyright (C)2011-2016 D. R. Commander. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -892,6 +892,9 @@ public class TJUnitTest { else tjc.compress(dstBuf, 0); } + dstImage = null; + dstBuf = null; + System.gc(); } } System.out.println("Done. "); diff --git a/java/doc/allclasses-frame.html b/java/doc/allclasses-frame.html index 509ea508..fecac06d 100644 --- a/java/doc/allclasses-frame.html +++ b/java/doc/allclasses-frame.html @@ -13,6 +13,7 @@
  • TJCompressor
  • TJCustomFilter
  • TJDecompressor
  • +
  • TJException
  • TJScalingFactor
  • TJTransform
  • TJTransformer
  • diff --git a/java/doc/allclasses-noframe.html b/java/doc/allclasses-noframe.html index 3eac18fa..1f7fd3c6 100644 --- a/java/doc/allclasses-noframe.html +++ b/java/doc/allclasses-noframe.html @@ -13,6 +13,7 @@
  • TJCompressor
  • TJCustomFilter
  • TJDecompressor
  • +
  • TJException
  • TJScalingFactor
  • TJTransform
  • TJTransformer
  • diff --git a/java/doc/index-all.html b/java/doc/index-all.html index 1af78bed..a02d9c46 100644 --- a/java/doc/index-all.html +++ b/java/doc/index-all.html @@ -821,6 +821,16 @@ source image stored in yuvImage with the newly created instance.
    +
    TJException - Exception in org.libjpegturbo.turbojpeg
    +
     
    +
    TJException() - Constructor for exception org.libjpegturbo.turbojpeg.TJException
    +
     
    +
    TJException(String, Throwable) - Constructor for exception org.libjpegturbo.turbojpeg.TJException
    +
     
    +
    TJException(String) - Constructor for exception org.libjpegturbo.turbojpeg.TJException
    +
     
    +
    TJException(Throwable) - Constructor for exception org.libjpegturbo.turbojpeg.TJException
    +
     
    TJScalingFactor - Class in org.libjpegturbo.turbojpeg
    Fractional scaling factor
    diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJ.html b/java/doc/org/libjpegturbo/turbojpeg/TJ.html index f8342f24..ffef6578 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/TJ.html +++ b/java/doc/org/libjpegturbo/turbojpeg/TJ.html @@ -983,16 +983,13 @@ public static final int FLAG_FORCESSE3
    • getMCUWidth

      -
      public static int getMCUWidth(int subsamp)
      -                       throws java.lang.Exception
      +
      public static int getMCUWidth(int subsamp)
      Returns the MCU block width for the given level of chrominance subsampling.
      Parameters:
      subsamp - the level of chrominance subsampling (one of SAMP_*)
      Returns:
      the MCU block width for the given level of chrominance - subsampling.
      -
      Throws:
      -
      java.lang.Exception
      + subsampling.
    @@ -1001,16 +998,13 @@ public static final int FLAG_FORCESSE3
    • getMCUHeight

      -
      public static int getMCUHeight(int subsamp)
      -                        throws java.lang.Exception
      +
      public static int getMCUHeight(int subsamp)
      Returns the MCU block height for the given level of chrominance subsampling.
      Parameters:
      subsamp - the level of chrominance subsampling (one of SAMP_*)
      Returns:
      the MCU block height for the given level of chrominance - subsampling.
      -
      Throws:
      -
      java.lang.Exception
      + subsampling.
    @@ -1019,13 +1013,10 @@ public static final int FLAG_FORCESSE3
    • getPixelSize

      -
      public static int getPixelSize(int pixelFormat)
      -                        throws java.lang.Exception
      +
      public static int getPixelSize(int pixelFormat)
      Returns the pixel size (in bytes) for the given pixel format.
      Parameters:
      pixelFormat - the pixel format (one of PF_*)
      -
      Returns:
      the pixel size (in bytes) for the given pixel format.
      -
      Throws:
      -
      java.lang.Exception
      +
      Returns:
      the pixel size (in bytes) for the given pixel format.
    @@ -1034,17 +1025,14 @@ public static final int FLAG_FORCESSE3
    • getRedOffset

      -
      public static int getRedOffset(int pixelFormat)
      -                        throws java.lang.Exception
      +
      public static int getRedOffset(int pixelFormat)
      For the given pixel format, returns the number of bytes that the red component is offset from the start of the pixel. For instance, if a pixel of format TJ.PF_BGRX is stored in char pixel[], then the red component will be pixel[TJ.getRedOffset(TJ.PF_BGRX)].
      Parameters:
      pixelFormat - the pixel format (one of PF_*)
      -
      Returns:
      the red offset for the given pixel format.
      -
      Throws:
      -
      java.lang.Exception
      +
      Returns:
      the red offset for the given pixel format.
    @@ -1053,17 +1041,14 @@ public static final int FLAG_FORCESSE3
    • getGreenOffset

      -
      public static int getGreenOffset(int pixelFormat)
      -                          throws java.lang.Exception
      +
      public static int getGreenOffset(int pixelFormat)
      For the given pixel format, returns the number of bytes that the green component is offset from the start of the pixel. For instance, if a pixel of format TJ.PF_BGRX is stored in char pixel[], then the green component will be pixel[TJ.getGreenOffset(TJ.PF_BGRX)].
      Parameters:
      pixelFormat - the pixel format (one of PF_*)
      -
      Returns:
      the green offset for the given pixel format.
      -
      Throws:
      -
      java.lang.Exception
      +
      Returns:
      the green offset for the given pixel format.
    @@ -1072,17 +1057,14 @@ public static final int FLAG_FORCESSE3
    • getBlueOffset

      -
      public static int getBlueOffset(int pixelFormat)
      -                         throws java.lang.Exception
      +
      public static int getBlueOffset(int pixelFormat)
      For the given pixel format, returns the number of bytes that the blue component is offset from the start of the pixel. For instance, if a pixel of format TJ.PF_BGRX is stored in char pixel[], then the blue component will be pixel[TJ.getBlueOffset(TJ.PF_BGRX)].
      Parameters:
      pixelFormat - the pixel format (one of PF_*)
      -
      Returns:
      the blue offset for the given pixel format.
      -
      Throws:
      -
      java.lang.Exception
      +
      Returns:
      the blue offset for the given pixel format.
    @@ -1093,16 +1075,13 @@ public static final int FLAG_FORCESSE3

    bufSize

    public static int bufSize(int width,
               int height,
    -          int jpegSubsamp)
    -                   throws java.lang.Exception
    + int jpegSubsamp)
    Returns the maximum size of the buffer (in bytes) required to hold a JPEG image with the given width, height, and level of chrominance subsampling.
    Parameters:
    width - the width (in pixels) of the JPEG image
    height - the height (in pixels) of the JPEG image
    jpegSubsamp - the level of chrominance subsampling to be used when generating the JPEG image (one of TJ.SAMP_*)
    Returns:
    the maximum size of the buffer (in bytes) required to hold a JPEG - image with the given width, height, and level of chrominance subsampling.
    -
    Throws:
    -
    java.lang.Exception
    + image with the given width, height, and level of chrominance subsampling. @@ -1114,17 +1093,14 @@ public static final int FLAG_FORCESSE3
    public static int bufSizeYUV(int width,
                  int pad,
                  int height,
    -             int subsamp)
    -                      throws java.lang.Exception
    + int subsamp)
    Returns the size of the buffer (in bytes) required to hold a YUV planar image with the given width, height, and level of chrominance subsampling.
    Parameters:
    width - the width (in pixels) of the YUV image
    pad - the width of each line in each plane of the image is padded to the nearest multiple of this number of bytes (must be a power of 2.)
    height - the height (in pixels) of the YUV image
    subsamp - the level of chrominance subsampling used in the YUV image (one of TJ.SAMP_*)
    Returns:
    the size of the buffer (in bytes) required to hold a YUV planar - image with the given width, height, and level of chrominance subsampling.
    -
    Throws:
    -
    java.lang.Exception
    + image with the given width, height, and level of chrominance subsampling. @@ -1136,11 +1112,8 @@ public static final int FLAG_FORCESSE3
    @Deprecated
     public static int bufSizeYUV(int width,
                             int height,
    -                        int subsamp)
    -                      throws java.lang.Exception
    + int subsamp)
    -
    Throws:
    -
    java.lang.Exception
    @@ -1153,8 +1126,7 @@ public static int bufSizeYUV(int width, int width, int stride, int height, - int subsamp) - throws java.lang.Exception + int subsamp)
    Returns the size of the buffer (in bytes) required to hold a YUV image plane with the given parameters.
    Parameters:
    componentID - ID number of the image plane (0 = Y, 1 = U/Cb, @@ -1163,9 +1135,7 @@ public static int bufSizeYUV(int width, height of the whole image, not the plane height.
    subsamp - the level of chrominance subsampling used in the YUV image (one of TJ.SAMP_*)
    Returns:
    the size of the buffer (in bytes) required to hold a YUV planar - image with the given parameters.
    -
    Throws:
    -
    java.lang.Exception
    + image with the given parameters. @@ -1176,16 +1146,13 @@ public static int bufSizeYUV(int width,

    planeWidth

    public static int planeWidth(int componentID,
                  int width,
    -             int subsamp)
    -                      throws java.lang.Exception
    + int subsamp)
    Parameters:
    componentID - ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr)
    width - width (in pixels) of the YUV image
    subsamp - the level of chrominance subsampling used in the YUV image (one of TJ.SAMP_*)
    -
    Returns:
    the plane width of a YUV image plane with the given parameters.
    -
    Throws:
    -
    java.lang.Exception
    +
    Returns:
    the plane width of a YUV image plane with the given parameters.
    @@ -1196,16 +1163,13 @@ public static int bufSizeYUV(int width,

    planeHeight

    public static int planeHeight(int componentID,
                   int height,
    -              int subsamp)
    -                       throws java.lang.Exception
    + int subsamp)
    Parameters:
    componentID - ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr)
    height - height (in pixels) of the YUV image
    subsamp - the level of chrominance subsampling used in the YUV image (one of TJ.SAMP_*)
    -
    Returns:
    the plane height of a YUV image plane with the given parameters.
    -
    Throws:
    -
    java.lang.Exception
    +
    Returns:
    the plane height of a YUV image plane with the given parameters.
    @@ -1214,14 +1178,11 @@ public static int bufSizeYUV(int width,
    • getScalingFactors

      -
      public static TJScalingFactor[] getScalingFactors()
      -                                           throws java.lang.Exception
      +
      public static TJScalingFactor[] getScalingFactors()
      Returns a list of fractional scaling factors that the JPEG decompressor in this implementation of TurboJPEG supports.
      Returns:
      a list of fractional scaling factors that the JPEG decompressor in - this implementation of TurboJPEG supports.
      -
      Throws:
      -
      java.lang.Exception
      + this implementation of TurboJPEG supports.
    diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJCompressor.html b/java/doc/org/libjpegturbo/turbojpeg/TJCompressor.html index b7fa3db4..29f12b79 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/TJCompressor.html +++ b/java/doc/org/libjpegturbo/turbojpeg/TJCompressor.html @@ -90,10 +90,15 @@
    • +
      +
      All Implemented Interfaces:
      +
      java.io.Closeable, java.lang.AutoCloseable
      +


      public class TJCompressor
      -extends java.lang.Object
      +extends java.lang.Object +implements java.io.Closeable
      TurboJPEG compressor
    @@ -376,10 +381,10 @@ extends java.lang.Object
  • TJCompressor

    public TJCompressor()
    -             throws java.lang.Exception
    + throws TJException
    Create a TurboJPEG compressor instance.
    Throws:
    -
    java.lang.Exception
    +
    TJException
  • @@ -395,14 +400,14 @@ extends java.lang.Object int pitch, int height, int pixelFormat) - throws java.lang.Exception + throws TJException
    Create a TurboJPEG compressor instance and associate the uncompressed source image stored in srcImage with the newly created instance.
    Parameters:
    srcImage - see setSourceImage(byte[], int, int, int, int, int, int) for description
    x - see setSourceImage(byte[], int, int, int, int, int, int) for description
    y - see setSourceImage(byte[], int, int, int, int, int, int) for description
    width - see setSourceImage(byte[], int, int, int, int, int, int) for description
    pitch - see setSourceImage(byte[], int, int, int, int, int, int) for description
    height - see setSourceImage(byte[], int, int, int, int, int, int) for description
    pixelFormat - pixel format of the source image (one of TJ.PF_*)
    Throws:
    -
    java.lang.Exception
    +
    TJException
    @@ -417,11 +422,11 @@ public TJCompressor(byte[] srcImage, int pitch, int height, int pixelFormat) - throws java.lang.Exception + throws TJException
    Throws:
    -
    java.lang.Exception
    +
    TJException
    @@ -435,7 +440,7 @@ public TJCompressor(byte[] srcImage, int y, int width, int height) - throws java.lang.Exception + throws TJException
    Create a TurboJPEG compressor instance and associate the uncompressed source image stored in srcImage with the newly created instance.
    @@ -446,7 +451,7 @@ public TJCompressor(byte[] srcImage, setSourceImage(BufferedImage, int, int, int, int) for description
    height - see setSourceImage(BufferedImage, int, int, int, int) for description
    Throws:
    -
    java.lang.Exception
    +
    TJException
    @@ -470,7 +475,7 @@ public TJCompressor(byte[] srcImage, int pitch, int height, int pixelFormat) - throws java.lang.Exception + throws TJException
    Associate an uncompressed RGB, grayscale, or CMYK source image with this compressor instance.
    Parameters:
    srcImage - image buffer containing RGB, grayscale, or CMYK pixels to @@ -488,7 +493,7 @@ public TJCompressor(byte[] srcImage, which the JPEG or YUV image should be compressed/encoded
    pixelFormat - pixel format of the source image (one of TJ.PF_*)
    Throws:
    -
    java.lang.Exception
    +
    TJException
    @@ -503,11 +508,11 @@ public void setSourceImage(byte[] srcImage, int pitch, int height, int pixelFormat) - throws java.lang.Exception + throws TJException
    Throws:
    -
    java.lang.Exception
    +
    TJException
    @@ -521,7 +526,7 @@ public void setSourceImage(byte[] srcImage, int y, int width, int height) - throws java.lang.Exception + throws TJException
    Associate an uncompressed RGB or grayscale source image with this compressor instance.
    Parameters:
    srcImage - a BufferedImage instance containing RGB or @@ -533,7 +538,7 @@ public void setSourceImage(byte[] srcImage, which the JPEG or YUV image should be compressed/encoded (0 = use the height of the source image)
    Throws:
    -
    java.lang.Exception
    +
    TJException
    @@ -543,13 +548,13 @@ public void setSourceImage(byte[] srcImage,
  • setSourceImage

    public void setSourceImage(YUVImage srcImage)
    -                    throws java.lang.Exception
    + throws TJException
    Associate an uncompressed YUV planar source image with this compressor instance.
    Parameters:
    srcImage - YUV planar image to be compressed. This image is not modified.
    Throws:
    -
    java.lang.Exception
    +
    TJException
  • @@ -558,8 +563,7 @@ public void setSourceImage(byte[] srcImage, @@ -588,13 +590,10 @@ public void setSourceImage(byte[] srcImage,
    • setJPEGQuality

      -
      public void setJPEGQuality(int quality)
      -                    throws java.lang.Exception
      +
      public void setJPEGQuality(int quality)
      Set the JPEG image quality level for subsequent compress operations.
      Parameters:
      quality - the new JPEG image quality level (1 to 100, 1 = worst, - 100 = best)
      -
      Throws:
      -
      java.lang.Exception
      + 100 = best)
    @@ -605,7 +604,7 @@ public void setSourceImage(byte[] srcImage,

    compress

    public void compress(byte[] dstBuf,
                 int flags)
    -              throws java.lang.Exception
    + throws
    TJException
    Compress the uncompressed source image associated with this compressor instance and output a JPEG image to the given destination buffer.
    Parameters:
    dstBuf - buffer that will receive the JPEG image. Use @@ -614,7 +613,7 @@ public void setSourceImage(byte[] srcImage, subsampling.
    flags - the bitwise OR of one or more of TJ.FLAG_*
    Throws:
    -
    java.lang.Exception
    +
    TJException
    @@ -624,7 +623,7 @@ public void setSourceImage(byte[] srcImage,
  • compress

    public byte[] compress(int flags)
    -                throws java.lang.Exception
    + throws
    TJException
    Compress the uncompressed source image associated with this compressor instance and return a buffer containing a JPEG image.
    Parameters:
    flags - the bitwise OR of one or more of @@ -632,7 +631,7 @@ public void setSourceImage(byte[] srcImage,
    Returns:
    a buffer containing a JPEG image. The length of this buffer will not be equal to the size of the JPEG image. Use getCompressedSize() to obtain the size of the JPEG image.
    Throws:
    -
    java.lang.Exception
    +
    TJException
  • @@ -645,12 +644,12 @@ public void setSourceImage(byte[] srcImage, public void compress(java.awt.image.BufferedImage srcImage, byte[] dstBuf, int flags) - throws java.lang.Exception + throws TJException
    Throws:
    -
    java.lang.Exception
    +
    TJException
    @@ -662,12 +661,12 @@ public void compress(java.awt.image.BufferedImage srcImage,
    @Deprecated
     public byte[] compress(java.awt.image.BufferedImage srcImage,
                              int flags)
    -                throws java.lang.Exception
    + throws
    TJException
    Throws:
    -
    java.lang.Exception
    +
    TJException
    @@ -678,7 +677,7 @@ public byte[] compress(java.awt.image.BufferedImage srcImage,

    encodeYUV

    public void encodeYUV(YUVImage dstImage,
                  int flags)
    -               throws java.lang.Exception
    + throws TJException
    Encode the uncompressed source image associated with this compressor instance into a YUV planar image and store it in the given YUVImage instance. This method uses the accelerated color @@ -689,7 +688,7 @@ public byte[] compress(java.awt.image.BufferedImage srcImage, image
    flags - the bitwise OR of one or more of TJ.FLAG_*
    Throws:
    -
    java.lang.Exception
    +
    TJException
    @@ -701,10 +700,10 @@ public byte[] compress(java.awt.image.BufferedImage srcImage,
    @Deprecated
     public void encodeYUV(byte[] dstBuf,
                             int flags)
    -               throws java.lang.Exception
    + throws
    TJException
    Deprecated. Use encodeYUV(YUVImage, int) instead.
    Throws:
    -
    java.lang.Exception
    +
    TJException
    @@ -715,7 +714,7 @@ public void encodeYUV(byte[] dstBuf,

    encodeYUV

    public YUVImage encodeYUV(int pad,
                      int flags)
    -                   throws java.lang.Exception
    + throws TJException
    Encode the uncompressed source image associated with this compressor instance into a unified YUV planar image buffer and return a YUVImage instance containing the encoded image. This method @@ -728,7 +727,7 @@ public void encodeYUV(byte[] dstBuf, TJ.FLAG_*
    Returns:
    a YUV planar image.
    Throws:
    -
    java.lang.Exception
    +
    TJException
    @@ -739,7 +738,7 @@ public void encodeYUV(byte[] dstBuf,

    encodeYUV

    public YUVImage encodeYUV(int[] strides,
                      int flags)
    -                   throws java.lang.Exception
    + throws TJException
    Encode the uncompressed source image associated with this compressor instance into separate Y, U (Cb), and V (Cr) image planes and return a YUVImage instance containing the encoded image planes. This @@ -756,7 +755,7 @@ public void encodeYUV(byte[] dstBuf, TJ.FLAG_*
    Returns:
    a YUV planar image.
    Throws:
    -
    java.lang.Exception
    +
    TJException
    @@ -767,10 +766,10 @@ public void encodeYUV(byte[] dstBuf,

    encodeYUV

    @Deprecated
     public byte[] encodeYUV(int flags)
    -                 throws java.lang.Exception
    + throws
    TJException
    Deprecated. Use encodeYUV(int, int) instead.
    Throws:
    -
    java.lang.Exception
    +
    TJException
    @@ -783,12 +782,12 @@ public byte[] encodeYUV(int flags) public void encodeYUV(java.awt.image.BufferedImage srcImage, byte[] dstBuf, int flags) - throws java.lang.Exception + throws TJException
    Throws:
    -
    java.lang.Exception
    +
    TJException
    @@ -800,12 +799,12 @@ public void encodeYUV(java.awt.image.BufferedImage srcImage,
    @Deprecated
     public byte[] encodeYUV(java.awt.image.BufferedImage srcImage,
                               int flags)
    -                 throws java.lang.Exception
    + throws
    TJException
    Throws:
    -
    java.lang.Exception
    +
    TJException
    @@ -828,10 +827,15 @@ public byte[] encodeYUV(java.awt.image.BufferedImage srcImage,
  • close

    public void close()
    -           throws java.lang.Exception
    + throws
    TJException
    Free the native structures associated with this compressor instance.
    -
    Throws:
    -
    java.lang.Exception
    +
    +
    Specified by:
    +
    close in interface java.io.Closeable
    +
    Specified by:
    +
    close in interface java.lang.AutoCloseable
    +
    Throws:
    +
    TJException
  • diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJCustomFilter.html b/java/doc/org/libjpegturbo/turbojpeg/TJCustomFilter.html index c2b6e613..6bd6fd27 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/TJCustomFilter.html +++ b/java/doc/org/libjpegturbo/turbojpeg/TJCustomFilter.html @@ -144,7 +144,7 @@ int componentID, int transformID, TJTransform transform) - throws java.lang.Exception + throws TJException
    A callback function that can be used to modify the DCT coefficients after they are losslessly transformed but before they are transcoded to a new JPEG image. This allows for custom filters or other transformations to be @@ -165,7 +165,7 @@ transform in the transforms array that was passed to TJTransformer.transform().
    transform - a TJTransform instance that specifies the parameters and/or cropping region for this transform
    Throws:
    -
    java.lang.Exception
    +
    TJException
    diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html b/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html index dc1dcbdc..a914de9e 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html +++ b/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html @@ -33,7 +33,7 @@