Merge pull request #121 from dcommander/libjpeg-turbo-diff-review
Documentation and code cleanup from DRC
This commit is contained in:
233
BUILDING.txt
233
BUILDING.txt
@@ -35,21 +35,9 @@ Build Requirements
|
||||
|
||||
NOTE: the NASM build will fail if texinfo is not installed.
|
||||
|
||||
-- GCC v4.1 or later recommended for best performance
|
||||
* Beginning with Xcode 4, Apple stopped distributing GCC and switched to
|
||||
the LLVM compiler. Xcode v4.0 through v4.6 provides a GCC front end
|
||||
called LLVM-GCC. Unfortunately, as of this writing, neither LLVM-GCC nor
|
||||
the LLVM (clang) compiler produces optimal performance with libmozjpeg.
|
||||
Building libmozjpeg with LLVM-GCC v4.2 results in a 10% performance
|
||||
degradation when compressing using 64-bit code, relative to building
|
||||
libmozjpeg with GCC v4.2. Building libmozjpeg with LLVM (clang)
|
||||
results in a 20% performance degradation when compressing using 64-bit
|
||||
code, relative to building libmozjpeg with GCC v4.2. If you are
|
||||
running Snow Leopard or earlier, it is suggested that you continue to use
|
||||
Xcode v3.2.6, which provides GCC v4.2. If you are using Lion or later, it
|
||||
is suggested that you install Apple GCC v4.2 through MacPorts.
|
||||
-- GCC v4.1 (or later) or clang recommended
|
||||
|
||||
-- If building the MozJPEG Java wrapper, JDK or OpenJDK 1.5 or later is
|
||||
-- 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 later, it will
|
||||
be necessary to install the Java Developer Package, which can be downloaded
|
||||
@@ -64,19 +52,19 @@ 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 libmozjpeg source directory. You
|
||||
need not necessarily be the same as the mozjpeg source directory. You
|
||||
can create multiple independent binary directories, in which different versions
|
||||
of libmozjpeg can be built from the same source tree using different
|
||||
of mozjpeg 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 libmozjpeg source
|
||||
binary directory, whereas {source_directory} refers to the mozjpeg source
|
||||
directory. For in-tree builds, these directories are the same.
|
||||
|
||||
|
||||
======================
|
||||
Building libmozjpeg
|
||||
======================
|
||||
================
|
||||
Building mozjpeg
|
||||
================
|
||||
|
||||
The following procedure will build libmozjpeg on Linux, FreeBSD, Cygwin, and
|
||||
The following procedure will build mozjpeg on Linux, FreeBSD, Cygwin, and
|
||||
Solaris/x86 systems (on Solaris, this generates a 32-bit library. See below
|
||||
for 64-bit build instructions.)
|
||||
|
||||
@@ -86,9 +74,6 @@ for 64-bit build instructions.)
|
||||
sh {source_directory}/configure [additional configure flags]
|
||||
make
|
||||
|
||||
NOTE: Running autoreconf in the source directory is usually only necessary if
|
||||
building libmozjpeg from the SVN repository.
|
||||
|
||||
This will generate the following files under .libs/
|
||||
|
||||
libjpeg.a
|
||||
@@ -110,28 +95,28 @@ This will generate the following files under .libs/
|
||||
libjpeg.dll.a (Cygwin)
|
||||
Import library for the libjpeg API
|
||||
|
||||
libmozjpeg.a
|
||||
Static link library for the MozJPEG API
|
||||
libturbojpeg.a
|
||||
Static link library for the TurboJPEG API
|
||||
|
||||
libmozjpeg.so.0.0.0 (Linux, Unix)
|
||||
libmozjpeg.0.0.0.dylib (OS X)
|
||||
cygmozjpeg-0.dll (Cygwin)
|
||||
Shared library for the MozJPEG 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
|
||||
|
||||
libmozjpeg.so (Linux, Unix)
|
||||
libmozjpeg.dylib (OS X)
|
||||
Development symlink for the MozJPEG API
|
||||
libturbojpeg.so (Linux, Unix)
|
||||
libturbojpeg.dylib (OS X)
|
||||
Development symlink for the TurboJPEG API
|
||||
|
||||
libmozjpeg.dll.a (Cygwin)
|
||||
Import library for the MozJPEG 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
|
||||
libmozjpeg that is API/ABI-compatible with libjpeg v7. Add --with-jpeg8 to
|
||||
the configure command to build a version of libmozjpeg that is
|
||||
mozjpeg that is API/ABI-compatible with libjpeg v7. Add --with-jpeg8 to
|
||||
the configure command to build a version of mozjpeg that is
|
||||
API/ABI-compatible with libjpeg v8. See README-turbo.txt for more information
|
||||
on libjpeg v7 and v8 emulation.
|
||||
|
||||
@@ -140,7 +125,7 @@ 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 libmozjpeg that lacks the
|
||||
configure command line to build a version of mozjpeg 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-turbo.txt for more information.
|
||||
@@ -150,7 +135,7 @@ Arithmetic Coding Support
|
||||
-------------------------
|
||||
|
||||
Since the patent on arithmetic coding has expired, this functionality has been
|
||||
included in this release of libmozjpeg. libmozjpeg's implementation is
|
||||
included in this release of mozjpeg. mozjpeg'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
|
||||
@@ -158,11 +143,11 @@ add --without-arith-enc or --without-arith-dec to the configure command line to
|
||||
disable encoding or decoding (respectively.)
|
||||
|
||||
|
||||
MozJPEG Java Wrapper
|
||||
TurboJPEG Java Wrapper
|
||||
----------------------
|
||||
Add --with-java to the configure command line to incorporate an optional Java
|
||||
Native Interface wrapper into the MozJPEG shared library and build the Java
|
||||
front-end classes to support it. This allows the MozJPEG shared library to
|
||||
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 for more details.
|
||||
|
||||
You can set the JAVAC, JAR, and JAVA configure variables to specify
|
||||
@@ -173,9 +158,9 @@ to specify arguments that should be passed to the C compiler when building the
|
||||
JNI wrapper. Run 'configure --help' for more details.
|
||||
|
||||
|
||||
========================
|
||||
Installing libmozjpeg
|
||||
========================
|
||||
==================
|
||||
Installing mozjpeg
|
||||
==================
|
||||
|
||||
If you intend to install these libraries and the associated header files, then
|
||||
replace 'make' in the instructions above with
|
||||
@@ -188,16 +173,16 @@ For example,
|
||||
|
||||
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/libmozjpeg/include and the library
|
||||
files in /opt/libmozjpeg/lib32 (32-bit) or /opt/libmozjpeg/lib64
|
||||
is to install the header files in /opt/mozjpeg/include and the library
|
||||
files in /opt/mozjpeg/lib32 (32-bit) or /opt/mozjpeg/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 libmozjpeg into
|
||||
overwriting it. It is recommended that you instead install mozjpeg into
|
||||
a non-system directory and manipulate the LD_LIBRARY_PATH or create symlinks
|
||||
to force applications to use libmozjpeg instead of libjpeg. See
|
||||
to force applications to use mozjpeg instead of libjpeg. See
|
||||
README-turbo.txt for more information.
|
||||
|
||||
|
||||
@@ -284,10 +269,10 @@ Add
|
||||
|
||||
CC=cc
|
||||
|
||||
to the configure command line. libmozjpeg will automatically be built with
|
||||
to the configure command line. mozjpeg will automatically be built with
|
||||
the maximum optimization level (-xO5) unless you override CFLAGS.
|
||||
|
||||
To build a 64-bit version of libmozjpeg using Oracle Solaris Studio, add
|
||||
To build a 64-bit version of mozjpeg using Oracle Solaris Studio, add
|
||||
|
||||
--host x86_64-pc-solaris CC=cc CFLAGS='-xO5 -m64' LDFLAGS=-m64
|
||||
|
||||
@@ -304,19 +289,19 @@ Use CMake (see recipes below)
|
||||
ARM Support
|
||||
===========
|
||||
|
||||
This release of libmozjpeg can use ARM NEON SIMD instructions to accelerate
|
||||
This release of mozjpeg can use ARM NEON SIMD instructions to accelerate
|
||||
JPEG compression/decompression by approximately 2-4x on ARMv7 and later
|
||||
platforms. If libmozjpeg is configured on an ARM Linux platform, then the
|
||||
platforms. If mozjpeg 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 libmozjpeg for iOS
|
||||
------------------------------
|
||||
Building mozjpeg 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
|
||||
libmozjpeg for these platforms.
|
||||
mozjpeg for these platforms.
|
||||
|
||||
Additional build requirements:
|
||||
|
||||
@@ -355,7 +340,7 @@ Set the following shell variables for simplicity:
|
||||
Xcode 5.0.x and later:
|
||||
IOS_CFLAGS="-arch armv7s"
|
||||
|
||||
Follow the procedure under "Building libmozjpeg" above, adding
|
||||
Follow the procedure under "Building mozjpeg" above, adding
|
||||
|
||||
--host arm-apple-darwin10 --enable-static --disable-shared \
|
||||
CC="$IOS_GCC" LD="$IOS_GCC" \
|
||||
@@ -375,12 +360,6 @@ the SDK.
|
||||
Once built, lipo can be used to combine the ARM v6, v7, and/or v7s variants
|
||||
into a universal library.
|
||||
|
||||
NOTE: If you are building libmozjpeg from the "official" project tarball,
|
||||
then it is highly likely that you will need to run 'autoreconf -fiv' in the
|
||||
source tree prior to building ARM v7 or v7s iOS binaries using the techniques
|
||||
described above. Otherwise, you may get a libtool error such as "unable to
|
||||
infer tagged configuration."
|
||||
|
||||
|
||||
Building libjpeg-turbo for Android
|
||||
----------------------------------
|
||||
@@ -440,12 +419,12 @@ Build Requirements
|
||||
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 libmozjpeg.
|
||||
everything necessary to build mozjpeg.
|
||||
|
||||
* You can also use Microsoft Visual Studio Express 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 libmozjpeg from the command line, then add the
|
||||
* If you intend to build mozjpeg 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
|
||||
@@ -467,7 +446,7 @@ Build Requirements
|
||||
-- NASM (http://www.nasm.us/) 0.98 or later (NASM 2.05 or later is required for
|
||||
a 64-bit build)
|
||||
|
||||
-- If building the MozJPEG Java wrapper, JDK 1.5 or later is required. This
|
||||
-- If building the TurboJPEG Java wrapper, JDK 1.5 or later is required. This
|
||||
can be downloaded from http://www.java.com.
|
||||
|
||||
|
||||
@@ -477,17 +456,17 @@ 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 libmozjpeg source directory. You can
|
||||
not necessarily be the same as the mozjpeg source directory. You can
|
||||
create multiple independent binary directories, in which different versions of
|
||||
libmozjpeg can be built from the same source tree using different compilers
|
||||
mozjpeg 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 libmozjpeg source
|
||||
directory, whereas {source_directory} refers to the mozjpeg source
|
||||
directory. For in-tree builds, these directories are the same.
|
||||
|
||||
|
||||
======================
|
||||
Building libmozjpeg
|
||||
======================
|
||||
================
|
||||
Building mozjpeg
|
||||
================
|
||||
|
||||
|
||||
Visual C++ (Command Line)
|
||||
@@ -497,7 +476,7 @@ Visual C++ (Command Line)
|
||||
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release {source_directory}
|
||||
nmake
|
||||
|
||||
This will build either a 32-bit or a 64-bit version of libmozjpeg, depending
|
||||
This will build either a 32-bit or a 64-bit version of mozjpeg, depending
|
||||
on which version of cl.exe is in the PATH.
|
||||
|
||||
The following files will be generated under {build_directory}:
|
||||
@@ -508,12 +487,12 @@ The following files will be generated under {build_directory}:
|
||||
DLL for the libjpeg API
|
||||
sharedlib/jpeg.lib
|
||||
Import library for the libjpeg API
|
||||
mozjpeg-static.lib
|
||||
Static link library for the MozJPEG API
|
||||
mozjpeg.dll
|
||||
DLL for the MozJPEG API
|
||||
mozjpeg.lib
|
||||
Import library for the MozJPEG 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.
|
||||
@@ -536,7 +515,7 @@ 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 libmozjpeg.
|
||||
build of mozjpeg.
|
||||
|
||||
This will generate the following files under {build_directory}:
|
||||
|
||||
@@ -546,12 +525,12 @@ This will generate the following files under {build_directory}:
|
||||
DLL for the libjpeg API
|
||||
sharedlib/{configuration}/jpeg.lib
|
||||
Import library for the libjpeg API
|
||||
{configuration}/mozjpeg-static.lib
|
||||
Static link library for the MozJPEG API
|
||||
{configuration}/mozjpeg.dll
|
||||
DLL for the MozJPEG API
|
||||
{configuration}/mozjpeg.lib
|
||||
Import library for the MozJPEG 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,
|
||||
@@ -576,12 +555,12 @@ This will generate the following files under {build_directory}
|
||||
DLL for the libjpeg API
|
||||
sharedlib/libjpeg.dll.a
|
||||
Import library for the libjpeg API
|
||||
libmozjpeg.a
|
||||
Static link library for the MozJPEG API
|
||||
libmozjpeg.dll
|
||||
DLL for the MozJPEG API
|
||||
libmozjpeg.dll.a
|
||||
Import library for the MozJPEG 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.
|
||||
@@ -599,8 +578,8 @@ libjpeg v7 or v8 API/ABI Emulation
|
||||
-----------------------------------
|
||||
|
||||
Add "-DWITH_JPEG7=1" to the cmake command line to build a version of
|
||||
libmozjpeg that is API/ABI-compatible with libjpeg v7. Add "-DWITH_JPEG8=1"
|
||||
to the cmake command to build a version of libmozjpeg that is
|
||||
mozjpeg that is API/ABI-compatible with libjpeg v7. Add "-DWITH_JPEG8=1"
|
||||
to the cmake command to build a version of mozjpeg that is
|
||||
API/ABI-compatible with libjpeg v8. See README-turbo.txt for more information
|
||||
on libjpeg v7 and v8 emulation.
|
||||
|
||||
@@ -609,7 +588,7 @@ 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 libmozjpeg that lacks the
|
||||
CMake command line to build a version of mozjpeg 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-turbo.txt for more information.
|
||||
@@ -619,7 +598,7 @@ Arithmetic Coding Support
|
||||
-------------------------
|
||||
|
||||
Since the patent on arithmetic coding has expired, this functionality has been
|
||||
included in this release of libmozjpeg. libmozjpeg's implementation is
|
||||
included in this release of mozjpeg. mozjpeg'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
|
||||
@@ -627,11 +606,11 @@ add "-DWITH_ARITH_ENC=0" or "-DWITH_ARITH_DEC=0" to the cmake command line to
|
||||
disable encoding or decoding (respectively.)
|
||||
|
||||
|
||||
MozJPEG Java Wrapper
|
||||
TurboJPEG Java Wrapper
|
||||
----------------------
|
||||
Add "-DWITH_JAVA=1" to the cmake command line to incorporate an optional Java
|
||||
Native Interface wrapper into the MozJPEG shared library and build the Java
|
||||
front-end classes to support it. This allows the MozJPEG shared library to
|
||||
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 for more details.
|
||||
|
||||
If you are using CMake 2.8, you can set the Java_JAVAC_EXECUTABLE,
|
||||
@@ -642,11 +621,11 @@ instead. 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 libmozjpeg
|
||||
========================
|
||||
==================
|
||||
Installing mozjpeg
|
||||
==================
|
||||
|
||||
You can use the build system to install libmozjpeg into a directory of your
|
||||
You can use the build system to install mozjpeg into a directory of your
|
||||
choosing (as opposed to creating an installer.) To do this, add:
|
||||
|
||||
-DCMAKE_INSTALL_PREFIX={install_directory}
|
||||
@@ -656,12 +635,12 @@ to the cmake command line.
|
||||
For example,
|
||||
|
||||
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=c:\libmozjpeg {source_directory}
|
||||
-DCMAKE_INSTALL_PREFIX=c:\mozjpeg {source_directory}
|
||||
nmake install
|
||||
|
||||
will install the header files in c:\libmozjpeg\include, the library files
|
||||
in c:\libmozjpeg\lib, the DLL's in c:\libmozjpeg\bin, and the
|
||||
documentation in c:\libmozjpeg\doc.
|
||||
will install the header files in c:\mozjpeg\include, the library files
|
||||
in c:\mozjpeg\lib, the DLL's in c:\mozjpeg\bin, and the
|
||||
documentation in c:\mozjpeg\doc.
|
||||
|
||||
|
||||
=============
|
||||
@@ -679,7 +658,7 @@ Build Recipes
|
||||
{source_directory}
|
||||
make
|
||||
|
||||
This produces a 64-bit build of libmozjpeg that does not depend on
|
||||
This produces a 64-bit build of mozjpeg 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.
|
||||
|
||||
@@ -694,7 +673,7 @@ mingw64-x86_64-gcc-g++ packages (and their dependencies) must be installed.
|
||||
{source_directory}
|
||||
make
|
||||
|
||||
This produces a 32-bit build of libmozjpeg that does not depend on
|
||||
This produces a 32-bit build of mozjpeg 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.
|
||||
|
||||
@@ -746,7 +725,7 @@ 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 libmozjpeg, then configure a 64-bit out-of-tree
|
||||
out-of-tree build of mozjpeg, 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
|
||||
@@ -758,13 +737,13 @@ make iosdmg [BUILDDIR32={32-bit build directory}] \
|
||||
[BUILDDIRARMV7S={ARM v7s build directory}]
|
||||
|
||||
On OS X systems, this creates a Macintosh package and disk image in which the
|
||||
libmozjpeg static libraries contain ARM architectures necessary to build
|
||||
mozjpeg 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 ARM v6, ARM v7, and/or ARM v7s out-of-tree builds of libmozjpeg
|
||||
(see "Building libmozjpeg for iOS" above.) If you are building an x86-64
|
||||
version of libmozjpeg, you should configure a 32-bit out-of-tree build as
|
||||
well. Next, build libmozjpeg as you would normally, using an out-of-tree
|
||||
configure ARM v6, ARM v7, and/or ARM v7s out-of-tree builds of mozjpeg
|
||||
(see "Building mozjpeg for iOS" above.) If you are building an x86-64
|
||||
version of mozjpeg, you should configure a 32-bit out-of-tree build as
|
||||
well. Next, build mozjpeg 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 ARM v6 build under {source_directory}/iosarmv6
|
||||
by default, the ARM v7 build under {source_directory}/iosarmv7 by default,
|
||||
@@ -794,7 +773,7 @@ If using MinGW:
|
||||
|
||||
If using the Visual Studio IDE, build the "installer" project.
|
||||
|
||||
The installer package (libmozjpeg[-gcc][64].exe) will be located under
|
||||
The installer package (mozjpeg[-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
|
||||
@@ -808,24 +787,24 @@ Building a Windows installer requires the Nullsoft Install System
|
||||
** Regression testing
|
||||
*******************************************************************************
|
||||
|
||||
The most common way to test libmozjpeg is by invoking 'make test' on
|
||||
The most common way to test mozjpeg 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 libmozjpeg and libjpeg v6b. This
|
||||
also invokes the MozJPEG unit tests, which ensure that the colorspace
|
||||
extensions, YUV encoding, decompression scaling, and other features of the
|
||||
MozJPEG C and Java APIs are working properly (and, by extension, that the
|
||||
equivalent features of the underlying libjpeg API are also working.)
|
||||
compatibility has been maintained. 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 MozJPEG C and Java
|
||||
wrappers can be run by invoking 'make tjtest'. These extended MozJPEG tests
|
||||
essentially iterate through all of the available features of the MozJPEG APIs
|
||||
that are not covered by the MozJPEG unit tests (this includes the lossless
|
||||
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
|
||||
MozJPEG tests are meant to test for regressions in the MozJPEG wrappers,
|
||||
TurboJPEG tests are meant to test for regressions in the TurboJPEG wrappers,
|
||||
not in the underlying libjpeg API library.
|
||||
|
||||
@@ -8,7 +8,7 @@ if(POLICY CMP0022)
|
||||
cmake_policy(SET CMP0022 OLD)
|
||||
endif()
|
||||
|
||||
project(libmozjpeg C)
|
||||
project(mozjpeg C)
|
||||
set(VERSION 2.1)
|
||||
|
||||
if(CYGWIN OR NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
|
||||
@@ -47,8 +47,8 @@ message(STATUS "VERSION = ${VERSION}, BUILD = ${BUILD}")
|
||||
option(WITH_SIMD "Include SIMD extensions" TRUE)
|
||||
option(WITH_ARITH_ENC "Include arithmetic encoding support" TRUE)
|
||||
option(WITH_ARITH_DEC "Include arithmetic decoding support" TRUE)
|
||||
option(WITH_JPEG7 "Emulate libjpeg v7 API/ABI (this makes libmozjpeg backward incompatible with libjpeg v6b)" FALSE)
|
||||
option(WITH_JPEG8 "Emulate libjpeg v8 API/ABI (this makes libmozjpeg backward incompatible with libjpeg v6b)" FALSE)
|
||||
option(WITH_JPEG7 "Emulate libjpeg v7 API/ABI (this makes mozjpeg backward incompatible with libjpeg v6b)" FALSE)
|
||||
option(WITH_JPEG8 "Emulate libjpeg v8 API/ABI (this makes mozjpeg backward incompatible with libjpeg v6b)" FALSE)
|
||||
option(WITH_MEM_SRCDST "Include in-memory source/destination manager functions when emulating the libjpeg v6b or v7 API/ABI" TRUE)
|
||||
option(WITH_TURBOJPEG "Include the TurboJPEG wrapper library and associated test programs" TRUE)
|
||||
option(WITH_JAVA "Build Java wrapper for the TurboJPEG library" FALSE)
|
||||
@@ -155,7 +155,7 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
set(CMAKE_INSTALL_PREFIX_DEFAULT ${CMAKE_INSTALL_PREFIX_DEFAULT}64)
|
||||
endif()
|
||||
set(CMAKE_INSTALL_PREFIX "c:/${CMAKE_INSTALL_PREFIX_DEFAULT}" CACHE PATH
|
||||
"Directory into which to install libmozjpeg (default: c:/${CMAKE_INSTALL_PREFIX_DEFAULT})"
|
||||
"Directory into which to install mozjpeg (default: c:/${CMAKE_INSTALL_PREFIX_DEFAULT})"
|
||||
FORCE)
|
||||
endif()
|
||||
|
||||
@@ -778,16 +778,16 @@ endif()
|
||||
|
||||
STRING(REGEX REPLACE "/" "\\\\" INST_DIR "${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
configure_file(release/libmozjpeg.nsi.in libmozjpeg.nsi @ONLY)
|
||||
configure_file(release/mozjpeg.nsi.in mozjpeg.nsi @ONLY)
|
||||
|
||||
if(WITH_JAVA)
|
||||
set(JAVA_DEPEND java)
|
||||
endif()
|
||||
add_custom_target(installer
|
||||
makensis -nocd ${INST_DEFS} libmozjpeg.nsi
|
||||
makensis -nocd ${INST_DEFS} mozjpeg.nsi
|
||||
DEPENDS jpeg jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom
|
||||
cjpeg djpeg jpegtran tjbench ${JAVA_DEPEND}
|
||||
SOURCES libmozjpeg.nsi)
|
||||
SOURCES mozjpeg.nsi)
|
||||
|
||||
if(WITH_TURBOJPEG)
|
||||
set(TURBOJPEG_TARGETS turbojpeg turbojpeg-static tjbench)
|
||||
|
||||
@@ -132,14 +132,6 @@ 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.
|
||||
|
||||
[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.
|
||||
|
||||
|
||||
1.3.1
|
||||
=====
|
||||
|
||||
@@ -2,6 +2,6 @@ Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the libmozjpeg Project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
* Neither the name of the mozjpeg Project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS", AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
18
Makefile.am
18
Makefile.am
@@ -536,26 +536,26 @@ if WITH_JAVA
|
||||
endif
|
||||
|
||||
|
||||
pkgscripts/libmozjpeg.spec: pkgscripts/libmozjpeg.spec.tmpl
|
||||
cat pkgscripts/libmozjpeg.spec.tmpl | sed s@%{__prefix}@$(prefix)@g | \
|
||||
pkgscripts/mozjpeg.spec: pkgscripts/mozjpeg.spec.tmpl
|
||||
cat pkgscripts/mozjpeg.spec.tmpl | sed s@%{__prefix}@$(prefix)@g | \
|
||||
sed s@%{__bindir}@$(bindir)@g | sed s@%{__datadir}@$(datadir)@g | \
|
||||
sed s@%{__docdir}@$(docdir)@g | sed s@%{__includedir}@$(includedir)@g | \
|
||||
sed s@%{__libdir}@$(libdir)@g | sed s@%{__mandir}@$(mandir)@g \
|
||||
> pkgscripts/libmozjpeg.spec
|
||||
> pkgscripts/mozjpeg.spec
|
||||
|
||||
rpm: all pkgscripts/libmozjpeg.spec
|
||||
rpm: all pkgscripts/mozjpeg.spec
|
||||
TMPDIR=`mktemp -d /tmp/${PACKAGE_NAME}-build.XXXXXX`; \
|
||||
mkdir -p $$TMPDIR/RPMS; \
|
||||
ln -fs `pwd` $$TMPDIR/BUILD; \
|
||||
rm -f ${PKGNAME}-${VERSION}.${RPMARCH}.rpm; \
|
||||
rpmbuild -bb --define "_blddir $$TMPDIR/buildroot" \
|
||||
--define "_topdir $$TMPDIR" \
|
||||
--target ${RPMARCH} pkgscripts/libmozjpeg.spec; \
|
||||
--target ${RPMARCH} pkgscripts/mozjpeg.spec; \
|
||||
cp $$TMPDIR/RPMS/${RPMARCH}/${PKGNAME}-${VERSION}-${BUILD}.${RPMARCH}.rpm \
|
||||
${PKGNAME}-${VERSION}.${RPMARCH}.rpm; \
|
||||
rm -rf $$TMPDIR
|
||||
|
||||
srpm: dist-gzip pkgscripts/libmozjpeg.spec
|
||||
srpm: dist-gzip pkgscripts/mozjpeg.spec
|
||||
TMPDIR=`mktemp -d /tmp/${PACKAGE_NAME}-build.XXXXXX`; \
|
||||
mkdir -p $$TMPDIR/RPMS; \
|
||||
mkdir -p $$TMPDIR/SRPMS; \
|
||||
@@ -564,10 +564,10 @@ srpm: dist-gzip pkgscripts/libmozjpeg.spec
|
||||
mkdir -p $$TMPDIR/SPECS; \
|
||||
rm -f ${PKGNAME}-${VERSION}.src.rpm; \
|
||||
cp ${PACKAGE_NAME}-${VERSION}.tar.gz $$TMPDIR/SOURCES; \
|
||||
cat pkgscripts/libmozjpeg.spec | sed s/%{_blddir}/%{_tmppath}/g \
|
||||
cat pkgscripts/mozjpeg.spec | sed s/%{_blddir}/%{_tmppath}/g \
|
||||
| sed s/#--\>//g \
|
||||
> $$TMPDIR/SPECS/libmozjpeg.spec; \
|
||||
rpmbuild -bs --define "_topdir $$TMPDIR" $$TMPDIR/SPECS/libmozjpeg.spec; \
|
||||
> $$TMPDIR/SPECS/mozjpeg.spec; \
|
||||
rpmbuild -bs --define "_topdir $$TMPDIR" $$TMPDIR/SPECS/mozjpeg.spec; \
|
||||
cp $$TMPDIR/SRPMS/${PKGNAME}-${VERSION}-${BUILD}.src.rpm \
|
||||
${PKGNAME}-${VERSION}.src.rpm; \
|
||||
rm -rf $$TMPDIR
|
||||
|
||||
3
cjpeg.c
3
cjpeg.c
@@ -753,7 +753,8 @@ main (int argc, char **argv)
|
||||
GETJOCTET(marker->data[3]) == 0x62 &&
|
||||
GETJOCTET(marker->data[4]) == 0x65)
|
||||
continue; /* reject duplicate Adobe */
|
||||
jpeg_write_marker(&cinfo, marker->marker, marker->data, marker->data_length);
|
||||
jpeg_write_marker(&cinfo, marker->marker, marker->data,
|
||||
marker->data_length);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
30
configure.ac
30
configure.ac
@@ -2,12 +2,12 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ([2.56])
|
||||
AC_INIT([libmozjpeg], [2.1])
|
||||
AC_INIT([mozjpeg], [2.1])
|
||||
BUILD=`date +%Y%m%d`
|
||||
|
||||
AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2])
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])
|
||||
AC_PREFIX_DEFAULT(/opt/libmozjpeg)
|
||||
AC_PREFIX_DEFAULT(/opt/mozjpeg)
|
||||
|
||||
# Checks for programs.
|
||||
SAVED_CFLAGS=${CFLAGS}
|
||||
@@ -22,7 +22,7 @@ m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
|
||||
AC_PROG_LIBTOOL
|
||||
AC_PROG_LN_S
|
||||
|
||||
# When the prefix is /opt/libmozjpeg, we assume that an "official" binary is
|
||||
# When the prefix is /opt/mozjpeg, we assume that an "official" binary is
|
||||
# being created, and thus we install things into specific locations.
|
||||
|
||||
old_prefix=${prefix}
|
||||
@@ -31,12 +31,12 @@ if test "x$prefix" = "xNONE" -a "x$ac_default_prefix" != "x"; then
|
||||
fi
|
||||
DATADIR=`eval echo ${datadir}`
|
||||
DATADIR=`eval echo $DATADIR`
|
||||
if test "$DATADIR" = "/opt/libmozjpeg/share"; then
|
||||
if test "$DATADIR" = "/opt/mozjpeg/share"; then
|
||||
datadir='${prefix}'
|
||||
fi
|
||||
DATADIR=`eval echo ${datarootdir}`
|
||||
DATADIR=`eval echo $DATADIR`
|
||||
if test "$DATADIR" = "/opt/libmozjpeg/share"; then
|
||||
if test "$DATADIR" = "/opt/mozjpeg/share"; then
|
||||
datarootdir='${prefix}'
|
||||
fi
|
||||
|
||||
@@ -48,7 +48,7 @@ fi
|
||||
if test "x${libdir}" = 'x${exec_prefix}/lib' -o "x${libdir}" = 'x${prefix}/lib'; then
|
||||
LIBDIR=`eval echo ${libdir}`
|
||||
LIBDIR=`eval echo $LIBDIR`
|
||||
if test "$LIBDIR" = "/opt/libmozjpeg/lib"; then
|
||||
if test "$LIBDIR" = "/opt/mozjpeg/lib"; then
|
||||
case $host_os in
|
||||
darwin*)
|
||||
;;
|
||||
@@ -149,10 +149,10 @@ AC_ARG_VAR(JPEG_LIB_VERSION, [libjpeg API version (62, 70, or 80)])
|
||||
if test "x$JPEG_LIB_VERSION" = "x"; then
|
||||
AC_ARG_WITH([jpeg7],
|
||||
AC_HELP_STRING([--with-jpeg7],
|
||||
[Emulate libjpeg v7 API/ABI (this makes libmozjpeg backward incompatible with libjpeg v6b.)]))
|
||||
[Emulate libjpeg v7 API/ABI (this makes mozjpeg backward incompatible with libjpeg v6b.)]))
|
||||
AC_ARG_WITH([jpeg8],
|
||||
AC_HELP_STRING([--with-jpeg8],
|
||||
[Emulate libjpeg v8 API/ABI (this makes libmozjpeg backward incompatible with libjpeg v6b.)]))
|
||||
[Emulate libjpeg v8 API/ABI (this makes mozjpeg backward incompatible with libjpeg v6b.)]))
|
||||
if test "x${with_jpeg8}" = "xyes"; then
|
||||
JPEG_LIB_VERSION=80
|
||||
else
|
||||
@@ -170,9 +170,9 @@ AC_DEFINE_UNQUOTED(JPEG_LIB_VERSION, [$JPEG_LIB_VERSION],
|
||||
[libjpeg API version])
|
||||
|
||||
AC_ARG_VAR(SO_MAJOR_VERSION,
|
||||
[Major version of the libmozjpeg shared library (default is determined by the API version)])
|
||||
[Major version of the mozjpeg shared library (default is determined by the API version)])
|
||||
AC_ARG_VAR(SO_MINOR_VERSION,
|
||||
[Minor version of the libmozjpeg shared library (default is determined by the API version)])
|
||||
[Minor version of the mozjpeg shared library (default is determined by the API version)])
|
||||
if test "x$SO_MAJOR_VERSION" = "x"; then
|
||||
case "$JPEG_LIB_VERSION" in
|
||||
62) SO_MAJOR_VERSION=$JPEG_LIB_VERSION ;;
|
||||
@@ -217,12 +217,12 @@ AC_SUBST(SO_MINOR_VERSION)
|
||||
AC_SUBST(SO_AGE)
|
||||
AC_SUBST(MEM_SRCDST_FUNCTIONS)
|
||||
|
||||
AC_DEFINE_UNQUOTED(LIBMOZJPEG_VERSION, [$VERSION], [libmozjpeg version])
|
||||
AC_DEFINE_UNQUOTED(MOZJPEG_VERSION, [$VERSION], [mozjpeg version])
|
||||
|
||||
VERSION_SCRIPT=yes
|
||||
AC_ARG_ENABLE([ld-version-script],
|
||||
AS_HELP_STRING([--disable-ld-version-script],
|
||||
[Disable linker version script for libmozjpeg (default is to use linker version script if the linker supports it)]),
|
||||
[Disable linker version script for mozjpeg (default is to use linker version script if the linker supports it)]),
|
||||
[VERSION_SCRIPT=$enableval], [])
|
||||
|
||||
AC_MSG_CHECKING([whether the linker supports version scripts])
|
||||
@@ -250,7 +250,7 @@ if test "x$VERSION_SCRIPT_FLAG" = "x"; then
|
||||
fi
|
||||
LDFLAGS="$SAVED_LDFLAGS"
|
||||
|
||||
AC_MSG_CHECKING([whether to use version script when building libmozjpeg])
|
||||
AC_MSG_CHECKING([whether to use version script when building mozjpeg])
|
||||
AC_MSG_RESULT($VERSION_SCRIPT)
|
||||
|
||||
AM_CONDITIONAL(VERSION_SCRIPT, test "x$VERSION_SCRIPT" = "xyes")
|
||||
@@ -520,7 +520,7 @@ 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"])
|
||||
|
||||
AC_ARG_VAR(PKGNAME, [distribution package name (default: libmozjpeg)])
|
||||
AC_ARG_VAR(PKGNAME, [distribution package name (default: mozjpeg)])
|
||||
if test "x$PKGNAME" = "x"; then
|
||||
PKGNAME=$PACKAGE_NAME
|
||||
fi
|
||||
@@ -551,7 +551,7 @@ AC_DEFINE_UNQUOTED([BUILD], "$BUILD", [libjpeg-turbo build number])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_HEADERS([jconfig.h])
|
||||
AC_CONFIG_HEADERS([jconfigint.h])
|
||||
AC_CONFIG_FILES([pkgscripts/libmozjpeg.spec.tmpl:release/libmozjpeg.spec.in])
|
||||
AC_CONFIG_FILES([pkgscripts/mozjpeg.spec.tmpl:release/mozjpeg.spec.in])
|
||||
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])
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "jpeglib.h"
|
||||
#include "jchuff.h"
|
||||
|
||||
|
||||
/* We use a full-image coefficient buffer when doing Huffman optimization,
|
||||
* and also for writing multiple-scan JPEG files. In all cases, the DCT
|
||||
* step is run during the first pass, and subsequent passes need only read
|
||||
@@ -190,7 +191,8 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
||||
(*cinfo->fdct->forward_DCT) (cinfo, compptr,
|
||||
input_buf[compptr->component_index],
|
||||
coef->MCU_buffer[blkn],
|
||||
ypos, xpos, (JDIMENSION) blockcnt, NULL);
|
||||
ypos, xpos, (JDIMENSION) blockcnt,
|
||||
NULL);
|
||||
if (blockcnt < compptr->MCU_width) {
|
||||
/* Create some dummy blocks at the right edge of the image. */
|
||||
jzero_far((void *) coef->MCU_buffer[blkn + blockcnt],
|
||||
@@ -302,7 +304,8 @@ compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
||||
(*cinfo->fdct->forward_DCT) (cinfo, compptr,
|
||||
input_buf[ci], thisblockrow,
|
||||
(JDIMENSION) (block_row * DCTSIZE),
|
||||
(JDIMENSION) 0, blocks_across, buffer_dst[block_row]);
|
||||
(JDIMENSION) 0, blocks_across,
|
||||
buffer_dst[block_row]);
|
||||
if (ndummy > 0) {
|
||||
/* Create dummy blocks at the right edge of the image. */
|
||||
thisblockrow += blocks_across; /* => first dummy block */
|
||||
@@ -503,7 +506,6 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Try to write the MCU. */
|
||||
if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
|
||||
/* Suspension forced; update state counters and exit */
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
/* Private subobject for this module */
|
||||
|
||||
typedef void (*forward_DCT_method_ptr) (DCTELEM * data);
|
||||
|
||||
@@ -809,5 +809,4 @@ jpeg_simple_progression (j_compress_ptr cinfo)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif /* C_PROGRESSIVE_SUPPORTED */
|
||||
|
||||
@@ -25,7 +25,6 @@ typedef enum { /* Operating modes for buffer controllers */
|
||||
JBUF_CRANK_DEST, /* Run dest subobject only, using saved data */
|
||||
JBUF_SAVE_AND_PASS, /* Run both subobjects, save output */
|
||||
JBUF_REQUANT /* Requantize */
|
||||
|
||||
} J_BUF_MODE;
|
||||
|
||||
/* Values of global_state field (jdapi.c has some dependencies on ordering!) */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<installer-gui-script minSpecVersion="1">
|
||||
<title>libjpeg-turbo</title>
|
||||
<title>mozjpeg</title>
|
||||
<welcome file="Welcome.rtf" />
|
||||
<readme file="ReadMe.txt" />
|
||||
<license file="License.rtf" />
|
||||
@@ -12,13 +12,13 @@
|
||||
<options customize="never" />
|
||||
<choices-outline>
|
||||
<line choice="default">
|
||||
<line choice="com.libjpeg-turbo.libjpeg-turbo"/>
|
||||
<line choice="com.mozilla.mozjpeg"/>
|
||||
</line>
|
||||
</choices-outline>
|
||||
<choice id="default"/>
|
||||
<choice id="com.libjpeg-turbo.libjpeg-turbo" visible="false">
|
||||
<pkg-ref id="com.libjpeg-turbo.libjpeg-turbo"/>
|
||||
<choice id="com.mozilla.mozjpeg" visible="false">
|
||||
<pkg-ref id="com.mozilla.mozjpeg"/>
|
||||
</choice>
|
||||
<pkg-ref auth="root"
|
||||
id="com.libjpeg-turbo.libjpeg-turbo">libjpeg-turbo.pkg</pkg-ref>
|
||||
id="com.mozilla.mozjpeg">mozjpeg.pkg</pkg-ref>
|
||||
</installer-gui-script>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
\pard\tx220\tx720\pardeftab720\li720\fi-720
|
||||
\ls1\ilvl0\cf0 {\listtext \'95 }Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\
|
||||
{\listtext \'95 }Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\
|
||||
{\listtext \'95 }Neither the name of the libmozjpeg Project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\
|
||||
{\listtext \'95 }Neither the name of the mozjpeg Project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\
|
||||
\pard\pardeftab720\qc
|
||||
\cf0 \
|
||||
\pard\pardeftab720
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
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.
|
||||
mozjpeg is a fork of libjpeg-turbo that aims to speed up load times of web pages by reducing the size (and, by extension, the transmission time) of JPEG files. It accomplishes this by enabling optimized Huffman trees and progressive entropy coding by default in the JPEG compressor, as well as splitting the spectrum of DCT coefficients into separate scans and using Trellis quantisation.
|
||||
|
||||
libjpeg-turbo implements both the traditional libjpeg API as well as the less powerful but more straightforward TurboJPEG API. libjpeg-turbo also features colorspace extensions that allow it to compress from/decompress to 32-bit and big-endian pixel buffers (RGBX, XBGR, etc.), as well as a full-featured Java interface.
|
||||
|
||||
libjpeg-turbo was originally based on libjpeg/SIMD, an MMX-accelerated derivative of libjpeg v6b developed by Miyasaka Masaru. The TigerVNC and VirtualGL projects made numerous enhancements to the codec in 2009, and in early 2010, libjpeg-turbo spun off into an independent project, with the goal of making high-speed JPEG compression/decompression technology available to a broader range of users and developers.
|
||||
Although it is based on libjpeg-turbo, mozjpeg is not intended to be a general-purpose or high-performance JPEG library. Its performance is highly "asymmetric". That is, the JPEG files it generates require much more time to compress than to decompress. When the default settings are used, mozjpeg is considerably slower than libjpeg-turbo or even libjpeg at compressing images. Thus, it is not generally suitable for real-time compression. It is best used as part of a web encoding workflow.
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
\deftab720
|
||||
\pard\pardeftab720
|
||||
|
||||
\f0\fs24 \cf0 This installer will install the libmozjpeg SDK and run-time libraries onto your computer so that you can use libmozjpeg to build new applications or accelerate existing ones. To remove the libmozjpeg package, run\
|
||||
\f0\fs24 \cf0 This installer will install the mozjpeg SDK and run-time libraries onto your computer so that you can use mozjpeg to build new applications. To remove the mozjpeg package, run\
|
||||
\
|
||||
\pard\pardeftab720
|
||||
|
||||
\f1 \cf0 /opt/libmozjpeg/bin/uninstall\
|
||||
\f1 \cf0 /opt/mozjpeg/bin/uninstall\
|
||||
\pard\pardeftab720
|
||||
|
||||
\f0 \cf0 \
|
||||
|
||||
@@ -4,28 +4,21 @@ Section: misc
|
||||
Priority: optional
|
||||
Architecture: {__ARCH}
|
||||
Essential: no
|
||||
Maintainer: The libmozjpeg Project <joshmoz@gmail.com>
|
||||
Maintainer: Mozilla Research <joshmoz@gmail.com>
|
||||
Homepage: https://github.com/mozilla/mozjpeg
|
||||
Installed-Size: {__SIZE}
|
||||
Description: A SIMD-accelerated JPEG codec that provides both the libjpeg and TurboJPEG APIs
|
||||
libmozjpeg 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, libmozjpeg is generally 2-4x as
|
||||
fast as libjpeg, all else being equal. On other types of systems,
|
||||
libmozjpeg can still outperform libjpeg by a significant amount, by virtue
|
||||
of its highly-optimized Huffman coding routines. In many cases, the
|
||||
performance of libmozjpeg rivals that of proprietary high-speed JPEG
|
||||
codecs.
|
||||
Description: A JPEG codec that provides increased compression for JPEG images (at the expense of compression performance)
|
||||
mozjpeg is a fork of libjpeg-turbo that aims to speed up load times of web
|
||||
pages by reducing the size (and, by extension, the transmission time) of JPEG
|
||||
files. It accomplishes this by enabling optimized Huffman trees and
|
||||
progressive entropy coding by default in the JPEG compressor, as well as
|
||||
splitting the spectrum of DCT coefficients into separate scans and using
|
||||
Trellis quantisation.
|
||||
.
|
||||
libmozjpeg implements both the traditional libjpeg API as well as the less
|
||||
powerful but more straightforward TurboJPEG API. libmozjpeg also features
|
||||
colorspace extensions that allow it to compress from/decompress to 32-bit and
|
||||
big-endian pixel buffers (RGBX, XBGR, etc.), as well as a full-featured Java
|
||||
interface.
|
||||
.
|
||||
libmozjpeg was forked from libjpeg-turbo. libjpeg-turbo was originally based on
|
||||
libjpeg/SIMD, an MMX-accelerated derivative of libjpeg v6b developed by Miyasaka
|
||||
Masaru. The TigerVNC and VirtualGL projects made numerous enhancements to the
|
||||
codec in 2009, and in early 2010, libjpeg-turbo spun off into an independent
|
||||
project, with the goal of making high-speed JPEG compression/decompression technology
|
||||
available to a broader range of users and developers.
|
||||
Although it is based on libjpeg-turbo, mozjpeg is not intended to be a
|
||||
general-purpose or high-performance JPEG library. Its performance is highly
|
||||
"asymmetric". That is, the JPEG files it generates require much more time to
|
||||
compress than to decompress. When the default settings are used, mozjpeg is
|
||||
considerably slower than libjpeg-turbo or even libjpeg at compressing images.
|
||||
Thus, it is not generally suitable for real-time compression. It is best used
|
||||
as part of a web encoding workflow.
|
||||
|
||||
@@ -31,7 +31,7 @@ __PWD=`pwd`
|
||||
make install DESTDIR=$TMPDIR/pkg docdir=/usr/share/doc/$PACKAGE_NAME-$VERSION \
|
||||
exampledir=/usr/share/doc/$PACKAGE_NAME-$VERSION
|
||||
rm $TMPDIR/pkg$LIBDIR/*.la
|
||||
if [ "$PREFIX" = "/opt/libmozjpeg" -a "$DOCDIR" = "/opt/libmozjpeg/doc" ]; then
|
||||
if [ "$PREFIX" = "/opt/mozjpeg" -a "$DOCDIR" = "/opt/mozjpeg/doc" ]; then
|
||||
ln -fs /usr/share/doc/$PACKAGE_NAME-$VERSION $TMPDIR/pkg$DOCDIR
|
||||
fi
|
||||
cd $TMPDIR/pkg
|
||||
|
||||
@@ -45,7 +45,7 @@ makedeb()
|
||||
make install DESTDIR=$TMPDIR docdir=/usr/share/doc/$DIRNAME-$VERSION \
|
||||
exampledir=/usr/share/doc/$DIRNAME-$VERSION
|
||||
rm -f $TMPDIR$LIBDIR/*.la
|
||||
if [ "$PREFIX" = "/opt/libmozjpeg" -a "$DOCDIR" = "/opt/libmozjpeg/doc" ]; then
|
||||
if [ "$PREFIX" = "/opt/mozjpeg" -a "$DOCDIR" = "/opt/mozjpeg/doc" ]; then
|
||||
ln -fs /usr/share/doc/$DIRNAME-$VERSION $TMPDIR$DOCDIR
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -91,7 +91,7 @@ make install DESTDIR=$PKGROOT docdir=/Library/Documentation/$PACKAGE_NAME \
|
||||
exampledir=/Library/Documentation/$PACKAGE_NAME
|
||||
rm -f $PKGROOT$LIBDIR/*.la
|
||||
|
||||
if [ "$PREFIX" = "/opt/libmozjpeg" -a "$DOCDIR" = "/opt/libmozjpeg/doc" ]; then
|
||||
if [ "$PREFIX" = "/opt/mozjpeg" -a "$DOCDIR" = "/opt/mozjpeg/doc" ]; then
|
||||
ln -fs /Library/Documentation/$PACKAGE_NAME $PKGROOT$DOCDIR
|
||||
fi
|
||||
|
||||
@@ -235,7 +235,7 @@ install_name_tool -id $LIBDIR/libturbojpeg.0.dylib $PKGROOT/$LIBDIR/libturbojpeg
|
||||
if [ $WITH_JAVA = 1 ]; then
|
||||
ln -fs libturbojpeg.0.dylib $PKGROOT/$LIBDIR/libturbojpeg.jnilib
|
||||
fi
|
||||
if [ "$PREFIX" = "/opt/libmozjpeg" -a "$LIBDIR" = "/opt/libmozjpeg/lib" ]; then
|
||||
if [ "$PREFIX" = "/opt/mozjpeg" -a "$LIBDIR" = "/opt/mozjpeg/lib" ]; then
|
||||
if [ ! -h $PKGROOT/$PREFIX/lib32 ]; then
|
||||
ln -fs lib $PKGROOT/$PREFIX/lib32
|
||||
fi
|
||||
@@ -254,7 +254,7 @@ cp $SRCDIR/release/License.rtf $SRCDIR/release/Welcome.rtf $SRCDIR/release/ReadM
|
||||
|
||||
mkdir $TMPDIR/dmg
|
||||
pkgbuild --root $PKGROOT --version $VERSION.$BUILD \
|
||||
--identifier com.libjpeg-turbo.libjpeg-turbo $TMPDIR/pkg/$PACKAGE_NAME.pkg
|
||||
--identifier com.mozilla.$PACKAGE_NAME $TMPDIR/pkg/$PACKAGE_NAME.pkg
|
||||
productbuild --distribution $SRCDIR/release/Distribution.xml \
|
||||
--package-path $TMPDIR/pkg/ --resources $TMPDIR/pkg/ \
|
||||
$TMPDIR/dmg/$PACKAGE_NAME.pkg
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Path under which libmozjpeg should be installed
|
||||
# Path under which mozjpeg should be installed
|
||||
%define _prefix %{__prefix}
|
||||
|
||||
# Path under which executables should be installed
|
||||
@@ -17,7 +17,7 @@
|
||||
%ifarch x86_64
|
||||
%define _lib lib64
|
||||
%else
|
||||
%if "%{_prefix}" == "/opt/libmozjpeg"
|
||||
%if "%{_prefix}" == "/opt/mozjpeg"
|
||||
%define _lib lib32
|
||||
%endif
|
||||
%endif
|
||||
@@ -25,13 +25,13 @@
|
||||
# Path under which man pages should be installed
|
||||
%define _mandir %{__mandir}
|
||||
|
||||
Summary: A SIMD-accelerated JPEG codec that provides both the libjpeg and TurboJPEG APIs
|
||||
Summary: A JPEG codec that provides increased compression for JPEG images (at the expense of compression performance)
|
||||
Name: @PKGNAME@
|
||||
Version: @VERSION@
|
||||
Vendor: The libmozjpeg Project
|
||||
Vendor: Mozilla Research
|
||||
URL: https://github.com/mozilla/mozjpeg
|
||||
Group: System Environment/Libraries
|
||||
#-->Source0: http://prdownloads.sourceforge.net/libmozjpeg/libmozjpeg-%{version}.tar.gz
|
||||
#-->Source0: https://github.com/mozilla/mozjpeg/archive/v%{version}.tar.gz
|
||||
Release: @BUILD@
|
||||
License: BSD-style
|
||||
BuildRoot: %{_blddir}/%{name}-buildroot-%{version}-%{release}
|
||||
@@ -43,30 +43,23 @@ Provides: %{name} = %{version}-%{release}, @PACKAGE_NAME@ = %{version}-%{release
|
||||
%endif
|
||||
|
||||
%description
|
||||
libmozjpeg 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, libmozjpeg is generally 2-4x as fast as
|
||||
libjpeg, all else being equal. On other types of systems, libmozjpeg can
|
||||
still outperform libjpeg by a significant amount, by virtue of its
|
||||
highly-optimized Huffman coding routines. In many cases, the performance of
|
||||
libmozjpeg rivals that of proprietary high-speed JPEG codecs.
|
||||
mozjpeg is a fork of libjpeg-turbo that aims to speed up load times of web
|
||||
pages by reducing the size (and, by extension, the transmission time) of JPEG
|
||||
files. It accomplishes this by enabling optimized Huffman trees and
|
||||
progressive entropy coding by default in the JPEG compressor, as well as
|
||||
splitting the spectrum of DCT coefficients into separate scans and using
|
||||
Trellis quantisation.
|
||||
|
||||
libmozjpeg implements both the traditional libjpeg API as well as the less
|
||||
powerful but more straightforward TurboJPEG API. libmozjpeg also features
|
||||
colorspace extensions that allow it to compress from/decompress to 32-bit and
|
||||
big-endian pixel buffers (RGBX, XBGR, etc.), as well as a full-featured Java
|
||||
interface.
|
||||
|
||||
libmozjpeg was forked from libjpeg-turbo.
|
||||
libjpeg-turbo was originally based on libjpeg/SIMD, an MMX-accelerated
|
||||
derivative of libjpeg v6b developed by Miyasaka Masaru. The TigerVNC and
|
||||
VirtualGL projects made numerous enhancements to the codec in 2009, and in
|
||||
early 2010, libjpeg-turbo spun off into an independent project, with the goal
|
||||
of making high-speed JPEG compression/decompression technology available to a
|
||||
broader range of users and developers.
|
||||
Although it is based on libjpeg-turbo, mozjpeg is not intended to be a
|
||||
general-purpose or high-performance JPEG library. Its performance is highly
|
||||
"asymmetric". That is, the JPEG files it generates require much more time to
|
||||
compress than to decompress. When the default settings are used, mozjpeg is
|
||||
considerably slower than libjpeg-turbo or even libjpeg at compressing images.
|
||||
Thus, it is not generally suitable for real-time compression. It is best used
|
||||
as part of a web encoding workflow.
|
||||
|
||||
#-->%prep
|
||||
#-->%setup -q -n libmozjpeg-%{version}
|
||||
#-->%setup -q -n mozjpeg-%{version}
|
||||
|
||||
#-->%build
|
||||
#-->./configure prefix=%{_prefix} bindir=%{_bindir} datadir=%{_datadir} \
|
||||
@@ -87,14 +80,14 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
|
||||
|
||||
LJT_LIBDIR=%{__libdir}
|
||||
if [ ! "$LJT_LIBDIR" = "%{_libdir}" ]; then
|
||||
echo ERROR: libmozjpeg must be configured with libdir=%{_prefix}/%{_lib} when generating an in-tree RPM for this architecture.
|
||||
echo ERROR: mozjpeg must be configured with libdir=%{_prefix}/%{_lib} when generating an in-tree RPM for this architecture.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#-->%endif
|
||||
|
||||
LJT_DOCDIR=%{__docdir}
|
||||
if [ "%{_prefix}" = "/opt/libmozjpeg" -a "$LJT_DOCDIR" = "/opt/libmozjpeg/doc" ]; then
|
||||
if [ "%{_prefix}" = "/opt/mozjpeg" -a "$LJT_DOCDIR" = "/opt/mozjpeg/doc" ]; then
|
||||
ln -fs %{_docdir} $RPM_BUILD_ROOT/$LJT_DOCDIR
|
||||
fi
|
||||
|
||||
@@ -110,7 +103,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%dir %{_docdir}
|
||||
%doc %{_docdir}/*
|
||||
%dir %{_prefix}
|
||||
%if "%{_prefix}" == "/opt/libmozjpeg" && "%{_docdir}" != "%{_prefix}/doc"
|
||||
%if "%{_prefix}" == "/opt/mozjpeg" && "%{_docdir}" != "%{_prefix}/doc"
|
||||
%{_prefix}/doc
|
||||
%endif
|
||||
%dir %{_bindir}
|
||||
@@ -8,7 +8,7 @@
|
||||
# - Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# - Neither the name of the libmozjpeg Project nor the names of its
|
||||
# - Neither the name of the mozjpeg Project nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
@@ -32,7 +32,7 @@ if [ ! "`id -u`" = "0" ]; then
|
||||
fi
|
||||
|
||||
PACKAGE=@PKGNAME@
|
||||
MACPACKAGE=com.$PACKAGE.$PACKAGE
|
||||
MACPACKAGE=com.mozilla.$PACKAGE
|
||||
RECEIPT=/Library/Receipts/$PACKAGE.pkg
|
||||
|
||||
LSBOM=
|
||||
@@ -72,7 +72,7 @@ fi
|
||||
if [ -d $INCLUDEDIR ]; then
|
||||
rmdir $INCLUDEDIR 2>&1 || EXITSTATUS=-1
|
||||
fi
|
||||
if [ "$PREFIX" = "/opt/libmozjpeg" -a "$LIBDIR" = "/opt/libmozjpeg/lib" ]; then
|
||||
if [ "$PREFIX" = "/opt/mozjpeg" -a "$LIBDIR" = "/opt/mozjpeg/lib" ]; then
|
||||
if [ -h $LIBDIR\32 ]; then
|
||||
rm $LIBDIR\32 2>&1 || EXITSTATUS=-1
|
||||
fi
|
||||
@@ -92,7 +92,7 @@ fi
|
||||
if [ -d $DATADIR -a "$DATADIR" != "$PREFIX" ]; then
|
||||
rmdir $DATADIR 2>&1 || EXITSTATUS=-1
|
||||
fi
|
||||
if [ "$PREFIX" = "/opt/libmozjpeg" -a -h "$PREFIX/doc" ]; then
|
||||
if [ "$PREFIX" = "/opt/mozjpeg" -a -h "$PREFIX/doc" ]; then
|
||||
rm $PREFIX/doc 2>&1 || EXITSTATUS=-1
|
||||
fi
|
||||
rmdir $PREFIX 2>&1 || EXITSTATUS=-1
|
||||
|
||||
76
tjbench.c
76
tjbench.c
@@ -273,82 +273,6 @@ int decomp(unsigned char *srcbuf, unsigned char **jpegbuf,
|
||||
}
|
||||
|
||||
|
||||
int dotestyuv(unsigned char *srcbuf, int w, int h, int subsamp,
|
||||
char *filename)
|
||||
{
|
||||
char tempstr[1024], tempstr2[80];
|
||||
FILE *file=NULL; tjhandle handle=NULL;
|
||||
unsigned char *dstbuf=NULL;
|
||||
double start, elapsed;
|
||||
int i, retval=0, ps=tjPixelSize[pf];
|
||||
int yuvsize=0;
|
||||
|
||||
yuvsize=tjBufSizeYUV(w, h, subsamp);
|
||||
if((dstbuf=(unsigned char *)malloc(yuvsize)) == NULL)
|
||||
_throwunix("allocating image buffer");
|
||||
|
||||
if(!quiet)
|
||||
printf(">>>>> %s (%s) <--> YUV %s <<<<<\n", pixFormatStr[pf],
|
||||
(flags&TJFLAG_BOTTOMUP)? "Bottom-up":"Top-down", subNameLong[subsamp]);
|
||||
|
||||
if(quiet==1)
|
||||
printf("%s\t%s\t%s\tN/A\t", pixFormatStr[pf],
|
||||
(flags&TJFLAG_BOTTOMUP)? "BU":"TD", subNameLong[subsamp]);
|
||||
|
||||
if((handle=tjInitCompress())==NULL)
|
||||
_throwtj("executing tjInitCompress()");
|
||||
|
||||
/* Execute once to preload cache */
|
||||
if(tjEncodeYUV2(handle, srcbuf, w, 0, h, pf, dstbuf, subsamp, flags)==-1)
|
||||
_throwtj("executing tjEncodeYUV2()");
|
||||
|
||||
/* Benchmark */
|
||||
for(i=0, start=gettime(); (elapsed=gettime()-start)<benchtime; i++)
|
||||
{
|
||||
if(tjEncodeYUV2(handle, srcbuf, w, 0, h, pf, dstbuf, subsamp, flags)==-1)
|
||||
_throwtj("executing tjEncodeYUV2()");
|
||||
}
|
||||
|
||||
if(tjDestroy(handle)==-1) _throwtj("executing tjDestroy()");
|
||||
handle=NULL;
|
||||
|
||||
if(quiet==1) printf("%-4d %-4d\t", w, h);
|
||||
if(quiet)
|
||||
{
|
||||
printf("%s%c%s%c",
|
||||
sigfig((double)(w*h)/1000000.*(double)i/elapsed, 4, tempstr, 1024),
|
||||
quiet==2? '\n':'\t',
|
||||
sigfig((double)(w*h*ps)/(double)yuvsize, 4, tempstr2, 80),
|
||||
quiet==2? '\n':'\t');
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\n%s size: %d x %d\n", "Image", w, h);
|
||||
printf("C--> Frame rate: %f fps\n", (double)i/elapsed);
|
||||
printf(" Output image size: %d bytes\n", yuvsize);
|
||||
printf(" Compression ratio: %f:1\n",
|
||||
(double)(w*h*ps)/(double)yuvsize);
|
||||
printf(" Source throughput: %f Megapixels/sec\n",
|
||||
(double)(w*h)/1000000.*(double)i/elapsed);
|
||||
printf(" Output bit stream: %f Megabits/sec\n",
|
||||
(double)yuvsize*8./1000000.*(double)i/elapsed);
|
||||
}
|
||||
snprintf(tempstr, 1024, "%s_%s.yuv", filename, subName[subsamp]);
|
||||
if((file=fopen(tempstr, "wb"))==NULL)
|
||||
_throwunix("opening reference image");
|
||||
if(fwrite(dstbuf, yuvsize, 1, file)!=1)
|
||||
_throwunix("writing reference image");
|
||||
fclose(file); file=NULL;
|
||||
if(!quiet) printf("Reference image written to %s\n", tempstr);
|
||||
|
||||
bailout:
|
||||
if(file) {fclose(file); file=NULL;}
|
||||
if(dstbuf) {free(dstbuf); dstbuf=NULL;}
|
||||
if(handle) {tjDestroy(handle); handle=NULL;}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
int fullTest(unsigned char *srcbuf, int w, int h, int subsamp, int jpegqual,
|
||||
char *filename)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user