Tag 1.5.2 release
* tag '1.5.2': (54 commits)
x86: Fix "short jump is out of range" w/ NASM<2.04
TurboJPEG: Document xform issue w/ big marker data
Java TJBench: Fix parsing of -warmup argument
Build: Disable warmup in TJBench regression tests
TJBench: Improve consistency of results
TurboJPEG: C API documentation buglet
TJBench: Code formatting tweaks
TJBench: Fix errors when decomp. files w/ ICC data
BUILDING.md: Include Android/x86 build recipes
Travis: Fix OS X build
Restore compatibility with older autoconf releases
Attribute ARM runtime detection code to Nokia
Honor max_memory_to_use/JPEGMEM/-maxmemory
AppVeyor: Fix CI build
TurboJPEG: Fix potential memory leaks
Always tweak EXIF w/h tags w/ lossless transforms
Fix error w/ lossless crop & libjpeg v7 emulation
Include jpeg_skip/crop_scanlines() in jpeg7.dll
libjpeg.txt: Include partial decomp. in TOC
Slightly de-confusify cjpeg, jpegtran usage info
...
If the source image for a transform operation has a lot of EXIF or ICC
data embedded in it, then it may cause the output image size to exceed
the worst-case size returned by tjBufSize() (because tjTransform()
transfers all markers to the output image.) This is only a problem if
TJFLAG_NOREALLOC is passed to the function. Since the TurboJPEG C API
doesn't require the destination image size to be set in this case, it
makes the documented assumption that the calling program has allocated
the destination buffer to exactly the size returned by tjBufSize().
Changing this assumption would change the API behavior and necessitate
a new function name (tjTransform2().) At the moment, it's easier to
just document this as a known issue, since it's easy to work around in
the C API.
The Java API is unfortunately a different story, since it must always
use TJFLAG_NOREALLOC (because, when using the TurboJPEG Java API, all
buffers are allocated on the Java heap, and thus they can't be
reallocated by the C code.) There is no easy way to work around this
without changing the C API as discussed above, because if the source
image contains large amounts of marker data, it's virtually impossible
to determine how big the output image will be.
Given that libjpeg-turbo can often process hundreds of megapixels/second
on modern hardware, the default of one warmup iteration was essentially
meaningless. Furthermore, the -warmup option was a bit clunky, since
it required some foreknowledge of how fast the benchmarks were going to
execute.
This commit introduces a 1-second warmup interval for each benchmark by
default, and the -warmup option has been retasked to control the length
of that interval.
Embedded ICC profiles can cause the size of a JPEG file to exceed the
size returned by tjBufSize() (which is really meant to be used for
compression anyhow, not for decompression), and this was causing a
segfault (C) or an ArrayIndexOutOfBoundsException (Java) when
decompressing such files with TJBench. This commit modifies the
benchmark such that, when tiled decompression is disabled, it re-uses
the source buffer as the primary JPEG buffer.
The Travis xcode7.3 image now apparently includes GnuPG 1.4.x by
default, so use it instead of installing GnuPG 2. Using GnuPG 2.1.x,
the default version in Homebrew as of this writing, is problematic for
this reason:
https://wiki.archlinux.org/index.php/GnuPG#Unattended_passphrase
This re-introduces a feature of the obsolete system-specific libjpeg
memory managers-- namely the ability to limit the amount of main memory
used by the library during decompression or multi-pass compression.
This is mainly beneficial for two reasons:
- Works around a 2 GB limit in libFuzzer
- Allows security-sensitive applications to set a memory limit for the
JPEG decoder so as to work around the progressive JPEG exploit
(LJT-01-004) described here:
http://www.libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf
This commit also removes obsolete documentation regarding the MS-DOS
memory manager (which itself was removed long ago) and changes the
documentation of the -maxmemory switch and JPEGMEM environment variable
to reflect the fact that backing stores are never used in libjpeg-turbo.
Inspired by:
066fee2e7dCloses#143
Something changed in the CI build environment, and our previous trick of
setting the Git URL to file://c:/projects/libjpeg-turbo no longer works.
Using cygpath to translate the Windows path to a MinGW-friendly format
is a better solution anyhow.
Referring to https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=746,
it seems that the values of local buffer pointers in TurboJPEG API
functions aren't always preserved if longjmp() returns control to a
point prior to the allocation of the local buffers. This is known to
be an issue with GCC 4.x and clang with -O1 and higher optimization
levels but not with GCC 5.x and later. It is unknown why GCC 5.x and
6.x do not suffer from the issue, but possibly the local buffer pointers
are not allocated on the stack when using those more recent compilers.
In any case, this commit modifies the TurboJPEG API library code such
that the jump buffer is always updated after any local buffer pointers
are allocated but before any subsequent libjpeg API functions are
called.
Tag 1.5.1 release
* tag '1.5.1':
ARM64 NEON: Fix another ABI conformance issue
Build: Remove ARMv6 support from 'make iosdmg'
Fix out-of-bounds write in partial decomp. feature
Silence additional UBSan warnings
Fix unsigned int overflow in libjpeg memory mgr.
TurboJPEG: Decomp. 4:2:2/4:4:0 JPEGs w/unusual SFs
Silence pedantic GCC6 code formatting warnings
Use plain upsampling if merged isn't accelerated
Implement h1v2 fancy upsampling
Fix AArch64 ABI conformance issue in SIMD code
Don't install libturbojpeg.pc if TJPEG disabled
Linux/PPC: Only enable AltiVec if CPU supports it
ARM/MIPS: Change the behavior of JSIMD_FORCE*
Bump version to 1.5.1 to prepare for new commits
... even if using libjpeg v6b emulation. Previously
adjust_exif_parameters() was only called with libjpeg v7/v8 emulation,
but due to a bug (which this commit also fixes), it only worked properly
with libjpeg v8 emulation.
The JPEG_LIB_VERSION #ifdef in jtransform_adjust_parameters() was
incorrect, which caused a "Bogus virtual array access" error when
attempting to use the lossless crop feature.
Introduced in c04bd3cc97.
This also adds libjpeg v7 API/ABI emulation to the Travis CI tests.
LICENSE.md is included in the binary distributions as well, so it
doesn't make much sense to refer to license headers in source files that
aren't necessarily going to be there.
This is a subtle point, but AC_C_INLINE defines "inline" to be either
"inline", "__inline__", or "__inline". The subsequent test for
"inline __attribute__((always_inline))" uses this definition. The
attribute is irrespective of the inline keyword, so whereas
"__inline__ __attribute__((always_inline))" works under C89,
"inline __attribute__((always_inline))" doesn't, and defining INLINE to
the latter causes the build to fail. The easiest way around this is
simply to define "inline" ahead of "INLINE" in jconfigint.h,
which causes the inline keyword detected by AC_C_INLINE to modify the
INLINE macro if necessary.
+ advertise that full AltiVec SIMD acceleration is now available on
OpenBSD.
The relevant compilers probably all support C99 or GNU's variation of
C90 that allows variables to be declared anywhere, but our policy is to
conform to the C90 standard, if for no other reason than that it
improves code readability.
Fixes:
rdppm.c:257:14: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
if (temp > maxval)
~~~~ ^ ~~~~~~
rdppm.c:284:14: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
if (temp > maxval)
~~~~ ^ ~~~~~~
rdppm.c:289:14: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
if (temp > maxval)
~~~~ ^ ~~~~~~
rdppm.c:294:14: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
if (temp > maxval)
The xcode7.2 image is verfallen, verlumpt, verblunget, verkackt
This also ensures that the build scripts are checked out from a
branch matching the libjpeg-turbo repository branch (not strictly
necessary when building from master, but it keeps the code in sync with
dev.)
AppVeyor already has MinGW32 and MinGW64 flavors of GCC 5.3.0
installed under MSYS2, so there is no need to install our own builds of
MinGW. MinGW-builds is no longer an active project, and we were getting
occasional timeouts while wgetting those files from SourceForge.
Furthermore, GCC 5.3.0 should produce faster code than GCC 4.8.1.
Updated out-of-date information, wordsmithed and clarified many
sections, and generally cleaned up the build recipes (including a
complete overhaul of the iOS recipes.)
Regression caused by f9134384b7
This commit also makes the "testclean" target clean up the 4:1:1 test
images. This was implemented in the autotools build system in
1f3635c496 but was left out of the CMake
build system due to an oversight.
This has the following advantages:
-- It doesn't require checking a private SSH key into the repository.
(With SourceForge, an SSH key is the "keys to the kingdom".)
-- If the S3 key is compromised, it is very easy to revoke it and
generate a new one.
-- The S3 bucket is isolated, so even if it becomes compromised, then
the damage that one could do is limited.
-- It's much easier to manage files through S3's web interface than
through SourceForge.
-- The files are served via HTTPS.
-- Travis fully supports S3 as a deployment target, so this simplifies
.travis.yml somewhat.
Since we're still deploying our Linux/macOS CI artifacts to a web server
(specifically SourceForge Project Web Services) that doesn't support
HTTPS, it's a good idea to sign them. But since the private key has to
be checked into the repository, we use a different key for signing the
pre-releases (per project policy, the private signing keys for our
release binaries are never made available on any public server.)
Previously, simd/CMakeLists.txt was hard-coded to use NASM, and it was
necessary to override the NASM variable in order to use YASM. This
commit changes the behavior such that NASM is still preferred, but YASM
will be used if it is in the PATH and NASM isn't available. This brings
the actual behavior in line with the behavior described in BUILDING.md.
Based on
b0799a1598Closes#107
Pass the actual repository and branch that Travis is using into the
builtljt script, so the official builds it generates will come from
the same code base as the other tested builds.
- Introduce a new FLOATTEST value ("387") on Un*x systems that will
compare the floating point DCT/IDCT algorithms against the expected
results from the C algorithms when built using 32-bit code and
-mfpmath=387.
- Extend the Windows regression tests so that they work properly when
building libjpeg-turbo with 32-bit code and without SIMD, using either
Visual C++ (tested with 2008, 2010, 2015) or MinGW.
Based on
98a5a9dc89
with wordsmithing by DRC.
In the AArch64 ABI, as in many others, it's forbidden to read/store data
below the stack pointer. Some SIMD functions were doing just that
(stack pointer misuse) when trying to preserve callee-saved registers,
and this resulted in those registers being restored with incorrect
contents under certain circumstances.
This patch fixes that behavior, and callee-saved registers are now
stored above the stack pointer throughout the function call. The patch
also removes register saving in places where it is unnecessary for this
ABI, or it makes use of unused scratch regiters instead of callee-saved
registers.
Fixes#97. Closes#101.
Refer also to https://bugzilla.redhat.com/show_bug.cgi?id=1368569
The last iDevice to require ARMv6 was the iPhone 3G, which required iOS
4.2.1 or older. Our binaries have always required iOS 4.3 or newer,
so I'm not sure if the ARMv6 fork of our binaries was ever useful to
begin with. In any case, if it ever was useful, it no longer is. Fat
binaries can still be generated with ARMv6 support by invoking
{build_directory}/pkgscripts/makemacpkg manually.
Reported by Clang UBSan (refer to
https://bugzilla.mozilla.org/show_bug.cgi?id=1301252 for test image.)
This appears to be a legitimate bug introduced by
3ab68cf563. Any component array, such
as first_MCU_col and last_MCU_col, should always be able to accommodate
MAX_COMPONENTS values. The aforementioned test image had 8 components,
which was not enough to make the out-of-bounds write bust out of the
jpeg_decomp_master struct (and fortunately the memory after last_MCU_col
is an integer used as a boolean, so stomping on it will do nothing other
than change the decoder state.) I crafted another special image that
has 10 components (the maximum allowable), but that was apparently not
enough to bust out of the allocated memory, either. Thus, it is
posited that the security threat posed by this bug is either extremely
minimal or non-existent.
When attempting to decode a malformed JPEG image (refer to
https://bugzilla.mozilla.org/show_bug.cgi?id=1295044) with dimensions
61472 x 32800, the maximum_space variable within the
realize_virt_arrays() function will exceed the maximum value of a 32-bit
integer and will wrap around. The memory manager subsequently fails
with an "Insufficient memory" error (case 4, in alloc_large()), so this
commit simply causes that error to be triggered earlier, before UBSan
has a chance to complain.
Note that this issue did not ever represent an exploitable security
threat, because the POSIX-based memory manager that we use doesn't ever
do anything meaningful with the value of maximum_space.
jpeg_mem_available() simply sets avail_mem = maximum_space, so the
subsequent behavior of the memory manager is the same regardless of
whether maximum_space is correct or not. This commit simply removes a
UBSan warning in order to make it easier to detect actual security
issues.
Normally, 4:2:2 JPEGs have horizontal x vertical luminance,chrominance
sampling factors of 2x1,1x1, and 4:4:0 JPEGs have horizontal x vertical
luminance,chrominance sampling factors of 1x2,1x1. However, it is
technically legal to create 4:2:2 JPEGs with sampling factors of
2x2,1x2 and 4:4:0 JPEGs with sampling factors of 2x2,2x1, since the
sums of the products of those sampling factors (2x2 + 1x2 + 1x2 and
2x2 + 2x1 + 2x1) are still <= 10. The libjpeg API correctly decodes
such images, so the TurboJPEG API should as well.
Fixes#92
Currently, this only affects ARM, since it is the only platform that
accelerates YCbCr-to-RGB conversion but not merged upsampling. Even if
"plain" upsampling isn't accelerated, the combination of accelerated
color conversion + unaccelerated plain upsampling is still faster than
the unaccelerated merged upsampling algorithms.
Closes#81
This allows fancy upsampling to be used when decompressing 4:2:2 images
that have been losslessly rotated or transposed.
(docs and comments added by DRC)
Based on f63aca945dCloses#89
In the AArch64 ABI, the high (unused) DWORD of a 32-bit argument's
register is undefined, so it was incorrect to use 64-bit
instructions to transfer a JDIMENSION argument in the 64-bit NEON SIMD
functions. The code worked thus far only because the existing compiler
optimizers weren't smart enough to do anything else with the register in
question, so the upper 32 bits happened to be all zeroes.
The latest builds of Clang/LLVM have a smarter optimizer, and under
certain circumstances, it will attempt to load-combine adjacent 32-bit
integers from one of the libjpeg structures into a single 64-bit integer
and pass that 64-bit integer as a 32-bit argument to one of the SIMD
functions (which is allowed by the ABI, since the upper 32 bits of the
32-bit argument's register are undefined.) This caused the
libjpeg-turbo regression tests to crash.
This patch tries to use the Wn registers whenever possible. Otherwise,
it uses a zero-extend instruction to avoid using the upper 32 bits of
the 64-bit registers, which are not guaranteed to be valid for 32-bit
arguments.
Based on 1fbae13021Closes#91. Refer also to android-ndk/ndk#110 and
https://llvm.org/bugs/show_bug.cgi?id=28393
This eliminates "illegal instruction" errors when running libjpeg-turbo
under Linux on PowerPC chips that lack AltiVec support (e.g. the old
7XX/G3 models but also the newer e5500 series.)
The JSIMD_FORCE* environment variables previously meant "force the use
of this instruction set if it is available but others are available as
well", but that did nothing on ARM platforms, since there is only ever
one instruction set available. Since the ARM and MIPS CPU feature
detection code is less than bulletproof, and since there is only one
SIMD instruction set (currently) supported on those platforms, it makes
sense for the JSIMD_FORCE* environment variables on those platforms to
actually force the use of the SIMD instruction set, thus bypassing the
CPU feature detection code.
This addresses a concern raised in #88 whereby parsing /proc/cpuinfo
didn't work within a QEMU environment. This at least provides a
workaround, allowing users to force-enable or force-disable SIMD
instructions for ARM and MIPS builds of libjpeg-turbo.
28d1a1300c introduced the line
"nasm.exe should be in your PATH". This commit corrects an oversight in
8f1c0a681c /
e5091f2cf3 whereby this line should have
been extended to include yasm.exe.
The IJG convention is to format copyright notices as:
Copyright (C) YYYY, Owner.
We try to maintain this convention for any code that is part of the
libjpeg API library (with the exception of preserving the copyright
notices from Cendio's code verbatim, since those predate
libjpeg-turbo.)
Note that the phrase "All Rights Reserved" is no longer necessary, since
all Buenos Aires Convention signatories signed onto the Berne Convention
in 2000. However, our convention is to retain this phrase for any files
that have a self-contained copyright header but to leave it off of any
files that refer to another file for conditions of distribution and use.
For instance, all of the non-SIMD files in the libjpeg API library refer
to README.ijg, and the copyright message in that file contains "All
Rights Reserved", so it is unnecessary to add it to the individual
files.
The TurboJPEG code retains my preferred formatting convention for
copyright notices, which is based on that of VirtualGL (where the
TurboJPEG API originated.)
Calling jpeg_stdio_dest() followed by jpeg_mem_dest(), or jpeg_mem_src()
followed by jpeg_stdio_src(), is dangerous, because the existing opaque
structure would not be big enough to accommodate the new source/dest
manager. This issue was non-obvious to libjpeg-turbo consumers, since
it was only documented in code comments. Furthermore, the issue could
also occur if the source/dest manager was allocated by the calling
program, but it was not allocated with enough space to accommodate the
opaque stdio or memory source/dest manager structs. The safest thing to
do is to throw an error if one of these functions is called when there
is already a source/dest manager assigned to the object and it was
allocated elsewhere.
Closes#78, #79
The jpeg-7/jpeg-8 APIs/ABIs require arithmetic coding, and the jpeg-8
API/ABI requires the memory source/destination manager, so this commit
causes the build system to ignore --with-arith-enc/--without-arith-enc
and --with-arith-dec/--without-arith-dec (and the equivalent CMake
variables-- WITH_ARITH_ENC and WITH_ARITH_DEC) when v7/v8 API/ABI
emulation is enabled. Furthermore, the CMake build system now ignores
WITH_MEM_SRCDST whenever WITH_JPEG8 is specified (the autotools build
system already did that.)
GCC does support UAL syntax (strbeq) if the ".syntax unified" directive
is supplied. This directive is supported by all versions of GCC and
clang going back to 2003, so it should not create any backward
compatibility issues.
Based on 1264349e2fCloses#76
If wmic.exe wasn't available, then CMakeLists.txt would call
"cmd /C date /T" and parse the result in order to set the BUILD
variable. However, the parser assumed that the date was in MM/DD/YYYY
format, which is not generally the case unless the user's locale is U.S.
English with the default region/language settings for that locale.
This commit modifies CMakeLists.txt such that it uses the
string(TIMESTAMP) function available in CMake 2.8.11 and later to set
the BUILD variable, thus eliminating the need to use wmic.exe or any
other platform-specific hack.
This commit also modifies the build instructions to remove any reference
to CMake 2.6 (which hasn't been supported by our build system since
libjpeg-turbo 1.3.x.)
Closes#74
* libjpeg-turbo/master: (140 commits)
Increase severity of tjDecompressToYUV2() bug desc
Catch libjpeg errors in tjDecompressToYUV2()
BUILDING.md: Fix "... OR ..." indentation again
BUILDING.md: Fix confusing Windows build reqs
ChangeLog.md: Improve readability of plain text
change.log: Refer users to ChangeLog.md
Markdown version of ChangeLog.txt
Rename ChangeLog.txt
README.md: Link to BUILDING.md
BUILDING.md and README.md: Cosmetic tweaks
ChangeLog: "1.5 beta1" --> "1.4.90 (1.5 beta1)"
Java: Fix parallel make with autotools
Win/x64: Fix improper callee save of xmm8-xmm11
Bump TurboJPEG C API revision to 1.5
ChangeLog: Mention jpeg_crop_scanline() function
1.5 beta1
Fix v7/v8-compatible build
libjpeg API: Partial scanline decompression
Build: Make the NASM autoconf variable persistent
Use consistent/modern code formatting for dbl ptrs
...
* libjpeg-turbo/1.4.x: (94 commits)
CMakeLists.txt: Clarify that Un*x isn't supported
Catch libjpeg errors in tjDecompressToYUV2()
cjpeg: Fix buf overrun caused by bad bin PPM input
Add version/build info to global string table
Ensure that default Huffman tables are initialized
Fix memory leak when running tjunittest -yuv
Prevent overread when decoding malformed JPEG
Guard against wrap-around in alloc functions
Fix Visual C++ compiler warnings
rdppm.c: formatting tweaks
jmemmgr.c: formatting tweaks
TurboJPEG: Avoid dangling pointers
Update Android build instr. for ARMv8, PIE, etc.
Makefile.am: formatting tweak
Update build instructions for new autoconf, GitHub
1.4.3
Regression: Allow co-install of 32-bit/64-bit RPMs
Build: Use FILEPATH type for NASM CMake variable
Comment formatting tweaks
Fix 'make dist'
...
Tag 1.4.1 release
* tag '1.4.1': (427 commits)
Now that the TurboJPEG API is reporting libjpeg warnings as errors, an "Invalid SOS parameters for sequential JPEG" warning surfaced in tjDecodeYUV*(). This was caused by the Se member of jpeg_decompress_struct being set to 0 (it is normally set to a non-zero value when the start-of-scan markers are read, but there are no SOS markers in this case, because we're not actually decompressing a JPEG file.)
Fix a segfault that occured in the MIPS DSPr2 fancy upsampling routine when downsampled_width==3. Because the DSPr2 code unrolls the loop for the middle columns (refer to jdsample.c), it has the effect of performing two column iterations, and that only works properly if the number of columns (minus the first and last) is >= 2. For the specific case of downsampled_width==3, this patch skips to the second iteration of the unrolled column loop.
If a warning (such as "Premature end of JPEG file") is triggered in the underlying libjpeg API, make sure that the TurboJPEG API function returns -1. Unlike errors, however, libjpeg warnings do not make the TurboJPEG functions abort.
Back out r1555 and r1548. Using setenv() didn't fix the iOS simulator issue. It just replaced an undefined _putenv$UNIX2003 symbol with an undefined _setenv$UNIX2003 symbol. The correct solution seems to be to use -D_NONSTD_SOURCE when generating our official builds.
Fix the Windows build. I remember now why I used putenv() originally-- because Windows doesn't have setenv(). We could use _putenv_s(), but older versions of MinGW don't have that either. Fortunately, since all of the environment values we're setting in turbojpeg.c are static, we can just map setenv() to putenv() using a macro. NOTE: we still have to use _putenv_s() in turbojpeg-jni.c, but at least people who may need to build with an older version of MinGW can still do so by disabling the Java build.
Allow building only static or only shared libraries on Windows
__WORDSIZE doesn't seem to be available on platforms other than Mac or Linux, and best practices are for user-level code not to rely on it anyhow, since it's meant to be an internal macro. Fortunately, autoconf already has a way of determining the word size at configure time, so it can be passed into the compiler. This should work on any platform and has been tested on all of the Un*x platforms we support (Linux, Mac, FreeBSD, Solaris.)
Unless you define _ANSI_SOURCE, then putenv() on Mac is renamed to putenv$UNIX2003(), and this causes problems when trying to link an i386 iOS application (for the simulator) against the TurboJPEG static library. It's easiest to just use setenv() instead.
Fix a bug in the 64-bit Huffman encoder that Google discovered when encoding some very specific (and proprietary) aerial images using quality=98, an optimized Huffman table, and the ISLOW DCT. These images were causing the Huffman bit buffer to overflow, because the code for encoding the DC coefficient was using the equivalent of the 32-bit version of EMIT_BITS(). Thus, when 64-bit code was used, the DC coefficient code was not properly checking how many bits were in the buffer before attempting to add more bits to it. This issue appears to have existed in all versions of libjpeg-turbo.
Restore backward compatibility with MSVC < 2010 (broken by r1541)
Oops. OS X doesn't define __WORDSIZE unless you include stdint.h, so apparently the Huffman codec hasn't ever been fully accelerated on 64-bit OS X.
Allow the executables and libraries outside of the sharedlib/ directory to be linked against msvcr*.dll instead of libcmt*.lib. This is reported to be necessary when building libjpeg-turbo for use with C#.
Surround the usage of getenv() in the TurboJPEG API with #ifndef NO_GETENV so that developers can add -DNO_GETENV to the C flags when building for platforms that don't have getenv(). Currently this is known to be necessary when building for Windows Phone.
If libjpeg-turbo is configured with a non-default prefix, such as /usr, then use the docdir variable defined by autoconf 2.60 and later, if available. This will, for instance, install the documentation under /usr/share/doc/libjpeg-turbo by default if prefix=/usr, unless docdir is overridden. When using earlier versions of autoconf, docdir is set to ${datadir}/doc, as it always has been.
Enable silent build rules for the NASM objects, if the source is configured with automake 1.11 or later. NOTE: the build still spits out "error: ignoring unknown tag NASM" for each object, but unfortunately, if we remove "--tag NASM" from the command line, the build breaks under older versions of automake (it aborts with "unable to infer tagged configuration.")
Set the RPM and deb architecture properly on non-x86 platforms.
Come on, Cohaagen, you got what you want. Give these people air!
Oops. Need to set the alpha channel when using TYPE_4BYTE_ABGR*. This has no bearing on the actual tests, but it prevents the PNG pre-encode reference images for those tests from being blank.
Oops. The MIPS SIMD implementations of h2v1 and h2v2 upsampling were not checking for DSPr2 support, so running 'djpeg -nosmooth' on a non-DSPr2-enabled platform caused an "illegal instruction" error.
Introduce fast paths to speed up NULL color conversion somewhat, particularly when using 64-bit code; on the decompression side, the "slow path" also now use an approach similar to that of the compression side (with the component loop outside of the column loop rather than inside.) This is faster when using 32-bit code.
...
* origin/master: (108 commits)
Bump version number to 3.1.
jpegyuv: fix memory leak when path is invalid
jpegyuv: fix memory leak when @image_buffer allocation fails
yuvjpeg: fix memory leak when @image_buffer allocation fails
jpegtran: Do not leak the input and output buffers
Fix previous commit
Scan optimization: return error when unable to copy data buffer
cjpeg option for baseline quant tables
Fix#153
rdpng: convert 16-bit input to 8-bit
Larger number of DC trellis candidates
Fix overflow issue #157
Const on getters
Const on simple getters and copy source
Expanded .gitignore
Add pkg-config requirement
Re-order links.
Declare inbuffer const
Oops. Delete the duplicate copy of [lib]turbojpeg.dll in the binary directory when uninstalling the package.
Get rid of changelog file that we don't update.
...
* commit 'eca0637c8150d3d1c08a60c64d7ee16eaea4b198':
Remove trailing spaces
Another oops. tjBufSizeYUV2() should return -1 if width < 1.
Oops. tjPlaneSizeYUV() should return -1 if componentID > 0 and subsamp==TJSAMP_GRAY.
When building libjpeg-turbo on Un*x systems, INT32 is usually typedef'ed to long, not int, so we need to specify an int pointer when doing a 4-byte write to the RGB565 output buffer. On little endian systems, this doesn't matter, but when you write a 32-bit int to a 64-bit long pointer address on a big endian system, you are writing to the upper 4 bytes, not the lower 4 bytes. NOTE: this will probably break on big endian systems that use 16-bit ints (are there any of those still around?)
Fix Windows build
Fix issues with RGB565 color conversion on big endian machines. The RGB565 routines are now abstracted in a separate file, with separate little-endian and big-endian versions defined at compile time through the use of macros (this is similar to how the colorspace extension routines work.) This allows big-endian machines to take advantage of the same performance optimizations as little-endian machines, and it retains the performance on little-endian machines, since the conditional branch for endianness is at a very coarse-grained level.
Fix build on OS X PowerPC platforms
Oops. Forgot to alter the version header in the change log to indicate the release of 1.4 beta.
Create 1.4.x branch
At one time, it was possible to use CMake to build under Cygwin, but
that hasn't worked since 1.4.1 (due to the Huffman codec changes that
now require SIZEOF_SIZE_T to be defined for non-WIN32 platforms) and may
have even been broken before that. Originally, we used the "date"
command under MSYS in order to obtain the default build number, but that
was rendered unnecessary by 5e3bb3e9 (v1.3 beta.) 9fe22dac (1.4 beta)
further modified CMakeLists.txt so that the "date" command was only used
on Cygwin, but for unexplained reasons, that commit also applied the
(now vestigial) code to all non-WIN32 platforms. This prevented
CMakeLists.txt from displaying an error if someone attempted to use the
CMake build system on Un*x platforms, and that may have been behind the
flurry of pull requests and issues-- including #21, #29, #37, #58, #73--
complaining that the CMake build system didn't work on Un*x platforms
(although it was not until #73 that this bug came to light.)
This commit removes all vestiges of Un*x support from the CMake build
system and makes it clear that CMake cannot be used to build
libjpeg-turbo on non-WIN32 platforms. It is our position that CMake
will not be supported on non-WIN32 platforms until/unless the autotools
build system is removed, and this will not happen without broad support
from the community (including major O/S vendors.) If you are in favor
of migrating the entire build system to CMake, then please make your
voice heard by commenting on #56.
Even though tjDecompressToYUV2() is mostly just a wrapper for
tjDecompressToYUVPlanes(), tjDecompressToYUV2() still calls
jpeg_read_header(), so it needs to properly set up the libjpeg error
handler prior to making this call. Otherwise, under very esoteric (and
arguably incorrect) use cases, a program could call tjDecompressToYUV2()
without first checking the JPEG header using tjDecompressHeader3(), and
if the header was corrupt, then the libjpeg API would invoke
my_error_exit(). my_error_exit() would in turn call longjmp() on the
previous value of myerr->setjmp_buffer, which was probably set in a
previous TurboJPEG function, such as tjInitDecompress(). Thus, when a
libjpeg error was triggered within the body of tjDecompressToYUV2(), the
PC would jump to the error handler of the previous TurboJPEG function,
and this usually caused stack corruption in the calling program (because
the signature and return type of the previous TurboJPEG function
probably wasn't the same as that of tjDecompressToYUV2().)
Actually, what happened was that the longjmp() call within
my_error_exit() acted on the previous value of myerr->setjmp_buffer,
which was probably set in a previous TurboJPEG function, such as
tjInitDecompress(). Thus, when a libjpeg error was triggered within
the body of tjDecompressToYUV2(), the PC jumped to the error handler
of the previous TurboJPEG function, and this usually caused stack
corruption in the calling program (because the signature and return
type of the previous TurboJPEG function probably wasn't the same.)
Even though tjDecompressToYUV2() is mostly just a wrapper for
tjDecompressToYUVPlanes(), tjDecompressToYUV2() still calls
jpeg_read_header(), so it needs to properly set up the libjpeg error
handler prior to making this call. Otherwise, under very esoteric (and
arguably incorrect) use cases, a program can call tjDecompressToYUV2()
without first checking the JPEG header using tjDecompressHeader3(), and
if the header is corrupt, tjDecompressToYUV2() will abort without
triggering an error.
Fixes#72
<sigh> GitHub doesn't render indented text the same as my local MarkDown
viewer (MacDown), so it's necessary to indent "... OR ..." by 3 spaces
so both will display it on the same indentation level as "Visual C++
2005 or later" and "MinGW".
Indent "... OR ..." to make it clear that the choice is between Visual
C++ and MinGW, not Visual C++ and MinGW + NASM. Move NASM to the top of
the list to make that even more clear. Make it clear that nasm.exe
should be in the PATH.
Addresses concerns raised in #70
This extends the fix in 6709e4a0cf to
include binary PPM/PGM files, thus preventing a malformed binary
PPM/PGM input file from triggering an overrun of the rescale array and
potentially crashing cjpeg.
Note that this issue affected only cjpeg and not the underlying
libjpeg-turbo libraries, and thus it did not represent a security
threat.
Thanks to @hughdavenport for the discovery.
This is a common practice in other infrastructure libraries, such as
OpenSSL and libpng, because it makes it easy to examine an application
binary and determine which version of the library the application was
linked against.
Closes#66
This prevents a malformed motion-JPEG frame (MJPEG frames lack Huffman
tables) from causing the "fast path" of the Huffman decoder to read
uninitialized memory. Essentially, this is doing the same thing for
MJPEG frames as 43d8cf4d45 did for regular
images.
Running 'make -j{jobs}' on a build that was configured with Java
(--with-java) would previously cause an error:
make: *** No rule to make target `TJExample.class', needed by
`turbojpeg.jar'.
It seems that parallel make doesn't understand that the files in
$(JAVA_CLASSES) are all generated from the same invocation of javac, so
it tries to parallelize the building of those files (which of course
doesn't work.) This patch instead makes turbojpeg.jar depend on
classnoinst.stamp. This effectively creates a synchronization fence,
since that file is only created when all of the class files have been
built.
Fixes#62
The x86-64 SIMD accelerations for Huffman encoding used incorrect
stack math to save xmm8-xmm11 on Windows. This caused TJBench to
always report 1 Mpixel/sec for the compression performance, and it
likely would have caused other application issues as well.
The changes relative to 1.4.x are only cosmetic (using const pointers)
and should not affect API/ABI compatibility, but our practice is to
synchronize the API revision with the most recent release that provides
user-visible changes to the API.
This, in combination with the existing jpeg_skip_scanlines() function,
provides the ability to crop the image both horizontally and vertically
while decompressing (certain restrictions apply-- see libjpeg.txt.)
This also cleans up the documentation of the line skipping feature and
removes the "strip decompression" feature from djpeg, since the new
cropping feature is a superset of it.
Refer to #34 for discussion.
Closes#34
Previously, if a custom value of this variable was specified when
running configure, then that value would be lost if configure was
automatically re-run (as a result of changes to configure.ac, for
instance.)
As a bonus, the NASM variable is now also listed when running
'configure --help', so it is obvious how to override the default
NASM command.
The convention used by libjpeg:
type * variable;
is not very common anymore, because it looks too much like
multiplication. Some (particularly C++ programmers) prefer to tuck the
pointer symbol against the type:
type* variable;
to emphasize that a pointer to a type is effectively a new type.
However, this can also be confusing, since defining multiple variables
on the same line would not work properly:
type* variable1, variable2; /* Only variable1 is actually a
pointer. */
This commit reformats the entirety of the libjpeg-turbo code base so
that it uses the same code formatting convention for pointers that the
TurboJPEG API code uses:
type *variable1, *variable2;
This seems to be the most common convention among C programmers, and
it is the convention used by other codec libraries, such as libpng and
libtiff.
Place the authors in the following order:
* libjpeg-turbo authors (2009-) in descending order of the date of their
most recent contribution to the project, then in ascending order of
the date of their first contribution to the project
* Upstream authors in descending order of the date of the first
inclusion of their code (this indicates that their code serves as the
foundation of this code.)
This also adds Siarhei to the author list, since he contributed ARM SIMD
code both as a Nokia employee and more recently as an independent
developer.
We need to garbage collect between iterations of the outside loop in
bufSizeTest() in order to avoid exhausting the heap when running with
Java 6 (which is still used on Linux to test the 32-bit version of
libjpeg-turbo in automated builds.)
Broken by 46ecffa324.
gas-preprocessor.pl and/or the clang assembler apparently don't like
default values in macro arguments, and we need to use a separate const
section for each function (because of our use of adr, also necessitated
by the broken clang assembler.)
... and only if ThunderX is detected. This can be easily expanded later
on to include other CPUs that are known to suffer from slow LD3/ST3, but
it doesn't make sense to disable LD3/ST3 for all non-Android Linux
platforms just because ThunderX is slow.
Full-color compression speedups relative to previous commits:
Cortex-A53 (Nexus 5X), Android, 64-bit: 1.1-13% (avg. 6.0%)
Cortex-A57 (Nexus 5X), Android, 64-bit: 0.0-22% (avg. 6.3%)
Refer to #47 and #50 for discussion
Closes#50
Note that this commit introduces a similar /proc/cpuinfo parser to that
of the ARM32 implementation. It is used to specifically check whether
the code is running on Cavium ThunderX and, if so, disable the ARM64
SIMD Huffman routines (which slow performance by an average of 8% on
that CPU.)
Based on:
a8c282e5e5
Don't include the all: target as a dependency of the tests when
cross-compiling, and ensure that the files generated by the tests are
removed, even if they were created read-only (or if the tests are being
run on a different type of system that doesn't correctly interpret the
file permissions.) This allows one to easily build the code on one
machine and run 'make test' on another.
When cross-compiling, CMakeLists.txt now generates the CTest script
using relative paths, so that CTest can more easily be executed on a
different machine from the build machine. Furthermore, Windows builds
are now tested using md5cmp, just like on Linux, rather than a CMake
script. This prevents issues with differing CMake locations between
the build and test machines.
This also removes some trailing spaces from the md5cmp code and improves
the readability of the test code in CMakeLists.txt.
jinclude.h can't be safely included multiple times, so instead of
including it in the shared (broken-out) headers, it should instead be
included by the source files that include one or more of those headers.
The accelerated Huffman decoder was previously invoked if there were
> 128 bytes in the input buffer. However, it is possible to construct a
JPEG image with Huffman blocks > 430 bytes in length
(http://stackoverflow.com/questions/2734678/jpeg-calculating-max-size).
While such images are pathological and could never be created by a
JPEG compressor, it is conceivable that an attacker could use such an
artifially-constructed image to trigger an input buffer overrun in the
libjpeg-turbo decompressor and thus gain access to some of the data on
the calling program's heap.
This patch simply increases the minimum buffer size for the accelerated
Huffman decoder to 512 bytes, which should (hopefully) accommodate any
possible input.
This addresses a major issue (LJT-01-005) identified in a security audit
by Cure53.
Because of the exposed nature of the libjpeg API, alloc_small() and
alloc_large() can potentially be called by external code. If an
application were to call either of those functions with
sizeofobject > SIZE_MAX - ALIGN_SIZE - 1, then the math in
round_up_pow2() would wrap around to zero, causing that function to
return a small value. That value would likely not exceed
MAX_ALLOC_CHUNK, so the subsequent size checks in alloc_small() and
alloc_large() would not catch the error.
A similar problem could occur in 32-bit builds if alloc_sarray() were
called with
samplesperrow > SIZE_MAX - (2 * ALIGN_SIZE / sizeof(JSAMPLE)) - 1
This patch simply ensures that the size argument to the alloc_*()
functions will never exceed MAX_ALLOC_CHUNK (1 billion). If it did,
then subsequent size checks would eventually catch that error, so we
are instead catching the error before round_up_pow2() is called.
This addresses a minor concern (LJT-01-001) expressed in a security
audit by Cure53.
This addresses a minor concern (LJT-01-002) expressed in a security
audit by Cure53. _tjInitCompress() and _tjInitDecompress() call
(respectively) jpeg_mem_dest_tj() and jpeg_mem_src_tj() with a pointer
to a dummy buffer, in order to set up the destination/source manager.
The dummy buffer should never be used, but it's still better to make it
static so that the pointer in the destination/source manager always
points to a valid region of memory.
Document the latest benchmarks on the Nexus 5X and change the "2-4x"
overall claim to "2-6x". The peak performance on x86 platforms was
already closer to 5x, and the addition of SIMD-accelerated Huffman
encoding gave it that extra push over the cliff.
There aren't really any best practices to follow here. I tried as best
as I could to adopt a standard that would ease any future maintenance
burdens. The basic tenets of that standard are:
* Assembly instructions always start on Column 5, and operands always
start on Column 21, except:
- The instruction and operand can be indented (usually by 2 spaces)
to indicate a separate instruction stream.
- If the instruction is within an enclosing .if block in a macro,
it should always be indented relative to the .if block.
* Comments are placed with an eye toward readability. There are always
at least 2 spaces between the end of a line of code and the associated
in-line comment. Where it made sense, I tried to line up the comments
in blocks, and some were shifted right to avoid overlap with
neighboring instruction lines. Not an exact science.
* Assembler directives and macros use 2-space indenting rules. .if
blocks are indented relative to the macro, and code within the .if
blocks is indented relative to the .if directive.
* No extraneous spaces between operands. Lining up the operands
vertically did not really improve readability-- personally, I think it
made it worse, since my eye would tend to lose its place in the
uniform columns of characters. Also, code with a lot of vertical
alignment is really hard to maintain, since changing one line could
necessitate changing a bunch of other lines to avoid spoiling the
alignment.
* No extraneous spaces in #defines or other directives. In general, the
only extraneous spaces (other than indenting spaces) are between:
- Instructions and operands
- Operands and in-line comments
This standard should be more or less in keeping with other formatting
standards used within the project.
Decompression speedup relative to libjpeg-turbo 1.4.2 (ISLOW IDCT):
48-core ThunderX (RunAbove ARM Cloud), Linux, 64-bit: 60-113% (avg. 86%)
Cortex-A53 (Nexus 5X), Android, 64-bit: 6.8-27% (avg. 14%)
Cortex-A57 (Nexus 5X), Android, 64-bit: 2.0-14% (avg. 6.8%)
Decompression speedup relative to libjpeg-turbo 1.4.2 (IFAST IDCT):
48-core ThunderX (RunAbove ARM Cloud), Linux, 64-bit: 51-98% (avg. 75%)
Minimal speedup (1-5%) observed on iPhone 5S (Cortex-A7)
NOTE: This commit avoids the st3 instruction for non-Android and
non-Apple builds, which may cause a performance regression against
libjpeg-turbo 1.4.x on ARM64 systems that are running plain Linux.
Since ThunderX is the only platform known to suffer from slow ld3 and
st3 instructions, it is probably better to check for the CPU type
at run time and disable ld3/st3 only if ThunderX is detected.
This commit also enables the use of ld3 on Android platforms, which
should be a safe bet, at least for now. This speeds up compression on
the afore-mentioned Nexus Cortex-A53 by 5.5-19% (avg. 12%) and on the
Nexus Cortex-A57 by 1.2-14% (avg. 6.3%), relative to the previous
commits.
This commit also removes unnecessary macros.
Refer to #52 for discussion.
Closes#52.
Based on:
6bad905034488dd7bf174f4d057c1fd3198afc43
* Include information on how to do a 64-bit ARMv8 build with the latest
NDK
* Suggest -fPIE and -pie as default CFLAGS (required for android-16 and
later.
* Remove -fstrict-aliasing flag (-Wall already includes it)
* Include information on how to do a 64-bit ARMv8 build with the latest
NDK
* Suggest -fPIE and -pie as default CFLAGS (required for android-16 and
later.
* Remove -fstrict-aliasing flag (-Wall already includes it)
For whatever reason, the "write" global variable in tjbench.c was
overriding the linkage with the write() system function. This may have
affected other platforms as well but was not known to.
This allows a project to use PKG_CHECK_MODULES() in its configure.ac
file to easily check for the presence of libjpeg-turbo and modify the
compiler/linker flags accordingly. Note that if a project relies solely
on pkg-config to check for libjpeg-turbo, then it will not be possible
to build that project using libjpeg or an earlier version of
libjpeg-turbo.
Closes#53
Based on:
4967138719
Per @ssvb:
ThunderX is an ARM64 chip that dedicates most of its transistor real
estate to providing 48 cores, so each core is not as fast as a result.
Each core is dual-issue & in-order for scalar instructions and has only
a single-issue half-width NEON unit, so the peak throughput is one
128-bit instruction per 2 cycles. So careful instruction scheduling is
important. Furthermore, ThunderX has an extremely slow implementation
of ld2 and ld3, so this commit implements the equivalent of those
instructions using ld1.
Compression speedup relative to libjpeg-turbo 1.4.2:
48-core ThunderX (RunAbove ARM Cloud), Linux, 64-bit: 58-85% (avg. 74%)
relative to jpeg-6b: 1.75-2.14x (avg. 1.95x)
Refer to #49 and #51 for discussion.
Closes#51.
This commit also wordsmiths the ChangeLog entry (the ARMv8 SIMD
implementation is "complete" only for compression-- it still lacks some
decompression algorithms, as does the ARMv7 implementation.)
Based on:
9405b5fd03
which is based on:
f561944ff7962c8ab21f
This adds 64-bit NEON coverage for all of the algorithms that are
covered by the 32-bit NEON implementation, except for h2v1 (4:2:2) fancy
upsampling (used when decompressing 4:2:2 JPEG images.) It also adds
64-bit NEON SIMD coverage for:
* slow integer forward DCT (compressor)
* h2v2 (4:2:0) downsampling (compressor)
* h2v1 (4:2:2) downsampling (compressor)
which are not covered in the 32-bit implementation.
Compression speedups relative to libjpeg-turbo 1.4.2:
Apple A7 (iPhone 5S), iOS, 64-bit: 113-150% (reported)
48-core ThunderX (RunAbove ARM Cloud), Linux, 64-bit: 2.1-33% (avg. 15%)
Refer to #44 and #49 for discussion
This commit also removes the unnecessary
if (simd_support & JSIMD_ARM_NEON)
statements from the jsimd* algorithm functions. Since the jsimd_can*()
functions check for the existence of NEON, the corresponding algorithm
functions will never be called if NEON isn't available.
Based on:
dcd9d84f10b0d87b811f70cd5c8a493e58d9a064837b19542f73dc43ccc8a82b71a261c1b1188c21305c89284e7f443f99954c2b53b77d
Unified version with fixes:
1004a3cd05
Full-color compression speedups relative to libjpeg-turbo 1.4.2:
800 MHz ARM Cortex-A9, iOS, 32-bit: 26-44% (avg. 32%)
Refer to #42 and #47 for discussion.
This commit also removes the unnecessary
if (simd_support & JSIMD_ARM_NEON)
statements from the jsimd* algorithm functions. Since the jsimd_can*()
functions check for the existence of NEON, the corresponding algorithm
functions will never be called if NEON isn't available. Removing those
if statements improved performance across the board by a couple of
percent.
Based on:
fc023c880c
Partially reverts 54014d9c2a. When
building from a git sandbox, as opposed to from an official source
tarball, it is still necessary to run autoreconf.
Closes#48
The Linux build machine has been upgraded to autoconf 2.69, automake
1.15, m4 1.4.17, and libtool 2.4.6, so it is no longer necessary to
recommend running autoreconf prior to building the source, if one is
building from an official source tarball (as opposed to from a git
sandbox.) Also, there is no SVN repository anymore (oops.)
Full-color compression speedups relative to libjpeg-turbo 1.4.2:
2.8 GHz Intel Xeon W3530, Linux, 64-bit: 2.2-18% (avg. 9.5%)
2.8 GHz Intel Xeon W3530, Linux, 32-bit: 10-25% (avg. 17%)
2.3 GHz AMD A10-4600M APU, Linux, 64-bit: 4.9-17% (avg. 11%)
2.3 GHz AMD A10-4600M APU, Linux, 32-bit: 8.8-19% (avg. 15%)
3.0 GHz Intel Core i7, OS X, 64-bit: 3.5-16% (avg. 10%)
3.0 GHz Intel Core i7, OS X, 32-bit: 4.8-14% (avg. 11%)
2.6 GHz AMD Athlon 64 X2 5050e:
Performance-neutral (give or take a few percent)
Full-color compression speedups relative to IPP:
2.8 GHz Intel Xeon W3530, Linux, 64-bit: 4.8-34% (avg. 19%)
2.8 GHz Intel Xeon W3530, Linux, 32-bit: -19%-7.0% (avg. -7.0%)
Refer to #42 for discussion. Numerous other approaches were attempted,
but this one proved to be the most performant across all platforms.
This commit also fixes#3 (works around, really-- the clang-compiled version
of jchuff.c still performs 20% worse than its GCC-compiled counterpart, but
that code is now bypassed by the new SSE2 Huffman algorithm.)
Based on:
2cb4d4133036c94e050d
Traditionally, the x86-64 code did not call init_simd() because it had
no need to (only SSE2 was supported.) However, having the ability to
disable SIMD at run time is a useful testing tool, and all of the other
SIMD implementations have this ability.
Fix a regression introduced in 1.4.1 that prevented 32-bit and 64-bit
libjpeg-turbo RPMs from being installed simultaneously on recent Red
Hat/Fedora distributions. This was due to the addition of the
SIZEOF_SIZE_T macro in jconfig.h, which allows the Huffman codec to
determine the word size at compile time. Since that macro differs
between 32-bit and 64-bit builds, this caused a conflict between the
i386 and x86_64 RPMs (any differing files, other than executables, are
not allowed when 32-bit and 64-bit RPMs are installed simultaneously.)
Since the macro is used only internally, it has been moved into
jconfigint.h.
The unnecessary .arch directive was removed from the ARM64 SIMD code
in d70a5c12fc, thus allowing clang's
integrated assembler to assemble the code on Linux systems. However,
this broke the detection mechanism in acinclude.m4 that tells the build
system whether it needs to use gas-preprocessor.pl. Since one of the
primary motivators for using gas-preprocessor.pl with ARM64 builds is
the lack of .req/.unreq directives in Apple's implementation of clang,
acinclude.m4 now checks whether .req/.unreq can be properly assembled
and uses gas-preprocessor.pl if not.
Closes#33.
Quality values > 95 are not useless. They just may not provide as good
of a size vs. perceptual quality tradeoff as lower quality values. This
also displays the default quality value in the cjpeg usage.
Closes#39
Most of these involved overrunning the signed 32-bit JLONG type whenever
building libjpeg-turbo with a 32-bit compiler. These issues are not
believed to represent actual security threats, but eliminating them
makes it easier to detect such threats should they arise in the future.
These days, INT32 is a commonly-defined datatype in system headers. We
cannot eliminate the definition of that datatype from jmorecfg.h, since
the INT32 typedef has technically been part of the libjpeg API since
version 5 (1994.) However, using INT32 internally is risky, because the
inclusion of a particular header (Xmd.h, for instance) could change the
definition of INT32 from long to int on 64-bit platforms and thus change
the internal behavior of libjpeg-turbo in unexpected ways (for instance,
failing to correctly set __INT32_IS_ACTUALLY_LONG to match the INT32
typedef-- perhaps as a result of including the wrong version of
jpeglib.h-- could cause libjpeg-turbo to produce incorrect results.)
The library has always been built in environments in which INT32 is
effectively long (on Windows, long is always 32-bit, so effectively it's
the same as int), so it makes sense to turn INT32 into an explicitly
long datatype. This ensures that libjpeg-turbo will always behave
consistently, regardless of the headers included at compile time.
Addresses a concern expressed in #26.
The IJG README file has been renamed to README.ijg, in order to avoid
confusion (many people were assuming that that was our project's README
file and weren't reading README-turbo.txt) and to lay the groundwork for
markdown versions of the libjpeg-turbo README and build instructions.
Most of these involved left shifting a negative number, which is
technically undefined (although every modern compiler I'm aware of
will implement this by treating the signed integer as a 2's complement
unsigned integer-- the LEFT_SHIFT() macro just makes this behavior
explicit in order to shut up ubsan.) This also fixes a couple of
non-issues in the entropy codecs, whereby the sanitizer reported an
out-of-bounds index in the 4th argument of jpeg_make_d_derived_tbl().
In those cases, the index was actually out of bounds (caused by a
malformed JPEG image), but jpeg_make_d_derived_tbl() would have caught
the error and aborted prior to actually using the invalid address. Here
again, the fix was to make our intentions explicit so as to shut up
ubsan.
The DSPr2 code was errantly comparing the residual (t9, width & 0xF)
with the end pointer (t4, out + width) instead of the width directly
(a1). This would give the wrong results with any image whose output
width was less than 16. The other small changes (ulw to lw and removal
of the nop) are just some easy optimizations around this code.
This issue caused a buffer overrun and subsequent segfault on images
whose scaled output height was 1 pixel and whose scaled output width was
< 16 pixels. Note that the "plain" (non-fancy and non-merged) upsample
routine, which was affected by this bug, is normally not used except
when decompressing a non-YCbCr JPEG image, but it is also used when
decompressing a single-row image (because the other upsampling
algorithms require at least two rows.)
Closes#16.
(descriptions cribbed by DRC from discussion in #20)
In the x86-64 ABI, the high (unused) DWORD of a 32-bit argument's
register is undefined, so it was incorrect to use a 64-bit mov
instruction to transfer a JDIMENSION argument in the 64-bit SSE2 SIMD
functions. The code worked thus far only because the existing compiler
optimizers weren't smart enough to do anything else with the register in
question, so the upper 32 bits happened to be all zeroes-- for the past
6 years, on every x86-64 compiler previously known to mankind.
The bleeding-edge Clang/LLVM compiler has a smarter optimizer, and
under certain circumstances, it will attempt to load-combine adjacent
32-bit integers from one of the libjpeg structures into a single 64-bit
integer and pass that 64-bit integer as a 32-bit argument to one of the
SIMD functions (which is allowed by the ABI, since the upper 32 bits of
the 32-bit argument's register are undefined.) This caused the
libjpeg-turbo regression tests to crash.
Also enhance the documentation of JDIMENSION to explain that its size
is significant to the implementation of the SIMD code.
Closes#20. Refer also to http://crbug.com/532214.
Previously this information was found in a page on libjpeg-turbo.org,
but there was still some confusion, because README-turbo.txt wasn't
clear as to which license applied to what.
With certain images, compressing using quality=100 and the fast integer
forward DCT will cause the divisor passed to compute_reciprocal() to be
1. In those cases, the library already disables the SIMD quantization
algorithm to avoid 16-bit overflow. However, compute_reciprocal()
doesn't properly handle the divisor==1 case, so we need to use special
values in that case so that the C quantization algorithm will behave
like an identity function.
When compiled with -mfpxx (which is now the default on Debian), there are
some restrictions on the use of odd-numbered FP registers. More details
about FPXX can be found here:
https://dmz-portal.mips.com/wiki/MIPS_O32_ABI_-_FR0_and_FR1_Interlinking
This commit simply changes all uses of FP registers to an even-numbered
equivalent like this:
f0 -> f0
f1 -> f2
f2 -> f4
...
f8 -> f16
This commit should have no observable effect except that the MIPS assembly
will now compile with -mfpxx.
Closes#11
rdbmp.c used the ambiguous INT32 datatype, which is sometimes typedef'ed
to long. Windows bitmap headers use 32-bit signed integers for the
width and height, because height can sometimes be negative (this
indicates a top-down bitmap.) If biWidth or biHeight was negative and
INT32 was a 64-bit long, then biWidth and biHeight were read as a
positive integer > INT32_MAX, which failed the test in line 385:
if (biWidth <= 0 || biHeight <= 0)
ERREXIT(cinfo, JERR_BMP_EMPTY);
This commit refactors rdbmp.c so that it uses the datatypes specified by
Microsoft for the Windows BMP header.
This closes#9 and also provides a better solution for mozilla/mozjpeg#153.
This reassures the caller that the buffers will not be modified and also
allows read-only buffers to be passed to the functions.
Partially reverts 3947a19f25fc8186d3812dbcf8e70baea36ef652.
Declare inbuffer arg in jpeg_mem_src() to be const
This reassures the caller that the buffer will not be modified and also
allows read-only buffers to be passed to the function.
rdbmp.c used the ambiguous INT32 datatype, which is sometimes typedef'ed
to long. Windows bitmap headers use 32-bit signed integers for the
width and height, because height can sometimes be negative (this
indicates a top-down bitmap.) If biWidth or biHeight was negative and
INT32 was a 64-bit long, then biWidth and biHeight were read as a
positive integer > INT32_MAX, which failed the test in line 385:
if (biWidth <= 0 || biHeight <= 0)
ERREXIT(cinfo, JERR_BMP_EMPTY);
This commit refactors rdbmp.c so that it uses the datatypes specified by
Microsoft for the Windows BMP header.
This closes#9 and also provides a better solution for mozilla/mozjpeg#153.
NASM 2.11.08 has a bug that prevents it from properly assembling a
macho64 version of libjpeg-turbo (the resulting binary generates corrupt
images.) 2.11.09 works properly. YASM also works properly and has been
a supported alternative since libjpeg-turbo 1.2.
NASM 2.11.08 has a bug that prevents it from properly assembling a
macho64 version of libjpeg-turbo (the resulting binary generates corrupt
images.) 2.11.09 works properly. YASM also works properly and has been
a supported alternative since libjpeg-turbo 1.2.
NASM 2.11.08 has a bug that prevents it from properly assembling a
macho64 version of libjpeg-turbo (the resulting binary generates corrupt
images.) 2.11.09 works properly. YASM also works properly and has been
a supported alternative since libjpeg-turbo 1.2.
NASM 2.11.08 has a bug that prevents it from properly assembling a
macho64 version of libjpeg-turbo (the resulting binary generates corrupt
images.) 2.11.09 works properly. YASM also works properly and has been
a supported alternative since libjpeg-turbo 1.2.
Under very rare circumstances, decompressing specific corrupt JPEG
images would create a situation whereby GET_BITS(1) was invoked
from within HUFF_DECODE_FAST() when bits_left=0. This produced a right
shift by a negative number of bits, which is undefined in C.
Under very rare circumstances, decompressing specific corrupt JPEG
images would create a situation whereby GET_BITS(1) was invoked
from within HUFF_DECODE_FAST() when bits_left=0. This produced a right
shift by a negative number of bits, which is undefined in C.
Under very rare circumstances, decompressing specific corrupt JPEG
images would create a situation whereby GET_BITS(1) was invoked
from within HUFF_DECODE_FAST() when bits_left=0. This produced a right
shift by a negative number of bits, which is undefined in C.
When using context-based upsampling, use a dummy color conversion
routine instead of a dummy row buffer. This improves performance
(since the actual color conversion routine no longer has to be called),
and it also fixes valgrind errors when decompressing to RGB565.
Valgrind previously complained, because using the RGB565 color
converter with the dummy row buffer was causing a table lookup with
undefined indices.
Under very rare circumstances, decompressing specific corrupt JPEG
images would create a situation whereby GET_BITS(1) was invoked
from within HUFF_DECODE_FAST() when bits_left=0. This produced a right
shift by a negative number of bits, which is undefined in C.
Use a new checked exception type (TJException) when passing through
errors from the underlying C library. This gives the application a
choice of catching all exceptions or just those from TurboJPEG.
Throw IllegalArgumentException at the JNI level when arguments to the
JNI function are incorrect, and when one of the TurboJPEG "utility"
functions returns an error (because, per the C API specification, those
functions will only return an error if one of their arguments is out of
range.)
Remove "throws Exception" from the signature of any methods that no
longer pass through an error from the TurboJPEG C library.
Credit Viktor for the new code
Code formatting tweaks
Change the behavior of the bailif0() macro in the JNI wrapper so that it doesn't throw an exception for an unexpected NULL condition. In fact, in all cases, the underlying JNI API function (such as GetFieldID(), etc.) will throw an Error on its own whenever it returns NULL, so our custom exceptions were never being thrown in that case anyhow. All we need to do is just detect the error and bail out of the C code.
This also corrects a couple of formatting issues (semicolons aren't needed at the end of class definitions, and @Override should be specified for the methods we're overriding from super-classes, so the compiler can sanity-check that we're actually overriding a method and not declaring a new one.)
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1595 632fc199-4ca6-4c93-a231-07263d6284db
#166 describes an issue where I/O suspension is not properly handled in
scan optimization. Supporting I/O suspension may be difficult to
achieve here, thus return an error to make it explicit that I/O
suspension is unsupported.
Add command line option -quant-baseline to cjpeg to force quantization
table entries to be in 1-255 range for JPEG baseline compatibility. See
related discussion in #145
* libjpeg-turbo: (39 commits)
Oops. Delete the duplicate copy of [lib]turbojpeg.dll in the binary directory when uninstalling the package.
AltiVec SIMD implementation of sample conversion and integer quantization
Document the fact that the AltiVec implementation uses the same modified algorithms as the SSE2 implementation
Use intrinsics for loading/storing data in the DCT/IDCT functions. This has no effect on the performance of the aligned loads/stores, but it makes it more obvious what that code is doing. Using intrinsics for the unaligned stores in the inverse DCT functions increases overall decompression performance by 1-2%.
AltiVec SIMD implementation of RGB-to-Grayscale color conversion
Remove unneeded code; Make sure jccolor-altivec.o will be rebuilt if jccolext-altivec.c changes.
AltiVec SIMD implementation of RGB-to-YCC color conversion
Make test a phony target so things don't go haywire if there is a file named test.c in the current directory.
Maintain the traditional order of the regression tests while allowing the TurboJPEG and libjpeg portions to be executed separately
Make comments more consistent
Add a "quicktest" pseudo-target, for those times when you just don't want to sit through 11 iterations of TJUnitTest.
Cosmetic tweaks to the PowerPC SIMD stubs
Split AltiVec algorithms into separate files for ease of maintenance; Rename constants using lowercase so they are not confused with macros
Optimizations to the AltiVec DCT algorithms (pre-compute constants and combine multiply/add operations)
AltiVec SIMD implementation of slow integer inverse DCT
Use macros to allocate constants statically, rather than reading them from a table using vec_splat*(). This improves code readability and probably improves performance a bit as well.
Swap the order of the IFAST and ISLOW FDCT functions so that it matches the order of the prototypes in jsimd.h and the stubs in jsimd_powerpc.c.
Include ARMv8 binaries when generating a combined OS X/iOS package using 'make iosdmg'
In the output of the configure script, indicate whether gas-preprocessor.pl is being used along with the assembler.
Modify the ARM64 assembly file so that it uses only syntax that the clang assembler in XCode 5.x can understand. These changes should all be cosmetic in nature-- they do not change the meaning or readability of the code nor the ability to build it for Linux. Actually, the code is now more in compliance with the ARM64 programming manual. In addition to these changes, there were a couple of instructions that clang simply doesn't support, so gas-preprocessor.pl was modified so that it now converts those into equivalent instructions that clang can handle.
...
Conflicts:
BUILDING.txt
ChangeLog.txt
cjpeg.c
jpegtran.c
-- Use macros to represent the fast FDCT constants, to facilitate comparing the AltiVec implementation of the algorithm with the SSE2 implementation.
-- Rename slow FDCT constants for consistency.
-- Use vec_sra() in all cases in the slow FDCT code. The SSE2 implementation uses psraw, which is an arithmetic shift, so we need to do likewise with AltiVec. Using vec_sr() hasn't caused any problems yet, but it is conceivable that it might cause different behavior in certain corner cases.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1444 632fc199-4ca6-4c93-a231-07263d6284db
-- Use macros to represent the fast FDCT constants, to facilitate comparing the AltiVec implementation of the algorithm with the SSE2 implementation.
-- Rename slow FDCT constants for consistency.
-- Use vec_sra() in all cases in the slow FDCT code. The SSE2 implementation uses psraw, which is an arithmetic shift, so we need to do likewise with AltiVec. Using vec_sr() hasn't caused any problems yet, but it is conceivable that it might cause different behavior in certain corner cases.
git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1444 632fc199-4ca6-4c93-a231-07263d6284db
This patch also removes an unneeded macro from jdmerge.c.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.4.x@1403 632fc199-4ca6-4c93-a231-07263d6284db
This patch also removes an unneeded macro from jdmerge.c.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.4.x@1403 632fc199-4ca6-4c93-a231-07263d6284db
This patch also removes an unneeded macro from jdmerge.c.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1402 632fc199-4ca6-4c93-a231-07263d6284db
-----
aee36252be.patch
From aee36252be20054afce371a92406fc66ba6627b5 Mon Sep 17 00:00:00 2001
From: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Date: Wed, 13 Aug 2014 03:50:22 +0300
Subject: [PATCH] ARM: Faster NEON yuv->rgb conversion for Krait and Cortex-A15
The older code was developed and tested only on ARM Cortex-A8 and ARM Cortex-A9.
Tuning it for newer ARM processors can introduce some speed-up (up to 20%).
The performance of the inner loop (conversion of 8 pixels) improves from
~27 cycles down to ~22 cycles on Qualcomm Krait 300, and from ~20 cycles
down to ~18 cycles on ARM Cortex-A15.
The performance remains exactly the same on ARM Cortex-A7 (~58 cycles),
ARM Cortex-A8 (~25 cycles) and ARM Cortex-A9 (~30 cycles) processors.
Also use larger indentation in the source code for separating two independent
instruction streams.
-----
a5efdbf22c.patch
From a5efdbf22ce9c1acd4b14a353cec863c2c57557e Mon Sep 17 00:00:00 2001
From: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Date: Wed, 13 Aug 2014 07:23:09 +0300
Subject: [PATCH] ARM: NEON optimized yuv->rgb565 conversion
The performance of the inner loop (conversion of 8 pixels):
* ARM Cortex-A7: ~55 cycles
* ARM Cortex-A8: ~28 cycles
* ARM Cortex-A9: ~32 cycles
* ARM Cortex-A15: ~20 cycles
* Qualcomm Krait: ~24 cycles
Based on the Linaro rgb565 patch from
https://sourceforge.net/p/libjpeg-turbo/patches/24/
but implements better instructions scheduling.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1385 632fc199-4ca6-4c93-a231-07263d6284db
-----
aee36252be.patch
From aee36252be20054afce371a92406fc66ba6627b5 Mon Sep 17 00:00:00 2001
From: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Date: Wed, 13 Aug 2014 03:50:22 +0300
Subject: [PATCH] ARM: Faster NEON yuv->rgb conversion for Krait and Cortex-A15
The older code was developed and tested only on ARM Cortex-A8 and ARM Cortex-A9.
Tuning it for newer ARM processors can introduce some speed-up (up to 20%).
The performance of the inner loop (conversion of 8 pixels) improves from
~27 cycles down to ~22 cycles on Qualcomm Krait 300, and from ~20 cycles
down to ~18 cycles on ARM Cortex-A15.
The performance remains exactly the same on ARM Cortex-A7 (~58 cycles),
ARM Cortex-A8 (~25 cycles) and ARM Cortex-A9 (~30 cycles) processors.
Also use larger indentation in the source code for separating two independent
instruction streams.
-----
a5efdbf22c.patch
From a5efdbf22ce9c1acd4b14a353cec863c2c57557e Mon Sep 17 00:00:00 2001
From: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Date: Wed, 13 Aug 2014 07:23:09 +0300
Subject: [PATCH] ARM: NEON optimized yuv->rgb565 conversion
The performance of the inner loop (conversion of 8 pixels):
* ARM Cortex-A7: ~55 cycles
* ARM Cortex-A8: ~28 cycles
* ARM Cortex-A9: ~32 cycles
* ARM Cortex-A15: ~20 cycles
* Qualcomm Krait: ~24 cycles
Based on the Linaro rgb565 patch from
https://sourceforge.net/p/libjpeg-turbo/patches/24/
but implements better instructions scheduling.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1385 632fc199-4ca6-4c93-a231-07263d6284db
We can't simply increase JMSG_LENGTH_MAX, because it is part of the libjpeg API, and it is generally assumed that a buffer of this length will be passed to format_message(). Thus, the easiest solution is simply to use a shorter copyright string for JMSG_COPYRIGHT.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.2.x@1320 632fc199-4ca6-4c93-a231-07263d6284db
We can't simply increase JMSG_LENGTH_MAX, because it is part of the libjpeg API, and it is generally assumed that a buffer of this length will be passed to format_message(). Thus, the easiest solution is simply to use a shorter copyright string for JMSG_COPYRIGHT.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.3.x@1319 632fc199-4ca6-4c93-a231-07263d6284db
We can't simply increase JMSG_LENGTH_MAX, because it is part of the libjpeg API, and it is generally assumed that a buffer of this length will be passed to format_message(). Thus, the easiest solution is simply to use a shorter copyright string for JMSG_COPYRIGHT.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.3.x@1319 632fc199-4ca6-4c93-a231-07263d6284db
We can't simply increase JMSG_LENGTH_MAX, because it is part of the libjpeg API, and it is generally assumed that a buffer of this length will be passed to format_message(). Thus, the easiest solution is simply to use a shorter copyright string for JMSG_COPYRIGHT.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1318 632fc199-4ca6-4c93-a231-07263d6284db
We can't simply increase JMSG_LENGTH_MAX, because it is part of the libjpeg API, and it is generally assumed that a buffer of this length will be passed to format_message(). Thus, the easiest solution is simply to use a shorter copyright string for JMSG_COPYRIGHT.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1318 632fc199-4ca6-4c93-a231-07263d6284db
-- Auto-generates HAVE_LOCALE_H macro and adds it to jconfig.h (this is used by rdjpgcom.c.)
-- Reconciles the description and ordering of macros between config.h.in and jconfig.h.in, so the two files can be easily diffed.
-- Eliminates the use of the autoheader-generated config.h in the project and moves relevant internal-only macros into a new file, jconfigint.h. This is to avoid "already defined" warnings in files that were including both config.h (to get the internal autotools package information or the INLINE definition) and jconfig.h.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.3.x@1258 632fc199-4ca6-4c93-a231-07263d6284db
-- Auto-generates HAVE_LOCALE_H macro and adds it to jconfig.h (this is used by rdjpgcom.c.)
-- Reconciles the description and ordering of macros between config.h.in and jconfig.h.in, so the two files can be easily diffed.
-- Eliminates the use of the autoheader-generated config.h in the project and moves relevant internal-only macros into a new file, jconfigint.h. This is to avoid "already defined" warnings in files that were including both config.h (to get the internal autotools package information or the INLINE definition) and jconfig.h.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.3.x@1258 632fc199-4ca6-4c93-a231-07263d6284db
-- Auto-generates HAVE_LOCALE_H macro and adds it to jconfig.h (this is used by rdjpgcom.c.)
-- Reconciles the description and ordering of macros between config.h.in and jconfig.h.in, so the two files can be easily diffed.
-- Eliminates the use of the autoheader-generated config.h in the project and moves relevant internal-only macros into a new file, jconfigint.h. This is to avoid "already defined" warnings in files that were including both config.h (to get the internal autotools package information or the INLINE definition) and jconfig.h.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1257 632fc199-4ca6-4c93-a231-07263d6284db
-- Auto-generates HAVE_LOCALE_H macro and adds it to jconfig.h (this is used by rdjpgcom.c.)
-- Reconciles the description and ordering of macros between config.h.in and jconfig.h.in, so the two files can be easily diffed.
-- Eliminates the use of the autoheader-generated config.h in the project and moves relevant internal-only macros into a new file, jconfigint.h. This is to avoid "already defined" warnings in files that were including both config.h (to get the internal autotools package information or the INLINE definition) and jconfig.h.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1257 632fc199-4ca6-4c93-a231-07263d6284db
delta = cur0 * 2;
cur0 += delta; /* form error * 3 */
errorptr[0] = (FSERROR) (bpreverr0 + cur0);
cur0 += delta; /* form error * 5 */
bpreverr0 = belowerr0 + cur0;
cur0 += delta; /* form error * 7 */
Each time cur0 is incremented by delta, the compiled code doubles the value of delta (WTF?!) Thus, by the time the end of the block is reached, cur0 is equal to 15 times its former self, not 7 times its former self as it should be. At any rate, it was a lot simpler to just refactor the code so that it uses multiplication.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.2.x@1255 632fc199-4ca6-4c93-a231-07263d6284db
delta = cur0 * 2;
cur0 += delta; /* form error * 3 */
errorptr[0] = (FSERROR) (bpreverr0 + cur0);
cur0 += delta; /* form error * 5 */
bpreverr0 = belowerr0 + cur0;
cur0 += delta; /* form error * 7 */
Each time cur0 is incremented by delta, the compiled code doubles the value of delta (WTF?!) Thus, by the time the end of the block is reached, cur0 is equal to 15 times its former self, not 7 times its former self as it should be. At any rate, it was a lot simpler to just refactor the code so that it uses multiplication.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.3.x@1253 632fc199-4ca6-4c93-a231-07263d6284db
delta = cur0 * 2;
cur0 += delta; /* form error * 3 */
errorptr[0] = (FSERROR) (bpreverr0 + cur0);
cur0 += delta; /* form error * 5 */
bpreverr0 = belowerr0 + cur0;
cur0 += delta; /* form error * 7 */
Each time cur0 is incremented by delta, the compiled code doubles the value of delta (WTF?!) Thus, by the time the end of the block is reached, cur0 is equal to 15 times its former self, not 7 times its former self as it should be. At any rate, it was a lot simpler to just refactor the code so that it uses multiplication.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.3.x@1253 632fc199-4ca6-4c93-a231-07263d6284db
delta = cur0 * 2;
cur0 += delta; /* form error * 3 */
errorptr[0] = (FSERROR) (bpreverr0 + cur0);
cur0 += delta; /* form error * 5 */
bpreverr0 = belowerr0 + cur0;
cur0 += delta; /* form error * 7 */
Each time cur0 is incremented by delta, the compiled code doubles the value of delta (WTF?!) Thus, by the time the end of the block is reached, cur0 is equal to 15 times its former self, not 7 times its former self as it should be. At any rate, it was a lot simpler to just refactor the code so that it uses multiplication.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1251 632fc199-4ca6-4c93-a231-07263d6284db
delta = cur0 * 2;
cur0 += delta; /* form error * 3 */
errorptr[0] = (FSERROR) (bpreverr0 + cur0);
cur0 += delta; /* form error * 5 */
bpreverr0 = belowerr0 + cur0;
cur0 += delta; /* form error * 7 */
Each time cur0 is incremented by delta, the compiled code doubles the value of delta (WTF?!) Thus, by the time the end of the block is reached, cur0 is equal to 15 times its former self, not 7 times its former self as it should be. At any rate, it was a lot simpler to just refactor the code so that it uses multiplication.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1251 632fc199-4ca6-4c93-a231-07263d6284db
-- The Mac and Cygwin packages will now be created with the directory structure defined by the configure variables "prefix", "bindir", "libdir", etc., with the exception that the docs are always installed under /usr/share/doc/{package_name}-{version} on Cygwin and /Library/Documentation/{package_name} on Mac.
-- Fixed a duplicate filename warning when generating RPMs with the default prefix of /opt/libjpeg-turbo.
-- Moved the TurboJPEG libraries out of the system directory on Windows and Mac. It is no longer necessary to put them there, since we are not trying to be backward compatible with TurboJPEG/IPP anymore.
-- Fixed an issue whereby building the "installer" target on Windows would not build the Java JAR file, thus causing an error if the JAR had not been previously built.
-- Building the "install" target on Windows will now install libjpeg-turbo into c:\libjpeg-turbo[-gcc][64] (the same directories used by the installers.) This can be overridden by setting CMAKE_INSTALL_PREFIX.
-- The Java classes on all platforms will now look for the JNI library in the directory under which the build/packaging system installs it.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@946 632fc199-4ca6-4c93-a231-07263d6284db
-- The Mac and Cygwin packages will now be created with the directory structure defined by the configure variables "prefix", "bindir", "libdir", etc., with the exception that the docs are always installed under /usr/share/doc/{package_name}-{version} on Cygwin and /Library/Documentation/{package_name} on Mac.
-- Fixed a duplicate filename warning when generating RPMs with the default prefix of /opt/libjpeg-turbo.
-- Moved the TurboJPEG libraries out of the system directory on Windows and Mac. It is no longer necessary to put them there, since we are not trying to be backward compatible with TurboJPEG/IPP anymore.
-- Fixed an issue whereby building the "installer" target on Windows would not build the Java JAR file, thus causing an error if the JAR had not been previously built.
-- Building the "install" target on Windows will now install libjpeg-turbo into c:\libjpeg-turbo[-gcc][64] (the same directories used by the installers.) This can be overridden by setting CMAKE_INSTALL_PREFIX.
-- The Java classes on all platforms will now look for the JNI library in the directory under which the build/packaging system installs it.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@946 632fc199-4ca6-4c93-a231-07263d6284db
If the default prefix (/opt/libjpeg-turbo) is used, then we now always install 32-bit libraries in /opt/libjpeg-turbo/lib32 and 64-bit libraries in /opt/libjpeg-turbo/lib64 instead of trying to conform to the Debian or Red Hat conventions. The RPM and DEB packages will now be created with the directory structure defined by the configure variables "prefix", "bindir", "libdir", etc., with the exception that the docs are always installed under /usr/share/doc/{package_name}-{version}.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@944 632fc199-4ca6-4c93-a231-07263d6284db
If the default prefix (/opt/libjpeg-turbo) is used, then we now always install 32-bit libraries in /opt/libjpeg-turbo/lib32 and 64-bit libraries in /opt/libjpeg-turbo/lib64 instead of trying to conform to the Debian or Red Hat conventions. The RPM and DEB packages will now be created with the directory structure defined by the configure variables "prefix", "bindir", "libdir", etc., with the exception that the docs are always installed under /usr/share/doc/{package_name}-{version}.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@944 632fc199-4ca6-4c93-a231-07263d6284db
build to fail when using the Visual Studio IDE.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@554 632fc199-4ca6-4c93-a231-07263d6284db
be used instead of 4:2:2 when decompressing JPEG images using SSE2 code
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@223 632fc199-4ca6-4c93-a231-07263d6284db
* Use jsimd_i386.c instead of the attic jsimd.c
* Corrected include of jsimd.h in jsimd_i386.c.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@59 632fc199-4ca6-4c93-a231-07263d6284db
Use RIP relative addressing as that works in both PIC and non-PIC mode.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@51 632fc199-4ca6-4c93-a231-07263d6284db
The SIMD glue code has gotten a bit #ifdef heavy so clean it up by having
one file for each possible SIMD arch. This also allows a simplification of
the x86_64 code as SSE/SSE2 is always known to exist on that arch.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@49 632fc199-4ca6-4c93-a231-07263d6284db
Older versions of automake doesn't properly support no-recursive make.
Reimplement the build system by having a local Makefile.am in the
simd/ directory.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@31 632fc199-4ca6-4c93-a231-07263d6284db
We use the heap allocators to avoid having more than one implementation
of the alignment logic.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@19 632fc199-4ca6-4c93-a231-07263d6284db
This has no measurable difference right now but makes it possible to do
SIMD implementations of this stage.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@16 632fc199-4ca6-4c93-a231-07263d6284db
Add NASM support and stub routine for detecting SIMD extensions.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@15 632fc199-4ca6-4c93-a231-07263d6284db
Designed to impose minimal changes on the "normal" code.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@14 632fc199-4ca6-4c93-a231-07263d6284db
Divide it into sample conversion, DCT and quantization in order to
easily provide alternative implementations of each stage.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@13 632fc199-4ca6-4c93-a231-07263d6284db
Fix some broken assumptions and allow any alignment, not just those
associated with C types.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@12 632fc199-4ca6-4c93-a231-07263d6284db
Studio build. A static jconfig.h has been re-added, but in a separate
directory, to avoid clash with jconfig.h generated by configure
script. Also, jconfig.h now includes the inline macro. jpeg.dsp has
been modified to search in the "win" subdir, to find jconfig.h.
This patch is in spirit similar to r121.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@5 632fc199-4ca6-4c93-a231-07263d6284db
"Link all libjpeg-turbo libraries and executables with the C run-time DLL (msvcr*.dll) instead of the static C run-time library (libcmt*.lib.) The default is to use the C run-time DLL only with the libraries and executables that need it."
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 mozjpeg Project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS", AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This project's goal is to reduce the size of JPEG files without reducing quality or compatibility with the vast majority of the world's deployed decoders.
MozJPEG reduces file sizes of JPEG images while retaining quality and compatibility with the vast majority of the world's deployed decoders.
The idea is to reduce transfer times for JPEGs on the Web, thus reducing page load times.
MozJPEG is based on [libjpeg-turbo](https://github.com/libjpeg-turbo/libjpeg-turbo). It's compatible with libjpeg API and ABI, and can be used as a drop-in replacement for libjpeg. MozJPEG makes tradeoffs that are intended to benefit Web use cases and focuses solely on improving encoding, so it's best used as part of a Web encoding workflow.
'mozjpeg' is not intended to be a general JPEG library replacement. It makes tradeoffs that are intended to benefit Web use cases and focuses solely on improving encoding. It is best used as part of a Web encoding workflow. For a general JPEG library (e.g. your system libjpeg), especially if you care about decoding, we recommend libjpeg-turbo.
MozJPEG is meant to be used as a library in graphics programs and image processing tools. We include a demo `cjpeg` tool, but it's not intended for serious use. We encourage authors of graphics programs to use MozJPEG's [C API](libjpeg.txt) instead.
<trclass="memdesc:ga0f6dbd18adf38b7d46ac547f0f4d562c"><tdclass="mdescLeft"> </td><tdclass="mdescRight">The number of transform operations. <ahref="#ga0f6dbd18adf38b7d46ac547f0f4d562c">More...</a><br/></td></tr>
<trclass="memdesc:ga50e03cb5ed115330e212417429600b00"><tdclass="mdescLeft"> </td><tdclass="mdescRight">This option will cause <aclass="el"href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> to return an error if the transform is not perfect. <ahref="#ga50e03cb5ed115330e212417429600b00">More...</a><br/></td></tr>
<trclass="memdesc:ga50e03cb5ed115330e212417429600b00"><tdclass="mdescLeft"> </td><tdclass="mdescRight">This option will cause <aclass="el"href="group___turbo_j_p_e_g.html#gad02cd42b69f193a0623a9c801788df3a"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> to return an error if the transform is not perfect. <ahref="#ga50e03cb5ed115330e212417429600b00">More...</a><br/></td></tr>
<trclass="memdesc:ga319826b7eb1583c0595bbe7b95428709"><tdclass="mdescLeft"> </td><tdclass="mdescRight">This option will cause <aclass="el"href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> to discard any partial MCU blocks that cannot be transformed. <ahref="#ga319826b7eb1583c0595bbe7b95428709">More...</a><br/></td></tr>
<trclass="memdesc:ga319826b7eb1583c0595bbe7b95428709"><tdclass="mdescLeft"> </td><tdclass="mdescRight">This option will cause <aclass="el"href="group___turbo_j_p_e_g.html#gad02cd42b69f193a0623a9c801788df3a"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> to discard any partial MCU blocks that cannot be transformed. <ahref="#ga319826b7eb1583c0595bbe7b95428709">More...</a><br/></td></tr>
<trclass="memdesc:ga9c771a757fc1294add611906b89ab2d2"><tdclass="mdescLeft"> </td><tdclass="mdescRight">This option will enable lossless cropping. <ahref="#ga9c771a757fc1294add611906b89ab2d2">More...</a><br/></td></tr>
@@ -144,7 +144,7 @@ Macros</h2></td></tr>
<trclass="memdesc:ga3acee7b48ade1b99e5588736007c2589"><tdclass="mdescLeft"> </td><tdclass="mdescRight">This option will discard the color data in the input image and produce a grayscale output image. <ahref="#ga3acee7b48ade1b99e5588736007c2589">More...</a><br/></td></tr>
<trclass="memdesc:gafbf992bbf6e006705886333703ffab31"><tdclass="mdescLeft"> </td><tdclass="mdescRight">This option will prevent <aclass="el"href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616"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.) <ahref="#gafbf992bbf6e006705886333703ffab31">More...</a><br/></td></tr>
<trclass="memdesc:gafbf992bbf6e006705886333703ffab31"><tdclass="mdescLeft"> </td><tdclass="mdescRight">This option will prevent <aclass="el"href="group___turbo_j_p_e_g.html#gad02cd42b69f193a0623a9c801788df3a"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.) <ahref="#gafbf992bbf6e006705886333703ffab31">More...</a><br/></td></tr>
<trclass="memdesc:ga0aba955473315e405295d978f0c16511"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Pad the given width to the nearest 32-bit boundary. <ahref="#ga0aba955473315e405295d978f0c16511">More...</a><br/></td></tr>
<trclass="memdesc:ga2de531af4e7e6c4f124908376b354866"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Transform operations for <aclass="el"href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a><ahref="group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866">More...</a><br/></td></tr>
<trclass="memdesc:ga2de531af4e7e6c4f124908376b354866"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Transform operations for <aclass="el"href="group___turbo_j_p_e_g.html#gad02cd42b69f193a0623a9c801788df3a"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a><ahref="group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866">More...</a><br/></td></tr>
<trclass="memitem:gaba62b7a98f960839b588579898495cf2"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int DLLCALL </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#gaba62b7a98f960839b588579898495cf2">tjCompress2</a> (<aclass="el"href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, 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>
<trclass="memdesc:gaba62b7a98f960839b588579898495cf2"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Compress an RGB, grayscale, or CMYK image into a JPEG image. <ahref="#gaba62b7a98f960839b588579898495cf2">More...</a><br/></td></tr>
<trclass="memitem:ga0b931126c7a615ddc3bbd0cca6698d67"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int DLLCALL </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga0b931126c7a615ddc3bbd0cca6698d67">tjCompressFromYUV</a> (<aclass="el"href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *srcBuf, int width, int pad, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags)</td></tr>
<trclass="memdesc:ga0b931126c7a615ddc3bbd0cca6698d67"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Compress a YUV planar image into a JPEG image. <ahref="#ga0b931126c7a615ddc3bbd0cca6698d67">More...</a><br/></td></tr>
<trclass="memitem:gaa89a1982cb4556b12ae7af4439991af6"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int DLLCALL </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#gaa89a1982cb4556b12ae7af4439991af6">tjCompressFromYUVPlanes</a> (<aclass="el"href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char **srcPlanes, int width, int *strides, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags)</td></tr>
<trclass="memdesc:gaa89a1982cb4556b12ae7af4439991af6"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Compress a set of Y, U (Cb), and V (Cr) image planes into a JPEG image. <ahref="#gaa89a1982cb4556b12ae7af4439991af6">More...</a><br/></td></tr>
<trclass="memitem:gaf38f2ed44bdc88e730e08b632fa6e88e"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int DLLCALL </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#gaf38f2ed44bdc88e730e08b632fa6e88e">tjCompress2</a> (<aclass="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>
<trclass="memdesc:gaf38f2ed44bdc88e730e08b632fa6e88e"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Compress an RGB, grayscale, or CMYK image into a JPEG image. <ahref="#gaf38f2ed44bdc88e730e08b632fa6e88e">More...</a><br/></td></tr>
<trclass="memitem:ga6f6de375d6ec0020faba627e37e5a060"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int DLLCALL </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga6f6de375d6ec0020faba627e37e5a060">tjCompressFromYUV</a> (<aclass="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>
<trclass="memdesc:ga6f6de375d6ec0020faba627e37e5a060"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Compress a YUV planar image into a JPEG image. <ahref="#ga6f6de375d6ec0020faba627e37e5a060">More...</a><br/></td></tr>
<trclass="memitem:ga0b84c682d8accf097d7a743c965d3464"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int DLLCALL </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga0b84c682d8accf097d7a743c965d3464">tjCompressFromYUVPlanes</a> (<aclass="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>
<trclass="memdesc:ga0b84c682d8accf097d7a743c965d3464"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Compress a set of Y, U (Cb), and V (Cr) image planes into a JPEG image. <ahref="#ga0b84c682d8accf097d7a743c965d3464">More...</a><br/></td></tr>
<trclass="memitem:gaccc5bca7f12fcdcc302e6e1c6d4b311b"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT unsigned long DLLCALL </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b">tjBufSize</a> (int width, int height, int jpegSubsamp)</td></tr>
<trclass="memdesc:gaccc5bca7f12fcdcc302e6e1c6d4b311b"><tdclass="mdescLeft"> </td><tdclass="mdescRight">The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters. <ahref="#gaccc5bca7f12fcdcc302e6e1c6d4b311b">More...</a><br/></td></tr>
<trclass="memitem:ga1a209696c6a80748f20e134b3c64789f"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga1a209696c6a80748f20e134b3c64789f">tjPlaneHeight</a> (int componentID, int height, int subsamp)</td></tr>
<trclass="memdesc:ga1a209696c6a80748f20e134b3c64789f"><tdclass="mdescLeft"> </td><tdclass="mdescRight">The plane height of a YUV image plane with the given parameters. <ahref="#ga1a209696c6a80748f20e134b3c64789f">More...</a><br/></td></tr>
<trclass="memitem:ga0a5ffbf7cb58a5b6a8201114fe889360"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int DLLCALL </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga0a5ffbf7cb58a5b6a8201114fe889360">tjEncodeYUV3</a> (<aclass="el"href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char *dstBuf, int pad, int subsamp, int flags)</td></tr>
<trclass="memdesc:ga0a5ffbf7cb58a5b6a8201114fe889360"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Encode an RGB or grayscale image into a YUV planar image. <ahref="#ga0a5ffbf7cb58a5b6a8201114fe889360">More...</a><br/></td></tr>
<trclass="memitem:gaa791db8598853ddcad24e42897ef1269"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int DLLCALL </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#gaa791db8598853ddcad24e42897ef1269">tjEncodeYUVPlanes</a> (<aclass="el"href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char **dstPlanes, int *strides, int subsamp, int flags)</td></tr>
<trclass="memdesc:gaa791db8598853ddcad24e42897ef1269"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Encode an RGB or grayscale image into separate Y, U (Cb), and V (Cr) image planes. <ahref="#gaa791db8598853ddcad24e42897ef1269">More...</a><br/></td></tr>
<trclass="memitem:gaabe05acd734990053ad1294b5ef239aa"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int DLLCALL </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#gaabe05acd734990053ad1294b5ef239aa">tjEncodeYUV3</a> (<aclass="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>
<trclass="memdesc:gaabe05acd734990053ad1294b5ef239aa"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Encode an RGB or grayscale image into a YUV planar image. <ahref="#gaabe05acd734990053ad1294b5ef239aa">More...</a><br/></td></tr>
<trclass="memitem:ga8a65ed3bd12df57c219d46afbc9008f1"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int DLLCALL </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga8a65ed3bd12df57c219d46afbc9008f1">tjEncodeYUVPlanes</a> (<aclass="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>
<trclass="memdesc:ga8a65ed3bd12df57c219d46afbc9008f1"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Encode an RGB or grayscale image into separate Y, U (Cb), and V (Cr) image planes. <ahref="#ga8a65ed3bd12df57c219d46afbc9008f1">More...</a><br/></td></tr>
<trclass="memitem:gacd0fac3af74b3511d39b4781b7103086"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int DLLCALL </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#gacd0fac3af74b3511d39b4781b7103086">tjDecompressHeader3</a> (<aclass="el"href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *jpegBuf, unsigned long jpegSize, int *width, int *height, int *jpegSubsamp, int *jpegColorspace)</td></tr>
<trclass="memdesc:gacd0fac3af74b3511d39b4781b7103086"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Retrieve information about a JPEG image without decompressing it. <ahref="#gacd0fac3af74b3511d39b4781b7103086">More...</a><br/></td></tr>
<trclass="memitem:ga3fced455e504e8ff4fbad28ba94a3020"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int DLLCALL </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga3fced455e504e8ff4fbad28ba94a3020">tjDecompressHeader3</a> (<aclass="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>
<trclass="memdesc:ga3fced455e504e8ff4fbad28ba94a3020"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Retrieve information about a JPEG image without decompressing it. <ahref="#ga3fced455e504e8ff4fbad28ba94a3020">More...</a><br/></td></tr>
<trclass="memdesc:ga6449044b9af402999ccf52f401333be8"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns a list of fractional scaling factors that the JPEG decompressor in this implementation of TurboJPEG supports. <ahref="#ga6449044b9af402999ccf52f401333be8">More...</a><br/></td></tr>
<trclass="memitem:gada69cc6443d1bb493b40f1626259e5e9"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int DLLCALL </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#gada69cc6443d1bb493b40f1626259e5e9">tjDecompress2</a> (<aclass="el"href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)</td></tr>
<trclass="memdesc:gada69cc6443d1bb493b40f1626259e5e9"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Decompress a JPEG image to an RGB, grayscale, or CMYK image. <ahref="#gada69cc6443d1bb493b40f1626259e5e9">More...</a><br/></td></tr>
<trclass="memitem:ga7c08b340ad7f8e85d407bd9e81d44d07"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int DLLCALL </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga7c08b340ad7f8e85d407bd9e81d44d07">tjDecompressToYUV2</a> (<aclass="el"href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, int width, int pad, int height, int flags)</td></tr>
<trclass="memdesc:ga7c08b340ad7f8e85d407bd9e81d44d07"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Decompress a JPEG image to a YUV planar image. <ahref="#ga7c08b340ad7f8e85d407bd9e81d44d07">More...</a><br/></td></tr>
<trclass="memitem:ga0828a38ae29631ac28b6857cefb0eebf"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int DLLCALL </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga0828a38ae29631ac28b6857cefb0eebf">tjDecompressToYUVPlanes</a> (<aclass="el"href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *jpegBuf, unsigned long jpegSize, unsigned char **dstPlanes, int width, int *strides, int height, int flags)</td></tr>
<trclass="memdesc:ga0828a38ae29631ac28b6857cefb0eebf"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Decompress a JPEG image into separate Y, U (Cb), and V (Cr) image planes. <ahref="#ga0828a38ae29631ac28b6857cefb0eebf">More...</a><br/></td></tr>
<trclass="memitem:ga132ae2c2cadcf64c8bb0f3bdf69da3ed"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int DLLCALL </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga132ae2c2cadcf64c8bb0f3bdf69da3ed">tjDecodeYUV</a> (<aclass="el"href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *srcBuf, int pad, int subsamp, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)</td></tr>
<trclass="memdesc:ga132ae2c2cadcf64c8bb0f3bdf69da3ed"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Decode a YUV planar image into an RGB or grayscale image. <ahref="#ga132ae2c2cadcf64c8bb0f3bdf69da3ed">More...</a><br/></td></tr>
<trclass="memitem:ga6cb5b0e1101a2b20edea576e11faf93d"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int DLLCALL </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga6cb5b0e1101a2b20edea576e11faf93d">tjDecodeYUVPlanes</a> (<aclass="el"href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char **srcPlanes, int *strides, int subsamp, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)</td></tr>
<trclass="memdesc:ga6cb5b0e1101a2b20edea576e11faf93d"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Decode a set of Y, U (Cb), and V (Cr) image planes into an RGB or grayscale image. <ahref="#ga6cb5b0e1101a2b20edea576e11faf93d">More...</a><br/></td></tr>
<trclass="memitem:gad8026a417e16a76313bc0a6c9e8b2ba2"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int DLLCALL </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#gad8026a417e16a76313bc0a6c9e8b2ba2">tjDecompress2</a> (<aclass="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>
<trclass="memdesc:gad8026a417e16a76313bc0a6c9e8b2ba2"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Decompress a JPEG image to an RGB, grayscale, or CMYK image. <ahref="#gad8026a417e16a76313bc0a6c9e8b2ba2">More...</a><br/></td></tr>
<trclass="memitem:ga39e08906528db5a764670ea48d344b09"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int DLLCALL </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga39e08906528db5a764670ea48d344b09">tjDecompressToYUV2</a> (<aclass="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>
<trclass="memdesc:ga39e08906528db5a764670ea48d344b09"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Decompress a JPEG image to a YUV planar image. <ahref="#ga39e08906528db5a764670ea48d344b09">More...</a><br/></td></tr>
<trclass="memitem:ga38d0ef90692663b3ffb5b16da2541512"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int DLLCALL </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga38d0ef90692663b3ffb5b16da2541512">tjDecompressToYUVPlanes</a> (<aclass="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>
<trclass="memdesc:ga38d0ef90692663b3ffb5b16da2541512"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Decompress a JPEG image into separate Y, U (Cb), and V (Cr) image planes. <ahref="#ga38d0ef90692663b3ffb5b16da2541512">More...</a><br/></td></tr>
<trclass="memitem:ga077c61027b875afecd5a1613bf18b3c1"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int DLLCALL </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga077c61027b875afecd5a1613bf18b3c1">tjDecodeYUV</a> (<aclass="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>
<trclass="memdesc:ga077c61027b875afecd5a1613bf18b3c1"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Decode a YUV planar image into an RGB or grayscale image. <ahref="#ga077c61027b875afecd5a1613bf18b3c1">More...</a><br/></td></tr>
<trclass="memitem:gaf42f19b7a496eb18bdc84fe61ee6d3e2"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int DLLCALL </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#gaf42f19b7a496eb18bdc84fe61ee6d3e2">tjDecodeYUVPlanes</a> (<aclass="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>
<trclass="memdesc:gaf42f19b7a496eb18bdc84fe61ee6d3e2"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Decode a set of Y, U (Cb), and V (Cr) image planes into an RGB or grayscale image. <ahref="#gaf42f19b7a496eb18bdc84fe61ee6d3e2">More...</a><br/></td></tr>
<trclass="memdesc:ga3155b775bfbac9dbba869b95a0367902"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Create a new TurboJPEG transformer instance. <ahref="#ga3155b775bfbac9dbba869b95a0367902">More...</a><br/></td></tr>
<trclass="memitem:gae403193ceb4aafb7e0f56ab587b48616"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int DLLCALL </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616">tjTransform</a> (<aclass="el"href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *jpegBuf, unsigned long jpegSize, int n, unsigned char **dstBufs, unsigned long *dstSizes, <aclass="el"href="structtjtransform.html">tjtransform</a> *transforms, int flags)</td></tr>
<trclass="memdesc:gae403193ceb4aafb7e0f56ab587b48616"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Losslessly transform a JPEG image into another JPEG image. <ahref="#gae403193ceb4aafb7e0f56ab587b48616">More...</a><br/></td></tr>
<trclass="memitem:gad02cd42b69f193a0623a9c801788df3a"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int DLLCALL </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#gad02cd42b69f193a0623a9c801788df3a">tjTransform</a> (<aclass="el"href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *jpegBuf, unsigned long jpegSize, int n, unsigned char **dstBufs, unsigned long *dstSizes, <aclass="el"href="structtjtransform.html">tjtransform</a> *transforms, int flags)</td></tr>
<trclass="memdesc:gad02cd42b69f193a0623a9c801788df3a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Losslessly transform a JPEG image into another JPEG image. <ahref="#gad02cd42b69f193a0623a9c801788df3a">More...</a><br/></td></tr>
<trclass="memitem:ga674adee917b95ad4a896f1ba39e12540"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int DLLCALL </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga674adee917b95ad4a896f1ba39e12540">tjDestroy</a> (<aclass="el"href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle)</td></tr>
<trclass="memdesc:ga674adee917b95ad4a896f1ba39e12540"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Destroy a TurboJPEG compressor, decompressor, or transformer instance. <ahref="#ga674adee917b95ad4a896f1ba39e12540">More...</a><br/></td></tr>
<p>If passed to <aclass="el"href="group___turbo_j_p_e_g.html#gaba62b7a98f960839b588579898495cf2"title="Compress an RGB, grayscale, or CMYK image into a JPEG image.">tjCompress2()</a> or <aclass="el"href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a>, 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>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>
</div>
</div>
@@ -517,7 +517,7 @@ Variables</h2></td></tr>
</div><divclass="memdoc">
<p>This option will enable lossless cropping. </p>
<p>See <aclass="el"href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> for more information. </p>
<p>See <aclass="el"href="group___turbo_j_p_e_g.html#gad02cd42b69f193a0623a9c801788df3a"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> for more information. </p>
</div>
</div>
@@ -545,7 +545,7 @@ Variables</h2></td></tr>
</table>
</div><divclass="memdoc">
<p>This option will prevent <aclass="el"href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616"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 <aclass="el"href="group___turbo_j_p_e_g.html#gad02cd42b69f193a0623a9c801788df3a"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>
</div>
</div>
@@ -559,7 +559,7 @@ Variables</h2></td></tr>
</table>
</div><divclass="memdoc">
<p>This option will cause <aclass="el"href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> to return an error if the transform is not perfect. </p>
<p>This option will cause <aclass="el"href="group___turbo_j_p_e_g.html#gad02cd42b69f193a0623a9c801788df3a"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> to return an error if the transform is not perfect. </p>
<p>Lossless transforms operate on MCU blocks, whose size depends on the level of chrominance subsampling used (see <aclass="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> and <aclass="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>.) If the image's width or height is not evenly divisible by the MCU block size, then there will be partial MCU blocks on the right and/or bottom edges. It is not possible to move these partial MCU blocks to the top or left of the image, so any transform that would require that is "imperfect." If this option is not specified, then any partial MCU blocks that cannot be transformed will be left in place, which will create odd-looking strips on the right or bottom edge of the image. </p>
</div>
@@ -574,7 +574,7 @@ Variables</h2></td></tr>
</table>
</div><divclass="memdoc">
<p>This option will cause <aclass="el"href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> to discard any partial MCU blocks that cannot be transformed. </p>
<p>This option will cause <aclass="el"href="group___turbo_j_p_e_g.html#gad02cd42b69f193a0623a9c801788df3a"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> to discard any partial MCU blocks that cannot be transformed. </p>
</div>
</div>
@@ -761,7 +761,7 @@ Variables</h2></td></tr>
</table>
</div><divclass="memdoc">
<p>Transform operations for <aclass="el"href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a></p>
<p>Transform operations for <aclass="el"href="group___turbo_j_p_e_g.html#gad02cd42b69f193a0623a9c801788df3a"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a></p>
<p>Do not transform the position of the image pixels. </p>
@@ -812,7 +812,7 @@ Variables</h2></td></tr>
</div><divclass="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 <aclass="el"href="group___turbo_j_p_e_g.html#gaba62b7a98f960839b588579898495cf2"title="Compress an RGB, grayscale, or CMYK image into a JPEG image.">tjCompress2()</a> and <aclass="el"href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> unless you are disabling automatic buffer (re)allocation (by setting <aclass="el"href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963"title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a>.)</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 <aclass="el"href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963"title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a>.)</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">bytes</td><td>the number of bytes to allocate</td></tr>
<tr><tdclass="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:<oltype="1">
<li>pre-allocate the JPEG buffer with an arbitrary size using <aclass="el"href="group___turbo_j_p_e_g.html#ga5c9234bda6d993cdaffdd89bf81a00ff"title="Allocate an image 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 <aclass="el"href="group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b"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 <aclass="el"href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963"title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees this.)</li>
<li>pre-allocate the buffer to a "worst case" size determined by calling <aclass="el"href="group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b"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 <aclass="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>
</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 <aclass="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><tdclass="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>
@@ -1022,7 +1022,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
@@ -1106,7 +1106,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
<tr><tdclass="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:<oltype="1">
<li>pre-allocate the JPEG buffer with an arbitrary size using <aclass="el"href="group___turbo_j_p_e_g.html#ga5c9234bda6d993cdaffdd89bf81a00ff"title="Allocate an image 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 <aclass="el"href="group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b"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 <aclass="el"href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963"title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees this.)</li>
<li>pre-allocate the buffer to a "worst case" size determined by calling <aclass="el"href="group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b"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 <aclass="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>
</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 <aclass="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><tdclass="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>
@@ -1119,7 +1119,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
@@ -1144,7 +1144,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
<tr>
<tdclass="paramkey"></td>
<td></td>
<tdclass="paramtype">int * </td>
<tdclass="paramtype">const int * </td>
<tdclass="paramname"><em>strides</em>, </td>
</tr>
<tr>
@@ -1203,7 +1203,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
<tr><tdclass="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:<oltype="1">
<li>pre-allocate the JPEG buffer with an arbitrary size using <aclass="el"href="group___turbo_j_p_e_g.html#ga5c9234bda6d993cdaffdd89bf81a00ff"title="Allocate an image 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 <aclass="el"href="group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b"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 <aclass="el"href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963"title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees this.)</li>
<li>pre-allocate the buffer to a "worst case" size determined by calling <aclass="el"href="group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b"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 <aclass="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>
</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 <aclass="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><tdclass="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>
@@ -1216,7 +1216,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
@@ -1942,7 +1942,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
</div><divclass="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 <aclass="el"href="group___turbo_j_p_e_g.html#gaba62b7a98f960839b588579898495cf2"title="Compress an RGB, grayscale, or CMYK image into a JPEG image.">tjCompress2()</a> or <aclass="el"href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> or that were manually allocated using <aclass="el"href="group___turbo_j_p_e_g.html#ga5c9234bda6d993cdaffdd89bf81a00ff"title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a>.</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 <aclass="el"href="group___turbo_j_p_e_g.html#ga5c9234bda6d993cdaffdd89bf81a00ff"title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a>.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">buffer</td><td>address of the buffer to free</td></tr>
@@ -2199,7 +2199,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
@@ -2270,7 +2270,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
<tr><tdclass="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:<oltype="1">
<li>pre-allocate the JPEG buffer with an arbitrary size using <aclass="el"href="group___turbo_j_p_e_g.html#ga5c9234bda6d993cdaffdd89bf81a00ff"title="Allocate an image 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 <aclass="el"href="group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b"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. This should ensure that the buffer never has to be re-allocated (setting <aclass="el"href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963"title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees this.)</li>
<li>pre-allocate the buffer to a "worst case" size determined by calling <aclass="el"href="group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b"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 <aclass="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 <aclass="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>
</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 <aclass="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><tdclass="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>
['tjtransform',['tjtransform',['../structtjtransform.html',1,'tjtransform'],['../group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616',1,'tjTransform(tjhandle handle, unsigned char *jpegBuf, unsigned long jpegSize, int n, unsigned char **dstBufs, unsigned long *dstSizes, tjtransform *transforms, int flags): turbojpeg.h'],['../group___turbo_j_p_e_g.html#gaa29f3189c41be12ec5dee7caec318a31',1,'tjtransform(): turbojpeg.h']]],
['tjtransform',['tjtransform',['../structtjtransform.html',1,'tjtransform'],['../group___turbo_j_p_e_g.html#gad02cd42b69f193a0623a9c801788df3a',1,'tjTransform(tjhandle handle, const unsigned char *jpegBuf, unsigned long jpegSize, int n, unsigned char **dstBufs, unsigned long *dstSizes, tjtransform *transforms, int flags): turbojpeg.h'],['../group___turbo_j_p_e_g.html#gaa29f3189c41be12ec5dee7caec318a31',1,'tjtransform(): turbojpeg.h']]],
<tr><tdclass="paramname">arrayRegion</td><td><aclass="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><tdclass="paramname">planeRegion</td><td><aclass="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><tdclass="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><tdclass="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 <aclass="el"href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a>.</td></tr>
<tr><tdclass="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 <aclass="el"href="group___turbo_j_p_e_g.html#gad02cd42b69f193a0623a9c801788df3a"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a>.</td></tr>
<tr><tdclass="paramname">transform</td><td>a pointer to a <aclass="el"href="structtjtransform.html"title="Lossless transform.">tjtransform</a> structure that specifies the parameters and/or cropping region for this transform</td></tr>
<li><ahref="org/libjpegturbo/turbojpeg/TJCompressor.html"title="class in org.libjpegturbo.turbojpeg"target="classFrame">TJCompressor</a></li>
<li><ahref="org/libjpegturbo/turbojpeg/TJCustomFilter.html"title="interface in org.libjpegturbo.turbojpeg"target="classFrame"><i>TJCustomFilter</i></a></li>
<li><ahref="org/libjpegturbo/turbojpeg/TJDecompressor.html"title="class in org.libjpegturbo.turbojpeg"target="classFrame">TJDecompressor</a></li>
<li><ahref="org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg"target="classFrame">TJException</a></li>
<li><ahref="org/libjpegturbo/turbojpeg/TJScalingFactor.html"title="class in org.libjpegturbo.turbojpeg"target="classFrame">TJScalingFactor</a></li>
<li><ahref="org/libjpegturbo/turbojpeg/TJTransform.html"title="class in org.libjpegturbo.turbojpeg"target="classFrame">TJTransform</a></li>
<li><ahref="org/libjpegturbo/turbojpeg/TJTransformer.html"title="class in org.libjpegturbo.turbojpeg"target="classFrame">TJTransformer</a></li>
source image stored in <code>yuvImage</code> with the newly created
instance.</div>
</dd>
<dt><ahref="./org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">TJException</span></a> - Exception in <ahref="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</a></dt>
<dd> </dd>
<dt><spanclass="strong"><ahref="./org/libjpegturbo/turbojpeg/TJException.html#TJException()">TJException()</a></span> - Constructor for exception org.libjpegturbo.turbojpeg.<ahref="./org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg">TJException</a></dt>
<dd> </dd>
<dt><spanclass="strong"><ahref="./org/libjpegturbo/turbojpeg/TJException.html#TJException(java.lang.String,%20java.lang.Throwable)">TJException(String, Throwable)</a></span> - Constructor for exception org.libjpegturbo.turbojpeg.<ahref="./org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg">TJException</a></dt>
<dd> </dd>
<dt><spanclass="strong"><ahref="./org/libjpegturbo/turbojpeg/TJException.html#TJException(java.lang.String)">TJException(String)</a></span> - Constructor for exception org.libjpegturbo.turbojpeg.<ahref="./org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg">TJException</a></dt>
<dd> </dd>
<dt><spanclass="strong"><ahref="./org/libjpegturbo/turbojpeg/TJException.html#TJException(java.lang.Throwable)">TJException(Throwable)</a></span> - Constructor for exception org.libjpegturbo.turbojpeg.<ahref="./org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg">TJException</a></dt>
<dd> </dd>
<dt><ahref="./org/libjpegturbo/turbojpeg/TJScalingFactor.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">TJScalingFactor</span></a> - Class in <ahref="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</a></dt>
<divclass="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><spanclass="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 <ahref="../../../org/libjpegturbo/turbojpeg/TJ.html"title="class in org.libjpegturbo.turbojpeg"><code>TJ.SAMP_*</code></a>)</dd>
<dt><spanclass="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>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
image with the given width, height, and level of chrominance subsampling.</dd></dl>
</li>
</ul>
<aname="bufSizeYUV(int, int, int, int)">
@@ -1114,17 +1093,14 @@ public static final int FLAG_FORCESSE3</pre>
<divclass="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><spanclass="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 <ahref="../../../org/libjpegturbo/turbojpeg/TJ.html"title="class in org.libjpegturbo.turbojpeg"><code>TJ.SAMP_*</code></a>)</dd>
<dt><spanclass="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>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
image with the given width, height, and level of chrominance subsampling.</dd></dl>
</li>
</ul>
<aname="bufSizeYUV(int, int, int)">
@@ -1136,11 +1112,8 @@ public static final int FLAG_FORCESSE3</pre>
<pre>@Deprecated
public static int bufSizeYUV(int width,
<divclass="block">Returns the plane width of a YUV image plane with the given parameters.
Refer to <ahref="../../../org/libjpegturbo/turbojpeg/YUVImage.html"title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> for a description of plane width.</div>
<dl><dt><spanclass="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 <ahref="../../../org/libjpegturbo/turbojpeg/TJ.html"title="class in org.libjpegturbo.turbojpeg"><code>TJ.SAMP_*</code></a>)</dd>
<dt><spanclass="strong">Returns:</span></dt><dd>the plane width of a YUV image plane with the given parameters.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
<dt><spanclass="strong">Returns:</span></dt><dd>the plane width of a YUV image plane with the given parameters.</dd></dl>
</li>
</ul>
<aname="planeHeight(int, int, int)">
@@ -1196,16 +1163,13 @@ public static int bufSizeYUV(int width,
<divclass="block">Returns the plane height of a YUV image plane with the given parameters.
Refer to <ahref="../../../org/libjpegturbo/turbojpeg/YUVImage.html"title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> for a description of plane height.</div>
<dl><dt><spanclass="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 <ahref="../../../org/libjpegturbo/turbojpeg/TJ.html"title="class in org.libjpegturbo.turbojpeg"><code>TJ.SAMP_*</code></a>)</dd>
<dt><spanclass="strong">Returns:</span></dt><dd>the plane height of a YUV image plane with the given parameters.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
<dt><spanclass="strong">Returns:</span></dt><dd>the plane height of a YUV image plane with the given parameters.</dd></dl>
</li>
</ul>
<aname="getScalingFactors()">
@@ -1214,14 +1178,11 @@ public static int bufSizeYUV(int width,
<ulclass="blockListLast">
<liclass="blockList">
<h4>getScalingFactors</h4>
<pre>public static <ahref="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html"title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</a>[] getScalingFactors()
throws java.lang.Exception</pre>
<pre>public static <ahref="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html"title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</a>[] getScalingFactors()</pre>
<divclass="block">Returns a list of fractional scaling factors that the JPEG decompressor in
this implementation of TurboJPEG supports.</div>
<dl><dt><spanclass="strong">Returns:</span></dt><dd>a list of fractional scaling factors that the JPEG decompressor in
this implementation of TurboJPEG supports.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
this implementation of TurboJPEG supports.</dd></dl>
throws <ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
<divclass="block">Create a TurboJPEG compressor instance and associate the uncompressed
source image stored in <code>srcImage</code> with the newly created
instance.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>srcImage</code> - see <ahref="../../../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 <ahref="../../../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 <ahref="../../../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 <ahref="../../../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 <ahref="../../../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 <ahref="../../../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
<ahref="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> for description</dd><dd><code>height</code> - see
<ahref="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> for description</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
<dd><code><ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
throws <ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
<divclass="block">Associate an uncompressed RGB or grayscale source image with this
compressor instance.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>srcImage</code> - a <code>BufferedImage</code> instance containing RGB or
grayscale pixels to be compressed or encoded</dd><dd><code>x</code> - x offset (in pixels) of the region in the source image from which
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
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
<pre>public void setSourceImage(<ahref="../../../org/libjpegturbo/turbojpeg/YUVImage.html"title="class in org.libjpegturbo.turbojpeg">YUVImage</a> srcImage)
throws java.lang.Exception</pre>
throws <ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
<divclass="block">Associate an uncompressed YUV planar source image with this compressor
instance.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>srcImage</code> - YUV planar image to be compressed</dd>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>srcImage</code> - YUV planar image to be compressed. This image is not
modified.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
<dd><code><ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
<divclass="block">Set the level of chrominance subsampling for subsequent compress/encode
operations. When pixels are converted from RGB to YCbCr (see
<ahref="../../../org/libjpegturbo/turbojpeg/TJ.html#CS_YCbCr"><code>TJ.CS_YCbCr</code></a>) or from CMYK to YCCK (see <ahref="../../../org/libjpegturbo/turbojpeg/TJ.html#CS_YCCK"><code>TJ.CS_YCCK</code></a>) as part
<dt><spanclass="strong">Returns:</span></dt><dd>a buffer containing a JPEG image. The length of this buffer will
not be equal to the size of the JPEG image. Use <ahref="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#getCompressedSize()"><code>getCompressedSize()</code></a> to obtain the size of the JPEG image.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
<dd><code><ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
<pre>public void encodeYUV(<ahref="../../../org/libjpegturbo/turbojpeg/YUVImage.html"title="class in org.libjpegturbo.turbojpeg">YUVImage</a> dstImage,
int flags)
throws java.lang.Exception</pre>
throws <ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
<divclass="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
<pre>public <ahref="../../../org/libjpegturbo/turbojpeg/YUVImage.html"title="class in org.libjpegturbo.turbojpeg">YUVImage</a> encodeYUV(int pad,
int flags)
throws java.lang.Exception</pre>
throws <ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
<divclass="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
<pre>public <ahref="../../../org/libjpegturbo/turbojpeg/YUVImage.html"title="class in org.libjpegturbo.turbojpeg">YUVImage</a> encodeYUV(int[] strides,
int flags)
throws java.lang.Exception</pre>
throws <ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
<divclass="block">Encode the uncompressed 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
<ahref="../../../org/libjpegturbo/turbojpeg/TJTransform.html"title="class in org.libjpegturbo.turbojpeg">TJTransform</a> transform)
throws java.lang.Exception</pre>
throws <ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
<divclass="block">A callback function that can be used to modify the DCT coefficients after
they are losslessly transformed but before they are transcoded to a new
JPEG image. This allows for custom filters or other transformations to be
@@ -165,7 +165,7 @@
transform in the <code>transforms</code> array that was passed to <ahref="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)"><code>TJTransformer.transform()</code></a>.</dd><dd><code>transform</code> - a <ahref="../../../org/libjpegturbo/turbojpeg/TJTransform.html"title="class in org.libjpegturbo.turbojpeg"><code>TJTransform</code></a> instance that specifies the
parameters and/or cropping region for this transform</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
<dd><code><ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
<li><ahref="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html"title="interface in org.libjpegturbo.turbojpeg"><spanclass="strong">Prev Class</span></a></li>
<li><ahref="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">Next Class</span></a></li>
<li><ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">Next Class</span></a></li>
throws <ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
<divclass="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><spanclass="strong">Parameters:</span></dt><dd><code>jpegImage</code> - JPEG image buffer</dd><dd><code>imageSize</code> - size of the JPEG image (in bytes)</dd>
<dl><dt><spanclass="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>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
<dd><code><ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
<pre>public TJDecompressor(<ahref="../../../org/libjpegturbo/turbojpeg/YUVImage.html"title="class in org.libjpegturbo.turbojpeg">YUVImage</a> yuvImage)
throws java.lang.Exception</pre>
throws <ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
<divclass="block">Create a TurboJPEG decompressor instance and associate the YUV planar
source image stored in <code>yuvImage</code> with the newly created
instance.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>yuvImage</code> - <ahref="../../../org/libjpegturbo/turbojpeg/YUVImage.html"title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing a YUV planar
image to be decoded</dd>
image to be decoded. This image is not modified.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
<dd><code><ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
throws <ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
<divclass="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><spanclass="strong">Parameters:</span></dt><dd><code>jpegImage</code> - JPEG image buffer</dd><dd><code>imageSize</code> - size of the JPEG image (in bytes)</dd>
<dl><dt><spanclass="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>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
<dd><code><ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
<pre>public void setSourceImage(<ahref="../../../org/libjpegturbo/turbojpeg/YUVImage.html"title="class in org.libjpegturbo.turbojpeg">YUVImage</a> srcImage)
throws java.lang.Exception</pre>
<pre>public void setSourceImage(<ahref="../../../org/libjpegturbo/turbojpeg/YUVImage.html"title="class in org.libjpegturbo.turbojpeg">YUVImage</a> srcImage)</pre>
<divclass="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><spanclass="strong">Parameters:</span></dt><dd><code>srcImage</code> - <ahref="../../../org/libjpegturbo/turbojpeg/YUVImage.html"title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing a YUV planar image to
<pre>public void decompressToYUV(<ahref="../../../org/libjpegturbo/turbojpeg/YUVImage.html"title="class in org.libjpegturbo.turbojpeg">YUVImage</a> dstImage,
int flags)
throws java.lang.Exception</pre>
throws <ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
<divclass="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
<li><ahref="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html"title="interface in org.libjpegturbo.turbojpeg"><spanclass="strong">Prev Class</span></a></li>
<li><ahref="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">Next Class</span></a></li>
<li><ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">Next Class</span></a></li>
<li><ahref="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">Prev Class</span></a></li>
<li><ahref="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">Next Class</span></a></li>
<li><ahref="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">Prev Class</span></a></li>
<li><ahref="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">Next Class</span></a></li>
<li><ahref="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">Prev Class</span></a></li>
<li><ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">Prev Class</span></a></li>
<li><ahref="../../../org/libjpegturbo/turbojpeg/TJTransform.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">Next Class</span></a></li>
<li><ahref="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">Prev Class</span></a></li>
<li><ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">Prev Class</span></a></li>
<li><ahref="../../../org/libjpegturbo/turbojpeg/TJTransform.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">Next Class</span></a></li>
<ahref="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html"title="interface in org.libjpegturbo.turbojpeg">TJCustomFilter</a> cf)
throws java.lang.Exception</pre>
<ahref="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html"title="interface in org.libjpegturbo.turbojpeg">TJCustomFilter</a> cf)</pre>
<divclass="block">Create a new lossless transform instance with the given parameters.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>x</code> - the left boundary of the cropping region. This must be evenly
divisible by the MCU block width (see <ahref="../../../org/libjpegturbo/turbojpeg/TJ.html#getMCUWidth(int)"><code>TJ.getMCUWidth(int)</code></a>)</dd><dd><code>y</code> - the upper boundary of the cropping region. This must be evenly
<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 <ahref="../../../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>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
(<code>OPT_*</code>)</dd><dd><code>cf</code> - an instance of an object that implements the <ahref="../../../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>
<ahref="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html"title="interface in org.libjpegturbo.turbojpeg">TJCustomFilter</a> cf)
throws java.lang.Exception</pre>
<ahref="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html"title="interface in org.libjpegturbo.turbojpeg">TJCustomFilter</a> cf)</pre>
<divclass="block">Create a new lossless transform instance with the given parameters.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>r</code> - a <code>Rectangle</code> instance that specifies the cropping
region. See <ahref="../../../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 <ahref="../../../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>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
(<code>OPT_*</code>)</dd><dd><code>cf</code> - an instance of an object that implements the <ahref="../../../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>
throws <ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
<divclass="block">Create a TurboJPEG lossless transformer instance and associate the JPEG
image of length <code>imageSize</code> bytes stored in
<code>jpegImage</code> with the newly created instance.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>jpegImage</code> - JPEG image buffer</dd><dd><code>imageSize</code> - size of the JPEG image (in bytes)</dd>
<dl><dt><spanclass="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>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
<dd><code><ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
<pre>public <ahref="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html"title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a>[] transform(<ahref="../../../org/libjpegturbo/turbojpeg/TJTransform.html"title="class in org.libjpegturbo.turbojpeg">TJTransform</a>[] transforms,
int flags)
throws java.lang.Exception</pre>
throws <ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
<divclass="block">Losslessly transform the JPEG image associated with this transformer
instance and return an array of <ahref="../../../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>
<dt><spanclass="strong">Returns:</span></dt><dd>an array of <ahref="../../../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>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
<dd><code><ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
<divclass="block">Create a new <code>YUVImage</code> instance backed by separate image
planes, and allocate memory for the image planes.</div>
<dl><dt><spanclass="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
strides for all planes will be set to their respective plane widths. When
using this constructor, the stride for each plane must be equal to or
greater than the plane width.</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 <ahref="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
image (one of <ahref="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd></dl>
<divclass="block">Create a new <code>YUVImage</code> instance backed by a unified image
buffer, and allocate memory for the image buffer.</div>
<dl><dt><spanclass="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
image (one of <ahref="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
image (one of <ahref="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd></dl>
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
image (one of <ahref="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
image (one of <ahref="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd></dl>
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
image (one of <ahref="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
image (one of <ahref="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd></dl>
to each plane or to specify that this <code>YUVImage</code> image 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 <ahref="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
image (one of <ahref="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd></dl>
<divclass="block">Assign a unified image buffer to this <code>YUVImage</code> instance.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>yuvImage</code> - image buffer that contains or will contain YUV planar
image data. Use <ahref="../../../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
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
image (one of <ahref="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
image (one of <ahref="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd></dl>
<litype="circle">org.libjpegturbo.turbojpeg.<ahref="../../../org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">TJException</span></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<litype="circle">org.libjpegturbo.turbojpeg.<ahref="../../../org/libjpegturbo/turbojpeg/TJ.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">TJ</span></a></li>
<litype="circle">org.libjpegturbo.turbojpeg.<ahref="../../../org/libjpegturbo/turbojpeg/TJCompressor.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">TJCompressor</span></a></li>
<litype="circle">org.libjpegturbo.turbojpeg.<ahref="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">TJDecompressor</span></a>
<litype="circle">org.libjpegturbo.turbojpeg.<ahref="../../../org/libjpegturbo/turbojpeg/TJCompressor.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">TJCompressor</span></a> (implements java.io.Closeable)</li>
<litype="circle">org.libjpegturbo.turbojpeg.<ahref="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">TJDecompressor</span></a> (implements java.io.Closeable)
<ul>
<litype="circle">org.libjpegturbo.turbojpeg.<ahref="../../../org/libjpegturbo/turbojpeg/TJTransformer.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">TJTransformer</span></a></li>
<litype="circle">org.libjpegturbo.turbojpeg.<ahref="org/libjpegturbo/turbojpeg/TJException.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">TJException</span></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<litype="circle">org.libjpegturbo.turbojpeg.<ahref="org/libjpegturbo/turbojpeg/TJ.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">TJ</span></a></li>
<litype="circle">org.libjpegturbo.turbojpeg.<ahref="org/libjpegturbo/turbojpeg/TJCompressor.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">TJCompressor</span></a></li>
<litype="circle">org.libjpegturbo.turbojpeg.<ahref="org/libjpegturbo/turbojpeg/TJDecompressor.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">TJDecompressor</span></a>
<litype="circle">org.libjpegturbo.turbojpeg.<ahref="org/libjpegturbo/turbojpeg/TJCompressor.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">TJCompressor</span></a> (implements java.io.Closeable)</li>
<litype="circle">org.libjpegturbo.turbojpeg.<ahref="org/libjpegturbo/turbojpeg/TJDecompressor.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">TJDecompressor</span></a> (implements java.io.Closeable)
<ul>
<litype="circle">org.libjpegturbo.turbojpeg.<ahref="org/libjpegturbo/turbojpeg/TJTransformer.html"title="class in org.libjpegturbo.turbojpeg"><spanclass="strong">TJTransformer</span></a></li>
* Processes exactly one iMCU row per call, unless suspended.
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.