Compare commits
334 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3bd754ee68 | ||
|
|
8ecba3647e | ||
|
|
6316d4d752 | ||
|
|
af265e7562 | ||
|
|
d743a2c12e | ||
|
|
a93f6a7a63 | ||
|
|
3b19db4e6e | ||
|
|
27f4ff80ce | ||
|
|
1485beaa49 | ||
|
|
8a1526a442 | ||
|
|
edbb7e6d43 | ||
|
|
af1b4c8df4 | ||
|
|
2aac545899 | ||
|
|
0738305ec5 | ||
|
|
98a6455875 | ||
|
|
b99e7590b0 | ||
|
|
28c2e60770 | ||
|
|
fb15efe94f | ||
|
|
7ed186ed79 | ||
|
|
08cbc23334 | ||
|
|
0c0df2d0c7 | ||
|
|
22a6636852 | ||
|
|
94a2b95342 | ||
|
|
9a146f0f23 | ||
|
|
b03ee8b835 | ||
|
|
d260858395 | ||
|
|
dc4a93fab3 | ||
|
|
5da86f7430 | ||
|
|
7bb5cb560e | ||
|
|
7f2eb09d6e | ||
|
|
403cfad611 | ||
|
|
c4105ba7ef | ||
|
|
45cd2ded88 | ||
|
|
74d5b168f7 | ||
|
|
eb1fd4ad34 | ||
|
|
37dd973bef | ||
|
|
78a36f6dc3 | ||
|
|
aa3dd0bd29 | ||
|
|
4f7a8afbb7 | ||
|
|
8c5e78ce29 | ||
|
|
8917c54877 | ||
|
|
cb3642cb0b | ||
|
|
51f1924e77 | ||
|
|
eb0a024af2 | ||
|
|
f579cc11b3 | ||
|
|
2cad2169ae | ||
|
|
c5db99e1aa | ||
|
|
fd56921259 | ||
|
|
a2d2907ff0 | ||
|
|
8162eddf04 | ||
|
|
2e136a7190 | ||
|
|
9f8f683e74 | ||
|
|
4dbc293125 | ||
|
|
59337a67b1 | ||
|
|
08978e58db | ||
|
|
ba22c0f76d | ||
|
|
a405519e96 | ||
|
|
fac8381441 | ||
|
|
5c6a0f0971 | ||
|
|
5e797fa699 | ||
|
|
290ddbf71a | ||
|
|
9171fd4bde | ||
|
|
d0e7c4548a | ||
|
|
dfc63d42ee | ||
|
|
67cb059046 | ||
|
|
5c8cac97c0 | ||
|
|
df3c3dcb9b | ||
|
|
2ee7264d40 | ||
|
|
30cba2a2f8 | ||
|
|
a014845403 | ||
|
|
f3c716a2bc | ||
|
|
6f1534d618 | ||
|
|
9abeff46d8 | ||
|
|
932b5bb0d5 | ||
|
|
e8df8a2d63 | ||
|
|
fdab4a7af4 | ||
|
|
0565548191 | ||
|
|
c5f269eb96 | ||
|
|
98bc3eeb3a | ||
|
|
147548c055 | ||
|
|
d640a45730 | ||
|
|
eb21c023ab | ||
|
|
13377e6b38 | ||
|
|
607b668ff9 | ||
|
|
ab6cae6f3b | ||
|
|
3ccb6ead23 | ||
|
|
6441ad0f83 | ||
|
|
6d2d6d3baf | ||
|
|
e1588a2a7b | ||
|
|
548490fe5e | ||
|
|
b579fc114d | ||
|
|
a3d4aadd0d | ||
|
|
d7d16df646 | ||
|
|
14ce28a92d | ||
|
|
da41ab94e7 | ||
|
|
1f55ae7b0f | ||
|
|
172972394a | ||
|
|
a7f0244e9b | ||
|
|
a01857cff6 | ||
|
|
57ba02a408 | ||
|
|
8a9a6dd15a | ||
|
|
73eff6effe | ||
|
|
2ce32e0fe5 | ||
|
|
e869a81a7a | ||
|
|
5446ff88d6 | ||
|
|
0f88060b0f | ||
|
|
ecf021bc0d | ||
|
|
4c5fa566b3 | ||
|
|
d401d62514 | ||
|
|
2fd4ae7b2c | ||
|
|
5552483db9 | ||
|
|
18edeff4e8 | ||
|
|
a9c41fbc4f | ||
|
|
739ecbc5ec | ||
|
|
4c313544e2 | ||
|
|
173900b1ca | ||
|
|
5d2430f4da | ||
|
|
129f0cb763 | ||
|
|
0a9b972178 | ||
|
|
2849d86aaa | ||
|
|
84d6306f64 | ||
|
|
512a7c3a51 | ||
|
|
e6e952d5d5 | ||
|
|
a72816ed07 | ||
|
|
4d9f256b01 | ||
|
|
b201838d8b | ||
|
|
a1bfc05854 | ||
|
|
2a2970af67 | ||
|
|
97a1575cb8 | ||
|
|
0081c2de20 | ||
|
|
9df5786f05 | ||
|
|
323469818c | ||
|
|
1a1fb615db | ||
|
|
5135c2e25d | ||
|
|
3932190c2e | ||
|
|
a219fd13b0 | ||
|
|
c23672ce52 | ||
|
|
4f51f36eb3 | ||
|
|
e0606dafff | ||
|
|
ffc1aa9674 | ||
|
|
55ec9b3b89 | ||
|
|
4de8f6922a | ||
|
|
785ec30eb4 | ||
|
|
d147be83e9 | ||
|
|
8fa70367ed | ||
|
|
171b875b27 | ||
|
|
3ab3234875 | ||
|
|
3e68a5ee20 | ||
|
|
4e45161654 | ||
|
|
629e96eedc | ||
|
|
ebaa67ea32 | ||
|
|
dd830b3ffe | ||
|
|
4ede2ef523 | ||
|
|
5cda8c5e31 | ||
|
|
47b66d1d1e | ||
|
|
55ab0d396c | ||
|
|
18bc4c6114 | ||
|
|
b1079002ad | ||
|
|
3311fc0001 | ||
|
|
34d264d64e | ||
|
|
f35fd27ec6 | ||
|
|
df17d398ec | ||
|
|
cd9a318502 | ||
|
|
d2d4465548 | ||
|
|
5536ace198 | ||
|
|
5dd906beff | ||
|
|
c81e91e8ca | ||
|
|
bff7959e34 | ||
|
|
6ad658be17 | ||
|
|
7b57cba6b4 | ||
|
|
2f9e8a1172 | ||
|
|
e4ec23d7ae | ||
|
|
e795afc330 | ||
|
|
2c01200c5d | ||
|
|
ed70101da2 | ||
|
|
c78b82bbb1 | ||
|
|
886ddb1786 | ||
|
|
69bd7ed953 | ||
|
|
ed21c3ba6f | ||
|
|
9f01177f72 | ||
|
|
ceb4f8e97c | ||
|
|
8a2cad0201 | ||
|
|
b6772910d3 | ||
|
|
399aa374bd | ||
|
|
1719d12e51 | ||
|
|
486cdcfb9d | ||
|
|
74e6ea45e3 | ||
|
|
d2c4079959 | ||
|
|
3e8911aad5 | ||
|
|
4b838c38f9 | ||
|
|
944f5915cd | ||
|
|
3179f330b2 | ||
|
|
1388ad6757 | ||
|
|
110d8d6dca | ||
|
|
7b68764905 | ||
|
|
21d056847b | ||
|
|
6e4509a3f1 | ||
|
|
c7ca521bc8 | ||
|
|
ccaba5d789 | ||
|
|
cfc7e6e58e | ||
|
|
4e52b66f34 | ||
|
|
8cf6f716bc | ||
|
|
eb14189caa | ||
|
|
91dd3b23ad | ||
|
|
7e0d94d3a7 | ||
|
|
1c839761cf | ||
|
|
6d91e950c8 | ||
|
|
d523435e18 | ||
|
|
1ac83cd636 | ||
|
|
0ba70b6a13 | ||
|
|
e417033d84 | ||
|
|
6d2e8837b4 | ||
|
|
f7c5489244 | ||
|
|
f7a10a61e3 | ||
|
|
d111d9ff7a | ||
|
|
292d78e786 | ||
|
|
8f8305981b | ||
|
|
33859880e9 | ||
|
|
bbd8089297 | ||
|
|
141f26ff6d | ||
|
|
4574f01f43 | ||
|
|
ba52a3de32 | ||
|
|
240ba417aa | ||
|
|
ed581cd935 | ||
|
|
2c6b68e283 | ||
|
|
2acfb93c94 | ||
|
|
975307775c | ||
|
|
5dbd39323c | ||
|
|
0f35cd68f2 | ||
|
|
f3c3f01d23 | ||
|
|
d0004de5dd | ||
|
|
3d84668d42 | ||
|
|
951d3677eb | ||
|
|
366168aa7d | ||
|
|
f73b1dbc60 | ||
|
|
4f2216b435 | ||
|
|
0efc4858d4 | ||
|
|
c7dd191271 | ||
|
|
7c1a1789d2 | ||
|
|
cd342acf7f | ||
|
|
88ae60986e | ||
|
|
7e4eac7021 | ||
|
|
9fc018fd1a | ||
|
|
96e4e7eb60 | ||
|
|
59352195b2 | ||
|
|
b8200c6601 | ||
|
|
ea8f643c16 | ||
|
|
460dfe40e1 | ||
|
|
ae08115d4d | ||
|
|
8789a5e255 | ||
|
|
1d7faf84a0 | ||
|
|
2b121d39e7 | ||
|
|
6ab61fa1d1 | ||
|
|
fe79f56b77 | ||
|
|
fb6f5e8b01 | ||
|
|
c77783ed41 | ||
|
|
4c5a15c362 | ||
|
|
b797f70012 | ||
|
|
80d77720c3 | ||
|
|
aecee25695 | ||
|
|
70040cb7ee | ||
|
|
219e8e8f65 | ||
|
|
b0f92a1d6c | ||
|
|
77ff3bd66d | ||
|
|
00d48d7e8c | ||
|
|
9a2cf32317 | ||
|
|
6aabca86d3 | ||
|
|
379edfd815 | ||
|
|
ada6ea5105 | ||
|
|
167b5a8059 | ||
|
|
4c57ad476c | ||
|
|
04d3143a65 | ||
|
|
b34c85ea4a | ||
|
|
c4675d62e8 | ||
|
|
80acd5c4a7 | ||
|
|
5000eaa3a6 | ||
|
|
e98b061282 | ||
|
|
54288598bb | ||
|
|
81b8c0eed5 | ||
|
|
52fef34928 | ||
|
|
e821464f79 | ||
|
|
b8a7680e12 | ||
|
|
f64c5508df | ||
|
|
26b4d62a65 | ||
|
|
9c6f79e919 | ||
|
|
f60b6dd36f | ||
|
|
c43a5081ce | ||
|
|
713c451f58 | ||
|
|
2234deeeed | ||
|
|
82695cfddf | ||
|
|
42825b68d5 | ||
|
|
f2d4b47315 | ||
|
|
45dff48c9f | ||
|
|
d70047fcd2 | ||
|
|
cbf0fcc8b7 | ||
|
|
bbedb4b564 | ||
|
|
087c29e07f | ||
|
|
d92ae5df0c | ||
|
|
adf9cc942f | ||
|
|
95f4d6ef8b | ||
|
|
2ae2bd66b4 | ||
|
|
b7523059c1 | ||
|
|
b4110b65fc | ||
|
|
8ef53b102f | ||
|
|
7fbfe29c65 | ||
|
|
051f4862f9 | ||
|
|
c055c88057 | ||
|
|
85d96d4478 | ||
|
|
f36d531553 | ||
|
|
8a0e35b212 | ||
|
|
afbe48c290 | ||
|
|
98ff5507d8 | ||
|
|
3ca6dba96e | ||
|
|
aaf58dabb6 | ||
|
|
a9075a17c3 | ||
|
|
bdec995839 | ||
|
|
fa905fbf7b | ||
|
|
9aada25ced | ||
|
|
73fd604161 | ||
|
|
2f9e7c84d1 | ||
|
|
3c7199ff06 | ||
|
|
73b98acd8b | ||
|
|
bb0d170288 | ||
|
|
db84125fcb | ||
|
|
ae4221f905 | ||
|
|
674343ab14 | ||
|
|
6fac90945a | ||
|
|
01e3032354 | ||
|
|
42d62bf114 | ||
|
|
a39c970d27 | ||
|
|
12f3d0be84 | ||
|
|
2cc4f93c88 | ||
|
|
133e4af070 | ||
|
|
995eb29dc3 |
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -2,3 +2,5 @@
|
||||
/appveyor.yml export-ignore
|
||||
/ci export-ignore
|
||||
/.gitattributes export-ignore
|
||||
*.ppm binary
|
||||
/ChangeLog.md conflict-marker-size=8
|
||||
|
||||
274
BUILDING.md
274
BUILDING.md
@@ -10,38 +10,24 @@ Build Requirements
|
||||
|
||||
- [CMake](http://www.cmake.org) v2.8.12 or later
|
||||
|
||||
- [NASM](http://www.nasm.us) or [YASM](http://yasm.tortall.net)
|
||||
- [NASM](http://www.nasm.us) or [Yasm](http://yasm.tortall.net)
|
||||
(if building x86 or x86-64 SIMD extensions)
|
||||
* If using NASM, 2.10 or later is required.
|
||||
* If using NASM, 2.10 or later (except 2.11.08) is required for an x86-64 Mac
|
||||
build (2.11.08 does not work properly with libjpeg-turbo's x86-64 SIMD code
|
||||
when building macho64 objects.)
|
||||
* If using YASM, 1.2.0 or later is required.
|
||||
* If building on macOS, NASM or YASM can be obtained from
|
||||
* If using NASM, 2.13 or later is required.
|
||||
* If using Yasm, 1.2.0 or later is required.
|
||||
* If building on macOS, NASM or Yasm can be obtained from
|
||||
[MacPorts](http://www.macports.org/) or [Homebrew](http://brew.sh/).
|
||||
- NOTE: Currently, if it is desirable to hide the SIMD function symbols in
|
||||
Mac executables or shared libraries that statically link with
|
||||
libjpeg-turbo, then NASM 2.14 or later or YASM must be used when
|
||||
libjpeg-turbo, then NASM 2.14 or later or Yasm must be used when
|
||||
building libjpeg-turbo.
|
||||
* If building on Windows, **nasm.exe**/**yasm.exe** should be in your `PATH`.
|
||||
* NASM and YASM are located in the CRB (Code Ready Builder) repository on
|
||||
Red Hat Enterprise Linux 8 and in the PowerTools repository on CentOS 8,
|
||||
which is not enabled by default.
|
||||
|
||||
The binary RPMs released by the NASM project do not work on older Linux
|
||||
systems, such as Red Hat Enterprise Linux 5. On such systems, you can 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`
|
||||
rpmbuild --rebuild nasm-{version}.src.rpm
|
||||
rpm -Uvh /usr/src/redhat/RPMS/$ARCH/nasm-{version}.$ARCH.rpm
|
||||
|
||||
NOTE: the NASM build will fail if texinfo is not installed.
|
||||
|
||||
* If NASM or Yasm is not in your `PATH`, then you can specify the full path
|
||||
to the assembler by using either the `CMAKE_ASM_NASM_COMPILER` CMake
|
||||
variable or the `ASM_NASM` environment variable. On Windows, use forward
|
||||
slashes rather than backslashes in the path (for example,
|
||||
**c:/nasm/nasm.exe**).
|
||||
* NASM and Yasm are located in the CRB (Code Ready Builder) or PowerTools
|
||||
repository on Red Hat Enterprise Linux 8+ and derivatives, which is not
|
||||
enabled by default.
|
||||
|
||||
### Un*x Platforms (including Linux, Mac, FreeBSD, Solaris, and Cygwin)
|
||||
|
||||
@@ -49,10 +35,8 @@ Build Requirements
|
||||
|
||||
- If building the TurboJPEG Java wrapper, JDK or OpenJDK 1.5 or later is
|
||||
required. Most modern Linux distributions, as well as Solaris 10 and later,
|
||||
include JDK or OpenJDK. On OS X 10.5 and 10.6, it will be necessary to
|
||||
install the Java Developer Package, which can be downloaded from
|
||||
<http://developer.apple.com/downloads> (Apple ID required.) For other
|
||||
systems, you can obtain the Oracle Java Development Kit from
|
||||
include JDK or OpenJDK. For other systems, you can obtain the Oracle Java
|
||||
Development Kit from
|
||||
<http://www.oracle.com/technetwork/java/javase/downloads>.
|
||||
|
||||
* If using JDK 11 or later, CMake 3.10.x or later must also be used.
|
||||
@@ -62,25 +46,43 @@ Build Requirements
|
||||
- Microsoft Visual C++ 2005 or later
|
||||
|
||||
If you don't already have Visual C++, then the easiest way to get it is by
|
||||
installing the
|
||||
[Windows SDK](http://msdn.microsoft.com/en-us/windows/bb980924.aspx).
|
||||
The Windows SDK includes both 32-bit and 64-bit Visual C++ compilers and
|
||||
everything necessary to build libjpeg-turbo.
|
||||
installing
|
||||
[Visual Studio Community Edition](https://visualstudio.microsoft.com).
|
||||
|
||||
* You can also use Microsoft Visual Studio Express/Community Edition, which
|
||||
is a free download. (NOTE: versions prior to 2012 can only be used to
|
||||
build 32-bit code.)
|
||||
* You can also download and install the standalone Windows SDK (for Windows 7
|
||||
or later), which includes command-line versions of the 32-bit and 64-bit
|
||||
Visual C++ compilers.
|
||||
* If you intend to build libjpeg-turbo from the command line, then add the
|
||||
appropriate compiler and SDK directories to the `INCLUDE`, `LIB`, and
|
||||
`PATH` environment variables. This is generally accomplished by
|
||||
executing `vcvars32.bat` or `vcvars64.bat` and `SetEnv.cmd`.
|
||||
`vcvars32.bat` and `vcvars64.bat` are part of Visual C++ and are located in
|
||||
the same directory as the compiler. `SetEnv.cmd` is part of the Windows
|
||||
SDK. You can pass optional arguments to `SetEnv.cmd` to specify a 32-bit
|
||||
or 64-bit build environment.
|
||||
executing `vcvars32.bat` or `vcvars64.bat`, which are located in the same
|
||||
directory as the compiler.
|
||||
* If built with Visual C++ 2015 or later, the libjpeg-turbo static libraries
|
||||
cannot be used with earlier versions of Visual C++, and vice versa.
|
||||
* The libjpeg API DLL (**jpeg{version}.dll**) will depend on the C run-time
|
||||
DLLs corresponding to the version of Visual C++ that was used to build it.
|
||||
|
||||
- Vcpkg
|
||||
|
||||
You need to download and install libpng using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:
|
||||
|
||||
git clone https://github.com/Microsoft/vcpkg.git
|
||||
cd vcpkg
|
||||
./bootstrap-vcpkg.sh
|
||||
./vcpkg integrate install
|
||||
vcpkg install libpng:x64-windows
|
||||
vcpkg install libpng:x64-windows-static
|
||||
|
||||
Actually, you can just download and install MozJPEG using vcpkg dependency manager:
|
||||
|
||||
vcpkg install mozjpeg
|
||||
|
||||
The mozjpeg port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
|
||||
|
||||
|
||||
... OR ...
|
||||
|
||||
|
||||
- MinGW
|
||||
|
||||
[MSYS2](http://msys2.github.io/) or [tdm-gcc](http://tdm-gcc.tdragon.net/)
|
||||
@@ -94,17 +96,13 @@ Build Requirements
|
||||
|
||||
* If using JDK 11 or later, CMake 3.10.x or later must also be used.
|
||||
|
||||
- Vcpkg
|
||||
|
||||
You can download and install mozjpeg using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:
|
||||
Sub-Project Builds
|
||||
------------------
|
||||
|
||||
git clone https://github.com/Microsoft/vcpkg.git
|
||||
cd vcpkg
|
||||
./bootstrap-vcpkg.sh
|
||||
./vcpkg integrate install
|
||||
vcpkg install mozjpeg
|
||||
|
||||
The mozjpeg port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
|
||||
The libjpeg-turbo build system does not support being included as a sub-project
|
||||
using the CMake `add_subdirectory()` function. Use the CMake
|
||||
`ExternalProject_Add()` function instead.
|
||||
|
||||
|
||||
Out-of-Tree Builds
|
||||
@@ -120,6 +118,14 @@ directory, whereas *{source_directory}* refers to the libjpeg-turbo source
|
||||
directory. For in-tree builds, these directories are the same.
|
||||
|
||||
|
||||
Ninja
|
||||
-----
|
||||
|
||||
If using Ninja, then replace `make` or `nmake` with `ninja`, and replace the
|
||||
CMake generator (specified with the `-G` option) with `Ninja`, in all of the
|
||||
procedures and recipes below.
|
||||
|
||||
|
||||
Build Procedure
|
||||
---------------
|
||||
|
||||
@@ -345,7 +351,7 @@ Build Recipes
|
||||
-------------
|
||||
|
||||
|
||||
### 32-bit Build on 64-bit Linux/Unix/Mac
|
||||
### 32-bit Build on 64-bit Linux/Unix
|
||||
|
||||
Use export/setenv to set the following environment variables before running
|
||||
CMake:
|
||||
@@ -384,9 +390,13 @@ located (usually **/usr/bin**.) Next, execute the following commands:
|
||||
|
||||
cd {build_directory}
|
||||
cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
|
||||
-DCMAKE_INSTALL_PREFIX={install_path} \
|
||||
[additional CMake flags] {source_directory}
|
||||
make
|
||||
|
||||
*{install\_path}* is the path under which the libjpeg-turbo binaries should be
|
||||
installed.
|
||||
|
||||
|
||||
### 64-bit MinGW Build on Un*x (including Mac and Cygwin)
|
||||
|
||||
@@ -403,9 +413,13 @@ located (usually **/usr/bin**.) Next, execute the following commands:
|
||||
|
||||
cd {build_directory}
|
||||
cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
|
||||
-DCMAKE_INSTALL_PREFIX={install_path} \
|
||||
[additional CMake flags] {source_directory}
|
||||
make
|
||||
|
||||
*{install\_path}* is the path under which the libjpeg-turbo binaries should be
|
||||
installed.
|
||||
|
||||
|
||||
Building libjpeg-turbo for iOS
|
||||
------------------------------
|
||||
@@ -417,103 +431,9 @@ compression/decompression. This section describes how to build libjpeg-turbo
|
||||
for these platforms.
|
||||
|
||||
|
||||
### Additional build requirements
|
||||
|
||||
- For configurations that require [gas-preprocessor.pl]
|
||||
(https://raw.githubusercontent.com/libjpeg-turbo/gas-preprocessor/master/gas-preprocessor.pl),
|
||||
it should be installed in your `PATH`.
|
||||
|
||||
|
||||
### Armv7 (32-bit)
|
||||
|
||||
**gas-preprocessor.pl required**
|
||||
|
||||
The following scripts demonstrate how to build libjpeg-turbo to run on the
|
||||
iPhone 3GS-4S/iPad 1st-3rd Generation and newer:
|
||||
|
||||
#### Xcode 4.2 and earlier (LLVM-GCC)
|
||||
|
||||
IOS_PLATFORMDIR=/Developer/Platforms/iPhoneOS.platform
|
||||
IOS_SYSROOT=($IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk)
|
||||
export CFLAGS="-mfloat-abi=softfp -march=armv7 -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -miphoneos-version-min=3.0"
|
||||
|
||||
cd {build_directory}
|
||||
|
||||
cat <<EOF >toolchain.cmake
|
||||
set(CMAKE_SYSTEM_NAME Darwin)
|
||||
set(CMAKE_SYSTEM_PROCESSOR arm)
|
||||
set(CMAKE_C_COMPILER ${IOS_PLATFORMDIR}/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2)
|
||||
EOF
|
||||
|
||||
cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
|
||||
-DCMAKE_OSX_SYSROOT=${IOS_SYSROOT[0]} \
|
||||
[additional CMake flags] {source_directory}
|
||||
make
|
||||
|
||||
#### Xcode 4.3-4.6 (LLVM-GCC)
|
||||
|
||||
Same as above, but replace the first line with:
|
||||
|
||||
IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform
|
||||
|
||||
#### Xcode 5 and later (Clang)
|
||||
|
||||
IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform
|
||||
IOS_SYSROOT=($IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk)
|
||||
export CFLAGS="-mfloat-abi=softfp -arch armv7 -miphoneos-version-min=3.0"
|
||||
export ASMFLAGS="-no-integrated-as"
|
||||
|
||||
cd {build_directory}
|
||||
|
||||
cat <<EOF >toolchain.cmake
|
||||
set(CMAKE_SYSTEM_NAME Darwin)
|
||||
set(CMAKE_SYSTEM_PROCESSOR arm)
|
||||
set(CMAKE_C_COMPILER /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang)
|
||||
EOF
|
||||
|
||||
cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
|
||||
-DCMAKE_OSX_SYSROOT=${IOS_SYSROOT[0]} \
|
||||
[additional CMake flags] {source_directory}
|
||||
make
|
||||
|
||||
|
||||
### Armv7s (32-bit)
|
||||
|
||||
**gas-preprocessor.pl required**
|
||||
|
||||
The following scripts demonstrate how to build libjpeg-turbo to run on the
|
||||
iPhone 5/iPad 4th Generation and newer:
|
||||
|
||||
#### Xcode 4.5-4.6 (LLVM-GCC)
|
||||
|
||||
IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform
|
||||
IOS_SYSROOT=($IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk)
|
||||
export CFLAGS="-Wall -mfloat-abi=softfp -march=armv7s -mcpu=swift -mtune=swift -mfpu=neon -miphoneos-version-min=6.0"
|
||||
|
||||
cd {build_directory}
|
||||
|
||||
cat <<EOF >toolchain.cmake
|
||||
set(CMAKE_SYSTEM_NAME Darwin)
|
||||
set(CMAKE_SYSTEM_PROCESSOR arm)
|
||||
set(CMAKE_C_COMPILER ${IOS_PLATFORMDIR}/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2)
|
||||
EOF
|
||||
|
||||
cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
|
||||
-DCMAKE_OSX_SYSROOT=${IOS_SYSROOT[0]} \
|
||||
[additional CMake flags] {source_directory}
|
||||
make
|
||||
|
||||
#### Xcode 5 and later (Clang)
|
||||
|
||||
Same as the Armv7 build procedure for Xcode 5 and later, except replace the
|
||||
compiler flags as follows:
|
||||
|
||||
export CFLAGS="-Wall -mfloat-abi=softfp -arch armv7s -miphoneos-version-min=6.0"
|
||||
|
||||
|
||||
### Armv8 (64-bit)
|
||||
|
||||
**gas-preprocessor.pl required if using Xcode < 6**
|
||||
**Xcode 5 or later required, Xcode 6.3.x or later recommended**
|
||||
|
||||
The following script demonstrates how to build libjpeg-turbo to run on the
|
||||
iPhone 5S/iPad Mini 2/iPad Air and newer.
|
||||
@@ -535,8 +455,9 @@ iPhone 5S/iPad Mini 2/iPad Air and newer.
|
||||
[additional CMake flags] {source_directory}
|
||||
make
|
||||
|
||||
Once built, lipo can be used to combine the Armv7, v7s, and/or v8 variants into
|
||||
a universal library.
|
||||
Replace `iPhoneOS` with `iPhoneSimulator` and `-miphoneos-version-min` with
|
||||
`-miphonesimulator-version-min` to build libjpeg-turbo for the iOS simulator on
|
||||
Macs with Apple silicon CPUs.
|
||||
|
||||
|
||||
Building libjpeg-turbo for Android
|
||||
@@ -548,6 +469,8 @@ Building libjpeg-turbo for Android platforms requires v13b or later of the
|
||||
|
||||
### Armv7 (32-bit)
|
||||
|
||||
**NDK r19 or later with Clang recommended**
|
||||
|
||||
The following is a general recipe script that can be modified for your specific
|
||||
needs.
|
||||
|
||||
@@ -573,6 +496,8 @@ needs.
|
||||
|
||||
### Armv8 (64-bit)
|
||||
|
||||
**Clang recommended**
|
||||
|
||||
The following is a general recipe script that can be modified for your specific
|
||||
needs.
|
||||
|
||||
@@ -747,44 +672,23 @@ Mac
|
||||
make dmg
|
||||
|
||||
Create Mac package/disk image. This requires pkgbuild and productbuild, which
|
||||
are installed by default on OS X 10.7 and later and which can be obtained by
|
||||
installing Xcode 3.2.6 (with the "Unix Development" option) on OS X 10.6.
|
||||
Packages built in this manner can be installed on OS X 10.5 and later, but they
|
||||
must be built on OS X 10.6 or later.
|
||||
are installed by default on OS X/macOS 10.7 and later.
|
||||
|
||||
make udmg
|
||||
In order to create a Mac package/disk image that contains universal
|
||||
x86-64/Arm binaries, set the following CMake variable:
|
||||
|
||||
This creates a Mac package/disk image that contains universal x86-64/i386/Arm
|
||||
binaries. The following CMake variables control which architectures are
|
||||
included in the universal binaries. Setting any of these variables to an empty
|
||||
string excludes that architecture from the package.
|
||||
* `ARMV8_BUILD`: Directory containing an Armv8 (64-bit) iOS or macOS build of
|
||||
libjpeg-turbo to include in the universal binaries
|
||||
|
||||
* `OSX_32BIT_BUILD`: Directory containing an i386 (32-bit) Mac build of
|
||||
libjpeg-turbo (default: *{source_directory}*/osxx86)
|
||||
* `IOS_ARMV7_BUILD`: Directory containing an Armv7 (32-bit) iOS build of
|
||||
libjpeg-turbo (default: *{source_directory}*/iosarmv7)
|
||||
* `IOS_ARMV7S_BUILD`: Directory containing an Armv7s (32-bit) iOS build of
|
||||
libjpeg-turbo (default: *{source_directory}*/iosarmv7s)
|
||||
* `IOS_ARMV8_BUILD`: Directory containing an Armv8 (64-bit) iOS build of
|
||||
libjpeg-turbo (default: *{source_directory}*/iosarmv8)
|
||||
|
||||
You should first use CMake to configure i386, Armv7, Armv7s, and/or Armv8
|
||||
sub-builds of libjpeg-turbo (see "Build Recipes" and "Building libjpeg-turbo
|
||||
for iOS" above) in build directories that match those specified in the
|
||||
aforementioned CMake variables. Next, configure the primary build of
|
||||
libjpeg-turbo as an out-of-tree build, and build it. Once the primary build
|
||||
has been built, run `make udmg` from the build directory. The packaging system
|
||||
will build the sub-builds, use lipo to combine them into a single set of
|
||||
universal binaries, then package the universal binaries in the same manner as
|
||||
`make dmg`.
|
||||
|
||||
|
||||
Cygwin
|
||||
------
|
||||
|
||||
make cygwinpkg
|
||||
|
||||
Build a Cygwin binary package.
|
||||
You should first use CMake to configure an Armv8 sub-build of libjpeg-turbo
|
||||
(see "Building libjpeg-turbo for iOS" above, if applicable) in a build
|
||||
directory that matches the one specified in the aforementioned CMake variable.
|
||||
Next, configure the primary (x86-64) build of libjpeg-turbo as an out-of-tree
|
||||
build, specifying the aforementioned CMake variable, and build it. Once the
|
||||
primary build has been built, run `make dmg` from the build directory. The
|
||||
packaging system will build the sub-build, use lipo to combine it with the
|
||||
primary build into a single set of universal binaries, then package the
|
||||
universal binaries.
|
||||
|
||||
|
||||
Windows
|
||||
|
||||
264
CMakeLists.txt
264
CMakeLists.txt
@@ -1,11 +1,17 @@
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
# When using CMake 3.4 and later, don't export symbols from executables unless
|
||||
# the CMAKE_ENABLE_EXPORTS variable is set.
|
||||
if(POLICY CMP0065)
|
||||
cmake_policy(SET CMP0065 NEW)
|
||||
endif()
|
||||
|
||||
if(CMAKE_EXECUTABLE_SUFFIX)
|
||||
set(CMAKE_EXECUTABLE_SUFFIX_TMP ${CMAKE_EXECUTABLE_SUFFIX})
|
||||
endif()
|
||||
|
||||
project(mozjpeg C)
|
||||
set(VERSION 4.0.2)
|
||||
set(VERSION 4.1.4)
|
||||
set(COPYRIGHT_YEAR "1991-2023")
|
||||
string(REPLACE "." ";" VERSION_TRIPLET ${VERSION})
|
||||
list(GET VERSION_TRIPLET 0 VERSION_MAJOR)
|
||||
list(GET VERSION_TRIPLET 1 VERSION_MINOR)
|
||||
@@ -25,6 +31,24 @@ pad_number(VERSION_MINOR 3)
|
||||
pad_number(VERSION_REVISION 3)
|
||||
set(LIBJPEG_TURBO_VERSION_NUMBER ${VERSION_MAJOR}${VERSION_MINOR}${VERSION_REVISION})
|
||||
|
||||
# CMake 3.14 and later sets CMAKE_MACOSX_BUNDLE to TRUE by default when
|
||||
# CMAKE_SYSTEM_NAME is iOS, tvOS, or watchOS, which breaks the libjpeg-turbo
|
||||
# build. (Specifically, when CMAKE_MACOSX_BUNDLE is TRUE, executables for
|
||||
# Apple platforms are built as application bundles, which causes CMake to
|
||||
# complain that our install() directives for executables do not specify a
|
||||
# BUNDLE DESTINATION. Even if CMake did not complain, building executables as
|
||||
# application bundles would break our iOS packages.)
|
||||
set(CMAKE_MACOSX_BUNDLE FALSE)
|
||||
|
||||
get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY
|
||||
GENERATOR_IS_MULTI_CONFIG)
|
||||
# If the GENERATOR_IS_MULTI_CONFIG property doesn't exist (CMake < 3.9), then
|
||||
# set the GENERATOR_IS_MULTI_CONFIG variable manually if the generator is
|
||||
# Visual Studio or Xcode (the only multi-config generators in CMake < 3.9).
|
||||
if(NOT GENERATOR_IS_MULTI_CONFIG AND (MSVC_IDE OR XCODE))
|
||||
set(GENERATOR_IS_MULTI_CONFIG TRUE)
|
||||
endif()
|
||||
|
||||
string(TIMESTAMP DEFAULT_BUILD "%Y%m%d")
|
||||
set(BUILD ${DEFAULT_BUILD} CACHE STRING "Build string (default: ${DEFAULT_BUILD})")
|
||||
|
||||
@@ -38,15 +62,24 @@ message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
|
||||
|
||||
message(STATUS "VERSION = ${VERSION}, BUILD = ${BUILD}")
|
||||
|
||||
include(cmakescripts/PackageInfo.cmake)
|
||||
|
||||
# Detect CPU type and whether we're building 64-bit or 32-bit code
|
||||
math(EXPR BITS "${CMAKE_SIZEOF_VOID_P} * 8")
|
||||
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} CMAKE_SYSTEM_PROCESSOR_LC)
|
||||
set(COUNT 1)
|
||||
foreach(ARCH ${CMAKE_OSX_ARCHITECTURES})
|
||||
if(COUNT GREATER 1)
|
||||
message(FATAL_ERROR "The libjpeg-turbo build system does not support multiple values in CMAKE_OSX_ARCHITECTURES.")
|
||||
endif()
|
||||
math(EXPR COUNT "${COUNT}+1")
|
||||
endforeach()
|
||||
if(CMAKE_SYSTEM_PROCESSOR_LC MATCHES "x86_64" OR
|
||||
CMAKE_SYSTEM_PROCESSOR_LC MATCHES "amd64" OR
|
||||
CMAKE_SYSTEM_PROCESSOR_LC MATCHES "i[0-9]86" OR
|
||||
CMAKE_SYSTEM_PROCESSOR_LC MATCHES "x86" OR
|
||||
CMAKE_SYSTEM_PROCESSOR_LC MATCHES "ia32")
|
||||
if(BITS EQUAL 64)
|
||||
if(BITS EQUAL 64 OR CMAKE_C_COMPILER_ABI MATCHES "ELF X32")
|
||||
set(CPU_TYPE x86_64)
|
||||
else()
|
||||
set(CPU_TYPE i386)
|
||||
@@ -55,18 +88,30 @@ if(CMAKE_SYSTEM_PROCESSOR_LC MATCHES "x86_64" OR
|
||||
set(CMAKE_SYSTEM_PROCESSOR ${CPU_TYPE})
|
||||
endif()
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR_LC STREQUAL "aarch64" OR
|
||||
CMAKE_SYSTEM_PROCESSOR_LC MATCHES "arm*")
|
||||
CMAKE_SYSTEM_PROCESSOR_LC MATCHES "^arm")
|
||||
if(BITS EQUAL 64)
|
||||
set(CPU_TYPE arm64)
|
||||
else()
|
||||
set(CPU_TYPE arm)
|
||||
endif()
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR_LC MATCHES "ppc*" OR
|
||||
CMAKE_SYSTEM_PROCESSOR_LC MATCHES "powerpc*")
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR_LC MATCHES "^ppc" OR
|
||||
CMAKE_SYSTEM_PROCESSOR_LC MATCHES "^powerpc")
|
||||
set(CPU_TYPE powerpc)
|
||||
else()
|
||||
set(CPU_TYPE ${CMAKE_SYSTEM_PROCESSOR_LC})
|
||||
endif()
|
||||
if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR
|
||||
CMAKE_OSX_ARCHITECTURES MATCHES "arm64" OR
|
||||
CMAKE_OSX_ARCHITECTURES MATCHES "i386")
|
||||
set(CPU_TYPE ${CMAKE_OSX_ARCHITECTURES})
|
||||
endif()
|
||||
if(CMAKE_OSX_ARCHITECTURES MATCHES "ppc")
|
||||
set(CPU_TYPE powerpc)
|
||||
endif()
|
||||
if(MSVC_IDE AND CMAKE_GENERATOR_PLATFORM MATCHES "arm64")
|
||||
set(CPU_TYPE arm64)
|
||||
endif()
|
||||
|
||||
message(STATUS "${BITS}-bit build (${CPU_TYPE})")
|
||||
|
||||
|
||||
@@ -84,7 +129,9 @@ if(WIN32)
|
||||
set(CMAKE_INSTALL_DEFAULT_PREFIX "${CMAKE_INSTALL_DEFAULT_PREFIX}64")
|
||||
endif()
|
||||
else()
|
||||
if(NOT CMAKE_INSTALL_DEFAULT_PREFIX)
|
||||
set(CMAKE_INSTALL_DEFAULT_PREFIX /opt/${CMAKE_PROJECT_NAME})
|
||||
endif()
|
||||
endif()
|
||||
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_DEFAULT_PREFIX}" CACHE PATH
|
||||
@@ -103,6 +150,8 @@ if(CMAKE_INSTALL_PREFIX STREQUAL "${CMAKE_INSTALL_DEFAULT_PREFIX}")
|
||||
if(UNIX AND NOT APPLE)
|
||||
if(BITS EQUAL 64)
|
||||
set(CMAKE_INSTALL_DEFAULT_LIBDIR "lib64")
|
||||
elseif(CMAKE_C_COMPILER_ABI MATCHES "ELF X32")
|
||||
set(CMAKE_INSTALL_DEFAULT_LIBDIR "libx32")
|
||||
else()
|
||||
set(CMAKE_INSTALL_DEFAULT_LIBDIR "lib32")
|
||||
endif()
|
||||
@@ -135,9 +184,9 @@ endforeach()
|
||||
|
||||
macro(boolean_number var)
|
||||
if(${var})
|
||||
set(${var} 1)
|
||||
set(${var} 1 ${ARGN})
|
||||
else()
|
||||
set(${var} 0)
|
||||
set(${var} 0 ${ARGN})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
@@ -155,8 +204,12 @@ option(WITH_ARITH_DEC "Include arithmetic decoding support when emulating the li
|
||||
boolean_number(WITH_ARITH_DEC)
|
||||
option(WITH_ARITH_ENC "Include arithmetic encoding support when emulating the libjpeg v6b API/ABI" FALSE)
|
||||
boolean_number(WITH_ARITH_ENC)
|
||||
option(WITH_JAVA "Build Java wrapper for the TurboJPEG API library (implies ENABLE_SHARED=1)" FALSE)
|
||||
boolean_number(WITH_JAVA)
|
||||
if(CMAKE_C_COMPILER_ABI MATCHES "ELF X32")
|
||||
set(WITH_JAVA 0)
|
||||
else()
|
||||
option(WITH_JAVA "Build Java wrapper for the TurboJPEG API library (implies ENABLE_SHARED=1)" FALSE)
|
||||
boolean_number(WITH_JAVA)
|
||||
endif()
|
||||
option(WITH_JPEG7 "Emulate libjpeg v7 API/ABI (this makes ${CMAKE_PROJECT_NAME} backward-incompatible with libjpeg v6b)" FALSE)
|
||||
boolean_number(WITH_JPEG7)
|
||||
option(WITH_JPEG8 "Emulate libjpeg v8 API/ABI (this makes ${CMAKE_PROJECT_NAME} backward-incompatible with libjpeg v6b)" FALSE)
|
||||
@@ -167,6 +220,7 @@ option(WITH_SIMD "Include SIMD extensions, if available for this platform" TRUE)
|
||||
boolean_number(WITH_SIMD)
|
||||
option(WITH_TURBOJPEG "Include the TurboJPEG API library and associated test programs" TRUE)
|
||||
boolean_number(WITH_TURBOJPEG)
|
||||
option(WITH_FUZZ "Build fuzz targets" FALSE)
|
||||
|
||||
macro(report_option var desc)
|
||||
if(${var})
|
||||
@@ -244,6 +298,16 @@ if(NOT WITH_JPEG8)
|
||||
report_option(WITH_MEM_SRCDST "In-memory source/destination managers")
|
||||
endif()
|
||||
|
||||
# 0: Original libjpeg v6b/v7/v8 API/ABI
|
||||
#
|
||||
# libjpeg v6b/v7 API/ABI emulation:
|
||||
# 1: + In-memory source/destination managers (libjpeg-turbo 1.3.x)
|
||||
# 2: + Partial image decompression functions (libjpeg-turbo 1.5.x)
|
||||
# 3: + ICC functions (libjpeg-turbo 2.0.x)
|
||||
#
|
||||
# libjpeg v8 API/ABI emulation:
|
||||
# 1: + Partial image decompression functions (libjpeg-turbo 1.5.x)
|
||||
# 2: + ICC functions (libjpeg-turbo 2.0.x)
|
||||
set(SO_AGE 2)
|
||||
if(WITH_MEM_SRCDST)
|
||||
set(SO_AGE 3)
|
||||
@@ -294,9 +358,21 @@ message(STATUS "libjpeg API shared library version = ${SO_MAJOR_VERSION}.${SO_AG
|
||||
# names of functions whenever they are modified in a backward-incompatible
|
||||
# manner, it is always backward-ABI-compatible with itself, so the major and
|
||||
# minor SO versions don't change. However, we increase the middle number (the
|
||||
# SO "age") whenever functions are added to the API.
|
||||
# SO "age") whenever functions are added to the API, because adding functions
|
||||
# affects forward API/ABI compatibility.
|
||||
set(TURBOJPEG_SO_MAJOR_VERSION 0)
|
||||
set(TURBOJPEG_SO_VERSION 0.2.0)
|
||||
# 0: TurboJPEG 1.3.x API
|
||||
# 1: TurboJPEG 1.4.x API
|
||||
# The TurboJPEG 1.5.x API modified some of the function prototypes, adding
|
||||
# the const keyword in front of pointers to unmodified buffers, but that did
|
||||
# not affect forward API/ABI compatibility.
|
||||
# 2: TurboJPEG 2.0.x API
|
||||
# The TurboJPEG 2.1.x API modified the behavior of the tjDecompressHeader3()
|
||||
# function so that it accepts "abbreviated table specification" (AKA
|
||||
# "tables-only") datastreams as well as JPEG images, but that did not affect
|
||||
# forward API/ABI compatibility.
|
||||
set(TURBOJPEG_SO_AGE 2)
|
||||
set(TURBOJPEG_SO_VERSION 0.${TURBOJPEG_SO_AGE}.0)
|
||||
|
||||
|
||||
###############################################################################
|
||||
@@ -316,7 +392,7 @@ if(MSVC)
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3 /wd4996")
|
||||
add_definitions(-D_CRT_NONSTDC_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
@@ -366,34 +442,6 @@ if(MSVC)
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
# Check for headers
|
||||
check_include_files(locale.h HAVE_LOCALE_H)
|
||||
check_include_files(stddef.h HAVE_STDDEF_H)
|
||||
check_include_files(stdlib.h HAVE_STDLIB_H)
|
||||
check_include_files(sys/types.h NEED_SYS_TYPES_H)
|
||||
|
||||
# Check for functions
|
||||
include(CheckSymbolExists)
|
||||
check_symbol_exists(memset string.h HAVE_MEMSET)
|
||||
check_symbol_exists(memcpy string.h HAVE_MEMCPY)
|
||||
if(NOT HAVE_MEMSET AND NOT HAVE_MEMCPY)
|
||||
set(NEED_BSD_STRINGS 1)
|
||||
endif()
|
||||
|
||||
# Check for types
|
||||
check_type_size("unsigned char" UNSIGNED_CHAR)
|
||||
check_type_size("unsigned short" UNSIGNED_SHORT)
|
||||
|
||||
# Check for compiler features
|
||||
check_c_source_compiles("int main(void) { typedef struct undefined_structure *undef_struct_ptr; undef_struct_ptr ptr = 0; return ptr != 0; }"
|
||||
INCOMPLETE_TYPES)
|
||||
if(INCOMPLETE_TYPES)
|
||||
message(STATUS "Compiler supports pointers to undefined structures.")
|
||||
else()
|
||||
set(INCOMPLETE_TYPES_BROKEN 1)
|
||||
message(STATUS "Compiler does not support pointers to undefined structures.")
|
||||
endif()
|
||||
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
set(RIGHT_SHIFT_IS_UNSIGNED 0)
|
||||
else()
|
||||
@@ -418,13 +466,6 @@ if(UNIX)
|
||||
exit(is_shifting_signed(-0x7F7E80B1L));
|
||||
}" RIGHT_SHIFT_IS_UNSIGNED)
|
||||
endif()
|
||||
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
set(__CHAR_UNSIGNED__ 0)
|
||||
else()
|
||||
check_c_source_runs("int main(void) { return ((char) -1 < 0); }"
|
||||
__CHAR_UNSIGNED__)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
@@ -455,19 +496,17 @@ if(NOT INLINE_WORKS)
|
||||
endif()
|
||||
message(STATUS "INLINE = ${INLINE} (FORCE_INLINE = ${FORCE_INLINE})")
|
||||
|
||||
if(WITH_TURBOJPEG)
|
||||
if(MSVC)
|
||||
if(MSVC)
|
||||
set(THREAD_LOCAL "__declspec(thread)")
|
||||
else()
|
||||
else()
|
||||
set(THREAD_LOCAL "__thread")
|
||||
endif()
|
||||
check_c_source_compiles("${THREAD_LOCAL} int i; int main(void) { i = 0; return i; }" HAVE_THREAD_LOCAL)
|
||||
if(HAVE_THREAD_LOCAL)
|
||||
endif()
|
||||
check_c_source_compiles("${THREAD_LOCAL} int i; int main(void) { i = 0; return i; }" HAVE_THREAD_LOCAL)
|
||||
if(HAVE_THREAD_LOCAL)
|
||||
message(STATUS "THREAD_LOCAL = ${THREAD_LOCAL}")
|
||||
else()
|
||||
else()
|
||||
message(WARNING "Thread-local storage is not available. The TurboJPEG API library's global error handler will not be thread-safe.")
|
||||
unset(THREAD_LOCAL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
@@ -511,6 +550,7 @@ else()
|
||||
configure_file(jconfig.h.in jconfig.h)
|
||||
endif()
|
||||
configure_file(jconfigint.h.in jconfigint.h)
|
||||
configure_file(jversion.h.in jversion.h)
|
||||
if(UNIX)
|
||||
configure_file(libjpeg.map.in libjpeg.map)
|
||||
endif()
|
||||
@@ -550,6 +590,9 @@ endif()
|
||||
|
||||
if(WITH_SIMD)
|
||||
add_subdirectory(simd)
|
||||
if(NEON_INTRINSICS)
|
||||
add_definitions(-DNEON_INTRINSICS)
|
||||
endif()
|
||||
elseif(NOT WITH_12BIT)
|
||||
message(STATUS "SIMD extensions: None (WITH_SIMD = ${WITH_SIMD})")
|
||||
endif()
|
||||
@@ -560,6 +603,9 @@ if(WITH_SIMD)
|
||||
endif()
|
||||
else()
|
||||
add_library(simd OBJECT jsimd_none.c)
|
||||
if(NOT WIN32 AND (CMAKE_POSITION_INDEPENDENT_CODE OR ENABLE_SHARED))
|
||||
set_target_properties(simd PROPERTIES POSITION_INDEPENDENT_CODE 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_JAVA)
|
||||
@@ -589,6 +635,12 @@ if(WITH_TURBOJPEG)
|
||||
include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
|
||||
set(TJMAPFILE ${CMAKE_CURRENT_SOURCE_DIR}/turbojpeg-mapfile.jni)
|
||||
endif()
|
||||
if(MSVC)
|
||||
configure_file(${CMAKE_SOURCE_DIR}/win/turbojpeg.rc.in
|
||||
${CMAKE_BINARY_DIR}/win/turbojpeg.rc)
|
||||
set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES}
|
||||
${CMAKE_BINARY_DIR}/win/turbojpeg.rc)
|
||||
endif()
|
||||
add_library(turbojpeg SHARED ${TURBOJPEG_SOURCES})
|
||||
set_property(TARGET turbojpeg PROPERTY COMPILE_FLAGS
|
||||
"-DBMP_SUPPORTED -DPPM_SUPPORTED")
|
||||
@@ -729,9 +781,15 @@ add_executable(wrjpgcom wrjpgcom.c)
|
||||
# TESTS
|
||||
###############################################################################
|
||||
|
||||
if(WITH_FUZZ)
|
||||
add_subdirectory(fuzz)
|
||||
endif()
|
||||
|
||||
add_executable(strtest strtest.c)
|
||||
|
||||
add_subdirectory(md5)
|
||||
|
||||
if(MSVC_IDE OR XCODE)
|
||||
if(GENERATOR_IS_MULTI_CONFIG)
|
||||
set(OBJDIR "\${CTEST_CONFIGURATION_TYPE}/")
|
||||
else()
|
||||
set(OBJDIR "")
|
||||
@@ -746,8 +804,10 @@ if(WITH_12BIT)
|
||||
set(MD5_PPM_RGB_ISLOW f3301d2219783b8b3d942b7239fa50c0)
|
||||
set(MD5_JPEG_422_IFAST_OPT 7322e3bd2f127f7de4b40d4480ce60e4)
|
||||
set(MD5_PPM_422_IFAST 79807fa552899e66a04708f533e16950)
|
||||
set(MD5_JPEG_440_ISLOW e25c1912e38367be505a89c410c1c2d2)
|
||||
set(MD5_PPM_440_ISLOW e7d2e26288870cfcb30f3114ad01e380)
|
||||
set(MD5_PPM_422M_IFAST 07737bfe8a7c1c87aaa393a0098d16b0)
|
||||
set(MD5_JPEG_420_IFAST_Q100_PROG 008ab68d6ddbba04a8f01deee4e0f9f8)
|
||||
set(MD5_JPEG_420_IFAST_Q100_PROG 9447cef4803d9b0f74bcf333cc710a29)
|
||||
set(MD5_PPM_420_Q100_IFAST 1b3730122709f53d007255e8dfd3305e)
|
||||
set(MD5_PPM_420M_Q100_IFAST 980a1a3c5bf9510022869d30b7d26566)
|
||||
set(MD5_JPEG_GRAY_ISLOW 235c90707b16e2e069f37c888b2636d9)
|
||||
@@ -795,10 +855,12 @@ else()
|
||||
set(MD5_BMP_RGB_ISLOW_565D 4cfa0928ef3e6bb626d7728c924cfda4)
|
||||
set(MD5_JPEG_422_IFAST_OPT 2540287b79d913f91665e660303ab2c8)
|
||||
set(MD5_PPM_422_IFAST 35bd6b3f833bad23de82acea847129fa)
|
||||
set(MD5_JPEG_440_ISLOW 368200a98a9d5041170a6232491522f9)
|
||||
set(MD5_PPM_440_ISLOW 59d718725c83d37a0b59b7e4e355d2fb)
|
||||
set(MD5_PPM_422M_IFAST 8dbc65323d62cca7c91ba02dd1cfa81d)
|
||||
set(MD5_BMP_422M_IFAST_565 3294bd4d9a1f2b3d08ea6020d0db7065)
|
||||
set(MD5_BMP_422M_IFAST_565D da98c9c7b6039511be4a79a878a9abc1)
|
||||
set(MD5_JPEG_420_IFAST_Q100_PROG e59bb462016a8d9a748c330a3474bb55)
|
||||
set(MD5_JPEG_420_IFAST_Q100_PROG 0ba15f9dab81a703505f835f9dbbac6d)
|
||||
set(MD5_PPM_420_Q100_IFAST 5a732542015c278ff43635e473a8a294)
|
||||
set(MD5_PPM_420M_Q100_IFAST ff692ee9323a3b424894862557c092f1)
|
||||
set(MD5_JPEG_GRAY_ISLOW 72b51f894b8f4a10b3ee3066770aa38d)
|
||||
@@ -824,29 +886,7 @@ else()
|
||||
set(MD5_PPM_3x2_IFAST fd283664b3b49127984af0a7f118fccd)
|
||||
set(MD5_JPEG_420_ISLOW_ARI e986fb0a637a8d833d96e8a6d6d84ea1)
|
||||
set(MD5_JPEG_444_ISLOW_PROGARI 0a8f1c8f66e113c3cf635df0a475a617)
|
||||
# Since v1.5.1, libjpeg-turbo uses the separate non-fancy upsampling and
|
||||
# YCbCr -> RGB color conversion routines rather than merged upsampling/color
|
||||
# conversion when fancy upsampling is disabled on platforms that have a SIMD
|
||||
# implementation of YCbCr -> RGB color conversion but no SIMD implementation
|
||||
# of merged upsampling/color conversion. This was intended to improve the
|
||||
# performance of the Arm Neon SIMD extensions, the only SIMD extensions for
|
||||
# which those circumstances currently apply. The separate non-fancy
|
||||
# upsampling and color conversion routines usually produce bitwise-identical
|
||||
# output to the merged upsampling/color conversion routines, but that is not
|
||||
# the case when skipping scanlines starting at an odd-numbered scanline. In
|
||||
# libjpeg-turbo 2.0.5 and prior, doing that while using merged h2v2
|
||||
# upsampling caused a segfault, so this test validates the fix for that
|
||||
# segfault. Unfortunately, however, the test also produces different bitwise
|
||||
# output when using the Neon SIMD extensions, because of the aforementioned
|
||||
# optimization. The easiest workaround is to use the old test from
|
||||
# libjpeg-turbo 2.0.5 and prior when using the Neon SIMD extensions. The
|
||||
# aforementioned segfault never would have occurred with the Neon SIMD
|
||||
# extensions anyhow, since merged upsampling is disabled when using them.
|
||||
if((CPU_TYPE STREQUAL "arm64" OR CPU_TYPE STREQUAL "arm") AND WITH_SIMD)
|
||||
set(MD5_PPM_420M_IFAST_ARI 72b59a99bcf1de24c5b27d151bde2437)
|
||||
else()
|
||||
set(MD5_PPM_420M_IFAST_ARI 57251da28a35b46eecb7177d82d10e0e)
|
||||
endif()
|
||||
set(MD5_JPEG_420_ISLOW 9a68f56bc76e466aa7e52f415d0f4a5f)
|
||||
set(MD5_PPM_420M_ISLOW_2_1 9f9de8c0612f8d06869b960b05abf9c9)
|
||||
set(MD5_PPM_420M_ISLOW_15_8 b6875bc070720b899566cc06459b63b7)
|
||||
@@ -945,16 +985,14 @@ if(CPU_TYPE STREQUAL "x86_64" OR CPU_TYPE STREQUAL "i386")
|
||||
set(DEFAULT_FLOATTEST sse)
|
||||
elseif(CPU_TYPE STREQUAL "x86_64")
|
||||
set(DEFAULT_FLOATTEST no-fp-contract)
|
||||
elseif(CPU_TYPE STREQUAL "i386" AND MSVC)
|
||||
set(DEFAULT_FLOATTEST msvc)
|
||||
# else we can't really set an intelligent default for i386. The appropriate
|
||||
# value could be 387, no-fp-contract, or fp-contract, depending on the
|
||||
# value could be no-fp-contract, fp-contract, 387, or msvc, depending on the
|
||||
# compiler and compiler options. We leave it to the user to set FLOATTEST
|
||||
# manually.
|
||||
endif()
|
||||
else()
|
||||
if((CPU_TYPE STREQUAL "powerpc" OR CPU_TYPE STREQUAL "arm64") AND
|
||||
NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
NOT CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT MSVC)
|
||||
set(DEFAULT_FLOATTEST fp-contract)
|
||||
else()
|
||||
set(DEFAULT_FLOATTEST no-fp-contract)
|
||||
@@ -1101,6 +1139,16 @@ foreach(libtype ${TEST_LIBTYPES})
|
||||
testout_422_ifast.ppm testout_422_ifast_opt.jpg
|
||||
${MD5_PPM_422_IFAST} cjpeg-${libtype}-422-ifast-opt)
|
||||
|
||||
# CC: RGB->YCC SAMP: fullsize/h1v2 FDCT: islow ENT: huff
|
||||
add_bittest(cjpeg 440-islow "-sample;1x2;-dct;int"
|
||||
testout_440_islow.jpg ${TESTIMAGES}/testorig.ppm
|
||||
${MD5_JPEG_440_ISLOW})
|
||||
|
||||
# CC: YCC->RGB SAMP: fullsize/h1v2 fancy IDCT: islow ENT: huff
|
||||
add_bittest(djpeg 440-islow "-dct;int"
|
||||
testout_440_islow.ppm testout_440_islow.jpg
|
||||
${MD5_PPM_440_ISLOW} cjpeg-${libtype}-440-islow)
|
||||
|
||||
# CC: YCC->RGB SAMP: h2v1 merged IDCT: ifast ENT: huff
|
||||
add_bittest(djpeg 422m-ifast "-dct;fast;-nosmooth"
|
||||
testout_422m_ifast.ppm testout_422_ifast_opt.jpg
|
||||
@@ -1196,7 +1244,7 @@ foreach(libtype ${TEST_LIBTYPES})
|
||||
testout_420_islow_ari.jpg ${TESTIMAGES}/testorig.ppm
|
||||
${MD5_JPEG_420_ISLOW_ARI})
|
||||
|
||||
add_bittest(jpegtran 420-islow-ari "--revert;arithmetic"
|
||||
add_bittest(jpegtran 420-islow-ari "-revert;-arithmetic"
|
||||
testout_420_islow_ari2.jpg ${TESTIMAGES}/testimgint.jpg
|
||||
${MD5_JPEG_420_ISLOW_ARI})
|
||||
|
||||
@@ -1209,17 +1257,9 @@ foreach(libtype ${TEST_LIBTYPES})
|
||||
|
||||
if(WITH_ARITH_DEC)
|
||||
# CC: RGB->YCC SAMP: h2v2 merged IDCT: ifast ENT: arith
|
||||
if((CPU_TYPE STREQUAL "arm64" OR CPU_TYPE STREQUAL "arm") AND WITH_SIMD)
|
||||
# Refer to the comment above the definition of MD5_PPM_420M_IFAST_ARI for
|
||||
# an explanation of why this is necessary.
|
||||
add_bittest(djpeg 420m-ifast-ari "-fast;-ppm"
|
||||
testout_420m_ifast_ari.ppm ${TESTIMAGES}/testimgari.jpg
|
||||
${MD5_PPM_420M_IFAST_ARI})
|
||||
else()
|
||||
add_bittest(djpeg 420m-ifast-ari "-fast;-skip;1,20;-ppm"
|
||||
testout_420m_ifast_ari.ppm ${TESTIMAGES}/testimgari.jpg
|
||||
${MD5_PPM_420M_IFAST_ARI})
|
||||
endif()
|
||||
|
||||
add_bittest(jpegtran 420-islow "-revert"
|
||||
testout_420_islow.jpg ${TESTIMAGES}/testimgari.jpg
|
||||
@@ -1388,14 +1428,15 @@ if(WITH_TURBOJPEG)
|
||||
COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest.java -yuv
|
||||
COMMAND echo tjbenchtest.java -progressive
|
||||
COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest.java -progressive
|
||||
COMMAND echo tjexampletest.java -progressive -yuv
|
||||
COMMAND echo tjbenchtest.java -progressive -yuv
|
||||
COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest.java
|
||||
-progressive -yuv
|
||||
COMMAND echo tjexampletest.java
|
||||
COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjexampletest.java
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest
|
||||
${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest.java
|
||||
${CMAKE_CURRENT_BINARY_DIR}/tjexampletest)
|
||||
${CMAKE_CURRENT_BINARY_DIR}/tjexampletest
|
||||
${CMAKE_CURRENT_BINARY_DIR}/tjexampletest.java)
|
||||
else()
|
||||
add_custom_target(tjtest
|
||||
COMMAND echo tjbenchtest
|
||||
@@ -1412,7 +1453,8 @@ if(WITH_TURBOJPEG)
|
||||
COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest -progressive -yuv
|
||||
COMMAND echo tjexampletest
|
||||
COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjexampletest
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest)
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest
|
||||
${CMAKE_CURRENT_BINARY_DIR}/tjexampletest)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -1425,10 +1467,13 @@ set(EXE ${CMAKE_EXECUTABLE_SUFFIX})
|
||||
|
||||
if(WITH_TURBOJPEG)
|
||||
if(ENABLE_SHARED)
|
||||
install(TARGETS turbojpeg tjbench
|
||||
install(TARGETS turbojpeg EXPORT ${CMAKE_PROJECT_NAME}Targets
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
install(TARGETS tjbench
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
if(NOT CMAKE_VERSION VERSION_LESS "3.1" AND MSVC AND
|
||||
CMAKE_C_LINKER_SUPPORTS_PDB)
|
||||
install(FILES "$<TARGET_PDB_FILE:turbojpeg>"
|
||||
@@ -1436,10 +1481,11 @@ if(WITH_TURBOJPEG)
|
||||
endif()
|
||||
endif()
|
||||
if(ENABLE_STATIC)
|
||||
install(TARGETS turbojpeg-static ARCHIVE
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install(TARGETS turbojpeg-static EXPORT ${CMAKE_PROJECT_NAME}Targets
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
if(NOT ENABLE_SHARED)
|
||||
if(MSVC_IDE OR XCODE)
|
||||
if(GENERATOR_IS_MULTI_CONFIG)
|
||||
set(DIR "${CMAKE_CURRENT_BINARY_DIR}/\${CMAKE_INSTALL_CONFIG_NAME}")
|
||||
else()
|
||||
set(DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
@@ -1453,9 +1499,11 @@ if(WITH_TURBOJPEG)
|
||||
endif()
|
||||
|
||||
if(ENABLE_STATIC)
|
||||
install(TARGETS jpeg-static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install(TARGETS jpeg-static EXPORT ${CMAKE_PROJECT_NAME}Targets
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
if(NOT ENABLE_SHARED)
|
||||
if(MSVC_IDE OR XCODE)
|
||||
if(GENERATOR_IS_MULTI_CONFIG)
|
||||
set(DIR "${CMAKE_CURRENT_BINARY_DIR}/\${CMAKE_INSTALL_CONFIG_NAME}")
|
||||
else()
|
||||
set(DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
@@ -1491,8 +1539,18 @@ if(UNIX OR MINGW)
|
||||
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
||||
endif()
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgscripts/libjpeg.pc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/pkgscripts/libturbojpeg.pc
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
if(WITH_TURBOJPEG)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgscripts/libturbojpeg.pc
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
endif()
|
||||
install(FILES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/pkgscripts/${CMAKE_PROJECT_NAME}Config.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/pkgscripts/${CMAKE_PROJECT_NAME}ConfigVersion.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CMAKE_PROJECT_NAME})
|
||||
install(EXPORT ${CMAKE_PROJECT_NAME}Targets
|
||||
NAMESPACE ${CMAKE_PROJECT_NAME}::
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CMAKE_PROJECT_NAME})
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/jconfig.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/jerror.h ${CMAKE_CURRENT_SOURCE_DIR}/jmorecfg.h
|
||||
|
||||
428
ChangeLog.md
428
ChangeLog.md
@@ -1,3 +1,395 @@
|
||||
2.1.5.1
|
||||
=======
|
||||
|
||||
### Significant changes relative to 2.1.5:
|
||||
|
||||
1. The SIMD dispatchers in libjpeg-turbo 2.1.4 and prior stored the list of
|
||||
supported SIMD instruction sets in a global variable, which caused an innocuous
|
||||
race condition whereby the variable could have been initialized multiple times
|
||||
if `jpeg_start_*compress()` was called simultaneously in multiple threads.
|
||||
libjpeg-turbo 2.1.5 included an undocumented attempt to fix this race condition
|
||||
by making the SIMD support variable thread-local. However, that caused another
|
||||
issue whereby, if `jpeg_start_*compress()` was called in one thread and
|
||||
`jpeg_read_*()` or `jpeg_write_*()` was called in a second thread, the SIMD
|
||||
support variable was never initialized in the second thread. On x86 systems,
|
||||
this led the second thread to incorrectly assume that AVX2 instructions were
|
||||
always available, and when it attempted to use those instructions on older x86
|
||||
CPUs that do not support them, an illegal instruction error occurred. The SIMD
|
||||
dispatchers now ensure that the SIMD support variable is initialized before
|
||||
dispatching based on its value.
|
||||
|
||||
|
||||
2.1.5
|
||||
=====
|
||||
|
||||
### Significant changes relative to 2.1.4:
|
||||
|
||||
1. Fixed issues in the build system whereby, when using the Ninja Multi-Config
|
||||
CMake generator, a static build of libjpeg-turbo (a build in which
|
||||
`ENABLE_SHARED` is `0`) could not be installed, a Windows installer could not
|
||||
be built, and the Java regression tests failed.
|
||||
|
||||
2. Fixed a regression introduced by 2.0 beta1[15] that caused a buffer overrun
|
||||
in the progressive Huffman encoder when attempting to transform a
|
||||
specially-crafted malformed 12-bit-per-component JPEG image into a progressive
|
||||
12-bit-per-component JPEG image using a 12-bit-per-component build of
|
||||
libjpeg-turbo (`-DWITH_12BIT=1`.) Given that the buffer overrun was fully
|
||||
contained within the progressive Huffman encoder structure and did not cause a
|
||||
segfault or other user-visible errant behavior, given that the lossless
|
||||
transformer (unlike the decompressor) is not generally exposed to arbitrary
|
||||
data exploits, and given that 12-bit-per-component builds of libjpeg-turbo are
|
||||
uncommon, this issue did not likely pose a security risk.
|
||||
|
||||
3. Fixed an issue whereby, when using a 12-bit-per-component build of
|
||||
libjpeg-turbo (`-DWITH_12BIT=1`), passing samples with values greater than 4095
|
||||
or less than 0 to `jpeg_write_scanlines()` caused a buffer overrun or underrun
|
||||
in the RGB-to-YCbCr color converter.
|
||||
|
||||
4. Fixed a floating point exception that occurred when attempting to use the
|
||||
jpegtran `-drop` and `-trim` options to losslessly transform a
|
||||
specially-crafted malformed JPEG image.
|
||||
|
||||
5. Fixed an issue in `tjBufSizeYUV2()` whereby it returned a bogus result,
|
||||
rather than throwing an error, if the `align` parameter was not a power of 2.
|
||||
Fixed a similar issue in `tjCompressFromYUV()` whereby it generated a corrupt
|
||||
JPEG image in certain cases, rather than throwing an error, if the `align`
|
||||
parameter was not a power of 2.
|
||||
|
||||
6. Fixed an issue whereby `tjDecompressToYUV2()`, which is a wrapper for
|
||||
`tjDecompressToYUVPlanes()`, used the desired YUV image dimensions rather than
|
||||
the actual scaled image dimensions when computing the plane pointers and
|
||||
strides to pass to `tjDecompressToYUVPlanes()`. This caused a buffer overrun
|
||||
and subsequent segfault if the desired image dimensions exceeded the scaled
|
||||
image dimensions.
|
||||
|
||||
7. Fixed an issue whereby, when decompressing a 12-bit-per-component JPEG image
|
||||
(`-DWITH_12BIT=1`) using an alpha-enabled output color space such as
|
||||
`JCS_EXT_RGBA`, the alpha channel was set to 255 rather than 4095.
|
||||
|
||||
8. Fixed an issue whereby the Java version of TJBench did not accept a range of
|
||||
quality values.
|
||||
|
||||
9. Fixed an issue whereby, when `-progressive` was passed to TJBench, the JPEG
|
||||
input image was not transformed into a progressive JPEG image prior to
|
||||
decompression.
|
||||
|
||||
|
||||
2.1.4
|
||||
=====
|
||||
|
||||
### Significant changes relative to 2.1.3:
|
||||
|
||||
1. Fixed a regression introduced in 2.1.3 that caused build failures with
|
||||
Visual Studio 2010.
|
||||
|
||||
2. The `tjDecompressHeader3()` function in the TurboJPEG C API and the
|
||||
`TJDecompressor.setSourceImage()` method in the TurboJPEG Java API now accept
|
||||
"abbreviated table specification" (AKA "tables-only") datastreams, which can be
|
||||
used to prime the decompressor with quantization and Huffman tables that can be
|
||||
used when decompressing subsequent "abbreviated image" datastreams.
|
||||
|
||||
3. libjpeg-turbo now performs run-time detection of AltiVec instructions on
|
||||
OS X/PowerPC systems if AltiVec instructions are not enabled at compile time.
|
||||
This allows both AltiVec-equipped (PowerPC G4 and G5) and non-AltiVec-equipped
|
||||
(PowerPC G3) CPUs to be supported using the same build of libjpeg-turbo.
|
||||
|
||||
4. Fixed an error ("Bogus virtual array access") that occurred when attempting
|
||||
to decompress a progressive JPEG image with a height less than or equal to one
|
||||
iMCU (8 * the vertical sampling factor) using buffered-image mode with
|
||||
interblock smoothing enabled. This was a regression introduced by
|
||||
2.1 beta1[6(b)].
|
||||
|
||||
5. Fixed two issues that prevented partial image decompression from working
|
||||
properly with buffered-image mode:
|
||||
|
||||
- Attempting to call `jpeg_crop_scanline()` after
|
||||
`jpeg_start_decompress()` but before `jpeg_start_output()` resulted in an error
|
||||
("Improper call to JPEG library in state 207".)
|
||||
- Attempting to use `jpeg_skip_scanlines()` resulted in an error ("Bogus
|
||||
virtual array access") under certain circumstances.
|
||||
|
||||
|
||||
2.1.3
|
||||
=====
|
||||
|
||||
### Significant changes relative to 2.1.2:
|
||||
|
||||
1. Fixed a regression introduced by 2.0 beta1[7] whereby cjpeg compressed PGM
|
||||
input files into full-color JPEG images unless the `-grayscale` option was
|
||||
used.
|
||||
|
||||
2. cjpeg now automatically compresses GIF and 8-bit BMP input files into
|
||||
grayscale JPEG images if the input files contain only shades of gray.
|
||||
|
||||
3. The build system now enables the intrinsics implementation of the AArch64
|
||||
(Arm 64-bit) Neon SIMD extensions by default when using GCC 12 or later.
|
||||
|
||||
4. Fixed a segfault that occurred while decompressing a 4:2:0 JPEG image using
|
||||
the merged (non-fancy) upsampling algorithms (that is, with
|
||||
`cinfo.do_fancy_upsampling` set to `FALSE`) along with `jpeg_crop_scanline()`.
|
||||
Specifically, the segfault occurred if the number of bytes remaining in the
|
||||
output buffer was less than the number of bytes required to represent one
|
||||
uncropped scanline of the output image. For that reason, the issue could only
|
||||
be reproduced using the libjpeg API, not using djpeg.
|
||||
|
||||
|
||||
2.1.2
|
||||
=====
|
||||
|
||||
### Significant changes relative to 2.1.1:
|
||||
|
||||
1. Fixed a regression introduced by 2.1 beta1[13] that caused the remaining
|
||||
GAS implementations of AArch64 (Arm 64-bit) Neon SIMD functions (which are used
|
||||
by default with GCC for performance reasons) to be placed in the `.rodata`
|
||||
section rather than in the `.text` section. This caused the GNU linker to
|
||||
automatically place the `.rodata` section in an executable segment, which
|
||||
prevented libjpeg-turbo from working properly with other linkers and also
|
||||
represented a potential security risk.
|
||||
|
||||
2. Fixed an issue whereby the `tjTransform()` function incorrectly computed the
|
||||
MCU block size for 4:4:4 JPEG images with non-unary sampling factors and thus
|
||||
unduly rejected some cropping regions, even though those regions aligned with
|
||||
8x8 MCU block boundaries.
|
||||
|
||||
3. Fixed a regression introduced by 2.1 beta1[13] that caused the build system
|
||||
to enable the Arm Neon SIMD extensions when targetting Armv6 and other legacy
|
||||
architectures that do not support Neon instructions.
|
||||
|
||||
4. libjpeg-turbo now performs run-time detection of AltiVec instructions on
|
||||
FreeBSD/PowerPC systems if AltiVec instructions are not enabled at compile
|
||||
time. This allows both AltiVec-equipped and non-AltiVec-equipped CPUs to be
|
||||
supported using the same build of libjpeg-turbo.
|
||||
|
||||
5. cjpeg now accepts a `-strict` argument similar to that of djpeg and
|
||||
jpegtran, which causes the compressor to abort if an LZW-compressed GIF input
|
||||
image contains incomplete or corrupt image data.
|
||||
|
||||
|
||||
2.1.1
|
||||
=====
|
||||
|
||||
### Significant changes relative to 2.1.0:
|
||||
|
||||
1. Fixed a regression introduced in 2.1.0 that caused build failures with
|
||||
non-GCC-compatible compilers for Un*x/Arm platforms.
|
||||
|
||||
2. Fixed a regression introduced by 2.1 beta1[13] that prevented the Arm 32-bit
|
||||
(AArch32) Neon SIMD extensions from building unless the C compiler flags
|
||||
included `-mfloat-abi=softfp` or `-mfloat-abi=hard`.
|
||||
|
||||
3. Fixed an issue in the AArch32 Neon SIMD Huffman encoder whereby reliance on
|
||||
undefined C compiler behavior led to crashes ("SIGBUS: illegal alignment") on
|
||||
Android systems when running AArch32/Thumb builds of libjpeg-turbo built with
|
||||
recent versions of Clang.
|
||||
|
||||
4. Added a command-line argument (`-copy icc`) to jpegtran that causes it to
|
||||
copy only the ICC profile markers from the source file and discard any other
|
||||
metadata.
|
||||
|
||||
5. libjpeg-turbo should now build and run on CHERI-enabled architectures, which
|
||||
use capability pointers that are larger than the size of `size_t`.
|
||||
|
||||
6. Fixed a regression (CVE-2021-37972) introduced by 2.1 beta1[5] that caused a
|
||||
segfault in the 64-bit SSE2 Huffman encoder when attempting to losslessly
|
||||
transform a specially-crafted malformed JPEG image.
|
||||
|
||||
|
||||
2.1.0
|
||||
=====
|
||||
|
||||
### Significant changes relative to 2.1 beta1:
|
||||
|
||||
1. Fixed a regression introduced by 2.1 beta1[6(b)] whereby attempting to
|
||||
decompress certain progressive JPEG images with one or more component planes of
|
||||
width 8 or less caused a buffer overrun.
|
||||
|
||||
2. Fixed a regression introduced by 2.1 beta1[6(b)] whereby attempting to
|
||||
decompress a specially-crafted malformed progressive JPEG image caused the
|
||||
block smoothing algorithm to read from uninitialized memory.
|
||||
|
||||
3. Fixed an issue in the Arm Neon SIMD Huffman encoders that caused the
|
||||
encoders to generate incorrect results when using the Clang compiler with
|
||||
Visual Studio.
|
||||
|
||||
4. Fixed a floating point exception (CVE-2021-20205) that occurred when
|
||||
attempting to compress a specially-crafted malformed GIF image with a specified
|
||||
image width of 0 using cjpeg.
|
||||
|
||||
5. Fixed a regression introduced by 2.0 beta1[15] whereby attempting to
|
||||
generate a progressive JPEG image on an SSE2-capable CPU using a scan script
|
||||
containing one or more scans with lengths divisible by 32 and non-zero
|
||||
successive approximation low bit positions would, under certain circumstances,
|
||||
result in an error ("Missing Huffman code table entry") and an invalid JPEG
|
||||
image.
|
||||
|
||||
6. Introduced a new flag (`TJFLAG_LIMITSCANS` in the TurboJPEG C API and
|
||||
`TJ.FLAG_LIMIT_SCANS` in the TurboJPEG Java API) and a corresponding TJBench
|
||||
command-line argument (`-limitscans`) that causes the TurboJPEG decompression
|
||||
and transform functions/operations to return/throw an error if a progressive
|
||||
JPEG image contains an unreasonably large number of scans. This allows
|
||||
applications that use the TurboJPEG API to guard against an exploit of the
|
||||
progressive JPEG format described in the report
|
||||
["Two Issues with the JPEG Standard"](https://libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf).
|
||||
|
||||
7. The PPM reader now throws an error, rather than segfaulting (due to a buffer
|
||||
overrun, CVE-2021-46822) or generating incorrect pixels, if an application
|
||||
attempts to use the `tjLoadImage()` function to load a 16-bit binary PPM file
|
||||
(a binary PPM file with a maximum value greater than 255) into a grayscale
|
||||
image buffer or to load a 16-bit binary PGM file into an RGB image buffer.
|
||||
|
||||
8. Fixed an issue in the PPM reader that caused incorrect pixels to be
|
||||
generated when using the `tjLoadImage()` function to load a 16-bit binary PPM
|
||||
file into an extended RGB image buffer.
|
||||
|
||||
9. Fixed an issue whereby, if a JPEG buffer was automatically re-allocated by
|
||||
one of the TurboJPEG compression or transform functions and an error
|
||||
subsequently occurred during compression or transformation, the JPEG buffer
|
||||
pointer passed by the application was not updated when the function returned.
|
||||
|
||||
|
||||
2.0.90 (2.1 beta1)
|
||||
==================
|
||||
|
||||
### Significant changes relative to 2.0.6:
|
||||
|
||||
1. The build system, x86-64 SIMD extensions, and accelerated Huffman codec now
|
||||
support the x32 ABI on Linux, which allows for using x86-64 instructions with
|
||||
32-bit pointers. The x32 ABI is generally enabled by adding `-mx32` to the
|
||||
compiler flags.
|
||||
|
||||
Caveats:
|
||||
- CMake 3.9.0 or later is required in order for the build system to
|
||||
automatically detect an x32 build.
|
||||
- Java does not support the x32 ABI, and thus the TurboJPEG Java API will
|
||||
automatically be disabled with x32 builds.
|
||||
|
||||
2. Added Loongson MMI SIMD implementations of the RGB-to-grayscale, 4:2:2 fancy
|
||||
chroma upsampling, 4:2:2 and 4:2:0 merged chroma upsampling/color conversion,
|
||||
and fast integer DCT/IDCT algorithms. Relative to libjpeg-turbo 2.0.x, this
|
||||
speeds up:
|
||||
|
||||
- the compression of RGB source images into grayscale JPEG images by
|
||||
approximately 20%
|
||||
- the decompression of 4:2:2 JPEG images by approximately 40-60% when
|
||||
using fancy upsampling
|
||||
- the decompression of 4:2:2 and 4:2:0 JPEG images by approximately
|
||||
15-20% when using merged upsampling
|
||||
- the compression of RGB source images by approximately 30-45% when using
|
||||
the fast integer DCT
|
||||
- the decompression of JPEG images into RGB destination images by
|
||||
approximately 2x when using the fast integer IDCT
|
||||
|
||||
The overall decompression speedup for RGB images is now approximately
|
||||
2.3-3.7x (compared to 2-3.5x with libjpeg-turbo 2.0.x.)
|
||||
|
||||
3. 32-bit (Armv7 or Armv7s) iOS builds of libjpeg-turbo are no longer
|
||||
supported, and the libjpeg-turbo build system can no longer be used to package
|
||||
such builds. 32-bit iOS apps cannot run in iOS 11 and later, and the App Store
|
||||
no longer allows them.
|
||||
|
||||
4. 32-bit (i386) OS X/macOS builds of libjpeg-turbo are no longer supported,
|
||||
and the libjpeg-turbo build system can no longer be used to package such
|
||||
builds. 32-bit Mac applications cannot run in macOS 10.15 "Catalina" and
|
||||
later, and the App Store no longer allows them.
|
||||
|
||||
5. The SSE2 (x86 SIMD) and C Huffman encoding algorithms have been
|
||||
significantly optimized, resulting in a measured average overall compression
|
||||
speedup of 12-28% for 64-bit code and 22-52% for 32-bit code on various Intel
|
||||
and AMD CPUs, as well as a measured average overall compression speedup of
|
||||
0-23% on platforms that do not have a SIMD-accelerated Huffman encoding
|
||||
implementation.
|
||||
|
||||
6. The block smoothing algorithm that is applied by default when decompressing
|
||||
progressive Huffman-encoded JPEG images has been improved in the following
|
||||
ways:
|
||||
|
||||
- The algorithm is now more fault-tolerant. Previously, if a particular
|
||||
scan was incomplete, then the smoothing parameters for the incomplete scan
|
||||
would be applied to the entire output image, including the parts of the image
|
||||
that were generated by the prior (complete) scan. Visually, this had the
|
||||
effect of removing block smoothing from lower-frequency scans if they were
|
||||
followed by an incomplete higher-frequency scan. libjpeg-turbo now applies
|
||||
block smoothing parameters to each iMCU row based on which scan generated the
|
||||
pixels in that row, rather than always using the block smoothing parameters for
|
||||
the most recent scan.
|
||||
- When applying block smoothing to DC scans, a Gaussian-like kernel with a
|
||||
5x5 window is used to reduce the "blocky" appearance.
|
||||
|
||||
7. Added SIMD acceleration for progressive Huffman encoding on Arm platforms.
|
||||
This speeds up the compression of full-color progressive JPEGs by about 30-40%
|
||||
on average (relative to libjpeg-turbo 2.0.x) when using modern Arm CPUs.
|
||||
|
||||
8. Added configure-time and run-time auto-detection of Loongson MMI SIMD
|
||||
instructions, so that the Loongson MMI SIMD extensions can be included in any
|
||||
MIPS64 libjpeg-turbo build.
|
||||
|
||||
9. Added fault tolerance features to djpeg and jpegtran, mainly to demonstrate
|
||||
methods by which applications can guard against the exploits of the JPEG format
|
||||
described in the report
|
||||
["Two Issues with the JPEG Standard"](https://libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf).
|
||||
|
||||
- Both programs now accept a `-maxscans` argument, which can be used to
|
||||
limit the number of allowable scans in the input file.
|
||||
- Both programs now accept a `-strict` argument, which can be used to
|
||||
treat all warnings as fatal.
|
||||
|
||||
10. CMake package config files are now included for both the libjpeg and
|
||||
TurboJPEG API libraries. This facilitates using libjpeg-turbo with CMake's
|
||||
`find_package()` function. For example:
|
||||
|
||||
find_package(libjpeg-turbo CONFIG REQUIRED)
|
||||
|
||||
add_executable(libjpeg_program libjpeg_program.c)
|
||||
target_link_libraries(libjpeg_program PUBLIC libjpeg-turbo::jpeg)
|
||||
|
||||
add_executable(libjpeg_program_static libjpeg_program.c)
|
||||
target_link_libraries(libjpeg_program_static PUBLIC
|
||||
libjpeg-turbo::jpeg-static)
|
||||
|
||||
add_executable(turbojpeg_program turbojpeg_program.c)
|
||||
target_link_libraries(turbojpeg_program PUBLIC
|
||||
libjpeg-turbo::turbojpeg)
|
||||
|
||||
add_executable(turbojpeg_program_static turbojpeg_program.c)
|
||||
target_link_libraries(turbojpeg_program_static PUBLIC
|
||||
libjpeg-turbo::turbojpeg-static)
|
||||
|
||||
11. Since the Unisys LZW patent has long expired, cjpeg and djpeg can now
|
||||
read/write both LZW-compressed and uncompressed GIF files (feature ported from
|
||||
jpeg-6a and jpeg-9d.)
|
||||
|
||||
12. jpegtran now includes the `-wipe` and `-drop` options from jpeg-9a and
|
||||
jpeg-9d, as well as the ability to expand the image size using the `-crop`
|
||||
option. Refer to jpegtran.1 or usage.txt for more details.
|
||||
|
||||
13. Added a complete intrinsics implementation of the Arm Neon SIMD extensions,
|
||||
thus providing SIMD acceleration on Arm platforms for all of the algorithms
|
||||
that are SIMD-accelerated on x86 platforms. This new implementation is
|
||||
significantly faster in some cases than the old GAS implementation--
|
||||
depending on the algorithms used, the type of CPU core, and the compiler. GCC,
|
||||
as of this writing, does not provide a full or optimal set of Neon intrinsics,
|
||||
so for performance reasons, the default when building libjpeg-turbo with GCC is
|
||||
to continue using the GAS implementation of the following algorithms:
|
||||
|
||||
- 32-bit RGB-to-YCbCr color conversion
|
||||
- 32-bit fast and accurate inverse DCT
|
||||
- 64-bit RGB-to-YCbCr and YCbCr-to-RGB color conversion
|
||||
- 64-bit accurate forward and inverse DCT
|
||||
- 64-bit Huffman encoding
|
||||
|
||||
A new CMake variable (`NEON_INTRINSICS`) can be used to override this
|
||||
default.
|
||||
|
||||
Since the new intrinsics implementation includes SIMD acceleration
|
||||
for merged upsampling/color conversion, 1.5.1[5] is no longer necessary and has
|
||||
been reverted.
|
||||
|
||||
14. The Arm Neon SIMD extensions can now be built using Visual Studio.
|
||||
|
||||
15. The build system can now be used to generate a universal x86-64 + Armv8
|
||||
libjpeg-turbo SDK package for both iOS and macOS.
|
||||
|
||||
|
||||
2.0.6
|
||||
=====
|
||||
|
||||
@@ -9,11 +401,11 @@ methods in the TurboJPEG Java API.
|
||||
|
||||
2. Fixed or worked around multiple issues with `jpeg_skip_scanlines()`:
|
||||
|
||||
- Fixed segfaults or "Corrupt JPEG data: premature end of data segment"
|
||||
errors in `jpeg_skip_scanlines()` that occurred when decompressing 4:2:2 or
|
||||
4:2:0 JPEG images using merged (non-fancy) upsampling/color conversion (that
|
||||
is, when setting `cinfo.do_fancy_upsampling` to `FALSE`.) 2.0.0[6] was a
|
||||
similar fix, but it did not cover all cases.
|
||||
- Fixed segfaults (CVE-2020-35538) or "Corrupt JPEG data: premature end of
|
||||
data segment" errors in `jpeg_skip_scanlines()` that occurred when
|
||||
decompressing 4:2:2 or 4:2:0 JPEG images using merged (non-fancy)
|
||||
upsampling/color conversion (that is, when setting `cinfo.do_fancy_upsampling`
|
||||
to `FALSE`.) 2.0.0[6] was a similar fix, but it did not cover all cases.
|
||||
- `jpeg_skip_scanlines()` now throws an error if two-pass color
|
||||
quantization is enabled. Two-pass color quantization never worked properly
|
||||
with `jpeg_skip_scanlines()`, and the issues could not readily be fixed.
|
||||
@@ -88,15 +480,15 @@ JPEG images. This was known to cause a buffer overflow when attempting to
|
||||
decompress some such images using `tjDecompressToYUV2()` or
|
||||
`tjDecompressToYUVPlanes()`.
|
||||
|
||||
5. Fixed an issue, detected by ASan, whereby attempting to losslessly transform
|
||||
a specially-crafted malformed JPEG image containing an extremely-high-frequency
|
||||
coefficient block (junk image data that could never be generated by a
|
||||
legitimate JPEG compressor) could cause the Huffman encoder's local buffer to
|
||||
be overrun. (Refer to 1.4.0[9] and 1.4beta1[15].) Given that the buffer
|
||||
overrun was fully contained within the stack and did not cause a segfault or
|
||||
other user-visible errant behavior, and given that the lossless transformer
|
||||
(unlike the decompressor) is not generally exposed to arbitrary data exploits,
|
||||
this issue did not likely pose a security risk.
|
||||
5. Fixed an issue (CVE-2020-17541), detected by ASan, whereby attempting to
|
||||
losslessly transform a specially-crafted malformed JPEG image containing an
|
||||
extremely-high-frequency coefficient block (junk image data that could never be
|
||||
generated by a legitimate JPEG compressor) could cause the Huffman encoder's
|
||||
local buffer to be overrun. (Refer to 1.4.0[9] and 1.4beta1[15].) Given that
|
||||
the buffer overrun was fully contained within the stack and did not cause a
|
||||
segfault or other user-visible errant behavior, and given that the lossless
|
||||
transformer (unlike the decompressor) is not generally exposed to arbitrary
|
||||
data exploits, this issue did not likely pose a security risk.
|
||||
|
||||
6. The Arm 64-bit (Armv8) Neon SIMD assembly code now stores constants in a
|
||||
separate read-only data section rather than in the text section, to support
|
||||
@@ -384,7 +776,7 @@ algorithm that caused incorrect dithering in the output image. This algorithm
|
||||
now produces bitwise-identical results to the unmerged algorithms.
|
||||
|
||||
12. The SIMD function symbols for x86[-64]/ELF, MIPS/ELF, macOS/x86[-64] (if
|
||||
libjpeg-turbo is built with YASM), and iOS/Arm[64] builds are now private.
|
||||
libjpeg-turbo is built with Yasm), and iOS/Arm[64] builds are now private.
|
||||
This prevents those symbols from being exposed in applications or shared
|
||||
libraries that link statically with libjpeg-turbo.
|
||||
|
||||
@@ -1269,8 +1661,8 @@ either the fast or the accurate DCT/IDCT algorithms in the underlying codec.
|
||||
|
||||
### Significant changes relative to 1.2 beta1:
|
||||
|
||||
1. Fixed build issue with YASM on Unix systems (the libjpeg-turbo build system
|
||||
was not adding the current directory to the assembler include path, so YASM
|
||||
1. Fixed build issue with Yasm on Unix systems (the libjpeg-turbo build system
|
||||
was not adding the current directory to the assembler include path, so Yasm
|
||||
was not able to find jsimdcfg.inc.)
|
||||
|
||||
2. Fixed out-of-bounds read in SSE2 SIMD code that occurred when decompressing
|
||||
@@ -1338,7 +1730,7 @@ transposed or rotated 90 degrees.
|
||||
8. All legacy VirtualGL code has been re-factored, and this has allowed
|
||||
libjpeg-turbo, in its entirety, to be re-licensed under a BSD-style license.
|
||||
|
||||
9. libjpeg-turbo can now be built with YASM.
|
||||
9. libjpeg-turbo can now be built with Yasm.
|
||||
|
||||
10. Added SIMD acceleration for ARM Linux and iOS platforms that support
|
||||
NEON instructions.
|
||||
|
||||
@@ -91,7 +91,7 @@ best of our understanding.
|
||||
The Modified (3-clause) BSD License
|
||||
===================================
|
||||
|
||||
Copyright (C)2009-2020 D. R. Commander. All Rights Reserved.
|
||||
Copyright (C)2009-2023 D. R. Commander. All Rights Reserved.<br>
|
||||
Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -185,7 +185,7 @@ Integer Extension Parameters Supported by mozjpeg
|
||||
8 = Table from: An Improved Detection Model for DCT Coefficient Quantization
|
||||
(1993) Peterson, Ahumada and Watson
|
||||
|
||||
* JINT_DC_SCAN_OPT_MODE (default: 1)
|
||||
* JINT_DC_SCAN_OPT_MODE (default: 0)
|
||||
Specifies the DC scan optimization mode. The following options are
|
||||
available:
|
||||
0 = One scan for all components
|
||||
|
||||
15
README.ijg
15
README.ijg
@@ -128,7 +128,7 @@ with respect to this software, its quality, accuracy, merchantability, or
|
||||
fitness for a particular purpose. This software is provided "AS IS", and you,
|
||||
its user, assume the entire risk as to its quality and accuracy.
|
||||
|
||||
This software is copyright (C) 1991-2016, Thomas G. Lane, Guido Vollbeding.
|
||||
This software is copyright (C) 1991-2020, Thomas G. Lane, Guido Vollbeding.
|
||||
All Rights Reserved except as specified below.
|
||||
|
||||
Permission is hereby granted to use, copy, modify, and distribute this
|
||||
@@ -159,19 +159,6 @@ commercial products, provided that all warranty or liability claims are
|
||||
assumed by the product vendor.
|
||||
|
||||
|
||||
The IJG distribution formerly included code to read and write GIF files.
|
||||
To avoid entanglement with the Unisys LZW patent (now expired), GIF reading
|
||||
support has been removed altogether, and the GIF writer has been simplified
|
||||
to produce "uncompressed GIFs". This technique does not use the LZW
|
||||
algorithm; the resulting GIF files are larger than usual, but are readable
|
||||
by all standard GIF decoders.
|
||||
|
||||
We are required to state that
|
||||
"The Graphics Interchange Format(c) is the Copyright property of
|
||||
CompuServe Incorporated. GIF(sm) is a Service Mark property of
|
||||
CompuServe Incorporated."
|
||||
|
||||
|
||||
REFERENCES
|
||||
==========
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Mozilla JPEG Encoder Project [](https://ci.appveyor.com/project/kornel/mozjpeg-4ekrx)
|
||||
============================
|
||||
|
||||
MozJPEG improves JPEG compression efficiency achieving higher visual quality and smaller file sizes at the same time. It is compatible the JPEG standard, and the vast majority of the world's deployed JPEG decoders.
|
||||
MozJPEG improves JPEG compression efficiency achieving higher visual quality and smaller file sizes at the same time. It is compatible with the JPEG standard, and the vast majority of the world's deployed JPEG decoders.
|
||||
|
||||
MozJPEG is a patch for [libjpeg-turbo](https://github.com/libjpeg-turbo/libjpeg-turbo). **Please send pull requests to libjpeg-turbo** if the changes aren't specific to newly-added MozJPEG-only compression code. This project aims to keep differences with libjpeg-turbo minimal, so whenever possible, improvements and bug fixes should go there first.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
image: Visual Studio 2017
|
||||
image: Visual Studio 2019
|
||||
configuration: Release
|
||||
platform:
|
||||
- Win32
|
||||
|
||||
28
cderror.h
28
cderror.h
@@ -1,9 +1,11 @@
|
||||
/*
|
||||
* cderror.h
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1994-1997, Thomas G. Lane.
|
||||
* Modified 2009-2017 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2021, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -42,7 +44,7 @@ JMESSAGE(JMSG_FIRSTADDONCODE = 1000, NULL) /* Must be first entry! */
|
||||
|
||||
#ifdef BMP_SUPPORTED
|
||||
JMESSAGE(JERR_BMP_BADCMAP, "Unsupported BMP colormap format")
|
||||
JMESSAGE(JERR_BMP_BADDEPTH, "Only 8- and 24-bit BMP files are supported")
|
||||
JMESSAGE(JERR_BMP_BADDEPTH, "Only 8-, 24-, and 32-bit BMP files are supported")
|
||||
JMESSAGE(JERR_BMP_BADHEADER, "Invalid BMP file: bad header length")
|
||||
JMESSAGE(JERR_BMP_BADPLANES, "Invalid BMP file: biPlanes not equal to 1")
|
||||
JMESSAGE(JERR_BMP_COLORSPACE, "BMP output must be grayscale or RGB")
|
||||
@@ -50,9 +52,9 @@ JMESSAGE(JERR_BMP_COMPRESSED, "Sorry, compressed BMPs not yet supported")
|
||||
JMESSAGE(JERR_BMP_EMPTY, "Empty BMP image")
|
||||
JMESSAGE(JERR_BMP_NOT, "Not a BMP file - does not start with BM")
|
||||
JMESSAGE(JERR_BMP_OUTOFRANGE, "Numeric value out of range in BMP file")
|
||||
JMESSAGE(JTRC_BMP, "%ux%u 24-bit BMP image")
|
||||
JMESSAGE(JTRC_BMP, "%ux%u %d-bit BMP image")
|
||||
JMESSAGE(JTRC_BMP_MAPPED, "%ux%u 8-bit colormapped BMP image")
|
||||
JMESSAGE(JTRC_BMP_OS2, "%ux%u 24-bit OS2 BMP image")
|
||||
JMESSAGE(JTRC_BMP_OS2, "%ux%u %d-bit OS2 BMP image")
|
||||
JMESSAGE(JTRC_BMP_OS2_MAPPED, "%ux%u 8-bit colormapped OS2 BMP image")
|
||||
#endif /* BMP_SUPPORTED */
|
||||
|
||||
@@ -60,6 +62,7 @@ JMESSAGE(JTRC_BMP_OS2_MAPPED, "%ux%u 8-bit colormapped OS2 BMP image")
|
||||
JMESSAGE(JERR_GIF_BUG, "GIF output got confused")
|
||||
JMESSAGE(JERR_GIF_CODESIZE, "Bogus GIF codesize %d")
|
||||
JMESSAGE(JERR_GIF_COLORSPACE, "GIF output must be grayscale or RGB")
|
||||
JMESSAGE(JERR_GIF_EMPTY, "Empty GIF image")
|
||||
JMESSAGE(JERR_GIF_IMAGENOTFOUND, "Too few images in GIF file")
|
||||
JMESSAGE(JERR_GIF_NOT, "Not a GIF file")
|
||||
JMESSAGE(JTRC_GIF, "%ux%ux%d GIF image")
|
||||
@@ -84,23 +87,6 @@ JMESSAGE(JTRC_PPM, "%ux%u PPM image")
|
||||
JMESSAGE(JTRC_PPM_TEXT, "%ux%u text PPM image")
|
||||
#endif /* PPM_SUPPORTED */
|
||||
|
||||
#ifdef RLE_SUPPORTED
|
||||
JMESSAGE(JERR_RLE_BADERROR, "Bogus error code from RLE library")
|
||||
JMESSAGE(JERR_RLE_COLORSPACE, "RLE output must be grayscale or RGB")
|
||||
JMESSAGE(JERR_RLE_DIMENSIONS, "Image dimensions (%ux%u) too large for RLE")
|
||||
JMESSAGE(JERR_RLE_EMPTY, "Empty RLE file")
|
||||
JMESSAGE(JERR_RLE_EOF, "Premature EOF in RLE header")
|
||||
JMESSAGE(JERR_RLE_MEM, "Insufficient memory for RLE header")
|
||||
JMESSAGE(JERR_RLE_NOT, "Not an RLE file")
|
||||
JMESSAGE(JERR_RLE_TOOMANYCHANNELS, "Cannot handle %d output channels for RLE")
|
||||
JMESSAGE(JERR_RLE_UNSUPPORTED, "Cannot handle this RLE setup")
|
||||
JMESSAGE(JTRC_RLE, "%ux%u full-color RLE file")
|
||||
JMESSAGE(JTRC_RLE_FULLMAP, "%ux%u full-color RLE file with map of length %d")
|
||||
JMESSAGE(JTRC_RLE_GRAY, "%ux%u grayscale RLE file")
|
||||
JMESSAGE(JTRC_RLE_MAPGRAY, "%ux%u grayscale RLE file with map of length %d")
|
||||
JMESSAGE(JTRC_RLE_MAPPED, "%ux%u colormapped RLE file with map of length %d")
|
||||
#endif /* RLE_SUPPORTED */
|
||||
|
||||
#ifdef TARGA_SUPPORTED
|
||||
JMESSAGE(JERR_TGA_BADCMAP, "Unsupported Targa colormap format")
|
||||
JMESSAGE(JERR_TGA_BADPARMS, "Invalid or unsupported Targa file")
|
||||
|
||||
23
cdjpeg.c
23
cdjpeg.c
@@ -3,8 +3,8 @@
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* It was modified by The libjpeg-turbo Project to include only code relevant
|
||||
* to libjpeg-turbo.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2019, 2022, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -25,12 +25,22 @@
|
||||
* Optional progress monitor: display a percent-done figure on stderr.
|
||||
*/
|
||||
|
||||
#ifdef PROGRESS_REPORT
|
||||
|
||||
METHODDEF(void)
|
||||
progress_monitor(j_common_ptr cinfo)
|
||||
{
|
||||
cd_progress_ptr prog = (cd_progress_ptr)cinfo->progress;
|
||||
|
||||
if (prog->max_scans != 0 && cinfo->is_decompressor) {
|
||||
int scan_no = ((j_decompress_ptr)cinfo)->input_scan_number;
|
||||
|
||||
if (scan_no > (int)prog->max_scans) {
|
||||
fprintf(stderr, "Scan number %d exceeds maximum scans (%u)\n", scan_no,
|
||||
prog->max_scans);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
if (prog->report) {
|
||||
int total_passes = prog->pub.total_passes + prog->total_extra_passes;
|
||||
int percent_done =
|
||||
(int)(prog->pub.pass_counter * 100L / prog->pub.pass_limit);
|
||||
@@ -46,6 +56,7 @@ progress_monitor(j_common_ptr cinfo)
|
||||
}
|
||||
fflush(stderr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +68,8 @@ start_progress_monitor(j_common_ptr cinfo, cd_progress_ptr progress)
|
||||
progress->pub.progress_monitor = progress_monitor;
|
||||
progress->completed_extra_passes = 0;
|
||||
progress->total_extra_passes = 0;
|
||||
progress->max_scans = 0;
|
||||
progress->report = FALSE;
|
||||
progress->percent_done = -1;
|
||||
cinfo->progress = &progress->pub;
|
||||
}
|
||||
@@ -73,8 +86,6 @@ end_progress_monitor(j_common_ptr cinfo)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Case-insensitive matching of possibly-abbreviated keyword switches.
|
||||
|
||||
20
cdjpeg.h
20
cdjpeg.h
@@ -3,8 +3,9 @@
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1994-1997, Thomas G. Lane.
|
||||
* Modified 2019 by Guido Vollbeding.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2017, D. R. Commander.
|
||||
* Copyright (C) 2017, 2019, 2021, D. R. Commander.
|
||||
* mozjpeg Modifications:
|
||||
* Copyright (C) 2014, Mozilla Corporation.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg file.
|
||||
@@ -37,7 +38,9 @@ struct cjpeg_source_struct {
|
||||
|
||||
JSAMPARRAY buffer;
|
||||
JDIMENSION buffer_height;
|
||||
|
||||
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
||||
JDIMENSION max_pixels;
|
||||
#endif
|
||||
#if JPEG_RAW_READER
|
||||
// For reading JPEG
|
||||
JSAMPARRAY plane_pointer[4];
|
||||
@@ -65,9 +68,9 @@ struct djpeg_dest_struct {
|
||||
void (*finish_output) (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo);
|
||||
/* Re-calculate buffer dimensions based on output dimensions (for use with
|
||||
partial image decompression.) If this is NULL, then the output format
|
||||
does not support partial image decompression (BMP and RLE, in particular,
|
||||
cannot support partial decompression because they use an inversion buffer
|
||||
to write the image in bottom-up order.) */
|
||||
does not support partial image decompression (BMP, in particular, cannot
|
||||
support partial decompression because it uses an inversion buffer to write
|
||||
the image in bottom-up order.) */
|
||||
void (*calc_buffer_dimensions) (j_decompress_ptr cinfo,
|
||||
djpeg_dest_ptr dinfo);
|
||||
|
||||
@@ -96,6 +99,9 @@ struct cdjpeg_progress_mgr {
|
||||
struct jpeg_progress_mgr pub; /* fields known to JPEG library */
|
||||
int completed_extra_passes; /* extra passes completed */
|
||||
int total_extra_passes; /* total extra */
|
||||
JDIMENSION max_scans; /* abort if the number of scans exceeds this
|
||||
value and the value is non-zero */
|
||||
boolean report; /* whether or not to report progress */
|
||||
/* last printed percentage stored here to avoid multiple printouts */
|
||||
int percent_done;
|
||||
};
|
||||
@@ -112,11 +118,9 @@ EXTERN(cjpeg_source_ptr) jinit_read_bmp(j_compress_ptr cinfo,
|
||||
EXTERN(djpeg_dest_ptr) jinit_write_bmp(j_decompress_ptr cinfo, boolean is_os2,
|
||||
boolean use_inversion_array);
|
||||
EXTERN(cjpeg_source_ptr) jinit_read_gif(j_compress_ptr cinfo);
|
||||
EXTERN(djpeg_dest_ptr) jinit_write_gif(j_decompress_ptr cinfo);
|
||||
EXTERN(djpeg_dest_ptr) jinit_write_gif(j_decompress_ptr cinfo, boolean is_lzw);
|
||||
EXTERN(cjpeg_source_ptr) jinit_read_ppm(j_compress_ptr cinfo);
|
||||
EXTERN(djpeg_dest_ptr) jinit_write_ppm(j_decompress_ptr cinfo);
|
||||
EXTERN(cjpeg_source_ptr) jinit_read_rle(j_compress_ptr cinfo);
|
||||
EXTERN(djpeg_dest_ptr) jinit_write_rle(j_decompress_ptr cinfo);
|
||||
EXTERN(cjpeg_source_ptr) jinit_read_targa(j_compress_ptr cinfo);
|
||||
EXTERN(djpeg_dest_ptr) jinit_write_targa(j_decompress_ptr cinfo);
|
||||
|
||||
|
||||
31
change.log
31
change.log
@@ -6,6 +6,25 @@ reference. Please see ChangeLog.md for information specific to libjpeg-turbo.
|
||||
CHANGE LOG for Independent JPEG Group's JPEG software
|
||||
|
||||
|
||||
Version 9d 12-Jan-2020
|
||||
-----------------------
|
||||
|
||||
Restore GIF read and write support from libjpeg version 6a.
|
||||
Thank to Wolfgang Werner (W.W.) Heinz for suggestion.
|
||||
|
||||
Add jpegtran -drop option; add options to the crop extension and wipe
|
||||
to fill the extra area with content from the source image region,
|
||||
instead of gray out.
|
||||
|
||||
|
||||
Version 9c 14-Jan-2018
|
||||
-----------------------
|
||||
|
||||
jpegtran: add an option to the -wipe switch to fill the region
|
||||
with the average of adjacent blocks, instead of gray out.
|
||||
Thank to Caitlyn Feddock and Maddie Ziegler for inspiration.
|
||||
|
||||
|
||||
Version 9b 17-Jan-2016
|
||||
-----------------------
|
||||
|
||||
@@ -13,6 +32,13 @@ Document 'f' specifier for jpegtran -crop specification.
|
||||
Thank to Michele Martone for suggestion.
|
||||
|
||||
|
||||
Version 9a 19-Jan-2014
|
||||
-----------------------
|
||||
|
||||
Add jpegtran -wipe option and extension for -crop.
|
||||
Thank to Andrew Senior, David Clunie, and Josef Schmid for suggestion.
|
||||
|
||||
|
||||
Version 9 13-Jan-2013
|
||||
----------------------
|
||||
|
||||
@@ -138,11 +164,6 @@ Huffman tables being used.
|
||||
|
||||
Huffman tables are checked for validity much more carefully than before.
|
||||
|
||||
To avoid the Unisys LZW patent, djpeg's GIF output capability has been
|
||||
changed to produce "uncompressed GIFs", and cjpeg's GIF input capability
|
||||
has been removed altogether. We're not happy about it either, but there
|
||||
seems to be no good alternative.
|
||||
|
||||
The configure script now supports building libjpeg as a shared library
|
||||
on many flavors of Unix (all the ones that GNU libtool knows how to
|
||||
build shared libraries for). Use "./configure --enable-shared" to
|
||||
|
||||
24
cjpeg.1
24
cjpeg.1
@@ -1,4 +1,4 @@
|
||||
.TH CJPEG 1 "4 November 2020"
|
||||
.TH CJPEG 1 "30 November 2021"
|
||||
.SH NAME
|
||||
cjpeg \- compress an image file to a JPEG file
|
||||
.SH SYNOPSIS
|
||||
@@ -16,8 +16,7 @@ cjpeg \- compress an image file to a JPEG file
|
||||
compresses the named image file, or the standard input if no file is
|
||||
named, and produces a JPEG/JFIF file on the standard output.
|
||||
The currently supported input file formats are: PPM (PBMPLUS color
|
||||
format), PGM (PBMPLUS grayscale format), BMP, Targa, and RLE (Utah Raster
|
||||
Toolkit format). (RLE is supported only if the URT library is available.)
|
||||
format), PGM (PBMPLUS grayscale format), BMP, GIF, and Targa.
|
||||
.SH OPTIONS
|
||||
All switch names may be abbreviated; for example,
|
||||
.B \-grayscale
|
||||
@@ -41,11 +40,7 @@ Scale quantization tables to adjust image quality. Quality is 0 (worst) to
|
||||
100 (best); default is 75. (See below for more info.)
|
||||
.TP
|
||||
.B \-grayscale
|
||||
Create monochrome JPEG file from color input. Be sure to use this switch when
|
||||
compressing a grayscale BMP file, because
|
||||
.B cjpeg
|
||||
isn't bright enough to notice whether a BMP file uses only shades of gray.
|
||||
By saying
|
||||
Create monochrome JPEG file from color input. By saying
|
||||
.BR \-grayscale,
|
||||
you'll get a smaller JPEG file that takes less time to process.
|
||||
.TP
|
||||
@@ -224,6 +219,14 @@ Compress to memory instead of a file. This feature was implemented mainly as a
|
||||
way of testing the in-memory destination manager (jpeg_mem_dest()), but it is
|
||||
also useful for benchmarking, since it reduces the I/O overhead.
|
||||
.TP
|
||||
.BI \-report
|
||||
Report compression progress.
|
||||
.TP
|
||||
.BI \-strict
|
||||
Treat all warnings as fatal. Enabling this option will cause the compressor to
|
||||
abort if an LZW-compressed GIF input image contains incomplete or corrupt image
|
||||
data.
|
||||
.TP
|
||||
.B \-verbose
|
||||
Enable debug printout. More
|
||||
.BR \-v 's
|
||||
@@ -350,11 +353,6 @@ This file was modified by The libjpeg-turbo Project to include only information
|
||||
relevant to libjpeg-turbo, to wordsmith certain sections, and to describe
|
||||
features not present in libjpeg.
|
||||
.SH ISSUES
|
||||
Support for GIF input files was removed in cjpeg v6b due to concerns over
|
||||
the Unisys LZW patent. Although this patent expired in 2006, cjpeg still
|
||||
lacks GIF support, for these historical reasons. (Conversion of GIF files to
|
||||
JPEG is usually a bad idea anyway, since GIF is a 256-color format.)
|
||||
.PP
|
||||
Not all variants of BMP and Targa file formats are supported.
|
||||
.PP
|
||||
The
|
||||
|
||||
149
cjpeg.c
149
cjpeg.c
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* Modified 2003-2011 by Guido Vollbeding.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2010, 2013-2014, 2017, 2020, D. R. Commander.
|
||||
* Copyright (C) 2010, 2013-2014, 2017, 2019-2022, D. R. Commander.
|
||||
* mozjpeg Modifications:
|
||||
* Copyright (C) 2014, Mozilla Corporation.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
@@ -28,25 +28,17 @@
|
||||
* works regardless of which command line style is used.
|
||||
*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
#endif
|
||||
|
||||
#ifdef CJPEG_FUZZER
|
||||
#define JPEG_INTERNALS
|
||||
#endif
|
||||
#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
|
||||
#include "jversion.h" /* for version message */
|
||||
#include "jconfigint.h"
|
||||
|
||||
#ifndef HAVE_STDLIB_H /* <stdlib.h> should declare malloc(),free() */
|
||||
extern void *malloc(size_t size);
|
||||
extern void free(void *ptr);
|
||||
#endif
|
||||
|
||||
#ifdef USE_CCOMMAND /* command-line reader for Macintosh */
|
||||
#ifdef __MWERKS__
|
||||
#include <SIOUX.h> /* Metrowerks needs this */
|
||||
#include <console.h> /* ... and this */
|
||||
#endif
|
||||
#ifdef THINK_C
|
||||
#include <console.h> /* Think declares it here */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Create the add-on message string table. */
|
||||
|
||||
@@ -70,9 +62,9 @@ static const char * const cdjpeg_message_table[] = {
|
||||
* 2) assume we can push back more than one character (works in
|
||||
* some C implementations, but unportable);
|
||||
* 3) provide our own buffering (breaks input readers that want to use
|
||||
* stdio directly, such as the RLE library);
|
||||
* stdio directly);
|
||||
* or 4) don't put back the data, and modify the input_init methods to assume
|
||||
* they start reading after the start of file (also breaks RLE library).
|
||||
* they start reading after the start of file.
|
||||
* #1 is attractive for MS-DOS but is untenable on Unix.
|
||||
*
|
||||
* The most portable solution for file types that can't be identified by their
|
||||
@@ -124,10 +116,6 @@ select_file_type(j_compress_ptr cinfo, FILE *infile)
|
||||
copy_markers = TRUE;
|
||||
return jinit_read_png(cinfo);
|
||||
#endif
|
||||
#ifdef RLE_SUPPORTED
|
||||
case 'R':
|
||||
return jinit_read_rle(cinfo);
|
||||
#endif
|
||||
#ifdef TARGA_SUPPORTED
|
||||
case 0x00:
|
||||
return jinit_read_targa(cinfo);
|
||||
@@ -158,6 +146,47 @@ static const char *progname; /* program name for error messages */
|
||||
static char *icc_filename; /* for -icc switch */
|
||||
static char *outfilename; /* for -outfile switch */
|
||||
boolean memdst; /* for -memdst switch */
|
||||
boolean report; /* for -report switch */
|
||||
boolean strict; /* for -strict switch */
|
||||
|
||||
|
||||
#ifdef CJPEG_FUZZER
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
struct my_error_mgr {
|
||||
struct jpeg_error_mgr pub;
|
||||
jmp_buf setjmp_buffer;
|
||||
};
|
||||
|
||||
void my_error_exit(j_common_ptr cinfo)
|
||||
{
|
||||
struct my_error_mgr *myerr = (struct my_error_mgr *)cinfo->err;
|
||||
|
||||
longjmp(myerr->setjmp_buffer, 1);
|
||||
}
|
||||
|
||||
static void my_emit_message_fuzzer(j_common_ptr cinfo, int msg_level)
|
||||
{
|
||||
if (msg_level < 0)
|
||||
cinfo->err->num_warnings++;
|
||||
}
|
||||
|
||||
#define HANDLE_ERROR() { \
|
||||
if (cinfo.global_state > CSTATE_START) { \
|
||||
if (memdst && outbuffer) \
|
||||
(*cinfo.dest->term_destination) (&cinfo); \
|
||||
jpeg_abort_compress(&cinfo); \
|
||||
} \
|
||||
jpeg_destroy_compress(&cinfo); \
|
||||
if (input_file != stdin && input_file != NULL) \
|
||||
fclose(input_file); \
|
||||
if (memdst) \
|
||||
free(outbuffer); \
|
||||
return EXIT_FAILURE; \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
LOCAL(void)
|
||||
@@ -222,10 +251,13 @@ usage(void)
|
||||
fprintf(stderr, " -quant-table N Use predefined quantization table N:\n");
|
||||
fprintf(stderr, " - 0 JPEG Annex K\n");
|
||||
fprintf(stderr, " - 1 Flat\n");
|
||||
fprintf(stderr, " - 2 Custom, tuned for MS-SSIM\n");
|
||||
fprintf(stderr, " - 3 ImageMagick table by N. Robidoux\n");
|
||||
fprintf(stderr, " - 4 Custom, tuned for PSNR-HVS\n");
|
||||
fprintf(stderr, " - 2 Tuned for MS-SSIM on Kodak image set\n");
|
||||
fprintf(stderr, " - 3 ImageMagick table by N. Robidoux (default)\n");
|
||||
fprintf(stderr, " - 4 Tuned for PSNR-HVS on Kodak image set\n");
|
||||
fprintf(stderr, " - 5 Table from paper by Klein, Silverstein and Carney\n");
|
||||
fprintf(stderr, " - 6 Table from paper by Watson, Taylor and Borthwick\n");
|
||||
fprintf(stderr, " - 7 Table from paper by Ahumada, Watson, Peterson\n");
|
||||
fprintf(stderr, " - 8 Table from paper by Peterson, Ahumada and Watson\n");
|
||||
fprintf(stderr, " -icc FILE Embed ICC profile contained in FILE\n");
|
||||
fprintf(stderr, " -restart N Set restart interval in rows, or in blocks with B\n");
|
||||
#ifdef INPUT_SMOOTHING_SUPPORTED
|
||||
@@ -236,6 +268,8 @@ usage(void)
|
||||
#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)
|
||||
fprintf(stderr, " -memdst Compress to memory instead of file (useful for benchmarking)\n");
|
||||
#endif
|
||||
fprintf(stderr, " -report Report compression progress\n");
|
||||
fprintf(stderr, " -strict Treat all warnings as fatal\n");
|
||||
fprintf(stderr, " -verbose or -debug Emit debug output\n");
|
||||
fprintf(stderr, " -version Print version information and exit\n");
|
||||
fprintf(stderr, "Switches for wizards:\n");
|
||||
@@ -283,6 +317,8 @@ parse_switches(j_compress_ptr cinfo, int argc, char **argv,
|
||||
icc_filename = NULL;
|
||||
outfilename = NULL;
|
||||
memdst = FALSE;
|
||||
report = FALSE;
|
||||
strict = FALSE;
|
||||
cinfo->err->trace_level = 0;
|
||||
|
||||
/* Scan command line options, adjust parameters */
|
||||
@@ -470,6 +506,8 @@ parse_switches(j_compress_ptr cinfo, int argc, char **argv,
|
||||
qtablefile = argv[argn];
|
||||
/* We postpone actually reading the file in case -quality comes later. */
|
||||
|
||||
} else if (keymatch(arg, "report", 3)) {
|
||||
report = TRUE;
|
||||
} else if (keymatch(arg, "quant-table", 7)) {
|
||||
int val;
|
||||
if (++argn >= argc) /* advance to next argument */
|
||||
@@ -545,6 +583,9 @@ parse_switches(j_compress_ptr cinfo, int argc, char **argv,
|
||||
usage();
|
||||
cinfo->smoothing_factor = val;
|
||||
|
||||
} else if (keymatch(arg, "strict", 2)) {
|
||||
strict = TRUE;
|
||||
|
||||
} else if (keymatch(arg, "targa", 1)) {
|
||||
/* Input file is Targa format. */
|
||||
is_targa = TRUE;
|
||||
@@ -653,6 +694,19 @@ parse_switches(j_compress_ptr cinfo, int argc, char **argv,
|
||||
}
|
||||
|
||||
|
||||
METHODDEF(void)
|
||||
my_emit_message(j_common_ptr cinfo, int msg_level)
|
||||
{
|
||||
if (msg_level < 0) {
|
||||
/* Treat warning as fatal */
|
||||
cinfo->err->error_exit(cinfo);
|
||||
} else {
|
||||
if (cinfo->err->trace_level >= msg_level)
|
||||
cinfo->err->output_message(cinfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The main program.
|
||||
*/
|
||||
@@ -661,13 +715,16 @@ int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
struct jpeg_compress_struct cinfo;
|
||||
#ifdef CJPEG_FUZZER
|
||||
struct my_error_mgr myerr;
|
||||
struct jpeg_error_mgr &jerr = myerr.pub;
|
||||
#else
|
||||
struct jpeg_error_mgr jerr;
|
||||
#ifdef PROGRESS_REPORT
|
||||
struct cdjpeg_progress_mgr progress;
|
||||
#endif
|
||||
struct cdjpeg_progress_mgr progress;
|
||||
int file_index;
|
||||
cjpeg_source_ptr src_mgr;
|
||||
FILE *input_file;
|
||||
FILE *input_file = NULL;
|
||||
FILE *icc_file;
|
||||
JOCTET *icc_profile = NULL;
|
||||
long icc_len = 0;
|
||||
@@ -676,11 +733,6 @@ main(int argc, char **argv)
|
||||
unsigned long outsize = 0;
|
||||
JDIMENSION num_scanlines;
|
||||
|
||||
/* On Mac, fetch a command line. */
|
||||
#ifdef USE_CCOMMAND
|
||||
argc = ccommand(&argv);
|
||||
#endif
|
||||
|
||||
progname = argv[0];
|
||||
if (progname == NULL || progname[0] == 0)
|
||||
progname = "cjpeg"; /* in case C library doesn't provide it */
|
||||
@@ -710,6 +762,9 @@ main(int argc, char **argv)
|
||||
|
||||
file_index = parse_switches(&cinfo, argc, argv, 0, FALSE);
|
||||
|
||||
if (strict)
|
||||
jerr.emit_message = my_emit_message;
|
||||
|
||||
#ifdef TWO_FILE_COMMANDLINE
|
||||
if (!memdst) {
|
||||
/* Must have either -outfile switch or explicit output file name */
|
||||
@@ -785,13 +840,24 @@ main(int argc, char **argv)
|
||||
fclose(icc_file);
|
||||
}
|
||||
|
||||
#ifdef PROGRESS_REPORT
|
||||
start_progress_monitor((j_common_ptr)&cinfo, &progress);
|
||||
#ifdef CJPEG_FUZZER
|
||||
jerr.error_exit = my_error_exit;
|
||||
jerr.emit_message = my_emit_message_fuzzer;
|
||||
if (setjmp(myerr.setjmp_buffer))
|
||||
HANDLE_ERROR()
|
||||
#endif
|
||||
|
||||
if (report) {
|
||||
start_progress_monitor((j_common_ptr)&cinfo, &progress);
|
||||
progress.report = report;
|
||||
}
|
||||
|
||||
/* Figure out the input file format, and set up to read it. */
|
||||
src_mgr = select_file_type(&cinfo, input_file);
|
||||
src_mgr->input_file = input_file;
|
||||
#ifdef CJPEG_FUZZER
|
||||
src_mgr->max_pixels = 1048576;
|
||||
#endif
|
||||
|
||||
/* Read the input file header to obtain file size & colorspace. */
|
||||
(*src_mgr->start_input) (&cinfo, src_mgr);
|
||||
@@ -813,6 +879,11 @@ main(int argc, char **argv)
|
||||
#endif
|
||||
jpeg_stdio_dest(&cinfo, output_file);
|
||||
|
||||
#ifdef CJPEG_FUZZER
|
||||
if (setjmp(myerr.setjmp_buffer))
|
||||
HANDLE_ERROR()
|
||||
#endif
|
||||
|
||||
/* Start compressor */
|
||||
jpeg_start_compress(&cinfo, TRUE);
|
||||
|
||||
@@ -873,18 +944,18 @@ main(int argc, char **argv)
|
||||
if (output_file != stdout && output_file != NULL)
|
||||
fclose(output_file);
|
||||
|
||||
#ifdef PROGRESS_REPORT
|
||||
if (report)
|
||||
end_progress_monitor((j_common_ptr)&cinfo);
|
||||
#endif
|
||||
|
||||
if (memdst) {
|
||||
#ifndef CJPEG_FUZZER
|
||||
fprintf(stderr, "Compressed size: %lu bytes\n", outsize);
|
||||
#endif
|
||||
free(outbuffer);
|
||||
}
|
||||
|
||||
free(icc_profile);
|
||||
|
||||
/* All done. */
|
||||
exit(jerr.num_warnings ? EXIT_WARNING : EXIT_SUCCESS);
|
||||
return 0; /* suppress no-return-value warnings */
|
||||
return (jerr.num_warnings ? EXIT_WARNING : EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -1,18 +1,6 @@
|
||||
# This file is included from the top-level CMakeLists.txt. We just store it
|
||||
# here to avoid cluttering up that file.
|
||||
|
||||
set(PKGNAME ${CMAKE_PROJECT_NAME} CACHE STRING
|
||||
"Distribution package name (default: ${CMAKE_PROJECT_NAME})")
|
||||
set(PKGVENDOR "The ${CMAKE_PROJECT_NAME} Project" CACHE STRING
|
||||
"Vendor name to be included in distribution package descriptions (default: The ${CMAKE_PROJECT_NAME} Project)")
|
||||
set(PKGURL "http://www.${CMAKE_PROJECT_NAME}.org" CACHE STRING
|
||||
"URL of project web site to be included in distribution package descriptions (default: http://www.${CMAKE_PROJECT_NAME}.org)")
|
||||
set(PKGEMAIL "information@${CMAKE_PROJECT_NAME}.org" CACHE STRING
|
||||
"E-mail of project maintainer to be included in distribution package descriptions (default: information@${CMAKE_PROJECT_NAME}.org")
|
||||
set(PKGID "com.${CMAKE_PROJECT_NAME}.${PKGNAME}" CACHE STRING
|
||||
"Globally unique package identifier (reverse DNS notation) (default: com.${CMAKE_PROJECT_NAME}.${PKGNAME})")
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Linux RPM and DEB
|
||||
###############################################################################
|
||||
@@ -22,13 +10,15 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
set(RPMARCH ${CMAKE_SYSTEM_PROCESSOR})
|
||||
if(CPU_TYPE STREQUAL "x86_64")
|
||||
set(DEBARCH amd64)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "armv7*")
|
||||
set(RPMARCH armv7hl)
|
||||
set(DEBARCH armhf)
|
||||
elseif(CPU_TYPE STREQUAL "arm64")
|
||||
set(DEBARCH ${CPU_TYPE})
|
||||
elseif(CPU_TYPE STREQUAL "arm")
|
||||
if(CMAKE_C_COMPILER MATCHES "gnueabihf")
|
||||
check_c_source_compiles("
|
||||
#if __ARM_PCS_VFP != 1
|
||||
#error \"float ABI != hard\"
|
||||
#endif
|
||||
int main(void) { return 0; }" HAVE_HARD_FLOAT)
|
||||
if(HAVE_HARD_FLOAT)
|
||||
set(RPMARCH armv7hl)
|
||||
set(DEBARCH armhf)
|
||||
else()
|
||||
@@ -78,12 +68,14 @@ if(WIN32)
|
||||
|
||||
if(MSVC)
|
||||
set(INST_PLATFORM "Visual C++")
|
||||
set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-vc)
|
||||
set(INST_ID vc)
|
||||
set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-${INST_ID})
|
||||
set(INST_REG_NAME ${CMAKE_PROJECT_NAME})
|
||||
elseif(MINGW)
|
||||
set(INST_PLATFORM GCC)
|
||||
set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-gcc)
|
||||
set(INST_REG_NAME ${CMAKE_PROJECT_NAME}-gcc)
|
||||
set(INST_ID gcc)
|
||||
set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-${INST_ID})
|
||||
set(INST_REG_NAME ${CMAKE_PROJECT_NAME}-${INST_ID})
|
||||
set(INST_DEFS -DGCC)
|
||||
endif()
|
||||
|
||||
@@ -98,7 +90,7 @@ if(WITH_JAVA)
|
||||
set(INST_DEFS ${INST_DEFS} -DJAVA)
|
||||
endif()
|
||||
|
||||
if(MSVC_IDE)
|
||||
if(GENERATOR_IS_MULTI_CONFIG)
|
||||
set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=${CMAKE_CFG_INTDIR}\\")
|
||||
else()
|
||||
set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=")
|
||||
@@ -107,66 +99,50 @@ endif()
|
||||
string(REGEX REPLACE "/" "\\\\" INST_DIR ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
configure_file(release/installer.nsi.in installer.nsi @ONLY)
|
||||
# TODO: It would be nice to eventually switch to CPack and eliminate this mess,
|
||||
# but not today.
|
||||
configure_file(win/projectTargets.cmake.in
|
||||
win/${CMAKE_PROJECT_NAME}Targets.cmake @ONLY)
|
||||
configure_file(win/${INST_ID}/projectTargets-release.cmake.in
|
||||
win/${CMAKE_PROJECT_NAME}Targets-release.cmake @ONLY)
|
||||
|
||||
if(WITH_JAVA)
|
||||
set(JAVA_DEPEND turbojpeg-java)
|
||||
endif()
|
||||
if(WITH_TURBOJPEG)
|
||||
set(TURBOJPEG_DEPEND turbojpeg turbojpeg-static tjbench)
|
||||
endif()
|
||||
add_custom_target(installer
|
||||
makensis -nocd ${INST_DEFS} installer.nsi
|
||||
DEPENDS jpeg jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom
|
||||
cjpeg djpeg jpegtran tjbench ${JAVA_DEPEND}
|
||||
DEPENDS jpeg jpeg-static rdjpgcom wrjpgcom cjpeg djpeg jpegtran
|
||||
${JAVA_DEPEND} ${TURBOJPEG_DEPEND}
|
||||
SOURCES installer.nsi)
|
||||
|
||||
endif() # WIN32
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Cygwin Package
|
||||
###############################################################################
|
||||
|
||||
if(CYGWIN)
|
||||
|
||||
configure_file(release/makecygwinpkg.in pkgscripts/makecygwinpkg)
|
||||
|
||||
add_custom_target(cygwinpkg pkgscripts/makecygwinpkg)
|
||||
|
||||
endif() # CYGWIN
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Mac DMG
|
||||
###############################################################################
|
||||
|
||||
if(APPLE)
|
||||
|
||||
set(DEFAULT_OSX_32BIT_BUILD ${CMAKE_SOURCE_DIR}/osxx86)
|
||||
set(OSX_32BIT_BUILD ${DEFAULT_OSX_32BIT_BUILD} CACHE PATH
|
||||
"Directory containing 32-bit (i386) Mac build to include in universal binaries (default: ${DEFAULT_OSX_32BIT_BUILD})")
|
||||
set(DEFAULT_IOS_ARMV7_BUILD ${CMAKE_SOURCE_DIR}/iosarmv7)
|
||||
set(IOS_ARMV7_BUILD ${DEFAULT_IOS_ARMV7_BUILD} CACHE PATH
|
||||
"Directory containing Armv7 iOS build to include in universal binaries (default: ${DEFAULT_IOS_ARMV7_BUILD})")
|
||||
set(DEFAULT_IOS_ARMV7S_BUILD ${CMAKE_SOURCE_DIR}/iosarmv7s)
|
||||
set(IOS_ARMV7S_BUILD ${DEFAULT_IOS_ARMV7S_BUILD} CACHE PATH
|
||||
"Directory containing Armv7s iOS build to include in universal binaries (default: ${DEFAULT_IOS_ARMV7S_BUILD})")
|
||||
set(DEFAULT_IOS_ARMV8_BUILD ${CMAKE_SOURCE_DIR}/iosarmv8)
|
||||
set(IOS_ARMV8_BUILD ${DEFAULT_IOS_ARMV8_BUILD} CACHE PATH
|
||||
"Directory containing Armv8 iOS build to include in universal binaries (default: ${DEFAULT_IOS_ARMV8_BUILD})")
|
||||
set(ARMV8_BUILD "" CACHE PATH
|
||||
"Directory containing Armv8 iOS or macOS build to include in universal binaries")
|
||||
|
||||
set(OSX_APP_CERT_NAME "" CACHE STRING
|
||||
set(MACOS_APP_CERT_NAME "" CACHE STRING
|
||||
"Name of the Developer ID Application certificate (in the macOS keychain) that should be used to sign the libjpeg-turbo DMG. Leave this blank to generate an unsigned DMG.")
|
||||
set(OSX_INST_CERT_NAME "" CACHE STRING
|
||||
set(MACOS_INST_CERT_NAME "" CACHE STRING
|
||||
"Name of the Developer ID Installer certificate (in the macOS keychain) that should be used to sign the libjpeg-turbo installer package. Leave this blank to generate an unsigned package.")
|
||||
|
||||
configure_file(release/makemacpkg.in pkgscripts/makemacpkg)
|
||||
configure_file(release/Distribution.xml.in pkgscripts/Distribution.xml)
|
||||
configure_file(release/Welcome.rtf.in pkgscripts/Welcome.rtf)
|
||||
configure_file(release/uninstall.in pkgscripts/uninstall)
|
||||
|
||||
add_custom_target(dmg pkgscripts/makemacpkg
|
||||
SOURCES pkgscripts/makemacpkg)
|
||||
|
||||
add_custom_target(udmg pkgscripts/makemacpkg universal
|
||||
SOURCES pkgscripts/makemacpkg)
|
||||
|
||||
endif() # APPLE
|
||||
|
||||
|
||||
@@ -186,4 +162,15 @@ add_custom_target(tarball pkgscripts/maketarball
|
||||
|
||||
configure_file(release/libjpeg.pc.in pkgscripts/libjpeg.pc @ONLY)
|
||||
|
||||
configure_file(release/libturbojpeg.pc.in pkgscripts/libturbojpeg.pc @ONLY)
|
||||
if(WITH_TURBOJPEG)
|
||||
configure_file(release/libturbojpeg.pc.in pkgscripts/libturbojpeg.pc @ONLY)
|
||||
endif()
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file(
|
||||
pkgscripts/${CMAKE_PROJECT_NAME}ConfigVersion.cmake
|
||||
VERSION ${VERSION} COMPATIBILITY AnyNewerVersion)
|
||||
|
||||
configure_package_config_file(release/Config.cmake.in
|
||||
pkgscripts/${CMAKE_PROJECT_NAME}Config.cmake
|
||||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CMAKE_PROJECT_NAME})
|
||||
|
||||
@@ -118,6 +118,7 @@
|
||||
# absolute paths where necessary, using the same logic.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2018 Matthias Räncker
|
||||
# Copyright 2016, 2019 D. R. Commander
|
||||
# Copyright 2016 Dmitry Marakasov
|
||||
# Copyright 2016 Roger Leigh
|
||||
@@ -259,6 +260,8 @@ if(NOT DEFINED CMAKE_INSTALL_DEFAULT_LIBDIR)
|
||||
else()
|
||||
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
|
||||
set(CMAKE_INSTALL_DEFAULT_LIBDIR "lib64")
|
||||
elseif(CMAKE_C_COMPILER_ABI MATCHES "ELF X32")
|
||||
set(CMAKE_INSTALL_DEFAULT_LIBDIR "libx32")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
13
cmakescripts/PackageInfo.cmake
Normal file
13
cmakescripts/PackageInfo.cmake
Normal file
@@ -0,0 +1,13 @@
|
||||
# This file is included from the top-level CMakeLists.txt. We just store it
|
||||
# here to avoid cluttering up that file.
|
||||
|
||||
set(PKGNAME ${CMAKE_PROJECT_NAME} CACHE STRING
|
||||
"Distribution package name (default: ${CMAKE_PROJECT_NAME})")
|
||||
set(PKGVENDOR "The ${CMAKE_PROJECT_NAME} Project" CACHE STRING
|
||||
"Vendor name to be included in distribution package descriptions (default: The ${CMAKE_PROJECT_NAME} Project)")
|
||||
set(PKGURL "http://www.${CMAKE_PROJECT_NAME}.org" CACHE STRING
|
||||
"URL of project web site to be included in distribution package descriptions (default: http://www.${CMAKE_PROJECT_NAME}.org)")
|
||||
set(PKGEMAIL "information@${CMAKE_PROJECT_NAME}.org" CACHE STRING
|
||||
"E-mail of project maintainer to be included in distribution package descriptions (default: information@${CMAKE_PROJECT_NAME}.org")
|
||||
set(PKGID "com.${CMAKE_PROJECT_NAME}.${PKGNAME}" CACHE STRING
|
||||
"Globally unique package identifier (reverse DNS notation) (default: com.${CMAKE_PROJECT_NAME}.${PKGNAME})")
|
||||
1
cmyk.h
1
cmyk.h
@@ -17,7 +17,6 @@
|
||||
#include <jinclude.h>
|
||||
#define JPEG_INTERNALS
|
||||
#include <jpeglib.h>
|
||||
#include "jconfigint.h"
|
||||
|
||||
|
||||
/* Fully reversible */
|
||||
|
||||
50
djpeg.1
50
djpeg.1
@@ -15,8 +15,7 @@ djpeg \- decompress a JPEG file to an image file
|
||||
.B djpeg
|
||||
decompresses the named JPEG file, or the standard input if no file is named,
|
||||
and produces an image file on the standard output. PBMPLUS (PPM/PGM), BMP,
|
||||
GIF, Targa, or RLE (Utah Raster Toolkit) output format can be selected.
|
||||
(RLE is supported only if the URT library is available.)
|
||||
GIF, or Targa output format can be selected.
|
||||
.SH OPTIONS
|
||||
All switch names may be abbreviated; for example,
|
||||
.B \-grayscale
|
||||
@@ -81,9 +80,20 @@ is specified, or if the JPEG file is grayscale; otherwise, 24-bit full-color
|
||||
format is emitted.
|
||||
.TP
|
||||
.B \-gif
|
||||
Select GIF output format. Since GIF does not support more than 256 colors,
|
||||
Select GIF output format (LZW-compressed). Since GIF does not support more
|
||||
than 256 colors,
|
||||
.B \-colors 256
|
||||
is assumed (unless you specify a smaller number of colors).
|
||||
is assumed (unless you specify a smaller number of colors). If you specify
|
||||
.BR \-fast,
|
||||
the default number of colors is 216.
|
||||
.TP
|
||||
.B \-gif0
|
||||
Select GIF output format (uncompressed). Since GIF does not support more than
|
||||
256 colors,
|
||||
.B \-colors 256
|
||||
is assumed (unless you specify a smaller number of colors). If you specify
|
||||
.BR \-fast,
|
||||
the default number of colors is 216.
|
||||
.TP
|
||||
.B \-os2
|
||||
Select BMP output format (OS/2 1.x flavor). 8-bit colormapped format is
|
||||
@@ -100,9 +110,6 @@ PGM is emitted if the JPEG file is grayscale or if
|
||||
.B \-grayscale
|
||||
is specified; otherwise PPM is emitted.
|
||||
.TP
|
||||
.B \-rle
|
||||
Select RLE output format. (Requires URT library.)
|
||||
.TP
|
||||
.B \-targa
|
||||
Select Targa output format. Grayscale format is emitted if the JPEG file is
|
||||
grayscale or if
|
||||
@@ -198,6 +205,19 @@ number. For example,
|
||||
.B \-max 4m
|
||||
selects 4000000 bytes. If more space is needed, an error will occur.
|
||||
.TP
|
||||
.BI \-maxscans " N"
|
||||
Abort if the JPEG image contains more than
|
||||
.I N
|
||||
scans. This feature demonstrates a method by which applications can guard
|
||||
against denial-of-service attacks instigated by specially-crafted malformed
|
||||
JPEG images containing numerous scans with missing image data or image data
|
||||
consisting only of "EOB runs" (a feature of progressive JPEG images that allows
|
||||
potentially hundreds of thousands of adjoining zero-value pixels to be
|
||||
represented using only a few bytes.) Attempting to decompress such malformed
|
||||
JPEG images can cause excessive CPU activity, since the decompressor must fully
|
||||
process each scan (even if the scan is corrupt) before it can proceed to the
|
||||
next scan.
|
||||
.TP
|
||||
.BI \-outfile " name"
|
||||
Send output image to the named file, not to standard output.
|
||||
.TP
|
||||
@@ -205,6 +225,9 @@ Send output image to the named file, not to standard output.
|
||||
Load input file into memory before decompressing. This feature was implemented
|
||||
mainly as a way of testing the in-memory source manager (jpeg_mem_src().)
|
||||
.TP
|
||||
.BI \-report
|
||||
Report decompression progress.
|
||||
.TP
|
||||
.BI \-skip " Y0,Y1"
|
||||
Decompress all rows of the JPEG image except those between Y0 and Y1
|
||||
(inclusive.) Note that if decompression scaling is being used, then Y0 and Y1
|
||||
@@ -218,6 +241,12 @@ decompression scaling is being used, then X, Y, W, and H are relative to the
|
||||
scaled image dimensions. Currently this option only works with the
|
||||
PBMPLUS (PPM/PGM), GIF, and Targa output formats.
|
||||
.TP
|
||||
.BI \-strict
|
||||
Treat all warnings as fatal. This feature also demonstrates a method by which
|
||||
applications can guard against attacks instigated by specially-crafted
|
||||
malformed JPEG images. Enabling this option will cause the decompressor to
|
||||
abort if the JPEG image contains incomplete or corrupt image data.
|
||||
.TP
|
||||
.B \-verbose
|
||||
Enable debug printout. More
|
||||
.BR \-v 's
|
||||
@@ -289,10 +318,3 @@ Independent JPEG Group
|
||||
This file was modified by The libjpeg-turbo Project to include only information
|
||||
relevant to libjpeg-turbo, to wordsmith certain sections, and to describe
|
||||
features not present in libjpeg.
|
||||
.SH ISSUES
|
||||
Support for compressed GIF output files was removed in djpeg v6b due to
|
||||
concerns over the Unisys LZW patent. Although this patent expired in 2006,
|
||||
djpeg still lacks compressed GIF support, for these historical reasons.
|
||||
(Conversion of JPEG files to GIF is usually a bad idea anyway, since GIF is a
|
||||
256-color format.) The uncompressed GIF files that djpeg generates are larger
|
||||
than they should be, but they are readable by standard GIF decoders.
|
||||
|
||||
127
djpeg.c
127
djpeg.c
@@ -3,9 +3,9 @@
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 2013 by Guido Vollbeding.
|
||||
* Modified 2013-2019 by Guido Vollbeding.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2010-2011, 2013-2017, 2020, D. R. Commander.
|
||||
* Copyright (C) 2010-2011, 2013-2017, 2019-2020, 2022, D. R. Commander.
|
||||
* Copyright (C) 2015, Google, Inc.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
@@ -28,26 +28,16 @@
|
||||
* works regardless of which command line style is used.
|
||||
*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
#endif
|
||||
|
||||
#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
|
||||
#include "jversion.h" /* for version message */
|
||||
#include "jconfigint.h"
|
||||
|
||||
#ifndef HAVE_STDLIB_H /* <stdlib.h> should declare free() */
|
||||
extern void free(void *ptr);
|
||||
#endif
|
||||
|
||||
#include <ctype.h> /* to declare isprint() */
|
||||
|
||||
#ifdef USE_CCOMMAND /* command-line reader for Macintosh */
|
||||
#ifdef __MWERKS__
|
||||
#include <SIOUX.h> /* Metrowerks needs this */
|
||||
#include <console.h> /* ... and this */
|
||||
#endif
|
||||
#ifdef THINK_C
|
||||
#include <console.h> /* Think declares it here */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Create the add-on message string table. */
|
||||
|
||||
@@ -68,10 +58,10 @@ static const char * const cdjpeg_message_table[] = {
|
||||
|
||||
typedef enum {
|
||||
FMT_BMP, /* BMP format (Windows flavor) */
|
||||
FMT_GIF, /* GIF format */
|
||||
FMT_GIF, /* GIF format (LZW-compressed) */
|
||||
FMT_GIF0, /* GIF format (uncompressed) */
|
||||
FMT_OS2, /* BMP format (OS/2 flavor) */
|
||||
FMT_PPM, /* PPM/PGM (PBMPLUS formats) */
|
||||
FMT_RLE, /* RLE format */
|
||||
FMT_TARGA, /* Targa format */
|
||||
FMT_TIFF /* TIFF format */
|
||||
} IMAGE_FORMATS;
|
||||
@@ -94,11 +84,14 @@ static IMAGE_FORMATS requested_fmt;
|
||||
|
||||
static const char *progname; /* program name for error messages */
|
||||
static char *icc_filename; /* for -icc switch */
|
||||
JDIMENSION max_scans; /* for -maxscans switch */
|
||||
static char *outfilename; /* for -outfile switch */
|
||||
boolean memsrc; /* for -memsrc switch */
|
||||
boolean report; /* for -report switch */
|
||||
boolean skip, crop;
|
||||
JDIMENSION skip_start, skip_end;
|
||||
JDIMENSION crop_x, crop_y, crop_width, crop_height;
|
||||
boolean strict; /* for -strict switch */
|
||||
#define INPUT_BUF_SIZE 4096
|
||||
|
||||
|
||||
@@ -127,8 +120,10 @@ usage(void)
|
||||
(DEFAULT_FMT == FMT_BMP ? " (default)" : ""));
|
||||
#endif
|
||||
#ifdef GIF_SUPPORTED
|
||||
fprintf(stderr, " -gif Select GIF output format%s\n",
|
||||
fprintf(stderr, " -gif Select GIF output format (LZW-compressed)%s\n",
|
||||
(DEFAULT_FMT == FMT_GIF ? " (default)" : ""));
|
||||
fprintf(stderr, " -gif0 Select GIF output format (uncompressed)%s\n",
|
||||
(DEFAULT_FMT == FMT_GIF0 ? " (default)" : ""));
|
||||
#endif
|
||||
#ifdef BMP_SUPPORTED
|
||||
fprintf(stderr, " -os2 Select BMP output format (OS/2 style)%s\n",
|
||||
@@ -138,10 +133,6 @@ usage(void)
|
||||
fprintf(stderr, " -pnm Select PBMPLUS (PPM/PGM) output format%s\n",
|
||||
(DEFAULT_FMT == FMT_PPM ? " (default)" : ""));
|
||||
#endif
|
||||
#ifdef RLE_SUPPORTED
|
||||
fprintf(stderr, " -rle Select Utah RLE output format%s\n",
|
||||
(DEFAULT_FMT == FMT_RLE ? " (default)" : ""));
|
||||
#endif
|
||||
#ifdef TARGA_SUPPORTED
|
||||
fprintf(stderr, " -targa Select Targa output format%s\n",
|
||||
(DEFAULT_FMT == FMT_TARGA ? " (default)" : ""));
|
||||
@@ -171,14 +162,16 @@ usage(void)
|
||||
fprintf(stderr, " -onepass Use 1-pass quantization (fast, low quality)\n");
|
||||
#endif
|
||||
fprintf(stderr, " -maxmemory N Maximum memory to use (in kbytes)\n");
|
||||
fprintf(stderr, " -maxscans N Maximum number of scans to allow in input file\n");
|
||||
fprintf(stderr, " -outfile name Specify name for output file\n");
|
||||
#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)
|
||||
fprintf(stderr, " -memsrc Load input file into memory before decompressing\n");
|
||||
#endif
|
||||
|
||||
fprintf(stderr, " -report Report decompression progress\n");
|
||||
fprintf(stderr, " -skip Y0,Y1 Decompress all rows except those between Y0 and Y1 (inclusive)\n");
|
||||
fprintf(stderr, " -crop WxH+X+Y Decompress only a rectangular subregion of the image\n");
|
||||
fprintf(stderr, " [requires PBMPLUS (PPM/PGM), GIF, or Targa output format]\n");
|
||||
fprintf(stderr, " -strict Treat all warnings as fatal\n");
|
||||
fprintf(stderr, " -verbose or -debug Emit debug output\n");
|
||||
fprintf(stderr, " -version Print version information and exit\n");
|
||||
exit(EXIT_FAILURE);
|
||||
@@ -203,10 +196,13 @@ parse_switches(j_decompress_ptr cinfo, int argc, char **argv,
|
||||
/* Set up default JPEG parameters. */
|
||||
requested_fmt = DEFAULT_FMT; /* set default output file format */
|
||||
icc_filename = NULL;
|
||||
max_scans = 0;
|
||||
outfilename = NULL;
|
||||
memsrc = FALSE;
|
||||
report = FALSE;
|
||||
skip = FALSE;
|
||||
crop = FALSE;
|
||||
strict = FALSE;
|
||||
cinfo->err->trace_level = 0;
|
||||
|
||||
/* Scan command line options, adjust parameters */
|
||||
@@ -224,7 +220,7 @@ parse_switches(j_decompress_ptr cinfo, int argc, char **argv,
|
||||
arg++; /* advance past switch marker character */
|
||||
|
||||
if (keymatch(arg, "bmp", 1)) {
|
||||
/* BMP output format. */
|
||||
/* BMP output format (Windows flavor). */
|
||||
requested_fmt = FMT_BMP;
|
||||
|
||||
} else if (keymatch(arg, "colors", 1) || keymatch(arg, "colours", 1) ||
|
||||
@@ -295,9 +291,13 @@ parse_switches(j_decompress_ptr cinfo, int argc, char **argv,
|
||||
cinfo->do_fancy_upsampling = FALSE;
|
||||
|
||||
} else if (keymatch(arg, "gif", 1)) {
|
||||
/* GIF output format. */
|
||||
/* GIF output format (LZW-compressed). */
|
||||
requested_fmt = FMT_GIF;
|
||||
|
||||
} else if (keymatch(arg, "gif0", 4)) {
|
||||
/* GIF output format (uncompressed). */
|
||||
requested_fmt = FMT_GIF0;
|
||||
|
||||
} else if (keymatch(arg, "grayscale", 2) ||
|
||||
keymatch(arg, "greyscale", 2)) {
|
||||
/* Force monochrome output. */
|
||||
@@ -316,7 +316,9 @@ parse_switches(j_decompress_ptr cinfo, int argc, char **argv,
|
||||
if (++argn >= argc) /* advance to next argument */
|
||||
usage();
|
||||
icc_filename = argv[argn];
|
||||
#ifdef SAVE_MARKERS_SUPPORTED
|
||||
jpeg_save_markers(cinfo, JPEG_APP0 + 2, 0xFFFF);
|
||||
#endif
|
||||
|
||||
} else if (keymatch(arg, "map", 3)) {
|
||||
/* Quantize to a color map taken from an input file. */
|
||||
@@ -351,6 +353,12 @@ parse_switches(j_decompress_ptr cinfo, int argc, char **argv,
|
||||
lval *= 1000L;
|
||||
cinfo->mem->max_memory_to_use = lval * 1000L;
|
||||
|
||||
} else if (keymatch(arg, "maxscans", 4)) {
|
||||
if (++argn >= argc) /* advance to next argument */
|
||||
usage();
|
||||
if (sscanf(argv[argn], "%u", &max_scans) != 1)
|
||||
usage();
|
||||
|
||||
} else if (keymatch(arg, "nosmooth", 3)) {
|
||||
/* Suppress fancy upsampling */
|
||||
cinfo->do_fancy_upsampling = FALSE;
|
||||
@@ -383,9 +391,8 @@ parse_switches(j_decompress_ptr cinfo, int argc, char **argv,
|
||||
/* PPM/PGM output format. */
|
||||
requested_fmt = FMT_PPM;
|
||||
|
||||
} else if (keymatch(arg, "rle", 1)) {
|
||||
/* RLE output format. */
|
||||
requested_fmt = FMT_RLE;
|
||||
} else if (keymatch(arg, "report", 2)) {
|
||||
report = TRUE;
|
||||
|
||||
} else if (keymatch(arg, "scale", 2)) {
|
||||
/* Scale the output image by a fraction M/N. */
|
||||
@@ -413,6 +420,9 @@ parse_switches(j_decompress_ptr cinfo, int argc, char **argv,
|
||||
usage();
|
||||
crop = TRUE;
|
||||
|
||||
} else if (keymatch(arg, "strict", 2)) {
|
||||
strict = TRUE;
|
||||
|
||||
} else if (keymatch(arg, "targa", 1)) {
|
||||
/* Targa output format. */
|
||||
requested_fmt = FMT_TARGA;
|
||||
@@ -444,7 +454,7 @@ jpeg_getc(j_decompress_ptr cinfo)
|
||||
ERREXIT(cinfo, JERR_CANT_SUSPEND);
|
||||
}
|
||||
datasrc->bytes_in_buffer--;
|
||||
return GETJOCTET(*datasrc->next_input_byte++);
|
||||
return *datasrc->next_input_byte++;
|
||||
}
|
||||
|
||||
|
||||
@@ -499,6 +509,19 @@ print_text_marker(j_decompress_ptr cinfo)
|
||||
}
|
||||
|
||||
|
||||
METHODDEF(void)
|
||||
my_emit_message(j_common_ptr cinfo, int msg_level)
|
||||
{
|
||||
if (msg_level < 0) {
|
||||
/* Treat warning as fatal */
|
||||
cinfo->err->error_exit(cinfo);
|
||||
} else {
|
||||
if (cinfo->err->trace_level >= msg_level)
|
||||
cinfo->err->output_message(cinfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The main program.
|
||||
*/
|
||||
@@ -508,9 +531,7 @@ main(int argc, char **argv)
|
||||
{
|
||||
struct jpeg_decompress_struct cinfo;
|
||||
struct jpeg_error_mgr jerr;
|
||||
#ifdef PROGRESS_REPORT
|
||||
struct cdjpeg_progress_mgr progress;
|
||||
#endif
|
||||
int file_index;
|
||||
djpeg_dest_ptr dest_mgr = NULL;
|
||||
FILE *input_file;
|
||||
@@ -521,11 +542,6 @@ main(int argc, char **argv)
|
||||
#endif
|
||||
JDIMENSION num_scanlines;
|
||||
|
||||
/* On Mac, fetch a command line. */
|
||||
#ifdef USE_CCOMMAND
|
||||
argc = ccommand(&argv);
|
||||
#endif
|
||||
|
||||
progname = argv[0];
|
||||
if (progname == NULL || progname[0] == 0)
|
||||
progname = "djpeg"; /* in case C library doesn't provide it */
|
||||
@@ -557,6 +573,9 @@ main(int argc, char **argv)
|
||||
|
||||
file_index = parse_switches(&cinfo, argc, argv, 0, FALSE);
|
||||
|
||||
if (strict)
|
||||
jerr.emit_message = my_emit_message;
|
||||
|
||||
#ifdef TWO_FILE_COMMANDLINE
|
||||
/* Must have either -outfile switch or explicit output file name */
|
||||
if (outfilename == NULL) {
|
||||
@@ -603,9 +622,11 @@ main(int argc, char **argv)
|
||||
output_file = write_stdout();
|
||||
}
|
||||
|
||||
#ifdef PROGRESS_REPORT
|
||||
if (report || max_scans != 0) {
|
||||
start_progress_monitor((j_common_ptr)&cinfo, &progress);
|
||||
#endif
|
||||
progress.report = report;
|
||||
progress.max_scans = max_scans;
|
||||
}
|
||||
|
||||
/* Specify data source for decompression */
|
||||
#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)
|
||||
@@ -617,7 +638,7 @@ main(int argc, char **argv)
|
||||
fprintf(stderr, "%s: memory allocation failure\n", progname);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
nbytes = JFREAD(input_file, &inbuffer[insize], INPUT_BUF_SIZE);
|
||||
nbytes = fread(&inbuffer[insize], 1, INPUT_BUF_SIZE, input_file);
|
||||
if (nbytes < INPUT_BUF_SIZE && ferror(input_file)) {
|
||||
if (file_index < argc)
|
||||
fprintf(stderr, "%s: can't read from %s\n", progname,
|
||||
@@ -653,7 +674,10 @@ main(int argc, char **argv)
|
||||
#endif
|
||||
#ifdef GIF_SUPPORTED
|
||||
case FMT_GIF:
|
||||
dest_mgr = jinit_write_gif(&cinfo);
|
||||
dest_mgr = jinit_write_gif(&cinfo, TRUE);
|
||||
break;
|
||||
case FMT_GIF0:
|
||||
dest_mgr = jinit_write_gif(&cinfo, FALSE);
|
||||
break;
|
||||
#endif
|
||||
#ifdef PPM_SUPPORTED
|
||||
@@ -661,11 +685,6 @@ main(int argc, char **argv)
|
||||
dest_mgr = jinit_write_ppm(&cinfo);
|
||||
break;
|
||||
#endif
|
||||
#ifdef RLE_SUPPORTED
|
||||
case FMT_RLE:
|
||||
dest_mgr = jinit_write_rle(&cinfo);
|
||||
break;
|
||||
#endif
|
||||
#ifdef TARGA_SUPPORTED
|
||||
case FMT_TARGA:
|
||||
dest_mgr = jinit_write_targa(&cinfo);
|
||||
@@ -689,7 +708,7 @@ main(int argc, char **argv)
|
||||
* that skip_start <= skip_end.
|
||||
*/
|
||||
if (skip_end > cinfo.output_height - 1) {
|
||||
fprintf(stderr, "%s: skip region exceeds image height %d\n", progname,
|
||||
fprintf(stderr, "%s: skip region exceeds image height %u\n", progname,
|
||||
cinfo.output_height);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@@ -710,7 +729,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
if ((tmp = jpeg_skip_scanlines(&cinfo, skip_end - skip_start + 1)) !=
|
||||
skip_end - skip_start + 1) {
|
||||
fprintf(stderr, "%s: jpeg_skip_scanlines() returned %d rather than %d\n",
|
||||
fprintf(stderr, "%s: jpeg_skip_scanlines() returned %u rather than %u\n",
|
||||
progname, tmp, skip_end - skip_start + 1);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@@ -729,7 +748,7 @@ main(int argc, char **argv)
|
||||
*/
|
||||
if (crop_x + crop_width > cinfo.output_width ||
|
||||
crop_y + crop_height > cinfo.output_height) {
|
||||
fprintf(stderr, "%s: crop dimensions exceed image dimensions %d x %d\n",
|
||||
fprintf(stderr, "%s: crop dimensions exceed image dimensions %u x %u\n",
|
||||
progname, cinfo.output_width, cinfo.output_height);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@@ -750,7 +769,7 @@ main(int argc, char **argv)
|
||||
|
||||
/* Process data */
|
||||
if ((tmp = jpeg_skip_scanlines(&cinfo, crop_y)) != crop_y) {
|
||||
fprintf(stderr, "%s: jpeg_skip_scanlines() returned %d rather than %d\n",
|
||||
fprintf(stderr, "%s: jpeg_skip_scanlines() returned %u rather than %u\n",
|
||||
progname, tmp, crop_y);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@@ -763,7 +782,7 @@ main(int argc, char **argv)
|
||||
jpeg_skip_scanlines(&cinfo,
|
||||
cinfo.output_height - crop_y - crop_height)) !=
|
||||
cinfo.output_height - crop_y - crop_height) {
|
||||
fprintf(stderr, "%s: jpeg_skip_scanlines() returned %d rather than %d\n",
|
||||
fprintf(stderr, "%s: jpeg_skip_scanlines() returned %u rather than %u\n",
|
||||
progname, tmp, cinfo.output_height - crop_y - crop_height);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@@ -781,12 +800,11 @@ main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PROGRESS_REPORT
|
||||
/* Hack: count final pass as done in case finish_output does an extra pass.
|
||||
* The library won't have updated completed_passes.
|
||||
*/
|
||||
if (report || max_scans != 0)
|
||||
progress.pub.completed_passes = progress.pub.total_passes;
|
||||
#endif
|
||||
|
||||
if (icc_filename != NULL) {
|
||||
FILE *icc_file;
|
||||
@@ -825,9 +843,8 @@ main(int argc, char **argv)
|
||||
if (output_file != stdout)
|
||||
fclose(output_file);
|
||||
|
||||
#ifdef PROGRESS_REPORT
|
||||
if (report || max_scans != 0)
|
||||
end_progress_monitor((j_common_ptr)&cinfo);
|
||||
#endif
|
||||
|
||||
if (memsrc)
|
||||
free(inbuffer);
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">TurboJPEG
|
||||
 <span id="projectnumber">2.0</span>
|
||||
 <span id="projectnumber">2.1.4</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">TurboJPEG
|
||||
 <span id="projectnumber">2.0</span>
|
||||
 <span id="projectnumber">2.1.4</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">TurboJPEG
|
||||
 <span id="projectnumber">2.0</span>
|
||||
 <span id="projectnumber">2.1.4</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">TurboJPEG
|
||||
 <span id="projectnumber">2.0</span>
|
||||
 <span id="projectnumber">2.1.4</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">TurboJPEG
|
||||
 <span id="projectnumber">2.0</span>
|
||||
 <span id="projectnumber">2.1.4</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -102,26 +102,29 @@ Macros</h2></td></tr>
|
||||
<tr class="memdesc:ga39f57a6fb02d9cf32e7b6890099b5a71"><td class="mdescLeft"> </td><td class="mdescRight">The number of JPEG colorspaces. <a href="group___turbo_j_p_e_g.html#ga39f57a6fb02d9cf32e7b6890099b5a71">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga39f57a6fb02d9cf32e7b6890099b5a71"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga72ecf4ebe6eb702d3c6f5ca27455e1ec"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">TJFLAG_BOTTOMUP</a></td></tr>
|
||||
<tr class="memdesc:ga72ecf4ebe6eb702d3c6f5ca27455e1ec"><td class="mdescLeft"> </td><td class="mdescRight">The uncompressed source/destination image is stored in bottom-up (Windows, OpenGL) order, not top-down (X11) order. <a href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:ga72ecf4ebe6eb702d3c6f5ca27455e1ec"><td class="mdescLeft"> </td><td class="mdescRight">Rows in the packed-pixel source/destination image are stored in bottom-up (Windows, OpenGL) order rather than in top-down (X11) order. <a href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga72ecf4ebe6eb702d3c6f5ca27455e1ec"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga4ee4506c81177a06f77e2504a22efd2d"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga4ee4506c81177a06f77e2504a22efd2d">TJFLAG_FASTUPSAMPLE</a></td></tr>
|
||||
<tr class="memdesc:ga4ee4506c81177a06f77e2504a22efd2d"><td class="mdescLeft"> </td><td class="mdescRight">When decompressing an image that was compressed using chrominance subsampling, use the fastest chrominance upsampling algorithm available in the underlying codec. <a href="group___turbo_j_p_e_g.html#ga4ee4506c81177a06f77e2504a22efd2d">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:ga4ee4506c81177a06f77e2504a22efd2d"><td class="mdescLeft"> </td><td class="mdescRight">When decompressing an image that was compressed using chrominance subsampling, use the fastest chrominance upsampling algorithm available. <a href="group___turbo_j_p_e_g.html#ga4ee4506c81177a06f77e2504a22efd2d">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga4ee4506c81177a06f77e2504a22efd2d"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga8808d403c68b62aaa58a4c1e58e98963"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963">TJFLAG_NOREALLOC</a></td></tr>
|
||||
<tr class="memdesc:ga8808d403c68b62aaa58a4c1e58e98963"><td class="mdescLeft"> </td><td class="mdescRight">Disable buffer (re)allocation. <a href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:ga8808d403c68b62aaa58a4c1e58e98963"><td class="mdescLeft"> </td><td class="mdescRight">Disable JPEG buffer (re)allocation. <a href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga8808d403c68b62aaa58a4c1e58e98963"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:gaabce235db80d3f698b27f36cbd453da2"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gaabce235db80d3f698b27f36cbd453da2">TJFLAG_FASTDCT</a></td></tr>
|
||||
<tr class="memdesc:gaabce235db80d3f698b27f36cbd453da2"><td class="mdescLeft"> </td><td class="mdescRight">Use the fastest DCT/IDCT algorithm available in the underlying codec. <a href="group___turbo_j_p_e_g.html#gaabce235db80d3f698b27f36cbd453da2">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:gaabce235db80d3f698b27f36cbd453da2"><td class="mdescLeft"> </td><td class="mdescRight">Use the fastest DCT/IDCT algorithm available. <a href="group___turbo_j_p_e_g.html#gaabce235db80d3f698b27f36cbd453da2">More...</a><br /></td></tr>
|
||||
<tr class="separator:gaabce235db80d3f698b27f36cbd453da2"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:gacb233cfd722d66d1ccbf48a7de81f0e0"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0">TJFLAG_ACCURATEDCT</a></td></tr>
|
||||
<tr class="memdesc:gacb233cfd722d66d1ccbf48a7de81f0e0"><td class="mdescLeft"> </td><td class="mdescRight">Use the most accurate DCT/IDCT algorithm available in the underlying codec. <a href="group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:gacb233cfd722d66d1ccbf48a7de81f0e0"><td class="mdescLeft"> </td><td class="mdescRight">Use the most accurate DCT/IDCT algorithm available. <a href="group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0">More...</a><br /></td></tr>
|
||||
<tr class="separator:gacb233cfd722d66d1ccbf48a7de81f0e0"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga519cfa4ef6c18d9e5b455fdf59306a3a"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga519cfa4ef6c18d9e5b455fdf59306a3a">TJFLAG_STOPONWARNING</a></td></tr>
|
||||
<tr class="memdesc:ga519cfa4ef6c18d9e5b455fdf59306a3a"><td class="mdescLeft"> </td><td class="mdescRight">Immediately discontinue the current compression/decompression/transform operation if the underlying codec throws a warning (non-fatal error). <a href="group___turbo_j_p_e_g.html#ga519cfa4ef6c18d9e5b455fdf59306a3a">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:ga519cfa4ef6c18d9e5b455fdf59306a3a"><td class="mdescLeft"> </td><td class="mdescRight">Immediately discontinue the current compression/decompression/transform operation if a warning (non-fatal error) occurs. <a href="group___turbo_j_p_e_g.html#ga519cfa4ef6c18d9e5b455fdf59306a3a">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga519cfa4ef6c18d9e5b455fdf59306a3a"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga43b426750b46190a25d34a67ef76df1b"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga43b426750b46190a25d34a67ef76df1b">TJFLAG_PROGRESSIVE</a></td></tr>
|
||||
<tr class="memdesc:ga43b426750b46190a25d34a67ef76df1b"><td class="mdescLeft"> </td><td class="mdescRight">Use progressive entropy coding in JPEG images generated by the compression and transform functions. <a href="group___turbo_j_p_e_g.html#ga43b426750b46190a25d34a67ef76df1b">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga43b426750b46190a25d34a67ef76df1b"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga163e6482dc5096831feef9c79ff3f805"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga163e6482dc5096831feef9c79ff3f805">TJFLAG_LIMITSCANS</a></td></tr>
|
||||
<tr class="memdesc:ga163e6482dc5096831feef9c79ff3f805"><td class="mdescLeft"> </td><td class="mdescRight">Limit the number of progressive JPEG scans that the decompression and transform functions will process. <a href="group___turbo_j_p_e_g.html#ga163e6482dc5096831feef9c79ff3f805">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga163e6482dc5096831feef9c79ff3f805"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga79bde1b4a3e2351e00887e47781b966e"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga79bde1b4a3e2351e00887e47781b966e">TJ_NUMERR</a></td></tr>
|
||||
<tr class="memdesc:ga79bde1b4a3e2351e00887e47781b966e"><td class="mdescLeft"> </td><td class="mdescRight">The number of error codes. <a href="group___turbo_j_p_e_g.html#ga79bde1b4a3e2351e00887e47781b966e">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga79bde1b4a3e2351e00887e47781b966e"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
@@ -138,19 +141,19 @@ Macros</h2></td></tr>
|
||||
<tr class="memdesc:ga9c771a757fc1294add611906b89ab2d2"><td class="mdescLeft"> </td><td class="mdescRight">This option will enable lossless cropping. <a href="group___turbo_j_p_e_g.html#ga9c771a757fc1294add611906b89ab2d2">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga9c771a757fc1294add611906b89ab2d2"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga3acee7b48ade1b99e5588736007c2589"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga3acee7b48ade1b99e5588736007c2589">TJXOPT_GRAY</a></td></tr>
|
||||
<tr class="memdesc:ga3acee7b48ade1b99e5588736007c2589"><td class="mdescLeft"> </td><td class="mdescRight">This option will discard the color data in the input image and produce a grayscale output image. <a href="group___turbo_j_p_e_g.html#ga3acee7b48ade1b99e5588736007c2589">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:ga3acee7b48ade1b99e5588736007c2589"><td class="mdescLeft"> </td><td class="mdescRight">This option will discard the color data in the source image and produce a grayscale destination image. <a href="group___turbo_j_p_e_g.html#ga3acee7b48ade1b99e5588736007c2589">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga3acee7b48ade1b99e5588736007c2589"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:gafbf992bbf6e006705886333703ffab31"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gafbf992bbf6e006705886333703ffab31">TJXOPT_NOOUTPUT</a></td></tr>
|
||||
<tr class="memdesc:gafbf992bbf6e006705886333703ffab31"><td class="mdescLeft"> </td><td class="mdescRight">This option will prevent <a class="el" href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> from outputting a JPEG image for this particular transform (this can be used in conjunction with a custom filter to capture the transformed DCT coefficients without transcoding them.) <a href="group___turbo_j_p_e_g.html#gafbf992bbf6e006705886333703ffab31">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:gafbf992bbf6e006705886333703ffab31"><td class="mdescLeft"> </td><td class="mdescRight">This option will prevent <a class="el" href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> from outputting a JPEG image for this particular transform. <a href="group___turbo_j_p_e_g.html#gafbf992bbf6e006705886333703ffab31">More...</a><br /></td></tr>
|
||||
<tr class="separator:gafbf992bbf6e006705886333703ffab31"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:gad2371c80674584ecc1a7d75e564cf026"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gad2371c80674584ecc1a7d75e564cf026">TJXOPT_PROGRESSIVE</a></td></tr>
|
||||
<tr class="memdesc:gad2371c80674584ecc1a7d75e564cf026"><td class="mdescLeft"> </td><td class="mdescRight">This option will enable progressive entropy coding in the output image generated by this particular transform. <a href="group___turbo_j_p_e_g.html#gad2371c80674584ecc1a7d75e564cf026">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:gad2371c80674584ecc1a7d75e564cf026"><td class="mdescLeft"> </td><td class="mdescRight">This option will enable progressive entropy coding in the JPEG image generated by this particular transform. <a href="group___turbo_j_p_e_g.html#gad2371c80674584ecc1a7d75e564cf026">More...</a><br /></td></tr>
|
||||
<tr class="separator:gad2371c80674584ecc1a7d75e564cf026"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga153b468cfb905d0de61706c838986fe8"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga153b468cfb905d0de61706c838986fe8">TJXOPT_COPYNONE</a></td></tr>
|
||||
<tr class="memdesc:ga153b468cfb905d0de61706c838986fe8"><td class="mdescLeft"> </td><td class="mdescRight">This option will prevent <a class="el" href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> from copying any extra markers (including EXIF and ICC profile data) from the source image to the output image. <a href="group___turbo_j_p_e_g.html#ga153b468cfb905d0de61706c838986fe8">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:ga153b468cfb905d0de61706c838986fe8"><td class="mdescLeft"> </td><td class="mdescRight">This option will prevent <a class="el" href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> from copying any extra markers (including EXIF and ICC profile data) from the source image to the destination image. <a href="group___turbo_j_p_e_g.html#ga153b468cfb905d0de61706c838986fe8">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga153b468cfb905d0de61706c838986fe8"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga0aba955473315e405295d978f0c16511"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511">TJPAD</a>(width)</td></tr>
|
||||
<tr class="memdesc:ga0aba955473315e405295d978f0c16511"><td class="mdescLeft"> </td><td class="mdescRight">Pad the given width to the nearest 32-bit boundary. <a href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:ga0aba955473315e405295d978f0c16511"><td class="mdescLeft"> </td><td class="mdescRight">Pad the given width to the nearest multiple of 4. <a href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga0aba955473315e405295d978f0c16511"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga84878bb65404204743aa18cac02781df"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df">TJSCALED</a>(dimension, scalingFactor)</td></tr>
|
||||
<tr class="memdesc:ga84878bb65404204743aa18cac02781df"><td class="mdescLeft"> </td><td class="mdescRight">Compute the scaled value of <code>dimension</code> using the given scaling factor. <a href="group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df">More...</a><br /></td></tr>
|
||||
@@ -237,20 +240,20 @@ Functions</h2></td></tr>
|
||||
<tr class="memdesc:ga9d63a05fc6d813f4aae06107041a37e8"><td class="mdescLeft"> </td><td class="mdescRight">Create a TurboJPEG compressor instance. <a href="group___turbo_j_p_e_g.html#ga9d63a05fc6d813f4aae06107041a37e8">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga9d63a05fc6d813f4aae06107041a37e8"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:gafbdce0112fd78fd38efae841443a9bcf"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gafbdce0112fd78fd38efae841443a9bcf">tjCompress2</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegSubsamp, int jpegQual, int flags)</td></tr>
|
||||
<tr class="memdesc:gafbdce0112fd78fd38efae841443a9bcf"><td class="mdescLeft"> </td><td class="mdescRight">Compress an RGB, grayscale, or CMYK image into a JPEG image. <a href="group___turbo_j_p_e_g.html#gafbdce0112fd78fd38efae841443a9bcf">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:gafbdce0112fd78fd38efae841443a9bcf"><td class="mdescLeft"> </td><td class="mdescRight">Compress a packed-pixel RGB, grayscale, or CMYK image into a JPEG image. <a href="group___turbo_j_p_e_g.html#gafbdce0112fd78fd38efae841443a9bcf">More...</a><br /></td></tr>
|
||||
<tr class="separator:gafbdce0112fd78fd38efae841443a9bcf"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga7622a459b79aa1007e005b58783f875b"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga7622a459b79aa1007e005b58783f875b">tjCompressFromYUV</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *srcBuf, int width, int pad, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags)</td></tr>
|
||||
<tr class="memdesc:ga7622a459b79aa1007e005b58783f875b"><td class="mdescLeft"> </td><td class="mdescRight">Compress a YUV planar image into a JPEG image. <a href="group___turbo_j_p_e_g.html#ga7622a459b79aa1007e005b58783f875b">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga7622a459b79aa1007e005b58783f875b"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:gab40f5096a72fd7e5bda9d6b58fa37e2e"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gab40f5096a72fd7e5bda9d6b58fa37e2e">tjCompressFromYUV</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *srcBuf, int width, int align, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags)</td></tr>
|
||||
<tr class="memdesc:gab40f5096a72fd7e5bda9d6b58fa37e2e"><td class="mdescLeft"> </td><td class="mdescRight">Compress a unified planar YUV image into a JPEG image. <a href="group___turbo_j_p_e_g.html#gab40f5096a72fd7e5bda9d6b58fa37e2e">More...</a><br /></td></tr>
|
||||
<tr class="separator:gab40f5096a72fd7e5bda9d6b58fa37e2e"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga29ec5dfbd2d84b8724e951d6fa0d5d9e"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga29ec5dfbd2d84b8724e951d6fa0d5d9e">tjCompressFromYUVPlanes</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char **srcPlanes, int width, const int *strides, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags)</td></tr>
|
||||
<tr class="memdesc:ga29ec5dfbd2d84b8724e951d6fa0d5d9e"><td class="mdescLeft"> </td><td class="mdescRight">Compress a set of Y, U (Cb), and V (Cr) image planes into a JPEG image. <a href="group___turbo_j_p_e_g.html#ga29ec5dfbd2d84b8724e951d6fa0d5d9e">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga29ec5dfbd2d84b8724e951d6fa0d5d9e"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga67ac12fee79073242cb216e07c9f1f90"><td class="memItemLeft" align="right" valign="top">DLLEXPORT unsigned long </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga67ac12fee79073242cb216e07c9f1f90">tjBufSize</a> (int width, int height, int jpegSubsamp)</td></tr>
|
||||
<tr class="memdesc:ga67ac12fee79073242cb216e07c9f1f90"><td class="mdescLeft"> </td><td class="mdescRight">The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters. <a href="group___turbo_j_p_e_g.html#ga67ac12fee79073242cb216e07c9f1f90">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga67ac12fee79073242cb216e07c9f1f90"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga2be2b9969d4df9ecce9b05deed273194"><td class="memItemLeft" align="right" valign="top">DLLEXPORT unsigned long </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga2be2b9969d4df9ecce9b05deed273194">tjBufSizeYUV2</a> (int width, int pad, int height, int subsamp)</td></tr>
|
||||
<tr class="memdesc:ga2be2b9969d4df9ecce9b05deed273194"><td class="mdescLeft"> </td><td class="mdescRight">The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters. <a href="group___turbo_j_p_e_g.html#ga2be2b9969d4df9ecce9b05deed273194">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga2be2b9969d4df9ecce9b05deed273194"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga5e5aac9e8bcf17049279301e2466474c"><td class="memItemLeft" align="right" valign="top">DLLEXPORT unsigned long </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga5e5aac9e8bcf17049279301e2466474c">tjBufSizeYUV2</a> (int width, int align, int height, int subsamp)</td></tr>
|
||||
<tr class="memdesc:ga5e5aac9e8bcf17049279301e2466474c"><td class="mdescLeft"> </td><td class="mdescRight">The size of the buffer (in bytes) required to hold a unified planar YUV image with the given parameters. <a href="group___turbo_j_p_e_g.html#ga5e5aac9e8bcf17049279301e2466474c">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga5e5aac9e8bcf17049279301e2466474c"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:gab4ab7b24f6e797d79abaaa670373961d"><td class="memItemLeft" align="right" valign="top">DLLEXPORT unsigned long </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gab4ab7b24f6e797d79abaaa670373961d">tjPlaneSizeYUV</a> (int componentID, int width, int stride, int height, int subsamp)</td></tr>
|
||||
<tr class="memdesc:gab4ab7b24f6e797d79abaaa670373961d"><td class="mdescLeft"> </td><td class="mdescRight">The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters. <a href="group___turbo_j_p_e_g.html#gab4ab7b24f6e797d79abaaa670373961d">More...</a><br /></td></tr>
|
||||
<tr class="separator:gab4ab7b24f6e797d79abaaa670373961d"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
@@ -260,35 +263,35 @@ Functions</h2></td></tr>
|
||||
<tr class="memitem:ga1a209696c6a80748f20e134b3c64789f"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga1a209696c6a80748f20e134b3c64789f">tjPlaneHeight</a> (int componentID, int height, int subsamp)</td></tr>
|
||||
<tr class="memdesc:ga1a209696c6a80748f20e134b3c64789f"><td class="mdescLeft"> </td><td class="mdescRight">The plane height of a YUV image plane with the given parameters. <a href="group___turbo_j_p_e_g.html#ga1a209696c6a80748f20e134b3c64789f">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga1a209696c6a80748f20e134b3c64789f"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:gac519b922cdf446e97d0cdcba513636bf"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gac519b922cdf446e97d0cdcba513636bf">tjEncodeYUV3</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char *dstBuf, int pad, int subsamp, int flags)</td></tr>
|
||||
<tr class="memdesc:gac519b922cdf446e97d0cdcba513636bf"><td class="mdescLeft"> </td><td class="mdescRight">Encode an RGB or grayscale image into a YUV planar image. <a href="group___turbo_j_p_e_g.html#gac519b922cdf446e97d0cdcba513636bf">More...</a><br /></td></tr>
|
||||
<tr class="separator:gac519b922cdf446e97d0cdcba513636bf"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga5d619e0a02b71e05a8dffb764f6d7a64"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga5d619e0a02b71e05a8dffb764f6d7a64">tjEncodeYUV3</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char *dstBuf, int align, int subsamp, int flags)</td></tr>
|
||||
<tr class="memdesc:ga5d619e0a02b71e05a8dffb764f6d7a64"><td class="mdescLeft"> </td><td class="mdescRight">Encode a packed-pixel RGB or grayscale image into a unified planar YUV image. <a href="group___turbo_j_p_e_g.html#ga5d619e0a02b71e05a8dffb764f6d7a64">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga5d619e0a02b71e05a8dffb764f6d7a64"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:gae2d04c72457fe7f4d60cf78ab1b1feb1"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gae2d04c72457fe7f4d60cf78ab1b1feb1">tjEncodeYUVPlanes</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char **dstPlanes, int *strides, int subsamp, int flags)</td></tr>
|
||||
<tr class="memdesc:gae2d04c72457fe7f4d60cf78ab1b1feb1"><td class="mdescLeft"> </td><td class="mdescRight">Encode an RGB or grayscale image into separate Y, U (Cb), and V (Cr) image planes. <a href="group___turbo_j_p_e_g.html#gae2d04c72457fe7f4d60cf78ab1b1feb1">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:gae2d04c72457fe7f4d60cf78ab1b1feb1"><td class="mdescLeft"> </td><td class="mdescRight">Encode a packed-pixel RGB or grayscale image into separate Y, U (Cb), and V (Cr) image planes. <a href="group___turbo_j_p_e_g.html#gae2d04c72457fe7f4d60cf78ab1b1feb1">More...</a><br /></td></tr>
|
||||
<tr class="separator:gae2d04c72457fe7f4d60cf78ab1b1feb1"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga52300eac3f3d9ef4bab303bc244f62d3"><td class="memItemLeft" align="right" valign="top">DLLEXPORT <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga52300eac3f3d9ef4bab303bc244f62d3">tjInitDecompress</a> (void)</td></tr>
|
||||
<tr class="memdesc:ga52300eac3f3d9ef4bab303bc244f62d3"><td class="mdescLeft"> </td><td class="mdescRight">Create a TurboJPEG decompressor instance. <a href="group___turbo_j_p_e_g.html#ga52300eac3f3d9ef4bab303bc244f62d3">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga52300eac3f3d9ef4bab303bc244f62d3"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga0595681096bba7199cc6f3533cb25f77"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga0595681096bba7199cc6f3533cb25f77">tjDecompressHeader3</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *jpegBuf, unsigned long jpegSize, int *width, int *height, int *jpegSubsamp, int *jpegColorspace)</td></tr>
|
||||
<tr class="memdesc:ga0595681096bba7199cc6f3533cb25f77"><td class="mdescLeft"> </td><td class="mdescRight">Retrieve information about a JPEG image without decompressing it. <a href="group___turbo_j_p_e_g.html#ga0595681096bba7199cc6f3533cb25f77">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:ga0595681096bba7199cc6f3533cb25f77"><td class="mdescLeft"> </td><td class="mdescRight">Retrieve information about a JPEG image without decompressing it, or prime the decompressor with quantization and Huffman tables. <a href="group___turbo_j_p_e_g.html#ga0595681096bba7199cc6f3533cb25f77">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga0595681096bba7199cc6f3533cb25f77"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:gac3854476006b10787bd128f7ede48057"><td class="memItemLeft" align="right" valign="top">DLLEXPORT <a class="el" href="structtjscalingfactor.html">tjscalingfactor</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gac3854476006b10787bd128f7ede48057">tjGetScalingFactors</a> (int *numscalingfactors)</td></tr>
|
||||
<tr class="memdesc:gac3854476006b10787bd128f7ede48057"><td class="mdescLeft"> </td><td class="mdescRight">Returns a list of fractional scaling factors that the JPEG decompressor in this implementation of TurboJPEG supports. <a href="group___turbo_j_p_e_g.html#gac3854476006b10787bd128f7ede48057">More...</a><br /></td></tr>
|
||||
<tr class="separator:gac3854476006b10787bd128f7ede48057"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga193d0977b3b9966d53a6c402e90899b1"><td class="memItemLeft" align="right" valign="top">DLLEXPORT <a class="el" href="structtjscalingfactor.html">tjscalingfactor</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga193d0977b3b9966d53a6c402e90899b1">tjGetScalingFactors</a> (int *numScalingFactors)</td></tr>
|
||||
<tr class="memdesc:ga193d0977b3b9966d53a6c402e90899b1"><td class="mdescLeft"> </td><td class="mdescRight">Returns a list of fractional scaling factors that the JPEG decompressor supports. <a href="group___turbo_j_p_e_g.html#ga193d0977b3b9966d53a6c402e90899b1">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga193d0977b3b9966d53a6c402e90899b1"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:gae9eccef8b682a48f43a9117c231ed013"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gae9eccef8b682a48f43a9117c231ed013">tjDecompress2</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)</td></tr>
|
||||
<tr class="memdesc:gae9eccef8b682a48f43a9117c231ed013"><td class="mdescLeft"> </td><td class="mdescRight">Decompress a JPEG image to an RGB, grayscale, or CMYK image. <a href="group___turbo_j_p_e_g.html#gae9eccef8b682a48f43a9117c231ed013">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:gae9eccef8b682a48f43a9117c231ed013"><td class="mdescLeft"> </td><td class="mdescRight">Decompress a JPEG image into a packed-pixel RGB, grayscale, or CMYK image. <a href="group___turbo_j_p_e_g.html#gae9eccef8b682a48f43a9117c231ed013">More...</a><br /></td></tr>
|
||||
<tr class="separator:gae9eccef8b682a48f43a9117c231ed013"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga04d1e839ff9a0860dd1475cff78d3364"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga04d1e839ff9a0860dd1475cff78d3364">tjDecompressToYUV2</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, int width, int pad, int height, int flags)</td></tr>
|
||||
<tr class="memdesc:ga04d1e839ff9a0860dd1475cff78d3364"><td class="mdescLeft"> </td><td class="mdescRight">Decompress a JPEG image to a YUV planar image. <a href="group___turbo_j_p_e_g.html#ga04d1e839ff9a0860dd1475cff78d3364">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga04d1e839ff9a0860dd1475cff78d3364"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga5a3093e325598c17a9f004323af6fafa"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga5a3093e325598c17a9f004323af6fafa">tjDecompressToYUV2</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, int width, int align, int height, int flags)</td></tr>
|
||||
<tr class="memdesc:ga5a3093e325598c17a9f004323af6fafa"><td class="mdescLeft"> </td><td class="mdescRight">Decompress a JPEG image into a unified planar YUV image. <a href="group___turbo_j_p_e_g.html#ga5a3093e325598c17a9f004323af6fafa">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga5a3093e325598c17a9f004323af6fafa"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:gaa59f901a5258ada5bd0185ad59368540"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gaa59f901a5258ada5bd0185ad59368540">tjDecompressToYUVPlanes</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *jpegBuf, unsigned long jpegSize, unsigned char **dstPlanes, int width, int *strides, int height, int flags)</td></tr>
|
||||
<tr class="memdesc:gaa59f901a5258ada5bd0185ad59368540"><td class="mdescLeft"> </td><td class="mdescRight">Decompress a JPEG image into separate Y, U (Cb), and V (Cr) image planes. <a href="group___turbo_j_p_e_g.html#gaa59f901a5258ada5bd0185ad59368540">More...</a><br /></td></tr>
|
||||
<tr class="separator:gaa59f901a5258ada5bd0185ad59368540"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga70abbf38f77a26fd6da8813bef96f695"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga70abbf38f77a26fd6da8813bef96f695">tjDecodeYUV</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *srcBuf, int pad, int subsamp, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)</td></tr>
|
||||
<tr class="memdesc:ga70abbf38f77a26fd6da8813bef96f695"><td class="mdescLeft"> </td><td class="mdescRight">Decode a YUV planar image into an RGB or grayscale image. <a href="group___turbo_j_p_e_g.html#ga70abbf38f77a26fd6da8813bef96f695">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga70abbf38f77a26fd6da8813bef96f695"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga97c2cedc1e2bade15a84164c94e503c1"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga97c2cedc1e2bade15a84164c94e503c1">tjDecodeYUV</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *srcBuf, int align, int subsamp, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)</td></tr>
|
||||
<tr class="memdesc:ga97c2cedc1e2bade15a84164c94e503c1"><td class="mdescLeft"> </td><td class="mdescRight">Decode a unified planar YUV image into a packed-pixel RGB or grayscale image. <a href="group___turbo_j_p_e_g.html#ga97c2cedc1e2bade15a84164c94e503c1">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga97c2cedc1e2bade15a84164c94e503c1"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga10e837c07fa9d25770565b237d3898d9"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga10e837c07fa9d25770565b237d3898d9">tjDecodeYUVPlanes</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char **srcPlanes, const int *strides, int subsamp, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)</td></tr>
|
||||
<tr class="memdesc:ga10e837c07fa9d25770565b237d3898d9"><td class="mdescLeft"> </td><td class="mdescRight">Decode a set of Y, U (Cb), and V (Cr) image planes into an RGB or grayscale image. <a href="group___turbo_j_p_e_g.html#ga10e837c07fa9d25770565b237d3898d9">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:ga10e837c07fa9d25770565b237d3898d9"><td class="mdescLeft"> </td><td class="mdescRight">Decode a set of Y, U (Cb), and V (Cr) image planes into a packed-pixel RGB or grayscale image. <a href="group___turbo_j_p_e_g.html#ga10e837c07fa9d25770565b237d3898d9">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga10e837c07fa9d25770565b237d3898d9"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga928beff6ac248ceadf01089fc6b41957"><td class="memItemLeft" align="right" valign="top">DLLEXPORT <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga928beff6ac248ceadf01089fc6b41957">tjInitTransform</a> (void)</td></tr>
|
||||
<tr class="memdesc:ga928beff6ac248ceadf01089fc6b41957"><td class="mdescLeft"> </td><td class="mdescRight">Create a new TurboJPEG transformer instance. <a href="group___turbo_j_p_e_g.html#ga928beff6ac248ceadf01089fc6b41957">More...</a><br /></td></tr>
|
||||
@@ -300,16 +303,16 @@ Functions</h2></td></tr>
|
||||
<tr class="memdesc:ga75f355fa27225ba1a4ee392c852394d2"><td class="mdescLeft"> </td><td class="mdescRight">Destroy a TurboJPEG compressor, decompressor, or transformer instance. <a href="group___turbo_j_p_e_g.html#ga75f355fa27225ba1a4ee392c852394d2">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga75f355fa27225ba1a4ee392c852394d2"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:gaec627dd4c5f30b7a775a7aea3bec5d83"><td class="memItemLeft" align="right" valign="top">DLLEXPORT unsigned char * </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83">tjAlloc</a> (int bytes)</td></tr>
|
||||
<tr class="memdesc:gaec627dd4c5f30b7a775a7aea3bec5d83"><td class="mdescLeft"> </td><td class="mdescRight">Allocate an image buffer for use with TurboJPEG. <a href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:gaec627dd4c5f30b7a775a7aea3bec5d83"><td class="mdescLeft"> </td><td class="mdescRight">Allocate a byte buffer for use with TurboJPEG. <a href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83">More...</a><br /></td></tr>
|
||||
<tr class="separator:gaec627dd4c5f30b7a775a7aea3bec5d83"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:gaffbd83c375e79f5db4b5c5d8ad4466e7"><td class="memItemLeft" align="right" valign="top">DLLEXPORT unsigned char * </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gaffbd83c375e79f5db4b5c5d8ad4466e7">tjLoadImage</a> (const char *filename, int *width, int align, int *height, int *pixelFormat, int flags)</td></tr>
|
||||
<tr class="memdesc:gaffbd83c375e79f5db4b5c5d8ad4466e7"><td class="mdescLeft"> </td><td class="mdescRight">Load an uncompressed image from disk into memory. <a href="group___turbo_j_p_e_g.html#gaffbd83c375e79f5db4b5c5d8ad4466e7">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:gaffbd83c375e79f5db4b5c5d8ad4466e7"><td class="mdescLeft"> </td><td class="mdescRight">Load a packed-pixel image from disk into memory. <a href="group___turbo_j_p_e_g.html#gaffbd83c375e79f5db4b5c5d8ad4466e7">More...</a><br /></td></tr>
|
||||
<tr class="separator:gaffbd83c375e79f5db4b5c5d8ad4466e7"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga6f445b22d8933ae4815b3370a538d879"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga6f445b22d8933ae4815b3370a538d879">tjSaveImage</a> (const char *filename, unsigned char *buffer, int width, int pitch, int height, int pixelFormat, int flags)</td></tr>
|
||||
<tr class="memdesc:ga6f445b22d8933ae4815b3370a538d879"><td class="mdescLeft"> </td><td class="mdescRight">Save an uncompressed image from memory to disk. <a href="group___turbo_j_p_e_g.html#ga6f445b22d8933ae4815b3370a538d879">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:ga6f445b22d8933ae4815b3370a538d879"><td class="mdescLeft"> </td><td class="mdescRight">Save a packed-pixel image from memory to disk. <a href="group___turbo_j_p_e_g.html#ga6f445b22d8933ae4815b3370a538d879">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga6f445b22d8933ae4815b3370a538d879"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:gaea863d2da0cdb609563aabdf9196514b"><td class="memItemLeft" align="right" valign="top">DLLEXPORT void </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gaea863d2da0cdb609563aabdf9196514b">tjFree</a> (unsigned char *buffer)</td></tr>
|
||||
<tr class="memdesc:gaea863d2da0cdb609563aabdf9196514b"><td class="mdescLeft"> </td><td class="mdescRight">Free an image buffer previously allocated by TurboJPEG. <a href="group___turbo_j_p_e_g.html#gaea863d2da0cdb609563aabdf9196514b">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:gaea863d2da0cdb609563aabdf9196514b"><td class="mdescLeft"> </td><td class="mdescRight">Free a byte buffer previously allocated by TurboJPEG. <a href="group___turbo_j_p_e_g.html#gaea863d2da0cdb609563aabdf9196514b">More...</a><br /></td></tr>
|
||||
<tr class="separator:gaea863d2da0cdb609563aabdf9196514b"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga1ead8574f9f39fbafc6b497124e7aafa"><td class="memItemLeft" align="right" valign="top">DLLEXPORT char * </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa">tjGetErrorStr2</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle)</td></tr>
|
||||
<tr class="memdesc:ga1ead8574f9f39fbafc6b497124e7aafa"><td class="mdescLeft"> </td><td class="mdescRight">Returns a descriptive error message explaining why the last command failed. <a href="group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa">More...</a><br /></td></tr>
|
||||
@@ -349,8 +352,8 @@ Variables</h2></td></tr>
|
||||
<h2><a class="anchor" id="autotoc_md0"></a>
|
||||
YUV Image Format Notes</h2>
|
||||
<p>Technically, the JPEG format uses the YCbCr colorspace (which is technically not a colorspace but a color transform), but per the convention of the digital video community, the TurboJPEG API uses "YUV" to refer to an image format consisting of Y, Cb, and Cr image planes.</p>
|
||||
<p>Each plane is simply a 2D array of bytes, each byte representing the value of one of the components (Y, Cb, or Cr) at a particular location in the image. The width and height of each plane are determined by the image width, height, and level of chrominance subsampling. The luminance plane width is the image width padded to the nearest multiple of the horizontal subsampling factor (2 in the case of 4:2:0 and 4:2:2, 4 in the case of 4:1:1, 1 in the case of 4:4:4 or grayscale.) Similarly, the luminance plane height is the image height padded to the nearest multiple of the vertical subsampling factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4 or grayscale.) This is irrespective of any additional padding that may be specified as an argument to the various YUV functions. The chrominance plane width is equal to the luminance plane width divided by the horizontal subsampling factor, and the chrominance plane height is equal to the luminance plane height divided by the vertical subsampling factor.</p>
|
||||
<p>For example, if the source image is 35 x 35 pixels and 4:2:2 subsampling is used, then the luminance plane would be 36 x 35 bytes, and each of the chrominance planes would be 18 x 35 bytes. If you specify a line padding of 4 bytes on top of this, then the luminance plane would be 36 x 35 bytes, and each of the chrominance planes would be 20 x 35 bytes. </p>
|
||||
<p>Each plane is simply a 2D array of bytes, each byte representing the value of one of the components (Y, Cb, or Cr) at a particular location in the image. The width and height of each plane are determined by the image width, height, and level of chrominance subsampling. The luminance plane width is the image width padded to the nearest multiple of the horizontal subsampling factor (1 in the case of 4:4:4, grayscale, or 4:4:0; 2 in the case of 4:2:2 or 4:2:0; 4 in the case of 4:1:1.) Similarly, the luminance plane height is the image height padded to the nearest multiple of the vertical subsampling factor (1 in the case of 4:4:4, 4:2:2, grayscale, or 4:1:1; 2 in the case of 4:2:0 or 4:4:0.) This is irrespective of any additional padding that may be specified as an argument to the various YUV functions. The chrominance plane width is equal to the luminance plane width divided by the horizontal subsampling factor, and the chrominance plane height is equal to the luminance plane height divided by the vertical subsampling factor.</p>
|
||||
<p>For example, if the source image is 35 x 35 pixels and 4:2:2 subsampling is used, then the luminance plane would be 36 x 35 bytes, and each of the chrominance planes would be 18 x 35 bytes. If you specify a row alignment of 4 bytes on top of this, then the luminance plane would be 36 x 35 bytes, and each of the chrominance planes would be 20 x 35 bytes. </p>
|
||||
<h2 class="groupheader">Macro Definition Documentation</h2>
|
||||
<a id="ga39f57a6fb02d9cf32e7b6890099b5a71"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ga39f57a6fb02d9cf32e7b6890099b5a71">◆ </a></span>TJ_NUMCS</h2>
|
||||
@@ -444,8 +447,8 @@ YUV Image Format Notes</h2>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Use the most accurate DCT/IDCT algorithm available in the underlying codec. </p>
|
||||
<p>The default if this flag is not specified is implementation-specific. For example, the implementation of TurboJPEG for libjpeg[-turbo] uses the fast algorithm by default when compressing, because this has been shown to have only a very slight effect on accuracy, but it uses the accurate algorithm when decompressing, because this has been shown to have a larger effect. </p>
|
||||
<p>Use the most accurate DCT/IDCT algorithm available. </p>
|
||||
<p>The default if this flag is not specified is implementation-specific. For example, the implementation of the TurboJPEG API in libjpeg-turbo uses the fast algorithm by default when compressing, because this has been shown to have only a very slight effect on accuracy, but it uses the accurate algorithm when decompressing, because this has been shown to have a larger effect. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -461,7 +464,7 @@ YUV Image Format Notes</h2>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>The uncompressed source/destination image is stored in bottom-up (Windows, OpenGL) order, not top-down (X11) order. </p>
|
||||
<p>Rows in the packed-pixel source/destination image are stored in bottom-up (Windows, OpenGL) order rather than in top-down (X11) order. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -477,8 +480,8 @@ YUV Image Format Notes</h2>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Use the fastest DCT/IDCT algorithm available in the underlying codec. </p>
|
||||
<p>The default if this flag is not specified is implementation-specific. For example, the implementation of TurboJPEG for libjpeg[-turbo] uses the fast algorithm by default when compressing, because this has been shown to have only a very slight effect on accuracy, but it uses the accurate algorithm when decompressing, because this has been shown to have a larger effect. </p>
|
||||
<p>Use the fastest DCT/IDCT algorithm available. </p>
|
||||
<p>The default if this flag is not specified is implementation-specific. For example, the implementation of the TurboJPEG API in libjpeg-turbo uses the fast algorithm by default when compressing, because this has been shown to have only a very slight effect on accuracy, but it uses the accurate algorithm when decompressing, because this has been shown to have a larger effect. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -494,9 +497,26 @@ YUV Image Format Notes</h2>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>When decompressing an image that was compressed using chrominance subsampling, use the fastest chrominance upsampling algorithm available in the underlying codec. </p>
|
||||
<p>When decompressing an image that was compressed using chrominance subsampling, use the fastest chrominance upsampling algorithm available. </p>
|
||||
<p>The default is to use smooth upsampling, which creates a smooth transition between neighboring chrominance components in order to reduce upsampling artifacts in the decompressed image. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="ga163e6482dc5096831feef9c79ff3f805"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ga163e6482dc5096831feef9c79ff3f805">◆ </a></span>TJFLAG_LIMITSCANS</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">#define TJFLAG_LIMITSCANS</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Limit the number of progressive JPEG scans that the decompression and transform functions will process. </p>
|
||||
<p>If a progressive JPEG image contains an unreasonably large number of scans, then this flag will cause the decompression and transform functions to return an error. The primary purpose of this is to allow security-critical applications to guard against an exploit of the progressive JPEG format described in <a href="https://libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf" target="_blank">this report</a>. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="ga8808d403c68b62aaa58a4c1e58e98963"></a>
|
||||
@@ -511,8 +531,8 @@ YUV Image Format Notes</h2>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Disable buffer (re)allocation. </p>
|
||||
<p>If passed to one of the JPEG compression or transform functions, this flag will cause those functions to generate an error if the JPEG image buffer is invalid or too small rather than attempting to allocate or reallocate that buffer. This reproduces the behavior of earlier versions of TurboJPEG. </p>
|
||||
<p>Disable JPEG buffer (re)allocation. </p>
|
||||
<p>If passed to one of the JPEG compression or transform functions, this flag will cause those functions to generate an error if the JPEG destination buffer is invalid or too small, rather than attempt to allocate or reallocate that buffer. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -545,7 +565,7 @@ YUV Image Format Notes</h2>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Immediately discontinue the current compression/decompression/transform operation if the underlying codec throws a warning (non-fatal error). </p>
|
||||
<p>Immediately discontinue the current compression/decompression/transform operation if a warning (non-fatal error) occurs. </p>
|
||||
<p>The default behavior is to allow the operation to complete unless a fatal error is encountered. </p>
|
||||
|
||||
</div>
|
||||
@@ -566,7 +586,7 @@ YUV Image Format Notes</h2>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Pad the given width to the nearest 32-bit boundary. </p>
|
||||
<p>Pad the given width to the nearest multiple of 4. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -613,7 +633,7 @@ YUV Image Format Notes</h2>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>This option will prevent <a class="el" href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> from copying any extra markers (including EXIF and ICC profile data) from the source image to the output image. </p>
|
||||
<p>This option will prevent <a class="el" href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> from copying any extra markers (including EXIF and ICC profile data) from the source image to the destination image. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -646,7 +666,7 @@ YUV Image Format Notes</h2>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>This option will discard the color data in the input image and produce a grayscale output image. </p>
|
||||
<p>This option will discard the color data in the source image and produce a grayscale destination image. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -662,7 +682,8 @@ YUV Image Format Notes</h2>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>This option will prevent <a class="el" href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> from outputting a JPEG image for this particular transform (this can be used in conjunction with a custom filter to capture the transformed DCT coefficients without transcoding them.) </p>
|
||||
<p>This option will prevent <a class="el" href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> from outputting a JPEG image for this particular transform. </p>
|
||||
<p>(This can be used in conjunction with a custom filter to capture the transformed DCT coefficients without transcoding them.) </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -695,8 +716,8 @@ YUV Image Format Notes</h2>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>This option will enable progressive entropy coding in the output image generated by this particular transform. </p>
|
||||
<p>Progressive entropy coding will generally improve compression relative to baseline entropy coding (the default), but it will reduce compression and decompression performance considerably. </p>
|
||||
<p>This option will enable progressive entropy coding in the JPEG image generated by this particular transform. </p>
|
||||
<p>Progressive entropy coding will generally improve compression relative to baseline entropy coding (the default), but it will reduce decompression performance considerably. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -765,19 +786,19 @@ YUV Image Format Notes</h2>
|
||||
<p>JPEG colorspaces. </p>
|
||||
<table class="fieldtable">
|
||||
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="gga4f83ad3368e0e29d1957be0efa7c3720a677cb7ccb85c4038ac41964a2e09e555"></a>TJCS_RGB </td><td class="fielddoc"><p>RGB colorspace. </p>
|
||||
<p>When compressing the JPEG image, the R, G, and B components in the source image are reordered into image planes, but no colorspace conversion or subsampling is performed. RGB JPEG images can be decompressed to any of the extended RGB pixel formats or grayscale, but they cannot be decompressed to YUV images. </p>
|
||||
<p>When compressing the JPEG image, the R, G, and B components in the source image are reordered into image planes, but no colorspace conversion or subsampling is performed. RGB JPEG images can be decompressed to packed-pixel images with any of the extended RGB or grayscale pixel formats, but they cannot be decompressed to planar YUV images. </p>
|
||||
</td></tr>
|
||||
<tr><td class="fieldname"><a id="gga4f83ad3368e0e29d1957be0efa7c3720a7389b8f65bb387ffedce3efd0d78ec75"></a>TJCS_YCbCr </td><td class="fielddoc"><p>YCbCr colorspace. </p>
|
||||
<p>YCbCr is not an absolute colorspace but rather a mathematical transformation of RGB designed solely for storage and transmission. YCbCr images must be converted to RGB before they can actually be displayed. In the YCbCr colorspace, the Y (luminance) component represents the black & white portion of the original image, and the Cb and Cr (chrominance) components represent the color portion of the original image. Originally, the analog equivalent of this transformation allowed the same signal to drive both black & white and color televisions, but JPEG images use YCbCr primarily because it allows the color data to be optionally subsampled for the purposes of reducing bandwidth or disk space. YCbCr is the most common JPEG colorspace, and YCbCr JPEG images can be compressed from and decompressed to any of the extended RGB pixel formats or grayscale, or they can be decompressed to YUV planar images. </p>
|
||||
<p>YCbCr is not an absolute colorspace but rather a mathematical transformation of RGB designed solely for storage and transmission. YCbCr images must be converted to RGB before they can actually be displayed. In the YCbCr colorspace, the Y (luminance) component represents the black & white portion of the original image, and the Cb and Cr (chrominance) components represent the color portion of the original image. Originally, the analog equivalent of this transformation allowed the same signal to drive both black & white and color televisions, but JPEG images use YCbCr primarily because it allows the color data to be optionally subsampled for the purposes of reducing network or disk usage. YCbCr is the most common JPEG colorspace, and YCbCr JPEG images can be compressed from and decompressed to packed-pixel images with any of the extended RGB or grayscale pixel formats. YCbCr JPEG images can also be compressed from and decompressed to planar YUV images. </p>
|
||||
</td></tr>
|
||||
<tr><td class="fieldname"><a id="gga4f83ad3368e0e29d1957be0efa7c3720ab3e7d6a87f695e45b81c1b5262b5a50a"></a>TJCS_GRAY </td><td class="fielddoc"><p>Grayscale colorspace. </p>
|
||||
<p>The JPEG image retains only the luminance data (Y component), and any color data from the source image is discarded. Grayscale JPEG images can be compressed from and decompressed to any of the extended RGB pixel formats or grayscale, or they can be decompressed to YUV planar images. </p>
|
||||
<p>The JPEG image retains only the luminance data (Y component), and any color data from the source image is discarded. Grayscale JPEG images can be compressed from and decompressed to packed-pixel images with any of the extended RGB or grayscale pixel formats, or they can be compressed from and decompressed to planar YUV images. </p>
|
||||
</td></tr>
|
||||
<tr><td class="fieldname"><a id="gga4f83ad3368e0e29d1957be0efa7c3720a6c8b636152ac8195b869587db315ee53"></a>TJCS_CMYK </td><td class="fielddoc"><p>CMYK colorspace. </p>
|
||||
<p>When compressing the JPEG image, the C, M, Y, and K components in the source image are reordered into image planes, but no colorspace conversion or subsampling is performed. CMYK JPEG images can only be decompressed to CMYK pixels. </p>
|
||||
<p>When compressing the JPEG image, the C, M, Y, and K components in the source image are reordered into image planes, but no colorspace conversion or subsampling is performed. CMYK JPEG images can only be decompressed to packed-pixel images with the CMYK pixel format. </p>
|
||||
</td></tr>
|
||||
<tr><td class="fieldname"><a id="gga4f83ad3368e0e29d1957be0efa7c3720a53839e0fe867b76b58d16b0a1a7c598e"></a>TJCS_YCCK </td><td class="fielddoc"><p>YCCK colorspace. </p>
|
||||
<p>YCCK (AKA "YCbCrK") is not an absolute colorspace but rather a mathematical transformation of CMYK designed solely for storage and transmission. It is to CMYK as YCbCr is to RGB. CMYK pixels can be reversibly transformed into YCCK, and as with YCbCr, the chrominance components in the YCCK pixels can be subsampled without incurring major perceptual loss. YCCK JPEG images can only be compressed from and decompressed to CMYK pixels. </p>
|
||||
<p>YCCK (AKA "YCbCrK") is not an absolute colorspace but rather a mathematical transformation of CMYK designed solely for storage and transmission. It is to CMYK as YCbCr is to RGB. CMYK pixels can be reversibly transformed into YCCK, and as with YCbCr, the chrominance components in the YCCK pixels can be subsampled without incurring major perceptual loss. YCCK JPEG images can only be compressed from and decompressed to packed-pixel images with the CMYK pixel format. </p>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
@@ -797,7 +818,7 @@ YUV Image Format Notes</h2>
|
||||
|
||||
<p>Error codes. </p>
|
||||
<table class="fieldtable">
|
||||
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="ggafbc17cfa57d0d5d11fea35ac025950fea342dd6e2aedb47bb257b4e7568329b59"></a>TJERR_WARNING </td><td class="fielddoc"><p>The error was non-fatal and recoverable, but the image may still be corrupt. </p>
|
||||
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="ggafbc17cfa57d0d5d11fea35ac025950fea342dd6e2aedb47bb257b4e7568329b59"></a>TJERR_WARNING </td><td class="fielddoc"><p>The error was non-fatal and recoverable, but the destination image may still be corrupt. </p>
|
||||
</td></tr>
|
||||
<tr><td class="fieldname"><a id="ggafbc17cfa57d0d5d11fea35ac025950feafc9cceeada13122b09e4851e3788039a"></a>TJERR_FATAL </td><td class="fielddoc"><p>The error was fatal and non-recoverable. </p>
|
||||
</td></tr>
|
||||
@@ -853,10 +874,10 @@ YUV Image Format Notes</h2>
|
||||
<p>This is the same as <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84">TJPF_XRGB</a>, except that when decompressing, the X component is guaranteed to be 0xFF, which can be interpreted as an opaque alpha channel. </p>
|
||||
</td></tr>
|
||||
<tr><td class="fieldname"><a id="ggac916144e26c3817ac514e64ae5d12e2aa7f5100ec44c91994e243f1cf55553f8b"></a>TJPF_CMYK </td><td class="fielddoc"><p>CMYK pixel format. </p>
|
||||
<p>Unlike RGB, which is an additive color model used primarily for display, CMYK (Cyan/Magenta/Yellow/Key) is a subtractive color model used primarily for printing. In the CMYK color model, the value of each color component typically corresponds to an amount of cyan, magenta, yellow, or black ink that is applied to a white background. In order to convert between CMYK and RGB, it is necessary to use a color management system (CMS.) A CMS will attempt to map colors within the printer's gamut to perceptually similar colors in the display's gamut and vice versa, but the mapping is typically not 1:1 or reversible, nor can it be defined with a simple formula. Thus, such a conversion is out of scope for a codec library. However, the TurboJPEG API allows for compressing CMYK pixels into a YCCK JPEG image (see <a class="el" href="group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a53839e0fe867b76b58d16b0a1a7c598e" title="YCCK colorspace.">TJCS_YCCK</a>) and decompressing YCCK JPEG images into CMYK pixels. </p>
|
||||
<p>Unlike RGB, which is an additive color model used primarily for display, CMYK (Cyan/Magenta/Yellow/Key) is a subtractive color model used primarily for printing. In the CMYK color model, the value of each color component typically corresponds to an amount of cyan, magenta, yellow, or black ink that is applied to a white background. In order to convert between CMYK and RGB, it is necessary to use a color management system (CMS.) A CMS will attempt to map colors within the printer's gamut to perceptually similar colors in the display's gamut and vice versa, but the mapping is typically not 1:1 or reversible, nor can it be defined with a simple formula. Thus, such a conversion is out of scope for a codec library. However, the TurboJPEG API allows for compressing packed-pixel CMYK images into YCCK JPEG images (see <a class="el" href="group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a53839e0fe867b76b58d16b0a1a7c598e" title="YCCK colorspace.">TJCS_YCCK</a>) and decompressing YCCK JPEG images into packed-pixel CMYK images. </p>
|
||||
</td></tr>
|
||||
<tr><td class="fieldname"><a id="ggac916144e26c3817ac514e64ae5d12e2aa84c1a6cead7952998e2fb895844a21ed"></a>TJPF_UNKNOWN </td><td class="fielddoc"><p>Unknown pixel format. </p>
|
||||
<p>Currently this is only used by <a class="el" href="group___turbo_j_p_e_g.html#gaffbd83c375e79f5db4b5c5d8ad4466e7" title="Load an uncompressed image from disk into memory.">tjLoadImage()</a>. </p>
|
||||
<p>Currently this is only used by <a class="el" href="group___turbo_j_p_e_g.html#gaffbd83c375e79f5db4b5c5d8ad4466e7" title="Load a packed-pixel image from disk into memory.">tjLoadImage()</a>. </p>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
@@ -875,7 +896,7 @@ YUV Image Format Notes</h2>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Chrominance subsampling options. </p>
|
||||
<p>When pixels are converted from RGB to YCbCr (see <a class="el" href="group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a7389b8f65bb387ffedce3efd0d78ec75" title="YCbCr colorspace.">TJCS_YCbCr</a>) or from CMYK to YCCK (see <a class="el" href="group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a53839e0fe867b76b58d16b0a1a7c598e" title="YCCK colorspace.">TJCS_YCCK</a>) as part of the JPEG compression process, some of the Cb and Cr (chrominance) components can be discarded or averaged together to produce a smaller image with little perceptible loss of image clarity (the human eye is more sensitive to small changes in brightness than to small changes in color.) This is called "chrominance subsampling". </p>
|
||||
<p>When pixels are converted from RGB to YCbCr (see <a class="el" href="group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a7389b8f65bb387ffedce3efd0d78ec75" title="YCbCr colorspace.">TJCS_YCbCr</a>) or from CMYK to YCCK (see <a class="el" href="group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a53839e0fe867b76b58d16b0a1a7c598e" title="YCCK colorspace.">TJCS_YCCK</a>) as part of the JPEG compression process, some of the Cb and Cr (chrominance) components can be discarded or averaged together to produce a smaller image with little perceptible loss of image clarity. (The human eye is more sensitive to small changes in brightness than to small changes in color.) This is called "chrominance subsampling". </p>
|
||||
<table class="fieldtable">
|
||||
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="gga1d047060ea80bb9820d540bb928e9074afb8da4f44197837bdec0a4f593dacae3"></a>TJSAMP_444 </td><td class="fielddoc"><p>4:4:4 chrominance subsampling (no chrominance subsampling). </p>
|
||||
<p>The JPEG or YUV image will contain one chrominance component for every pixel in the source image. </p>
|
||||
@@ -957,8 +978,8 @@ YUV Image Format Notes</h2>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Allocate an image buffer for use with TurboJPEG. </p>
|
||||
<p>You should always use this function to allocate the JPEG destination buffer(s) for the compression and transform functions unless you are disabling automatic buffer (re)allocation (by setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a>.)</p>
|
||||
<p>Allocate a byte buffer for use with TurboJPEG. </p>
|
||||
<p>You should always use this function to allocate the JPEG destination buffer(s) for the compression and transform functions unless you are disabling automatic buffer (re)allocation (by setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable JPEG buffer (re)allocation.">TJFLAG_NOREALLOC</a>.)</p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">bytes</td><td>the number of bytes to allocate</td></tr>
|
||||
@@ -966,7 +987,7 @@ YUV Image Format Notes</h2>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>a pointer to a newly-allocated buffer with the specified number of bytes.</dd></dl>
|
||||
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___turbo_j_p_e_g.html#gaea863d2da0cdb609563aabdf9196514b" title="Free an image buffer previously allocated by TurboJPEG.">tjFree()</a> </dd></dl>
|
||||
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___turbo_j_p_e_g.html#gaea863d2da0cdb609563aabdf9196514b" title="Free a byte buffer previously allocated by TurboJPEG.">tjFree()</a> </dd></dl>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -1003,7 +1024,7 @@ YUV Image Format Notes</h2>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters. </p>
|
||||
<p>The number of bytes returned by this function is larger than the size of the uncompressed source image. The reason for this is that the JPEG format uses 16-bit coefficients, and it is thus possible for a very high-quality JPEG image with very high-frequency content to expand rather than compress when converted to the JPEG format. Such images represent a very rare corner case, but since there is no way to predict the size of a JPEG image prior to compression, the corner case has to be handled.</p>
|
||||
<p>The number of bytes returned by this function is larger than the size of the uncompressed source image. The reason for this is that the JPEG format uses 16-bit coefficients, so it is possible for a very high-quality source image with very high-frequency content to expand rather than compress when converted to the JPEG format. Such images represent very rare corner cases, but since there is no way to predict the size of a JPEG image prior to compression, the corner cases have to be handled.</p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">width</td><td>width (in pixels) of the image</td></tr>
|
||||
@@ -1016,8 +1037,8 @@ YUV Image Format Notes</h2>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="ga2be2b9969d4df9ecce9b05deed273194"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ga2be2b9969d4df9ecce9b05deed273194">◆ </a></span>tjBufSizeYUV2()</h2>
|
||||
<a id="ga5e5aac9e8bcf17049279301e2466474c"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ga5e5aac9e8bcf17049279301e2466474c">◆ </a></span>tjBufSizeYUV2()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
@@ -1032,7 +1053,7 @@ YUV Image Format Notes</h2>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">int </td>
|
||||
<td class="paramname"><em>pad</em>, </td>
|
||||
<td class="paramname"><em>align</em>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
@@ -1054,11 +1075,11 @@ YUV Image Format Notes</h2>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters. </p>
|
||||
<p>The size of the buffer (in bytes) required to hold a unified planar YUV image with the given parameters. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">width</td><td>width (in pixels) of the image</td></tr>
|
||||
<tr><td class="paramname">pad</td><td>the width of each line in each plane of the image is padded to the nearest multiple of this number of bytes (must be a power of 2.)</td></tr>
|
||||
<tr><td class="paramname">align</td><td>row alignment (in bytes) of the image (must be a power of 2.) Setting this parameter to n specifies that each row in each plane of the image will be padded to the nearest multiple of n bytes (1 = unpadded.)</td></tr>
|
||||
<tr><td class="paramname">height</td><td>height (in pixels) of the image</td></tr>
|
||||
<tr><td class="paramname">subsamp</td><td>level of chrominance subsampling in the image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
|
||||
</table>
|
||||
@@ -1148,22 +1169,22 @@ YUV Image Format Notes</h2>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Compress an RGB, grayscale, or CMYK image into a JPEG image. </p>
|
||||
<p>Compress a packed-pixel RGB, grayscale, or CMYK image into a JPEG image. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance</td></tr>
|
||||
<tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing RGB, grayscale, or CMYK pixels to be compressed</td></tr>
|
||||
<tr><td class="paramname">srcBuf</td><td>pointer to a buffer containing a packed-pixel RGB, grayscale, or CMYK source image to be compressed</td></tr>
|
||||
<tr><td class="paramname">width</td><td>width (in pixels) of the source image</td></tr>
|
||||
<tr><td class="paramname">pitch</td><td>bytes per line in the source image. Normally, this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
|
||||
<tr><td class="paramname">pitch</td><td>bytes per row in the source image. Normally this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>, if the image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest multiple of 4.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each row of the image is padded to the nearest multiple of 4 bytes, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip rows, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
|
||||
<tr><td class="paramname">height</td><td>height (in pixels) of the source image</td></tr>
|
||||
<tr><td class="paramname">pixelFormat</td><td>pixel format of the source image (see <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.)</td></tr>
|
||||
<tr><td class="paramname">jpegBuf</td><td>address of a pointer to an image buffer that will receive the JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:<ol type="1">
|
||||
<li>pre-allocate the JPEG buffer with an arbitrary size using <a class="el" href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83" title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a> and let TurboJPEG grow the buffer as needed,</li>
|
||||
<tr><td class="paramname">jpegBuf</td><td>address of a pointer to a byte buffer that will receive the JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:<ol type="1">
|
||||
<li>pre-allocate the JPEG buffer with an arbitrary size using <a class="el" href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83" title="Allocate a byte buffer for use with TurboJPEG.">tjAlloc()</a> and let TurboJPEG grow the buffer as needed,</li>
|
||||
<li>set <code>*jpegBuf</code> to NULL to tell TurboJPEG to allocate the buffer for you, or</li>
|
||||
<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#ga67ac12fee79073242cb216e07c9f1f90" title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters.">tjBufSize()</a>. This should ensure that the buffer never has to be re-allocated (setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees that it won't be.)</li>
|
||||
<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#ga67ac12fee79073242cb216e07c9f1f90" title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters.">tjBufSize()</a>. This should ensure that the buffer never has to be re-allocated. (Setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable JPEG buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees that it won't be.)</li>
|
||||
</ol>
|
||||
If you choose option 1, <code>*jpegSize</code> should be set to the size of your pre-allocated buffer. In any case, unless you have set <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a>, you should always check <code>*jpegBuf</code> upon return from this function, as it may have changed.</td></tr>
|
||||
<tr><td class="paramname">jpegSize</td><td>pointer to an unsigned long variable that holds the size of the JPEG image buffer. If <code>*jpegBuf</code> points to a pre-allocated buffer, then <code>*jpegSize</code> should be set to the size of the buffer. Upon return, <code>*jpegSize</code> will contain the size of the JPEG image (in bytes.) If <code>*jpegBuf</code> points to a JPEG image buffer that is being reused from a previous call to one of the JPEG compression functions, then <code>*jpegSize</code> is ignored.</td></tr>
|
||||
If you choose option 1, then <code>*jpegSize</code> should be set to the size of your pre-allocated buffer. In any case, unless you have set <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable JPEG buffer (re)allocation.">TJFLAG_NOREALLOC</a>, you should always check <code>*jpegBuf</code> upon return from this function, as it may have changed.</td></tr>
|
||||
<tr><td class="paramname">jpegSize</td><td>pointer to an unsigned long variable that holds the size of the JPEG buffer. If <code>*jpegBuf</code> points to a pre-allocated buffer, then <code>*jpegSize</code> should be set to the size of the buffer. Upon return, <code>*jpegSize</code> will contain the size of the JPEG image (in bytes.) If <code>*jpegBuf</code> points to a JPEG buffer that is being reused from a previous call to one of the JPEG compression functions, then <code>*jpegSize</code> is ignored.</td></tr>
|
||||
<tr><td class="paramname">jpegSubsamp</td><td>the level of chrominance subsampling to be used when generating the JPEG image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
|
||||
<tr><td class="paramname">jpegQual</td><td>the image quality of the generated JPEG image (1 = worst, 100 = best)</td></tr>
|
||||
<tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
|
||||
@@ -1174,8 +1195,8 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="ga7622a459b79aa1007e005b58783f875b"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ga7622a459b79aa1007e005b58783f875b">◆ </a></span>tjCompressFromYUV()</h2>
|
||||
<a id="gab40f5096a72fd7e5bda9d6b58fa37e2e"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#gab40f5096a72fd7e5bda9d6b58fa37e2e">◆ </a></span>tjCompressFromYUV()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
@@ -1202,7 +1223,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">int </td>
|
||||
<td class="paramname"><em>pad</em>, </td>
|
||||
<td class="paramname"><em>align</em>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
@@ -1248,22 +1269,22 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Compress a YUV planar image into a JPEG image. </p>
|
||||
<p>Compress a unified planar YUV image into a JPEG image. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance</td></tr>
|
||||
<tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing a YUV planar image to be compressed. The size of this buffer should match the value returned by <a class="el" href="group___turbo_j_p_e_g.html#ga2be2b9969d4df9ecce9b05deed273194" title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters.">tjBufSizeYUV2()</a> for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer (refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.)</td></tr>
|
||||
<tr><td class="paramname">width</td><td>width (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
|
||||
<tr><td class="paramname">pad</td><td>the line padding used in the source image. For instance, if each line in each plane of the YUV image is padded to the nearest multiple of 4 bytes, then <code>pad</code> should be set to 4.</td></tr>
|
||||
<tr><td class="paramname">height</td><td>height (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
|
||||
<tr><td class="paramname">srcBuf</td><td>pointer to a buffer containing a unified planar YUV source image to be compressed. The size of this buffer should match the value returned by <a class="el" href="group___turbo_j_p_e_g.html#ga5e5aac9e8bcf17049279301e2466474c" title="The size of the buffer (in bytes) required to hold a unified planar YUV image with the given paramete...">tjBufSizeYUV2()</a> for the given image width, height, row alignment, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the buffer. (Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.)</td></tr>
|
||||
<tr><td class="paramname">width</td><td>width (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a>), then an intermediate buffer copy will be performed.</td></tr>
|
||||
<tr><td class="paramname">align</td><td>row alignment (in bytes) of the source image (must be a power of 2.) Setting this parameter to n indicates that each row in each plane of the source image is padded to the nearest multiple of n bytes (1 = unpadded.)</td></tr>
|
||||
<tr><td class="paramname">height</td><td>height (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>), then an intermediate buffer copy will be performed.</td></tr>
|
||||
<tr><td class="paramname">subsamp</td><td>the level of chrominance subsampling used in the source image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
|
||||
<tr><td class="paramname">jpegBuf</td><td>address of a pointer to an image buffer that will receive the JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:<ol type="1">
|
||||
<li>pre-allocate the JPEG buffer with an arbitrary size using <a class="el" href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83" title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a> and let TurboJPEG grow the buffer as needed,</li>
|
||||
<tr><td class="paramname">jpegBuf</td><td>address of a pointer to a byte buffer that will receive the JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:<ol type="1">
|
||||
<li>pre-allocate the JPEG buffer with an arbitrary size using <a class="el" href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83" title="Allocate a byte buffer for use with TurboJPEG.">tjAlloc()</a> and let TurboJPEG grow the buffer as needed,</li>
|
||||
<li>set <code>*jpegBuf</code> to NULL to tell TurboJPEG to allocate the buffer for you, or</li>
|
||||
<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#ga67ac12fee79073242cb216e07c9f1f90" title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters.">tjBufSize()</a>. This should ensure that the buffer never has to be re-allocated (setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees that it won't be.)</li>
|
||||
<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#ga67ac12fee79073242cb216e07c9f1f90" title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters.">tjBufSize()</a>. This should ensure that the buffer never has to be re-allocated. (Setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable JPEG buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees that it won't be.)</li>
|
||||
</ol>
|
||||
If you choose option 1, <code>*jpegSize</code> should be set to the size of your pre-allocated buffer. In any case, unless you have set <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a>, you should always check <code>*jpegBuf</code> upon return from this function, as it may have changed.</td></tr>
|
||||
<tr><td class="paramname">jpegSize</td><td>pointer to an unsigned long variable that holds the size of the JPEG image buffer. If <code>*jpegBuf</code> points to a pre-allocated buffer, then <code>*jpegSize</code> should be set to the size of the buffer. Upon return, <code>*jpegSize</code> will contain the size of the JPEG image (in bytes.) If <code>*jpegBuf</code> points to a JPEG image buffer that is being reused from a previous call to one of the JPEG compression functions, then <code>*jpegSize</code> is ignored.</td></tr>
|
||||
If you choose option 1, then <code>*jpegSize</code> should be set to the size of your pre-allocated buffer. In any case, unless you have set <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable JPEG buffer (re)allocation.">TJFLAG_NOREALLOC</a>, you should always check <code>*jpegBuf</code> upon return from this function, as it may have changed.</td></tr>
|
||||
<tr><td class="paramname">jpegSize</td><td>pointer to an unsigned long variable that holds the size of the JPEG buffer. If <code>*jpegBuf</code> points to a pre-allocated buffer, then <code>*jpegSize</code> should be set to the size of the buffer. Upon return, <code>*jpegSize</code> will contain the size of the JPEG image (in bytes.) If <code>*jpegBuf</code> points to a JPEG buffer that is being reused from a previous call to one of the JPEG compression functions, then <code>*jpegSize</code> is ignored.</td></tr>
|
||||
<tr><td class="paramname">jpegQual</td><td>the image quality of the generated JPEG image (1 = worst, 100 = best)</td></tr>
|
||||
<tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
|
||||
</table>
|
||||
@@ -1351,18 +1372,18 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance</td></tr>
|
||||
<tr><td class="paramname">srcPlanes</td><td>an array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if compressing a grayscale image) that contain a YUV image to be compressed. These planes can be contiguous or non-contiguous in memory. The size of each plane should match the value returned by <a class="el" href="group___turbo_j_p_e_g.html#gab4ab7b24f6e797d79abaaa670373961d" title="The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters.">tjPlaneSizeYUV()</a> for the given image width, height, strides, and level of chrominance subsampling. Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for more details.</td></tr>
|
||||
<tr><td class="paramname">width</td><td>width (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
|
||||
<tr><td class="paramname">strides</td><td>an array of integers, each specifying the number of bytes per line in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the plane width (see <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.) If <code>strides</code> is NULL, then the strides for all planes will be set to their respective plane widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to create a JPEG image from a subregion of a larger YUV planar image.</td></tr>
|
||||
<tr><td class="paramname">height</td><td>height (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
|
||||
<tr><td class="paramname">srcPlanes</td><td>an array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if compressing a grayscale image) that contain a YUV source image to be compressed. These planes can be contiguous or non-contiguous in memory. The size of each plane should match the value returned by <a class="el" href="group___turbo_j_p_e_g.html#gab4ab7b24f6e797d79abaaa670373961d" title="The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters.">tjPlaneSizeYUV()</a> for the given image width, height, strides, and level of chrominance subsampling. Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for more details.</td></tr>
|
||||
<tr><td class="paramname">width</td><td>width (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a>), then an intermediate buffer copy will be performed.</td></tr>
|
||||
<tr><td class="paramname">strides</td><td>an array of integers, each specifying the number of bytes per row in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the plane width (see <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.) If <code>strides</code> is NULL, then the strides for all planes will be set to their respective plane widths. You can adjust the strides in order to specify an arbitrary amount of row padding in each plane or to create a JPEG image from a subregion of a larger planar YUV image.</td></tr>
|
||||
<tr><td class="paramname">height</td><td>height (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>), then an intermediate buffer copy will be performed.</td></tr>
|
||||
<tr><td class="paramname">subsamp</td><td>the level of chrominance subsampling used in the source image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
|
||||
<tr><td class="paramname">jpegBuf</td><td>address of a pointer to an image buffer that will receive the JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:<ol type="1">
|
||||
<li>pre-allocate the JPEG buffer with an arbitrary size using <a class="el" href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83" title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a> and let TurboJPEG grow the buffer as needed,</li>
|
||||
<tr><td class="paramname">jpegBuf</td><td>address of a pointer to a byte buffer that will receive the JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:<ol type="1">
|
||||
<li>pre-allocate the JPEG buffer with an arbitrary size using <a class="el" href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83" title="Allocate a byte buffer for use with TurboJPEG.">tjAlloc()</a> and let TurboJPEG grow the buffer as needed,</li>
|
||||
<li>set <code>*jpegBuf</code> to NULL to tell TurboJPEG to allocate the buffer for you, or</li>
|
||||
<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#ga67ac12fee79073242cb216e07c9f1f90" title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters.">tjBufSize()</a>. This should ensure that the buffer never has to be re-allocated (setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees that it won't be.)</li>
|
||||
<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#ga67ac12fee79073242cb216e07c9f1f90" title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters.">tjBufSize()</a>. This should ensure that the buffer never has to be re-allocated. (Setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable JPEG buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees that it won't be.)</li>
|
||||
</ol>
|
||||
If you choose option 1, <code>*jpegSize</code> should be set to the size of your pre-allocated buffer. In any case, unless you have set <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a>, you should always check <code>*jpegBuf</code> upon return from this function, as it may have changed.</td></tr>
|
||||
<tr><td class="paramname">jpegSize</td><td>pointer to an unsigned long variable that holds the size of the JPEG image buffer. If <code>*jpegBuf</code> points to a pre-allocated buffer, then <code>*jpegSize</code> should be set to the size of the buffer. Upon return, <code>*jpegSize</code> will contain the size of the JPEG image (in bytes.) If <code>*jpegBuf</code> points to a JPEG image buffer that is being reused from a previous call to one of the JPEG compression functions, then <code>*jpegSize</code> is ignored.</td></tr>
|
||||
If you choose option 1, then <code>*jpegSize</code> should be set to the size of your pre-allocated buffer. In any case, unless you have set <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable JPEG buffer (re)allocation.">TJFLAG_NOREALLOC</a>, you should always check <code>*jpegBuf</code> upon return from this function, as it may have changed.</td></tr>
|
||||
<tr><td class="paramname">jpegSize</td><td>pointer to an unsigned long variable that holds the size of the JPEG buffer. If <code>*jpegBuf</code> points to a pre-allocated buffer, then <code>*jpegSize</code> should be set to the size of the buffer. Upon return, <code>*jpegSize</code> will contain the size of the JPEG image (in bytes.) If <code>*jpegBuf</code> points to a JPEG buffer that is being reused from a previous call to one of the JPEG compression functions, then <code>*jpegSize</code> is ignored.</td></tr>
|
||||
<tr><td class="paramname">jpegQual</td><td>the image quality of the generated JPEG image (1 = worst, 100 = best)</td></tr>
|
||||
<tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
|
||||
</table>
|
||||
@@ -1372,8 +1393,8 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="ga70abbf38f77a26fd6da8813bef96f695"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ga70abbf38f77a26fd6da8813bef96f695">◆ </a></span>tjDecodeYUV()</h2>
|
||||
<a id="ga97c2cedc1e2bade15a84164c94e503c1"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ga97c2cedc1e2bade15a84164c94e503c1">◆ </a></span>tjDecodeYUV()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
@@ -1394,7 +1415,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">int </td>
|
||||
<td class="paramname"><em>pad</em>, </td>
|
||||
<td class="paramname"><em>align</em>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
@@ -1446,17 +1467,17 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Decode a YUV planar image into an RGB or grayscale image. </p>
|
||||
<p>This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG decompression process.</p>
|
||||
<p>Decode a unified planar YUV image into a packed-pixel RGB or grayscale image. </p>
|
||||
<p>This function performs color conversion (which is accelerated in the libjpeg-turbo implementation) but does not execute any of the other steps in the JPEG decompression process.</p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</td></tr>
|
||||
<tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing a YUV planar image to be decoded. The size of this buffer should match the value returned by <a class="el" href="group___turbo_j_p_e_g.html#ga2be2b9969d4df9ecce9b05deed273194" title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters.">tjBufSizeYUV2()</a> for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer (refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.)</td></tr>
|
||||
<tr><td class="paramname">pad</td><td>Use this parameter to specify that the width of each line in each plane of the YUV source image is padded to the nearest multiple of this number of bytes (must be a power of 2.)</td></tr>
|
||||
<tr><td class="paramname">srcBuf</td><td>pointer to a buffer containing a unified planar YUV source image to be decoded. The size of this buffer should match the value returned by <a class="el" href="group___turbo_j_p_e_g.html#ga5e5aac9e8bcf17049279301e2466474c" title="The size of the buffer (in bytes) required to hold a unified planar YUV image with the given paramete...">tjBufSizeYUV2()</a> for the given image width, height, row alignment, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer. (Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.)</td></tr>
|
||||
<tr><td class="paramname">align</td><td>row alignment (in bytes) of the YUV source image (must be a power of 2.) Setting this parameter to n indicates that each row in each plane of the YUV source image is padded to the nearest multiple of n bytes (1 = unpadded.)</td></tr>
|
||||
<tr><td class="paramname">subsamp</td><td>the level of chrominance subsampling used in the YUV source image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
|
||||
<tr><td class="paramname">dstBuf</td><td>pointer to an image buffer that will receive the decoded image. This buffer should normally be <code>pitch * height</code> bytes in size, but the <code>dstBuf</code> pointer can also be used to decode into a specific region of a larger buffer.</td></tr>
|
||||
<tr><td class="paramname">dstBuf</td><td>pointer to a buffer that will receive the packed-pixel decoded image. This buffer should normally be <code>pitch * height</code> bytes in size, but the <code>dstBuf</code> pointer can also be used to decode into a specific region of a larger buffer.</td></tr>
|
||||
<tr><td class="paramname">width</td><td>width (in pixels) of the source and destination images</td></tr>
|
||||
<tr><td class="paramname">pitch</td><td>bytes per line in the destination image. Normally, this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the destination image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the destination image should be padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
|
||||
<tr><td class="paramname">pitch</td><td>bytes per row in the destination image. Normally this should be set to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>, if the destination image should be unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest multiple of 4.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each row of the destination image should be padded to the nearest multiple of 4 bytes, as is the case for Windows bitmaps. You can also be clever and use the pitch parameter to skip rows, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
|
||||
<tr><td class="paramname">height</td><td>height (in pixels) of the source and destination images</td></tr>
|
||||
<tr><td class="paramname">pixelFormat</td><td>pixel format of the destination image (see <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.)</td></tr>
|
||||
<tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
|
||||
@@ -1541,17 +1562,17 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Decode a set of Y, U (Cb), and V (Cr) image planes into an RGB or grayscale image. </p>
|
||||
<p>This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG decompression process.</p>
|
||||
<p>Decode a set of Y, U (Cb), and V (Cr) image planes into a packed-pixel RGB or grayscale image. </p>
|
||||
<p>This function performs color conversion (which is accelerated in the libjpeg-turbo implementation) but does not execute any of the other steps in the JPEG decompression process.</p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</td></tr>
|
||||
<tr><td class="paramname">srcPlanes</td><td>an array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decoding a grayscale image) that contain a YUV image to be decoded. These planes can be contiguous or non-contiguous in memory. The size of each plane should match the value returned by <a class="el" href="group___turbo_j_p_e_g.html#gab4ab7b24f6e797d79abaaa670373961d" title="The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters.">tjPlaneSizeYUV()</a> for the given image width, height, strides, and level of chrominance subsampling. Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for more details.</td></tr>
|
||||
<tr><td class="paramname">strides</td><td>an array of integers, each specifying the number of bytes per line in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the plane width (see <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.) If <code>strides</code> is NULL, then the strides for all planes will be set to their respective plane widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to decode a subregion of a larger YUV planar image.</td></tr>
|
||||
<tr><td class="paramname">strides</td><td>an array of integers, each specifying the number of bytes per row in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the plane width (see <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.) If <code>strides</code> is NULL, then the strides for all planes will be set to their respective plane widths. You can adjust the strides in order to specify an arbitrary amount of row padding in each plane or to decode a subregion of a larger planar YUV image.</td></tr>
|
||||
<tr><td class="paramname">subsamp</td><td>the level of chrominance subsampling used in the YUV source image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
|
||||
<tr><td class="paramname">dstBuf</td><td>pointer to an image buffer that will receive the decoded image. This buffer should normally be <code>pitch * height</code> bytes in size, but the <code>dstBuf</code> pointer can also be used to decode into a specific region of a larger buffer.</td></tr>
|
||||
<tr><td class="paramname">dstBuf</td><td>pointer to a buffer that will receive the packed-pixel decoded image. This buffer should normally be <code>pitch * height</code> bytes in size, but the <code>dstBuf</code> pointer can also be used to decode into a specific region of a larger buffer.</td></tr>
|
||||
<tr><td class="paramname">width</td><td>width (in pixels) of the source and destination images</td></tr>
|
||||
<tr><td class="paramname">pitch</td><td>bytes per line in the destination image. Normally, this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the destination image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the destination image should be padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
|
||||
<tr><td class="paramname">pitch</td><td>bytes per row in the destination image. Normally this should be set to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>, if the destination image should be unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest multiple of 4.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each row of the destination image should be padded to the nearest multiple of 4 bytes, as is the case for Windows bitmaps. You can also be clever and use the pitch parameter to skip rows, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
|
||||
<tr><td class="paramname">height</td><td>height (in pixels) of the source and destination images</td></tr>
|
||||
<tr><td class="paramname">pixelFormat</td><td>pixel format of the destination image (see <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.)</td></tr>
|
||||
<tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
|
||||
@@ -1630,15 +1651,15 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Decompress a JPEG image to an RGB, grayscale, or CMYK image. </p>
|
||||
<p>Decompress a JPEG image into a packed-pixel RGB, grayscale, or CMYK image. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</td></tr>
|
||||
<tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG image to decompress</td></tr>
|
||||
<tr><td class="paramname">jpegBuf</td><td>pointer to a byte buffer containing the JPEG image to decompress</td></tr>
|
||||
<tr><td class="paramname">jpegSize</td><td>size of the JPEG image (in bytes)</td></tr>
|
||||
<tr><td class="paramname">dstBuf</td><td>pointer to an image buffer that will receive the decompressed image. This buffer should normally be <code>pitch * scaledHeight</code> bytes in size, where <code>scaledHeight</code> can be determined by calling <a class="el" href="group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df" title="Compute the scaled value of dimension using the given scaling factor.">TJSCALED()</a> with the JPEG image height and one of the scaling factors returned by <a class="el" href="group___turbo_j_p_e_g.html#gac3854476006b10787bd128f7ede48057" title="Returns a list of fractional scaling factors that the JPEG decompressor in this implementation of Tur...">tjGetScalingFactors()</a>. The <code>dstBuf</code> pointer may also be used to decompress into a specific region of a larger buffer.</td></tr>
|
||||
<tr><td class="paramname">dstBuf</td><td>pointer to a buffer that will receive the packed-pixel decompressed image. This buffer should normally be <code>pitch * scaledHeight</code> bytes in size, where <code>scaledHeight</code> can be determined by calling <a class="el" href="group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df" title="Compute the scaled value of dimension using the given scaling factor.">TJSCALED()</a> with the JPEG image height and one of the scaling factors returned by <a class="el" href="group___turbo_j_p_e_g.html#ga193d0977b3b9966d53a6c402e90899b1" title="Returns a list of fractional scaling factors that the JPEG decompressor supports.">tjGetScalingFactors()</a>. The <code>dstBuf</code> pointer may also be used to decompress into a specific region of a larger buffer.</td></tr>
|
||||
<tr><td class="paramname">width</td><td>desired width (in pixels) of the destination image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If <code>width</code> is set to 0, then only the height will be considered when determining the scaled image size.</td></tr>
|
||||
<tr><td class="paramname">pitch</td><td>bytes per line in the destination image. Normally, this is <code>scaledWidth * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the decompressed image is unpadded, else <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(scaledWidth * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the decompressed image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. (NOTE: <code>scaledWidth</code> can be determined by calling <a class="el" href="group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df" title="Compute the scaled value of dimension using the given scaling factor.">TJSCALED()</a> with the JPEG image width and one of the scaling factors returned by <a class="el" href="group___turbo_j_p_e_g.html#gac3854476006b10787bd128f7ede48057" title="Returns a list of fractional scaling factors that the JPEG decompressor in this implementation of Tur...">tjGetScalingFactors()</a>.) You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>scaledWidth * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
|
||||
<tr><td class="paramname">pitch</td><td>bytes per row in the destination image. Normally this should be set to <code>scaledWidth * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>, if the destination image should be unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest multiple of 4.">TJPAD</a>(scaledWidth * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each row of the destination image should be padded to the nearest multiple of 4 bytes, as is the case for Windows bitmaps. (NOTE: <code>scaledWidth</code> can be determined by calling <a class="el" href="group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df" title="Compute the scaled value of dimension using the given scaling factor.">TJSCALED()</a> with the JPEG image width and one of the scaling factors returned by <a class="el" href="group___turbo_j_p_e_g.html#ga193d0977b3b9966d53a6c402e90899b1" title="Returns a list of fractional scaling factors that the JPEG decompressor supports.">tjGetScalingFactors()</a>.) You can also be clever and use the pitch parameter to skip rows, etc. Setting this parameter to 0 is the equivalent of setting it to <code>scaledWidth * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
|
||||
<tr><td class="paramname">height</td><td>desired height (in pixels) of the destination image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If <code>height</code> is set to 0, then only the width will be considered when determining the scaled image size.</td></tr>
|
||||
<tr><td class="paramname">pixelFormat</td><td>pixel format of the destination image (see <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.)</td></tr>
|
||||
<tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
|
||||
@@ -1705,16 +1726,16 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Retrieve information about a JPEG image without decompressing it. </p>
|
||||
<p>Retrieve information about a JPEG image without decompressing it, or prime the decompressor with quantization and Huffman tables. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</td></tr>
|
||||
<tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing a JPEG image</td></tr>
|
||||
<tr><td class="paramname">jpegSize</td><td>size of the JPEG image (in bytes)</td></tr>
|
||||
<tr><td class="paramname">width</td><td>pointer to an integer variable that will receive the width (in pixels) of the JPEG image</td></tr>
|
||||
<tr><td class="paramname">height</td><td>pointer to an integer variable that will receive the height (in pixels) of the JPEG image</td></tr>
|
||||
<tr><td class="paramname">jpegSubsamp</td><td>pointer to an integer variable that will receive the level of chrominance subsampling used when the JPEG image was compressed (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
|
||||
<tr><td class="paramname">jpegColorspace</td><td>pointer to an integer variable that will receive one of the JPEG colorspace constants, indicating the colorspace of the JPEG image (see <a class="el" href="group___turbo_j_p_e_g.html#ga4f83ad3368e0e29d1957be0efa7c3720">JPEG colorspaces</a>.)</td></tr>
|
||||
<tr><td class="paramname">jpegBuf</td><td>pointer to a byte buffer containing a JPEG image or an "abbreviated table specification" (AKA "tables-only") datastream. Passing a tables-only datastream to this function primes the decompressor with quantization and Huffman tables that can be used when decompressing subsequent "abbreviated image" datastreams. This is useful, for instance, when decompressing video streams in which all frames share the same quantization and Huffman tables.</td></tr>
|
||||
<tr><td class="paramname">jpegSize</td><td>size of the JPEG image or tables-only datastream (in bytes)</td></tr>
|
||||
<tr><td class="paramname">width</td><td>pointer to an integer variable that will receive the width (in pixels) of the JPEG image. If <code>jpegBuf</code> points to a tables-only datastream, then <code>width</code> is ignored.</td></tr>
|
||||
<tr><td class="paramname">height</td><td>pointer to an integer variable that will receive the height (in pixels) of the JPEG image. If <code>jpegBuf</code> points to a tables-only datastream, then <code>height</code> is ignored.</td></tr>
|
||||
<tr><td class="paramname">jpegSubsamp</td><td>pointer to an integer variable that will receive the level of chrominance subsampling used when the JPEG image was compressed (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.) If <code>jpegBuf</code> points to a tables-only datastream, then <code>jpegSubsamp</code> is ignored.</td></tr>
|
||||
<tr><td class="paramname">jpegColorspace</td><td>pointer to an integer variable that will receive one of the JPEG colorspace constants, indicating the colorspace of the JPEG image (see <a class="el" href="group___turbo_j_p_e_g.html#ga4f83ad3368e0e29d1957be0efa7c3720">JPEG colorspaces</a>.) If <code>jpegBuf</code> points to a tables-only datastream, then <code>jpegColorspace</code> is ignored.</td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
@@ -1722,8 +1743,8 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="ga04d1e839ff9a0860dd1475cff78d3364"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ga04d1e839ff9a0860dd1475cff78d3364">◆ </a></span>tjDecompressToYUV2()</h2>
|
||||
<a id="ga5a3093e325598c17a9f004323af6fafa"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ga5a3093e325598c17a9f004323af6fafa">◆ </a></span>tjDecompressToYUV2()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
@@ -1762,7 +1783,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">int </td>
|
||||
<td class="paramname"><em>pad</em>, </td>
|
||||
<td class="paramname"><em>align</em>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
@@ -1784,17 +1805,17 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Decompress a JPEG image to a YUV planar image. </p>
|
||||
<p>This function performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of an RGB image.</p>
|
||||
<p>Decompress a JPEG image into a unified planar YUV image. </p>
|
||||
<p>This function performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of a packed-pixel image.</p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</td></tr>
|
||||
<tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG image to decompress</td></tr>
|
||||
<tr><td class="paramname">jpegBuf</td><td>pointer to a byte buffer containing the JPEG image to decompress</td></tr>
|
||||
<tr><td class="paramname">jpegSize</td><td>size of the JPEG image (in bytes)</td></tr>
|
||||
<tr><td class="paramname">dstBuf</td><td>pointer to an image buffer that will receive the YUV image. Use <a class="el" href="group___turbo_j_p_e_g.html#ga2be2b9969d4df9ecce9b05deed273194" title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters.">tjBufSizeYUV2()</a> to determine the appropriate size for this buffer based on the image width, height, padding, and level of subsampling. The Y, U (Cb), and V (Cr) image planes will be stored sequentially in the buffer (refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.)</td></tr>
|
||||
<tr><td class="paramname">width</td><td>desired width (in pixels) of the YUV image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If <code>width</code> is set to 0, then only the height will be considered when determining the scaled image size. If the scaled width is not an even multiple of the MCU block width (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
|
||||
<tr><td class="paramname">pad</td><td>the width of each line in each plane of the YUV image will be padded to the nearest multiple of this number of bytes (must be a power of 2.) To generate images suitable for X Video, <code>pad</code> should be set to 4.</td></tr>
|
||||
<tr><td class="paramname">height</td><td>desired height (in pixels) of the YUV image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If <code>height</code> is set to 0, then only the width will be considered when determining the scaled image size. If the scaled height is not an even multiple of the MCU block height (see <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
|
||||
<tr><td class="paramname">dstBuf</td><td>pointer to a buffer that will receive the unified planar YUV decompressed image. Use <a class="el" href="group___turbo_j_p_e_g.html#ga5e5aac9e8bcf17049279301e2466474c" title="The size of the buffer (in bytes) required to hold a unified planar YUV image with the given paramete...">tjBufSizeYUV2()</a> to determine the appropriate size for this buffer based on the scaled image width, scaled image height, row alignment, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes will be stored sequentially in the buffer. (Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.)</td></tr>
|
||||
<tr><td class="paramname">width</td><td>desired width (in pixels) of the YUV image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If <code>width</code> is set to 0, then only the height will be considered when determining the scaled image size. If the scaled width is not an even multiple of the MCU block width (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a>), then an intermediate buffer copy will be performed.</td></tr>
|
||||
<tr><td class="paramname">align</td><td>row alignment (in bytes) of the YUV image (must be a power of 2.) Setting this parameter to n will cause each row in each plane of the YUV image to be padded to the nearest multiple of n bytes (1 = unpadded.) To generate images suitable for X Video, <code>align</code> should be set to 4.</td></tr>
|
||||
<tr><td class="paramname">height</td><td>desired height (in pixels) of the YUV image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If <code>height</code> is set to 0, then only the width will be considered when determining the scaled image size. If the scaled height is not an even multiple of the MCU block height (see <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>), then an intermediate buffer copy will be performed.</td></tr>
|
||||
<tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
@@ -1866,16 +1887,16 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Decompress a JPEG image into separate Y, U (Cb), and V (Cr) image planes. </p>
|
||||
<p>This function performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of an RGB image.</p>
|
||||
<p>This function performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of a packed-pixel image.</p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</td></tr>
|
||||
<tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG image to decompress</td></tr>
|
||||
<tr><td class="paramname">jpegBuf</td><td>pointer to a byte buffer containing the JPEG image to decompress</td></tr>
|
||||
<tr><td class="paramname">jpegSize</td><td>size of the JPEG image (in bytes)</td></tr>
|
||||
<tr><td class="paramname">dstPlanes</td><td>an array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decompressing a grayscale image) that will receive the YUV image. These planes can be contiguous or non-contiguous in memory. Use <a class="el" href="group___turbo_j_p_e_g.html#gab4ab7b24f6e797d79abaaa670373961d" title="The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters.">tjPlaneSizeYUV()</a> to determine the appropriate size for each plane based on the scaled image width, scaled image height, strides, and level of chrominance subsampling. Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for more details.</td></tr>
|
||||
<tr><td class="paramname">width</td><td>desired width (in pixels) of the YUV image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If <code>width</code> is set to 0, then only the height will be considered when determining the scaled image size. If the scaled width is not an even multiple of the MCU block width (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
|
||||
<tr><td class="paramname">strides</td><td>an array of integers, each specifying the number of bytes per line in the corresponding plane of the output image. Setting the stride for any plane to 0 is the same as setting it to the scaled plane width (see <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.) If <code>strides</code> is NULL, then the strides for all planes will be set to their respective scaled plane widths. You can adjust the strides in order to add an arbitrary amount of line padding to each plane or to decompress the JPEG image into a subregion of a larger YUV planar image.</td></tr>
|
||||
<tr><td class="paramname">height</td><td>desired height (in pixels) of the YUV image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If <code>height</code> is set to 0, then only the width will be considered when determining the scaled image size. If the scaled height is not an even multiple of the MCU block height (see <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
|
||||
<tr><td class="paramname">dstPlanes</td><td>an array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decompressing a grayscale image) that will receive the decompressed image. These planes can be contiguous or non-contiguous in memory. Use <a class="el" href="group___turbo_j_p_e_g.html#gab4ab7b24f6e797d79abaaa670373961d" title="The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters.">tjPlaneSizeYUV()</a> to determine the appropriate size for each plane based on the scaled image width, scaled image height, strides, and level of chrominance subsampling. Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for more details.</td></tr>
|
||||
<tr><td class="paramname">width</td><td>desired width (in pixels) of the YUV image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If <code>width</code> is set to 0, then only the height will be considered when determining the scaled image size. If the scaled width is not an even multiple of the MCU block width (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a>), then an intermediate buffer copy will be performed.</td></tr>
|
||||
<tr><td class="paramname">strides</td><td>an array of integers, each specifying the number of bytes per row in the corresponding plane of the YUV image. Setting the stride for any plane to 0 is the same as setting it to the scaled plane width (see <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.) If <code>strides</code> is NULL, then the strides for all planes will be set to their respective scaled plane widths. You can adjust the strides in order to add an arbitrary amount of row padding to each plane or to decompress the JPEG image into a subregion of a larger planar YUV image.</td></tr>
|
||||
<tr><td class="paramname">height</td><td>desired height (in pixels) of the YUV image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If <code>height</code> is set to 0, then only the width will be considered when determining the scaled image size. If the scaled height is not an even multiple of the MCU block height (see <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>), then an intermediate buffer copy will be performed.</td></tr>
|
||||
<tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
@@ -1911,8 +1932,8 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="gac519b922cdf446e97d0cdcba513636bf"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#gac519b922cdf446e97d0cdcba513636bf">◆ </a></span>tjEncodeYUV3()</h2>
|
||||
<a id="ga5d619e0a02b71e05a8dffb764f6d7a64"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ga5d619e0a02b71e05a8dffb764f6d7a64">◆ </a></span>tjEncodeYUV3()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
@@ -1963,7 +1984,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">int </td>
|
||||
<td class="paramname"><em>pad</em>, </td>
|
||||
<td class="paramname"><em>align</em>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
@@ -1985,18 +2006,18 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Encode an RGB or grayscale image into a YUV planar image. </p>
|
||||
<p>This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG compression process.</p>
|
||||
<p>Encode a packed-pixel RGB or grayscale image into a unified planar YUV image. </p>
|
||||
<p>This function performs color conversion (which is accelerated in the libjpeg-turbo implementation) but does not execute any of the other steps in the JPEG compression process.</p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance</td></tr>
|
||||
<tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing RGB or grayscale pixels to be encoded</td></tr>
|
||||
<tr><td class="paramname">srcBuf</td><td>pointer to a buffer containing a packed-pixel RGB or grayscale source image to be encoded</td></tr>
|
||||
<tr><td class="paramname">width</td><td>width (in pixels) of the source image</td></tr>
|
||||
<tr><td class="paramname">pitch</td><td>bytes per line in the source image. Normally, this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
|
||||
<tr><td class="paramname">pitch</td><td>bytes per row in the source image. Normally this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>, if the image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest multiple of 4.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each row of the image is padded to the nearest multiple of 4 bytes, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip rows, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
|
||||
<tr><td class="paramname">height</td><td>height (in pixels) of the source image</td></tr>
|
||||
<tr><td class="paramname">pixelFormat</td><td>pixel format of the source image (see <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.)</td></tr>
|
||||
<tr><td class="paramname">dstBuf</td><td>pointer to an image buffer that will receive the YUV image. Use <a class="el" href="group___turbo_j_p_e_g.html#ga2be2b9969d4df9ecce9b05deed273194" title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters.">tjBufSizeYUV2()</a> to determine the appropriate size for this buffer based on the image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes will be stored sequentially in the buffer (refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.)</td></tr>
|
||||
<tr><td class="paramname">pad</td><td>the width of each line in each plane of the YUV image will be padded to the nearest multiple of this number of bytes (must be a power of 2.) To generate images suitable for X Video, <code>pad</code> should be set to 4.</td></tr>
|
||||
<tr><td class="paramname">dstBuf</td><td>pointer to a buffer that will receive the unified planar YUV image. Use <a class="el" href="group___turbo_j_p_e_g.html#ga5e5aac9e8bcf17049279301e2466474c" title="The size of the buffer (in bytes) required to hold a unified planar YUV image with the given paramete...">tjBufSizeYUV2()</a> to determine the appropriate size for this buffer based on the image width, height, row alignment, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes will be stored sequentially in the buffer. (Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.)</td></tr>
|
||||
<tr><td class="paramname">align</td><td>row alignment (in bytes) of the YUV image (must be a power of 2.) Setting this parameter to n will cause each row in each plane of the YUV image to be padded to the nearest multiple of n bytes (1 = unpadded.) To generate images suitable for X Video, <code>align</code> should be set to 4.</td></tr>
|
||||
<tr><td class="paramname">subsamp</td><td>the level of chrominance subsampling to be used when generating the YUV image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.) To generate images suitable for X Video, <code>subsamp</code> should be set to <a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a63085dbf683cfe39e513cdb6343e3737">TJSAMP_420</a>. This produces an image compatible with the I420 (AKA "YUV420P") format.</td></tr>
|
||||
<tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
|
||||
</table>
|
||||
@@ -2080,18 +2101,18 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Encode an RGB or grayscale image into separate Y, U (Cb), and V (Cr) image planes. </p>
|
||||
<p>This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG compression process.</p>
|
||||
<p>Encode a packed-pixel RGB or grayscale image into separate Y, U (Cb), and V (Cr) image planes. </p>
|
||||
<p>This function performs color conversion (which is accelerated in the libjpeg-turbo implementation) but does not execute any of the other steps in the JPEG compression process.</p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance</td></tr>
|
||||
<tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing RGB or grayscale pixels to be encoded</td></tr>
|
||||
<tr><td class="paramname">srcBuf</td><td>pointer to a buffer containing a packed-pixel RGB or grayscale source image to be encoded</td></tr>
|
||||
<tr><td class="paramname">width</td><td>width (in pixels) of the source image</td></tr>
|
||||
<tr><td class="paramname">pitch</td><td>bytes per line in the source image. Normally, this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
|
||||
<tr><td class="paramname">pitch</td><td>bytes per row in the source image. Normally this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>, if the image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest multiple of 4.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each row of the image is padded to the nearest multiple of 4 bytes, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip rows, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
|
||||
<tr><td class="paramname">height</td><td>height (in pixels) of the source image</td></tr>
|
||||
<tr><td class="paramname">pixelFormat</td><td>pixel format of the source image (see <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.)</td></tr>
|
||||
<tr><td class="paramname">dstPlanes</td><td>an array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if generating a grayscale image) that will receive the encoded image. These planes can be contiguous or non-contiguous in memory. Use <a class="el" href="group___turbo_j_p_e_g.html#gab4ab7b24f6e797d79abaaa670373961d" title="The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters.">tjPlaneSizeYUV()</a> to determine the appropriate size for each plane based on the image width, height, strides, and level of chrominance subsampling. Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for more details.</td></tr>
|
||||
<tr><td class="paramname">strides</td><td>an array of integers, each specifying the number of bytes per line in the corresponding plane of the output image. Setting the stride for any plane to 0 is the same as setting it to the plane width (see <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.) If <code>strides</code> is NULL, then the strides for all planes will be set to their respective plane widths. You can adjust the strides in order to add an arbitrary amount of line padding to each plane or to encode an RGB or grayscale image into a subregion of a larger YUV planar image.</td></tr>
|
||||
<tr><td class="paramname">strides</td><td>an array of integers, each specifying the number of bytes per row in the corresponding plane of the YUV image. Setting the stride for any plane to 0 is the same as setting it to the plane width (see <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.) If <code>strides</code> is NULL, then the strides for all planes will be set to their respective plane widths. You can adjust the strides in order to add an arbitrary amount of row padding to each plane or to encode an RGB or grayscale image into a subregion of a larger planar YUV image.</td></tr>
|
||||
<tr><td class="paramname">subsamp</td><td>the level of chrominance subsampling to be used when generating the YUV image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.) To generate images suitable for X Video, <code>subsamp</code> should be set to <a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a63085dbf683cfe39e513cdb6343e3737">TJSAMP_420</a>. This produces an image compatible with the I420 (AKA "YUV420P") format.</td></tr>
|
||||
<tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
|
||||
</table>
|
||||
@@ -2117,15 +2138,15 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Free an image buffer previously allocated by TurboJPEG. </p>
|
||||
<p>You should always use this function to free JPEG destination buffer(s) that were automatically (re)allocated by the compression and transform functions or that were manually allocated using <a class="el" href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83" title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a>.</p>
|
||||
<p>Free a byte buffer previously allocated by TurboJPEG. </p>
|
||||
<p>You should always use this function to free JPEG destination buffer(s) that were automatically (re)allocated by the compression and transform functions or that were manually allocated using <a class="el" href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83" title="Allocate a byte buffer for use with TurboJPEG.">tjAlloc()</a>.</p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">buffer</td><td>address of the buffer to free. If the address is NULL, then this function has no effect.</td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83" title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a> </dd></dl>
|
||||
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83" title="Allocate a byte buffer for use with TurboJPEG.">tjAlloc()</a> </dd></dl>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -2184,8 +2205,8 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="gac3854476006b10787bd128f7ede48057"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#gac3854476006b10787bd128f7ede48057">◆ </a></span>tjGetScalingFactors()</h2>
|
||||
<a id="ga193d0977b3b9966d53a6c402e90899b1"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ga193d0977b3b9966d53a6c402e90899b1">◆ </a></span>tjGetScalingFactors()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
@@ -2194,16 +2215,16 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
<td class="memname">DLLEXPORT <a class="el" href="structtjscalingfactor.html">tjscalingfactor</a>* tjGetScalingFactors </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">int * </td>
|
||||
<td class="paramname"><em>numscalingfactors</em></td><td>)</td>
|
||||
<td class="paramname"><em>numScalingFactors</em></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Returns a list of fractional scaling factors that the JPEG decompressor in this implementation of TurboJPEG supports. </p>
|
||||
<p>Returns a list of fractional scaling factors that the JPEG decompressor supports. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">numscalingfactors</td><td>pointer to an integer variable that will receive the number of elements in the list</td></tr>
|
||||
<tr><td class="paramname">numScalingFactors</td><td>pointer to an integer variable that will receive the number of elements in the list</td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
@@ -2324,25 +2345,25 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Load an uncompressed image from disk into memory. </p>
|
||||
<p>Load a packed-pixel image from disk into memory. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">filename</td><td>name of a file containing an uncompressed image in Windows BMP or PBMPLUS (PPM/PGM) format</td></tr>
|
||||
<tr><td class="paramname">width</td><td>pointer to an integer variable that will receive the width (in pixels) of the uncompressed image</td></tr>
|
||||
<tr><td class="paramname">align</td><td>row alignment of the image buffer to be returned (must be a power of 2.) For instance, setting this parameter to 4 will cause all rows in the image buffer to be padded to the nearest 32-bit boundary, and setting this parameter to 1 will cause all rows in the image buffer to be unpadded.</td></tr>
|
||||
<tr><td class="paramname">height</td><td>pointer to an integer variable that will receive the height (in pixels) of the uncompressed image</td></tr>
|
||||
<tr><td class="paramname">pixelFormat</td><td>pointer to an integer variable that specifies or will receive the pixel format of the uncompressed image buffer. The behavior of <a class="el" href="group___turbo_j_p_e_g.html#gaffbd83c375e79f5db4b5c5d8ad4466e7" title="Load an uncompressed image from disk into memory.">tjLoadImage()</a> will vary depending on the value of <code>*pixelFormat</code> passed to the function:<ul>
|
||||
<li><a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa84c1a6cead7952998e2fb895844a21ed">TJPF_UNKNOWN</a> : The uncompressed image buffer returned by the function will use the most optimal pixel format for the file type, and <code>*pixelFormat</code> will contain the ID of this pixel format upon successful return from the function.</li>
|
||||
<li><a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a">TJPF_GRAY</a> : Only PGM files and 8-bit BMP files with a grayscale colormap can be loaded.</li>
|
||||
<li><a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7f5100ec44c91994e243f1cf55553f8b">TJPF_CMYK</a> : The RGB or grayscale pixels stored in the file will be converted using a quick & dirty algorithm that is suitable only for testing purposes (proper conversion between CMYK and other formats requires a color management system.)</li>
|
||||
<li>Other <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">pixel formats</a> : The uncompressed image buffer will use the specified pixel format, and pixel format conversion will be performed if necessary.</li>
|
||||
<tr><td class="paramname">filename</td><td>name of a file containing a packed-pixel image in Windows BMP or PBMPLUS (PPM/PGM) format</td></tr>
|
||||
<tr><td class="paramname">width</td><td>pointer to an integer variable that will receive the width (in pixels) of the packed-pixel image</td></tr>
|
||||
<tr><td class="paramname">align</td><td>row alignment of the packed-pixel buffer to be returned (must be a power of 2.) Setting this parameter to n will cause all rows in the buffer to be padded to the nearest multiple of n bytes (1 = unpadded.)</td></tr>
|
||||
<tr><td class="paramname">height</td><td>pointer to an integer variable that will receive the height (in pixels) of the packed-pixel image</td></tr>
|
||||
<tr><td class="paramname">pixelFormat</td><td>pointer to an integer variable that specifies or will receive the pixel format of the packed-pixel buffer. The behavior of <a class="el" href="group___turbo_j_p_e_g.html#gaffbd83c375e79f5db4b5c5d8ad4466e7" title="Load a packed-pixel image from disk into memory.">tjLoadImage()</a> will vary depending on the value of <code>*pixelFormat</code> passed to the function:<ul>
|
||||
<li><a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa84c1a6cead7952998e2fb895844a21ed">TJPF_UNKNOWN</a> : The packed-pixel buffer returned by this function will use the most optimal pixel format for the file type, and <code>*pixelFormat</code> will contain the ID of that pixel format upon successful return from this function.</li>
|
||||
<li><a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a">TJPF_GRAY</a> : Only PGM files and 8-bit-per-pixel BMP files with a grayscale colormap can be loaded.</li>
|
||||
<li><a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7f5100ec44c91994e243f1cf55553f8b">TJPF_CMYK</a> : The RGB or grayscale pixels stored in the file will be converted using a quick & dirty algorithm that is suitable only for testing purposes. (Proper conversion between CMYK and other formats requires a color management system.)</li>
|
||||
<li>Other <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">pixel formats</a> : The packed-pixel buffer will use the specified pixel format, and pixel format conversion will be performed if necessary.</li>
|
||||
</ul>
|
||||
</td></tr>
|
||||
<tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a>.</td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>a pointer to a newly-allocated buffer containing the uncompressed image, converted to the chosen pixel format and with the chosen row alignment, or NULL if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a>.) This buffer should be freed using <a class="el" href="group___turbo_j_p_e_g.html#gaea863d2da0cdb609563aabdf9196514b" title="Free an image buffer previously allocated by TurboJPEG.">tjFree()</a>. </dd></dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>a pointer to a newly-allocated buffer containing the packed-pixel image, converted to the chosen pixel format and with the chosen row alignment, or NULL if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a>.) This buffer should be freed using <a class="el" href="group___turbo_j_p_e_g.html#gaea863d2da0cdb609563aabdf9196514b" title="Free a byte buffer previously allocated by TurboJPEG.">tjFree()</a>. </dd></dl>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -2441,7 +2462,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
<table class="params">
|
||||
<tr><td class="paramname">componentID</td><td>ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr)</td></tr>
|
||||
<tr><td class="paramname">width</td><td>width (in pixels) of the YUV image. NOTE: this is the width of the whole image, not the plane width.</td></tr>
|
||||
<tr><td class="paramname">stride</td><td>bytes per line in the image plane. Setting this to 0 is the equivalent of setting it to the plane width.</td></tr>
|
||||
<tr><td class="paramname">stride</td><td>bytes per row in the image plane. Setting this to 0 is the equivalent of setting it to the plane width.</td></tr>
|
||||
<tr><td class="paramname">height</td><td>height (in pixels) of the YUV image. NOTE: this is the height of the whole image, not the plane height.</td></tr>
|
||||
<tr><td class="paramname">subsamp</td><td>level of chrominance subsampling in the image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
|
||||
</table>
|
||||
@@ -2553,15 +2574,15 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Save an uncompressed image from memory to disk. </p>
|
||||
<p>Save a packed-pixel image from memory to disk. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">filename</td><td>name of a file to which to save the uncompressed image. The image will be stored in Windows BMP or PBMPLUS (PPM/PGM) format, depending on the file extension.</td></tr>
|
||||
<tr><td class="paramname">buffer</td><td>pointer to an image buffer containing RGB, grayscale, or CMYK pixels to be saved</td></tr>
|
||||
<tr><td class="paramname">width</td><td>width (in pixels) of the uncompressed image</td></tr>
|
||||
<tr><td class="paramname">pitch</td><td>bytes per line in the image buffer. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
|
||||
<tr><td class="paramname">height</td><td>height (in pixels) of the uncompressed image</td></tr>
|
||||
<tr><td class="paramname">pixelFormat</td><td>pixel format of the image buffer (see <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.) If this parameter is set to <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a">TJPF_GRAY</a>, then the image will be stored in PGM or 8-bit (indexed color) BMP format. Otherwise, the image will be stored in PPM or 24-bit BMP format. If this parameter is set to <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7f5100ec44c91994e243f1cf55553f8b">TJPF_CMYK</a>, then the CMYK pixels will be converted to RGB using a quick & dirty algorithm that is suitable only for testing (proper conversion between CMYK and other formats requires a color management system.)</td></tr>
|
||||
<tr><td class="paramname">filename</td><td>name of a file to which to save the packed-pixel image. The image will be stored in Windows BMP or PBMPLUS (PPM/PGM) format, depending on the file extension.</td></tr>
|
||||
<tr><td class="paramname">buffer</td><td>pointer to a buffer containing a packed-pixel RGB, grayscale, or CMYK image to be saved</td></tr>
|
||||
<tr><td class="paramname">width</td><td>width (in pixels) of the packed-pixel image</td></tr>
|
||||
<tr><td class="paramname">pitch</td><td>bytes per row in the packed-pixel image. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
|
||||
<tr><td class="paramname">height</td><td>height (in pixels) of the packed-pixel image</td></tr>
|
||||
<tr><td class="paramname">pixelFormat</td><td>pixel format of the packed-pixel image (see <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.) If this parameter is set to <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a">TJPF_GRAY</a>, then the image will be stored in PGM or 8-bit-per-pixel (indexed color) BMP format. Otherwise, the image will be stored in PPM or 24-bit-per-pixel BMP format. If this parameter is set to <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7f5100ec44c91994e243f1cf55553f8b">TJPF_CMYK</a>, then the CMYK pixels will be converted to RGB using a quick & dirty algorithm that is suitable only for testing purposes. (Proper conversion between CMYK and other formats requires a color management system.)</td></tr>
|
||||
<tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a>.</td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
@@ -2637,17 +2658,17 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG transformer instance</td></tr>
|
||||
<tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG source image to transform</td></tr>
|
||||
<tr><td class="paramname">jpegBuf</td><td>pointer to a byte buffer containing the JPEG source image to transform</td></tr>
|
||||
<tr><td class="paramname">jpegSize</td><td>size of the JPEG source image (in bytes)</td></tr>
|
||||
<tr><td class="paramname">n</td><td>the number of transformed JPEG images to generate</td></tr>
|
||||
<tr><td class="paramname">dstBufs</td><td>pointer to an array of n image buffers. <code>dstBufs[i]</code> will receive a JPEG image that has been transformed using the parameters in <code>transforms[i]</code>. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:<ol type="1">
|
||||
<li>pre-allocate the JPEG buffer with an arbitrary size using <a class="el" href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83" title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a> and let TurboJPEG grow the buffer as needed,</li>
|
||||
<tr><td class="paramname">dstBufs</td><td>pointer to an array of n byte buffers. <code>dstBufs[i]</code> will receive a JPEG image that has been transformed using the parameters in <code>transforms[i]</code>. TurboJPEG has the ability to reallocate the JPEG destination buffer to accommodate the size of the transformed JPEG image. Thus, you can choose to:<ol type="1">
|
||||
<li>pre-allocate the JPEG destination buffer with an arbitrary size using <a class="el" href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83" title="Allocate a byte buffer for use with TurboJPEG.">tjAlloc()</a> and let TurboJPEG grow the buffer as needed,</li>
|
||||
<li>set <code>dstBufs[i]</code> to NULL to tell TurboJPEG to allocate the buffer for you, or</li>
|
||||
<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#ga67ac12fee79073242cb216e07c9f1f90" title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters.">tjBufSize()</a> with the transformed or cropped width and height. Under normal circumstances, this should ensure that the buffer never has to be re-allocated (setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees that it won't be.) Note, however, that there are some rare cases (such as transforming images with a large amount of embedded EXIF or ICC profile data) in which the output image will be larger than the worst-case size, and <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> cannot be used in those cases.</li>
|
||||
<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#ga67ac12fee79073242cb216e07c9f1f90" title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters.">tjBufSize()</a> with the transformed or cropped width and height. Under normal circumstances, this should ensure that the buffer never has to be re-allocated. (Setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable JPEG buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees that it won't be.) Note, however, that there are some rare cases (such as transforming images with a large amount of embedded EXIF or ICC profile data) in which the transformed JPEG image will be larger than the worst-case size, and <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable JPEG buffer (re)allocation.">TJFLAG_NOREALLOC</a> cannot be used in those cases.</li>
|
||||
</ol>
|
||||
If you choose option 1, <code>dstSizes[i]</code> should be set to the size of your pre-allocated buffer. In any case, unless you have set <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a>, you should always check <code>dstBufs[i]</code> upon return from this function, as it may have changed.</td></tr>
|
||||
<tr><td class="paramname">dstSizes</td><td>pointer to an array of n unsigned long variables that will receive the actual sizes (in bytes) of each transformed JPEG image. If <code>dstBufs[i]</code> points to a pre-allocated buffer, then <code>dstSizes[i]</code> should be set to the size of the buffer. Upon return, <code>dstSizes[i]</code> will contain the size of the JPEG image (in bytes.)</td></tr>
|
||||
<tr><td class="paramname">transforms</td><td>pointer to an array of n <a class="el" href="structtjtransform.html" title="Lossless transform.">tjtransform</a> structures, each of which specifies the transform parameters and/or cropping region for the corresponding transformed output image.</td></tr>
|
||||
If you choose option 1, then <code>dstSizes[i]</code> should be set to the size of your pre-allocated buffer. In any case, unless you have set <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable JPEG buffer (re)allocation.">TJFLAG_NOREALLOC</a>, you should always check <code>dstBufs[i]</code> upon return from this function, as it may have changed.</td></tr>
|
||||
<tr><td class="paramname">dstSizes</td><td>pointer to an array of n unsigned long variables that will receive the actual sizes (in bytes) of each transformed JPEG image. If <code>dstBufs[i]</code> points to a pre-allocated buffer, then <code>dstSizes[i]</code> should be set to the size of the buffer. Upon return, <code>dstSizes[i]</code> will contain the size of the transformed JPEG image (in bytes.)</td></tr>
|
||||
<tr><td class="paramname">transforms</td><td>pointer to an array of n <a class="el" href="structtjtransform.html" title="Lossless transform.">tjtransform</a> structures, each of which specifies the transform parameters and/or cropping region for the corresponding transformed JPEG image.</td></tr>
|
||||
<tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
@@ -2678,7 +2699,7 @@ If you choose option 1, <code>dstSizes[i]</code> should be set to the size of yo
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Alpha offset (in bytes) for a given pixel format. </p>
|
||||
<p>This specifies the number of bytes that the Alpha component is offset from the start of the pixel. For instance, if a pixel of format TJ_BGRA is stored in <code>char pixel[]</code>, then the alpha component will be <code>pixel[tjAlphaOffset[TJ_BGRA]]</code>. This will be -1 if the pixel format does not have an alpha component. </p>
|
||||
<p>This specifies the number of bytes that the alpha component is offset from the start of the pixel. For instance, if a pixel of format TJPF_BGRA is stored in <code>unsigned char pixel[]</code>, then the alpha component will be <code>pixel[tjAlphaOffset[TJPF_BGRA]]</code>. This will be -1 if the pixel format does not have an alpha component. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -2703,7 +2724,7 @@ If you choose option 1, <code>dstSizes[i]</code> should be set to the size of yo
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Blue offset (in bytes) for a given pixel format. </p>
|
||||
<p>This specifies the number of bytes that the Blue component is offset from the start of the pixel. For instance, if a pixel of format TJ_BGRX is stored in <code>char pixel[]</code>, then the blue component will be <code>pixel[tjBlueOffset[TJ_BGRX]]</code>. This will be -1 if the pixel format does not have a blue component. </p>
|
||||
<p>This specifies the number of bytes that the blue component is offset from the start of the pixel. For instance, if a pixel of format TJPF_BGRX is stored in <code>unsigned char pixel[]</code>, then the blue component will be <code>pixel[tjBlueOffset[TJPF_BGRX]]</code>. This will be -1 if the pixel format does not have a blue component. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -2728,7 +2749,7 @@ If you choose option 1, <code>dstSizes[i]</code> should be set to the size of yo
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Green offset (in bytes) for a given pixel format. </p>
|
||||
<p>This specifies the number of bytes that the green component is offset from the start of the pixel. For instance, if a pixel of format TJ_BGRX is stored in <code>char pixel[]</code>, then the green component will be <code>pixel[tjGreenOffset[TJ_BGRX]]</code>. This will be -1 if the pixel format does not have a green component. </p>
|
||||
<p>This specifies the number of bytes that the green component is offset from the start of the pixel. For instance, if a pixel of format TJPF_BGRX is stored in <code>unsigned char pixel[]</code>, then the green component will be <code>pixel[tjGreenOffset[TJPF_BGRX]]</code>. This will be -1 if the pixel format does not have a green component. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -2839,7 +2860,7 @@ If you choose option 1, <code>dstSizes[i]</code> should be set to the size of yo
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Red offset (in bytes) for a given pixel format. </p>
|
||||
<p>This specifies the number of bytes that the red component is offset from the start of the pixel. For instance, if a pixel of format TJ_BGRX is stored in <code>char pixel[]</code>, then the red component will be <code>pixel[tjRedOffset[TJ_BGRX]]</code>. This will be -1 if the pixel format does not have a red component. </p>
|
||||
<p>This specifies the number of bytes that the red component is offset from the start of the pixel. For instance, if a pixel of format TJPF_BGRX is stored in <code>unsigned char pixel[]</code>, then the red component will be <code>pixel[tjRedOffset[TJPF_BGRX]]</code>. This will be -1 if the pixel format does not have a red component. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">TurboJPEG
|
||||
 <span id="projectnumber">2.0</span>
|
||||
 <span id="projectnumber">2.1.4</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">TurboJPEG
|
||||
 <span id="projectnumber">2.0</span>
|
||||
 <span id="projectnumber">2.1.4</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -9,9 +9,9 @@ var searchData=
|
||||
['tjalphaoffset_14',['tjAlphaOffset',['../group___turbo_j_p_e_g.html#ga5af0ab065feefd526debf1e20c43e837',1,'turbojpeg.h']]],
|
||||
['tjblueoffset_15',['tjBlueOffset',['../group___turbo_j_p_e_g.html#ga84e2e35d3f08025f976ec1ec53693dea',1,'turbojpeg.h']]],
|
||||
['tjbufsize_16',['tjBufSize',['../group___turbo_j_p_e_g.html#ga67ac12fee79073242cb216e07c9f1f90',1,'turbojpeg.h']]],
|
||||
['tjbufsizeyuv2_17',['tjBufSizeYUV2',['../group___turbo_j_p_e_g.html#ga2be2b9969d4df9ecce9b05deed273194',1,'turbojpeg.h']]],
|
||||
['tjbufsizeyuv2_17',['tjBufSizeYUV2',['../group___turbo_j_p_e_g.html#ga5e5aac9e8bcf17049279301e2466474c',1,'turbojpeg.h']]],
|
||||
['tjcompress2_18',['tjCompress2',['../group___turbo_j_p_e_g.html#gafbdce0112fd78fd38efae841443a9bcf',1,'turbojpeg.h']]],
|
||||
['tjcompressfromyuv_19',['tjCompressFromYUV',['../group___turbo_j_p_e_g.html#ga7622a459b79aa1007e005b58783f875b',1,'turbojpeg.h']]],
|
||||
['tjcompressfromyuv_19',['tjCompressFromYUV',['../group___turbo_j_p_e_g.html#gab40f5096a72fd7e5bda9d6b58fa37e2e',1,'turbojpeg.h']]],
|
||||
['tjcompressfromyuvplanes_20',['tjCompressFromYUVPlanes',['../group___turbo_j_p_e_g.html#ga29ec5dfbd2d84b8724e951d6fa0d5d9e',1,'turbojpeg.h']]],
|
||||
['tjcs_21',['TJCS',['../group___turbo_j_p_e_g.html#ga4f83ad3368e0e29d1957be0efa7c3720',1,'turbojpeg.h']]],
|
||||
['tjcs_5fcmyk_22',['TJCS_CMYK',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a6c8b636152ac8195b869587db315ee53',1,'turbojpeg.h']]],
|
||||
@@ -19,14 +19,14 @@ var searchData=
|
||||
['tjcs_5frgb_24',['TJCS_RGB',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a677cb7ccb85c4038ac41964a2e09e555',1,'turbojpeg.h']]],
|
||||
['tjcs_5fycbcr_25',['TJCS_YCbCr',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a7389b8f65bb387ffedce3efd0d78ec75',1,'turbojpeg.h']]],
|
||||
['tjcs_5fycck_26',['TJCS_YCCK',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a53839e0fe867b76b58d16b0a1a7c598e',1,'turbojpeg.h']]],
|
||||
['tjdecodeyuv_27',['tjDecodeYUV',['../group___turbo_j_p_e_g.html#ga70abbf38f77a26fd6da8813bef96f695',1,'turbojpeg.h']]],
|
||||
['tjdecodeyuv_27',['tjDecodeYUV',['../group___turbo_j_p_e_g.html#ga97c2cedc1e2bade15a84164c94e503c1',1,'turbojpeg.h']]],
|
||||
['tjdecodeyuvplanes_28',['tjDecodeYUVPlanes',['../group___turbo_j_p_e_g.html#ga10e837c07fa9d25770565b237d3898d9',1,'turbojpeg.h']]],
|
||||
['tjdecompress2_29',['tjDecompress2',['../group___turbo_j_p_e_g.html#gae9eccef8b682a48f43a9117c231ed013',1,'turbojpeg.h']]],
|
||||
['tjdecompressheader3_30',['tjDecompressHeader3',['../group___turbo_j_p_e_g.html#ga0595681096bba7199cc6f3533cb25f77',1,'turbojpeg.h']]],
|
||||
['tjdecompresstoyuv2_31',['tjDecompressToYUV2',['../group___turbo_j_p_e_g.html#ga04d1e839ff9a0860dd1475cff78d3364',1,'turbojpeg.h']]],
|
||||
['tjdecompresstoyuv2_31',['tjDecompressToYUV2',['../group___turbo_j_p_e_g.html#ga5a3093e325598c17a9f004323af6fafa',1,'turbojpeg.h']]],
|
||||
['tjdecompresstoyuvplanes_32',['tjDecompressToYUVPlanes',['../group___turbo_j_p_e_g.html#gaa59f901a5258ada5bd0185ad59368540',1,'turbojpeg.h']]],
|
||||
['tjdestroy_33',['tjDestroy',['../group___turbo_j_p_e_g.html#ga75f355fa27225ba1a4ee392c852394d2',1,'turbojpeg.h']]],
|
||||
['tjencodeyuv3_34',['tjEncodeYUV3',['../group___turbo_j_p_e_g.html#gac519b922cdf446e97d0cdcba513636bf',1,'turbojpeg.h']]],
|
||||
['tjencodeyuv3_34',['tjEncodeYUV3',['../group___turbo_j_p_e_g.html#ga5d619e0a02b71e05a8dffb764f6d7a64',1,'turbojpeg.h']]],
|
||||
['tjencodeyuvplanes_35',['tjEncodeYUVPlanes',['../group___turbo_j_p_e_g.html#gae2d04c72457fe7f4d60cf78ab1b1feb1',1,'turbojpeg.h']]],
|
||||
['tjerr_36',['TJERR',['../group___turbo_j_p_e_g.html#gafbc17cfa57d0d5d11fea35ac025950fe',1,'turbojpeg.h']]],
|
||||
['tjerr_5ffatal_37',['TJERR_FATAL',['../group___turbo_j_p_e_g.html#ggafbc17cfa57d0d5d11fea35ac025950feafc9cceeada13122b09e4851e3788039a',1,'turbojpeg.h']]],
|
||||
@@ -35,68 +35,69 @@ var searchData=
|
||||
['tjflag_5fbottomup_40',['TJFLAG_BOTTOMUP',['../group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec',1,'turbojpeg.h']]],
|
||||
['tjflag_5ffastdct_41',['TJFLAG_FASTDCT',['../group___turbo_j_p_e_g.html#gaabce235db80d3f698b27f36cbd453da2',1,'turbojpeg.h']]],
|
||||
['tjflag_5ffastupsample_42',['TJFLAG_FASTUPSAMPLE',['../group___turbo_j_p_e_g.html#ga4ee4506c81177a06f77e2504a22efd2d',1,'turbojpeg.h']]],
|
||||
['tjflag_5fnorealloc_43',['TJFLAG_NOREALLOC',['../group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963',1,'turbojpeg.h']]],
|
||||
['tjflag_5fprogressive_44',['TJFLAG_PROGRESSIVE',['../group___turbo_j_p_e_g.html#ga43b426750b46190a25d34a67ef76df1b',1,'turbojpeg.h']]],
|
||||
['tjflag_5fstoponwarning_45',['TJFLAG_STOPONWARNING',['../group___turbo_j_p_e_g.html#ga519cfa4ef6c18d9e5b455fdf59306a3a',1,'turbojpeg.h']]],
|
||||
['tjfree_46',['tjFree',['../group___turbo_j_p_e_g.html#gaea863d2da0cdb609563aabdf9196514b',1,'turbojpeg.h']]],
|
||||
['tjgeterrorcode_47',['tjGetErrorCode',['../group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410',1,'turbojpeg.h']]],
|
||||
['tjgeterrorstr2_48',['tjGetErrorStr2',['../group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa',1,'turbojpeg.h']]],
|
||||
['tjgetscalingfactors_49',['tjGetScalingFactors',['../group___turbo_j_p_e_g.html#gac3854476006b10787bd128f7ede48057',1,'turbojpeg.h']]],
|
||||
['tjgreenoffset_50',['tjGreenOffset',['../group___turbo_j_p_e_g.html#ga82d6e35da441112a411da41923c0ba2f',1,'turbojpeg.h']]],
|
||||
['tjhandle_51',['tjhandle',['../group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763',1,'turbojpeg.h']]],
|
||||
['tjinitcompress_52',['tjInitCompress',['../group___turbo_j_p_e_g.html#ga9d63a05fc6d813f4aae06107041a37e8',1,'turbojpeg.h']]],
|
||||
['tjinitdecompress_53',['tjInitDecompress',['../group___turbo_j_p_e_g.html#ga52300eac3f3d9ef4bab303bc244f62d3',1,'turbojpeg.h']]],
|
||||
['tjinittransform_54',['tjInitTransform',['../group___turbo_j_p_e_g.html#ga928beff6ac248ceadf01089fc6b41957',1,'turbojpeg.h']]],
|
||||
['tjloadimage_55',['tjLoadImage',['../group___turbo_j_p_e_g.html#gaffbd83c375e79f5db4b5c5d8ad4466e7',1,'turbojpeg.h']]],
|
||||
['tjmcuheight_56',['tjMCUHeight',['../group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf',1,'turbojpeg.h']]],
|
||||
['tjmcuwidth_57',['tjMCUWidth',['../group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c',1,'turbojpeg.h']]],
|
||||
['tjpad_58',['TJPAD',['../group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511',1,'turbojpeg.h']]],
|
||||
['tjpf_59',['TJPF',['../group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a',1,'turbojpeg.h']]],
|
||||
['tjpf_5fabgr_60',['TJPF_ABGR',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa1ba1a7f1631dbeaa49a0a85fc4a40081',1,'turbojpeg.h']]],
|
||||
['tjpf_5fargb_61',['TJPF_ARGB',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aae8f846ed9d9de99b6e1dfe448848765c',1,'turbojpeg.h']]],
|
||||
['tjpf_5fbgr_62',['TJPF_BGR',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aab10624437fb8ef495a0b153e65749839',1,'turbojpeg.h']]],
|
||||
['tjpf_5fbgra_63',['TJPF_BGRA',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aac037ff1845cf9b74bb81a3659c2b9fb4',1,'turbojpeg.h']]],
|
||||
['tjpf_5fbgrx_64',['TJPF_BGRX',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa2a1fbf569ca79897eae886e3376ca4c8',1,'turbojpeg.h']]],
|
||||
['tjpf_5fcmyk_65',['TJPF_CMYK',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7f5100ec44c91994e243f1cf55553f8b',1,'turbojpeg.h']]],
|
||||
['tjpf_5fgray_66',['TJPF_GRAY',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a',1,'turbojpeg.h']]],
|
||||
['tjpf_5frgb_67',['TJPF_RGB',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7ce93230bff449518ce387c17e6ed37c',1,'turbojpeg.h']]],
|
||||
['tjpf_5frgba_68',['TJPF_RGBA',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa88d2e88fab67f6503cf972e14851cc12',1,'turbojpeg.h']]],
|
||||
['tjpf_5frgbx_69',['TJPF_RGBX',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01',1,'turbojpeg.h']]],
|
||||
['tjpf_5funknown_70',['TJPF_UNKNOWN',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa84c1a6cead7952998e2fb895844a21ed',1,'turbojpeg.h']]],
|
||||
['tjpf_5fxbgr_71',['TJPF_XBGR',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af',1,'turbojpeg.h']]],
|
||||
['tjpf_5fxrgb_72',['TJPF_XRGB',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84',1,'turbojpeg.h']]],
|
||||
['tjpixelsize_73',['tjPixelSize',['../group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c',1,'turbojpeg.h']]],
|
||||
['tjplaneheight_74',['tjPlaneHeight',['../group___turbo_j_p_e_g.html#ga1a209696c6a80748f20e134b3c64789f',1,'turbojpeg.h']]],
|
||||
['tjplanesizeyuv_75',['tjPlaneSizeYUV',['../group___turbo_j_p_e_g.html#gab4ab7b24f6e797d79abaaa670373961d',1,'turbojpeg.h']]],
|
||||
['tjplanewidth_76',['tjPlaneWidth',['../group___turbo_j_p_e_g.html#ga63fb66bb1e36c74008c4634360becbb1',1,'turbojpeg.h']]],
|
||||
['tjredoffset_77',['tjRedOffset',['../group___turbo_j_p_e_g.html#gadd9b446742ac8a3923f7992c7988fea8',1,'turbojpeg.h']]],
|
||||
['tjregion_78',['tjregion',['../structtjregion.html',1,'']]],
|
||||
['tjsamp_79',['TJSAMP',['../group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074',1,'turbojpeg.h']]],
|
||||
['tjsamp_5f411_80',['TJSAMP_411',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a28ec62575e5ea295c3fde3001dc628e2',1,'turbojpeg.h']]],
|
||||
['tjsamp_5f420_81',['TJSAMP_420',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a63085dbf683cfe39e513cdb6343e3737',1,'turbojpeg.h']]],
|
||||
['tjsamp_5f422_82',['TJSAMP_422',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a136130902cc578f11f32429b59368404',1,'turbojpeg.h']]],
|
||||
['tjsamp_5f440_83',['TJSAMP_440',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074accf740e6f3aa6ba20ba922cad13cb974',1,'turbojpeg.h']]],
|
||||
['tjsamp_5f444_84',['TJSAMP_444',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074afb8da4f44197837bdec0a4f593dacae3',1,'turbojpeg.h']]],
|
||||
['tjsamp_5fgray_85',['TJSAMP_GRAY',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a3f1c9504842ddc7a48d0f690754b6248',1,'turbojpeg.h']]],
|
||||
['tjsaveimage_86',['tjSaveImage',['../group___turbo_j_p_e_g.html#ga6f445b22d8933ae4815b3370a538d879',1,'turbojpeg.h']]],
|
||||
['tjscaled_87',['TJSCALED',['../group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df',1,'turbojpeg.h']]],
|
||||
['tjscalingfactor_88',['tjscalingfactor',['../structtjscalingfactor.html',1,'']]],
|
||||
['tjtransform_89',['tjtransform',['../structtjtransform.html',1,'tjtransform'],['../group___turbo_j_p_e_g.html#ga504805ec0161f1b505397ca0118bf8fd',1,'tjtransform(): turbojpeg.h'],['../group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25',1,'tjTransform(tjhandle handle, const unsigned char *jpegBuf, unsigned long jpegSize, int n, unsigned char **dstBufs, unsigned long *dstSizes, tjtransform *transforms, int flags): turbojpeg.h']]],
|
||||
['tjxop_90',['TJXOP',['../group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866',1,'turbojpeg.h']]],
|
||||
['tjxop_5fhflip_91',['TJXOP_HFLIP',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aa0df69776caa30f0fa28e26332d311ce',1,'turbojpeg.h']]],
|
||||
['tjxop_5fnone_92',['TJXOP_NONE',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aad88c0366cd3f7d0eac9d7a3fa1c2c27',1,'turbojpeg.h']]],
|
||||
['tjxop_5frot180_93',['TJXOP_ROT180',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a140952eb8dd0300accfcc22726d69692',1,'turbojpeg.h']]],
|
||||
['tjxop_5frot270_94',['TJXOP_ROT270',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a3064ee5dfb7f032df332818587567a08',1,'turbojpeg.h']]],
|
||||
['tjxop_5frot90_95',['TJXOP_ROT90',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a43b2bbb23bc4bd548422d43fbe9af128',1,'turbojpeg.h']]],
|
||||
['tjxop_5ftranspose_96',['TJXOP_TRANSPOSE',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a31060aed199f886afdd417f80499c32d',1,'turbojpeg.h']]],
|
||||
['tjxop_5ftransverse_97',['TJXOP_TRANSVERSE',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866af3b14d488aea6ece9e5b3df73a74d6a4',1,'turbojpeg.h']]],
|
||||
['tjxop_5fvflip_98',['TJXOP_VFLIP',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a324eddfbec53b7e691f61e56929d0d5d',1,'turbojpeg.h']]],
|
||||
['tjxopt_5fcopynone_99',['TJXOPT_COPYNONE',['../group___turbo_j_p_e_g.html#ga153b468cfb905d0de61706c838986fe8',1,'turbojpeg.h']]],
|
||||
['tjxopt_5fcrop_100',['TJXOPT_CROP',['../group___turbo_j_p_e_g.html#ga9c771a757fc1294add611906b89ab2d2',1,'turbojpeg.h']]],
|
||||
['tjxopt_5fgray_101',['TJXOPT_GRAY',['../group___turbo_j_p_e_g.html#ga3acee7b48ade1b99e5588736007c2589',1,'turbojpeg.h']]],
|
||||
['tjxopt_5fnooutput_102',['TJXOPT_NOOUTPUT',['../group___turbo_j_p_e_g.html#gafbf992bbf6e006705886333703ffab31',1,'turbojpeg.h']]],
|
||||
['tjxopt_5fperfect_103',['TJXOPT_PERFECT',['../group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00',1,'turbojpeg.h']]],
|
||||
['tjxopt_5fprogressive_104',['TJXOPT_PROGRESSIVE',['../group___turbo_j_p_e_g.html#gad2371c80674584ecc1a7d75e564cf026',1,'turbojpeg.h']]],
|
||||
['tjxopt_5ftrim_105',['TJXOPT_TRIM',['../group___turbo_j_p_e_g.html#ga319826b7eb1583c0595bbe7b95428709',1,'turbojpeg.h']]],
|
||||
['turbojpeg_106',['TurboJPEG',['../group___turbo_j_p_e_g.html',1,'']]]
|
||||
['tjflag_5flimitscans_43',['TJFLAG_LIMITSCANS',['../group___turbo_j_p_e_g.html#ga163e6482dc5096831feef9c79ff3f805',1,'turbojpeg.h']]],
|
||||
['tjflag_5fnorealloc_44',['TJFLAG_NOREALLOC',['../group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963',1,'turbojpeg.h']]],
|
||||
['tjflag_5fprogressive_45',['TJFLAG_PROGRESSIVE',['../group___turbo_j_p_e_g.html#ga43b426750b46190a25d34a67ef76df1b',1,'turbojpeg.h']]],
|
||||
['tjflag_5fstoponwarning_46',['TJFLAG_STOPONWARNING',['../group___turbo_j_p_e_g.html#ga519cfa4ef6c18d9e5b455fdf59306a3a',1,'turbojpeg.h']]],
|
||||
['tjfree_47',['tjFree',['../group___turbo_j_p_e_g.html#gaea863d2da0cdb609563aabdf9196514b',1,'turbojpeg.h']]],
|
||||
['tjgeterrorcode_48',['tjGetErrorCode',['../group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410',1,'turbojpeg.h']]],
|
||||
['tjgeterrorstr2_49',['tjGetErrorStr2',['../group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa',1,'turbojpeg.h']]],
|
||||
['tjgetscalingfactors_50',['tjGetScalingFactors',['../group___turbo_j_p_e_g.html#ga193d0977b3b9966d53a6c402e90899b1',1,'turbojpeg.h']]],
|
||||
['tjgreenoffset_51',['tjGreenOffset',['../group___turbo_j_p_e_g.html#ga82d6e35da441112a411da41923c0ba2f',1,'turbojpeg.h']]],
|
||||
['tjhandle_52',['tjhandle',['../group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763',1,'turbojpeg.h']]],
|
||||
['tjinitcompress_53',['tjInitCompress',['../group___turbo_j_p_e_g.html#ga9d63a05fc6d813f4aae06107041a37e8',1,'turbojpeg.h']]],
|
||||
['tjinitdecompress_54',['tjInitDecompress',['../group___turbo_j_p_e_g.html#ga52300eac3f3d9ef4bab303bc244f62d3',1,'turbojpeg.h']]],
|
||||
['tjinittransform_55',['tjInitTransform',['../group___turbo_j_p_e_g.html#ga928beff6ac248ceadf01089fc6b41957',1,'turbojpeg.h']]],
|
||||
['tjloadimage_56',['tjLoadImage',['../group___turbo_j_p_e_g.html#gaffbd83c375e79f5db4b5c5d8ad4466e7',1,'turbojpeg.h']]],
|
||||
['tjmcuheight_57',['tjMCUHeight',['../group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf',1,'turbojpeg.h']]],
|
||||
['tjmcuwidth_58',['tjMCUWidth',['../group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c',1,'turbojpeg.h']]],
|
||||
['tjpad_59',['TJPAD',['../group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511',1,'turbojpeg.h']]],
|
||||
['tjpf_60',['TJPF',['../group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a',1,'turbojpeg.h']]],
|
||||
['tjpf_5fabgr_61',['TJPF_ABGR',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa1ba1a7f1631dbeaa49a0a85fc4a40081',1,'turbojpeg.h']]],
|
||||
['tjpf_5fargb_62',['TJPF_ARGB',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aae8f846ed9d9de99b6e1dfe448848765c',1,'turbojpeg.h']]],
|
||||
['tjpf_5fbgr_63',['TJPF_BGR',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aab10624437fb8ef495a0b153e65749839',1,'turbojpeg.h']]],
|
||||
['tjpf_5fbgra_64',['TJPF_BGRA',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aac037ff1845cf9b74bb81a3659c2b9fb4',1,'turbojpeg.h']]],
|
||||
['tjpf_5fbgrx_65',['TJPF_BGRX',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa2a1fbf569ca79897eae886e3376ca4c8',1,'turbojpeg.h']]],
|
||||
['tjpf_5fcmyk_66',['TJPF_CMYK',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7f5100ec44c91994e243f1cf55553f8b',1,'turbojpeg.h']]],
|
||||
['tjpf_5fgray_67',['TJPF_GRAY',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a',1,'turbojpeg.h']]],
|
||||
['tjpf_5frgb_68',['TJPF_RGB',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7ce93230bff449518ce387c17e6ed37c',1,'turbojpeg.h']]],
|
||||
['tjpf_5frgba_69',['TJPF_RGBA',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa88d2e88fab67f6503cf972e14851cc12',1,'turbojpeg.h']]],
|
||||
['tjpf_5frgbx_70',['TJPF_RGBX',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01',1,'turbojpeg.h']]],
|
||||
['tjpf_5funknown_71',['TJPF_UNKNOWN',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa84c1a6cead7952998e2fb895844a21ed',1,'turbojpeg.h']]],
|
||||
['tjpf_5fxbgr_72',['TJPF_XBGR',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af',1,'turbojpeg.h']]],
|
||||
['tjpf_5fxrgb_73',['TJPF_XRGB',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84',1,'turbojpeg.h']]],
|
||||
['tjpixelsize_74',['tjPixelSize',['../group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c',1,'turbojpeg.h']]],
|
||||
['tjplaneheight_75',['tjPlaneHeight',['../group___turbo_j_p_e_g.html#ga1a209696c6a80748f20e134b3c64789f',1,'turbojpeg.h']]],
|
||||
['tjplanesizeyuv_76',['tjPlaneSizeYUV',['../group___turbo_j_p_e_g.html#gab4ab7b24f6e797d79abaaa670373961d',1,'turbojpeg.h']]],
|
||||
['tjplanewidth_77',['tjPlaneWidth',['../group___turbo_j_p_e_g.html#ga63fb66bb1e36c74008c4634360becbb1',1,'turbojpeg.h']]],
|
||||
['tjredoffset_78',['tjRedOffset',['../group___turbo_j_p_e_g.html#gadd9b446742ac8a3923f7992c7988fea8',1,'turbojpeg.h']]],
|
||||
['tjregion_79',['tjregion',['../structtjregion.html',1,'']]],
|
||||
['tjsamp_80',['TJSAMP',['../group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074',1,'turbojpeg.h']]],
|
||||
['tjsamp_5f411_81',['TJSAMP_411',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a28ec62575e5ea295c3fde3001dc628e2',1,'turbojpeg.h']]],
|
||||
['tjsamp_5f420_82',['TJSAMP_420',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a63085dbf683cfe39e513cdb6343e3737',1,'turbojpeg.h']]],
|
||||
['tjsamp_5f422_83',['TJSAMP_422',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a136130902cc578f11f32429b59368404',1,'turbojpeg.h']]],
|
||||
['tjsamp_5f440_84',['TJSAMP_440',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074accf740e6f3aa6ba20ba922cad13cb974',1,'turbojpeg.h']]],
|
||||
['tjsamp_5f444_85',['TJSAMP_444',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074afb8da4f44197837bdec0a4f593dacae3',1,'turbojpeg.h']]],
|
||||
['tjsamp_5fgray_86',['TJSAMP_GRAY',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a3f1c9504842ddc7a48d0f690754b6248',1,'turbojpeg.h']]],
|
||||
['tjsaveimage_87',['tjSaveImage',['../group___turbo_j_p_e_g.html#ga6f445b22d8933ae4815b3370a538d879',1,'turbojpeg.h']]],
|
||||
['tjscaled_88',['TJSCALED',['../group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df',1,'turbojpeg.h']]],
|
||||
['tjscalingfactor_89',['tjscalingfactor',['../structtjscalingfactor.html',1,'']]],
|
||||
['tjtransform_90',['tjtransform',['../structtjtransform.html',1,'tjtransform'],['../group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25',1,'tjTransform(tjhandle handle, const unsigned char *jpegBuf, unsigned long jpegSize, int n, unsigned char **dstBufs, unsigned long *dstSizes, tjtransform *transforms, int flags): turbojpeg.h'],['../group___turbo_j_p_e_g.html#ga504805ec0161f1b505397ca0118bf8fd',1,'tjtransform(): turbojpeg.h']]],
|
||||
['tjxop_91',['TJXOP',['../group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866',1,'turbojpeg.h']]],
|
||||
['tjxop_5fhflip_92',['TJXOP_HFLIP',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aa0df69776caa30f0fa28e26332d311ce',1,'turbojpeg.h']]],
|
||||
['tjxop_5fnone_93',['TJXOP_NONE',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aad88c0366cd3f7d0eac9d7a3fa1c2c27',1,'turbojpeg.h']]],
|
||||
['tjxop_5frot180_94',['TJXOP_ROT180',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a140952eb8dd0300accfcc22726d69692',1,'turbojpeg.h']]],
|
||||
['tjxop_5frot270_95',['TJXOP_ROT270',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a3064ee5dfb7f032df332818587567a08',1,'turbojpeg.h']]],
|
||||
['tjxop_5frot90_96',['TJXOP_ROT90',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a43b2bbb23bc4bd548422d43fbe9af128',1,'turbojpeg.h']]],
|
||||
['tjxop_5ftranspose_97',['TJXOP_TRANSPOSE',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a31060aed199f886afdd417f80499c32d',1,'turbojpeg.h']]],
|
||||
['tjxop_5ftransverse_98',['TJXOP_TRANSVERSE',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866af3b14d488aea6ece9e5b3df73a74d6a4',1,'turbojpeg.h']]],
|
||||
['tjxop_5fvflip_99',['TJXOP_VFLIP',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a324eddfbec53b7e691f61e56929d0d5d',1,'turbojpeg.h']]],
|
||||
['tjxopt_5fcopynone_100',['TJXOPT_COPYNONE',['../group___turbo_j_p_e_g.html#ga153b468cfb905d0de61706c838986fe8',1,'turbojpeg.h']]],
|
||||
['tjxopt_5fcrop_101',['TJXOPT_CROP',['../group___turbo_j_p_e_g.html#ga9c771a757fc1294add611906b89ab2d2',1,'turbojpeg.h']]],
|
||||
['tjxopt_5fgray_102',['TJXOPT_GRAY',['../group___turbo_j_p_e_g.html#ga3acee7b48ade1b99e5588736007c2589',1,'turbojpeg.h']]],
|
||||
['tjxopt_5fnooutput_103',['TJXOPT_NOOUTPUT',['../group___turbo_j_p_e_g.html#gafbf992bbf6e006705886333703ffab31',1,'turbojpeg.h']]],
|
||||
['tjxopt_5fperfect_104',['TJXOPT_PERFECT',['../group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00',1,'turbojpeg.h']]],
|
||||
['tjxopt_5fprogressive_105',['TJXOPT_PROGRESSIVE',['../group___turbo_j_p_e_g.html#gad2371c80674584ecc1a7d75e564cf026',1,'turbojpeg.h']]],
|
||||
['tjxopt_5ftrim_106',['TJXOPT_TRIM',['../group___turbo_j_p_e_g.html#ga319826b7eb1583c0595bbe7b95428709',1,'turbojpeg.h']]],
|
||||
['turbojpeg_107',['TurboJPEG',['../group___turbo_j_p_e_g.html',1,'']]]
|
||||
];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var searchData=
|
||||
[
|
||||
['w_107',['w',['../structtjregion.html#ab6eb73ceef584fc23c8c8097926dce42',1,'tjregion']]]
|
||||
['w_108',['w',['../structtjregion.html#ab6eb73ceef584fc23c8c8097926dce42',1,'tjregion']]]
|
||||
];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var searchData=
|
||||
[
|
||||
['x_108',['x',['../structtjregion.html#a4b6a37a93997091b26a75831fa291ad9',1,'tjregion']]]
|
||||
['x_109',['x',['../structtjregion.html#a4b6a37a93997091b26a75831fa291ad9',1,'tjregion']]]
|
||||
];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var searchData=
|
||||
[
|
||||
['y_109',['y',['../structtjregion.html#a7b3e0c24cfe87acc80e334cafdcf22c2',1,'tjregion']]]
|
||||
['y_110',['y',['../structtjregion.html#a7b3e0c24cfe87acc80e334cafdcf22c2',1,'tjregion']]]
|
||||
];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
var searchData=
|
||||
[
|
||||
['tjregion_110',['tjregion',['../structtjregion.html',1,'']]],
|
||||
['tjscalingfactor_111',['tjscalingfactor',['../structtjscalingfactor.html',1,'']]],
|
||||
['tjtransform_112',['tjtransform',['../structtjtransform.html',1,'']]]
|
||||
['tjregion_111',['tjregion',['../structtjregion.html',1,'']]],
|
||||
['tjscalingfactor_112',['tjscalingfactor',['../structtjscalingfactor.html',1,'']]],
|
||||
['tjtransform_113',['tjtransform',['../structtjtransform.html',1,'']]]
|
||||
];
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
var searchData=
|
||||
[
|
||||
['tjcs_161',['TJCS',['../group___turbo_j_p_e_g.html#ga4f83ad3368e0e29d1957be0efa7c3720',1,'turbojpeg.h']]],
|
||||
['tjerr_162',['TJERR',['../group___turbo_j_p_e_g.html#gafbc17cfa57d0d5d11fea35ac025950fe',1,'turbojpeg.h']]],
|
||||
['tjpf_163',['TJPF',['../group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a',1,'turbojpeg.h']]],
|
||||
['tjsamp_164',['TJSAMP',['../group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074',1,'turbojpeg.h']]],
|
||||
['tjxop_165',['TJXOP',['../group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866',1,'turbojpeg.h']]]
|
||||
['tjcs_162',['TJCS',['../group___turbo_j_p_e_g.html#ga4f83ad3368e0e29d1957be0efa7c3720',1,'turbojpeg.h']]],
|
||||
['tjerr_163',['TJERR',['../group___turbo_j_p_e_g.html#gafbc17cfa57d0d5d11fea35ac025950fe',1,'turbojpeg.h']]],
|
||||
['tjpf_164',['TJPF',['../group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a',1,'turbojpeg.h']]],
|
||||
['tjsamp_165',['TJSAMP',['../group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074',1,'turbojpeg.h']]],
|
||||
['tjxop_166',['TJXOP',['../group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866',1,'turbojpeg.h']]]
|
||||
];
|
||||
|
||||
@@ -1,37 +1,37 @@
|
||||
var searchData=
|
||||
[
|
||||
['tjcs_5fcmyk_166',['TJCS_CMYK',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a6c8b636152ac8195b869587db315ee53',1,'turbojpeg.h']]],
|
||||
['tjcs_5fgray_167',['TJCS_GRAY',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720ab3e7d6a87f695e45b81c1b5262b5a50a',1,'turbojpeg.h']]],
|
||||
['tjcs_5frgb_168',['TJCS_RGB',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a677cb7ccb85c4038ac41964a2e09e555',1,'turbojpeg.h']]],
|
||||
['tjcs_5fycbcr_169',['TJCS_YCbCr',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a7389b8f65bb387ffedce3efd0d78ec75',1,'turbojpeg.h']]],
|
||||
['tjcs_5fycck_170',['TJCS_YCCK',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a53839e0fe867b76b58d16b0a1a7c598e',1,'turbojpeg.h']]],
|
||||
['tjerr_5ffatal_171',['TJERR_FATAL',['../group___turbo_j_p_e_g.html#ggafbc17cfa57d0d5d11fea35ac025950feafc9cceeada13122b09e4851e3788039a',1,'turbojpeg.h']]],
|
||||
['tjerr_5fwarning_172',['TJERR_WARNING',['../group___turbo_j_p_e_g.html#ggafbc17cfa57d0d5d11fea35ac025950fea342dd6e2aedb47bb257b4e7568329b59',1,'turbojpeg.h']]],
|
||||
['tjpf_5fabgr_173',['TJPF_ABGR',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa1ba1a7f1631dbeaa49a0a85fc4a40081',1,'turbojpeg.h']]],
|
||||
['tjpf_5fargb_174',['TJPF_ARGB',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aae8f846ed9d9de99b6e1dfe448848765c',1,'turbojpeg.h']]],
|
||||
['tjpf_5fbgr_175',['TJPF_BGR',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aab10624437fb8ef495a0b153e65749839',1,'turbojpeg.h']]],
|
||||
['tjpf_5fbgra_176',['TJPF_BGRA',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aac037ff1845cf9b74bb81a3659c2b9fb4',1,'turbojpeg.h']]],
|
||||
['tjpf_5fbgrx_177',['TJPF_BGRX',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa2a1fbf569ca79897eae886e3376ca4c8',1,'turbojpeg.h']]],
|
||||
['tjpf_5fcmyk_178',['TJPF_CMYK',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7f5100ec44c91994e243f1cf55553f8b',1,'turbojpeg.h']]],
|
||||
['tjpf_5fgray_179',['TJPF_GRAY',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a',1,'turbojpeg.h']]],
|
||||
['tjpf_5frgb_180',['TJPF_RGB',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7ce93230bff449518ce387c17e6ed37c',1,'turbojpeg.h']]],
|
||||
['tjpf_5frgba_181',['TJPF_RGBA',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa88d2e88fab67f6503cf972e14851cc12',1,'turbojpeg.h']]],
|
||||
['tjpf_5frgbx_182',['TJPF_RGBX',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01',1,'turbojpeg.h']]],
|
||||
['tjpf_5funknown_183',['TJPF_UNKNOWN',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa84c1a6cead7952998e2fb895844a21ed',1,'turbojpeg.h']]],
|
||||
['tjpf_5fxbgr_184',['TJPF_XBGR',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af',1,'turbojpeg.h']]],
|
||||
['tjpf_5fxrgb_185',['TJPF_XRGB',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84',1,'turbojpeg.h']]],
|
||||
['tjsamp_5f411_186',['TJSAMP_411',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a28ec62575e5ea295c3fde3001dc628e2',1,'turbojpeg.h']]],
|
||||
['tjsamp_5f420_187',['TJSAMP_420',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a63085dbf683cfe39e513cdb6343e3737',1,'turbojpeg.h']]],
|
||||
['tjsamp_5f422_188',['TJSAMP_422',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a136130902cc578f11f32429b59368404',1,'turbojpeg.h']]],
|
||||
['tjsamp_5f440_189',['TJSAMP_440',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074accf740e6f3aa6ba20ba922cad13cb974',1,'turbojpeg.h']]],
|
||||
['tjsamp_5f444_190',['TJSAMP_444',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074afb8da4f44197837bdec0a4f593dacae3',1,'turbojpeg.h']]],
|
||||
['tjsamp_5fgray_191',['TJSAMP_GRAY',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a3f1c9504842ddc7a48d0f690754b6248',1,'turbojpeg.h']]],
|
||||
['tjxop_5fhflip_192',['TJXOP_HFLIP',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aa0df69776caa30f0fa28e26332d311ce',1,'turbojpeg.h']]],
|
||||
['tjxop_5fnone_193',['TJXOP_NONE',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aad88c0366cd3f7d0eac9d7a3fa1c2c27',1,'turbojpeg.h']]],
|
||||
['tjxop_5frot180_194',['TJXOP_ROT180',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a140952eb8dd0300accfcc22726d69692',1,'turbojpeg.h']]],
|
||||
['tjxop_5frot270_195',['TJXOP_ROT270',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a3064ee5dfb7f032df332818587567a08',1,'turbojpeg.h']]],
|
||||
['tjxop_5frot90_196',['TJXOP_ROT90',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a43b2bbb23bc4bd548422d43fbe9af128',1,'turbojpeg.h']]],
|
||||
['tjxop_5ftranspose_197',['TJXOP_TRANSPOSE',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a31060aed199f886afdd417f80499c32d',1,'turbojpeg.h']]],
|
||||
['tjxop_5ftransverse_198',['TJXOP_TRANSVERSE',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866af3b14d488aea6ece9e5b3df73a74d6a4',1,'turbojpeg.h']]],
|
||||
['tjxop_5fvflip_199',['TJXOP_VFLIP',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a324eddfbec53b7e691f61e56929d0d5d',1,'turbojpeg.h']]]
|
||||
['tjcs_5fcmyk_167',['TJCS_CMYK',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a6c8b636152ac8195b869587db315ee53',1,'turbojpeg.h']]],
|
||||
['tjcs_5fgray_168',['TJCS_GRAY',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720ab3e7d6a87f695e45b81c1b5262b5a50a',1,'turbojpeg.h']]],
|
||||
['tjcs_5frgb_169',['TJCS_RGB',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a677cb7ccb85c4038ac41964a2e09e555',1,'turbojpeg.h']]],
|
||||
['tjcs_5fycbcr_170',['TJCS_YCbCr',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a7389b8f65bb387ffedce3efd0d78ec75',1,'turbojpeg.h']]],
|
||||
['tjcs_5fycck_171',['TJCS_YCCK',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a53839e0fe867b76b58d16b0a1a7c598e',1,'turbojpeg.h']]],
|
||||
['tjerr_5ffatal_172',['TJERR_FATAL',['../group___turbo_j_p_e_g.html#ggafbc17cfa57d0d5d11fea35ac025950feafc9cceeada13122b09e4851e3788039a',1,'turbojpeg.h']]],
|
||||
['tjerr_5fwarning_173',['TJERR_WARNING',['../group___turbo_j_p_e_g.html#ggafbc17cfa57d0d5d11fea35ac025950fea342dd6e2aedb47bb257b4e7568329b59',1,'turbojpeg.h']]],
|
||||
['tjpf_5fabgr_174',['TJPF_ABGR',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa1ba1a7f1631dbeaa49a0a85fc4a40081',1,'turbojpeg.h']]],
|
||||
['tjpf_5fargb_175',['TJPF_ARGB',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aae8f846ed9d9de99b6e1dfe448848765c',1,'turbojpeg.h']]],
|
||||
['tjpf_5fbgr_176',['TJPF_BGR',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aab10624437fb8ef495a0b153e65749839',1,'turbojpeg.h']]],
|
||||
['tjpf_5fbgra_177',['TJPF_BGRA',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aac037ff1845cf9b74bb81a3659c2b9fb4',1,'turbojpeg.h']]],
|
||||
['tjpf_5fbgrx_178',['TJPF_BGRX',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa2a1fbf569ca79897eae886e3376ca4c8',1,'turbojpeg.h']]],
|
||||
['tjpf_5fcmyk_179',['TJPF_CMYK',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7f5100ec44c91994e243f1cf55553f8b',1,'turbojpeg.h']]],
|
||||
['tjpf_5fgray_180',['TJPF_GRAY',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a',1,'turbojpeg.h']]],
|
||||
['tjpf_5frgb_181',['TJPF_RGB',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7ce93230bff449518ce387c17e6ed37c',1,'turbojpeg.h']]],
|
||||
['tjpf_5frgba_182',['TJPF_RGBA',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa88d2e88fab67f6503cf972e14851cc12',1,'turbojpeg.h']]],
|
||||
['tjpf_5frgbx_183',['TJPF_RGBX',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01',1,'turbojpeg.h']]],
|
||||
['tjpf_5funknown_184',['TJPF_UNKNOWN',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa84c1a6cead7952998e2fb895844a21ed',1,'turbojpeg.h']]],
|
||||
['tjpf_5fxbgr_185',['TJPF_XBGR',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af',1,'turbojpeg.h']]],
|
||||
['tjpf_5fxrgb_186',['TJPF_XRGB',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84',1,'turbojpeg.h']]],
|
||||
['tjsamp_5f411_187',['TJSAMP_411',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a28ec62575e5ea295c3fde3001dc628e2',1,'turbojpeg.h']]],
|
||||
['tjsamp_5f420_188',['TJSAMP_420',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a63085dbf683cfe39e513cdb6343e3737',1,'turbojpeg.h']]],
|
||||
['tjsamp_5f422_189',['TJSAMP_422',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a136130902cc578f11f32429b59368404',1,'turbojpeg.h']]],
|
||||
['tjsamp_5f440_190',['TJSAMP_440',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074accf740e6f3aa6ba20ba922cad13cb974',1,'turbojpeg.h']]],
|
||||
['tjsamp_5f444_191',['TJSAMP_444',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074afb8da4f44197837bdec0a4f593dacae3',1,'turbojpeg.h']]],
|
||||
['tjsamp_5fgray_192',['TJSAMP_GRAY',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a3f1c9504842ddc7a48d0f690754b6248',1,'turbojpeg.h']]],
|
||||
['tjxop_5fhflip_193',['TJXOP_HFLIP',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aa0df69776caa30f0fa28e26332d311ce',1,'turbojpeg.h']]],
|
||||
['tjxop_5fnone_194',['TJXOP_NONE',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aad88c0366cd3f7d0eac9d7a3fa1c2c27',1,'turbojpeg.h']]],
|
||||
['tjxop_5frot180_195',['TJXOP_ROT180',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a140952eb8dd0300accfcc22726d69692',1,'turbojpeg.h']]],
|
||||
['tjxop_5frot270_196',['TJXOP_ROT270',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a3064ee5dfb7f032df332818587567a08',1,'turbojpeg.h']]],
|
||||
['tjxop_5frot90_197',['TJXOP_ROT90',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a43b2bbb23bc4bd548422d43fbe9af128',1,'turbojpeg.h']]],
|
||||
['tjxop_5ftranspose_198',['TJXOP_TRANSPOSE',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a31060aed199f886afdd417f80499c32d',1,'turbojpeg.h']]],
|
||||
['tjxop_5ftransverse_199',['TJXOP_TRANSVERSE',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866af3b14d488aea6ece9e5b3df73a74d6a4',1,'turbojpeg.h']]],
|
||||
['tjxop_5fvflip_200',['TJXOP_VFLIP',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a324eddfbec53b7e691f61e56929d0d5d',1,'turbojpeg.h']]]
|
||||
];
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
var searchData=
|
||||
[
|
||||
['tjalloc_113',['tjAlloc',['../group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83',1,'turbojpeg.h']]],
|
||||
['tjbufsize_114',['tjBufSize',['../group___turbo_j_p_e_g.html#ga67ac12fee79073242cb216e07c9f1f90',1,'turbojpeg.h']]],
|
||||
['tjbufsizeyuv2_115',['tjBufSizeYUV2',['../group___turbo_j_p_e_g.html#ga2be2b9969d4df9ecce9b05deed273194',1,'turbojpeg.h']]],
|
||||
['tjcompress2_116',['tjCompress2',['../group___turbo_j_p_e_g.html#gafbdce0112fd78fd38efae841443a9bcf',1,'turbojpeg.h']]],
|
||||
['tjcompressfromyuv_117',['tjCompressFromYUV',['../group___turbo_j_p_e_g.html#ga7622a459b79aa1007e005b58783f875b',1,'turbojpeg.h']]],
|
||||
['tjcompressfromyuvplanes_118',['tjCompressFromYUVPlanes',['../group___turbo_j_p_e_g.html#ga29ec5dfbd2d84b8724e951d6fa0d5d9e',1,'turbojpeg.h']]],
|
||||
['tjdecodeyuv_119',['tjDecodeYUV',['../group___turbo_j_p_e_g.html#ga70abbf38f77a26fd6da8813bef96f695',1,'turbojpeg.h']]],
|
||||
['tjdecodeyuvplanes_120',['tjDecodeYUVPlanes',['../group___turbo_j_p_e_g.html#ga10e837c07fa9d25770565b237d3898d9',1,'turbojpeg.h']]],
|
||||
['tjdecompress2_121',['tjDecompress2',['../group___turbo_j_p_e_g.html#gae9eccef8b682a48f43a9117c231ed013',1,'turbojpeg.h']]],
|
||||
['tjdecompressheader3_122',['tjDecompressHeader3',['../group___turbo_j_p_e_g.html#ga0595681096bba7199cc6f3533cb25f77',1,'turbojpeg.h']]],
|
||||
['tjdecompresstoyuv2_123',['tjDecompressToYUV2',['../group___turbo_j_p_e_g.html#ga04d1e839ff9a0860dd1475cff78d3364',1,'turbojpeg.h']]],
|
||||
['tjdecompresstoyuvplanes_124',['tjDecompressToYUVPlanes',['../group___turbo_j_p_e_g.html#gaa59f901a5258ada5bd0185ad59368540',1,'turbojpeg.h']]],
|
||||
['tjdestroy_125',['tjDestroy',['../group___turbo_j_p_e_g.html#ga75f355fa27225ba1a4ee392c852394d2',1,'turbojpeg.h']]],
|
||||
['tjencodeyuv3_126',['tjEncodeYUV3',['../group___turbo_j_p_e_g.html#gac519b922cdf446e97d0cdcba513636bf',1,'turbojpeg.h']]],
|
||||
['tjencodeyuvplanes_127',['tjEncodeYUVPlanes',['../group___turbo_j_p_e_g.html#gae2d04c72457fe7f4d60cf78ab1b1feb1',1,'turbojpeg.h']]],
|
||||
['tjfree_128',['tjFree',['../group___turbo_j_p_e_g.html#gaea863d2da0cdb609563aabdf9196514b',1,'turbojpeg.h']]],
|
||||
['tjgeterrorcode_129',['tjGetErrorCode',['../group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410',1,'turbojpeg.h']]],
|
||||
['tjgeterrorstr2_130',['tjGetErrorStr2',['../group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa',1,'turbojpeg.h']]],
|
||||
['tjgetscalingfactors_131',['tjGetScalingFactors',['../group___turbo_j_p_e_g.html#gac3854476006b10787bd128f7ede48057',1,'turbojpeg.h']]],
|
||||
['tjinitcompress_132',['tjInitCompress',['../group___turbo_j_p_e_g.html#ga9d63a05fc6d813f4aae06107041a37e8',1,'turbojpeg.h']]],
|
||||
['tjinitdecompress_133',['tjInitDecompress',['../group___turbo_j_p_e_g.html#ga52300eac3f3d9ef4bab303bc244f62d3',1,'turbojpeg.h']]],
|
||||
['tjinittransform_134',['tjInitTransform',['../group___turbo_j_p_e_g.html#ga928beff6ac248ceadf01089fc6b41957',1,'turbojpeg.h']]],
|
||||
['tjloadimage_135',['tjLoadImage',['../group___turbo_j_p_e_g.html#gaffbd83c375e79f5db4b5c5d8ad4466e7',1,'turbojpeg.h']]],
|
||||
['tjplaneheight_136',['tjPlaneHeight',['../group___turbo_j_p_e_g.html#ga1a209696c6a80748f20e134b3c64789f',1,'turbojpeg.h']]],
|
||||
['tjplanesizeyuv_137',['tjPlaneSizeYUV',['../group___turbo_j_p_e_g.html#gab4ab7b24f6e797d79abaaa670373961d',1,'turbojpeg.h']]],
|
||||
['tjplanewidth_138',['tjPlaneWidth',['../group___turbo_j_p_e_g.html#ga63fb66bb1e36c74008c4634360becbb1',1,'turbojpeg.h']]],
|
||||
['tjsaveimage_139',['tjSaveImage',['../group___turbo_j_p_e_g.html#ga6f445b22d8933ae4815b3370a538d879',1,'turbojpeg.h']]],
|
||||
['tjtransform_140',['tjTransform',['../group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25',1,'turbojpeg.h']]]
|
||||
['tjalloc_114',['tjAlloc',['../group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83',1,'turbojpeg.h']]],
|
||||
['tjbufsize_115',['tjBufSize',['../group___turbo_j_p_e_g.html#ga67ac12fee79073242cb216e07c9f1f90',1,'turbojpeg.h']]],
|
||||
['tjbufsizeyuv2_116',['tjBufSizeYUV2',['../group___turbo_j_p_e_g.html#ga5e5aac9e8bcf17049279301e2466474c',1,'turbojpeg.h']]],
|
||||
['tjcompress2_117',['tjCompress2',['../group___turbo_j_p_e_g.html#gafbdce0112fd78fd38efae841443a9bcf',1,'turbojpeg.h']]],
|
||||
['tjcompressfromyuv_118',['tjCompressFromYUV',['../group___turbo_j_p_e_g.html#gab40f5096a72fd7e5bda9d6b58fa37e2e',1,'turbojpeg.h']]],
|
||||
['tjcompressfromyuvplanes_119',['tjCompressFromYUVPlanes',['../group___turbo_j_p_e_g.html#ga29ec5dfbd2d84b8724e951d6fa0d5d9e',1,'turbojpeg.h']]],
|
||||
['tjdecodeyuv_120',['tjDecodeYUV',['../group___turbo_j_p_e_g.html#ga97c2cedc1e2bade15a84164c94e503c1',1,'turbojpeg.h']]],
|
||||
['tjdecodeyuvplanes_121',['tjDecodeYUVPlanes',['../group___turbo_j_p_e_g.html#ga10e837c07fa9d25770565b237d3898d9',1,'turbojpeg.h']]],
|
||||
['tjdecompress2_122',['tjDecompress2',['../group___turbo_j_p_e_g.html#gae9eccef8b682a48f43a9117c231ed013',1,'turbojpeg.h']]],
|
||||
['tjdecompressheader3_123',['tjDecompressHeader3',['../group___turbo_j_p_e_g.html#ga0595681096bba7199cc6f3533cb25f77',1,'turbojpeg.h']]],
|
||||
['tjdecompresstoyuv2_124',['tjDecompressToYUV2',['../group___turbo_j_p_e_g.html#ga5a3093e325598c17a9f004323af6fafa',1,'turbojpeg.h']]],
|
||||
['tjdecompresstoyuvplanes_125',['tjDecompressToYUVPlanes',['../group___turbo_j_p_e_g.html#gaa59f901a5258ada5bd0185ad59368540',1,'turbojpeg.h']]],
|
||||
['tjdestroy_126',['tjDestroy',['../group___turbo_j_p_e_g.html#ga75f355fa27225ba1a4ee392c852394d2',1,'turbojpeg.h']]],
|
||||
['tjencodeyuv3_127',['tjEncodeYUV3',['../group___turbo_j_p_e_g.html#ga5d619e0a02b71e05a8dffb764f6d7a64',1,'turbojpeg.h']]],
|
||||
['tjencodeyuvplanes_128',['tjEncodeYUVPlanes',['../group___turbo_j_p_e_g.html#gae2d04c72457fe7f4d60cf78ab1b1feb1',1,'turbojpeg.h']]],
|
||||
['tjfree_129',['tjFree',['../group___turbo_j_p_e_g.html#gaea863d2da0cdb609563aabdf9196514b',1,'turbojpeg.h']]],
|
||||
['tjgeterrorcode_130',['tjGetErrorCode',['../group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410',1,'turbojpeg.h']]],
|
||||
['tjgeterrorstr2_131',['tjGetErrorStr2',['../group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa',1,'turbojpeg.h']]],
|
||||
['tjgetscalingfactors_132',['tjGetScalingFactors',['../group___turbo_j_p_e_g.html#ga193d0977b3b9966d53a6c402e90899b1',1,'turbojpeg.h']]],
|
||||
['tjinitcompress_133',['tjInitCompress',['../group___turbo_j_p_e_g.html#ga9d63a05fc6d813f4aae06107041a37e8',1,'turbojpeg.h']]],
|
||||
['tjinitdecompress_134',['tjInitDecompress',['../group___turbo_j_p_e_g.html#ga52300eac3f3d9ef4bab303bc244f62d3',1,'turbojpeg.h']]],
|
||||
['tjinittransform_135',['tjInitTransform',['../group___turbo_j_p_e_g.html#ga928beff6ac248ceadf01089fc6b41957',1,'turbojpeg.h']]],
|
||||
['tjloadimage_136',['tjLoadImage',['../group___turbo_j_p_e_g.html#gaffbd83c375e79f5db4b5c5d8ad4466e7',1,'turbojpeg.h']]],
|
||||
['tjplaneheight_137',['tjPlaneHeight',['../group___turbo_j_p_e_g.html#ga1a209696c6a80748f20e134b3c64789f',1,'turbojpeg.h']]],
|
||||
['tjplanesizeyuv_138',['tjPlaneSizeYUV',['../group___turbo_j_p_e_g.html#gab4ab7b24f6e797d79abaaa670373961d',1,'turbojpeg.h']]],
|
||||
['tjplanewidth_139',['tjPlaneWidth',['../group___turbo_j_p_e_g.html#ga63fb66bb1e36c74008c4634360becbb1',1,'turbojpeg.h']]],
|
||||
['tjsaveimage_140',['tjSaveImage',['../group___turbo_j_p_e_g.html#ga6f445b22d8933ae4815b3370a538d879',1,'turbojpeg.h']]],
|
||||
['tjtransform_141',['tjTransform',['../group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25',1,'turbojpeg.h']]]
|
||||
];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var searchData=
|
||||
[
|
||||
['turbojpeg_200',['TurboJPEG',['../group___turbo_j_p_e_g.html',1,'']]]
|
||||
['turbojpeg_201',['TurboJPEG',['../group___turbo_j_p_e_g.html',1,'']]]
|
||||
];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
var searchData=
|
||||
[
|
||||
['tjhandle_159',['tjhandle',['../group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763',1,'turbojpeg.h']]],
|
||||
['tjtransform_160',['tjtransform',['../group___turbo_j_p_e_g.html#ga504805ec0161f1b505397ca0118bf8fd',1,'turbojpeg.h']]]
|
||||
['tjhandle_160',['tjhandle',['../group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763',1,'turbojpeg.h']]],
|
||||
['tjtransform_161',['tjtransform',['../group___turbo_j_p_e_g.html#ga504805ec0161f1b505397ca0118bf8fd',1,'turbojpeg.h']]]
|
||||
];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var searchData=
|
||||
[
|
||||
['customfilter_141',['customFilter',['../structtjtransform.html#afd7fc262df33f741e120ef4183202ef5',1,'tjtransform']]]
|
||||
['customfilter_142',['customFilter',['../structtjtransform.html#afd7fc262df33f741e120ef4183202ef5',1,'tjtransform']]]
|
||||
];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
var searchData=
|
||||
[
|
||||
['data_142',['data',['../structtjtransform.html#a688fe8f1a8ecc12a538d9e561cf338e3',1,'tjtransform']]],
|
||||
['denom_143',['denom',['../structtjscalingfactor.html#aefbcdf3e9e62274b2d312c695f133ce3',1,'tjscalingfactor']]]
|
||||
['data_143',['data',['../structtjtransform.html#a688fe8f1a8ecc12a538d9e561cf338e3',1,'tjtransform']]],
|
||||
['denom_144',['denom',['../structtjscalingfactor.html#aefbcdf3e9e62274b2d312c695f133ce3',1,'tjscalingfactor']]]
|
||||
];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var searchData=
|
||||
[
|
||||
['h_144',['h',['../structtjregion.html#aecefc45a26f4d8b60dd4d825c1710115',1,'tjregion']]]
|
||||
['h_145',['h',['../structtjregion.html#aecefc45a26f4d8b60dd4d825c1710115',1,'tjregion']]]
|
||||
];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var searchData=
|
||||
[
|
||||
['num_145',['num',['../structtjscalingfactor.html#a9b011e57f981ee23083e2c1aa5e640ec',1,'tjscalingfactor']]]
|
||||
['num_146',['num',['../structtjscalingfactor.html#a9b011e57f981ee23083e2c1aa5e640ec',1,'tjscalingfactor']]]
|
||||
];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
var searchData=
|
||||
[
|
||||
['op_146',['op',['../structtjtransform.html#a2525aab4ba6978a1c273f74fef50e498',1,'tjtransform']]],
|
||||
['options_147',['options',['../structtjtransform.html#ac0e74655baa4402209a21e1ae481c8f6',1,'tjtransform']]]
|
||||
['op_147',['op',['../structtjtransform.html#a2525aab4ba6978a1c273f74fef50e498',1,'tjtransform']]],
|
||||
['options_148',['options',['../structtjtransform.html#ac0e74655baa4402209a21e1ae481c8f6',1,'tjtransform']]]
|
||||
];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var searchData=
|
||||
[
|
||||
['r_148',['r',['../structtjtransform.html#ac324e5e442abec8a961e5bf219db12cf',1,'tjtransform']]]
|
||||
['r_149',['r',['../structtjtransform.html#ac324e5e442abec8a961e5bf219db12cf',1,'tjtransform']]]
|
||||
];
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
var searchData=
|
||||
[
|
||||
['tjalphaoffset_149',['tjAlphaOffset',['../group___turbo_j_p_e_g.html#ga5af0ab065feefd526debf1e20c43e837',1,'turbojpeg.h']]],
|
||||
['tjblueoffset_150',['tjBlueOffset',['../group___turbo_j_p_e_g.html#ga84e2e35d3f08025f976ec1ec53693dea',1,'turbojpeg.h']]],
|
||||
['tjgreenoffset_151',['tjGreenOffset',['../group___turbo_j_p_e_g.html#ga82d6e35da441112a411da41923c0ba2f',1,'turbojpeg.h']]],
|
||||
['tjmcuheight_152',['tjMCUHeight',['../group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf',1,'turbojpeg.h']]],
|
||||
['tjmcuwidth_153',['tjMCUWidth',['../group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c',1,'turbojpeg.h']]],
|
||||
['tjpixelsize_154',['tjPixelSize',['../group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c',1,'turbojpeg.h']]],
|
||||
['tjredoffset_155',['tjRedOffset',['../group___turbo_j_p_e_g.html#gadd9b446742ac8a3923f7992c7988fea8',1,'turbojpeg.h']]]
|
||||
['tjalphaoffset_150',['tjAlphaOffset',['../group___turbo_j_p_e_g.html#ga5af0ab065feefd526debf1e20c43e837',1,'turbojpeg.h']]],
|
||||
['tjblueoffset_151',['tjBlueOffset',['../group___turbo_j_p_e_g.html#ga84e2e35d3f08025f976ec1ec53693dea',1,'turbojpeg.h']]],
|
||||
['tjgreenoffset_152',['tjGreenOffset',['../group___turbo_j_p_e_g.html#ga82d6e35da441112a411da41923c0ba2f',1,'turbojpeg.h']]],
|
||||
['tjmcuheight_153',['tjMCUHeight',['../group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf',1,'turbojpeg.h']]],
|
||||
['tjmcuwidth_154',['tjMCUWidth',['../group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c',1,'turbojpeg.h']]],
|
||||
['tjpixelsize_155',['tjPixelSize',['../group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c',1,'turbojpeg.h']]],
|
||||
['tjredoffset_156',['tjRedOffset',['../group___turbo_j_p_e_g.html#gadd9b446742ac8a3923f7992c7988fea8',1,'turbojpeg.h']]]
|
||||
];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var searchData=
|
||||
[
|
||||
['w_156',['w',['../structtjregion.html#ab6eb73ceef584fc23c8c8097926dce42',1,'tjregion']]]
|
||||
['w_157',['w',['../structtjregion.html#ab6eb73ceef584fc23c8c8097926dce42',1,'tjregion']]]
|
||||
];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var searchData=
|
||||
[
|
||||
['x_157',['x',['../structtjregion.html#a4b6a37a93997091b26a75831fa291ad9',1,'tjregion']]]
|
||||
['x_158',['x',['../structtjregion.html#a4b6a37a93997091b26a75831fa291ad9',1,'tjregion']]]
|
||||
];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var searchData=
|
||||
[
|
||||
['y_158',['y',['../structtjregion.html#a7b3e0c24cfe87acc80e334cafdcf22c2',1,'tjregion']]]
|
||||
['y_159',['y',['../structtjregion.html#a7b3e0c24cfe87acc80e334cafdcf22c2',1,'tjregion']]]
|
||||
];
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">TurboJPEG
|
||||
 <span id="projectnumber">2.0</span>
|
||||
 <span id="projectnumber">2.1.4</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">TurboJPEG
|
||||
 <span id="projectnumber">2.0</span>
|
||||
 <span id="projectnumber">2.1.4</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">TurboJPEG
|
||||
 <span id="projectnumber">2.0</span>
|
||||
 <span id="projectnumber">2.1.4</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -84,7 +84,7 @@ Data Fields</h2></td></tr>
|
||||
<tr class="memdesc:a2525aab4ba6978a1c273f74fef50e498"><td class="mdescLeft"> </td><td class="mdescRight">One of the <a class="el" href="group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866">transform operations</a>. <a href="structtjtransform.html#a2525aab4ba6978a1c273f74fef50e498">More...</a><br /></td></tr>
|
||||
<tr class="separator:a2525aab4ba6978a1c273f74fef50e498"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ac0e74655baa4402209a21e1ae481c8f6"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="structtjtransform.html#ac0e74655baa4402209a21e1ae481c8f6">options</a></td></tr>
|
||||
<tr class="memdesc:ac0e74655baa4402209a21e1ae481c8f6"><td class="mdescLeft"> </td><td class="mdescRight">The bitwise OR of one of more of the <a class="el" href="group___turbo_j_p_e_g.html#ga9c771a757fc1294add611906b89ab2d2">transform options</a>. <a href="structtjtransform.html#ac0e74655baa4402209a21e1ae481c8f6">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:ac0e74655baa4402209a21e1ae481c8f6"><td class="mdescLeft"> </td><td class="mdescRight">The bitwise OR of one of more of the <a class="el" href="group___turbo_j_p_e_g.html#ga153b468cfb905d0de61706c838986fe8">transform options</a>. <a href="structtjtransform.html#ac0e74655baa4402209a21e1ae481c8f6">More...</a><br /></td></tr>
|
||||
<tr class="separator:ac0e74655baa4402209a21e1ae481c8f6"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a688fe8f1a8ecc12a538d9e561cf338e3"><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="structtjtransform.html#a688fe8f1a8ecc12a538d9e561cf338e3">data</a></td></tr>
|
||||
<tr class="memdesc:a688fe8f1a8ecc12a538d9e561cf338e3"><td class="mdescLeft"> </td><td class="mdescRight">Arbitrary data that can be accessed within the body of the callback function. <a href="structtjtransform.html#a688fe8f1a8ecc12a538d9e561cf338e3">More...</a><br /></td></tr>
|
||||
@@ -115,7 +115,7 @@ Data Fields</h2></td></tr>
|
||||
<tr><td class="paramname">coeffs</td><td>pointer to an array of transformed DCT coefficients. (NOTE: this pointer is not guaranteed to be valid once the callback returns, so applications wishing to hand off the DCT coefficients to another function or library should make a copy of them within the body of the callback.)</td></tr>
|
||||
<tr><td class="paramname">arrayRegion</td><td><a class="el" href="structtjregion.html" title="Cropping region.">tjregion</a> structure containing the width and height of the array pointed to by <code>coeffs</code> as well as its offset relative to the component plane. TurboJPEG implementations may choose to split each component plane into multiple DCT coefficient arrays and call the callback function once for each array.</td></tr>
|
||||
<tr><td class="paramname">planeRegion</td><td><a class="el" href="structtjregion.html" title="Cropping region.">tjregion</a> structure containing the width and height of the component plane to which <code>coeffs</code> belongs</td></tr>
|
||||
<tr><td class="paramname">componentID</td><td>ID number of the component plane to which <code>coeffs</code> belongs (Y, Cb, and Cr have, respectively, ID's of 0, 1, and 2 in typical JPEG images.)</td></tr>
|
||||
<tr><td class="paramname">componentID</td><td>ID number of the component plane to which <code>coeffs</code> belongs. (Y, Cb, and Cr have, respectively, ID's of 0, 1, and 2 in typical JPEG images.)</td></tr>
|
||||
<tr><td class="paramname">transformID</td><td>ID number of the transformed image to which <code>coeffs</code> belongs. This is the same as the index of the transform in the <code>transforms</code> array that was passed to <a class="el" href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a>.</td></tr>
|
||||
<tr><td class="paramname">transform</td><td>a pointer to a <a class="el" href="structtjtransform.html" title="Lossless transform.">tjtransform</a> structure that specifies the parameters and/or cropping region for this transform</td></tr>
|
||||
</table>
|
||||
@@ -169,7 +169,7 @@ Data Fields</h2></td></tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>The bitwise OR of one of more of the <a class="el" href="group___turbo_j_p_e_g.html#ga9c771a757fc1294add611906b89ab2d2">transform options</a>. </p>
|
||||
<p>The bitwise OR of one of more of the <a class="el" href="group___turbo_j_p_e_g.html#ga153b468cfb905d0de61706c838986fe8">transform options</a>. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
PROJECT_NAME = TurboJPEG
|
||||
PROJECT_NUMBER = 2.0
|
||||
PROJECT_NUMBER = 2.1.4
|
||||
OUTPUT_DIRECTORY = doc/
|
||||
USE_WINDOWS_ENCODING = NO
|
||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||
|
||||
@@ -311,7 +311,7 @@ read_JPEG_file(char *filename)
|
||||
* We call the libjpeg API from within a separate function, because modifying
|
||||
* the local non-volatile jpeg_decompress_struct instance below the setjmp()
|
||||
* return point and then accessing the instance after setjmp() returns would
|
||||
* return in undefined behavior that may potentially overwrite all or part of
|
||||
* result in undefined behavior that may potentially overwrite all or part of
|
||||
* the structure.
|
||||
*/
|
||||
|
||||
|
||||
55
fuzz/CMakeLists.txt
Normal file
55
fuzz/CMakeLists.txt
Normal file
@@ -0,0 +1,55 @@
|
||||
if(NOT ENABLE_STATIC)
|
||||
message(FATAL_ERROR "Fuzz targets require static libraries.")
|
||||
endif()
|
||||
if(NOT WITH_TURBOJPEG)
|
||||
message(FATAL_ERROR "Fuzz targets require the TurboJPEG API library.")
|
||||
endif()
|
||||
|
||||
set(FUZZ_BINDIR "" CACHE PATH
|
||||
"Directory into which fuzz targets should be installed")
|
||||
if(NOT FUZZ_BINDIR)
|
||||
message(FATAL_ERROR "FUZZ_BINDIR must be specified.")
|
||||
endif()
|
||||
message(STATUS "FUZZ_BINDIR = ${FUZZ_BINDIR}")
|
||||
|
||||
set(FUZZ_LIBRARY "" CACHE STRING
|
||||
"Path to fuzzer library or flags necessary to link with it")
|
||||
if(NOT FUZZ_LIBRARY)
|
||||
message(FATAL_ERROR "FUZZ_LIBRARY must be specified.")
|
||||
endif()
|
||||
message(STATUS "FUZZ_LIBRARY = ${FUZZ_LIBRARY}")
|
||||
|
||||
enable_language(CXX)
|
||||
|
||||
set(EFFECTIVE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE_UC}}")
|
||||
message(STATUS "C++ Compiler flags = ${EFFECTIVE_CXX_FLAGS}")
|
||||
|
||||
add_executable(cjpeg_fuzzer${FUZZER_SUFFIX} cjpeg.cc ../cdjpeg.c ../rdbmp.c
|
||||
../rdgif.c ../rdppm.c ../rdswitch.c ../rdtarga.c)
|
||||
set_property(TARGET cjpeg_fuzzer${FUZZER_SUFFIX} PROPERTY COMPILE_FLAGS
|
||||
${COMPILE_FLAGS})
|
||||
target_link_libraries(cjpeg_fuzzer${FUZZER_SUFFIX} ${FUZZ_LIBRARY} jpeg-static)
|
||||
install(TARGETS cjpeg_fuzzer${FUZZER_SUFFIX} RUNTIME DESTINATION
|
||||
${FUZZ_BINDIR})
|
||||
|
||||
macro(add_fuzz_target target source_file)
|
||||
add_executable(${target}_fuzzer${FUZZER_SUFFIX} ${source_file})
|
||||
target_link_libraries(${target}_fuzzer${FUZZER_SUFFIX} ${FUZZ_LIBRARY}
|
||||
turbojpeg-static)
|
||||
install(TARGETS ${target}_fuzzer${FUZZER_SUFFIX} RUNTIME DESTINATION
|
||||
${FUZZ_BINDIR})
|
||||
endmacro()
|
||||
|
||||
add_fuzz_target(compress compress.cc)
|
||||
|
||||
add_fuzz_target(compress_yuv compress_yuv.cc)
|
||||
|
||||
# NOTE: This target is named libjpeg_turbo_fuzzer instead of decompress_fuzzer
|
||||
# in order to preserve the corpora from Google's OSS-Fuzz target for
|
||||
# libjpeg-turbo, which this target replaces.
|
||||
add_fuzz_target(libjpeg_turbo decompress.cc)
|
||||
|
||||
add_fuzz_target(decompress_yuv decompress_yuv.cc)
|
||||
|
||||
add_fuzz_target(transform transform.cc)
|
||||
25
fuzz/build.sh
Normal file
25
fuzz/build.sh
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -u
|
||||
set -e
|
||||
|
||||
FUZZER_SUFFIX=
|
||||
if [ $# -ge 1 ]; then
|
||||
FUZZER_SUFFIX="$1"
|
||||
FUZZER_SUFFIX="`echo $1 | sed 's/\./_/g'`"
|
||||
fi
|
||||
|
||||
cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_STATIC=1 -DENABLE_SHARED=0 \
|
||||
-DCMAKE_C_FLAGS_RELWITHDEBINFO="-g -DNDEBUG" \
|
||||
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-g -DNDEBUG" -DCMAKE_INSTALL_PREFIX=$WORK \
|
||||
-DWITH_FUZZ=1 -DFUZZ_BINDIR=$OUT -DFUZZ_LIBRARY=$LIB_FUZZING_ENGINE \
|
||||
-DFUZZER_SUFFIX="$FUZZER_SUFFIX"
|
||||
make "-j$(nproc)" "--load-average=$(nproc)"
|
||||
make install
|
||||
|
||||
cp $SRC/compress_fuzzer_seed_corpus.zip $OUT/cjpeg_fuzzer${FUZZER_SUFFIX}_seed_corpus.zip
|
||||
cp $SRC/compress_fuzzer_seed_corpus.zip $OUT/compress_fuzzer${FUZZER_SUFFIX}_seed_corpus.zip
|
||||
cp $SRC/compress_fuzzer_seed_corpus.zip $OUT/compress_yuv_fuzzer${FUZZER_SUFFIX}_seed_corpus.zip
|
||||
cp $SRC/decompress_fuzzer_seed_corpus.zip $OUT/libjpeg_turbo_fuzzer${FUZZER_SUFFIX}_seed_corpus.zip
|
||||
cp $SRC/decompress_fuzzer_seed_corpus.zip $OUT/decompress_yuv_fuzzer${FUZZER_SUFFIX}_seed_corpus.zip
|
||||
cp $SRC/decompress_fuzzer_seed_corpus.zip $OUT/transform_fuzzer${FUZZER_SUFFIX}_seed_corpus.zip
|
||||
89
fuzz/cjpeg.cc
Normal file
89
fuzz/cjpeg.cc
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (C)2021 D. R. Commander. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of the libjpeg-turbo Project nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* This fuzz target wraps cjpeg in order to test esoteric compression options
|
||||
as well as the GIF and Targa readers. */
|
||||
|
||||
#define main cjpeg_main
|
||||
#define CJPEG_FUZZER
|
||||
extern "C" {
|
||||
#include "../cjpeg.c"
|
||||
}
|
||||
#undef main
|
||||
#undef CJPEG_FUZZER
|
||||
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
{
|
||||
char filename[FILENAME_MAX] = { 0 };
|
||||
char *argv1[] = {
|
||||
(char *)"cjpeg", (char *)"-dct", (char *)"float", (char *)"-memdst",
|
||||
(char *)"-optimize", (char *)"-quality", (char *)"100,99,98",
|
||||
(char *)"-restart", (char *)"2", (char *)"-sample", (char *)"4x1,2x2,1x2",
|
||||
(char *)"-targa", NULL
|
||||
};
|
||||
char *argv2[] = {
|
||||
(char *)"cjpeg", (char *)"-arithmetic", (char *)"-dct", (char *)"float",
|
||||
(char *)"-memdst", (char *)"-quality", (char *)"90,80,70", (char *)"-rgb",
|
||||
(char *)"-sample", (char *)"2x2", (char *)"-smooth", (char *)"50",
|
||||
(char *)"-targa", NULL
|
||||
};
|
||||
int fd = -1;
|
||||
#if defined(__has_feature) && __has_feature(memory_sanitizer)
|
||||
char env[18] = "JSIMD_FORCENONE=1";
|
||||
|
||||
/* The libjpeg-turbo SIMD extensions produce false positives with
|
||||
MemorySanitizer. */
|
||||
putenv(env);
|
||||
#endif
|
||||
|
||||
snprintf(filename, FILENAME_MAX, "/tmp/libjpeg-turbo_cjpeg_fuzz.XXXXXX");
|
||||
if ((fd = mkstemp(filename)) < 0 || write(fd, data, size) < 0)
|
||||
goto bailout;
|
||||
|
||||
argv1[12] = argv2[13] = filename;
|
||||
|
||||
cjpeg_main(13, argv1);
|
||||
cjpeg_main(14, argv2);
|
||||
|
||||
argv1[12] = argv2[13] = NULL;
|
||||
argv1[11] = argv2[12] = filename;
|
||||
|
||||
cjpeg_main(12, argv1);
|
||||
cjpeg_main(13, argv2);
|
||||
|
||||
bailout:
|
||||
if (fd >= 0) {
|
||||
close(fd);
|
||||
if (strlen(filename) > 0) unlink(filename);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
133
fuzz/compress.cc
Normal file
133
fuzz/compress.cc
Normal file
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright (C)2021 D. R. Commander. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of the libjpeg-turbo Project nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <turbojpeg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#define NUMTESTS 7
|
||||
/* Private flag that triggers different TurboJPEG API behavior when fuzzing */
|
||||
#define TJFLAG_FUZZING (1 << 30)
|
||||
|
||||
|
||||
struct test {
|
||||
enum TJPF pf;
|
||||
enum TJSAMP subsamp;
|
||||
int quality;
|
||||
};
|
||||
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
{
|
||||
tjhandle handle = NULL;
|
||||
unsigned char *srcBuf = NULL, *dstBuf = NULL;
|
||||
int width = 0, height = 0, fd = -1, i, ti;
|
||||
char filename[FILENAME_MAX] = { 0 };
|
||||
struct test tests[NUMTESTS] = {
|
||||
{ TJPF_RGB, TJSAMP_444, 100 },
|
||||
{ TJPF_BGR, TJSAMP_422, 90 },
|
||||
{ TJPF_RGBX, TJSAMP_420, 80 },
|
||||
{ TJPF_BGRA, TJSAMP_411, 70 },
|
||||
{ TJPF_XRGB, TJSAMP_GRAY, 60 },
|
||||
{ TJPF_GRAY, TJSAMP_GRAY, 50 },
|
||||
{ TJPF_CMYK, TJSAMP_440, 40 }
|
||||
};
|
||||
#if defined(__has_feature) && __has_feature(memory_sanitizer)
|
||||
char env[18] = "JSIMD_FORCENONE=1";
|
||||
|
||||
/* The libjpeg-turbo SIMD extensions produce false positives with
|
||||
MemorySanitizer. */
|
||||
putenv(env);
|
||||
#endif
|
||||
|
||||
snprintf(filename, FILENAME_MAX, "/tmp/libjpeg-turbo_compress_fuzz.XXXXXX");
|
||||
if ((fd = mkstemp(filename)) < 0 || write(fd, data, size) < 0)
|
||||
goto bailout;
|
||||
|
||||
if ((handle = tjInitCompress()) == NULL)
|
||||
goto bailout;
|
||||
|
||||
for (ti = 0; ti < NUMTESTS; ti++) {
|
||||
int flags = TJFLAG_FUZZING, sum = 0, pf = tests[ti].pf;
|
||||
unsigned long dstSize = 0, maxBufSize;
|
||||
|
||||
/* Test non-default compression options on specific iterations. */
|
||||
if (ti == 0)
|
||||
flags |= TJFLAG_BOTTOMUP | TJFLAG_ACCURATEDCT;
|
||||
else if (ti == 1)
|
||||
flags |= TJFLAG_PROGRESSIVE;
|
||||
if (ti != 2)
|
||||
flags |= TJFLAG_NOREALLOC;
|
||||
|
||||
/* tjLoadImage() refuses to load images larger than 1 Megapixel when
|
||||
FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION is defined (yes, that's a dirty
|
||||
hack), so we don't need to check the width and height here. */
|
||||
if ((srcBuf = tjLoadImage(filename, &width, 1, &height, &pf,
|
||||
flags)) == NULL)
|
||||
continue;
|
||||
|
||||
maxBufSize = tjBufSize(width, height, tests[ti].subsamp);
|
||||
if (flags & TJFLAG_NOREALLOC) {
|
||||
if ((dstBuf = (unsigned char *)malloc(maxBufSize)) == NULL)
|
||||
goto bailout;
|
||||
} else
|
||||
dstBuf = NULL;
|
||||
|
||||
if (tjCompress2(handle, srcBuf, width, 0, height, pf, &dstBuf, &dstSize,
|
||||
tests[ti].subsamp, tests[ti].quality, flags) == 0) {
|
||||
/* Touch all of the output pixels in order to catch uninitialized reads
|
||||
when using MemorySanitizer. */
|
||||
for (i = 0; i < dstSize; i++)
|
||||
sum += dstBuf[i];
|
||||
}
|
||||
|
||||
free(dstBuf);
|
||||
dstBuf = NULL;
|
||||
tjFree(srcBuf);
|
||||
srcBuf = NULL;
|
||||
|
||||
/* Prevent the code above from being optimized out. This test should never
|
||||
be true, but the compiler doesn't know that. */
|
||||
if (sum > 255 * maxBufSize)
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
bailout:
|
||||
free(dstBuf);
|
||||
tjFree(srcBuf);
|
||||
if (fd >= 0) {
|
||||
close(fd);
|
||||
if (strlen(filename) > 0) unlink(filename);
|
||||
}
|
||||
if (handle) tjDestroy(handle);
|
||||
return 0;
|
||||
}
|
||||
148
fuzz/compress_yuv.cc
Normal file
148
fuzz/compress_yuv.cc
Normal file
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
* Copyright (C)2021 D. R. Commander. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of the libjpeg-turbo Project nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <turbojpeg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#define NUMTESTS 6
|
||||
/* Private flag that triggers different TurboJPEG API behavior when fuzzing */
|
||||
#define TJFLAG_FUZZING (1 << 30)
|
||||
|
||||
|
||||
struct test {
|
||||
enum TJPF pf;
|
||||
enum TJSAMP subsamp;
|
||||
int quality;
|
||||
};
|
||||
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
{
|
||||
tjhandle handle = NULL;
|
||||
unsigned char *srcBuf = NULL, *dstBuf = NULL, *yuvBuf = NULL;
|
||||
int width = 0, height = 0, fd = -1, i, ti;
|
||||
char filename[FILENAME_MAX] = { 0 };
|
||||
struct test tests[NUMTESTS] = {
|
||||
{ TJPF_XBGR, TJSAMP_444, 100 },
|
||||
{ TJPF_XRGB, TJSAMP_422, 90 },
|
||||
{ TJPF_BGR, TJSAMP_420, 80 },
|
||||
{ TJPF_RGB, TJSAMP_411, 70 },
|
||||
{ TJPF_BGR, TJSAMP_GRAY, 60 },
|
||||
{ TJPF_GRAY, TJSAMP_GRAY, 50 }
|
||||
};
|
||||
char arithEnv[16] = "TJ_ARITHMETIC=0";
|
||||
char restartEnv[13] = "TJ_RESTART=0";
|
||||
#if defined(__has_feature) && __has_feature(memory_sanitizer)
|
||||
char simdEnv[18] = "JSIMD_FORCENONE=1";
|
||||
|
||||
/* The libjpeg-turbo SIMD extensions produce false positives with
|
||||
MemorySanitizer. */
|
||||
putenv(simdEnv);
|
||||
#endif
|
||||
putenv(arithEnv);
|
||||
putenv(restartEnv);
|
||||
|
||||
snprintf(filename, FILENAME_MAX, "/tmp/libjpeg-turbo_compress_yuv_fuzz.XXXXXX");
|
||||
if ((fd = mkstemp(filename)) < 0 || write(fd, data, size) < 0)
|
||||
goto bailout;
|
||||
|
||||
if ((handle = tjInitCompress()) == NULL)
|
||||
goto bailout;
|
||||
|
||||
for (ti = 0; ti < NUMTESTS; ti++) {
|
||||
int flags = TJFLAG_FUZZING | TJFLAG_NOREALLOC, sum = 0, pf = tests[ti].pf;
|
||||
unsigned long dstSize = 0, maxBufSize;
|
||||
|
||||
/* Test non-default compression options on specific iterations. */
|
||||
if (ti == 0)
|
||||
flags |= TJFLAG_BOTTOMUP | TJFLAG_ACCURATEDCT;
|
||||
else if (ti == 1 || ti == 3)
|
||||
flags |= TJFLAG_PROGRESSIVE;
|
||||
if (ti == 2 || ti == 3)
|
||||
arithEnv[14] = '1';
|
||||
else
|
||||
arithEnv[14] = '0';
|
||||
if (ti == 1 || ti == 2)
|
||||
restartEnv[11] = '2';
|
||||
else
|
||||
restartEnv[11] = '0';
|
||||
|
||||
/* tjLoadImage() refuses to load images larger than 1 Megapixel when
|
||||
FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION is defined (yes, that's a dirty
|
||||
hack), so we don't need to check the width and height here. */
|
||||
if ((srcBuf = tjLoadImage(filename, &width, 1, &height, &pf,
|
||||
flags)) == NULL)
|
||||
continue;
|
||||
|
||||
maxBufSize = tjBufSize(width, height, tests[ti].subsamp);
|
||||
if ((dstBuf = (unsigned char *)malloc(maxBufSize)) == NULL)
|
||||
goto bailout;
|
||||
if ((yuvBuf =
|
||||
(unsigned char *)malloc(tjBufSizeYUV2(width, 1, height,
|
||||
tests[ti].subsamp))) == NULL)
|
||||
goto bailout;
|
||||
|
||||
if (tjEncodeYUV3(handle, srcBuf, width, 0, height, pf, yuvBuf, 1,
|
||||
tests[ti].subsamp, flags) == 0 &&
|
||||
tjCompressFromYUV(handle, yuvBuf, width, 1, height, tests[ti].subsamp,
|
||||
&dstBuf, &dstSize, tests[ti].quality, flags) == 0) {
|
||||
/* Touch all of the output pixels in order to catch uninitialized reads
|
||||
when using MemorySanitizer. */
|
||||
for (i = 0; i < dstSize; i++)
|
||||
sum += dstBuf[i];
|
||||
}
|
||||
|
||||
free(dstBuf);
|
||||
dstBuf = NULL;
|
||||
free(yuvBuf);
|
||||
yuvBuf = NULL;
|
||||
tjFree(srcBuf);
|
||||
srcBuf = NULL;
|
||||
|
||||
/* Prevent the code above from being optimized out. This test should never
|
||||
be true, but the compiler doesn't know that. */
|
||||
if (sum > 255 * maxBufSize)
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
bailout:
|
||||
free(dstBuf);
|
||||
free(yuvBuf);
|
||||
tjFree(srcBuf);
|
||||
if (fd >= 0) {
|
||||
close(fd);
|
||||
if (strlen(filename) > 0) unlink(filename);
|
||||
}
|
||||
if (handle) tjDestroy(handle);
|
||||
return 0;
|
||||
}
|
||||
107
fuzz/decompress.cc
Normal file
107
fuzz/decompress.cc
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Copyright (C)2021, 2023 D. R. Commander. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of the libjpeg-turbo Project nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <turbojpeg.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#define NUMPF 4
|
||||
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
{
|
||||
tjhandle handle = NULL;
|
||||
unsigned char *dstBuf = NULL;
|
||||
int width = 0, height = 0, jpegSubsamp, jpegColorspace, pfi;
|
||||
/* TJPF_RGB-TJPF_BGR share the same code paths, as do TJPF_RGBX-TJPF_XRGB and
|
||||
TJPF_RGBA-TJPF_ARGB. Thus, the pixel formats below should be the minimum
|
||||
necessary to achieve full coverage. */
|
||||
enum TJPF pixelFormats[NUMPF] =
|
||||
{ TJPF_RGB, TJPF_BGRX, TJPF_GRAY, TJPF_CMYK };
|
||||
#if defined(__has_feature) && __has_feature(memory_sanitizer)
|
||||
char env[18] = "JSIMD_FORCENONE=1";
|
||||
|
||||
/* The libjpeg-turbo SIMD extensions produce false positives with
|
||||
MemorySanitizer. */
|
||||
putenv(env);
|
||||
#endif
|
||||
|
||||
if ((handle = tjInitDecompress()) == NULL)
|
||||
goto bailout;
|
||||
|
||||
/* We ignore the return value of tjDecompressHeader3(), because some JPEG
|
||||
images may have unusual subsampling configurations that the TurboJPEG API
|
||||
cannot identify but can still decompress. */
|
||||
tjDecompressHeader3(handle, data, size, &width, &height, &jpegSubsamp,
|
||||
&jpegColorspace);
|
||||
|
||||
/* Ignore 0-pixel images and images larger than 1 Megapixel, as Google's
|
||||
OSS-Fuzz target for libjpeg-turbo did. Casting width to (uint64_t)
|
||||
prevents integer overflow if width * height > INT_MAX. */
|
||||
if (width < 1 || height < 1 || (uint64_t)width * height > 1048576)
|
||||
goto bailout;
|
||||
|
||||
for (pfi = 0; pfi < NUMPF; pfi++) {
|
||||
int pf = pixelFormats[pfi], flags = TJFLAG_LIMITSCANS, i, sum = 0;
|
||||
int w = width, h = height;
|
||||
|
||||
/* Test non-default decompression options on the first iteration. */
|
||||
if (pfi == 0)
|
||||
flags |= TJFLAG_BOTTOMUP | TJFLAG_FASTUPSAMPLE | TJFLAG_FASTDCT;
|
||||
/* Test IDCT scaling on the second iteration. */
|
||||
else if (pfi == 1) {
|
||||
w = (width + 1) / 2;
|
||||
h = (height + 1) / 2;
|
||||
}
|
||||
|
||||
if ((dstBuf = (unsigned char *)malloc(w * h * tjPixelSize[pf])) == NULL)
|
||||
goto bailout;
|
||||
|
||||
if (tjDecompress2(handle, data, size, dstBuf, w, 0, h, pf, flags) == 0) {
|
||||
/* Touch all of the output pixels in order to catch uninitialized reads
|
||||
when using MemorySanitizer. */
|
||||
for (i = 0; i < w * h * tjPixelSize[pf]; i++)
|
||||
sum += dstBuf[i];
|
||||
} else
|
||||
goto bailout;
|
||||
|
||||
free(dstBuf);
|
||||
dstBuf = NULL;
|
||||
|
||||
/* Prevent the code above from being optimized out. This test should never
|
||||
be true, but the compiler doesn't know that. */
|
||||
if (sum > 255 * 1048576 * tjPixelSize[pf])
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
bailout:
|
||||
free(dstBuf);
|
||||
if (handle) tjDestroy(handle);
|
||||
return 0;
|
||||
}
|
||||
112
fuzz/decompress_yuv.cc
Normal file
112
fuzz/decompress_yuv.cc
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright (C)2021, 2023 D. R. Commander. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of the libjpeg-turbo Project nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <turbojpeg.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#define NUMPF 3
|
||||
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
{
|
||||
tjhandle handle = NULL;
|
||||
unsigned char *dstBuf = NULL, *yuvBuf = NULL;
|
||||
int width = 0, height = 0, jpegSubsamp, jpegColorspace, pfi;
|
||||
/* TJPF_RGB-TJPF_BGR share the same code paths, as do TJPF_RGBX-TJPF_XRGB and
|
||||
TJPF_RGBA-TJPF_ARGB. Thus, the pixel formats below should be the minimum
|
||||
necessary to achieve full coverage. */
|
||||
enum TJPF pixelFormats[NUMPF] =
|
||||
{ TJPF_BGR, TJPF_XRGB, TJPF_GRAY };
|
||||
#if defined(__has_feature) && __has_feature(memory_sanitizer)
|
||||
char env[18] = "JSIMD_FORCENONE=1";
|
||||
|
||||
/* The libjpeg-turbo SIMD extensions produce false positives with
|
||||
MemorySanitizer. */
|
||||
putenv(env);
|
||||
#endif
|
||||
|
||||
if ((handle = tjInitDecompress()) == NULL)
|
||||
goto bailout;
|
||||
|
||||
if (tjDecompressHeader3(handle, data, size, &width, &height, &jpegSubsamp,
|
||||
&jpegColorspace) < 0)
|
||||
goto bailout;
|
||||
|
||||
/* Ignore 0-pixel images and images larger than 1 Megapixel. Casting width
|
||||
to (uint64_t) prevents integer overflow if width * height > INT_MAX. */
|
||||
if (width < 1 || height < 1 || (uint64_t)width * height > 1048576)
|
||||
goto bailout;
|
||||
|
||||
for (pfi = 0; pfi < NUMPF; pfi++) {
|
||||
int pf = pixelFormats[pfi], flags = TJFLAG_LIMITSCANS, i, sum = 0;
|
||||
int w = width, h = height;
|
||||
|
||||
/* Test non-default decompression options on the first iteration. */
|
||||
if (pfi == 0)
|
||||
flags |= TJFLAG_BOTTOMUP | TJFLAG_FASTUPSAMPLE | TJFLAG_FASTDCT;
|
||||
/* Test IDCT scaling on the second iteration. */
|
||||
else if (pfi == 1) {
|
||||
w = (width + 3) / 4;
|
||||
h = (height + 3) / 4;
|
||||
}
|
||||
|
||||
if ((dstBuf = (unsigned char *)malloc(w * h * tjPixelSize[pf])) == NULL)
|
||||
goto bailout;
|
||||
if ((yuvBuf =
|
||||
(unsigned char *)malloc(tjBufSizeYUV2(w, 1, h, jpegSubsamp))) == NULL)
|
||||
goto bailout;
|
||||
|
||||
if (tjDecompressToYUV2(handle, data, size, yuvBuf, w, 1, h, flags) == 0 &&
|
||||
tjDecodeYUV(handle, yuvBuf, 1, jpegSubsamp, dstBuf, w, 0, h, pf,
|
||||
flags) == 0) {
|
||||
/* Touch all of the output pixels in order to catch uninitialized reads
|
||||
when using MemorySanitizer. */
|
||||
for (i = 0; i < w * h * tjPixelSize[pf]; i++)
|
||||
sum += dstBuf[i];
|
||||
} else
|
||||
goto bailout;
|
||||
|
||||
free(dstBuf);
|
||||
dstBuf = NULL;
|
||||
free(yuvBuf);
|
||||
yuvBuf = NULL;
|
||||
|
||||
/* Prevent the code above from being optimized out. This test should never
|
||||
be true, but the compiler doesn't know that. */
|
||||
if (sum > 255 * 1048576 * tjPixelSize[pf])
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
bailout:
|
||||
free(dstBuf);
|
||||
free(yuvBuf);
|
||||
if (handle) tjDestroy(handle);
|
||||
return 0;
|
||||
}
|
||||
135
fuzz/transform.cc
Normal file
135
fuzz/transform.cc
Normal file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* Copyright (C)2021 D. R. Commander. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of the libjpeg-turbo Project nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <turbojpeg.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#define NUMXFORMS 3
|
||||
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
{
|
||||
tjhandle handle = NULL;
|
||||
unsigned char *dstBufs[NUMXFORMS] = { NULL, NULL, NULL };
|
||||
unsigned long dstSizes[NUMXFORMS] = { 0, 0, 0 }, maxBufSize;
|
||||
int width = 0, height = 0, jpegSubsamp, jpegColorspace, i, t;
|
||||
tjtransform transforms[NUMXFORMS];
|
||||
#if defined(__has_feature) && __has_feature(memory_sanitizer)
|
||||
char env[18] = "JSIMD_FORCENONE=1";
|
||||
|
||||
/* The libjpeg-turbo SIMD extensions produce false positives with
|
||||
MemorySanitizer. */
|
||||
putenv(env);
|
||||
#endif
|
||||
|
||||
if ((handle = tjInitTransform()) == NULL)
|
||||
goto bailout;
|
||||
|
||||
/* We ignore the return value of tjDecompressHeader3(), because some JPEG
|
||||
images may have unusual subsampling configurations that the TurboJPEG API
|
||||
cannot identify but can still transform. */
|
||||
tjDecompressHeader3(handle, data, size, &width, &height, &jpegSubsamp,
|
||||
&jpegColorspace);
|
||||
|
||||
/* Ignore 0-pixel images and images larger than 1 Megapixel. Casting width
|
||||
to (uint64_t) prevents integer overflow if width * height > INT_MAX. */
|
||||
if (width < 1 || height < 1 || (uint64_t)width * height > 1048576)
|
||||
goto bailout;
|
||||
|
||||
if (jpegSubsamp < 0 || jpegSubsamp >= TJ_NUMSAMP)
|
||||
jpegSubsamp = TJSAMP_444;
|
||||
|
||||
for (t = 0; t < NUMXFORMS; t++)
|
||||
memset(&transforms[t], 0, sizeof(tjtransform));
|
||||
|
||||
transforms[0].op = TJXOP_NONE;
|
||||
transforms[0].options = TJXOPT_PROGRESSIVE | TJXOPT_COPYNONE;
|
||||
dstBufs[0] = (unsigned char *)malloc(tjBufSize(width, height, jpegSubsamp));
|
||||
if (!dstBufs[0])
|
||||
goto bailout;
|
||||
|
||||
transforms[1].r.w = (width + 1) / 2;
|
||||
transforms[1].r.h = (height + 1) / 2;
|
||||
transforms[1].op = TJXOP_TRANSPOSE;
|
||||
transforms[1].options = TJXOPT_GRAY | TJXOPT_CROP | TJXOPT_COPYNONE;
|
||||
dstBufs[1] =
|
||||
(unsigned char *)malloc(tjBufSize((width + 1) / 2, (height + 1) / 2,
|
||||
TJSAMP_GRAY));
|
||||
if (!dstBufs[1])
|
||||
goto bailout;
|
||||
|
||||
transforms[2].op = TJXOP_ROT90;
|
||||
transforms[2].options = TJXOPT_TRIM | TJXOPT_COPYNONE;
|
||||
dstBufs[2] = (unsigned char *)malloc(tjBufSize(height, width, jpegSubsamp));
|
||||
if (!dstBufs[2])
|
||||
goto bailout;
|
||||
|
||||
maxBufSize = tjBufSize(width, height, jpegSubsamp);
|
||||
|
||||
if (tjTransform(handle, data, size, NUMXFORMS, dstBufs, dstSizes, transforms,
|
||||
TJFLAG_LIMITSCANS | TJFLAG_NOREALLOC) == 0) {
|
||||
/* Touch all of the output pixels in order to catch uninitialized reads
|
||||
when using MemorySanitizer. */
|
||||
for (t = 0; t < NUMXFORMS; t++) {
|
||||
int sum = 0;
|
||||
|
||||
for (i = 0; i < dstSizes[t]; i++)
|
||||
sum += dstBufs[t][i];
|
||||
|
||||
/* Prevent the code above from being optimized out. This test should
|
||||
never be true, but the compiler doesn't know that. */
|
||||
if (sum > 255 * maxBufSize)
|
||||
goto bailout;
|
||||
}
|
||||
}
|
||||
|
||||
transforms[0].options &= ~TJXOPT_COPYNONE;
|
||||
free(dstBufs[0]);
|
||||
dstBufs[0] = NULL;
|
||||
dstSizes[0] = 0;
|
||||
|
||||
if (tjTransform(handle, data, size, 1, dstBufs, dstSizes, transforms,
|
||||
TJFLAG_LIMITSCANS) == 0) {
|
||||
int sum = 0;
|
||||
|
||||
for (i = 0; i < dstSizes[0]; i++)
|
||||
sum += dstBufs[0][i];
|
||||
|
||||
if (sum > 255 * maxBufSize)
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
bailout:
|
||||
for (t = 0; t < NUMXFORMS; t++)
|
||||
free(dstBufs[t]);
|
||||
if (handle) tjDestroy(handle);
|
||||
return 0;
|
||||
}
|
||||
@@ -38,7 +38,7 @@ Installation Directory
|
||||
----------------------
|
||||
|
||||
The TurboJPEG Java Wrapper will look for the TurboJPEG JNI library
|
||||
(libturbojpeg.so, libturbojpeg.jnilib, or turbojpeg.dll) in the system library
|
||||
(libturbojpeg.so, libturbojpeg.dylib, or turbojpeg.dll) in the system library
|
||||
paths or in any paths specified in LD_LIBRARY_PATH (Un*x), DYLD_LIBRARY_PATH
|
||||
(Mac), or PATH (Windows.) Failing this, on Un*x and Mac systems, the wrapper
|
||||
will look for the JNI library under the library directory configured when
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C)2009-2014, 2016-2019 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2009-2014, 2016-2019, 2021, 2023 D. R. Commander.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -36,7 +37,7 @@ final class TJBench {
|
||||
|
||||
private TJBench() {}
|
||||
|
||||
private static int flags = 0, quiet = 0, pf = TJ.PF_BGR, yuvPad = 1;
|
||||
private static int flags = 0, quiet = 0, pf = TJ.PF_BGR, yuvAlign = 1;
|
||||
private static boolean compOnly, decompOnly, doTile, doYUV, write = true;
|
||||
|
||||
static final String[] PIXFORMATSTR = {
|
||||
@@ -191,7 +192,7 @@ final class TJBench {
|
||||
int width = doTile ? tilew : scaledw;
|
||||
int height = doTile ? tileh : scaledh;
|
||||
|
||||
yuvImage = new YUVImage(width, yuvPad, height, subsamp);
|
||||
yuvImage = new YUVImage(width, yuvAlign, height, subsamp);
|
||||
Arrays.fill(yuvImage.getBuf(), (byte)127);
|
||||
}
|
||||
|
||||
@@ -211,7 +212,8 @@ final class TJBench {
|
||||
tjd.setSourceImage(jpegBuf[tile], jpegSize[tile]);
|
||||
} catch (TJException e) { handleTJException(e); }
|
||||
if (doYUV) {
|
||||
yuvImage.setBuf(yuvImage.getBuf(), width, yuvPad, height, subsamp);
|
||||
yuvImage.setBuf(yuvImage.getBuf(), width, yuvAlign, height,
|
||||
subsamp);
|
||||
try {
|
||||
tjd.decompressToYUV(yuvImage, flags);
|
||||
} catch (TJException e) { handleTJException(e); }
|
||||
@@ -371,7 +373,7 @@ final class TJBench {
|
||||
tjc.setSubsamp(subsamp);
|
||||
|
||||
if (doYUV) {
|
||||
yuvImage = new YUVImage(tilew, yuvPad, tileh, subsamp);
|
||||
yuvImage = new YUVImage(tilew, yuvAlign, tileh, subsamp);
|
||||
Arrays.fill(yuvImage.getBuf(), (byte)127);
|
||||
}
|
||||
|
||||
@@ -392,7 +394,7 @@ final class TJBench {
|
||||
if (doYUV) {
|
||||
double startEncode = getTime();
|
||||
|
||||
yuvImage.setBuf(yuvImage.getBuf(), width, yuvPad, height,
|
||||
yuvImage.setBuf(yuvImage.getBuf(), width, yuvAlign, height,
|
||||
subsamp);
|
||||
tjc.encodeYUV(yuvImage, flags);
|
||||
if (iter >= 0)
|
||||
@@ -523,7 +525,7 @@ final class TJBench {
|
||||
|
||||
if (quiet == 1) {
|
||||
System.out.println("All performance values in Mpixels/sec\n");
|
||||
System.out.format("Bitmap JPEG JPEG %s %s Xform Comp Decomp ",
|
||||
System.out.format("Pixel JPEG JPEG %s %s Xform Comp Decomp ",
|
||||
(doTile ? "Tile " : "Image"),
|
||||
(doTile ? "Tile " : "Image"));
|
||||
if (doYUV)
|
||||
@@ -648,7 +650,7 @@ final class TJBench {
|
||||
sigFig((double)(w * h * ps) /
|
||||
(double)totalJpegSize, 4),
|
||||
quiet == 2 ? "\n" : " ");
|
||||
} else if (quiet == 0) {
|
||||
} else {
|
||||
System.out.format("Transform --> Frame rate: %f fps\n",
|
||||
1.0 / elapsed);
|
||||
System.out.format(" Output image size: %d bytes\n",
|
||||
@@ -694,34 +696,30 @@ final class TJBench {
|
||||
String className = new TJBench().getClass().getName();
|
||||
|
||||
System.out.println("\nUSAGE: java " + className);
|
||||
System.out.println(" <Inputfile (BMP)> <Quality> [options]\n");
|
||||
System.out.println(" <Inputimage (BMP)> <Quality> [options]\n");
|
||||
System.out.println(" java " + className);
|
||||
System.out.println(" <Inputfile (JPG)> [options]\n");
|
||||
System.out.println(" <Inputimage (JPG)> [options]\n");
|
||||
System.out.println("Options:\n");
|
||||
System.out.println("-alloc = Dynamically allocate JPEG image buffers");
|
||||
System.out.println("-bottomup = Test bottom-up compression/decompression");
|
||||
System.out.println("-tile = Test performance of the codec when the image is encoded as separate");
|
||||
System.out.println(" tiles of varying sizes.");
|
||||
System.out.println("-bottomup = Use bottom-up row order for packed-pixel source/destination buffers");
|
||||
System.out.println("-tile = Compress/transform the input image into separate JPEG tiles of varying");
|
||||
System.out.println(" sizes (useful for measuring JPEG overhead)");
|
||||
System.out.println("-rgb, -bgr, -rgbx, -bgrx, -xbgr, -xrgb =");
|
||||
System.out.println(" Test the specified color conversion path in the codec (default = BGR)");
|
||||
System.out.println("-fastupsample = Use the fastest chrominance upsampling algorithm available in");
|
||||
System.out.println(" the underlying codec");
|
||||
System.out.println("-fastdct = Use the fastest DCT/IDCT algorithms available in the underlying");
|
||||
System.out.println(" codec");
|
||||
System.out.println("-accuratedct = Use the most accurate DCT/IDCT algorithms available in the");
|
||||
System.out.println(" underlying codec");
|
||||
System.out.println(" Use the specified pixel format for packed-pixel source/destination buffers");
|
||||
System.out.println(" [default = BGR]");
|
||||
System.out.println("-fastupsample = Use the fastest chrominance upsampling algorithm available");
|
||||
System.out.println("-fastdct = Use the fastest DCT/IDCT algorithm available");
|
||||
System.out.println("-accuratedct = Use the most accurate DCT/IDCT algorithm available");
|
||||
System.out.println("-progressive = Use progressive entropy coding in JPEG images generated by");
|
||||
System.out.println(" compression and transform operations.");
|
||||
System.out.println("-subsamp <s> = When testing JPEG compression, this option specifies the level");
|
||||
System.out.println(" of chrominance subsampling to use (<s> = 444, 422, 440, 420, 411, or");
|
||||
System.out.println(" GRAY). The default is to test Grayscale, 4:2:0, 4:2:2, and 4:4:4 in");
|
||||
System.out.println(" sequence.");
|
||||
System.out.println(" compression and transform operations");
|
||||
System.out.println("-subsamp <s> = When compressing, use the specified level of chrominance");
|
||||
System.out.println(" subsampling (<s> = 444, 422, 440, 420, 411, or GRAY) [default = test");
|
||||
System.out.println(" Grayscale, 4:2:0, 4:2:2, and 4:4:4 in sequence]");
|
||||
System.out.println("-quiet = Output results in tabular rather than verbose format");
|
||||
System.out.println("-yuv = Test YUV encoding/decoding functions");
|
||||
System.out.println("-yuvpad <p> = If testing YUV encoding/decoding, this specifies the number of");
|
||||
System.out.println(" bytes to which each row of each plane in the intermediate YUV image is");
|
||||
System.out.println(" padded (default = 1)");
|
||||
System.out.println("-scale M/N = Scale down the width/height of the decompressed JPEG image by a");
|
||||
System.out.println("-yuv = Compress from/decompress to intermediate planar YUV images");
|
||||
System.out.println("-yuvpad <p> = The number of bytes by which each row in each plane of an");
|
||||
System.out.println(" intermediate YUV image is evenly divisible (must be a power of 2)");
|
||||
System.out.println(" [default = 1]");
|
||||
System.out.println("-scale M/N = When decompressing, scale the width/height of the JPEG image by a");
|
||||
System.out.print(" factor of M/N (M/N = ");
|
||||
for (i = 0; i < nsf; i++) {
|
||||
System.out.format("%d/%d", scalingFactors[i].getNum(),
|
||||
@@ -739,22 +737,24 @@ final class TJBench {
|
||||
}
|
||||
System.out.println(")");
|
||||
System.out.println("-hflip, -vflip, -transpose, -transverse, -rot90, -rot180, -rot270 =");
|
||||
System.out.println(" Perform the corresponding lossless transform prior to");
|
||||
System.out.println(" decompression (these options are mutually exclusive)");
|
||||
System.out.println("-grayscale = Perform lossless grayscale conversion prior to decompression");
|
||||
System.out.println(" test (can be combined with the other transforms above)");
|
||||
System.out.println(" Perform the specified lossless transform operation on the input image");
|
||||
System.out.println(" prior to decompression (these operations are mutually exclusive)");
|
||||
System.out.println("-grayscale = Transform the input image into a grayscale JPEG image prior to");
|
||||
System.out.println(" decompression (can be combined with the other transform operations above)");
|
||||
System.out.println("-copynone = Do not copy any extra markers (including EXIF and ICC profile data)");
|
||||
System.out.println(" when transforming the image.");
|
||||
System.out.println("-benchtime <t> = Run each benchmark for at least <t> seconds (default = 5.0)");
|
||||
System.out.println("-warmup <t> = Run each benchmark for <t> seconds (default = 1.0) prior to");
|
||||
System.out.println(" when transforming the input image");
|
||||
System.out.println("-benchtime <t> = Run each benchmark for at least <t> seconds [default = 5.0]");
|
||||
System.out.println("-warmup <t> = Run each benchmark for <t> seconds [default = 1.0] prior to");
|
||||
System.out.println(" starting the timer, in order to prime the caches and thus improve the");
|
||||
System.out.println(" consistency of the results.");
|
||||
System.out.println(" consistency of the benchmark results");
|
||||
System.out.println("-componly = Stop after running compression tests. Do not test decompression.");
|
||||
System.out.println("-nowrite = Do not write reference or output images (improves consistency");
|
||||
System.out.println(" of performance measurements.)");
|
||||
System.out.println("-nowrite = Do not write reference or output images (improves consistency of");
|
||||
System.out.println(" benchmark results)");
|
||||
System.out.println("-limitscans = Refuse to decompress or transform progressive JPEG images that");
|
||||
System.out.println(" have an unreasonably large number of scans");
|
||||
System.out.println("-stoponwarning = Immediately discontinue the current");
|
||||
System.out.println(" compression/decompression/transform operation if the underlying codec");
|
||||
System.out.println(" throws a warning (non-fatal error)\n");
|
||||
System.out.println(" compression/decompression/transform operation if a warning (non-fatal");
|
||||
System.out.println(" error) occurs\n");
|
||||
System.out.println("NOTE: If the quality is specified as a range (e.g. 90-100), a separate");
|
||||
System.out.println("test will be performed for all quality values in the range.\n");
|
||||
System.exit(1);
|
||||
@@ -782,18 +782,18 @@ final class TJBench {
|
||||
minArg = 2;
|
||||
if (argv.length < minArg)
|
||||
usage();
|
||||
String[] quals = argv[1].split("-", 2);
|
||||
try {
|
||||
minQual = Integer.parseInt(argv[1]);
|
||||
minQual = Integer.parseInt(quals[0]);
|
||||
} catch (NumberFormatException e) {}
|
||||
if (minQual < 1 || minQual > 100)
|
||||
throw new Exception("Quality must be between 1 and 100.");
|
||||
int dashIndex = argv[1].indexOf('-');
|
||||
if (dashIndex > 0 && argv[1].length() > dashIndex + 1) {
|
||||
if (quals.length > 1) {
|
||||
try {
|
||||
maxQual = Integer.parseInt(argv[1].substring(dashIndex + 1));
|
||||
maxQual = Integer.parseInt(quals[1]);
|
||||
} catch (NumberFormatException e) {}
|
||||
}
|
||||
if (maxQual < 1 || maxQual > 100)
|
||||
if (maxQual < 1 || maxQual > 100 || maxQual < minQual)
|
||||
maxQual = minQual;
|
||||
}
|
||||
|
||||
@@ -802,7 +802,7 @@ final class TJBench {
|
||||
if (argv[i].equalsIgnoreCase("-tile")) {
|
||||
doTile = true; xformOpt |= TJTransform.OPT_CROP;
|
||||
} else if (argv[i].equalsIgnoreCase("-fastupsample")) {
|
||||
System.out.println("Using fast upsampling code\n");
|
||||
System.out.println("Using fastest upsampling algorithm\n");
|
||||
flags |= TJ.FLAG_FASTUPSAMPLE;
|
||||
} else if (argv[i].equalsIgnoreCase("-fastdct")) {
|
||||
System.out.println("Using fastest DCT/IDCT algorithm\n");
|
||||
@@ -813,6 +813,7 @@ final class TJBench {
|
||||
} else if (argv[i].equalsIgnoreCase("-progressive")) {
|
||||
System.out.println("Using progressive entropy coding\n");
|
||||
flags |= TJ.FLAG_PROGRESSIVE;
|
||||
xformOpt |= TJTransform.OPT_PROGRESSIVE;
|
||||
} else if (argv[i].equalsIgnoreCase("-rgb"))
|
||||
pf = TJ.PF_RGB;
|
||||
else if (argv[i].equalsIgnoreCase("-rgbx"))
|
||||
@@ -899,7 +900,7 @@ final class TJBench {
|
||||
} else
|
||||
usage();
|
||||
} else if (argv[i].equalsIgnoreCase("-yuv")) {
|
||||
System.out.println("Testing YUV planar encoding/decoding\n");
|
||||
System.out.println("Testing planar YUV encoding/decoding\n");
|
||||
doYUV = true;
|
||||
} else if (argv[i].equalsIgnoreCase("-yuvpad") &&
|
||||
i < argv.length - 1) {
|
||||
@@ -908,8 +909,10 @@ final class TJBench {
|
||||
try {
|
||||
temp = Integer.parseInt(argv[++i]);
|
||||
} catch (NumberFormatException e) {}
|
||||
if (temp >= 1)
|
||||
yuvPad = temp;
|
||||
if (temp >= 1 && (temp & (temp - 1)) == 0)
|
||||
yuvAlign = temp;
|
||||
else
|
||||
usage();
|
||||
} else if (argv[i].equalsIgnoreCase("-subsamp") &&
|
||||
i < argv.length - 1) {
|
||||
i++;
|
||||
@@ -925,10 +928,14 @@ final class TJBench {
|
||||
subsamp = TJ.SAMP_420;
|
||||
else if (argv[i].equals("411"))
|
||||
subsamp = TJ.SAMP_411;
|
||||
else
|
||||
usage();
|
||||
} else if (argv[i].equalsIgnoreCase("-componly"))
|
||||
compOnly = true;
|
||||
else if (argv[i].equalsIgnoreCase("-nowrite"))
|
||||
write = false;
|
||||
else if (argv[i].equalsIgnoreCase("-limitscans"))
|
||||
flags |= TJ.FLAG_LIMITSCANS;
|
||||
else if (argv[i].equalsIgnoreCase("-stoponwarning"))
|
||||
flags |= TJ.FLAG_STOPONWARNING;
|
||||
else usage();
|
||||
@@ -940,8 +947,9 @@ final class TJBench {
|
||||
|
||||
if ((sf.getNum() != 1 || sf.getDenom() != 1) && doTile) {
|
||||
System.out.println("Disabling tiled compression/decompression tests, because those tests do not");
|
||||
System.out.println("work when scaled decompression is enabled.");
|
||||
System.out.println("work when scaled decompression is enabled.\n");
|
||||
doTile = false;
|
||||
xformOpt &= (~TJTransform.OPT_CROP);
|
||||
}
|
||||
|
||||
if (!decompOnly) {
|
||||
@@ -956,7 +964,7 @@ final class TJBench {
|
||||
|
||||
if (quiet == 1 && !decompOnly) {
|
||||
System.out.println("All performance values in Mpixels/sec\n");
|
||||
System.out.format("Bitmap JPEG JPEG %s %s ",
|
||||
System.out.format("Pixel JPEG JPEG %s %s ",
|
||||
(doTile ? "Tile " : "Image"),
|
||||
(doTile ? "Tile " : "Image"));
|
||||
if (doYUV)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2011-2012, 2014-2015, 2017-2018 D. R. Commander.
|
||||
* Copyright (C)2011-2012, 2014-2015, 2017-2018, 2023 D. R. Commander.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -136,14 +136,11 @@ class TJExample implements TJCustomFilter {
|
||||
System.out.println("-display = Display output image (Output filename need not be specified in this");
|
||||
System.out.println(" case.)\n");
|
||||
|
||||
System.out.println("-fastupsample = Use the fastest chrominance upsampling algorithm available in");
|
||||
System.out.println(" the underlying codec.\n");
|
||||
System.out.println("-fastupsample = Use the fastest chrominance upsampling algorithm available\n");
|
||||
|
||||
System.out.println("-fastdct = Use the fastest DCT/IDCT algorithms available in the underlying");
|
||||
System.out.println(" codec.\n");
|
||||
System.out.println("-fastdct = Use the fastest DCT/IDCT algorithm available\n");
|
||||
|
||||
System.out.println("-accuratedct = Use the most accurate DCT/IDCT algorithms available in the");
|
||||
System.out.println(" underlying codec.\n");
|
||||
System.out.println("-accuratedct = Use the most accurate DCT/IDCT algorithm available\n");
|
||||
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2011-2018 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2011-2018, 2023 D. R. Commander. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -48,10 +48,10 @@ final class TJUnitTest {
|
||||
static void usage() {
|
||||
System.out.println("\nUSAGE: java " + CLASS_NAME + " [options]\n");
|
||||
System.out.println("Options:");
|
||||
System.out.println("-yuv = test YUV encoding/decoding support");
|
||||
System.out.println("-noyuvpad = do not pad each line of each Y, U, and V plane to the nearest");
|
||||
System.out.println(" 4-byte boundary");
|
||||
System.out.println("-bi = test BufferedImage support\n");
|
||||
System.out.println("-yuv = test YUV encoding/compression/decompression/decoding");
|
||||
System.out.println("-noyuvpad = do not pad each row in each Y, U, and V plane to the nearest");
|
||||
System.out.println(" multiple of 4 bytes");
|
||||
System.out.println("-bi = test BufferedImage I/O\n");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ final class TJUnitTest {
|
||||
};
|
||||
|
||||
private static boolean doYUV = false;
|
||||
private static int pad = 4;
|
||||
private static int yuvAlign = 4;
|
||||
private static boolean bi = false;
|
||||
|
||||
private static int exitStatus = 0;
|
||||
@@ -532,7 +532,7 @@ final class TJUnitTest {
|
||||
int hsf = TJ.getMCUWidth(subsamp) / 8, vsf = TJ.getMCUHeight(subsamp) / 8;
|
||||
int pw = pad(w, hsf), ph = pad(h, vsf);
|
||||
int cw = pw / hsf, ch = ph / vsf;
|
||||
int ypitch = pad(pw, pad), uvpitch = pad(cw, pad);
|
||||
int ypitch = pad(pw, yuvAlign), uvpitch = pad(cw, yuvAlign);
|
||||
int retval = 1;
|
||||
int correctsize = ypitch * ph +
|
||||
(subsamp == TJ.SAMP_GRAY ? 0 : uvpitch * ch * 2);
|
||||
@@ -668,7 +668,7 @@ final class TJUnitTest {
|
||||
if (doYUV) {
|
||||
System.out.format("%s %s -> YUV %s ... ", pfStrLong, buStrLong,
|
||||
SUBNAME_LONG[subsamp]);
|
||||
YUVImage yuvImage = tjc.encodeYUV(pad, flags);
|
||||
YUVImage yuvImage = tjc.encodeYUV(yuvAlign, flags);
|
||||
if (checkBufYUV(yuvImage.getBuf(), yuvImage.getSize(), w, h, subsamp,
|
||||
new TJScalingFactor(1, 1)) == 1)
|
||||
System.out.print("Passed.\n");
|
||||
@@ -733,8 +733,8 @@ final class TJUnitTest {
|
||||
if (!sf.isOne())
|
||||
System.out.format("%d/%d ... ", sf.getNum(), sf.getDenom());
|
||||
else System.out.print("... ");
|
||||
YUVImage yuvImage = tjd.decompressToYUV(scaledWidth, pad, scaledHeight,
|
||||
flags);
|
||||
YUVImage yuvImage = tjd.decompressToYUV(scaledWidth, yuvAlign,
|
||||
scaledHeight, flags);
|
||||
if (checkBufYUV(yuvImage.getBuf(), yuvImage.getSize(), scaledWidth,
|
||||
scaledHeight, subsamp, sf) == 1)
|
||||
System.out.print("Passed.\n");
|
||||
@@ -837,6 +837,55 @@ final class TJUnitTest {
|
||||
if (tjd != null) tjd.close();
|
||||
}
|
||||
|
||||
static void overflowTest() throws Exception {
|
||||
/* Ensure that the various buffer size methods don't overflow */
|
||||
int size = 0;
|
||||
boolean exception = false;
|
||||
|
||||
try {
|
||||
exception = false;
|
||||
size = TJ.bufSize(18919, 18919, TJ.SAMP_444);
|
||||
} catch (Exception e) { exception = true; }
|
||||
if (!exception || size != 0)
|
||||
throw new Exception("TJ.bufSize() overflow");
|
||||
try {
|
||||
exception = false;
|
||||
size = TJ.bufSizeYUV(26755, 1, 26755, TJ.SAMP_444);
|
||||
} catch (Exception e) { exception = true; }
|
||||
if (!exception || size != 0)
|
||||
throw new Exception("TJ.bufSizeYUV() overflow");
|
||||
try {
|
||||
exception = false;
|
||||
size = TJ.bufSizeYUV(26754, 3, 26754, TJ.SAMP_444);
|
||||
} catch (Exception e) { exception = true; }
|
||||
if (!exception || size != 0)
|
||||
throw new Exception("TJ.bufSizeYUV() overflow");
|
||||
try {
|
||||
exception = false;
|
||||
size = TJ.bufSizeYUV(26754, -1, 26754, TJ.SAMP_444);
|
||||
} catch (Exception e) { exception = true; }
|
||||
if (!exception || size != 0)
|
||||
throw new Exception("TJ.bufSizeYUV() overflow");
|
||||
try {
|
||||
exception = false;
|
||||
size = TJ.planeSizeYUV(0, 46341, 0, 46341, TJ.SAMP_444);
|
||||
} catch (Exception e) { exception = true; }
|
||||
if (!exception || size != 0)
|
||||
throw new Exception("TJ.planeSizeYUV() overflow");
|
||||
try {
|
||||
exception = false;
|
||||
size = TJ.planeWidth(0, Integer.MAX_VALUE, TJ.SAMP_420);
|
||||
} catch (Exception e) { exception = true; }
|
||||
if (!exception || size != 0)
|
||||
throw new Exception("TJ.planeWidth() overflow");
|
||||
try {
|
||||
exception = false;
|
||||
size = TJ.planeHeight(0, Integer.MAX_VALUE, TJ.SAMP_420);
|
||||
} catch (Exception e) { exception = true; }
|
||||
if (!exception || size != 0)
|
||||
throw new Exception("TJ.planeHeight() overflow");
|
||||
}
|
||||
|
||||
static void bufSizeTest() throws Exception {
|
||||
int w, h, i, subsamp;
|
||||
byte[] srcBuf, dstBuf = null;
|
||||
@@ -855,7 +904,7 @@ final class TJUnitTest {
|
||||
System.out.format("%04d x %04d\b\b\b\b\b\b\b\b\b\b\b", w, h);
|
||||
srcBuf = new byte[w * h * 4];
|
||||
if (doYUV)
|
||||
dstImage = new YUVImage(w, pad, h, subsamp);
|
||||
dstImage = new YUVImage(w, yuvAlign, h, subsamp);
|
||||
else
|
||||
dstBuf = new byte[TJ.bufSize(w, h, subsamp)];
|
||||
for (i = 0; i < w * h * 4; i++) {
|
||||
@@ -871,7 +920,7 @@ final class TJUnitTest {
|
||||
|
||||
srcBuf = new byte[h * w * 4];
|
||||
if (doYUV)
|
||||
dstImage = new YUVImage(h, pad, w, subsamp);
|
||||
dstImage = new YUVImage(h, yuvAlign, w, subsamp);
|
||||
else
|
||||
dstBuf = new byte[TJ.bufSize(h, w, subsamp)];
|
||||
for (i = 0; i < h * w * 4; i++) {
|
||||
@@ -903,7 +952,7 @@ final class TJUnitTest {
|
||||
if (argv[i].equalsIgnoreCase("-yuv"))
|
||||
doYUV = true;
|
||||
else if (argv[i].equalsIgnoreCase("-noyuvpad"))
|
||||
pad = 1;
|
||||
yuvAlign = 1;
|
||||
else if (argv[i].equalsIgnoreCase("-bi")) {
|
||||
bi = true;
|
||||
testName = "javabitest";
|
||||
@@ -912,6 +961,7 @@ final class TJUnitTest {
|
||||
}
|
||||
if (doYUV)
|
||||
FORMATS_4BYTE[4] = -1;
|
||||
overflowTest();
|
||||
doTest(35, 39, bi ? FORMATS_3BYTEBI : FORMATS_3BYTE, TJ.SAMP_444,
|
||||
testName);
|
||||
doTest(39, 41, bi ? FORMATS_4BYTEBI : FORMATS_4BYTE, TJ.SAMP_444,
|
||||
|
||||
@@ -189,167 +189,174 @@
|
||||
<td class="colLast"><code>128</code></td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.FLAG_LIMITSCANS">
|
||||
<!-- -->
|
||||
</a><code>public static final int</code></td>
|
||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#FLAG_LIMITSCANS">FLAG_LIMITSCANS</a></code></td>
|
||||
<td class="colLast"><code>32768</code></td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.FLAG_PROGRESSIVE">
|
||||
<!-- -->
|
||||
</a><code>public static final int</code></td>
|
||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#FLAG_PROGRESSIVE">FLAG_PROGRESSIVE</a></code></td>
|
||||
<td class="colLast"><code>16384</code></td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.FLAG_STOPONWARNING">
|
||||
<!-- -->
|
||||
</a><code>public static final int</code></td>
|
||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING">FLAG_STOPONWARNING</a></code></td>
|
||||
<td class="colLast"><code>8192</code></td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.NUMCS">
|
||||
<!-- -->
|
||||
</a><code>public static final int</code></td>
|
||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#NUMCS">NUMCS</a></code></td>
|
||||
<td class="colLast"><code>5</code></td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.NUMERR">
|
||||
<!-- -->
|
||||
</a><code>public static final int</code></td>
|
||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#NUMERR">NUMERR</a></code></td>
|
||||
<td class="colLast"><code>2</code></td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.NUMPF">
|
||||
<!-- -->
|
||||
</a><code>public static final int</code></td>
|
||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#NUMPF">NUMPF</a></code></td>
|
||||
<td class="colLast"><code>12</code></td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.NUMSAMP">
|
||||
<!-- -->
|
||||
</a><code>public static final int</code></td>
|
||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#NUMSAMP">NUMSAMP</a></code></td>
|
||||
<td class="colLast"><code>6</code></td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_ABGR">
|
||||
<!-- -->
|
||||
</a><code>public static final int</code></td>
|
||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_ABGR">PF_ABGR</a></code></td>
|
||||
<td class="colLast"><code>9</code></td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_ARGB">
|
||||
<!-- -->
|
||||
</a><code>public static final int</code></td>
|
||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_ARGB">PF_ARGB</a></code></td>
|
||||
<td class="colLast"><code>10</code></td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_BGR">
|
||||
<!-- -->
|
||||
</a><code>public static final int</code></td>
|
||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_BGR">PF_BGR</a></code></td>
|
||||
<td class="colLast"><code>1</code></td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_BGRA">
|
||||
<!-- -->
|
||||
</a><code>public static final int</code></td>
|
||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_BGRA">PF_BGRA</a></code></td>
|
||||
<td class="colLast"><code>8</code></td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_BGRX">
|
||||
<!-- -->
|
||||
</a><code>public static final int</code></td>
|
||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_BGRX">PF_BGRX</a></code></td>
|
||||
<td class="colLast"><code>3</code></td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_CMYK">
|
||||
<!-- -->
|
||||
</a><code>public static final int</code></td>
|
||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_CMYK">PF_CMYK</a></code></td>
|
||||
<td class="colLast"><code>11</code></td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_GRAY">
|
||||
<!-- -->
|
||||
</a><code>public static final int</code></td>
|
||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_GRAY">PF_GRAY</a></code></td>
|
||||
<td class="colLast"><code>6</code></td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_RGB">
|
||||
<!-- -->
|
||||
</a><code>public static final int</code></td>
|
||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_RGB">PF_RGB</a></code></td>
|
||||
<td class="colLast"><code>0</code></td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_RGBA">
|
||||
<!-- -->
|
||||
</a><code>public static final int</code></td>
|
||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_RGBA">PF_RGBA</a></code></td>
|
||||
<td class="colLast"><code>7</code></td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_RGBX">
|
||||
<!-- -->
|
||||
</a><code>public static final int</code></td>
|
||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_RGBX">PF_RGBX</a></code></td>
|
||||
<td class="colLast"><code>2</code></td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_XBGR">
|
||||
<!-- -->
|
||||
</a><code>public static final int</code></td>
|
||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_XBGR">PF_XBGR</a></code></td>
|
||||
<td class="colLast"><code>4</code></td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_XRGB">
|
||||
<!-- -->
|
||||
</a><code>public static final int</code></td>
|
||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_XRGB">PF_XRGB</a></code></td>
|
||||
<td class="colLast"><code>5</code></td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.SAMP_411">
|
||||
<!-- -->
|
||||
</a><code>public static final int</code></td>
|
||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_411">SAMP_411</a></code></td>
|
||||
<td class="colLast"><code>5</code></td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.SAMP_420">
|
||||
<!-- -->
|
||||
</a><code>public static final int</code></td>
|
||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_420">SAMP_420</a></code></td>
|
||||
<td class="colLast"><code>2</code></td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.SAMP_422">
|
||||
<!-- -->
|
||||
</a><code>public static final int</code></td>
|
||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_422">SAMP_422</a></code></td>
|
||||
<td class="colLast"><code>1</code></td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.SAMP_440">
|
||||
<!-- -->
|
||||
</a><code>public static final int</code></td>
|
||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_440">SAMP_440</a></code></td>
|
||||
<td class="colLast"><code>4</code></td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.SAMP_444">
|
||||
<!-- -->
|
||||
</a><code>public static final int</code></td>
|
||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_444">SAMP_444</a></code></td>
|
||||
<td class="colLast"><code>0</code></td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.SAMP_GRAY">
|
||||
<!-- -->
|
||||
</a><code>public static final int</code></td>
|
||||
|
||||
@@ -74,8 +74,9 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int,%20int,%20int,%20int)">bufSizeYUV(int, int, int, int)</a></span> - Static method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||
<dd>
|
||||
<div class="block">Returns the size of the buffer (in bytes) required to hold a YUV planar
|
||||
image with the given width, height, and level of chrominance subsampling.</div>
|
||||
<div class="block">Returns the size of the buffer (in bytes) required to hold a unified
|
||||
planar YUV image with the given width, height, and level of chrominance
|
||||
subsampling.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int,%20int,%20int)">bufSizeYUV(int, int, int)</a></span> - Static method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||
<dd>
|
||||
@@ -103,13 +104,14 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#compress(byte[],%20int)">compress(byte[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Compress the uncompressed source image associated with this compressor
|
||||
instance and output a JPEG image to the given destination buffer.</div>
|
||||
<div class="block">Compress the packed-pixel or planar YUV source image associated with this
|
||||
compressor instance and output a JPEG image to the given destination
|
||||
buffer.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#compress(int)">compress(int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Compress the uncompressed source image associated with this compressor
|
||||
instance and return a buffer containing a JPEG image.</div>
|
||||
<div class="block">Compress the packed-pixel or planar YUV source image associated with this
|
||||
compressor instance and return a buffer containing a JPEG image.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#compress(java.awt.image.BufferedImage,%20byte[],%20int)">compress(BufferedImage, byte[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
<dd>
|
||||
@@ -161,9 +163,9 @@
|
||||
<dl>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)">decompress(byte[], int, int, int, int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Decompress the JPEG source image or decode the YUV source image associated
|
||||
with this decompressor instance and output a grayscale, RGB, or CMYK image
|
||||
to the given destination buffer.</div>
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and output a packed-pixel
|
||||
grayscale, RGB, or CMYK image to the given destination buffer.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int)">decompress(byte[], int, int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
@@ -174,32 +176,35 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int,%20int,%20int,%20int,%20int)">decompress(int, int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Decompress the JPEG source image associated with this decompressor
|
||||
instance and return a buffer containing the decompressed image.</div>
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and return a buffer containing
|
||||
the packed-pixel decompressed image.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)">decompress(int[], int, int, int, int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Decompress the JPEG source image or decode the YUV source image associated
|
||||
with this decompressor instance and output a grayscale, RGB, or CMYK image
|
||||
to the given destination buffer.</div>
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and output a packed-pixel
|
||||
grayscale, RGB, or CMYK image to the given destination buffer.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(java.awt.image.BufferedImage,%20int)">decompress(BufferedImage, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Decompress the JPEG source image or decode the YUV source image associated
|
||||
with this decompressor instance and output a decompressed/decoded image to
|
||||
the given <code>BufferedImage</code> instance.</div>
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and output a packed-pixel
|
||||
decompressed/decoded image to the given <code>BufferedImage</code>
|
||||
instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int,%20int,%20int,%20int)">decompress(int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Decompress the JPEG source image or decode the YUV source image associated
|
||||
with this decompressor instance and return a <code>BufferedImage</code>
|
||||
instance containing the decompressed/decoded image.</div>
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and return a
|
||||
<code>BufferedImage</code> instance containing the packed-pixel
|
||||
decompressed/decoded image.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)">decompressToYUV(YUVImage, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Decompress the JPEG source image associated with this decompressor
|
||||
instance into a YUV planar image and store it in the given
|
||||
<code>YUVImage</code> instance.</div>
|
||||
instance into a planar YUV image and store it in the given
|
||||
<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[],%20int)">decompressToYUV(byte[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
@@ -211,13 +216,13 @@
|
||||
<dd>
|
||||
<div class="block">Decompress the JPEG source image associated with this decompressor
|
||||
instance into a set of Y, U (Cb), and V (Cr) image planes and return a
|
||||
<code>YUVImage</code> instance containing the decompressed image planes.</div>
|
||||
<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing the decompressed image planes.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int,%20int,%20int,%20int)">decompressToYUV(int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Decompress the JPEG source image associated with this decompressor
|
||||
instance into a unified YUV planar image buffer and return a
|
||||
<code>YUVImage</code> instance containing the decompressed image.</div>
|
||||
instance into a unified planar YUV image and return a <a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a>
|
||||
instance containing the decompressed image.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int)">decompressToYUV(int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
@@ -233,9 +238,9 @@
|
||||
<dl>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)">encodeYUV(YUVImage, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Encode the uncompressed source image associated with this compressor
|
||||
instance into a YUV planar image and store it in the given
|
||||
<code>YUVImage</code> instance.</div>
|
||||
<div class="block">Encode the packed-pixel source image associated with this compressor
|
||||
instance into a planar YUV image and store it in the given
|
||||
<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[],%20int)">encodeYUV(byte[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
<dd>
|
||||
@@ -245,15 +250,15 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int,%20int)">encodeYUV(int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Encode the uncompressed source image associated with this compressor
|
||||
instance into a unified YUV planar image buffer and return a
|
||||
<code>YUVImage</code> instance containing the encoded image.</div>
|
||||
<div class="block">Encode the packed-pixel source image associated with this compressor
|
||||
instance into a unified planar YUV image and return a <a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a>
|
||||
instance containing the encoded image.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int[],%20int)">encodeYUV(int[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Encode the uncompressed source image associated with this compressor
|
||||
<div class="block">Encode the packed-pixel source image associated with this compressor
|
||||
instance into separate Y, U (Cb), and V (Cr) image planes and return a
|
||||
<code>YUVImage</code> instance containing the encoded image planes.</div>
|
||||
<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing the encoded image planes.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int)">encodeYUV(int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
<dd>
|
||||
@@ -288,8 +293,8 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#ERR_WARNING">ERR_WARNING</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||
<dd>
|
||||
<div class="block">The error was non-fatal and recoverable, but the image may still be
|
||||
corrupt.</div>
|
||||
<div class="block">The error was non-fatal and recoverable, but the destination image may
|
||||
still be corrupt.</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<a name="_F_">
|
||||
@@ -303,23 +308,21 @@
|
||||
<dd> </dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_ACCURATEDCT">FLAG_ACCURATEDCT</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||
<dd>
|
||||
<div class="block">Use the most accurate DCT/IDCT algorithm available in the underlying
|
||||
codec.</div>
|
||||
<div class="block">Use the most accurate DCT/IDCT algorithm available.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP">FLAG_BOTTOMUP</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||
<dd>
|
||||
<div class="block">The uncompressed source/destination image is stored in bottom-up (Windows,
|
||||
OpenGL) order, not top-down (X11) order.</div>
|
||||
<div class="block">Rows in the packed-pixel source/destination image are stored in bottom-up
|
||||
(Windows, OpenGL) order rather than in top-down (X11) order.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_FASTDCT">FLAG_FASTDCT</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||
<dd>
|
||||
<div class="block">Use the fastest DCT/IDCT algorithm available in the underlying codec.</div>
|
||||
<div class="block">Use the fastest DCT/IDCT algorithm available.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_FASTUPSAMPLE">FLAG_FASTUPSAMPLE</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||
<dd>
|
||||
<div class="block">When decompressing an image that was compressed using chrominance
|
||||
subsampling, use the fastest chrominance upsampling algorithm available in
|
||||
the underlying codec.</div>
|
||||
subsampling, use the fastest chrominance upsampling algorithm available.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_FORCEMMX">FLAG_FORCEMMX</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||
<dd>
|
||||
@@ -337,6 +340,11 @@
|
||||
<dd>
|
||||
<div class="block"><span class="strong">Deprecated.</span></div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_LIMITSCANS">FLAG_LIMITSCANS</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||
<dd>
|
||||
<div class="block">Limit the number of progressive JPEG scans that the decompression and
|
||||
transform operations will process.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_PROGRESSIVE">FLAG_PROGRESSIVE</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||
<dd>
|
||||
<div class="block">Use progressive entropy coding in JPEG images generated by compression and
|
||||
@@ -345,7 +353,7 @@
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING">FLAG_STOPONWARNING</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||
<dd>
|
||||
<div class="block">Immediately discontinue the current compression/decompression/transform
|
||||
operation if the underlying codec throws a warning (non-fatal error).</div>
|
||||
operation if a warning (non-fatal error) occurs.</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<a name="_G_">
|
||||
@@ -365,8 +373,8 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#getBuf()">getBuf()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
<dd>
|
||||
<div class="block">Returns the YUV image buffer (if this image is stored in a unified
|
||||
buffer rather than separate image planes.)</div>
|
||||
<div class="block">Returns the YUV buffer (if this image is stored in a unified buffer rather
|
||||
than separate image planes.)</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getColorspace()">getColorspace()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
@@ -403,7 +411,7 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGBuf()">getJPEGBuf()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Returns the JPEG image buffer associated with this decompressor instance.</div>
|
||||
<div class="block">Returns the JPEG buffer associated with this decompressor instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGSize()">getJPEGSize()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
@@ -431,7 +439,7 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#getPad()">getPad()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
<dd>
|
||||
<div class="block">Returns the line padding used in the YUV image buffer (if this image is
|
||||
<div class="block">Returns the row alignment (in bytes) of the YUV buffer (if this image is
|
||||
stored in a unified buffer rather than separate image planes.)</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#getPixelSize(int)">getPixelSize(int)</a></span> - Static method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||
@@ -465,17 +473,17 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()">getScalingFactors()</a></span> - Static method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||
<dd>
|
||||
<div class="block">Returns a list of fractional scaling factors that the JPEG decompressor in
|
||||
this implementation of TurboJPEG supports.</div>
|
||||
<div class="block">Returns a list of fractional scaling factors that the JPEG decompressor
|
||||
supports.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#getSize()">getSize()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
<dd>
|
||||
<div class="block">Returns the size (in bytes) of the YUV image buffer (if this image is
|
||||
stored in a unified buffer rather than separate image planes.)</div>
|
||||
<div class="block">Returns the size (in bytes) of the YUV buffer (if this image is stored in
|
||||
a unified buffer rather than separate image planes.)</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#getStrides()">getStrides()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
<dd>
|
||||
<div class="block">Returns the number of bytes per line of each plane in the YUV image.</div>
|
||||
<div class="block">Returns the number of bytes per row of each plane in the YUV image.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getSubsamp()">getSubsamp()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
@@ -489,7 +497,7 @@
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransformer.html#getTransformedSizes()">getTransformedSizes()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</a></dt>
|
||||
<dd>
|
||||
<div class="block">Returns an array containing the sizes of the transformed JPEG images
|
||||
generated by the most recent transform operation.</div>
|
||||
(in bytes) generated by the most recent transform operation.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getWidth()">getWidth()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
@@ -573,7 +581,7 @@
|
||||
<dl>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#op">op</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
||||
<dd>
|
||||
<div class="block">Transform operation (one of <code>OP_*</code>)</div>
|
||||
<div class="block">Transform operation (one of <a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OP_NONE"><code>OP_*</code></a>)</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OP_HFLIP">OP_HFLIP</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
||||
<dd>
|
||||
@@ -611,7 +619,7 @@
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_COPYNONE">OPT_COPYNONE</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
||||
<dd>
|
||||
<div class="block">This option will prevent <a href="./org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)"><code>TJTransformer.transform()</code></a> from copying any extra markers (including EXIF
|
||||
and ICC profile data) from the source image to the output image.</div>
|
||||
and ICC profile data) from the source image to the destination image.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_CROP">OPT_CROP</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
||||
<dd>
|
||||
@@ -619,8 +627,8 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_GRAY">OPT_GRAY</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
||||
<dd>
|
||||
<div class="block">This option will discard the color data in the input image and produce
|
||||
a grayscale output image.</div>
|
||||
<div class="block">This option will discard the color data in the source image and produce a
|
||||
grayscale destination image.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_NOOUTPUT">OPT_NOOUTPUT</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
||||
<dd>
|
||||
@@ -634,7 +642,7 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PROGRESSIVE">OPT_PROGRESSIVE</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
||||
<dd>
|
||||
<div class="block">This option will enable progressive entropy coding in the output image
|
||||
<div class="block">This option will enable progressive entropy coding in the JPEG image
|
||||
generated by this particular transform.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_TRIM">OPT_TRIM</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
||||
@@ -644,7 +652,8 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#options">options</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
||||
<dd>
|
||||
<div class="block">Transform options (bitwise OR of one or more of <code>OPT_*</code>)</div>
|
||||
<div class="block">Transform options (bitwise OR of one or more of
|
||||
<a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT"><code>OPT_*</code></a>)</div>
|
||||
</dd>
|
||||
<dt><a href="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</a> - package org.libjpegturbo.turbojpeg</dt>
|
||||
<dd> </dd>
|
||||
@@ -751,7 +760,7 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#setBuf(byte[],%20int,%20int,%20int,%20int)">setBuf(byte[], int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
<dd>
|
||||
<div class="block">Assign a unified image buffer to this <code>YUVImage</code> instance.</div>
|
||||
<div class="block">Assign a unified buffer to this <code>YUVImage</code> instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGImage(byte[],%20int)">setJPEGImage(byte[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
@@ -765,7 +774,7 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)">setSourceImage(byte[], int, int, int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Associate an uncompressed RGB, grayscale, or CMYK source image with this
|
||||
<div class="block">Associate a packed-pixel RGB, grayscale, or CMYK source image with this
|
||||
compressor instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int)">setSourceImage(byte[], int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
@@ -777,22 +786,22 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)">setSourceImage(BufferedImage, int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Associate an uncompressed RGB or grayscale source image with this
|
||||
<div class="block">Associate a packed-pixel RGB or grayscale source image with this
|
||||
compressor instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)">setSourceImage(YUVImage)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Associate an uncompressed YUV planar source image with this compressor
|
||||
instance.</div>
|
||||
<div class="block">Associate a planar YUV source image with this compressor instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte[],%20int)">setSourceImage(byte[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Associate the JPEG image of length <code>imageSize</code> bytes stored in
|
||||
<div class="block">Associate the JPEG image or "abbreviated table specification" (AKA
|
||||
"tables-only") datastream of length <code>imageSize</code> bytes stored in
|
||||
<code>jpegImage</code> with this decompressor instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)">setSourceImage(YUVImage)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Associate the specified YUV planar source image with this decompressor
|
||||
<div class="block">Associate the specified planar YUV source image with this decompressor
|
||||
instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSubsamp(int)">setSubsamp(int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
@@ -820,7 +829,7 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[],%20int,%20int,%20int,%20int,%20int,%20int)">TJCompressor(byte[], int, int, int, int, int, int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Create a TurboJPEG compressor instance and associate the uncompressed
|
||||
<div class="block">Create a TurboJPEG compressor instance and associate the packed-pixel
|
||||
source image stored in <code>srcImage</code> with the newly created
|
||||
instance.</div>
|
||||
</dd>
|
||||
@@ -833,7 +842,7 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)">TJCompressor(BufferedImage, int, int, int, int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Create a TurboJPEG compressor instance and associate the uncompressed
|
||||
<div class="block">Create a TurboJPEG compressor instance and associate the packed-pixel
|
||||
source image stored in <code>srcImage</code> with the newly created
|
||||
instance.</div>
|
||||
</dd>
|
||||
@@ -852,17 +861,19 @@
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(byte[])">TJDecompressor(byte[])</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Create a TurboJPEG decompressor instance and associate the JPEG source
|
||||
image stored in <code>jpegImage</code> with the newly created instance.</div>
|
||||
image or "abbreviated table specification" (AKA "tables-only") datastream
|
||||
stored in <code>jpegImage</code> with the newly created instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(byte[],%20int)">TJDecompressor(byte[], int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Create a TurboJPEG decompressor instance and associate the JPEG source
|
||||
image of length <code>imageSize</code> bytes stored in
|
||||
<code>jpegImage</code> with the newly created instance.</div>
|
||||
image or "abbreviated table specification" (AKA "tables-only") datastream
|
||||
of length <code>imageSize</code> bytes stored in <code>jpegImage</code>
|
||||
with the newly created instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(org.libjpegturbo.turbojpeg.YUVImage)">TJDecompressor(YUVImage)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Create a TurboJPEG decompressor instance and associate the YUV planar
|
||||
<div class="block">Create a TurboJPEG decompressor instance and associate the planar YUV
|
||||
source image stored in <code>yuvImage</code> with the newly created
|
||||
instance.</div>
|
||||
</dd>
|
||||
@@ -913,25 +924,26 @@
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransformer.html#TJTransformer(byte[])">TJTransformer(byte[])</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</a></dt>
|
||||
<dd>
|
||||
<div class="block">Create a TurboJPEG lossless transformer instance and associate the JPEG
|
||||
image stored in <code>jpegImage</code> with the newly created instance.</div>
|
||||
source image stored in <code>jpegImage</code> with the newly created
|
||||
instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransformer.html#TJTransformer(byte[],%20int)">TJTransformer(byte[], int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</a></dt>
|
||||
<dd>
|
||||
<div class="block">Create a TurboJPEG lossless transformer instance and associate the JPEG
|
||||
image of length <code>imageSize</code> bytes stored in
|
||||
source image of length <code>imageSize</code> bytes stored in
|
||||
<code>jpegImage</code> with the newly created instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)">transform(byte[][], TJTransform[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</a></dt>
|
||||
<dd>
|
||||
<div class="block">Losslessly transform the JPEG image associated with this transformer
|
||||
instance into one or more JPEG images stored in the given destination
|
||||
buffers.</div>
|
||||
<div class="block">Losslessly transform the JPEG source image associated with this
|
||||
transformer instance into one or more JPEG images stored in the given
|
||||
destination buffers.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransformer.html#transform(org.libjpegturbo.turbojpeg.TJTransform[],%20int)">transform(TJTransform[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</a></dt>
|
||||
<dd>
|
||||
<div class="block">Losslessly transform the JPEG image associated with this transformer
|
||||
instance and return an array of <a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><code>TJDecompressor</code></a> instances, each of
|
||||
which has a transformed JPEG image associated with it.</div>
|
||||
<div class="block">Losslessly transform the JPEG source image associated with this
|
||||
transformer instance and return an array of <a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><code>TJDecompressor</code></a>
|
||||
instances, each of which has a transformed JPEG image associated with it.</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<a name="_Y_">
|
||||
@@ -939,13 +951,15 @@
|
||||
</a>
|
||||
<h2 class="title">Y</h2>
|
||||
<dl>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#yuvAlign">yuvAlign</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#yuvHeight">yuvHeight</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#yuvImage">yuvImage</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><span class="strong">YUVImage</span></a> - Class in <a href="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</a></dt>
|
||||
<dd>
|
||||
<div class="block">This class encapsulates a YUV planar image and the metadata
|
||||
<div class="block">This class encapsulates a planar YUV image and the metadata
|
||||
associated with it.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(int,%20int[],%20int,%20int)">YUVImage(int, int[], int, int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
@@ -955,8 +969,8 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(int,%20int,%20int,%20int)">YUVImage(int, int, int, int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
<dd>
|
||||
<div class="block">Create a new <code>YUVImage</code> instance backed by a unified image
|
||||
buffer, and allocate memory for the image buffer.</div>
|
||||
<div class="block">Create a new <code>YUVImage</code> instance backed by a unified buffer,
|
||||
and allocate memory for the buffer.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(byte[][],%20int[],%20int,%20int[],%20int,%20int)">YUVImage(byte[][], int[], int, int[], int, int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
<dd>
|
||||
@@ -965,13 +979,11 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(byte[],%20int,%20int,%20int,%20int)">YUVImage(byte[], int, int, int, int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
<dd>
|
||||
<div class="block">Create a new <code>YUVImage</code> instance from an existing unified image
|
||||
<div class="block">Create a new <code>YUVImage</code> instance from an existing unified
|
||||
buffer.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#yuvOffsets">yuvOffsets</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#yuvPad">yuvPad</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#yuvPlanes">yuvPlanes</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#yuvStrides">yuvStrides</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
|
||||
@@ -156,36 +156,34 @@ extends java.lang.Object</pre>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#ERR_WARNING">ERR_WARNING</a></strong></code>
|
||||
<div class="block">The error was non-fatal and recoverable, but the image may still be
|
||||
corrupt.</div>
|
||||
<div class="block">The error was non-fatal and recoverable, but the destination image may
|
||||
still be corrupt.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_ACCURATEDCT">FLAG_ACCURATEDCT</a></strong></code>
|
||||
<div class="block">Use the most accurate DCT/IDCT algorithm available in the underlying
|
||||
codec.</div>
|
||||
<div class="block">Use the most accurate DCT/IDCT algorithm available.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP">FLAG_BOTTOMUP</a></strong></code>
|
||||
<div class="block">The uncompressed source/destination image is stored in bottom-up (Windows,
|
||||
OpenGL) order, not top-down (X11) order.</div>
|
||||
<div class="block">Rows in the packed-pixel source/destination image are stored in bottom-up
|
||||
(Windows, OpenGL) order rather than in top-down (X11) order.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_FASTDCT">FLAG_FASTDCT</a></strong></code>
|
||||
<div class="block">Use the fastest DCT/IDCT algorithm available in the underlying codec.</div>
|
||||
<div class="block">Use the fastest DCT/IDCT algorithm available.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_FASTUPSAMPLE">FLAG_FASTUPSAMPLE</a></strong></code>
|
||||
<div class="block">When decompressing an image that was compressed using chrominance
|
||||
subsampling, use the fastest chrominance upsampling algorithm available in
|
||||
the underlying codec.</div>
|
||||
subsampling, use the fastest chrominance upsampling algorithm available.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
@@ -214,145 +212,152 @@ extends java.lang.Object</pre>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_LIMITSCANS">FLAG_LIMITSCANS</a></strong></code>
|
||||
<div class="block">Limit the number of progressive JPEG scans that the decompression and
|
||||
transform operations will process.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_PROGRESSIVE">FLAG_PROGRESSIVE</a></strong></code>
|
||||
<div class="block">Use progressive entropy coding in JPEG images generated by compression and
|
||||
transform operations.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING">FLAG_STOPONWARNING</a></strong></code>
|
||||
<div class="block">Immediately discontinue the current compression/decompression/transform
|
||||
operation if the underlying codec throws a warning (non-fatal error).</div>
|
||||
operation if a warning (non-fatal error) occurs.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#NUMCS">NUMCS</a></strong></code>
|
||||
<div class="block">The number of JPEG colorspaces</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#NUMERR">NUMERR</a></strong></code>
|
||||
<div class="block">The number of error codes</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#NUMPF">NUMPF</a></strong></code>
|
||||
<div class="block">The number of pixel formats</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#NUMSAMP">NUMSAMP</a></strong></code>
|
||||
<div class="block">The number of chrominance subsampling options</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_ABGR">PF_ABGR</a></strong></code>
|
||||
<div class="block">ABGR pixel format.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_ARGB">PF_ARGB</a></strong></code>
|
||||
<div class="block">ARGB pixel format.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_BGR">PF_BGR</a></strong></code>
|
||||
<div class="block">BGR pixel format.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_BGRA">PF_BGRA</a></strong></code>
|
||||
<div class="block">BGRA pixel format.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_BGRX">PF_BGRX</a></strong></code>
|
||||
<div class="block">BGRX pixel format.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_CMYK">PF_CMYK</a></strong></code>
|
||||
<div class="block">CMYK pixel format.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_GRAY">PF_GRAY</a></strong></code>
|
||||
<div class="block">Grayscale pixel format.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB">PF_RGB</a></strong></code>
|
||||
<div class="block">RGB pixel format.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGBA">PF_RGBA</a></strong></code>
|
||||
<div class="block">RGBA pixel format.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGBX">PF_RGBX</a></strong></code>
|
||||
<div class="block">RGBX pixel format.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_XBGR">PF_XBGR</a></strong></code>
|
||||
<div class="block">XBGR pixel format.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_XRGB">PF_XRGB</a></strong></code>
|
||||
<div class="block">XRGB pixel format.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_411">SAMP_411</a></strong></code>
|
||||
<div class="block">4:1:1 chrominance subsampling.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_420">SAMP_420</a></strong></code>
|
||||
<div class="block">4:2:0 chrominance subsampling.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_422">SAMP_422</a></strong></code>
|
||||
<div class="block">4:2:2 chrominance subsampling.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_440">SAMP_440</a></strong></code>
|
||||
<div class="block">4:4:0 chrominance subsampling.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444">SAMP_444</a></strong></code>
|
||||
<div class="block">4:4:4 chrominance subsampling (no chrominance subsampling).</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_GRAY">SAMP_GRAY</a></strong></code>
|
||||
<div class="block">Grayscale.</div>
|
||||
@@ -395,11 +400,12 @@ extends java.lang.Object</pre>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int,%20int,%20int,%20int)">bufSizeYUV</a></strong>(int width,
|
||||
int pad,
|
||||
int align,
|
||||
int height,
|
||||
int subsamp)</code>
|
||||
<div class="block">Returns the size of the buffer (in bytes) required to hold a YUV planar
|
||||
image with the given width, height, and level of chrominance subsampling.</div>
|
||||
<div class="block">Returns the size of the buffer (in bytes) required to hold a unified
|
||||
planar YUV image with the given width, height, and level of chrominance
|
||||
subsampling.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
@@ -453,8 +459,8 @@ extends java.lang.Object</pre>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>static <a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</a>[]</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()">getScalingFactors</a></strong>()</code>
|
||||
<div class="block">Returns a list of fractional scaling factors that the JPEG decompressor in
|
||||
this implementation of TurboJPEG supports.</div>
|
||||
<div class="block">Returns a list of fractional scaling factors that the JPEG decompressor
|
||||
supports.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
@@ -771,8 +777,8 @@ extends java.lang.Object</pre>
|
||||
vice versa, but the mapping is typically not 1:1 or reversible, nor can it
|
||||
be defined with a simple formula. Thus, such a conversion is out of scope
|
||||
for a codec library. However, the TurboJPEG API allows for compressing
|
||||
CMYK pixels into a YCCK JPEG image (see <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#CS_YCCK"><code>CS_YCCK</code></a>) and
|
||||
decompressing YCCK JPEG images into CMYK pixels.</div>
|
||||
packed-pixel CMYK images into YCCK JPEG images (see <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#CS_YCCK"><code>CS_YCCK</code></a>) and
|
||||
decompressing YCCK JPEG images into packed-pixel CMYK images.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.PF_CMYK">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -797,8 +803,9 @@ extends java.lang.Object</pre>
|
||||
<div class="block">RGB colorspace. When compressing the JPEG image, the R, G, and B
|
||||
components in the source image are reordered into image planes, but no
|
||||
colorspace conversion or subsampling is performed. RGB JPEG images can be
|
||||
decompressed to any of the extended RGB pixel formats or grayscale, but
|
||||
they cannot be decompressed to YUV images.</div>
|
||||
decompressed to packed-pixel images with any of the extended RGB or
|
||||
grayscale pixel formats, but they cannot be decompressed to planar YUV
|
||||
images.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.CS_RGB">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -819,10 +826,11 @@ extends java.lang.Object</pre>
|
||||
transformation allowed the same signal to drive both black & white and
|
||||
color televisions, but JPEG images use YCbCr primarily because it allows
|
||||
the color data to be optionally subsampled for the purposes of reducing
|
||||
bandwidth or disk space. YCbCr is the most common JPEG colorspace, and
|
||||
YCbCr JPEG images can be compressed from and decompressed to any of the
|
||||
extended RGB pixel formats or grayscale, or they can be decompressed to
|
||||
YUV planar images.</div>
|
||||
network or disk usage. YCbCr is the most common JPEG colorspace, and
|
||||
YCbCr JPEG images can be compressed from and decompressed to packed-pixel
|
||||
images with any of the extended RGB or grayscale pixel formats. YCbCr
|
||||
JPEG images can also be compressed from and decompressed to planar YUV
|
||||
images.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.CS_YCbCr">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -835,9 +843,10 @@ extends java.lang.Object</pre>
|
||||
<pre>public static final int CS_GRAY</pre>
|
||||
<div class="block">Grayscale colorspace. The JPEG image retains only the luminance data (Y
|
||||
component), and any color data from the source image is discarded.
|
||||
Grayscale JPEG images can be compressed from and decompressed to any of
|
||||
the extended RGB pixel formats or grayscale, or they can be decompressed
|
||||
to YUV planar images.</div>
|
||||
Grayscale JPEG images can be compressed from and decompressed to
|
||||
packed-pixel images with any of the extended RGB or grayscale pixel
|
||||
formats, or they can be compressed from and decompressed to planar YUV
|
||||
images.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.CS_GRAY">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -851,7 +860,7 @@ extends java.lang.Object</pre>
|
||||
<div class="block">CMYK colorspace. When compressing the JPEG image, the C, M, Y, and K
|
||||
components in the source image are reordered into image planes, but no
|
||||
colorspace conversion or subsampling is performed. CMYK JPEG images can
|
||||
only be decompressed to CMYK pixels.</div>
|
||||
only be decompressed to packed-pixel images with the CMYK pixel format.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.CS_CMYK">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -868,7 +877,7 @@ extends java.lang.Object</pre>
|
||||
reversibly transformed into YCCK, and as with YCbCr, the chrominance
|
||||
components in the YCCK pixels can be subsampled without incurring major
|
||||
perceptual loss. YCCK JPEG images can only be compressed from and
|
||||
decompressed to CMYK pixels.</div>
|
||||
decompressed to packed-pixel images with the CMYK pixel format.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.CS_YCCK">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -879,8 +888,8 @@ extends java.lang.Object</pre>
|
||||
<li class="blockList">
|
||||
<h4>FLAG_BOTTOMUP</h4>
|
||||
<pre>public static final int FLAG_BOTTOMUP</pre>
|
||||
<div class="block">The uncompressed source/destination image is stored in bottom-up (Windows,
|
||||
OpenGL) order, not top-down (X11) order.</div>
|
||||
<div class="block">Rows in the packed-pixel source/destination image are stored in bottom-up
|
||||
(Windows, OpenGL) order rather than in top-down (X11) order.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_BOTTOMUP">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -940,10 +949,10 @@ public static final int FLAG_FORCESSE3</pre>
|
||||
<h4>FLAG_FASTUPSAMPLE</h4>
|
||||
<pre>public static final int FLAG_FASTUPSAMPLE</pre>
|
||||
<div class="block">When decompressing an image that was compressed using chrominance
|
||||
subsampling, use the fastest chrominance upsampling algorithm available in
|
||||
the underlying codec. The default is to use smooth upsampling, which
|
||||
creates a smooth transition between neighboring chrominance components in
|
||||
order to reduce upsampling artifacts in the decompressed image.</div>
|
||||
subsampling, use the fastest chrominance upsampling algorithm available.
|
||||
The default is to use smooth upsampling, which creates a smooth transition
|
||||
between neighboring chrominance components in order to reduce upsampling
|
||||
artifacts in the decompressed image.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_FASTUPSAMPLE">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -954,12 +963,12 @@ public static final int FLAG_FORCESSE3</pre>
|
||||
<li class="blockList">
|
||||
<h4>FLAG_FASTDCT</h4>
|
||||
<pre>public static final int FLAG_FASTDCT</pre>
|
||||
<div class="block">Use the fastest DCT/IDCT algorithm available in the underlying codec. The
|
||||
default if this flag is not specified is implementation-specific. For
|
||||
example, the implementation of TurboJPEG for libjpeg[-turbo] uses the fast
|
||||
algorithm by default when compressing, because this has been shown to have
|
||||
only a very slight effect on accuracy, but it uses the accurate algorithm
|
||||
when decompressing, because this has been shown to have a larger effect.</div>
|
||||
<div class="block">Use the fastest DCT/IDCT algorithm available. The default if this flag is
|
||||
not specified is implementation-specific. For example, the implementation
|
||||
of the TurboJPEG API in libjpeg-turbo uses the fast algorithm by default
|
||||
when compressing, because this has been shown to have only a very slight
|
||||
effect on accuracy, but it uses the accurate algorithm when decompressing,
|
||||
because this has been shown to have a larger effect.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_FASTDCT">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -970,13 +979,12 @@ public static final int FLAG_FORCESSE3</pre>
|
||||
<li class="blockList">
|
||||
<h4>FLAG_ACCURATEDCT</h4>
|
||||
<pre>public static final int FLAG_ACCURATEDCT</pre>
|
||||
<div class="block">Use the most accurate DCT/IDCT algorithm available in the underlying
|
||||
codec. The default if this flag is not specified is
|
||||
implementation-specific. For example, the implementation of TurboJPEG for
|
||||
libjpeg[-turbo] uses the fast algorithm by default when compressing,
|
||||
because this has been shown to have only a very slight effect on accuracy,
|
||||
but it uses the accurate algorithm when decompressing, because this has
|
||||
been shown to have a larger effect.</div>
|
||||
<div class="block">Use the most accurate DCT/IDCT algorithm available. The default if this
|
||||
flag is not specified is implementation-specific. For example, the
|
||||
implementation of the TurboJPEG API in libjpeg-turbo uses the fast
|
||||
algorithm by default when compressing, because this has been shown to have
|
||||
only a very slight effect on accuracy, but it uses the accurate algorithm
|
||||
when decompressing, because this has been shown to have a larger effect.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_ACCURATEDCT">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -988,14 +996,13 @@ public static final int FLAG_FORCESSE3</pre>
|
||||
<h4>FLAG_STOPONWARNING</h4>
|
||||
<pre>public static final int FLAG_STOPONWARNING</pre>
|
||||
<div class="block">Immediately discontinue the current compression/decompression/transform
|
||||
operation if the underlying codec throws a warning (non-fatal error). The
|
||||
default behavior is to allow the operation to complete unless a fatal
|
||||
error is encountered.
|
||||
operation if a warning (non-fatal error) occurs. The default behavior is
|
||||
to allow the operation to complete unless a fatal error is encountered.
|
||||
<p>
|
||||
NOTE: due to the design of the TurboJPEG Java API, only certain methods
|
||||
(specifically, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><code>TJDecompressor.decompress*()</code></a> methods
|
||||
with a void return type) will complete and leave the output image in a
|
||||
fully recoverable state after a non-fatal error occurs.</div>
|
||||
with a void return type) will complete and leave the destination image in
|
||||
a fully recoverable state after a non-fatal error occurs.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_STOPONWARNING">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -1013,6 +1020,23 @@ public static final int FLAG_FORCESSE3</pre>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_PROGRESSIVE">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="FLAG_LIMITSCANS">
|
||||
<!-- -->
|
||||
</a>
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>FLAG_LIMITSCANS</h4>
|
||||
<pre>public static final int FLAG_LIMITSCANS</pre>
|
||||
<div class="block">Limit the number of progressive JPEG scans that the decompression and
|
||||
transform operations will process. If a progressive JPEG image contains
|
||||
an unreasonably large number of scans, then this flag will cause the
|
||||
decompression and transform operations to throw an error. The primary
|
||||
purpose of this is to allow security-critical applications to guard
|
||||
against an exploit of the progressive JPEG format described in
|
||||
<a href="https://libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf" target="_blank">this report</a>.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_LIMITSCANS">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="NUMERR">
|
||||
<!-- -->
|
||||
</a>
|
||||
@@ -1031,13 +1055,13 @@ public static final int FLAG_FORCESSE3</pre>
|
||||
<li class="blockList">
|
||||
<h4>ERR_WARNING</h4>
|
||||
<pre>public static final int ERR_WARNING</pre>
|
||||
<div class="block">The error was non-fatal and recoverable, but the image may still be
|
||||
corrupt.
|
||||
<div class="block">The error was non-fatal and recoverable, but the destination image may
|
||||
still be corrupt.
|
||||
<p>
|
||||
NOTE: due to the design of the TurboJPEG Java API, only certain methods
|
||||
(specifically, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><code>TJDecompressor.decompress*()</code></a> methods
|
||||
with a void return type) will complete and leave the output image in a
|
||||
fully recoverable state after a non-fatal error occurs.</div>
|
||||
with a void return type) will complete and leave the destination image in
|
||||
a fully recoverable state after a non-fatal error occurs.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.ERR_WARNING">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -1070,7 +1094,7 @@ public static final int FLAG_FORCESSE3</pre>
|
||||
<div class="block">Returns the MCU block width for the given level of chrominance
|
||||
subsampling.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>subsamp</code> - the level of chrominance subsampling (one of
|
||||
<code>SAMP_*</code>)</dd>
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>SAMP_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the MCU block width for the given level of chrominance
|
||||
subsampling.</dd></dl>
|
||||
</li>
|
||||
@@ -1085,7 +1109,7 @@ public static final int FLAG_FORCESSE3</pre>
|
||||
<div class="block">Returns the MCU block height for the given level of chrominance
|
||||
subsampling.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>subsamp</code> - the level of chrominance subsampling (one of
|
||||
<code>SAMP_*</code>)</dd>
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>SAMP_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the MCU block height for the given level of chrominance
|
||||
subsampling.</dd></dl>
|
||||
</li>
|
||||
@@ -1098,7 +1122,7 @@ public static final int FLAG_FORCESSE3</pre>
|
||||
<h4>getPixelSize</h4>
|
||||
<pre>public static int getPixelSize(int pixelFormat)</pre>
|
||||
<div class="block">Returns the pixel size (in bytes) for the given pixel format.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB"><code>PF_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the pixel size (in bytes) for the given pixel format.</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -1114,7 +1138,7 @@ public static final int FLAG_FORCESSE3</pre>
|
||||
of format <code>TJ.PF_BGRX</code> is stored in <code>char pixel[]</code>,
|
||||
then the red component will be
|
||||
<code>pixel[TJ.getRedOffset(TJ.PF_BGRX)]</code>.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB"><code>PF_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the red offset for the given pixel format, or -1 if the pixel
|
||||
format does not have a red component.</dd></dl>
|
||||
</li>
|
||||
@@ -1131,7 +1155,7 @@ public static final int FLAG_FORCESSE3</pre>
|
||||
of format <code>TJ.PF_BGRX</code> is stored in <code>char pixel[]</code>,
|
||||
then the green component will be
|
||||
<code>pixel[TJ.getGreenOffset(TJ.PF_BGRX)]</code>.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB"><code>PF_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the green offset for the given pixel format, or -1 if the pixel
|
||||
format does not have a green component.</dd></dl>
|
||||
</li>
|
||||
@@ -1148,7 +1172,7 @@ public static final int FLAG_FORCESSE3</pre>
|
||||
of format <code>TJ.PF_BGRX</code> is stored in <code>char pixel[]</code>,
|
||||
then the blue component will be
|
||||
<code>pixel[TJ.getBlueOffset(TJ.PF_BGRX)]</code>.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB"><code>PF_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the blue offset for the given pixel format, or -1 if the pixel
|
||||
format does not have a blue component.</dd></dl>
|
||||
</li>
|
||||
@@ -1165,7 +1189,7 @@ public static final int FLAG_FORCESSE3</pre>
|
||||
of format <code>TJ.PF_BGRA</code> is stored in <code>char pixel[]</code>,
|
||||
then the alpha component will be
|
||||
<code>pixel[TJ.getAlphaOffset(TJ.PF_BGRA)]</code>.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB"><code>PF_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the alpha offset for the given pixel format, or -1 if the pixel
|
||||
format does not have a alpha component.</dd></dl>
|
||||
</li>
|
||||
@@ -1182,7 +1206,7 @@ public static final int FLAG_FORCESSE3</pre>
|
||||
<div class="block">Returns the maximum size of the buffer (in bytes) required to hold a JPEG
|
||||
image with the given width, height, and level of chrominance subsampling.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>width</code> - the width (in pixels) of the JPEG image</dd><dd><code>height</code> - the height (in pixels) of the JPEG image</dd><dd><code>jpegSubsamp</code> - the level of chrominance subsampling to be used when
|
||||
generating the JPEG image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><code>TJ.SAMP_*</code></a>)</dd>
|
||||
generating the JPEG image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the maximum size of the buffer (in bytes) required to hold a JPEG
|
||||
image with the given width, height, and level of chrominance subsampling.</dd></dl>
|
||||
</li>
|
||||
@@ -1194,16 +1218,20 @@ public static final int FLAG_FORCESSE3</pre>
|
||||
<li class="blockList">
|
||||
<h4>bufSizeYUV</h4>
|
||||
<pre>public static int bufSizeYUV(int width,
|
||||
int pad,
|
||||
int align,
|
||||
int height,
|
||||
int subsamp)</pre>
|
||||
<div class="block">Returns the size of the buffer (in bytes) required to hold a YUV planar
|
||||
image with the given width, height, and level of chrominance subsampling.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>width</code> - the width (in pixels) of the YUV image</dd><dd><code>pad</code> - the width of each line in each plane of the image is padded to
|
||||
the nearest multiple of this number of bytes (must be a power of 2.)</dd><dd><code>height</code> - the height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV
|
||||
image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><code>TJ.SAMP_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the size of the buffer (in bytes) required to hold a YUV planar
|
||||
image with the given width, height, and level of chrominance subsampling.</dd></dl>
|
||||
<div class="block">Returns the size of the buffer (in bytes) required to hold a unified
|
||||
planar YUV image with the given width, height, and level of chrominance
|
||||
subsampling.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>width</code> - the width (in pixels) of the YUV image</dd><dd><code>align</code> - row alignment (in bytes) of the YUV image (must be a power of
|
||||
2.) Setting this parameter to n specifies that each row in each plane of
|
||||
the YUV image will be padded to the nearest multiple of n bytes
|
||||
(1 = unpadded.)</dd><dd><code>height</code> - the height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV
|
||||
image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the size of the buffer (in bytes) required to hold a unified
|
||||
planar YUV image with the given width, height, and level of chrominance
|
||||
subsampling.</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="bufSizeYUV(int, int, int)">
|
||||
@@ -1234,11 +1262,11 @@ public static int bufSizeYUV(int width,
|
||||
plane with the given parameters.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>componentID</code> - ID number of the image plane (0 = Y, 1 = U/Cb,
|
||||
2 = V/Cr)</dd><dd><code>width</code> - width (in pixels) of the YUV image. NOTE: this is the width
|
||||
of the whole image, not the plane width.</dd><dd><code>stride</code> - bytes per line in the image plane.</dd><dd><code>height</code> - height (in pixels) of the YUV image. NOTE: this is the
|
||||
of the whole image, not the plane width.</dd><dd><code>stride</code> - bytes per row in the image plane.</dd><dd><code>height</code> - height (in pixels) of the YUV image. NOTE: this is the
|
||||
height of the whole image, not the plane height.</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV
|
||||
image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><code>TJ.SAMP_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the size of the buffer (in bytes) required to hold a YUV planar
|
||||
image with the given parameters.</dd></dl>
|
||||
image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the size of the buffer (in bytes) required to hold a YUV image
|
||||
plane with the given parameters.</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="planeWidth(int, int, int)">
|
||||
@@ -1254,7 +1282,7 @@ public static int bufSizeYUV(int width,
|
||||
Refer to <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> for a description of plane width.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>componentID</code> - ID number of the image plane (0 = Y, 1 = U/Cb,
|
||||
2 = V/Cr)</dd><dd><code>width</code> - width (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV image
|
||||
(one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><code>TJ.SAMP_*</code></a>)</dd>
|
||||
(one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the plane width of a YUV image plane with the given parameters.</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -1271,7 +1299,7 @@ public static int bufSizeYUV(int width,
|
||||
Refer to <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> for a description of plane height.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>componentID</code> - ID number of the image plane (0 = Y, 1 = U/Cb,
|
||||
2 = V/Cr)</dd><dd><code>height</code> - height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV image
|
||||
(one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><code>TJ.SAMP_*</code></a>)</dd>
|
||||
(one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the plane height of a YUV image plane with the given parameters.</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -1282,10 +1310,10 @@ public static int bufSizeYUV(int width,
|
||||
<li class="blockList">
|
||||
<h4>getScalingFactors</h4>
|
||||
<pre>public static <a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</a>[] getScalingFactors()</pre>
|
||||
<div class="block">Returns a list of fractional scaling factors that the JPEG decompressor in
|
||||
this implementation of TurboJPEG supports.</div>
|
||||
<dl><dt><span class="strong">Returns:</span></dt><dd>a list of fractional scaling factors that the JPEG decompressor in
|
||||
this implementation of TurboJPEG supports.</dd></dl>
|
||||
<div class="block">Returns a list of fractional scaling factors that the JPEG decompressor
|
||||
supports.</div>
|
||||
<dl><dt><span class="strong">Returns:</span></dt><dd>a list of fractional scaling factors that the JPEG decompressor
|
||||
supports.</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -132,7 +132,7 @@ implements java.io.Closeable</pre>
|
||||
int y,
|
||||
int width,
|
||||
int height)</code>
|
||||
<div class="block">Create a TurboJPEG compressor instance and associate the uncompressed
|
||||
<div class="block">Create a TurboJPEG compressor instance and associate the packed-pixel
|
||||
source image stored in <code>srcImage</code> with the newly created
|
||||
instance.</div>
|
||||
</td>
|
||||
@@ -157,7 +157,7 @@ implements java.io.Closeable</pre>
|
||||
int pitch,
|
||||
int height,
|
||||
int pixelFormat)</code>
|
||||
<div class="block">Create a TurboJPEG compressor instance and associate the uncompressed
|
||||
<div class="block">Create a TurboJPEG compressor instance and associate the packed-pixel
|
||||
source image stored in <code>srcImage</code> with the newly created
|
||||
instance.</div>
|
||||
</td>
|
||||
@@ -210,15 +210,16 @@ implements java.io.Closeable</pre>
|
||||
<td class="colFirst"><code>void</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(byte[],%20int)">compress</a></strong>(byte[] dstBuf,
|
||||
int flags)</code>
|
||||
<div class="block">Compress the uncompressed source image associated with this compressor
|
||||
instance and output a JPEG image to the given destination buffer.</div>
|
||||
<div class="block">Compress the packed-pixel or planar YUV source image associated with this
|
||||
compressor instance and output a JPEG image to the given destination
|
||||
buffer.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>byte[]</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(int)">compress</a></strong>(int flags)</code>
|
||||
<div class="block">Compress the uncompressed source image associated with this compressor
|
||||
instance and return a buffer containing a JPEG image.</div>
|
||||
<div class="block">Compress the packed-pixel or planar YUV source image associated with this
|
||||
compressor instance and return a buffer containing a JPEG image.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
@@ -265,27 +266,27 @@ implements java.io.Closeable</pre>
|
||||
<td class="colFirst"><code><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int[],%20int)">encodeYUV</a></strong>(int[] strides,
|
||||
int flags)</code>
|
||||
<div class="block">Encode the uncompressed source image associated with this compressor
|
||||
<div class="block">Encode the packed-pixel source image associated with this compressor
|
||||
instance into separate Y, U (Cb), and V (Cr) image planes and return a
|
||||
<code>YUVImage</code> instance containing the encoded image planes.</div>
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing the encoded image planes.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int,%20int)">encodeYUV</a></strong>(int pad,
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int,%20int)">encodeYUV</a></strong>(int align,
|
||||
int flags)</code>
|
||||
<div class="block">Encode the uncompressed source image associated with this compressor
|
||||
instance into a unified YUV planar image buffer and return a
|
||||
<code>YUVImage</code> instance containing the encoded image.</div>
|
||||
<div class="block">Encode the packed-pixel source image associated with this compressor
|
||||
instance into a unified planar YUV image and return a <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a>
|
||||
instance containing the encoded image.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>void</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)">encodeYUV</a></strong>(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> dstImage,
|
||||
int flags)</code>
|
||||
<div class="block">Encode the uncompressed source image associated with this compressor
|
||||
instance into a YUV planar image and store it in the given
|
||||
<code>YUVImage</code> instance.</div>
|
||||
<div class="block">Encode the packed-pixel source image associated with this compressor
|
||||
instance into a planar YUV image and store it in the given
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
@@ -312,7 +313,7 @@ implements java.io.Closeable</pre>
|
||||
int y,
|
||||
int width,
|
||||
int height)</code>
|
||||
<div class="block">Associate an uncompressed RGB or grayscale source image with this
|
||||
<div class="block">Associate a packed-pixel RGB or grayscale source image with this
|
||||
compressor instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -338,15 +339,14 @@ implements java.io.Closeable</pre>
|
||||
int pitch,
|
||||
int height,
|
||||
int pixelFormat)</code>
|
||||
<div class="block">Associate an uncompressed RGB, grayscale, or CMYK source image with this
|
||||
<div class="block">Associate a packed-pixel RGB, grayscale, or CMYK source image with this
|
||||
compressor instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>void</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)">setSourceImage</a></strong>(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> srcImage)</code>
|
||||
<div class="block">Associate an uncompressed YUV planar source image with this compressor
|
||||
instance.</div>
|
||||
<div class="block">Associate a planar YUV source image with this compressor instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
@@ -405,7 +405,7 @@ implements java.io.Closeable</pre>
|
||||
int height,
|
||||
int pixelFormat)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Create a TurboJPEG compressor instance and associate the uncompressed
|
||||
<div class="block">Create a TurboJPEG compressor instance and associate the packed-pixel
|
||||
source image stored in <code>srcImage</code> with the newly created
|
||||
instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>x</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>y</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>width</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>pitch</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>height</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>pixelFormat</code> - pixel format of the source image (one of
|
||||
@@ -445,7 +445,7 @@ public TJCompressor(byte[] srcImage,
|
||||
int width,
|
||||
int height)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Create a TurboJPEG compressor instance and associate the uncompressed
|
||||
<div class="block">Create a TurboJPEG compressor instance and associate the packed-pixel
|
||||
source image stored in <code>srcImage</code> with the newly created
|
||||
instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - see
|
||||
@@ -480,20 +480,22 @@ public TJCompressor(byte[] srcImage,
|
||||
int height,
|
||||
int pixelFormat)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Associate an uncompressed RGB, grayscale, or CMYK source image with this
|
||||
<div class="block">Associate a packed-pixel RGB, grayscale, or CMYK source image with this
|
||||
compressor instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - image buffer containing RGB, grayscale, or CMYK pixels to
|
||||
be compressed or encoded. This buffer is not modified.</dd><dd><code>x</code> - x offset (in pixels) of the region in the source image from which
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - buffer containing a packed-pixel RGB, grayscale, or CMYK
|
||||
source image to be compressed or encoded. This buffer is not modified.</dd><dd><code>x</code> - x offset (in pixels) of the region in the source image from which
|
||||
the JPEG or YUV image should be compressed/encoded</dd><dd><code>y</code> - y offset (in pixels) of the region in the source image from which
|
||||
the JPEG or YUV image should be compressed/encoded</dd><dd><code>width</code> - width (in pixels) of the region in the source image from
|
||||
which the JPEG or YUV image should be compressed/encoded</dd><dd><code>pitch</code> - bytes per line of the source image. Normally, this should be
|
||||
<code>width * TJ.pixelSize(pixelFormat)</code> if the source image is
|
||||
unpadded, but you can use this parameter to, for instance, specify that
|
||||
the scanlines in the source image are padded to a 4-byte boundary or to
|
||||
compress/encode a JPEG or YUV image from a region of a larger source
|
||||
image. 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
|
||||
<code>width * TJ.pixelSize(pixelFormat)</code>.</dd><dd><code>height</code> - height (in pixels) of the region in the source image from
|
||||
which the JPEG or YUV image should be compressed/encoded</dd><dd><code>pitch</code> - bytes per row in the source image. Normally this should be
|
||||
<code>width *
|
||||
</code><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getPixelSize(int)"><code>TJ.getPixelSize</code></a><code>(pixelFormat)</code>,
|
||||
if the source image is unpadded. However, you can use this parameter to,
|
||||
for instance, specify that the rows in the source image are padded to the
|
||||
nearest multiple of 4 bytes or to compress/encode a JPEG or YUV image from
|
||||
a region of a larger source image. You can also be clever and use this
|
||||
parameter to skip rows, etc. Setting this parameter to 0 is the
|
||||
equivalent of setting it to <code>width *
|
||||
</code><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getPixelSize(int)"><code>TJ.getPixelSize</code></a><code>(pixelFormat)</code>.</dd><dd><code>height</code> - height (in pixels) of the region in the source image from
|
||||
which the JPEG or YUV image should be compressed/encoded</dd><dd><code>pixelFormat</code> - pixel format of the source image (one of
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB"><code>TJ.PF_*</code></a>)</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
@@ -531,10 +533,11 @@ public void setSourceImage(byte[] srcImage,
|
||||
int width,
|
||||
int height)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Associate an uncompressed RGB or grayscale source image with this
|
||||
<div class="block">Associate a packed-pixel RGB or grayscale source image with this
|
||||
compressor instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - a <code>BufferedImage</code> instance containing RGB or
|
||||
grayscale pixels to be compressed or encoded. This image is not modified.</dd><dd><code>x</code> - x offset (in pixels) of the region in the source image from which
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - a <code>BufferedImage</code> instance containing a
|
||||
packed-pixel RGB or grayscale source image to be compressed or encoded.
|
||||
This image is not modified.</dd><dd><code>x</code> - x offset (in pixels) of the region in the source image from which
|
||||
the JPEG or YUV image should be compressed/encoded</dd><dd><code>y</code> - y offset (in pixels) of the region in the source image from which
|
||||
the JPEG or YUV image should be compressed/encoded</dd><dd><code>width</code> - width (in pixels) of the region in the source image from
|
||||
which the JPEG or YUV image should be compressed/encoded (0 = use the
|
||||
@@ -553,10 +556,9 @@ public void setSourceImage(byte[] srcImage,
|
||||
<h4>setSourceImage</h4>
|
||||
<pre>public void setSourceImage(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> srcImage)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Associate an uncompressed YUV planar source image with this compressor
|
||||
instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - YUV planar image to be compressed. This image is not
|
||||
modified.</dd>
|
||||
<div class="block">Associate a planar YUV source image with this compressor instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - planar YUV source image to be compressed. This image is
|
||||
not modified.</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
</li>
|
||||
@@ -573,16 +575,16 @@ public void setSourceImage(byte[] srcImage,
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#CS_YCbCr"><code>TJ.CS_YCbCr</code></a>) or from CMYK to YCCK (see <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#CS_YCCK"><code>TJ.CS_YCCK</code></a>) as part
|
||||
of the JPEG compression process, some of the Cb and Cr (chrominance)
|
||||
components can be discarded or averaged together to produce a smaller
|
||||
image with little perceptible loss of image clarity (the human eye is more
|
||||
sensitive to small changes in brightness than to small changes in color.)
|
||||
This is called "chrominance subsampling".
|
||||
image with little perceptible loss of image clarity. (The human eye is
|
||||
more sensitive to small changes in brightness than to small changes in
|
||||
color.) This is called "chrominance subsampling".
|
||||
<p>
|
||||
NOTE: This method has no effect when compressing a JPEG image from a YUV
|
||||
planar source. In that case, the level of chrominance subsampling in
|
||||
the JPEG image is determined by the source. Furthermore, this method has
|
||||
no effect when encoding to a pre-allocated <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance. In
|
||||
that case, the level of chrominance subsampling is determined by the
|
||||
destination.</div>
|
||||
NOTE: This method has no effect when compressing a JPEG image from a
|
||||
planar YUV source image. In that case, the level of chrominance
|
||||
subsampling in the JPEG image is determined by the source image.
|
||||
Furthermore, this method has no effect when encoding to a pre-allocated
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance. In that case, the level of chrominance
|
||||
subsampling is determined by the destination image.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>newSubsamp</code> - the level of chrominance subsampling to use in
|
||||
subsequent compress/encode oeprations (one of
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd></dl>
|
||||
@@ -609,8 +611,9 @@ public void setSourceImage(byte[] srcImage,
|
||||
<pre>public void compress(byte[] dstBuf,
|
||||
int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Compress the uncompressed source image associated with this compressor
|
||||
instance and output a JPEG image to the given destination buffer.</div>
|
||||
<div class="block">Compress the packed-pixel or planar YUV source image associated with this
|
||||
compressor instance and output a JPEG image to the given destination
|
||||
buffer.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstBuf</code> - buffer that will receive the JPEG image. Use
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSize(int,%20int,%20int)"><code>TJ.bufSize(int, int, int)</code></a> to determine the maximum size for this buffer based on
|
||||
the source image's width and height and the desired level of chrominance
|
||||
@@ -628,8 +631,8 @@ public void setSourceImage(byte[] srcImage,
|
||||
<h4>compress</h4>
|
||||
<pre>public byte[] compress(int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Compress the uncompressed source image associated with this compressor
|
||||
instance and return a buffer containing a JPEG image.</div>
|
||||
<div class="block">Compress the packed-pixel or planar YUV source image associated with this
|
||||
compressor instance and return a buffer containing a JPEG image.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>flags</code> - the bitwise OR of one or more of
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>a buffer containing a JPEG image. The length of this buffer will
|
||||
@@ -682,13 +685,13 @@ public byte[] compress(java.awt.image.BufferedImage srcImage,
|
||||
<pre>public void encodeYUV(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> dstImage,
|
||||
int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Encode the uncompressed source image associated with this compressor
|
||||
instance into a YUV planar image and store it in the given
|
||||
<code>YUVImage</code> instance. This method uses the accelerated color
|
||||
conversion routines in TurboJPEG's underlying codec but does not execute
|
||||
any of the other steps in the JPEG compression process. Encoding
|
||||
CMYK source images to YUV is not supported.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstImage</code> - <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance that will receive the YUV planar
|
||||
<div class="block">Encode the packed-pixel source image associated with this compressor
|
||||
instance into a planar YUV image and store it in the given
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance. This method performs color conversion (which
|
||||
is accelerated in the libjpeg-turbo implementation) but does not execute
|
||||
any of the other steps in the JPEG compression process. Encoding CMYK
|
||||
source images into YUV images is not supported.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstImage</code> - <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance that will receive the planar YUV
|
||||
image</dd><dd><code>flags</code> - the bitwise OR of one or more of
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
@@ -716,20 +719,21 @@ public void encodeYUV(byte[] dstBuf,
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>encodeYUV</h4>
|
||||
<pre>public <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> encodeYUV(int pad,
|
||||
<pre>public <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> encodeYUV(int align,
|
||||
int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Encode the uncompressed source image associated with this compressor
|
||||
instance into a unified YUV planar image buffer and return a
|
||||
<code>YUVImage</code> instance containing the encoded image. This method
|
||||
uses the accelerated color conversion routines in TurboJPEG's underlying
|
||||
codec but does not execute any of the other steps in the JPEG compression
|
||||
process. Encoding CMYK source images to YUV is not supported.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pad</code> - the width of each line in each plane of the YUV image will be
|
||||
padded to the nearest multiple of this number of bytes (must be a power of
|
||||
2.)</dd><dd><code>flags</code> - the bitwise OR of one or more of
|
||||
<div class="block">Encode the packed-pixel source image associated with this compressor
|
||||
instance into a unified planar YUV image and return a <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a>
|
||||
instance containing the encoded image. This method performs color
|
||||
conversion (which is accelerated in the libjpeg-turbo implementation) but
|
||||
does not execute any of the other steps in the JPEG compression process.
|
||||
Encoding CMYK source images into YUV images is not supported.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>align</code> - row alignment (in bytes) of the YUV image (must be a power of
|
||||
2.) Setting this parameter to n will cause each row in each plane of the
|
||||
YUV image to be padded to the nearest multiple of n bytes (1 = unpadded.)</dd><dd><code>flags</code> - the bitwise OR of one or more of
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>a YUV planar image.</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>a <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing the unified planar YUV
|
||||
encoded image</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
</li>
|
||||
@@ -743,21 +747,22 @@ public void encodeYUV(byte[] dstBuf,
|
||||
<pre>public <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> encodeYUV(int[] strides,
|
||||
int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Encode the uncompressed source image associated with this compressor
|
||||
<div class="block">Encode the packed-pixel source image associated with this compressor
|
||||
instance into separate Y, U (Cb), and V (Cr) image planes and return a
|
||||
<code>YUVImage</code> instance containing the encoded image planes. This
|
||||
method uses the accelerated color conversion routines in TurboJPEG's
|
||||
underlying codec but does not execute any of the other steps in the JPEG
|
||||
compression process. Encoding CMYK source images to YUV is not supported.</div>
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing the encoded image planes. This
|
||||
method performs color conversion (which is accelerated in the
|
||||
libjpeg-turbo implementation) but does not execute any of the other steps
|
||||
in the JPEG compression process. Encoding CMYK source images into YUV
|
||||
images is not supported.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>strides</code> - an array of integers, each specifying the number of bytes
|
||||
per line in the corresponding plane of the output image. Setting the
|
||||
stride for any plane to 0 is the same as setting it to the component width
|
||||
of the plane. If <code>strides</code> is null, then the strides for all
|
||||
planes will be set to their respective component widths. You can adjust
|
||||
the strides in order to add an arbitrary amount of line padding to each
|
||||
plane.</dd><dd><code>flags</code> - the bitwise OR of one or more of
|
||||
per row in the corresponding plane of the YUV source image. Setting the
|
||||
stride for any plane to 0 is the same as setting it to the plane width
|
||||
(see <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a>.) If <code>strides</code> is null, then the strides
|
||||
for all planes will be set to their respective plane widths. You can
|
||||
adjust the strides in order to add an arbitrary amount of row padding to
|
||||
each plane.</dd><dd><code>flags</code> - the bitwise OR of one or more of
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>a YUV planar image.</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>a <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing the encoded image planes</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
</li>
|
||||
|
||||
@@ -163,7 +163,7 @@
|
||||
into multiple DCT coefficient buffers and call the callback function once
|
||||
for each buffer.</dd><dd><code>planeRegion</code> - rectangle containing the width and height of the
|
||||
component plane to which <code>coeffBuffer</code> belongs</dd><dd><code>componentID</code> - ID number of the component plane to which
|
||||
<code>coeffBuffer</code> belongs (Y, Cb, and Cr have, respectively, ID's
|
||||
<code>coeffBuffer</code> belongs. (Y, Cb, and Cr have, respectively, ID's
|
||||
of 0, 1, and 2 in typical JPEG images.)</dd><dd><code>transformID</code> - ID number of the transformed image to which
|
||||
<code>coeffBuffer</code> belongs. This is the same as the index of the
|
||||
transform in the <code>transforms</code> array that was passed to <a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)"><code>TJTransformer.transform()</code></a>.</dd><dd><code>transform</code> - a <a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><code>TJTransform</code></a> instance that specifies the
|
||||
|
||||
@@ -180,20 +180,22 @@ implements java.io.Closeable</pre>
|
||||
<tr class="rowColor">
|
||||
<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(byte[])">TJDecompressor</a></strong>(byte[] jpegImage)</code>
|
||||
<div class="block">Create a TurboJPEG decompressor instance and associate the JPEG source
|
||||
image stored in <code>jpegImage</code> with the newly created instance.</div>
|
||||
image or "abbreviated table specification" (AKA "tables-only") datastream
|
||||
stored in <code>jpegImage</code> with the newly created instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(byte[],%20int)">TJDecompressor</a></strong>(byte[] jpegImage,
|
||||
int imageSize)</code>
|
||||
<div class="block">Create a TurboJPEG decompressor instance and associate the JPEG source
|
||||
image of length <code>imageSize</code> bytes stored in
|
||||
<code>jpegImage</code> with the newly created instance.</div>
|
||||
image or "abbreviated table specification" (AKA "tables-only") datastream
|
||||
of length <code>imageSize</code> bytes stored in <code>jpegImage</code>
|
||||
with the newly created instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(org.libjpegturbo.turbojpeg.YUVImage)">TJDecompressor</a></strong>(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> yuvImage)</code>
|
||||
<div class="block">Create a TurboJPEG decompressor instance and associate the YUV planar
|
||||
<div class="block">Create a TurboJPEG decompressor instance and associate the planar YUV
|
||||
source image stored in <code>yuvImage</code> with the newly created
|
||||
instance.</div>
|
||||
</td>
|
||||
@@ -223,9 +225,10 @@ implements java.io.Closeable</pre>
|
||||
<td class="colFirst"><code>void</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(java.awt.image.BufferedImage,%20int)">decompress</a></strong>(java.awt.image.BufferedImage dstImage,
|
||||
int flags)</code>
|
||||
<div class="block">Decompress the JPEG source image or decode the YUV source image associated
|
||||
with this decompressor instance and output a decompressed/decoded image to
|
||||
the given <code>BufferedImage</code> instance.</div>
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and output a packed-pixel
|
||||
decompressed/decoded image to the given <code>BufferedImage</code>
|
||||
instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
@@ -252,9 +255,9 @@ implements java.io.Closeable</pre>
|
||||
int desiredHeight,
|
||||
int pixelFormat,
|
||||
int flags)</code>
|
||||
<div class="block">Decompress the JPEG source image or decode the YUV source image associated
|
||||
with this decompressor instance and output a grayscale, RGB, or CMYK image
|
||||
to the given destination buffer.</div>
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and output a packed-pixel
|
||||
grayscale, RGB, or CMYK image to the given destination buffer.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
@@ -267,9 +270,9 @@ implements java.io.Closeable</pre>
|
||||
int desiredHeight,
|
||||
int pixelFormat,
|
||||
int flags)</code>
|
||||
<div class="block">Decompress the JPEG source image or decode the YUV source image associated
|
||||
with this decompressor instance and output a grayscale, RGB, or CMYK image
|
||||
to the given destination buffer.</div>
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and output a packed-pixel
|
||||
grayscale, RGB, or CMYK image to the given destination buffer.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
@@ -278,9 +281,10 @@ implements java.io.Closeable</pre>
|
||||
int desiredHeight,
|
||||
int bufferedImageType,
|
||||
int flags)</code>
|
||||
<div class="block">Decompress the JPEG source image or decode the YUV source image associated
|
||||
with this decompressor instance and return a <code>BufferedImage</code>
|
||||
instance containing the decompressed/decoded image.</div>
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and return a
|
||||
<code>BufferedImage</code> instance containing the packed-pixel
|
||||
decompressed/decoded image.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
@@ -290,8 +294,9 @@ implements java.io.Closeable</pre>
|
||||
int desiredHeight,
|
||||
int pixelFormat,
|
||||
int flags)</code>
|
||||
<div class="block">Decompress the JPEG source image associated with this decompressor
|
||||
instance and return a buffer containing the decompressed image.</div>
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and return a buffer containing
|
||||
the packed-pixel decompressed image.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
@@ -319,18 +324,18 @@ implements java.io.Closeable</pre>
|
||||
int flags)</code>
|
||||
<div class="block">Decompress the JPEG source image associated with this decompressor
|
||||
instance into a set of Y, U (Cb), and V (Cr) image planes and return a
|
||||
<code>YUVImage</code> instance containing the decompressed image planes.</div>
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing the decompressed image planes.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int,%20int,%20int,%20int)">decompressToYUV</a></strong>(int desiredWidth,
|
||||
int pad,
|
||||
int align,
|
||||
int desiredHeight,
|
||||
int flags)</code>
|
||||
<div class="block">Decompress the JPEG source image associated with this decompressor
|
||||
instance into a unified YUV planar image buffer and return a
|
||||
<code>YUVImage</code> instance containing the decompressed image.</div>
|
||||
instance into a unified planar YUV image and return a <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a>
|
||||
instance containing the decompressed image.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
@@ -338,8 +343,8 @@ implements java.io.Closeable</pre>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)">decompressToYUV</a></strong>(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> dstImage,
|
||||
int flags)</code>
|
||||
<div class="block">Decompress the JPEG source image associated with this decompressor
|
||||
instance into a YUV planar image and store it in the given
|
||||
<code>YUVImage</code> instance.</div>
|
||||
instance into a planar YUV image and store it in the given
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
@@ -363,7 +368,7 @@ implements java.io.Closeable</pre>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>byte[]</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGBuf()">getJPEGBuf</a></strong>()</code>
|
||||
<div class="block">Returns the JPEG image buffer associated with this decompressor instance.</div>
|
||||
<div class="block">Returns the JPEG buffer associated with this decompressor instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
@@ -418,14 +423,15 @@ implements java.io.Closeable</pre>
|
||||
<td class="colFirst"><code>void</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte[],%20int)">setSourceImage</a></strong>(byte[] jpegImage,
|
||||
int imageSize)</code>
|
||||
<div class="block">Associate the JPEG image of length <code>imageSize</code> bytes stored in
|
||||
<div class="block">Associate the JPEG image or "abbreviated table specification" (AKA
|
||||
"tables-only") datastream of length <code>imageSize</code> bytes stored in
|
||||
<code>jpegImage</code> with this decompressor instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>void</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)">setSourceImage</a></strong>(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> srcImage)</code>
|
||||
<div class="block">Associate the specified YUV planar source image with this decompressor
|
||||
<div class="block">Associate the specified planar YUV source image with this decompressor
|
||||
instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -553,9 +559,11 @@ implements java.io.Closeable</pre>
|
||||
<pre>public TJDecompressor(byte[] jpegImage)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Create a TurboJPEG decompressor instance and associate the JPEG source
|
||||
image stored in <code>jpegImage</code> with the newly created instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - JPEG image buffer (size of the JPEG image is assumed to
|
||||
be the length of the array.) This buffer is not modified.</dd>
|
||||
image or "abbreviated table specification" (AKA "tables-only") datastream
|
||||
stored in <code>jpegImage</code> with the newly created instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - buffer containing a JPEG source image or tables-only
|
||||
datastream. (The size of the JPEG image or datastream is assumed to be
|
||||
the length of the array.) This buffer is not modified.</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
</li>
|
||||
@@ -570,9 +578,12 @@ implements java.io.Closeable</pre>
|
||||
int imageSize)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Create a TurboJPEG decompressor instance and associate the JPEG source
|
||||
image of length <code>imageSize</code> bytes stored in
|
||||
<code>jpegImage</code> with the newly created instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - JPEG image buffer. This buffer is not modified.</dd><dd><code>imageSize</code> - size of the JPEG image (in bytes)</dd>
|
||||
image or "abbreviated table specification" (AKA "tables-only") datastream
|
||||
of length <code>imageSize</code> bytes stored in <code>jpegImage</code>
|
||||
with the newly created instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - buffer containing a JPEG source image or tables-only
|
||||
datastream. This buffer is not modified.</dd><dd><code>imageSize</code> - size of the JPEG source image or tables-only datastream
|
||||
(in bytes)</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
</li>
|
||||
@@ -585,10 +596,10 @@ implements java.io.Closeable</pre>
|
||||
<h4>TJDecompressor</h4>
|
||||
<pre>public TJDecompressor(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> yuvImage)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Create a TurboJPEG decompressor instance and associate the YUV planar
|
||||
<div class="block">Create a TurboJPEG decompressor instance and associate the planar YUV
|
||||
source image stored in <code>yuvImage</code> with the newly created
|
||||
instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>yuvImage</code> - <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing a YUV planar
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>yuvImage</code> - <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing a planar YUV source
|
||||
image to be decoded. This image is not modified.</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
@@ -611,10 +622,19 @@ implements java.io.Closeable</pre>
|
||||
<pre>public void setSourceImage(byte[] jpegImage,
|
||||
int imageSize)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Associate the JPEG image of length <code>imageSize</code> bytes stored in
|
||||
<code>jpegImage</code> with this decompressor instance. This image will
|
||||
be used as the source image for subsequent decompress operations.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - JPEG image buffer. This buffer is not modified.</dd><dd><code>imageSize</code> - size of the JPEG image (in bytes)</dd>
|
||||
<div class="block">Associate the JPEG image or "abbreviated table specification" (AKA
|
||||
"tables-only") datastream of length <code>imageSize</code> bytes stored in
|
||||
<code>jpegImage</code> with this decompressor instance. If
|
||||
<code>jpegImage</code> contains a JPEG image, then this image will be used
|
||||
as the source image for subsequent decompression operations. Passing a
|
||||
tables-only datastream to this method primes the decompressor with
|
||||
quantization and Huffman tables that can be used when decompressing
|
||||
subsequent "abbreviated image" datastreams. This is useful, for instance,
|
||||
when decompressing video streams in which all frames share the same
|
||||
quantization and Huffman tables.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - buffer containing a JPEG source image or tables-only
|
||||
datastream. This buffer is not modified.</dd><dd><code>imageSize</code> - size of the JPEG source image or tables-only datastream
|
||||
(in bytes)</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
</li>
|
||||
@@ -641,11 +661,11 @@ public void setJPEGImage(byte[] jpegImage,
|
||||
<li class="blockList">
|
||||
<h4>setSourceImage</h4>
|
||||
<pre>public void setSourceImage(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> srcImage)</pre>
|
||||
<div class="block">Associate the specified YUV planar source image with this decompressor
|
||||
instance. Subsequent decompress operations will decode this image into an
|
||||
RGB or grayscale destination image.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing a YUV planar image to
|
||||
be decoded. This image is not modified.</dd></dl>
|
||||
<div class="block">Associate the specified planar YUV source image with this decompressor
|
||||
instance. Subsequent decompression operations will decode this image into
|
||||
a packed-pixel RGB or grayscale destination image.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing a planar YUV source
|
||||
image to be decoded. This image is not modified.</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="getWidth()">
|
||||
@@ -709,8 +729,8 @@ public void setJPEGImage(byte[] jpegImage,
|
||||
<li class="blockList">
|
||||
<h4>getJPEGBuf</h4>
|
||||
<pre>public byte[] getJPEGBuf()</pre>
|
||||
<div class="block">Returns the JPEG image buffer associated with this decompressor instance.</div>
|
||||
<dl><dt><span class="strong">Returns:</span></dt><dd>the JPEG image buffer associated with this decompressor instance.</dd></dl>
|
||||
<div class="block">Returns the JPEG buffer associated with this decompressor instance.</div>
|
||||
<dl><dt><span class="strong">Returns:</span></dt><dd>the JPEG buffer associated with this decompressor instance.</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="getJPEGSize()">
|
||||
@@ -738,12 +758,12 @@ public void setJPEGImage(byte[] jpegImage,
|
||||
decompressor can generate without exceeding the desired image width and
|
||||
height.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>desiredWidth</code> - desired width (in pixels) of the decompressed image.
|
||||
Setting this to 0 is the same as setting it to the width of the JPEG image
|
||||
(in other words, the width will not be considered when determining the
|
||||
scaled image size.)</dd><dd><code>desiredHeight</code> - desired height (in pixels) of the decompressed image.
|
||||
Setting this to 0 is the same as setting it to the width of the JPEG
|
||||
image. (In other words, the width will not be considered when determining
|
||||
the scaled image size.)</dd><dd><code>desiredHeight</code> - desired height (in pixels) of the decompressed image.
|
||||
Setting this to 0 is the same as setting it to the height of the JPEG
|
||||
image (in other words, the height will not be considered when determining
|
||||
the scaled image size.)</dd>
|
||||
image. (In other words, the height will not be considered when
|
||||
determining the scaled image size.)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the width of the largest scaled-down image that the TurboJPEG
|
||||
decompressor can generate without exceeding the desired image width and
|
||||
height.</dd></dl>
|
||||
@@ -761,12 +781,12 @@ public void setJPEGImage(byte[] jpegImage,
|
||||
decompressor can generate without exceeding the desired image width and
|
||||
height.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>desiredWidth</code> - desired width (in pixels) of the decompressed image.
|
||||
Setting this to 0 is the same as setting it to the width of the JPEG image
|
||||
(in other words, the width will not be considered when determining the
|
||||
scaled image size.)</dd><dd><code>desiredHeight</code> - desired height (in pixels) of the decompressed image.
|
||||
Setting this to 0 is the same as setting it to the width of the JPEG
|
||||
image. (In other words, the width will not be considered when determining
|
||||
the scaled image size.)</dd><dd><code>desiredHeight</code> - desired height (in pixels) of the decompressed image.
|
||||
Setting this to 0 is the same as setting it to the height of the JPEG
|
||||
image (in other words, the height will not be considered when determining
|
||||
the scaled image size.)</dd>
|
||||
image. (In other words, the height will not be considered when
|
||||
determining the scaled image size.)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the height of the largest scaled-down image that the TurboJPEG
|
||||
decompressor can generate without exceeding the desired image width and
|
||||
height.</dd></dl>
|
||||
@@ -787,25 +807,26 @@ public void setJPEGImage(byte[] jpegImage,
|
||||
int pixelFormat,
|
||||
int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Decompress the JPEG source image or decode the YUV source image associated
|
||||
with this decompressor instance and output a grayscale, RGB, or CMYK image
|
||||
to the given destination buffer.
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and output a packed-pixel
|
||||
grayscale, RGB, or CMYK image to the given destination buffer.
|
||||
<p>
|
||||
NOTE: The output image is fully recoverable if this method throws a
|
||||
NOTE: The destination image is fully recoverable if this method throws a
|
||||
non-fatal <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg"><code>TJException</code></a> (unless
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING"><code>TJ.FLAG_STOPONWARNING</code></a> is specified.)</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstBuf</code> - buffer that will receive the decompressed/decoded image.
|
||||
If the source image is a JPEG image, then this buffer should normally be
|
||||
<code>pitch * scaledHeight</code> bytes in size, where
|
||||
<code>scaledHeight</code> can be determined by calling <code>
|
||||
scalingFactor.<a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><code>getScaled</code></a>(jpegHeight)
|
||||
</code> with one of the scaling factors returned from <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()"><code>TJ.getScalingFactors()</code></a> or by calling <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int,%20int)"><code>getScaledHeight(int, int)</code></a>. If the
|
||||
source image is a YUV image, then this buffer should normally be
|
||||
<code>pitch * height</code> bytes in size, where <code>height</code> is
|
||||
the height of the YUV image. However, the buffer may also be larger than
|
||||
the dimensions of the source image, in which case the <code>x</code>,
|
||||
<code>y</code>, and <code>pitch</code> parameters can be used to specify
|
||||
the region into which the source image should be decompressed/decoded.</dd><dd><code>x</code> - x offset (in pixels) of the region in the destination image into
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstBuf</code> - buffer that will receive the packed-pixel
|
||||
decompressed/decoded image. If the source image is a JPEG image, then
|
||||
this buffer should normally be <code>pitch * scaledHeight</code> bytes in
|
||||
size, where <code>scaledHeight</code> can be determined by calling
|
||||
<code>scalingFactor.</code><a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><code>getScaled</code></a><code>(jpegHeight)</code>
|
||||
with one of the scaling factors returned from <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()"><code>TJ.getScalingFactors()</code></a>
|
||||
or by calling <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int,%20int)"><code>getScaledHeight(int, int)</code></a>. If the source image is a YUV
|
||||
image, then this buffer should normally be <code>pitch * height</code>
|
||||
bytes in size, where <code>height</code> is the height of the YUV image.
|
||||
However, the buffer may also be larger than the dimensions of the source
|
||||
image, in which case the <code>x</code>, <code>y</code>, and
|
||||
<code>pitch</code> parameters can be used to specify the region into which
|
||||
the source image should be decompressed/decoded.</dd><dd><code>x</code> - x offset (in pixels) of the region in the destination image into
|
||||
which the source image should be decompressed/decoded</dd><dd><code>y</code> - y offset (in pixels) of the region in the destination image into
|
||||
which the source image should be decompressed/decoded</dd><dd><code>desiredWidth</code> - If the source image is a JPEG image, then this
|
||||
specifies the desired width (in pixels) of the decompressed image (or
|
||||
@@ -813,27 +834,29 @@ public void setJPEGImage(byte[] jpegImage,
|
||||
than the source image dimensions, then TurboJPEG will use scaling in the
|
||||
JPEG decompressor to generate the largest possible image that will fit
|
||||
within the desired dimensions. Setting this to 0 is the same as setting
|
||||
it to the width of the JPEG image (in other words, the width will not be
|
||||
it to the width of the JPEG image. (In other words, the width will not be
|
||||
considered when determining the scaled image size.) This parameter is
|
||||
ignored if the source image is a YUV image.</dd><dd><code>pitch</code> - bytes per line of the destination image. Normally, this
|
||||
should be set to <code>scaledWidth * TJ.pixelSize(pixelFormat)</code> if
|
||||
the destination image is unpadded, but you can use this to, for instance,
|
||||
pad each line of the destination image to a 4-byte boundary or to
|
||||
decompress/decode the source image into a region of a larger image. NOTE:
|
||||
if the source image is a JPEG image, then <code>scaledWidth</code> can be
|
||||
determined by calling <code>
|
||||
scalingFactor.<a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><code>getScaled</code></a>(jpegWidth)
|
||||
</code> or by calling <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int,%20int)"><code>getScaledWidth(int, int)</code></a>. If the source image is a
|
||||
YUV image, then <code>scaledWidth</code> is the width of the YUV image.
|
||||
ignored if the source image is a YUV image.</dd><dd><code>pitch</code> - bytes per row in the destination image. Normally this should
|
||||
be set to <code>scaledWidth *
|
||||
</code><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getPixelSize(int)"><code>TJ.getPixelSize</code></a><code>(pixelFormat)</code>,
|
||||
if the destination image will be unpadded. However, you can use this to,
|
||||
for instance, pad each row of the destination image to the nearest
|
||||
multiple of 4 bytes or to decompress/decode the source image into a region
|
||||
of a larger image. NOTE: if the source image is a JPEG image, then
|
||||
<code>scaledWidth</code> can be determined by calling
|
||||
<code>scalingFactor.</code><a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><code>getScaled</code></a><code>(jpegWidth)</code>
|
||||
or by calling <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int,%20int)"><code>getScaledWidth(int, int)</code></a>. If the source image is a YUV
|
||||
image, then <code>scaledWidth</code> is the width of the YUV image.
|
||||
Setting this parameter to 0 is the equivalent of setting it to
|
||||
<code>scaledWidth * TJ.pixelSize(pixelFormat)</code>.</dd><dd><code>desiredHeight</code> - If the source image is a JPEG image, then this
|
||||
<code>scaledWidth *
|
||||
</code><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getPixelSize(int)"><code>TJ.getPixelSize</code></a><code>(pixelFormat)</code>.</dd><dd><code>desiredHeight</code> - If the source image is a JPEG image, then this
|
||||
specifies the desired height (in pixels) of the decompressed image (or
|
||||
image region.) If the desired destination image dimensions are different
|
||||
than the source image dimensions, then TurboJPEG will use scaling in the
|
||||
JPEG decompressor to generate the largest possible image that will fit
|
||||
within the desired dimensions. Setting this to 0 is the same as setting
|
||||
it to the height of the JPEG image (in other words, the height will not be
|
||||
considered when determining the scaled image size.) This parameter is
|
||||
it to the height of the JPEG image. (In other words, the height will not
|
||||
be considered when determining the scaled image size.) This parameter is
|
||||
ignored if the source image is a YUV image.</dd><dd><code>pixelFormat</code> - pixel format of the decompressed/decoded image (one of
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB"><code>TJ.PF_*</code></a>)</dd><dd><code>flags</code> - the bitwise OR of one or more of
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
|
||||
@@ -873,8 +896,9 @@ public void decompress(byte[] dstBuf,
|
||||
int pixelFormat,
|
||||
int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Decompress the JPEG source image associated with this decompressor
|
||||
instance and return a buffer containing the decompressed image.</div>
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and return a buffer containing
|
||||
the packed-pixel decompressed image.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>desiredWidth</code> - see
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)"><code>decompress(byte[], int, int, int, int, int, int, int)</code></a>
|
||||
for description</dd><dd><code>pitch</code> - see
|
||||
@@ -884,7 +908,7 @@ public void decompress(byte[] dstBuf,
|
||||
for description</dd><dd><code>pixelFormat</code> - pixel format of the decompressed image (one of
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB"><code>TJ.PF_*</code></a>)</dd><dd><code>flags</code> - the bitwise OR of one or more of
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>a buffer containing the decompressed image.</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>a buffer containing the packed-pixel decompressed image.</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
</li>
|
||||
@@ -899,21 +923,21 @@ public void decompress(byte[] dstBuf,
|
||||
int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Decompress the JPEG source image associated with this decompressor
|
||||
instance into a YUV planar image and store it in the given
|
||||
<code>YUVImage</code> instance. This method performs JPEG decompression
|
||||
but leaves out the color conversion step, so a planar YUV image is
|
||||
generated instead of an RGB or grayscale image. This method cannot be
|
||||
used to decompress JPEG source images with the CMYK or YCCK colorspace.
|
||||
instance into a planar YUV image and store it in the given
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance. This method performs JPEG decompression but
|
||||
leaves out the color conversion step, so a planar YUV image is generated
|
||||
instead of a packed-pixel image. This method cannot be used to decompress
|
||||
JPEG source images with the CMYK or YCCK colorspace.
|
||||
<p>
|
||||
NOTE: The YUV planar output image is fully recoverable if this method
|
||||
NOTE: The planar YUV destination image is fully recoverable if this method
|
||||
throws a non-fatal <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg"><code>TJException</code></a> (unless
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING"><code>TJ.FLAG_STOPONWARNING</code></a> is specified.)</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstImage</code> - <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance that will receive the YUV planar
|
||||
image. The level of subsampling specified in this <code>YUVImage</code>
|
||||
instance must match that of the JPEG image, and the width and height
|
||||
specified in the <code>YUVImage</code> instance must match one of the
|
||||
scaled image sizes that TurboJPEG is capable of generating from the JPEG
|
||||
source image.</dd><dd><code>flags</code> - the bitwise OR of one or more of
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstImage</code> - <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance that will receive the planar YUV
|
||||
decompressed image. The level of subsampling specified in this
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance must match that of the JPEG image, and the width
|
||||
and height specified in the <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance must match one of
|
||||
the scaled image sizes that the decompressor is capable of generating from
|
||||
the JPEG source image.</dd><dd><code>flags</code> - the bitwise OR of one or more of
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
@@ -947,32 +971,33 @@ public void decompressToYUV(byte[] dstBuf,
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Decompress the JPEG source image associated with this decompressor
|
||||
instance into a set of Y, U (Cb), and V (Cr) image planes and return a
|
||||
<code>YUVImage</code> instance containing the decompressed image planes.
|
||||
This method performs JPEG decompression but leaves out the color
|
||||
conversion step, so a planar YUV image is generated instead of an RGB or
|
||||
grayscale image. This method cannot be used to decompress JPEG source
|
||||
images with the CMYK or YCCK colorspace.</div>
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing the decompressed image planes. This
|
||||
method performs JPEG decompression but leaves out the color conversion
|
||||
step, so a planar YUV image is generated instead of a packed-pixel image.
|
||||
This method cannot be used to decompress JPEG source images with the CMYK
|
||||
or YCCK colorspace.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>desiredWidth</code> - desired width (in pixels) of the YUV image. If the
|
||||
desired image dimensions are different than the dimensions of the JPEG
|
||||
image being decompressed, then TurboJPEG will use scaling in the JPEG
|
||||
decompressor to generate the largest possible image that will fit within
|
||||
the desired dimensions. Setting this to 0 is the same as setting it to
|
||||
the width of the JPEG image (in other words, the width will not be
|
||||
the width of the JPEG image. (In other words, the width will not be
|
||||
considered when determining the scaled image size.)</dd><dd><code>strides</code> - an array of integers, each specifying the number of bytes
|
||||
per line in the corresponding plane of the output image. Setting the
|
||||
stride for any plane to 0 is the same as setting it to the scaled
|
||||
component width of the plane. If <tt>strides</tt> is NULL, then the
|
||||
strides for all planes will be set to their respective scaled component
|
||||
widths. You can adjust the strides in order to add an arbitrary amount of
|
||||
line padding to each plane.</dd><dd><code>desiredHeight</code> - desired height (in pixels) of the YUV image. If the
|
||||
per row in the corresponding plane of the YUV image. Setting the stride
|
||||
for any plane to 0 is the same as setting it to the scaled plane width
|
||||
(see <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a>.) If <code>strides</code> is null, then the strides
|
||||
for all planes will be set to their respective scaled plane widths. You
|
||||
can adjust the strides in order to add an arbitrary amount of row padding
|
||||
to each plane.</dd><dd><code>desiredHeight</code> - desired height (in pixels) of the YUV image. If the
|
||||
desired image dimensions are different than the dimensions of the JPEG
|
||||
image being decompressed, then TurboJPEG will use scaling in the JPEG
|
||||
decompressor to generate the largest possible image that will fit within
|
||||
the desired dimensions. Setting this to 0 is the same as setting it to
|
||||
the height of the JPEG image (in other words, the height will not be
|
||||
the height of the JPEG image. (In other words, the height will not be
|
||||
considered when determining the scaled image size.)</dd><dd><code>flags</code> - the bitwise OR of one or more of
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>a YUV planar image.</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>a <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing the decompressed image
|
||||
planes</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
</li>
|
||||
@@ -984,34 +1009,34 @@ public void decompressToYUV(byte[] dstBuf,
|
||||
<li class="blockList">
|
||||
<h4>decompressToYUV</h4>
|
||||
<pre>public <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> decompressToYUV(int desiredWidth,
|
||||
int pad,
|
||||
int align,
|
||||
int desiredHeight,
|
||||
int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Decompress the JPEG source image associated with this decompressor
|
||||
instance into a unified YUV planar image buffer and return a
|
||||
<code>YUVImage</code> instance containing the decompressed image. This
|
||||
method performs JPEG decompression but leaves out the color conversion
|
||||
step, so a planar YUV image is generated instead of an RGB or grayscale
|
||||
image. This method cannot be used to decompress JPEG source images with
|
||||
the CMYK or YCCK colorspace.</div>
|
||||
instance into a unified planar YUV image and return a <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a>
|
||||
instance containing the decompressed image. This method performs JPEG
|
||||
decompression but leaves out the color conversion step, so a planar YUV
|
||||
image is generated instead of a packed-pixel image. This method cannot be
|
||||
used to decompress JPEG source images with the CMYK or YCCK colorspace.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>desiredWidth</code> - desired width (in pixels) of the YUV image. If the
|
||||
desired image dimensions are different than the dimensions of the JPEG
|
||||
image being decompressed, then TurboJPEG will use scaling in the JPEG
|
||||
decompressor to generate the largest possible image that will fit within
|
||||
the desired dimensions. Setting this to 0 is the same as setting it to
|
||||
the width of the JPEG image (in other words, the width will not be
|
||||
considered when determining the scaled image size.)</dd><dd><code>pad</code> - the width of each line in each plane of the YUV image will be
|
||||
padded to the nearest multiple of this number of bytes (must be a power of
|
||||
2.)</dd><dd><code>desiredHeight</code> - desired height (in pixels) of the YUV image. If the
|
||||
the width of the JPEG image. (In other words, the width will not be
|
||||
considered when determining the scaled image size.)</dd><dd><code>align</code> - row alignment (in bytes) of the YUV image (must be a power of
|
||||
2.) Setting this parameter to n will cause each row in each plane of the
|
||||
YUV image to be padded to the nearest multiple of n bytes (1 = unpadded.)</dd><dd><code>desiredHeight</code> - desired height (in pixels) of the YUV image. If the
|
||||
desired image dimensions are different than the dimensions of the JPEG
|
||||
image being decompressed, then TurboJPEG will use scaling in the JPEG
|
||||
decompressor to generate the largest possible image that will fit within
|
||||
the desired dimensions. Setting this to 0 is the same as setting it to
|
||||
the height of the JPEG image (in other words, the height will not be
|
||||
the height of the JPEG image. (In other words, the height will not be
|
||||
considered when determining the scaled image size.)</dd><dd><code>flags</code> - the bitwise OR of one or more of
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>a YUV planar image.</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>a <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing the unified planar YUV
|
||||
decompressed image</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
</li>
|
||||
@@ -1045,25 +1070,26 @@ public byte[] decompressToYUV(int flags)
|
||||
int pixelFormat,
|
||||
int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Decompress the JPEG source image or decode the YUV source image associated
|
||||
with this decompressor instance and output a grayscale, RGB, or CMYK image
|
||||
to the given destination buffer.
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and output a packed-pixel
|
||||
grayscale, RGB, or CMYK image to the given destination buffer.
|
||||
<p>
|
||||
NOTE: The output image is fully recoverable if this method throws a
|
||||
NOTE: The destination image is fully recoverable if this method throws a
|
||||
non-fatal <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg"><code>TJException</code></a> (unless
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING"><code>TJ.FLAG_STOPONWARNING</code></a> is specified.)</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstBuf</code> - buffer that will receive the decompressed/decoded image.
|
||||
If the source image is a JPEG image, then this buffer should normally be
|
||||
<code>stride * scaledHeight</code> pixels in size, where
|
||||
<code>scaledHeight</code> can be determined by calling <code>
|
||||
scalingFactor.<a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><code>getScaled</code></a>(jpegHeight)
|
||||
</code> with one of the scaling factors returned from <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()"><code>TJ.getScalingFactors()</code></a> or by calling <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int,%20int)"><code>getScaledHeight(int, int)</code></a>. If the
|
||||
source image is a YUV image, then this buffer should normally be
|
||||
<code>stride * height</code> pixels in size, where <code>height</code> is
|
||||
the height of the YUV image. However, the buffer may also be larger than
|
||||
the dimensions of the JPEG image, in which case the <code>x</code>,
|
||||
<code>y</code>, and <code>stride</code> parameters can be used to specify
|
||||
the region into which the source image should be decompressed.</dd><dd><code>x</code> - x offset (in pixels) of the region in the destination image into
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstBuf</code> - buffer that will receive the packed-pixel
|
||||
decompressed/decoded image. If the source image is a JPEG image, then
|
||||
this buffer should normally be <code>stride * scaledHeight</code> pixels
|
||||
in size, where <code>scaledHeight</code> can be determined by calling
|
||||
<code>scalingFactor.</code><a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><code>getScaled</code></a><code>(jpegHeight)</code>
|
||||
with one of the scaling factors returned from <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()"><code>TJ.getScalingFactors()</code></a>
|
||||
or by calling <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int,%20int)"><code>getScaledHeight(int, int)</code></a>. If the source image is a YUV
|
||||
image, then this buffer should normally be <code>stride * height</code>
|
||||
pixels in size, where <code>height</code> is the height of the YUV image.
|
||||
However, the buffer may also be larger than the dimensions of the JPEG
|
||||
image, in which case the <code>x</code>, <code>y</code>, and
|
||||
<code>stride</code> parameters can be used to specify the region into
|
||||
which the source image should be decompressed.</dd><dd><code>x</code> - x offset (in pixels) of the region in the destination image into
|
||||
which the source image should be decompressed/decoded</dd><dd><code>y</code> - y offset (in pixels) of the region in the destination image into
|
||||
which the source image should be decompressed/decoded</dd><dd><code>desiredWidth</code> - If the source image is a JPEG image, then this
|
||||
specifies the desired width (in pixels) of the decompressed image (or
|
||||
@@ -1071,16 +1097,16 @@ public byte[] decompressToYUV(int flags)
|
||||
than the source image dimensions, then TurboJPEG will use scaling in the
|
||||
JPEG decompressor to generate the largest possible image that will fit
|
||||
within the desired dimensions. Setting this to 0 is the same as setting
|
||||
it to the width of the JPEG image (in other words, the width will not be
|
||||
it to the width of the JPEG image. (In other words, the width will not be
|
||||
considered when determining the scaled image size.) This parameter is
|
||||
ignored if the source image is a YUV image.</dd><dd><code>stride</code> - pixels per line of the destination image. Normally, this
|
||||
ignored if the source image is a YUV image.</dd><dd><code>stride</code> - pixels per row in the destination image. Normally this
|
||||
should be set to <code>scaledWidth</code>, but you can use this to, for
|
||||
instance, decompress the JPEG image into a region of a larger image.
|
||||
NOTE: if the source image is a JPEG image, then <code>scaledWidth</code>
|
||||
can be determined by calling <code>
|
||||
scalingFactor.<a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><code>getScaled</code></a>(jpegWidth)
|
||||
</code> or by calling <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int,%20int)"><code>getScaledWidth(int, int)</code></a>. If the source image is a
|
||||
YUV image, then <code>scaledWidth</code> is the width of the YUV image.
|
||||
can be determined by calling
|
||||
<code>scalingFactor.</code><a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><code>getScaled</code></a><code>(jpegWidth)</code>
|
||||
or by calling <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int,%20int)"><code>getScaledWidth(int, int)</code></a>. If the source image is a YUV
|
||||
image, then <code>scaledWidth</code> is the width of the YUV image.
|
||||
Setting this parameter to 0 is the equivalent of setting it to
|
||||
<code>scaledWidth</code>.</dd><dd><code>desiredHeight</code> - If the source image is a JPEG image, then this
|
||||
specifies the desired height (in pixels) of the decompressed image (or
|
||||
@@ -1088,8 +1114,8 @@ public byte[] decompressToYUV(int flags)
|
||||
than the source image dimensions, then TurboJPEG will use scaling in the
|
||||
JPEG decompressor to generate the largest possible image that will fit
|
||||
within the desired dimensions. Setting this to 0 is the same as setting
|
||||
it to the height of the JPEG image (in other words, the height will not be
|
||||
considered when determining the scaled image size.) This parameter is
|
||||
it to the height of the JPEG image. (In other words, the height will not
|
||||
be considered when determining the scaled image size.) This parameter is
|
||||
ignored if the source image is a YUV image.</dd><dd><code>pixelFormat</code> - pixel format of the decompressed image (one of
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB"><code>TJ.PF_*</code></a>)</dd><dd><code>flags</code> - the bitwise OR of one or more of
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
|
||||
@@ -1106,20 +1132,21 @@ public byte[] decompressToYUV(int flags)
|
||||
<pre>public void decompress(java.awt.image.BufferedImage dstImage,
|
||||
int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Decompress the JPEG source image or decode the YUV source image associated
|
||||
with this decompressor instance and output a decompressed/decoded image to
|
||||
the given <code>BufferedImage</code> instance.
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and output a packed-pixel
|
||||
decompressed/decoded image to the given <code>BufferedImage</code>
|
||||
instance.
|
||||
<p>
|
||||
NOTE: The output image is fully recoverable if this method throws a
|
||||
NOTE: The destination image is fully recoverable if this method throws a
|
||||
non-fatal <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg"><code>TJException</code></a> (unless
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING"><code>TJ.FLAG_STOPONWARNING</code></a> is specified.)</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstImage</code> - a <code>BufferedImage</code> instance that will receive
|
||||
the decompressed/decoded image. If the source image is a JPEG image, then
|
||||
the width and height of the <code>BufferedImage</code> instance must match
|
||||
one of the scaled image sizes that TurboJPEG is capable of generating from
|
||||
the JPEG image. If the source image is a YUV image, then the width and
|
||||
height of the <code>BufferedImage</code> instance must match the width and
|
||||
height of the YUV image.</dd><dd><code>flags</code> - the bitwise OR of one or more of
|
||||
the packed-pixel decompressed/decoded image. If the source image is a
|
||||
JPEG image, then the width and height of the <code>BufferedImage</code>
|
||||
instance must match one of the scaled image sizes that the decompressor is
|
||||
capable of generating from the JPEG image. If the source image is a YUV
|
||||
image, then the width and height of the <code>BufferedImage</code>
|
||||
instance must match the width and height of the YUV image.</dd><dd><code>flags</code> - the bitwise OR of one or more of
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
@@ -1136,9 +1163,10 @@ public byte[] decompressToYUV(int flags)
|
||||
int bufferedImageType,
|
||||
int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Decompress the JPEG source image or decode the YUV source image associated
|
||||
with this decompressor instance and return a <code>BufferedImage</code>
|
||||
instance containing the decompressed/decoded image.</div>
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and return a
|
||||
<code>BufferedImage</code> instance containing the packed-pixel
|
||||
decompressed/decoded image.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>desiredWidth</code> - see
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)"><code>decompress(byte[], int, int, int, int, int, int, int)</code></a> for
|
||||
description</dd><dd><code>desiredHeight</code> - see
|
||||
@@ -1147,7 +1175,7 @@ public byte[] decompressToYUV(int flags)
|
||||
instance that will be created (for instance,
|
||||
<code>BufferedImage.TYPE_INT_RGB</code>)</dd><dd><code>flags</code> - the bitwise OR of one or more of
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>a <code>BufferedImage</code> instance containing the
|
||||
<dt><span class="strong">Returns:</span></dt><dd>a <code>BufferedImage</code> instance containing the packed-pixel
|
||||
decompressed/decoded image.</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
|
||||
@@ -167,7 +167,7 @@ extends java.awt.Rectangle</pre>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#op">op</a></strong></code>
|
||||
<div class="block">Transform operation (one of <code>OP_*</code>)</div>
|
||||
<div class="block">Transform operation (one of <a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OP_NONE"><code>OP_*</code></a>)</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
@@ -223,7 +223,7 @@ extends java.awt.Rectangle</pre>
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_COPYNONE">OPT_COPYNONE</a></strong></code>
|
||||
<div class="block">This option will prevent <a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)"><code>TJTransformer.transform()</code></a> from copying any extra markers (including EXIF
|
||||
and ICC profile data) from the source image to the output image.</div>
|
||||
and ICC profile data) from the source image to the destination image.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
@@ -235,8 +235,8 @@ extends java.awt.Rectangle</pre>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_GRAY">OPT_GRAY</a></strong></code>
|
||||
<div class="block">This option will discard the color data in the input image and produce
|
||||
a grayscale output image.</div>
|
||||
<div class="block">This option will discard the color data in the source image and produce a
|
||||
grayscale destination image.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
@@ -256,7 +256,7 @@ extends java.awt.Rectangle</pre>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PROGRESSIVE">OPT_PROGRESSIVE</a></strong></code>
|
||||
<div class="block">This option will enable progressive entropy coding in the output image
|
||||
<div class="block">This option will enable progressive entropy coding in the JPEG image
|
||||
generated by this particular transform.</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -270,7 +270,8 @@ extends java.awt.Rectangle</pre>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#options">options</a></strong></code>
|
||||
<div class="block">Transform options (bitwise OR of one or more of <code>OPT_*</code>)</div>
|
||||
<div class="block">Transform options (bitwise OR of one or more of
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT"><code>OPT_*</code></a>)</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -547,8 +548,8 @@ extends java.awt.Rectangle</pre>
|
||||
<li class="blockList">
|
||||
<h4>OPT_GRAY</h4>
|
||||
<pre>public static final int OPT_GRAY</pre>
|
||||
<div class="block">This option will discard the color data in the input image and produce
|
||||
a grayscale output image.</div>
|
||||
<div class="block">This option will discard the color data in the source image and produce a
|
||||
grayscale destination image.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJTransform.OPT_GRAY">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -573,11 +574,10 @@ extends java.awt.Rectangle</pre>
|
||||
<li class="blockList">
|
||||
<h4>OPT_PROGRESSIVE</h4>
|
||||
<pre>public static final int OPT_PROGRESSIVE</pre>
|
||||
<div class="block">This option will enable progressive entropy coding in the output image
|
||||
<div class="block">This option will enable progressive entropy coding in the JPEG image
|
||||
generated by this particular transform. Progressive entropy coding will
|
||||
generally improve compression relative to baseline entropy coding (the
|
||||
default), but it will reduce compression and decompression performance
|
||||
considerably.</div>
|
||||
default), but it will reduce decompression performance considerably.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJTransform.OPT_PROGRESSIVE">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -589,7 +589,7 @@ extends java.awt.Rectangle</pre>
|
||||
<h4>OPT_COPYNONE</h4>
|
||||
<pre>public static final int OPT_COPYNONE</pre>
|
||||
<div class="block">This option will prevent <a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)"><code>TJTransformer.transform()</code></a> from copying any extra markers (including EXIF
|
||||
and ICC profile data) from the source image to the output image.</div>
|
||||
and ICC profile data) from the source image to the destination image.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJTransform.OPT_COPYNONE">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -600,7 +600,7 @@ extends java.awt.Rectangle</pre>
|
||||
<li class="blockList">
|
||||
<h4>op</h4>
|
||||
<pre>public int op</pre>
|
||||
<div class="block">Transform operation (one of <code>OP_*</code>)</div>
|
||||
<div class="block">Transform operation (one of <a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OP_NONE"><code>OP_*</code></a>)</div>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="options">
|
||||
@@ -610,7 +610,8 @@ extends java.awt.Rectangle</pre>
|
||||
<li class="blockList">
|
||||
<h4>options</h4>
|
||||
<pre>public int options</pre>
|
||||
<div class="block">Transform options (bitwise OR of one or more of <code>OPT_*</code>)</div>
|
||||
<div class="block">Transform options (bitwise OR of one or more of
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT"><code>OPT_*</code></a>)</div>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="cf">
|
||||
@@ -661,8 +662,8 @@ extends java.awt.Rectangle</pre>
|
||||
equivalent of setting it to (width of the source JPEG image -
|
||||
<code>x</code>).</dd><dd><code>h</code> - the height of the cropping region. Setting this to 0 is the
|
||||
equivalent of setting it to (height of the source JPEG image -
|
||||
<code>y</code>).</dd><dd><code>op</code> - one of the transform operations (<code>OP_*</code>)</dd><dd><code>options</code> - the bitwise OR of one or more of the transform options
|
||||
(<code>OPT_*</code>)</dd><dd><code>cf</code> - an instance of an object that implements the <a href="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg"><code>TJCustomFilter</code></a> interface, or null if no custom filter is needed</dd></dl>
|
||||
<code>y</code>).</dd><dd><code>op</code> - one of the transform operations (<a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OP_NONE"><code>OP_*</code></a>)</dd><dd><code>options</code> - the bitwise OR of one or more of the transform options
|
||||
(<a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT"><code>OPT_*</code></a>)</dd><dd><code>cf</code> - an instance of an object that implements the <a href="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg"><code>TJCustomFilter</code></a> interface, or null if no custom filter is needed</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="TJTransform(java.awt.Rectangle, int, int, org.libjpegturbo.turbojpeg.TJCustomFilter)">
|
||||
@@ -678,8 +679,8 @@ extends java.awt.Rectangle</pre>
|
||||
<div class="block">Create a new lossless transform instance with the given parameters.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>r</code> - a <code>Rectangle</code> instance that specifies the cropping
|
||||
region. See <a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#TJTransform(int,%20int,%20int,%20int,%20int,%20int,%20org.libjpegturbo.turbojpeg.TJCustomFilter)"><code>TJTransform(int, int, int, int, int, int, TJCustomFilter)</code></a> for more
|
||||
detail.</dd><dd><code>op</code> - one of the transform operations (<code>OP_*</code>)</dd><dd><code>options</code> - the bitwise OR of one or more of the transform options
|
||||
(<code>OPT_*</code>)</dd><dd><code>cf</code> - an instance of an object that implements the <a href="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg"><code>TJCustomFilter</code></a> interface, or null if no custom filter is needed</dd></dl>
|
||||
detail.</dd><dd><code>op</code> - one of the transform operations (<a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OP_NONE"><code>OP_*</code></a>)</dd><dd><code>options</code> - the bitwise OR of one or more of the transform options
|
||||
(<a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT"><code>OPT_*</code></a>)</dd><dd><code>cf</code> - an instance of an object that implements the <a href="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg"><code>TJCustomFilter</code></a> interface, or null if no custom filter is needed</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -148,14 +148,15 @@ extends <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title=
|
||||
<tr class="rowColor">
|
||||
<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#TJTransformer(byte[])">TJTransformer</a></strong>(byte[] jpegImage)</code>
|
||||
<div class="block">Create a TurboJPEG lossless transformer instance and associate the JPEG
|
||||
image stored in <code>jpegImage</code> with the newly created instance.</div>
|
||||
source image stored in <code>jpegImage</code> with the newly created
|
||||
instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#TJTransformer(byte[],%20int)">TJTransformer</a></strong>(byte[] jpegImage,
|
||||
int imageSize)</code>
|
||||
<div class="block">Create a TurboJPEG lossless transformer instance and associate the JPEG
|
||||
image of length <code>imageSize</code> bytes stored in
|
||||
source image of length <code>imageSize</code> bytes stored in
|
||||
<code>jpegImage</code> with the newly created instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -178,7 +179,7 @@ extends <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title=
|
||||
<td class="colFirst"><code>int[]</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#getTransformedSizes()">getTransformedSizes</a></strong>()</code>
|
||||
<div class="block">Returns an array containing the sizes of the transformed JPEG images
|
||||
generated by the most recent transform operation.</div>
|
||||
(in bytes) generated by the most recent transform operation.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
@@ -186,18 +187,18 @@ extends <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title=
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)">transform</a></strong>(byte[][] dstBufs,
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a>[] transforms,
|
||||
int flags)</code>
|
||||
<div class="block">Losslessly transform the JPEG image associated with this transformer
|
||||
instance into one or more JPEG images stored in the given destination
|
||||
buffers.</div>
|
||||
<div class="block">Losslessly transform the JPEG source image associated with this
|
||||
transformer instance into one or more JPEG images stored in the given
|
||||
destination buffers.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a>[]</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(org.libjpegturbo.turbojpeg.TJTransform[],%20int)">transform</a></strong>(<a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a>[] transforms,
|
||||
int flags)</code>
|
||||
<div class="block">Losslessly transform the JPEG image associated with this transformer
|
||||
instance and return an array of <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><code>TJDecompressor</code></a> instances, each of
|
||||
which has a transformed JPEG image associated with it.</div>
|
||||
<div class="block">Losslessly transform the JPEG source image associated with this
|
||||
transformer instance and return an array of <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><code>TJDecompressor</code></a>
|
||||
instances, each of which has a transformed JPEG image associated with it.</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -251,9 +252,11 @@ extends <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title=
|
||||
<pre>public TJTransformer(byte[] jpegImage)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Create a TurboJPEG lossless transformer instance and associate the JPEG
|
||||
image stored in <code>jpegImage</code> with the newly created instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - JPEG image buffer (size of the JPEG image is assumed to
|
||||
be the length of the array.) This buffer is not modified.</dd>
|
||||
source image stored in <code>jpegImage</code> with the newly created
|
||||
instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - buffer containing the JPEG source image to transform.
|
||||
(The size of the JPEG image is assumed to be the length of the array.)
|
||||
This buffer is not modified.</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
</li>
|
||||
@@ -268,9 +271,10 @@ extends <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title=
|
||||
int imageSize)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Create a TurboJPEG lossless transformer instance and associate the JPEG
|
||||
image of length <code>imageSize</code> bytes stored in
|
||||
source image of length <code>imageSize</code> bytes stored in
|
||||
<code>jpegImage</code> with the newly created instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - JPEG image buffer. This buffer is not modified.</dd><dd><code>imageSize</code> - size of the JPEG image (in bytes)</dd>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - buffer containing the JPEG source image to transform.
|
||||
This buffer is not modified.</dd><dd><code>imageSize</code> - size of the JPEG source image (in bytes)</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
</li>
|
||||
@@ -293,25 +297,26 @@ extends <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title=
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a>[] transforms,
|
||||
int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Losslessly transform the JPEG image associated with this transformer
|
||||
instance into one or more JPEG images stored in the given destination
|
||||
buffers. Lossless transforms work by moving the raw coefficients from one
|
||||
JPEG image structure to another without altering the values of the
|
||||
coefficients. While this is typically faster than decompressing the
|
||||
image, transforming it, and re-compressing it, lossless transforms are not
|
||||
free. Each lossless transform requires reading and performing Huffman
|
||||
decoding on all of the coefficients in the source image, regardless of the
|
||||
size of the destination image. Thus, this method provides a means of
|
||||
generating multiple transformed images from the same source or of applying
|
||||
multiple transformations simultaneously, in order to eliminate the need to
|
||||
read the source coefficients multiple times.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstBufs</code> - an array of image buffers. <code>dstbufs[i]</code> will
|
||||
receive a JPEG image that has been transformed using the parameters in
|
||||
<code>transforms[i]</code>. Use <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSize(int,%20int,%20int)"><code>TJ.bufSize(int, int, int)</code></a> to determine the
|
||||
maximum size for each buffer based on the transformed or cropped width and
|
||||
height and the level of subsampling used in the source image.</dd><dd><code>transforms</code> - an array of <a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><code>TJTransform</code></a> instances, each of
|
||||
<div class="block">Losslessly transform the JPEG source image associated with this
|
||||
transformer instance into one or more JPEG images stored in the given
|
||||
destination buffers. Lossless transforms work by moving the raw
|
||||
coefficients from one JPEG image structure to another without altering the
|
||||
values of the coefficients. While this is typically faster than
|
||||
decompressing the image, transforming it, and re-compressing it, lossless
|
||||
transforms are not free. Each lossless transform requires reading and
|
||||
performing Huffman decoding on all of the coefficients in the source
|
||||
image, regardless of the size of the destination image. Thus, this method
|
||||
provides a means of generating multiple transformed images from the same
|
||||
source or of applying multiple transformations simultaneously, in order to
|
||||
eliminate the need to read the source coefficients multiple times.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstBufs</code> - an array of JPEG destination buffers.
|
||||
<code>dstbufs[i]</code> will receive a JPEG image that has been
|
||||
transformed using the parameters in <code>transforms[i]</code>. Use
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSize(int,%20int,%20int)"><code>TJ.bufSize(int, int, int)</code></a> to determine the maximum size for each buffer based on
|
||||
the transformed or cropped width and height and the level of subsampling
|
||||
used in the source image.</dd><dd><code>transforms</code> - an array of <a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><code>TJTransform</code></a> instances, each of
|
||||
which specifies the transform parameters and/or cropping region for the
|
||||
corresponding transformed output image</dd><dd><code>flags</code> - the bitwise OR of one or more of
|
||||
corresponding transformed JPEG image</dd><dd><code>flags</code> - the bitwise OR of one or more of
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
@@ -326,12 +331,12 @@ extends <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title=
|
||||
<pre>public <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a>[] transform(<a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a>[] transforms,
|
||||
int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Losslessly transform the JPEG image associated with this transformer
|
||||
instance and return an array of <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><code>TJDecompressor</code></a> instances, each of
|
||||
which has a transformed JPEG image associated with it.</div>
|
||||
<div class="block">Losslessly transform the JPEG source image associated with this
|
||||
transformer instance and return an array of <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><code>TJDecompressor</code></a>
|
||||
instances, each of which has a transformed JPEG image associated with it.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>transforms</code> - an array of <a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><code>TJTransform</code></a> instances, each of
|
||||
which specifies the transform parameters and/or cropping region for the
|
||||
corresponding transformed output image</dd><dd><code>flags</code> - the bitwise OR of one or more of
|
||||
corresponding transformed JPEG image</dd><dd><code>flags</code> - the bitwise OR of one or more of
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>an array of <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><code>TJDecompressor</code></a> instances, each of
|
||||
which has a transformed JPEG image associated with it.</dd>
|
||||
@@ -347,9 +352,9 @@ extends <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title=
|
||||
<h4>getTransformedSizes</h4>
|
||||
<pre>public int[] getTransformedSizes()</pre>
|
||||
<div class="block">Returns an array containing the sizes of the transformed JPEG images
|
||||
generated by the most recent transform operation.</div>
|
||||
(in bytes) generated by the most recent transform operation.</div>
|
||||
<dl><dt><span class="strong">Returns:</span></dt><dd>an array containing the sizes of the transformed JPEG images
|
||||
generated by the most recent transform operation.</dd></dl>
|
||||
(in bytes) generated by the most recent transform operation.</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
<br>
|
||||
<pre>public class <span class="strong">YUVImage</span>
|
||||
extends java.lang.Object</pre>
|
||||
<div class="block">This class encapsulates a YUV planar image and the metadata
|
||||
<div class="block">This class encapsulates a planar YUV image and the metadata
|
||||
associated with it. The TurboJPEG API allows both the JPEG compression and
|
||||
decompression pipelines to be split into stages: YUV encode, compress from
|
||||
YUV, decompress to YUV, and YUV decode. A <code>YUVImage</code> instance
|
||||
@@ -106,30 +106,32 @@ extends java.lang.Object</pre>
|
||||
operations and as the source image for compress-from-YUV and YUV decode
|
||||
operations.
|
||||
<p>
|
||||
Technically, the JPEG format uses the YCbCr colorspace (which technically is
|
||||
not a "colorspace" but rather a "color transform"), but per the convention
|
||||
of the digital video community, the TurboJPEG API uses "YUV" to refer to an
|
||||
image format consisting of Y, Cb, and Cr image planes.
|
||||
Technically, the JPEG format uses the YCbCr colorspace (which is technically
|
||||
not a colorspace but a color transform), but per the convention of the
|
||||
digital video community, the TurboJPEG API uses "YUV" to refer to an image
|
||||
format consisting of Y, Cb, and Cr image planes.
|
||||
<p>
|
||||
Each plane is simply a 2D array of bytes, each byte representing the value
|
||||
of one of the components (Y, Cb, or Cr) at a particular location in the
|
||||
image. The width and height of each plane are determined by the image
|
||||
width, height, and level of chrominance subsampling. The luminance plane
|
||||
width is the image width padded to the nearest multiple of the horizontal
|
||||
subsampling factor (2 in the case of 4:2:0 and 4:2:2, 4 in the case of
|
||||
4:1:1, 1 in the case of 4:4:4 or grayscale.) Similarly, the luminance plane
|
||||
height is the image height padded to the nearest multiple of the vertical
|
||||
subsampling factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4
|
||||
or grayscale.) The chrominance plane width is equal to the luminance plane
|
||||
width divided by the horizontal subsampling factor, and the chrominance
|
||||
plane height is equal to the luminance plane height divided by the vertical
|
||||
subsampling factor.
|
||||
subsampling factor (1 in the case of 4:4:4, grayscale, or 4:4:0; 2 in the
|
||||
case of 4:2:2 or 4:2:0; 4 in the case of 4:1:1.) Similarly, the luminance
|
||||
plane height is the image height padded to the nearest multiple of the
|
||||
vertical subsampling factor (1 in the case of 4:4:4, 4:2:2, grayscale, or
|
||||
4:1:1; 2 in the case of 4:2:0 or 4:4:0.) This is irrespective of any
|
||||
additional padding that may be specified as an argument to the various
|
||||
YUVImage methods. The chrominance plane width is equal to the luminance
|
||||
plane width divided by the horizontal subsampling factor, and the
|
||||
chrominance plane height is equal to the luminance plane height divided by
|
||||
the vertical subsampling factor.
|
||||
<p>
|
||||
For example, if the source image is 35 x 35 pixels and 4:2:2 subsampling is
|
||||
used, then the luminance plane would be 36 x 35 bytes, and each of the
|
||||
chrominance planes would be 18 x 35 bytes. If you specify a line padding of
|
||||
4 bytes on top of this, then the luminance plane would be 36 x 35 bytes, and
|
||||
each of the chrominance planes would be 20 x 35 bytes.</div>
|
||||
chrominance planes would be 18 x 35 bytes. If you specify a row alignment
|
||||
of 4 bytes on top of this, then the luminance plane would be 36 x 35 bytes,
|
||||
and each of the chrominance planes would be 20 x 35 bytes.</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -154,15 +156,15 @@ extends java.lang.Object</pre>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>protected int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#yuvHeight">yuvHeight</a></strong></code> </td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#yuvAlign">yuvAlign</a></strong></code> </td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>protected int[]</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#yuvOffsets">yuvOffsets</a></strong></code> </td>
|
||||
<td class="colFirst"><code>protected int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#yuvHeight">yuvHeight</a></strong></code> </td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>protected int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#yuvPad">yuvPad</a></strong></code> </td>
|
||||
<td class="colFirst"><code>protected int[]</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#yuvOffsets">yuvOffsets</a></strong></code> </td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>protected byte[][]</code></td>
|
||||
@@ -208,10 +210,10 @@ extends java.lang.Object</pre>
|
||||
<tr class="rowColor">
|
||||
<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(byte[],%20int,%20int,%20int,%20int)">YUVImage</a></strong>(byte[] yuvImage,
|
||||
int width,
|
||||
int pad,
|
||||
int align,
|
||||
int height,
|
||||
int subsamp)</code>
|
||||
<div class="block">Create a new <code>YUVImage</code> instance from an existing unified image
|
||||
<div class="block">Create a new <code>YUVImage</code> instance from an existing unified
|
||||
buffer.</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -226,11 +228,11 @@ extends java.lang.Object</pre>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(int,%20int,%20int,%20int)">YUVImage</a></strong>(int width,
|
||||
int pad,
|
||||
int align,
|
||||
int height,
|
||||
int subsamp)</code>
|
||||
<div class="block">Create a new <code>YUVImage</code> instance backed by a unified image
|
||||
buffer, and allocate memory for the image buffer.</div>
|
||||
<div class="block">Create a new <code>YUVImage</code> instance backed by a unified buffer,
|
||||
and allocate memory for the buffer.</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -251,8 +253,8 @@ extends java.lang.Object</pre>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>byte[]</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#getBuf()">getBuf</a></strong>()</code>
|
||||
<div class="block">Returns the YUV image buffer (if this image is stored in a unified
|
||||
buffer rather than separate image planes.)</div>
|
||||
<div class="block">Returns the YUV buffer (if this image is stored in a unified buffer rather
|
||||
than separate image planes.)</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
@@ -271,7 +273,7 @@ extends java.lang.Object</pre>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#getPad()">getPad</a></strong>()</code>
|
||||
<div class="block">Returns the line padding used in the YUV image buffer (if this image is
|
||||
<div class="block">Returns the row alignment (in bytes) of the YUV buffer (if this image is
|
||||
stored in a unified buffer rather than separate image planes.)</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -284,14 +286,14 @@ extends java.lang.Object</pre>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#getSize()">getSize</a></strong>()</code>
|
||||
<div class="block">Returns the size (in bytes) of the YUV image buffer (if this image is
|
||||
stored in a unified buffer rather than separate image planes.)</div>
|
||||
<div class="block">Returns the size (in bytes) of the YUV buffer (if this image is stored in
|
||||
a unified buffer rather than separate image planes.)</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>int[]</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#getStrides()">getStrides</a></strong>()</code>
|
||||
<div class="block">Returns the number of bytes per line of each plane in the YUV image.</div>
|
||||
<div class="block">Returns the number of bytes per row of each plane in the YUV image.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
@@ -321,10 +323,10 @@ extends java.lang.Object</pre>
|
||||
<td class="colFirst"><code>void</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#setBuf(byte[],%20int,%20int,%20int,%20int)">setBuf</a></strong>(byte[] yuvImage,
|
||||
int width,
|
||||
int pad,
|
||||
int align,
|
||||
int height,
|
||||
int subsamp)</code>
|
||||
<div class="block">Assign a unified image buffer to this <code>YUVImage</code> instance.</div>
|
||||
<div class="block">Assign a unified buffer to this <code>YUVImage</code> instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -385,13 +387,13 @@ extends java.lang.Object</pre>
|
||||
<pre>protected int[] yuvStrides</pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="yuvPad">
|
||||
<a name="yuvAlign">
|
||||
<!-- -->
|
||||
</a>
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>yuvPad</h4>
|
||||
<pre>protected int yuvPad</pre>
|
||||
<h4>yuvAlign</h4>
|
||||
<pre>protected int yuvAlign</pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="yuvWidth">
|
||||
@@ -442,7 +444,7 @@ extends java.lang.Object</pre>
|
||||
<div class="block">Create a new <code>YUVImage</code> instance backed by separate image
|
||||
planes, and allocate memory for the image planes.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>width</code> - width (in pixels) of the YUV image</dd><dd><code>strides</code> - an array of integers, each specifying the number of bytes
|
||||
per line in the corresponding plane of the YUV image. Setting the stride
|
||||
per row in the corresponding plane of the YUV image. Setting the stride
|
||||
for any plane to 0 is the same as setting it to the plane width (see
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>above</code></a>.) If <code>strides</code> is null, then the
|
||||
strides for all planes will be set to their respective plane widths. When
|
||||
@@ -458,13 +460,15 @@ extends java.lang.Object</pre>
|
||||
<li class="blockList">
|
||||
<h4>YUVImage</h4>
|
||||
<pre>public YUVImage(int width,
|
||||
int pad,
|
||||
int align,
|
||||
int height,
|
||||
int subsamp)</pre>
|
||||
<div class="block">Create a new <code>YUVImage</code> instance backed by a unified image
|
||||
buffer, and allocate memory for the image buffer.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>width</code> - width (in pixels) of the YUV image</dd><dd><code>pad</code> - Each line of each plane in the YUV image buffer will be padded
|
||||
to this number of bytes (must be a power of 2.)</dd><dd><code>height</code> - height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling to be used in the YUV
|
||||
<div class="block">Create a new <code>YUVImage</code> instance backed by a unified buffer,
|
||||
and allocate memory for the buffer.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>width</code> - width (in pixels) of the YUV image</dd><dd><code>align</code> - row alignment (in bytes) of the YUV image (must be a power of
|
||||
2.) Setting this parameter to n specifies that each row in each plane of
|
||||
the YUV image will be padded to the nearest multiple of n bytes
|
||||
(1 = unpadded.)</dd><dd><code>height</code> - height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling to be used in the YUV
|
||||
image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -485,18 +489,18 @@ extends java.lang.Object</pre>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>planes</code> - an array of buffers representing the Y, U (Cb), and V (Cr)
|
||||
image planes (or just the Y plane, if the image is grayscale.) These
|
||||
planes can be contiguous or non-contiguous in memory. Plane
|
||||
<code>i</code> should be at least <code>offsets[i] +
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeSizeYUV(int,%20int,%20int,%20int,%20int)"><code>TJ.planeSizeYUV</code></a>(i, width, strides[i], height, subsamp)</code>
|
||||
<code>i</code> should be at least <code>offsets[i] + </code>
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeSizeYUV(int,%20int,%20int,%20int,%20int)"><code>TJ.planeSizeYUV</code></a><code>(i, width, strides[i], height, subsamp)</code>
|
||||
bytes in size.</dd><dd><code>offsets</code> - If this <code>YUVImage</code> instance represents a
|
||||
subregion of a larger image, then <code>offsets[i]</code> specifies the
|
||||
offset (in bytes) of the subregion within plane <code>i</code> of the
|
||||
larger image. Setting this to null is the same as setting the offsets for
|
||||
all planes to 0.</dd><dd><code>width</code> - width (in pixels) of the new YUV image (or subregion)</dd><dd><code>strides</code> - an array of integers, each specifying the number of bytes
|
||||
per line in the corresponding plane of the YUV image. Setting the stride
|
||||
per row in the corresponding plane of the YUV image. Setting the stride
|
||||
for any plane to 0 is the same as setting it to the plane width (see
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>above</code></a>.) If <code>strides</code> is null, then the
|
||||
strides for all planes will be set to their respective plane widths. You
|
||||
can adjust the strides in order to add an arbitrary amount of line padding
|
||||
can adjust the strides in order to add an arbitrary amount of row padding
|
||||
to each plane or to specify that this <code>YUVImage</code> instance is a
|
||||
subregion of a larger image (in which case, <code>strides[i]</code> should
|
||||
be set to the plane width of plane <code>i</code> in the larger image.)</dd><dd><code>height</code> - height (in pixels) of the new YUV image (or subregion)</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV
|
||||
@@ -511,18 +515,19 @@ extends java.lang.Object</pre>
|
||||
<h4>YUVImage</h4>
|
||||
<pre>public YUVImage(byte[] yuvImage,
|
||||
int width,
|
||||
int pad,
|
||||
int align,
|
||||
int height,
|
||||
int subsamp)</pre>
|
||||
<div class="block">Create a new <code>YUVImage</code> instance from an existing unified image
|
||||
<div class="block">Create a new <code>YUVImage</code> instance from an existing unified
|
||||
buffer.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>yuvImage</code> - image buffer that contains or will contain YUV planar
|
||||
image data. Use <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int,%20int,%20int,%20int)"><code>TJ.bufSizeYUV(int, int, int, int)</code></a> to determine the minimum size for
|
||||
this buffer. The Y, U (Cb), and V (Cr) image planes are stored
|
||||
sequentially in the buffer (see <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>above</code></a> for a description
|
||||
of the image format.)</dd><dd><code>width</code> - width (in pixels) of the YUV image</dd><dd><code>pad</code> - the line padding used in the YUV image buffer. For
|
||||
instance, if each line in each plane of the buffer is padded to the
|
||||
nearest multiple of 4 bytes, then <code>pad</code> should be set to 4.</dd><dd><code>height</code> - height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>yuvImage</code> - buffer that contains or will receive a unified planar YUV
|
||||
image. Use <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int,%20int,%20int,%20int)"><code>TJ.bufSizeYUV(int, int, int, int)</code></a> to determine the minimum size for this
|
||||
buffer. The Y, U (Cb), and V (Cr) image planes are stored sequentially in
|
||||
the buffer. (See <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>above</code></a> for a description of the image
|
||||
format.)</dd><dd><code>width</code> - width (in pixels) of the YUV image</dd><dd><code>align</code> - row alignment (in bytes) of the YUV image (must be a power of
|
||||
2.) Setting this parameter to n specifies that each row in each plane of
|
||||
the YUV image will be padded to the nearest multiple of n bytes
|
||||
(1 = unpadded.)</dd><dd><code>height</code> - height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV
|
||||
image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -550,19 +555,19 @@ extends java.lang.Object</pre>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>planes</code> - an array of buffers representing the Y, U (Cb), and V (Cr)
|
||||
image planes (or just the Y plane, if the image is grayscale.) These
|
||||
planes can be contiguous or non-contiguous in memory. Plane
|
||||
<code>i</code> should be at least <code>offsets[i] +
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeSizeYUV(int,%20int,%20int,%20int,%20int)"><code>TJ.planeSizeYUV</code></a>(i, width, strides[i], height, subsamp)</code>
|
||||
<code>i</code> should be at least <code>offsets[i] + </code>
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeSizeYUV(int,%20int,%20int,%20int,%20int)"><code>TJ.planeSizeYUV</code></a><code>(i, width, strides[i], height, subsamp)</code>
|
||||
bytes in size.</dd><dd><code>offsets</code> - If this <code>YUVImage</code> instance represents a
|
||||
subregion of a larger image, then <code>offsets[i]</code> specifies the
|
||||
offset (in bytes) of the subregion within plane <code>i</code> of the
|
||||
larger image. Setting this to null is the same as setting the offsets for
|
||||
all planes to 0.</dd><dd><code>width</code> - width (in pixels) of the YUV image (or subregion)</dd><dd><code>strides</code> - an array of integers, each specifying the number of bytes
|
||||
per line in the corresponding plane of the YUV image. Setting the stride
|
||||
per row in the corresponding plane of the YUV image. Setting the stride
|
||||
for any plane to 0 is the same as setting it to the plane width (see
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>above</code></a>.) If <code>strides</code> is null, then the
|
||||
strides for all planes will be set to their respective plane widths. You
|
||||
can adjust the strides in order to add an arbitrary amount of line padding
|
||||
to each plane or to specify that this <code>YUVImage</code> image is a
|
||||
can adjust the strides in order to add an arbitrary amount of row padding
|
||||
to each plane or to specify that this <code>YUVImage</code> instance is a
|
||||
subregion of a larger image (in which case, <code>strides[i]</code> should
|
||||
be set to the plane width of plane <code>i</code> in the larger image.)</dd><dd><code>height</code> - height (in pixels) of the YUV image (or subregion)</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV
|
||||
image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd></dl>
|
||||
@@ -576,17 +581,18 @@ extends java.lang.Object</pre>
|
||||
<h4>setBuf</h4>
|
||||
<pre>public void setBuf(byte[] yuvImage,
|
||||
int width,
|
||||
int pad,
|
||||
int align,
|
||||
int height,
|
||||
int subsamp)</pre>
|
||||
<div class="block">Assign a unified image buffer to this <code>YUVImage</code> instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>yuvImage</code> - image buffer that contains or will contain YUV planar
|
||||
image data. Use <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int,%20int,%20int,%20int)"><code>TJ.bufSizeYUV(int, int, int, int)</code></a> to determine the minimum size for
|
||||
this buffer. The Y, U (Cb), and V (Cr) image planes are stored
|
||||
sequentially in the buffer (see <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>above</code></a> for a description
|
||||
of the image format.)</dd><dd><code>width</code> - width (in pixels) of the YUV image</dd><dd><code>pad</code> - the line padding used in the YUV image buffer. For
|
||||
instance, if each line in each plane of the buffer is padded to the
|
||||
nearest multiple of 4 bytes, then <code>pad</code> should be set to 4.</dd><dd><code>height</code> - height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV
|
||||
<div class="block">Assign a unified buffer to this <code>YUVImage</code> instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>yuvImage</code> - buffer that contains or will receive a unified planar YUV
|
||||
image. Use <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int,%20int,%20int,%20int)"><code>TJ.bufSizeYUV(int, int, int, int)</code></a> to determine the minimum size for this
|
||||
buffer. The Y, U (Cb), and V (Cr) image planes are stored sequentially in
|
||||
the buffer. (See <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>above</code></a> for a description of the image
|
||||
format.)</dd><dd><code>width</code> - width (in pixels) of the YUV image</dd><dd><code>align</code> - row alignment (in bytes) of the YUV image (must be a power of
|
||||
2.) Setting this parameter to n specifies that each row in each plane of
|
||||
the YUV image will be padded to the nearest multiple of n bytes
|
||||
(1 = unpadded.)</dd><dd><code>height</code> - height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV
|
||||
image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -619,9 +625,9 @@ extends java.lang.Object</pre>
|
||||
<li class="blockList">
|
||||
<h4>getPad</h4>
|
||||
<pre>public int getPad()</pre>
|
||||
<div class="block">Returns the line padding used in the YUV image buffer (if this image is
|
||||
<div class="block">Returns the row alignment (in bytes) of the YUV buffer (if this image is
|
||||
stored in a unified buffer rather than separate image planes.)</div>
|
||||
<dl><dt><span class="strong">Returns:</span></dt><dd>the line padding used in the YUV image buffer</dd></dl>
|
||||
<dl><dt><span class="strong">Returns:</span></dt><dd>the row alignment of the YUV buffer</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="getStrides()">
|
||||
@@ -631,8 +637,8 @@ extends java.lang.Object</pre>
|
||||
<li class="blockList">
|
||||
<h4>getStrides</h4>
|
||||
<pre>public int[] getStrides()</pre>
|
||||
<div class="block">Returns the number of bytes per line of each plane in the YUV image.</div>
|
||||
<dl><dt><span class="strong">Returns:</span></dt><dd>the number of bytes per line of each plane in the YUV image</dd></dl>
|
||||
<div class="block">Returns the number of bytes per row of each plane in the YUV image.</div>
|
||||
<dl><dt><span class="strong">Returns:</span></dt><dd>the number of bytes per row of each plane in the YUV image</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="getOffsets()">
|
||||
@@ -679,9 +685,9 @@ extends java.lang.Object</pre>
|
||||
<li class="blockList">
|
||||
<h4>getBuf</h4>
|
||||
<pre>public byte[] getBuf()</pre>
|
||||
<div class="block">Returns the YUV image buffer (if this image is stored in a unified
|
||||
buffer rather than separate image planes.)</div>
|
||||
<dl><dt><span class="strong">Returns:</span></dt><dd>the YUV image buffer</dd></dl>
|
||||
<div class="block">Returns the YUV buffer (if this image is stored in a unified buffer rather
|
||||
than separate image planes.)</div>
|
||||
<dl><dt><span class="strong">Returns:</span></dt><dd>the YUV buffer</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="getSize()">
|
||||
@@ -691,9 +697,9 @@ extends java.lang.Object</pre>
|
||||
<li class="blockList">
|
||||
<h4>getSize</h4>
|
||||
<pre>public int getSize()</pre>
|
||||
<div class="block">Returns the size (in bytes) of the YUV image buffer (if this image is
|
||||
stored in a unified buffer rather than separate image planes.)</div>
|
||||
<dl><dt><span class="strong">Returns:</span></dt><dd>the size (in bytes) of the YUV image buffer</dd></dl>
|
||||
<div class="block">Returns the size (in bytes) of the YUV buffer (if this image is stored in
|
||||
a unified buffer rather than separate image planes.)</div>
|
||||
<dl><dt><span class="strong">Returns:</span></dt><dd>the size (in bytes) of the YUV buffer</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -131,7 +131,7 @@
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></td>
|
||||
<td class="colLast">
|
||||
<div class="block">This class encapsulates a YUV planar image and the metadata
|
||||
<div class="block">This class encapsulates a planar YUV image and the metadata
|
||||
associated with it.</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -109,12 +109,13 @@
|
||||
<li class="blockList">
|
||||
<h4>op</h4>
|
||||
<pre>int op</pre>
|
||||
<div class="block">Transform operation (one of <code>OP_*</code>)</div>
|
||||
<div class="block">Transform operation (one of <a href="org/libjpegturbo/turbojpeg/TJTransform.html#OP_NONE"><code>OP_*</code></a>)</div>
|
||||
</li>
|
||||
<li class="blockList">
|
||||
<h4>options</h4>
|
||||
<pre>int options</pre>
|
||||
<div class="block">Transform options (bitwise OR of one or more of <code>OPT_*</code>)</div>
|
||||
<div class="block">Transform options (bitwise OR of one or more of
|
||||
<a href="org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT"><code>OPT_*</code></a>)</div>
|
||||
</li>
|
||||
<li class="blockListLast">
|
||||
<h4>cf</h4>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2011-2013, 2017-2018, 2020 D. R. Commander.
|
||||
* Copyright (C)2011-2013, 2017-2018, 2020-2021, 2023 D. R. Commander.
|
||||
* All Rights Reserved.
|
||||
* Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
||||
*
|
||||
@@ -85,7 +85,7 @@ public final class TJ {
|
||||
* subsampling.
|
||||
*
|
||||
* @param subsamp the level of chrominance subsampling (one of
|
||||
* <code>SAMP_*</code>)
|
||||
* {@link #SAMP_444 SAMP_*})
|
||||
*
|
||||
* @return the MCU block width for the given level of chrominance
|
||||
* subsampling.
|
||||
@@ -105,7 +105,7 @@ public final class TJ {
|
||||
* subsampling.
|
||||
*
|
||||
* @param subsamp the level of chrominance subsampling (one of
|
||||
* <code>SAMP_*</code>)
|
||||
* {@link #SAMP_444 SAMP_*})
|
||||
*
|
||||
* @return the MCU block height for the given level of chrominance
|
||||
* subsampling.
|
||||
@@ -205,8 +205,8 @@ public final class TJ {
|
||||
* vice versa, but the mapping is typically not 1:1 or reversible, nor can it
|
||||
* be defined with a simple formula. Thus, such a conversion is out of scope
|
||||
* for a codec library. However, the TurboJPEG API allows for compressing
|
||||
* CMYK pixels into a YCCK JPEG image (see {@link #CS_YCCK}) and
|
||||
* decompressing YCCK JPEG images into CMYK pixels.
|
||||
* packed-pixel CMYK images into YCCK JPEG images (see {@link #CS_YCCK}) and
|
||||
* decompressing YCCK JPEG images into packed-pixel CMYK images.
|
||||
*/
|
||||
public static final int PF_CMYK = 11;
|
||||
|
||||
@@ -214,7 +214,7 @@ public final class TJ {
|
||||
/**
|
||||
* Returns the pixel size (in bytes) for the given pixel format.
|
||||
*
|
||||
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
||||
* @param pixelFormat the pixel format (one of {@link #PF_RGB PF_*})
|
||||
*
|
||||
* @return the pixel size (in bytes) for the given pixel format.
|
||||
*/
|
||||
@@ -235,7 +235,7 @@ public final class TJ {
|
||||
* then the red component will be
|
||||
* <code>pixel[TJ.getRedOffset(TJ.PF_BGRX)]</code>.
|
||||
*
|
||||
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
||||
* @param pixelFormat the pixel format (one of {@link #PF_RGB PF_*})
|
||||
*
|
||||
* @return the red offset for the given pixel format, or -1 if the pixel
|
||||
* format does not have a red component.
|
||||
@@ -257,7 +257,7 @@ public final class TJ {
|
||||
* then the green component will be
|
||||
* <code>pixel[TJ.getGreenOffset(TJ.PF_BGRX)]</code>.
|
||||
*
|
||||
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
||||
* @param pixelFormat the pixel format (one of {@link #PF_RGB PF_*})
|
||||
*
|
||||
* @return the green offset for the given pixel format, or -1 if the pixel
|
||||
* format does not have a green component.
|
||||
@@ -279,7 +279,7 @@ public final class TJ {
|
||||
* then the blue component will be
|
||||
* <code>pixel[TJ.getBlueOffset(TJ.PF_BGRX)]</code>.
|
||||
*
|
||||
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
||||
* @param pixelFormat the pixel format (one of {@link #PF_RGB PF_*})
|
||||
*
|
||||
* @return the blue offset for the given pixel format, or -1 if the pixel
|
||||
* format does not have a blue component.
|
||||
@@ -301,7 +301,7 @@ public final class TJ {
|
||||
* then the alpha component will be
|
||||
* <code>pixel[TJ.getAlphaOffset(TJ.PF_BGRA)]</code>.
|
||||
*
|
||||
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
||||
* @param pixelFormat the pixel format (one of {@link #PF_RGB PF_*})
|
||||
*
|
||||
* @return the alpha offset for the given pixel format, or -1 if the pixel
|
||||
* format does not have a alpha component.
|
||||
@@ -324,8 +324,9 @@ public final class TJ {
|
||||
* RGB colorspace. When compressing the JPEG image, the R, G, and B
|
||||
* components in the source image are reordered into image planes, but no
|
||||
* colorspace conversion or subsampling is performed. RGB JPEG images can be
|
||||
* decompressed to any of the extended RGB pixel formats or grayscale, but
|
||||
* they cannot be decompressed to YUV images.
|
||||
* decompressed to packed-pixel images with any of the extended RGB or
|
||||
* grayscale pixel formats, but they cannot be decompressed to planar YUV
|
||||
* images.
|
||||
*/
|
||||
public static final int CS_RGB = 0;
|
||||
/**
|
||||
@@ -339,26 +340,28 @@ public final class TJ {
|
||||
* transformation allowed the same signal to drive both black & white and
|
||||
* color televisions, but JPEG images use YCbCr primarily because it allows
|
||||
* the color data to be optionally subsampled for the purposes of reducing
|
||||
* bandwidth or disk space. YCbCr is the most common JPEG colorspace, and
|
||||
* YCbCr JPEG images can be compressed from and decompressed to any of the
|
||||
* extended RGB pixel formats or grayscale, or they can be decompressed to
|
||||
* YUV planar images.
|
||||
* network or disk usage. YCbCr is the most common JPEG colorspace, and
|
||||
* YCbCr JPEG images can be compressed from and decompressed to packed-pixel
|
||||
* images with any of the extended RGB or grayscale pixel formats. YCbCr
|
||||
* JPEG images can also be compressed from and decompressed to planar YUV
|
||||
* images.
|
||||
*/
|
||||
@SuppressWarnings("checkstyle:ConstantName")
|
||||
public static final int CS_YCbCr = 1;
|
||||
/**
|
||||
* Grayscale colorspace. The JPEG image retains only the luminance data (Y
|
||||
* component), and any color data from the source image is discarded.
|
||||
* Grayscale JPEG images can be compressed from and decompressed to any of
|
||||
* the extended RGB pixel formats or grayscale, or they can be decompressed
|
||||
* to YUV planar images.
|
||||
* Grayscale JPEG images can be compressed from and decompressed to
|
||||
* packed-pixel images with any of the extended RGB or grayscale pixel
|
||||
* formats, or they can be compressed from and decompressed to planar YUV
|
||||
* images.
|
||||
*/
|
||||
public static final int CS_GRAY = 2;
|
||||
/**
|
||||
* CMYK colorspace. When compressing the JPEG image, the C, M, Y, and K
|
||||
* components in the source image are reordered into image planes, but no
|
||||
* colorspace conversion or subsampling is performed. CMYK JPEG images can
|
||||
* only be decompressed to CMYK pixels.
|
||||
* only be decompressed to packed-pixel images with the CMYK pixel format.
|
||||
*/
|
||||
public static final int CS_CMYK = 3;
|
||||
/**
|
||||
@@ -368,14 +371,14 @@ public final class TJ {
|
||||
* reversibly transformed into YCCK, and as with YCbCr, the chrominance
|
||||
* components in the YCCK pixels can be subsampled without incurring major
|
||||
* perceptual loss. YCCK JPEG images can only be compressed from and
|
||||
* decompressed to CMYK pixels.
|
||||
* decompressed to packed-pixel images with the CMYK pixel format.
|
||||
*/
|
||||
public static final int CS_YCCK = 4;
|
||||
|
||||
|
||||
/**
|
||||
* The uncompressed source/destination image is stored in bottom-up (Windows,
|
||||
* OpenGL) order, not top-down (X11) order.
|
||||
* Rows in the packed-pixel source/destination image are stored in bottom-up
|
||||
* (Windows, OpenGL) order rather than in top-down (X11) order.
|
||||
*/
|
||||
public static final int FLAG_BOTTOMUP = 2;
|
||||
|
||||
@@ -394,41 +397,39 @@ public final class TJ {
|
||||
|
||||
/**
|
||||
* When decompressing an image that was compressed using chrominance
|
||||
* subsampling, use the fastest chrominance upsampling algorithm available in
|
||||
* the underlying codec. The default is to use smooth upsampling, which
|
||||
* creates a smooth transition between neighboring chrominance components in
|
||||
* order to reduce upsampling artifacts in the decompressed image.
|
||||
* subsampling, use the fastest chrominance upsampling algorithm available.
|
||||
* The default is to use smooth upsampling, which creates a smooth transition
|
||||
* between neighboring chrominance components in order to reduce upsampling
|
||||
* artifacts in the decompressed image.
|
||||
*/
|
||||
public static final int FLAG_FASTUPSAMPLE = 256;
|
||||
/**
|
||||
* Use the fastest DCT/IDCT algorithm available in the underlying codec. The
|
||||
* default if this flag is not specified is implementation-specific. For
|
||||
* example, the implementation of TurboJPEG for libjpeg[-turbo] uses the fast
|
||||
* Use the fastest DCT/IDCT algorithm available. The default if this flag is
|
||||
* not specified is implementation-specific. For example, the implementation
|
||||
* of the TurboJPEG API in libjpeg-turbo uses the fast algorithm by default
|
||||
* when compressing, because this has been shown to have only a very slight
|
||||
* effect on accuracy, but it uses the accurate algorithm when decompressing,
|
||||
* because this has been shown to have a larger effect.
|
||||
*/
|
||||
public static final int FLAG_FASTDCT = 2048;
|
||||
/**
|
||||
* Use the most accurate DCT/IDCT algorithm available. The default if this
|
||||
* flag is not specified is implementation-specific. For example, the
|
||||
* implementation of the TurboJPEG API in libjpeg-turbo uses the fast
|
||||
* algorithm by default when compressing, because this has been shown to have
|
||||
* only a very slight effect on accuracy, but it uses the accurate algorithm
|
||||
* when decompressing, because this has been shown to have a larger effect.
|
||||
*/
|
||||
public static final int FLAG_FASTDCT = 2048;
|
||||
/**
|
||||
* Use the most accurate DCT/IDCT algorithm available in the underlying
|
||||
* codec. The default if this flag is not specified is
|
||||
* implementation-specific. For example, the implementation of TurboJPEG for
|
||||
* libjpeg[-turbo] uses the fast algorithm by default when compressing,
|
||||
* because this has been shown to have only a very slight effect on accuracy,
|
||||
* but it uses the accurate algorithm when decompressing, because this has
|
||||
* been shown to have a larger effect.
|
||||
*/
|
||||
public static final int FLAG_ACCURATEDCT = 4096;
|
||||
/**
|
||||
* Immediately discontinue the current compression/decompression/transform
|
||||
* operation if the underlying codec throws a warning (non-fatal error). The
|
||||
* default behavior is to allow the operation to complete unless a fatal
|
||||
* error is encountered.
|
||||
* operation if a warning (non-fatal error) occurs. The default behavior is
|
||||
* to allow the operation to complete unless a fatal error is encountered.
|
||||
* <p>
|
||||
* NOTE: due to the design of the TurboJPEG Java API, only certain methods
|
||||
* (specifically, {@link TJDecompressor TJDecompressor.decompress*()} methods
|
||||
* with a void return type) will complete and leave the output image in a
|
||||
* fully recoverable state after a non-fatal error occurs.
|
||||
* with a void return type) will complete and leave the destination image in
|
||||
* a fully recoverable state after a non-fatal error occurs.
|
||||
*/
|
||||
public static final int FLAG_STOPONWARNING = 8192;
|
||||
/**
|
||||
@@ -438,6 +439,16 @@ public final class TJ {
|
||||
* reduce compression and decompression performance considerably.
|
||||
*/
|
||||
public static final int FLAG_PROGRESSIVE = 16384;
|
||||
/**
|
||||
* Limit the number of progressive JPEG scans that the decompression and
|
||||
* transform operations will process. If a progressive JPEG image contains
|
||||
* an unreasonably large number of scans, then this flag will cause the
|
||||
* decompression and transform operations to throw an error. The primary
|
||||
* purpose of this is to allow security-critical applications to guard
|
||||
* against an exploit of the progressive JPEG format described in
|
||||
* <a href="https://libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf" target="_blank">this report</a>.
|
||||
*/
|
||||
public static final int FLAG_LIMITSCANS = 32768;
|
||||
|
||||
|
||||
/**
|
||||
@@ -445,13 +456,13 @@ public final class TJ {
|
||||
*/
|
||||
public static final int NUMERR = 2;
|
||||
/**
|
||||
* The error was non-fatal and recoverable, but the image may still be
|
||||
* corrupt.
|
||||
* The error was non-fatal and recoverable, but the destination image may
|
||||
* still be corrupt.
|
||||
* <p>
|
||||
* NOTE: due to the design of the TurboJPEG Java API, only certain methods
|
||||
* (specifically, {@link TJDecompressor TJDecompressor.decompress*()} methods
|
||||
* with a void return type) will complete and leave the output image in a
|
||||
* fully recoverable state after a non-fatal error occurs.
|
||||
* with a void return type) will complete and leave the destination image in
|
||||
* a fully recoverable state after a non-fatal error occurs.
|
||||
*/
|
||||
public static final int ERR_WARNING = 0;
|
||||
/**
|
||||
@@ -469,7 +480,7 @@ public final class TJ {
|
||||
* @param height the height (in pixels) of the JPEG image
|
||||
*
|
||||
* @param jpegSubsamp the level of chrominance subsampling to be used when
|
||||
* generating the JPEG image (one of {@link TJ TJ.SAMP_*})
|
||||
* generating the JPEG image (one of {@link #SAMP_444 TJ.SAMP_*})
|
||||
*
|
||||
* @return the maximum size of the buffer (in bytes) required to hold a JPEG
|
||||
* image with the given width, height, and level of chrominance subsampling.
|
||||
@@ -477,23 +488,27 @@ public final class TJ {
|
||||
public static native int bufSize(int width, int height, int jpegSubsamp);
|
||||
|
||||
/**
|
||||
* Returns the size of the buffer (in bytes) required to hold a YUV planar
|
||||
* image with the given width, height, and level of chrominance subsampling.
|
||||
* Returns the size of the buffer (in bytes) required to hold a unified
|
||||
* planar YUV image with the given width, height, and level of chrominance
|
||||
* subsampling.
|
||||
*
|
||||
* @param width the width (in pixels) of the YUV image
|
||||
*
|
||||
* @param pad the width of each line in each plane of the image is padded to
|
||||
* the nearest multiple of this number of bytes (must be a power of 2.)
|
||||
* @param align row alignment (in bytes) of the YUV image (must be a power of
|
||||
* 2.) Setting this parameter to n specifies that each row in each plane of
|
||||
* the YUV image will be padded to the nearest multiple of n bytes
|
||||
* (1 = unpadded.)
|
||||
*
|
||||
* @param height the height (in pixels) of the YUV image
|
||||
*
|
||||
* @param subsamp the level of chrominance subsampling used in the YUV
|
||||
* image (one of {@link TJ TJ.SAMP_*})
|
||||
* image (one of {@link #SAMP_444 TJ.SAMP_*})
|
||||
*
|
||||
* @return the size of the buffer (in bytes) required to hold a YUV planar
|
||||
* image with the given width, height, and level of chrominance subsampling.
|
||||
* @return the size of the buffer (in bytes) required to hold a unified
|
||||
* planar YUV image with the given width, height, and level of chrominance
|
||||
* subsampling.
|
||||
*/
|
||||
public static native int bufSizeYUV(int width, int pad, int height,
|
||||
public static native int bufSizeYUV(int width, int align, int height,
|
||||
int subsamp);
|
||||
|
||||
/**
|
||||
@@ -513,16 +528,16 @@ public final class TJ {
|
||||
* @param width width (in pixels) of the YUV image. NOTE: this is the width
|
||||
* of the whole image, not the plane width.
|
||||
*
|
||||
* @param stride bytes per line in the image plane.
|
||||
* @param stride bytes per row in the image plane.
|
||||
*
|
||||
* @param height height (in pixels) of the YUV image. NOTE: this is the
|
||||
* height of the whole image, not the plane height.
|
||||
*
|
||||
* @param subsamp the level of chrominance subsampling used in the YUV
|
||||
* image (one of {@link TJ TJ.SAMP_*})
|
||||
* image (one of {@link #SAMP_444 TJ.SAMP_*})
|
||||
*
|
||||
* @return the size of the buffer (in bytes) required to hold a YUV planar
|
||||
* image with the given parameters.
|
||||
* @return the size of the buffer (in bytes) required to hold a YUV image
|
||||
* plane with the given parameters.
|
||||
*/
|
||||
public static native int planeSizeYUV(int componentID, int width, int stride,
|
||||
int height, int subsamp);
|
||||
@@ -537,7 +552,7 @@ public final class TJ {
|
||||
* @param width width (in pixels) of the YUV image
|
||||
*
|
||||
* @param subsamp the level of chrominance subsampling used in the YUV image
|
||||
* (one of {@link TJ TJ.SAMP_*})
|
||||
* (one of {@link #SAMP_444 TJ.SAMP_*})
|
||||
*
|
||||
* @return the plane width of a YUV image plane with the given parameters.
|
||||
*/
|
||||
@@ -553,7 +568,7 @@ public final class TJ {
|
||||
* @param height height (in pixels) of the YUV image
|
||||
*
|
||||
* @param subsamp the level of chrominance subsampling used in the YUV image
|
||||
* (one of {@link TJ TJ.SAMP_*})
|
||||
* (one of {@link #SAMP_444 TJ.SAMP_*})
|
||||
*
|
||||
* @return the plane height of a YUV image plane with the given parameters.
|
||||
*/
|
||||
@@ -561,11 +576,11 @@ public final class TJ {
|
||||
int subsamp);
|
||||
|
||||
/**
|
||||
* Returns a list of fractional scaling factors that the JPEG decompressor in
|
||||
* this implementation of TurboJPEG supports.
|
||||
* Returns a list of fractional scaling factors that the JPEG decompressor
|
||||
* supports.
|
||||
*
|
||||
* @return a list of fractional scaling factors that the JPEG decompressor in
|
||||
* this implementation of TurboJPEG supports.
|
||||
* @return a list of fractional scaling factors that the JPEG decompressor
|
||||
* supports.
|
||||
*/
|
||||
public static native TJScalingFactor[] getScalingFactors();
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C)2011-2015, 2018, 2020 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2011-2015, 2018, 2020, 2023 D. R. Commander.
|
||||
* All Rights Reserved.
|
||||
* Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -49,7 +50,7 @@ public class TJCompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a TurboJPEG compressor instance and associate the uncompressed
|
||||
* Create a TurboJPEG compressor instance and associate the packed-pixel
|
||||
* source image stored in <code>srcImage</code> with the newly created
|
||||
* instance.
|
||||
*
|
||||
@@ -85,7 +86,7 @@ public class TJCompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a TurboJPEG compressor instance and associate the uncompressed
|
||||
* Create a TurboJPEG compressor instance and associate the packed-pixel
|
||||
* source image stored in <code>srcImage</code> with the newly created
|
||||
* instance.
|
||||
*
|
||||
@@ -110,11 +111,11 @@ public class TJCompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate an uncompressed RGB, grayscale, or CMYK source image with this
|
||||
* Associate a packed-pixel RGB, grayscale, or CMYK source image with this
|
||||
* compressor instance.
|
||||
*
|
||||
* @param srcImage image buffer containing RGB, grayscale, or CMYK pixels to
|
||||
* be compressed or encoded. This buffer is not modified.
|
||||
* @param srcImage buffer containing a packed-pixel RGB, grayscale, or CMYK
|
||||
* source image to be compressed or encoded. This buffer is not modified.
|
||||
*
|
||||
* @param x x offset (in pixels) of the region in the source image from which
|
||||
* the JPEG or YUV image should be compressed/encoded
|
||||
@@ -125,14 +126,16 @@ public class TJCompressor implements Closeable {
|
||||
* @param width width (in pixels) of the region in the source image from
|
||||
* which the JPEG or YUV image should be compressed/encoded
|
||||
*
|
||||
* @param pitch bytes per line of the source image. Normally, this should be
|
||||
* <code>width * TJ.pixelSize(pixelFormat)</code> if the source image is
|
||||
* unpadded, but you can use this parameter to, for instance, specify that
|
||||
* the scanlines in the source image are padded to a 4-byte boundary or to
|
||||
* compress/encode a JPEG or YUV image from a region of a larger source
|
||||
* image. 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
|
||||
* <code>width * TJ.pixelSize(pixelFormat)</code>.
|
||||
* @param pitch bytes per row in the source image. Normally this should be
|
||||
* <code>width *
|
||||
* </code>{@link TJ#getPixelSize TJ.getPixelSize}<code>(pixelFormat)</code>,
|
||||
* if the source image is unpadded. However, you can use this parameter to,
|
||||
* for instance, specify that the rows in the source image are padded to the
|
||||
* nearest multiple of 4 bytes or to compress/encode a JPEG or YUV image from
|
||||
* a region of a larger source image. You can also be clever and use this
|
||||
* parameter to skip rows, etc. Setting this parameter to 0 is the
|
||||
* equivalent of setting it to <code>width *
|
||||
* </code>{@link TJ#getPixelSize TJ.getPixelSize}<code>(pixelFormat)</code>.
|
||||
*
|
||||
* @param height height (in pixels) of the region in the source image from
|
||||
* which the JPEG or YUV image should be compressed/encoded
|
||||
@@ -174,11 +177,12 @@ public class TJCompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate an uncompressed RGB or grayscale source image with this
|
||||
* Associate a packed-pixel RGB or grayscale source image with this
|
||||
* compressor instance.
|
||||
*
|
||||
* @param srcImage a <code>BufferedImage</code> instance containing RGB or
|
||||
* grayscale pixels to be compressed or encoded. This image is not modified.
|
||||
* @param srcImage a <code>BufferedImage</code> instance containing a
|
||||
* packed-pixel RGB or grayscale source image to be compressed or encoded.
|
||||
* This image is not modified.
|
||||
*
|
||||
* @param x x offset (in pixels) of the region in the source image from which
|
||||
* the JPEG or YUV image should be compressed/encoded
|
||||
@@ -260,11 +264,10 @@ public class TJCompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate an uncompressed YUV planar source image with this compressor
|
||||
* instance.
|
||||
* Associate a planar YUV source image with this compressor instance.
|
||||
*
|
||||
* @param srcImage YUV planar image to be compressed. This image is not
|
||||
* modified.
|
||||
* @param srcImage planar YUV source image to be compressed. This image is
|
||||
* not modified.
|
||||
*/
|
||||
public void setSourceImage(YUVImage srcImage) throws TJException {
|
||||
if (handle == 0) init();
|
||||
@@ -281,16 +284,16 @@ public class TJCompressor implements Closeable {
|
||||
* {@link TJ#CS_YCbCr}) or from CMYK to YCCK (see {@link TJ#CS_YCCK}) as part
|
||||
* of the JPEG compression process, some of the Cb and Cr (chrominance)
|
||||
* components can be discarded or averaged together to produce a smaller
|
||||
* image with little perceptible loss of image clarity (the human eye is more
|
||||
* sensitive to small changes in brightness than to small changes in color.)
|
||||
* This is called "chrominance subsampling".
|
||||
* image with little perceptible loss of image clarity. (The human eye is
|
||||
* more sensitive to small changes in brightness than to small changes in
|
||||
* color.) This is called "chrominance subsampling".
|
||||
* <p>
|
||||
* NOTE: This method has no effect when compressing a JPEG image from a YUV
|
||||
* planar source. In that case, the level of chrominance subsampling in
|
||||
* the JPEG image is determined by the source. Furthermore, this method has
|
||||
* no effect when encoding to a pre-allocated {@link YUVImage} instance. In
|
||||
* that case, the level of chrominance subsampling is determined by the
|
||||
* destination.
|
||||
* NOTE: This method has no effect when compressing a JPEG image from a
|
||||
* planar YUV source image. In that case, the level of chrominance
|
||||
* subsampling in the JPEG image is determined by the source image.
|
||||
* Furthermore, this method has no effect when encoding to a pre-allocated
|
||||
* {@link YUVImage} instance. In that case, the level of chrominance
|
||||
* subsampling is determined by the destination image.
|
||||
*
|
||||
* @param newSubsamp the level of chrominance subsampling to use in
|
||||
* subsequent compress/encode oeprations (one of
|
||||
@@ -315,8 +318,9 @@ public class TJCompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Compress the uncompressed source image associated with this compressor
|
||||
* instance and output a JPEG image to the given destination buffer.
|
||||
* Compress the packed-pixel or planar YUV source image associated with this
|
||||
* compressor instance and output a JPEG image to the given destination
|
||||
* buffer.
|
||||
*
|
||||
* @param dstBuf buffer that will receive the JPEG image. Use
|
||||
* {@link TJ#bufSize} to determine the maximum size for this buffer based on
|
||||
@@ -366,8 +370,8 @@ public class TJCompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Compress the uncompressed source image associated with this compressor
|
||||
* instance and return a buffer containing a JPEG image.
|
||||
* Compress the packed-pixel or planar YUV source image associated with this
|
||||
* compressor instance and return a buffer containing a JPEG image.
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of
|
||||
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
|
||||
@@ -417,14 +421,14 @@ public class TJCompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode the uncompressed source image associated with this compressor
|
||||
* instance into a YUV planar image and store it in the given
|
||||
* <code>YUVImage</code> instance. This method uses the accelerated color
|
||||
* conversion routines in TurboJPEG's underlying codec but does not execute
|
||||
* any of the other steps in the JPEG compression process. Encoding
|
||||
* CMYK source images to YUV is not supported.
|
||||
* Encode the packed-pixel source image associated with this compressor
|
||||
* instance into a planar YUV image and store it in the given
|
||||
* {@link YUVImage} instance. This method performs color conversion (which
|
||||
* is accelerated in the libjpeg-turbo implementation) but does not execute
|
||||
* any of the other steps in the JPEG compression process. Encoding CMYK
|
||||
* source images into YUV images is not supported.
|
||||
*
|
||||
* @param dstImage {@link YUVImage} instance that will receive the YUV planar
|
||||
* @param dstImage {@link YUVImage} instance that will receive the planar YUV
|
||||
* image
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of
|
||||
@@ -469,52 +473,54 @@ public class TJCompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode the uncompressed source image associated with this compressor
|
||||
* instance into a unified YUV planar image buffer and return a
|
||||
* <code>YUVImage</code> instance containing the encoded image. This method
|
||||
* uses the accelerated color conversion routines in TurboJPEG's underlying
|
||||
* codec but does not execute any of the other steps in the JPEG compression
|
||||
* process. Encoding CMYK source images to YUV is not supported.
|
||||
* Encode the packed-pixel source image associated with this compressor
|
||||
* instance into a unified planar YUV image and return a {@link YUVImage}
|
||||
* instance containing the encoded image. This method performs color
|
||||
* conversion (which is accelerated in the libjpeg-turbo implementation) but
|
||||
* does not execute any of the other steps in the JPEG compression process.
|
||||
* Encoding CMYK source images into YUV images is not supported.
|
||||
*
|
||||
* @param pad the width of each line in each plane of the YUV image will be
|
||||
* padded to the nearest multiple of this number of bytes (must be a power of
|
||||
* 2.)
|
||||
* @param align row alignment (in bytes) of the YUV image (must be a power of
|
||||
* 2.) Setting this parameter to n will cause each row in each plane of the
|
||||
* YUV image to be padded to the nearest multiple of n bytes (1 = unpadded.)
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of
|
||||
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
|
||||
*
|
||||
* @return a YUV planar image.
|
||||
* @return a {@link YUVImage} instance containing the unified planar YUV
|
||||
* encoded image
|
||||
*/
|
||||
public YUVImage encodeYUV(int pad, int flags) throws TJException {
|
||||
public YUVImage encodeYUV(int align, int flags) throws TJException {
|
||||
checkSourceImage();
|
||||
checkSubsampling();
|
||||
if (pad < 1 || ((pad & (pad - 1)) != 0))
|
||||
if (align < 1 || ((align & (align - 1)) != 0))
|
||||
throw new IllegalStateException("Invalid argument in encodeYUV()");
|
||||
YUVImage dstYUVImage = new YUVImage(srcWidth, pad, srcHeight, subsamp);
|
||||
YUVImage dstYUVImage = new YUVImage(srcWidth, align, srcHeight, subsamp);
|
||||
encodeYUV(dstYUVImage, flags);
|
||||
return dstYUVImage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode the uncompressed source image associated with this compressor
|
||||
* Encode the packed-pixel source image associated with this compressor
|
||||
* instance into separate Y, U (Cb), and V (Cr) image planes and return a
|
||||
* <code>YUVImage</code> instance containing the encoded image planes. This
|
||||
* method uses the accelerated color conversion routines in TurboJPEG's
|
||||
* underlying codec but does not execute any of the other steps in the JPEG
|
||||
* compression process. Encoding CMYK source images to YUV is not supported.
|
||||
* {@link YUVImage} instance containing the encoded image planes. This
|
||||
* method performs color conversion (which is accelerated in the
|
||||
* libjpeg-turbo implementation) but does not execute any of the other steps
|
||||
* in the JPEG compression process. Encoding CMYK source images into YUV
|
||||
* images is not supported.
|
||||
*
|
||||
* @param strides an array of integers, each specifying the number of bytes
|
||||
* per line in the corresponding plane of the output image. Setting the
|
||||
* stride for any plane to 0 is the same as setting it to the component width
|
||||
* of the plane. If <code>strides</code> is null, then the strides for all
|
||||
* planes will be set to their respective component widths. You can adjust
|
||||
* the strides in order to add an arbitrary amount of line padding to each
|
||||
* plane.
|
||||
* per row in the corresponding plane of the YUV source image. Setting the
|
||||
* stride for any plane to 0 is the same as setting it to the plane width
|
||||
* (see {@link YUVImage}.) If <code>strides</code> is null, then the strides
|
||||
* for all planes will be set to their respective plane widths. You can
|
||||
* adjust the strides in order to add an arbitrary amount of row padding to
|
||||
* each plane.
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of
|
||||
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
|
||||
*
|
||||
* @return a YUV planar image.
|
||||
* @return a {@link YUVImage} instance containing the encoded image planes
|
||||
*/
|
||||
public YUVImage encodeYUV(int[] strides, int flags) throws TJException {
|
||||
checkSourceImage();
|
||||
@@ -679,6 +685,5 @@ public class TJCompressor implements Closeable {
|
||||
private int subsamp = -1;
|
||||
private int jpegQuality = -1;
|
||||
private int compressedSize = 0;
|
||||
private int yuvPad = 4;
|
||||
private ByteOrder byteOrder = null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2011, 2013 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2011, 2013, 2023 D. R. Commander. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -58,7 +58,7 @@ public interface TJCustomFilter {
|
||||
* component plane to which <code>coeffBuffer</code> belongs
|
||||
*
|
||||
* @param componentID ID number of the component plane to which
|
||||
* <code>coeffBuffer</code> belongs (Y, Cb, and Cr have, respectively, ID's
|
||||
* <code>coeffBuffer</code> belongs. (Y, Cb, and Cr have, respectively, ID's
|
||||
* of 0, 1, and 2 in typical JPEG images.)
|
||||
*
|
||||
* @param transformID ID number of the transformed image to which
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C)2011-2015, 2018 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2011-2015, 2018, 2022-2023 D. R. Commander.
|
||||
* All Rights Reserved.
|
||||
* Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -50,10 +51,12 @@ public class TJDecompressor implements Closeable {
|
||||
|
||||
/**
|
||||
* Create a TurboJPEG decompressor instance and associate the JPEG source
|
||||
* image stored in <code>jpegImage</code> with the newly created instance.
|
||||
* image or "abbreviated table specification" (AKA "tables-only") datastream
|
||||
* stored in <code>jpegImage</code> with the newly created instance.
|
||||
*
|
||||
* @param jpegImage JPEG image buffer (size of the JPEG image is assumed to
|
||||
* be the length of the array.) This buffer is not modified.
|
||||
* @param jpegImage buffer containing a JPEG source image or tables-only
|
||||
* datastream. (The size of the JPEG image or datastream is assumed to be
|
||||
* the length of the array.) This buffer is not modified.
|
||||
*/
|
||||
public TJDecompressor(byte[] jpegImage) throws TJException {
|
||||
init();
|
||||
@@ -62,12 +65,15 @@ public class TJDecompressor implements Closeable {
|
||||
|
||||
/**
|
||||
* Create a TurboJPEG decompressor instance and associate the JPEG source
|
||||
* image of length <code>imageSize</code> bytes stored in
|
||||
* <code>jpegImage</code> with the newly created instance.
|
||||
* image or "abbreviated table specification" (AKA "tables-only") datastream
|
||||
* of length <code>imageSize</code> bytes stored in <code>jpegImage</code>
|
||||
* with the newly created instance.
|
||||
*
|
||||
* @param jpegImage JPEG image buffer. This buffer is not modified.
|
||||
* @param jpegImage buffer containing a JPEG source image or tables-only
|
||||
* datastream. This buffer is not modified.
|
||||
*
|
||||
* @param imageSize size of the JPEG image (in bytes)
|
||||
* @param imageSize size of the JPEG source image or tables-only datastream
|
||||
* (in bytes)
|
||||
*/
|
||||
public TJDecompressor(byte[] jpegImage, int imageSize) throws TJException {
|
||||
init();
|
||||
@@ -75,11 +81,11 @@ public class TJDecompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a TurboJPEG decompressor instance and associate the YUV planar
|
||||
* Create a TurboJPEG decompressor instance and associate the planar YUV
|
||||
* source image stored in <code>yuvImage</code> with the newly created
|
||||
* instance.
|
||||
*
|
||||
* @param yuvImage {@link YUVImage} instance containing a YUV planar
|
||||
* @param yuvImage {@link YUVImage} instance containing a planar YUV source
|
||||
* image to be decoded. This image is not modified.
|
||||
*/
|
||||
@SuppressWarnings("checkstyle:HiddenField")
|
||||
@@ -89,13 +95,22 @@ public class TJDecompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate the JPEG image of length <code>imageSize</code> bytes stored in
|
||||
* <code>jpegImage</code> with this decompressor instance. This image will
|
||||
* be used as the source image for subsequent decompress operations.
|
||||
* Associate the JPEG image or "abbreviated table specification" (AKA
|
||||
* "tables-only") datastream of length <code>imageSize</code> bytes stored in
|
||||
* <code>jpegImage</code> with this decompressor instance. If
|
||||
* <code>jpegImage</code> contains a JPEG image, then this image will be used
|
||||
* as the source image for subsequent decompression operations. Passing a
|
||||
* tables-only datastream to this method primes the decompressor with
|
||||
* quantization and Huffman tables that can be used when decompressing
|
||||
* subsequent "abbreviated image" datastreams. This is useful, for instance,
|
||||
* when decompressing video streams in which all frames share the same
|
||||
* quantization and Huffman tables.
|
||||
*
|
||||
* @param jpegImage JPEG image buffer. This buffer is not modified.
|
||||
* @param jpegImage buffer containing a JPEG source image or tables-only
|
||||
* datastream. This buffer is not modified.
|
||||
*
|
||||
* @param imageSize size of the JPEG image (in bytes)
|
||||
* @param imageSize size of the JPEG source image or tables-only datastream
|
||||
* (in bytes)
|
||||
*/
|
||||
public void setSourceImage(byte[] jpegImage, int imageSize)
|
||||
throws TJException {
|
||||
@@ -118,12 +133,12 @@ public class TJDecompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate the specified YUV planar source image with this decompressor
|
||||
* instance. Subsequent decompress operations will decode this image into an
|
||||
* RGB or grayscale destination image.
|
||||
* Associate the specified planar YUV source image with this decompressor
|
||||
* instance. Subsequent decompression operations will decode this image into
|
||||
* a packed-pixel RGB or grayscale destination image.
|
||||
*
|
||||
* @param srcImage {@link YUVImage} instance containing a YUV planar image to
|
||||
* be decoded. This image is not modified.
|
||||
* @param srcImage {@link YUVImage} instance containing a planar YUV source
|
||||
* image to be decoded. This image is not modified.
|
||||
*/
|
||||
public void setSourceImage(YUVImage srcImage) {
|
||||
if (srcImage == null)
|
||||
@@ -201,9 +216,9 @@ public class TJDecompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the JPEG image buffer associated with this decompressor instance.
|
||||
* Returns the JPEG buffer associated with this decompressor instance.
|
||||
*
|
||||
* @return the JPEG image buffer associated with this decompressor instance.
|
||||
* @return the JPEG buffer associated with this decompressor instance.
|
||||
*/
|
||||
public byte[] getJPEGBuf() {
|
||||
if (jpegBuf == null)
|
||||
@@ -230,14 +245,14 @@ public class TJDecompressor implements Closeable {
|
||||
* height.
|
||||
*
|
||||
* @param desiredWidth desired width (in pixels) of the decompressed image.
|
||||
* Setting this to 0 is the same as setting it to the width of the JPEG image
|
||||
* (in other words, the width will not be considered when determining the
|
||||
* scaled image size.)
|
||||
* Setting this to 0 is the same as setting it to the width of the JPEG
|
||||
* image. (In other words, the width will not be considered when determining
|
||||
* the scaled image size.)
|
||||
*
|
||||
* @param desiredHeight desired height (in pixels) of the decompressed image.
|
||||
* Setting this to 0 is the same as setting it to the height of the JPEG
|
||||
* image (in other words, the height will not be considered when determining
|
||||
* the scaled image size.)
|
||||
* image. (In other words, the height will not be considered when
|
||||
* determining the scaled image size.)
|
||||
*
|
||||
* @return the width of the largest scaled-down image that the TurboJPEG
|
||||
* decompressor can generate without exceeding the desired image width and
|
||||
@@ -271,14 +286,14 @@ public class TJDecompressor implements Closeable {
|
||||
* height.
|
||||
*
|
||||
* @param desiredWidth desired width (in pixels) of the decompressed image.
|
||||
* Setting this to 0 is the same as setting it to the width of the JPEG image
|
||||
* (in other words, the width will not be considered when determining the
|
||||
* scaled image size.)
|
||||
* Setting this to 0 is the same as setting it to the width of the JPEG
|
||||
* image. (In other words, the width will not be considered when determining
|
||||
* the scaled image size.)
|
||||
*
|
||||
* @param desiredHeight desired height (in pixels) of the decompressed image.
|
||||
* Setting this to 0 is the same as setting it to the height of the JPEG
|
||||
* image (in other words, the height will not be considered when determining
|
||||
* the scaled image size.)
|
||||
* image. (In other words, the height will not be considered when
|
||||
* determining the scaled image size.)
|
||||
*
|
||||
* @return the height of the largest scaled-down image that the TurboJPEG
|
||||
* decompressor can generate without exceeding the desired image width and
|
||||
@@ -307,27 +322,27 @@ public class TJDecompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Decompress the JPEG source image or decode the YUV source image associated
|
||||
* with this decompressor instance and output a grayscale, RGB, or CMYK image
|
||||
* to the given destination buffer.
|
||||
* Decompress the JPEG source image or decode the planar YUV source image
|
||||
* associated with this decompressor instance and output a packed-pixel
|
||||
* grayscale, RGB, or CMYK image to the given destination buffer.
|
||||
* <p>
|
||||
* NOTE: The output image is fully recoverable if this method throws a
|
||||
* NOTE: The destination image is fully recoverable if this method throws a
|
||||
* non-fatal {@link TJException} (unless
|
||||
* {@link TJ#FLAG_STOPONWARNING TJ.FLAG_STOPONWARNING} is specified.)
|
||||
*
|
||||
* @param dstBuf buffer that will receive the decompressed/decoded image.
|
||||
* If the source image is a JPEG image, then this buffer should normally be
|
||||
* <code>pitch * scaledHeight</code> bytes in size, where
|
||||
* <code>scaledHeight</code> can be determined by calling <code>
|
||||
* scalingFactor.{@link TJScalingFactor#getScaled getScaled}(jpegHeight)
|
||||
* </code> with one of the scaling factors returned from {@link
|
||||
* TJ#getScalingFactors} or by calling {@link #getScaledHeight}. If the
|
||||
* source image is a YUV image, then this buffer should normally be
|
||||
* <code>pitch * height</code> bytes in size, where <code>height</code> is
|
||||
* the height of the YUV image. However, the buffer may also be larger than
|
||||
* the dimensions of the source image, in which case the <code>x</code>,
|
||||
* <code>y</code>, and <code>pitch</code> parameters can be used to specify
|
||||
* the region into which the source image should be decompressed/decoded.
|
||||
* @param dstBuf buffer that will receive the packed-pixel
|
||||
* decompressed/decoded image. If the source image is a JPEG image, then
|
||||
* this buffer should normally be <code>pitch * scaledHeight</code> bytes in
|
||||
* size, where <code>scaledHeight</code> can be determined by calling
|
||||
* <code>scalingFactor.</code>{@link TJScalingFactor#getScaled getScaled}<code>(jpegHeight)</code>
|
||||
* with one of the scaling factors returned from {@link TJ#getScalingFactors}
|
||||
* or by calling {@link #getScaledHeight}. If the source image is a YUV
|
||||
* image, then this buffer should normally be <code>pitch * height</code>
|
||||
* bytes in size, where <code>height</code> is the height of the YUV image.
|
||||
* However, the buffer may also be larger than the dimensions of the source
|
||||
* image, in which case the <code>x</code>, <code>y</code>, and
|
||||
* <code>pitch</code> parameters can be used to specify the region into which
|
||||
* the source image should be decompressed/decoded.
|
||||
*
|
||||
* @param x x offset (in pixels) of the region in the destination image into
|
||||
* which the source image should be decompressed/decoded
|
||||
@@ -341,22 +356,24 @@ public class TJDecompressor implements Closeable {
|
||||
* than the source image dimensions, then TurboJPEG will use scaling in the
|
||||
* JPEG decompressor to generate the largest possible image that will fit
|
||||
* within the desired dimensions. Setting this to 0 is the same as setting
|
||||
* it to the width of the JPEG image (in other words, the width will not be
|
||||
* it to the width of the JPEG image. (In other words, the width will not be
|
||||
* considered when determining the scaled image size.) This parameter is
|
||||
* ignored if the source image is a YUV image.
|
||||
*
|
||||
* @param pitch bytes per line of the destination image. Normally, this
|
||||
* should be set to <code>scaledWidth * TJ.pixelSize(pixelFormat)</code> if
|
||||
* the destination image is unpadded, but you can use this to, for instance,
|
||||
* pad each line of the destination image to a 4-byte boundary or to
|
||||
* decompress/decode the source image into a region of a larger image. NOTE:
|
||||
* if the source image is a JPEG image, then <code>scaledWidth</code> can be
|
||||
* determined by calling <code>
|
||||
* scalingFactor.{@link TJScalingFactor#getScaled getScaled}(jpegWidth)
|
||||
* </code> or by calling {@link #getScaledWidth}. If the source image is a
|
||||
* YUV image, then <code>scaledWidth</code> is the width of the YUV image.
|
||||
* @param pitch bytes per row in the destination image. Normally this should
|
||||
* be set to <code>scaledWidth *
|
||||
* </code>{@link TJ#getPixelSize TJ.getPixelSize}<code>(pixelFormat)</code>,
|
||||
* if the destination image will be unpadded. However, you can use this to,
|
||||
* for instance, pad each row of the destination image to the nearest
|
||||
* multiple of 4 bytes or to decompress/decode the source image into a region
|
||||
* of a larger image. NOTE: if the source image is a JPEG image, then
|
||||
* <code>scaledWidth</code> can be determined by calling
|
||||
* <code>scalingFactor.</code>{@link TJScalingFactor#getScaled getScaled}<code>(jpegWidth)</code>
|
||||
* or by calling {@link #getScaledWidth}. If the source image is a YUV
|
||||
* image, then <code>scaledWidth</code> is the width of the YUV image.
|
||||
* Setting this parameter to 0 is the equivalent of setting it to
|
||||
* <code>scaledWidth * TJ.pixelSize(pixelFormat)</code>.
|
||||
* <code>scaledWidth *
|
||||
* </code>{@link TJ#getPixelSize TJ.getPixelSize}<code>(pixelFormat)</code>.
|
||||
*
|
||||
* @param desiredHeight If the source image is a JPEG image, then this
|
||||
* specifies the desired height (in pixels) of the decompressed image (or
|
||||
@@ -364,8 +381,8 @@ public class TJDecompressor implements Closeable {
|
||||
* than the source image dimensions, then TurboJPEG will use scaling in the
|
||||
* JPEG decompressor to generate the largest possible image that will fit
|
||||
* within the desired dimensions. Setting this to 0 is the same as setting
|
||||
* it to the height of the JPEG image (in other words, the height will not be
|
||||
* considered when determining the scaled image size.) This parameter is
|
||||
* it to the height of the JPEG image. (In other words, the height will not
|
||||
* be considered when determining the scaled image size.) This parameter is
|
||||
* ignored if the source image is a YUV image.
|
||||
*
|
||||
* @param pixelFormat pixel format of the decompressed/decoded image (one of
|
||||
@@ -378,7 +395,7 @@ public class TJDecompressor implements Closeable {
|
||||
int pitch, int desiredHeight, int pixelFormat,
|
||||
int flags) throws TJException {
|
||||
if (jpegBuf == null && yuvImage == null)
|
||||
throw new IllegalStateException(NO_ASSOC_ERROR);
|
||||
throw new IllegalStateException("No source image is associated with this instance");
|
||||
if (dstBuf == null || x < 0 || y < 0 || pitch < 0 ||
|
||||
(yuvImage != null && (desiredWidth < 0 || desiredHeight < 0)) ||
|
||||
pixelFormat < 0 || pixelFormat >= TJ.NUMPF || flags < 0)
|
||||
@@ -412,8 +429,9 @@ public class TJDecompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Decompress the JPEG source image associated with this decompressor
|
||||
* instance and return a buffer containing the decompressed image.
|
||||
* Decompress the JPEG source image or decode the planar YUV source image
|
||||
* associated with this decompressor instance and return a buffer containing
|
||||
* the packed-pixel decompressed image.
|
||||
*
|
||||
* @param desiredWidth see
|
||||
* {@link #decompress(byte[], int, int, int, int, int, int, int)}
|
||||
@@ -433,7 +451,7 @@ public class TJDecompressor implements Closeable {
|
||||
* @param flags the bitwise OR of one or more of
|
||||
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
|
||||
*
|
||||
* @return a buffer containing the decompressed image.
|
||||
* @return a buffer containing the packed-pixel decompressed image.
|
||||
*/
|
||||
public byte[] decompress(int desiredWidth, int pitch, int desiredHeight,
|
||||
int pixelFormat, int flags) throws TJException {
|
||||
@@ -453,22 +471,22 @@ public class TJDecompressor implements Closeable {
|
||||
|
||||
/**
|
||||
* Decompress the JPEG source image associated with this decompressor
|
||||
* instance into a YUV planar image and store it in the given
|
||||
* <code>YUVImage</code> instance. This method performs JPEG decompression
|
||||
* but leaves out the color conversion step, so a planar YUV image is
|
||||
* generated instead of an RGB or grayscale image. This method cannot be
|
||||
* used to decompress JPEG source images with the CMYK or YCCK colorspace.
|
||||
* instance into a planar YUV image and store it in the given
|
||||
* {@link YUVImage} instance. This method performs JPEG decompression but
|
||||
* leaves out the color conversion step, so a planar YUV image is generated
|
||||
* instead of a packed-pixel image. This method cannot be used to decompress
|
||||
* JPEG source images with the CMYK or YCCK colorspace.
|
||||
* <p>
|
||||
* NOTE: The YUV planar output image is fully recoverable if this method
|
||||
* NOTE: The planar YUV destination image is fully recoverable if this method
|
||||
* throws a non-fatal {@link TJException} (unless
|
||||
* {@link TJ#FLAG_STOPONWARNING TJ.FLAG_STOPONWARNING} is specified.)
|
||||
*
|
||||
* @param dstImage {@link YUVImage} instance that will receive the YUV planar
|
||||
* image. The level of subsampling specified in this <code>YUVImage</code>
|
||||
* instance must match that of the JPEG image, and the width and height
|
||||
* specified in the <code>YUVImage</code> instance must match one of the
|
||||
* scaled image sizes that TurboJPEG is capable of generating from the JPEG
|
||||
* source image.
|
||||
* @param dstImage {@link YUVImage} instance that will receive the planar YUV
|
||||
* decompressed image. The level of subsampling specified in this
|
||||
* {@link YUVImage} instance must match that of the JPEG image, and the width
|
||||
* and height specified in the {@link YUVImage} instance must match one of
|
||||
* the scaled image sizes that the decompressor is capable of generating from
|
||||
* the JPEG source image.
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of
|
||||
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
|
||||
@@ -485,7 +503,7 @@ public class TJDecompressor implements Closeable {
|
||||
dstImage.getHeight());
|
||||
if (scaledWidth != dstImage.getWidth() ||
|
||||
scaledHeight != dstImage.getHeight())
|
||||
throw new IllegalArgumentException("YUVImage dimensions do not match one of the scaled image sizes that TurboJPEG is capable of generating.");
|
||||
throw new IllegalArgumentException("YUVImage dimensions do not match one of the scaled image sizes that the decompressor is capable of generating.");
|
||||
if (jpegSubsamp != dstImage.getSubsamp())
|
||||
throw new IllegalArgumentException("YUVImage subsampling level does not match that of the JPEG image");
|
||||
|
||||
@@ -508,40 +526,41 @@ public class TJDecompressor implements Closeable {
|
||||
/**
|
||||
* Decompress the JPEG source image associated with this decompressor
|
||||
* instance into a set of Y, U (Cb), and V (Cr) image planes and return a
|
||||
* <code>YUVImage</code> instance containing the decompressed image planes.
|
||||
* This method performs JPEG decompression but leaves out the color
|
||||
* conversion step, so a planar YUV image is generated instead of an RGB or
|
||||
* grayscale image. This method cannot be used to decompress JPEG source
|
||||
* images with the CMYK or YCCK colorspace.
|
||||
* {@link YUVImage} instance containing the decompressed image planes. This
|
||||
* method performs JPEG decompression but leaves out the color conversion
|
||||
* step, so a planar YUV image is generated instead of a packed-pixel image.
|
||||
* This method cannot be used to decompress JPEG source images with the CMYK
|
||||
* or YCCK colorspace.
|
||||
*
|
||||
* @param desiredWidth desired width (in pixels) of the YUV image. If the
|
||||
* desired image dimensions are different than the dimensions of the JPEG
|
||||
* image being decompressed, then TurboJPEG will use scaling in the JPEG
|
||||
* decompressor to generate the largest possible image that will fit within
|
||||
* the desired dimensions. Setting this to 0 is the same as setting it to
|
||||
* the width of the JPEG image (in other words, the width will not be
|
||||
* the width of the JPEG image. (In other words, the width will not be
|
||||
* considered when determining the scaled image size.)
|
||||
*
|
||||
* @param strides an array of integers, each specifying the number of bytes
|
||||
* per line in the corresponding plane of the output image. Setting the
|
||||
* stride for any plane to 0 is the same as setting it to the scaled
|
||||
* component width of the plane. If <tt>strides</tt> is NULL, then the
|
||||
* strides for all planes will be set to their respective scaled component
|
||||
* widths. You can adjust the strides in order to add an arbitrary amount of
|
||||
* line padding to each plane.
|
||||
* per row in the corresponding plane of the YUV image. Setting the stride
|
||||
* for any plane to 0 is the same as setting it to the scaled plane width
|
||||
* (see {@link YUVImage}.) If <code>strides</code> is null, then the strides
|
||||
* for all planes will be set to their respective scaled plane widths. You
|
||||
* can adjust the strides in order to add an arbitrary amount of row padding
|
||||
* to each plane.
|
||||
*
|
||||
* @param desiredHeight desired height (in pixels) of the YUV image. If the
|
||||
* desired image dimensions are different than the dimensions of the JPEG
|
||||
* image being decompressed, then TurboJPEG will use scaling in the JPEG
|
||||
* decompressor to generate the largest possible image that will fit within
|
||||
* the desired dimensions. Setting this to 0 is the same as setting it to
|
||||
* the height of the JPEG image (in other words, the height will not be
|
||||
* the height of the JPEG image. (In other words, the height will not be
|
||||
* considered when determining the scaled image size.)
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of
|
||||
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
|
||||
*
|
||||
* @return a YUV planar image.
|
||||
* @return a {@link YUVImage} instance containing the decompressed image
|
||||
* planes
|
||||
*/
|
||||
public YUVImage decompressToYUV(int desiredWidth, int[] strides,
|
||||
int desiredHeight,
|
||||
@@ -565,40 +584,41 @@ public class TJDecompressor implements Closeable {
|
||||
|
||||
/**
|
||||
* Decompress the JPEG source image associated with this decompressor
|
||||
* instance into a unified YUV planar image buffer and return a
|
||||
* <code>YUVImage</code> instance containing the decompressed image. This
|
||||
* method performs JPEG decompression but leaves out the color conversion
|
||||
* step, so a planar YUV image is generated instead of an RGB or grayscale
|
||||
* image. This method cannot be used to decompress JPEG source images with
|
||||
* the CMYK or YCCK colorspace.
|
||||
* instance into a unified planar YUV image and return a {@link YUVImage}
|
||||
* instance containing the decompressed image. This method performs JPEG
|
||||
* decompression but leaves out the color conversion step, so a planar YUV
|
||||
* image is generated instead of a packed-pixel image. This method cannot be
|
||||
* used to decompress JPEG source images with the CMYK or YCCK colorspace.
|
||||
*
|
||||
* @param desiredWidth desired width (in pixels) of the YUV image. If the
|
||||
* desired image dimensions are different than the dimensions of the JPEG
|
||||
* image being decompressed, then TurboJPEG will use scaling in the JPEG
|
||||
* decompressor to generate the largest possible image that will fit within
|
||||
* the desired dimensions. Setting this to 0 is the same as setting it to
|
||||
* the width of the JPEG image (in other words, the width will not be
|
||||
* the width of the JPEG image. (In other words, the width will not be
|
||||
* considered when determining the scaled image size.)
|
||||
*
|
||||
* @param pad the width of each line in each plane of the YUV image will be
|
||||
* padded to the nearest multiple of this number of bytes (must be a power of
|
||||
* 2.)
|
||||
* @param align row alignment (in bytes) of the YUV image (must be a power of
|
||||
* 2.) Setting this parameter to n will cause each row in each plane of the
|
||||
* YUV image to be padded to the nearest multiple of n bytes (1 = unpadded.)
|
||||
*
|
||||
* @param desiredHeight desired height (in pixels) of the YUV image. If the
|
||||
* desired image dimensions are different than the dimensions of the JPEG
|
||||
* image being decompressed, then TurboJPEG will use scaling in the JPEG
|
||||
* decompressor to generate the largest possible image that will fit within
|
||||
* the desired dimensions. Setting this to 0 is the same as setting it to
|
||||
* the height of the JPEG image (in other words, the height will not be
|
||||
* the height of the JPEG image. (In other words, the height will not be
|
||||
* considered when determining the scaled image size.)
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of
|
||||
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
|
||||
*
|
||||
* @return a YUV planar image.
|
||||
* @return a {@link YUVImage} instance containing the unified planar YUV
|
||||
* decompressed image
|
||||
*/
|
||||
public YUVImage decompressToYUV(int desiredWidth, int pad, int desiredHeight,
|
||||
int flags) throws TJException {
|
||||
public YUVImage decompressToYUV(int desiredWidth, int align,
|
||||
int desiredHeight, int flags)
|
||||
throws TJException {
|
||||
if (flags < 0)
|
||||
throw new IllegalArgumentException("Invalid argument in decompressToYUV()");
|
||||
if (jpegWidth < 1 || jpegHeight < 1 || jpegSubsamp < 0)
|
||||
@@ -610,7 +630,7 @@ public class TJDecompressor implements Closeable {
|
||||
|
||||
int scaledWidth = getScaledWidth(desiredWidth, desiredHeight);
|
||||
int scaledHeight = getScaledHeight(desiredWidth, desiredHeight);
|
||||
YUVImage dstYUVImage = new YUVImage(scaledWidth, pad, scaledHeight,
|
||||
YUVImage dstYUVImage = new YUVImage(scaledWidth, align, scaledHeight,
|
||||
jpegSubsamp);
|
||||
decompressToYUV(dstYUVImage, flags);
|
||||
return dstYUVImage;
|
||||
@@ -628,27 +648,27 @@ public class TJDecompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Decompress the JPEG source image or decode the YUV source image associated
|
||||
* with this decompressor instance and output a grayscale, RGB, or CMYK image
|
||||
* to the given destination buffer.
|
||||
* Decompress the JPEG source image or decode the planar YUV source image
|
||||
* associated with this decompressor instance and output a packed-pixel
|
||||
* grayscale, RGB, or CMYK image to the given destination buffer.
|
||||
* <p>
|
||||
* NOTE: The output image is fully recoverable if this method throws a
|
||||
* NOTE: The destination image is fully recoverable if this method throws a
|
||||
* non-fatal {@link TJException} (unless
|
||||
* {@link TJ#FLAG_STOPONWARNING TJ.FLAG_STOPONWARNING} is specified.)
|
||||
*
|
||||
* @param dstBuf buffer that will receive the decompressed/decoded image.
|
||||
* If the source image is a JPEG image, then this buffer should normally be
|
||||
* <code>stride * scaledHeight</code> pixels in size, where
|
||||
* <code>scaledHeight</code> can be determined by calling <code>
|
||||
* scalingFactor.{@link TJScalingFactor#getScaled getScaled}(jpegHeight)
|
||||
* </code> with one of the scaling factors returned from {@link
|
||||
* TJ#getScalingFactors} or by calling {@link #getScaledHeight}. If the
|
||||
* source image is a YUV image, then this buffer should normally be
|
||||
* <code>stride * height</code> pixels in size, where <code>height</code> is
|
||||
* the height of the YUV image. However, the buffer may also be larger than
|
||||
* the dimensions of the JPEG image, in which case the <code>x</code>,
|
||||
* <code>y</code>, and <code>stride</code> parameters can be used to specify
|
||||
* the region into which the source image should be decompressed.
|
||||
* @param dstBuf buffer that will receive the packed-pixel
|
||||
* decompressed/decoded image. If the source image is a JPEG image, then
|
||||
* this buffer should normally be <code>stride * scaledHeight</code> pixels
|
||||
* in size, where <code>scaledHeight</code> can be determined by calling
|
||||
* <code>scalingFactor.</code>{@link TJScalingFactor#getScaled getScaled}<code>(jpegHeight)</code>
|
||||
* with one of the scaling factors returned from {@link TJ#getScalingFactors}
|
||||
* or by calling {@link #getScaledHeight}. If the source image is a YUV
|
||||
* image, then this buffer should normally be <code>stride * height</code>
|
||||
* pixels in size, where <code>height</code> is the height of the YUV image.
|
||||
* However, the buffer may also be larger than the dimensions of the JPEG
|
||||
* image, in which case the <code>x</code>, <code>y</code>, and
|
||||
* <code>stride</code> parameters can be used to specify the region into
|
||||
* which the source image should be decompressed.
|
||||
*
|
||||
* @param x x offset (in pixels) of the region in the destination image into
|
||||
* which the source image should be decompressed/decoded
|
||||
@@ -662,18 +682,18 @@ public class TJDecompressor implements Closeable {
|
||||
* than the source image dimensions, then TurboJPEG will use scaling in the
|
||||
* JPEG decompressor to generate the largest possible image that will fit
|
||||
* within the desired dimensions. Setting this to 0 is the same as setting
|
||||
* it to the width of the JPEG image (in other words, the width will not be
|
||||
* it to the width of the JPEG image. (In other words, the width will not be
|
||||
* considered when determining the scaled image size.) This parameter is
|
||||
* ignored if the source image is a YUV image.
|
||||
*
|
||||
* @param stride pixels per line of the destination image. Normally, this
|
||||
* @param stride pixels per row in the destination image. Normally this
|
||||
* should be set to <code>scaledWidth</code>, but you can use this to, for
|
||||
* instance, decompress the JPEG image into a region of a larger image.
|
||||
* NOTE: if the source image is a JPEG image, then <code>scaledWidth</code>
|
||||
* can be determined by calling <code>
|
||||
* scalingFactor.{@link TJScalingFactor#getScaled getScaled}(jpegWidth)
|
||||
* </code> or by calling {@link #getScaledWidth}. If the source image is a
|
||||
* YUV image, then <code>scaledWidth</code> is the width of the YUV image.
|
||||
* can be determined by calling
|
||||
* <code>scalingFactor.</code>{@link TJScalingFactor#getScaled getScaled}<code>(jpegWidth)</code>
|
||||
* or by calling {@link #getScaledWidth}. If the source image is a YUV
|
||||
* image, then <code>scaledWidth</code> is the width of the YUV image.
|
||||
* Setting this parameter to 0 is the equivalent of setting it to
|
||||
* <code>scaledWidth</code>.
|
||||
*
|
||||
@@ -683,8 +703,8 @@ public class TJDecompressor implements Closeable {
|
||||
* than the source image dimensions, then TurboJPEG will use scaling in the
|
||||
* JPEG decompressor to generate the largest possible image that will fit
|
||||
* within the desired dimensions. Setting this to 0 is the same as setting
|
||||
* it to the height of the JPEG image (in other words, the height will not be
|
||||
* considered when determining the scaled image size.) This parameter is
|
||||
* it to the height of the JPEG image. (In other words, the height will not
|
||||
* be considered when determining the scaled image size.) This parameter is
|
||||
* ignored if the source image is a YUV image.
|
||||
*
|
||||
* @param pixelFormat pixel format of the decompressed image (one of
|
||||
@@ -697,7 +717,7 @@ public class TJDecompressor implements Closeable {
|
||||
int stride, int desiredHeight, int pixelFormat,
|
||||
int flags) throws TJException {
|
||||
if (jpegBuf == null && yuvImage == null)
|
||||
throw new IllegalStateException(NO_ASSOC_ERROR);
|
||||
throw new IllegalStateException("No source image is associated with this instance");
|
||||
if (dstBuf == null || x < 0 || y < 0 || stride < 0 ||
|
||||
(yuvImage != null && (desiredWidth < 0 || desiredHeight < 0)) ||
|
||||
pixelFormat < 0 || pixelFormat >= TJ.NUMPF || flags < 0)
|
||||
@@ -713,21 +733,22 @@ public class TJDecompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Decompress the JPEG source image or decode the YUV source image associated
|
||||
* with this decompressor instance and output a decompressed/decoded image to
|
||||
* the given <code>BufferedImage</code> instance.
|
||||
* Decompress the JPEG source image or decode the planar YUV source image
|
||||
* associated with this decompressor instance and output a packed-pixel
|
||||
* decompressed/decoded image to the given <code>BufferedImage</code>
|
||||
* instance.
|
||||
* <p>
|
||||
* NOTE: The output image is fully recoverable if this method throws a
|
||||
* NOTE: The destination image is fully recoverable if this method throws a
|
||||
* non-fatal {@link TJException} (unless
|
||||
* {@link TJ#FLAG_STOPONWARNING TJ.FLAG_STOPONWARNING} is specified.)
|
||||
*
|
||||
* @param dstImage a <code>BufferedImage</code> instance that will receive
|
||||
* the decompressed/decoded image. If the source image is a JPEG image, then
|
||||
* the width and height of the <code>BufferedImage</code> instance must match
|
||||
* one of the scaled image sizes that TurboJPEG is capable of generating from
|
||||
* the JPEG image. If the source image is a YUV image, then the width and
|
||||
* height of the <code>BufferedImage</code> instance must match the width and
|
||||
* height of the YUV image.
|
||||
* the packed-pixel decompressed/decoded image. If the source image is a
|
||||
* JPEG image, then the width and height of the <code>BufferedImage</code>
|
||||
* instance must match one of the scaled image sizes that the decompressor is
|
||||
* capable of generating from the JPEG image. If the source image is a YUV
|
||||
* image, then the width and height of the <code>BufferedImage</code>
|
||||
* instance must match the width and height of the YUV image.
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of
|
||||
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
|
||||
@@ -750,7 +771,7 @@ public class TJDecompressor implements Closeable {
|
||||
scaledWidth = getScaledWidth(desiredWidth, desiredHeight);
|
||||
scaledHeight = getScaledHeight(desiredWidth, desiredHeight);
|
||||
if (scaledWidth != desiredWidth || scaledHeight != desiredHeight)
|
||||
throw new IllegalArgumentException("BufferedImage dimensions do not match one of the scaled image sizes that TurboJPEG is capable of generating.");
|
||||
throw new IllegalArgumentException("BufferedImage dimensions do not match one of the scaled image sizes that the decompressor is capable of generating.");
|
||||
}
|
||||
int pixelFormat; boolean intPixels = false;
|
||||
if (byteOrder == null)
|
||||
@@ -818,9 +839,10 @@ public class TJDecompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Decompress the JPEG source image or decode the YUV source image associated
|
||||
* with this decompressor instance and return a <code>BufferedImage</code>
|
||||
* instance containing the decompressed/decoded image.
|
||||
* Decompress the JPEG source image or decode the planar YUV source image
|
||||
* associated with this decompressor instance and return a
|
||||
* <code>BufferedImage</code> instance containing the packed-pixel
|
||||
* decompressed/decoded image.
|
||||
*
|
||||
* @param desiredWidth see
|
||||
* {@link #decompress(byte[], int, int, int, int, int, int, int)} for
|
||||
@@ -837,7 +859,7 @@ public class TJDecompressor implements Closeable {
|
||||
* @param flags the bitwise OR of one or more of
|
||||
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
|
||||
*
|
||||
* @return a <code>BufferedImage</code> instance containing the
|
||||
* @return a <code>BufferedImage</code> instance containing the packed-pixel
|
||||
* decompressed/decoded image.
|
||||
*/
|
||||
public BufferedImage decompress(int desiredWidth, int desiredHeight,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2011-2013, 2016 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2011-2013, 2016, 2020 D. R. Commander. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -36,9 +36,9 @@ final class TJLoader {
|
||||
String os = System.getProperty("os.name").toLowerCase();
|
||||
if (os.indexOf("mac") >= 0) {
|
||||
try {
|
||||
System.load("@CMAKE_INSTALL_FULL_LIBDIR@/libturbojpeg.jnilib");
|
||||
System.load("@CMAKE_INSTALL_FULL_LIBDIR@/libturbojpeg.dylib");
|
||||
} catch (java.lang.UnsatisfiedLinkError e2) {
|
||||
System.load("/usr/lib/libturbojpeg.jnilib");
|
||||
System.load("/usr/lib/libturbojpeg.dylib");
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2011, 2013, 2018 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2011, 2013, 2018, 2023 D. R. Commander. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -114,8 +114,8 @@ public class TJTransform extends Rectangle {
|
||||
*/
|
||||
public static final int OPT_CROP = 4;
|
||||
/**
|
||||
* This option will discard the color data in the input image and produce
|
||||
* a grayscale output image.
|
||||
* This option will discard the color data in the source image and produce a
|
||||
* grayscale destination image.
|
||||
*/
|
||||
public static final int OPT_GRAY = 8;
|
||||
/**
|
||||
@@ -127,17 +127,16 @@ public class TJTransform extends Rectangle {
|
||||
*/
|
||||
public static final int OPT_NOOUTPUT = 16;
|
||||
/**
|
||||
* This option will enable progressive entropy coding in the output image
|
||||
* This option will enable progressive entropy coding in the JPEG image
|
||||
* generated by this particular transform. Progressive entropy coding will
|
||||
* generally improve compression relative to baseline entropy coding (the
|
||||
* default), but it will reduce compression and decompression performance
|
||||
* considerably.
|
||||
* default), but it will reduce decompression performance considerably.
|
||||
*/
|
||||
public static final int OPT_PROGRESSIVE = 32;
|
||||
/**
|
||||
* This option will prevent {@link TJTransformer#transform
|
||||
* TJTransformer.transform()} from copying any extra markers (including EXIF
|
||||
* and ICC profile data) from the source image to the output image.
|
||||
* and ICC profile data) from the source image to the destination image.
|
||||
*/
|
||||
public static final int OPT_COPYNONE = 64;
|
||||
|
||||
@@ -165,10 +164,10 @@ public class TJTransform extends Rectangle {
|
||||
* equivalent of setting it to (height of the source JPEG image -
|
||||
* <code>y</code>).
|
||||
*
|
||||
* @param op one of the transform operations (<code>OP_*</code>)
|
||||
* @param op one of the transform operations ({@link #OP_NONE OP_*})
|
||||
*
|
||||
* @param options the bitwise OR of one or more of the transform options
|
||||
* (<code>OPT_*</code>)
|
||||
* ({@link #OPT_PERFECT OPT_*})
|
||||
*
|
||||
* @param cf an instance of an object that implements the {@link
|
||||
* TJCustomFilter} interface, or null if no custom filter is needed
|
||||
@@ -190,10 +189,10 @@ public class TJTransform extends Rectangle {
|
||||
* #TJTransform(int, int, int, int, int, int, TJCustomFilter)} for more
|
||||
* detail.
|
||||
*
|
||||
* @param op one of the transform operations (<code>OP_*</code>)
|
||||
* @param op one of the transform operations ({@link #OP_NONE OP_*})
|
||||
*
|
||||
* @param options the bitwise OR of one or more of the transform options
|
||||
* (<code>OPT_*</code>)
|
||||
* ({@link #OPT_PERFECT OPT_*})
|
||||
*
|
||||
* @param cf an instance of an object that implements the {@link
|
||||
* TJCustomFilter} interface, or null if no custom filter is needed
|
||||
@@ -208,13 +207,14 @@ public class TJTransform extends Rectangle {
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform operation (one of <code>OP_*</code>)
|
||||
* Transform operation (one of {@link #OP_NONE OP_*})
|
||||
*/
|
||||
@SuppressWarnings("checkstyle:VisibilityModifier")
|
||||
public int op = 0;
|
||||
|
||||
/**
|
||||
* Transform options (bitwise OR of one or more of <code>OPT_*</code>)
|
||||
* Transform options (bitwise OR of one or more of
|
||||
* {@link #OPT_PERFECT OPT_*})
|
||||
*/
|
||||
@SuppressWarnings("checkstyle:VisibilityModifier")
|
||||
public int options = 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2011, 2013-2015 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2011, 2013-2015, 2023 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -43,10 +43,12 @@ public class TJTransformer extends TJDecompressor {
|
||||
|
||||
/**
|
||||
* Create a TurboJPEG lossless transformer instance and associate the JPEG
|
||||
* image stored in <code>jpegImage</code> with the newly created instance.
|
||||
* source image stored in <code>jpegImage</code> with the newly created
|
||||
* instance.
|
||||
*
|
||||
* @param jpegImage JPEG image buffer (size of the JPEG image is assumed to
|
||||
* be the length of the array.) This buffer is not modified.
|
||||
* @param jpegImage buffer containing the JPEG source image to transform.
|
||||
* (The size of the JPEG image is assumed to be the length of the array.)
|
||||
* This buffer is not modified.
|
||||
*/
|
||||
public TJTransformer(byte[] jpegImage) throws TJException {
|
||||
init();
|
||||
@@ -55,12 +57,13 @@ public class TJTransformer extends TJDecompressor {
|
||||
|
||||
/**
|
||||
* Create a TurboJPEG lossless transformer instance and associate the JPEG
|
||||
* image of length <code>imageSize</code> bytes stored in
|
||||
* source image of length <code>imageSize</code> bytes stored in
|
||||
* <code>jpegImage</code> with the newly created instance.
|
||||
*
|
||||
* @param jpegImage JPEG image buffer. This buffer is not modified.
|
||||
* @param jpegImage buffer containing the JPEG source image to transform.
|
||||
* This buffer is not modified.
|
||||
*
|
||||
* @param imageSize size of the JPEG image (in bytes)
|
||||
* @param imageSize size of the JPEG source image (in bytes)
|
||||
*/
|
||||
public TJTransformer(byte[] jpegImage, int imageSize) throws TJException {
|
||||
init();
|
||||
@@ -68,28 +71,29 @@ public class TJTransformer extends TJDecompressor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Losslessly transform the JPEG image associated with this transformer
|
||||
* instance into one or more JPEG images stored in the given destination
|
||||
* buffers. Lossless transforms work by moving the raw coefficients from one
|
||||
* JPEG image structure to another without altering the values of the
|
||||
* coefficients. While this is typically faster than decompressing the
|
||||
* image, transforming it, and re-compressing it, lossless transforms are not
|
||||
* free. Each lossless transform requires reading and performing Huffman
|
||||
* decoding on all of the coefficients in the source image, regardless of the
|
||||
* size of the destination image. Thus, this method provides a means of
|
||||
* generating multiple transformed images from the same source or of applying
|
||||
* multiple transformations simultaneously, in order to eliminate the need to
|
||||
* read the source coefficients multiple times.
|
||||
* Losslessly transform the JPEG source image associated with this
|
||||
* transformer instance into one or more JPEG images stored in the given
|
||||
* destination buffers. Lossless transforms work by moving the raw
|
||||
* coefficients from one JPEG image structure to another without altering the
|
||||
* values of the coefficients. While this is typically faster than
|
||||
* decompressing the image, transforming it, and re-compressing it, lossless
|
||||
* transforms are not free. Each lossless transform requires reading and
|
||||
* performing Huffman decoding on all of the coefficients in the source
|
||||
* image, regardless of the size of the destination image. Thus, this method
|
||||
* provides a means of generating multiple transformed images from the same
|
||||
* source or of applying multiple transformations simultaneously, in order to
|
||||
* eliminate the need to read the source coefficients multiple times.
|
||||
*
|
||||
* @param dstBufs an array of image buffers. <code>dstbufs[i]</code> will
|
||||
* receive a JPEG image that has been transformed using the parameters in
|
||||
* <code>transforms[i]</code>. Use {@link TJ#bufSize} to determine the
|
||||
* maximum size for each buffer based on the transformed or cropped width and
|
||||
* height and the level of subsampling used in the source image.
|
||||
* @param dstBufs an array of JPEG destination buffers.
|
||||
* <code>dstbufs[i]</code> will receive a JPEG image that has been
|
||||
* transformed using the parameters in <code>transforms[i]</code>. Use
|
||||
* {@link TJ#bufSize} to determine the maximum size for each buffer based on
|
||||
* the transformed or cropped width and height and the level of subsampling
|
||||
* used in the source image.
|
||||
*
|
||||
* @param transforms an array of {@link TJTransform} instances, each of
|
||||
* which specifies the transform parameters and/or cropping region for the
|
||||
* corresponding transformed output image
|
||||
* corresponding transformed JPEG image
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of
|
||||
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
|
||||
@@ -103,13 +107,13 @@ public class TJTransformer extends TJDecompressor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Losslessly transform the JPEG image associated with this transformer
|
||||
* instance and return an array of {@link TJDecompressor} instances, each of
|
||||
* which has a transformed JPEG image associated with it.
|
||||
* Losslessly transform the JPEG source image associated with this
|
||||
* transformer instance and return an array of {@link TJDecompressor}
|
||||
* instances, each of which has a transformed JPEG image associated with it.
|
||||
*
|
||||
* @param transforms an array of {@link TJTransform} instances, each of
|
||||
* which specifies the transform parameters and/or cropping region for the
|
||||
* corresponding transformed output image
|
||||
* corresponding transformed JPEG image
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of
|
||||
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
|
||||
@@ -139,10 +143,10 @@ public class TJTransformer extends TJDecompressor {
|
||||
|
||||
/**
|
||||
* Returns an array containing the sizes of the transformed JPEG images
|
||||
* generated by the most recent transform operation.
|
||||
* (in bytes) generated by the most recent transform operation.
|
||||
*
|
||||
* @return an array containing the sizes of the transformed JPEG images
|
||||
* generated by the most recent transform operation.
|
||||
* (in bytes) generated by the most recent transform operation.
|
||||
*/
|
||||
public int[] getTransformedSizes() {
|
||||
if (transformedSizes == null)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2014, 2017 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2014, 2017, 2023 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -30,7 +30,7 @@
|
||||
package org.libjpegturbo.turbojpeg;
|
||||
|
||||
/**
|
||||
* This class encapsulates a YUV planar image and the metadata
|
||||
* This class encapsulates a planar YUV image and the metadata
|
||||
* associated with it. The TurboJPEG API allows both the JPEG compression and
|
||||
* decompression pipelines to be split into stages: YUV encode, compress from
|
||||
* YUV, decompress to YUV, and YUV decode. A <code>YUVImage</code> instance
|
||||
@@ -38,30 +38,32 @@ package org.libjpegturbo.turbojpeg;
|
||||
* operations and as the source image for compress-from-YUV and YUV decode
|
||||
* operations.
|
||||
* <p>
|
||||
* Technically, the JPEG format uses the YCbCr colorspace (which technically is
|
||||
* not a "colorspace" but rather a "color transform"), but per the convention
|
||||
* of the digital video community, the TurboJPEG API uses "YUV" to refer to an
|
||||
* image format consisting of Y, Cb, and Cr image planes.
|
||||
* Technically, the JPEG format uses the YCbCr colorspace (which is technically
|
||||
* not a colorspace but a color transform), but per the convention of the
|
||||
* digital video community, the TurboJPEG API uses "YUV" to refer to an image
|
||||
* format consisting of Y, Cb, and Cr image planes.
|
||||
* <p>
|
||||
* Each plane is simply a 2D array of bytes, each byte representing the value
|
||||
* of one of the components (Y, Cb, or Cr) at a particular location in the
|
||||
* image. The width and height of each plane are determined by the image
|
||||
* width, height, and level of chrominance subsampling. The luminance plane
|
||||
* width is the image width padded to the nearest multiple of the horizontal
|
||||
* subsampling factor (2 in the case of 4:2:0 and 4:2:2, 4 in the case of
|
||||
* 4:1:1, 1 in the case of 4:4:4 or grayscale.) Similarly, the luminance plane
|
||||
* height is the image height padded to the nearest multiple of the vertical
|
||||
* subsampling factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4
|
||||
* or grayscale.) The chrominance plane width is equal to the luminance plane
|
||||
* width divided by the horizontal subsampling factor, and the chrominance
|
||||
* plane height is equal to the luminance plane height divided by the vertical
|
||||
* subsampling factor.
|
||||
* subsampling factor (1 in the case of 4:4:4, grayscale, or 4:4:0; 2 in the
|
||||
* case of 4:2:2 or 4:2:0; 4 in the case of 4:1:1.) Similarly, the luminance
|
||||
* plane height is the image height padded to the nearest multiple of the
|
||||
* vertical subsampling factor (1 in the case of 4:4:4, 4:2:2, grayscale, or
|
||||
* 4:1:1; 2 in the case of 4:2:0 or 4:4:0.) This is irrespective of any
|
||||
* additional padding that may be specified as an argument to the various
|
||||
* YUVImage methods. The chrominance plane width is equal to the luminance
|
||||
* plane width divided by the horizontal subsampling factor, and the
|
||||
* chrominance plane height is equal to the luminance plane height divided by
|
||||
* the vertical subsampling factor.
|
||||
* <p>
|
||||
* For example, if the source image is 35 x 35 pixels and 4:2:2 subsampling is
|
||||
* used, then the luminance plane would be 36 x 35 bytes, and each of the
|
||||
* chrominance planes would be 18 x 35 bytes. If you specify a line padding of
|
||||
* 4 bytes on top of this, then the luminance plane would be 36 x 35 bytes, and
|
||||
* each of the chrominance planes would be 20 x 35 bytes.
|
||||
* chrominance planes would be 18 x 35 bytes. If you specify a row alignment
|
||||
* of 4 bytes on top of this, then the luminance plane would be 36 x 35 bytes,
|
||||
* and each of the chrominance planes would be 20 x 35 bytes.
|
||||
*/
|
||||
public class YUVImage {
|
||||
|
||||
@@ -75,7 +77,7 @@ public class YUVImage {
|
||||
* @param width width (in pixels) of the YUV image
|
||||
*
|
||||
* @param strides an array of integers, each specifying the number of bytes
|
||||
* per line in the corresponding plane of the YUV image. Setting the stride
|
||||
* per row in the corresponding plane of the YUV image. Setting the stride
|
||||
* for any plane to 0 is the same as setting it to the plane width (see
|
||||
* {@link YUVImage above}.) If <code>strides</code> is null, then the
|
||||
* strides for all planes will be set to their respective plane widths. When
|
||||
@@ -92,22 +94,24 @@ public class YUVImage {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new <code>YUVImage</code> instance backed by a unified image
|
||||
* buffer, and allocate memory for the image buffer.
|
||||
* Create a new <code>YUVImage</code> instance backed by a unified buffer,
|
||||
* and allocate memory for the buffer.
|
||||
*
|
||||
* @param width width (in pixels) of the YUV image
|
||||
*
|
||||
* @param pad Each line of each plane in the YUV image buffer will be padded
|
||||
* to this number of bytes (must be a power of 2.)
|
||||
* @param align row alignment (in bytes) of the YUV image (must be a power of
|
||||
* 2.) Setting this parameter to n specifies that each row in each plane of
|
||||
* the YUV image will be padded to the nearest multiple of n bytes
|
||||
* (1 = unpadded.)
|
||||
*
|
||||
* @param height height (in pixels) of the YUV image
|
||||
*
|
||||
* @param subsamp the level of chrominance subsampling to be used in the YUV
|
||||
* image (one of {@link TJ#SAMP_444 TJ.SAMP_*})
|
||||
*/
|
||||
public YUVImage(int width, int pad, int height, int subsamp) {
|
||||
setBuf(new byte[TJ.bufSizeYUV(width, pad, height, subsamp)], width, pad,
|
||||
height, subsamp);
|
||||
public YUVImage(int width, int align, int height, int subsamp) {
|
||||
setBuf(new byte[TJ.bufSizeYUV(width, align, height, subsamp)], width,
|
||||
align, height, subsamp);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -117,8 +121,8 @@ public class YUVImage {
|
||||
* @param planes an array of buffers representing the Y, U (Cb), and V (Cr)
|
||||
* image planes (or just the Y plane, if the image is grayscale.) These
|
||||
* planes can be contiguous or non-contiguous in memory. Plane
|
||||
* <code>i</code> should be at least <code>offsets[i] +
|
||||
* {@link TJ#planeSizeYUV TJ.planeSizeYUV}(i, width, strides[i], height, subsamp)</code>
|
||||
* <code>i</code> should be at least <code>offsets[i] + </code>
|
||||
* {@link TJ#planeSizeYUV TJ.planeSizeYUV}<code>(i, width, strides[i], height, subsamp)</code>
|
||||
* bytes in size.
|
||||
*
|
||||
* @param offsets If this <code>YUVImage</code> instance represents a
|
||||
@@ -130,11 +134,11 @@ public class YUVImage {
|
||||
* @param width width (in pixels) of the new YUV image (or subregion)
|
||||
*
|
||||
* @param strides an array of integers, each specifying the number of bytes
|
||||
* per line in the corresponding plane of the YUV image. Setting the stride
|
||||
* per row in the corresponding plane of the YUV image. Setting the stride
|
||||
* for any plane to 0 is the same as setting it to the plane width (see
|
||||
* {@link YUVImage above}.) If <code>strides</code> is null, then the
|
||||
* strides for all planes will be set to their respective plane widths. You
|
||||
* can adjust the strides in order to add an arbitrary amount of line padding
|
||||
* can adjust the strides in order to add an arbitrary amount of row padding
|
||||
* to each plane or to specify that this <code>YUVImage</code> instance is a
|
||||
* subregion of a larger image (in which case, <code>strides[i]</code> should
|
||||
* be set to the plane width of plane <code>i</code> in the larger image.)
|
||||
@@ -150,29 +154,30 @@ public class YUVImage {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new <code>YUVImage</code> instance from an existing unified image
|
||||
* Create a new <code>YUVImage</code> instance from an existing unified
|
||||
* buffer.
|
||||
*
|
||||
* @param yuvImage image buffer that contains or will contain YUV planar
|
||||
* image data. Use {@link TJ#bufSizeYUV} to determine the minimum size for
|
||||
* this buffer. The Y, U (Cb), and V (Cr) image planes are stored
|
||||
* sequentially in the buffer (see {@link YUVImage above} for a description
|
||||
* of the image format.)
|
||||
* @param yuvImage buffer that contains or will receive a unified planar YUV
|
||||
* image. Use {@link TJ#bufSizeYUV} to determine the minimum size for this
|
||||
* buffer. The Y, U (Cb), and V (Cr) image planes are stored sequentially in
|
||||
* the buffer. (See {@link YUVImage above} for a description of the image
|
||||
* format.)
|
||||
*
|
||||
* @param width width (in pixels) of the YUV image
|
||||
*
|
||||
* @param pad the line padding used in the YUV image buffer. For
|
||||
* instance, if each line in each plane of the buffer is padded to the
|
||||
* nearest multiple of 4 bytes, then <code>pad</code> should be set to 4.
|
||||
* @param align row alignment (in bytes) of the YUV image (must be a power of
|
||||
* 2.) Setting this parameter to n specifies that each row in each plane of
|
||||
* the YUV image will be padded to the nearest multiple of n bytes
|
||||
* (1 = unpadded.)
|
||||
*
|
||||
* @param height height (in pixels) of the YUV image
|
||||
*
|
||||
* @param subsamp the level of chrominance subsampling used in the YUV
|
||||
* image (one of {@link TJ#SAMP_444 TJ.SAMP_*})
|
||||
*/
|
||||
public YUVImage(byte[] yuvImage, int width, int pad, int height,
|
||||
public YUVImage(byte[] yuvImage, int width, int align, int height,
|
||||
int subsamp) {
|
||||
setBuf(yuvImage, width, pad, height, subsamp);
|
||||
setBuf(yuvImage, width, align, height, subsamp);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -181,8 +186,8 @@ public class YUVImage {
|
||||
* @param planes an array of buffers representing the Y, U (Cb), and V (Cr)
|
||||
* image planes (or just the Y plane, if the image is grayscale.) These
|
||||
* planes can be contiguous or non-contiguous in memory. Plane
|
||||
* <code>i</code> should be at least <code>offsets[i] +
|
||||
* {@link TJ#planeSizeYUV TJ.planeSizeYUV}(i, width, strides[i], height, subsamp)</code>
|
||||
* <code>i</code> should be at least <code>offsets[i] + </code>
|
||||
* {@link TJ#planeSizeYUV TJ.planeSizeYUV}<code>(i, width, strides[i], height, subsamp)</code>
|
||||
* bytes in size.
|
||||
*
|
||||
* @param offsets If this <code>YUVImage</code> instance represents a
|
||||
@@ -194,12 +199,12 @@ public class YUVImage {
|
||||
* @param width width (in pixels) of the YUV image (or subregion)
|
||||
*
|
||||
* @param strides an array of integers, each specifying the number of bytes
|
||||
* per line in the corresponding plane of the YUV image. Setting the stride
|
||||
* per row in the corresponding plane of the YUV image. Setting the stride
|
||||
* for any plane to 0 is the same as setting it to the plane width (see
|
||||
* {@link YUVImage above}.) If <code>strides</code> is null, then the
|
||||
* strides for all planes will be set to their respective plane widths. You
|
||||
* can adjust the strides in order to add an arbitrary amount of line padding
|
||||
* to each plane or to specify that this <code>YUVImage</code> image is a
|
||||
* can adjust the strides in order to add an arbitrary amount of row padding
|
||||
* to each plane or to specify that this <code>YUVImage</code> instance is a
|
||||
* subregion of a larger image (in which case, <code>strides[i]</code> should
|
||||
* be set to the plane width of plane <code>i</code> in the larger image.)
|
||||
*
|
||||
@@ -263,32 +268,34 @@ public class YUVImage {
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign a unified image buffer to this <code>YUVImage</code> instance.
|
||||
* Assign a unified buffer to this <code>YUVImage</code> instance.
|
||||
*
|
||||
* @param yuvImage image buffer that contains or will contain YUV planar
|
||||
* image data. Use {@link TJ#bufSizeYUV} to determine the minimum size for
|
||||
* this buffer. The Y, U (Cb), and V (Cr) image planes are stored
|
||||
* sequentially in the buffer (see {@link YUVImage above} for a description
|
||||
* of the image format.)
|
||||
* @param yuvImage buffer that contains or will receive a unified planar YUV
|
||||
* image. Use {@link TJ#bufSizeYUV} to determine the minimum size for this
|
||||
* buffer. The Y, U (Cb), and V (Cr) image planes are stored sequentially in
|
||||
* the buffer. (See {@link YUVImage above} for a description of the image
|
||||
* format.)
|
||||
*
|
||||
* @param width width (in pixels) of the YUV image
|
||||
*
|
||||
* @param pad the line padding used in the YUV image buffer. For
|
||||
* instance, if each line in each plane of the buffer is padded to the
|
||||
* nearest multiple of 4 bytes, then <code>pad</code> should be set to 4.
|
||||
* @param align row alignment (in bytes) of the YUV image (must be a power of
|
||||
* 2.) Setting this parameter to n specifies that each row in each plane of
|
||||
* the YUV image will be padded to the nearest multiple of n bytes
|
||||
* (1 = unpadded.)
|
||||
*
|
||||
* @param height height (in pixels) of the YUV image
|
||||
*
|
||||
* @param subsamp the level of chrominance subsampling used in the YUV
|
||||
* image (one of {@link TJ#SAMP_444 TJ.SAMP_*})
|
||||
*/
|
||||
public void setBuf(byte[] yuvImage, int width, int pad, int height,
|
||||
public void setBuf(byte[] yuvImage, int width, int align, int height,
|
||||
int subsamp) {
|
||||
if (yuvImage == null || width < 1 || pad < 1 || ((pad & (pad - 1)) != 0) ||
|
||||
height < 1 || subsamp < 0 || subsamp >= TJ.NUMSAMP)
|
||||
if (yuvImage == null || width < 1 || align < 1 ||
|
||||
((align & (align - 1)) != 0) || height < 1 || subsamp < 0 ||
|
||||
subsamp >= TJ.NUMSAMP)
|
||||
throw new IllegalArgumentException("Invalid argument in YUVImage::setBuf()");
|
||||
if (yuvImage.length < TJ.bufSizeYUV(width, pad, height, subsamp))
|
||||
throw new IllegalArgumentException("YUV image buffer is not large enough");
|
||||
if (yuvImage.length < TJ.bufSizeYUV(width, align, height, subsamp))
|
||||
throw new IllegalArgumentException("YUV buffer is not large enough");
|
||||
|
||||
int nc = (subsamp == TJ.SAMP_GRAY ? 1 : 3);
|
||||
byte[][] planes = new byte[nc][];
|
||||
@@ -296,9 +303,9 @@ public class YUVImage {
|
||||
int[] offsets = new int[nc];
|
||||
|
||||
planes[0] = yuvImage;
|
||||
strides[0] = pad(TJ.planeWidth(0, width, subsamp), pad);
|
||||
strides[0] = pad(TJ.planeWidth(0, width, subsamp), align);
|
||||
if (subsamp != TJ.SAMP_GRAY) {
|
||||
strides[1] = strides[2] = pad(TJ.planeWidth(1, width, subsamp), pad);
|
||||
strides[1] = strides[2] = pad(TJ.planeWidth(1, width, subsamp), align);
|
||||
planes[1] = planes[2] = yuvImage;
|
||||
offsets[1] = offsets[0] +
|
||||
strides[0] * TJ.planeHeight(0, height, subsamp);
|
||||
@@ -306,7 +313,7 @@ public class YUVImage {
|
||||
strides[1] * TJ.planeHeight(1, height, subsamp);
|
||||
}
|
||||
|
||||
yuvPad = pad;
|
||||
yuvAlign = align;
|
||||
setBuf(planes, offsets, width, strides, height, subsamp);
|
||||
}
|
||||
|
||||
@@ -333,23 +340,23 @@ public class YUVImage {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the line padding used in the YUV image buffer (if this image is
|
||||
* Returns the row alignment (in bytes) of the YUV buffer (if this image is
|
||||
* stored in a unified buffer rather than separate image planes.)
|
||||
*
|
||||
* @return the line padding used in the YUV image buffer
|
||||
* @return the row alignment of the YUV buffer
|
||||
*/
|
||||
public int getPad() {
|
||||
if (yuvPlanes == null)
|
||||
throw new IllegalStateException(NO_ASSOC_ERROR);
|
||||
if (yuvPad < 1 || ((yuvPad & (yuvPad - 1)) != 0))
|
||||
if (yuvAlign < 1 || ((yuvAlign & (yuvAlign - 1)) != 0))
|
||||
throw new IllegalStateException("Image is not stored in a unified buffer");
|
||||
return yuvPad;
|
||||
return yuvAlign;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of bytes per line of each plane in the YUV image.
|
||||
* Returns the number of bytes per row of each plane in the YUV image.
|
||||
*
|
||||
* @return the number of bytes per line of each plane in the YUV image
|
||||
* @return the number of bytes per row of each plane in the YUV image
|
||||
*/
|
||||
public int[] getStrides() {
|
||||
if (yuvStrides == null)
|
||||
@@ -395,10 +402,10 @@ public class YUVImage {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the YUV image buffer (if this image is stored in a unified
|
||||
* buffer rather than separate image planes.)
|
||||
* Returns the YUV buffer (if this image is stored in a unified buffer rather
|
||||
* than separate image planes.)
|
||||
*
|
||||
* @return the YUV image buffer
|
||||
* @return the YUV buffer
|
||||
*/
|
||||
public byte[] getBuf() {
|
||||
if (yuvPlanes == null || yuvSubsamp < 0 || yuvSubsamp >= TJ.NUMSAMP)
|
||||
@@ -412,22 +419,22 @@ public class YUVImage {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the size (in bytes) of the YUV image buffer (if this image is
|
||||
* stored in a unified buffer rather than separate image planes.)
|
||||
* Returns the size (in bytes) of the YUV buffer (if this image is stored in
|
||||
* a unified buffer rather than separate image planes.)
|
||||
*
|
||||
* @return the size (in bytes) of the YUV image buffer
|
||||
* @return the size (in bytes) of the YUV buffer
|
||||
*/
|
||||
public int getSize() {
|
||||
if (yuvPlanes == null || yuvSubsamp < 0 || yuvSubsamp >= TJ.NUMSAMP)
|
||||
throw new IllegalStateException(NO_ASSOC_ERROR);
|
||||
int nc = (yuvSubsamp == TJ.SAMP_GRAY ? 1 : 3);
|
||||
if (yuvPad < 1)
|
||||
if (yuvAlign < 1)
|
||||
throw new IllegalStateException("Image is not stored in a unified buffer");
|
||||
for (int i = 1; i < nc; i++) {
|
||||
if (yuvPlanes[i] != yuvPlanes[0])
|
||||
throw new IllegalStateException("Image is not stored in a unified buffer");
|
||||
}
|
||||
return TJ.bufSizeYUV(yuvWidth, yuvPad, yuvHeight, yuvSubsamp);
|
||||
return TJ.bufSizeYUV(yuvWidth, yuvAlign, yuvHeight, yuvSubsamp);
|
||||
}
|
||||
|
||||
private static int pad(int v, int p) {
|
||||
@@ -438,7 +445,7 @@ public class YUVImage {
|
||||
protected byte[][] yuvPlanes = null;
|
||||
protected int[] yuvOffsets = null;
|
||||
protected int[] yuvStrides = null;
|
||||
protected int yuvPad = 0;
|
||||
protected int yuvAlign = 1;
|
||||
protected int yuvWidth = 0;
|
||||
protected int yuvHeight = 0;
|
||||
protected int yuvSubsamp = -1;
|
||||
|
||||
@@ -61,12 +61,32 @@ extern "C" {
|
||||
#define org_libjpegturbo_turbojpeg_TJ_CS_YCCK 4L
|
||||
#undef org_libjpegturbo_turbojpeg_TJ_FLAG_BOTTOMUP
|
||||
#define org_libjpegturbo_turbojpeg_TJ_FLAG_BOTTOMUP 2L
|
||||
#undef org_libjpegturbo_turbojpeg_TJ_FLAG_FORCEMMX
|
||||
#define org_libjpegturbo_turbojpeg_TJ_FLAG_FORCEMMX 8L
|
||||
#undef org_libjpegturbo_turbojpeg_TJ_FLAG_FORCESSE
|
||||
#define org_libjpegturbo_turbojpeg_TJ_FLAG_FORCESSE 16L
|
||||
#undef org_libjpegturbo_turbojpeg_TJ_FLAG_FORCESSE2
|
||||
#define org_libjpegturbo_turbojpeg_TJ_FLAG_FORCESSE2 32L
|
||||
#undef org_libjpegturbo_turbojpeg_TJ_FLAG_FORCESSE3
|
||||
#define org_libjpegturbo_turbojpeg_TJ_FLAG_FORCESSE3 128L
|
||||
#undef org_libjpegturbo_turbojpeg_TJ_FLAG_FASTUPSAMPLE
|
||||
#define org_libjpegturbo_turbojpeg_TJ_FLAG_FASTUPSAMPLE 256L
|
||||
#undef org_libjpegturbo_turbojpeg_TJ_FLAG_FASTDCT
|
||||
#define org_libjpegturbo_turbojpeg_TJ_FLAG_FASTDCT 2048L
|
||||
#undef org_libjpegturbo_turbojpeg_TJ_FLAG_ACCURATEDCT
|
||||
#define org_libjpegturbo_turbojpeg_TJ_FLAG_ACCURATEDCT 4096L
|
||||
#undef org_libjpegturbo_turbojpeg_TJ_FLAG_STOPONWARNING
|
||||
#define org_libjpegturbo_turbojpeg_TJ_FLAG_STOPONWARNING 8192L
|
||||
#undef org_libjpegturbo_turbojpeg_TJ_FLAG_PROGRESSIVE
|
||||
#define org_libjpegturbo_turbojpeg_TJ_FLAG_PROGRESSIVE 16384L
|
||||
#undef org_libjpegturbo_turbojpeg_TJ_FLAG_LIMITSCANS
|
||||
#define org_libjpegturbo_turbojpeg_TJ_FLAG_LIMITSCANS 32768L
|
||||
#undef org_libjpegturbo_turbojpeg_TJ_NUMERR
|
||||
#define org_libjpegturbo_turbojpeg_TJ_NUMERR 2L
|
||||
#undef org_libjpegturbo_turbojpeg_TJ_ERR_WARNING
|
||||
#define org_libjpegturbo_turbojpeg_TJ_ERR_WARNING 0L
|
||||
#undef org_libjpegturbo_turbojpeg_TJ_ERR_FATAL
|
||||
#define org_libjpegturbo_turbojpeg_TJ_ERR_FATAL 1L
|
||||
/*
|
||||
* Class: org_libjpegturbo_turbojpeg_TJ
|
||||
* Method: bufSize
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
* Copyright (C) 1994-1998, Thomas G. Lane.
|
||||
* Modified 2003-2010 by Guido Vollbeding.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2014, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
* Copyright (C) 2022, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
* This file contains application interface code for the compression half
|
||||
* of the JPEG library. These are the "minimum" API routines that may be
|
||||
@@ -53,7 +54,7 @@ jpeg_CreateCompress(j_compress_ptr cinfo, int version, size_t structsize)
|
||||
{
|
||||
struct jpeg_error_mgr *err = cinfo->err;
|
||||
void *client_data = cinfo->client_data; /* ignore Purify complaint here */
|
||||
MEMZERO(cinfo, sizeof(struct jpeg_compress_struct));
|
||||
memset(cinfo, 0, sizeof(struct jpeg_compress_struct));
|
||||
cinfo->err = err;
|
||||
cinfo->client_data = client_data;
|
||||
}
|
||||
@@ -100,7 +101,7 @@ jpeg_CreateCompress(j_compress_ptr cinfo, int version, size_t structsize)
|
||||
cinfo->master = (struct jpeg_comp_master *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
|
||||
sizeof(my_comp_master));
|
||||
MEMZERO(cinfo->master, sizeof(my_comp_master));
|
||||
memset(cinfo->master, 0, sizeof(my_comp_master));
|
||||
|
||||
cinfo->master->compress_profile = JCP_MAX_COMPRESSION;
|
||||
}
|
||||
|
||||
12
jcarith.c
12
jcarith.c
@@ -4,7 +4,7 @@
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Developed 1997-2009 by Guido Vollbeding.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2015, 2018, D. R. Commander.
|
||||
* Copyright (C) 2015, 2018, 2021-2022, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -342,14 +342,14 @@ emit_restart(j_compress_ptr cinfo, int restart_num)
|
||||
compptr = cinfo->cur_comp_info[ci];
|
||||
/* DC needs no table for refinement scan */
|
||||
if (cinfo->progressive_mode == 0 || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
|
||||
MEMZERO(entropy->dc_stats[compptr->dc_tbl_no], DC_STAT_BINS);
|
||||
memset(entropy->dc_stats[compptr->dc_tbl_no], 0, DC_STAT_BINS);
|
||||
/* Reset DC predictions to 0 */
|
||||
entropy->last_dc_val[ci] = 0;
|
||||
entropy->dc_context[ci] = 0;
|
||||
}
|
||||
/* AC needs no table when not present */
|
||||
if (cinfo->progressive_mode == 0 || cinfo->Se) {
|
||||
MEMZERO(entropy->ac_stats[compptr->ac_tbl_no], AC_STAT_BINS);
|
||||
memset(entropy->ac_stats[compptr->ac_tbl_no], 0, AC_STAT_BINS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -841,7 +841,7 @@ start_pass(j_compress_ptr cinfo, boolean gather_statistics)
|
||||
* We are fully adaptive here and need no extra
|
||||
* statistics gathering pass!
|
||||
*/
|
||||
ERREXIT(cinfo, JERR_NOT_COMPILED);
|
||||
ERREXIT(cinfo, JERR_NOTIMPL);
|
||||
|
||||
/* We assume jcmaster.c already validated the progressive scan parameters. */
|
||||
|
||||
@@ -876,7 +876,7 @@ start_pass(j_compress_ptr cinfo, boolean gather_statistics)
|
||||
if (entropy->dc_stats[tbl] == NULL)
|
||||
entropy->dc_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
|
||||
((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
|
||||
MEMZERO(entropy->dc_stats[tbl], DC_STAT_BINS);
|
||||
memset(entropy->dc_stats[tbl], 0, DC_STAT_BINS);
|
||||
/* Initialize DC predictions to 0 */
|
||||
entropy->last_dc_val[ci] = 0;
|
||||
entropy->dc_context[ci] = 0;
|
||||
@@ -889,7 +889,7 @@ start_pass(j_compress_ptr cinfo, boolean gather_statistics)
|
||||
if (entropy->ac_stats[tbl] == NULL)
|
||||
entropy->ac_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
|
||||
((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
|
||||
MEMZERO(entropy->ac_stats[tbl], AC_STAT_BINS);
|
||||
memset(entropy->ac_stats[tbl], 0, AC_STAT_BINS);
|
||||
#ifdef CALCULATE_SPECTRAL_CONDITIONING
|
||||
if (progressive_mode)
|
||||
/* Section G.1.3.2: Set appropriate arithmetic conditioning value Kx */
|
||||
|
||||
20
jccolext.c
20
jccolext.c
@@ -4,7 +4,7 @@
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1996, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2009-2012, 2015, D. R. Commander.
|
||||
* Copyright (C) 2009-2012, 2015, 2022, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -48,9 +48,9 @@ rgb_ycc_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf,
|
||||
outptr2 = output_buf[2][output_row];
|
||||
output_row++;
|
||||
for (col = 0; col < num_cols; col++) {
|
||||
r = GETJSAMPLE(inptr[RGB_RED]);
|
||||
g = GETJSAMPLE(inptr[RGB_GREEN]);
|
||||
b = GETJSAMPLE(inptr[RGB_BLUE]);
|
||||
r = RANGE_LIMIT(inptr[RGB_RED]);
|
||||
g = RANGE_LIMIT(inptr[RGB_GREEN]);
|
||||
b = RANGE_LIMIT(inptr[RGB_BLUE]);
|
||||
inptr += RGB_PIXELSIZE;
|
||||
/* If the inputs are 0..MAXJSAMPLE, the outputs of these equations
|
||||
* must be too; we do not need an explicit range-limiting operation.
|
||||
@@ -100,9 +100,9 @@ rgb_gray_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf,
|
||||
outptr = output_buf[0][output_row];
|
||||
output_row++;
|
||||
for (col = 0; col < num_cols; col++) {
|
||||
r = GETJSAMPLE(inptr[RGB_RED]);
|
||||
g = GETJSAMPLE(inptr[RGB_GREEN]);
|
||||
b = GETJSAMPLE(inptr[RGB_BLUE]);
|
||||
r = RANGE_LIMIT(inptr[RGB_RED]);
|
||||
g = RANGE_LIMIT(inptr[RGB_GREEN]);
|
||||
b = RANGE_LIMIT(inptr[RGB_BLUE]);
|
||||
inptr += RGB_PIXELSIZE;
|
||||
/* Y */
|
||||
outptr[col] = (JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
|
||||
@@ -135,9 +135,9 @@ rgb_rgb_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf,
|
||||
outptr2 = output_buf[2][output_row];
|
||||
output_row++;
|
||||
for (col = 0; col < num_cols; col++) {
|
||||
outptr0[col] = GETJSAMPLE(inptr[RGB_RED]);
|
||||
outptr1[col] = GETJSAMPLE(inptr[RGB_GREEN]);
|
||||
outptr2[col] = GETJSAMPLE(inptr[RGB_BLUE]);
|
||||
outptr0[col] = inptr[RGB_RED];
|
||||
outptr1[col] = inptr[RGB_GREEN];
|
||||
outptr2[col] = inptr[RGB_BLUE];
|
||||
inptr += RGB_PIXELSIZE;
|
||||
}
|
||||
}
|
||||
|
||||
27
jccolor.c
27
jccolor.c
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1991-1996, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
* Copyright (C) 2009-2012, 2015, D. R. Commander.
|
||||
* Copyright (C) 2009-2012, 2015, 2022, D. R. Commander.
|
||||
* Copyright (C) 2014, MIPS Technologies, Inc., California.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
@@ -17,7 +17,6 @@
|
||||
#include "jinclude.h"
|
||||
#include "jpeglib.h"
|
||||
#include "jsimd.h"
|
||||
#include "jconfigint.h"
|
||||
|
||||
|
||||
/* Private subobject */
|
||||
@@ -84,6 +83,18 @@ typedef my_color_converter *my_cconvert_ptr;
|
||||
#define B_CR_OFF (7 * (MAXJSAMPLE + 1))
|
||||
#define TABLE_SIZE (8 * (MAXJSAMPLE + 1))
|
||||
|
||||
/* 12-bit samples use a 16-bit data type, so it is possible to pass
|
||||
* out-of-range sample values (< 0 or > 4095) to jpeg_write_scanlines().
|
||||
* Thus, we mask the incoming 12-bit samples to guard against overrunning
|
||||
* or underrunning the conversion tables.
|
||||
*/
|
||||
|
||||
#if BITS_IN_JSAMPLE == 12
|
||||
#define RANGE_LIMIT(value) ((value) & 0xFFF)
|
||||
#else
|
||||
#define RANGE_LIMIT(value) (value)
|
||||
#endif
|
||||
|
||||
|
||||
/* Include inline routines for colorspace extensions */
|
||||
|
||||
@@ -392,11 +403,11 @@ cmyk_ycck_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
|
||||
outptr3 = output_buf[3][output_row];
|
||||
output_row++;
|
||||
for (col = 0; col < num_cols; col++) {
|
||||
r = MAXJSAMPLE - GETJSAMPLE(inptr[0]);
|
||||
g = MAXJSAMPLE - GETJSAMPLE(inptr[1]);
|
||||
b = MAXJSAMPLE - GETJSAMPLE(inptr[2]);
|
||||
r = MAXJSAMPLE - RANGE_LIMIT(inptr[0]);
|
||||
g = MAXJSAMPLE - RANGE_LIMIT(inptr[1]);
|
||||
b = MAXJSAMPLE - RANGE_LIMIT(inptr[2]);
|
||||
/* K passes through as-is */
|
||||
outptr3[col] = inptr[3]; /* don't need GETJSAMPLE here */
|
||||
outptr3[col] = inptr[3];
|
||||
inptr += 4;
|
||||
/* If the inputs are 0..MAXJSAMPLE, the outputs of these equations
|
||||
* must be too; we do not need an explicit range-limiting operation.
|
||||
@@ -438,7 +449,7 @@ grayscale_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
|
||||
outptr = output_buf[0][output_row];
|
||||
output_row++;
|
||||
for (col = 0; col < num_cols; col++) {
|
||||
outptr[col] = inptr[0]; /* don't need GETJSAMPLE() here */
|
||||
outptr[col] = inptr[0];
|
||||
inptr += instride;
|
||||
}
|
||||
}
|
||||
@@ -497,7 +508,7 @@ null_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
||||
inptr = *input_buf;
|
||||
outptr = output_buf[ci][output_row];
|
||||
for (col = 0; col < num_cols; col++) {
|
||||
outptr[col] = inptr[ci]; /* don't need GETJSAMPLE() here */
|
||||
outptr[col] = inptr[ci];
|
||||
inptr += nc;
|
||||
}
|
||||
}
|
||||
|
||||
37
jcdctmgr.c
37
jcdctmgr.c
@@ -574,19 +574,19 @@ convsamp (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM *workspace)
|
||||
elemptr = sample_data[elemr] + start_col;
|
||||
|
||||
#if DCTSIZE == 8 /* unroll the inner loop */
|
||||
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
||||
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
||||
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
||||
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
||||
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
||||
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
||||
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
||||
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
||||
*workspaceptr++ = (*elemptr++) - CENTERJSAMPLE;
|
||||
*workspaceptr++ = (*elemptr++) - CENTERJSAMPLE;
|
||||
*workspaceptr++ = (*elemptr++) - CENTERJSAMPLE;
|
||||
*workspaceptr++ = (*elemptr++) - CENTERJSAMPLE;
|
||||
*workspaceptr++ = (*elemptr++) - CENTERJSAMPLE;
|
||||
*workspaceptr++ = (*elemptr++) - CENTERJSAMPLE;
|
||||
*workspaceptr++ = (*elemptr++) - CENTERJSAMPLE;
|
||||
*workspaceptr++ = (*elemptr++) - CENTERJSAMPLE;
|
||||
#else
|
||||
{
|
||||
register int elemc;
|
||||
for (elemc = DCTSIZE; elemc > 0; elemc--)
|
||||
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
||||
*workspaceptr++ = (*elemptr++) - CENTERJSAMPLE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -774,20 +774,19 @@ convsamp_float(JSAMPARRAY sample_data, JDIMENSION start_col,
|
||||
for (elemr = 0; elemr < DCTSIZE; elemr++) {
|
||||
elemptr = sample_data[elemr] + start_col;
|
||||
#if DCTSIZE == 8 /* unroll the inner loop */
|
||||
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
||||
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
||||
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
||||
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
||||
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
||||
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
||||
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
||||
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
||||
*workspaceptr++ = (FAST_FLOAT)((*elemptr++) - CENTERJSAMPLE);
|
||||
*workspaceptr++ = (FAST_FLOAT)((*elemptr++) - CENTERJSAMPLE);
|
||||
*workspaceptr++ = (FAST_FLOAT)((*elemptr++) - CENTERJSAMPLE);
|
||||
*workspaceptr++ = (FAST_FLOAT)((*elemptr++) - CENTERJSAMPLE);
|
||||
*workspaceptr++ = (FAST_FLOAT)((*elemptr++) - CENTERJSAMPLE);
|
||||
*workspaceptr++ = (FAST_FLOAT)((*elemptr++) - CENTERJSAMPLE);
|
||||
*workspaceptr++ = (FAST_FLOAT)((*elemptr++) - CENTERJSAMPLE);
|
||||
*workspaceptr++ = (FAST_FLOAT)((*elemptr++) - CENTERJSAMPLE);
|
||||
#else
|
||||
{
|
||||
register int elemc;
|
||||
for (elemc = DCTSIZE; elemc > 0; elemc--)
|
||||
*workspaceptr++ = (FAST_FLOAT)
|
||||
(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
||||
*workspaceptr++ = (FAST_FLOAT)((*elemptr++) - CENTERJSAMPLE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
390
jchuff.c
390
jchuff.c
@@ -4,8 +4,10 @@
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2009-2011, 2014-2016, 2018-2019, D. R. Commander.
|
||||
* Copyright (C) 2009-2011, 2014-2016, 2018-2022, D. R. Commander.
|
||||
* Copyright (C) 2015, Matthieu Darbois.
|
||||
* Copyright (C) 2018, Matthias Räncker.
|
||||
* Copyright (C) 2020, Arm Limited.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -25,7 +27,6 @@
|
||||
#include "jinclude.h"
|
||||
#include "jpeglib.h"
|
||||
#include "jsimd.h"
|
||||
#include "jconfigint.h"
|
||||
#include <limits.h>
|
||||
|
||||
/*
|
||||
@@ -43,14 +44,19 @@
|
||||
*/
|
||||
|
||||
/* NOTE: Both GCC and Clang define __GNUC__ */
|
||||
#if defined(__GNUC__) && (defined(__arm__) || defined(__aarch64__))
|
||||
#if (defined(__GNUC__) && (defined(__arm__) || defined(__aarch64__))) || \
|
||||
defined(_M_ARM) || defined(_M_ARM64)
|
||||
#if !defined(__thumb__) || defined(__thumb2__)
|
||||
#define USE_CLZ_INTRINSIC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_CLZ_INTRINSIC
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#define JPEG_NBITS_NONZERO(x) (32 - _CountLeadingZeros(x))
|
||||
#else
|
||||
#define JPEG_NBITS_NONZERO(x) (32 - __builtin_clz(x))
|
||||
#endif
|
||||
#define JPEG_NBITS(x) (x ? JPEG_NBITS_NONZERO(x) : 0)
|
||||
#else
|
||||
#include "jpeg_nbits_table.h"
|
||||
@@ -65,32 +71,43 @@
|
||||
* but must not be updated permanently until we complete the MCU.
|
||||
*/
|
||||
|
||||
#if defined(__x86_64__) && defined(__ILP32__)
|
||||
typedef unsigned long long bit_buf_type;
|
||||
#else
|
||||
typedef size_t bit_buf_type;
|
||||
#endif
|
||||
|
||||
/* NOTE: The more optimal Huffman encoding algorithm is only used by the
|
||||
* intrinsics implementation of the Arm Neon SIMD extensions, which is why we
|
||||
* retain the old Huffman encoder behavior when using the GAS implementation.
|
||||
*/
|
||||
#if defined(WITH_SIMD) && !(defined(__arm__) || defined(__aarch64__) || \
|
||||
defined(_M_ARM) || defined(_M_ARM64))
|
||||
typedef unsigned long long simd_bit_buf_type;
|
||||
#else
|
||||
typedef bit_buf_type simd_bit_buf_type;
|
||||
#endif
|
||||
|
||||
#if (defined(SIZEOF_SIZE_T) && SIZEOF_SIZE_T == 8) || defined(_WIN64) || \
|
||||
(defined(__x86_64__) && defined(__ILP32__))
|
||||
#define BIT_BUF_SIZE 64
|
||||
#elif (defined(SIZEOF_SIZE_T) && SIZEOF_SIZE_T == 4) || defined(_WIN32)
|
||||
#define BIT_BUF_SIZE 32
|
||||
#else
|
||||
#error Cannot determine word size
|
||||
#endif
|
||||
#define SIMD_BIT_BUF_SIZE (sizeof(simd_bit_buf_type) * 8)
|
||||
|
||||
typedef struct {
|
||||
size_t put_buffer; /* current bit-accumulation buffer */
|
||||
int put_bits; /* # of bits now in it */
|
||||
union {
|
||||
bit_buf_type c;
|
||||
simd_bit_buf_type simd;
|
||||
} put_buffer; /* current bit accumulation buffer */
|
||||
int free_bits; /* # of bits available in it */
|
||||
/* (Neon GAS: # of bits now in it) */
|
||||
int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */
|
||||
} savable_state;
|
||||
|
||||
/* This macro is to work around compilers with missing or broken
|
||||
* structure assignment. You'll need to fix this code if you have
|
||||
* such a compiler and you change MAX_COMPS_IN_SCAN.
|
||||
*/
|
||||
|
||||
#ifndef NO_STRUCT_ASSIGN
|
||||
#define ASSIGN_STATE(dest, src) ((dest) = (src))
|
||||
#else
|
||||
#if MAX_COMPS_IN_SCAN == 4
|
||||
#define ASSIGN_STATE(dest, src) \
|
||||
((dest).put_buffer = (src).put_buffer, \
|
||||
(dest).put_bits = (src).put_bits, \
|
||||
(dest).last_dc_val[0] = (src).last_dc_val[0], \
|
||||
(dest).last_dc_val[1] = (src).last_dc_val[1], \
|
||||
(dest).last_dc_val[2] = (src).last_dc_val[2], \
|
||||
(dest).last_dc_val[3] = (src).last_dc_val[3])
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct {
|
||||
struct jpeg_entropy_encoder pub; /* public fields */
|
||||
|
||||
@@ -123,6 +140,7 @@ typedef struct {
|
||||
size_t free_in_buffer; /* # of byte spaces remaining in buffer */
|
||||
savable_state cur; /* Current bit buffer & DC state */
|
||||
j_compress_ptr cinfo; /* dump_buffer needs access to this */
|
||||
int simd;
|
||||
} working_state;
|
||||
|
||||
|
||||
@@ -181,12 +199,12 @@ start_pass_huff(j_compress_ptr cinfo, boolean gather_statistics)
|
||||
entropy->dc_count_ptrs[dctbl] = (long *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||
257 * sizeof(long));
|
||||
MEMZERO(entropy->dc_count_ptrs[dctbl], 257 * sizeof(long));
|
||||
memset(entropy->dc_count_ptrs[dctbl], 0, 257 * sizeof(long));
|
||||
if (entropy->ac_count_ptrs[actbl] == NULL)
|
||||
entropy->ac_count_ptrs[actbl] = (long *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||
257 * sizeof(long));
|
||||
MEMZERO(entropy->ac_count_ptrs[actbl], 257 * sizeof(long));
|
||||
memset(entropy->ac_count_ptrs[actbl], 0, 257 * sizeof(long));
|
||||
#endif
|
||||
} else {
|
||||
/* Compute derived values for Huffman tables */
|
||||
@@ -201,8 +219,17 @@ start_pass_huff(j_compress_ptr cinfo, boolean gather_statistics)
|
||||
}
|
||||
|
||||
/* Initialize bit buffer to empty */
|
||||
entropy->saved.put_buffer = 0;
|
||||
entropy->saved.put_bits = 0;
|
||||
if (entropy->simd) {
|
||||
entropy->saved.put_buffer.simd = 0;
|
||||
#if defined(__aarch64__) && !defined(NEON_INTRINSICS)
|
||||
entropy->saved.free_bits = 0;
|
||||
#else
|
||||
entropy->saved.free_bits = SIMD_BIT_BUF_SIZE;
|
||||
#endif
|
||||
} else {
|
||||
entropy->saved.put_buffer.c = 0;
|
||||
entropy->saved.free_bits = BIT_BUF_SIZE;
|
||||
}
|
||||
|
||||
/* Initialize restart stuff */
|
||||
entropy->restarts_to_go = cinfo->restart_interval;
|
||||
@@ -287,7 +314,8 @@ jpeg_make_c_derived_tbl(j_compress_ptr cinfo, boolean isDC, int tblno,
|
||||
* this lets us detect duplicate VAL entries here, and later
|
||||
* allows emit_bits to detect any attempt to emit such symbols.
|
||||
*/
|
||||
MEMZERO(dtbl->ehufsi, sizeof(dtbl->ehufsi));
|
||||
memset(dtbl->ehufco, 0, sizeof(dtbl->ehufco));
|
||||
memset(dtbl->ehufsi, 0, sizeof(dtbl->ehufsi));
|
||||
|
||||
/* This is also a convenient place to check for out-of-range
|
||||
* and duplicated VAL entries. We allow 0..255 for AC symbols
|
||||
@@ -334,94 +362,94 @@ dump_buffer(working_state *state)
|
||||
|
||||
/* Outputting bits to the file */
|
||||
|
||||
/* These macros perform the same task as the emit_bits() function in the
|
||||
* original libjpeg code. In addition to reducing overhead by explicitly
|
||||
* inlining the code, additional performance is achieved by taking into
|
||||
* account the size of the bit buffer and waiting until it is almost full
|
||||
* before emptying it. This mostly benefits 64-bit platforms, since 6
|
||||
* bytes can be stored in a 64-bit bit buffer before it has to be emptied.
|
||||
/* Output byte b and, speculatively, an additional 0 byte. 0xFF must be
|
||||
* encoded as 0xFF 0x00, so the output buffer pointer is advanced by 2 if the
|
||||
* byte is 0xFF. Otherwise, the output buffer pointer is advanced by 1, and
|
||||
* the speculative 0 byte will be overwritten by the next byte.
|
||||
*/
|
||||
|
||||
#define EMIT_BYTE() { \
|
||||
JOCTET c; \
|
||||
put_bits -= 8; \
|
||||
c = (JOCTET)GETJOCTET(put_buffer >> put_bits); \
|
||||
*buffer++ = c; \
|
||||
if (c == 0xFF) /* need to stuff a zero byte? */ \
|
||||
*buffer++ = 0; \
|
||||
#define EMIT_BYTE(b) { \
|
||||
buffer[0] = (JOCTET)(b); \
|
||||
buffer[1] = 0; \
|
||||
buffer -= -2 + ((JOCTET)(b) < 0xFF); \
|
||||
}
|
||||
|
||||
#define PUT_BITS(code, size) { \
|
||||
put_bits += size; \
|
||||
put_buffer = (put_buffer << size) | code; \
|
||||
}
|
||||
/* Output the entire bit buffer. If there are no 0xFF bytes in it, then write
|
||||
* directly to the output buffer. Otherwise, use the EMIT_BYTE() macro to
|
||||
* encode 0xFF as 0xFF 0x00.
|
||||
*/
|
||||
#if BIT_BUF_SIZE == 64
|
||||
|
||||
#if SIZEOF_SIZE_T != 8 && !defined(_WIN64)
|
||||
|
||||
#define CHECKBUF15() { \
|
||||
if (put_bits > 15) { \
|
||||
EMIT_BYTE() \
|
||||
EMIT_BYTE() \
|
||||
#define FLUSH() { \
|
||||
if (put_buffer & 0x8080808080808080 & ~(put_buffer + 0x0101010101010101)) { \
|
||||
EMIT_BYTE(put_buffer >> 56) \
|
||||
EMIT_BYTE(put_buffer >> 48) \
|
||||
EMIT_BYTE(put_buffer >> 40) \
|
||||
EMIT_BYTE(put_buffer >> 32) \
|
||||
EMIT_BYTE(put_buffer >> 24) \
|
||||
EMIT_BYTE(put_buffer >> 16) \
|
||||
EMIT_BYTE(put_buffer >> 8) \
|
||||
EMIT_BYTE(put_buffer ) \
|
||||
} else { \
|
||||
buffer[0] = (JOCTET)(put_buffer >> 56); \
|
||||
buffer[1] = (JOCTET)(put_buffer >> 48); \
|
||||
buffer[2] = (JOCTET)(put_buffer >> 40); \
|
||||
buffer[3] = (JOCTET)(put_buffer >> 32); \
|
||||
buffer[4] = (JOCTET)(put_buffer >> 24); \
|
||||
buffer[5] = (JOCTET)(put_buffer >> 16); \
|
||||
buffer[6] = (JOCTET)(put_buffer >> 8); \
|
||||
buffer[7] = (JOCTET)(put_buffer); \
|
||||
buffer += 8; \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define CHECKBUF31() { \
|
||||
if (put_bits > 31) { \
|
||||
EMIT_BYTE() \
|
||||
EMIT_BYTE() \
|
||||
EMIT_BYTE() \
|
||||
EMIT_BYTE() \
|
||||
} \
|
||||
}
|
||||
|
||||
#define CHECKBUF47() { \
|
||||
if (put_bits > 47) { \
|
||||
EMIT_BYTE() \
|
||||
EMIT_BYTE() \
|
||||
EMIT_BYTE() \
|
||||
EMIT_BYTE() \
|
||||
EMIT_BYTE() \
|
||||
EMIT_BYTE() \
|
||||
} \
|
||||
}
|
||||
|
||||
#if !defined(_WIN32) && !defined(SIZEOF_SIZE_T)
|
||||
#error Cannot determine word size
|
||||
#endif
|
||||
|
||||
#if SIZEOF_SIZE_T == 8 || defined(_WIN64)
|
||||
|
||||
#define EMIT_BITS(code, size) { \
|
||||
CHECKBUF47() \
|
||||
PUT_BITS(code, size) \
|
||||
}
|
||||
|
||||
#define EMIT_CODE(code, size) { \
|
||||
temp2 &= (((JLONG)1) << nbits) - 1; \
|
||||
CHECKBUF31() \
|
||||
PUT_BITS(code, size) \
|
||||
PUT_BITS(temp2, nbits) \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define EMIT_BITS(code, size) { \
|
||||
PUT_BITS(code, size) \
|
||||
CHECKBUF15() \
|
||||
}
|
||||
|
||||
#define EMIT_CODE(code, size) { \
|
||||
temp2 &= (((JLONG)1) << nbits) - 1; \
|
||||
PUT_BITS(code, size) \
|
||||
CHECKBUF15() \
|
||||
PUT_BITS(temp2, nbits) \
|
||||
CHECKBUF15() \
|
||||
#define FLUSH() { \
|
||||
if (put_buffer & 0x80808080 & ~(put_buffer + 0x01010101)) { \
|
||||
EMIT_BYTE(put_buffer >> 24) \
|
||||
EMIT_BYTE(put_buffer >> 16) \
|
||||
EMIT_BYTE(put_buffer >> 8) \
|
||||
EMIT_BYTE(put_buffer ) \
|
||||
} else { \
|
||||
buffer[0] = (JOCTET)(put_buffer >> 24); \
|
||||
buffer[1] = (JOCTET)(put_buffer >> 16); \
|
||||
buffer[2] = (JOCTET)(put_buffer >> 8); \
|
||||
buffer[3] = (JOCTET)(put_buffer); \
|
||||
buffer += 4; \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Fill the bit buffer to capacity with the leading bits from code, then output
|
||||
* the bit buffer and put the remaining bits from code into the bit buffer.
|
||||
*/
|
||||
#define PUT_AND_FLUSH(code, size) { \
|
||||
put_buffer = (put_buffer << (size + free_bits)) | (code >> -free_bits); \
|
||||
FLUSH() \
|
||||
free_bits += BIT_BUF_SIZE; \
|
||||
put_buffer = code; \
|
||||
}
|
||||
|
||||
/* Insert code into the bit buffer and output the bit buffer if needed.
|
||||
* NOTE: We can't flush with free_bits == 0, since the left shift in
|
||||
* PUT_AND_FLUSH() would have undefined behavior.
|
||||
*/
|
||||
#define PUT_BITS(code, size) { \
|
||||
free_bits -= size; \
|
||||
if (free_bits < 0) \
|
||||
PUT_AND_FLUSH(code, size) \
|
||||
else \
|
||||
put_buffer = (put_buffer << size) | code; \
|
||||
}
|
||||
|
||||
#define PUT_CODE(code, size) { \
|
||||
temp &= (((JLONG)1) << nbits) - 1; \
|
||||
temp |= code << nbits; \
|
||||
nbits += size; \
|
||||
PUT_BITS(temp, nbits) \
|
||||
}
|
||||
|
||||
|
||||
/* Although it is exceedingly rare, it is possible for a Huffman-encoded
|
||||
* coefficient block to be larger than the 128-byte unencoded block. For each
|
||||
@@ -444,11 +472,12 @@ dump_buffer(working_state *state)
|
||||
|
||||
#define STORE_BUFFER() { \
|
||||
if (localbuf) { \
|
||||
size_t bytes, bytestocopy; \
|
||||
bytes = buffer - _buffer; \
|
||||
buffer = _buffer; \
|
||||
while (bytes > 0) { \
|
||||
bytestocopy = MIN(bytes, state->free_in_buffer); \
|
||||
MEMCOPY(state->next_output_byte, buffer, bytestocopy); \
|
||||
memcpy(state->next_output_byte, buffer, bytestocopy); \
|
||||
state->next_output_byte += bytestocopy; \
|
||||
buffer += bytestocopy; \
|
||||
state->free_in_buffer -= bytestocopy; \
|
||||
@@ -466,20 +495,46 @@ dump_buffer(working_state *state)
|
||||
LOCAL(boolean)
|
||||
flush_bits(working_state *state)
|
||||
{
|
||||
JOCTET _buffer[BUFSIZE], *buffer;
|
||||
size_t put_buffer; int put_bits;
|
||||
size_t bytes, bytestocopy; int localbuf = 0;
|
||||
JOCTET _buffer[BUFSIZE], *buffer, temp;
|
||||
simd_bit_buf_type put_buffer; int put_bits;
|
||||
int localbuf = 0;
|
||||
|
||||
if (state->simd) {
|
||||
#if defined(__aarch64__) && !defined(NEON_INTRINSICS)
|
||||
put_bits = state->cur.free_bits;
|
||||
#else
|
||||
put_bits = SIMD_BIT_BUF_SIZE - state->cur.free_bits;
|
||||
#endif
|
||||
put_buffer = state->cur.put_buffer.simd;
|
||||
} else {
|
||||
put_bits = BIT_BUF_SIZE - state->cur.free_bits;
|
||||
put_buffer = state->cur.put_buffer.c;
|
||||
}
|
||||
|
||||
put_buffer = state->cur.put_buffer;
|
||||
put_bits = state->cur.put_bits;
|
||||
LOAD_BUFFER()
|
||||
|
||||
/* fill any partial byte with ones */
|
||||
PUT_BITS(0x7F, 7)
|
||||
while (put_bits >= 8) EMIT_BYTE()
|
||||
while (put_bits >= 8) {
|
||||
put_bits -= 8;
|
||||
temp = (JOCTET)(put_buffer >> put_bits);
|
||||
EMIT_BYTE(temp)
|
||||
}
|
||||
if (put_bits) {
|
||||
/* fill partial byte with ones */
|
||||
temp = (JOCTET)((put_buffer << (8 - put_bits)) | (0xFF >> put_bits));
|
||||
EMIT_BYTE(temp)
|
||||
}
|
||||
|
||||
state->cur.put_buffer = 0; /* and reset bit-buffer to empty */
|
||||
state->cur.put_bits = 0;
|
||||
if (state->simd) { /* and reset bit buffer to empty */
|
||||
state->cur.put_buffer.simd = 0;
|
||||
#if defined(__aarch64__) && !defined(NEON_INTRINSICS)
|
||||
state->cur.free_bits = 0;
|
||||
#else
|
||||
state->cur.free_bits = SIMD_BIT_BUF_SIZE;
|
||||
#endif
|
||||
} else {
|
||||
state->cur.put_buffer.c = 0;
|
||||
state->cur.free_bits = BIT_BUF_SIZE;
|
||||
}
|
||||
STORE_BUFFER()
|
||||
|
||||
return TRUE;
|
||||
@@ -493,7 +548,7 @@ encode_one_block_simd(working_state *state, JCOEFPTR block, int last_dc_val,
|
||||
c_derived_tbl *dctbl, c_derived_tbl *actbl)
|
||||
{
|
||||
JOCTET _buffer[BUFSIZE], *buffer;
|
||||
size_t bytes, bytestocopy; int localbuf = 0;
|
||||
int localbuf = 0;
|
||||
|
||||
LOAD_BUFFER()
|
||||
|
||||
@@ -509,53 +564,41 @@ LOCAL(boolean)
|
||||
encode_one_block(working_state *state, JCOEFPTR block, int last_dc_val,
|
||||
c_derived_tbl *dctbl, c_derived_tbl *actbl)
|
||||
{
|
||||
int temp, temp2, temp3;
|
||||
int nbits;
|
||||
int r, code, size;
|
||||
int temp, nbits, free_bits;
|
||||
bit_buf_type put_buffer;
|
||||
JOCTET _buffer[BUFSIZE], *buffer;
|
||||
size_t put_buffer; int put_bits;
|
||||
int code_0xf0 = actbl->ehufco[0xf0], size_0xf0 = actbl->ehufsi[0xf0];
|
||||
size_t bytes, bytestocopy; int localbuf = 0;
|
||||
int localbuf = 0;
|
||||
|
||||
put_buffer = state->cur.put_buffer;
|
||||
put_bits = state->cur.put_bits;
|
||||
free_bits = state->cur.free_bits;
|
||||
put_buffer = state->cur.put_buffer.c;
|
||||
LOAD_BUFFER()
|
||||
|
||||
/* Encode the DC coefficient difference per section F.1.2.1 */
|
||||
|
||||
temp = temp2 = block[0] - last_dc_val;
|
||||
temp = block[0] - last_dc_val;
|
||||
|
||||
/* This is a well-known technique for obtaining the absolute value without a
|
||||
* branch. It is derived from an assembly language technique presented in
|
||||
* "How to Optimize for the Pentium Processors", Copyright (c) 1996, 1997 by
|
||||
* Agner Fog.
|
||||
* Agner Fog. This code assumes we are on a two's complement machine.
|
||||
*/
|
||||
temp3 = temp >> (CHAR_BIT * sizeof(int) - 1);
|
||||
temp ^= temp3;
|
||||
temp -= temp3;
|
||||
|
||||
/* For a negative input, want temp2 = bitwise complement of abs(input) */
|
||||
/* This code assumes we are on a two's complement machine */
|
||||
temp2 += temp3;
|
||||
nbits = temp >> (CHAR_BIT * sizeof(int) - 1);
|
||||
temp += nbits;
|
||||
nbits ^= temp;
|
||||
|
||||
/* Find the number of bits needed for the magnitude of the coefficient */
|
||||
nbits = JPEG_NBITS(temp);
|
||||
nbits = JPEG_NBITS(nbits);
|
||||
|
||||
/* Emit the Huffman-coded symbol for the number of bits */
|
||||
code = dctbl->ehufco[nbits];
|
||||
size = dctbl->ehufsi[nbits];
|
||||
EMIT_BITS(code, size)
|
||||
|
||||
/* Mask off any extra bits in code */
|
||||
temp2 &= (((JLONG)1) << nbits) - 1;
|
||||
|
||||
/* Emit that number of bits of the value, if positive, */
|
||||
/* or the complement of its magnitude, if negative. */
|
||||
EMIT_BITS(temp2, nbits)
|
||||
/* Emit the Huffman-coded symbol for the number of bits.
|
||||
* Emit that number of bits of the value, if positive,
|
||||
* or the complement of its magnitude, if negative.
|
||||
*/
|
||||
PUT_CODE(dctbl->ehufco[nbits], dctbl->ehufsi[nbits])
|
||||
|
||||
/* Encode the AC coefficients per section F.1.2.2 */
|
||||
|
||||
r = 0; /* r = run length of zeros */
|
||||
{
|
||||
int r = 0; /* r = run length of zeros */
|
||||
|
||||
/* Manually unroll the k loop to eliminate the counter variable. This
|
||||
* improves performance greatly on systems with a limited number of
|
||||
@@ -563,25 +606,21 @@ encode_one_block(working_state *state, JCOEFPTR block, int last_dc_val,
|
||||
*/
|
||||
#define kloop(jpeg_natural_order_of_k) { \
|
||||
if ((temp = block[jpeg_natural_order_of_k]) == 0) { \
|
||||
r++; \
|
||||
r += 16; \
|
||||
} else { \
|
||||
temp2 = temp; \
|
||||
/* Branch-less absolute value, bitwise complement, etc., same as above */ \
|
||||
temp3 = temp >> (CHAR_BIT * sizeof(int) - 1); \
|
||||
temp ^= temp3; \
|
||||
temp -= temp3; \
|
||||
temp2 += temp3; \
|
||||
nbits = JPEG_NBITS_NONZERO(temp); \
|
||||
nbits = temp >> (CHAR_BIT * sizeof(int) - 1); \
|
||||
temp += nbits; \
|
||||
nbits ^= temp; \
|
||||
nbits = JPEG_NBITS_NONZERO(nbits); \
|
||||
/* if run length > 15, must emit special run-length-16 codes (0xF0) */ \
|
||||
while (r > 15) { \
|
||||
EMIT_BITS(code_0xf0, size_0xf0) \
|
||||
r -= 16; \
|
||||
while (r >= 16 * 16) { \
|
||||
r -= 16 * 16; \
|
||||
PUT_BITS(actbl->ehufco[0xf0], actbl->ehufsi[0xf0]) \
|
||||
} \
|
||||
/* Emit Huffman symbol for run length / number of bits */ \
|
||||
temp3 = (r << 4) + nbits; \
|
||||
code = actbl->ehufco[temp3]; \
|
||||
size = actbl->ehufsi[temp3]; \
|
||||
EMIT_CODE(code, size) \
|
||||
r += nbits; \
|
||||
PUT_CODE(actbl->ehufco[r], actbl->ehufsi[r]) \
|
||||
r = 0; \
|
||||
} \
|
||||
}
|
||||
@@ -601,13 +640,12 @@ encode_one_block(working_state *state, JCOEFPTR block, int last_dc_val,
|
||||
|
||||
/* If the last coef(s) were zero, emit an end-of-block code */
|
||||
if (r > 0) {
|
||||
code = actbl->ehufco[0];
|
||||
size = actbl->ehufsi[0];
|
||||
EMIT_BITS(code, size)
|
||||
PUT_BITS(actbl->ehufco[0], actbl->ehufsi[0])
|
||||
}
|
||||
}
|
||||
|
||||
state->cur.put_buffer = put_buffer;
|
||||
state->cur.put_bits = put_bits;
|
||||
state->cur.put_buffer.c = put_buffer;
|
||||
state->cur.free_bits = free_bits;
|
||||
STORE_BUFFER()
|
||||
|
||||
return TRUE;
|
||||
@@ -654,8 +692,9 @@ encode_mcu_huff(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
/* Load up working state */
|
||||
state.next_output_byte = cinfo->dest->next_output_byte;
|
||||
state.free_in_buffer = cinfo->dest->free_in_buffer;
|
||||
ASSIGN_STATE(state.cur, entropy->saved);
|
||||
state.cur = entropy->saved;
|
||||
state.cinfo = cinfo;
|
||||
state.simd = entropy->simd;
|
||||
|
||||
/* Emit restart marker if needed */
|
||||
if (cinfo->restart_interval) {
|
||||
@@ -694,7 +733,7 @@ encode_mcu_huff(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
/* Completed MCU, so update state */
|
||||
cinfo->dest->next_output_byte = state.next_output_byte;
|
||||
cinfo->dest->free_in_buffer = state.free_in_buffer;
|
||||
ASSIGN_STATE(entropy->saved, state.cur);
|
||||
entropy->saved = state.cur;
|
||||
|
||||
/* Update restart-interval state too */
|
||||
if (cinfo->restart_interval) {
|
||||
@@ -723,8 +762,9 @@ finish_pass_huff(j_compress_ptr cinfo)
|
||||
/* Load up working state ... flush_bits needs it */
|
||||
state.next_output_byte = cinfo->dest->next_output_byte;
|
||||
state.free_in_buffer = cinfo->dest->free_in_buffer;
|
||||
ASSIGN_STATE(state.cur, entropy->saved);
|
||||
state.cur = entropy->saved;
|
||||
state.cinfo = cinfo;
|
||||
state.simd = entropy->simd;
|
||||
|
||||
/* Flush out the last data */
|
||||
if (!flush_bits(&state))
|
||||
@@ -733,7 +773,7 @@ finish_pass_huff(j_compress_ptr cinfo)
|
||||
/* Update state */
|
||||
cinfo->dest->next_output_byte = state.next_output_byte;
|
||||
cinfo->dest->free_in_buffer = state.free_in_buffer;
|
||||
ASSIGN_STATE(entropy->saved, state.cur);
|
||||
entropy->saved = state.cur;
|
||||
}
|
||||
|
||||
|
||||
@@ -900,8 +940,8 @@ jpeg_gen_optimal_table(j_compress_ptr cinfo, JHUFF_TBL *htbl, long freq[])
|
||||
|
||||
/* This algorithm is explained in section K.2 of the JPEG standard */
|
||||
|
||||
MEMZERO(bits, sizeof(bits));
|
||||
MEMZERO(codesize, sizeof(codesize));
|
||||
memset(bits, 0, sizeof(bits));
|
||||
memset(codesize, 0, sizeof(codesize));
|
||||
for (i = 0; i < 257; i++)
|
||||
others[i] = -1; /* init links to empty */
|
||||
|
||||
@@ -1003,7 +1043,7 @@ jpeg_gen_optimal_table(j_compress_ptr cinfo, JHUFF_TBL *htbl, long freq[])
|
||||
bits[i]--;
|
||||
|
||||
/* Return final symbol counts (only for lengths 0..16) */
|
||||
MEMCOPY(htbl->bits, bits, sizeof(htbl->bits));
|
||||
memcpy(htbl->bits, bits, sizeof(htbl->bits));
|
||||
|
||||
/* Return a list of the symbols sorted by code length */
|
||||
/* It's not real clear to me why we don't need to consider the codelength
|
||||
@@ -1042,8 +1082,8 @@ finish_pass_gather(j_compress_ptr cinfo)
|
||||
/* It's important not to apply jpeg_gen_optimal_table more than once
|
||||
* per table, because it clobbers the input frequency counts!
|
||||
*/
|
||||
MEMZERO(did_dc, sizeof(did_dc));
|
||||
MEMZERO(did_ac, sizeof(did_ac));
|
||||
memset(did_dc, 0, sizeof(did_dc));
|
||||
memset(did_ac, 0, sizeof(did_ac));
|
||||
|
||||
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
|
||||
compptr = cinfo->cur_comp_info[ci];
|
||||
|
||||
15
jchuff.h
15
jchuff.h
@@ -3,11 +3,12 @@
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* It was modified by The libjpeg-turbo Project to include only code relevant
|
||||
* to libjpeg-turbo.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2022, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
* mozjpeg Modifications:
|
||||
* Copyright (C) 2014, Mozilla Corporation.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
* This file contains declarations for Huffman entropy encoding routines
|
||||
* that are shared between the sequential encoder (jchuff.c) and the
|
||||
@@ -26,6 +27,14 @@
|
||||
#define MAX_COEF_BITS 14
|
||||
#endif
|
||||
|
||||
/* The progressive Huffman encoder uses an unsigned 16-bit data type to store
|
||||
* absolute values of coefficients, because it is possible to inject a
|
||||
* coefficient value of -32768 into the encoder by attempting to transform a
|
||||
* malformed 12-bit JPEG image, and the absolute value of -32768 would overflow
|
||||
* a signed 16-bit integer.
|
||||
*/
|
||||
typedef unsigned short UJCOEF;
|
||||
|
||||
/* Derived data constructed for each Huffman table */
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -508,7 +508,7 @@ prepare_for_pass (j_compress_ptr cinfo)
|
||||
master->pass_type = output_pass;
|
||||
master->pass_number++;
|
||||
#endif
|
||||
/*FALLTHROUGH*/
|
||||
FALLTHROUGH /*FALLTHROUGH*/
|
||||
case output_pass:
|
||||
/* Do a data-output pass. */
|
||||
/* We need not repeat per-scan setup if prior optimization pass did it. */
|
||||
@@ -603,7 +603,7 @@ copy_buffer (j_compress_ptr cinfo, int scan_idx)
|
||||
|
||||
while (size >= cinfo->dest->free_in_buffer)
|
||||
{
|
||||
MEMCOPY(cinfo->dest->next_output_byte, src, cinfo->dest->free_in_buffer);
|
||||
memcpy(cinfo->dest->next_output_byte, src, cinfo->dest->free_in_buffer);
|
||||
src += cinfo->dest->free_in_buffer;
|
||||
size -= cinfo->dest->free_in_buffer;
|
||||
cinfo->dest->next_output_byte += cinfo->dest->free_in_buffer;
|
||||
@@ -613,7 +613,7 @@ copy_buffer (j_compress_ptr cinfo, int scan_idx)
|
||||
ERREXIT(cinfo, JERR_UNSUPPORTED_SUSPEND);
|
||||
}
|
||||
|
||||
MEMCOPY(cinfo->dest->next_output_byte, src, size);
|
||||
memcpy(cinfo->dest->next_output_byte, src, size);
|
||||
cinfo->dest->next_output_byte += size;
|
||||
cinfo->dest->free_in_buffer -= size;
|
||||
}
|
||||
|
||||
36
jconfig.h.in
36
jconfig.h.in
@@ -32,42 +32,6 @@
|
||||
|
||||
#define BITS_IN_JSAMPLE @BITS_IN_JSAMPLE@ /* use 8 or 12 */
|
||||
|
||||
/* Define to 1 if you have the <locale.h> header file. */
|
||||
#cmakedefine HAVE_LOCALE_H 1
|
||||
|
||||
/* Define to 1 if you have the <stddef.h> header file. */
|
||||
#cmakedefine HAVE_STDDEF_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#cmakedefine HAVE_STDLIB_H 1
|
||||
|
||||
/* Define if you need to include <sys/types.h> to get size_t. */
|
||||
#cmakedefine NEED_SYS_TYPES_H 1
|
||||
|
||||
/* Define if you have BSD-like bzero and bcopy in <strings.h> rather than
|
||||
memset/memcpy in <string.h>. */
|
||||
#cmakedefine NEED_BSD_STRINGS 1
|
||||
|
||||
/* Define to 1 if the system has the type `unsigned char'. */
|
||||
#cmakedefine HAVE_UNSIGNED_CHAR 1
|
||||
|
||||
/* Define to 1 if the system has the type `unsigned short'. */
|
||||
#cmakedefine HAVE_UNSIGNED_SHORT 1
|
||||
|
||||
/* Compiler does not support pointers to undefined structures. */
|
||||
#cmakedefine INCOMPLETE_TYPES_BROKEN 1
|
||||
|
||||
/* Define if your (broken) compiler shifts signed values as if they were
|
||||
unsigned. */
|
||||
#cmakedefine RIGHT_SHIFT_IS_UNSIGNED 1
|
||||
|
||||
/* Define to 1 if type `char' is unsigned and you are not using gcc. */
|
||||
#ifndef __CHAR_UNSIGNED__
|
||||
#cmakedefine __CHAR_UNSIGNED__ 1
|
||||
#endif
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
/* #undef const */
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
/* #undef size_t */
|
||||
|
||||
51
jconfig.txt
51
jconfig.txt
@@ -26,56 +26,6 @@
|
||||
* #define the symbol if yes, #undef it if no.
|
||||
*/
|
||||
|
||||
/* Does your compiler support the declaration "unsigned char" ?
|
||||
* How about "unsigned short" ?
|
||||
*/
|
||||
#define HAVE_UNSIGNED_CHAR
|
||||
#define HAVE_UNSIGNED_SHORT
|
||||
|
||||
/* Define "void" as "char" if your compiler doesn't know about type void.
|
||||
* NOTE: be sure to define void such that "void *" represents the most general
|
||||
* pointer type, e.g., that returned by malloc().
|
||||
*/
|
||||
/* #define void char */
|
||||
|
||||
/* Define "const" as empty if your compiler doesn't know the "const" keyword.
|
||||
*/
|
||||
/* #define const */
|
||||
|
||||
/* Define this if an ordinary "char" type is unsigned.
|
||||
* If you're not sure, leaving it undefined will work at some cost in speed.
|
||||
* If you defined HAVE_UNSIGNED_CHAR then the speed difference is minimal.
|
||||
*/
|
||||
#undef __CHAR_UNSIGNED__
|
||||
|
||||
/* Define this if your system has an ANSI-conforming <stddef.h> file.
|
||||
*/
|
||||
#define HAVE_STDDEF_H
|
||||
|
||||
/* Define this if your system has an ANSI-conforming <stdlib.h> file.
|
||||
*/
|
||||
#define HAVE_STDLIB_H
|
||||
|
||||
/* Define this if your system does not have an ANSI/SysV <string.h>,
|
||||
* but does have a BSD-style <strings.h>.
|
||||
*/
|
||||
#undef NEED_BSD_STRINGS
|
||||
|
||||
/* Define this if your system does not provide typedef size_t in any of the
|
||||
* ANSI-standard places (stddef.h, stdlib.h, or stdio.h), but places it in
|
||||
* <sys/types.h> instead.
|
||||
*/
|
||||
#undef NEED_SYS_TYPES_H
|
||||
|
||||
/* Although a real ANSI C compiler can deal perfectly well with pointers to
|
||||
* unspecified structures (see "incomplete types" in the spec), a few pre-ANSI
|
||||
* and pseudo-ANSI compilers get confused. To keep one of these bozos happy,
|
||||
* define INCOMPLETE_TYPES_BROKEN. This is not recommended unless you
|
||||
* actually get "missing structure definition" warnings or errors while
|
||||
* compiling the JPEG code.
|
||||
*/
|
||||
#undef INCOMPLETE_TYPES_BROKEN
|
||||
|
||||
/* Define "boolean" as unsigned char, not int, on Windows systems.
|
||||
*/
|
||||
#ifdef _WIN32
|
||||
@@ -119,7 +69,6 @@ typedef unsigned char boolean;
|
||||
#define BMP_SUPPORTED /* BMP image file format */
|
||||
#define GIF_SUPPORTED /* GIF image file format */
|
||||
#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
|
||||
#undef RLE_SUPPORTED /* Utah RLE image file format */
|
||||
#define TARGA_SUPPORTED /* Targa image file format */
|
||||
|
||||
/* Define this if you want to name both input and output files on the command
|
||||
|
||||
@@ -32,3 +32,13 @@
|
||||
#define HAVE_BITSCANFORWARD
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__has_attribute)
|
||||
#if __has_attribute(fallthrough)
|
||||
#define FALLTHROUGH __attribute__((fallthrough));
|
||||
#else
|
||||
#define FALLTHROUGH
|
||||
#endif
|
||||
#else
|
||||
#define FALLTHROUGH
|
||||
#endif
|
||||
|
||||
@@ -488,7 +488,7 @@ jpeg_set_defaults (j_compress_ptr cinfo)
|
||||
|
||||
jpeg_default_colorspace(cinfo);
|
||||
|
||||
cinfo->master->dc_scan_opt_mode = 1;
|
||||
cinfo->master->dc_scan_opt_mode = 0;
|
||||
|
||||
#ifdef C_PROGRESSIVE_SUPPORTED
|
||||
if (cinfo->master->compress_profile == JCP_MAX_COMPRESSION) {
|
||||
|
||||
71
jcphuff.c
71
jcphuff.c
@@ -4,8 +4,10 @@
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1995-1997, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2011, 2015, 2018, D. R. Commander.
|
||||
* Copyright (C) 2016, 2018, Matthieu Darbois.
|
||||
* Copyright (C) 2011, 2015, 2018, 2021-2022, D. R. Commander.
|
||||
* Copyright (C) 2016, 2018, 2022, Matthieu Darbois.
|
||||
* Copyright (C) 2020, Arm Limited.
|
||||
* Copyright (C) 2021, Alex Richardson.
|
||||
* Copyright (C) 2014, Mozilla Corporation.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
@@ -21,7 +23,6 @@
|
||||
#include "jinclude.h"
|
||||
#include "jpeglib.h"
|
||||
#include "jsimd.h"
|
||||
#include "jconfigint.h"
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef HAVE_INTRIN_H
|
||||
@@ -53,14 +54,19 @@
|
||||
*/
|
||||
|
||||
/* NOTE: Both GCC and Clang define __GNUC__ */
|
||||
#if defined(__GNUC__) && (defined(__arm__) || defined(__aarch64__))
|
||||
#if (defined(__GNUC__) && (defined(__arm__) || defined(__aarch64__))) || \
|
||||
defined(_M_ARM) || defined(_M_ARM64)
|
||||
#if !defined(__thumb__) || defined(__thumb2__)
|
||||
#define USE_CLZ_INTRINSIC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_CLZ_INTRINSIC
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#define JPEG_NBITS_NONZERO(x) (32 - _CountLeadingZeros(x))
|
||||
#else
|
||||
#define JPEG_NBITS_NONZERO(x) (32 - __builtin_clz(x))
|
||||
#endif
|
||||
#define JPEG_NBITS(x) (x ? JPEG_NBITS_NONZERO(x) : 0)
|
||||
#else
|
||||
#include "jpeg_nbits_table.h"
|
||||
@@ -77,11 +83,11 @@ typedef struct {
|
||||
/* Pointer to routine to prepare data for encode_mcu_AC_first() */
|
||||
void (*AC_first_prepare) (const JCOEF *block,
|
||||
const int *jpeg_natural_order_start, int Sl,
|
||||
int Al, JCOEF *values, size_t *zerobits);
|
||||
int Al, UJCOEF *values, size_t *zerobits);
|
||||
/* Pointer to routine to prepare data for encode_mcu_AC_refine() */
|
||||
int (*AC_refine_prepare) (const JCOEF *block,
|
||||
const int *jpeg_natural_order_start, int Sl,
|
||||
int Al, JCOEF *absvalues, size_t *bits);
|
||||
int Al, UJCOEF *absvalues, size_t *bits);
|
||||
|
||||
/* Mode flag: TRUE for optimization, FALSE for actual data output */
|
||||
boolean gather_statistics;
|
||||
@@ -151,15 +157,15 @@ METHODDEF(boolean) encode_mcu_DC_first (j_compress_ptr cinfo,
|
||||
JBLOCKROW *MCU_data);
|
||||
METHODDEF(void) encode_mcu_AC_first_prepare
|
||||
(const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al,
|
||||
JCOEF *values, size_t *zerobits);
|
||||
METHODDEF(boolean) encode_mcu_AC_first (j_compress_ptr cinfo,
|
||||
UJCOEF *values, size_t *zerobits);
|
||||
METHODDEF(boolean) encode_mcu_AC_first(j_compress_ptr cinfo,
|
||||
JBLOCKROW *MCU_data);
|
||||
METHODDEF(boolean) encode_mcu_DC_refine (j_compress_ptr cinfo,
|
||||
JBLOCKROW *MCU_data);
|
||||
METHODDEF(int) encode_mcu_AC_refine_prepare
|
||||
(const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al,
|
||||
JCOEF *absvalues, size_t *bits);
|
||||
METHODDEF(boolean) encode_mcu_AC_refine (j_compress_ptr cinfo,
|
||||
UJCOEF *absvalues, size_t *bits);
|
||||
METHODDEF(boolean) encode_mcu_AC_refine(j_compress_ptr cinfo,
|
||||
JBLOCKROW *MCU_data);
|
||||
METHODDEF(void) finish_pass_phuff (j_compress_ptr cinfo);
|
||||
METHODDEF(void) finish_pass_gather_phuff (j_compress_ptr cinfo);
|
||||
@@ -170,24 +176,26 @@ INLINE
|
||||
METHODDEF(int)
|
||||
count_zeroes(size_t *x)
|
||||
{
|
||||
int result;
|
||||
#if defined(HAVE_BUILTIN_CTZL)
|
||||
int result;
|
||||
result = __builtin_ctzl(*x);
|
||||
*x >>= result;
|
||||
#elif defined(HAVE_BITSCANFORWARD64)
|
||||
unsigned long result;
|
||||
_BitScanForward64(&result, *x);
|
||||
*x >>= result;
|
||||
#elif defined(HAVE_BITSCANFORWARD)
|
||||
unsigned long result;
|
||||
_BitScanForward(&result, *x);
|
||||
*x >>= result;
|
||||
#else
|
||||
result = 0;
|
||||
int result = 0;
|
||||
while ((*x & 1) == 0) {
|
||||
++result;
|
||||
*x >>= 1;
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
return (int)result;
|
||||
}
|
||||
|
||||
|
||||
@@ -267,7 +275,8 @@ start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics)
|
||||
entropy->count_ptrs[tbl] = (long *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
257 * sizeof(long));
|
||||
MEMZERO(entropy->count_ptrs[tbl], 257 * sizeof(long));
|
||||
memset(entropy->count_ptrs[tbl], 0, 257 * sizeof(long));
|
||||
|
||||
if (cinfo->master->trellis_passes) {
|
||||
/* When generating tables for trellis passes, make sure that all */
|
||||
/* codewords have an assigned length */
|
||||
@@ -584,8 +593,8 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
continue; \
|
||||
/* For a negative coef, want temp2 = bitwise complement of abs(coef) */ \
|
||||
temp2 ^= temp; \
|
||||
values[k] = temp; \
|
||||
values[k + DCTSIZE2] = temp2; \
|
||||
values[k] = (UJCOEF)temp; \
|
||||
values[k + DCTSIZE2] = (UJCOEF)temp2; \
|
||||
zerobits |= ((size_t)1U) << k; \
|
||||
} \
|
||||
}
|
||||
@@ -593,7 +602,7 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
METHODDEF(void)
|
||||
encode_mcu_AC_first_prepare(const JCOEF *block,
|
||||
const int *jpeg_natural_order_start, int Sl,
|
||||
int Al, JCOEF *values, size_t *bits)
|
||||
int Al, UJCOEF *values, size_t *bits)
|
||||
{
|
||||
register int k, temp, temp2;
|
||||
size_t zerobits = 0U;
|
||||
@@ -666,9 +675,9 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
register int nbits, r;
|
||||
int Sl = cinfo->Se - cinfo->Ss + 1;
|
||||
int Al = cinfo->Al;
|
||||
JCOEF values_unaligned[2 * DCTSIZE2 + 15];
|
||||
JCOEF *values;
|
||||
const JCOEF *cvalue;
|
||||
UJCOEF values_unaligned[2 * DCTSIZE2 + 15];
|
||||
UJCOEF *values;
|
||||
const UJCOEF *cvalue;
|
||||
size_t zerobits;
|
||||
size_t bits[8 / SIZEOF_SIZE_T];
|
||||
|
||||
@@ -681,7 +690,7 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
emit_restart(entropy, entropy->next_restart_num);
|
||||
|
||||
#ifdef WITH_SIMD
|
||||
cvalue = values = (JCOEF *)PAD((size_t)values_unaligned, 16);
|
||||
cvalue = values = (UJCOEF *)PAD((JUINTPTR)values_unaligned, 16);
|
||||
#else
|
||||
/* Not using SIMD, so alignment is not needed */
|
||||
cvalue = values = values_unaligned;
|
||||
@@ -815,7 +824,7 @@ encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
zerobits |= ((size_t)1U) << k; \
|
||||
signbits |= ((size_t)(temp2 + 1)) << k; \
|
||||
} \
|
||||
absvalues[k] = (JCOEF)temp; /* save abs value for main pass */ \
|
||||
absvalues[k] = (UJCOEF)temp; /* save abs value for main pass */ \
|
||||
if (temp == 1) \
|
||||
EOB = k + koffset; /* EOB = index of last newly-nonzero coef */ \
|
||||
} \
|
||||
@@ -824,7 +833,7 @@ encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
METHODDEF(int)
|
||||
encode_mcu_AC_refine_prepare(const JCOEF *block,
|
||||
const int *jpeg_natural_order_start, int Sl,
|
||||
int Al, JCOEF *absvalues, size_t *bits)
|
||||
int Al, UJCOEF *absvalues, size_t *bits)
|
||||
{
|
||||
register int k, temp, temp2;
|
||||
int EOB = 0;
|
||||
@@ -869,7 +878,7 @@ encode_mcu_AC_refine_prepare(const JCOEF *block,
|
||||
|
||||
#define ENCODE_COEFS_AC_REFINE(label) { \
|
||||
while (zerobits) { \
|
||||
int idx = count_zeroes(&zerobits); \
|
||||
idx = count_zeroes(&zerobits); \
|
||||
r += idx; \
|
||||
cabsvalue += idx; \
|
||||
signbits >>= idx; \
|
||||
@@ -926,14 +935,14 @@ METHODDEF(boolean)
|
||||
encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
{
|
||||
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
|
||||
register int temp, r;
|
||||
register int temp, r, idx;
|
||||
char *BR_buffer;
|
||||
unsigned int BR;
|
||||
int Sl = cinfo->Se - cinfo->Ss + 1;
|
||||
int Al = cinfo->Al;
|
||||
JCOEF absvalues_unaligned[DCTSIZE2 + 15];
|
||||
JCOEF *absvalues;
|
||||
const JCOEF *cabsvalue, *EOBPTR;
|
||||
UJCOEF absvalues_unaligned[DCTSIZE2 + 15];
|
||||
UJCOEF *absvalues;
|
||||
const UJCOEF *cabsvalue, *EOBPTR;
|
||||
size_t zerobits, signbits;
|
||||
size_t bits[16 / SIZEOF_SIZE_T];
|
||||
|
||||
@@ -946,7 +955,7 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
emit_restart(entropy, entropy->next_restart_num);
|
||||
|
||||
#ifdef WITH_SIMD
|
||||
cabsvalue = absvalues = (JCOEF *)PAD((size_t)absvalues_unaligned, 16);
|
||||
cabsvalue = absvalues = (UJCOEF *)PAD((JUINTPTR)absvalues_unaligned, 16);
|
||||
#else
|
||||
/* Not using SIMD, so alignment is not needed */
|
||||
cabsvalue = absvalues = absvalues_unaligned;
|
||||
@@ -977,7 +986,7 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
|
||||
if (zerobits) {
|
||||
int diff = ((absvalues + DCTSIZE2 / 2) - cabsvalue);
|
||||
int idx = count_zeroes(&zerobits);
|
||||
idx = count_zeroes(&zerobits);
|
||||
signbits >>= idx;
|
||||
idx += diff;
|
||||
r += idx;
|
||||
@@ -1062,7 +1071,7 @@ finish_pass_gather_phuff (j_compress_ptr cinfo)
|
||||
/* It's important not to apply jpeg_gen_optimal_table more than once
|
||||
* per table, because it clobbers the input frequency counts!
|
||||
*/
|
||||
MEMZERO(did, sizeof(did));
|
||||
memset(did, 0, sizeof(did));
|
||||
|
||||
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
|
||||
compptr = cinfo->cur_comp_info[ci];
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
*
|
||||
* This file is part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* It was modified by The libjpeg-turbo Project to include only code relevant
|
||||
* to libjpeg-turbo.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2022, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -289,7 +289,7 @@ create_context_buffer(j_compress_ptr cinfo)
|
||||
cinfo->max_h_samp_factor) / compptr->h_samp_factor),
|
||||
(JDIMENSION)(3 * rgroup_height));
|
||||
/* Copy true buffer row pointers into the middle of the fake row array */
|
||||
MEMCOPY(fake_buffer + rgroup_height, true_buffer,
|
||||
memcpy(fake_buffer + rgroup_height, true_buffer,
|
||||
3 * rgroup_height * sizeof(JSAMPROW));
|
||||
/* Fill in the above and below wraparound pointers */
|
||||
for (i = 0; i < rgroup_height; i++) {
|
||||
|
||||
63
jcsample.c
63
jcsample.c
@@ -6,7 +6,7 @@
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
* Copyright (C) 2014, MIPS Technologies, Inc., California.
|
||||
* Copyright (C) 2015, D. R. Commander.
|
||||
* Copyright (C) 2015, 2019, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -103,7 +103,7 @@ expand_right_edge(JSAMPARRAY image_data, int num_rows, JDIMENSION input_cols,
|
||||
if (numcols > 0) {
|
||||
for (row = 0; row < num_rows; row++) {
|
||||
ptr = image_data[row] + input_cols;
|
||||
pixval = ptr[-1]; /* don't need GETJSAMPLE() here */
|
||||
pixval = ptr[-1];
|
||||
for (count = numcols; count > 0; count--)
|
||||
*ptr++ = pixval;
|
||||
}
|
||||
@@ -174,7 +174,7 @@ int_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
|
||||
for (v = 0; v < v_expand; v++) {
|
||||
inptr = input_data[inrow + v] + outcol_h;
|
||||
for (h = 0; h < h_expand; h++) {
|
||||
outvalue += (JLONG)GETJSAMPLE(*inptr++);
|
||||
outvalue += (JLONG)(*inptr++);
|
||||
}
|
||||
}
|
||||
*outptr++ = (JSAMPLE)((outvalue + numpix2) / numpix);
|
||||
@@ -237,8 +237,7 @@ h2v1_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
|
||||
inptr = input_data[outrow];
|
||||
bias = 0; /* bias = 0,1,0,1,... for successive samples */
|
||||
for (outcol = 0; outcol < output_cols; outcol++) {
|
||||
*outptr++ =
|
||||
(JSAMPLE)((GETJSAMPLE(*inptr) + GETJSAMPLE(inptr[1]) + bias) >> 1);
|
||||
*outptr++ = (JSAMPLE)((inptr[0] + inptr[1] + bias) >> 1);
|
||||
bias ^= 1; /* 0=>1, 1=>0 */
|
||||
inptr += 2;
|
||||
}
|
||||
@@ -277,8 +276,7 @@ h2v2_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
|
||||
bias = 1; /* bias = 1,2,1,2,... for successive samples */
|
||||
for (outcol = 0; outcol < output_cols; outcol++) {
|
||||
*outptr++ =
|
||||
(JSAMPLE)((GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
|
||||
GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]) + bias) >> 2);
|
||||
(JSAMPLE)((inptr0[0] + inptr0[1] + inptr1[0] + inptr1[1] + bias) >> 2);
|
||||
bias ^= 3; /* 1=>2, 2=>1 */
|
||||
inptr0 += 2; inptr1 += 2;
|
||||
}
|
||||
@@ -337,33 +335,25 @@ h2v2_smooth_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
|
||||
below_ptr = input_data[inrow + 2];
|
||||
|
||||
/* Special case for first column: pretend column -1 is same as column 0 */
|
||||
membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
|
||||
GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
|
||||
neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
|
||||
GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
|
||||
GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[2]) +
|
||||
GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[2]);
|
||||
membersum = inptr0[0] + inptr0[1] + inptr1[0] + inptr1[1];
|
||||
neighsum = above_ptr[0] + above_ptr[1] + below_ptr[0] + below_ptr[1] +
|
||||
inptr0[0] + inptr0[2] + inptr1[0] + inptr1[2];
|
||||
neighsum += neighsum;
|
||||
neighsum += GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[2]) +
|
||||
GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[2]);
|
||||
neighsum += above_ptr[0] + above_ptr[2] + below_ptr[0] + below_ptr[2];
|
||||
membersum = membersum * memberscale + neighsum * neighscale;
|
||||
*outptr++ = (JSAMPLE)((membersum + 32768) >> 16);
|
||||
inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
|
||||
|
||||
for (colctr = output_cols - 2; colctr > 0; colctr--) {
|
||||
/* sum of pixels directly mapped to this output element */
|
||||
membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
|
||||
GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
|
||||
membersum = inptr0[0] + inptr0[1] + inptr1[0] + inptr1[1];
|
||||
/* sum of edge-neighbor pixels */
|
||||
neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
|
||||
GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
|
||||
GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[2]) +
|
||||
GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[2]);
|
||||
neighsum = above_ptr[0] + above_ptr[1] + below_ptr[0] + below_ptr[1] +
|
||||
inptr0[-1] + inptr0[2] + inptr1[-1] + inptr1[2];
|
||||
/* The edge-neighbors count twice as much as corner-neighbors */
|
||||
neighsum += neighsum;
|
||||
/* Add in the corner-neighbors */
|
||||
neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[2]) +
|
||||
GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[2]);
|
||||
neighsum += above_ptr[-1] + above_ptr[2] + below_ptr[-1] + below_ptr[2];
|
||||
/* form final output scaled up by 2^16 */
|
||||
membersum = membersum * memberscale + neighsum * neighscale;
|
||||
/* round, descale and output it */
|
||||
@@ -372,15 +362,11 @@ h2v2_smooth_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
|
||||
}
|
||||
|
||||
/* Special case for last column */
|
||||
membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
|
||||
GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
|
||||
neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
|
||||
GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
|
||||
GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[1]) +
|
||||
GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[1]);
|
||||
membersum = inptr0[0] + inptr0[1] + inptr1[0] + inptr1[1];
|
||||
neighsum = above_ptr[0] + above_ptr[1] + below_ptr[0] + below_ptr[1] +
|
||||
inptr0[-1] + inptr0[1] + inptr1[-1] + inptr1[1];
|
||||
neighsum += neighsum;
|
||||
neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[1]) +
|
||||
GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[1]);
|
||||
neighsum += above_ptr[-1] + above_ptr[1] + below_ptr[-1] + below_ptr[1];
|
||||
membersum = membersum * memberscale + neighsum * neighscale;
|
||||
*outptr = (JSAMPLE)((membersum + 32768) >> 16);
|
||||
|
||||
@@ -429,21 +415,18 @@ fullsize_smooth_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
|
||||
below_ptr = input_data[outrow + 1];
|
||||
|
||||
/* Special case for first column */
|
||||
colsum = GETJSAMPLE(*above_ptr++) + GETJSAMPLE(*below_ptr++) +
|
||||
GETJSAMPLE(*inptr);
|
||||
membersum = GETJSAMPLE(*inptr++);
|
||||
nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) +
|
||||
GETJSAMPLE(*inptr);
|
||||
colsum = (*above_ptr++) + (*below_ptr++) + inptr[0];
|
||||
membersum = *inptr++;
|
||||
nextcolsum = above_ptr[0] + below_ptr[0] + inptr[0];
|
||||
neighsum = colsum + (colsum - membersum) + nextcolsum;
|
||||
membersum = membersum * memberscale + neighsum * neighscale;
|
||||
*outptr++ = (JSAMPLE)((membersum + 32768) >> 16);
|
||||
lastcolsum = colsum; colsum = nextcolsum;
|
||||
|
||||
for (colctr = output_cols - 2; colctr > 0; colctr--) {
|
||||
membersum = GETJSAMPLE(*inptr++);
|
||||
membersum = *inptr++;
|
||||
above_ptr++; below_ptr++;
|
||||
nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) +
|
||||
GETJSAMPLE(*inptr);
|
||||
nextcolsum = above_ptr[0] + below_ptr[0] + inptr[0];
|
||||
neighsum = lastcolsum + (colsum - membersum) + nextcolsum;
|
||||
membersum = membersum * memberscale + neighsum * neighscale;
|
||||
*outptr++ = (JSAMPLE)((membersum + 32768) >> 16);
|
||||
@@ -451,7 +434,7 @@ fullsize_smooth_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
|
||||
}
|
||||
|
||||
/* Special case for last column */
|
||||
membersum = GETJSAMPLE(*inptr);
|
||||
membersum = *inptr;
|
||||
neighsum = lastcolsum + (colsum - membersum) + colsum;
|
||||
membersum = membersum * memberscale + neighsum * neighscale;
|
||||
*outptr = (JSAMPLE)((membersum + 32768) >> 16);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user