Compare commits
89 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba29357611 | ||
|
|
2c289bfa9b | ||
|
|
5ee81f43cf | ||
|
|
4f81526385 | ||
|
|
fad469f51e | ||
|
|
83c8f14fa2 | ||
|
|
049aef51d4 | ||
|
|
c56a74cdac | ||
|
|
51705fb967 | ||
|
|
e43d21d57f | ||
|
|
9e6378c448 | ||
|
|
62de12281a | ||
|
|
5c36465fd5 | ||
|
|
58454c74cc | ||
|
|
98b8529d1f | ||
|
|
577ae78c30 | ||
|
|
926e01ffe1 | ||
|
|
2a33dfcaab | ||
|
|
e7fde87ca5 | ||
|
|
59a58343ea | ||
|
|
9e50fa7fbe | ||
|
|
e44f8c0112 | ||
|
|
1e14b47c22 | ||
|
|
a8eabfebd1 | ||
|
|
1c87e45cff | ||
|
|
539b288780 | ||
|
|
47aaf6fa15 | ||
|
|
328c4388b7 | ||
|
|
e6f597f28f | ||
|
|
bfa34cf143 | ||
|
|
5e091d4d1f | ||
|
|
95db4f48a5 | ||
|
|
1a79ede633 | ||
|
|
a6471c34ed | ||
|
|
df1c38df74 | ||
|
|
6ee5459459 | ||
|
|
66df5eca03 | ||
|
|
da58a91d1e | ||
|
|
0769f505bf | ||
|
|
b4a50ceefb | ||
|
|
361a637174 | ||
|
|
3484e0b160 | ||
|
|
d5a69afa5a | ||
|
|
0745c0fb6a | ||
|
|
94476c648b | ||
|
|
0cc1279e03 | ||
|
|
10e3193373 | ||
|
|
eeab6957dd | ||
|
|
5cb1b68d39 | ||
|
|
0b11d1c815 | ||
|
|
582a46a59e | ||
|
|
6e51e19b1c | ||
|
|
2ca3eb5660 | ||
|
|
404e82e070 | ||
|
|
7d9d434826 | ||
|
|
b4b31403c7 | ||
|
|
2a28599343 | ||
|
|
3e87c8b0a4 | ||
|
|
db8df01c85 | ||
|
|
240d82f8be | ||
|
|
8569c2f5a6 | ||
|
|
5d6f858235 | ||
|
|
f3281e8275 | ||
|
|
0d2d965364 | ||
|
|
16e761e59c | ||
|
|
69e15442f3 | ||
|
|
da509e32c6 | ||
|
|
23ce65d25d | ||
|
|
f38eee0739 | ||
|
|
c4ef01fc66 | ||
|
|
ab4db657db | ||
|
|
f0a5ba7542 | ||
|
|
7c1df0a430 | ||
|
|
bb4465f392 | ||
|
|
72abc29722 | ||
|
|
fc1970acef | ||
|
|
dbf80031ae | ||
|
|
8254df1a06 | ||
|
|
91e86ba6cf | ||
|
|
cfef7f1bd8 | ||
|
|
b8cc52bf1a | ||
|
|
e27124ab39 | ||
|
|
2e4d044cab | ||
|
|
daae6d966a | ||
|
|
4a1c2d9693 | ||
|
|
c4bce4857e | ||
|
|
a4efd4eec7 | ||
|
|
2d94e261ec | ||
|
|
01e6909180 |
73
BUILDING.txt
73
BUILDING.txt
@@ -12,21 +12,25 @@ Build Requirements
|
|||||||
-- libtool 1.4 or later
|
-- libtool 1.4 or later
|
||||||
|
|
||||||
-- NASM
|
-- NASM
|
||||||
* 0.98 or later is required for a 32-bit build
|
* 0.98, or 2.01 or later is required for a 32-bit build
|
||||||
* NASM 2.05 or later is required for a 64-bit build
|
* NASM 2.00 or later is required for a 64-bit build
|
||||||
* NASM 2.07 or later is required for a 64-bit build on OS X. This can be
|
* NASM 2.07 or later is required for a 64-bit build on OS X. This can be
|
||||||
obtained from MacPorts (http://www.macports.org/).
|
obtained from MacPorts (http://www.macports.org/).
|
||||||
|
|
||||||
The NASM 2.05 RPMs do not work on older Linux systems, such as Red Hat
|
The binary RPMs released by the NASM project do not work on older Linux
|
||||||
Enterprise Linux 4. On such systems, you can easily build and install NASM
|
systems, such as Red Hat Enterprise Linux 4. On such systems, you can
|
||||||
2.05 from the source RPM by executing the following as root:
|
easily build and install NASM from a source RPM by downloading one of the
|
||||||
|
SRPMs from
|
||||||
|
|
||||||
|
http://www.nasm.us/pub/nasm/releasebuilds
|
||||||
|
|
||||||
|
and executing the following as root:
|
||||||
|
|
||||||
ARCH=`uname -m`
|
ARCH=`uname -m`
|
||||||
wget http://www.nasm.us/pub/nasm/releasebuilds/2.05.01/nasm-2.05.01-1.src.rpm
|
rpmbuild --rebuild nasm-{version}.src.rpm
|
||||||
rpmbuild --rebuild nasm-2.05.01-1.src.rpm
|
rpm -Uvh /usr/src/redhat/RPMS/$ARCH/nasm-{version}.$ARCH.rpm
|
||||||
rpm -Uvh /usr/src/redhat/RPMS/$ARCH/nasm-2.05.01-1.$ARCH.rpm
|
|
||||||
|
|
||||||
NOTE: NASM build will fail if texinfo is not installed.
|
NOTE: the NASM build will fail if texinfo is not installed.
|
||||||
|
|
||||||
-- GCC v4.1 or later recommended for best performance
|
-- GCC v4.1 or later recommended for best performance
|
||||||
|
|
||||||
@@ -91,17 +95,17 @@ This will generate the following files under .libs/
|
|||||||
Development stub for TurboJPEG/OSS shared library
|
Development stub for TurboJPEG/OSS shared library
|
||||||
|
|
||||||
{version} is 62.0.0, 7.0.0, or 8.0.2, depending on whether libjpeg v6b
|
{version} is 62.0.0, 7.0.0, or 8.0.2, depending on whether libjpeg v6b
|
||||||
(default), v7, or v8b emulation is enabled. If using Cygwin, {version} is
|
(default), v7, or v8 emulation is enabled. If using Cygwin, {version} is
|
||||||
62, 7, or 8.
|
62, 7, or 8.
|
||||||
|
|
||||||
|
|
||||||
libjpeg v7 or v8b Emulation
|
libjpeg v7 or v8 Emulation
|
||||||
---------------------------
|
--------------------------
|
||||||
|
|
||||||
Add --with-jpeg7 to the configure command line to build a version of
|
Add --with-jpeg7 to the configure command line to build a version of
|
||||||
libjpeg-turbo that is compatible with libjpeg v7. Add --with-jpeg8 to the
|
libjpeg-turbo that is compatible with libjpeg v7. Add --with-jpeg8 to the
|
||||||
configure command to build a version of libjpeg-turbo that is compatible with
|
configure command to build a version of libjpeg-turbo that is compatible with
|
||||||
libjpeg v8b. See README-turbo.txt for more information on libjpeg v7 and v8b
|
libjpeg v8. See README-turbo.txt for more information on libjpeg v7 and v8
|
||||||
emulation.
|
emulation.
|
||||||
|
|
||||||
|
|
||||||
@@ -110,7 +114,7 @@ Arithmetic Coding Support
|
|||||||
|
|
||||||
Since the patent on arithmetic coding has expired, this functionality has been
|
Since the patent on arithmetic coding has expired, this functionality has been
|
||||||
included in this release of libjpeg-turbo. libjpeg-turbo's implementation is
|
included in this release of libjpeg-turbo. libjpeg-turbo's implementation is
|
||||||
based on the implementation in libjpeg v8b, but it works when emulating libjpeg
|
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
|
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
|
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
|
add --without-arith-enc or --without-arith-dec to the configure command line to
|
||||||
@@ -154,7 +158,7 @@ Build Recipes
|
|||||||
|
|
||||||
Add
|
Add
|
||||||
|
|
||||||
--host i686-pc-linux-gnu CFLAGS='-O3 -m32' CXXFLAGS='-O3 -m32' LDFLAGS=-m32
|
--host i686-pc-linux-gnu CFLAGS='-O3 -m32' LDFLAGS=-m32
|
||||||
|
|
||||||
to the configure command line.
|
to the configure command line.
|
||||||
|
|
||||||
@@ -175,7 +179,7 @@ installed.
|
|||||||
|
|
||||||
Add
|
Add
|
||||||
|
|
||||||
CFLAGS='-O3 -m32' CXXFLAGS='-O3 -m32' LDFLAGS=-m32
|
CFLAGS='-O3 -m32' LDFLAGS=-m32
|
||||||
|
|
||||||
to the configure command line.
|
to the configure command line.
|
||||||
|
|
||||||
@@ -187,8 +191,6 @@ Add
|
|||||||
|
|
||||||
--host x86_64-apple-darwin NASM=/opt/local/bin/nasm \
|
--host x86_64-apple-darwin NASM=/opt/local/bin/nasm \
|
||||||
CFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
|
CFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
|
||||||
-mmacosx-version-min=10.4 -O3' \
|
|
||||||
CXXFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
|
|
||||||
-mmacosx-version-min=10.4 -O3' \
|
-mmacosx-version-min=10.4 -O3' \
|
||||||
LDFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
|
LDFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
|
||||||
-mmacosx-version-min=10.4'
|
-mmacosx-version-min=10.4'
|
||||||
@@ -203,8 +205,6 @@ MacPorts, must be installed.
|
|||||||
Add
|
Add
|
||||||
|
|
||||||
CFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
|
CFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
|
||||||
-mmacosx-version-min=10.4 -O3 -m32' \
|
|
||||||
CXXFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
|
|
||||||
-mmacosx-version-min=10.4 -O3 -m32' \
|
-mmacosx-version-min=10.4 -O3 -m32' \
|
||||||
LDFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
|
LDFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
|
||||||
-mmacosx-version-min=10.4 -m32'
|
-mmacosx-version-min=10.4 -m32'
|
||||||
@@ -217,7 +217,7 @@ to the configure command line. The OS X 10.4 SDK must be installed.
|
|||||||
|
|
||||||
Add
|
Add
|
||||||
|
|
||||||
--host x86_64-pc-solaris CFLAGS='-O3 -m64' CXXFLAGS='-O3 -m64' LDFLAGS=-m64
|
--host x86_64-pc-solaris CFLAGS='-O3 -m64' LDFLAGS=-m64
|
||||||
|
|
||||||
to the configure command line.
|
to the configure command line.
|
||||||
|
|
||||||
@@ -227,8 +227,8 @@ to the configure command line.
|
|||||||
|
|
||||||
Add
|
Add
|
||||||
|
|
||||||
--host i386-unknown-freebsd CC='gcc -B /usr/lib32' CXX='g++ -B/usr/lib32' \
|
--host i386-unknown-freebsd CC='gcc -B /usr/lib32' CFLAGS='-O3 -m32' \
|
||||||
CFLAGS='-O3 -m32' CXXFLAGS='-O3 -m32' LDFLAGS='-B/usr/lib32'
|
LDFLAGS='-B/usr/lib32'
|
||||||
|
|
||||||
to the configure command line. NASM 2.07 or later from FreeBSD ports must be
|
to the configure command line. NASM 2.07 or later from FreeBSD ports must be
|
||||||
installed.
|
installed.
|
||||||
@@ -239,15 +239,14 @@ Sun Studio
|
|||||||
|
|
||||||
Add
|
Add
|
||||||
|
|
||||||
CC=cc CXX=CC
|
CC=cc
|
||||||
|
|
||||||
to the configure command line. libjpeg-turbo will automatically be built with
|
to the configure command line. libjpeg-turbo will automatically be built with
|
||||||
the maximum optimization level (-xO5) unless you override CFLAGS and CXXFLAGS.
|
the maximum optimization level (-xO5) unless you override CFLAGS.
|
||||||
|
|
||||||
To build a 64-bit version of libjpeg-turbo using Sun Studio, add
|
To build a 64-bit version of libjpeg-turbo using Sun Studio, add
|
||||||
|
|
||||||
--host x86_64-pc-solaris CC=cc CXX=CC CFLAGS='-xO5 -m64' \
|
--host x86_64-pc-solaris CC=cc CFLAGS='-xO5 -m64' LDFLAGS=-m64
|
||||||
CXXFLAGS='-xO5 -m64' LDFLAGS=-m64
|
|
||||||
|
|
||||||
to the configure command line.
|
to the configure command line.
|
||||||
|
|
||||||
@@ -346,7 +345,7 @@ The following files will be generated under {build_directory}:
|
|||||||
Import library for TurboJPEG/OSS DLL
|
Import library for TurboJPEG/OSS DLL
|
||||||
|
|
||||||
{version} is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or
|
{version} is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or
|
||||||
v8b emulation is enabled.
|
v8 emulation is enabled.
|
||||||
|
|
||||||
|
|
||||||
Visual C++ (IDE)
|
Visual C++ (IDE)
|
||||||
@@ -380,7 +379,7 @@ This will generate the following files under {build_directory}:
|
|||||||
|
|
||||||
{configuration} is Debug, Release, RelWithDebInfo, or MinSizeRel, depending on
|
{configuration} is Debug, Release, RelWithDebInfo, or MinSizeRel, depending on
|
||||||
the configuration you built in the IDE, and {version} is 62, 7, or 8,
|
the configuration you built in the IDE, and {version} is 62, 7, or 8,
|
||||||
depending on whether libjpeg v6b (default), v7, or v8b emulation is enabled.
|
depending on whether libjpeg v6b (default), v7, or v8 emulation is enabled.
|
||||||
|
|
||||||
|
|
||||||
MinGW
|
MinGW
|
||||||
@@ -406,7 +405,7 @@ This will generate the following files under {build_directory}
|
|||||||
Import library for TurboJPEG/OSS DLL
|
Import library for TurboJPEG/OSS DLL
|
||||||
|
|
||||||
{version} is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or
|
{version} is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or
|
||||||
v8b emulation is enabled.
|
v8 emulation is enabled.
|
||||||
|
|
||||||
|
|
||||||
Debug Build
|
Debug Build
|
||||||
@@ -417,13 +416,13 @@ NMake, remove "-DCMAKE_BUILD_TYPE=Release" (Debug builds are the default with
|
|||||||
NMake.)
|
NMake.)
|
||||||
|
|
||||||
|
|
||||||
libjpeg v7 or v8b Emulation
|
libjpeg v7 or v8 Emulation
|
||||||
---------------------------
|
--------------------------
|
||||||
|
|
||||||
Add "-DWITH_JPEG7=1" to the cmake command line to build a version of
|
Add "-DWITH_JPEG7=1" to the cmake command line to build a version of
|
||||||
libjpeg-turbo that is compatible with libjpeg v7. Add "-DWITH_JPEG8=1" to the
|
libjpeg-turbo that is compatible with libjpeg v7. Add "-DWITH_JPEG8=1" to the
|
||||||
cmake command to build a version of libjpeg-turbo that is compatible with
|
cmake command to build a version of libjpeg-turbo that is compatible with
|
||||||
libjpeg v8b. See README-turbo.txt for more information on libjpeg v7 and v8b
|
libjpeg v8. See README-turbo.txt for more information on libjpeg v7 and v8
|
||||||
emulation.
|
emulation.
|
||||||
|
|
||||||
|
|
||||||
@@ -432,7 +431,7 @@ Arithmetic Coding Support
|
|||||||
|
|
||||||
Since the patent on arithmetic coding has expired, this functionality has been
|
Since the patent on arithmetic coding has expired, this functionality has been
|
||||||
included in this release of libjpeg-turbo. libjpeg-turbo's implementation is
|
included in this release of libjpeg-turbo. libjpeg-turbo's implementation is
|
||||||
based on the implementation in libjpeg v8b, but it works when emulating libjpeg
|
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
|
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
|
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
|
add "-DWITH_ARITH_ENC=0" or "-DWITH_ARITH_DEC=0" to the cmake command line to
|
||||||
@@ -470,7 +469,7 @@ Build Recipes
|
|||||||
----------------------------
|
----------------------------
|
||||||
|
|
||||||
cd {build_directory}
|
cd {build_directory}
|
||||||
CC=/usr/bin/x86_64-w64-mingw32-gcc CXX=/usr/bin/x86_64-w64-mingw32-g++ \
|
CC=/usr/bin/x86_64-w64-mingw32-gcc \
|
||||||
cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
|
cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
|
||||||
-DCMAKE_AR=/usr/bin/x86_64-w64-mingw32-ar \
|
-DCMAKE_AR=/usr/bin/x86_64-w64-mingw32-ar \
|
||||||
-DCMAKE_RANLIB=/usr/bin/x86_64-w64-mingw32-ranlib {source_directory}
|
-DCMAKE_RANLIB=/usr/bin/x86_64-w64-mingw32-ranlib {source_directory}
|
||||||
@@ -485,7 +484,7 @@ mingw64-x86_64-gcc-g++ packages (and their dependencies) must be installed.
|
|||||||
----------------------------
|
----------------------------
|
||||||
|
|
||||||
cd {build_directory}
|
cd {build_directory}
|
||||||
CC=/usr/bin/i686-w64-mingw32-gcc CXX=/usr/bin/i686-w64-mingw32-g++ \
|
CC=/usr/bin/i686-w64-mingw32-gcc \
|
||||||
cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
|
cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
|
||||||
-DDCMAKE_AR=/usr/bin/i686-w64-mingw32-ar \
|
-DDCMAKE_AR=/usr/bin/i686-w64-mingw32-ar \
|
||||||
-DCMAKE_RANLIB=/usr/bin/i686-w64-mingw32-ranlib {source_directory}
|
-DCMAKE_RANLIB=/usr/bin/i686-w64-mingw32-ranlib {source_directory}
|
||||||
@@ -504,7 +503,6 @@ toolchain (which is faster than the Cygwin version):
|
|||||||
|
|
||||||
cd {build_directory}
|
cd {build_directory}
|
||||||
CC={mingw-w64_binary_path}/x86_64-w64-mingw32-gcc \
|
CC={mingw-w64_binary_path}/x86_64-w64-mingw32-gcc \
|
||||||
CXX={mingw-w64_binary_path}/x86_64-w64-mingw32-g++ \
|
|
||||||
cmake -G "MSYS Makefiles" \
|
cmake -G "MSYS Makefiles" \
|
||||||
-DCMAKE_AR={mingw-w64_binary_path}/x86_64-w64-mingw32-ar \
|
-DCMAKE_AR={mingw-w64_binary_path}/x86_64-w64-mingw32-ar \
|
||||||
-DCMAKE_RANLIB={mingw-w64_binary_path}/x86_64-w64-mingw32-ranlib \
|
-DCMAKE_RANLIB={mingw-w64_binary_path}/x86_64-w64-mingw32-ranlib \
|
||||||
@@ -517,7 +515,6 @@ MinGW Build on Linux
|
|||||||
|
|
||||||
cd {build_directory}
|
cd {build_directory}
|
||||||
CC={mingw_binary_path}/i386-mingw32-gcc \
|
CC={mingw_binary_path}/i386-mingw32-gcc \
|
||||||
CXX={mingw_binary_path}/i386-mingw32-g++ \
|
|
||||||
cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
|
cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
|
||||||
-DCMAKE_AR={mingw_binary_path}/i386-mingw32-ar \
|
-DCMAKE_AR={mingw_binary_path}/i386-mingw32-ar \
|
||||||
-DCMAKE_RANLIB={mingw_binary_path}/i386-mingw32-ranlib \
|
-DCMAKE_RANLIB={mingw_binary_path}/i386-mingw32-ranlib \
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
cmake_minimum_required(VERSION 2.6)
|
cmake_minimum_required(VERSION 2.6)
|
||||||
|
|
||||||
project(libjpeg-turbo)
|
project(libjpeg-turbo C)
|
||||||
set(VERSION 1.0.90)
|
set(VERSION 1.1.1)
|
||||||
|
|
||||||
if(MINGW OR CYGWIN)
|
if(MINGW OR CYGWIN)
|
||||||
execute_process(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE BUILD)
|
execute_process(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE BUILD)
|
||||||
@@ -32,17 +32,11 @@ endif()
|
|||||||
|
|
||||||
message(STATUS "VERSION = ${VERSION}, BUILD = ${BUILD}")
|
message(STATUS "VERSION = ${VERSION}, BUILD = ${BUILD}")
|
||||||
|
|
||||||
if(NOT DEFINED WITH_SIMD)
|
option(WITH_SIMD "Include SIMD extensions" TRUE)
|
||||||
set(WITH_SIMD 1)
|
option(WITH_ARITH_ENC "Include arithmetic encoding support" TRUE)
|
||||||
endif()
|
option(WITH_ARITH_DEC "Include arithmetic decoding support" TRUE)
|
||||||
|
option(WITH_JPEG7 "Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b)" FALSE)
|
||||||
if(NOT DEFINED WITH_ARITH_ENC)
|
option(WITH_JPEG8 "Emulate libjpeg v8 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b)" FALSE)
|
||||||
set(WITH_ARITH_ENC 1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT DEFINED WITH_ARITH_DEC)
|
|
||||||
set(WITH_ARITH_DEC 1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WITH_ARITH_ENC)
|
if(WITH_ARITH_ENC)
|
||||||
set(C_ARITH_CODING_SUPPORTED 1)
|
set(C_ARITH_CODING_SUPPORTED 1)
|
||||||
@@ -65,7 +59,7 @@ if(WITH_JPEG8)
|
|||||||
set(JPEG_LIB_VERSION 80)
|
set(JPEG_LIB_VERSION 80)
|
||||||
set(DLL_VERSION 8)
|
set(DLL_VERSION 8)
|
||||||
set(FULLVERSION ${DLL_VERSION}.0.2)
|
set(FULLVERSION ${DLL_VERSION}.0.2)
|
||||||
message(STATUS "Emulating libjpeg v8b API/ABI")
|
message(STATUS "Emulating libjpeg v8 API/ABI")
|
||||||
elseif(WITH_JPEG7)
|
elseif(WITH_JPEG7)
|
||||||
set(JPEG_LIB_VERSION 70)
|
set(JPEG_LIB_VERSION 70)
|
||||||
set(DLL_VERSION 7)
|
set(DLL_VERSION 7)
|
||||||
@@ -76,9 +70,7 @@ endif(WITH_JPEG8)
|
|||||||
if(MSVC)
|
if(MSVC)
|
||||||
# Use the static C library for all build types
|
# Use the static C library for all build types
|
||||||
foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
||||||
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
|
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
|
||||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
|
||||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
|
||||||
if(${var} MATCHES "/MD")
|
if(${var} MATCHES "/MD")
|
||||||
string(REGEX REPLACE "/MD" "/MT" ${var} "${${var}}")
|
string(REGEX REPLACE "/MD" "/MT" ${var} "${${var}}")
|
||||||
endif()
|
endif()
|
||||||
@@ -177,22 +169,22 @@ target_link_libraries(jpegut turbojpeg)
|
|||||||
add_executable(jpegut-static jpegut.c)
|
add_executable(jpegut-static jpegut.c)
|
||||||
target_link_libraries(jpegut-static turbojpeg-static)
|
target_link_libraries(jpegut-static turbojpeg-static)
|
||||||
|
|
||||||
add_executable(jpgtest jpgtest.cxx bmp.c)
|
add_executable(jpgtest jpgtest.c bmp.c)
|
||||||
target_link_libraries(jpgtest turbojpeg)
|
target_link_libraries(jpgtest turbojpeg)
|
||||||
|
|
||||||
add_executable(jpgtest-static jpgtest.cxx bmp.c)
|
add_executable(jpgtest-static jpgtest.c bmp.c)
|
||||||
target_link_libraries(jpgtest-static turbojpeg-static)
|
target_link_libraries(jpgtest-static turbojpeg-static)
|
||||||
|
|
||||||
add_executable(cjpeg-static cjpeg.c cdjpeg.c rdbmp.c rdgif.c rdppm.c rdswitch.c
|
add_executable(cjpeg-static cjpeg.c cdjpeg.c rdbmp.c rdgif.c rdppm.c rdswitch.c
|
||||||
rdtarga.c)
|
rdtarga.c)
|
||||||
set_property(TARGET cjpeg-static PROPERTY COMPILE_FLAGS
|
set_property(TARGET cjpeg-static PROPERTY COMPILE_FLAGS
|
||||||
"-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED")
|
"-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE")
|
||||||
target_link_libraries(cjpeg-static jpeg-static)
|
target_link_libraries(cjpeg-static jpeg-static)
|
||||||
|
|
||||||
add_executable(djpeg-static djpeg.c cdjpeg.c rdcolmap.c rdswitch.c wrbmp.c wrgif.c
|
add_executable(djpeg-static djpeg.c cdjpeg.c rdcolmap.c rdswitch.c wrbmp.c wrgif.c
|
||||||
wrppm.c wrtarga.c)
|
wrppm.c wrtarga.c)
|
||||||
set_property(TARGET djpeg-static PROPERTY COMPILE_FLAGS
|
set_property(TARGET djpeg-static PROPERTY COMPILE_FLAGS
|
||||||
"-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED")
|
"-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE")
|
||||||
target_link_libraries(djpeg-static jpeg-static)
|
target_link_libraries(djpeg-static jpeg-static)
|
||||||
|
|
||||||
add_executable(jpegtran-static jpegtran.c cdjpeg.c rdswitch.c transupp.c)
|
add_executable(jpegtran-static jpegtran.c cdjpeg.c rdswitch.c transupp.c)
|
||||||
@@ -214,6 +206,8 @@ add_test(cjpeg-int sharedlib/cjpeg -dct int -outfile testoutint.jpg ${CMAKE_SOUR
|
|||||||
add_test(cjpeg-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.jpg testoutint.jpg)
|
add_test(cjpeg-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.jpg testoutint.jpg)
|
||||||
add_test(cjpeg-fast sharedlib/cjpeg -dct fast -opt -outfile testoutfst.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
|
add_test(cjpeg-fast sharedlib/cjpeg -dct fast -opt -outfile testoutfst.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
|
||||||
add_test(cjpeg-fast-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst.jpg testoutfst.jpg)
|
add_test(cjpeg-fast-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst.jpg testoutfst.jpg)
|
||||||
|
add_test(cjpeg-fast-100 sharedlib/cjpeg -dct fast -quality 100 -opt -outfile testoutfst100.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
|
||||||
|
add_test(cjpeg-fast-100-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst100.jpg testoutfst100.jpg)
|
||||||
add_test(cjpeg-float sharedlib/cjpeg -dct float -outfile testoutflt.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
|
add_test(cjpeg-float sharedlib/cjpeg -dct float -outfile testoutflt.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
|
||||||
if(WITH_SIMD)
|
if(WITH_SIMD)
|
||||||
add_test(cjpeg-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgflt.jpg testoutflt.jpg)
|
add_test(cjpeg-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgflt.jpg testoutflt.jpg)
|
||||||
@@ -257,6 +251,8 @@ add_test(cjpeg-static-int cjpeg-static -dct int -outfile testoutint.jpg ${CMAKE_
|
|||||||
add_test(cjpeg-static-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.jpg testoutint.jpg)
|
add_test(cjpeg-static-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.jpg testoutint.jpg)
|
||||||
add_test(cjpeg-static-fast cjpeg-static -dct fast -opt -outfile testoutfst.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
|
add_test(cjpeg-static-fast cjpeg-static -dct fast -opt -outfile testoutfst.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
|
||||||
add_test(cjpeg-static-fast-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst.jpg testoutfst.jpg)
|
add_test(cjpeg-static-fast-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst.jpg testoutfst.jpg)
|
||||||
|
add_test(cjpeg-static-fast-100 cjpeg-static -dct fast -quality 100 -opt -outfile testoutfst100.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
|
||||||
|
add_test(cjpeg-static-fast-100-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst100.jpg testoutfst100.jpg)
|
||||||
add_test(cjpeg-static-float cjpeg-static -dct float -outfile testoutflt.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
|
add_test(cjpeg-static-float cjpeg-static -dct float -outfile testoutflt.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
|
||||||
if(WITH_SIMD)
|
if(WITH_SIMD)
|
||||||
add_test(cjpeg-static-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgflt.jpg testoutflt.jpg)
|
add_test(cjpeg-static-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgflt.jpg testoutflt.jpg)
|
||||||
@@ -299,24 +295,26 @@ add_test(jpegtran-static-crop-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOUR
|
|||||||
# Installer
|
# Installer
|
||||||
#
|
#
|
||||||
|
|
||||||
set(INST_NAME ${CMAKE_PROJECT_NAME})
|
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
set(INST_PLATFORM "Visual C++")
|
set(INST_PLATFORM "Visual C++")
|
||||||
|
set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-vc)
|
||||||
|
set(INST_DIR ${CMAKE_PROJECT_NAME})
|
||||||
elseif(MINGW)
|
elseif(MINGW)
|
||||||
set(INST_PLATFORM GCC)
|
set(INST_PLATFORM GCC)
|
||||||
set(INST_NAME ${INST_NAME}-gcc)
|
set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-gcc)
|
||||||
|
set(INST_DIR ${CMAKE_PROJECT_NAME}-gcc)
|
||||||
set(INST_DEFS -DGCC)
|
set(INST_DEFS -DGCC)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(64BIT)
|
if(64BIT)
|
||||||
set(INST_PLATFORM "${INST_PLATFORM} 64-bit")
|
set(INST_PLATFORM "${INST_PLATFORM} 64-bit")
|
||||||
set(INST_NAME ${INST_NAME}64)
|
set(INST_NAME ${INST_NAME}64)
|
||||||
|
set(INST_DIR ${INST_DIR}64)
|
||||||
set(INST_DEFS ${INST_DEFS} -DWIN64)
|
set(INST_DEFS ${INST_DEFS} -DWIN64)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MSVC_IDE)
|
if(MSVC_IDE)
|
||||||
set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=$(OutDir)\\")
|
set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=${CMAKE_CFG_INTDIR}\\")
|
||||||
else()
|
else()
|
||||||
set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=")
|
set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=")
|
||||||
endif()
|
endif()
|
||||||
@@ -325,10 +323,11 @@ configure_file(release/libjpeg-turbo.nsi.in libjpeg-turbo.nsi @ONLY)
|
|||||||
|
|
||||||
add_custom_target(installer
|
add_custom_target(installer
|
||||||
makensis -nocd ${INST_DEFS} libjpeg-turbo.nsi
|
makensis -nocd ${INST_DEFS} libjpeg-turbo.nsi
|
||||||
DEPENDS jpeg jpeg-static turbojpeg turbojpeg-static
|
DEPENDS jpeg jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom
|
||||||
|
cjpeg djpeg jpegtran jpgtest
|
||||||
SOURCES libjpeg-turbo.nsi)
|
SOURCES libjpeg-turbo.nsi)
|
||||||
|
|
||||||
install(TARGETS jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom
|
install(TARGETS jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom jpgtest
|
||||||
ARCHIVE DESTINATION lib
|
ARCHIVE DESTINATION lib
|
||||||
LIBRARY DESTINATION lib
|
LIBRARY DESTINATION lib
|
||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION bin
|
||||||
|
|||||||
102
ChangeLog.txt
102
ChangeLog.txt
@@ -1,14 +1,84 @@
|
|||||||
Significant changes since 1.0.1
|
1.1.1
|
||||||
===============================
|
=====
|
||||||
|
|
||||||
[1] Added emulation of the libjpeg v7 and v8b APIs and ABIs. See
|
[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 <inputfile >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 TurboJPEG/OSS 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.
|
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.
|
[2] Created a new CMake-based build system for the Visual C++ and MinGW builds.
|
||||||
|
|
||||||
[3] TurboJPEG/OSS can now compress from/decompress to grayscale bitmaps.
|
[3] TurboJPEG/OSS can now compress from/decompress to grayscale bitmaps.
|
||||||
|
|
||||||
[4] jpgtest can now be used to test decompression performance only.
|
[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
|
[5] If the default install prefix (/opt/libjpeg-turbo) is used, then
|
||||||
'make install' now creates /opt/libjpeg-turbo/lib32 and
|
'make install' now creates /opt/libjpeg-turbo/lib32 and
|
||||||
@@ -18,7 +88,7 @@ packages.
|
|||||||
[6] All symbols in the libjpeg-turbo dynamic library are now versioned, even
|
[6] All symbols in the libjpeg-turbo dynamic library are now versioned, even
|
||||||
when the library is built with libjpeg v6b emulation.
|
when the library is built with libjpeg v6b emulation.
|
||||||
|
|
||||||
[7] Added arithmetic encoding and decoding support (can be disabled via
|
[7] Added arithmetic encoding and decoding support (can be disabled with
|
||||||
configure or CMake options)
|
configure or CMake options)
|
||||||
|
|
||||||
[8] Added a TJ_YUV flag to TurboJPEG/OSS which causes both the compressor and
|
[8] Added a TJ_YUV flag to TurboJPEG/OSS which causes both the compressor and
|
||||||
@@ -30,8 +100,8 @@ allows the caller to determine the type of subsampling used in a JPEG image.
|
|||||||
[10] Added further protections against invalid Huffman codes.
|
[10] Added further protections against invalid Huffman codes.
|
||||||
|
|
||||||
|
|
||||||
Significant changes since 1.0.0
|
1.0.1
|
||||||
===============================
|
=====
|
||||||
|
|
||||||
[1] The Huffman decoder will now handle erroneous Huffman codes (for instance,
|
[1] The Huffman decoder will now handle erroneous Huffman codes (for instance,
|
||||||
from a corrupt JPEG image.) Previously, these would cause libjpeg-turbo to
|
from a corrupt JPEG image.) Previously, these would cause libjpeg-turbo to
|
||||||
@@ -44,8 +114,8 @@ be used instead of 4:2:0 when decompressing JPEG images using SSE2 code.
|
|||||||
INCOMPLETE_TYPES_BROKEN macro should be defined.
|
INCOMPLETE_TYPES_BROKEN macro should be defined.
|
||||||
|
|
||||||
|
|
||||||
Significant changes since 0.0.93
|
1.0.0
|
||||||
================================
|
=====
|
||||||
|
|
||||||
[1] 2983700: Further FreeBSD build tweaks (no longer necessary to specify
|
[1] 2983700: Further FreeBSD build tweaks (no longer necessary to specify
|
||||||
--host when configuring on a 64-bit system)
|
--host when configuring on a 64-bit system)
|
||||||
@@ -69,18 +139,24 @@ contains just the 32-bit libjpeg-turbo libraries.
|
|||||||
unit tests now work on those architectures.
|
unit tests now work on those architectures.
|
||||||
|
|
||||||
|
|
||||||
Significant changes since 0.0.91
|
0.0.93
|
||||||
================================
|
======
|
||||||
|
|
||||||
[1] 2982659, Fixed x86-64 build on FreeBSD systems
|
[1] 2982659, Fixed x86-64 build on FreeBSD systems
|
||||||
|
|
||||||
[2] 2988188: Added support for Windows 64-bit systems
|
[2] 2988188: Added support for Windows 64-bit systems
|
||||||
|
|
||||||
|
|
||||||
Significant changes since 0.0.90
|
0.0.91
|
||||||
================================
|
======
|
||||||
|
|
||||||
[1] Added documentation to .deb packages
|
[1] Added documentation to .deb packages
|
||||||
|
|
||||||
[2] 2968313: Fixed data corruption issues when decompressing large JPEG images
|
[2] 2968313: Fixed data corruption issues when decompressing large JPEG images
|
||||||
and/or using buffered I/O with the libjpeg-turbo decompressor
|
and/or using buffered I/O with the libjpeg-turbo decompressor
|
||||||
|
|
||||||
|
|
||||||
|
0.0.90
|
||||||
|
======
|
||||||
|
|
||||||
|
Initial release
|
||||||
|
|||||||
50
Makefile.am
50
Makefile.am
@@ -37,14 +37,9 @@ endif
|
|||||||
libturbojpeg_la_SOURCES = $(libjpeg_la_SOURCES) turbojpegl.c turbojpeg.h \
|
libturbojpeg_la_SOURCES = $(libjpeg_la_SOURCES) turbojpegl.c turbojpeg.h \
|
||||||
turbojpeg-mapfile
|
turbojpeg-mapfile
|
||||||
|
|
||||||
if ANON_VERSION_SCRIPT
|
|
||||||
|
|
||||||
libturbojpeg_la_LDFLAGS += $(ANON_VERSION_SCRIPT_FLAG)$(srcdir)/turbojpeg-mapfile
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
if VERSION_SCRIPT
|
if VERSION_SCRIPT
|
||||||
|
|
||||||
|
libturbojpeg_la_LDFLAGS += $(VERSION_SCRIPT_FLAG)$(srcdir)/turbojpeg-mapfile
|
||||||
libjpeg_la_LDFLAGS += $(VERSION_SCRIPT_FLAG)libjpeg.map
|
libjpeg_la_LDFLAGS += $(VERSION_SCRIPT_FLAG)libjpeg.map
|
||||||
|
|
||||||
endif
|
endif
|
||||||
@@ -63,12 +58,12 @@ endif
|
|||||||
|
|
||||||
TSTHDRS = rrutil.h rrtimer.h
|
TSTHDRS = rrutil.h rrtimer.h
|
||||||
|
|
||||||
bin_PROGRAMS = cjpeg djpeg jpegtran rdjpgcom wrjpgcom
|
bin_PROGRAMS = cjpeg djpeg jpegtran rdjpgcom wrjpgcom jpgtest
|
||||||
noinst_PROGRAMS = jpgtest jpegut
|
noinst_PROGRAMS = jpegut
|
||||||
|
|
||||||
jpgtest_SOURCES = $(TSTHDRS) jpgtest.cxx bmp.h bmp.c
|
jpgtest_SOURCES = $(TSTHDRS) jpgtest.c bmp.h bmp.c
|
||||||
|
|
||||||
jpgtest_LDADD = libturbojpeg.la
|
jpgtest_LDADD = libturbojpeg.la -lm
|
||||||
|
|
||||||
jpegut_SOURCES = $(TSTHDRS) jpegut.c bmp.h bmp.c
|
jpegut_SOURCES = $(TSTHDRS) jpegut.c bmp.h bmp.c
|
||||||
|
|
||||||
@@ -113,7 +108,7 @@ DOCS= README install.txt usage.txt wizard.txt example.c libjpeg.txt \
|
|||||||
TESTFILES= testorig.jpg testorig.ppm testimg.bmp testimgflt.jpg \
|
TESTFILES= testorig.jpg testorig.ppm testimg.bmp testimgflt.jpg \
|
||||||
testimgfst.jpg testimgint.jpg testimgp.jpg testimgflt.ppm testimgfst.ppm \
|
testimgfst.jpg testimgint.jpg testimgp.jpg testimgflt.ppm testimgfst.ppm \
|
||||||
testimgint.ppm testimgflt-nosimd.jpg testimgcrop.jpg testimgari.jpg \
|
testimgint.ppm testimgflt-nosimd.jpg testimgcrop.jpg testimgari.jpg \
|
||||||
testimgari.ppm
|
testimgari.ppm testimgfst100.jpg
|
||||||
|
|
||||||
EXTRA_DIST = win release $(DOCS) $(TESTFILES) CMakeLists.txt \
|
EXTRA_DIST = win release $(DOCS) $(TESTFILES) CMakeLists.txt \
|
||||||
sharedlib/CMakeLists.txt cmakescripts libjpeg.map.in
|
sharedlib/CMakeLists.txt cmakescripts libjpeg.map.in
|
||||||
@@ -129,6 +124,8 @@ test: testclean all
|
|||||||
cmp $(srcdir)/testimgint.jpg testoutint.jpg
|
cmp $(srcdir)/testimgint.jpg testoutint.jpg
|
||||||
./cjpeg -dct fast -opt -outfile testoutfst.jpg $(srcdir)/testorig.ppm
|
./cjpeg -dct fast -opt -outfile testoutfst.jpg $(srcdir)/testorig.ppm
|
||||||
cmp $(srcdir)/testimgfst.jpg testoutfst.jpg
|
cmp $(srcdir)/testimgfst.jpg testoutfst.jpg
|
||||||
|
./cjpeg -dct fast -quality 100 -opt -outfile testoutfst100.jpg $(srcdir)/testorig.ppm
|
||||||
|
cmp $(srcdir)/testimgfst100.jpg testoutfst100.jpg
|
||||||
./cjpeg -dct float -outfile testoutflt.jpg $(srcdir)/testorig.ppm
|
./cjpeg -dct float -outfile testoutflt.jpg $(srcdir)/testorig.ppm
|
||||||
if WITH_SIMD
|
if WITH_SIMD
|
||||||
cmp $(srcdir)/testimgflt.jpg testoutflt.jpg
|
cmp $(srcdir)/testimgflt.jpg testoutflt.jpg
|
||||||
@@ -172,15 +169,19 @@ testclean:
|
|||||||
rm -f *_GRAYQ[0-9]*.bmp
|
rm -f *_GRAYQ[0-9]*.bmp
|
||||||
rm -f *_GRAYQ[0-9]*.ppm
|
rm -f *_GRAYQ[0-9]*.ppm
|
||||||
rm -f *_GRAYQ[0-9]*.jpg
|
rm -f *_GRAYQ[0-9]*.jpg
|
||||||
|
rm -f *_GRAY.yuv
|
||||||
rm -f *_420Q[0-9]*.bmp
|
rm -f *_420Q[0-9]*.bmp
|
||||||
rm -f *_420Q[0-9]*.ppm
|
rm -f *_420Q[0-9]*.ppm
|
||||||
rm -f *_420Q[0-9]*.jpg
|
rm -f *_420Q[0-9]*.jpg
|
||||||
|
rm -f *_420.yuv
|
||||||
rm -f *_422Q[0-9]*.bmp
|
rm -f *_422Q[0-9]*.bmp
|
||||||
rm -f *_422Q[0-9]*.ppm
|
rm -f *_422Q[0-9]*.ppm
|
||||||
rm -f *_422Q[0-9]*.jpg
|
rm -f *_422Q[0-9]*.jpg
|
||||||
|
rm -f *_422.yuv
|
||||||
rm -f *_444Q[0-9]*.bmp
|
rm -f *_444Q[0-9]*.bmp
|
||||||
rm -f *_444Q[0-9]*.ppm
|
rm -f *_444Q[0-9]*.ppm
|
||||||
rm -f *_444Q[0-9]*.jpg
|
rm -f *_444Q[0-9]*.jpg
|
||||||
|
rm -f *_444.yuv
|
||||||
|
|
||||||
if X86_64
|
if X86_64
|
||||||
|
|
||||||
@@ -210,11 +211,12 @@ rpm: all
|
|||||||
TMPDIR=`mktemp -d /tmp/${PACKAGE_NAME}-build.XXXXXX`; \
|
TMPDIR=`mktemp -d /tmp/${PACKAGE_NAME}-build.XXXXXX`; \
|
||||||
mkdir -p $$TMPDIR/RPMS; \
|
mkdir -p $$TMPDIR/RPMS; \
|
||||||
ln -fs `pwd` $$TMPDIR/BUILD; \
|
ln -fs `pwd` $$TMPDIR/BUILD; \
|
||||||
rm -f ${PACKAGE_NAME}.${RPMARCH}.rpm; \
|
rm -f ${PACKAGE_NAME}-${VERSION}.${RPMARCH}.rpm; \
|
||||||
rpmbuild -bb --define "_blddir $$TMPDIR/buildroot" \
|
rpmbuild -bb --define "_blddir $$TMPDIR/buildroot" \
|
||||||
--define "_topdir $$TMPDIR" --define "_srcdir ${srcdir}" \
|
--define "_topdir $$TMPDIR" --define "_srcdir ${srcdir}" \
|
||||||
--target ${RPMARCH} libjpeg-turbo.spec; \
|
--target ${RPMARCH} pkgscripts/libjpeg-turbo.spec; \
|
||||||
cp $$TMPDIR/RPMS/${RPMARCH}/${PACKAGE_NAME}-${VERSION}-${BUILD}.${RPMARCH}.rpm ${PACKAGE_NAME}.${RPMARCH}.rpm; \
|
cp $$TMPDIR/RPMS/${RPMARCH}/${PACKAGE_NAME}-${VERSION}-${BUILD}.${RPMARCH}.rpm \
|
||||||
|
${PACKAGE_NAME}-${VERSION}.${RPMARCH}.rpm; \
|
||||||
rm -rf $$TMPDIR
|
rm -rf $$TMPDIR
|
||||||
|
|
||||||
srpm: dist-gzip
|
srpm: dist-gzip
|
||||||
@@ -224,38 +226,38 @@ srpm: dist-gzip
|
|||||||
mkdir -p $$TMPDIR/BUILD; \
|
mkdir -p $$TMPDIR/BUILD; \
|
||||||
mkdir -p $$TMPDIR/SOURCES; \
|
mkdir -p $$TMPDIR/SOURCES; \
|
||||||
mkdir -p $$TMPDIR/SPECS; \
|
mkdir -p $$TMPDIR/SPECS; \
|
||||||
rm -f ${PACKAGE_NAME}.src.rpm; \
|
rm -f ${PACKAGE_NAME}-${VERSION}.src.rpm; \
|
||||||
cp ${PACKAGE_NAME}-${VERSION}.tar.gz $$TMPDIR/SOURCES; \
|
cp ${PACKAGE_NAME}-${VERSION}.tar.gz $$TMPDIR/SOURCES; \
|
||||||
cat libjpeg-turbo.spec | sed s/%{_blddir}/%{_tmppath}/g \
|
cat pkgscripts/libjpeg-turbo.spec | sed s/%{_blddir}/%{_tmppath}/g \
|
||||||
| sed s@%{_srcdir}/@@g | sed s/#--\>//g \
|
| sed s@%{_srcdir}/@@g | sed s/#--\>//g \
|
||||||
> $$TMPDIR/SPECS/libjpeg-turbo.spec; \
|
> $$TMPDIR/SPECS/libjpeg-turbo.spec; \
|
||||||
rpmbuild -bs --define "_topdir $$TMPDIR" $$TMPDIR/SPECS/libjpeg-turbo.spec; \
|
rpmbuild -bs --define "_topdir $$TMPDIR" $$TMPDIR/SPECS/libjpeg-turbo.spec; \
|
||||||
cp $$TMPDIR/SRPMS/${PACKAGE_NAME}-${VERSION}-${BUILD}.src.rpm ${PACKAGE_NAME}.src.rpm; \
|
cp $$TMPDIR/SRPMS/${PACKAGE_NAME}-${VERSION}-${BUILD}.src.rpm \
|
||||||
|
${PACKAGE_NAME}-${VERSION}.src.rpm; \
|
||||||
rm -rf $$TMPDIR
|
rm -rf $$TMPDIR
|
||||||
|
|
||||||
deb: all
|
deb: all
|
||||||
sh $(srcdir)/release/makedpkg ${PACKAGE_NAME} ${VERSION} ${BUILD} \
|
sh pkgscripts/makedpkg
|
||||||
${DEBARCH} ${srcdir}
|
|
||||||
|
|
||||||
if X86_64
|
if X86_64
|
||||||
|
|
||||||
udmg: all
|
udmg: all
|
||||||
sh makemacpkg universal ${BUILDDIR32}
|
sh pkgscripts/makemacpkg universal ${BUILDDIR32}
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
dmg: all
|
dmg: all
|
||||||
sh makemacpkg
|
sh pkgscripts/makemacpkg
|
||||||
|
|
||||||
if X86_64
|
if X86_64
|
||||||
|
|
||||||
csunpkg: all
|
csunpkg: all
|
||||||
sh makesunpkg combined ${BUILDDIR32}
|
sh pkgscripts/makesunpkg combined ${BUILDDIR32}
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
sunpkg: all
|
sunpkg: all
|
||||||
sh makesunpkg
|
sh pkgscripts/makesunpkg
|
||||||
|
|
||||||
cygwinpkg: all
|
cygwinpkg: all
|
||||||
sh $(srcdir)/release/makecygwinpkg ${PACKAGE_NAME} ${VERSION} ${srcdir}
|
sh pkgscripts/makecygwinpkg
|
||||||
|
|||||||
122
README-turbo.txt
122
README-turbo.txt
@@ -2,22 +2,23 @@
|
|||||||
** Background
|
** Background
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
|
|
||||||
libjpeg-turbo is a high-speed version of libjpeg for x86 and x86-64 processors
|
libjpeg-turbo is a derivative of libjpeg which uses SIMD instructions (MMX,
|
||||||
which uses SIMD instructions (MMX, SSE2, etc.) to accelerate baseline JPEG
|
SSE2, etc.) to accelerate baseline JPEG compression and decompression on x86
|
||||||
compression and decompression. libjpeg-turbo is generally 2-4x as fast
|
and x86-64 systems. On such systems, libjpeg-turbo is generally 2-4x as fast
|
||||||
as the unmodified version of libjpeg, all else being equal.
|
as the unmodified version of libjpeg, all else being equal.
|
||||||
|
|
||||||
libjpeg-turbo was originally based on libjpeg/SIMD by Miyasaka Masaru, but
|
libjpeg-turbo was originally based on libjpeg/SIMD by Miyasaka Masaru, but
|
||||||
the TigerVNC and VirtualGL projects made numerous enhancements to the codec,
|
the TigerVNC and VirtualGL projects made numerous enhancements to the codec in
|
||||||
including improved support for Mac OS X, 64-bit support, support for 32-bit
|
2009, including improved support for Mac OS X, 64-bit support, support for
|
||||||
and big endian pixel formats, accelerated Huffman encoding/decoding, and
|
32-bit and big endian pixel formats (RGBX, XBGR, etc.), accelerated Huffman
|
||||||
various bug fixes. The goal was to produce a fully open source codec that
|
encoding/decoding, and various bug fixes. The goal was to produce a fully open
|
||||||
could replace the partially closed source TurboJPEG/IPP codec used by VirtualGL
|
source codec that could replace the partially closed source TurboJPEG/IPP codec
|
||||||
and TurboVNC. libjpeg-turbo generally performs in the range of 80-120% of
|
used by VirtualGL and TurboVNC. libjpeg-turbo generally performs in the range
|
||||||
TurboJPEG/IPP. It is faster in some areas but slower in others.
|
of 80-120% of TurboJPEG/IPP. It is faster in some areas but slower in others.
|
||||||
|
|
||||||
It was decided to split libjpeg-turbo into a separate SDK so that other
|
In early 2010, libjpeg-turbo spun off into its own independent project, with
|
||||||
projects could take advantage of this technology. The libjpeg-turbo shared
|
the goal of making high-speed JPEG compression/decompression technology
|
||||||
|
available to a broader range of users and developers. The libjpeg-turbo shared
|
||||||
libraries can be used as drop-in replacements for libjpeg on most systems.
|
libraries can be used as drop-in replacements for libjpeg on most systems.
|
||||||
|
|
||||||
|
|
||||||
@@ -25,21 +26,21 @@ libraries can be used as drop-in replacements for libjpeg on most systems.
|
|||||||
** License
|
** License
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
|
|
||||||
Some of the optimizations to the Huffman encoder (jchuff.c) and decoder
|
The TurboJPEG/OSS wrapper, as well as some of the optimizations to the Huffman
|
||||||
(jdhuff.c) were borrowed from VirtualGL, and thus any distribution of
|
encoder (jchuff.c) and decoder (jdhuff.c), were borrowed from VirtualGL, and
|
||||||
libjpeg-turbo which includes those optimizations must, as a whole, be subject
|
thus any distribution of libjpeg-turbo which includes those files must, as a
|
||||||
to the terms of the wxWindows Library Licence, Version 3.1. A copy of this
|
whole, be subject to the terms of the wxWindows Library Licence, Version 3.1.
|
||||||
license can be found in this directory under LICENSE.txt. The wxWindows
|
A copy of this license can be found in this directory under LICENSE.txt. The
|
||||||
Library License is based on the LGPL but includes provisions which allow the
|
wxWindows Library License is based on the LGPL but includes provisions which
|
||||||
Library to be statically linked into proprietary libraries and applications
|
allow the Library to be statically linked into proprietary libraries and
|
||||||
without requiring the resulting binaries to be distributed under the terms of
|
applications without requiring the resulting binaries to be distributed under
|
||||||
the LGPL.
|
the terms of the LGPL.
|
||||||
|
|
||||||
The rest of the source code, apart from the Huffman codec optimizations, falls
|
The rest of the source code, apart from TurboJPEG/OSS and the Huffman codec
|
||||||
under a less restrictive, BSD-style license (see README.) You can choose to
|
optimizations, falls under a less restrictive, BSD-style license (see README.)
|
||||||
distribute libjpeg-turbo, as a whole, under this BSD-style license by simply
|
You can choose to distribute libjpeg-turbo, as a whole, under this BSD-style
|
||||||
replacing the optimized jchuff.c and jdhuff.c with their unoptimized
|
license by simply removing TurboJPEG/OSS and replacing the optimized jchuff.c
|
||||||
counterparts from the libjpeg v6b source.
|
and jdhuff.c with their unoptimized counterparts from the libjpeg v6b source.
|
||||||
|
|
||||||
|
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
@@ -51,7 +52,7 @@ Replacing libjpeg at Run Time
|
|||||||
=============================
|
=============================
|
||||||
|
|
||||||
If a Unix application is dynamically linked with libjpeg, then you can replace
|
If a Unix application is dynamically linked with libjpeg, then you can replace
|
||||||
libjpeg with libjpeg-turbo at run time by manipulating the LD_LIBRARY_PATH.
|
libjpeg with libjpeg-turbo at run time by manipulating LD_LIBRARY_PATH.
|
||||||
For instance:
|
For instance:
|
||||||
|
|
||||||
[Using libjpeg]
|
[Using libjpeg]
|
||||||
@@ -75,28 +76,29 @@ links to the libjpeg dynamic library located in /opt/libjpeg-turbo/{lib}. This
|
|||||||
will effectively accelerate every dynamically linked libjpeg application on the
|
will effectively accelerate every dynamically linked libjpeg application on the
|
||||||
system.
|
system.
|
||||||
|
|
||||||
The Windows distribution of the libjpeg-turbo SDK installs the libjpeg-turbo
|
The libjpeg-turbo SDK for Visual C++ installs the libjpeg-turbo DLL
|
||||||
DLL (jpeg62.dll, jpeg7.dll, or jpeg8.dll, depending on whether libjpeg v6b,
|
(jpeg62.dll, jpeg7.dll, or jpeg8.dll, depending on whether libjpeg v6b, v7, or
|
||||||
v7, or v8 emulation is enabled) into c:\libjpeg-turbo[64]\bin, and the PATH
|
v8 emulation is enabled) into c:\libjpeg-turbo[64]\bin, and the PATH
|
||||||
environment variable can be modified such that this directory is searched
|
environment variable can be modified such that this directory is searched
|
||||||
before any others that might contain a libjpeg DLL. However, if a libjpeg
|
before any others that might contain a libjpeg DLL. However, if a libjpeg
|
||||||
DLL exists in an application's install directory, then Windows will load this
|
DLL exists in an application's install directory, then Windows will load this
|
||||||
DLL first whenever the application is launched. Thus, if an application ships
|
DLL first whenever the application is launched. Thus, if an application ships
|
||||||
with jpeg62.dll, jpeg7.dll, or jpeg8.dll, then back up the application's
|
with jpeg62.dll, jpeg7.dll, or jpeg8.dll, then back up the application's
|
||||||
version of this DLL and copy c:\libjpeg-turbo\bin\jpeg*.dll into the
|
version of this DLL and copy c:\libjpeg-turbo[64]\bin\jpeg*.dll into the
|
||||||
application's install directory to accelerate it.
|
application's install directory to accelerate it.
|
||||||
|
|
||||||
The version of the libjpeg-turbo DLL distributed with the "official"
|
The version of the libjpeg-turbo DLL distributed in the libjpeg-turbo SDK for
|
||||||
libjpeg-turbo SDK requires the Visual C++ 2008 C run time DLL (msvcr90.dll).
|
Visual C++ requires the Visual C++ 2008 C run time DLL (msvcr90.dll).
|
||||||
msvcr90.dll ships with more recent versions of Windows, but users of older
|
msvcr90.dll ships with more recent versions of Windows, but users of older
|
||||||
Windows releases can obtain it from the Visual C++ 2008 Redistributable
|
Windows releases can obtain it from the Visual C++ 2008 Redistributable
|
||||||
Package, which is available as a free download from Microsoft's web site.
|
Package, which is available as a free download from Microsoft's web site.
|
||||||
|
|
||||||
NOTE: Features of libjpeg which require passing a C run time structure, such
|
NOTE: Features of libjpeg which require passing a C run time structure, such
|
||||||
as a file handle, from an application to libjpeg will probably not work with
|
as a file handle, from an application to libjpeg will probably not work with
|
||||||
the "official" version of the libjpeg-turbo DLL unless the application is also
|
the version of the libjpeg-turbo DLL distributed in the libjpeg-turbo SDK for
|
||||||
built to use the Visual C++ 2008 C run time DLL. In particular, this affects
|
Visual C++, unless the application is also built to use the Visual C++ 2008 C
|
||||||
jpeg_stdio_dest() and jpeg_stdio_src().
|
run time DLL. In particular, this affects jpeg_stdio_dest() and
|
||||||
|
jpeg_stdio_src().
|
||||||
|
|
||||||
Mac applications typically embed their own copies of the libjpeg dylib inside
|
Mac applications typically embed their own copies of the libjpeg dylib inside
|
||||||
the (hidden) application bundle, so it is not possible to globally replace
|
the (hidden) application bundle, so it is not possible to globally replace
|
||||||
@@ -117,8 +119,8 @@ VirtualGL 2.1.x and TurboVNC 0.6 (and prior.) libjpeg-turbo contains a wrapper
|
|||||||
library (TurboJPEG/OSS) that emulates the TurboJPEG API using libjpeg-turbo
|
library (TurboJPEG/OSS) that emulates the TurboJPEG API using libjpeg-turbo
|
||||||
instead of the closed source Intel Performance Primitives. You can replace the
|
instead of the closed source Intel Performance Primitives. You can replace the
|
||||||
TurboJPEG/IPP package on Linux systems with the libjpeg-turbo package in order
|
TurboJPEG/IPP package on Linux systems with the libjpeg-turbo package in order
|
||||||
to make existing releases of VirtualGL 2.1.x and TurboVNC use the new codec at
|
to make existing releases of VirtualGL 2.1.x and TurboVNC 0.x use the new codec
|
||||||
run time. Note that the 64-bit libjpeg-turbo packages contain only 64-bit
|
at run time. Note that the 64-bit libjpeg-turbo packages contain only 64-bit
|
||||||
binaries, whereas the TurboJPEG/IPP 64-bit packages contained both 64-bit and
|
binaries, whereas the TurboJPEG/IPP 64-bit packages contained both 64-bit and
|
||||||
32-bit binaries. Thus, to replace a TurboJPEG/IPP 64-bit package, install
|
32-bit binaries. Thus, to replace a TurboJPEG/IPP 64-bit package, install
|
||||||
both the 64-bit and 32-bit versions of libjpeg-turbo.
|
both the 64-bit and 32-bit versions of libjpeg-turbo.
|
||||||
@@ -152,11 +154,11 @@ If using MinGW, then set
|
|||||||
|
|
||||||
Building against libjpeg-turbo is useful, for instance, if you want to build an
|
Building against libjpeg-turbo is useful, for instance, if you want to build an
|
||||||
application that leverages the libjpeg-turbo colorspace extensions (see below.)
|
application that leverages the libjpeg-turbo colorspace extensions (see below.)
|
||||||
On Linux and Solaris systems, you would still need to manipulate the
|
On Linux and Solaris systems, you would still need to manipulate
|
||||||
LD_LIBRARY_PATH or sym links appropriately to use libjpeg-turbo at run time.
|
LD_LIBRARY_PATH or create appropriate sym links to use libjpeg-turbo at run
|
||||||
On such systems, you can pass -R /opt/libjpeg-turbo/{lib} to the linker to
|
time. On such systems, you can pass -R /opt/libjpeg-turbo/{lib} to the linker
|
||||||
force the use of libjpeg-turbo at run time rather than libjpeg (also useful if
|
to force the use of libjpeg-turbo at run time rather than libjpeg (also useful
|
||||||
you want to leverage the colorspace extensions), or you can link against the
|
if you want to leverage the colorspace extensions), or you can link against the
|
||||||
libjpeg-turbo static library.
|
libjpeg-turbo static library.
|
||||||
|
|
||||||
To force a Linux, Solaris, or MinGW application to link against the static
|
To force a Linux, Solaris, or MinGW application to link against the static
|
||||||
@@ -168,8 +170,8 @@ On OS X, simply add /opt/libjpeg-turbo/lib/libjpeg.a to the linker command
|
|||||||
line (this also works on Linux and Solaris.)
|
line (this also works on Linux and Solaris.)
|
||||||
|
|
||||||
To build Visual C++ applications using libjpeg-turbo, add
|
To build Visual C++ applications using libjpeg-turbo, add
|
||||||
c:\libjpeg-turbo[64]\include to your system or user INCLUDE environment
|
c:\libjpeg-turbo[64]\include to the system or user INCLUDE environment
|
||||||
variable and c:\libjpeg-turbo[64]\lib to your system or user LIB environment
|
variable and c:\libjpeg-turbo[64]\lib to the system or user LIB environment
|
||||||
variable, and then link against either jpeg.lib (to use the DLL version of
|
variable, and then link against either jpeg.lib (to use the DLL version of
|
||||||
libjpeg-turbo) or jpeg-static.lib (to use the static version of libjpeg-turbo.)
|
libjpeg-turbo) or jpeg-static.lib (to use the static version of libjpeg-turbo.)
|
||||||
|
|
||||||
@@ -227,7 +229,7 @@ releases will also be backward-incompatible.
|
|||||||
|
|
||||||
By passing an argument of --with-jpeg7 or --with-jpeg8 to configure, or an
|
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
|
argument of -DWITH_JPEG7=1 or -DWITH_JPEG8=1 to cmake, you can build a version
|
||||||
of libjpeg-turbo which emulates the libjpeg v7 or v8b API/ABI, so that programs
|
of libjpeg-turbo which emulates the libjpeg v7 or v8 API/ABI, so that programs
|
||||||
which are built against libjpeg v7 or v8 can be run with libjpeg-turbo. The
|
which 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
|
following section describes which libjpeg v7+ features are supported and which
|
||||||
aren't.
|
aren't.
|
||||||
@@ -272,3 +274,31 @@ Not supported:
|
|||||||
|
|
||||||
-- jpegtran: Scaling
|
-- jpegtran: Scaling
|
||||||
Seems to depend on the DCT scaling feature, which isn't supported.
|
Seems to depend on the DCT scaling feature, which isn't supported.
|
||||||
|
|
||||||
|
|
||||||
|
*******************************************************************************
|
||||||
|
** Performance pitfalls
|
||||||
|
*******************************************************************************
|
||||||
|
|
||||||
|
===============
|
||||||
|
Restart Markers
|
||||||
|
===============
|
||||||
|
|
||||||
|
The optimized Huffman decoder in libjpeg-turbo does not handle restart markers
|
||||||
|
in a way that makes libjpeg happy, so it is necessary to use the slow Huffman
|
||||||
|
decoder when decompressing a JPEG image that has restart markers. This can
|
||||||
|
cause the decompression performance to drop by as much as 20%, but the
|
||||||
|
performance will still be much much greater than that of libjpeg v6b. 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
|
||||||
|
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.
|
||||||
|
|||||||
3
bmp.h
3
bmp.h
@@ -1,5 +1,6 @@
|
|||||||
/* Copyright (C)2004 Landmark Graphics Corporation
|
/* Copyright (C)2004 Landmark Graphics Corporation
|
||||||
* Copyright (C)2005 Sun Microsystems, Inc.
|
* Copyright (C)2005 Sun Microsystems, Inc.
|
||||||
|
* Copyright (C)2011 D. R. Commander
|
||||||
*
|
*
|
||||||
* This library is free software and may be redistributed and/or modified under
|
* This library is free software and may be redistributed and/or modified under
|
||||||
* the terms of the wxWindows Library License, Version 3.1 or (at your option)
|
* the terms of the wxWindows Library License, Version 3.1 or (at your option)
|
||||||
@@ -19,7 +20,7 @@
|
|||||||
#define __BMP_H__
|
#define __BMP_H__
|
||||||
|
|
||||||
#define BMPPIXELFORMATS 6
|
#define BMPPIXELFORMATS 6
|
||||||
enum BMPPIXELFORMAT {BMP_RGB=0, BMP_RGBA, BMP_BGR, BMP_BGRA, BMP_ABGR, BMP_ARGB};
|
enum BMPPIXELFORMAT {BMP_RGB=0, BMP_RGBX, BMP_BGR, BMP_BGRX, BMP_XBGR, BMP_XRGB};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
62
configure.ac
62
configure.ac
@@ -2,7 +2,7 @@
|
|||||||
# Process this file with autoconf to produce a configure script.
|
# Process this file with autoconf to produce a configure script.
|
||||||
|
|
||||||
AC_PREREQ([2.56])
|
AC_PREREQ([2.56])
|
||||||
AC_INIT([libjpeg-turbo], [1.0.90])
|
AC_INIT([libjpeg-turbo], [1.1.1])
|
||||||
BUILD=`date +%Y%m%d`
|
BUILD=`date +%Y%m%d`
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2])
|
AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2])
|
||||||
@@ -13,10 +13,9 @@ AC_DEFINE([HAVE_PROTOTYPES], 1, [Define if your compiler supports prototypes])
|
|||||||
|
|
||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
SAVED_CFLAGS=${CFLAGS}
|
SAVED_CFLAGS=${CFLAGS}
|
||||||
SAVED_CXXFLAGS=${CXXFLAGS}
|
SAVED_CPPFLAGS=${CPPFLAGS}
|
||||||
AC_PROG_CPP
|
AC_PROG_CPP
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_PROG_CXX
|
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
AC_PROG_LIBTOOL
|
AC_PROG_LIBTOOL
|
||||||
AC_PROG_LN_S
|
AC_PROG_LN_S
|
||||||
@@ -32,8 +31,8 @@ if test "x${GCC}" = "xyes"; then
|
|||||||
if test "x${SAVED_CFLAGS}" = "x"; then
|
if test "x${SAVED_CFLAGS}" = "x"; then
|
||||||
CFLAGS=-O3
|
CFLAGS=-O3
|
||||||
fi
|
fi
|
||||||
if test "x${SAVED_CXXFLAGS}" = "x"; then
|
if test "x${SAVED_CPPFLAGS}" = "x"; then
|
||||||
CXXFLAGS=-O3
|
CPPFLAGS=-Wall
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -42,9 +41,6 @@ if test "x${SUNCC}" = "xyes"; then
|
|||||||
if test "x${SAVED_CFLAGS}" = "x"; then
|
if test "x${SAVED_CFLAGS}" = "x"; then
|
||||||
CFLAGS=-xO5
|
CFLAGS=-xO5
|
||||||
fi
|
fi
|
||||||
if test "x${SAVED_CXXFLAGS}" = "x"; then
|
|
||||||
CXXFLAGS=-xO5
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Checks for libraries.
|
# Checks for libraries.
|
||||||
@@ -102,21 +98,13 @@ AC_CHECK_FUNCS([memset memcpy], [],
|
|||||||
[AC_DEFINE([NEED_BSD_STRINGS], 1,
|
[AC_DEFINE([NEED_BSD_STRINGS], 1,
|
||||||
[Define if you have BSD-like bzero and bcopy])])
|
[Define if you have BSD-like bzero and bcopy])])
|
||||||
|
|
||||||
# Set flags to indicate platform
|
|
||||||
case "$host_os" in
|
|
||||||
cygwin* | mingw* | pw32* | interix*)
|
|
||||||
is_win32=1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
AM_CONDITIONAL([IS_WIN32], [test "x$is_win32" = "x1"])
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([libjpeg API version])
|
AC_MSG_CHECKING([libjpeg API version])
|
||||||
AC_ARG_VAR(JPEG_LIB_VERSION, [libjpeg API version (62, 70, or 80)])
|
AC_ARG_VAR(JPEG_LIB_VERSION, [libjpeg API version (62, 70, or 80)])
|
||||||
if test "x$JPEG_LIB_VERSION" = "x"; then
|
if test "x$JPEG_LIB_VERSION" = "x"; then
|
||||||
AC_ARG_WITH([jpeg7],
|
AC_ARG_WITH([jpeg7],
|
||||||
AC_HELP_STRING([--with-jpeg7], [Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)]))
|
AC_HELP_STRING([--with-jpeg7], [Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)]))
|
||||||
AC_ARG_WITH([jpeg8],
|
AC_ARG_WITH([jpeg8],
|
||||||
AC_HELP_STRING([--with-jpeg8], [Emulate libjpeg v8b API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)]))
|
AC_HELP_STRING([--with-jpeg8], [Emulate libjpeg v8 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)]))
|
||||||
if test "x${with_jpeg8}" = "xyes"; then
|
if test "x${with_jpeg8}" = "xyes"; then
|
||||||
JPEG_LIB_VERSION=80
|
JPEG_LIB_VERSION=80
|
||||||
else
|
else
|
||||||
@@ -176,36 +164,13 @@ if test "x$VERSION_SCRIPT_FLAG" = "x"; then
|
|||||||
VERSION_SCRIPT=no
|
VERSION_SCRIPT=no
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ANON_VERSION_SCRIPT=yes
|
|
||||||
AC_MSG_CHECKING([whether the linker supports anonymous version scripts])
|
|
||||||
LDFLAGS="$SAVED_LDFLAGS -Wl,--version-script,conftest.map"
|
|
||||||
cat > conftest.map <<EOF
|
|
||||||
{
|
|
||||||
global: main;
|
|
||||||
local: *;
|
|
||||||
};
|
|
||||||
EOF
|
|
||||||
AC_LINK_IFELSE(AC_LANG_PROGRAM([], []),
|
|
||||||
[ANON_VERSION_SCRIPT_FLAG=-Wl,--version-script,; AC_MSG_RESULT([yes (GNU style)])], [])
|
|
||||||
if test "x$ANON_VERSION_SCRIPT_FLAG" = "x"; then
|
|
||||||
LDFLAGS="$SAVED_LDFLAGS -Wl,-M,conftest.map"
|
|
||||||
AC_LINK_IFELSE(AC_LANG_PROGRAM([], []),
|
|
||||||
[ANON_VERSION_SCRIPT_FLAG=-Wl,-M,; AC_MSG_RESULT([yes (Sun style)])], [])
|
|
||||||
fi
|
|
||||||
if test "x$ANON_VERSION_SCRIPT_FLAG" = "x"; then
|
|
||||||
ANON_VERSION_SCRIPT=no
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
fi
|
|
||||||
LDFLAGS="$SAVED_LDFLAGS"
|
LDFLAGS="$SAVED_LDFLAGS"
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to use version script when building libjpeg])
|
AC_MSG_CHECKING([whether to use version script when building libjpeg-turbo])
|
||||||
AC_MSG_RESULT($VERSION_SCRIPT)
|
AC_MSG_RESULT($VERSION_SCRIPT)
|
||||||
|
|
||||||
AM_CONDITIONAL(VERSION_SCRIPT, test "x$VERSION_SCRIPT" = "xyes")
|
AM_CONDITIONAL(VERSION_SCRIPT, test "x$VERSION_SCRIPT" = "xyes")
|
||||||
AM_CONDITIONAL(ANON_VERSION_SCRIPT, test "x$ANON_VERSION_SCRIPT" = "xyes")
|
|
||||||
AC_SUBST(VERSION_SCRIPT_FLAG)
|
AC_SUBST(VERSION_SCRIPT_FLAG)
|
||||||
AC_SUBST(ANON_VERSION_SCRIPT_FLAG)
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to include arithmetic encoding support])
|
AC_MSG_CHECKING([whether to include arithmetic encoding support])
|
||||||
AC_ARG_WITH([arith-enc],
|
AC_ARG_WITH([arith-enc],
|
||||||
@@ -233,7 +198,7 @@ AM_CONDITIONAL([WITH_ARITH], [test "x$with_arith_dec" != "xno" -o "x$with_arith_
|
|||||||
|
|
||||||
# SIMD is optional
|
# SIMD is optional
|
||||||
AC_ARG_WITH([simd],
|
AC_ARG_WITH([simd],
|
||||||
AC_HELP_STRING([--without-simd],[Omit accelerated SIMD routines.]))
|
AC_HELP_STRING([--without-simd],[Omit SIMD extensions.]))
|
||||||
if test "x${with_simd}" != "xno"; then
|
if test "x${with_simd}" != "xno"; then
|
||||||
# Check if we're on a supported CPU
|
# Check if we're on a supported CPU
|
||||||
AC_MSG_CHECKING([if we have SIMD optimisations for cpu type])
|
AC_MSG_CHECKING([if we have SIMD optimisations for cpu type])
|
||||||
@@ -287,9 +252,16 @@ AC_DEFINE_UNQUOTED([BUILD], "$BUILD", [Build number])
|
|||||||
# jconfig.h is a minimal version that allows this package to be built
|
# jconfig.h is a minimal version that allows this package to be built
|
||||||
AC_CONFIG_HEADERS([config.h])
|
AC_CONFIG_HEADERS([config.h])
|
||||||
AC_CONFIG_HEADERS([jconfig.h])
|
AC_CONFIG_HEADERS([jconfig.h])
|
||||||
AC_CONFIG_FILES([libjpeg-turbo.spec:release/libjpeg-turbo.spec.in])
|
AC_CONFIG_FILES([pkgscripts/libjpeg-turbo.spec:release/libjpeg-turbo.spec.in])
|
||||||
AC_CONFIG_FILES([makemacpkg:release/makemacpkg.in])
|
AC_CONFIG_FILES([pkgscripts/makecygwinpkg:release/makecygwinpkg.in])
|
||||||
AC_CONFIG_FILES([makesunpkg:release/makesunpkg.in])
|
AC_CONFIG_FILES([pkgscripts/makedpkg:release/makedpkg.in])
|
||||||
|
AC_CONFIG_FILES([pkgscripts/deb-control:release/deb-control.in])
|
||||||
|
AC_CONFIG_FILES([pkgscripts/makemacpkg:release/makemacpkg.in])
|
||||||
|
AC_CONFIG_FILES([pkgscripts/Description.plist:release/Description.plist.in])
|
||||||
|
AC_CONFIG_FILES([pkgscripts/Info.plist:release/Info.plist.in])
|
||||||
|
AC_CONFIG_FILES([pkgscripts/uninstall:release/uninstall.in])
|
||||||
|
AC_CONFIG_FILES([pkgscripts/makesunpkg:release/makesunpkg.in])
|
||||||
|
AC_CONFIG_FILES([pkgscripts/pkginfo:release/pkginfo.in])
|
||||||
AC_CONFIG_FILES([libjpeg.map])
|
AC_CONFIG_FILES([libjpeg.map])
|
||||||
AC_CONFIG_FILES([Makefile simd/Makefile])
|
AC_CONFIG_FILES([Makefile simd/Makefile])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (C) 1991-1996, Thomas G. Lane.
|
* Copyright (C) 1991-1996, Thomas G. Lane.
|
||||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||||
* Copyright 2009 D. R. Commander
|
* Copyright 2009-2011 D. R. Commander
|
||||||
* This file is part of the Independent JPEG Group's software.
|
* 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 file.
|
||||||
*
|
*
|
||||||
@@ -122,7 +122,7 @@ static const unsigned char green_lut[256] = {
|
|||||||
113, 113, 114, 114, 115, 116, 116, 117, 117, 118, 119, 119,
|
113, 113, 114, 114, 115, 116, 116, 117, 117, 118, 119, 119,
|
||||||
120, 120, 121, 122, 122, 123, 123, 124, 124, 125, 126, 126,
|
120, 120, 121, 122, 122, 123, 123, 124, 124, 125, 126, 126,
|
||||||
127, 127, 128, 129, 129, 130, 130, 131, 131, 132, 133, 133,
|
127, 127, 128, 129, 129, 130, 130, 131, 131, 132, 133, 133,
|
||||||
34, 134, 135, 136, 136, 137, 137, 138, 139, 139, 140, 140,
|
134, 134, 135, 136, 136, 137, 137, 138, 139, 139, 140, 140,
|
||||||
141, 141, 142, 143, 143, 144, 144, 145, 146, 146, 147, 147,
|
141, 141, 142, 143, 143, 144, 144, 145, 146, 146, 147, 147,
|
||||||
148, 149, 149, 150
|
148, 149, 149, 150
|
||||||
};
|
};
|
||||||
@@ -258,14 +258,13 @@ rgb_gray_convert (j_compress_ptr cinfo,
|
|||||||
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
||||||
JDIMENSION output_row, int num_rows)
|
JDIMENSION output_row, int num_rows)
|
||||||
{
|
{
|
||||||
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
|
||||||
#if BITS_IN_JSAMPLE != 8
|
#if BITS_IN_JSAMPLE != 8
|
||||||
|
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
||||||
register INT32 * ctab = cconvert->rgb_ycc_tab;
|
register INT32 * ctab = cconvert->rgb_ycc_tab;
|
||||||
#endif
|
#endif
|
||||||
register JSAMPROW inptr;
|
register JSAMPROW inptr;
|
||||||
register JSAMPROW outptr;
|
register JSAMPROW outptr;
|
||||||
JSAMPLE *maxoutptr;
|
JSAMPLE *maxoutptr;
|
||||||
register JDIMENSION col;
|
|
||||||
JDIMENSION num_cols = cinfo->image_width;
|
JDIMENSION num_cols = cinfo->image_width;
|
||||||
int rindex = rgb_red[cinfo->in_color_space];
|
int rindex = rgb_red[cinfo->in_color_space];
|
||||||
int gindex = rgb_green[cinfo->in_color_space];
|
int gindex = rgb_green[cinfo->in_color_space];
|
||||||
|
|||||||
18
jcdctmgr.c
18
jcdctmgr.c
@@ -4,6 +4,7 @@
|
|||||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||||
* Copyright (C) 1999-2006, MIYASAKA Masaru.
|
* Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||||
|
* Copyright (C) 2011 D. R. Commander
|
||||||
* This file is part of the Independent JPEG Group's software.
|
* 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 file.
|
||||||
*
|
*
|
||||||
@@ -39,6 +40,8 @@ typedef JMETHOD(void, float_quantize_method_ptr,
|
|||||||
(JCOEFPTR coef_block, FAST_FLOAT * divisors,
|
(JCOEFPTR coef_block, FAST_FLOAT * divisors,
|
||||||
FAST_FLOAT * workspace));
|
FAST_FLOAT * workspace));
|
||||||
|
|
||||||
|
METHODDEF(void) quantize (JCOEFPTR, DCTELEM *, DCTELEM *);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
struct jpeg_forward_dct pub; /* public fields */
|
struct jpeg_forward_dct pub; /* public fields */
|
||||||
|
|
||||||
@@ -160,7 +163,7 @@ flss (UINT16 val)
|
|||||||
* of in a consecutive manner, yet again in order to allow SIMD
|
* of in a consecutive manner, yet again in order to allow SIMD
|
||||||
* routines.
|
* routines.
|
||||||
*/
|
*/
|
||||||
LOCAL(void)
|
LOCAL(int)
|
||||||
compute_reciprocal (UINT16 divisor, DCTELEM * dtbl)
|
compute_reciprocal (UINT16 divisor, DCTELEM * dtbl)
|
||||||
{
|
{
|
||||||
UDCTELEM2 fq, fr;
|
UDCTELEM2 fq, fr;
|
||||||
@@ -189,6 +192,9 @@ compute_reciprocal (UINT16 divisor, DCTELEM * dtbl)
|
|||||||
dtbl[DCTSIZE2 * 1] = (DCTELEM) c; /* correction + roundfactor */
|
dtbl[DCTSIZE2 * 1] = (DCTELEM) c; /* correction + roundfactor */
|
||||||
dtbl[DCTSIZE2 * 2] = (DCTELEM) (1 << (sizeof(DCTELEM)*8*2 - r)); /* scale */
|
dtbl[DCTSIZE2 * 2] = (DCTELEM) (1 << (sizeof(DCTELEM)*8*2 - r)); /* scale */
|
||||||
dtbl[DCTSIZE2 * 3] = (DCTELEM) r - sizeof(DCTELEM)*8; /* shift */
|
dtbl[DCTSIZE2 * 3] = (DCTELEM) r - sizeof(DCTELEM)*8; /* shift */
|
||||||
|
|
||||||
|
if(r <= 16) return 0;
|
||||||
|
else return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -232,7 +238,9 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
|
|||||||
}
|
}
|
||||||
dtbl = fdct->divisors[qtblno];
|
dtbl = fdct->divisors[qtblno];
|
||||||
for (i = 0; i < DCTSIZE2; i++) {
|
for (i = 0; i < DCTSIZE2; i++) {
|
||||||
compute_reciprocal(qtbl->quantval[i] << 3, &dtbl[i]);
|
if(!compute_reciprocal(qtbl->quantval[i] << 3, &dtbl[i])
|
||||||
|
&& fdct->quantize == jsimd_quantize)
|
||||||
|
fdct->quantize = quantize;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
@@ -266,10 +274,12 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
|
|||||||
}
|
}
|
||||||
dtbl = fdct->divisors[qtblno];
|
dtbl = fdct->divisors[qtblno];
|
||||||
for (i = 0; i < DCTSIZE2; i++) {
|
for (i = 0; i < DCTSIZE2; i++) {
|
||||||
compute_reciprocal(
|
if(!compute_reciprocal(
|
||||||
DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i],
|
DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i],
|
||||||
(INT32) aanscales[i]),
|
(INT32) aanscales[i]),
|
||||||
CONST_BITS-3), &dtbl[i]);
|
CONST_BITS-3), &dtbl[i])
|
||||||
|
&& fdct->quantize == jsimd_quantize)
|
||||||
|
fdct->quantize = quantize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -75,7 +75,9 @@ initial_setup (j_compress_ptr cinfo, boolean transcode_only)
|
|||||||
JDIMENSION jd_samplesperrow;
|
JDIMENSION jd_samplesperrow;
|
||||||
|
|
||||||
#if JPEG_LIB_VERSION >= 70
|
#if JPEG_LIB_VERSION >= 70
|
||||||
|
#if JPEG_LIB_VERSION >= 80
|
||||||
if (!transcode_only)
|
if (!transcode_only)
|
||||||
|
#endif
|
||||||
jpeg_calc_jpeg_dimensions(cinfo);
|
jpeg_calc_jpeg_dimensions(cinfo);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -223,7 +223,6 @@ gray_rgb_convert (j_decompress_ptr cinfo,
|
|||||||
{
|
{
|
||||||
register JSAMPROW inptr, outptr;
|
register JSAMPROW inptr, outptr;
|
||||||
JSAMPLE *maxinptr;
|
JSAMPLE *maxinptr;
|
||||||
register JDIMENSION col;
|
|
||||||
JDIMENSION num_cols = cinfo->output_width;
|
JDIMENSION num_cols = cinfo->output_width;
|
||||||
int rindex = rgb_red[cinfo->out_color_space];
|
int rindex = rgb_red[cinfo->out_color_space];
|
||||||
int gindex = rgb_green[cinfo->out_color_space];
|
int gindex = rgb_green[cinfo->out_color_space];
|
||||||
|
|||||||
12
jdhuff.c
12
jdhuff.c
@@ -623,6 +623,7 @@ decode_mcu_slow (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
if (val0 == 0xFF) { \
|
if (val0 == 0xFF) { \
|
||||||
buffer++; \
|
buffer++; \
|
||||||
if (val1 != 0) { \
|
if (val1 != 0) { \
|
||||||
|
cinfo->unread_marker = val1; \
|
||||||
buffer -= 2; \
|
buffer -= 2; \
|
||||||
get_buffer &= ~0xFF; \
|
get_buffer &= ~0xFF; \
|
||||||
} \
|
} \
|
||||||
@@ -739,6 +740,11 @@ decode_mcu_fast (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cinfo->unread_marker != 0) {
|
||||||
|
cinfo->unread_marker = 0;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
br_state.bytes_in_buffer -= (buffer - br_state.next_input_byte);
|
br_state.bytes_in_buffer -= (buffer - br_state.next_input_byte);
|
||||||
br_state.next_input_byte = buffer;
|
br_state.next_input_byte = buffer;
|
||||||
BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
|
BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
|
||||||
@@ -778,7 +784,8 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
usefast = 0;
|
usefast = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cinfo->src->bytes_in_buffer < BUFSIZE * cinfo->blocks_in_MCU)
|
if (cinfo->src->bytes_in_buffer < BUFSIZE * cinfo->blocks_in_MCU
|
||||||
|
|| cinfo->unread_marker != 0)
|
||||||
usefast = 0;
|
usefast = 0;
|
||||||
|
|
||||||
/* If we've run out of data, just leave the MCU set to zeroes.
|
/* If we've run out of data, just leave the MCU set to zeroes.
|
||||||
@@ -787,9 +794,10 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
if (! entropy->pub.insufficient_data) {
|
if (! entropy->pub.insufficient_data) {
|
||||||
|
|
||||||
if (usefast) {
|
if (usefast) {
|
||||||
if (!decode_mcu_fast(cinfo, MCU_data)) return FALSE;
|
if (!decode_mcu_fast(cinfo, MCU_data)) goto use_slow;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
use_slow:
|
||||||
if (!decode_mcu_slow(cinfo, MCU_data)) return FALSE;
|
if (!decode_mcu_slow(cinfo, MCU_data)) return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -99,6 +99,11 @@ transdecode_master_selection (j_decompress_ptr cinfo)
|
|||||||
/* This is effectively a buffered-image operation. */
|
/* This is effectively a buffered-image operation. */
|
||||||
cinfo->buffered_image = TRUE;
|
cinfo->buffered_image = TRUE;
|
||||||
|
|
||||||
|
#if JPEG_LIB_VERSION >= 80
|
||||||
|
/* Compute output image dimensions and related values. */
|
||||||
|
jpeg_core_output_dimensions(cinfo);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Entropy decoding: either Huffman or arithmetic coding. */
|
/* Entropy decoding: either Huffman or arithmetic coding. */
|
||||||
if (cinfo->arith_code) {
|
if (cinfo->arith_code) {
|
||||||
#ifdef D_ARITH_CODING_SUPPORTED
|
#ifdef D_ARITH_CODING_SUPPORTED
|
||||||
|
|||||||
15
jmemmgr.c
15
jmemmgr.c
@@ -37,6 +37,15 @@ extern char * getenv JPP((const char * name));
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
LOCAL(size_t)
|
||||||
|
round_up_pow2 (size_t a, size_t b)
|
||||||
|
/* a rounded up to the next multiple of b, i.e. ceil(a/b)*b */
|
||||||
|
/* Assumes a >= 0, b > 0, and b is a power of 2 */
|
||||||
|
{
|
||||||
|
return ((a + b - 1) & (~(b - 1)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some important notes:
|
* Some important notes:
|
||||||
* The allocation routines provided here must never return NULL.
|
* The allocation routines provided here must never return NULL.
|
||||||
@@ -265,7 +274,7 @@ alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
|
|||||||
* and so that algorithms can straddle outside the proper area up
|
* and so that algorithms can straddle outside the proper area up
|
||||||
* to the next alignment.
|
* to the next alignment.
|
||||||
*/
|
*/
|
||||||
sizeofobject = jround_up(sizeofobject, ALIGN_SIZE);
|
sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
|
||||||
|
|
||||||
/* Check for unsatisfiable request (do now to ensure no overflow below) */
|
/* Check for unsatisfiable request (do now to ensure no overflow below) */
|
||||||
if ((SIZEOF(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) > MAX_ALLOC_CHUNK)
|
if ((SIZEOF(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) > MAX_ALLOC_CHUNK)
|
||||||
@@ -354,7 +363,7 @@ alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
|
|||||||
* algorithms can straddle outside the proper area up to the next
|
* algorithms can straddle outside the proper area up to the next
|
||||||
* alignment.
|
* alignment.
|
||||||
*/
|
*/
|
||||||
sizeofobject = jround_up(sizeofobject, ALIGN_SIZE);
|
sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
|
||||||
|
|
||||||
/* Check for unsatisfiable request (do now to ensure no overflow below) */
|
/* Check for unsatisfiable request (do now to ensure no overflow below) */
|
||||||
if ((SIZEOF(large_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) > MAX_ALLOC_CHUNK)
|
if ((SIZEOF(large_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) > MAX_ALLOC_CHUNK)
|
||||||
@@ -420,7 +429,7 @@ alloc_sarray (j_common_ptr cinfo, int pool_id,
|
|||||||
/* Make sure each row is properly aligned */
|
/* Make sure each row is properly aligned */
|
||||||
if ((ALIGN_SIZE % SIZEOF(JSAMPLE)) != 0)
|
if ((ALIGN_SIZE % SIZEOF(JSAMPLE)) != 0)
|
||||||
out_of_memory(cinfo, 5); /* safety check */
|
out_of_memory(cinfo, 5); /* safety check */
|
||||||
samplesperrow = (JDIMENSION)jround_up(samplesperrow, (2 * ALIGN_SIZE) / SIZEOF(JSAMPLE));
|
samplesperrow = (JDIMENSION)round_up_pow2(samplesperrow, (2 * ALIGN_SIZE) / SIZEOF(JSAMPLE));
|
||||||
|
|
||||||
/* Calculate max # of rows allowed in one allocation chunk */
|
/* Calculate max # of rows allowed in one allocation chunk */
|
||||||
ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) /
|
ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) /
|
||||||
|
|||||||
@@ -375,7 +375,7 @@ EXTERN(void) jinit_memory_mgr JPP((j_common_ptr cinfo));
|
|||||||
|
|
||||||
/* Utility routines in jutils.c */
|
/* Utility routines in jutils.c */
|
||||||
EXTERN(long) jdiv_round_up JPP((long a, long b));
|
EXTERN(long) jdiv_round_up JPP((long a, long b));
|
||||||
EXTERN(size_t) jround_up JPP((size_t a, size_t b));
|
EXTERN(long) jround_up JPP((long a, long b));
|
||||||
EXTERN(void) jcopy_sample_rows JPP((JSAMPARRAY input_array, int source_row,
|
EXTERN(void) jcopy_sample_rows JPP((JSAMPARRAY input_array, int source_row,
|
||||||
JSAMPARRAY output_array, int dest_row,
|
JSAMPARRAY output_array, int dest_row,
|
||||||
int num_rows, JDIMENSION num_cols));
|
int num_rows, JDIMENSION num_cols));
|
||||||
|
|||||||
104
jpegut.c
104
jpegut.c
@@ -1,6 +1,6 @@
|
|||||||
/* Copyright (C)2004 Landmark Graphics Corporation
|
/* Copyright (C)2004 Landmark Graphics Corporation
|
||||||
* Copyright (C)2005 Sun Microsystems, Inc.
|
* Copyright (C)2005 Sun Microsystems, Inc.
|
||||||
* Copyright (C)2009-2010 D. R. Commander
|
* Copyright (C)2009-2011 D. R. Commander
|
||||||
*
|
*
|
||||||
* This library is free software and may be redistributed and/or modified under
|
* This library is free software and may be redistributed and/or modified under
|
||||||
* the terms of the wxWindows Library License, Version 3.1 or (at your option)
|
* the terms of the wxWindows Library License, Version 3.1 or (at your option)
|
||||||
@@ -107,12 +107,13 @@ void dumpbuf(unsigned char *buf, int w, int h, int ps, int flags)
|
|||||||
{
|
{
|
||||||
int roffset=(flags&TJ_BGR)?2:0, goffset=1, boffset=(flags&TJ_BGR)?0:2, i,
|
int roffset=(flags&TJ_BGR)?2:0, goffset=1, boffset=(flags&TJ_BGR)?0:2, i,
|
||||||
j;
|
j;
|
||||||
|
printf("\n");
|
||||||
for(i=0; i<h; i++)
|
for(i=0; i<h; i++)
|
||||||
{
|
{
|
||||||
for(j=0; j<w; j++)
|
for(j=0; j<w; j++)
|
||||||
{
|
{
|
||||||
printf("%.3d/%.3d/%.3d ", buf[(w*i+j)*ps+roffset],
|
printf("%.3d/%.3d/%.3d ", buf[(w*i+j)*ps+roffset],
|
||||||
buf[(w*i+j)*ps+roffset], buf[(w*i+j)*ps+roffset]);
|
buf[(w*i+j)*ps+goffset], buf[(w*i+j)*ps+boffset]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
@@ -218,15 +219,14 @@ int checkbuf(unsigned char *buf, int w, int h, int ps, int subsamp, int flags)
|
|||||||
}}
|
}}
|
||||||
|
|
||||||
#define checkval255(v) { \
|
#define checkval255(v) { \
|
||||||
if(v<254 && !(v==217 && i==0 && j==21)) { \
|
if(v<254) { \
|
||||||
printf("\nComp. %s at %d,%d should be 255, not %d\n", #v, i, j, v); \
|
printf("\nComp. %s at %d,%d should be 255, not %d\n", #v, i, j, v); \
|
||||||
retval=0; goto bailout; \
|
retval=0; goto bailout; \
|
||||||
}}
|
}}
|
||||||
|
|
||||||
#define PAD(v, p) ((v+(p)-1)&(~((p)-1)))
|
#define PAD(v, p) ((v+(p)-1)&(~((p)-1)))
|
||||||
|
|
||||||
int checkbufyuv(unsigned char *buf, unsigned long size, int w, int h,
|
int checkbufyuv(unsigned char *buf, int w, int h, int subsamp)
|
||||||
int subsamp)
|
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
int hsf=_hsf[subsamp], vsf=_vsf[subsamp];
|
int hsf=_hsf[subsamp], vsf=_vsf[subsamp];
|
||||||
@@ -234,13 +234,6 @@ int checkbufyuv(unsigned char *buf, unsigned long size, int w, int h,
|
|||||||
int cw=pw/hsf, ch=ph/vsf;
|
int cw=pw/hsf, ch=ph/vsf;
|
||||||
int ypitch=PAD(pw, 4), uvpitch=PAD(cw, 4);
|
int ypitch=PAD(pw, 4), uvpitch=PAD(cw, 4);
|
||||||
int retval=1;
|
int retval=1;
|
||||||
unsigned long correctsize=ypitch*ph + (subsamp==TJ_GRAYSCALE? 0:uvpitch*ch*2);
|
|
||||||
|
|
||||||
if(size!=correctsize)
|
|
||||||
{
|
|
||||||
printf("\nIncorrect size %lu. Should be %lu\n", size, correctsize);
|
|
||||||
retval=0; goto bailout;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i=0; i<16; i++)
|
for(i=0; i<16; i++)
|
||||||
{
|
{
|
||||||
@@ -349,17 +342,15 @@ void gentestjpeg(tjhandle hnd, unsigned char *jpegbuf, unsigned long *size,
|
|||||||
char tempstr[1024]; unsigned char *bmpbuf=NULL;
|
char tempstr[1024]; unsigned char *bmpbuf=NULL;
|
||||||
const char *pixformat; double t;
|
const char *pixformat; double t;
|
||||||
|
|
||||||
if(yuv==YUVENCODE) flags|=TJ_YUV;
|
|
||||||
|
|
||||||
if(flags&TJ_BGR)
|
if(flags&TJ_BGR)
|
||||||
{
|
{
|
||||||
if(ps==3) pixformat="BGR";
|
if(ps==3) pixformat="BGR";
|
||||||
else {if(flags&TJ_ALPHAFIRST) pixformat="ABGR"; else pixformat="BGRA";}
|
else {if(flags&TJ_ALPHAFIRST) pixformat="XBGR"; else pixformat="BGRX";}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(ps==3) pixformat="RGB";
|
if(ps==3) pixformat="RGB";
|
||||||
else {if(flags&TJ_ALPHAFIRST) pixformat="ARGB"; else pixformat="RGBA";}
|
else {if(flags&TJ_ALPHAFIRST) pixformat="XRGB"; else pixformat="RGBX";}
|
||||||
}
|
}
|
||||||
if(ps==1) pixformat="Grayscale";
|
if(ps==1) pixformat="Grayscale";
|
||||||
if(yuv==YUVENCODE)
|
if(yuv==YUVENCODE)
|
||||||
@@ -374,10 +365,20 @@ void gentestjpeg(tjhandle hnd, unsigned char *jpegbuf, unsigned long *size,
|
|||||||
printf("ERROR: Could not allocate buffer\n"); bailout();
|
printf("ERROR: Could not allocate buffer\n"); bailout();
|
||||||
}
|
}
|
||||||
initbuf(bmpbuf, w, h, ps, flags);
|
initbuf(bmpbuf, w, h, ps, flags);
|
||||||
memset(jpegbuf, 0, TJBUFSIZE(w, h));
|
memset(jpegbuf, 0,
|
||||||
|
yuv==YUVENCODE? TJBUFSIZEYUV(w, h, subsamp):TJBUFSIZE(w, h));
|
||||||
|
|
||||||
t=rrtime();
|
t=rrtime();
|
||||||
_catch(tjCompress(hnd, bmpbuf, w, 0, h, ps, jpegbuf, size, subsamp, qual, flags));
|
if(yuv==YUVENCODE)
|
||||||
|
{
|
||||||
|
_catch(tjEncodeYUV(hnd, bmpbuf, w, 0, h, ps, jpegbuf, subsamp, flags));
|
||||||
|
*size=TJBUFSIZEYUV(w, h, subsamp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_catch(tjCompress(hnd, bmpbuf, w, 0, h, ps, jpegbuf, size, subsamp, qual,
|
||||||
|
flags));
|
||||||
|
}
|
||||||
t=rrtime()-t;
|
t=rrtime()-t;
|
||||||
|
|
||||||
if(yuv==YUVENCODE)
|
if(yuv==YUVENCODE)
|
||||||
@@ -389,8 +390,8 @@ void gentestjpeg(tjhandle hnd, unsigned char *jpegbuf, unsigned long *size,
|
|||||||
writejpeg(jpegbuf, *size, tempstr);
|
writejpeg(jpegbuf, *size, tempstr);
|
||||||
if(yuv==YUVENCODE)
|
if(yuv==YUVENCODE)
|
||||||
{
|
{
|
||||||
if(checkbufyuv(jpegbuf, *size, w, h, subsamp)) printf("Passed.");
|
if(checkbufyuv(jpegbuf, w, h, subsamp)) printf("Passed.");
|
||||||
else printf("FAILED!");
|
else {printf("FAILED!"); exitstatus=-1;}
|
||||||
}
|
}
|
||||||
else printf("Done.");
|
else printf("Done.");
|
||||||
printf(" %f ms\n Result in %s\n", t*1000., tempstr);
|
printf(" %f ms\n Result in %s\n", t*1000., tempstr);
|
||||||
@@ -405,23 +406,18 @@ void gentestbmp(tjhandle hnd, unsigned char *jpegbuf, unsigned long jpegsize,
|
|||||||
unsigned char *bmpbuf=NULL;
|
unsigned char *bmpbuf=NULL;
|
||||||
const char *pixformat; int _w=0, _h=0; double t;
|
const char *pixformat; int _w=0, _h=0; double t;
|
||||||
unsigned long size=0;
|
unsigned long size=0;
|
||||||
int hsf=_hsf[subsamp], vsf=_vsf[subsamp];
|
|
||||||
int pw=PAD(w, hsf), ph=PAD(h, vsf);
|
|
||||||
int cw=pw/hsf, ch=ph/vsf;
|
|
||||||
int ypitch=PAD(pw, 4), uvpitch=PAD(cw, 4);
|
|
||||||
|
|
||||||
if(yuv==YUVDECODE) flags|=TJ_YUV;
|
if(yuv==YUVENCODE) return;
|
||||||
else if(yuv==YUVENCODE) return;
|
|
||||||
|
|
||||||
if(flags&TJ_BGR)
|
if(flags&TJ_BGR)
|
||||||
{
|
{
|
||||||
if(ps==3) pixformat="BGR";
|
if(ps==3) pixformat="BGR";
|
||||||
else {if(flags&TJ_ALPHAFIRST) pixformat="ABGR"; else pixformat="BGRA";}
|
else {if(flags&TJ_ALPHAFIRST) pixformat="XBGR"; else pixformat="BGRX";}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(ps==3) pixformat="RGB";
|
if(ps==3) pixformat="RGB";
|
||||||
else {if(flags&TJ_ALPHAFIRST) pixformat="ARGB"; else pixformat="RGBA";}
|
else {if(flags&TJ_ALPHAFIRST) pixformat="XRGB"; else pixformat="RGBX";}
|
||||||
}
|
}
|
||||||
if(ps==1) pixformat="Grayscale";
|
if(ps==1) pixformat="Grayscale";
|
||||||
if(yuv==YUVDECODE)
|
if(yuv==YUVDECODE)
|
||||||
@@ -436,30 +432,39 @@ void gentestbmp(tjhandle hnd, unsigned char *jpegbuf, unsigned long jpegsize,
|
|||||||
printf("Incorrect JPEG header\n"); bailout();
|
printf("Incorrect JPEG header\n"); bailout();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(yuv==YUVDECODE)
|
if(yuv==YUVDECODE) size=TJBUFSIZEYUV(w, h, subsamp);
|
||||||
size=ypitch*ph + (subsamp==TJ_GRAYSCALE? 0:uvpitch*ch*2);
|
else size=w*h*ps+1;
|
||||||
else
|
if((bmpbuf=(unsigned char *)malloc(size))==NULL)
|
||||||
size=w*h*ps;
|
|
||||||
if((bmpbuf=(unsigned char *)malloc(size+1))==NULL)
|
|
||||||
{
|
{
|
||||||
printf("ERROR: Could not allocate buffer\n"); bailout();
|
printf("ERROR: Could not allocate buffer\n"); bailout();
|
||||||
}
|
}
|
||||||
memset(bmpbuf, 0, size+1);
|
memset(bmpbuf, 0, size);
|
||||||
|
|
||||||
t=rrtime();
|
t=rrtime();
|
||||||
_catch(tjDecompress(hnd, jpegbuf, jpegsize, bmpbuf, w, w*ps, h, ps, flags));
|
if(yuv==YUVDECODE)
|
||||||
|
{
|
||||||
|
_catch(tjDecompressToYUV(hnd, jpegbuf, jpegsize, bmpbuf, flags));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_catch(tjDecompress(hnd, jpegbuf, jpegsize, bmpbuf, w, w*ps, h, ps,
|
||||||
|
flags));
|
||||||
|
}
|
||||||
t=rrtime()-t;
|
t=rrtime()-t;
|
||||||
|
|
||||||
if(yuv==YUVDECODE)
|
if(yuv==YUVDECODE)
|
||||||
{
|
{
|
||||||
if(checkbufyuv(bmpbuf, size, pw, ph, subsamp))
|
if(checkbufyuv(bmpbuf, w, h, subsamp)) printf("Passed.");
|
||||||
printf("Passed.");
|
else {printf("FAILED!"); exitstatus=-1;}
|
||||||
else printf("FAILED!");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(checkbuf(bmpbuf, w, h, ps, subsamp, flags)) printf("Passed.");
|
if(checkbuf(bmpbuf, w, h, ps, subsamp, flags)) printf("Passed.");
|
||||||
else {printf("FAILED!"); dumpbuf(bmpbuf, w, h, ps, flags);}
|
else
|
||||||
|
{
|
||||||
|
printf("FAILED!"); exitstatus=-1;
|
||||||
|
dumpbuf(bmpbuf, w, h, ps, flags);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
printf(" %f ms\n\n", t*1000.);
|
printf(" %f ms\n\n", t*1000.);
|
||||||
|
|
||||||
@@ -472,7 +477,8 @@ void dotest(int w, int h, int ps, int subsamp, char *basefilename)
|
|||||||
tjhandle hnd=NULL, dhnd=NULL; unsigned char *jpegbuf=NULL;
|
tjhandle hnd=NULL, dhnd=NULL; unsigned char *jpegbuf=NULL;
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
|
|
||||||
if((jpegbuf=(unsigned char *)malloc(TJBUFSIZE(w, h))) == NULL)
|
size=(yuv==YUVENCODE? TJBUFSIZEYUV(w, h, subsamp):TJBUFSIZE(w, h));
|
||||||
|
if((jpegbuf=(unsigned char *)malloc(size)) == NULL)
|
||||||
{
|
{
|
||||||
puts("ERROR: Could not allocate buffer."); bailout();
|
puts("ERROR: Could not allocate buffer."); bailout();
|
||||||
}
|
}
|
||||||
@@ -542,9 +548,9 @@ void dotest1(void)
|
|||||||
{
|
{
|
||||||
bmpbuf[i2*4]=pixels[i2%9][2];
|
bmpbuf[i2*4]=pixels[i2%9][2];
|
||||||
bmpbuf[i2*4+1]=pixels[i2%9][1];
|
bmpbuf[i2*4+1]=pixels[i2%9][1];
|
||||||
bmpbuf[i2*2+2]=pixels[i2%9][0];
|
bmpbuf[i2*4+2]=pixels[i2%9][0];
|
||||||
}
|
}
|
||||||
_catch(tjCompress(hnd, bmpbuf, i, i*4, j, 4,
|
_catch(tjCompress(hnd, bmpbuf, i, 0, j, 4,
|
||||||
jpgbuf, &size, TJ_444, 100, TJ_BGR));
|
jpgbuf, &size, TJ_444, 100, TJ_BGR));
|
||||||
free(bmpbuf); bmpbuf=NULL; free(jpgbuf); jpgbuf=NULL;
|
free(bmpbuf); bmpbuf=NULL; free(jpgbuf); jpgbuf=NULL;
|
||||||
|
|
||||||
@@ -553,12 +559,12 @@ void dotest1(void)
|
|||||||
{
|
{
|
||||||
printf("Memory allocation failure\n"); bailout();
|
printf("Memory allocation failure\n"); bailout();
|
||||||
}
|
}
|
||||||
for(i2=0; i2<j*i*4; i2++)
|
for(i2=0; i2<j*i; i2++)
|
||||||
{
|
{
|
||||||
if(i2%2==0) bmpbuf[i2]=0xFF;
|
if(i2%2==0) bmpbuf[i2*4]=bmpbuf[i2*4+1]=bmpbuf[i2*4+2]=0xFF;
|
||||||
else bmpbuf[i2]=0;
|
else bmpbuf[i2*4]=bmpbuf[i2*4+1]=bmpbuf[i2*4+2]=0;
|
||||||
}
|
}
|
||||||
_catch(tjCompress(hnd, bmpbuf, j, j*4, i, 4,
|
_catch(tjCompress(hnd, bmpbuf, j, 0, i, 4,
|
||||||
jpgbuf, &size, TJ_444, 100, TJ_BGR));
|
jpgbuf, &size, TJ_444, 100, TJ_BGR));
|
||||||
free(bmpbuf); bmpbuf=NULL; free(jpgbuf); jpgbuf=NULL;
|
free(bmpbuf); bmpbuf=NULL; free(jpgbuf); jpgbuf=NULL;
|
||||||
}
|
}
|
||||||
@@ -593,6 +599,12 @@ int main(int argc, char *argv[])
|
|||||||
yuv=YUVDECODE;
|
yuv=YUVDECODE;
|
||||||
dotest(48, 48, 3, TJ_444, "test");
|
dotest(48, 48, 3, TJ_444, "test");
|
||||||
dotest(35, 39, 3, TJ_444, "test");
|
dotest(35, 39, 3, TJ_444, "test");
|
||||||
|
dotest(48, 48, 3, TJ_422, "test");
|
||||||
|
dotest(39, 41, 3, TJ_422, "test");
|
||||||
|
dotest(48, 48, 3, TJ_420, "test");
|
||||||
|
dotest(41, 35, 3, TJ_420, "test");
|
||||||
|
dotest(48, 48, 3, TJ_GRAYSCALE, "test");
|
||||||
|
dotest(35, 39, 3, TJ_GRAYSCALE, "test");
|
||||||
dotest(48, 48, 1, TJ_GRAYSCALE, "test");
|
dotest(48, 48, 1, TJ_GRAYSCALE, "test");
|
||||||
dotest(39, 41, 1, TJ_GRAYSCALE, "test");
|
dotest(39, 41, 1, TJ_GRAYSCALE, "test");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* Copyright (C)2004 Landmark Graphics Corporation
|
/* Copyright (C)2004 Landmark Graphics Corporation
|
||||||
* Copyright (C)2005, 2006 Sun Microsystems, Inc.
|
* Copyright (C)2005, 2006 Sun Microsystems, Inc.
|
||||||
* Copyright (C)2009-2010 D. R. Commander
|
* Copyright (C)2009-2011 D. R. Commander
|
||||||
*
|
*
|
||||||
* This library is free software and may be redistributed and/or modified under
|
* This library is free software and may be redistributed and/or modified under
|
||||||
* the terms of the wxWindows Library License, Version 3.1 or (at your option)
|
* the terms of the wxWindows Library License, Version 3.1 or (at your option)
|
||||||
@@ -40,11 +40,9 @@ const int _flags[BMPPIXELFORMATS]={0, 0, TJ_BGR, TJ_BGR,
|
|||||||
const int _rindex[BMPPIXELFORMATS]={0, 0, 2, 2, 3, 1};
|
const int _rindex[BMPPIXELFORMATS]={0, 0, 2, 2, 3, 1};
|
||||||
const int _gindex[BMPPIXELFORMATS]={1, 1, 1, 1, 2, 2};
|
const int _gindex[BMPPIXELFORMATS]={1, 1, 1, 1, 2, 2};
|
||||||
const int _bindex[BMPPIXELFORMATS]={2, 2, 0, 0, 1, 3};
|
const int _bindex[BMPPIXELFORMATS]={2, 2, 0, 0, 1, 3};
|
||||||
const char *_pfname[]={"RGB", "RGBA", "BGR", "BGRA", "ABGR", "ARGB"};
|
const char *_pfname[]={"RGB", "RGBX", "BGR", "BGRX", "XBGR", "XRGB"};
|
||||||
const char *_subnamel[NUMSUBOPT]={"4:4:4", "4:2:2", "4:2:0", "GRAY"};
|
const char *_subnamel[NUMSUBOPT]={"4:4:4", "4:2:2", "4:2:0", "GRAY"};
|
||||||
const char *_subnames[NUMSUBOPT]={"444", "422", "420", "GRAY"};
|
const char *_subnames[NUMSUBOPT]={"444", "422", "420", "GRAY"};
|
||||||
const int _hsf[NUMSUBOPT]={1, 2, 2, 1};
|
|
||||||
const int _vsf[NUMSUBOPT]={1, 1, 2, 1};
|
|
||||||
|
|
||||||
void printsigfig(double val, int figs)
|
void printsigfig(double val, int figs)
|
||||||
{
|
{
|
||||||
@@ -64,43 +62,39 @@ void printsigfig(double val, int figs)
|
|||||||
printf(format, val);
|
printf(format, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dotest(unsigned char *srcbuf, int w, int h, BMPPIXELFORMAT pf, int bu,
|
void dotest(unsigned char *srcbuf, int w, int h, int pf, int bu,
|
||||||
int jpegsub, int qual, char *filename, int dotile, int useppm, int quiet)
|
int jpegsub, int qual, char *filename, int dotile, int useppm, int quiet)
|
||||||
{
|
{
|
||||||
char tempstr[1024];
|
char tempstr[1024];
|
||||||
FILE *outfile=NULL; tjhandle hnd;
|
FILE *outfile=NULL; tjhandle hnd=NULL;
|
||||||
unsigned char **jpegbuf=NULL, *rgbbuf=NULL;
|
unsigned char **jpegbuf=NULL, *rgbbuf=NULL;
|
||||||
rrtimer timer; double elapsed;
|
double start, elapsed;
|
||||||
int jpgbufsize=0, i, j, tilesizex, tilesizey, numtilesx, numtilesy, ITER;
|
int jpgbufsize=0, i, j, tilesizex=w, tilesizey=h, numtilesx=1, numtilesy=1,
|
||||||
|
ITER;
|
||||||
unsigned long *comptilesize=NULL;
|
unsigned long *comptilesize=NULL;
|
||||||
int flags=(forcemmx?TJ_FORCEMMX:0)|(forcesse?TJ_FORCESSE:0)
|
int flags=(forcemmx?TJ_FORCEMMX:0)|(forcesse?TJ_FORCESSE:0)
|
||||||
|(forcesse2?TJ_FORCESSE2:0)|(forcesse3?TJ_FORCESSE3:0)
|
|(forcesse2?TJ_FORCESSE2:0)|(forcesse3?TJ_FORCESSE3:0)
|
||||||
|(fastupsample?TJ_FASTUPSAMPLE:0);
|
|(fastupsample?TJ_FASTUPSAMPLE:0);
|
||||||
int ps=_ps[pf];
|
int ps=_ps[pf], tilen;
|
||||||
int pitch=w*ps, yuvsize;
|
int pitch=w*ps, yuvsize=0;
|
||||||
int hsf=_hsf[jpegsub], vsf=_vsf[jpegsub];
|
|
||||||
int pw=PAD(w, hsf), ph=PAD(h, vsf);
|
|
||||||
int cw=pw/hsf, ch=ph/vsf;
|
|
||||||
int ypitch=PAD(pw, 4), uvpitch=PAD(cw, 4);
|
|
||||||
|
|
||||||
flags |= _flags[pf];
|
flags |= _flags[pf];
|
||||||
if(bu) flags |= TJ_BOTTOMUP;
|
if(bu) flags |= TJ_BOTTOMUP;
|
||||||
if(yuv==YUVENCODE) flags |= TJ_YUV;
|
|
||||||
|
|
||||||
yuvsize=ypitch*ph + (jpegsub==TJ_GRAYSCALE? 0:uvpitch*ch*2);
|
if(yuv==YUVENCODE) yuvsize=TJBUFSIZEYUV(w, h, jpegsub);
|
||||||
if((rgbbuf=(unsigned char *)malloc(max(yuvsize, pitch*h))) == NULL)
|
if((rgbbuf=(unsigned char *)malloc(max(yuvsize, pitch*h+1))) == NULL)
|
||||||
_throwunix("allocating image buffer");
|
_throwunix("allocating image buffer");
|
||||||
|
|
||||||
if(!quiet)
|
if(!quiet)
|
||||||
{
|
{
|
||||||
if(yuv==YUVENCODE)
|
if(yuv==YUVENCODE)
|
||||||
printf("\n>>>>> %s (%s) <--> YUV %s <<<<<\n", _pfname[pf],
|
printf(">>>>> %s (%s) <--> YUV %s <<<<<\n", _pfname[pf],
|
||||||
bu?"Bottom-up":"Top-down", _subnamel[jpegsub]);
|
bu?"Bottom-up":"Top-down", _subnamel[jpegsub]);
|
||||||
else
|
else
|
||||||
printf("\n>>>>> %s (%s) <--> JPEG %s Q%d <<<<<\n", _pfname[pf],
|
printf(">>>>> %s (%s) <--> JPEG %s Q%d <<<<<\n", _pfname[pf],
|
||||||
bu?"Bottom-up":"Top-down", _subnamel[jpegsub], qual);
|
bu?"Bottom-up":"Top-down", _subnamel[jpegsub], qual);
|
||||||
}
|
}
|
||||||
if(yuv==YUVDECODE) dotile=0;
|
if(yuv) dotile=0;
|
||||||
if(dotile) {tilesizex=tilesizey=4;} else {tilesizex=w; tilesizey=h;}
|
if(dotile) {tilesizex=tilesizey=4;} else {tilesizex=w; tilesizey=h;}
|
||||||
|
|
||||||
do
|
do
|
||||||
@@ -115,30 +109,46 @@ void dotest(unsigned char *srcbuf, int w, int h, BMPPIXELFORMAT pf, int bu,
|
|||||||
memset(jpegbuf, 0, sizeof(unsigned char *)*numtilesx*numtilesy);
|
memset(jpegbuf, 0, sizeof(unsigned char *)*numtilesx*numtilesy);
|
||||||
for(i=0; i<numtilesx*numtilesy; i++)
|
for(i=0; i<numtilesx*numtilesy; i++)
|
||||||
{
|
{
|
||||||
if((jpegbuf[i]=(unsigned char *)malloc(TJBUFSIZE(tilesizex, tilesizey))) == NULL)
|
if((jpegbuf[i]=(unsigned char *)malloc(
|
||||||
|
yuv==YUVENCODE? TJBUFSIZEYUV(tilesizex, tilesizey, jpegsub)
|
||||||
|
: TJBUFSIZE(tilesizex, tilesizey))) == NULL)
|
||||||
_throwunix("allocating image buffers");
|
_throwunix("allocating image buffers");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compression test
|
// Compression test
|
||||||
if(quiet) printf("%s\t%s\t%s\t%d\t", _pfname[pf], bu?"BU":"TD",
|
if(quiet==1) printf("%s\t%s\t%s\t%d\t", _pfname[pf], bu?"BU":"TD",
|
||||||
_subnamel[jpegsub], qual);
|
_subnamel[jpegsub], qual);
|
||||||
for(i=0; i<h; i++) memcpy(&rgbbuf[pitch*i], &srcbuf[w*ps*i], w*ps);
|
for(i=0; i<h; i++) memcpy(&rgbbuf[pitch*i], &srcbuf[w*ps*i], w*ps);
|
||||||
if((hnd=tjInitCompress())==NULL)
|
if((hnd=tjInitCompress())==NULL)
|
||||||
_throwtj("executing tjInitCompress()");
|
_throwtj("executing tjInitCompress()");
|
||||||
if(tjCompress(hnd, rgbbuf, tilesizex, pitch, tilesizey, ps,
|
if(yuv==YUVENCODE)
|
||||||
|
{
|
||||||
|
if(tjEncodeYUV(hnd, rgbbuf, tilesizex, pitch, tilesizey, ps,
|
||||||
|
jpegbuf[0], jpegsub, flags)==-1)
|
||||||
|
_throwtj("executing tjEncodeYUV()");
|
||||||
|
comptilesize[0]=TJBUFSIZEYUV(tilesizex, tilesizey, jpegsub);
|
||||||
|
}
|
||||||
|
else if(tjCompress(hnd, rgbbuf, tilesizex, pitch, tilesizey, ps,
|
||||||
jpegbuf[0], &comptilesize[0], jpegsub, qual, flags)==-1)
|
jpegbuf[0], &comptilesize[0], jpegsub, qual, flags)==-1)
|
||||||
_throwtj("executing tjCompress()");
|
_throwtj("executing tjCompress()");
|
||||||
ITER=0;
|
ITER=0;
|
||||||
timer.start();
|
start=rrtime();
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
jpgbufsize=0; int tilen=0;
|
jpgbufsize=0; tilen=0;
|
||||||
for(i=0; i<h; i+=tilesizey)
|
for(i=0; i<h; i+=tilesizey)
|
||||||
{
|
{
|
||||||
for(j=0; j<w; j+=tilesizex)
|
for(j=0; j<w; j+=tilesizex)
|
||||||
{
|
{
|
||||||
int tempw=min(tilesizex, w-j), temph=min(tilesizey, h-i);
|
int tempw=min(tilesizex, w-j), temph=min(tilesizey, h-i);
|
||||||
if(tjCompress(hnd, &rgbbuf[pitch*i+j*ps], tempw, pitch,
|
if(yuv==YUVENCODE)
|
||||||
|
{
|
||||||
|
if(tjEncodeYUV(hnd, &rgbbuf[pitch*i+j*ps], tempw, pitch,
|
||||||
|
temph, ps, jpegbuf[tilen], jpegsub, flags)==-1)
|
||||||
|
_throwtj("executing tjEncodeYUV()");
|
||||||
|
comptilesize[tilen]=TJBUFSIZEYUV(tempw, temph, jpegsub);
|
||||||
|
}
|
||||||
|
else if(tjCompress(hnd, &rgbbuf[pitch*i+j*ps], tempw, pitch,
|
||||||
temph, ps, jpegbuf[tilen], &comptilesize[tilen], jpegsub, qual,
|
temph, ps, jpegbuf[tilen], &comptilesize[tilen], jpegsub, qual,
|
||||||
flags)==-1)
|
flags)==-1)
|
||||||
_throwtj("executing tjCompress()");
|
_throwtj("executing tjCompress()");
|
||||||
@@ -147,17 +157,20 @@ void dotest(unsigned char *srcbuf, int w, int h, BMPPIXELFORMAT pf, int bu,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ITER++;
|
ITER++;
|
||||||
} while((elapsed=timer.elapsed())<5.);
|
} while((elapsed=rrtime()-start)<5.);
|
||||||
if(tjDestroy(hnd)==-1) _throwtj("executing tjDestroy()");
|
if(tjDestroy(hnd)==-1) _throwtj("executing tjDestroy()");
|
||||||
hnd=NULL;
|
hnd=NULL;
|
||||||
if(quiet)
|
if(quiet==1)
|
||||||
{
|
{
|
||||||
if(tilesizex==w && tilesizey==h) printf("Full \t");
|
if(tilesizex==w && tilesizey==h) printf("Full \t");
|
||||||
else printf("%-4d %-4d\t", tilesizex, tilesizey);
|
else printf("%-4d %-4d\t", tilesizex, tilesizey);
|
||||||
|
}
|
||||||
|
if(quiet)
|
||||||
|
{
|
||||||
printsigfig((double)(w*h)/1000000.*(double)ITER/elapsed, 4);
|
printsigfig((double)(w*h)/1000000.*(double)ITER/elapsed, 4);
|
||||||
printf("\t");
|
printf("%c", quiet==2? '\n':'\t');
|
||||||
printsigfig((double)(w*h*ps)/(double)jpgbufsize, 4);
|
printsigfig((double)(w*h*ps)/(double)jpgbufsize, 4);
|
||||||
printf("\t");
|
printf("%c", quiet==2? '\n':'\t');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -185,18 +198,25 @@ void dotest(unsigned char *srcbuf, int w, int h, BMPPIXELFORMAT pf, int bu,
|
|||||||
fclose(outfile); outfile=NULL;
|
fclose(outfile); outfile=NULL;
|
||||||
if(!quiet) printf("Reference image written to %s\n", tempstr);
|
if(!quiet) printf("Reference image written to %s\n", tempstr);
|
||||||
}
|
}
|
||||||
if(yuv==YUVENCODE) goto bailout;
|
if(yuv==YUVENCODE)
|
||||||
|
{
|
||||||
|
if(quiet==1) printf("\n"); goto bailout;
|
||||||
|
}
|
||||||
|
|
||||||
// Decompression test
|
// Decompression test
|
||||||
if(yuv==YUVDECODE) flags |= TJ_YUV;
|
|
||||||
memset(rgbbuf, 127, max(yuvsize, pitch*h)); // Grey image means decompressor did nothing
|
memset(rgbbuf, 127, max(yuvsize, pitch*h)); // Grey image means decompressor did nothing
|
||||||
if((hnd=tjInitDecompress())==NULL)
|
if((hnd=tjInitDecompress())==NULL)
|
||||||
_throwtj("executing tjInitDecompress()");
|
_throwtj("executing tjInitDecompress()");
|
||||||
if(tjDecompress(hnd, jpegbuf[0], jpgbufsize, rgbbuf, tilesizex, pitch,
|
if(yuv==YUVDECODE)
|
||||||
|
{
|
||||||
|
if(tjDecompressToYUV(hnd, jpegbuf[0], jpgbufsize, rgbbuf, flags)==-1)
|
||||||
|
_throwtj("executing tjDecompressToYUV()");
|
||||||
|
}
|
||||||
|
else if(tjDecompress(hnd, jpegbuf[0], jpgbufsize, rgbbuf, tilesizex, pitch,
|
||||||
tilesizey, ps, flags)==-1)
|
tilesizey, ps, flags)==-1)
|
||||||
_throwtj("executing tjDecompress()");
|
_throwtj("executing tjDecompress()");
|
||||||
ITER=0;
|
ITER=0;
|
||||||
timer.start();
|
start=rrtime();
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
int tilen=0;
|
int tilen=0;
|
||||||
@@ -205,14 +225,20 @@ void dotest(unsigned char *srcbuf, int w, int h, BMPPIXELFORMAT pf, int bu,
|
|||||||
for(j=0; j<w; j+=tilesizex)
|
for(j=0; j<w; j+=tilesizex)
|
||||||
{
|
{
|
||||||
int tempw=min(tilesizex, w-j), temph=min(tilesizey, h-i);
|
int tempw=min(tilesizex, w-j), temph=min(tilesizey, h-i);
|
||||||
if(tjDecompress(hnd, jpegbuf[tilen], comptilesize[tilen],
|
if(yuv==YUVDECODE)
|
||||||
|
{
|
||||||
|
if(tjDecompressToYUV(hnd, jpegbuf[tilen], comptilesize[tilen],
|
||||||
|
&rgbbuf[pitch*i+ps*j], flags)==-1)
|
||||||
|
_throwtj("executing tjDecompressToYUV()");
|
||||||
|
}
|
||||||
|
else if(tjDecompress(hnd, jpegbuf[tilen], comptilesize[tilen],
|
||||||
&rgbbuf[pitch*i+ps*j], tempw, pitch, temph, ps, flags)==-1)
|
&rgbbuf[pitch*i+ps*j], tempw, pitch, temph, ps, flags)==-1)
|
||||||
_throwtj("executing tjDecompress()");
|
_throwtj("executing tjDecompress()");
|
||||||
tilen++;
|
tilen++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ITER++;
|
ITER++;
|
||||||
} while((elapsed=timer.elapsed())<5.);
|
} while((elapsed=rrtime()-start)<5.);
|
||||||
if(tjDestroy(hnd)==-1) _throwtj("executing tjDestroy()");
|
if(tjDestroy(hnd)==-1) _throwtj("executing tjDestroy()");
|
||||||
hnd=NULL;
|
hnd=NULL;
|
||||||
if(quiet)
|
if(quiet)
|
||||||
@@ -301,13 +327,13 @@ void dotest(unsigned char *srcbuf, int w, int h, BMPPIXELFORMAT pf, int bu,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void dodecomptest(char *filename, BMPPIXELFORMAT pf, int bu, int useppm,
|
void dodecomptest(char *filename, int pf, int bu, int useppm,
|
||||||
int quiet)
|
int quiet)
|
||||||
{
|
{
|
||||||
char tempstr[1024];
|
char tempstr[1024];
|
||||||
FILE *file=NULL; tjhandle hnd;
|
FILE *file=NULL; tjhandle hnd=NULL;
|
||||||
unsigned char *jpegbuf=NULL, *rgbbuf=NULL;
|
unsigned char *jpegbuf=NULL, *rgbbuf=NULL;
|
||||||
rrtimer timer; double elapsed;
|
double start, elapsed;
|
||||||
int w, h, ITER;
|
int w, h, ITER;
|
||||||
unsigned long jpgbufsize=0;
|
unsigned long jpgbufsize=0;
|
||||||
int flags=(forcemmx?TJ_FORCEMMX:0)|(forcesse?TJ_FORCESSE:0)
|
int flags=(forcemmx?TJ_FORCEMMX:0)|(forcesse?TJ_FORCESSE:0)
|
||||||
@@ -315,11 +341,10 @@ void dodecomptest(char *filename, BMPPIXELFORMAT pf, int bu, int useppm,
|
|||||||
|(fastupsample?TJ_FASTUPSAMPLE:0);
|
|(fastupsample?TJ_FASTUPSAMPLE:0);
|
||||||
int ps=_ps[pf], pitch, jpegsub=-1;
|
int ps=_ps[pf], pitch, jpegsub=-1;
|
||||||
char *temp=NULL;
|
char *temp=NULL;
|
||||||
int hsf, vsf, pw, ph, cw, ch, ypitch, uvpitch, yuvsize;
|
int yuvsize, bufsize;
|
||||||
|
|
||||||
flags |= _flags[pf];
|
flags |= _flags[pf];
|
||||||
if(bu) flags |= TJ_BOTTOMUP;
|
if(bu) flags |= TJ_BOTTOMUP;
|
||||||
if(yuv==YUVDECODE) flags |= TJ_YUV;
|
|
||||||
|
|
||||||
if((file=fopen(filename, "rb"))==NULL)
|
if((file=fopen(filename, "rb"))==NULL)
|
||||||
_throwunix("opening file");
|
_throwunix("opening file");
|
||||||
@@ -340,15 +365,11 @@ void dodecomptest(char *filename, BMPPIXELFORMAT pf, int bu, int useppm,
|
|||||||
if(tjDecompressHeader2(hnd, jpegbuf, jpgbufsize, &w, &h, &jpegsub)==-1)
|
if(tjDecompressHeader2(hnd, jpegbuf, jpgbufsize, &w, &h, &jpegsub)==-1)
|
||||||
_throwtj("executing tjDecompressHeader2()");
|
_throwtj("executing tjDecompressHeader2()");
|
||||||
|
|
||||||
hsf=_hsf[jpegsub], vsf=_vsf[jpegsub];
|
yuvsize=TJBUFSIZEYUV(w, h, jpegsub);
|
||||||
pw=PAD(w, hsf), ph=PAD(h, vsf);
|
|
||||||
cw=pw/hsf, ch=ph/vsf;
|
|
||||||
ypitch=PAD(pw, 4), uvpitch=PAD(cw, 4);
|
|
||||||
yuvsize=ypitch*ph + (jpegsub==TJ_GRAYSCALE? 0:uvpitch*ch*2);
|
|
||||||
|
|
||||||
pitch=w*ps;
|
pitch=w*ps;
|
||||||
|
|
||||||
if(quiet)
|
if(quiet==1)
|
||||||
{
|
{
|
||||||
printf("All performance values in Mpixels/sec\n\n");
|
printf("All performance values in Mpixels/sec\n\n");
|
||||||
printf("Bitmap\tBitmap\tImage Size\tDecomp\n"),
|
printf("Bitmap\tBitmap\tImage Size\tDecomp\n"),
|
||||||
@@ -356,31 +377,43 @@ void dodecomptest(char *filename, BMPPIXELFORMAT pf, int bu, int useppm,
|
|||||||
printf("%s\t%s\t%-4d %-4d\t", _pfname[pf], bu?"BU":"TD", w, h);
|
printf("%s\t%s\t%-4d %-4d\t", _pfname[pf], bu?"BU":"TD", w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((rgbbuf=(unsigned char *)malloc(max(yuvsize, pitch*h)))==NULL)
|
bufsize=(yuv==YUVDECODE? yuvsize:pitch*h);
|
||||||
|
if((rgbbuf=(unsigned char *)malloc(bufsize))==NULL)
|
||||||
_throwunix("allocating image buffer");
|
_throwunix("allocating image buffer");
|
||||||
|
|
||||||
if(!quiet)
|
if(!quiet)
|
||||||
{
|
{
|
||||||
if(yuv==YUVDECODE)
|
if(yuv==YUVDECODE)
|
||||||
printf("\n>>>>> JPEG --> YUV %s <<<<<\n", _subnamel[jpegsub]);
|
printf(">>>>> JPEG --> YUV %s <<<<<\n", _subnamel[jpegsub]);
|
||||||
else
|
else
|
||||||
printf("\n>>>>> JPEG --> %s (%s) <<<<<\n", _pfname[pf],
|
printf(">>>>> JPEG --> %s (%s) <<<<<\n", _pfname[pf],
|
||||||
bu?"Bottom-up":"Top-down");
|
bu?"Bottom-up":"Top-down");
|
||||||
printf("\nImage size: %d x %d\n", w, h);
|
printf("\nImage size: %d x %d\n", w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(rgbbuf, 127, max(yuvsize, pitch*h)); // Grey image means decompressor did nothing
|
memset(rgbbuf, 127, bufsize); // Grey image means decompressor did nothing
|
||||||
if(tjDecompress(hnd, jpegbuf, jpgbufsize, rgbbuf, w, pitch, h, ps, flags)==-1)
|
if(yuv==YUVDECODE)
|
||||||
|
{
|
||||||
|
if(tjDecompressToYUV(hnd, jpegbuf, jpgbufsize, rgbbuf, flags)==-1)
|
||||||
|
_throwtj("executing tjDecompressToYUV()");
|
||||||
|
}
|
||||||
|
else if(tjDecompress(hnd, jpegbuf, jpgbufsize, rgbbuf, w, pitch, h, ps,
|
||||||
|
flags)==-1)
|
||||||
_throwtj("executing tjDecompress()");
|
_throwtj("executing tjDecompress()");
|
||||||
ITER=0;
|
ITER=0;
|
||||||
timer.start();
|
start=rrtime();
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if(tjDecompress(hnd, jpegbuf, jpgbufsize, rgbbuf, w, pitch, h, ps, flags)
|
if(yuv==YUVDECODE)
|
||||||
==-1)
|
{
|
||||||
|
if(tjDecompressToYUV(hnd, jpegbuf, jpgbufsize, rgbbuf, flags)==-1)
|
||||||
|
_throwtj("executing tjDecompressToYUV()");
|
||||||
|
}
|
||||||
|
else if(tjDecompress(hnd, jpegbuf, jpgbufsize, rgbbuf, w, pitch, h, ps,
|
||||||
|
flags)==-1)
|
||||||
_throwtj("executing tjDecompress()");
|
_throwtj("executing tjDecompress()");
|
||||||
ITER++;
|
ITER++;
|
||||||
} while((elapsed=timer.elapsed())<5.);
|
} while((elapsed=rrtime()-start)<5.);
|
||||||
if(tjDestroy(hnd)==-1) _throwtj("executing tjDestroy()");
|
if(tjDestroy(hnd)==-1) _throwtj("executing tjDestroy()");
|
||||||
hnd=NULL;
|
hnd=NULL;
|
||||||
if(quiet)
|
if(quiet)
|
||||||
@@ -427,8 +460,8 @@ void usage(char *progname)
|
|||||||
printf(" Test performance of the codec when the image is encoded\n");
|
printf(" Test performance of the codec when the image is encoded\n");
|
||||||
printf(" as separate tiles of varying sizes.\n\n");
|
printf(" as separate tiles of varying sizes.\n\n");
|
||||||
printf(" [-forcemmx] [-forcesse] [-forcesse2] [-forcesse3]\n");
|
printf(" [-forcemmx] [-forcesse] [-forcesse2] [-forcesse3]\n");
|
||||||
printf(" Force MMX, SSE, or SSE2 code paths in Intel codec\n\n");
|
printf(" Force MMX, SSE, SSE2, or SSE3 code paths in the underlying codec\n\n");
|
||||||
printf(" [-rgb | -bgr | -rgba | -bgra | -abgr | -argb]\n");
|
printf(" [-rgb | -bgr | -rgbx | -bgrx | -xbgr | -xrgb]\n");
|
||||||
printf(" Test the specified color conversion path in the codec (default: BGR)\n\n");
|
printf(" Test the specified color conversion path in the codec (default: BGR)\n\n");
|
||||||
printf(" [-fastupsample]\n");
|
printf(" [-fastupsample]\n");
|
||||||
printf(" Use fast, inaccurate upsampling code to perform 4:2:2 and 4:2:0\n");
|
printf(" Use fast, inaccurate upsampling code to perform 4:2:2 and 4:2:0\n");
|
||||||
@@ -448,12 +481,10 @@ void usage(char *progname)
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
unsigned char *bmpbuf=NULL; int w, h, i, useppm=0;
|
unsigned char *bmpbuf=NULL; int w, h, i, useppm=0;
|
||||||
int qual, dotile=0, quiet=0, hiqual=-1; char *temp;
|
int qual=-1, dotile=0, quiet=0, hiqual=-1; char *temp;
|
||||||
BMPPIXELFORMAT pf=BMP_BGR;
|
int pf=BMP_BGR;
|
||||||
int bu=0, minarg=2;
|
int bu=0, minarg=2;
|
||||||
|
|
||||||
printf("\n");
|
|
||||||
|
|
||||||
if(argc<minarg) usage(argv[0]);
|
if(argc<minarg) usage(argv[0]);
|
||||||
|
|
||||||
temp=strrchr(argv[1], '.');
|
temp=strrchr(argv[1], '.');
|
||||||
@@ -463,18 +494,20 @@ int main(int argc, char *argv[])
|
|||||||
if(!stricmp(temp, ".jpg") || !stricmp(temp, ".jpeg")) decomponly=1;
|
if(!stricmp(temp, ".jpg") || !stricmp(temp, ".jpeg")) decomponly=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
if(argc>minarg)
|
if(argc>minarg)
|
||||||
{
|
{
|
||||||
for(i=minarg; i<argc; i++)
|
for(i=minarg; i<argc; i++)
|
||||||
{
|
{
|
||||||
if(!stricmp(argv[i], "-yuvencode"))
|
if(!stricmp(argv[i], "-yuvencode"))
|
||||||
{
|
{
|
||||||
printf("Testing YUV planar encoding\n");
|
printf("Testing YUV planar encoding\n\n");
|
||||||
yuv=YUVENCODE; hiqual=qual=100;
|
yuv=YUVENCODE; hiqual=qual=100;
|
||||||
}
|
}
|
||||||
if(!stricmp(argv[i], "-yuvdecode"))
|
if(!stricmp(argv[i], "-yuvdecode"))
|
||||||
{
|
{
|
||||||
printf("Testing YUV planar decoding\n");
|
printf("Testing YUV planar decoding\n\n");
|
||||||
yuv=YUVDECODE;
|
yuv=YUVDECODE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -502,37 +535,38 @@ int main(int argc, char *argv[])
|
|||||||
if(!stricmp(argv[i], "-tile")) dotile=1;
|
if(!stricmp(argv[i], "-tile")) dotile=1;
|
||||||
if(!stricmp(argv[i], "-forcesse3"))
|
if(!stricmp(argv[i], "-forcesse3"))
|
||||||
{
|
{
|
||||||
printf("Using SSE3 code\n");
|
printf("Using SSE3 code\n\n");
|
||||||
forcesse3=1;
|
forcesse3=1;
|
||||||
}
|
}
|
||||||
if(!stricmp(argv[i], "-forcesse2"))
|
if(!stricmp(argv[i], "-forcesse2"))
|
||||||
{
|
{
|
||||||
printf("Using SSE2 code\n");
|
printf("Using SSE2 code\n\n");
|
||||||
forcesse2=1;
|
forcesse2=1;
|
||||||
}
|
}
|
||||||
if(!stricmp(argv[i], "-forcesse"))
|
if(!stricmp(argv[i], "-forcesse"))
|
||||||
{
|
{
|
||||||
printf("Using SSE code\n");
|
printf("Using SSE code\n\n");
|
||||||
forcesse=1;
|
forcesse=1;
|
||||||
}
|
}
|
||||||
if(!stricmp(argv[i], "-forcemmx"))
|
if(!stricmp(argv[i], "-forcemmx"))
|
||||||
{
|
{
|
||||||
printf("Using MMX code\n");
|
printf("Using MMX code\n\n");
|
||||||
forcemmx=1;
|
forcemmx=1;
|
||||||
}
|
}
|
||||||
if(!stricmp(argv[i], "-fastupsample"))
|
if(!stricmp(argv[i], "-fastupsample"))
|
||||||
{
|
{
|
||||||
printf("Using fast upsampling code\n");
|
printf("Using fast upsampling code\n\n");
|
||||||
fastupsample=1;
|
fastupsample=1;
|
||||||
}
|
}
|
||||||
if(!stricmp(argv[i], "-rgb")) pf=BMP_RGB;
|
if(!stricmp(argv[i], "-rgb")) pf=BMP_RGB;
|
||||||
if(!stricmp(argv[i], "-rgba")) pf=BMP_RGBA;
|
if(!stricmp(argv[i], "-rgbx")) pf=BMP_RGBX;
|
||||||
if(!stricmp(argv[i], "-bgr")) pf=BMP_BGR;
|
if(!stricmp(argv[i], "-bgr")) pf=BMP_BGR;
|
||||||
if(!stricmp(argv[i], "-bgra")) pf=BMP_BGRA;
|
if(!stricmp(argv[i], "-bgrx")) pf=BMP_BGRX;
|
||||||
if(!stricmp(argv[i], "-abgr")) pf=BMP_ABGR;
|
if(!stricmp(argv[i], "-xbgr")) pf=BMP_XBGR;
|
||||||
if(!stricmp(argv[i], "-argb")) pf=BMP_ARGB;
|
if(!stricmp(argv[i], "-xrgb")) pf=BMP_XRGB;
|
||||||
if(!stricmp(argv[i], "-bottomup")) bu=1;
|
if(!stricmp(argv[i], "-bottomup")) bu=1;
|
||||||
if(!stricmp(argv[i], "-quiet")) quiet=1;
|
if(!stricmp(argv[i], "-quiet")) quiet=1;
|
||||||
|
if(!stricmp(argv[i], "-qq")) quiet=2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -544,7 +578,7 @@ int main(int argc, char *argv[])
|
|||||||
if(temp!=NULL) *temp='\0';
|
if(temp!=NULL) *temp='\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if(quiet && !decomponly)
|
if(quiet==1 && !decomponly)
|
||||||
{
|
{
|
||||||
printf("All performance values in Mpixels/sec\n\n");
|
printf("All performance values in Mpixels/sec\n\n");
|
||||||
printf("Bitmap\tBitmap\tJPEG\tJPEG\tTile Size\tCompr\tCompr\tDecomp\n");
|
printf("Bitmap\tBitmap\tJPEG\tJPEG\tTile Size\tCompr\tCompr\tDecomp\n");
|
||||||
@@ -554,19 +588,21 @@ int main(int argc, char *argv[])
|
|||||||
if(decomponly)
|
if(decomponly)
|
||||||
{
|
{
|
||||||
dodecomptest(argv[1], pf, bu, 1, quiet);
|
dodecomptest(argv[1], pf, bu, 1, quiet);
|
||||||
|
printf("\n");
|
||||||
goto bailout;
|
goto bailout;
|
||||||
}
|
}
|
||||||
for(i=hiqual; i>=qual; i--)
|
for(i=hiqual; i>=qual; i--)
|
||||||
dotest(bmpbuf, w, h, pf, bu, TJ_GRAYSCALE, i, argv[1], dotile, useppm, quiet);
|
dotest(bmpbuf, w, h, pf, bu, TJ_GRAYSCALE, i, argv[1], dotile, useppm, quiet);
|
||||||
if(quiet) printf("\n");
|
printf("\n");
|
||||||
for(i=hiqual; i>=qual; i--)
|
for(i=hiqual; i>=qual; i--)
|
||||||
dotest(bmpbuf, w, h, pf, bu, TJ_420, i, argv[1], dotile, useppm, quiet);
|
dotest(bmpbuf, w, h, pf, bu, TJ_420, i, argv[1], dotile, useppm, quiet);
|
||||||
if(quiet) printf("\n");
|
printf("\n");
|
||||||
for(i=hiqual; i>=qual; i--)
|
for(i=hiqual; i>=qual; i--)
|
||||||
dotest(bmpbuf, w, h, pf, bu, TJ_422, i, argv[1], dotile, useppm, quiet);
|
dotest(bmpbuf, w, h, pf, bu, TJ_422, i, argv[1], dotile, useppm, quiet);
|
||||||
if(quiet) printf("\n");
|
printf("\n");
|
||||||
for(i=hiqual; i>=qual; i--)
|
for(i=hiqual; i>=qual; i--)
|
||||||
dotest(bmpbuf, w, h, pf, bu, TJ_444, i, argv[1], dotile, useppm, quiet);
|
dotest(bmpbuf, w, h, pf, bu, TJ_444, i, argv[1], dotile, useppm, quiet);
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
bailout:
|
bailout:
|
||||||
if(bmpbuf) free(bmpbuf);
|
if(bmpbuf) free(bmpbuf);
|
||||||
1
jsimd.h
1
jsimd.h
@@ -5,6 +5,7 @@
|
|||||||
*
|
*
|
||||||
* Based on the x86 SIMD extension for IJG JPEG library,
|
* Based on the x86 SIMD extension for IJG JPEG library,
|
||||||
* Copyright (C) 1999-2006, MIYASAKA Masaru.
|
* Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||||
|
* For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Based on the x86 SIMD extension for IJG JPEG library,
|
* Based on the x86 SIMD extension for IJG JPEG library,
|
||||||
* Copyright (C) 1999-2006, MIYASAKA Masaru.
|
* Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||||
|
* For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||||
*
|
*
|
||||||
* This file contains stubs for when there is no SIMD support available.
|
* This file contains stubs for when there is no SIMD support available.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
*
|
*
|
||||||
* Based on the x86 SIMD extension for IJG JPEG library,
|
* Based on the x86 SIMD extension for IJG JPEG library,
|
||||||
* Copyright (C) 1999-2006, MIYASAKA Masaru.
|
* Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||||
|
* For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
4
jutils.c
4
jutils.c
@@ -77,8 +77,8 @@ jdiv_round_up (long a, long b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GLOBAL(size_t)
|
GLOBAL(long)
|
||||||
jround_up (size_t a, size_t b)
|
jround_up (long a, long b)
|
||||||
/* Compute a rounded up to next multiple of b, ie, ceil(a/b)*b */
|
/* Compute a rounded up to next multiple of b, ie, ceil(a/b)*b */
|
||||||
/* Assumes a >= 0, b > 0 */
|
/* Assumes a >= 0, b > 0 */
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,4 +34,4 @@
|
|||||||
"Copyright (C) 2004 Landmark Graphics Corporation\n" \
|
"Copyright (C) 2004 Landmark Graphics Corporation\n" \
|
||||||
"Copyright (C) 2005-2007 Sun Microsystems, Inc.\n" \
|
"Copyright (C) 2005-2007 Sun Microsystems, Inc.\n" \
|
||||||
"Copyright (C) 2009 Pierre Ossman for Cendio AB\n" \
|
"Copyright (C) 2009 Pierre Ossman for Cendio AB\n" \
|
||||||
"Copyright (C) 2009-2010 D. R. Commander"
|
"Copyright (C) 2009-2011 D. R. Commander"
|
||||||
|
|||||||
12
rdbmp.c
12
rdbmp.c
@@ -3,6 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||||
* Modified 2009-2010 by Guido Vollbeding.
|
* Modified 2009-2010 by Guido Vollbeding.
|
||||||
|
* Modified 2011 by Siarhei Siamashka.
|
||||||
* This file is part of the Independent JPEG Group's software.
|
* 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 file.
|
||||||
*
|
*
|
||||||
@@ -220,10 +221,9 @@ preload_image (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
|
|||||||
{
|
{
|
||||||
bmp_source_ptr source = (bmp_source_ptr) sinfo;
|
bmp_source_ptr source = (bmp_source_ptr) sinfo;
|
||||||
register FILE *infile = source->pub.input_file;
|
register FILE *infile = source->pub.input_file;
|
||||||
register int c;
|
|
||||||
register JSAMPROW out_ptr;
|
register JSAMPROW out_ptr;
|
||||||
JSAMPARRAY image_ptr;
|
JSAMPARRAY image_ptr;
|
||||||
JDIMENSION row, col;
|
JDIMENSION row;
|
||||||
cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress;
|
cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress;
|
||||||
|
|
||||||
/* Read the data into a virtual array in input-file row order. */
|
/* Read the data into a virtual array in input-file row order. */
|
||||||
@@ -237,11 +237,11 @@ preload_image (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
|
|||||||
((j_common_ptr) cinfo, source->whole_image,
|
((j_common_ptr) cinfo, source->whole_image,
|
||||||
row, (JDIMENSION) 1, TRUE);
|
row, (JDIMENSION) 1, TRUE);
|
||||||
out_ptr = image_ptr[0];
|
out_ptr = image_ptr[0];
|
||||||
for (col = source->row_width; col > 0; col--) {
|
if (fread(out_ptr, 1, source->row_width, infile) != source->row_width) {
|
||||||
/* inline copy of read_byte() for speed */
|
if (feof(infile))
|
||||||
if ((c = getc(infile)) == EOF)
|
|
||||||
ERREXIT(cinfo, JERR_INPUT_EOF);
|
ERREXIT(cinfo, JERR_INPUT_EOF);
|
||||||
*out_ptr++ = (JSAMPLE) c;
|
else
|
||||||
|
ERREXIT(cinfo, JERR_FILE_READ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (progress != NULL)
|
if (progress != NULL)
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
<key>IFPkgDescriptionDescription</key>
|
<key>IFPkgDescriptionDescription</key>
|
||||||
<string>A SIMD-accelerated JPEG codec which provides both the libjpeg and TurboJPEG APIs</string>
|
<string>A SIMD-accelerated JPEG codec which provides both the libjpeg and TurboJPEG APIs</string>
|
||||||
<key>IFPkgDescriptionTitle</key>
|
<key>IFPkgDescriptionTitle</key>
|
||||||
<string>{__APPNAME}</string>
|
<string>@PACKAGE_NAME@</string>
|
||||||
<key>IFPkgDescriptionVersion</key>
|
<key>IFPkgDescriptionVersion</key>
|
||||||
<string>{__VERSION}</string>
|
<string>@VERSION@</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
@@ -3,15 +3,15 @@
|
|||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleGetInfoString</key>
|
<key>CFBundleGetInfoString</key>
|
||||||
<string>{__VERSION}, The libjpeg-turbo Project</string>
|
<string>@VERSION@, The libjpeg-turbo Project</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>com.libjpeg-turbo.libjpeg-turbo</string>
|
<string>com.libjpeg-turbo.libjpeg-turbo</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>{__VERSION}</string>
|
<string>@VERSION@</string>
|
||||||
<key>IFMajorVersion</key>
|
<key>IFMajorVersion</key>
|
||||||
<integer>1</integer>
|
<integer>1</integer>
|
||||||
<key>IFMinorVersion</key>
|
<key>IFMinorVersion</key>
|
||||||
<integer>{__BUILD}</integer>
|
<integer>@BUILD@</integer>
|
||||||
<key>IFPkgFlagAllowBackRev</key>
|
<key>IFPkgFlagAllowBackRev</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>IFPkgFlagAuthorizationAction</key>
|
<key>IFPkgFlagAuthorizationAction</key>
|
||||||
@@ -1,11 +1,13 @@
|
|||||||
{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf250
|
{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350
|
||||||
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
|
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
|
||||||
{\colortbl;\red255\green255\blue255;}
|
{\colortbl;\red255\green255\blue255;}
|
||||||
\margl1440\margr1440\vieww15200\viewh9600\viewkind0
|
\margl1440\margr1440\vieww15200\viewh9600\viewkind0
|
||||||
\deftab720
|
\deftab720
|
||||||
\pard\pardeftab720\ql\qnatural
|
\pard\pardeftab720\ql\qnatural
|
||||||
|
|
||||||
\f0\fs24 \cf0 libjpeg-turbo is a high-speed version of libjpeg for x86 and x86-64 processors which uses SIMD instructions (MMX, SSE2, etc.) to accelerate baseline JPEG compression and decompression. libjpeg-turbo is generally 2-4x as fast as the unmodified version of libjpeg, all else being equal. libjpeg-turbo also includes a wrapper library for the TurboJPEG API used by VirtualGL and TurboVNC.\
|
\f0\fs24 \cf0 libjpeg-turbo is a derivative of libjpeg which uses SIMD instructions (MMX, SSE2, etc.) to accelerate baseline JPEG compression and decompression on x86 and x86-64 systems. On such systems, libjpeg-turbo is generally 2-4x as fast as the unmodified version of libjpeg, all else being equal. libjpeg-turbo also includes a wrapper library which implements the TurboJPEG API used by VirtualGL and TurboVNC.\
|
||||||
\
|
\
|
||||||
libjpeg-turbo was originally based on libjpeg/SIMD by Miyasaka Masaru, but the TigerVNC and VirtualGL projects made numerous enhancements to the codec, including improved support for Mac OS X, 64-bit support, support for 32-bit and big endian pixel formats, accelerated Huffman encoding/decoding, and various bug fixes. The goal was to produce a fully open source codec that could replace the partially closed source TurboJPEG/IPP codec used by VirtualGL and TurboVNC. libjpeg-turbo generally performs in the range of 80-120% of TurboJPEG/IPP. It is faster in some areas but slower in others.\
|
libjpeg-turbo was originally based on libjpeg/SIMD by Miyasaka Masaru, but the TigerVNC and VirtualGL projects made numerous enhancements to the codec in 2009, including improved support for Mac OS X, 64-bit support, support for 32-bit and big endian pixel formats (RGBX, XBGR, etc.), accelerated Huffman encoding/decoding, and various bug fixes. The goal was to produce a fully open source codec that could replace the partially closed source TurboJPEG/IPP codec used by VirtualGL and TurboVNC. libjpeg-turbo generally performs in the range of 80-120% of TurboJPEG/IPP. It is faster in some areas but slower in others.\
|
||||||
|
\
|
||||||
|
In early 2010, libjpeg-turbo spun off into its own independent project, with the goal of making high-speed JPEG compression/decompression technology available to a broader range of users and developers.\
|
||||||
}
|
}
|
||||||
28
release/deb-control.in
Normal file
28
release/deb-control.in
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
Package: @PACKAGE_NAME@
|
||||||
|
Version: @VERSION@-@BUILD@
|
||||||
|
Section: misc
|
||||||
|
Priority: optional
|
||||||
|
Architecture: @DEBARCH@
|
||||||
|
Essential: no
|
||||||
|
Maintainer: The libjpeg-turbo Project [http://www.libjpeg-turbo.org]
|
||||||
|
Description: A SIMD-accelerated JPEG codec which provides both the libjpeg and TurboJPEG APIs
|
||||||
|
libjpeg-turbo is a derivative of libjpeg which uses SIMD instructions (MMX,
|
||||||
|
SSE2, etc.) to accelerate baseline JPEG compression and decompression on x86
|
||||||
|
and x86-64 systems. On such systems, libjpeg-turbo is generally 2-4x as fast
|
||||||
|
as the unmodified version of libjpeg, all else being equal. libjpeg-turbo
|
||||||
|
also includes a wrapper library which implements the TurboJPEG API used by
|
||||||
|
VirtualGL and TurboVNC.
|
||||||
|
.
|
||||||
|
libjpeg-turbo was originally based on libjpeg/SIMD by Miyasaka Masaru, but
|
||||||
|
the TigerVNC and VirtualGL projects made numerous enhancements to the codec
|
||||||
|
in 2009, including improved support for Mac OS X, 64-bit support, support
|
||||||
|
for 32-bit and big endian pixel formats (RGBX, XBGR, etc.), accelerated
|
||||||
|
Huffman encoding/decoding, and various bug fixes. The goal was to produce a
|
||||||
|
fully open source codec that could replace the partially closed source
|
||||||
|
TurboJPEG/IPP codec used by VirtualGL and TurboVNC. libjpeg-turbo generally
|
||||||
|
performs in the range of 80-120% of TurboJPEG/IPP. It is faster in some
|
||||||
|
areas but slower in others.
|
||||||
|
.
|
||||||
|
In early 2010, libjpeg-turbo spun off into its own independent project, with
|
||||||
|
the goal of making high-speed JPEG compression/decompression technology
|
||||||
|
available to a broader range of users and developers.
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
Package: {__PKGNAME}
|
|
||||||
Version: {__VERSION}-{__BUILD}
|
|
||||||
Section: misc
|
|
||||||
Priority: optional
|
|
||||||
Architecture: {__ARCH}
|
|
||||||
Essential: no
|
|
||||||
Maintainer: The libjpeg-turbo Project [http://libjpeg-turbo.VirtualGL.org]
|
|
||||||
Description: A toolkit for displaying OpenGL applications to thin clients
|
|
||||||
libjpeg-turbo is a high-speed version of libjpeg for x86 and x86-64 processors
|
|
||||||
which uses SIMD instructions (MMX, SSE2, etc.) to accelerate baseline JPEG
|
|
||||||
compression and decompression. libjpeg-turbo is generally 2-4x as fast
|
|
||||||
as the unmodified version of libjpeg, all else being equal. libjpeg-turbo
|
|
||||||
also includes a wrapper library for the TurboJPEG API used by VirtualGL and
|
|
||||||
TurboVNC.
|
|
||||||
.
|
|
||||||
libjpeg-turbo was originally based on libjpeg/SIMD by Miyasaka Masaru, but
|
|
||||||
the TigerVNC and VirtualGL projects made numerous enhancements to the codec,
|
|
||||||
including improved support for Mac OS X, 64-bit support, support for 32-bit
|
|
||||||
and big endian pixel formats, accelerated Huffman encoding/decoding, and
|
|
||||||
various bug fixes. The goal was to produce a fully open source codec that
|
|
||||||
could replace the partially closed source TurboJPEG/IPP codec used by
|
|
||||||
VirtualGL and TurboVNC. libjpeg-turbo generally performs in the range of
|
|
||||||
80-120% of TurboJPEG/IPP. It is faster in some areas but slower in others.
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
!include x64.nsh
|
!include x64.nsh
|
||||||
Name "@CMAKE_PROJECT_NAME@ SDK for @INST_PLATFORM@"
|
Name "@CMAKE_PROJECT_NAME@ SDK for @INST_PLATFORM@"
|
||||||
OutFile "@CMAKE_BINARY_DIR@\${BUILDDIR}@INST_NAME@.exe"
|
OutFile "@CMAKE_BINARY_DIR@\${BUILDDIR}@INST_NAME@.exe"
|
||||||
InstallDir c:\@INST_NAME@
|
InstallDir c:\@INST_DIR@
|
||||||
|
|
||||||
SetCompressor bzip2
|
SetCompressor bzip2
|
||||||
|
|
||||||
@@ -45,6 +45,12 @@ Section "@CMAKE_PROJECT_NAME@ SDK for @INST_PLATFORM@ (required)"
|
|||||||
!else
|
!else
|
||||||
File "@CMAKE_BINARY_DIR@\sharedlib\${BUILDDIR}jpeg@DLL_VERSION@.dll"
|
File "@CMAKE_BINARY_DIR@\sharedlib\${BUILDDIR}jpeg@DLL_VERSION@.dll"
|
||||||
!endif
|
!endif
|
||||||
|
File "@CMAKE_BINARY_DIR@\sharedlib\${BUILDDIR}cjpeg.exe"
|
||||||
|
File "@CMAKE_BINARY_DIR@\sharedlib\${BUILDDIR}djpeg.exe"
|
||||||
|
File "@CMAKE_BINARY_DIR@\sharedlib\${BUILDDIR}jpegtran.exe"
|
||||||
|
File "@CMAKE_BINARY_DIR@\${BUILDDIR}jpgtest.exe"
|
||||||
|
File "@CMAKE_BINARY_DIR@\${BUILDDIR}rdjpgcom.exe"
|
||||||
|
File "@CMAKE_BINARY_DIR@\${BUILDDIR}wrjpgcom.exe"
|
||||||
SetOutPath $INSTDIR\lib
|
SetOutPath $INSTDIR\lib
|
||||||
!ifdef GCC
|
!ifdef GCC
|
||||||
File "@CMAKE_BINARY_DIR@\libturbojpeg.dll.a"
|
File "@CMAKE_BINARY_DIR@\libturbojpeg.dll.a"
|
||||||
@@ -63,19 +69,20 @@ Section "@CMAKE_PROJECT_NAME@ SDK for @INST_PLATFORM@ (required)"
|
|||||||
File "@CMAKE_SOURCE_DIR@\jmorecfg.h"
|
File "@CMAKE_SOURCE_DIR@\jmorecfg.h"
|
||||||
File "@CMAKE_SOURCE_DIR@\jpeglib.h"
|
File "@CMAKE_SOURCE_DIR@\jpeglib.h"
|
||||||
File "@CMAKE_SOURCE_DIR@\turbojpeg.h"
|
File "@CMAKE_SOURCE_DIR@\turbojpeg.h"
|
||||||
SetOutPath $INSTDIR
|
SetOutPath $INSTDIR\doc
|
||||||
File "@CMAKE_SOURCE_DIR@\README"
|
File "@CMAKE_SOURCE_DIR@\README"
|
||||||
File "@CMAKE_SOURCE_DIR@\README-turbo.txt"
|
File "@CMAKE_SOURCE_DIR@\README-turbo.txt"
|
||||||
File "@CMAKE_SOURCE_DIR@\libjpeg.txt"
|
File "@CMAKE_SOURCE_DIR@\libjpeg.txt"
|
||||||
File "@CMAKE_SOURCE_DIR@\LGPL.txt"
|
File "@CMAKE_SOURCE_DIR@\LGPL.txt"
|
||||||
File "@CMAKE_SOURCE_DIR@\LICENSE.txt"
|
File "@CMAKE_SOURCE_DIR@\LICENSE.txt"
|
||||||
|
File "@CMAKE_SOURCE_DIR@\usage.txt"
|
||||||
|
|
||||||
WriteRegStr HKLM "SOFTWARE\@INST_NAME@ @VERSION@" "Install_Dir" "$INSTDIR"
|
WriteRegStr HKLM "SOFTWARE\@INST_DIR@ @VERSION@" "Install_Dir" "$INSTDIR"
|
||||||
|
|
||||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_NAME@ @VERSION@" "DisplayName" "@CMAKE_PROJECT_NAME@ SDK v@VERSION@ for @INST_PLATFORM@"
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_DIR@ @VERSION@" "DisplayName" "@CMAKE_PROJECT_NAME@ SDK v@VERSION@ for @INST_PLATFORM@"
|
||||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_NAME@ @VERSION@" "UninstallString" '"$INSTDIR\uninstall_@VERSION@.exe"'
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_DIR@ @VERSION@" "UninstallString" '"$INSTDIR\uninstall_@VERSION@.exe"'
|
||||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_NAME@ @VERSION@" "NoModify" 1
|
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_DIR@ @VERSION@" "NoModify" 1
|
||||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_NAME@ @VERSION@" "NoRepair" 1
|
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_DIR@ @VERSION@" "NoRepair" 1
|
||||||
WriteUninstaller "uninstall_@VERSION@.exe"
|
WriteUninstaller "uninstall_@VERSION@.exe"
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
@@ -88,8 +95,8 @@ Section "Uninstall"
|
|||||||
|
|
||||||
SetShellVarContext all
|
SetShellVarContext all
|
||||||
|
|
||||||
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_NAME@ @VERSION@"
|
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_DIR@ @VERSION@"
|
||||||
DeleteRegKey HKLM "SOFTWARE\@INST_NAME@ @VERSION@"
|
DeleteRegKey HKLM "SOFTWARE\@INST_DIR@ @VERSION@"
|
||||||
|
|
||||||
!ifdef GCC
|
!ifdef GCC
|
||||||
Delete $INSTDIR\bin\libjpeg-@DLL_VERSION@.dll
|
Delete $INSTDIR\bin\libjpeg-@DLL_VERSION@.dll
|
||||||
@@ -106,20 +113,28 @@ Section "Uninstall"
|
|||||||
Delete $INSTDIR\lib\turbojpeg.lib
|
Delete $INSTDIR\lib\turbojpeg.lib
|
||||||
Delete $INSTDIR\lib\turbojpeg-static.lib
|
Delete $INSTDIR\lib\turbojpeg-static.lib
|
||||||
!endif
|
!endif
|
||||||
|
Delete $INSTDIR\bin\cjpeg.exe
|
||||||
|
Delete $INSTDIR\bin\djpeg.exe
|
||||||
|
Delete $INSTDIR\bin\jpegtran.exe
|
||||||
|
Delete $INSTDIR\bin\jpgtest.exe
|
||||||
|
Delete $INSTDIR\bin\rdjpgcom.exe
|
||||||
|
Delete $INSTDIR\bin\wrjpgcom.exe
|
||||||
Delete $INSTDIR\include\jconfig.h"
|
Delete $INSTDIR\include\jconfig.h"
|
||||||
Delete $INSTDIR\include\jerror.h"
|
Delete $INSTDIR\include\jerror.h"
|
||||||
Delete $INSTDIR\include\jmorecfg.h"
|
Delete $INSTDIR\include\jmorecfg.h"
|
||||||
Delete $INSTDIR\include\jpeglib.h"
|
Delete $INSTDIR\include\jpeglib.h"
|
||||||
Delete $INSTDIR\include\turbojpeg.h"
|
Delete $INSTDIR\include\turbojpeg.h"
|
||||||
Delete $INSTDIR\uninstall_@VERSION@.exe
|
Delete $INSTDIR\uninstall_@VERSION@.exe
|
||||||
Delete $INSTDIR\README
|
Delete $INSTDIR\doc\README
|
||||||
Delete $INSTDIR\README-turbo.txt
|
Delete $INSTDIR\doc\README-turbo.txt
|
||||||
Delete $INSTDIR\libjpeg.txt
|
Delete $INSTDIR\doc\libjpeg.txt
|
||||||
Delete $INSTDIR\LGPL.txt
|
Delete $INSTDIR\doc\LGPL.txt
|
||||||
Delete $INSTDIR\LICENSE.txt
|
Delete $INSTDIR\doc\LICENSE.txt
|
||||||
|
Delete $INSTDIR\doc\usage.txt
|
||||||
|
|
||||||
RMDir "$INSTDIR\include"
|
RMDir "$INSTDIR\include"
|
||||||
RMDir "$INSTDIR\lib"
|
RMDir "$INSTDIR\lib"
|
||||||
|
RMDir "$INSTDIR\doc"
|
||||||
RMDir "$INSTDIR\bin"
|
RMDir "$INSTDIR\bin"
|
||||||
RMDir "$INSTDIR"
|
RMDir "$INSTDIR"
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ Summary: A SIMD-accelerated JPEG codec which provides both the libjpeg and Turbo
|
|||||||
Name: @PACKAGE_NAME@
|
Name: @PACKAGE_NAME@
|
||||||
Version: @VERSION@
|
Version: @VERSION@
|
||||||
Vendor: The libjpeg-turbo Project
|
Vendor: The libjpeg-turbo Project
|
||||||
URL: http://libjpeg-turbo.virtualgl.org
|
URL: http://www.libjpeg-turbo.org
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
#-->Source0: http://prdownloads.sourceforge.net/libjpeg-turbo/libjpeg-turbo-%{version}.tar.gz
|
#-->Source0: http://prdownloads.sourceforge.net/libjpeg-turbo/libjpeg-turbo-%{version}.tar.gz
|
||||||
Release: @BUILD@
|
Release: @BUILD@
|
||||||
@@ -19,27 +19,31 @@ Provides: %{name} = %{version}-%{release}, turbojpeg = 2.00
|
|||||||
Obsoletes: turbojpeg
|
Obsoletes: turbojpeg
|
||||||
|
|
||||||
%description
|
%description
|
||||||
libjpeg-turbo is a high-speed version of libjpeg for x86 and x86-64 processors
|
libjpeg-turbo is a derivative of libjpeg which uses SIMD instructions (MMX,
|
||||||
which uses SIMD instructions (MMX, SSE2, etc.) to accelerate baseline JPEG
|
SSE2, etc.) to accelerate baseline JPEG compression and decompression on x86
|
||||||
compression and decompression. libjpeg-turbo is generally 2-4x as fast
|
and x86-64 systems. On such systems, libjpeg-turbo is generally 2-4x as fast
|
||||||
as the unmodified version of libjpeg, all else being equal. libjpeg-turbo also
|
as the unmodified version of libjpeg, all else being equal. libjpeg-turbo also
|
||||||
includes a wrapper library for the TurboJPEG API used by VirtualGL and
|
includes a wrapper library which implements the TurboJPEG API used by VirtualGL
|
||||||
TurboVNC.
|
and TurboVNC.
|
||||||
|
|
||||||
libjpeg-turbo was originally based on libjpeg/SIMD by Miyasaka Masaru, but
|
libjpeg-turbo was originally based on libjpeg/SIMD by Miyasaka Masaru, but
|
||||||
the TigerVNC and VirtualGL projects made numerous enhancements to the codec,
|
the TigerVNC and VirtualGL projects made numerous enhancements to the codec in
|
||||||
including improved support for Mac OS X, 64-bit support, support for 32-bit
|
2009, including improved support for Mac OS X, 64-bit support, support for
|
||||||
and big endian pixel formats, accelerated Huffman encoding/decoding, and
|
32-bit and big endian pixel formats (RGBX, XBGR, etc.), accelerated Huffman
|
||||||
various bug fixes. The goal was to produce a fully open source codec that
|
encoding/decoding, and various bug fixes. The goal was to produce a fully open
|
||||||
could replace the partially closed source TurboJPEG/IPP codec used by VirtualGL
|
source codec that could replace the partially closed source TurboJPEG/IPP codec
|
||||||
and TurboVNC. libjpeg-turbo generally performs in the range of 80-120% of
|
used by VirtualGL and TurboVNC. libjpeg-turbo generally performs in the range
|
||||||
TurboJPEG/IPP. It is faster in some areas but slower in others.
|
of 80-120% of TurboJPEG/IPP. It is faster in some areas but slower in others.
|
||||||
|
|
||||||
|
In early 2010, libjpeg-turbo spun off into its own independent project, with
|
||||||
|
the goal of making high-speed JPEG compression/decompression technology
|
||||||
|
available to a broader range of users and developers.
|
||||||
|
|
||||||
#-->%prep
|
#-->%prep
|
||||||
#-->%setup -q
|
#-->%setup -q
|
||||||
|
|
||||||
#-->%build
|
#-->%build
|
||||||
#-->configure libdir=/opt/%{name}/%{__lib} mandir=/opt/%{name}/man JPEG_LIB_VERSION=@JPEG_LIB_VERSION@ SO_MAJOR_VERSION=@SO_MAJOR_VERSION@ SO_MINOR_VERSION=@SO_MINOR_VERSION@ --with-pic
|
#-->./configure libdir=/opt/%{name}/%{__lib} mandir=/opt/%{name}/man JPEG_LIB_VERSION=@JPEG_LIB_VERSION@ SO_MAJOR_VERSION=@SO_MAJOR_VERSION@ SO_MINOR_VERSION=@SO_MINOR_VERSION@ --with-pic
|
||||||
#-->make DESTDIR=$RPM_BUILD_ROOT libdir=/opt/%{name}/%{__lib} mandir=/opt/%{name}/man
|
#-->make DESTDIR=$RPM_BUILD_ROOT libdir=/opt/%{name}/%{__lib} mandir=/opt/%{name}/man
|
||||||
|
|
||||||
%install
|
%install
|
||||||
@@ -71,6 +75,7 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
/opt/%{name}/bin/cjpeg
|
/opt/%{name}/bin/cjpeg
|
||||||
/opt/%{name}/bin/djpeg
|
/opt/%{name}/bin/djpeg
|
||||||
/opt/%{name}/bin/jpegtran
|
/opt/%{name}/bin/jpegtran
|
||||||
|
/opt/%{name}/bin/jpgtest
|
||||||
/opt/%{name}/bin/rdjpgcom
|
/opt/%{name}/bin/rdjpgcom
|
||||||
/opt/%{name}/bin/wrjpgcom
|
/opt/%{name}/bin/wrjpgcom
|
||||||
%dir /opt/%{name}/%{__lib}
|
%dir /opt/%{name}/%{__lib}
|
||||||
|
|||||||
@@ -15,16 +15,9 @@ onexit()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
usage()
|
PACKAGE_NAME=@PACKAGE_NAME@
|
||||||
{
|
VERSION=@VERSION@
|
||||||
echo "$0 <package name> <version> <source dir.>"
|
SRCDIR=@abs_top_srcdir@
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ $# -lt 3 ]; then usage $0; fi
|
|
||||||
PACKAGE_NAME=$1
|
|
||||||
VERSION=$2
|
|
||||||
SRCDIR=$3
|
|
||||||
|
|
||||||
umask 022
|
umask 022
|
||||||
rm -f $PACKAGE_NAME-$VERSION-cygwin.tar.bz2
|
rm -f $PACKAGE_NAME-$VERSION-cygwin.tar.bz2
|
||||||
@@ -15,12 +15,6 @@ onexit()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
usage()
|
|
||||||
{
|
|
||||||
echo "$0 <package name> <version> <build> <DEB architecture> <source dir.>"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
makedeb()
|
makedeb()
|
||||||
{
|
{
|
||||||
SUPPLEMENT=$1
|
SUPPLEMENT=$1
|
||||||
@@ -35,12 +29,10 @@ makedeb()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
umask 022
|
umask 022
|
||||||
rm -f $PACKAGE_NAME\_$DEBARCH.deb
|
rm -f $PACKAGE_NAME\_$VERSION\_$DEBARCH.deb
|
||||||
TMPDIR=`mktemp -d /tmp/$PACKAGE_NAME-build.XXXXXX`
|
TMPDIR=`mktemp -d /tmp/$PACKAGE_NAME-build.XXXXXX`
|
||||||
mkdir $TMPDIR/DEBIAN
|
mkdir $TMPDIR/DEBIAN
|
||||||
(cat $SRCDIR/release/deb-control.tmpl | sed s/{__PKGNAME}/$PACKAGE_NAME/g \
|
cp pkgscripts/deb-control $TMPDIR/DEBIAN/control
|
||||||
| sed s/{__VERSION}/$VERSION/g | sed s/{__BUILD}/$BUILD/g \
|
|
||||||
| sed s/{__ARCH}/$DEBARCH/g > $TMPDIR/DEBIAN/control)
|
|
||||||
|
|
||||||
make install prefix=$TMPDIR/opt/$DIRNAME libdir=$TMPDIR/opt/$DIRNAME/$__LIB mandir=$TMPDIR/opt/$DIRNAME/man
|
make install prefix=$TMPDIR/opt/$DIRNAME libdir=$TMPDIR/opt/$DIRNAME/$__LIB mandir=$TMPDIR/opt/$DIRNAME/man
|
||||||
rm -f $TMPDIR/opt/$DIRNAME/$__LIB/*.la
|
rm -f $TMPDIR/opt/$DIRNAME/$__LIB/*.la
|
||||||
@@ -78,15 +70,14 @@ makedeb()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
sudo chown -Rh root:root $TMPDIR/*
|
sudo chown -Rh root:root $TMPDIR/*
|
||||||
dpkg -b $TMPDIR $PACKAGE_NAME\_$DEBARCH.deb
|
dpkg -b $TMPDIR $PACKAGE_NAME\_$VERSION\_$DEBARCH.deb
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ $# -lt 5 ]; then usage $0; fi
|
PACKAGE_NAME=@PACKAGE_NAME@
|
||||||
PACKAGE_NAME=$1
|
VERSION=@VERSION@
|
||||||
VERSION=$2
|
BUILD=@BUILD@
|
||||||
BUILD=$3
|
DEBARCH=@DEBARCH@
|
||||||
DEBARCH=$4
|
SRCDIR=@abs_top_srcdir@
|
||||||
SRCDIR=$5
|
|
||||||
|
|
||||||
makedeb 0
|
makedeb 0
|
||||||
if [ "$DEBARCH" = "i386" ]; then makedeb 1; fi
|
if [ "$DEBARCH" = "i386" ]; then makedeb 1; fi
|
||||||
@@ -26,8 +26,8 @@ UNIVERSAL=0
|
|||||||
PACKAGE_NAME=@PACKAGE_NAME@
|
PACKAGE_NAME=@PACKAGE_NAME@
|
||||||
VERSION=@VERSION@
|
VERSION=@VERSION@
|
||||||
BUILD=@BUILD@
|
BUILD=@BUILD@
|
||||||
SRCDIR=@srcdir@
|
SRCDIR=@abs_top_srcdir@
|
||||||
BUILDDIR32=@srcdir@/osxx86
|
BUILDDIR32=@abs_top_srcdir@/osxx86
|
||||||
if [ $# -gt 0 ]; then
|
if [ $# -gt 0 ]; then
|
||||||
if [ "$1" = "universal" ]; then
|
if [ "$1" = "universal" ]; then
|
||||||
UNIVERSAL=1
|
UNIVERSAL=1
|
||||||
@@ -36,8 +36,8 @@ if [ $# -gt 0 ]; then
|
|||||||
fi
|
fi
|
||||||
PACKAGEMAKER=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
|
PACKAGEMAKER=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
|
||||||
|
|
||||||
if [ -f $PACKAGE_NAME.dmg ]; then
|
if [ -f $PACKAGE_NAME-$VERSION.dmg ]; then
|
||||||
rm -f $PACKAGE_NAME.dmg
|
rm -f $PACKAGE_NAME-$VERSION.dmg
|
||||||
fi
|
fi
|
||||||
|
|
||||||
umask 022
|
umask 022
|
||||||
@@ -102,6 +102,10 @@ if [ $UNIVERSAL = 1 ]; then
|
|||||||
-arch i386 $TMPDIR/dist.x86/opt/$PACKAGE_NAME/bin/jpegtran \
|
-arch i386 $TMPDIR/dist.x86/opt/$PACKAGE_NAME/bin/jpegtran \
|
||||||
-arch x86_64 $PKGROOT/opt/$PACKAGE_NAME/bin/jpegtran \
|
-arch x86_64 $PKGROOT/opt/$PACKAGE_NAME/bin/jpegtran \
|
||||||
-output $PKGROOT/opt/$PACKAGE_NAME/bin/jpegtran
|
-output $PKGROOT/opt/$PACKAGE_NAME/bin/jpegtran
|
||||||
|
lipo -create \
|
||||||
|
-arch i386 $TMPDIR/dist.x86/opt/$PACKAGE_NAME/bin/jpgtest \
|
||||||
|
-arch x86_64 $PKGROOT/opt/$PACKAGE_NAME/bin/jpgtest \
|
||||||
|
-output $PKGROOT/opt/$PACKAGE_NAME/bin/jpgtest
|
||||||
lipo -create \
|
lipo -create \
|
||||||
-arch i386 $TMPDIR/dist.x86/opt/$PACKAGE_NAME/bin/rdjpgcom \
|
-arch i386 $TMPDIR/dist.x86/opt/$PACKAGE_NAME/bin/rdjpgcom \
|
||||||
-arch x86_64 $PKGROOT/opt/$PACKAGE_NAME/bin/rdjpgcom \
|
-arch x86_64 $PKGROOT/opt/$PACKAGE_NAME/bin/rdjpgcom \
|
||||||
@@ -130,15 +134,9 @@ chmod 1775 $PKGROOT/Library
|
|||||||
chmod 775 $PKGROOT/Library/Documentation
|
chmod 775 $PKGROOT/Library/Documentation
|
||||||
mkdir -p $TMPDIR/pkg/Resources
|
mkdir -p $TMPDIR/pkg/Resources
|
||||||
|
|
||||||
(cat $SRCDIR/release/Description.plist.tmpl | sed s/{__VERSION}/$VERSION/g \
|
cp pkgscripts/Description.plist $TMPDIR/pkg/
|
||||||
| sed s/{__APPNAME}/$PACKAGE_NAME/g \
|
cp pkgscripts/Info.plist $TMPDIR/pkg/
|
||||||
> $TMPDIR/pkg/Description.plist)
|
install -m 755 pkgscripts/uninstall $PKGROOT/opt/$PACKAGE_NAME/bin/
|
||||||
(cat $SRCDIR/release/Info.plist.tmpl | sed s/{__VERSION}/$VERSION/g \
|
|
||||||
| sed s/{__BUILD}/$BUILD/g > $TMPDIR/pkg/Info.plist)
|
|
||||||
(cat $SRCDIR/release/uninstall.sh.tmpl \
|
|
||||||
| sed s/{__APPNAME}/$PACKAGE_NAME/g \
|
|
||||||
> $PKGROOT/opt/$PACKAGE_NAME/bin/uninstall)
|
|
||||||
chmod 755 $PKGROOT/opt/$PACKAGE_NAME/bin/uninstall
|
|
||||||
|
|
||||||
install -m 644 $SRCDIR/LICENSE.txt $PKGROOT/Library/Documentation/$PACKAGE_NAME/LICENSE.txt
|
install -m 644 $SRCDIR/LICENSE.txt $PKGROOT/Library/Documentation/$PACKAGE_NAME/LICENSE.txt
|
||||||
install -m 644 $SRCDIR/LGPL.txt $PKGROOT/Library/Documentation/$PACKAGE_NAME/LGPL.txt
|
install -m 644 $SRCDIR/LGPL.txt $PKGROOT/Library/Documentation/$PACKAGE_NAME/LGPL.txt
|
||||||
@@ -159,8 +157,7 @@ install -m 644 $SRCDIR/release/uninstall.applescript $TMPDIR
|
|||||||
sudo osacompile -t APPL -o "$TMPDIR/dmg/Uninstall $PACKAGE_NAME.app" $TMPDIR/uninstall.applescript
|
sudo osacompile -t APPL -o "$TMPDIR/dmg/Uninstall $PACKAGE_NAME.app" $TMPDIR/uninstall.applescript
|
||||||
sudo chown -R $USER "$TMPDIR/dmg/Uninstall $PACKAGE_NAME.app"
|
sudo chown -R $USER "$TMPDIR/dmg/Uninstall $PACKAGE_NAME.app"
|
||||||
hdiutil create -fs HFS+ -volname $PACKAGE_NAME-$VERSION \
|
hdiutil create -fs HFS+ -volname $PACKAGE_NAME-$VERSION \
|
||||||
-srcfolder "$TMPDIR/dmg" \
|
-srcfolder "$TMPDIR/dmg" $TMPDIR/$PACKAGE_NAME-$VERSION.dmg
|
||||||
$TMPDIR/$PACKAGE_NAME.dmg
|
cp $TMPDIR/$PACKAGE_NAME-$VERSION.dmg .
|
||||||
cp $TMPDIR/$PACKAGE_NAME.dmg .
|
|
||||||
|
|
||||||
exit
|
exit
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ PACKAGE_NAME=@PACKAGE_NAME@
|
|||||||
VERSION=@VERSION@
|
VERSION=@VERSION@
|
||||||
BUILD=@BUILD@
|
BUILD=@BUILD@
|
||||||
PKGARCH=@DEBARCH@
|
PKGARCH=@DEBARCH@
|
||||||
SRCDIR=@srcdir@
|
SRCDIR=@abs_top_srcdir@
|
||||||
BUILDDIR32=@srcdir@/solx86
|
BUILDDIR32=@abs_top_srcdir@/solx86
|
||||||
if [ $# -gt 0 ]; then
|
if [ $# -gt 0 ]; then
|
||||||
if [ "$1" = "combined" ]; then
|
if [ "$1" = "combined" ]; then
|
||||||
COMBINED=1
|
COMBINED=1
|
||||||
@@ -41,9 +41,7 @@ TMPDIR=`mktemp -d /tmp/$PACKAGE_NAME-build.XXXXXX`
|
|||||||
rm -f $PACKAGE_NAME.pkg.bz2
|
rm -f $PACKAGE_NAME.pkg.bz2
|
||||||
cp $SRCDIR/release/copyright $TMPDIR
|
cp $SRCDIR/release/copyright $TMPDIR
|
||||||
touch $TMPDIR/depend
|
touch $TMPDIR/depend
|
||||||
cat $SRCDIR/release/pkginfo.tmpl | sed s/{__VERSION}/$VERSION/g \
|
cp pkgscripts/pkginfo $TMPDIR/pkginfo
|
||||||
| sed s/{__BUILD}/$BUILD/g | sed s/{__APPNAME}/$PACKAGE_NAME/g \
|
|
||||||
| sed s/{__PKGNAME}/$PACKAGE_NAME/g > $TMPDIR/pkginfo
|
|
||||||
|
|
||||||
if [ "$PKGARCH" = "i386" ]; then
|
if [ "$PKGARCH" = "i386" ]; then
|
||||||
__LIB=lib
|
__LIB=lib
|
||||||
@@ -81,6 +79,7 @@ d none $PACKAGE_NAME/bin 0755 root bin
|
|||||||
f none $PACKAGE_NAME/bin/cjpeg 0755 root bin
|
f none $PACKAGE_NAME/bin/cjpeg 0755 root bin
|
||||||
f none $PACKAGE_NAME/bin/djpeg 0755 root bin
|
f none $PACKAGE_NAME/bin/djpeg 0755 root bin
|
||||||
f none $PACKAGE_NAME/bin/jpegtran 0755 root bin
|
f none $PACKAGE_NAME/bin/jpegtran 0755 root bin
|
||||||
|
f none $PACKAGE_NAME/bin/jpgtest 0755 root bin
|
||||||
f none $PACKAGE_NAME/bin/rdjpgcom 0755 root bin
|
f none $PACKAGE_NAME/bin/rdjpgcom 0755 root bin
|
||||||
f none $PACKAGE_NAME/bin/wrjpgcom 0755 root bin
|
f none $PACKAGE_NAME/bin/wrjpgcom 0755 root bin
|
||||||
d none $PACKAGE_NAME/lib 0755 root bin
|
d none $PACKAGE_NAME/lib 0755 root bin
|
||||||
@@ -131,8 +130,8 @@ f none $PACKAGE_NAME/doc/usage.txt 0644 root bin
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
pkgmk -o -r $TMPDIR/opt -d $TMPDIR -a i386 -f $TMPDIR/proto
|
pkgmk -o -r $TMPDIR/opt -d $TMPDIR -a i386 -f $TMPDIR/proto
|
||||||
pkgtrans -s $TMPDIR $TMPDIR/$PACKAGE_NAME.pkg $PACKAGE_NAME
|
pkgtrans -s $TMPDIR $TMPDIR/$PACKAGE_NAME-$VERSION.pkg $PACKAGE_NAME
|
||||||
bzip2 $TMPDIR/$PACKAGE_NAME.pkg
|
bzip2 $TMPDIR/$PACKAGE_NAME-$VERSION.pkg
|
||||||
cp $TMPDIR/$PACKAGE_NAME.pkg.bz2 .
|
cp $TMPDIR/$PACKAGE_NAME-$VERSION.pkg.bz2 .
|
||||||
|
|
||||||
exit
|
exit
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
ARCH=i386
|
ARCH=i386
|
||||||
PKG={__PKGNAME}
|
PKG=@PACKAGE_NAME@
|
||||||
NAME={__APPNAME} SDK and run time libraries
|
NAME=@PACKAGE_NAME@ SDK and run time libraries
|
||||||
VERSION={__VERSION},REV={__BUILD}
|
VERSION=@VERSION@,REV=@BUILD@
|
||||||
SUNW_PKGVERS=1.0
|
SUNW_PKGVERS=1.0
|
||||||
DESC=A SIMD-accelerated JPEG codec which provides both the libjpeg and TurboJPEG APIs
|
DESC=A SIMD-accelerated JPEG codec which provides both the libjpeg and TurboJPEG APIs
|
||||||
VENDOR=The libjpeg-turbo Project
|
VENDOR=The libjpeg-turbo Project
|
||||||
HOTLINE=http://libjpeg-turbo.VirtualGL.org
|
HOTLINE=http://www.libjpeg-turbo.org
|
||||||
EMAIL=information@virtualgl.org
|
EMAIL=information@libjpeg-turbo.org
|
||||||
MAXINST=1
|
MAXINST=1
|
||||||
CATEGORY=application
|
CATEGORY=application
|
||||||
BASEDIR=/opt
|
BASEDIR=/opt
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (C)2009-2010 D. R. Commander
|
# Copyright (C)2009-2011 D. R. Commander
|
||||||
# Copyright (C)2009 Sun Microsystems, Inc.
|
# Copyright (C)2009 Sun Microsystems, Inc.
|
||||||
#
|
#
|
||||||
# This library is free software and may be redistributed and/or modified under
|
# This library is free software and may be redistributed and/or modified under
|
||||||
@@ -23,7 +23,7 @@ if [ ! "`id -u`" = "0" ]; then
|
|||||||
error "This command must be run as root"
|
error "This command must be run as root"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PKGNAME={__APPNAME}
|
PKGNAME=@PACKAGE_NAME@
|
||||||
MACPKGNAME=com.$PKGNAME.$PKGNAME
|
MACPKGNAME=com.$PKGNAME.$PKGNAME
|
||||||
RCPT=/Library/Receipts/$PKGNAME.pkg
|
RCPT=/Library/Receipts/$PKGNAME.pkg
|
||||||
|
|
||||||
64
rrtimer.h
64
rrtimer.h
@@ -15,69 +15,6 @@
|
|||||||
#ifndef __RRTIMER_H__
|
#ifndef __RRTIMER_H__
|
||||||
#define __RRTIMER_H__
|
#define __RRTIMER_H__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#include <windows.h>
|
|
||||||
#else
|
|
||||||
#include <sys/time.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class rrtimer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
rrtimer(void) : t1(0.0)
|
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
|
||||||
highres=false; tick=0.001;
|
|
||||||
LARGE_INTEGER Frequency;
|
|
||||||
if(QueryPerformanceFrequency(&Frequency)!=0)
|
|
||||||
{
|
|
||||||
tick=(double)1.0/(double)(Frequency.QuadPart);
|
|
||||||
highres=true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void start(void)
|
|
||||||
{
|
|
||||||
t1=time();
|
|
||||||
}
|
|
||||||
|
|
||||||
double time(void)
|
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
|
||||||
if(highres)
|
|
||||||
{
|
|
||||||
LARGE_INTEGER Time;
|
|
||||||
QueryPerformanceCounter(&Time);
|
|
||||||
return((double)(Time.QuadPart)*tick);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return((double)GetTickCount()*tick);
|
|
||||||
#else
|
|
||||||
struct timeval __tv;
|
|
||||||
gettimeofday(&__tv, (struct timezone *)NULL);
|
|
||||||
return((double)(__tv.tv_sec)+(double)(__tv.tv_usec)*0.000001);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
double elapsed(void)
|
|
||||||
{
|
|
||||||
return time()-t1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
bool highres; double tick;
|
|
||||||
#endif
|
|
||||||
double t1;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // __cplusplus
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@@ -111,4 +48,3 @@ static __inline double rrtime(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,7 @@
|
|||||||
if(MSVC)
|
if(MSVC)
|
||||||
# Build all configurations against shared C library
|
# Build all configurations against shared C library
|
||||||
foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
||||||
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
|
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
|
||||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
|
||||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
|
||||||
if(${var} MATCHES "/MT")
|
if(${var} MATCHES "/MT")
|
||||||
string(REGEX REPLACE "/MT" "/MD" ${var} "${${var}}")
|
string(REGEX REPLACE "/MT" "/MD" ${var} "${${var}}")
|
||||||
endif()
|
endif()
|
||||||
@@ -42,13 +40,13 @@ endif()
|
|||||||
add_executable(cjpeg ../cjpeg.c ../cdjpeg.c ../rdbmp.c ../rdgif.c ../rdppm.c
|
add_executable(cjpeg ../cjpeg.c ../cdjpeg.c ../rdbmp.c ../rdgif.c ../rdppm.c
|
||||||
../rdswitch.c ../rdtarga.c)
|
../rdswitch.c ../rdtarga.c)
|
||||||
set_property(TARGET cjpeg PROPERTY COMPILE_FLAGS
|
set_property(TARGET cjpeg PROPERTY COMPILE_FLAGS
|
||||||
"-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED")
|
"-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE")
|
||||||
target_link_libraries(cjpeg jpeg)
|
target_link_libraries(cjpeg jpeg)
|
||||||
|
|
||||||
add_executable(djpeg ../djpeg.c ../cdjpeg.c ../rdcolmap.c ../rdswitch.c
|
add_executable(djpeg ../djpeg.c ../cdjpeg.c ../rdcolmap.c ../rdswitch.c
|
||||||
../wrbmp.c ../wrgif.c ../wrppm.c ../wrtarga.c)
|
../wrbmp.c ../wrgif.c ../wrppm.c ../wrtarga.c)
|
||||||
set_property(TARGET djpeg PROPERTY COMPILE_FLAGS
|
set_property(TARGET djpeg PROPERTY COMPILE_FLAGS
|
||||||
"-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED")
|
"-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE")
|
||||||
target_link_libraries(djpeg jpeg)
|
target_link_libraries(djpeg jpeg)
|
||||||
|
|
||||||
add_executable(jpegtran ../jpegtran.c ../cdjpeg.c ../rdswitch.c ../transupp.c)
|
add_executable(jpegtran ../jpegtran.c ../cdjpeg.c ../rdswitch.c ../transupp.c)
|
||||||
|
|||||||
@@ -10,10 +10,6 @@ else()
|
|||||||
-I${CMAKE_CURRENT_SOURCE_DIR}/)
|
-I${CMAKE_CURRENT_SOURCE_DIR}/)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
|
||||||
set(NAFLAGS ${NAFLAGS} -DMSVC)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# This only works if building from the command line. There is currently no way
|
# This only works if building from the command line. There is currently no way
|
||||||
# to set a variable's value based on the build type when using the MSVC IDE.
|
# to set a variable's value based on the build type when using the MSVC IDE.
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug"
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug"
|
||||||
@@ -36,7 +32,7 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MSVC_IDE)
|
if(MSVC_IDE)
|
||||||
set(OBJDIR "${CMAKE_CURRENT_BINARY_DIR}/$(OutDir)")
|
set(OBJDIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}")
|
||||||
else()
|
else()
|
||||||
set(OBJDIR ${CMAKE_CURRENT_BINARY_DIR})
|
set(OBJDIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
*
|
*
|
||||||
* Based on the x86 SIMD extension for IJG JPEG library,
|
* Based on the x86 SIMD extension for IJG JPEG library,
|
||||||
* Copyright (C) 1999-2006, MIYASAKA Masaru.
|
* Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||||
|
* For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Based on the x86 SIMD extension for IJG JPEG library,
|
* Based on the x86 SIMD extension for IJG JPEG library,
|
||||||
* Copyright (C) 1999-2006, MIYASAKA Masaru.
|
* Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||||
|
* For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||||
*
|
*
|
||||||
* This file contains the interface between the "normal" portions
|
* This file contains the interface between the "normal" portions
|
||||||
* of the library and the SIMD implementations when running on a
|
* of the library and the SIMD implementations when running on a
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Based on the x86 SIMD extension for IJG JPEG library,
|
* Based on the x86 SIMD extension for IJG JPEG library,
|
||||||
* Copyright (C) 1999-2006, MIYASAKA Masaru.
|
* Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||||
|
* For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||||
*
|
*
|
||||||
* This file contains the interface between the "normal" portions
|
* This file contains the interface between the "normal" portions
|
||||||
* of the library and the SIMD implementations when running on a
|
* of the library and the SIMD implementations when running on a
|
||||||
|
|||||||
@@ -48,9 +48,7 @@
|
|||||||
;
|
;
|
||||||
%define SEG_TEXT .text align=16 public use64 class=CODE
|
%define SEG_TEXT .text align=16 public use64 class=CODE
|
||||||
%define SEG_CONST .rdata align=16 public use64 class=CONST
|
%define SEG_CONST .rdata align=16 public use64 class=CONST
|
||||||
%ifdef MSVC
|
|
||||||
%define EXTN(name) name ; foo() -> foo
|
%define EXTN(name) name ; foo() -> foo
|
||||||
%endif
|
|
||||||
|
|
||||||
%elifdef OBJ32 ; ----(nasm -fobj -DOBJ32 ...)----------
|
%elifdef OBJ32 ; ----(nasm -fobj -DOBJ32 ...)----------
|
||||||
; * Borland C++ (Win32)
|
; * Borland C++ (Win32)
|
||||||
|
|||||||
BIN
testimgfst100.jpg
Normal file
BIN
testimgfst100.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
@@ -1,3 +1,4 @@
|
|||||||
|
TURBOJPEG_1.0
|
||||||
{
|
{
|
||||||
global:
|
global:
|
||||||
tjInitCompress;
|
tjInitCompress;
|
||||||
@@ -5,10 +6,18 @@
|
|||||||
TJBUFSIZE;
|
TJBUFSIZE;
|
||||||
tjInitDecompress;
|
tjInitDecompress;
|
||||||
tjDecompressHeader;
|
tjDecompressHeader;
|
||||||
tjDecompressHeader2;
|
|
||||||
tjDecompress;
|
tjDecompress;
|
||||||
tjDestroy;
|
tjDestroy;
|
||||||
tjGetErrorStr;
|
tjGetErrorStr;
|
||||||
local:
|
local:
|
||||||
*;
|
*;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TURBOJPEG_1.1
|
||||||
|
{
|
||||||
|
global:
|
||||||
|
TJBUFSIZEYUV;
|
||||||
|
tjDecompressHeader2;
|
||||||
|
tjDecompressToYUV;
|
||||||
|
tjEncodeYUV;
|
||||||
|
} TURBOJPEG_1.0;
|
||||||
|
|||||||
192
turbojpeg.h
192
turbojpeg.h
@@ -1,6 +1,6 @@
|
|||||||
/* Copyright (C)2004 Landmark Graphics Corporation
|
/* Copyright (C)2004 Landmark Graphics Corporation
|
||||||
* Copyright (C)2005, 2006 Sun Microsystems, Inc.
|
* Copyright (C)2005, 2006 Sun Microsystems, Inc.
|
||||||
* Copyright (C)2009 D. R. Commander
|
* Copyright (C)2009-2011 D. R. Commander
|
||||||
*
|
*
|
||||||
* This library is free software and may be redistributed and/or modified under
|
* This library is free software and may be redistributed and/or modified under
|
||||||
* the terms of the wxWindows Library License, Version 3.1 or (at your option)
|
* the terms of the wxWindows Library License, Version 3.1 or (at your option)
|
||||||
@@ -52,28 +52,9 @@ enum {TJ_444=0, TJ_422, TJ_420, TJ_GRAYSCALE};
|
|||||||
(64-bit IPP version only) */
|
(64-bit IPP version only) */
|
||||||
#define TJ_FASTUPSAMPLE 256
|
#define TJ_FASTUPSAMPLE 256
|
||||||
/* Use fast, inaccurate 4:2:2 and 4:2:0 YUV upsampling routines
|
/* Use fast, inaccurate 4:2:2 and 4:2:0 YUV upsampling routines
|
||||||
(libjpeg version only) */
|
(libjpeg and libjpeg-turbo versions only) */
|
||||||
#define TJ_YUV 512
|
#define TJ_YUV 512
|
||||||
/* If passed to tjCompress(), this causes TurboJPEG/OSS to use the
|
/* Nothing to see here. Pay no attention to the man behind the curtain. */
|
||||||
accelerated color conversion routines in libjpeg-turbo to produce a planar
|
|
||||||
YUV image that is suitable for X Video. Specifically, if the chrominance
|
|
||||||
components are subsampled along the horizontal dimension, then the width
|
|
||||||
of the luminance plane is padded to 2 in the output image (same goes for
|
|
||||||
the height of the luminance plane, if the chrominance components are
|
|
||||||
subsampled along the vertical dimension.) Also, each line of each plane
|
|
||||||
in the output image is padded to 4 bytes. Although this will work with
|
|
||||||
any subsampling option, it is really only useful in combination with
|
|
||||||
TJ_420, which produces an image compatible with the I420 (AKA "YUV420P")
|
|
||||||
format.
|
|
||||||
|
|
||||||
If passed to tjDecompress(), this tells TurboJPEG/OSS to perform JPEG
|
|
||||||
decompression but to leave out the color conversion step, so a planar YUV
|
|
||||||
image is generated instead of an RGB image. The padding of the planes in
|
|
||||||
this image is the same as in the above case. Note that, if the width or
|
|
||||||
height of the output image is not a multiple of 8 (or a multiple of 16
|
|
||||||
along any dimension in which chrominance subsampling is used), then an
|
|
||||||
intermediate buffer copy will be performed within TurboJPEG/OSS.
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef void* tjhandle;
|
typedef void* tjhandle;
|
||||||
|
|
||||||
@@ -96,7 +77,8 @@ extern "C" {
|
|||||||
and returns a handle to the instance. Most applications will only
|
and returns a handle to the instance. Most applications will only
|
||||||
need to call this once at the beginning of the program or once for each
|
need to call this once at the beginning of the program or once for each
|
||||||
concurrent thread. Don't try to create a new instance every time you
|
concurrent thread. Don't try to create a new instance every time you
|
||||||
compress an image, because this will cause performance to suffer.
|
compress an image, because this may cause performance to suffer in some
|
||||||
|
TurboJPEG implementations.
|
||||||
|
|
||||||
RETURNS: NULL on error
|
RETURNS: NULL on error
|
||||||
*/
|
*/
|
||||||
@@ -111,39 +93,40 @@ DLLEXPORT tjhandle DLLCALL tjInitCompress(void);
|
|||||||
|
|
||||||
[INPUT] j = instance handle previously returned from a call to
|
[INPUT] j = instance handle previously returned from a call to
|
||||||
tjInitCompress()
|
tjInitCompress()
|
||||||
[INPUT] srcbuf = pointer to user-allocated image buffer containing pixels in
|
[INPUT] srcbuf = pointer to user-allocated image buffer containing RGB or
|
||||||
RGB(A) or BGR(A) form
|
grayscale pixels to be compressed
|
||||||
[INPUT] width = width (in pixels) of the source image
|
[INPUT] width = width (in pixels) of the source image
|
||||||
[INPUT] pitch = bytes per line of the source image (width*pixelsize if the
|
[INPUT] pitch = bytes per line of the source image (width*pixelsize if the
|
||||||
bitmap is unpadded, else TJPAD(width*pixelsize) if each line of the bitmap
|
bitmap is unpadded, else TJPAD(width*pixelsize) if each line of the bitmap
|
||||||
is padded to the nearest 32-bit boundary, such as is the case for Windows
|
is padded to the nearest 32-bit boundary, such as is the case for Windows
|
||||||
bitmaps. You can also be clever and use this parameter to skip lines, etc.,
|
bitmaps. You can also be clever and use this parameter to skip lines,
|
||||||
as long as the pitch is greater than 0.)
|
etc. Setting this parameter to 0 is the equivalent of setting it to
|
||||||
|
width*pixelsize.
|
||||||
[INPUT] height = height (in pixels) of the source image
|
[INPUT] height = height (in pixels) of the source image
|
||||||
[INPUT] pixelsize = size (in bytes) of each pixel in the source image
|
[INPUT] pixelsize = size (in bytes) of each pixel in the source image
|
||||||
RGBA and BGRA: 4, RGB and BGR: 3, Grayscale: 1
|
RGBX/BGRX/XRGB/XBGR: 4, RGB/BGR: 3, Grayscale: 1
|
||||||
[INPUT] dstbuf = pointer to user-allocated image buffer which will receive
|
[INPUT] dstbuf = pointer to user-allocated image buffer which will receive
|
||||||
the JPEG image. Use the macro TJBUFSIZE(width, height) to determine
|
the JPEG image. Use the TJBUFSIZE(width, height) function to determine
|
||||||
the appropriate size for this buffer based on the image width and height.
|
the appropriate size for this buffer based on the image width and height.
|
||||||
[OUTPUT] size = pointer to unsigned long which receives the size (in bytes)
|
[OUTPUT] size = pointer to unsigned long which receives the size (in bytes)
|
||||||
of the compressed image
|
of the compressed image
|
||||||
[INPUT] jpegsubsamp = Specifies either 4:2:0, 4:2:2, or 4:4:4 subsampling.
|
[INPUT] jpegsubsamp = Specifies either 4:2:0, 4:2:2, 4:4:4, or grayscale
|
||||||
When the image is converted from the RGB to YCbCr colorspace as part of the
|
subsampling. When the image is converted from the RGB to YCbCr colorspace
|
||||||
JPEG compression process, every other Cb and Cr (chrominance) pixel can be
|
as part of the JPEG compression process, every other Cb and Cr
|
||||||
discarded to produce a smaller image with little perceptible loss of
|
(chrominance) pixel can be discarded to produce a smaller image with
|
||||||
image clarity (the human eye is more sensitive to small changes in
|
little perceptible loss of image clarity (the human eye is more sensitive
|
||||||
brightness than small changes in color.)
|
to small changes in brightness than small changes in color.)
|
||||||
|
|
||||||
TJ_420: 4:2:0 subsampling. Discards every other Cb, Cr pixel in both
|
TJ_420: 4:2:0 subsampling. Discards every other Cb, Cr pixel in both
|
||||||
horizontal and vertical directions.
|
horizontal and vertical directions
|
||||||
TJ_422: 4:2:2 subsampling. Discards every other Cb, Cr pixel only in
|
TJ_422: 4:2:2 subsampling. Discards every other Cb, Cr pixel only in
|
||||||
the horizontal direction.
|
the horizontal direction
|
||||||
TJ_444: no subsampling.
|
TJ_444: no subsampling
|
||||||
TJ_GRAYSCALE: Generate grayscale JPEG image
|
TJ_GRAYSCALE: Generate grayscale JPEG image
|
||||||
|
|
||||||
[INPUT] jpegqual = JPEG quality (an integer between 0 and 100 inclusive.)
|
[INPUT] jpegqual = JPEG quality (an integer between 0 and 100 inclusive)
|
||||||
[INPUT] flags = the bitwise OR of one or more of the flags described in the
|
[INPUT] flags = the bitwise OR of one or more of the flags described in the
|
||||||
"Flags" section above.
|
"Flags" section above
|
||||||
|
|
||||||
RETURNS: 0 on success, -1 on error
|
RETURNS: 0 on success, -1 on error
|
||||||
*/
|
*/
|
||||||
@@ -152,8 +135,77 @@ DLLEXPORT int DLLCALL tjCompress(tjhandle j,
|
|||||||
unsigned char *dstbuf, unsigned long *size,
|
unsigned char *dstbuf, unsigned long *size,
|
||||||
int jpegsubsamp, int jpegqual, int flags);
|
int jpegsubsamp, int jpegqual, int flags);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
unsigned long TJBUFSIZE(int width, int height)
|
||||||
|
|
||||||
|
Convenience function which returns the maximum size of the buffer required to
|
||||||
|
hold a JPEG image with the given width and height
|
||||||
|
|
||||||
|
RETURNS: -1 if arguments are out of bounds
|
||||||
|
*/
|
||||||
DLLEXPORT unsigned long DLLCALL TJBUFSIZE(int width, int height);
|
DLLEXPORT unsigned long DLLCALL TJBUFSIZE(int width, int height);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
unsigned long TJBUFSIZEYUV(int width, int height, int subsamp)
|
||||||
|
|
||||||
|
Convenience function which returns the size of the buffer required to
|
||||||
|
hold a YUV planar image with the given width, height, and level of
|
||||||
|
chrominance subsampling
|
||||||
|
|
||||||
|
RETURNS: -1 if arguments are out of bounds
|
||||||
|
*/
|
||||||
|
DLLEXPORT unsigned long DLLCALL TJBUFSIZEYUV(int width, int height,
|
||||||
|
int subsamp);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
int tjEncodeYUV(tjhandle j,
|
||||||
|
unsigned char *srcbuf, int width, int pitch, int height, int pixelsize,
|
||||||
|
unsigned char *dstbuf, int subsamp, int flags)
|
||||||
|
|
||||||
|
This function uses the accelerated color conversion routines in TurboJPEG's
|
||||||
|
underlying codec to produce a planar YUV image that is suitable for X Video.
|
||||||
|
Specifically, if the chrominance components are subsampled along the
|
||||||
|
horizontal dimension, then the width of the luminance plane is padded to 2 in
|
||||||
|
the output image (same goes for the height of the luminance plane, if the
|
||||||
|
chrominance components are subsampled along the vertical dimension.) Also,
|
||||||
|
each line of each plane in the output image is padded to 4 bytes. Although
|
||||||
|
this will work with any subsampling option, it is really only useful in
|
||||||
|
combination with TJ_420, which produces an image compatible with the I420
|
||||||
|
(AKA "YUV420P") format.
|
||||||
|
|
||||||
|
[INPUT] j = instance handle previously returned from a call to
|
||||||
|
tjInitCompress()
|
||||||
|
[INPUT] srcbuf = pointer to user-allocated image buffer containing RGB or
|
||||||
|
grayscale pixels to be encoded
|
||||||
|
[INPUT] width = width (in pixels) of the source image
|
||||||
|
[INPUT] pitch = bytes per line of the source image (width*pixelsize if the
|
||||||
|
bitmap is unpadded, else TJPAD(width*pixelsize) if each line of the bitmap
|
||||||
|
is padded to the nearest 32-bit boundary, such 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*pixelsize.
|
||||||
|
[INPUT] height = height (in pixels) of the source image
|
||||||
|
[INPUT] pixelsize = size (in bytes) of each pixel in the source image
|
||||||
|
RGBX/BGRX/XRGB/XBGR: 4, RGB/BGR: 3, Grayscale: 1
|
||||||
|
[INPUT] dstbuf = pointer to user-allocated image buffer which will receive
|
||||||
|
the YUV image. Use the TJBUFSIZEYUV(width, height, subsamp) function to
|
||||||
|
determine the appropriate size for this buffer based on the image width,
|
||||||
|
height, and level of subsampling.
|
||||||
|
[INPUT] subsamp = Specifies either 4:2:0, 4:2:2, 4:4:4, or grayscale
|
||||||
|
subsampling (see description under tjCompress())
|
||||||
|
[INPUT] flags = the bitwise OR of one or more of the flags described in the
|
||||||
|
"Flags" section above
|
||||||
|
|
||||||
|
RETURNS: 0 on success, -1 on error
|
||||||
|
*/
|
||||||
|
DLLEXPORT int DLLCALL tjEncodeYUV(tjhandle j,
|
||||||
|
unsigned char *srcbuf, int width, int pitch, int height, int pixelsize,
|
||||||
|
unsigned char *dstbuf, int subsamp, int flags);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
tjhandle tjInitDecompress(void)
|
tjhandle tjInitDecompress(void)
|
||||||
|
|
||||||
@@ -161,7 +213,8 @@ DLLEXPORT unsigned long DLLCALL TJBUFSIZE(int width, int height);
|
|||||||
structures, and returns a handle to the instance. Most applications will
|
structures, and returns a handle to the instance. Most applications will
|
||||||
only need to call this once at the beginning of the program or once for each
|
only need to call this once at the beginning of the program or once for each
|
||||||
concurrent thread. Don't try to create a new instance every time you
|
concurrent thread. Don't try to create a new instance every time you
|
||||||
decompress an image, because this will cause performance to suffer.
|
decompress an image, because this may cause performance to suffer in some
|
||||||
|
TurboJPEG implementations.
|
||||||
|
|
||||||
RETURNS: NULL on error
|
RETURNS: NULL on error
|
||||||
*/
|
*/
|
||||||
@@ -171,26 +224,25 @@ DLLEXPORT tjhandle DLLCALL tjInitDecompress(void);
|
|||||||
/*
|
/*
|
||||||
int tjDecompressHeader2(tjhandle j,
|
int tjDecompressHeader2(tjhandle j,
|
||||||
unsigned char *srcbuf, unsigned long size,
|
unsigned char *srcbuf, unsigned long size,
|
||||||
int *width, int *height, int *jpegsub)
|
int *width, int *height, int *jpegsubsamp)
|
||||||
|
|
||||||
[INPUT] j = instance handle previously returned from a call to
|
[INPUT] j = instance handle previously returned from a call to
|
||||||
tjInitDecompress()
|
tjInitDecompress()
|
||||||
[INPUT] srcbuf = pointer to a user-allocated buffer containing the JPEG image
|
[INPUT] srcbuf = pointer to a user-allocated buffer containing a JPEG image
|
||||||
to decompress
|
|
||||||
[INPUT] size = size of the JPEG image buffer (in bytes)
|
[INPUT] size = size of the JPEG image buffer (in bytes)
|
||||||
[OUTPUT] width = width (in pixels) of the JPEG image
|
[OUTPUT] width = width (in pixels) of the JPEG image
|
||||||
[OUTPUT] height = height (in pixels) of the JPEG image
|
[OUTPUT] height = height (in pixels) of the JPEG image
|
||||||
[OUTPUT] jpegsub = type of chrominance subsampling used when compressing the
|
[OUTPUT] jpegsubsamp = type of chrominance subsampling used when compressing
|
||||||
JPEG image
|
the JPEG image
|
||||||
|
|
||||||
RETURNS: 0 on success, -1 on error
|
RETURNS: 0 on success, -1 on error
|
||||||
*/
|
*/
|
||||||
DLLEXPORT int DLLCALL tjDecompressHeader2(tjhandle j,
|
DLLEXPORT int DLLCALL tjDecompressHeader2(tjhandle j,
|
||||||
unsigned char *srcbuf, unsigned long size,
|
unsigned char *srcbuf, unsigned long size,
|
||||||
int *width, int *height, int *jpegsub);
|
int *width, int *height, int *jpegsubsamp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Deprecated version of the above function
|
Legacy version of the above function
|
||||||
*/
|
*/
|
||||||
DLLEXPORT int DLLCALL tjDecompressHeader(tjhandle j,
|
DLLEXPORT int DLLCALL tjDecompressHeader(tjhandle j,
|
||||||
unsigned char *srcbuf, unsigned long size,
|
unsigned char *srcbuf, unsigned long size,
|
||||||
@@ -213,14 +265,15 @@ DLLEXPORT int DLLCALL tjDecompressHeader(tjhandle j,
|
|||||||
bytes in size, although this pointer may also be used to decompress into
|
bytes in size, although this pointer may also be used to decompress into
|
||||||
a specific region of a larger buffer.
|
a specific region of a larger buffer.
|
||||||
[INPUT] width = width (in pixels) of the destination image
|
[INPUT] width = width (in pixels) of the destination image
|
||||||
[INPUT] pitch = bytes per line of the destination image (width*pixelsize if the
|
[INPUT] pitch = bytes per line of the destination image (width*pixelsize if
|
||||||
bitmap is unpadded, else TJPAD(width*pixelsize) if each line of the bitmap
|
the bitmap is unpadded, else TJPAD(width*pixelsize) if each line of the
|
||||||
is padded to the nearest 32-bit boundary, such as is the case for Windows
|
bitmap is padded to the nearest 32-bit boundary, such as is the case for
|
||||||
bitmaps. You can also be clever and use this parameter to skip lines, etc.,
|
Windows bitmaps. You can also be clever and use this parameter to skip
|
||||||
as long as the pitch is greater than 0.)
|
lines, etc. Setting this parameter to 0 is the equivalent of setting it
|
||||||
|
to width*pixelsize.
|
||||||
[INPUT] height = height (in pixels) of the destination image
|
[INPUT] height = height (in pixels) of the destination image
|
||||||
[INPUT] pixelsize = size (in bytes) of each pixel in the destination image
|
[INPUT] pixelsize = size (in bytes) of each pixel in the destination image
|
||||||
RGBA/RGBx and BGRA/BGRx: 4, RGB and BGR: 3, Grayscale: 1
|
RGBX/BGRX/XRGB/XBGR: 4, RGB/BGR: 3, Grayscale: 1
|
||||||
[INPUT] flags = the bitwise OR of one or more of the flags described in the
|
[INPUT] flags = the bitwise OR of one or more of the flags described in the
|
||||||
"Flags" section above.
|
"Flags" section above.
|
||||||
|
|
||||||
@@ -232,6 +285,37 @@ DLLEXPORT int DLLCALL tjDecompress(tjhandle j,
|
|||||||
int flags);
|
int flags);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
int tjDecompressToYUV(tjhandle j,
|
||||||
|
unsigned char *srcbuf, unsigned long size,
|
||||||
|
unsigned char *dstbuf, int flags)
|
||||||
|
|
||||||
|
This function performs JPEG decompression but leaves out the color conversion
|
||||||
|
step, so a planar YUV image is generated instead of an RGB image. The
|
||||||
|
padding of the planes in this image is the same as in tjEncodeYUV().
|
||||||
|
Note that, if the width or height of the output image is not a multiple of 8
|
||||||
|
(or a multiple of 16 along any dimension in which chrominance subsampling is
|
||||||
|
used), then an intermediate buffer copy will be performed within TurboJPEG.
|
||||||
|
|
||||||
|
[INPUT] j = instance handle previously returned from a call to
|
||||||
|
tjInitDecompress()
|
||||||
|
[INPUT] srcbuf = pointer to a user-allocated buffer containing the JPEG image
|
||||||
|
to decompress
|
||||||
|
[INPUT] size = size of the JPEG image buffer (in bytes)
|
||||||
|
[INPUT] dstbuf = pointer to user-allocated image buffer which will receive
|
||||||
|
the YUV image. Use the TJBUFSIZEYUV(width, height, subsamp) function to
|
||||||
|
determine the appropriate size for this buffer based on the image width,
|
||||||
|
height, and level of subsampling.
|
||||||
|
[INPUT] flags = the bitwise OR of one or more of the flags described in the
|
||||||
|
"Flags" section above.
|
||||||
|
|
||||||
|
RETURNS: 0 on success, -1 on error
|
||||||
|
*/
|
||||||
|
DLLEXPORT int DLLCALL tjDecompressToYUV(tjhandle j,
|
||||||
|
unsigned char *srcbuf, unsigned long size,
|
||||||
|
unsigned char *dstbuf, int flags);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
int tjDestroy(tjhandle h)
|
int tjDestroy(tjhandle h)
|
||||||
|
|
||||||
|
|||||||
162
turbojpegl.c
162
turbojpegl.c
@@ -1,6 +1,6 @@
|
|||||||
/* Copyright (C)2004 Landmark Graphics Corporation
|
/* Copyright (C)2004 Landmark Graphics Corporation
|
||||||
* Copyright (C)2005 Sun Microsystems, Inc.
|
* Copyright (C)2005 Sun Microsystems, Inc.
|
||||||
* Copyright (C)2009-2010 D. R. Commander
|
* Copyright (C)2009-2011 D. R. Commander
|
||||||
*
|
*
|
||||||
* This library is free software and may be redistributed and/or modified under
|
* This library is free software and may be redistributed and/or modified under
|
||||||
* the terms of the wxWindows Library License, Version 3.1 or (at your option)
|
* the terms of the wxWindows Library License, Version 3.1 or (at your option)
|
||||||
@@ -70,10 +70,9 @@ static const int hsampfactor[NUMSUBOPT]={1, 2, 2, 1};
|
|||||||
static const int vsampfactor[NUMSUBOPT]={1, 1, 2, 1};
|
static const int vsampfactor[NUMSUBOPT]={1, 1, 2, 1};
|
||||||
static const int pixelsize[NUMSUBOPT]={3, 3, 3, 1};
|
static const int pixelsize[NUMSUBOPT]={3, 3, 3, 1};
|
||||||
|
|
||||||
#define _throw(c) {sprintf(lasterror, "%s", c); return -1;}
|
#define _throw(c) {sprintf(lasterror, "%s", c); retval=-1; goto bailout;}
|
||||||
#define _catch(f) {if((f)==-1) return -1;}
|
|
||||||
#define checkhandle(h) jpgstruct *j=(jpgstruct *)h; \
|
#define checkhandle(h) jpgstruct *j=(jpgstruct *)h; \
|
||||||
if(!j) _throw("Invalid handle");
|
if(!j) {sprintf(lasterror, "Invalid handle"); return -1;}
|
||||||
|
|
||||||
|
|
||||||
// CO
|
// CO
|
||||||
@@ -113,18 +112,46 @@ DLLEXPORT tjhandle DLLCALL tjInitCompress(void)
|
|||||||
return (tjhandle)j;
|
return (tjhandle)j;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DLLEXPORT unsigned long DLLCALL TJBUFSIZE(int width, int height)
|
DLLEXPORT unsigned long DLLCALL TJBUFSIZE(int width, int height)
|
||||||
{
|
{
|
||||||
// This allows enough room in case the image doesn't compress
|
unsigned long retval=0;
|
||||||
return ((width+15)&(~15)) * ((height+15)&(~15)) * 6 + 2048;
|
if(width<1 || height<1)
|
||||||
|
_throw("Invalid argument in TJBUFSIZE()");
|
||||||
|
|
||||||
|
// This allows for rare corner cases in which a JPEG image can actually be
|
||||||
|
// larger than the uncompressed input (we wouldn't mention it if it hadn't
|
||||||
|
// happened before.)
|
||||||
|
retval=((width+15)&(~15)) * ((height+15)&(~15)) * 6 + 2048;
|
||||||
|
|
||||||
|
bailout:
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DLLEXPORT unsigned long DLLCALL TJBUFSIZEYUV(int width, int height,
|
||||||
|
int subsamp)
|
||||||
|
{
|
||||||
|
unsigned long retval=0;
|
||||||
|
int pw, ph, cw, ch;
|
||||||
|
if(width<1 || height<1 || subsamp<0 || subsamp>=NUMSUBOPT)
|
||||||
|
_throw("Invalid argument in TJBUFSIZEYUV()");
|
||||||
|
pw=PAD(width, hsampfactor[subsamp]);
|
||||||
|
ph=PAD(height, vsampfactor[subsamp]);
|
||||||
|
cw=pw/hsampfactor[subsamp]; ch=ph/vsampfactor[subsamp];
|
||||||
|
retval=PAD(pw, 4)*ph + (subsamp==TJ_GRAYSCALE? 0:PAD(cw, 4)*ch*2);
|
||||||
|
|
||||||
|
bailout:
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
DLLEXPORT int DLLCALL tjCompress(tjhandle h,
|
DLLEXPORT int DLLCALL tjCompress(tjhandle h,
|
||||||
unsigned char *srcbuf, int width, int pitch, int height, int ps,
|
unsigned char *srcbuf, int width, int pitch, int height, int ps,
|
||||||
unsigned char *dstbuf, unsigned long *size,
|
unsigned char *dstbuf, unsigned long *size,
|
||||||
int jpegsub, int qual, int flags)
|
int jpegsub, int qual, int flags)
|
||||||
{
|
{
|
||||||
int i; JSAMPROW *row_pointer=NULL;
|
int i, retval=0; JSAMPROW *row_pointer=NULL;
|
||||||
JSAMPLE *_tmpbuf[MAX_COMPONENTS], *_tmpbuf2[MAX_COMPONENTS];
|
JSAMPLE *_tmpbuf[MAX_COMPONENTS], *_tmpbuf2[MAX_COMPONENTS];
|
||||||
JSAMPROW *tmpbuf[MAX_COMPONENTS], *tmpbuf2[MAX_COMPONENTS];
|
JSAMPROW *tmpbuf[MAX_COMPONENTS], *tmpbuf2[MAX_COMPONENTS];
|
||||||
JSAMPROW *outbuf[MAX_COMPONENTS];
|
JSAMPROW *outbuf[MAX_COMPONENTS];
|
||||||
@@ -174,16 +201,8 @@ DLLEXPORT int DLLCALL tjCompress(tjhandle h,
|
|||||||
|
|
||||||
if(setjmp(j->jerr.jb))
|
if(setjmp(j->jerr.jb))
|
||||||
{ // this will execute if LIBJPEG has an error
|
{ // this will execute if LIBJPEG has an error
|
||||||
if(row_pointer) free(row_pointer);
|
retval=-1;
|
||||||
for(i=0; i<MAX_COMPONENTS; i++)
|
goto bailout;
|
||||||
{
|
|
||||||
if(tmpbuf[i]!=NULL) free(tmpbuf[i]);
|
|
||||||
if(_tmpbuf[i]!=NULL) free(_tmpbuf[i]);
|
|
||||||
if(tmpbuf2[i]!=NULL) free(tmpbuf2[i]);
|
|
||||||
if(_tmpbuf2[i]!=NULL) free(_tmpbuf2[i]);
|
|
||||||
if(outbuf[i]!=NULL) free(outbuf[i]);
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jpeg_set_defaults(&j->cinfo);
|
jpeg_set_defaults(&j->cinfo);
|
||||||
@@ -193,7 +212,8 @@ DLLEXPORT int DLLCALL tjCompress(tjhandle h,
|
|||||||
jpeg_set_colorspace(&j->cinfo, JCS_GRAYSCALE);
|
jpeg_set_colorspace(&j->cinfo, JCS_GRAYSCALE);
|
||||||
else
|
else
|
||||||
jpeg_set_colorspace(&j->cinfo, JCS_YCbCr);
|
jpeg_set_colorspace(&j->cinfo, JCS_YCbCr);
|
||||||
j->cinfo.dct_method = JDCT_FASTEST;
|
if(qual>=96) j->cinfo.dct_method=JDCT_ISLOW;
|
||||||
|
else j->cinfo.dct_method=JDCT_FASTEST;
|
||||||
|
|
||||||
j->cinfo.comp_info[0].h_samp_factor=hsampfactor[jpegsub];
|
j->cinfo.comp_info[0].h_samp_factor=hsampfactor[jpegsub];
|
||||||
j->cinfo.comp_info[1].h_samp_factor=1;
|
j->cinfo.comp_info[1].h_samp_factor=1;
|
||||||
@@ -280,6 +300,7 @@ DLLEXPORT int DLLCALL tjCompress(tjhandle h,
|
|||||||
}
|
}
|
||||||
*size=yuvsize;
|
*size=yuvsize;
|
||||||
cinfo->next_scanline+=height;
|
cinfo->next_scanline+=height;
|
||||||
|
jpeg_abort_compress(&j->cinfo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -295,12 +316,13 @@ DLLEXPORT int DLLCALL tjCompress(tjhandle h,
|
|||||||
jpeg_write_scanlines(&j->cinfo, &row_pointer[j->cinfo.next_scanline],
|
jpeg_write_scanlines(&j->cinfo, &row_pointer[j->cinfo.next_scanline],
|
||||||
j->cinfo.image_height-j->cinfo.next_scanline);
|
j->cinfo.image_height-j->cinfo.next_scanline);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
jpeg_finish_compress(&j->cinfo);
|
jpeg_finish_compress(&j->cinfo);
|
||||||
if(!(flags&TJ_YUV))
|
|
||||||
*size=TJBUFSIZE(j->cinfo.image_width, j->cinfo.image_height)
|
*size=TJBUFSIZE(j->cinfo.image_width, j->cinfo.image_height)
|
||||||
-(unsigned long)(j->jdms.free_in_buffer);
|
-(unsigned long)(j->jdms.free_in_buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
bailout:
|
||||||
|
if(j->cinfo.global_state>CSTATE_START) jpeg_abort_compress(&j->cinfo);
|
||||||
if(row_pointer) free(row_pointer);
|
if(row_pointer) free(row_pointer);
|
||||||
for(i=0; i<MAX_COMPONENTS; i++)
|
for(i=0; i<MAX_COMPONENTS; i++)
|
||||||
{
|
{
|
||||||
@@ -310,7 +332,17 @@ DLLEXPORT int DLLCALL tjCompress(tjhandle h,
|
|||||||
if(_tmpbuf2[i]!=NULL) free(_tmpbuf2[i]);
|
if(_tmpbuf2[i]!=NULL) free(_tmpbuf2[i]);
|
||||||
if(outbuf[i]!=NULL) free(outbuf[i]);
|
if(outbuf[i]!=NULL) free(outbuf[i]);
|
||||||
}
|
}
|
||||||
return 0;
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DLLEXPORT int DLLCALL tjEncodeYUV(tjhandle h,
|
||||||
|
unsigned char *srcbuf, int width, int pitch, int height, int ps,
|
||||||
|
unsigned char *dstbuf, int subsamp, int flags)
|
||||||
|
{
|
||||||
|
unsigned long size;
|
||||||
|
return tjCompress(h, srcbuf, width, pitch, height, ps, dstbuf, &size,
|
||||||
|
subsamp, 0, flags|TJ_YUV);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -360,45 +392,16 @@ DLLEXPORT tjhandle DLLCALL tjInitDecompress(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DLLEXPORT int DLLCALL tjDecompressHeader(tjhandle h,
|
|
||||||
unsigned char *srcbuf, unsigned long size,
|
|
||||||
int *width, int *height)
|
|
||||||
{
|
|
||||||
checkhandle(h);
|
|
||||||
|
|
||||||
if(srcbuf==NULL || size<=0 || width==NULL || height==NULL)
|
|
||||||
_throw("Invalid argument in tjDecompressHeader()");
|
|
||||||
if(!j->initd) _throw("Instance has not been initialized for decompression");
|
|
||||||
|
|
||||||
if(setjmp(j->jerr.jb))
|
|
||||||
{ // this will execute if LIBJPEG has an error
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
j->jsms.bytes_in_buffer = size;
|
|
||||||
j->jsms.next_input_byte = srcbuf;
|
|
||||||
|
|
||||||
jpeg_read_header(&j->dinfo, TRUE);
|
|
||||||
|
|
||||||
*width=j->dinfo.image_width; *height=j->dinfo.image_height;
|
|
||||||
|
|
||||||
jpeg_abort_decompress(&j->dinfo);
|
|
||||||
|
|
||||||
if(*width<1 || *height<1) _throw("Invalid data returned in header");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DLLEXPORT int DLLCALL tjDecompressHeader2(tjhandle h,
|
DLLEXPORT int DLLCALL tjDecompressHeader2(tjhandle h,
|
||||||
unsigned char *srcbuf, unsigned long size,
|
unsigned char *srcbuf, unsigned long size,
|
||||||
int *width, int *height, int *jpegsub)
|
int *width, int *height, int *jpegsub)
|
||||||
{
|
{
|
||||||
int i, k;
|
int i, k, retval=0;
|
||||||
|
|
||||||
checkhandle(h);
|
checkhandle(h);
|
||||||
|
|
||||||
if(srcbuf==NULL || size<=0 || width==NULL || height==NULL || jpegsub==NULL)
|
if(srcbuf==NULL || size<=0 || width==NULL || height==NULL || jpegsub==NULL)
|
||||||
_throw("Invalid argument in tjDecompressHeader()");
|
_throw("Invalid argument in tjDecompressHeader2()");
|
||||||
if(!j->initd) _throw("Instance has not been initialized for decompression");
|
if(!j->initd) _throw("Instance has not been initialized for decompression");
|
||||||
|
|
||||||
if(setjmp(j->jerr.jb))
|
if(setjmp(j->jerr.jb))
|
||||||
@@ -439,7 +442,18 @@ DLLEXPORT int DLLCALL tjDecompressHeader2(tjhandle h,
|
|||||||
|
|
||||||
if(*jpegsub<0) _throw("Could not determine subsampling type for JPEG image");
|
if(*jpegsub<0) _throw("Could not determine subsampling type for JPEG image");
|
||||||
if(*width<1 || *height<1) _throw("Invalid data returned in header");
|
if(*width<1 || *height<1) _throw("Invalid data returned in header");
|
||||||
return 0;
|
|
||||||
|
bailout:
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DLLEXPORT int DLLCALL tjDecompressHeader(tjhandle h,
|
||||||
|
unsigned char *srcbuf, unsigned long size,
|
||||||
|
int *width, int *height)
|
||||||
|
{
|
||||||
|
int jpegsub;
|
||||||
|
return tjDecompressHeader2(h, srcbuf, size, width, height, &jpegsub);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -448,7 +462,7 @@ DLLEXPORT int DLLCALL tjDecompress(tjhandle h,
|
|||||||
unsigned char *dstbuf, int width, int pitch, int height, int ps,
|
unsigned char *dstbuf, int width, int pitch, int height, int ps,
|
||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
int i, row; JSAMPROW *row_pointer=NULL, *outbuf[MAX_COMPONENTS];
|
int i, row, retval=0; JSAMPROW *row_pointer=NULL, *outbuf[MAX_COMPONENTS];
|
||||||
int cw[MAX_COMPONENTS], ch[MAX_COMPONENTS], iw[MAX_COMPONENTS],
|
int cw[MAX_COMPONENTS], ch[MAX_COMPONENTS], iw[MAX_COMPONENTS],
|
||||||
tmpbufsize=0, usetmpbuf=0, th[MAX_COMPONENTS];
|
tmpbufsize=0, usetmpbuf=0, th[MAX_COMPONENTS];
|
||||||
JSAMPLE *_tmpbuf=NULL; JSAMPROW *tmpbuf[MAX_COMPONENTS];
|
JSAMPLE *_tmpbuf=NULL; JSAMPROW *tmpbuf[MAX_COMPONENTS];
|
||||||
@@ -475,14 +489,8 @@ DLLEXPORT int DLLCALL tjDecompress(tjhandle h,
|
|||||||
|
|
||||||
if(setjmp(j->jerr.jb))
|
if(setjmp(j->jerr.jb))
|
||||||
{ // this will execute if LIBJPEG has an error
|
{ // this will execute if LIBJPEG has an error
|
||||||
for(i=0; i<MAX_COMPONENTS; i++)
|
retval=-1;
|
||||||
{
|
goto bailout;
|
||||||
if(tmpbuf[i]!=NULL) free(tmpbuf[i]);
|
|
||||||
if(outbuf[i]!=NULL) free(outbuf[i]);
|
|
||||||
}
|
|
||||||
if(_tmpbuf) free(_tmpbuf);
|
|
||||||
if(row_pointer) free(row_pointer);
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
j->jsms.bytes_in_buffer = size;
|
j->jsms.bytes_in_buffer = size;
|
||||||
@@ -501,15 +509,15 @@ DLLEXPORT int DLLCALL tjDecompress(tjhandle h,
|
|||||||
int ih;
|
int ih;
|
||||||
iw[i]=compptr->width_in_blocks*DCTSIZE;
|
iw[i]=compptr->width_in_blocks*DCTSIZE;
|
||||||
ih=compptr->height_in_blocks*DCTSIZE;
|
ih=compptr->height_in_blocks*DCTSIZE;
|
||||||
cw[i]=PAD(width, dinfo->max_h_samp_factor)*compptr->h_samp_factor
|
cw[i]=PAD(dinfo->image_width, dinfo->max_h_samp_factor)
|
||||||
/dinfo->max_h_samp_factor;
|
*compptr->h_samp_factor/dinfo->max_h_samp_factor;
|
||||||
ch[i]=PAD(height, dinfo->max_v_samp_factor)*compptr->v_samp_factor
|
ch[i]=PAD(dinfo->image_height, dinfo->max_v_samp_factor)
|
||||||
/dinfo->max_v_samp_factor;
|
*compptr->v_samp_factor/dinfo->max_v_samp_factor;
|
||||||
if(iw[i]!=cw[i] || ih!=ch[i]) usetmpbuf=1;
|
if(iw[i]!=cw[i] || ih!=ch[i]) usetmpbuf=1;
|
||||||
th[i]=compptr->v_samp_factor*DCTSIZE;
|
th[i]=compptr->v_samp_factor*DCTSIZE;
|
||||||
tmpbufsize+=iw[i]*th[i];
|
tmpbufsize+=iw[i]*th[i];
|
||||||
if((outbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ch[i]))==NULL)
|
if((outbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ch[i]))==NULL)
|
||||||
_throw("Memory allocation failed in tjInitDecompress()");
|
_throw("Memory allocation failed in tjDecompress()");
|
||||||
for(row=0; row<ch[i]; row++)
|
for(row=0; row<ch[i]; row++)
|
||||||
{
|
{
|
||||||
outbuf[i][row]=ptr;
|
outbuf[i][row]=ptr;
|
||||||
@@ -519,13 +527,12 @@ DLLEXPORT int DLLCALL tjDecompress(tjhandle h,
|
|||||||
if(usetmpbuf)
|
if(usetmpbuf)
|
||||||
{
|
{
|
||||||
if((_tmpbuf=(JSAMPLE *)malloc(sizeof(JSAMPLE)*tmpbufsize))==NULL)
|
if((_tmpbuf=(JSAMPLE *)malloc(sizeof(JSAMPLE)*tmpbufsize))==NULL)
|
||||||
_throw("Memory allocation failed in tjInitDecompress()");
|
_throw("Memory allocation failed in tjDecompress()");
|
||||||
ptr=_tmpbuf;
|
ptr=_tmpbuf;
|
||||||
for(i=0; i<dinfo->num_components; i++)
|
for(i=0; i<dinfo->num_components; i++)
|
||||||
{
|
{
|
||||||
jpeg_component_info *compptr=&dinfo->comp_info[i];
|
|
||||||
if((tmpbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*th[i]))==NULL)
|
if((tmpbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*th[i]))==NULL)
|
||||||
_throw("Memory allocation failed in tjInitDecompress()");
|
_throw("Memory allocation failed in tjDecompress()");
|
||||||
for(row=0; row<th[i]; row++)
|
for(row=0; row<th[i]; row++)
|
||||||
{
|
{
|
||||||
tmpbuf[i][row]=ptr;
|
tmpbuf[i][row]=ptr;
|
||||||
@@ -537,7 +544,7 @@ DLLEXPORT int DLLCALL tjDecompress(tjhandle h,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)*height))==NULL)
|
if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)*height))==NULL)
|
||||||
_throw("Memory allocation failed in tjInitDecompress()");
|
_throw("Memory allocation failed in tjDecompress()");
|
||||||
for(i=0; i<height; i++)
|
for(i=0; i<height; i++)
|
||||||
{
|
{
|
||||||
if(flags&TJ_BOTTOMUP) row_pointer[i]= &dstbuf[(height-i-1)*pitch];
|
if(flags&TJ_BOTTOMUP) row_pointer[i]= &dstbuf[(height-i-1)*pitch];
|
||||||
@@ -587,7 +594,6 @@ DLLEXPORT int DLLCALL tjDecompress(tjhandle h,
|
|||||||
int j;
|
int j;
|
||||||
for(i=0; i<dinfo->num_components; i++)
|
for(i=0; i<dinfo->num_components; i++)
|
||||||
{
|
{
|
||||||
jpeg_component_info *compptr=&dinfo->comp_info[i];
|
|
||||||
for(j=0; j<min(th[i], ch[i]-crow[i]); j++)
|
for(j=0; j<min(th[i], ch[i]-crow[i]); j++)
|
||||||
{
|
{
|
||||||
memcpy(outbuf[i][crow[i]+j], tmpbuf[i][j], cw[i]);
|
memcpy(outbuf[i][crow[i]+j], tmpbuf[i][j], cw[i]);
|
||||||
@@ -606,6 +612,8 @@ DLLEXPORT int DLLCALL tjDecompress(tjhandle h,
|
|||||||
}
|
}
|
||||||
jpeg_finish_decompress(&j->dinfo);
|
jpeg_finish_decompress(&j->dinfo);
|
||||||
|
|
||||||
|
bailout:
|
||||||
|
if(j->dinfo.global_state>DSTATE_START) jpeg_abort_decompress(&j->dinfo);
|
||||||
for(i=0; i<MAX_COMPONENTS; i++)
|
for(i=0; i<MAX_COMPONENTS; i++)
|
||||||
{
|
{
|
||||||
if(tmpbuf[i]) free(tmpbuf[i]);
|
if(tmpbuf[i]) free(tmpbuf[i]);
|
||||||
@@ -613,7 +621,15 @@ DLLEXPORT int DLLCALL tjDecompress(tjhandle h,
|
|||||||
}
|
}
|
||||||
if(_tmpbuf) free(_tmpbuf);
|
if(_tmpbuf) free(_tmpbuf);
|
||||||
if(row_pointer) free(row_pointer);
|
if(row_pointer) free(row_pointer);
|
||||||
return 0;
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DLLEXPORT int DLLCALL tjDecompressToYUV(tjhandle h,
|
||||||
|
unsigned char *srcbuf, unsigned long size,
|
||||||
|
unsigned char *dstbuf, int flags)
|
||||||
|
{
|
||||||
|
return tjDecompress(h, srcbuf, size, dstbuf, 1, 0, 1, 3, flags|TJ_YUV);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user