Compare commits
380 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d23e3fc586 | ||
|
|
f1d512de2f | ||
|
|
751ce7d9f3 | ||
|
|
ffea183e55 | ||
|
|
3fed7e016b | ||
|
|
8fb32c0a39 | ||
|
|
b3e739028a | ||
|
|
ae87a95861 | ||
|
|
b443c541b9 | ||
|
|
cf483eee49 | ||
|
|
3de15e0c34 | ||
|
|
a2291b252d | ||
|
|
a36deef563 | ||
|
|
6d95c51adf | ||
|
|
5ea5482872 | ||
|
|
8cc1277b69 | ||
|
|
ecf5f9a96a | ||
|
|
035262a18d | ||
|
|
ed7cab47d9 | ||
|
|
42d679b9fc | ||
|
|
044c22e12f | ||
|
|
1d2320994d | ||
|
|
70327296e2 | ||
|
|
f81833aed6 | ||
|
|
00607ec260 | ||
|
|
fdf8903354 | ||
|
|
166e34213e | ||
|
|
6367924ac6 | ||
|
|
29f718ee63 | ||
|
|
fe50cd9978 | ||
|
|
b542e4c8e9 | ||
|
|
52291467e1 | ||
|
|
c76f4a0826 | ||
|
|
c0b16e3d2b | ||
|
|
6cedf37c83 | ||
|
|
bd20344b0a | ||
|
|
c30b1e72da | ||
|
|
622c462e48 | ||
|
|
410c028f33 | ||
|
|
cf54623b08 | ||
|
|
ac59b2c582 | ||
|
|
6902cdb177 | ||
|
|
55de97207d | ||
|
|
708f013f89 | ||
|
|
163f0b1965 | ||
|
|
3a32d199df | ||
|
|
9a51a87af3 | ||
|
|
74aeaddf8e | ||
|
|
ab6c4a5db1 | ||
|
|
ec4cacc16e | ||
|
|
5db6a6819d | ||
|
|
f448279b14 | ||
|
|
ded5a504b4 | ||
|
|
c0d0fe86d8 | ||
|
|
a81a8c137b | ||
|
|
02f7bcdbd1 | ||
|
|
bbb7550709 | ||
|
|
5ced1f590b | ||
|
|
b98ee19241 | ||
|
|
ad8330af72 | ||
|
|
b25adabcfa | ||
|
|
875e873f26 | ||
|
|
2a9e3bd743 | ||
|
|
f37b7c1f96 | ||
|
|
509c2680aa | ||
|
|
d48cfe591f | ||
|
|
68564c0f9e | ||
|
|
ec5adb83dd | ||
|
|
de4cbb5c21 | ||
|
|
c8e52741fd | ||
|
|
72473266b8 | ||
|
|
a5ad46b9f8 | ||
|
|
6399d0a699 | ||
|
|
aa9db61677 | ||
|
|
2b05d47bc2 | ||
|
|
7bc9fca430 | ||
|
|
bb16b94455 | ||
|
|
33011754e6 | ||
|
|
bce58f487e | ||
|
|
ce067a6cd1 | ||
|
|
d3a3a73f64 | ||
|
|
58a3975e93 | ||
|
|
351d5d08fa | ||
|
|
426de82d0c | ||
|
|
5857929f95 | ||
|
|
709477274e | ||
|
|
1af712c101 | ||
|
|
ec90cd0f90 | ||
|
|
ce76ffac4c | ||
|
|
500b5ecec3 | ||
|
|
87ab3360d0 | ||
|
|
b46af82cc1 | ||
|
|
a4aa30d9a0 | ||
|
|
0d7818d1b6 | ||
|
|
4b67db4d9b | ||
|
|
f70a7e1ee1 | ||
|
|
f27167f20c | ||
|
|
6a8421fb44 | ||
|
|
031e16ecff | ||
|
|
75be88cfbd | ||
|
|
e2442e0707 | ||
|
|
1c2d3cfaaf | ||
|
|
2d0b675adf | ||
|
|
a214094b37 | ||
|
|
83fcf7b9e9 | ||
|
|
8a885c5443 | ||
|
|
ae5c15eb59 | ||
|
|
90e2d7f3fd | ||
|
|
5308c1a03b | ||
|
|
ce90ab5d44 | ||
|
|
1ee87a9e2e | ||
|
|
479501b07c | ||
|
|
9bc8eb6449 | ||
|
|
0fa5ae6b54 | ||
|
|
1ff90822f1 | ||
|
|
f8cca819a4 | ||
|
|
beefb62a6f | ||
|
|
3d9c64e9f8 | ||
|
|
23e8e0ff83 | ||
|
|
c868e41b22 | ||
|
|
0696b0a451 | ||
|
|
254909fab5 | ||
|
|
aa829dcf50 | ||
|
|
fbef50bc8b | ||
|
|
43ce78e032 | ||
|
|
add6158e96 | ||
|
|
65aaecd2d5 | ||
|
|
cfb7138523 | ||
|
|
bb3d325624 | ||
|
|
c701014dce | ||
|
|
950580eb0c | ||
|
|
8217fd5478 | ||
|
|
103c6c3276 | ||
|
|
2b1c9c6887 | ||
|
|
07e304c3bf | ||
|
|
5ea77d8b77 | ||
|
|
9a1d32095b | ||
|
|
17ed160078 | ||
|
|
504a295cde | ||
|
|
d00d7d8c19 | ||
|
|
aaffc14f65 | ||
|
|
d5f281b734 | ||
|
|
f2729c983a | ||
|
|
c1f07a9fc4 | ||
|
|
4f943644e5 | ||
|
|
3bef88f6ec | ||
|
|
2260b66e16 | ||
|
|
a861cc2f31 | ||
|
|
5c064c6ba5 | ||
|
|
9454cd365a | ||
|
|
43c58ff983 | ||
|
|
86a9bd1b08 | ||
|
|
a4a721fce5 | ||
|
|
574f3a772c | ||
|
|
ad6c316146 | ||
|
|
8d95be3afb | ||
|
|
a62895265f | ||
|
|
9ab569e616 | ||
|
|
9c78a04df4 | ||
|
|
0fa7850aeb | ||
|
|
0c8eb5b4dd | ||
|
|
84893085cf | ||
|
|
f4b8a5cf03 | ||
|
|
6d8caa9f88 | ||
|
|
398c1e9acc | ||
|
|
26f109290d | ||
|
|
43e84cff1b | ||
|
|
696e754ecf | ||
|
|
909a8cfc7b | ||
|
|
7678cba140 | ||
|
|
3820eb1e2d | ||
|
|
d23bf13189 | ||
|
|
f7aeafaf00 | ||
|
|
fce0382181 | ||
|
|
3041cf67ff | ||
|
|
1a85fc497d | ||
|
|
eb8bba627f | ||
|
|
53bb941845 | ||
|
|
2401e4d10c | ||
|
|
34e9d7e340 | ||
|
|
dc9bdf143a | ||
|
|
b2d000e64b | ||
|
|
bfc3ce3157 | ||
|
|
269e84c971 | ||
|
|
b628d6934f | ||
|
|
450306a84b | ||
|
|
ed3c527386 | ||
|
|
4a275cf080 | ||
|
|
13e4803e6a | ||
|
|
a74655af45 | ||
|
|
58cb10ee5f | ||
|
|
7b3c0f0109 | ||
|
|
72964b8633 | ||
|
|
3270768736 | ||
|
|
51f94caba1 | ||
|
|
9a12cf7ab5 | ||
|
|
c80ddef7a4 | ||
|
|
d3a1f899ee | ||
|
|
d64e8e2905 | ||
|
|
e15a6b4e08 | ||
|
|
ca56642128 | ||
|
|
3fa69b4d61 | ||
|
|
d83c997749 | ||
|
|
d66dc70d7b | ||
|
|
8adf4c0a4f | ||
|
|
1095b822b0 | ||
|
|
c0ca354eb4 | ||
|
|
2e90ccac0b | ||
|
|
5b177b3cab | ||
|
|
16bd984557 | ||
|
|
81baa1b501 | ||
|
|
293263c352 | ||
|
|
09497c1a73 | ||
|
|
84fbd4f1ed | ||
|
|
bd96b30b74 | ||
|
|
25758055ac | ||
|
|
c743009717 | ||
|
|
29e453f7c0 | ||
|
|
a4da0750f0 | ||
|
|
19c791cdac | ||
|
|
d45434fe19 | ||
|
|
b85de60a9f | ||
|
|
e73ee60a8f | ||
|
|
4508ab3e51 | ||
|
|
87bc8721b4 | ||
|
|
33ce0b5e71 | ||
|
|
35ed3c97b2 | ||
|
|
3c54642c81 | ||
|
|
367a838626 | ||
|
|
7c2bfdb040 | ||
|
|
0dd9a2c1fd | ||
|
|
32eaeeac9e | ||
|
|
4c4dc6149b | ||
|
|
feaec37d32 | ||
|
|
b6909ab3f7 | ||
|
|
9bef5df776 | ||
|
|
88421563ad | ||
|
|
9cdec16ceb | ||
|
|
845fe8bf80 | ||
|
|
de9e9db6a5 | ||
|
|
715b7c38a8 | ||
|
|
ca387e7fda | ||
|
|
39e9e65c5b | ||
|
|
264dd42a98 | ||
|
|
ff392d81ef | ||
|
|
37bae1a0e9 | ||
|
|
985ef4f9f1 | ||
|
|
700de8aa81 | ||
|
|
4e240795cc | ||
|
|
d4859558da | ||
|
|
289014d470 | ||
|
|
3847f91122 | ||
|
|
f918646f9a | ||
|
|
365bc1ce11 | ||
|
|
836e711c38 | ||
|
|
bd544e284b | ||
|
|
0e2bca0744 | ||
|
|
0fba3c1993 | ||
|
|
7d3feda796 | ||
|
|
bf6c774305 | ||
|
|
afdd7999e4 | ||
|
|
c308d43416 | ||
|
|
773040f9d9 | ||
|
|
c05d124968 | ||
|
|
a831b5a986 | ||
|
|
9f1f86bf7f | ||
|
|
e817c07779 | ||
|
|
479fa1d870 | ||
|
|
8c40ac8ae6 | ||
|
|
dc4b900223 | ||
|
|
aa7459050d | ||
|
|
087ec126c1 | ||
|
|
cd8a12586a | ||
|
|
4893e5d8b8 | ||
|
|
19b393b624 | ||
|
|
9d9d8fe658 | ||
|
|
78e97e38cb | ||
|
|
468f2fed27 | ||
|
|
5abf2536f6 | ||
|
|
5fce2e9421 | ||
|
|
907dd683a4 | ||
|
|
f008876cc1 | ||
|
|
5bc43c7821 | ||
|
|
f3ad13e3d8 | ||
|
|
94e152b186 | ||
|
|
073b0e88a1 | ||
|
|
616b4e2d1b | ||
|
|
3d72522a68 | ||
|
|
f0dd80f246 | ||
|
|
1b385f37f3 | ||
|
|
fd778bba46 | ||
|
|
8d403aeb6a | ||
|
|
01b74c101e | ||
|
|
db0dec3c5a | ||
|
|
ba6e9d8a11 | ||
|
|
7106ffe5f2 | ||
|
|
5426a4cb16 | ||
|
|
d0bac69a8a | ||
|
|
59322e0973 | ||
|
|
51cc89fa7b | ||
|
|
4ded4dfac6 | ||
|
|
1d93541617 | ||
|
|
c0f3512d5a | ||
|
|
02fa8f244e | ||
|
|
32120054c2 | ||
|
|
1478361204 | ||
|
|
c94531212f | ||
|
|
9baef107e1 | ||
|
|
dadebcd79a | ||
|
|
dedce66eb5 | ||
|
|
aba6ae5950 | ||
|
|
596e3965e7 | ||
|
|
d4092f6b4d | ||
|
|
42e1e2d886 | ||
|
|
25c912c1b2 | ||
|
|
178796e748 | ||
|
|
b9ab64d8db | ||
|
|
2ac4e9d914 | ||
|
|
44b2399a94 | ||
|
|
d9cb76f636 | ||
|
|
d34d255957 | ||
|
|
2fb4d7e337 | ||
|
|
8a9b042b26 | ||
|
|
11426a8716 | ||
|
|
67ad535022 | ||
|
|
6c6696e569 | ||
|
|
6530203fdd | ||
|
|
c8358fcbd9 | ||
|
|
b0fcd0ccc5 | ||
|
|
2b29bca2a9 | ||
|
|
d681fa7626 | ||
|
|
ff05b6e0de | ||
|
|
e6426d2420 | ||
|
|
2af2fe42a3 | ||
|
|
261db7706d | ||
|
|
952191da79 | ||
|
|
d642da75bd | ||
|
|
059c9a5f2a | ||
|
|
94686e3c0f | ||
|
|
97205269bc | ||
|
|
27d4c5ea22 | ||
|
|
6abd39160c | ||
|
|
9df7ac2e6a | ||
|
|
0ff7da7191 | ||
|
|
9fdb8f8553 | ||
|
|
a949da48da | ||
|
|
108b1cd9ba | ||
|
|
1a8c68ac5b | ||
|
|
fa3bdfb7bc | ||
|
|
7884e245bc | ||
|
|
be908ac024 | ||
|
|
ed21f4bd03 | ||
|
|
f34f2f5bc6 | ||
|
|
6c36568626 | ||
|
|
3924ebceb5 | ||
|
|
3dcb85ee9a | ||
|
|
1be87b6273 | ||
|
|
b331385e8a | ||
|
|
b2921f1bcc | ||
|
|
eaae2cdb16 | ||
|
|
a7c2f97939 | ||
|
|
e06ccbe3f7 | ||
|
|
67de29b503 | ||
|
|
c22e42e9a2 | ||
|
|
6d765524bc | ||
|
|
421d34fd2f | ||
|
|
c6300ffe4e | ||
|
|
6448a5e584 | ||
|
|
7ee3ce9ada | ||
|
|
b5426c52c0 | ||
|
|
621b29f5b1 | ||
|
|
f1cbc32876 | ||
|
|
72c837da24 | ||
|
|
1c8a475cd4 | ||
|
|
8880e08771 | ||
|
|
426d787c4c | ||
|
|
2cf199cbbd | ||
|
|
16b121890c | ||
|
|
6cb27c31d9 | ||
|
|
ff5685d534 |
4
.gitattributes
vendored
Normal file
4
.gitattributes
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
/.travis.yml export-ignore
|
||||||
|
/appveyor.yml export-ignore
|
||||||
|
/ci export-ignore
|
||||||
|
/.gitattributes export-ignore
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
|
|
||||||
dcommander = DRC <dcommander@users.sourceforge.net>
|
|
||||||
astrand = Peter Åstrand <astrand@cendio.se>
|
|
||||||
ossman_ = Pierre Ossman <ossman@cendio.se>
|
|
||||||
const_k = Constantin Kaplinsky <const@tightvnc.com>
|
|
||||||
atkac = Adam Tkac <atkac@redhat.com>
|
|
||||||
|
|
||||||
998
BUILDING.md
998
BUILDING.md
File diff suppressed because it is too large
Load Diff
1568
CMakeLists.txt
1568
CMakeLists.txt
File diff suppressed because it is too large
Load Diff
15
CODE_OF_CONDUCT.md
Normal file
15
CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# Community Participation Guidelines
|
||||||
|
|
||||||
|
This repository is governed by Mozilla's code of conduct and etiquette guidelines.
|
||||||
|
For more details, please read the
|
||||||
|
[Mozilla Community Participation Guidelines](https://www.mozilla.org/about/governance/policies/participation/).
|
||||||
|
|
||||||
|
## How to Report
|
||||||
|
For more information on how to report violations of the Community Participation Guidelines, please read our '[How to Report](https://www.mozilla.org/about/governance/policies/participation/reporting/)' page.
|
||||||
|
|
||||||
|
<!--
|
||||||
|
## Project Specific Etiquette
|
||||||
|
|
||||||
|
In some cases, there will be additional project etiquette i.e.: (https://bugzilla.mozilla.org/page.cgi?id=etiquette.html).
|
||||||
|
Please update for your project.
|
||||||
|
-->
|
||||||
453
ChangeLog.md
453
ChangeLog.md
@@ -1,3 +1,419 @@
|
|||||||
|
2.0.5
|
||||||
|
=====
|
||||||
|
|
||||||
|
### Significant changes relative to 2.0.4:
|
||||||
|
|
||||||
|
1. Worked around issues in the MIPS DSPr2 SIMD extensions that caused failures
|
||||||
|
in the libjpeg-turbo regression tests. Specifically, the
|
||||||
|
`jsimd_h2v1_downsample_dspr2()` and `jsimd_h2v2_downsample_dspr2()` functions
|
||||||
|
in the MIPS DSPr2 SIMD extensions are now disabled until/unless they can be
|
||||||
|
fixed, and other functions that are incompatible with big endian MIPS CPUs are
|
||||||
|
disabled when building libjpeg-turbo for such CPUs.
|
||||||
|
|
||||||
|
2. Fixed an oversight in the `TJCompressor.compress(int)` method in the
|
||||||
|
TurboJPEG Java API that caused an error ("java.lang.IllegalStateException: No
|
||||||
|
source image is associated with this instance") when attempting to use that
|
||||||
|
method to compress a YUV image.
|
||||||
|
|
||||||
|
3. Fixed an issue (CVE-2020-13790) in the PPM reader that caused a buffer
|
||||||
|
overrun in cjpeg, TJBench, or the `tjLoadImage()` function if one of the values
|
||||||
|
in a binary PPM/PGM input file exceeded the maximum value defined in the file's
|
||||||
|
header and that maximum value was less than 255. libjpeg-turbo 1.5.0 already
|
||||||
|
included a similar fix for binary PPM/PGM files with maximum values greater
|
||||||
|
than 255.
|
||||||
|
|
||||||
|
4. The TurboJPEG API library's global error handler, which is used in functions
|
||||||
|
such as `tjBufSize()` and `tjLoadImage()` that do not require a TurboJPEG
|
||||||
|
instance handle, is now thread-safe on platforms that support thread-local
|
||||||
|
storage.
|
||||||
|
|
||||||
|
|
||||||
|
2.0.4
|
||||||
|
=====
|
||||||
|
|
||||||
|
### Significant changes relative to 2.0.3:
|
||||||
|
|
||||||
|
1. Fixed a regression in the Windows packaging system (introduced by
|
||||||
|
2.0 beta1[2]) whereby, if both the 64-bit libjpeg-turbo SDK for GCC and the
|
||||||
|
64-bit libjpeg-turbo SDK for Visual C++ were installed on the same system, only
|
||||||
|
one of them could be uninstalled.
|
||||||
|
|
||||||
|
2. Fixed a signed integer overflow and subsequent segfault that occurred when
|
||||||
|
attempting to decompress images with more than 715827882 pixels using the
|
||||||
|
64-bit C version of TJBench.
|
||||||
|
|
||||||
|
3. Fixed out-of-bounds write in `tjDecompressToYUV2()` and
|
||||||
|
`tjDecompressToYUVPlanes()` (sometimes manifesting as a double free) that
|
||||||
|
occurred when attempting to decompress grayscale JPEG images that were
|
||||||
|
compressed with a sampling factor other than 1 (for instance, with
|
||||||
|
`cjpeg -grayscale -sample 2x2`).
|
||||||
|
|
||||||
|
4. Fixed a regression introduced by 2.0.2[5] that caused the TurboJPEG API to
|
||||||
|
incorrectly identify some JPEG images with unusual sampling factors as 4:4:4
|
||||||
|
JPEG images. This was known to cause a buffer overflow when attempting to
|
||||||
|
decompress some such images using `tjDecompressToYUV2()` or
|
||||||
|
`tjDecompressToYUVPlanes()`.
|
||||||
|
|
||||||
|
5. Fixed an issue, detected by ASan, whereby attempting to losslessly transform
|
||||||
|
a specially-crafted malformed JPEG image containing an extremely-high-frequency
|
||||||
|
coefficient block (junk image data that could never be generated by a
|
||||||
|
legitimate JPEG compressor) could cause the Huffman encoder's local buffer to
|
||||||
|
be overrun. (Refer to 1.4.0[9] and 1.4beta1[15].) Given that the buffer
|
||||||
|
overrun was fully contained within the stack and did not cause a segfault or
|
||||||
|
other user-visible errant behavior, and given that the lossless transformer
|
||||||
|
(unlike the decompressor) is not generally exposed to arbitrary data exploits,
|
||||||
|
this issue did not likely pose a security risk.
|
||||||
|
|
||||||
|
6. The ARM 64-bit (ARMv8) NEON SIMD assembly code now stores constants in a
|
||||||
|
separate read-only data section rather than in the text section, to support
|
||||||
|
execute-only memory layouts.
|
||||||
|
|
||||||
|
|
||||||
|
2.0.3
|
||||||
|
=====
|
||||||
|
|
||||||
|
### Significant changes relative to 2.0.2:
|
||||||
|
|
||||||
|
1. Fixed "using JNI after critical get" errors that occurred on Android
|
||||||
|
platforms when passing invalid arguments to certain methods in the TurboJPEG
|
||||||
|
Java API.
|
||||||
|
|
||||||
|
2. Fixed a regression in the SIMD feature detection code, introduced by
|
||||||
|
the AVX2 SIMD extensions (2.0 beta1[1]), that was known to cause an illegal
|
||||||
|
instruction exception, in rare cases, on CPUs that lack support for CPUID leaf
|
||||||
|
07H (or on which the maximum CPUID leaf has been limited by way of a BIOS
|
||||||
|
setting.)
|
||||||
|
|
||||||
|
3. The 4:4:0 (h1v2) fancy (smooth) chroma upsampling algorithm in the
|
||||||
|
decompressor now uses a similar bias pattern to that of the 4:2:2 (h2v1) fancy
|
||||||
|
chroma upsampling algorithm, rounding up or down the upsampled result for
|
||||||
|
alternate pixels rather than always rounding down. This ensures that,
|
||||||
|
regardless of whether a 4:2:2 JPEG image is rotated or transposed prior to
|
||||||
|
decompression (in the frequency domain) or after decompression (in the spatial
|
||||||
|
domain), the final image will be similar.
|
||||||
|
|
||||||
|
4. Fixed an integer overflow and subsequent segfault that occurred when
|
||||||
|
attempting to compress or decompress images with more than 1 billion pixels
|
||||||
|
using the TurboJPEG API.
|
||||||
|
|
||||||
|
5. Fixed a regression introduced by 2.0 beta1[15] whereby attempting to
|
||||||
|
generate a progressive JPEG image on an SSE2-capable CPU using a scan script
|
||||||
|
containing one or more scans with lengths divisible by 16 would result in an
|
||||||
|
error ("Missing Huffman code table entry") and an invalid JPEG image.
|
||||||
|
|
||||||
|
6. Fixed an issue whereby `tjDecodeYUV()` and `tjDecodeYUVPlanes()` would throw
|
||||||
|
an error ("Invalid progressive parameters") or a warning ("Inconsistent
|
||||||
|
progression sequence") if passed a TurboJPEG instance that was previously used
|
||||||
|
to decompress a progressive JPEG image.
|
||||||
|
|
||||||
|
|
||||||
|
2.0.2
|
||||||
|
=====
|
||||||
|
|
||||||
|
### Significant changes relative to 2.0.1:
|
||||||
|
|
||||||
|
1. Fixed a regression introduced by 2.0.1[5] that prevented a runtime search
|
||||||
|
path (rpath) from being embedded in the libjpeg-turbo shared libraries and
|
||||||
|
executables for macOS and iOS. This caused a fatal error of the form
|
||||||
|
"dyld: Library not loaded" when attempting to use one of the executables,
|
||||||
|
unless `DYLD_LIBRARY_PATH` was explicitly set to the location of the
|
||||||
|
libjpeg-turbo shared libraries.
|
||||||
|
|
||||||
|
2. Fixed an integer overflow and subsequent segfault (CVE-2018-20330) that
|
||||||
|
occurred when attempting to load a BMP file with more than 1 billion pixels
|
||||||
|
using the `tjLoadImage()` function.
|
||||||
|
|
||||||
|
3. Fixed a buffer overrun (CVE-2018-19664) that occurred when attempting to
|
||||||
|
decompress a specially-crafted malformed JPEG image to a 256-color BMP using
|
||||||
|
djpeg.
|
||||||
|
|
||||||
|
4. Fixed a floating point exception that occurred when attempting to
|
||||||
|
decompress a specially-crafted malformed JPEG image with a specified image
|
||||||
|
width or height of 0 using the C version of TJBench.
|
||||||
|
|
||||||
|
5. The TurboJPEG API will now decompress 4:4:4 JPEG images with 2x1, 1x2, 3x1,
|
||||||
|
or 1x3 luminance and chrominance sampling factors. This is a non-standard way
|
||||||
|
of specifying 1x subsampling (normally 4:4:4 JPEGs have 1x1 luminance and
|
||||||
|
chrominance sampling factors), but the JPEG format and the libjpeg API both
|
||||||
|
allow it.
|
||||||
|
|
||||||
|
6. Fixed a regression introduced by 2.0 beta1[7] that caused djpeg to generate
|
||||||
|
incorrect PPM images when used with the `-colors` option.
|
||||||
|
|
||||||
|
7. Fixed an issue whereby a static build of libjpeg-turbo (a build in which
|
||||||
|
`ENABLE_SHARED` is `0`) could not be installed using the Visual Studio IDE.
|
||||||
|
|
||||||
|
8. Fixed a severe performance issue in the Loongson MMI SIMD extensions that
|
||||||
|
occurred when compressing RGB images whose image rows were not 64-bit-aligned.
|
||||||
|
|
||||||
|
|
||||||
|
2.0.1
|
||||||
|
=====
|
||||||
|
|
||||||
|
### Significant changes relative to 2.0.0:
|
||||||
|
|
||||||
|
1. Fixed a regression introduced with the new CMake-based Un*x build system,
|
||||||
|
whereby jconfig.h could cause compiler warnings of the form
|
||||||
|
`"HAVE_*_H" redefined` if it was included by downstream Autotools-based
|
||||||
|
projects that used `AC_CHECK_HEADERS()` to check for the existence of locale.h,
|
||||||
|
stddef.h, or stdlib.h.
|
||||||
|
|
||||||
|
2. The `jsimd_quantize_float_dspr2()` and `jsimd_convsamp_float_dspr2()`
|
||||||
|
functions in the MIPS DSPr2 SIMD extensions are now disabled at compile time
|
||||||
|
if the soft float ABI is enabled. Those functions use instructions that are
|
||||||
|
incompatible with the soft float ABI.
|
||||||
|
|
||||||
|
3. Fixed a regression in the SIMD feature detection code, introduced by
|
||||||
|
the AVX2 SIMD extensions (2.0 beta1[1]), that caused libjpeg-turbo to crash on
|
||||||
|
Windows 7 if Service Pack 1 was not installed.
|
||||||
|
|
||||||
|
4. Fixed out-of-bounds read in cjpeg that occurred when attempting to compress
|
||||||
|
a specially-crafted malformed color-index (8-bit-per-sample) Targa file in
|
||||||
|
which some of the samples (color indices) exceeded the bounds of the Targa
|
||||||
|
file's color table.
|
||||||
|
|
||||||
|
5. Fixed an issue whereby installing a fully static build of libjpeg-turbo
|
||||||
|
(a build in which `CFLAGS` contains `-static` and `ENABLE_SHARED` is `0`) would
|
||||||
|
fail with "No valid ELF RPATH or RUNPATH entry exists in the file."
|
||||||
|
|
||||||
|
|
||||||
|
2.0.0
|
||||||
|
=====
|
||||||
|
|
||||||
|
### Significant changes relative to 2.0 beta1:
|
||||||
|
|
||||||
|
1. The TurboJPEG API can now decompress CMYK JPEG images that have subsampled M
|
||||||
|
and Y components (not to be confused with YCCK JPEG images, in which the C/M/Y
|
||||||
|
components have been transformed into luma and chroma.) Previously, an error
|
||||||
|
was generated ("Could not determine subsampling type for JPEG image") when such
|
||||||
|
an image was passed to `tjDecompressHeader3()`, `tjTransform()`,
|
||||||
|
`tjDecompressToYUVPlanes()`, `tjDecompressToYUV2()`, or the equivalent Java
|
||||||
|
methods.
|
||||||
|
|
||||||
|
2. Fixed an issue (CVE-2018-11813) whereby a specially-crafted malformed input
|
||||||
|
file (specifically, a file with a valid Targa header but incomplete pixel data)
|
||||||
|
would cause cjpeg to generate a JPEG file that was potentially thousands of
|
||||||
|
times larger than the input file. The Targa reader in cjpeg was not properly
|
||||||
|
detecting that the end of the input file had been reached prematurely, so after
|
||||||
|
all valid pixels had been read from the input, the reader injected dummy pixels
|
||||||
|
with values of 255 into the JPEG compressor until the number of pixels
|
||||||
|
specified in the Targa header had been compressed. The Targa reader in cjpeg
|
||||||
|
now behaves like the PPM reader and aborts compression if the end of the input
|
||||||
|
file is reached prematurely. Because this issue only affected cjpeg and not
|
||||||
|
the underlying library, and because it did not involve any out-of-bounds reads
|
||||||
|
or other exploitable behaviors, it was not believed to represent a security
|
||||||
|
threat.
|
||||||
|
|
||||||
|
3. Fixed an issue whereby the `tjLoadImage()` and `tjSaveImage()` functions
|
||||||
|
would produce a "Bogus message code" error message if the underlying bitmap and
|
||||||
|
PPM readers/writers threw an error that was specific to the readers/writers
|
||||||
|
(as opposed to a general libjpeg API error.)
|
||||||
|
|
||||||
|
4. Fixed an issue (CVE-2018-1152) whereby a specially-crafted malformed BMP
|
||||||
|
file, one in which the header specified an image width of 1073741824 pixels,
|
||||||
|
would trigger a floating point exception (division by zero) in the
|
||||||
|
`tjLoadImage()` function when attempting to load the BMP file into a
|
||||||
|
4-component image buffer.
|
||||||
|
|
||||||
|
5. Fixed an issue whereby certain combinations of calls to
|
||||||
|
`jpeg_skip_scanlines()` and `jpeg_read_scanlines()` could trigger an infinite
|
||||||
|
loop when decompressing progressive JPEG images that use vertical chroma
|
||||||
|
subsampling (for instance, 4:2:0 or 4:4:0.)
|
||||||
|
|
||||||
|
6. Fixed a segfault in `jpeg_skip_scanlines()` that occurred when decompressing
|
||||||
|
a 4:2:2 or 4:2:0 JPEG image using the merged (non-fancy) upsampling algorithms
|
||||||
|
(that is, when setting `cinfo.do_fancy_upsampling` to `FALSE`.)
|
||||||
|
|
||||||
|
7. The new CMake-based build system will now disable the MIPS DSPr2 SIMD
|
||||||
|
extensions if it detects that the compiler does not support DSPr2 instructions.
|
||||||
|
|
||||||
|
8. Fixed out-of-bounds read in cjpeg (CVE-2018-14498) that occurred when
|
||||||
|
attempting to compress a specially-crafted malformed color-index
|
||||||
|
(8-bit-per-sample) BMP file in which some of the samples (color indices)
|
||||||
|
exceeded the bounds of the BMP file's color table.
|
||||||
|
|
||||||
|
9. Fixed a signed integer overflow in the progressive Huffman decoder, detected
|
||||||
|
by the Clang and GCC undefined behavior sanitizers, that could be triggered by
|
||||||
|
attempting to decompress a specially-crafted malformed JPEG image. This issue
|
||||||
|
did not pose a security threat, but removing the warning made it easier to
|
||||||
|
detect actual security issues, should they arise in the future.
|
||||||
|
|
||||||
|
|
||||||
|
1.5.90 (2.0 beta1)
|
||||||
|
==================
|
||||||
|
|
||||||
|
### Significant changes relative to 1.5.3:
|
||||||
|
|
||||||
|
1. Added AVX2 SIMD implementations of the colorspace conversion, chroma
|
||||||
|
downsampling and upsampling, integer quantization and sample conversion, and
|
||||||
|
slow integer DCT/IDCT algorithms. When using the slow integer DCT/IDCT
|
||||||
|
algorithms on AVX2-equipped CPUs, the compression of RGB images is
|
||||||
|
approximately 13-36% (avg. 22%) faster (relative to libjpeg-turbo 1.5.x) with
|
||||||
|
64-bit code and 11-21% (avg. 17%) faster with 32-bit code, and the
|
||||||
|
decompression of RGB images is approximately 9-35% (avg. 17%) faster with
|
||||||
|
64-bit code and 7-17% (avg. 12%) faster with 32-bit code. (As tested on a
|
||||||
|
3 GHz Intel Core i7. Actual mileage may vary.)
|
||||||
|
|
||||||
|
2. Overhauled the build system to use CMake on all platforms, and removed the
|
||||||
|
autotools-based build system. This decision resulted from extensive
|
||||||
|
discussions within the libjpeg-turbo community. libjpeg-turbo traditionally
|
||||||
|
used CMake only for Windows builds, but there was an increasing amount of
|
||||||
|
demand to extend CMake support to other platforms. However, because of the
|
||||||
|
unique nature of our code base (the need to support different assemblers on
|
||||||
|
each platform, the need for Java support, etc.), providing dual build systems
|
||||||
|
as other OSS imaging libraries do (including libpng and libtiff) would have
|
||||||
|
created a maintenance burden. The use of CMake greatly simplifies some aspects
|
||||||
|
of our build system, owing to CMake's built-in support for various assemblers,
|
||||||
|
Java, and unit testing, as well as generally fewer quirks that have to be
|
||||||
|
worked around in order to implement our packaging system. Eliminating
|
||||||
|
autotools puts our project slightly at odds with the traditional practices of
|
||||||
|
the OSS community, since most "system libraries" tend to be built with
|
||||||
|
autotools, but it is believed that the benefits of this move outweigh the
|
||||||
|
risks. In addition to providing a unified build environment, switching to
|
||||||
|
CMake allows for the use of various build tools and IDEs that aren't supported
|
||||||
|
under autotools, including XCode, Ninja, and Eclipse. It also eliminates the
|
||||||
|
need to install autotools via MacPorts/Homebrew on OS X and allows
|
||||||
|
libjpeg-turbo to be configured without the use of a terminal/command prompt.
|
||||||
|
Extensive testing was conducted to ensure that all features provided by the
|
||||||
|
autotools-based build system are provided by the new build system.
|
||||||
|
|
||||||
|
3. The libjpeg API in this version of libjpeg-turbo now includes two additional
|
||||||
|
functions, `jpeg_read_icc_profile()` and `jpeg_write_icc_profile()`, that can
|
||||||
|
be used to extract ICC profile data from a JPEG file while decompressing or to
|
||||||
|
embed ICC profile data in a JPEG file while compressing or transforming. This
|
||||||
|
eliminates the need for downstream projects, such as color management libraries
|
||||||
|
and browsers, to include their own glueware for accomplishing this.
|
||||||
|
|
||||||
|
4. Improved error handling in the TurboJPEG API library:
|
||||||
|
|
||||||
|
- Introduced a new function (`tjGetErrorStr2()`) in the TurboJPEG C API
|
||||||
|
that allows compression/decompression/transform error messages to be retrieved
|
||||||
|
in a thread-safe manner. Retrieving error messages from global functions, such
|
||||||
|
as `tjInitCompress()` or `tjBufSize()`, is still thread-unsafe, but since those
|
||||||
|
functions will only throw errors if passed an invalid argument or if a memory
|
||||||
|
allocation failure occurs, thread safety is not as much of a concern.
|
||||||
|
- Introduced a new function (`tjGetErrorCode()`) in the TurboJPEG C API
|
||||||
|
and a new method (`TJException.getErrorCode()`) in the TurboJPEG Java API that
|
||||||
|
can be used to determine the severity of the last
|
||||||
|
compression/decompression/transform error. This allows applications to
|
||||||
|
choose whether to ignore warnings (non-fatal errors) from the underlying
|
||||||
|
libjpeg API or to treat them as fatal.
|
||||||
|
- Introduced a new flag (`TJFLAG_STOPONWARNING` in the TurboJPEG C API and
|
||||||
|
`TJ.FLAG_STOPONWARNING` in the TurboJPEG Java API) that causes the library to
|
||||||
|
immediately halt a compression/decompression/transform operation if it
|
||||||
|
encounters a warning from the underlying libjpeg API (the default behavior is
|
||||||
|
to allow the operation to complete unless a fatal error is encountered.)
|
||||||
|
|
||||||
|
5. Introduced a new flag in the TurboJPEG C and Java APIs (`TJFLAG_PROGRESSIVE`
|
||||||
|
and `TJ.FLAG_PROGRESSIVE`, respectively) that causes the library to use
|
||||||
|
progressive entropy coding in JPEG images generated by compression and
|
||||||
|
transform operations. Additionally, a new transform option
|
||||||
|
(`TJXOPT_PROGRESSIVE` in the C API and `TJTransform.OPT_PROGRESSIVE` in the
|
||||||
|
Java API) has been introduced, allowing progressive entropy coding to be
|
||||||
|
enabled for selected transforms in a multi-transform operation.
|
||||||
|
|
||||||
|
6. Introduced a new transform option in the TurboJPEG API (`TJXOPT_COPYNONE` in
|
||||||
|
the C API and `TJTransform.OPT_COPYNONE` in the Java API) that allows the
|
||||||
|
copying of markers (including EXIF and ICC profile data) to be disabled for a
|
||||||
|
particular transform.
|
||||||
|
|
||||||
|
7. Added two functions to the TurboJPEG C API (`tjLoadImage()` and
|
||||||
|
`tjSaveImage()`) that can be used to load/save a BMP or PPM/PGM image to/from a
|
||||||
|
memory buffer with a specified pixel format and layout. These functions
|
||||||
|
replace the project-private (and slow) bmp API, which was previously used by
|
||||||
|
TJBench, and they also provide a convenient way for first-time users of
|
||||||
|
libjpeg-turbo to quickly develop a complete JPEG compression/decompression
|
||||||
|
program.
|
||||||
|
|
||||||
|
8. The TurboJPEG C API now includes a new convenience array (`tjAlphaOffset[]`)
|
||||||
|
that contains the alpha component index for each pixel format (or -1 if the
|
||||||
|
pixel format lacks an alpha component.) The TurboJPEG Java API now includes a
|
||||||
|
new method (`TJ.getAlphaOffset()`) that returns the same value. In addition,
|
||||||
|
the `tjRedOffset[]`, `tjGreenOffset[]`, and `tjBlueOffset[]` arrays-- and the
|
||||||
|
corresponding `TJ.getRedOffset()`, `TJ.getGreenOffset()`, and
|
||||||
|
`TJ.getBlueOffset()` methods-- now return -1 for `TJPF_GRAY`/`TJ.PF_GRAY`
|
||||||
|
rather than 0. This allows programs to easily determine whether a pixel format
|
||||||
|
has red, green, blue, and alpha components.
|
||||||
|
|
||||||
|
9. Added a new example (tjexample.c) that demonstrates the basic usage of the
|
||||||
|
TurboJPEG C API. This example mirrors the functionality of TJExample.java.
|
||||||
|
Both files are now included in the libjpeg-turbo documentation.
|
||||||
|
|
||||||
|
10. Fixed two signed integer overflows in the arithmetic decoder, detected by
|
||||||
|
the Clang undefined behavior sanitizer, that could be triggered by attempting
|
||||||
|
to decompress a specially-crafted malformed JPEG image. These issues did not
|
||||||
|
pose a security threat, but removing the warnings makes it easier to detect
|
||||||
|
actual security issues, should they arise in the future.
|
||||||
|
|
||||||
|
11. Fixed a bug in the merged 4:2:0 upsampling/dithered RGB565 color conversion
|
||||||
|
algorithm that caused incorrect dithering in the output image. This algorithm
|
||||||
|
now produces bitwise-identical results to the unmerged algorithms.
|
||||||
|
|
||||||
|
12. The SIMD function symbols for x86[-64]/ELF, MIPS/ELF, macOS/x86[-64] (if
|
||||||
|
libjpeg-turbo is built with YASM), and iOS/ARM[64] builds are now private.
|
||||||
|
This prevents those symbols from being exposed in applications or shared
|
||||||
|
libraries that link statically with libjpeg-turbo.
|
||||||
|
|
||||||
|
13. Added Loongson MMI SIMD implementations of the RGB-to-YCbCr and
|
||||||
|
YCbCr-to-RGB colorspace conversion, 4:2:0 chroma downsampling, 4:2:0 fancy
|
||||||
|
chroma upsampling, integer quantization, and slow integer DCT/IDCT algorithms.
|
||||||
|
When using the slow integer DCT/IDCT, this speeds up the compression of RGB
|
||||||
|
images by approximately 70-100% and the decompression of RGB images by
|
||||||
|
approximately 2-3.5x.
|
||||||
|
|
||||||
|
14. Fixed a build error when building with older MinGW releases (regression
|
||||||
|
caused by 1.5.1[7].)
|
||||||
|
|
||||||
|
15. Added SIMD acceleration for progressive Huffman encoding on SSE2-capable
|
||||||
|
x86 and x86-64 platforms. This speeds up the compression of full-color
|
||||||
|
progressive JPEGs by about 85-90% on average (relative to libjpeg-turbo 1.5.x)
|
||||||
|
when using modern Intel and AMD CPUs.
|
||||||
|
|
||||||
|
|
||||||
|
1.5.3
|
||||||
|
=====
|
||||||
|
|
||||||
|
### Significant changes relative to 1.5.2:
|
||||||
|
|
||||||
|
1. Fixed a NullPointerException in the TurboJPEG Java wrapper that occurred
|
||||||
|
when using the YUVImage constructor that creates an instance backed by separate
|
||||||
|
image planes and allocates memory for the image planes.
|
||||||
|
|
||||||
|
2. Fixed an issue whereby the Java version of TJUnitTest would fail when
|
||||||
|
testing BufferedImage encoding/decoding on big endian systems.
|
||||||
|
|
||||||
|
3. Fixed a segfault in djpeg that would occur if an output format other than
|
||||||
|
PPM/PGM was selected along with the `-crop` option. The `-crop` option now
|
||||||
|
works with the GIF and Targa formats as well (unfortunately, it cannot be made
|
||||||
|
to work with the BMP and RLE formats due to the fact that those output engines
|
||||||
|
write scanlines in bottom-up order.) djpeg will now exit gracefully if an
|
||||||
|
output format other than PPM/PGM, GIF, or Targa is selected along with the
|
||||||
|
`-crop` option.
|
||||||
|
|
||||||
|
4. Fixed an issue (CVE-2017-15232) whereby `jpeg_skip_scanlines()` would
|
||||||
|
segfault if color quantization was enabled.
|
||||||
|
|
||||||
|
5. TJBench (both C and Java versions) will now display usage information if any
|
||||||
|
command-line argument is unrecognized. This prevents the program from silently
|
||||||
|
ignoring typos.
|
||||||
|
|
||||||
|
6. Fixed an access violation in tjbench.exe (Windows) that occurred when the
|
||||||
|
program was used to decompress an existing JPEG image.
|
||||||
|
|
||||||
|
7. Fixed an ArrayIndexOutOfBoundsException in the TJExample Java program that
|
||||||
|
occurred when attempting to decompress a JPEG image that had been compressed
|
||||||
|
with 4:1:1 chrominance subsampling.
|
||||||
|
|
||||||
|
8. Fixed an issue whereby, when using `jpeg_skip_scanlines()` to skip to the
|
||||||
|
end of a single-scan (non-progressive) image, subsequent calls to
|
||||||
|
`jpeg_consume_input()` would return `JPEG_SUSPENDED` rather than
|
||||||
|
`JPEG_REACHED_EOI`.
|
||||||
|
|
||||||
|
9. `jpeg_crop_scanlines()` now works correctly when decompressing grayscale
|
||||||
|
JPEG images that were compressed with a sampling factor other than 1 (for
|
||||||
|
instance, with `cjpeg -grayscale -sample 2x2`).
|
||||||
|
|
||||||
|
|
||||||
1.5.2
|
1.5.2
|
||||||
=====
|
=====
|
||||||
|
|
||||||
@@ -130,8 +546,8 @@ specified.)
|
|||||||
2x2 luminance sampling factors and 2x1 or 1x2 chrominance sampling factors.
|
2x2 luminance sampling factors and 2x1 or 1x2 chrominance sampling factors.
|
||||||
This is a non-standard way of specifying 2x subsampling (normally 4:2:2 JPEGs
|
This is a non-standard way of specifying 2x subsampling (normally 4:2:2 JPEGs
|
||||||
have 2x1 luminance and 1x1 chrominance sampling factors, and 4:4:0 JPEGs have
|
have 2x1 luminance and 1x1 chrominance sampling factors, and 4:4:0 JPEGs have
|
||||||
1x2 luminance and 1x1 chrominance sampling factors), but the JPEG specification
|
1x2 luminance and 1x1 chrominance sampling factors), but the JPEG format and
|
||||||
and the libjpeg API both allow it.
|
the libjpeg API both allow it.
|
||||||
|
|
||||||
7. Fixed an unsigned integer overflow in the libjpeg memory manager, detected
|
7. Fixed an unsigned integer overflow in the libjpeg memory manager, detected
|
||||||
by the Clang undefined behavior sanitizer, that could be triggered by
|
by the Clang undefined behavior sanitizer, that could be triggered by
|
||||||
@@ -176,10 +592,10 @@ application was linked against.
|
|||||||
|
|
||||||
3. Fixed a couple of issues in the PPM reader that would cause buffer overruns
|
3. Fixed a couple of issues in the PPM reader that would cause buffer overruns
|
||||||
in cjpeg if one of the values in a binary PPM/PGM input file exceeded the
|
in cjpeg if one of the values in a binary PPM/PGM input file exceeded the
|
||||||
maximum value defined in the file's header. libjpeg-turbo 1.4.2 already
|
maximum value defined in the file's header and that maximum value was greater
|
||||||
included a similar fix for ASCII PPM/PGM files. Note that these issues were
|
than 255. libjpeg-turbo 1.4.2 already included a similar fix for ASCII PPM/PGM
|
||||||
not security bugs, since they were confined to the cjpeg program and did not
|
files. Note that these issues were not security bugs, since they were confined
|
||||||
affect any of the libjpeg-turbo libraries.
|
to the cjpeg program and did not affect any of the libjpeg-turbo libraries.
|
||||||
|
|
||||||
4. Fixed an issue whereby attempting to decompress a JPEG file with a corrupt
|
4. Fixed an issue whereby attempting to decompress a JPEG file with a corrupt
|
||||||
header using the `tjDecompressToYUV2()` function would cause the function to
|
header using the `tjDecompressToYUV2()` function would cause the function to
|
||||||
@@ -602,13 +1018,13 @@ and IDCT algorithms (both are used during JPEG decompression.) For unknown
|
|||||||
reasons (probably related to clang), this code cannot currently be compiled for
|
reasons (probably related to clang), this code cannot currently be compiled for
|
||||||
iOS.
|
iOS.
|
||||||
|
|
||||||
15. Fixed an extremely rare bug that could cause the Huffman encoder's local
|
15. Fixed an extremely rare bug (CVE-2014-9092) that could cause the Huffman
|
||||||
buffer to overrun when a very high-frequency MCU is compressed using quality
|
encoder's local buffer to overrun when a very high-frequency MCU is compressed
|
||||||
100 and no subsampling, and when the JPEG output buffer is being dynamically
|
using quality 100 and no subsampling, and when the JPEG output buffer is being
|
||||||
resized by the destination manager. This issue was so rare that, even with a
|
dynamically resized by the destination manager. This issue was so rare that,
|
||||||
test program specifically designed to make the bug occur (by injecting random
|
even with a test program specifically designed to make the bug occur (by
|
||||||
high-frequency YUV data into the compressor), it was reproducible only once in
|
injecting random high-frequency YUV data into the compressor), it was
|
||||||
about every 25 million iterations.
|
reproducible only once in about every 25 million iterations.
|
||||||
|
|
||||||
16. Fixed an oversight in the TurboJPEG C wrapper: if any of the JPEG
|
16. Fixed an oversight in the TurboJPEG C wrapper: if any of the JPEG
|
||||||
compression functions was called repeatedly with the same
|
compression functions was called repeatedly with the same
|
||||||
@@ -643,8 +1059,9 @@ entropy coding (by passing arguments of `-progressive -arithmetic` to cjpeg or
|
|||||||
jpegtran, for instance) would result in an error, `Requested feature was
|
jpegtran, for instance) would result in an error, `Requested feature was
|
||||||
omitted at compile time`.
|
omitted at compile time`.
|
||||||
|
|
||||||
4. Fixed a couple of issues whereby malformed JPEG images would cause
|
4. Fixed a couple of issues (CVE-2013-6629 and CVE-2013-6630) whereby malformed
|
||||||
libjpeg-turbo to use uninitialized memory during decompression.
|
JPEG images would cause libjpeg-turbo to use uninitialized memory during
|
||||||
|
decompression.
|
||||||
|
|
||||||
5. Fixed an error (`Buffer passed to JPEG library is too small`) that occurred
|
5. Fixed an error (`Buffer passed to JPEG library is too small`) that occurred
|
||||||
when calling the TurboJPEG YUV encoding function with a very small (< 5x5)
|
when calling the TurboJPEG YUV encoding function with a very small (< 5x5)
|
||||||
@@ -783,9 +1200,9 @@ correct behavior of the colorspace extensions when merged upsampling is used.
|
|||||||
upper 64 bits of xmm6 and xmm7 on Win64 platforms, which violated the Win64
|
upper 64 bits of xmm6 and xmm7 on Win64 platforms, which violated the Win64
|
||||||
calling conventions.
|
calling conventions.
|
||||||
|
|
||||||
4. Fixed a regression caused by 1.2.0[6] whereby decompressing corrupt JPEG
|
4. Fixed a regression (CVE-2012-2806) caused by 1.2.0[6] whereby decompressing
|
||||||
images (specifically, images in which the component count was erroneously set
|
corrupt JPEG images (specifically, images in which the component count was
|
||||||
to a large value) would cause libjpeg-turbo to segfault.
|
erroneously set to a large value) would cause libjpeg-turbo to segfault.
|
||||||
|
|
||||||
5. Worked around a severe performance issue with "Bobcat" (AMD Embedded APU)
|
5. Worked around a severe performance issue with "Bobcat" (AMD Embedded APU)
|
||||||
processors. The `MASKMOVDQU` instruction, which was used by the libjpeg-turbo
|
processors. The `MASKMOVDQU` instruction, which was used by the libjpeg-turbo
|
||||||
|
|||||||
39
LICENSE.md
39
LICENSE.md
@@ -11,9 +11,10 @@ libjpeg-turbo is covered by three compatible BSD-style open source licenses:
|
|||||||
|
|
||||||
- The Modified (3-clause) BSD License, which is listed below
|
- The Modified (3-clause) BSD License, which is listed below
|
||||||
|
|
||||||
This license covers the TurboJPEG API library and associated programs.
|
This license covers the TurboJPEG API library and associated programs, as
|
||||||
|
well as the build system.
|
||||||
|
|
||||||
- The zlib License, which is listed below
|
- The [zlib License](https://opensource.org/licenses/Zlib)
|
||||||
|
|
||||||
This license is a subset of the other two, and it covers the libjpeg-turbo
|
This license is a subset of the other two, and it covers the libjpeg-turbo
|
||||||
SIMD extensions.
|
SIMD extensions.
|
||||||
@@ -65,7 +66,7 @@ best of our understanding.
|
|||||||
|
|
||||||
2. If your binary distribution includes or uses the TurboJPEG API, then
|
2. If your binary distribution includes or uses the TurboJPEG API, then
|
||||||
your product documentation must include the text of the Modified BSD
|
your product documentation must include the text of the Modified BSD
|
||||||
License.
|
License (see below.)
|
||||||
|
|
||||||
**Origin**
|
**Origin**
|
||||||
- Clause 2 of the Modified BSD License
|
- Clause 2 of the Modified BSD License
|
||||||
@@ -90,7 +91,8 @@ best of our understanding.
|
|||||||
The Modified (3-clause) BSD License
|
The Modified (3-clause) BSD License
|
||||||
===================================
|
===================================
|
||||||
|
|
||||||
Copyright (C)\<YEAR\> \<AUTHOR\>. All Rights Reserved.
|
Copyright (C)2009-2020 D. R. Commander. All Rights Reserved.
|
||||||
|
Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions are met:
|
modification, are permitted provided that the following conditions are met:
|
||||||
@@ -117,23 +119,14 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|||||||
POSSIBILITY OF SUCH DAMAGE.
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
|
||||||
The zlib License
|
Why Three Licenses?
|
||||||
================
|
===================
|
||||||
|
|
||||||
Copyright (C) \<YEAR\>, \<AUTHOR\>.
|
The zlib License could have been used instead of the Modified (3-clause) BSD
|
||||||
|
License, and since the IJG License effectively subsumes the distribution
|
||||||
This software is provided 'as-is', without any express or implied
|
conditions of the zlib License, this would have effectively placed
|
||||||
warranty. In no event will the authors be held liable for any damages
|
libjpeg-turbo binary distributions under the IJG License. However, the IJG
|
||||||
arising from the use of this software.
|
License specifically refers to the Independent JPEG Group and does not extend
|
||||||
|
attribution and endorsement protections to other entities. Thus, it was
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
desirable to choose a license that granted us the same protections for new code
|
||||||
including commercial applications, and to alter it and redistribute it
|
that were granted to the IJG for code derived from their software.
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
|
|||||||
806
Makefile.am
806
Makefile.am
@@ -1,806 +0,0 @@
|
|||||||
lib_LTLIBRARIES = libjpeg.la
|
|
||||||
libjpeg_la_LDFLAGS = -version-info ${LIBTOOL_CURRENT}:${SO_MINOR_VERSION}:${SO_AGE} -no-undefined
|
|
||||||
include_HEADERS = jerror.h jmorecfg.h jpeglib.h
|
|
||||||
|
|
||||||
if WITH_TURBOJPEG
|
|
||||||
lib_LTLIBRARIES += libturbojpeg.la
|
|
||||||
libturbojpeg_la_LDFLAGS = -version-info 1:0:1 -no-undefined
|
|
||||||
include_HEADERS += turbojpeg.h
|
|
||||||
endif
|
|
||||||
|
|
||||||
nodist_include_HEADERS = jconfig.h
|
|
||||||
|
|
||||||
pkgconfigdir = $(libdir)/pkgconfig
|
|
||||||
pkgconfig_DATA = pkgscripts/libjpeg.pc
|
|
||||||
if WITH_TURBOJPEG
|
|
||||||
pkgconfig_DATA += pkgscripts/libturbojpeg.pc
|
|
||||||
endif
|
|
||||||
|
|
||||||
HDRS = jchuff.h jcmaster.h jdct.h jdhuff.h jerror.h jinclude.h jmemsys.h \
|
|
||||||
jmorecfg.h jpegint.h jpeglib.h jversion.h jsimd.h jsimddct.h jpegcomp.h \
|
|
||||||
jpeg_nbits_table.h
|
|
||||||
|
|
||||||
libjpeg_la_SOURCES = $(HDRS) jcapimin.c jcapistd.c jccoefct.c jccolor.c \
|
|
||||||
jcdctmgr.c jcext.c jchuff.c jcinit.c jcmainct.c jcmarker.c \
|
|
||||||
jcmaster.c jcomapi.c jcparam.c jcphuff.c jcprepct.c jcsample.c \
|
|
||||||
jctrans.c jdapimin.c jdapistd.c jdatadst.c jdatasrc.c jdcoefct.c \
|
|
||||||
jdcolor.c jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c \
|
|
||||||
jdmaster.c jdmerge.c jdphuff.c jdpostct.c jdsample.c jdtrans.c \
|
|
||||||
jerror.c jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c \
|
|
||||||
jidctint.c jidctred.c jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c
|
|
||||||
|
|
||||||
if WITH_ARITH
|
|
||||||
libjpeg_la_SOURCES += jaricom.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
if WITH_ARITH_ENC
|
|
||||||
libjpeg_la_SOURCES += jcarith.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
if WITH_ARITH_DEC
|
|
||||||
libjpeg_la_SOURCES += jdarith.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
SUBDIRS = java
|
|
||||||
|
|
||||||
|
|
||||||
if WITH_TURBOJPEG
|
|
||||||
|
|
||||||
libturbojpeg_la_SOURCES = $(libjpeg_la_SOURCES) turbojpeg.c turbojpeg.h \
|
|
||||||
transupp.c transupp.h jdatadst-tj.c jdatasrc-tj.c
|
|
||||||
|
|
||||||
if WITH_JAVA
|
|
||||||
|
|
||||||
libturbojpeg_la_SOURCES += turbojpeg-jni.c
|
|
||||||
libturbojpeg_la_CFLAGS = ${JNI_CFLAGS}
|
|
||||||
TJMAPFILE = turbojpeg-mapfile.jni
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
TJMAPFILE = turbojpeg-mapfile
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
libturbojpeg_la_SOURCES += $(TJMAPFILE)
|
|
||||||
|
|
||||||
if VERSION_SCRIPT
|
|
||||||
libturbojpeg_la_LDFLAGS += $(VERSION_SCRIPT_FLAG)$(srcdir)/$(TJMAPFILE)
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
if VERSION_SCRIPT
|
|
||||||
libjpeg_la_LDFLAGS += $(VERSION_SCRIPT_FLAG)libjpeg.map
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
if WITH_SIMD
|
|
||||||
|
|
||||||
SUBDIRS += simd
|
|
||||||
libjpeg_la_LIBADD = simd/libsimd.la
|
|
||||||
libturbojpeg_la_LIBADD = simd/libsimd.la
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
libjpeg_la_SOURCES += jsimd_none.c
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
bin_PROGRAMS = cjpeg djpeg jpegtran rdjpgcom wrjpgcom
|
|
||||||
noinst_PROGRAMS = jcstest jpegyuv yuvjpeg
|
|
||||||
|
|
||||||
|
|
||||||
if WITH_TURBOJPEG
|
|
||||||
|
|
||||||
bin_PROGRAMS += tjbench
|
|
||||||
|
|
||||||
noinst_PROGRAMS += tjunittest
|
|
||||||
|
|
||||||
tjbench_SOURCES = tjbench.c bmp.h bmp.c tjutil.h tjutil.c rdbmp.c rdppm.c \
|
|
||||||
wrbmp.c wrppm.c
|
|
||||||
|
|
||||||
tjbench_LDADD = libturbojpeg.la libjpeg.la -lm
|
|
||||||
|
|
||||||
tjbench_CFLAGS = -DBMP_SUPPORTED -DPPM_SUPPORTED
|
|
||||||
|
|
||||||
tjunittest_SOURCES = tjunittest.c tjutil.h tjutil.c
|
|
||||||
|
|
||||||
tjunittest_LDADD = libturbojpeg.la
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
cjpeg_SOURCES = cdjpeg.h cderror.h cdjpeg.c cjpeg.c rdgif.c rdppm.c rdswitch.c rdjpeg.c
|
|
||||||
if WITH_12BIT
|
|
||||||
else
|
|
||||||
cjpeg_SOURCES += rdbmp.c rdtarga.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
cjpeg_LDADD = libjpeg.la
|
|
||||||
|
|
||||||
cjpeg_CFLAGS = -DGIF_SUPPORTED -DPPM_SUPPORTED
|
|
||||||
if WITH_12BIT
|
|
||||||
else
|
|
||||||
cjpeg_CFLAGS += -DBMP_SUPPORTED -DTARGA_SUPPORTED
|
|
||||||
endif
|
|
||||||
|
|
||||||
if HAVE_LIBPNG
|
|
||||||
cjpeg_CFLAGS += -DPNG_SUPPORTED $(libpng_CFLAGS)
|
|
||||||
cjpeg_LDADD += $(libpng_LIBS)
|
|
||||||
cjpeg_SOURCES += rdpng.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
djpeg_SOURCES = cdjpeg.h cderror.h cdjpeg.c djpeg.c rdcolmap.c rdswitch.c \
|
|
||||||
wrgif.c wrppm.c
|
|
||||||
if WITH_12BIT
|
|
||||||
else
|
|
||||||
djpeg_SOURCES += wrbmp.c wrtarga.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
djpeg_LDADD = libjpeg.la
|
|
||||||
|
|
||||||
djpeg_CFLAGS = -DGIF_SUPPORTED -DPPM_SUPPORTED
|
|
||||||
if WITH_12BIT
|
|
||||||
else
|
|
||||||
djpeg_CFLAGS += -DBMP_SUPPORTED -DTARGA_SUPPORTED
|
|
||||||
endif
|
|
||||||
|
|
||||||
jpegtran_SOURCES = jpegtran.c rdswitch.c cdjpeg.c transupp.c transupp.h
|
|
||||||
|
|
||||||
jpegtran_LDADD = libjpeg.la
|
|
||||||
|
|
||||||
rdjpgcom_SOURCES = rdjpgcom.c
|
|
||||||
|
|
||||||
rdjpgcom_LDADD = libjpeg.la
|
|
||||||
|
|
||||||
wrjpgcom_SOURCES = wrjpgcom.c
|
|
||||||
|
|
||||||
wrjpgcom_LDADD = libjpeg.la
|
|
||||||
|
|
||||||
jcstest_SOURCES = jcstest.c
|
|
||||||
|
|
||||||
jcstest_LDADD = libjpeg.la
|
|
||||||
|
|
||||||
jpegyuv_SOURCES = jpegyuv.c
|
|
||||||
|
|
||||||
jpegyuv_LDADD = libjpeg.la
|
|
||||||
|
|
||||||
yuvjpeg_SOURCES = yuvjpeg.c
|
|
||||||
|
|
||||||
yuvjpeg_LDADD = libjpeg.la
|
|
||||||
|
|
||||||
dist_man1_MANS = cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 wrjpgcom.1
|
|
||||||
|
|
||||||
DOCS= coderules.txt jconfig.txt change.log rdrle.c wrrle.c BUILDING.md \
|
|
||||||
ChangeLog.md
|
|
||||||
|
|
||||||
dist_doc_DATA = README.ijg README.md libjpeg.txt structure.txt usage.txt \
|
|
||||||
wizard.txt LICENSE.md
|
|
||||||
|
|
||||||
exampledir = $(docdir)
|
|
||||||
dist_example_DATA = example.c
|
|
||||||
|
|
||||||
|
|
||||||
EXTRA_DIST = win release $(DOCS) testimages CMakeLists.txt \
|
|
||||||
sharedlib/CMakeLists.txt cmakescripts libjpeg.map.in doc doxygen.config \
|
|
||||||
doxygen-extra.css jccolext.c jdcolext.c jdcol565.c jdmrgext.c jdmrg565.c \
|
|
||||||
jstdhuff.c jdcoefct.h jdmainct.h jdmaster.h jdsample.h wrppm.h \
|
|
||||||
md5/CMakeLists.txt
|
|
||||||
|
|
||||||
dist-hook:
|
|
||||||
rm -rf `find $(distdir) -name .svn`
|
|
||||||
|
|
||||||
|
|
||||||
SUBDIRS += md5
|
|
||||||
|
|
||||||
if WITH_12BIT
|
|
||||||
|
|
||||||
TESTORIG = testorig12.jpg
|
|
||||||
MD5_JPEG_RGB_ISLOW = 9620f424569594bb9242b48498ad801f
|
|
||||||
MD5_PPM_RGB_ISLOW = f3301d2219783b8b3d942b7239fa50c0
|
|
||||||
MD5_JPEG_422_IFAST_OPT = 7322e3bd2f127f7de4b40d4480ce60e4
|
|
||||||
MD5_PPM_422_IFAST = 79807fa552899e66a04708f533e16950
|
|
||||||
MD5_PPM_422M_IFAST = 07737bfe8a7c1c87aaa393a0098d16b0
|
|
||||||
MD5_JPEG_420_IFAST_Q100_PROG = a1da220b5604081863a504297ed59e55
|
|
||||||
MD5_PPM_420_Q100_IFAST = 1b3730122709f53d007255e8dfd3305e
|
|
||||||
MD5_PPM_420M_Q100_IFAST = 980a1a3c5bf9510022869d30b7d26566
|
|
||||||
MD5_JPEG_GRAY_ISLOW = 235c90707b16e2e069f37c888b2636d9
|
|
||||||
MD5_PPM_GRAY_ISLOW = 7213c10af507ad467da5578ca5ee1fca
|
|
||||||
MD5_PPM_GRAY_ISLOW_RGB = e96ee81c30a6ed422d466338bd3de65d
|
|
||||||
MD5_JPEG_420S_IFAST_OPT = 7af8e60be4d9c227ec63ac9b6630855e
|
|
||||||
MD5_JPEG_3x2_FLOAT_PROG_SSE = a8c17daf77b457725ec929e215b603f8
|
|
||||||
MD5_PPM_3x2_FLOAT_SSE = 42876ab9e5c2f76a87d08db5fbd57956
|
|
||||||
MD5_JPEG_3x2_FLOAT_PROG_32BIT = a8c17daf77b457725ec929e215b603f8
|
|
||||||
MD5_PPM_3x2_FLOAT_32BIT = 42876ab9e5c2f76a87d08db5fbd57956
|
|
||||||
MD5_PPM_3x2_FLOAT_64BIT = d6fbc71153b3d8ded484dbc17c7b9cf4
|
|
||||||
MD5_JPEG_3x2_FLOAT_PROG_387 = bc6dbbefac2872f6b9d6c4a0ae60c3c0
|
|
||||||
MD5_PPM_3x2_FLOAT_387 = bcc5723c61560463ac60f772e742d092
|
|
||||||
MD5_JPEG_3x2_IFAST_PROG = 1396cc2b7185cfe943d408c9d305339e
|
|
||||||
MD5_PPM_3x2_IFAST = 3975985ef6eeb0a2cdc58daa651ccc00
|
|
||||||
MD5_PPM_420M_ISLOW_2_1 = 4ca6be2a6f326ff9eaab63e70a8259c0
|
|
||||||
MD5_PPM_420M_ISLOW_15_8 = 12aa9f9534c1b3d7ba047322226365eb
|
|
||||||
MD5_PPM_420M_ISLOW_13_8 = f7e22817c7b25e1393e4ec101e9d4e96
|
|
||||||
MD5_PPM_420M_ISLOW_11_8 = 800a16f9f4dc9b293197bfe11be10a82
|
|
||||||
MD5_PPM_420M_ISLOW_9_8 = 06b7a92a9bc69f4dc36ec40f1937d55c
|
|
||||||
MD5_PPM_420M_ISLOW_7_8 = 3ec444a14a4ab4eab88ffc49c48eca43
|
|
||||||
MD5_PPM_420M_ISLOW_3_4 = 3e726b7ea872445b19437d1c1d4f0d93
|
|
||||||
MD5_PPM_420M_ISLOW_5_8 = a8a771abdc94301d20ffac119b2caccd
|
|
||||||
MD5_PPM_420M_ISLOW_1_2 = b419124dd5568b085787234866102866
|
|
||||||
MD5_PPM_420M_ISLOW_3_8 = 343d19015531b7bbe746124127244fa8
|
|
||||||
MD5_PPM_420M_ISLOW_1_4 = 35fd59d866e44659edfa3c18db2a3edb
|
|
||||||
MD5_PPM_420M_ISLOW_1_8 = ccaed48ac0aedefda5d4abe4013f4ad7
|
|
||||||
MD5_PPM_420_ISLOW_SKIP15_31 = 86664cd9dc956536409e44e244d20a97
|
|
||||||
MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71 = 452a21656115a163029cfba5c04fa76a
|
|
||||||
MD5_PPM_444_ISLOW_SKIP1_6 = ef63901f71ef7a75cd78253fc0914f84
|
|
||||||
MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13 = 15b173fb5872d9575572fbcc1b05956f
|
|
||||||
MD5_JPEG_CROP = cdb35ff4b4519392690ea040c56ea99c
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
TESTORIG = testorig.jpg
|
|
||||||
MD5_JPEG_RGB_ISLOW = 768e970dd57b340ff1b83c9d3d47c77b
|
|
||||||
MD5_PPM_RGB_ISLOW = 00a257f5393fef8821f2b88ac7421291
|
|
||||||
MD5_BMP_RGB_ISLOW_565 = f07d2e75073e4bb10f6c6f4d36e2e3be
|
|
||||||
MD5_BMP_RGB_ISLOW_565D = 4cfa0928ef3e6bb626d7728c924cfda4
|
|
||||||
MD5_JPEG_422_IFAST_OPT = 2540287b79d913f91665e660303ab2c8
|
|
||||||
MD5_PPM_422_IFAST = 35bd6b3f833bad23de82acea847129fa
|
|
||||||
MD5_PPM_422M_IFAST = 8dbc65323d62cca7c91ba02dd1cfa81d
|
|
||||||
MD5_BMP_422M_IFAST_565 = 3294bd4d9a1f2b3d08ea6020d0db7065
|
|
||||||
MD5_BMP_422M_IFAST_565D = da98c9c7b6039511be4a79a878a9abc1
|
|
||||||
MD5_JPEG_420_IFAST_Q100_PROG = 990cbe0329c882420a2094da7e5adade
|
|
||||||
MD5_PPM_420_Q100_IFAST = 5a732542015c278ff43635e473a8a294
|
|
||||||
MD5_PPM_420M_Q100_IFAST = ff692ee9323a3b424894862557c092f1
|
|
||||||
MD5_JPEG_GRAY_ISLOW = 72b51f894b8f4a10b3ee3066770aa38d
|
|
||||||
MD5_PPM_GRAY_ISLOW = 8d3596c56eace32f205deccc229aa5ed
|
|
||||||
MD5_PPM_GRAY_ISLOW_RGB = 116424ac07b79e5e801f00508eab48ec
|
|
||||||
MD5_BMP_GRAY_ISLOW_565 = 12f78118e56a2f48b966f792fedf23cc
|
|
||||||
MD5_BMP_GRAY_ISLOW_565D = bdbbd616441a24354c98553df5dc82db
|
|
||||||
MD5_JPEG_420S_IFAST_OPT = 388708217ac46273ca33086b22827ed8
|
|
||||||
# See README.md for more details on why this next bit is necessary.
|
|
||||||
MD5_JPEG_3x2_FLOAT_PROG_SSE = 343e3f8caf8af5986ebaf0bdc13b5c71
|
|
||||||
MD5_PPM_3x2_FLOAT_SSE = 1a75f36e5904d6fc3a85a43da9ad89bb
|
|
||||||
MD5_JPEG_3x2_FLOAT_PROG_32BIT = 9bca803d2042bd1eb03819e2bf92b3e5
|
|
||||||
MD5_PPM_3x2_FLOAT_32BIT = f6bfab038438ed8f5522fbd33595dcdc
|
|
||||||
MD5_PPM_3x2_FLOAT_64BIT = 0e917a34193ef976b679a6b069b1be26
|
|
||||||
MD5_JPEG_3x2_FLOAT_PROG_387 = 1657664a410e0822c924b54f6f65e6e9
|
|
||||||
MD5_PPM_3x2_FLOAT_387 = cb0a1f027f3d2917c902b5640214e025
|
|
||||||
MD5_JPEG_3x2_IFAST_PROG = 1ee5d2c1a77f2da495f993c8c7cceca5
|
|
||||||
MD5_PPM_3x2_IFAST = fd283664b3b49127984af0a7f118fccd
|
|
||||||
MD5_JPEG_420_ISLOW_ARI = e986fb0a637a8d833d96e8a6d6d84ea1
|
|
||||||
MD5_JPEG_444_ISLOW_PROGARI = 0a8f1c8f66e113c3cf635df0a475a617
|
|
||||||
MD5_PPM_420M_IFAST_ARI = 72b59a99bcf1de24c5b27d151bde2437
|
|
||||||
MD5_JPEG_420_ISLOW = 9a68f56bc76e466aa7e52f415d0f4a5f
|
|
||||||
MD5_PPM_420M_ISLOW_2_1 = 9f9de8c0612f8d06869b960b05abf9c9
|
|
||||||
MD5_PPM_420M_ISLOW_15_8 = b6875bc070720b899566cc06459b63b7
|
|
||||||
MD5_PPM_420M_ISLOW_13_8 = bc3452573c8152f6ae552939ee19f82f
|
|
||||||
MD5_PPM_420M_ISLOW_11_8 = d8cc73c0aaacd4556569b59437ba00a5
|
|
||||||
MD5_PPM_420M_ISLOW_9_8 = d25e61bc7eac0002f5b393aa223747b6
|
|
||||||
MD5_PPM_420M_ISLOW_7_8 = ddb564b7c74a09494016d6cd7502a946
|
|
||||||
MD5_PPM_420M_ISLOW_3_4 = 8ed8e68808c3fbc4ea764fc9d2968646
|
|
||||||
MD5_PPM_420M_ISLOW_5_8 = a3363274999da2366a024efae6d16c9b
|
|
||||||
MD5_PPM_420M_ISLOW_1_2 = e692a315cea26b988c8e8b29a5dbcd81
|
|
||||||
MD5_PPM_420M_ISLOW_3_8 = 79eca9175652ced755155c90e785a996
|
|
||||||
MD5_PPM_420M_ISLOW_1_4 = 79cd778f8bf1a117690052cacdd54eca
|
|
||||||
MD5_PPM_420M_ISLOW_1_8 = 391b3d4aca640c8567d6f8745eb2142f
|
|
||||||
MD5_BMP_420_ISLOW_256 = 4980185e3776e89bd931736e1cddeee6
|
|
||||||
MD5_BMP_420_ISLOW_565 = bf9d13e16c4923b92e1faa604d7922cb
|
|
||||||
MD5_BMP_420_ISLOW_565D = 6bde71526acc44bcff76f696df8638d2
|
|
||||||
MD5_BMP_420M_ISLOW_565 = 8dc0185245353cfa32ad97027342216f
|
|
||||||
MD5_BMP_420M_ISLOW_565D =d1be3a3339166255e76fa50a0d70d73e
|
|
||||||
MD5_PPM_420_ISLOW_SKIP15_31 = c4c65c1e43d7275cd50328a61e6534f0
|
|
||||||
MD5_PPM_420_ISLOW_ARI_SKIP16_139 = 087c6b123db16ac00cb88c5b590bb74a
|
|
||||||
MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71 = 26eb36ccc7d1f0cb80cdabb0ac8b5d99
|
|
||||||
MD5_PPM_420_ISLOW_ARI_CROP53x53_4_4 = 886c6775af22370257122f8b16207e6d
|
|
||||||
MD5_PPM_444_ISLOW_SKIP1_6 = 5606f86874cf26b8fcee1117a0a436a6
|
|
||||||
MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13 = db87dc7ce26bcdc7a6b56239ce2b9d6c
|
|
||||||
MD5_PPM_444_ISLOW_ARI_CROP37x37_0_0 = cb57b32bd6d03e35432362f7bf184b6d
|
|
||||||
MD5_JPEG_CROP = b4197f377e621c4e9b1d20471432610d
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: test
|
|
||||||
test: tjquicktest tjbittest bittest
|
|
||||||
|
|
||||||
if CROSS_COMPILING
|
|
||||||
tjquicktest: testclean
|
|
||||||
else
|
|
||||||
tjquicktest: testclean all
|
|
||||||
endif
|
|
||||||
|
|
||||||
if WITH_TURBOJPEG
|
|
||||||
if WITH_JAVA
|
|
||||||
$(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest
|
|
||||||
$(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -bi
|
|
||||||
$(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -yuv
|
|
||||||
$(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -yuv -noyuvpad
|
|
||||||
$(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -yuv -bi
|
|
||||||
$(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -yuv -bi -noyuvpad
|
|
||||||
endif
|
|
||||||
./tjunittest
|
|
||||||
./tjunittest -alloc
|
|
||||||
./tjunittest -yuv
|
|
||||||
./tjunittest -yuv -alloc
|
|
||||||
./tjunittest -yuv -noyuvpad
|
|
||||||
endif
|
|
||||||
echo GREAT SUCCESS!
|
|
||||||
|
|
||||||
if CROSS_COMPILING
|
|
||||||
tjbittest: testclean
|
|
||||||
else
|
|
||||||
tjbittest: testclean all
|
|
||||||
endif
|
|
||||||
|
|
||||||
if WITH_TURBOJPEG
|
|
||||||
|
|
||||||
MD5_PPM_GRAY_TILE = 89d3ca21213d9d864b50b4e4e7de4ca6
|
|
||||||
MD5_PPM_420_8x8_TILE = 847fceab15c5b7b911cb986cf0f71de3
|
|
||||||
MD5_PPM_420_16x16_TILE = ca45552a93687e078f7137cc4126a7b0
|
|
||||||
MD5_PPM_420_32x32_TILE = d8676f1d6b68df358353bba9844f4a00
|
|
||||||
MD5_PPM_420_64x64_TILE = 4e4c1a3d7ea4bace4f868bcbe83b7050
|
|
||||||
MD5_PPM_420_128x128_TILE = f24c3429c52265832beab9df72a0ceae
|
|
||||||
MD5_PPM_420M_8x8_TILE = bc25320e1f4c31ce2e610e43e9fd173c
|
|
||||||
MD5_PPM_420M_TILE = 75ffdf14602258c5c189522af57fa605
|
|
||||||
MD5_PPM_422_8x8_TILE = d83dacd9fc73b0a6f10c09acad64eb1e
|
|
||||||
MD5_PPM_422_16x16_TILE = 35077fb610d72dd743b1eb0cbcfe10fb
|
|
||||||
MD5_PPM_422_32x32_TILE = e6902ed8a449ecc0f0d6f2bf945f65f7
|
|
||||||
MD5_PPM_422_64x64_TILE = 2b4502a8f316cedbde1da7bce3d2231e
|
|
||||||
MD5_PPM_422_128x128_TILE = f0b5617d578f5e13c8eee215d64d4877
|
|
||||||
MD5_PPM_422M_8x8_TILE = 828941d7f41cd6283abd6beffb7fd51d
|
|
||||||
MD5_PPM_422M_TILE = e877ae1324c4a280b95376f7f018172f
|
|
||||||
MD5_PPM_444_TILE = 7964e41e67cfb8d0a587c0aa4798f9c3
|
|
||||||
|
|
||||||
# Test compressing from/decompressing to an arbitrary subregion of a larger
|
|
||||||
# image buffer
|
|
||||||
cp $(srcdir)/testimages/testorig.ppm testout_tile.ppm
|
|
||||||
TJ_REVERT=1 ./tjbench testout_tile.ppm 95 -rgb -quiet -tile -benchtime 0.01 -warmup 0 >/dev/null 2>&1
|
|
||||||
for i in 8 16 32 64 128; do \
|
|
||||||
md5/md5cmp $(MD5_PPM_GRAY_TILE) testout_tile_GRAY_Q95_$$i\x$$i.ppm; \
|
|
||||||
done
|
|
||||||
md5/md5cmp $(MD5_PPM_420_8x8_TILE) testout_tile_420_Q95_8x8.ppm
|
|
||||||
md5/md5cmp $(MD5_PPM_420_16x16_TILE) testout_tile_420_Q95_16x16.ppm
|
|
||||||
md5/md5cmp $(MD5_PPM_420_32x32_TILE) testout_tile_420_Q95_32x32.ppm
|
|
||||||
md5/md5cmp $(MD5_PPM_420_64x64_TILE) testout_tile_420_Q95_64x64.ppm
|
|
||||||
md5/md5cmp $(MD5_PPM_420_128x128_TILE) testout_tile_420_Q95_128x128.ppm
|
|
||||||
md5/md5cmp $(MD5_PPM_422_8x8_TILE) testout_tile_422_Q95_8x8.ppm
|
|
||||||
md5/md5cmp $(MD5_PPM_422_16x16_TILE) testout_tile_422_Q95_16x16.ppm
|
|
||||||
md5/md5cmp $(MD5_PPM_422_32x32_TILE) testout_tile_422_Q95_32x32.ppm
|
|
||||||
md5/md5cmp $(MD5_PPM_422_64x64_TILE) testout_tile_422_Q95_64x64.ppm
|
|
||||||
md5/md5cmp $(MD5_PPM_422_128x128_TILE) testout_tile_422_Q95_128x128.ppm
|
|
||||||
for i in 8 16 32 64 128; do \
|
|
||||||
md5/md5cmp $(MD5_PPM_444_TILE) testout_tile_444_Q95_$$i\x$$i.ppm; \
|
|
||||||
done
|
|
||||||
rm -f testout_tile_GRAY_* testout_tile_420_* testout_tile_422_* testout_tile_444_*
|
|
||||||
|
|
||||||
TJ_REVERT=1 ./tjbench testout_tile.ppm 95 -rgb -fastupsample -quiet -tile -benchtime 0.01 -warmup 0 >/dev/null 2>&1
|
|
||||||
md5/md5cmp $(MD5_PPM_420M_8x8_TILE) testout_tile_420_Q95_8x8.ppm
|
|
||||||
for i in 16 32 64 128; do \
|
|
||||||
md5/md5cmp $(MD5_PPM_420M_TILE) testout_tile_420_Q95_$$i\x$$i.ppm; \
|
|
||||||
done
|
|
||||||
md5/md5cmp $(MD5_PPM_422M_8x8_TILE) testout_tile_422_Q95_8x8.ppm
|
|
||||||
for i in 16 32 64 128; do \
|
|
||||||
md5/md5cmp $(MD5_PPM_422M_TILE) testout_tile_422_Q95_$$i\x$$i.ppm; \
|
|
||||||
done
|
|
||||||
rm -f testout_tile_GRAY_* testout_tile_420_* testout_tile_422_* testout_tile_444_* testout_tile.ppm
|
|
||||||
echo GREAT SUCCESS!
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
if CROSS_COMPILING
|
|
||||||
bittest: testclean
|
|
||||||
else
|
|
||||||
bittest: testclean all
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These tests are carefully crafted to provide full coverage of as many of the
|
|
||||||
# underlying algorithms as possible (including all of the SIMD-accelerated
|
|
||||||
# ones.)
|
|
||||||
|
|
||||||
# CC: null SAMP: fullsize FDCT: islow ENT: huff
|
|
||||||
./cjpeg -revert -rgb -dct int -outfile testout_rgb_islow.jpg $(srcdir)/testimages/testorig.ppm
|
|
||||||
md5/md5cmp $(MD5_JPEG_RGB_ISLOW) testout_rgb_islow.jpg
|
|
||||||
# CC: null SAMP: fullsize IDCT: islow ENT: huff
|
|
||||||
./djpeg -dct int -ppm -outfile testout_rgb_islow.ppm testout_rgb_islow.jpg
|
|
||||||
md5/md5cmp $(MD5_PPM_RGB_ISLOW) testout_rgb_islow.ppm
|
|
||||||
rm -f testout_rgb_islow.ppm
|
|
||||||
if WITH_12BIT
|
|
||||||
rm -f testout_rgb_islow.jpg
|
|
||||||
else
|
|
||||||
# CC: RGB->RGB565 SAMP: fullsize IDCT: islow ENT: huff
|
|
||||||
./djpeg -dct int -rgb565 -dither none -bmp -outfile testout_rgb_islow_565.bmp testout_rgb_islow.jpg
|
|
||||||
md5/md5cmp $(MD5_BMP_RGB_ISLOW_565) testout_rgb_islow_565.bmp
|
|
||||||
rm -f testout_rgb_islow_565.bmp
|
|
||||||
# CC: RGB->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff
|
|
||||||
./djpeg -dct int -rgb565 -bmp -outfile testout_rgb_islow_565D.bmp testout_rgb_islow.jpg
|
|
||||||
md5/md5cmp $(MD5_BMP_RGB_ISLOW_565D) testout_rgb_islow_565D.bmp
|
|
||||||
rm -f testout_rgb_islow_565D.bmp testout_rgb_islow.jpg
|
|
||||||
endif
|
|
||||||
|
|
||||||
# CC: RGB->YCC SAMP: fullsize/h2v1 FDCT: ifast ENT: 2-pass huff
|
|
||||||
./cjpeg -revert -sample 2x1 -dct fast -opt -outfile testout_422_ifast_opt.jpg $(srcdir)/testimages/testorig.ppm
|
|
||||||
md5/md5cmp $(MD5_JPEG_422_IFAST_OPT) testout_422_ifast_opt.jpg
|
|
||||||
# CC: YCC->RGB SAMP: fullsize/h2v1 fancy IDCT: ifast ENT: huff
|
|
||||||
./djpeg -dct fast -outfile testout_422_ifast.ppm testout_422_ifast_opt.jpg
|
|
||||||
md5/md5cmp $(MD5_PPM_422_IFAST) testout_422_ifast.ppm
|
|
||||||
rm -f testout_422_ifast.ppm
|
|
||||||
# CC: YCC->RGB SAMP: h2v1 merged IDCT: ifast ENT: huff
|
|
||||||
./djpeg -dct fast -nosmooth -outfile testout_422m_ifast.ppm testout_422_ifast_opt.jpg
|
|
||||||
md5/md5cmp $(MD5_PPM_422M_IFAST) testout_422m_ifast.ppm
|
|
||||||
rm -f testout_422m_ifast.ppm
|
|
||||||
if WITH_12BIT
|
|
||||||
rm -f testout_422_ifast_opt.jpg
|
|
||||||
else
|
|
||||||
# CC: YCC->RGB565 SAMP: h2v1 merged IDCT: ifast ENT: huff
|
|
||||||
./djpeg -dct int -nosmooth -rgb565 -dither none -bmp -outfile testout_422m_ifast_565.bmp testout_422_ifast_opt.jpg
|
|
||||||
md5/md5cmp $(MD5_BMP_422M_IFAST_565) testout_422m_ifast_565.bmp
|
|
||||||
rm -f testout_422m_ifast_565.bmp
|
|
||||||
# CC: YCC->RGB565 (dithered) SAMP: h2v1 merged IDCT: ifast ENT: huff
|
|
||||||
./djpeg -dct int -nosmooth -rgb565 -bmp -outfile testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg
|
|
||||||
md5/md5cmp $(MD5_BMP_422M_IFAST_565D) testout_422m_ifast_565D.bmp
|
|
||||||
rm -f testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg
|
|
||||||
endif
|
|
||||||
|
|
||||||
# CC: RGB->YCC SAMP: fullsize/h2v2 FDCT: ifast ENT: prog huff
|
|
||||||
./cjpeg -revert -sample 2x2 -quality 100 -dct fast -prog -outfile testout_420_q100_ifast_prog.jpg $(srcdir)/testimages/testorig.ppm
|
|
||||||
md5/md5cmp $(MD5_JPEG_420_IFAST_Q100_PROG) testout_420_q100_ifast_prog.jpg
|
|
||||||
# CC: YCC->RGB SAMP: fullsize/h2v2 fancy IDCT: ifast ENT: prog huff
|
|
||||||
./djpeg -dct fast -outfile testout_420_q100_ifast.ppm testout_420_q100_ifast_prog.jpg
|
|
||||||
md5/md5cmp $(MD5_PPM_420_Q100_IFAST) testout_420_q100_ifast.ppm
|
|
||||||
rm -f testout_420_q100_ifast.ppm
|
|
||||||
# CC: YCC->RGB SAMP: h2v2 merged IDCT: ifast ENT: prog huff
|
|
||||||
./djpeg -dct fast -nosmooth -outfile testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg
|
|
||||||
md5/md5cmp $(MD5_PPM_420M_Q100_IFAST) testout_420m_q100_ifast.ppm
|
|
||||||
rm -f testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg
|
|
||||||
|
|
||||||
# CC: RGB->Gray SAMP: fullsize FDCT: islow ENT: huff
|
|
||||||
./cjpeg -revert -gray -dct int -outfile testout_gray_islow.jpg $(srcdir)/testimages/testorig.ppm
|
|
||||||
md5/md5cmp $(MD5_JPEG_GRAY_ISLOW) testout_gray_islow.jpg
|
|
||||||
# CC: Gray->Gray SAMP: fullsize IDCT: islow ENT: huff
|
|
||||||
./djpeg -dct int -outfile testout_gray_islow.ppm testout_gray_islow.jpg
|
|
||||||
md5/md5cmp $(MD5_PPM_GRAY_ISLOW) testout_gray_islow.ppm
|
|
||||||
rm -f testout_gray_islow.ppm
|
|
||||||
# CC: Gray->RGB SAMP: fullsize IDCT: islow ENT: huff
|
|
||||||
./djpeg -dct int -rgb -outfile testout_gray_islow_rgb.ppm testout_gray_islow.jpg
|
|
||||||
md5/md5cmp $(MD5_PPM_GRAY_ISLOW_RGB) testout_gray_islow_rgb.ppm
|
|
||||||
rm -f testout_gray_islow_rgb.ppm
|
|
||||||
if WITH_12BIT
|
|
||||||
rm -f testout_gray_islow.jpg
|
|
||||||
else
|
|
||||||
# CC: Gray->RGB565 SAMP: fullsize IDCT: islow ENT: huff
|
|
||||||
./djpeg -dct int -rgb565 -dither none -bmp -outfile testout_gray_islow_565.bmp testout_gray_islow.jpg
|
|
||||||
md5/md5cmp $(MD5_BMP_GRAY_ISLOW_565) testout_gray_islow_565.bmp
|
|
||||||
rm -f testout_gray_islow_565.bmp
|
|
||||||
# CC: Gray->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff
|
|
||||||
./djpeg -dct int -rgb565 -bmp -outfile testout_gray_islow_565D.bmp testout_gray_islow.jpg
|
|
||||||
md5/md5cmp $(MD5_BMP_GRAY_ISLOW_565D) testout_gray_islow_565D.bmp
|
|
||||||
rm -f testout_gray_islow_565D.bmp testout_gray_islow.jpg
|
|
||||||
endif
|
|
||||||
|
|
||||||
# CC: RGB->YCC SAMP: fullsize smooth/h2v2 smooth FDCT: islow
|
|
||||||
# ENT: 2-pass huff
|
|
||||||
./cjpeg -revert -sample 2x2 -smooth 1 -dct int -opt -outfile testout_420s_ifast_opt.jpg $(srcdir)/testimages/testorig.ppm
|
|
||||||
md5/md5cmp $(MD5_JPEG_420S_IFAST_OPT) testout_420s_ifast_opt.jpg
|
|
||||||
rm -f testout_420s_ifast_opt.jpg
|
|
||||||
|
|
||||||
# The output of the floating point tests is not validated by default, because
|
|
||||||
# the output differs depending on the type of floating point math used, and
|
|
||||||
# this is only deterministic if the DCT/IDCT are implemented using SIMD
|
|
||||||
# instructions on a particular platform. Pass one of the following on the make
|
|
||||||
# command line to validate the floating point tests against one of the expected
|
|
||||||
# results:
|
|
||||||
#
|
|
||||||
# FLOATTEST=sse validate against the expected results from the libjpeg-turbo
|
|
||||||
# SSE SIMD extensions
|
|
||||||
# FLOATTEST=32bit validate against the expected results from the C code
|
|
||||||
# when running on a 32-bit FPU (or when SSE is being used for
|
|
||||||
# floating point math, which is generally the default with
|
|
||||||
# x86-64 compilers)
|
|
||||||
# FLOATTEST=64bit validate against the exepected results from the C code
|
|
||||||
# when running on a 64-bit FPU
|
|
||||||
# FLOATTEST=387 validate against the expected results from the C code when
|
|
||||||
# the 387 FPU is being used for floating point math (which is
|
|
||||||
# generally the default with x86 compilers)
|
|
||||||
|
|
||||||
# CC: RGB->YCC SAMP: fullsize/int FDCT: float ENT: prog huff
|
|
||||||
./cjpeg -revert -sample 3x2 -dct float -prog -outfile testout_3x2_float_prog.jpg $(srcdir)/testimages/testorig.ppm
|
|
||||||
if [ "${FLOATTEST}" = "sse" ]; then \
|
|
||||||
md5/md5cmp $(MD5_JPEG_3x2_FLOAT_PROG_SSE) testout_3x2_float_prog.jpg; \
|
|
||||||
elif [ "${FLOATTEST}" = "32bit" -o "${FLOATTEST}" = "64bit" ]; then \
|
|
||||||
md5/md5cmp $(MD5_JPEG_3x2_FLOAT_PROG_32BIT) testout_3x2_float_prog.jpg; \
|
|
||||||
elif [ "${FLOATTEST}" = "387" ]; then \
|
|
||||||
md5/md5cmp $(MD5_JPEG_3x2_FLOAT_PROG_387) testout_3x2_float_prog.jpg; \
|
|
||||||
fi
|
|
||||||
# CC: YCC->RGB SAMP: fullsize/int IDCT: float ENT: prog huff
|
|
||||||
./djpeg -dct float -outfile testout_3x2_float.ppm testout_3x2_float_prog.jpg
|
|
||||||
if [ "${FLOATTEST}" = "sse" ]; then \
|
|
||||||
md5/md5cmp $(MD5_PPM_3x2_FLOAT_SSE) testout_3x2_float.ppm; \
|
|
||||||
elif [ "${FLOATTEST}" = "32bit" ]; then \
|
|
||||||
md5/md5cmp $(MD5_PPM_3x2_FLOAT_32BIT) testout_3x2_float.ppm; \
|
|
||||||
elif [ "${FLOATTEST}" = "64bit" ]; then \
|
|
||||||
md5/md5cmp $(MD5_PPM_3x2_FLOAT_64BIT) testout_3x2_float.ppm; \
|
|
||||||
elif [ "${FLOATTEST}" = "387" ]; then \
|
|
||||||
md5/md5cmp $(MD5_PPM_3x2_FLOAT_387) testout_3x2_float.ppm; \
|
|
||||||
fi
|
|
||||||
rm -f testout_3x2_float.ppm testout_3x2_float_prog.jpg
|
|
||||||
|
|
||||||
# CC: RGB->YCC SAMP: fullsize/int FDCT: ifast ENT: prog huff
|
|
||||||
./cjpeg -revert -sample 3x2 -dct fast -prog -outfile testout_3x2_ifast_prog.jpg $(srcdir)/testimages/testorig.ppm
|
|
||||||
md5/md5cmp $(MD5_JPEG_3x2_IFAST_PROG) testout_3x2_ifast_prog.jpg
|
|
||||||
# CC: YCC->RGB SAMP: fullsize/int IDCT: ifast ENT: prog huff
|
|
||||||
./djpeg -dct fast -outfile testout_3x2_ifast.ppm testout_3x2_ifast_prog.jpg
|
|
||||||
md5/md5cmp $(MD5_PPM_3x2_IFAST) testout_3x2_ifast.ppm
|
|
||||||
rm -f testout_3x2_ifast.ppm testout_3x2_ifast_prog.jpg
|
|
||||||
|
|
||||||
if WITH_ARITH_ENC
|
|
||||||
# CC: YCC->RGB SAMP: fullsize/h2v2 FDCT: islow ENT: arith
|
|
||||||
./cjpeg -revert -dct int -arithmetic -outfile testout_420_islow_ari.jpg $(srcdir)/testimages/testorig.ppm
|
|
||||||
md5/md5cmp $(MD5_JPEG_420_ISLOW_ARI) testout_420_islow_ari.jpg
|
|
||||||
rm -f testout_420_islow_ari.jpg
|
|
||||||
./jpegtran -revert -arithmetic -outfile testout_420_islow_ari.jpg $(srcdir)/testimages/testimgint.jpg
|
|
||||||
md5/md5cmp $(MD5_JPEG_420_ISLOW_ARI) testout_420_islow_ari.jpg
|
|
||||||
rm -f testout_420_islow_ari.jpg
|
|
||||||
# CC: YCC->RGB SAMP: fullsize FDCT: islow ENT: prog arith
|
|
||||||
./cjpeg -revert -sample 1x1 -dct int -prog -arithmetic -outfile testout_444_islow_progari.jpg $(srcdir)/testimages/testorig.ppm
|
|
||||||
md5/md5cmp $(MD5_JPEG_444_ISLOW_PROGARI) testout_444_islow_progari.jpg
|
|
||||||
rm -f testout_444_islow_progari.jpg
|
|
||||||
endif
|
|
||||||
if WITH_ARITH_DEC
|
|
||||||
# CC: RGB->YCC SAMP: h2v2 merged IDCT: ifast ENT: arith
|
|
||||||
./djpeg -fast -ppm -outfile testout_420m_ifast_ari.ppm $(srcdir)/testimages/testimgari.jpg
|
|
||||||
md5/md5cmp $(MD5_PPM_420M_IFAST_ARI) testout_420m_ifast_ari.ppm
|
|
||||||
rm -f testout_420m_ifast_ari.ppm
|
|
||||||
./jpegtran -revert -outfile testout_420_islow.jpg $(srcdir)/testimages/testimgari.jpg
|
|
||||||
md5/md5cmp $(MD5_JPEG_420_ISLOW) testout_420_islow.jpg
|
|
||||||
rm -f testout_420_islow.jpg
|
|
||||||
endif
|
|
||||||
|
|
||||||
# CC: YCC->RGB SAMP: h2v2 merged IDCT: 16x16 islow ENT: huff
|
|
||||||
./djpeg -dct int -scale 2/1 -nosmooth -ppm -outfile testout_420m_islow_2_1.ppm $(srcdir)/testimages/$(TESTORIG)
|
|
||||||
md5/md5cmp $(MD5_PPM_420M_ISLOW_2_1) testout_420m_islow_2_1.ppm
|
|
||||||
rm -f testout_420m_islow_2_1.ppm
|
|
||||||
# CC: YCC->RGB SAMP: h2v2 merged IDCT: 15x15 islow ENT: huff
|
|
||||||
./djpeg -dct int -scale 15/8 -nosmooth -ppm -outfile testout_420m_islow_15_8.ppm $(srcdir)/testimages/$(TESTORIG)
|
|
||||||
md5/md5cmp $(MD5_PPM_420M_ISLOW_15_8) testout_420m_islow_15_8.ppm
|
|
||||||
rm -f testout_420m_islow_15_8.ppm
|
|
||||||
# CC: YCC->RGB SAMP: h2v2 merged IDCT: 13x13 islow ENT: huff
|
|
||||||
./djpeg -dct int -scale 13/8 -nosmooth -ppm -outfile testout_420m_islow_13_8.ppm $(srcdir)/testimages/$(TESTORIG)
|
|
||||||
md5/md5cmp $(MD5_PPM_420M_ISLOW_13_8) testout_420m_islow_13_8.ppm
|
|
||||||
rm -f testout_420m_islow_13_8.ppm
|
|
||||||
# CC: YCC->RGB SAMP: h2v2 merged IDCT: 11x11 islow ENT: huff
|
|
||||||
./djpeg -dct int -scale 11/8 -nosmooth -ppm -outfile testout_420m_islow_11_8.ppm $(srcdir)/testimages/$(TESTORIG)
|
|
||||||
md5/md5cmp $(MD5_PPM_420M_ISLOW_11_8) testout_420m_islow_11_8.ppm
|
|
||||||
rm -f testout_420m_islow_11_8.ppm
|
|
||||||
# CC: YCC->RGB SAMP: h2v2 merged IDCT: 9x9 islow ENT: huff
|
|
||||||
./djpeg -dct int -scale 9/8 -nosmooth -ppm -outfile testout_420m_islow_9_8.ppm $(srcdir)/testimages/$(TESTORIG)
|
|
||||||
md5/md5cmp $(MD5_PPM_420M_ISLOW_9_8) testout_420m_islow_9_8.ppm
|
|
||||||
rm -f testout_420m_islow_9_8.ppm
|
|
||||||
# CC: YCC->RGB SAMP: h2v2 merged IDCT: 7x7 islow/14x14 islow ENT: huff
|
|
||||||
./djpeg -dct int -scale 7/8 -nosmooth -ppm -outfile testout_420m_islow_7_8.ppm $(srcdir)/testimages/$(TESTORIG)
|
|
||||||
md5/md5cmp $(MD5_PPM_420M_ISLOW_7_8) testout_420m_islow_7_8.ppm
|
|
||||||
rm -f testout_420m_islow_7_8.ppm
|
|
||||||
# CC: YCC->RGB SAMP: h2v2 merged IDCT: 6x6 islow/12x12 islow ENT: huff
|
|
||||||
./djpeg -dct int -scale 3/4 -nosmooth -ppm -outfile testout_420m_islow_3_4.ppm $(srcdir)/testimages/$(TESTORIG)
|
|
||||||
md5/md5cmp $(MD5_PPM_420M_ISLOW_3_4) testout_420m_islow_3_4.ppm
|
|
||||||
rm -f testout_420m_islow_3_4.ppm
|
|
||||||
# CC: YCC->RGB SAMP: h2v2 merged IDCT: 5x5 islow/10x10 islow ENT: huff
|
|
||||||
./djpeg -dct int -scale 5/8 -nosmooth -ppm -outfile testout_420m_islow_5_8.ppm $(srcdir)/testimages/$(TESTORIG)
|
|
||||||
md5/md5cmp $(MD5_PPM_420M_ISLOW_5_8) testout_420m_islow_5_8.ppm
|
|
||||||
rm -f testout_420m_islow_5_8.ppm
|
|
||||||
# CC: YCC->RGB SAMP: h2v2 merged IDCT: 4x4 islow/8x8 islow ENT: huff
|
|
||||||
./djpeg -dct int -scale 1/2 -nosmooth -ppm -outfile testout_420m_islow_1_2.ppm $(srcdir)/testimages/$(TESTORIG)
|
|
||||||
md5/md5cmp $(MD5_PPM_420M_ISLOW_1_2) testout_420m_islow_1_2.ppm
|
|
||||||
rm -f testout_420m_islow_1_2.ppm
|
|
||||||
# CC: YCC->RGB SAMP: h2v2 merged IDCT: 3x3 islow/6x6 islow ENT: huff
|
|
||||||
./djpeg -dct int -scale 3/8 -nosmooth -ppm -outfile testout_420m_islow_3_8.ppm $(srcdir)/testimages/$(TESTORIG)
|
|
||||||
md5/md5cmp $(MD5_PPM_420M_ISLOW_3_8) testout_420m_islow_3_8.ppm
|
|
||||||
rm -f testout_420m_islow_3_8.ppm
|
|
||||||
# CC: YCC->RGB SAMP: h2v2 merged IDCT: 2x2 islow/4x4 islow ENT: huff
|
|
||||||
./djpeg -dct int -scale 1/4 -nosmooth -ppm -outfile testout_420m_islow_1_4.ppm $(srcdir)/testimages/$(TESTORIG)
|
|
||||||
md5/md5cmp $(MD5_PPM_420M_ISLOW_1_4) testout_420m_islow_1_4.ppm
|
|
||||||
rm -f testout_420m_islow_1_4.ppm
|
|
||||||
# CC: YCC->RGB SAMP: h2v2 merged IDCT: 1x1 islow/2x2 islow ENT: huff
|
|
||||||
./djpeg -dct int -scale 1/8 -nosmooth -ppm -outfile testout_420m_islow_1_8.ppm $(srcdir)/testimages/$(TESTORIG)
|
|
||||||
md5/md5cmp $(MD5_PPM_420M_ISLOW_1_8) testout_420m_islow_1_8.ppm
|
|
||||||
rm -f testout_420m_islow_1_8.ppm
|
|
||||||
if WITH_12BIT
|
|
||||||
else
|
|
||||||
# CC: YCC->RGB (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff
|
|
||||||
./djpeg -dct int -colors 256 -bmp -outfile testout_420_islow_256.bmp $(srcdir)/testimages/$(TESTORIG)
|
|
||||||
md5/md5cmp $(MD5_BMP_420_ISLOW_256) testout_420_islow_256.bmp
|
|
||||||
rm -f testout_420_islow_256.bmp
|
|
||||||
# CC: YCC->RGB565 SAMP: h2v2 fancy IDCT: islow ENT: huff
|
|
||||||
./djpeg -dct int -rgb565 -dither none -bmp -outfile testout_420_islow_565.bmp $(srcdir)/testimages/$(TESTORIG)
|
|
||||||
md5/md5cmp $(MD5_BMP_420_ISLOW_565) testout_420_islow_565.bmp
|
|
||||||
rm -f testout_420_islow_565.bmp
|
|
||||||
# CC: YCC->RGB565 (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff
|
|
||||||
./djpeg -dct int -rgb565 -bmp -outfile testout_420_islow_565D.bmp $(srcdir)/testimages/$(TESTORIG)
|
|
||||||
md5/md5cmp $(MD5_BMP_420_ISLOW_565D) testout_420_islow_565D.bmp
|
|
||||||
rm -f testout_420_islow_565D.bmp
|
|
||||||
# CC: YCC->RGB565 SAMP: h2v2 merged IDCT: islow ENT: huff
|
|
||||||
./djpeg -dct int -nosmooth -rgb565 -dither none -bmp -outfile testout_420m_islow_565.bmp $(srcdir)/testimages/$(TESTORIG)
|
|
||||||
md5/md5cmp $(MD5_BMP_420M_ISLOW_565) testout_420m_islow_565.bmp
|
|
||||||
rm -f testout_420m_islow_565.bmp
|
|
||||||
# CC: YCC->RGB565 (dithered) SAMP: h2v2 merged IDCT: islow ENT: huff
|
|
||||||
./djpeg -dct int -nosmooth -rgb565 -bmp -outfile testout_420m_islow_565D.bmp $(srcdir)/testimages/$(TESTORIG)
|
|
||||||
md5/md5cmp $(MD5_BMP_420M_ISLOW_565D) testout_420m_islow_565D.bmp
|
|
||||||
rm -f testout_420m_islow_565D.bmp
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Partial decode tests. These tests are designed to cover all of the possible
|
|
||||||
# code paths in jpeg_skip_scanlines().
|
|
||||||
|
|
||||||
# Context rows: Yes Intra-iMCU row: Yes iMCU row prefetch: No ENT: huff
|
|
||||||
./djpeg -dct int -skip 15,31 -ppm -outfile testout_420_islow_skip15,31.ppm $(srcdir)/testimages/$(TESTORIG)
|
|
||||||
md5/md5cmp $(MD5_PPM_420_ISLOW_SKIP15_31) testout_420_islow_skip15,31.ppm
|
|
||||||
rm -f testout_420_islow_skip15,31.ppm
|
|
||||||
# Context rows: Yes Intra-iMCU row: No iMCU row prefetch: Yes ENT: arith
|
|
||||||
if WITH_ARITH_DEC
|
|
||||||
./djpeg -dct int -skip 16,139 -ppm -outfile testout_420_islow_ari_skip16,139.ppm $(srcdir)/testimages/testimgari.jpg
|
|
||||||
md5/md5cmp $(MD5_PPM_420_ISLOW_ARI_SKIP16_139) testout_420_islow_ari_skip16,139.ppm
|
|
||||||
rm -f testout_420_islow_ari_skip16,139.ppm
|
|
||||||
endif
|
|
||||||
# Context rows: Yes Intra-iMCU row: No iMCU row prefetch: No ENT: prog huff
|
|
||||||
./cjpeg -revert -dct int -prog -outfile testout_420_islow_prog.jpg $(srcdir)/testimages/testorig.ppm
|
|
||||||
./djpeg -dct int -crop 62x62+71+71 -ppm -outfile testout_420_islow_prog_crop62x62,71,71.ppm testout_420_islow_prog.jpg
|
|
||||||
md5/md5cmp $(MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71) testout_420_islow_prog_crop62x62,71,71.ppm
|
|
||||||
rm -f testout_420_islow_prog_crop62x62,71,71.ppm testout_420_islow_prog.jpg
|
|
||||||
# Context rows: Yes Intra-iMCU row: No iMCU row prefetch: No ENT: arith
|
|
||||||
if WITH_ARITH_DEC
|
|
||||||
./djpeg -dct int -crop 53x53+4+4 -ppm -outfile testout_420_islow_ari_crop53x53,4,4.ppm $(srcdir)/testimages/testimgari.jpg
|
|
||||||
md5/md5cmp $(MD5_PPM_420_ISLOW_ARI_CROP53x53_4_4) testout_420_islow_ari_crop53x53,4,4.ppm
|
|
||||||
rm -f testout_420_islow_ari_crop53x53,4,4.ppm
|
|
||||||
endif
|
|
||||||
# Context rows: No Intra-iMCU row: Yes ENT: huff
|
|
||||||
./cjpeg -revert -dct int -sample 1x1 -outfile testout_444_islow.jpg $(srcdir)/testimages/testorig.ppm
|
|
||||||
./djpeg -dct int -skip 1,6 -ppm -outfile testout_444_islow_skip1,6.ppm testout_444_islow.jpg
|
|
||||||
md5/md5cmp $(MD5_PPM_444_ISLOW_SKIP1_6) testout_444_islow_skip1,6.ppm
|
|
||||||
rm -f testout_444_islow_skip1,6.ppm testout_444_islow.jpg
|
|
||||||
# Context rows: No Intra-iMCU row: No ENT: prog huff
|
|
||||||
./cjpeg -revert -dct int -prog -sample 1x1 -outfile testout_444_islow_prog.jpg $(srcdir)/testimages/testorig.ppm
|
|
||||||
./djpeg -dct int -crop 98x98+13+13 -ppm -outfile testout_444_islow_prog_crop98x98,13,13.ppm testout_444_islow_prog.jpg
|
|
||||||
md5/md5cmp $(MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13) testout_444_islow_prog_crop98x98,13,13.ppm
|
|
||||||
rm -f testout_444_islow_prog_crop98x98,13,13.ppm testout_444_islow_prog.jpg
|
|
||||||
# Context rows: No Intra-iMCU row: No ENT: arith
|
|
||||||
if WITH_ARITH_ENC
|
|
||||||
./cjpeg -revert -dct int -arithmetic -sample 1x1 -outfile testout_444_islow_ari.jpg $(srcdir)/testimages/testorig.ppm
|
|
||||||
if WITH_ARITH_DEC
|
|
||||||
./djpeg -dct int -crop 37x37+0+0 -ppm -outfile testout_444_islow_ari_crop37x37,0,0.ppm testout_444_islow_ari.jpg
|
|
||||||
md5/md5cmp $(MD5_PPM_444_ISLOW_ARI_CROP37x37_0_0) testout_444_islow_ari_crop37x37,0,0.ppm
|
|
||||||
rm -f testout_444_islow_ari_crop37x37,0,0.ppm
|
|
||||||
endif
|
|
||||||
rm -f testout_444_islow_ari.jpg
|
|
||||||
endif
|
|
||||||
|
|
||||||
./jpegtran -revert -crop 120x90+20+50 -transpose -perfect -outfile testout_crop.jpg $(srcdir)/testimages/$(TESTORIG)
|
|
||||||
md5/md5cmp $(MD5_JPEG_CROP) testout_crop.jpg
|
|
||||||
rm -f testout_crop.jpg
|
|
||||||
echo GREAT SUCCESS!
|
|
||||||
|
|
||||||
|
|
||||||
testclean:
|
|
||||||
rm -f testout*
|
|
||||||
rm -f *_GRAY_*.bmp
|
|
||||||
rm -f *_GRAY_*.png
|
|
||||||
rm -f *_GRAY_*.ppm
|
|
||||||
rm -f *_GRAY_*.jpg
|
|
||||||
rm -f *_GRAY.yuv
|
|
||||||
rm -f *_420_*.bmp
|
|
||||||
rm -f *_420_*.png
|
|
||||||
rm -f *_420_*.ppm
|
|
||||||
rm -f *_420_*.jpg
|
|
||||||
rm -f *_420.yuv
|
|
||||||
rm -f *_422_*.bmp
|
|
||||||
rm -f *_422_*.png
|
|
||||||
rm -f *_422_*.ppm
|
|
||||||
rm -f *_422_*.jpg
|
|
||||||
rm -f *_422.yuv
|
|
||||||
rm -f *_444_*.bmp
|
|
||||||
rm -f *_444_*.png
|
|
||||||
rm -f *_444_*.ppm
|
|
||||||
rm -f *_444_*.jpg
|
|
||||||
rm -f *_444.yuv
|
|
||||||
rm -f *_440_*.bmp
|
|
||||||
rm -f *_440_*.png
|
|
||||||
rm -f *_440_*.ppm
|
|
||||||
rm -f *_440_*.jpg
|
|
||||||
rm -f *_440.yuv
|
|
||||||
rm -f *_411_*.bmp
|
|
||||||
rm -f *_411_*.png
|
|
||||||
rm -f *_411_*.ppm
|
|
||||||
rm -f *_411_*.jpg
|
|
||||||
rm -f *_411.yuv
|
|
||||||
|
|
||||||
|
|
||||||
tjtest:
|
|
||||||
sh ./tjbenchtest
|
|
||||||
sh ./tjbenchtest -alloc
|
|
||||||
sh ./tjbenchtest -yuv
|
|
||||||
sh ./tjbenchtest -yuv -alloc
|
|
||||||
if WITH_JAVA
|
|
||||||
sh ./tjbenchtest.java
|
|
||||||
sh ./tjbenchtest.java -yuv
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
pkgscripts/mozjpeg.spec: pkgscripts/mozjpeg.spec.tmpl
|
|
||||||
cat pkgscripts/mozjpeg.spec.tmpl | sed s@%{__prefix}@$(prefix)@g | \
|
|
||||||
sed s@%{__bindir}@$(bindir)@g | sed s@%{__datadir}@$(datadir)@g | \
|
|
||||||
sed s@%{__docdir}@$(docdir)@g | sed s@%{__includedir}@$(includedir)@g | \
|
|
||||||
sed s@%{__libdir}@$(libdir)@g | sed s@%{__mandir}@$(mandir)@g \
|
|
||||||
> pkgscripts/mozjpeg.spec
|
|
||||||
|
|
||||||
rpm: all pkgscripts/mozjpeg.spec
|
|
||||||
TMPDIR=`mktemp -d /tmp/${PACKAGE_NAME}-build.XXXXXX`; \
|
|
||||||
mkdir -p $$TMPDIR/RPMS; \
|
|
||||||
ln -fs `pwd` $$TMPDIR/BUILD; \
|
|
||||||
rm -f ${PKGNAME}-${VERSION}.${RPMARCH}.rpm; \
|
|
||||||
rpmbuild -bb --define "_blddir $$TMPDIR/buildroot" \
|
|
||||||
--define "_topdir $$TMPDIR" \
|
|
||||||
--target ${RPMARCH} pkgscripts/mozjpeg.spec; \
|
|
||||||
cp $$TMPDIR/RPMS/${RPMARCH}/${PKGNAME}-${VERSION}-${BUILD}.${RPMARCH}.rpm \
|
|
||||||
${PKGNAME}-${VERSION}.${RPMARCH}.rpm; \
|
|
||||||
rm -rf $$TMPDIR
|
|
||||||
|
|
||||||
srpm: dist-gzip pkgscripts/mozjpeg.spec
|
|
||||||
TMPDIR=`mktemp -d /tmp/${PACKAGE_NAME}-build.XXXXXX`; \
|
|
||||||
mkdir -p $$TMPDIR/RPMS; \
|
|
||||||
mkdir -p $$TMPDIR/SRPMS; \
|
|
||||||
mkdir -p $$TMPDIR/BUILD; \
|
|
||||||
mkdir -p $$TMPDIR/SOURCES; \
|
|
||||||
mkdir -p $$TMPDIR/SPECS; \
|
|
||||||
rm -f ${PKGNAME}-${VERSION}.src.rpm; \
|
|
||||||
cp ${PACKAGE_NAME}-${VERSION}.tar.gz $$TMPDIR/SOURCES; \
|
|
||||||
cat pkgscripts/mozjpeg.spec | sed s/%{_blddir}/%{_tmppath}/g \
|
|
||||||
| sed s/#--\>//g \
|
|
||||||
> $$TMPDIR/SPECS/mozjpeg.spec; \
|
|
||||||
rpmbuild -bs --define "_topdir $$TMPDIR" $$TMPDIR/SPECS/mozjpeg.spec; \
|
|
||||||
cp $$TMPDIR/SRPMS/${PKGNAME}-${VERSION}-${BUILD}.src.rpm \
|
|
||||||
${PKGNAME}-${VERSION}.src.rpm; \
|
|
||||||
rm -rf $$TMPDIR
|
|
||||||
|
|
||||||
pkgscripts/makedpkg: pkgscripts/makedpkg.tmpl
|
|
||||||
cat pkgscripts/makedpkg.tmpl | sed s@%{__prefix}@$(prefix)@g | \
|
|
||||||
sed s@%{__docdir}@$(docdir)@g | sed s@%{__libdir}@$(libdir)@g \
|
|
||||||
> pkgscripts/makedpkg
|
|
||||||
|
|
||||||
deb: all pkgscripts/makedpkg
|
|
||||||
sh pkgscripts/makedpkg
|
|
||||||
|
|
||||||
pkgscripts/uninstall: pkgscripts/uninstall.tmpl
|
|
||||||
cat pkgscripts/uninstall.tmpl | sed s@%{__prefix}@$(prefix)@g | \
|
|
||||||
sed s@%{__bindir}@$(bindir)@g | sed s@%{__datadir}@$(datadir)@g | \
|
|
||||||
sed s@%{__includedir}@$(includedir)@g | sed s@%{__libdir}@$(libdir)@g | \
|
|
||||||
sed s@%{__mandir}@$(mandir)@g > pkgscripts/uninstall
|
|
||||||
|
|
||||||
pkgscripts/makemacpkg: pkgscripts/makemacpkg.tmpl
|
|
||||||
cat pkgscripts/makemacpkg.tmpl | sed s@%{__prefix}@$(prefix)@g | \
|
|
||||||
sed s@%{__bindir}@$(bindir)@g | sed s@%{__docdir}@$(docdir)@g | \
|
|
||||||
sed s@%{__libdir}@$(libdir)@g > pkgscripts/makemacpkg
|
|
||||||
|
|
||||||
if X86_64
|
|
||||||
|
|
||||||
udmg: all pkgscripts/makemacpkg pkgscripts/uninstall
|
|
||||||
sh pkgscripts/makemacpkg -build32 ${BUILDDIR32}
|
|
||||||
|
|
||||||
iosdmg: all pkgscripts/makemacpkg pkgscripts/uninstall
|
|
||||||
sh pkgscripts/makemacpkg -build32 ${BUILDDIR32} -buildarmv7 ${BUILDDIRARMV7} -buildarmv7s ${BUILDDIRARMV7S} -buildarmv8 ${BUILDDIRARMV8} -lipo "${LIPO}"
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
iosdmg: all pkgscripts/makemacpkg pkgscripts/uninstall
|
|
||||||
sh pkgscripts/makemacpkg -buildarmv7 ${BUILDDIRARMV7} -buildarmv7s ${BUILDDIRARMV7S} -buildarmv8 ${BUILDDIRARMV8} -lipo "${LIPO}"
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
dmg: all pkgscripts/makemacpkg pkgscripts/uninstall
|
|
||||||
sh pkgscripts/makemacpkg
|
|
||||||
|
|
||||||
pkgscripts/makecygwinpkg: pkgscripts/makecygwinpkg.tmpl
|
|
||||||
cat pkgscripts/makecygwinpkg.tmpl | sed s@%{__prefix}@$(prefix)@g | \
|
|
||||||
sed s@%{__docdir}@$(docdir)@g | sed s@%{__libdir}@$(libdir)@g \
|
|
||||||
> pkgscripts/makecygwinpkg
|
|
||||||
|
|
||||||
cygwinpkg: all pkgscripts/makecygwinpkg
|
|
||||||
sh pkgscripts/makecygwinpkg
|
|
||||||
@@ -2,8 +2,9 @@ Background
|
|||||||
==========
|
==========
|
||||||
|
|
||||||
libjpeg-turbo is a JPEG image codec that uses SIMD instructions (MMX, SSE2,
|
libjpeg-turbo is a JPEG image codec that uses SIMD instructions (MMX, SSE2,
|
||||||
NEON, AltiVec) to accelerate baseline JPEG compression and decompression on
|
AVX2, NEON, AltiVec) to accelerate baseline JPEG compression and decompression
|
||||||
x86, x86-64, ARM, and PowerPC systems. On such systems, libjpeg-turbo is
|
on x86, x86-64, ARM, and PowerPC systems, as well as progressive JPEG
|
||||||
|
compression on x86 and x86-64 systems. On such systems, libjpeg-turbo is
|
||||||
generally 2-6x as fast as libjpeg, all else being equal. On other types of
|
generally 2-6x as fast as libjpeg, all else being equal. On other types of
|
||||||
systems, libjpeg-turbo can still outperform libjpeg by a significant amount, by
|
systems, libjpeg-turbo can still outperform libjpeg by a significant amount, by
|
||||||
virtue of its highly-optimized Huffman coding routines. In many cases, the
|
virtue of its highly-optimized Huffman coding routines. In many cases, the
|
||||||
@@ -42,21 +43,25 @@ Using libjpeg-turbo
|
|||||||
libjpeg-turbo includes two APIs that can be used to compress and decompress
|
libjpeg-turbo includes two APIs that can be used to compress and decompress
|
||||||
JPEG images:
|
JPEG images:
|
||||||
|
|
||||||
- **TurboJPEG API**
|
- **TurboJPEG API**<br>
|
||||||
This API provides an easy-to-use interface for compressing and decompressing
|
This API provides an easy-to-use interface for compressing and decompressing
|
||||||
JPEG images in memory. It also provides some functionality that would not be
|
JPEG images in memory. It also provides some functionality that would not be
|
||||||
straightforward to achieve using the underlying libjpeg API, such as
|
straightforward to achieve using the underlying libjpeg API, such as
|
||||||
generating planar YUV images and performing multiple simultaneous lossless
|
generating planar YUV images and performing multiple simultaneous lossless
|
||||||
transforms on an image. The Java interface for libjpeg-turbo is written on
|
transforms on an image. The Java interface for libjpeg-turbo is written on
|
||||||
top of the TurboJPEG API.
|
top of the TurboJPEG API. The TurboJPEG API is recommended for first-time
|
||||||
|
users of libjpeg-turbo. Refer to [tjexample.c](tjexample.c) and
|
||||||
|
[TJExample.java](java/TJExample.java) for examples of its usage and to
|
||||||
|
<http://libjpeg-turbo.org/Documentation/Documentation> for API documentation.
|
||||||
|
|
||||||
- **libjpeg API**
|
- **libjpeg API**<br>
|
||||||
This is the de facto industry-standard API for compressing and decompressing
|
This is the de facto industry-standard API for compressing and decompressing
|
||||||
JPEG images. It is more difficult to use than the TurboJPEG API but also
|
JPEG images. It is more difficult to use than the TurboJPEG API but also
|
||||||
more powerful. The libjpeg API implementation in libjpeg-turbo is both
|
more powerful. The libjpeg API implementation in libjpeg-turbo is both
|
||||||
API/ABI-compatible and mathematically compatible with libjpeg v6b. It can
|
API/ABI-compatible and mathematically compatible with libjpeg v6b. It can
|
||||||
also optionally be configured to be API/ABI-compatible with libjpeg v7 and v8
|
also optionally be configured to be API/ABI-compatible with libjpeg v7 and v8
|
||||||
(see below.)
|
(see below.) Refer to [cjpeg.c](cjpeg.c) and [djpeg.c](djpeg.c) for examples
|
||||||
|
of its usage and to [libjpeg.txt](libjpeg.txt) for API documentation.
|
||||||
|
|
||||||
There is no significant performance advantage to either API when both are used
|
There is no significant performance advantage to either API when both are used
|
||||||
to perform similar operations.
|
to perform similar operations.
|
||||||
@@ -141,17 +146,17 @@ which aren't.
|
|||||||
|
|
||||||
#### Fully supported
|
#### Fully supported
|
||||||
|
|
||||||
- **libjpeg: IDCT scaling extensions in decompressor**
|
- **libjpeg: IDCT scaling extensions in decompressor**<br>
|
||||||
libjpeg-turbo supports IDCT scaling with scaling factors of 1/8, 1/4, 3/8,
|
libjpeg-turbo supports IDCT scaling with scaling factors of 1/8, 1/4, 3/8,
|
||||||
1/2, 5/8, 3/4, 7/8, 9/8, 5/4, 11/8, 3/2, 13/8, 7/4, 15/8, and 2/1 (only 1/4
|
1/2, 5/8, 3/4, 7/8, 9/8, 5/4, 11/8, 3/2, 13/8, 7/4, 15/8, and 2/1 (only 1/4
|
||||||
and 1/2 are SIMD-accelerated.)
|
and 1/2 are SIMD-accelerated.)
|
||||||
|
|
||||||
- **libjpeg: Arithmetic coding**
|
- **libjpeg: Arithmetic coding**
|
||||||
|
|
||||||
- **libjpeg: In-memory source and destination managers**
|
- **libjpeg: In-memory source and destination managers**<br>
|
||||||
See notes below.
|
See notes below.
|
||||||
|
|
||||||
- **cjpeg: Separate quality settings for luminance and chrominance**
|
- **cjpeg: Separate quality settings for luminance and chrominance**<br>
|
||||||
Note that the libpjeg v7+ API was extended to accommodate this feature only
|
Note that the libpjeg v7+ API was extended to accommodate this feature only
|
||||||
for convenience purposes. It has always been possible to implement this
|
for convenience purposes. It has always been possible to implement this
|
||||||
feature with libjpeg v6b (see rdswitch.c for an example.)
|
feature with libjpeg v6b (see rdswitch.c for an example.)
|
||||||
@@ -180,14 +185,14 @@ means of quality improvement. The reader is invited to peruse the research at
|
|||||||
but it is the general belief of our project that these features have not
|
but it is the general belief of our project that these features have not
|
||||||
demonstrated sufficient usefulness to justify inclusion in libjpeg-turbo.
|
demonstrated sufficient usefulness to justify inclusion in libjpeg-turbo.
|
||||||
|
|
||||||
- **libjpeg: DCT scaling in compressor**
|
- **libjpeg: DCT scaling in compressor**<br>
|
||||||
`cinfo.scale_num` and `cinfo.scale_denom` are silently ignored.
|
`cinfo.scale_num` and `cinfo.scale_denom` are silently ignored.
|
||||||
There is no technical reason why DCT scaling could not be supported when
|
There is no technical reason why DCT scaling could not be supported when
|
||||||
emulating the libjpeg v7+ API/ABI, but without the SmartScale extension (see
|
emulating the libjpeg v7+ API/ABI, but without the SmartScale extension (see
|
||||||
below), only scaling factors of 1/2, 8/15, 4/7, 8/13, 2/3, 8/11, 4/5, and
|
below), only scaling factors of 1/2, 8/15, 4/7, 8/13, 2/3, 8/11, 4/5, and
|
||||||
8/9 would be available, which is of limited usefulness.
|
8/9 would be available, which is of limited usefulness.
|
||||||
|
|
||||||
- **libjpeg: SmartScale**
|
- **libjpeg: SmartScale**<br>
|
||||||
`cinfo.block_size` is silently ignored.
|
`cinfo.block_size` is silently ignored.
|
||||||
SmartScale is an extension to the JPEG format that allows for DCT block
|
SmartScale is an extension to the JPEG format that allows for DCT block
|
||||||
sizes other than 8x8. Providing support for this new format would be
|
sizes other than 8x8. Providing support for this new format would be
|
||||||
@@ -200,15 +205,15 @@ demonstrated sufficient usefulness to justify inclusion in libjpeg-turbo.
|
|||||||
interest in providing this feature would be as a means of supporting
|
interest in providing this feature would be as a means of supporting
|
||||||
additional DCT scaling factors.
|
additional DCT scaling factors.
|
||||||
|
|
||||||
- **libjpeg: Fancy downsampling in compressor**
|
- **libjpeg: Fancy downsampling in compressor**<br>
|
||||||
`cinfo.do_fancy_downsampling` is silently ignored.
|
`cinfo.do_fancy_downsampling` is silently ignored.
|
||||||
This requires the DCT scaling feature, which is not supported.
|
This requires the DCT scaling feature, which is not supported.
|
||||||
|
|
||||||
- **jpegtran: Scaling**
|
- **jpegtran: Scaling**<br>
|
||||||
This requires both the DCT scaling and SmartScale features, which are not
|
This requires both the DCT scaling and SmartScale features, which are not
|
||||||
supported.
|
supported.
|
||||||
|
|
||||||
- **Lossless RGB JPEG files**
|
- **Lossless RGB JPEG files**<br>
|
||||||
This requires the SmartScale feature, which is not supported.
|
This requires the SmartScale feature, which is not supported.
|
||||||
|
|
||||||
### What About libjpeg v9?
|
### What About libjpeg v9?
|
||||||
@@ -226,7 +231,7 @@ generally accomplish anything that can't already be accomplished better with
|
|||||||
existing, standard lossless formats. Therefore, at this time it is our belief
|
existing, standard lossless formats. Therefore, at this time it is our belief
|
||||||
that there is not sufficient technical justification for software projects to
|
that there is not sufficient technical justification for software projects to
|
||||||
upgrade from libjpeg v8 to libjpeg v9, and thus there is not sufficient
|
upgrade from libjpeg v8 to libjpeg v9, and thus there is not sufficient
|
||||||
echnical justification for us to emulate the libjpeg v9 ABI.
|
technical justification for us to emulate the libjpeg v9 ABI.
|
||||||
|
|
||||||
In-Memory Source/Destination Managers
|
In-Memory Source/Destination Managers
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
@@ -249,8 +254,8 @@ libjpeg-turbo. This will restore the pre-1.3 behavior, in which
|
|||||||
libjpeg v8 API/ABI.
|
libjpeg v8 API/ABI.
|
||||||
|
|
||||||
On Un*x systems, including the in-memory source/destination managers changes
|
On Un*x systems, including the in-memory source/destination managers changes
|
||||||
the dynamic library version from 62.0.0 to 62.1.0 if using libjpeg v6b API/ABI
|
the dynamic library version from 62.1.0 to 62.2.0 if using libjpeg v6b API/ABI
|
||||||
emulation and from 7.0.0 to 7.1.0 if using libjpeg v7 API/ABI emulation.
|
emulation and from 7.1.0 to 7.2.0 if using libjpeg v7 API/ABI emulation.
|
||||||
|
|
||||||
Note that, on most Un*x systems, the dynamic linker will not look for a
|
Note that, on most Un*x systems, the dynamic linker will not look for a
|
||||||
function in a library until that function is actually used. Thus, if a program
|
function in a library until that function is actually used. Thus, if a program
|
||||||
@@ -339,4 +344,3 @@ quality of 98-100. Thus, libjpeg-turbo must use the non-SIMD quantization
|
|||||||
function in those cases. This causes performance to drop by as much as 40%.
|
function in those cases. This causes performance to drop by as much as 40%.
|
||||||
It is therefore strongly advised that you use the slow integer forward DCT
|
It is therefore strongly advised that you use the slow integer forward DCT
|
||||||
whenever encoding images with a JPEG quality of 98 or higher.
|
whenever encoding images with a JPEG quality of 98 or higher.
|
||||||
|
|
||||||
|
|||||||
50
README.ijg
50
README.ijg
@@ -43,7 +43,7 @@ User documentation:
|
|||||||
change.log Version-to-version change highlights.
|
change.log Version-to-version change highlights.
|
||||||
Programmer and internal documentation:
|
Programmer and internal documentation:
|
||||||
libjpeg.txt How to use the JPEG library in your own programs.
|
libjpeg.txt How to use the JPEG library in your own programs.
|
||||||
example.c Sample code for calling the JPEG library.
|
example.txt Sample code for calling the JPEG library.
|
||||||
structure.txt Overview of the JPEG library's internal structure.
|
structure.txt Overview of the JPEG library's internal structure.
|
||||||
coderules.txt Coding style rules --- please read if you contribute code.
|
coderules.txt Coding style rules --- please read if you contribute code.
|
||||||
|
|
||||||
@@ -159,12 +159,6 @@ commercial products, provided that all warranty or liability claims are
|
|||||||
assumed by the product vendor.
|
assumed by the product vendor.
|
||||||
|
|
||||||
|
|
||||||
The Unix configuration script "configure" was produced with GNU Autoconf.
|
|
||||||
It is copyright by the Free Software Foundation but is freely distributable.
|
|
||||||
The same holds for its supporting scripts (config.guess, config.sub,
|
|
||||||
ltmain.sh). Another support script, install-sh, is copyright by X Consortium
|
|
||||||
but is also freely distributable.
|
|
||||||
|
|
||||||
The IJG distribution formerly included code to read and write GIF files.
|
The IJG distribution formerly included code to read and write GIF files.
|
||||||
To avoid entanglement with the Unisys LZW patent (now expired), GIF reading
|
To avoid entanglement with the Unisys LZW patent (now expired), GIF reading
|
||||||
support has been removed altogether, and the GIF writer has been simplified
|
support has been removed altogether, and the GIF writer has been simplified
|
||||||
@@ -220,14 +214,14 @@ Continuous-tone Still Images, Part 2: Compliance testing" and has document
|
|||||||
numbers ISO/IEC IS 10918-2, ITU-T T.83.
|
numbers ISO/IEC IS 10918-2, ITU-T T.83.
|
||||||
|
|
||||||
The JPEG standard does not specify all details of an interchangeable file
|
The JPEG standard does not specify all details of an interchangeable file
|
||||||
format. For the omitted details we follow the "JFIF" conventions, revision
|
format. For the omitted details, we follow the "JFIF" conventions, revision
|
||||||
1.02. JFIF 1.02 has been adopted as an Ecma International Technical Report
|
1.02. JFIF version 1 has been adopted as ISO/IEC 10918-5 (05/2013) and
|
||||||
and thus received a formal publication status. It is available as a free
|
Recommendation ITU-T T.871 (05/2011): Information technology - Digital
|
||||||
download in PDF format from
|
compression and coding of continuous-tone still images: JPEG File Interchange
|
||||||
http://www.ecma-international.org/publications/techreports/E-TR-098.htm.
|
Format (JFIF). It is available as a free download in PDF file format from
|
||||||
A PostScript version of the JFIF document is available at
|
https://www.iso.org/standard/54989.html and http://www.itu.int/rec/T-REC-T.871.
|
||||||
http://www.ijg.org/files/jfif.ps.gz. There is also a plain text version at
|
A PDF file of the older JFIF 1.02 specification is available at
|
||||||
http://www.ijg.org/files/jfif.txt.gz, but it is missing the figures.
|
http://www.w3.org/Graphics/JPEG/jfif3.pdf.
|
||||||
|
|
||||||
The TIFF 6.0 file format specification can be obtained by FTP from
|
The TIFF 6.0 file format specification can be obtained by FTP from
|
||||||
ftp://ftp.sgi.com/graphics/tiff/TIFF6.ps.gz. The JPEG incorporation scheme
|
ftp://ftp.sgi.com/graphics/tiff/TIFF6.ps.gz. The JPEG incorporation scheme
|
||||||
@@ -259,18 +253,22 @@ with body
|
|||||||
send usenet/news.answers/jpeg-faq/part2
|
send usenet/news.answers/jpeg-faq/part2
|
||||||
|
|
||||||
|
|
||||||
FILE FORMAT WARS
|
FILE FORMAT COMPATIBILITY
|
||||||
================
|
=========================
|
||||||
|
|
||||||
The ISO/IEC JTC1/SC29/WG1 standards committee (also known as JPEG, together
|
This software implements ITU T.81 | ISO/IEC 10918 with some extensions from
|
||||||
with ITU-T SG16) currently promotes different formats containing the name
|
ITU T.871 | ISO/IEC 10918-5 (JPEG File Interchange Format-- see REFERENCES).
|
||||||
"JPEG" which are incompatible with original DCT-based JPEG. IJG therefore does
|
Informally, the term "JPEG image" or "JPEG file" most often refers to JFIF or
|
||||||
not support these formats (see REFERENCES). Indeed, one of the original
|
a subset thereof, but there are other formats containing the name "JPEG" that
|
||||||
reasons for developing this free software was to help force convergence on
|
are incompatible with the DCT-based JPEG standard or with JFIF (for instance,
|
||||||
common, interoperable format standards for JPEG files.
|
JPEG 2000 and JPEG XR). This software therefore does not support these
|
||||||
Don't use an incompatible file format!
|
formats. Indeed, one of the original reasons for developing this free software
|
||||||
(In any case, our decoder will remain capable of reading existing JPEG
|
was to help force convergence on a common, interoperable format standard for
|
||||||
image files indefinitely.)
|
JPEG files.
|
||||||
|
|
||||||
|
JFIF is a minimal or "low end" representation. TIFF/JPEG (TIFF revision 6.0 as
|
||||||
|
modified by TIFF Technical Note #2) can be used for "high end" applications
|
||||||
|
that need to record a lot of additional data about an image.
|
||||||
|
|
||||||
|
|
||||||
TO DO
|
TO DO
|
||||||
|
|||||||
20
README.md
20
README.md
@@ -1,9 +1,19 @@
|
|||||||
Mozilla JPEG Encoder Project
|
> ## News: About Instagram's flaw
|
||||||
|
>
|
||||||
|
> Instagram had [a security vulnerability](https://m.facebook.com/security/advisories/cve-2020-1895). Instagram uses MozJPEG. These two facts were somewhat conflated in the [vulnerability report](https://research.checkpoint.com/2020/instagram_rce-code-execution-vulnerability-in-instagram-app-for-android-and-ios/) that gets reposted all over the Internet right now.
|
||||||
|
|
||||||
|
> MozJPEG is **NOT** affected by this vulnerability. The issue was in Facebook's own integration code, unique to only Instagram, and not in MozJPEG. There will be no MozJPEG patches in response to that report, because it's not a MozJPEG issue.
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
Mozilla JPEG Encoder Project [](https://ci.appveyor.com/project/kornel/mozjpeg-4ekrx)
|
||||||
============================
|
============================
|
||||||
|
|
||||||
MozJPEG reduces file sizes of JPEG images while retaining quality and 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.
|
||||||
|
|
||||||
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 based on [libjpeg-turbo](https://github.com/libjpeg-turbo/libjpeg-turbo). **Please send pull requests to libjpeg-turbo** if the changes aren't specific to newly-added MozJPEG-only compression code. This project aims to keep differences with libjpeg-turbo minimal, so whenever possible, improvements and bug fixes should go there first.
|
||||||
|
|
||||||
|
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 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.
|
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.
|
||||||
|
|
||||||
@@ -18,6 +28,10 @@ MozJPEG is meant to be used as a library in graphics programs and image processi
|
|||||||
## Releases
|
## Releases
|
||||||
|
|
||||||
* [Latest release](https://github.com/mozilla/mozjpeg/releases/latest)
|
* [Latest release](https://github.com/mozilla/mozjpeg/releases/latest)
|
||||||
* [Version 3.0 Announcement](https://boomswaggerboom.wordpress.com/2014/12/30/mozjpeg-3-0-released/) ([overview of 3.0 features](https://calendar.perfplanet.com/2014/mozjpeg-3-0/))
|
* [Overview of 3.0 features](https://calendar.perfplanet.com/2014/mozjpeg-3-0/)
|
||||||
* [Version 2.0 Announcement](https://blog.mozilla.org/research/2014/07/15/mozilla-advances-jpeg-encoding-with-mozjpeg-2-0/)
|
* [Version 2.0 Announcement](https://blog.mozilla.org/research/2014/07/15/mozilla-advances-jpeg-encoding-with-mozjpeg-2-0/)
|
||||||
* [Version 1.0 Announcement](https://blog.mozilla.org/research/2014/03/05/introducing-the-mozjpeg-project/)
|
* [Version 1.0 Announcement](https://blog.mozilla.org/research/2014/03/05/introducing-the-mozjpeg-project/)
|
||||||
|
|
||||||
|
## Compiling
|
||||||
|
|
||||||
|
See [BUILDING](BUILDING.md).
|
||||||
|
|||||||
254
acinclude.m4
254
acinclude.m4
@@ -1,254 +0,0 @@
|
|||||||
# AC_PROG_NASM
|
|
||||||
# --------------------------
|
|
||||||
# Check that NASM exists and determine flags
|
|
||||||
AC_DEFUN([AC_PROG_NASM],[
|
|
||||||
|
|
||||||
AC_ARG_VAR(NASM, [NASM command (used to build the x86/x86-64 SIMD code)])
|
|
||||||
if test "x$NASM" = "x"; then
|
|
||||||
AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
|
|
||||||
test -z "$NASM" && AC_MSG_ERROR([no nasm (Netwide Assembler) found])
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([for object file format of host system])
|
|
||||||
case "$host_os" in
|
|
||||||
cygwin* | mingw* | pw32* | interix*)
|
|
||||||
case "$host_cpu" in
|
|
||||||
x86_64)
|
|
||||||
objfmt='Win64-COFF'
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
objfmt='Win32-COFF'
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
msdosdjgpp* | go32*)
|
|
||||||
objfmt='COFF'
|
|
||||||
;;
|
|
||||||
os2-emx*) # not tested
|
|
||||||
objfmt='MSOMF' # obj
|
|
||||||
;;
|
|
||||||
linux*coff* | linux*oldld*)
|
|
||||||
objfmt='COFF' # ???
|
|
||||||
;;
|
|
||||||
linux*aout*)
|
|
||||||
objfmt='a.out'
|
|
||||||
;;
|
|
||||||
linux*)
|
|
||||||
case "$host_cpu" in
|
|
||||||
x86_64)
|
|
||||||
objfmt='ELF64'
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
objfmt='ELF'
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
kfreebsd* | freebsd* | netbsd* | openbsd*)
|
|
||||||
if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
|
|
||||||
objfmt='BSD-a.out'
|
|
||||||
else
|
|
||||||
case "$host_cpu" in
|
|
||||||
x86_64 | amd64)
|
|
||||||
objfmt='ELF64'
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
objfmt='ELF'
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
solaris* | sunos* | sysv* | sco*)
|
|
||||||
case "$host_cpu" in
|
|
||||||
x86_64)
|
|
||||||
objfmt='ELF64'
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
objfmt='ELF'
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
darwin* | rhapsody* | nextstep* | openstep* | macos*)
|
|
||||||
case "$host_cpu" in
|
|
||||||
x86_64)
|
|
||||||
objfmt='Mach-O64'
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
objfmt='Mach-O'
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
objfmt='ELF ?'
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
AC_MSG_RESULT([$objfmt])
|
|
||||||
if test "$objfmt" = 'ELF ?'; then
|
|
||||||
objfmt='ELF'
|
|
||||||
AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
|
|
||||||
case "$objfmt" in
|
|
||||||
MSOMF) NAFLAGS='-fobj -DOBJ32';;
|
|
||||||
Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
|
|
||||||
Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
|
|
||||||
COFF) NAFLAGS='-fcoff -DCOFF';;
|
|
||||||
a.out) NAFLAGS='-faout -DAOUT';;
|
|
||||||
BSD-a.out) NAFLAGS='-faoutb -DAOUT';;
|
|
||||||
ELF) NAFLAGS='-felf -DELF';;
|
|
||||||
ELF64) NAFLAGS='-felf64 -DELF -D__x86_64__';;
|
|
||||||
RDF) NAFLAGS='-frdf -DRDF';;
|
|
||||||
Mach-O) NAFLAGS='-fmacho -DMACHO';;
|
|
||||||
Mach-O64) NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
|
|
||||||
esac
|
|
||||||
AC_MSG_RESULT([$NAFLAGS])
|
|
||||||
AC_SUBST([NAFLAGS])
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
|
|
||||||
cat > conftest.asm <<EOF
|
|
||||||
[%line __oline__ "configure"
|
|
||||||
section .text
|
|
||||||
global _main,main
|
|
||||||
_main:
|
|
||||||
main: xor eax,eax
|
|
||||||
ret
|
|
||||||
]EOF
|
|
||||||
try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
|
|
||||||
if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
else
|
|
||||||
echo "configure: failed program was:" >&AC_FD_CC
|
|
||||||
cat conftest.asm >&AC_FD_CC
|
|
||||||
rm -rf conftest*
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
AC_MSG_ERROR([installation or configuration problem: assembler cannot create object files.])
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether the linker accepts assembler output])
|
|
||||||
try_nasm='${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.o $LIBS 1>&AC_FD_CC'
|
|
||||||
if AC_TRY_EVAL(try_nasm) && test -s conftest${ac_exeext}; then
|
|
||||||
rm -rf conftest*
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
else
|
|
||||||
rm -rf conftest*
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
AC_MSG_ERROR([configuration problem: maybe object file format mismatch.])
|
|
||||||
fi
|
|
||||||
|
|
||||||
])
|
|
||||||
|
|
||||||
# AC_CHECK_COMPATIBLE_ARM_ASSEMBLER_IFELSE
|
|
||||||
# --------------------------
|
|
||||||
# Test whether the assembler is suitable and supports NEON instructions
|
|
||||||
AC_DEFUN([AC_CHECK_COMPATIBLE_ARM_ASSEMBLER_IFELSE],[
|
|
||||||
ac_good_gnu_arm_assembler=no
|
|
||||||
ac_save_CC="$CC"
|
|
||||||
ac_save_CFLAGS="$CFLAGS"
|
|
||||||
CFLAGS="$CCASFLAGS -x assembler-with-cpp"
|
|
||||||
CC="$CCAS"
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
|
||||||
.text
|
|
||||||
.fpu neon
|
|
||||||
.arch armv7a
|
|
||||||
.object_arch armv4
|
|
||||||
.arm
|
|
||||||
pld [r0]
|
|
||||||
vmovn.u16 d0, q0]])], ac_good_gnu_arm_assembler=yes)
|
|
||||||
|
|
||||||
ac_use_gas_preprocessor=no
|
|
||||||
if test "x$ac_good_gnu_arm_assembler" = "xno" ; then
|
|
||||||
CC="gas-preprocessor.pl $CCAS"
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
|
||||||
.text
|
|
||||||
.fpu neon
|
|
||||||
.arch armv7a
|
|
||||||
.object_arch armv4
|
|
||||||
.arm
|
|
||||||
pld [r0]
|
|
||||||
vmovn.u16 d0, q0]])], ac_use_gas_preprocessor=yes)
|
|
||||||
fi
|
|
||||||
CFLAGS="$ac_save_CFLAGS"
|
|
||||||
CC="$ac_save_CC"
|
|
||||||
|
|
||||||
if test "x$ac_use_gas_preprocessor" = "xyes" ; then
|
|
||||||
CCAS="gas-preprocessor.pl $CCAS"
|
|
||||||
AC_SUBST([CCAS])
|
|
||||||
ac_good_gnu_arm_assembler=yes
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "x$ac_good_gnu_arm_assembler" = "xyes" ; then
|
|
||||||
$1
|
|
||||||
else
|
|
||||||
$2
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
|
|
||||||
# AC_CHECK_COMPATIBLE_MIPSEL_ASSEMBLER_IFELSE
|
|
||||||
# --------------------------
|
|
||||||
# Test whether the assembler is suitable and supports MIPS instructions
|
|
||||||
AC_DEFUN([AC_CHECK_COMPATIBLE_MIPS_ASSEMBLER_IFELSE],[
|
|
||||||
have_mips_dspr2=no
|
|
||||||
ac_save_CFLAGS="$CFLAGS"
|
|
||||||
CFLAGS="$CCASFLAGS -mdspr2"
|
|
||||||
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
|
||||||
|
|
||||||
int main ()
|
|
||||||
{
|
|
||||||
int c = 0, a = 0, b = 0;
|
|
||||||
__asm__ __volatile__ (
|
|
||||||
"precr.qb.ph %[c], %[a], %[b] \n\t"
|
|
||||||
: [c] "=r" (c)
|
|
||||||
: [a] "r" (a), [b] "r" (b)
|
|
||||||
);
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
]])], have_mips_dspr2=yes)
|
|
||||||
CFLAGS=$ac_save_CFLAGS
|
|
||||||
|
|
||||||
if test "x$have_mips_dspr2" = "xyes" ; then
|
|
||||||
$1
|
|
||||||
else
|
|
||||||
$2
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFUN([AC_CHECK_COMPATIBLE_ARM64_ASSEMBLER_IFELSE],[
|
|
||||||
ac_good_gnu_arm_assembler=no
|
|
||||||
ac_save_CC="$CC"
|
|
||||||
ac_save_CFLAGS="$CFLAGS"
|
|
||||||
CFLAGS="$CCASFLAGS -x assembler-with-cpp"
|
|
||||||
CC="$CCAS"
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
|
||||||
.text
|
|
||||||
MYVAR .req x0
|
|
||||||
movi v0.16b, #100
|
|
||||||
mov MYVAR, #100
|
|
||||||
.unreq MYVAR]])], ac_good_gnu_arm_assembler=yes)
|
|
||||||
|
|
||||||
ac_use_gas_preprocessor=no
|
|
||||||
if test "x$ac_good_gnu_arm_assembler" = "xno" ; then
|
|
||||||
CC="gas-preprocessor.pl $CCAS"
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
|
||||||
.text
|
|
||||||
MYVAR .req x0
|
|
||||||
movi v0.16b, #100
|
|
||||||
mov MYVAR, #100
|
|
||||||
.unreq MYVAR]])], ac_use_gas_preprocessor=yes)
|
|
||||||
fi
|
|
||||||
CFLAGS="$ac_save_CFLAGS"
|
|
||||||
CC="$ac_save_CC"
|
|
||||||
|
|
||||||
if test "x$ac_use_gas_preprocessor" = "xyes" ; then
|
|
||||||
CCAS="gas-preprocessor.pl $CCAS"
|
|
||||||
AC_SUBST([CCAS])
|
|
||||||
ac_good_gnu_arm_assembler=yes
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "x$ac_good_gnu_arm_assembler" = "xyes" ; then
|
|
||||||
$1
|
|
||||||
else
|
|
||||||
$2
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
62
appveyor.yml
Normal file
62
appveyor.yml
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
image: Visual Studio 2017
|
||||||
|
configuration: Release
|
||||||
|
platform:
|
||||||
|
- Win32
|
||||||
|
- x64
|
||||||
|
|
||||||
|
install:
|
||||||
|
- if %PLATFORM% == Win32 (set ARCH=x86)
|
||||||
|
- if %PLATFORM% == x64 (set ARCH=x64)
|
||||||
|
## Set up nasm
|
||||||
|
- choco install nasm
|
||||||
|
- set PATH=%PATH%;C:\Program Files\NASM
|
||||||
|
## Set up libpng
|
||||||
|
- cd C:\Tools\vcpkg
|
||||||
|
- vcpkg install libpng:%ARCH%-windows
|
||||||
|
- vcpkg install libpng:%ARCH%-windows-static
|
||||||
|
|
||||||
|
before_build:
|
||||||
|
- cd %APPVEYOR_BUILD_FOLDER%
|
||||||
|
- nasm -v
|
||||||
|
- cmake --version
|
||||||
|
- git describe --always --tags --dirty
|
||||||
|
- FOR /F %%a in ('git describe --always --tags --dirty') do set GIT_VERSION=%%a
|
||||||
|
|
||||||
|
build_script:
|
||||||
|
## Build shared
|
||||||
|
- cmake -B shared -A %PLATFORM%
|
||||||
|
-DENABLE_SHARED=1 -DENABLE_STATIC=0
|
||||||
|
-DREQUIRE_SIMD=1
|
||||||
|
-DCMAKE_TOOLCHAIN_FILE=C:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake
|
||||||
|
|
||||||
|
- cmake --build shared --config Release
|
||||||
|
|
||||||
|
## Build static
|
||||||
|
- cmake -B static -A %PLATFORM%
|
||||||
|
-DENABLE_SHARED=0 -DENABLE_STATIC=1
|
||||||
|
-DREQUIRE_SIMD=1
|
||||||
|
-DCMAKE_TOOLCHAIN_FILE=C:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake
|
||||||
|
-DVCPKG_TARGET_TRIPLET=%ARCH%-windows-static
|
||||||
|
|
||||||
|
- cmake --build static --config Release
|
||||||
|
|
||||||
|
after_build:
|
||||||
|
- 7z a mozjpeg-%GIT_VERSION%-win-%ARCH%.zip shared/Release static/Release
|
||||||
|
|
||||||
|
artifacts:
|
||||||
|
- path: '*.zip'
|
||||||
|
|
||||||
|
cache:
|
||||||
|
- C:\ProgramData\chocolatey\bin
|
||||||
|
- C:\ProgramData\chocolatey\lib
|
||||||
|
- C:\Program Files\NASM
|
||||||
|
- C:\tools\vcpkg\installed
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
description: 'Automated build using Appveyor'
|
||||||
|
provider: GitHub
|
||||||
|
auth_token:
|
||||||
|
secure: 2Jj47Q5HnaPob9U4yX2t4q4TYTw4JWU6cS56mM12aoRLgfYkZ4gRZPySIzfmTPqC
|
||||||
|
artifact: /.*\.zip/
|
||||||
|
on:
|
||||||
|
APPVEYOR_REPO_TAG: true # deploy on tag push only
|
||||||
341
bmp.c
341
bmp.c
@@ -1,341 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C)2011, 2015 D. R. Commander. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* - Neither the name of the libjpeg-turbo Project nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived from this
|
|
||||||
* software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <setjmp.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include "cdjpeg.h"
|
|
||||||
#include <jpeglib.h>
|
|
||||||
#include <jpegint.h>
|
|
||||||
#include "tjutil.h"
|
|
||||||
#include "bmp.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* This duplicates the functionality of the VirtualGL bitmap library using
|
|
||||||
the components from cjpeg and djpeg */
|
|
||||||
|
|
||||||
|
|
||||||
/* Error handling (based on example in example.c) */
|
|
||||||
|
|
||||||
static char errStr[JMSG_LENGTH_MAX]="No error";
|
|
||||||
|
|
||||||
struct my_error_mgr
|
|
||||||
{
|
|
||||||
struct jpeg_error_mgr pub;
|
|
||||||
jmp_buf setjmp_buffer;
|
|
||||||
};
|
|
||||||
typedef struct my_error_mgr *my_error_ptr;
|
|
||||||
|
|
||||||
static void my_error_exit(j_common_ptr cinfo)
|
|
||||||
{
|
|
||||||
my_error_ptr myerr=(my_error_ptr)cinfo->err;
|
|
||||||
(*cinfo->err->output_message)(cinfo);
|
|
||||||
longjmp(myerr->setjmp_buffer, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Based on output_message() in jerror.c */
|
|
||||||
|
|
||||||
static void my_output_message(j_common_ptr cinfo)
|
|
||||||
{
|
|
||||||
(*cinfo->err->format_message)(cinfo, errStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define _throw(m) {snprintf(errStr, JMSG_LENGTH_MAX, "%s", m); \
|
|
||||||
retval=-1; goto bailout;}
|
|
||||||
#define _throwunix(m) {snprintf(errStr, JMSG_LENGTH_MAX, "%s\n%s", m, \
|
|
||||||
strerror(errno)); retval=-1; goto bailout;}
|
|
||||||
|
|
||||||
|
|
||||||
static void pixelconvert(unsigned char *srcbuf, int srcpf, int srcbottomup,
|
|
||||||
unsigned char *dstbuf, int dstpf, int dstbottomup, int w, int h)
|
|
||||||
{
|
|
||||||
unsigned char *srcrowptr=srcbuf, *srccolptr;
|
|
||||||
int srcps=tjPixelSize[srcpf];
|
|
||||||
int srcstride=srcbottomup? -w*srcps:w*srcps;
|
|
||||||
unsigned char *dstrowptr=dstbuf, *dstcolptr;
|
|
||||||
int dstps=tjPixelSize[dstpf];
|
|
||||||
int dststride=dstbottomup? -w*dstps:w*dstps;
|
|
||||||
int row, col;
|
|
||||||
|
|
||||||
if(srcbottomup) srcrowptr=&srcbuf[w*srcps*(h-1)];
|
|
||||||
if(dstbottomup) dstrowptr=&dstbuf[w*dstps*(h-1)];
|
|
||||||
|
|
||||||
/* NOTE: These quick & dirty CMYK<->RGB conversion routines are for testing
|
|
||||||
purposes only. Properly converting between CMYK and RGB requires a color
|
|
||||||
management system. */
|
|
||||||
|
|
||||||
if(dstpf==TJPF_CMYK)
|
|
||||||
{
|
|
||||||
for(row=0; row<h; row++, srcrowptr+=srcstride, dstrowptr+=dststride)
|
|
||||||
{
|
|
||||||
for(col=0, srccolptr=srcrowptr, dstcolptr=dstrowptr;
|
|
||||||
col<w; col++, srccolptr+=srcps)
|
|
||||||
{
|
|
||||||
double c=1.0-((double)(srccolptr[tjRedOffset[srcpf]])/255.);
|
|
||||||
double m=1.0-((double)(srccolptr[tjGreenOffset[srcpf]])/255.);
|
|
||||||
double y=1.0-((double)(srccolptr[tjBlueOffset[srcpf]])/255.);
|
|
||||||
double k=min(min(c,m),min(y,1.0));
|
|
||||||
if(k==1.0) c=m=y=0.0;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
c=(c-k)/(1.0-k);
|
|
||||||
m=(m-k)/(1.0-k);
|
|
||||||
y=(y-k)/(1.0-k);
|
|
||||||
}
|
|
||||||
if(c>1.0) c=1.0;
|
|
||||||
if(c<0.) c=0.;
|
|
||||||
if(m>1.0) m=1.0;
|
|
||||||
if(m<0.) m=0.;
|
|
||||||
if(y>1.0) y=1.0;
|
|
||||||
if(y<0.) y=0.;
|
|
||||||
if(k>1.0) k=1.0;
|
|
||||||
if(k<0.) k=0.;
|
|
||||||
*dstcolptr++=(unsigned char)(255.0-c*255.0+0.5);
|
|
||||||
*dstcolptr++=(unsigned char)(255.0-m*255.0+0.5);
|
|
||||||
*dstcolptr++=(unsigned char)(255.0-y*255.0+0.5);
|
|
||||||
*dstcolptr++=(unsigned char)(255.0-k*255.0+0.5);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(srcpf==TJPF_CMYK)
|
|
||||||
{
|
|
||||||
for(row=0; row<h; row++, srcrowptr+=srcstride, dstrowptr+=dststride)
|
|
||||||
{
|
|
||||||
for(col=0, srccolptr=srcrowptr, dstcolptr=dstrowptr;
|
|
||||||
col<w; col++, dstcolptr+=dstps)
|
|
||||||
{
|
|
||||||
double c=(double)(*srccolptr++);
|
|
||||||
double m=(double)(*srccolptr++);
|
|
||||||
double y=(double)(*srccolptr++);
|
|
||||||
double k=(double)(*srccolptr++);
|
|
||||||
double r=c*k/255.;
|
|
||||||
double g=m*k/255.;
|
|
||||||
double b=y*k/255.;
|
|
||||||
if(r>255.0) r=255.0;
|
|
||||||
if(r<0.) r=0.;
|
|
||||||
if(g>255.0) g=255.0;
|
|
||||||
if(g<0.) g=0.;
|
|
||||||
if(b>255.0) b=255.0;
|
|
||||||
if(b<0.) b=0.;
|
|
||||||
dstcolptr[tjRedOffset[dstpf]]=(unsigned char)(r+0.5);
|
|
||||||
dstcolptr[tjGreenOffset[dstpf]]=(unsigned char)(g+0.5);
|
|
||||||
dstcolptr[tjBlueOffset[dstpf]]=(unsigned char)(b+0.5);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for(row=0; row<h; row++, srcrowptr+=srcstride, dstrowptr+=dststride)
|
|
||||||
{
|
|
||||||
for(col=0, srccolptr=srcrowptr, dstcolptr=dstrowptr;
|
|
||||||
col<w; col++, srccolptr+=srcps, dstcolptr+=dstps)
|
|
||||||
{
|
|
||||||
dstcolptr[tjRedOffset[dstpf]]=srccolptr[tjRedOffset[srcpf]];
|
|
||||||
dstcolptr[tjGreenOffset[dstpf]]=srccolptr[tjGreenOffset[srcpf]];
|
|
||||||
dstcolptr[tjBlueOffset[dstpf]]=srccolptr[tjBlueOffset[srcpf]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int loadbmp(char *filename, unsigned char **buf, int *w, int *h,
|
|
||||||
int dstpf, int bottomup)
|
|
||||||
{
|
|
||||||
int retval=0, dstps, srcpf, tempc;
|
|
||||||
struct jpeg_compress_struct cinfo;
|
|
||||||
struct my_error_mgr jerr;
|
|
||||||
cjpeg_source_ptr src;
|
|
||||||
FILE *file=NULL;
|
|
||||||
|
|
||||||
memset(&cinfo, 0, sizeof(struct jpeg_compress_struct));
|
|
||||||
|
|
||||||
if(!filename || !buf || !w || !h || dstpf<0 || dstpf>=TJ_NUMPF)
|
|
||||||
_throw("loadbmp(): Invalid argument");
|
|
||||||
|
|
||||||
if((file=fopen(filename, "rb"))==NULL)
|
|
||||||
_throwunix("loadbmp(): Cannot open input file");
|
|
||||||
|
|
||||||
cinfo.err=jpeg_std_error(&jerr.pub);
|
|
||||||
jerr.pub.error_exit=my_error_exit;
|
|
||||||
jerr.pub.output_message=my_output_message;
|
|
||||||
|
|
||||||
if(setjmp(jerr.setjmp_buffer))
|
|
||||||
{
|
|
||||||
/* If we get here, the JPEG code has signaled an error. */
|
|
||||||
retval=-1; goto bailout;
|
|
||||||
}
|
|
||||||
|
|
||||||
jpeg_create_compress(&cinfo);
|
|
||||||
if((tempc=getc(file))<0 || ungetc(tempc, file)==EOF)
|
|
||||||
_throwunix("loadbmp(): Could not read input file")
|
|
||||||
else if(tempc==EOF) _throw("loadbmp(): Input file contains no data");
|
|
||||||
|
|
||||||
if(tempc=='B')
|
|
||||||
{
|
|
||||||
if((src=jinit_read_bmp(&cinfo))==NULL)
|
|
||||||
_throw("loadbmp(): Could not initialize bitmap loader");
|
|
||||||
}
|
|
||||||
else if(tempc=='P')
|
|
||||||
{
|
|
||||||
if((src=jinit_read_ppm(&cinfo))==NULL)
|
|
||||||
_throw("loadbmp(): Could not initialize bitmap loader");
|
|
||||||
}
|
|
||||||
else _throw("loadbmp(): Unsupported file type");
|
|
||||||
|
|
||||||
src->input_file=file;
|
|
||||||
(*src->start_input)(&cinfo, src);
|
|
||||||
(*cinfo.mem->realize_virt_arrays)((j_common_ptr)&cinfo);
|
|
||||||
|
|
||||||
*w=cinfo.image_width; *h=cinfo.image_height;
|
|
||||||
|
|
||||||
if(cinfo.input_components==1 && cinfo.in_color_space==JCS_RGB)
|
|
||||||
srcpf=TJPF_GRAY;
|
|
||||||
else srcpf=TJPF_RGB;
|
|
||||||
|
|
||||||
dstps=tjPixelSize[dstpf];
|
|
||||||
if((*buf=(unsigned char *)malloc((*w)*(*h)*dstps))==NULL)
|
|
||||||
_throw("loadbmp(): Memory allocation failure");
|
|
||||||
|
|
||||||
while(cinfo.next_scanline<cinfo.image_height)
|
|
||||||
{
|
|
||||||
int i, nlines=(*src->get_pixel_rows)(&cinfo, src);
|
|
||||||
for(i=0; i<nlines; i++)
|
|
||||||
{
|
|
||||||
unsigned char *outbuf; int row;
|
|
||||||
row=cinfo.next_scanline+i;
|
|
||||||
if(bottomup) outbuf=&(*buf)[((*h)-row-1)*(*w)*dstps];
|
|
||||||
else outbuf=&(*buf)[row*(*w)*dstps];
|
|
||||||
pixelconvert(src->buffer[i], srcpf, 0, outbuf, dstpf, bottomup, *w,
|
|
||||||
nlines);
|
|
||||||
}
|
|
||||||
cinfo.next_scanline+=nlines;
|
|
||||||
}
|
|
||||||
|
|
||||||
(*src->finish_input)(&cinfo, src);
|
|
||||||
|
|
||||||
bailout:
|
|
||||||
jpeg_destroy_compress(&cinfo);
|
|
||||||
if(file) fclose(file);
|
|
||||||
if(retval<0 && buf && *buf) {free(*buf); *buf=NULL;}
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int savebmp(char *filename, unsigned char *buf, int w, int h, int srcpf,
|
|
||||||
int bottomup)
|
|
||||||
{
|
|
||||||
int retval=0, srcps, dstpf;
|
|
||||||
struct jpeg_decompress_struct dinfo;
|
|
||||||
struct my_error_mgr jerr;
|
|
||||||
djpeg_dest_ptr dst;
|
|
||||||
FILE *file=NULL;
|
|
||||||
char *ptr=NULL;
|
|
||||||
|
|
||||||
memset(&dinfo, 0, sizeof(struct jpeg_decompress_struct));
|
|
||||||
|
|
||||||
if(!filename || !buf || w<1 || h<1 || srcpf<0 || srcpf>=TJ_NUMPF)
|
|
||||||
_throw("savebmp(): Invalid argument");
|
|
||||||
|
|
||||||
if((file=fopen(filename, "wb"))==NULL)
|
|
||||||
_throwunix("savebmp(): Cannot open output file");
|
|
||||||
|
|
||||||
dinfo.err=jpeg_std_error(&jerr.pub);
|
|
||||||
jerr.pub.error_exit=my_error_exit;
|
|
||||||
jerr.pub.output_message=my_output_message;
|
|
||||||
|
|
||||||
if(setjmp(jerr.setjmp_buffer))
|
|
||||||
{
|
|
||||||
/* If we get here, the JPEG code has signaled an error. */
|
|
||||||
retval=-1; goto bailout;
|
|
||||||
}
|
|
||||||
|
|
||||||
jpeg_create_decompress(&dinfo);
|
|
||||||
if(srcpf==TJPF_GRAY)
|
|
||||||
{
|
|
||||||
dinfo.out_color_components=dinfo.output_components=1;
|
|
||||||
dinfo.out_color_space=JCS_GRAYSCALE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dinfo.out_color_components=dinfo.output_components=3;
|
|
||||||
dinfo.out_color_space=JCS_RGB;
|
|
||||||
}
|
|
||||||
dinfo.image_width=w; dinfo.image_height=h;
|
|
||||||
dinfo.global_state=DSTATE_READY;
|
|
||||||
dinfo.scale_num=dinfo.scale_denom=1;
|
|
||||||
|
|
||||||
ptr=strrchr(filename, '.');
|
|
||||||
if(ptr && !strcasecmp(ptr, ".bmp"))
|
|
||||||
{
|
|
||||||
if((dst=jinit_write_bmp(&dinfo, 0))==NULL)
|
|
||||||
_throw("savebmp(): Could not initialize bitmap writer");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if((dst=jinit_write_ppm(&dinfo))==NULL)
|
|
||||||
_throw("savebmp(): Could not initialize PPM writer");
|
|
||||||
}
|
|
||||||
|
|
||||||
dst->output_file=file;
|
|
||||||
(*dst->start_output)(&dinfo, dst);
|
|
||||||
(*dinfo.mem->realize_virt_arrays)((j_common_ptr)&dinfo);
|
|
||||||
|
|
||||||
if(srcpf==TJPF_GRAY) dstpf=srcpf;
|
|
||||||
else dstpf=TJPF_RGB;
|
|
||||||
srcps=tjPixelSize[srcpf];
|
|
||||||
|
|
||||||
while(dinfo.output_scanline<dinfo.output_height)
|
|
||||||
{
|
|
||||||
int i, nlines=dst->buffer_height;
|
|
||||||
for(i=0; i<nlines; i++)
|
|
||||||
{
|
|
||||||
unsigned char *inbuf; int row;
|
|
||||||
row=dinfo.output_scanline+i;
|
|
||||||
if(bottomup) inbuf=&buf[(h-row-1)*w*srcps];
|
|
||||||
else inbuf=&buf[row*w*srcps];
|
|
||||||
pixelconvert(inbuf, srcpf, bottomup, dst->buffer[i], dstpf, 0, w,
|
|
||||||
nlines);
|
|
||||||
}
|
|
||||||
(*dst->put_pixel_rows)(&dinfo, dst, nlines);
|
|
||||||
dinfo.output_scanline+=nlines;
|
|
||||||
}
|
|
||||||
|
|
||||||
(*dst->finish_output)(&dinfo, dst);
|
|
||||||
|
|
||||||
bailout:
|
|
||||||
jpeg_destroy_decompress(&dinfo);
|
|
||||||
if(file) fclose(file);
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *bmpgeterr(void)
|
|
||||||
{
|
|
||||||
return errStr;
|
|
||||||
}
|
|
||||||
42
bmp.h
42
bmp.h
@@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C)2011 D. R. Commander. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* - Neither the name of the libjpeg-turbo Project nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived from this
|
|
||||||
* software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __BMP_H__
|
|
||||||
#define __BMP_H__
|
|
||||||
|
|
||||||
#include "./turbojpeg.h"
|
|
||||||
|
|
||||||
int loadbmp(char *filename, unsigned char **buf, int *w, int *h, int pf,
|
|
||||||
int bottomup);
|
|
||||||
|
|
||||||
int savebmp(char *filename, unsigned char *buf, int w, int h, int pf,
|
|
||||||
int bottomup);
|
|
||||||
|
|
||||||
const char *bmpgeterr(void);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
17
cderror.h
17
cderror.h
@@ -2,7 +2,7 @@
|
|||||||
* cderror.h
|
* cderror.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 1994-1997, Thomas G. Lane.
|
* Copyright (C) 1994-1997, Thomas G. Lane.
|
||||||
* Modified 2009 by Guido Vollbeding.
|
* Modified 2009-2017 by Guido Vollbeding.
|
||||||
* This file is part of the Independent JPEG Group's software.
|
* This file is part of the Independent JPEG Group's software.
|
||||||
* For conditions of distribution and use, see the accompanying README.ijg
|
* For conditions of distribution and use, see the accompanying README.ijg
|
||||||
* file.
|
* file.
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
#define JMAKE_ENUM_LIST
|
#define JMAKE_ENUM_LIST
|
||||||
#else
|
#else
|
||||||
/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */
|
/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */
|
||||||
#define JMESSAGE(code,string)
|
#define JMESSAGE(code, string)
|
||||||
#endif /* CDERROR_H */
|
#endif /* CDERROR_H */
|
||||||
#endif /* JMESSAGE */
|
#endif /* JMESSAGE */
|
||||||
|
|
||||||
@@ -34,11 +34,11 @@
|
|||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
||||||
#define JMESSAGE(code,string) code ,
|
#define JMESSAGE(code, string) code,
|
||||||
|
|
||||||
#endif /* JMAKE_ENUM_LIST */
|
#endif /* JMAKE_ENUM_LIST */
|
||||||
|
|
||||||
JMESSAGE(JMSG_FIRSTADDONCODE=1000, NULL) /* Must be first entry! */
|
JMESSAGE(JMSG_FIRSTADDONCODE = 1000, NULL) /* Must be first entry! */
|
||||||
|
|
||||||
#ifdef BMP_SUPPORTED
|
#ifdef BMP_SUPPORTED
|
||||||
JMESSAGE(JERR_BMP_BADCMAP, "Unsupported BMP colormap format")
|
JMESSAGE(JERR_BMP_BADCMAP, "Unsupported BMP colormap format")
|
||||||
@@ -49,6 +49,7 @@ JMESSAGE(JERR_BMP_COLORSPACE, "BMP output must be grayscale or RGB")
|
|||||||
JMESSAGE(JERR_BMP_COMPRESSED, "Sorry, compressed BMPs not yet supported")
|
JMESSAGE(JERR_BMP_COMPRESSED, "Sorry, compressed BMPs not yet supported")
|
||||||
JMESSAGE(JERR_BMP_EMPTY, "Empty BMP image")
|
JMESSAGE(JERR_BMP_EMPTY, "Empty BMP image")
|
||||||
JMESSAGE(JERR_BMP_NOT, "Not a BMP file - does not start with BM")
|
JMESSAGE(JERR_BMP_NOT, "Not a BMP file - does not start with BM")
|
||||||
|
JMESSAGE(JERR_BMP_OUTOFRANGE, "Numeric value out of range in BMP file")
|
||||||
JMESSAGE(JTRC_BMP, "%ux%u 24-bit BMP image")
|
JMESSAGE(JTRC_BMP, "%ux%u 24-bit BMP image")
|
||||||
JMESSAGE(JTRC_BMP_MAPPED, "%ux%u 8-bit colormapped BMP image")
|
JMESSAGE(JTRC_BMP_MAPPED, "%ux%u 8-bit colormapped BMP image")
|
||||||
JMESSAGE(JTRC_BMP_OS2, "%ux%u 24-bit OS2 BMP image")
|
JMESSAGE(JTRC_BMP_OS2, "%ux%u 24-bit OS2 BMP image")
|
||||||
@@ -75,8 +76,8 @@ JMESSAGE(JWRN_GIF_NOMOREDATA, "Ran out of GIF bits")
|
|||||||
#ifdef PPM_SUPPORTED
|
#ifdef PPM_SUPPORTED
|
||||||
JMESSAGE(JERR_PPM_COLORSPACE, "PPM output must be grayscale or RGB")
|
JMESSAGE(JERR_PPM_COLORSPACE, "PPM output must be grayscale or RGB")
|
||||||
JMESSAGE(JERR_PPM_NONNUMERIC, "Nonnumeric data in PPM file")
|
JMESSAGE(JERR_PPM_NONNUMERIC, "Nonnumeric data in PPM file")
|
||||||
JMESSAGE(JERR_PPM_TOOLARGE, "Integer value too large in PPM file")
|
|
||||||
JMESSAGE(JERR_PPM_NOT, "Not a PPM/PGM file")
|
JMESSAGE(JERR_PPM_NOT, "Not a PPM/PGM file")
|
||||||
|
JMESSAGE(JERR_PPM_OUTOFRANGE, "Numeric value out of range in PPM file")
|
||||||
JMESSAGE(JTRC_PGM, "%ux%u PGM image")
|
JMESSAGE(JTRC_PGM, "%ux%u PGM image")
|
||||||
JMESSAGE(JTRC_PGM_TEXT, "%ux%u text PGM image")
|
JMESSAGE(JTRC_PGM_TEXT, "%ux%u text PGM image")
|
||||||
JMESSAGE(JTRC_PPM, "%ux%u PPM image")
|
JMESSAGE(JTRC_PPM, "%ux%u PPM image")
|
||||||
@@ -116,11 +117,11 @@ JMESSAGE(JERR_BAD_CMAP_FILE,
|
|||||||
JMESSAGE(JERR_TOO_MANY_COLORS,
|
JMESSAGE(JERR_TOO_MANY_COLORS,
|
||||||
"Output file format cannot handle %d colormap entries")
|
"Output file format cannot handle %d colormap entries")
|
||||||
JMESSAGE(JERR_UNGETC_FAILED, "ungetc failed")
|
JMESSAGE(JERR_UNGETC_FAILED, "ungetc failed")
|
||||||
#ifdef TARGA_SUPPORTED
|
#ifdef PNG_SUPPORTED
|
||||||
JMESSAGE(JERR_UNKNOWN_FORMAT,
|
JMESSAGE(JERR_UNKNOWN_FORMAT,
|
||||||
"Unrecognized input file format --- perhaps you need -targa")
|
"MozJPEG can't read the image (JPEG, PNG and old BMP and Targa are supported)")
|
||||||
#else
|
#else
|
||||||
JMESSAGE(JERR_UNKNOWN_FORMAT, "Unrecognized input file format")
|
JMESSAGE(JERR_UNKNOWN_FORMAT, "MozJPEG can't read the image (PNG support is disabled in this build)")
|
||||||
#endif
|
#endif
|
||||||
JMESSAGE(JERR_UNSUPPORTED_FORMAT, "Unsupported output file format")
|
JMESSAGE(JERR_UNSUPPORTED_FORMAT, "Unsupported output file format")
|
||||||
|
|
||||||
|
|||||||
21
cdjpeg.c
21
cdjpeg.c
@@ -28,11 +28,12 @@
|
|||||||
#ifdef PROGRESS_REPORT
|
#ifdef PROGRESS_REPORT
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
progress_monitor (j_common_ptr cinfo)
|
progress_monitor(j_common_ptr cinfo)
|
||||||
{
|
{
|
||||||
cd_progress_ptr prog = (cd_progress_ptr) cinfo->progress;
|
cd_progress_ptr prog = (cd_progress_ptr)cinfo->progress;
|
||||||
int total_passes = prog->pub.total_passes + prog->total_extra_passes;
|
int total_passes = prog->pub.total_passes + prog->total_extra_passes;
|
||||||
int percent_done = (int) (prog->pub.pass_counter*100L/prog->pub.pass_limit);
|
int percent_done =
|
||||||
|
(int)(prog->pub.pass_counter * 100L / prog->pub.pass_limit);
|
||||||
|
|
||||||
if (percent_done != prog->percent_done) {
|
if (percent_done != prog->percent_done) {
|
||||||
prog->percent_done = percent_done;
|
prog->percent_done = percent_done;
|
||||||
@@ -49,7 +50,7 @@ progress_monitor (j_common_ptr cinfo)
|
|||||||
|
|
||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
start_progress_monitor (j_common_ptr cinfo, cd_progress_ptr progress)
|
start_progress_monitor(j_common_ptr cinfo, cd_progress_ptr progress)
|
||||||
{
|
{
|
||||||
/* Enable progress display, unless trace output is on */
|
/* Enable progress display, unless trace output is on */
|
||||||
if (cinfo->err->trace_level == 0) {
|
if (cinfo->err->trace_level == 0) {
|
||||||
@@ -63,7 +64,7 @@ start_progress_monitor (j_common_ptr cinfo, cd_progress_ptr progress)
|
|||||||
|
|
||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
end_progress_monitor (j_common_ptr cinfo)
|
end_progress_monitor(j_common_ptr cinfo)
|
||||||
{
|
{
|
||||||
/* Clear away progress display */
|
/* Clear away progress display */
|
||||||
if (cinfo->err->trace_level == 0) {
|
if (cinfo->err->trace_level == 0) {
|
||||||
@@ -82,7 +83,7 @@ end_progress_monitor (j_common_ptr cinfo)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GLOBAL(boolean)
|
GLOBAL(boolean)
|
||||||
keymatch (char *arg, const char *keyword, int minchars)
|
keymatch(char *arg, const char *keyword, int minchars)
|
||||||
{
|
{
|
||||||
register int ca, ck;
|
register int ca, ck;
|
||||||
register int nmatched = 0;
|
register int nmatched = 0;
|
||||||
@@ -109,9 +110,9 @@ keymatch (char *arg, const char *keyword, int minchars)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GLOBAL(FILE *)
|
GLOBAL(FILE *)
|
||||||
read_stdin (void)
|
read_stdin(void)
|
||||||
{
|
{
|
||||||
FILE * input_file = stdin;
|
FILE *input_file = stdin;
|
||||||
|
|
||||||
#ifdef USE_SETMODE /* need to hack file mode? */
|
#ifdef USE_SETMODE /* need to hack file mode? */
|
||||||
setmode(fileno(stdin), O_BINARY);
|
setmode(fileno(stdin), O_BINARY);
|
||||||
@@ -127,9 +128,9 @@ read_stdin (void)
|
|||||||
|
|
||||||
|
|
||||||
GLOBAL(FILE *)
|
GLOBAL(FILE *)
|
||||||
write_stdout (void)
|
write_stdout(void)
|
||||||
{
|
{
|
||||||
FILE * output_file = stdout;
|
FILE *output_file = stdout;
|
||||||
|
|
||||||
#ifdef USE_SETMODE /* need to hack file mode? */
|
#ifdef USE_SETMODE /* need to hack file mode? */
|
||||||
setmode(fileno(stdout), O_BINARY);
|
setmode(fileno(stdout), O_BINARY);
|
||||||
|
|||||||
62
cdjpeg.h
62
cdjpeg.h
@@ -3,8 +3,8 @@
|
|||||||
*
|
*
|
||||||
* This file was part of the Independent JPEG Group's software:
|
* This file was part of the Independent JPEG Group's software:
|
||||||
* Copyright (C) 1994-1997, Thomas G. Lane.
|
* Copyright (C) 1994-1997, Thomas G. Lane.
|
||||||
* It was modified by The libjpeg-turbo Project to include only code relevant
|
* libjpeg-turbo Modifications:
|
||||||
* to libjpeg-turbo.
|
* Copyright (C) 2017, D. R. Commander.
|
||||||
* mozjpeg Modifications:
|
* mozjpeg Modifications:
|
||||||
* Copyright (C) 2014, Mozilla Corporation.
|
* Copyright (C) 2014, Mozilla Corporation.
|
||||||
* For conditions of distribution and use, see the accompanying README.ijg file.
|
* For conditions of distribution and use, see the accompanying README.ijg file.
|
||||||
@@ -63,6 +63,14 @@ struct djpeg_dest_struct {
|
|||||||
JDIMENSION rows_supplied);
|
JDIMENSION rows_supplied);
|
||||||
/* Finish up at the end of the image. */
|
/* Finish up at the end of the image. */
|
||||||
void (*finish_output) (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo);
|
void (*finish_output) (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo);
|
||||||
|
/* Re-calculate buffer dimensions based on output dimensions (for use with
|
||||||
|
partial image decompression.) If this is NULL, then the output format
|
||||||
|
does not support partial image decompression (BMP and RLE, in particular,
|
||||||
|
cannot support partial decompression because they use an inversion buffer
|
||||||
|
to write the image in bottom-up order.) */
|
||||||
|
void (*calc_buffer_dimensions) (j_decompress_ptr cinfo,
|
||||||
|
djpeg_dest_ptr dinfo);
|
||||||
|
|
||||||
|
|
||||||
/* Target file spec; filled in by djpeg.c after object is created. */
|
/* Target file spec; filled in by djpeg.c after object is created. */
|
||||||
FILE *output_file;
|
FILE *output_file;
|
||||||
@@ -97,43 +105,44 @@ typedef struct cdjpeg_progress_mgr *cd_progress_ptr;
|
|||||||
|
|
||||||
/* Module selection routines for I/O modules. */
|
/* Module selection routines for I/O modules. */
|
||||||
|
|
||||||
EXTERN(cjpeg_source_ptr) jinit_read_bmp (j_compress_ptr cinfo);
|
|
||||||
EXTERN(djpeg_dest_ptr) jinit_write_bmp (j_decompress_ptr cinfo,
|
|
||||||
boolean is_os2);
|
|
||||||
EXTERN(cjpeg_source_ptr) jinit_read_gif (j_compress_ptr cinfo);
|
|
||||||
EXTERN(djpeg_dest_ptr) jinit_write_gif (j_decompress_ptr cinfo);
|
|
||||||
EXTERN(cjpeg_source_ptr) jinit_read_jpeg (j_compress_ptr cinfo);
|
EXTERN(cjpeg_source_ptr) jinit_read_jpeg (j_compress_ptr cinfo);
|
||||||
EXTERN(cjpeg_source_ptr) jinit_read_ppm (j_compress_ptr cinfo);
|
|
||||||
EXTERN(cjpeg_source_ptr) jinit_read_png (j_compress_ptr cinfo);
|
EXTERN(cjpeg_source_ptr) jinit_read_png (j_compress_ptr cinfo);
|
||||||
EXTERN(djpeg_dest_ptr) jinit_write_ppm (j_decompress_ptr cinfo);
|
EXTERN(cjpeg_source_ptr) jinit_read_bmp(j_compress_ptr cinfo,
|
||||||
EXTERN(cjpeg_source_ptr) jinit_read_rle (j_compress_ptr cinfo);
|
boolean use_inversion_array);
|
||||||
EXTERN(djpeg_dest_ptr) jinit_write_rle (j_decompress_ptr cinfo);
|
EXTERN(djpeg_dest_ptr) jinit_write_bmp(j_decompress_ptr cinfo, boolean is_os2,
|
||||||
EXTERN(cjpeg_source_ptr) jinit_read_targa (j_compress_ptr cinfo);
|
boolean use_inversion_array);
|
||||||
EXTERN(djpeg_dest_ptr) jinit_write_targa (j_decompress_ptr cinfo);
|
EXTERN(cjpeg_source_ptr) jinit_read_gif(j_compress_ptr cinfo);
|
||||||
|
EXTERN(djpeg_dest_ptr) jinit_write_gif(j_decompress_ptr cinfo);
|
||||||
|
EXTERN(cjpeg_source_ptr) jinit_read_ppm(j_compress_ptr cinfo);
|
||||||
|
EXTERN(djpeg_dest_ptr) jinit_write_ppm(j_decompress_ptr cinfo);
|
||||||
|
EXTERN(cjpeg_source_ptr) jinit_read_rle(j_compress_ptr cinfo);
|
||||||
|
EXTERN(djpeg_dest_ptr) jinit_write_rle(j_decompress_ptr cinfo);
|
||||||
|
EXTERN(cjpeg_source_ptr) jinit_read_targa(j_compress_ptr cinfo);
|
||||||
|
EXTERN(djpeg_dest_ptr) jinit_write_targa(j_decompress_ptr cinfo);
|
||||||
|
|
||||||
/* cjpeg support routines (in rdswitch.c) */
|
/* cjpeg support routines (in rdswitch.c) */
|
||||||
|
|
||||||
EXTERN(boolean) read_quant_tables (j_compress_ptr cinfo, char *filename,
|
EXTERN(boolean) read_quant_tables(j_compress_ptr cinfo, char *filename,
|
||||||
boolean force_baseline);
|
boolean force_baseline);
|
||||||
EXTERN(boolean) read_scan_script (j_compress_ptr cinfo, char *filename);
|
EXTERN(boolean) read_scan_script(j_compress_ptr cinfo, char *filename);
|
||||||
EXTERN(boolean) set_quality_ratings (j_compress_ptr cinfo, char *arg,
|
EXTERN(boolean) set_quality_ratings(j_compress_ptr cinfo, char *arg,
|
||||||
boolean force_baseline);
|
boolean force_baseline);
|
||||||
EXTERN(boolean) set_quant_slots (j_compress_ptr cinfo, char *arg);
|
EXTERN(boolean) set_quant_slots(j_compress_ptr cinfo, char *arg);
|
||||||
EXTERN(boolean) set_sample_factors (j_compress_ptr cinfo, char *arg);
|
EXTERN(boolean) set_sample_factors(j_compress_ptr cinfo, char *arg);
|
||||||
|
|
||||||
/* djpeg support routines (in rdcolmap.c) */
|
/* djpeg support routines (in rdcolmap.c) */
|
||||||
|
|
||||||
EXTERN(void) read_color_map (j_decompress_ptr cinfo, FILE *infile);
|
EXTERN(void) read_color_map(j_decompress_ptr cinfo, FILE *infile);
|
||||||
|
|
||||||
/* common support routines (in cdjpeg.c) */
|
/* common support routines (in cdjpeg.c) */
|
||||||
|
|
||||||
EXTERN(void) enable_signal_catcher (j_common_ptr cinfo);
|
EXTERN(void) enable_signal_catcher(j_common_ptr cinfo);
|
||||||
EXTERN(void) start_progress_monitor (j_common_ptr cinfo,
|
EXTERN(void) start_progress_monitor(j_common_ptr cinfo,
|
||||||
cd_progress_ptr progress);
|
cd_progress_ptr progress);
|
||||||
EXTERN(void) end_progress_monitor (j_common_ptr cinfo);
|
EXTERN(void) end_progress_monitor(j_common_ptr cinfo);
|
||||||
EXTERN(boolean) keymatch (char *arg, const char *keyword, int minchars);
|
EXTERN(boolean) keymatch(char *arg, const char *keyword, int minchars);
|
||||||
EXTERN(FILE *) read_stdin (void);
|
EXTERN(FILE *) read_stdin(void);
|
||||||
EXTERN(FILE *) write_stdout (void);
|
EXTERN(FILE *) write_stdout(void);
|
||||||
|
|
||||||
/* miscellaneous useful macros */
|
/* miscellaneous useful macros */
|
||||||
|
|
||||||
@@ -154,3 +163,6 @@ EXTERN(FILE *) write_stdout (void);
|
|||||||
#ifndef EXIT_WARNING
|
#ifndef EXIT_WARNING
|
||||||
#define EXIT_WARNING 2
|
#define EXIT_WARNING 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define IsExtRGB(cs) \
|
||||||
|
(cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
|
||||||
|
|||||||
5
cjpeg.1
5
cjpeg.1
@@ -46,7 +46,7 @@ compressing a grayscale BMP file, because
|
|||||||
.B cjpeg
|
.B cjpeg
|
||||||
isn't bright enough to notice whether a BMP file uses only shades of gray.
|
isn't bright enough to notice whether a BMP file uses only shades of gray.
|
||||||
By saying
|
By saying
|
||||||
.BR \-grayscale ,
|
.BR \-grayscale,
|
||||||
you'll get a smaller JPEG file that takes less time to process.
|
you'll get a smaller JPEG file that takes less time to process.
|
||||||
.TP
|
.TP
|
||||||
.B \-rgb
|
.B \-rgb
|
||||||
@@ -187,6 +187,9 @@ method may also give different results on different machines due to varying
|
|||||||
roundoff behavior, whereas the integer methods should give the same results on
|
roundoff behavior, whereas the integer methods should give the same results on
|
||||||
all machines.
|
all machines.
|
||||||
.TP
|
.TP
|
||||||
|
.BI \-icc " file"
|
||||||
|
Embed ICC color management profile contained in the specified file.
|
||||||
|
.TP
|
||||||
.BI \-restart " N"
|
.BI \-restart " N"
|
||||||
Emit a JPEG restart marker every N MCU rows, or every N MCU blocks if "B" is
|
Emit a JPEG restart marker every N MCU rows, or every N MCU blocks if "B" is
|
||||||
attached to the number.
|
attached to the number.
|
||||||
|
|||||||
87
cjpeg.c
87
cjpeg.c
@@ -32,6 +32,11 @@
|
|||||||
#include "jversion.h" /* for version message */
|
#include "jversion.h" /* for version message */
|
||||||
#include "jconfigint.h"
|
#include "jconfigint.h"
|
||||||
|
|
||||||
|
#ifndef HAVE_STDLIB_H /* <stdlib.h> should declare malloc(),free() */
|
||||||
|
extern void *malloc(size_t size);
|
||||||
|
extern void free(void *ptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_CCOMMAND /* command-line reader for Macintosh */
|
#ifdef USE_CCOMMAND /* command-line reader for Macintosh */
|
||||||
#ifdef __MWERKS__
|
#ifdef __MWERKS__
|
||||||
#include <SIOUX.h> /* Metrowerks needs this */
|
#include <SIOUX.h> /* Metrowerks needs this */
|
||||||
@@ -45,7 +50,7 @@
|
|||||||
|
|
||||||
/* Create the add-on message string table. */
|
/* Create the add-on message string table. */
|
||||||
|
|
||||||
#define JMESSAGE(code,string) string ,
|
#define JMESSAGE(code, string) string,
|
||||||
|
|
||||||
static const char * const cdjpeg_message_table[] = {
|
static const char * const cdjpeg_message_table[] = {
|
||||||
#include "cderror.h"
|
#include "cderror.h"
|
||||||
@@ -84,7 +89,7 @@ static boolean is_jpeg;
|
|||||||
static boolean copy_markers;
|
static boolean copy_markers;
|
||||||
|
|
||||||
LOCAL(cjpeg_source_ptr)
|
LOCAL(cjpeg_source_ptr)
|
||||||
select_file_type (j_compress_ptr cinfo, FILE *infile)
|
select_file_type(j_compress_ptr cinfo, FILE *infile)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
@@ -104,7 +109,7 @@ select_file_type (j_compress_ptr cinfo, FILE *infile)
|
|||||||
switch (c) {
|
switch (c) {
|
||||||
#ifdef BMP_SUPPORTED
|
#ifdef BMP_SUPPORTED
|
||||||
case 'B':
|
case 'B':
|
||||||
return jinit_read_bmp(cinfo);
|
return jinit_read_bmp(cinfo, TRUE);
|
||||||
#endif
|
#endif
|
||||||
#ifdef GIF_SUPPORTED
|
#ifdef GIF_SUPPORTED
|
||||||
case 'G':
|
case 'G':
|
||||||
@@ -150,12 +155,13 @@ select_file_type (j_compress_ptr cinfo, FILE *infile)
|
|||||||
|
|
||||||
|
|
||||||
static const char *progname; /* program name for error messages */
|
static const char *progname; /* program name for error messages */
|
||||||
|
static char *icc_filename; /* for -icc switch */
|
||||||
static char *outfilename; /* for -outfile switch */
|
static char *outfilename; /* for -outfile switch */
|
||||||
boolean memdst; /* for -memdst switch */
|
boolean memdst; /* for -memdst switch */
|
||||||
|
|
||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
usage (void)
|
usage(void)
|
||||||
/* complain about bad command line */
|
/* complain about bad command line */
|
||||||
{
|
{
|
||||||
fprintf(stderr, "usage: %s [switches] ", progname);
|
fprintf(stderr, "usage: %s [switches] ", progname);
|
||||||
@@ -196,6 +202,7 @@ usage (void)
|
|||||||
fprintf(stderr, " -tune-ms-ssim Tune trellis optimization for MS-SSIM\n");
|
fprintf(stderr, " -tune-ms-ssim Tune trellis optimization for MS-SSIM\n");
|
||||||
fprintf(stderr, "Switches for advanced users:\n");
|
fprintf(stderr, "Switches for advanced users:\n");
|
||||||
fprintf(stderr, " -noovershoot Disable black-on-white deringing via overshoot\n");
|
fprintf(stderr, " -noovershoot Disable black-on-white deringing via overshoot\n");
|
||||||
|
fprintf(stderr, " -nojfif Do not write JFIF (reduces size by 18 bytes but breaks standards; no known problems in Web browsers)\n");
|
||||||
#ifdef C_ARITH_CODING_SUPPORTED
|
#ifdef C_ARITH_CODING_SUPPORTED
|
||||||
fprintf(stderr, " -arithmetic Use arithmetic coding\n");
|
fprintf(stderr, " -arithmetic Use arithmetic coding\n");
|
||||||
#endif
|
#endif
|
||||||
@@ -219,6 +226,7 @@ usage (void)
|
|||||||
fprintf(stderr, " - 3 ImageMagick table by N. Robidoux\n");
|
fprintf(stderr, " - 3 ImageMagick table by N. Robidoux\n");
|
||||||
fprintf(stderr, " - 4 Custom, tuned for PSNR-HVS\n");
|
fprintf(stderr, " - 4 Custom, tuned for PSNR-HVS\n");
|
||||||
fprintf(stderr, " - 5 Table from paper by Klein, Silverstein and Carney\n");
|
fprintf(stderr, " - 5 Table from paper by Klein, Silverstein and Carney\n");
|
||||||
|
fprintf(stderr, " -icc FILE Embed ICC profile contained in FILE\n");
|
||||||
fprintf(stderr, " -restart N Set restart interval in rows, or in blocks with B\n");
|
fprintf(stderr, " -restart N Set restart interval in rows, or in blocks with B\n");
|
||||||
#ifdef INPUT_SMOOTHING_SUPPORTED
|
#ifdef INPUT_SMOOTHING_SUPPORTED
|
||||||
fprintf(stderr, " -smooth N Smooth dithered input (N=1..100 is strength)\n");
|
fprintf(stderr, " -smooth N Smooth dithered input (N=1..100 is strength)\n");
|
||||||
@@ -242,7 +250,7 @@ usage (void)
|
|||||||
|
|
||||||
|
|
||||||
LOCAL(int)
|
LOCAL(int)
|
||||||
parse_switches (j_compress_ptr cinfo, int argc, char **argv,
|
parse_switches(j_compress_ptr cinfo, int argc, char **argv,
|
||||||
int last_file_arg_seen, boolean for_real)
|
int last_file_arg_seen, boolean for_real)
|
||||||
/* Parse optional switches.
|
/* Parse optional switches.
|
||||||
* Returns argv[] index of first file-name argument (== argc if none).
|
* Returns argv[] index of first file-name argument (== argc if none).
|
||||||
@@ -272,6 +280,7 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
|
|||||||
simple_progressive = FALSE;
|
simple_progressive = FALSE;
|
||||||
#endif
|
#endif
|
||||||
is_targa = FALSE;
|
is_targa = FALSE;
|
||||||
|
icc_filename = NULL;
|
||||||
outfilename = NULL;
|
outfilename = NULL;
|
||||||
memdst = FALSE;
|
memdst = FALSE;
|
||||||
cinfo->err->trace_level = 0;
|
cinfo->err->trace_level = 0;
|
||||||
@@ -333,7 +342,7 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
|
|||||||
/* On first -d, print version identification */
|
/* On first -d, print version identification */
|
||||||
static boolean printed_version = FALSE;
|
static boolean printed_version = FALSE;
|
||||||
|
|
||||||
if (! printed_version) {
|
if (!printed_version) {
|
||||||
fprintf(stderr, "%s version %s (build %s)\n",
|
fprintf(stderr, "%s version %s (build %s)\n",
|
||||||
PACKAGE_NAME, VERSION, BUILD);
|
PACKAGE_NAME, VERSION, BUILD);
|
||||||
fprintf(stderr, "%s\n\n", JCOPYRIGHT);
|
fprintf(stderr, "%s\n\n", JCOPYRIGHT);
|
||||||
@@ -371,6 +380,12 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
|
|||||||
jpeg_c_set_float_param(cinfo, JFLOAT_LAMBDA_LOG_SCALE2,
|
jpeg_c_set_float_param(cinfo, JFLOAT_LAMBDA_LOG_SCALE2,
|
||||||
atof(argv[argn]));
|
atof(argv[argn]));
|
||||||
|
|
||||||
|
} else if (keymatch(arg, "icc", 1)) {
|
||||||
|
/* Set ICC filename. */
|
||||||
|
if (++argn >= argc) /* advance to next argument */
|
||||||
|
usage();
|
||||||
|
icc_filename = argv[argn];
|
||||||
|
|
||||||
} else if (keymatch(arg, "maxmemory", 3)) {
|
} else if (keymatch(arg, "maxmemory", 3)) {
|
||||||
/* Maximum memory in Kb (or Mb with 'm'). */
|
/* Maximum memory in Kb (or Mb with 'm'). */
|
||||||
long lval;
|
long lval;
|
||||||
@@ -483,10 +498,10 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
|
|||||||
if (lval < 0 || lval > 65535L)
|
if (lval < 0 || lval > 65535L)
|
||||||
usage();
|
usage();
|
||||||
if (ch == 'b' || ch == 'B') {
|
if (ch == 'b' || ch == 'B') {
|
||||||
cinfo->restart_interval = (unsigned int) lval;
|
cinfo->restart_interval = (unsigned int)lval;
|
||||||
cinfo->restart_in_rows = 0; /* else prior '-restart n' overrides me */
|
cinfo->restart_in_rows = 0; /* else prior '-restart n' overrides me */
|
||||||
} else {
|
} else {
|
||||||
cinfo->restart_in_rows = (int) lval;
|
cinfo->restart_in_rows = (int)lval;
|
||||||
/* restart_interval will be computed during startup */
|
/* restart_interval will be computed during startup */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -583,6 +598,9 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
|
|||||||
|
|
||||||
} else if (keymatch(arg, "noovershoot", 11)) {
|
} else if (keymatch(arg, "noovershoot", 11)) {
|
||||||
jpeg_c_set_bool_param(cinfo, JBOOLEAN_OVERSHOOT_DERINGING, FALSE);
|
jpeg_c_set_bool_param(cinfo, JBOOLEAN_OVERSHOOT_DERINGING, FALSE);
|
||||||
|
|
||||||
|
} else if (keymatch(arg, "nojfif", 6)) {
|
||||||
|
cinfo->write_JFIF_header = 0;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "%s: unknown option '%s'\n", progname, arg);
|
fprintf(stderr, "%s: unknown option '%s'\n", progname, arg);
|
||||||
usage(); /* bogus switch */
|
usage(); /* bogus switch */
|
||||||
@@ -608,7 +626,7 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (qslotsarg != NULL) /* process -qslots if it was present */
|
if (qslotsarg != NULL) /* process -qslots if it was present */
|
||||||
if (! set_quant_slots(cinfo, qslotsarg))
|
if (!set_quant_slots(cinfo, qslotsarg))
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
/* set_quality_ratings sets default subsampling, so the explicit
|
/* set_quality_ratings sets default subsampling, so the explicit
|
||||||
@@ -626,7 +644,7 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
|
|||||||
|
|
||||||
#ifdef C_MULTISCAN_FILES_SUPPORTED
|
#ifdef C_MULTISCAN_FILES_SUPPORTED
|
||||||
if (scansarg != NULL) /* process -scans if it was present */
|
if (scansarg != NULL) /* process -scans if it was present */
|
||||||
if (! read_scan_script(cinfo, scansarg))
|
if (!read_scan_script(cinfo, scansarg))
|
||||||
usage();
|
usage();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -640,7 +658,7 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct jpeg_compress_struct cinfo;
|
struct jpeg_compress_struct cinfo;
|
||||||
struct jpeg_error_mgr jerr;
|
struct jpeg_error_mgr jerr;
|
||||||
@@ -650,6 +668,9 @@ main (int argc, char **argv)
|
|||||||
int file_index;
|
int file_index;
|
||||||
cjpeg_source_ptr src_mgr;
|
cjpeg_source_ptr src_mgr;
|
||||||
FILE *input_file;
|
FILE *input_file;
|
||||||
|
FILE *icc_file;
|
||||||
|
JOCTET *icc_profile = NULL;
|
||||||
|
long icc_len = 0;
|
||||||
FILE *output_file = NULL;
|
FILE *output_file = NULL;
|
||||||
unsigned char *outbuffer = NULL;
|
unsigned char *outbuffer = NULL;
|
||||||
unsigned long outsize = 0;
|
unsigned long outsize = 0;
|
||||||
@@ -693,14 +714,14 @@ main (int argc, char **argv)
|
|||||||
if (!memdst) {
|
if (!memdst) {
|
||||||
/* Must have either -outfile switch or explicit output file name */
|
/* Must have either -outfile switch or explicit output file name */
|
||||||
if (outfilename == NULL) {
|
if (outfilename == NULL) {
|
||||||
if (file_index != argc-2) {
|
if (file_index != argc - 2) {
|
||||||
fprintf(stderr, "%s: must name one input and one output file\n",
|
fprintf(stderr, "%s: must name one input and one output file\n",
|
||||||
progname);
|
progname);
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
outfilename = argv[file_index+1];
|
outfilename = argv[file_index + 1];
|
||||||
} else {
|
} else {
|
||||||
if (file_index != argc-1) {
|
if (file_index != argc - 1) {
|
||||||
fprintf(stderr, "%s: must name one input and one output file\n",
|
fprintf(stderr, "%s: must name one input and one output file\n",
|
||||||
progname);
|
progname);
|
||||||
usage();
|
usage();
|
||||||
@@ -709,7 +730,7 @@ main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/* Unix style: expect zero or one file name */
|
/* Unix style: expect zero or one file name */
|
||||||
if (file_index < argc-1) {
|
if (file_index < argc - 1) {
|
||||||
fprintf(stderr, "%s: only one input file\n", progname);
|
fprintf(stderr, "%s: only one input file\n", progname);
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
@@ -737,8 +758,35 @@ main (int argc, char **argv)
|
|||||||
output_file = write_stdout();
|
output_file = write_stdout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (icc_filename != NULL) {
|
||||||
|
if ((icc_file = fopen(icc_filename, READ_BINARY)) == NULL) {
|
||||||
|
fprintf(stderr, "%s: can't open %s\n", progname, icc_filename);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
if (fseek(icc_file, 0, SEEK_END) < 0 ||
|
||||||
|
(icc_len = ftell(icc_file)) < 1 ||
|
||||||
|
fseek(icc_file, 0, SEEK_SET) < 0) {
|
||||||
|
fprintf(stderr, "%s: can't determine size of %s\n", progname,
|
||||||
|
icc_filename);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
if ((icc_profile = (JOCTET *)malloc(icc_len)) == NULL) {
|
||||||
|
fprintf(stderr, "%s: can't allocate memory for ICC profile\n", progname);
|
||||||
|
fclose(icc_file);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
if (fread(icc_profile, icc_len, 1, icc_file) < 1) {
|
||||||
|
fprintf(stderr, "%s: can't read ICC profile from %s\n", progname,
|
||||||
|
icc_filename);
|
||||||
|
free(icc_profile);
|
||||||
|
fclose(icc_file);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
fclose(icc_file);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef PROGRESS_REPORT
|
#ifdef PROGRESS_REPORT
|
||||||
start_progress_monitor((j_common_ptr) &cinfo, &progress);
|
start_progress_monitor((j_common_ptr)&cinfo, &progress);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Figure out the input file format, and set up to read it. */
|
/* Figure out the input file format, and set up to read it. */
|
||||||
@@ -800,6 +848,8 @@ main (int argc, char **argv)
|
|||||||
marker->data_length);
|
marker->data_length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (icc_profile != NULL)
|
||||||
|
jpeg_write_icc_profile(&cinfo, icc_profile, (unsigned int)icc_len);
|
||||||
|
|
||||||
/* Process data */
|
/* Process data */
|
||||||
while (cinfo.next_scanline < cinfo.image_height) {
|
while (cinfo.next_scanline < cinfo.image_height) {
|
||||||
@@ -824,15 +874,16 @@ main (int argc, char **argv)
|
|||||||
fclose(output_file);
|
fclose(output_file);
|
||||||
|
|
||||||
#ifdef PROGRESS_REPORT
|
#ifdef PROGRESS_REPORT
|
||||||
end_progress_monitor((j_common_ptr) &cinfo);
|
end_progress_monitor((j_common_ptr)&cinfo);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (memdst) {
|
if (memdst) {
|
||||||
fprintf(stderr, "Compressed size: %lu bytes\n", outsize);
|
fprintf(stderr, "Compressed size: %lu bytes\n", outsize);
|
||||||
if (outbuffer != NULL)
|
|
||||||
free(outbuffer);
|
free(outbuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(icc_profile);
|
||||||
|
|
||||||
/* All done. */
|
/* All done. */
|
||||||
exit(jerr.num_warnings ? EXIT_WARNING : EXIT_SUCCESS);
|
exit(jerr.num_warnings ? EXIT_WARNING : EXIT_SUCCESS);
|
||||||
return 0; /* suppress no-return-value warnings */
|
return 0; /* suppress no-return-value warnings */
|
||||||
|
|||||||
182
cmakescripts/BuildPackages.cmake
Normal file
182
cmakescripts/BuildPackages.cmake
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
# This file is included from the top-level CMakeLists.txt. We just store it
|
||||||
|
# here to avoid cluttering up that file.
|
||||||
|
|
||||||
|
set(PKGNAME ${CMAKE_PROJECT_NAME} CACHE STRING
|
||||||
|
"Distribution package name (default: ${CMAKE_PROJECT_NAME})")
|
||||||
|
set(PKGVENDOR "The ${CMAKE_PROJECT_NAME} Project" CACHE STRING
|
||||||
|
"Vendor name to be included in distribution package descriptions (default: The ${CMAKE_PROJECT_NAME} Project)")
|
||||||
|
set(PKGURL "http://www.${CMAKE_PROJECT_NAME}.org" CACHE STRING
|
||||||
|
"URL of project web site to be included in distribution package descriptions (default: http://www.${CMAKE_PROJECT_NAME}.org)")
|
||||||
|
set(PKGEMAIL "information@${CMAKE_PROJECT_NAME}.org" CACHE STRING
|
||||||
|
"E-mail of project maintainer to be included in distribution package descriptions (default: information@${CMAKE_PROJECT_NAME}.org")
|
||||||
|
set(PKGID "com.${CMAKE_PROJECT_NAME}.${PKGNAME}" CACHE STRING
|
||||||
|
"Globally unique package identifier (reverse DNS notation) (default: com.${CMAKE_PROJECT_NAME}.${PKGNAME})")
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Linux RPM and DEB
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
|
||||||
|
set(RPMARCH ${CMAKE_SYSTEM_PROCESSOR})
|
||||||
|
if(CPU_TYPE STREQUAL "x86_64")
|
||||||
|
set(DEBARCH amd64)
|
||||||
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "armv7*")
|
||||||
|
set(DEBARCH armhf)
|
||||||
|
elseif(CPU_TYPE STREQUAL "arm64")
|
||||||
|
set(DEBARCH ${CPU_TYPE})
|
||||||
|
elseif(CPU_TYPE STREQUAL "arm")
|
||||||
|
set(DEBARCH armel)
|
||||||
|
elseif(CMAKE_SYSTEM_PROCESSOR_LC STREQUAL "ppc64le")
|
||||||
|
set(DEBARCH ppc64el)
|
||||||
|
elseif(CPU_TYPE STREQUAL "powerpc" AND BITS EQUAL 32)
|
||||||
|
set(RPMARCH ppc)
|
||||||
|
set(DEBARCH ppc)
|
||||||
|
else()
|
||||||
|
set(DEBARCH ${CMAKE_SYSTEM_PROCESSOR})
|
||||||
|
endif()
|
||||||
|
message(STATUS "RPM architecture = ${RPMARCH}, DEB architecture = ${DEBARCH}")
|
||||||
|
|
||||||
|
# Re-set CMAKE_POSITION_INDEPENDENT_CODE so that the RPM spec file works
|
||||||
|
# properly
|
||||||
|
boolean_number(CMAKE_POSITION_INDEPENDENT_CODE)
|
||||||
|
|
||||||
|
configure_file(release/makerpm.in pkgscripts/makerpm)
|
||||||
|
configure_file(release/rpm.spec.in pkgscripts/rpm.spec @ONLY)
|
||||||
|
|
||||||
|
add_custom_target(rpm sh pkgscripts/makerpm
|
||||||
|
SOURCES pkgscripts/makerpm)
|
||||||
|
|
||||||
|
configure_file(release/makesrpm.in pkgscripts/makesrpm)
|
||||||
|
|
||||||
|
add_custom_target(srpm sh pkgscripts/makesrpm
|
||||||
|
SOURCES pkgscripts/makesrpm
|
||||||
|
DEPENDS dist)
|
||||||
|
|
||||||
|
configure_file(release/makedpkg.in pkgscripts/makedpkg)
|
||||||
|
configure_file(release/deb-control.in pkgscripts/deb-control)
|
||||||
|
|
||||||
|
add_custom_target(deb sh pkgscripts/makedpkg
|
||||||
|
SOURCES pkgscripts/makedpkg)
|
||||||
|
|
||||||
|
endif() # Linux
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Windows installer (NullSoft Installer)
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
set(INST_PLATFORM "Visual C++")
|
||||||
|
set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-vc)
|
||||||
|
set(INST_REG_NAME ${CMAKE_PROJECT_NAME})
|
||||||
|
elseif(MINGW)
|
||||||
|
set(INST_PLATFORM GCC)
|
||||||
|
set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-gcc)
|
||||||
|
set(INST_REG_NAME ${CMAKE_PROJECT_NAME}-gcc)
|
||||||
|
set(INST_DEFS -DGCC)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(BITS EQUAL 64)
|
||||||
|
set(INST_PLATFORM "${INST_PLATFORM} 64-bit")
|
||||||
|
set(INST_NAME ${INST_NAME}64)
|
||||||
|
set(INST_REG_NAME ${INST_REG_NAME}64)
|
||||||
|
set(INST_DEFS ${INST_DEFS} -DWIN64)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WITH_JAVA)
|
||||||
|
set(INST_DEFS ${INST_DEFS} -DJAVA)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(MSVC_IDE)
|
||||||
|
set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=${CMAKE_CFG_INTDIR}\\")
|
||||||
|
else()
|
||||||
|
set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
string(REGEX REPLACE "/" "\\\\" INST_DIR ${CMAKE_INSTALL_PREFIX})
|
||||||
|
|
||||||
|
configure_file(release/installer.nsi.in installer.nsi @ONLY)
|
||||||
|
|
||||||
|
if(WITH_JAVA)
|
||||||
|
set(JAVA_DEPEND turbojpeg-java)
|
||||||
|
endif()
|
||||||
|
add_custom_target(installer
|
||||||
|
makensis -nocd ${INST_DEFS} installer.nsi
|
||||||
|
DEPENDS jpeg jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom
|
||||||
|
cjpeg djpeg jpegtran tjbench ${JAVA_DEPEND}
|
||||||
|
SOURCES installer.nsi)
|
||||||
|
|
||||||
|
endif() # WIN32
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Cygwin Package
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
if(CYGWIN)
|
||||||
|
|
||||||
|
configure_file(release/makecygwinpkg.in pkgscripts/makecygwinpkg)
|
||||||
|
|
||||||
|
add_custom_target(cygwinpkg sh pkgscripts/makecygwinpkg)
|
||||||
|
|
||||||
|
endif() # CYGWIN
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Mac DMG
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
|
||||||
|
set(DEFAULT_OSX_32BIT_BUILD ${CMAKE_SOURCE_DIR}/osxx86)
|
||||||
|
set(OSX_32BIT_BUILD ${DEFAULT_OSX_32BIT_BUILD} CACHE PATH
|
||||||
|
"Directory containing 32-bit (i386) Mac build to include in universal binaries (default: ${DEFAULT_OSX_32BIT_BUILD})")
|
||||||
|
set(DEFAULT_IOS_ARMV7_BUILD ${CMAKE_SOURCE_DIR}/iosarmv7)
|
||||||
|
set(IOS_ARMV7_BUILD ${DEFAULT_IOS_ARMV7_BUILD} CACHE PATH
|
||||||
|
"Directory containing ARMv7 iOS build to include in universal binaries (default: ${DEFAULT_IOS_ARMV7_BUILD})")
|
||||||
|
set(DEFAULT_IOS_ARMV7S_BUILD ${CMAKE_SOURCE_DIR}/iosarmv7s)
|
||||||
|
set(IOS_ARMV7S_BUILD ${DEFAULT_IOS_ARMV7S_BUILD} CACHE PATH
|
||||||
|
"Directory containing ARMv7s iOS build to include in universal binaries (default: ${DEFAULT_IOS_ARMV7S_BUILD})")
|
||||||
|
set(DEFAULT_IOS_ARMV8_BUILD ${CMAKE_SOURCE_DIR}/iosarmv8)
|
||||||
|
set(IOS_ARMV8_BUILD ${DEFAULT_IOS_ARMV8_BUILD} CACHE PATH
|
||||||
|
"Directory containing ARMv8 iOS build to include in universal binaries (default: ${DEFAULT_IOS_ARMV8_BUILD})")
|
||||||
|
|
||||||
|
set(OSX_APP_CERT_NAME "" CACHE STRING
|
||||||
|
"Name of the Developer ID Application certificate (in the macOS keychain) that should be used to sign the libjpeg-turbo DMG. Leave this blank to generate an unsigned DMG.")
|
||||||
|
set(OSX_INST_CERT_NAME "" CACHE STRING
|
||||||
|
"Name of the Developer ID Installer certificate (in the macOS keychain) that should be used to sign the libjpeg-turbo installer package. Leave this blank to generate an unsigned package.")
|
||||||
|
|
||||||
|
configure_file(release/makemacpkg.in pkgscripts/makemacpkg)
|
||||||
|
configure_file(release/Distribution.xml.in pkgscripts/Distribution.xml)
|
||||||
|
configure_file(release/uninstall.in pkgscripts/uninstall)
|
||||||
|
|
||||||
|
add_custom_target(dmg sh pkgscripts/makemacpkg
|
||||||
|
SOURCES pkgscripts/makemacpkg)
|
||||||
|
|
||||||
|
add_custom_target(udmg sh pkgscripts/makemacpkg universal
|
||||||
|
SOURCES pkgscripts/makemacpkg)
|
||||||
|
|
||||||
|
endif() # APPLE
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Generic
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
add_custom_target(dist
|
||||||
|
COMMAND git archive --prefix=${CMAKE_PROJECT_NAME}-${VERSION}/ HEAD |
|
||||||
|
gzip > ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}-${VERSION}.tar.gz
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
|
configure_file(release/maketarball.in pkgscripts/maketarball)
|
||||||
|
|
||||||
|
add_custom_target(tarball sh pkgscripts/maketarball
|
||||||
|
SOURCES pkgscripts/maketarball)
|
||||||
|
|
||||||
|
configure_file(release/libjpeg.pc.in pkgscripts/libjpeg.pc @ONLY)
|
||||||
|
|
||||||
|
configure_file(release/libturbojpeg.pc.in pkgscripts/libturbojpeg.pc @ONLY)
|
||||||
416
cmakescripts/GNUInstallDirs.cmake
Normal file
416
cmakescripts/GNUInstallDirs.cmake
Normal file
@@ -0,0 +1,416 @@
|
|||||||
|
#.rst:
|
||||||
|
# GNUInstallDirs
|
||||||
|
# --------------
|
||||||
|
#
|
||||||
|
# Define GNU standard installation directories
|
||||||
|
#
|
||||||
|
# Provides install directory variables as defined by the
|
||||||
|
# `GNU Coding Standards`_.
|
||||||
|
#
|
||||||
|
# .. _`GNU Coding Standards`: https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
|
||||||
|
#
|
||||||
|
# Result Variables
|
||||||
|
# ^^^^^^^^^^^^^^^^
|
||||||
|
#
|
||||||
|
# Inclusion of this module defines the following variables:
|
||||||
|
#
|
||||||
|
# ``CMAKE_INSTALL_<dir>``
|
||||||
|
#
|
||||||
|
# Destination for files of a given type. This value may be passed to
|
||||||
|
# the ``DESTINATION`` options of :command:`install` commands for the
|
||||||
|
# corresponding file type.
|
||||||
|
#
|
||||||
|
# ``CMAKE_INSTALL_FULL_<dir>``
|
||||||
|
#
|
||||||
|
# The absolute path generated from the corresponding ``CMAKE_INSTALL_<dir>``
|
||||||
|
# value. If the value is not already an absolute path, an absolute path
|
||||||
|
# is constructed typically by prepending the value of the
|
||||||
|
# :variable:`CMAKE_INSTALL_PREFIX` variable. However, there are some
|
||||||
|
# `special cases`_ as documented below.
|
||||||
|
#
|
||||||
|
# where ``<dir>`` is one of:
|
||||||
|
#
|
||||||
|
# ``BINDIR``
|
||||||
|
# user executables (``bin``)
|
||||||
|
# ``SBINDIR``
|
||||||
|
# system admin executables (``sbin``)
|
||||||
|
# ``LIBEXECDIR``
|
||||||
|
# program executables (``libexec``)
|
||||||
|
# ``SYSCONFDIR``
|
||||||
|
# read-only single-machine data (``etc``)
|
||||||
|
# ``SHAREDSTATEDIR``
|
||||||
|
# modifiable architecture-independent data (``com``)
|
||||||
|
# ``LOCALSTATEDIR``
|
||||||
|
# modifiable single-machine data (``var``)
|
||||||
|
# ``LIBDIR``
|
||||||
|
# object code libraries (``lib`` or ``lib64``
|
||||||
|
# or ``lib/<multiarch-tuple>`` on Debian)
|
||||||
|
# ``INCLUDEDIR``
|
||||||
|
# C header files (``include``)
|
||||||
|
# ``OLDINCLUDEDIR``
|
||||||
|
# C header files for non-gcc (``/usr/include``)
|
||||||
|
# ``DATAROOTDIR``
|
||||||
|
# read-only architecture-independent data root (``share``)
|
||||||
|
# ``DATADIR``
|
||||||
|
# read-only architecture-independent data (``DATAROOTDIR``)
|
||||||
|
# ``INFODIR``
|
||||||
|
# info documentation (``DATAROOTDIR/info``)
|
||||||
|
# ``LOCALEDIR``
|
||||||
|
# locale-dependent data (``DATAROOTDIR/locale``)
|
||||||
|
# ``MANDIR``
|
||||||
|
# man documentation (``DATAROOTDIR/man``)
|
||||||
|
# ``DOCDIR``
|
||||||
|
# documentation root (``DATAROOTDIR/doc/PROJECT_NAME``)
|
||||||
|
#
|
||||||
|
# If the includer does not define a value the above-shown default will be
|
||||||
|
# used and the value will appear in the cache for editing by the user.
|
||||||
|
#
|
||||||
|
# Special Cases
|
||||||
|
# ^^^^^^^^^^^^^
|
||||||
|
#
|
||||||
|
# The following values of :variable:`CMAKE_INSTALL_PREFIX` are special:
|
||||||
|
#
|
||||||
|
# ``/``
|
||||||
|
#
|
||||||
|
# For ``<dir>`` other than the ``SYSCONFDIR`` and ``LOCALSTATEDIR``,
|
||||||
|
# the value of ``CMAKE_INSTALL_<dir>`` is prefixed with ``usr/`` if
|
||||||
|
# it is not user-specified as an absolute path. For example, the
|
||||||
|
# ``INCLUDEDIR`` value ``include`` becomes ``usr/include``.
|
||||||
|
# This is required by the `GNU Coding Standards`_, which state:
|
||||||
|
#
|
||||||
|
# When building the complete GNU system, the prefix will be empty
|
||||||
|
# and ``/usr`` will be a symbolic link to ``/``.
|
||||||
|
#
|
||||||
|
# ``/usr``
|
||||||
|
#
|
||||||
|
# For ``<dir>`` equal to ``SYSCONFDIR`` or ``LOCALSTATEDIR``, the
|
||||||
|
# ``CMAKE_INSTALL_FULL_<dir>`` is computed by prepending just ``/``
|
||||||
|
# to the value of ``CMAKE_INSTALL_<dir>`` if it is not user-specified
|
||||||
|
# as an absolute path. For example, the ``SYSCONFDIR`` value ``etc``
|
||||||
|
# becomes ``/etc``. This is required by the `GNU Coding Standards`_.
|
||||||
|
#
|
||||||
|
# ``/opt/...``
|
||||||
|
#
|
||||||
|
# For ``<dir>`` equal to ``SYSCONFDIR`` or ``LOCALSTATEDIR``, the
|
||||||
|
# ``CMAKE_INSTALL_FULL_<dir>`` is computed by *appending* the prefix
|
||||||
|
# to the value of ``CMAKE_INSTALL_<dir>`` if it is not user-specified
|
||||||
|
# as an absolute path. For example, the ``SYSCONFDIR`` value ``etc``
|
||||||
|
# becomes ``/etc/opt/...``. This is defined by the
|
||||||
|
# `Filesystem Hierarchy Standard`_.
|
||||||
|
#
|
||||||
|
# .. _`Filesystem Hierarchy Standard`: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html
|
||||||
|
#
|
||||||
|
# Macros
|
||||||
|
# ^^^^^^
|
||||||
|
#
|
||||||
|
# .. command:: GNUInstallDirs_get_absolute_install_dir
|
||||||
|
#
|
||||||
|
# ::
|
||||||
|
#
|
||||||
|
# GNUInstallDirs_get_absolute_install_dir(absvar var)
|
||||||
|
#
|
||||||
|
# Set the given variable ``absvar`` to the absolute path contained
|
||||||
|
# within the variable ``var``. This is to allow the computation of an
|
||||||
|
# absolute path, accounting for all the special cases documented
|
||||||
|
# above. While this macro is used to compute the various
|
||||||
|
# ``CMAKE_INSTALL_FULL_<dir>`` variables, it is exposed publicly to
|
||||||
|
# allow users who create additional path variables to also compute
|
||||||
|
# absolute paths where necessary, using the same logic.
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Copyright 2016, 2019 D. R. Commander
|
||||||
|
# Copyright 2016 Dmitry Marakasov
|
||||||
|
# Copyright 2016 Roger Leigh
|
||||||
|
# Copyright 2015 Alex Turbov
|
||||||
|
# Copyright 2014 Rolf Eike Beer
|
||||||
|
# Copyright 2014 Daniele E. Domenichelli
|
||||||
|
# Copyright 2013 Dimitri John Ledkov
|
||||||
|
# Copyright 2011 Alex Neundorf
|
||||||
|
# Copyright 2011 Eric NOULARD
|
||||||
|
# Copyright 2011, 2013-2015 Kitware, Inc.
|
||||||
|
# Copyright 2011 Nikita Krupen'ko
|
||||||
|
#
|
||||||
|
# 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 names of Kitware, Inc., the Insight Software Consortium,
|
||||||
|
# nor the names of their 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
|
||||||
|
# HOLDER 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.
|
||||||
|
#=============================================================================
|
||||||
|
|
||||||
|
# Installation directories
|
||||||
|
#
|
||||||
|
|
||||||
|
macro(GNUInstallDirs_set_install_dir var docstring)
|
||||||
|
# If CMAKE_INSTALL_PREFIX changes and CMAKE_INSTALL_*DIR is still set to the
|
||||||
|
# default value, then modify it accordingly. This presumes that the default
|
||||||
|
# value may change based on the prefix.
|
||||||
|
|
||||||
|
set(_GNUInstallDirs_CMAKE_INSTALL_FORCE_${var} "")
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_${var})
|
||||||
|
set(_GNUInstallDirs_CMAKE_INSTALL_DEFAULT_${var} 1 CACHE INTERNAL
|
||||||
|
"CMAKE_INSTALL_${var} has default value")
|
||||||
|
elseif(DEFINED _GNUInstallDirs_CMAKE_INSTALL_LAST_DEFAULT_${var} AND
|
||||||
|
NOT "${_GNUInstallDirs_CMAKE_INSTALL_LAST_DEFAULT_${var}}" STREQUAL
|
||||||
|
"${CMAKE_INSTALL_DEFAULT_${var}}" AND
|
||||||
|
_GNUInstallDirs_CMAKE_INSTALL_DEFAULT_${var} AND
|
||||||
|
"${_GNUInstallDirs_CMAKE_INSTALL_LAST_${var}}" STREQUAL
|
||||||
|
"${CMAKE_INSTALL_${var}}")
|
||||||
|
set(_GNUInstallDirs_CMAKE_INSTALL_FORCE_${var} "FORCE")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CMAKE_INSTALL_${var} "${CMAKE_INSTALL_DEFAULT_${var}}" CACHE PATH
|
||||||
|
"${docstring} (Default: ${CMAKE_INSTALL_DEFAULT_${var}})"
|
||||||
|
${_GNUInstallDirs_CMAKE_INSTALL_FORCE_${var}})
|
||||||
|
|
||||||
|
if(NOT CMAKE_INSTALL_${var} STREQUAL CMAKE_INSTALL_DEFAULT_${var})
|
||||||
|
unset(_GNUInstallDirs_CMAKE_INSTALL_DEFAULT_${var} CACHE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Save for next run
|
||||||
|
set(_GNUInstallDirs_CMAKE_INSTALL_LAST_${var} "${CMAKE_INSTALL_${var}}"
|
||||||
|
CACHE INTERNAL "CMAKE_INSTALL_${var} during last run")
|
||||||
|
set(_GNUInstallDirs_CMAKE_INSTALL_LAST_DEFAULT_${var}
|
||||||
|
"${CMAKE_INSTALL_DEFAULT_${var}}" CACHE INTERNAL
|
||||||
|
"CMAKE_INSTALL_DEFAULT_${var} during last run")
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_BINDIR)
|
||||||
|
set(CMAKE_INSTALL_DEFAULT_BINDIR "bin")
|
||||||
|
endif()
|
||||||
|
GNUInstallDirs_set_install_dir(BINDIR
|
||||||
|
"Directory into which user executables should be installed")
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_SBINDIR)
|
||||||
|
set(CMAKE_INSTALL_DEFAULT_SBINDIR "sbin")
|
||||||
|
endif()
|
||||||
|
GNUInstallDirs_set_install_dir(SBINDIR
|
||||||
|
"Directory into which system admin executables should be installed")
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_LIBEXECDIR)
|
||||||
|
set(CMAKE_INSTALL_DEFAULT_LIBEXECDIR "libexec")
|
||||||
|
endif()
|
||||||
|
GNUInstallDirs_set_install_dir(LIBEXECDIR
|
||||||
|
"Directory under which executables run by other programs should be installed")
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_SYSCONFDIR)
|
||||||
|
set(CMAKE_INSTALL_DEFAULT_SYSCONFDIR "etc")
|
||||||
|
endif()
|
||||||
|
GNUInstallDirs_set_install_dir(SYSCONFDIR
|
||||||
|
"Directory into which machine-specific read-only ASCII data and configuration files should be installed")
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_SHAREDSTATEDIR)
|
||||||
|
set(CMAKE_INSTALL_DEFAULT_SHAREDSTATEDIR "com")
|
||||||
|
endif()
|
||||||
|
GNUInstallDirs_set_install_dir(SHAREDSTATEDIR
|
||||||
|
"Directory into which architecture-independent run-time-modifiable data files should be installed")
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_LOCALSTATEDIR)
|
||||||
|
set(CMAKE_INSTALL_DEFAULT_LOCALSTATEDIR "var")
|
||||||
|
endif()
|
||||||
|
GNUInstallDirs_set_install_dir(LOCALSTATEDIR
|
||||||
|
"Directory into which machine-specific run-time-modifiable data files should be installed")
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_LIBDIR)
|
||||||
|
set(CMAKE_INSTALL_DEFAULT_LIBDIR "lib")
|
||||||
|
# Override this default 'lib' with 'lib64' iff:
|
||||||
|
# - we are on Linux system but NOT cross-compiling
|
||||||
|
# - we are NOT on debian
|
||||||
|
# - we are on a 64 bits system
|
||||||
|
# reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf
|
||||||
|
# For Debian with multiarch, use 'lib/${CMAKE_LIBRARY_ARCHITECTURE}' if
|
||||||
|
# CMAKE_LIBRARY_ARCHITECTURE is set (which contains e.g. "i386-linux-gnu"
|
||||||
|
# and CMAKE_INSTALL_PREFIX is "/usr"
|
||||||
|
# See http://wiki.debian.org/Multiarch
|
||||||
|
if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$"
|
||||||
|
AND NOT CMAKE_CROSSCOMPILING)
|
||||||
|
if (EXISTS "/etc/debian_version") # is this a debian system ?
|
||||||
|
if(CMAKE_LIBRARY_ARCHITECTURE)
|
||||||
|
if("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$")
|
||||||
|
set(CMAKE_INSTALL_DEFAULT_LIBDIR "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
else() # not debian, rely on CMAKE_SIZEOF_VOID_P:
|
||||||
|
if(NOT DEFINED CMAKE_SIZEOF_VOID_P)
|
||||||
|
message(AUTHOR_WARNING
|
||||||
|
"Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. "
|
||||||
|
"Please enable at least one language before including GNUInstallDirs.")
|
||||||
|
else()
|
||||||
|
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
|
||||||
|
set(CMAKE_INSTALL_DEFAULT_LIBDIR "lib64")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
GNUInstallDirs_set_install_dir(LIBDIR
|
||||||
|
"Directory into which object files and object code libraries should be installed")
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_INCLUDEDIR)
|
||||||
|
set(CMAKE_INSTALL_DEFAULT_INCLUDEDIR "include")
|
||||||
|
endif()
|
||||||
|
GNUInstallDirs_set_install_dir(INCLUDEDIR
|
||||||
|
"Directory into which C header files should be installed")
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_OLDINCLUDEDIR)
|
||||||
|
set(CMAKE_INSTALL_DEFAULT_OLDINCLUDEDIR "/usr/include")
|
||||||
|
endif()
|
||||||
|
GNUInstallDirs_set_install_dir(OLDINCLUDEDIR
|
||||||
|
PATH "Directory into which C header files for non-GCC compilers should be installed")
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_DATAROOTDIR)
|
||||||
|
set(CMAKE_INSTALL_DEFAULT_DATAROOTDIR "share")
|
||||||
|
endif()
|
||||||
|
GNUInstallDirs_set_install_dir(DATAROOTDIR
|
||||||
|
"The root of the directory tree for read-only architecture-independent data files")
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# Values whose defaults are relative to DATAROOTDIR. Store empty values in
|
||||||
|
# the cache and store the defaults in local variables if the cache values are
|
||||||
|
# not set explicitly. This auto-updates the defaults as DATAROOTDIR changes.
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_DATADIR)
|
||||||
|
set(CMAKE_INSTALL_DEFAULT_DATADIR "<CMAKE_INSTALL_DATAROOTDIR>")
|
||||||
|
endif()
|
||||||
|
GNUInstallDirs_set_install_dir(DATADIR
|
||||||
|
"The directory under which read-only architecture-independent data files should be installed")
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_INFODIR)
|
||||||
|
if(CMAKE_SYSTEM_NAME MATCHES "^(.*BSD|DragonFly)$")
|
||||||
|
set(CMAKE_INSTALL_DEFAULT_INFODIR "info")
|
||||||
|
else()
|
||||||
|
set(CMAKE_INSTALL_DEFAULT_INFODIR "<CMAKE_INSTALL_DATAROOTDIR>/info")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
GNUInstallDirs_set_install_dir(INFODIR
|
||||||
|
"The directory into which info documentation files should be installed")
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_MANDIR)
|
||||||
|
if(CMAKE_SYSTEM_NAME MATCHES "^(.*BSD|DragonFly)$")
|
||||||
|
set(CMAKE_INSTALL_DEFAULT_MANDIR "man")
|
||||||
|
else()
|
||||||
|
set(CMAKE_INSTALL_DEFAULT_MANDIR "<CMAKE_INSTALL_DATAROOTDIR>/man")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
GNUInstallDirs_set_install_dir(MANDIR
|
||||||
|
"The directory under which man pages should be installed")
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_LOCALEDIR)
|
||||||
|
set(CMAKE_INSTALL_DEFAULT_LOCALEDIR "<CMAKE_INSTALL_DATAROOTDIR>/locale")
|
||||||
|
endif()
|
||||||
|
GNUInstallDirs_set_install_dir(LOCALEDIR
|
||||||
|
"The directory under which locale-specific message catalogs should be installed")
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_DOCDIR)
|
||||||
|
set(CMAKE_INSTALL_DEFAULT_DOCDIR "<CMAKE_INSTALL_DATAROOTDIR>/doc/${PROJECT_NAME}")
|
||||||
|
endif()
|
||||||
|
GNUInstallDirs_set_install_dir(DOCDIR
|
||||||
|
"The directory into which documentation files (other than info files) should be installed")
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
mark_as_advanced(
|
||||||
|
CMAKE_INSTALL_BINDIR
|
||||||
|
CMAKE_INSTALL_SBINDIR
|
||||||
|
CMAKE_INSTALL_LIBEXECDIR
|
||||||
|
CMAKE_INSTALL_SYSCONFDIR
|
||||||
|
CMAKE_INSTALL_SHAREDSTATEDIR
|
||||||
|
CMAKE_INSTALL_LOCALSTATEDIR
|
||||||
|
CMAKE_INSTALL_LIBDIR
|
||||||
|
CMAKE_INSTALL_INCLUDEDIR
|
||||||
|
CMAKE_INSTALL_OLDINCLUDEDIR
|
||||||
|
CMAKE_INSTALL_DATAROOTDIR
|
||||||
|
CMAKE_INSTALL_DATADIR
|
||||||
|
CMAKE_INSTALL_INFODIR
|
||||||
|
CMAKE_INSTALL_LOCALEDIR
|
||||||
|
CMAKE_INSTALL_MANDIR
|
||||||
|
CMAKE_INSTALL_DOCDIR
|
||||||
|
)
|
||||||
|
|
||||||
|
macro(GNUInstallDirs_get_absolute_install_dir absvar var)
|
||||||
|
string(REGEX REPLACE "[<>]" "@" ${var} "${${var}}")
|
||||||
|
# Handle the specific case of an empty CMAKE_INSTALL_DATAROOTDIR
|
||||||
|
if(NOT CMAKE_INSTALL_DATAROOTDIR AND
|
||||||
|
${var} MATCHES "\@CMAKE_INSTALL_DATAROOTDIR\@/")
|
||||||
|
string(CONFIGURE "${${var}}" ${var} @ONLY)
|
||||||
|
string(REGEX REPLACE "^/" "" ${var} "${${var}}")
|
||||||
|
else()
|
||||||
|
string(CONFIGURE "${${var}}" ${var} @ONLY)
|
||||||
|
endif()
|
||||||
|
if(NOT IS_ABSOLUTE "${${var}}")
|
||||||
|
# Handle special cases:
|
||||||
|
# - CMAKE_INSTALL_PREFIX == /
|
||||||
|
# - CMAKE_INSTALL_PREFIX == /usr
|
||||||
|
# - CMAKE_INSTALL_PREFIX == /opt/...
|
||||||
|
if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/")
|
||||||
|
if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR")
|
||||||
|
set(${absvar} "/${${var}}")
|
||||||
|
else()
|
||||||
|
if (NOT "${${var}}" MATCHES "^usr/")
|
||||||
|
set(${var} "usr/${${var}}")
|
||||||
|
endif()
|
||||||
|
set(${absvar} "/${${var}}")
|
||||||
|
endif()
|
||||||
|
elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$")
|
||||||
|
if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR")
|
||||||
|
set(${absvar} "/${${var}}")
|
||||||
|
else()
|
||||||
|
set(${absvar} "${CMAKE_INSTALL_PREFIX}/${${var}}")
|
||||||
|
endif()
|
||||||
|
elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/opt/.*")
|
||||||
|
if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR")
|
||||||
|
set(${absvar} "/${${var}}${CMAKE_INSTALL_PREFIX}")
|
||||||
|
else()
|
||||||
|
set(${absvar} "${CMAKE_INSTALL_PREFIX}/${${var}}")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(${absvar} "${CMAKE_INSTALL_PREFIX}/${${var}}")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(${absvar} "${${var}}")
|
||||||
|
endif()
|
||||||
|
string(REGEX REPLACE "/$" "" ${absvar} "${${absvar}}")
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# Result directories
|
||||||
|
#
|
||||||
|
foreach(dir
|
||||||
|
BINDIR
|
||||||
|
SBINDIR
|
||||||
|
LIBEXECDIR
|
||||||
|
SYSCONFDIR
|
||||||
|
SHAREDSTATEDIR
|
||||||
|
LOCALSTATEDIR
|
||||||
|
LIBDIR
|
||||||
|
INCLUDEDIR
|
||||||
|
OLDINCLUDEDIR
|
||||||
|
DATAROOTDIR
|
||||||
|
DATADIR
|
||||||
|
INFODIR
|
||||||
|
LOCALEDIR
|
||||||
|
MANDIR
|
||||||
|
DOCDIR
|
||||||
|
)
|
||||||
|
GNUInstallDirs_get_absolute_install_dir(CMAKE_INSTALL_FULL_${dir} CMAKE_INSTALL_${dir})
|
||||||
|
endforeach()
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
# This code is from the CMake FAQ
|
# This code is from the CMake FAQ
|
||||||
|
|
||||||
if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
if (NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
|
||||||
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
|
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_BINARY_DIR@/install_manifest.txt\"")
|
||||||
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
endif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
|
||||||
|
|
||||||
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
|
file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
|
||||||
string(REGEX REPLACE "\n" ";" files "${files}")
|
string(REGEX REPLACE "\n" ";" files "${files}")
|
||||||
list(REVERSE files)
|
list(REVERSE files)
|
||||||
foreach (file ${files})
|
foreach (file ${files})
|
||||||
|
|||||||
@@ -29,7 +29,9 @@ file(GLOB FILES
|
|||||||
*_411_*.png
|
*_411_*.png
|
||||||
*_411_*.ppm
|
*_411_*.ppm
|
||||||
*_411_*.jpg
|
*_411_*.jpg
|
||||||
*_411.yuv)
|
*_411.yuv
|
||||||
|
tjbenchtest*.log
|
||||||
|
tjexampletest*.log)
|
||||||
|
|
||||||
if(NOT FILES STREQUAL "")
|
if(NOT FILES STREQUAL "")
|
||||||
message(STATUS "Removing test files")
|
message(STATUS "Removing test files")
|
||||||
|
|||||||
61
cmyk.h
Normal file
61
cmyk.h
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* cmyk.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017-2018, D. R. Commander.
|
||||||
|
* For conditions of distribution and use, see the accompanying README.ijg
|
||||||
|
* file.
|
||||||
|
*
|
||||||
|
* This file contains convenience functions for performing quick & dirty
|
||||||
|
* CMYK<->RGB conversion. This algorithm is suitable for testing purposes
|
||||||
|
* only. Properly converting between CMYK and RGB requires a color management
|
||||||
|
* system.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CMYK_H
|
||||||
|
#define CMYK_H
|
||||||
|
|
||||||
|
#include <jinclude.h>
|
||||||
|
#define JPEG_INTERNALS
|
||||||
|
#include <jpeglib.h>
|
||||||
|
#include "jconfigint.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* Fully reversible */
|
||||||
|
|
||||||
|
INLINE
|
||||||
|
LOCAL(void)
|
||||||
|
rgb_to_cmyk(JSAMPLE r, JSAMPLE g, JSAMPLE b, JSAMPLE *c, JSAMPLE *m,
|
||||||
|
JSAMPLE *y, JSAMPLE *k)
|
||||||
|
{
|
||||||
|
double ctmp = 1.0 - ((double)r / 255.0);
|
||||||
|
double mtmp = 1.0 - ((double)g / 255.0);
|
||||||
|
double ytmp = 1.0 - ((double)b / 255.0);
|
||||||
|
double ktmp = MIN(MIN(ctmp, mtmp), ytmp);
|
||||||
|
|
||||||
|
if (ktmp == 1.0) ctmp = mtmp = ytmp = 0.0;
|
||||||
|
else {
|
||||||
|
ctmp = (ctmp - ktmp) / (1.0 - ktmp);
|
||||||
|
mtmp = (mtmp - ktmp) / (1.0 - ktmp);
|
||||||
|
ytmp = (ytmp - ktmp) / (1.0 - ktmp);
|
||||||
|
}
|
||||||
|
*c = (JSAMPLE)(255.0 - ctmp * 255.0 + 0.5);
|
||||||
|
*m = (JSAMPLE)(255.0 - mtmp * 255.0 + 0.5);
|
||||||
|
*y = (JSAMPLE)(255.0 - ytmp * 255.0 + 0.5);
|
||||||
|
*k = (JSAMPLE)(255.0 - ktmp * 255.0 + 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Fully reversible only for C/M/Y/K values generated with rgb_to_cmyk() */
|
||||||
|
|
||||||
|
INLINE
|
||||||
|
LOCAL(void)
|
||||||
|
cmyk_to_rgb(JSAMPLE c, JSAMPLE m, JSAMPLE y, JSAMPLE k, JSAMPLE *r, JSAMPLE *g,
|
||||||
|
JSAMPLE *b)
|
||||||
|
{
|
||||||
|
*r = (JSAMPLE)((double)c * (double)k / 255.0 + 0.5);
|
||||||
|
*g = (JSAMPLE)((double)m * (double)k / 255.0 + 0.5);
|
||||||
|
*b = (JSAMPLE)((double)y * (double)k / 255.0 + 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* CMYK_H */
|
||||||
619
configure.ac
619
configure.ac
@@ -1,619 +0,0 @@
|
|||||||
# -*- Autoconf -*-
|
|
||||||
# Process this file with autoconf to produce a configure script.
|
|
||||||
|
|
||||||
AC_PREREQ([2.56])
|
|
||||||
AC_INIT([mozjpeg], [3.3.1])
|
|
||||||
BUILD=`date +%Y%m%d`
|
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2])
|
|
||||||
AC_PREFIX_DEFAULT(/opt/mozjpeg)
|
|
||||||
|
|
||||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
|
||||||
|
|
||||||
# Checks for programs.
|
|
||||||
SAVED_CFLAGS=${CFLAGS}
|
|
||||||
SAVED_CPPFLAGS=${CPPFLAGS}
|
|
||||||
AC_PROG_CPP
|
|
||||||
AC_PROG_CC
|
|
||||||
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
|
|
||||||
AM_PROG_AS
|
|
||||||
AM_PROG_CC_C_O
|
|
||||||
AC_PROG_INSTALL
|
|
||||||
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
|
|
||||||
AC_PROG_LIBTOOL
|
|
||||||
AC_PROG_LN_S
|
|
||||||
|
|
||||||
AC_ARG_WITH([build-date], [Use custom build string to enable reproducible builds (default: YYMMDD)],
|
|
||||||
[BUILD="$with_build_date"],
|
|
||||||
[BUILD=`date +%Y%m%d`])
|
|
||||||
|
|
||||||
PKG_PROG_PKG_CONFIG
|
|
||||||
|
|
||||||
# When the prefix is /opt/libjpeg-turbo, we assume that an "official" binary is
|
|
||||||
# being created, and thus we install things into specific locations.
|
|
||||||
|
|
||||||
old_prefix=${prefix}
|
|
||||||
if test "x$prefix" = "xNONE" -a "x$ac_default_prefix" != "x"; then
|
|
||||||
prefix=$ac_default_prefix
|
|
||||||
fi
|
|
||||||
DATADIR=`eval echo ${datadir}`
|
|
||||||
DATADIR=`eval echo $DATADIR`
|
|
||||||
if test "$DATADIR" = "/opt/libjpeg-turbo/share"; then
|
|
||||||
datadir='${prefix}'
|
|
||||||
fi
|
|
||||||
DATADIR=`eval echo ${datarootdir}`
|
|
||||||
DATADIR=`eval echo $DATADIR`
|
|
||||||
if test "$DATADIR" = "/opt/libjpeg-turbo/share"; then
|
|
||||||
datarootdir='${prefix}'
|
|
||||||
fi
|
|
||||||
DOCDIR=`eval echo ${docdir}`
|
|
||||||
DOCDIR=`eval echo $DOCDIR`
|
|
||||||
if test "$DOCDIR" = "/opt/libjpeg-turbo/doc/libjpeg-turbo"; then
|
|
||||||
docdir='${datadir}/doc'
|
|
||||||
fi
|
|
||||||
|
|
||||||
old_exec_prefix=${exec_prefix}
|
|
||||||
if test "x$exec_prefix" = "xNONE"; then
|
|
||||||
exec_prefix=${prefix}
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_CHECK_SIZEOF(size_t)
|
|
||||||
|
|
||||||
if test "x${libdir}" = 'x${exec_prefix}/lib' -o "x${libdir}" = 'x${prefix}/lib'; then
|
|
||||||
LIBDIR=`eval echo ${libdir}`
|
|
||||||
LIBDIR=`eval echo $LIBDIR`
|
|
||||||
if test "$LIBDIR" = "/opt/mozjpeg/lib"; then
|
|
||||||
case $host_os in
|
|
||||||
darwin*)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if test "${ac_cv_sizeof_size_t}" = "8"; then
|
|
||||||
libdir='${exec_prefix}/lib64'
|
|
||||||
elif test "${ac_cv_sizeof_size_t}" = "4"; then
|
|
||||||
libdir='${exec_prefix}/lib32'
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
exec_prefix=${old_exec_prefix}
|
|
||||||
prefix=${old_prefix}
|
|
||||||
|
|
||||||
# Check whether compiler supports pointers to undefined structures
|
|
||||||
AC_MSG_CHECKING(whether compiler supports pointers to undefined structures)
|
|
||||||
AC_TRY_COMPILE([ typedef struct undefined_structure *undef_struct_ptr; ], ,
|
|
||||||
AC_MSG_RESULT(yes),
|
|
||||||
[AC_MSG_RESULT(no)
|
|
||||||
AC_DEFINE([INCOMPLETE_TYPES_BROKEN], [1],
|
|
||||||
[Compiler does not support pointers to undefined structures.])])
|
|
||||||
|
|
||||||
if test "x${GCC}" = "xyes"; then
|
|
||||||
if test "x${SAVED_CFLAGS}" = "x"; then
|
|
||||||
CFLAGS=-O3
|
|
||||||
fi
|
|
||||||
if test "x${SAVED_CPPFLAGS}" = "x"; then
|
|
||||||
CPPFLAGS=-Wall
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
|
|
||||||
if test "x${SUNCC}" = "xyes"; then
|
|
||||||
if test "x${SAVED_CFLAGS}" = "x"; then
|
|
||||||
CFLAGS=-xO5
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Checks for libraries.
|
|
||||||
AC_CHECK_LIB([m],[pow])
|
|
||||||
|
|
||||||
PKG_CHECK_MODULES([libpng], [libpng], [HAVE_LIBPNG=1], [
|
|
||||||
PKG_CHECK_MODULES([libpng], [libpng12], [HAVE_LIBPNG=1], [HAVE_LIBPNG=0])
|
|
||||||
])
|
|
||||||
AM_CONDITIONAL([HAVE_LIBPNG], [test "$HAVE_LIBPNG" -eq 1])
|
|
||||||
|
|
||||||
# Checks for header files.
|
|
||||||
AC_HEADER_STDC
|
|
||||||
AC_CHECK_HEADERS([stddef.h stdlib.h locale.h string.h])
|
|
||||||
AC_CHECK_HEADER([sys/types.h],
|
|
||||||
AC_DEFINE([NEED_SYS_TYPES_H], 1, [Define if you need to include <sys/types.h> to get size_t.]))
|
|
||||||
|
|
||||||
# Checks for typedefs, structures, and compiler characteristics.
|
|
||||||
AC_C_CONST
|
|
||||||
AC_C_CHAR_UNSIGNED
|
|
||||||
AC_C_INLINE
|
|
||||||
AC_TYPE_SIZE_T
|
|
||||||
AC_CHECK_TYPES([unsigned char, unsigned short])
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([if right shift is signed])
|
|
||||||
AC_TRY_RUN(
|
|
||||||
[#include <stdio.h>
|
|
||||||
int is_shifting_signed (long arg) {
|
|
||||||
long res = arg >> 4;
|
|
||||||
|
|
||||||
if (res == -0x7F7E80CL)
|
|
||||||
return 1; /* right shift is signed */
|
|
||||||
|
|
||||||
/* see if unsigned-shift hack will fix it. */
|
|
||||||
/* we can't just test exact value since it depends on width of long... */
|
|
||||||
res |= (~0L) << (32-4);
|
|
||||||
if (res == -0x7F7E80CL)
|
|
||||||
return 0; /* right shift is unsigned */
|
|
||||||
|
|
||||||
printf("Right shift isn't acting as I expect it to.\n");
|
|
||||||
printf("I fear the JPEG software will not work at all.\n\n");
|
|
||||||
return 0; /* try it with unsigned anyway */
|
|
||||||
}
|
|
||||||
int main (void) {
|
|
||||||
exit(is_shifting_signed(-0x7F7E80B1L));
|
|
||||||
}],
|
|
||||||
[AC_MSG_RESULT(no)
|
|
||||||
AC_DEFINE([RIGHT_SHIFT_IS_UNSIGNED], 1,
|
|
||||||
[Define if your (broken) compiler shifts signed values as if they were unsigned.])],
|
|
||||||
[AC_MSG_RESULT(yes)],
|
|
||||||
[AC_MSG_RESULT(Assuming that right shift is signed on target machine.)])
|
|
||||||
|
|
||||||
# Checks for library functions.
|
|
||||||
AC_CHECK_FUNCS([memset memcpy], [],
|
|
||||||
[AC_DEFINE([NEED_BSD_STRINGS], 1,
|
|
||||||
[Define if you have BSD-like bzero and bcopy in <strings.h> rather than memset/memcpy in <string.h>.])])
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([libjpeg API version])
|
|
||||||
AC_ARG_VAR(JPEG_LIB_VERSION, [libjpeg API version (62, 70, or 80)])
|
|
||||||
if test "x$JPEG_LIB_VERSION" = "x"; then
|
|
||||||
AC_ARG_WITH([jpeg7],
|
|
||||||
AC_HELP_STRING([--with-jpeg7],
|
|
||||||
[Emulate libjpeg v7 API/ABI (this makes mozjpeg backward incompatible with libjpeg v6b.)]))
|
|
||||||
AC_ARG_WITH([jpeg8],
|
|
||||||
AC_HELP_STRING([--with-jpeg8],
|
|
||||||
[Emulate libjpeg v8 API/ABI (this makes mozjpeg backward incompatible with libjpeg v6b.)]))
|
|
||||||
if test "x${with_jpeg8}" = "xyes"; then
|
|
||||||
JPEG_LIB_VERSION=80
|
|
||||||
else
|
|
||||||
if test "x${with_jpeg7}" = "xyes"; then
|
|
||||||
JPEG_LIB_VERSION=70
|
|
||||||
else
|
|
||||||
JPEG_LIB_VERSION=62
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
JPEG_LIB_VERSION_DECIMAL=`expr $JPEG_LIB_VERSION / 10`.`expr $JPEG_LIB_VERSION % 10`
|
|
||||||
AC_SUBST(JPEG_LIB_VERSION_DECIMAL)
|
|
||||||
AC_MSG_RESULT([$JPEG_LIB_VERSION_DECIMAL])
|
|
||||||
AC_DEFINE_UNQUOTED(JPEG_LIB_VERSION, [$JPEG_LIB_VERSION],
|
|
||||||
[libjpeg API version])
|
|
||||||
|
|
||||||
AC_ARG_VAR(SO_MAJOR_VERSION,
|
|
||||||
[Major version of the mozjpeg shared library (default is determined by the API version)])
|
|
||||||
AC_ARG_VAR(SO_MINOR_VERSION,
|
|
||||||
[Minor version of the mozjpeg shared library (default is determined by the API version)])
|
|
||||||
if test "x$SO_MAJOR_VERSION" = "x"; then
|
|
||||||
case "$JPEG_LIB_VERSION" in
|
|
||||||
62) SO_MAJOR_VERSION=$JPEG_LIB_VERSION ;;
|
|
||||||
*) SO_MAJOR_VERSION=`expr $JPEG_LIB_VERSION / 10` ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
if test "x$SO_MINOR_VERSION" = "x"; then
|
|
||||||
case "$JPEG_LIB_VERSION" in
|
|
||||||
80) SO_MINOR_VERSION=2 ;;
|
|
||||||
*) SO_MINOR_VERSION=0 ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
RPM_CONFIG_ARGS=
|
|
||||||
|
|
||||||
# Memory source/destination managers
|
|
||||||
SO_AGE=1
|
|
||||||
MEM_SRCDST_FUNCTIONS=
|
|
||||||
if test "x${with_jpeg8}" != "xyes"; then
|
|
||||||
AC_MSG_CHECKING([whether to include in-memory source/destination managers])
|
|
||||||
AC_ARG_WITH([mem-srcdst],
|
|
||||||
AC_HELP_STRING([--without-mem-srcdst],
|
|
||||||
[Do not include in-memory source/destination manager functions when emulating the libjpeg v6b or v7 API/ABI]))
|
|
||||||
if test "x$with_mem_srcdst" != "xno"; then
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
AC_DEFINE([MEM_SRCDST_SUPPORTED], [1],
|
|
||||||
[Support in-memory source/destination managers])
|
|
||||||
SO_AGE=2
|
|
||||||
MEM_SRCDST_FUNCTIONS="global: jpeg_mem_dest; jpeg_mem_src;";
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-mem-srcdst"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([libjpeg shared library version])
|
|
||||||
AC_MSG_RESULT([$SO_MAJOR_VERSION.$SO_AGE.$SO_MINOR_VERSION])
|
|
||||||
LIBTOOL_CURRENT=`expr $SO_MAJOR_VERSION + $SO_AGE`
|
|
||||||
AC_SUBST(LIBTOOL_CURRENT)
|
|
||||||
AC_SUBST(SO_MAJOR_VERSION)
|
|
||||||
AC_SUBST(SO_MINOR_VERSION)
|
|
||||||
AC_SUBST(SO_AGE)
|
|
||||||
AC_SUBST(MEM_SRCDST_FUNCTIONS)
|
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED(MOZJPEG_VERSION, [$VERSION], [mozjpeg version])
|
|
||||||
|
|
||||||
m4_define(version_triplet,m4_split(AC_PACKAGE_VERSION,[[.]]))
|
|
||||||
m4_define(version_major,m4_car(m4_shiftn(1,[],version_triplet)))
|
|
||||||
m4_define(version_minor,m4_car(m4_shiftn(2,[],version_triplet)))
|
|
||||||
m4_define(version_revision,m4_car(m4_shiftn(3,[],version_triplet)))
|
|
||||||
VERSION_MAJOR=version_major
|
|
||||||
VERSION_MINOR=version_minor
|
|
||||||
VERSION_REVISION=version_revision
|
|
||||||
LIBJPEG_TURBO_VERSION_NUMBER=`printf "%d%03d%03d" $VERSION_MAJOR $VERSION_MINOR $VERSION_REVISION`
|
|
||||||
AC_DEFINE_UNQUOTED(LIBJPEG_TURBO_VERSION_NUMBER, [$LIBJPEG_TURBO_VERSION_NUMBER], [libjpeg-turbo version in integer form])
|
|
||||||
|
|
||||||
VERSION_SCRIPT=yes
|
|
||||||
AC_ARG_ENABLE([ld-version-script],
|
|
||||||
AS_HELP_STRING([--disable-ld-version-script],
|
|
||||||
[Disable linker version script for mozjpeg (default is to use linker version script if the linker supports it)]),
|
|
||||||
[VERSION_SCRIPT=$enableval], [])
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether the linker supports version scripts])
|
|
||||||
SAVED_LDFLAGS="$LDFLAGS"
|
|
||||||
LDFLAGS="$LDFLAGS -Wl,--version-script,conftest.map"
|
|
||||||
cat > conftest.map <<EOF
|
|
||||||
VERS_1 {
|
|
||||||
global: *;
|
|
||||||
};
|
|
||||||
EOF
|
|
||||||
AC_LINK_IFELSE([AC_LANG_SOURCE([AC_LANG_PROGRAM([], [])])],
|
|
||||||
[VERSION_SCRIPT_FLAG=-Wl,--version-script,;
|
|
||||||
AC_MSG_RESULT([yes (GNU style)])],
|
|
||||||
[])
|
|
||||||
if test "x$VERSION_SCRIPT_FLAG" = "x"; then
|
|
||||||
LDFLAGS="$SAVED_LDFLAGS -Wl,-M,conftest.map"
|
|
||||||
AC_LINK_IFELSE([AC_LANG_SOURCE([AC_LANG_PROGRAM([], [])])],
|
|
||||||
[VERSION_SCRIPT_FLAG=-Wl,-M,;
|
|
||||||
AC_MSG_RESULT([yes (Sun style)])],
|
|
||||||
[])
|
|
||||||
fi
|
|
||||||
if test "x$VERSION_SCRIPT_FLAG" = "x"; then
|
|
||||||
VERSION_SCRIPT=no
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
fi
|
|
||||||
LDFLAGS="$SAVED_LDFLAGS"
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to use version script when building mozjpeg])
|
|
||||||
AC_MSG_RESULT($VERSION_SCRIPT)
|
|
||||||
|
|
||||||
AM_CONDITIONAL(VERSION_SCRIPT, test "x$VERSION_SCRIPT" = "xyes")
|
|
||||||
AC_SUBST(VERSION_SCRIPT_FLAG)
|
|
||||||
|
|
||||||
# Check for non-broken inline under various spellings
|
|
||||||
AC_MSG_CHECKING(for inline)
|
|
||||||
ljt_cv_inline=""
|
|
||||||
AC_TRY_COMPILE(, [} inline __attribute__((always_inline)) int foo() { return 0; }
|
|
||||||
int bar() { return foo();], ljt_cv_inline="inline __attribute__((always_inline))",
|
|
||||||
AC_TRY_COMPILE(, [} __inline__ int foo() { return 0; }
|
|
||||||
int bar() { return foo();], ljt_cv_inline="__inline__",
|
|
||||||
AC_TRY_COMPILE(, [} __inline int foo() { return 0; }
|
|
||||||
int bar() { return foo();], ljt_cv_inline="__inline",
|
|
||||||
AC_TRY_COMPILE(, [} inline int foo() { return 0; }
|
|
||||||
int bar() { return foo();], ljt_cv_inline="inline"))))
|
|
||||||
AC_MSG_RESULT($ljt_cv_inline)
|
|
||||||
AC_DEFINE_UNQUOTED([INLINE],[$ljt_cv_inline],[How to obtain function inlining.])
|
|
||||||
|
|
||||||
# Arithmetic coding support
|
|
||||||
AC_MSG_CHECKING([whether to include arithmetic encoding support])
|
|
||||||
AC_ARG_WITH([arith-enc],
|
|
||||||
AC_HELP_STRING([--without-arith-enc],
|
|
||||||
[Do not include arithmetic encoding support when emulating the libjpeg v6b API/ABI]))
|
|
||||||
if test "x$with_12bit" = "xyes"; then
|
|
||||||
with_arith_enc=no
|
|
||||||
fi
|
|
||||||
if test "x${with_jpeg8}" = "xyes" -o "x${with_jpeg7}" = "xyes"; then
|
|
||||||
with_arith_enc=yes
|
|
||||||
fi
|
|
||||||
if test "x$with_arith_enc" = "xno"; then
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-arith-enc"
|
|
||||||
else
|
|
||||||
AC_DEFINE([C_ARITH_CODING_SUPPORTED], [1], [Support arithmetic encoding])
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
fi
|
|
||||||
AM_CONDITIONAL([WITH_ARITH_ENC], [test "x$with_arith_enc" != "xno"])
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to include arithmetic decoding support])
|
|
||||||
AC_ARG_WITH([arith-dec],
|
|
||||||
AC_HELP_STRING([--without-arith-dec],
|
|
||||||
[Do not include arithmetic decoding support when emulating the libjpeg v6b API/ABI]))
|
|
||||||
if test "x$with_12bit" = "xyes"; then
|
|
||||||
with_arith_dec=no
|
|
||||||
fi
|
|
||||||
if test "x${with_jpeg8}" = "xyes" -o "x${with_jpeg7}" = "xyes"; then
|
|
||||||
with_arith_dec=yes
|
|
||||||
fi
|
|
||||||
if test "x$with_arith_dec" = "xno"; then
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-arith-dec"
|
|
||||||
else
|
|
||||||
AC_DEFINE([D_ARITH_CODING_SUPPORTED], [1], [Support arithmetic decoding])
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
fi
|
|
||||||
AM_CONDITIONAL([WITH_ARITH_DEC], [test "x$with_arith_dec" != "xno"])
|
|
||||||
|
|
||||||
AM_CONDITIONAL([WITH_ARITH],
|
|
||||||
[test "x$with_arith_dec" != "xno" -o "x$with_arith_enc" != "xno"])
|
|
||||||
|
|
||||||
# 12-bit component support
|
|
||||||
AC_MSG_CHECKING([whether to use 12-bit samples])
|
|
||||||
AC_ARG_WITH([12bit],
|
|
||||||
AC_HELP_STRING([--with-12bit], [Encode/decode JPEG images with 12-bit samples (implies --without-simd --without-turbojpeg --without-arith-dec --without-arith-enc)]))
|
|
||||||
if test "x$with_12bit" = "xyes"; then
|
|
||||||
AC_DEFINE([BITS_IN_JSAMPLE], [12], [use 8 or 12])
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
fi
|
|
||||||
AM_CONDITIONAL([WITH_12BIT], [test "x$with_12bit" = "xyes"])
|
|
||||||
|
|
||||||
# TurboJPEG support
|
|
||||||
AC_MSG_CHECKING([whether to build TurboJPEG C wrapper])
|
|
||||||
AC_ARG_WITH([turbojpeg],
|
|
||||||
AC_HELP_STRING([--without-turbojpeg],
|
|
||||||
[Do not include the TurboJPEG wrapper library and associated test programs]))
|
|
||||||
if test "x$with_12bit" = "xyes"; then
|
|
||||||
with_turbojpeg=no
|
|
||||||
fi
|
|
||||||
if test "x$with_turbojpeg" = "xno"; then
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-turbojpeg"
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Java support
|
|
||||||
AC_ARG_VAR(JAVAC, [Java compiler command (default: javac)])
|
|
||||||
if test "x$JAVAC" = "x"; then
|
|
||||||
JAVAC=javac
|
|
||||||
fi
|
|
||||||
AC_SUBST(JAVAC)
|
|
||||||
AC_ARG_VAR(JAVACFLAGS, [Java compiler flags])
|
|
||||||
AC_SUBST(JAVACFLAGS)
|
|
||||||
AC_ARG_VAR(JAR, [Java archive command (default: jar)])
|
|
||||||
if test "x$JAR" = "x"; then
|
|
||||||
JAR=jar
|
|
||||||
fi
|
|
||||||
AC_SUBST(JAR)
|
|
||||||
AC_ARG_VAR(JAVA, [Java runtime command (default: java)])
|
|
||||||
if test "x$JAVA" = "x"; then
|
|
||||||
JAVA=java
|
|
||||||
fi
|
|
||||||
AC_SUBST(JAVA)
|
|
||||||
AC_ARG_VAR(JNI_CFLAGS,
|
|
||||||
[C compiler flags needed to include jni.h (default: -I/System/Library/Frameworks/JavaVM.framework/Headers on OS X, '-I/usr/java/include -I/usr/java/include/solaris' on Solaris, and '-I/usr/java/default/include -I/usr/java/default/include/linux' on Linux)])
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to build TurboJPEG Java wrapper])
|
|
||||||
AC_ARG_WITH([java],
|
|
||||||
AC_HELP_STRING([--with-java], [Build Java wrapper for the TurboJPEG library]))
|
|
||||||
if test "x$with_12bit" = "xyes" -o "x$with_turbojpeg" = "xno"; then
|
|
||||||
with_java=no
|
|
||||||
fi
|
|
||||||
|
|
||||||
WITH_JAVA=0
|
|
||||||
if test "x$with_java" = "xyes"; then
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
|
|
||||||
case $host_os in
|
|
||||||
darwin*)
|
|
||||||
DEFAULT_JNI_CFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers
|
|
||||||
;;
|
|
||||||
solaris*)
|
|
||||||
DEFAULT_JNI_CFLAGS='-I/usr/java/include -I/usr/java/include/solaris'
|
|
||||||
;;
|
|
||||||
linux*)
|
|
||||||
DEFAULT_JNI_CFLAGS='-I/usr/java/default/include -I/usr/java/default/include/linux'
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
if test "x$JNI_CFLAGS" = "x"; then
|
|
||||||
JNI_CFLAGS=$DEFAULT_JNI_CFLAGS
|
|
||||||
fi
|
|
||||||
|
|
||||||
SAVE_CPPFLAGS=${CPPFLAGS}
|
|
||||||
CPPFLAGS="${CPPFLAGS} ${JNI_CFLAGS}"
|
|
||||||
AC_CHECK_HEADERS([jni.h], [DUMMY=1],
|
|
||||||
[AC_MSG_ERROR([Could not find JNI header file])])
|
|
||||||
CPPFLAGS=${SAVE_CPPFLAGS}
|
|
||||||
AC_SUBST(JNI_CFLAGS)
|
|
||||||
|
|
||||||
RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --with-java"
|
|
||||||
JAVA_RPM_CONTENTS_1='%dir %{_datadir}/classes'
|
|
||||||
JAVA_RPM_CONTENTS_2=%{_datadir}/classes/turbojpeg.jar
|
|
||||||
WITH_JAVA=1
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
fi
|
|
||||||
AM_CONDITIONAL([WITH_JAVA], [test "x$with_java" = "xyes"])
|
|
||||||
AC_SUBST(WITH_JAVA)
|
|
||||||
AC_SUBST(JAVA_RPM_CONTENTS_1)
|
|
||||||
AC_SUBST(JAVA_RPM_CONTENTS_2)
|
|
||||||
|
|
||||||
# optionally force using gas-preprocessor.pl for compatibility testing
|
|
||||||
AC_ARG_WITH([gas-preprocessor],
|
|
||||||
AC_HELP_STRING([--with-gas-preprocessor],
|
|
||||||
[Force using gas-preprocessor.pl on ARM.]))
|
|
||||||
if test "x${with_gas_preprocessor}" = "xyes"; then
|
|
||||||
case $host_os in
|
|
||||||
darwin*)
|
|
||||||
CCAS="gas-preprocessor.pl -fix-unreq $CC"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
CCAS="gas-preprocessor.pl -no-fix-unreq $CC"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
AC_SUBST([CCAS])
|
|
||||||
fi
|
|
||||||
|
|
||||||
# SIMD is optional
|
|
||||||
AC_ARG_WITH([simd],
|
|
||||||
AC_HELP_STRING([--without-simd], [Do not include SIMD extensions]))
|
|
||||||
if test "x$with_12bit" = "xyes"; then
|
|
||||||
with_simd=no
|
|
||||||
fi
|
|
||||||
if test "x${with_simd}" != "xno"; then
|
|
||||||
require_simd=no
|
|
||||||
if test "x${with_simd}" = "xyes"; then
|
|
||||||
require_simd=yes
|
|
||||||
fi
|
|
||||||
# Check if we're on a supported CPU
|
|
||||||
AC_MSG_CHECKING([if we have SIMD optimisations for cpu type])
|
|
||||||
case "$host_cpu" in
|
|
||||||
x86_64 | amd64)
|
|
||||||
AC_MSG_RESULT([yes (x86_64)])
|
|
||||||
AC_PROG_NASM
|
|
||||||
simd_arch=x86_64
|
|
||||||
;;
|
|
||||||
i*86 | x86 | ia32)
|
|
||||||
AC_MSG_RESULT([yes (i386)])
|
|
||||||
AC_PROG_NASM
|
|
||||||
simd_arch=i386
|
|
||||||
;;
|
|
||||||
arm*)
|
|
||||||
AC_MSG_RESULT([yes (arm)])
|
|
||||||
AC_MSG_CHECKING([if the assembler is GNU-compatible and can be used])
|
|
||||||
AC_CHECK_COMPATIBLE_ARM_ASSEMBLER_IFELSE(
|
|
||||||
[if test "x$ac_use_gas_preprocessor" = "xyes"; then
|
|
||||||
AC_MSG_RESULT([yes (with gas-preprocessor)])
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
fi
|
|
||||||
simd_arch=arm],
|
|
||||||
[AC_MSG_RESULT([no])
|
|
||||||
with_simd=no])
|
|
||||||
if test "x${with_simd}" = "xno"; then
|
|
||||||
if test "x${require_simd}" = "xyes"; then
|
|
||||||
AC_MSG_ERROR([SIMD support can't be enabled.])
|
|
||||||
else
|
|
||||||
AC_MSG_WARN([SIMD support can't be enabled. Performance will suffer.])
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
aarch64*)
|
|
||||||
AC_MSG_RESULT([yes (arm64)])
|
|
||||||
AC_MSG_CHECKING([if the assembler is GNU-compatible and can be used])
|
|
||||||
AC_CHECK_COMPATIBLE_ARM64_ASSEMBLER_IFELSE(
|
|
||||||
[if test "x$ac_use_gas_preprocessor" = "xyes"; then
|
|
||||||
AC_MSG_RESULT([yes (with gas-preprocessor)])
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
fi
|
|
||||||
simd_arch=aarch64],
|
|
||||||
[AC_MSG_RESULT([no])
|
|
||||||
with_simd=no])
|
|
||||||
if test "x${with_simd}" = "xno"; then
|
|
||||||
if test "x${require_simd}" = "xyes"; then
|
|
||||||
AC_MSG_ERROR([SIMD support can't be enabled.])
|
|
||||||
else
|
|
||||||
AC_MSG_WARN([SIMD support can't be enabled. Performance will suffer.])
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
mips*)
|
|
||||||
AC_MSG_RESULT([yes (mips)])
|
|
||||||
AC_MSG_CHECKING([if the assembler is GNU-compatible and can be used])
|
|
||||||
AC_CHECK_COMPATIBLE_MIPS_ASSEMBLER_IFELSE(
|
|
||||||
[AC_MSG_RESULT([yes])
|
|
||||||
simd_arch=mips],
|
|
||||||
[AC_MSG_RESULT([no])
|
|
||||||
with_simd=no])
|
|
||||||
if test "x${with_simd}" = "xno"; then
|
|
||||||
if test "x${require_simd}" = "xyes"; then
|
|
||||||
AC_MSG_ERROR([SIMD support can't be enabled.])
|
|
||||||
else
|
|
||||||
AC_MSG_WARN([SIMD support can't be enabled. Performance will suffer.])
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
powerpc*)
|
|
||||||
AC_MSG_RESULT([yes (powerpc)])
|
|
||||||
simd_arch=powerpc
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
AC_MSG_RESULT([no ("$host_cpu")])
|
|
||||||
with_simd=no;
|
|
||||||
if test "x${require_simd}" = "xyes"; then
|
|
||||||
AC_MSG_ERROR([SIMD support not available for this CPU.])
|
|
||||||
else
|
|
||||||
AC_MSG_WARN([SIMD support not available for this CPU. Performance will suffer.])
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if test "x${with_simd}" != "xno"; then
|
|
||||||
AC_DEFINE([WITH_SIMD], [1], [Use accelerated SIMD routines.])
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-simd"
|
|
||||||
fi
|
|
||||||
|
|
||||||
AM_CONDITIONAL([WITH_SIMD], [test "x$with_simd" != "xno"])
|
|
||||||
AM_CONDITIONAL([WITH_SSE_FLOAT_DCT], [test "x$simd_arch" = "xx86_64" -o "x$simd_arch" = "xi386"])
|
|
||||||
AM_CONDITIONAL([SIMD_I386], [test "x$simd_arch" = "xi386"])
|
|
||||||
AM_CONDITIONAL([SIMD_X86_64], [test "x$simd_arch" = "xx86_64"])
|
|
||||||
AM_CONDITIONAL([SIMD_ARM], [test "x$simd_arch" = "xarm"])
|
|
||||||
AM_CONDITIONAL([SIMD_ARM_64], [test "x$simd_arch" = "xaarch64"])
|
|
||||||
AM_CONDITIONAL([SIMD_MIPS], [test "x$simd_arch" = "xmips"])
|
|
||||||
AM_CONDITIONAL([SIMD_POWERPC], [test "x$simd_arch" = "xpowerpc"])
|
|
||||||
AM_CONDITIONAL([X86_64], [test "x$host_cpu" = "xx86_64" -o "x$host_cpu" = "xamd64"])
|
|
||||||
AM_CONDITIONAL([WITH_TURBOJPEG], [test "x$with_turbojpeg" != "xno"])
|
|
||||||
AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = "xyes"])
|
|
||||||
|
|
||||||
AC_ARG_VAR(PKGNAME, [distribution package name (default: mozjpeg)])
|
|
||||||
if test "x$PKGNAME" = "x"; then
|
|
||||||
PKGNAME=$PACKAGE_NAME
|
|
||||||
fi
|
|
||||||
AC_SUBST(PKGNAME)
|
|
||||||
|
|
||||||
case "$host_cpu" in
|
|
||||||
x86_64)
|
|
||||||
RPMARCH=x86_64
|
|
||||||
DEBARCH=amd64
|
|
||||||
;;
|
|
||||||
i*86 | x86 | ia32)
|
|
||||||
RPMARCH=i386
|
|
||||||
DEBARCH=i386
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
RPMARCH=`uname -m`
|
|
||||||
DEBARCH=$RPMARCH
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if test "${docdir}" = ""; then
|
|
||||||
docdir=${datadir}/doc
|
|
||||||
AC_SUBST(docdir)
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_SUBST(RPMARCH)
|
|
||||||
AC_SUBST(RPM_CONFIG_ARGS)
|
|
||||||
AC_SUBST(DEBARCH)
|
|
||||||
AC_SUBST(BUILD)
|
|
||||||
AC_DEFINE_UNQUOTED([BUILD], "$BUILD", [libjpeg-turbo build number])
|
|
||||||
|
|
||||||
# NOTE: autoheader automatically modifies the input file of the first
|
|
||||||
# invocation of AC_CONFIG_HEADERS, so we put config.h first to prevent
|
|
||||||
# jconfig.h.in from being clobbered. config.h is used only internally, whereas
|
|
||||||
# jconfig.h contains macros that are relevant to external programs (macros that
|
|
||||||
# specify which features were built into the library.)
|
|
||||||
AC_CONFIG_HEADERS([config.h])
|
|
||||||
AC_CONFIG_HEADERS([jconfig.h])
|
|
||||||
AC_CONFIG_HEADERS([jconfigint.h])
|
|
||||||
AC_CONFIG_FILES([pkgscripts/mozjpeg.spec.tmpl:release/mozjpeg.spec.in])
|
|
||||||
AC_CONFIG_FILES([pkgscripts/makecygwinpkg.tmpl:release/makecygwinpkg.in])
|
|
||||||
AC_CONFIG_FILES([pkgscripts/makedpkg.tmpl:release/makedpkg.in])
|
|
||||||
AC_CONFIG_FILES([pkgscripts/makemacpkg.tmpl:release/makemacpkg.in])
|
|
||||||
AC_CONFIG_FILES([pkgscripts/uninstall.tmpl:release/uninstall.in])
|
|
||||||
AC_CONFIG_FILES([pkgscripts/libjpeg.pc:release/libjpeg.pc.in])
|
|
||||||
AC_CONFIG_FILES([pkgscripts/libturbojpeg.pc:release/libturbojpeg.pc.in])
|
|
||||||
if test "x$with_turbojpeg" != "xno"; then
|
|
||||||
AC_CONFIG_FILES([tjbenchtest])
|
|
||||||
fi
|
|
||||||
if test "x$with_java" = "xyes"; then
|
|
||||||
AC_CONFIG_FILES([tjbenchtest.java])
|
|
||||||
AC_CONFIG_FILES([tjexampletest])
|
|
||||||
fi
|
|
||||||
AC_CONFIG_FILES([libjpeg.map])
|
|
||||||
AC_CONFIG_FILES([Makefile simd/Makefile])
|
|
||||||
AC_CONFIG_FILES([java/Makefile])
|
|
||||||
AC_CONFIG_FILES([md5/Makefile])
|
|
||||||
AC_OUTPUT
|
|
||||||
8
djpeg.1
8
djpeg.1
@@ -1,4 +1,4 @@
|
|||||||
.TH DJPEG 1 "18 March 2017"
|
.TH DJPEG 1 "13 November 2017"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
djpeg \- decompress a JPEG file to an image file
|
djpeg \- decompress a JPEG file to an image file
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@@ -157,6 +157,9 @@ Ordered dither is only available in
|
|||||||
.B \-onepass
|
.B \-onepass
|
||||||
mode.
|
mode.
|
||||||
.TP
|
.TP
|
||||||
|
.BI \-icc " file"
|
||||||
|
Extract ICC color management profile to the specified file.
|
||||||
|
.TP
|
||||||
.BI \-map " file"
|
.BI \-map " file"
|
||||||
Quantize to the colors used in the specified image file. This is useful for
|
Quantize to the colors used in the specified image file. This is useful for
|
||||||
producing multiple files with identical color maps, or for forcing a
|
producing multiple files with identical color maps, or for forcing a
|
||||||
@@ -204,7 +207,8 @@ Decompress only a rectangular subregion of the image, starting at point X,Y
|
|||||||
with width W and height H. If necessary, X will be shifted left to the nearest
|
with width W and height H. If necessary, X will be shifted left to the nearest
|
||||||
iMCU boundary, and the width will be increased accordingly. Note that if
|
iMCU boundary, and the width will be increased accordingly. Note that if
|
||||||
decompression scaling is being used, then X, Y, W, and H are relative to the
|
decompression scaling is being used, then X, Y, W, and H are relative to the
|
||||||
scaled image dimensions.
|
scaled image dimensions. Currently this option only works with the
|
||||||
|
PBMPLUS (PPM/PGM), GIF, and Targa output formats.
|
||||||
.TP
|
.TP
|
||||||
.B \-verbose
|
.B \-verbose
|
||||||
Enable debug printout. More
|
Enable debug printout. More
|
||||||
|
|||||||
101
djpeg.c
101
djpeg.c
@@ -5,7 +5,7 @@
|
|||||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||||
* Modified 2013 by Guido Vollbeding.
|
* Modified 2013 by Guido Vollbeding.
|
||||||
* libjpeg-turbo Modifications:
|
* libjpeg-turbo Modifications:
|
||||||
* Copyright (C) 2010-2011, 2013-2016, D. R. Commander.
|
* Copyright (C) 2010-2011, 2013-2017, D. R. Commander.
|
||||||
* Copyright (C) 2015, Google, Inc.
|
* Copyright (C) 2015, Google, Inc.
|
||||||
* For conditions of distribution and use, see the accompanying README.ijg
|
* For conditions of distribution and use, see the accompanying README.ijg
|
||||||
* file.
|
* file.
|
||||||
@@ -31,7 +31,10 @@
|
|||||||
#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
|
#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
|
||||||
#include "jversion.h" /* for version message */
|
#include "jversion.h" /* for version message */
|
||||||
#include "jconfigint.h"
|
#include "jconfigint.h"
|
||||||
#include "wrppm.h"
|
|
||||||
|
#ifndef HAVE_STDLIB_H /* <stdlib.h> should declare free() */
|
||||||
|
extern void free(void *ptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <ctype.h> /* to declare isprint() */
|
#include <ctype.h> /* to declare isprint() */
|
||||||
|
|
||||||
@@ -48,7 +51,7 @@
|
|||||||
|
|
||||||
/* Create the add-on message string table. */
|
/* Create the add-on message string table. */
|
||||||
|
|
||||||
#define JMESSAGE(code,string) string ,
|
#define JMESSAGE(code, string) string,
|
||||||
|
|
||||||
static const char * const cdjpeg_message_table[] = {
|
static const char * const cdjpeg_message_table[] = {
|
||||||
#include "cderror.h"
|
#include "cderror.h"
|
||||||
@@ -90,6 +93,7 @@ static IMAGE_FORMATS requested_fmt;
|
|||||||
|
|
||||||
|
|
||||||
static const char *progname; /* program name for error messages */
|
static const char *progname; /* program name for error messages */
|
||||||
|
static char *icc_filename; /* for -icc switch */
|
||||||
static char *outfilename; /* for -outfile switch */
|
static char *outfilename; /* for -outfile switch */
|
||||||
boolean memsrc; /* for -memsrc switch */
|
boolean memsrc; /* for -memsrc switch */
|
||||||
boolean skip, crop;
|
boolean skip, crop;
|
||||||
@@ -99,7 +103,7 @@ JDIMENSION crop_x, crop_y, crop_width, crop_height;
|
|||||||
|
|
||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
usage (void)
|
usage(void)
|
||||||
/* complain about bad command line */
|
/* complain about bad command line */
|
||||||
{
|
{
|
||||||
fprintf(stderr, "usage: %s [switches] ", progname);
|
fprintf(stderr, "usage: %s [switches] ", progname);
|
||||||
@@ -158,6 +162,7 @@ usage (void)
|
|||||||
fprintf(stderr, " -dither fs Use F-S dithering (default)\n");
|
fprintf(stderr, " -dither fs Use F-S dithering (default)\n");
|
||||||
fprintf(stderr, " -dither none Don't use dithering in quantization\n");
|
fprintf(stderr, " -dither none Don't use dithering in quantization\n");
|
||||||
fprintf(stderr, " -dither ordered Use ordered dither (medium speed, quality)\n");
|
fprintf(stderr, " -dither ordered Use ordered dither (medium speed, quality)\n");
|
||||||
|
fprintf(stderr, " -icc FILE Extract ICC profile to FILE\n");
|
||||||
#ifdef QUANT_2PASS_SUPPORTED
|
#ifdef QUANT_2PASS_SUPPORTED
|
||||||
fprintf(stderr, " -map FILE Map to colors used in named image file\n");
|
fprintf(stderr, " -map FILE Map to colors used in named image file\n");
|
||||||
#endif
|
#endif
|
||||||
@@ -173,6 +178,7 @@ usage (void)
|
|||||||
|
|
||||||
fprintf(stderr, " -skip Y0,Y1 Decompress all rows except those between Y0 and Y1 (inclusive)\n");
|
fprintf(stderr, " -skip Y0,Y1 Decompress all rows except those between Y0 and Y1 (inclusive)\n");
|
||||||
fprintf(stderr, " -crop WxH+X+Y Decompress only a rectangular subregion of the image\n");
|
fprintf(stderr, " -crop WxH+X+Y Decompress only a rectangular subregion of the image\n");
|
||||||
|
fprintf(stderr, " [requires PBMPLUS (PPM/PGM), GIF, or Targa output format]\n");
|
||||||
fprintf(stderr, " -verbose or -debug Emit debug output\n");
|
fprintf(stderr, " -verbose or -debug Emit debug output\n");
|
||||||
fprintf(stderr, " -version Print version information and exit\n");
|
fprintf(stderr, " -version Print version information and exit\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
@@ -180,7 +186,7 @@ usage (void)
|
|||||||
|
|
||||||
|
|
||||||
LOCAL(int)
|
LOCAL(int)
|
||||||
parse_switches (j_decompress_ptr cinfo, int argc, char **argv,
|
parse_switches(j_decompress_ptr cinfo, int argc, char **argv,
|
||||||
int last_file_arg_seen, boolean for_real)
|
int last_file_arg_seen, boolean for_real)
|
||||||
/* Parse optional switches.
|
/* Parse optional switches.
|
||||||
* Returns argv[] index of first file-name argument (== argc if none).
|
* Returns argv[] index of first file-name argument (== argc if none).
|
||||||
@@ -196,6 +202,7 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv,
|
|||||||
|
|
||||||
/* Set up default JPEG parameters. */
|
/* Set up default JPEG parameters. */
|
||||||
requested_fmt = DEFAULT_FMT; /* set default output file format */
|
requested_fmt = DEFAULT_FMT; /* set default output file format */
|
||||||
|
icc_filename = NULL;
|
||||||
outfilename = NULL;
|
outfilename = NULL;
|
||||||
memsrc = FALSE;
|
memsrc = FALSE;
|
||||||
skip = FALSE;
|
skip = FALSE;
|
||||||
@@ -263,7 +270,7 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv,
|
|||||||
/* On first -d, print version identification */
|
/* On first -d, print version identification */
|
||||||
static boolean printed_version = FALSE;
|
static boolean printed_version = FALSE;
|
||||||
|
|
||||||
if (! printed_version) {
|
if (!printed_version) {
|
||||||
fprintf(stderr, "%s version %s (build %s)\n",
|
fprintf(stderr, "%s version %s (build %s)\n",
|
||||||
PACKAGE_NAME, VERSION, BUILD);
|
PACKAGE_NAME, VERSION, BUILD);
|
||||||
fprintf(stderr, "%s\n\n", JCOPYRIGHT);
|
fprintf(stderr, "%s\n\n", JCOPYRIGHT);
|
||||||
@@ -282,7 +289,7 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv,
|
|||||||
/* Select recommended processing options for quick-and-dirty output. */
|
/* Select recommended processing options for quick-and-dirty output. */
|
||||||
cinfo->two_pass_quantize = FALSE;
|
cinfo->two_pass_quantize = FALSE;
|
||||||
cinfo->dither_mode = JDITHER_ORDERED;
|
cinfo->dither_mode = JDITHER_ORDERED;
|
||||||
if (! cinfo->quantize_colors) /* don't override an earlier -colors */
|
if (!cinfo->quantize_colors) /* don't override an earlier -colors */
|
||||||
cinfo->desired_number_of_colors = 216;
|
cinfo->desired_number_of_colors = 216;
|
||||||
cinfo->dct_method = JDCT_FASTEST;
|
cinfo->dct_method = JDCT_FASTEST;
|
||||||
cinfo->do_fancy_upsampling = FALSE;
|
cinfo->do_fancy_upsampling = FALSE;
|
||||||
@@ -291,7 +298,8 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv,
|
|||||||
/* GIF output format. */
|
/* GIF output format. */
|
||||||
requested_fmt = FMT_GIF;
|
requested_fmt = FMT_GIF;
|
||||||
|
|
||||||
} else if (keymatch(arg, "grayscale", 2) || keymatch(arg, "greyscale",2)) {
|
} else if (keymatch(arg, "grayscale", 2) ||
|
||||||
|
keymatch(arg, "greyscale", 2)) {
|
||||||
/* Force monochrome output. */
|
/* Force monochrome output. */
|
||||||
cinfo->out_color_space = JCS_GRAYSCALE;
|
cinfo->out_color_space = JCS_GRAYSCALE;
|
||||||
|
|
||||||
@@ -303,6 +311,13 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv,
|
|||||||
/* Force RGB565 output. */
|
/* Force RGB565 output. */
|
||||||
cinfo->out_color_space = JCS_RGB565;
|
cinfo->out_color_space = JCS_RGB565;
|
||||||
|
|
||||||
|
} else if (keymatch(arg, "icc", 1)) {
|
||||||
|
/* Set ICC filename. */
|
||||||
|
if (++argn >= argc) /* advance to next argument */
|
||||||
|
usage();
|
||||||
|
icc_filename = argv[argn];
|
||||||
|
jpeg_save_markers(cinfo, JPEG_APP0 + 2, 0xFFFF);
|
||||||
|
|
||||||
} else if (keymatch(arg, "map", 3)) {
|
} else if (keymatch(arg, "map", 3)) {
|
||||||
/* Quantize to a color map taken from an input file. */
|
/* Quantize to a color map taken from an input file. */
|
||||||
if (++argn >= argc) /* advance to next argument */
|
if (++argn >= argc) /* advance to next argument */
|
||||||
@@ -419,13 +434,13 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
LOCAL(unsigned int)
|
LOCAL(unsigned int)
|
||||||
jpeg_getc (j_decompress_ptr cinfo)
|
jpeg_getc(j_decompress_ptr cinfo)
|
||||||
/* Read next byte */
|
/* Read next byte */
|
||||||
{
|
{
|
||||||
struct jpeg_source_mgr *datasrc = cinfo->src;
|
struct jpeg_source_mgr *datasrc = cinfo->src;
|
||||||
|
|
||||||
if (datasrc->bytes_in_buffer == 0) {
|
if (datasrc->bytes_in_buffer == 0) {
|
||||||
if (! (*datasrc->fill_input_buffer) (cinfo))
|
if (!(*datasrc->fill_input_buffer) (cinfo))
|
||||||
ERREXIT(cinfo, JERR_CANT_SUSPEND);
|
ERREXIT(cinfo, JERR_CANT_SUSPEND);
|
||||||
}
|
}
|
||||||
datasrc->bytes_in_buffer--;
|
datasrc->bytes_in_buffer--;
|
||||||
@@ -434,7 +449,7 @@ jpeg_getc (j_decompress_ptr cinfo)
|
|||||||
|
|
||||||
|
|
||||||
METHODDEF(boolean)
|
METHODDEF(boolean)
|
||||||
print_text_marker (j_decompress_ptr cinfo)
|
print_text_marker(j_decompress_ptr cinfo)
|
||||||
{
|
{
|
||||||
boolean traceit = (cinfo->err->trace_level >= 1);
|
boolean traceit = (cinfo->err->trace_level >= 1);
|
||||||
long length;
|
long length;
|
||||||
@@ -447,10 +462,10 @@ print_text_marker (j_decompress_ptr cinfo)
|
|||||||
|
|
||||||
if (traceit) {
|
if (traceit) {
|
||||||
if (cinfo->unread_marker == JPEG_COM)
|
if (cinfo->unread_marker == JPEG_COM)
|
||||||
fprintf(stderr, "Comment, length %ld:\n", (long) length);
|
fprintf(stderr, "Comment, length %ld:\n", (long)length);
|
||||||
else /* assume it is an APPn otherwise */
|
else /* assume it is an APPn otherwise */
|
||||||
fprintf(stderr, "APP%d, length %ld:\n",
|
fprintf(stderr, "APP%d, length %ld:\n",
|
||||||
cinfo->unread_marker - JPEG_APP0, (long) length);
|
cinfo->unread_marker - JPEG_APP0, (long)length);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (--length >= 0) {
|
while (--length >= 0) {
|
||||||
@@ -489,7 +504,7 @@ print_text_marker (j_decompress_ptr cinfo)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct jpeg_decompress_struct cinfo;
|
struct jpeg_decompress_struct cinfo;
|
||||||
struct jpeg_error_mgr jerr;
|
struct jpeg_error_mgr jerr;
|
||||||
@@ -501,7 +516,9 @@ main (int argc, char **argv)
|
|||||||
FILE *input_file;
|
FILE *input_file;
|
||||||
FILE *output_file;
|
FILE *output_file;
|
||||||
unsigned char *inbuffer = NULL;
|
unsigned char *inbuffer = NULL;
|
||||||
|
#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)
|
||||||
unsigned long insize = 0;
|
unsigned long insize = 0;
|
||||||
|
#endif
|
||||||
JDIMENSION num_scanlines;
|
JDIMENSION num_scanlines;
|
||||||
|
|
||||||
/* On Mac, fetch a command line. */
|
/* On Mac, fetch a command line. */
|
||||||
@@ -528,7 +545,7 @@ main (int argc, char **argv)
|
|||||||
* but don't try to override APP0 or APP14 this way (see libjpeg.txt).
|
* but don't try to override APP0 or APP14 this way (see libjpeg.txt).
|
||||||
*/
|
*/
|
||||||
jpeg_set_marker_processor(&cinfo, JPEG_COM, print_text_marker);
|
jpeg_set_marker_processor(&cinfo, JPEG_COM, print_text_marker);
|
||||||
jpeg_set_marker_processor(&cinfo, JPEG_APP0+12, print_text_marker);
|
jpeg_set_marker_processor(&cinfo, JPEG_APP0 + 12, print_text_marker);
|
||||||
|
|
||||||
/* Scan command line to find file names. */
|
/* Scan command line to find file names. */
|
||||||
/* It is convenient to use just one switch-parsing routine, but the switch
|
/* It is convenient to use just one switch-parsing routine, but the switch
|
||||||
@@ -543,14 +560,14 @@ main (int argc, char **argv)
|
|||||||
#ifdef TWO_FILE_COMMANDLINE
|
#ifdef TWO_FILE_COMMANDLINE
|
||||||
/* Must have either -outfile switch or explicit output file name */
|
/* Must have either -outfile switch or explicit output file name */
|
||||||
if (outfilename == NULL) {
|
if (outfilename == NULL) {
|
||||||
if (file_index != argc-2) {
|
if (file_index != argc - 2) {
|
||||||
fprintf(stderr, "%s: must name one input and one output file\n",
|
fprintf(stderr, "%s: must name one input and one output file\n",
|
||||||
progname);
|
progname);
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
outfilename = argv[file_index+1];
|
outfilename = argv[file_index + 1];
|
||||||
} else {
|
} else {
|
||||||
if (file_index != argc-1) {
|
if (file_index != argc - 1) {
|
||||||
fprintf(stderr, "%s: must name one input and one output file\n",
|
fprintf(stderr, "%s: must name one input and one output file\n",
|
||||||
progname);
|
progname);
|
||||||
usage();
|
usage();
|
||||||
@@ -558,7 +575,7 @@ main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/* Unix style: expect zero or one file name */
|
/* Unix style: expect zero or one file name */
|
||||||
if (file_index < argc-1) {
|
if (file_index < argc - 1) {
|
||||||
fprintf(stderr, "%s: only one input file\n", progname);
|
fprintf(stderr, "%s: only one input file\n", progname);
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
@@ -587,7 +604,7 @@ main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PROGRESS_REPORT
|
#ifdef PROGRESS_REPORT
|
||||||
start_progress_monitor((j_common_ptr) &cinfo, &progress);
|
start_progress_monitor((j_common_ptr)&cinfo, &progress);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Specify data source for decompression */
|
/* Specify data source for decompression */
|
||||||
@@ -617,7 +634,7 @@ main (int argc, char **argv)
|
|||||||
jpeg_stdio_src(&cinfo, input_file);
|
jpeg_stdio_src(&cinfo, input_file);
|
||||||
|
|
||||||
/* Read file header, set default decompression parameters */
|
/* Read file header, set default decompression parameters */
|
||||||
(void) jpeg_read_header(&cinfo, TRUE);
|
(void)jpeg_read_header(&cinfo, TRUE);
|
||||||
|
|
||||||
/* Adjust default decompression parameters by re-parsing the options */
|
/* Adjust default decompression parameters by re-parsing the options */
|
||||||
file_index = parse_switches(&cinfo, argc, argv, 0, TRUE);
|
file_index = parse_switches(&cinfo, argc, argv, 0, TRUE);
|
||||||
@@ -628,10 +645,10 @@ main (int argc, char **argv)
|
|||||||
switch (requested_fmt) {
|
switch (requested_fmt) {
|
||||||
#ifdef BMP_SUPPORTED
|
#ifdef BMP_SUPPORTED
|
||||||
case FMT_BMP:
|
case FMT_BMP:
|
||||||
dest_mgr = jinit_write_bmp(&cinfo, FALSE);
|
dest_mgr = jinit_write_bmp(&cinfo, FALSE, TRUE);
|
||||||
break;
|
break;
|
||||||
case FMT_OS2:
|
case FMT_OS2:
|
||||||
dest_mgr = jinit_write_bmp(&cinfo, TRUE);
|
dest_mgr = jinit_write_bmp(&cinfo, TRUE, TRUE);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef GIF_SUPPORTED
|
#ifdef GIF_SUPPORTED
|
||||||
@@ -661,7 +678,7 @@ main (int argc, char **argv)
|
|||||||
dest_mgr->output_file = output_file;
|
dest_mgr->output_file = output_file;
|
||||||
|
|
||||||
/* Start decompressor */
|
/* Start decompressor */
|
||||||
(void) jpeg_start_decompress(&cinfo);
|
(void)jpeg_start_decompress(&cinfo);
|
||||||
|
|
||||||
/* Skip rows */
|
/* Skip rows */
|
||||||
if (skip) {
|
if (skip) {
|
||||||
@@ -713,9 +730,10 @@ main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
jpeg_crop_scanline(&cinfo, &crop_x, &crop_width);
|
jpeg_crop_scanline(&cinfo, &crop_x, &crop_width);
|
||||||
((ppm_dest_ptr) dest_mgr)->buffer_width = cinfo.output_width *
|
if (dest_mgr->calc_buffer_dimensions)
|
||||||
cinfo.out_color_components *
|
(*dest_mgr->calc_buffer_dimensions) (&cinfo, dest_mgr);
|
||||||
sizeof(JSAMPLE);
|
else
|
||||||
|
ERREXIT(&cinfo, JERR_UNSUPPORTED_FORMAT);
|
||||||
|
|
||||||
/* Write output file header. This is a hack to ensure that the destination
|
/* Write output file header. This is a hack to ensure that the destination
|
||||||
* manager creates an output image of the proper size.
|
* manager creates an output image of the proper size.
|
||||||
@@ -754,12 +772,35 @@ main (int argc, char **argv)
|
|||||||
progress.pub.completed_passes = progress.pub.total_passes;
|
progress.pub.completed_passes = progress.pub.total_passes;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (icc_filename != NULL) {
|
||||||
|
FILE *icc_file;
|
||||||
|
JOCTET *icc_profile;
|
||||||
|
unsigned int icc_len;
|
||||||
|
|
||||||
|
if ((icc_file = fopen(icc_filename, WRITE_BINARY)) == NULL) {
|
||||||
|
fprintf(stderr, "%s: can't open %s\n", progname, icc_filename);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
if (jpeg_read_icc_profile(&cinfo, &icc_profile, &icc_len)) {
|
||||||
|
if (fwrite(icc_profile, icc_len, 1, icc_file) < 1) {
|
||||||
|
fprintf(stderr, "%s: can't read ICC profile from %s\n", progname,
|
||||||
|
icc_filename);
|
||||||
|
free(icc_profile);
|
||||||
|
fclose(icc_file);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
free(icc_profile);
|
||||||
|
fclose(icc_file);
|
||||||
|
} else if (cinfo.err->msg_code != JWRN_BOGUS_ICC)
|
||||||
|
fprintf(stderr, "%s: no ICC profile data in JPEG file\n", progname);
|
||||||
|
}
|
||||||
|
|
||||||
/* Finish decompression and release memory.
|
/* Finish decompression and release memory.
|
||||||
* I must do it in this order because output module has allocated memory
|
* I must do it in this order because output module has allocated memory
|
||||||
* of lifespan JPOOL_IMAGE; it needs to finish before releasing memory.
|
* of lifespan JPOOL_IMAGE; it needs to finish before releasing memory.
|
||||||
*/
|
*/
|
||||||
(*dest_mgr->finish_output) (&cinfo, dest_mgr);
|
(*dest_mgr->finish_output) (&cinfo, dest_mgr);
|
||||||
(void) jpeg_finish_decompress(&cinfo);
|
(void)jpeg_finish_decompress(&cinfo);
|
||||||
jpeg_destroy_decompress(&cinfo);
|
jpeg_destroy_decompress(&cinfo);
|
||||||
|
|
||||||
/* Close files, if we opened them */
|
/* Close files, if we opened them */
|
||||||
@@ -769,10 +810,10 @@ main (int argc, char **argv)
|
|||||||
fclose(output_file);
|
fclose(output_file);
|
||||||
|
|
||||||
#ifdef PROGRESS_REPORT
|
#ifdef PROGRESS_REPORT
|
||||||
end_progress_monitor((j_common_ptr) &cinfo);
|
end_progress_monitor((j_common_ptr)&cinfo);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (memsrc && inbuffer != NULL)
|
if (memsrc)
|
||||||
free(inbuffer);
|
free(inbuffer);
|
||||||
|
|
||||||
/* All done. */
|
/* All done. */
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<tr style="height: 56px;">
|
<tr style="height: 56px;">
|
||||||
<td style="padding-left: 0.5em;">
|
<td style="padding-left: 0.5em;">
|
||||||
<div id="projectname">TurboJPEG
|
<div id="projectname">TurboJPEG
|
||||||
 <span id="projectnumber">1.5</span>
|
 <span id="projectnumber">2.0</span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<tr style="height: 56px;">
|
<tr style="height: 56px;">
|
||||||
<td style="padding-left: 0.5em;">
|
<td style="padding-left: 0.5em;">
|
||||||
<div id="projectname">TurboJPEG
|
<div id="projectname">TurboJPEG
|
||||||
 <span id="projectnumber">1.5</span>
|
 <span id="projectnumber">2.0</span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<tr style="height: 56px;">
|
<tr style="height: 56px;">
|
||||||
<td style="padding-left: 0.5em;">
|
<td style="padding-left: 0.5em;">
|
||||||
<div id="projectname">TurboJPEG
|
<div id="projectname">TurboJPEG
|
||||||
 <span id="projectnumber">1.5</span>
|
 <span id="projectnumber">2.0</span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<tr style="height: 56px;">
|
<tr style="height: 56px;">
|
||||||
<td style="padding-left: 0.5em;">
|
<td style="padding-left: 0.5em;">
|
||||||
<div id="projectname">TurboJPEG
|
<div id="projectname">TurboJPEG
|
||||||
 <span id="projectnumber">1.5</span>
|
 <span id="projectnumber">2.0</span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -24,7 +24,7 @@
|
|||||||
<tr style="height: 56px;">
|
<tr style="height: 56px;">
|
||||||
<td style="padding-left: 0.5em;">
|
<td style="padding-left: 0.5em;">
|
||||||
<div id="projectname">TurboJPEG
|
<div id="projectname">TurboJPEG
|
||||||
 <span id="projectnumber">1.5</span>
|
 <span id="projectnumber">2.0</span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<tr style="height: 56px;">
|
<tr style="height: 56px;">
|
||||||
<td style="padding-left: 0.5em;">
|
<td style="padding-left: 0.5em;">
|
||||||
<div id="projectname">TurboJPEG
|
<div id="projectname">TurboJPEG
|
||||||
 <span id="projectnumber">1.5</span>
|
 <span id="projectnumber">2.0</span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -1,44 +1,53 @@
|
|||||||
var searchData=
|
var searchData=
|
||||||
[
|
[
|
||||||
['tj_5fnumcs',['TJ_NUMCS',['../group___turbo_j_p_e_g.html#ga39f57a6fb02d9cf32e7b6890099b5a71',1,'turbojpeg.h']]],
|
['tj_5fnumcs',['TJ_NUMCS',['../group___turbo_j_p_e_g.html#ga39f57a6fb02d9cf32e7b6890099b5a71',1,'turbojpeg.h']]],
|
||||||
|
['tj_5fnumerr',['TJ_NUMERR',['../group___turbo_j_p_e_g.html#ga79bde1b4a3e2351e00887e47781b966e',1,'turbojpeg.h']]],
|
||||||
['tj_5fnumpf',['TJ_NUMPF',['../group___turbo_j_p_e_g.html#ga7010a4402f54a45ba822ad8675a4655e',1,'turbojpeg.h']]],
|
['tj_5fnumpf',['TJ_NUMPF',['../group___turbo_j_p_e_g.html#ga7010a4402f54a45ba822ad8675a4655e',1,'turbojpeg.h']]],
|
||||||
['tj_5fnumsamp',['TJ_NUMSAMP',['../group___turbo_j_p_e_g.html#ga5ef3d169162ce77ce348e292a0b7477c',1,'turbojpeg.h']]],
|
['tj_5fnumsamp',['TJ_NUMSAMP',['../group___turbo_j_p_e_g.html#ga5ef3d169162ce77ce348e292a0b7477c',1,'turbojpeg.h']]],
|
||||||
['tj_5fnumxop',['TJ_NUMXOP',['../group___turbo_j_p_e_g.html#ga0f6dbd18adf38b7d46ac547f0f4d562c',1,'turbojpeg.h']]],
|
['tj_5fnumxop',['TJ_NUMXOP',['../group___turbo_j_p_e_g.html#ga0f6dbd18adf38b7d46ac547f0f4d562c',1,'turbojpeg.h']]],
|
||||||
['tjalloc',['tjAlloc',['../group___turbo_j_p_e_g.html#ga5c9234bda6d993cdaffdd89bf81a00ff',1,'turbojpeg.h']]],
|
['tjalloc',['tjAlloc',['../group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83',1,'turbojpeg.h']]],
|
||||||
|
['tjalphaoffset',['tjAlphaOffset',['../group___turbo_j_p_e_g.html#ga5af0ab065feefd526debf1e20c43e837',1,'turbojpeg.h']]],
|
||||||
['tjblueoffset',['tjBlueOffset',['../group___turbo_j_p_e_g.html#ga84e2e35d3f08025f976ec1ec53693dea',1,'turbojpeg.h']]],
|
['tjblueoffset',['tjBlueOffset',['../group___turbo_j_p_e_g.html#ga84e2e35d3f08025f976ec1ec53693dea',1,'turbojpeg.h']]],
|
||||||
['tjbufsize',['tjBufSize',['../group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b',1,'turbojpeg.h']]],
|
['tjbufsize',['tjBufSize',['../group___turbo_j_p_e_g.html#ga67ac12fee79073242cb216e07c9f1f90',1,'turbojpeg.h']]],
|
||||||
['tjbufsizeyuv2',['tjBufSizeYUV2',['../group___turbo_j_p_e_g.html#gaf451664a62c1f6c7cc5a6401f32908c9',1,'turbojpeg.h']]],
|
['tjbufsizeyuv2',['tjBufSizeYUV2',['../group___turbo_j_p_e_g.html#ga2be2b9969d4df9ecce9b05deed273194',1,'turbojpeg.h']]],
|
||||||
['tjcompress2',['tjCompress2',['../group___turbo_j_p_e_g.html#gaf38f2ed44bdc88e730e08b632fa6e88e',1,'turbojpeg.h']]],
|
['tjcompress2',['tjCompress2',['../group___turbo_j_p_e_g.html#gafbdce0112fd78fd38efae841443a9bcf',1,'turbojpeg.h']]],
|
||||||
['tjcompressfromyuv',['tjCompressFromYUV',['../group___turbo_j_p_e_g.html#ga6f6de375d6ec0020faba627e37e5a060',1,'turbojpeg.h']]],
|
['tjcompressfromyuv',['tjCompressFromYUV',['../group___turbo_j_p_e_g.html#ga7622a459b79aa1007e005b58783f875b',1,'turbojpeg.h']]],
|
||||||
['tjcompressfromyuvplanes',['tjCompressFromYUVPlanes',['../group___turbo_j_p_e_g.html#ga0b84c682d8accf097d7a743c965d3464',1,'turbojpeg.h']]],
|
['tjcompressfromyuvplanes',['tjCompressFromYUVPlanes',['../group___turbo_j_p_e_g.html#ga29ec5dfbd2d84b8724e951d6fa0d5d9e',1,'turbojpeg.h']]],
|
||||||
['tjcs',['TJCS',['../group___turbo_j_p_e_g.html#ga4f83ad3368e0e29d1957be0efa7c3720',1,'turbojpeg.h']]],
|
['tjcs',['TJCS',['../group___turbo_j_p_e_g.html#ga4f83ad3368e0e29d1957be0efa7c3720',1,'turbojpeg.h']]],
|
||||||
['tjcs_5fcmyk',['TJCS_CMYK',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a6c8b636152ac8195b869587db315ee53',1,'turbojpeg.h']]],
|
['tjcs_5fcmyk',['TJCS_CMYK',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a6c8b636152ac8195b869587db315ee53',1,'turbojpeg.h']]],
|
||||||
['tjcs_5fgray',['TJCS_GRAY',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720ab3e7d6a87f695e45b81c1b5262b5a50a',1,'turbojpeg.h']]],
|
['tjcs_5fgray',['TJCS_GRAY',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720ab3e7d6a87f695e45b81c1b5262b5a50a',1,'turbojpeg.h']]],
|
||||||
['tjcs_5frgb',['TJCS_RGB',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a677cb7ccb85c4038ac41964a2e09e555',1,'turbojpeg.h']]],
|
['tjcs_5frgb',['TJCS_RGB',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a677cb7ccb85c4038ac41964a2e09e555',1,'turbojpeg.h']]],
|
||||||
['tjcs_5fycbcr',['TJCS_YCbCr',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a7389b8f65bb387ffedce3efd0d78ec75',1,'turbojpeg.h']]],
|
['tjcs_5fycbcr',['TJCS_YCbCr',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a7389b8f65bb387ffedce3efd0d78ec75',1,'turbojpeg.h']]],
|
||||||
['tjcs_5fycck',['TJCS_YCCK',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a53839e0fe867b76b58d16b0a1a7c598e',1,'turbojpeg.h']]],
|
['tjcs_5fycck',['TJCS_YCCK',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a53839e0fe867b76b58d16b0a1a7c598e',1,'turbojpeg.h']]],
|
||||||
['tjdecodeyuv',['tjDecodeYUV',['../group___turbo_j_p_e_g.html#ga077c61027b875afecd5a1613bf18b3c1',1,'turbojpeg.h']]],
|
['tjdecodeyuv',['tjDecodeYUV',['../group___turbo_j_p_e_g.html#ga70abbf38f77a26fd6da8813bef96f695',1,'turbojpeg.h']]],
|
||||||
['tjdecodeyuvplanes',['tjDecodeYUVPlanes',['../group___turbo_j_p_e_g.html#gaf42f19b7a496eb18bdc84fe61ee6d3e2',1,'turbojpeg.h']]],
|
['tjdecodeyuvplanes',['tjDecodeYUVPlanes',['../group___turbo_j_p_e_g.html#ga10e837c07fa9d25770565b237d3898d9',1,'turbojpeg.h']]],
|
||||||
['tjdecompress2',['tjDecompress2',['../group___turbo_j_p_e_g.html#gad8026a417e16a76313bc0a6c9e8b2ba2',1,'turbojpeg.h']]],
|
['tjdecompress2',['tjDecompress2',['../group___turbo_j_p_e_g.html#gae9eccef8b682a48f43a9117c231ed013',1,'turbojpeg.h']]],
|
||||||
['tjdecompressheader3',['tjDecompressHeader3',['../group___turbo_j_p_e_g.html#ga3fced455e504e8ff4fbad28ba94a3020',1,'turbojpeg.h']]],
|
['tjdecompressheader3',['tjDecompressHeader3',['../group___turbo_j_p_e_g.html#ga0595681096bba7199cc6f3533cb25f77',1,'turbojpeg.h']]],
|
||||||
['tjdecompresstoyuv2',['tjDecompressToYUV2',['../group___turbo_j_p_e_g.html#ga39e08906528db5a764670ea48d344b09',1,'turbojpeg.h']]],
|
['tjdecompresstoyuv2',['tjDecompressToYUV2',['../group___turbo_j_p_e_g.html#ga04d1e839ff9a0860dd1475cff78d3364',1,'turbojpeg.h']]],
|
||||||
['tjdecompresstoyuvplanes',['tjDecompressToYUVPlanes',['../group___turbo_j_p_e_g.html#ga38d0ef90692663b3ffb5b16da2541512',1,'turbojpeg.h']]],
|
['tjdecompresstoyuvplanes',['tjDecompressToYUVPlanes',['../group___turbo_j_p_e_g.html#gaa59f901a5258ada5bd0185ad59368540',1,'turbojpeg.h']]],
|
||||||
['tjdestroy',['tjDestroy',['../group___turbo_j_p_e_g.html#ga674adee917b95ad4a896f1ba39e12540',1,'turbojpeg.h']]],
|
['tjdestroy',['tjDestroy',['../group___turbo_j_p_e_g.html#ga75f355fa27225ba1a4ee392c852394d2',1,'turbojpeg.h']]],
|
||||||
['tjencodeyuv3',['tjEncodeYUV3',['../group___turbo_j_p_e_g.html#gaabe05acd734990053ad1294b5ef239aa',1,'turbojpeg.h']]],
|
['tjencodeyuv3',['tjEncodeYUV3',['../group___turbo_j_p_e_g.html#gac519b922cdf446e97d0cdcba513636bf',1,'turbojpeg.h']]],
|
||||||
['tjencodeyuvplanes',['tjEncodeYUVPlanes',['../group___turbo_j_p_e_g.html#ga8a65ed3bd12df57c219d46afbc9008f1',1,'turbojpeg.h']]],
|
['tjencodeyuvplanes',['tjEncodeYUVPlanes',['../group___turbo_j_p_e_g.html#gae2d04c72457fe7f4d60cf78ab1b1feb1',1,'turbojpeg.h']]],
|
||||||
|
['tjerr',['TJERR',['../group___turbo_j_p_e_g.html#gafbc17cfa57d0d5d11fea35ac025950fe',1,'turbojpeg.h']]],
|
||||||
|
['tjerr_5ffatal',['TJERR_FATAL',['../group___turbo_j_p_e_g.html#ggafbc17cfa57d0d5d11fea35ac025950feafc9cceeada13122b09e4851e3788039a',1,'turbojpeg.h']]],
|
||||||
|
['tjerr_5fwarning',['TJERR_WARNING',['../group___turbo_j_p_e_g.html#ggafbc17cfa57d0d5d11fea35ac025950fea342dd6e2aedb47bb257b4e7568329b59',1,'turbojpeg.h']]],
|
||||||
['tjflag_5faccuratedct',['TJFLAG_ACCURATEDCT',['../group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0',1,'turbojpeg.h']]],
|
['tjflag_5faccuratedct',['TJFLAG_ACCURATEDCT',['../group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0',1,'turbojpeg.h']]],
|
||||||
['tjflag_5fbottomup',['TJFLAG_BOTTOMUP',['../group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec',1,'turbojpeg.h']]],
|
['tjflag_5fbottomup',['TJFLAG_BOTTOMUP',['../group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec',1,'turbojpeg.h']]],
|
||||||
['tjflag_5ffastdct',['TJFLAG_FASTDCT',['../group___turbo_j_p_e_g.html#gaabce235db80d3f698b27f36cbd453da2',1,'turbojpeg.h']]],
|
['tjflag_5ffastdct',['TJFLAG_FASTDCT',['../group___turbo_j_p_e_g.html#gaabce235db80d3f698b27f36cbd453da2',1,'turbojpeg.h']]],
|
||||||
['tjflag_5ffastupsample',['TJFLAG_FASTUPSAMPLE',['../group___turbo_j_p_e_g.html#ga4ee4506c81177a06f77e2504a22efd2d',1,'turbojpeg.h']]],
|
['tjflag_5ffastupsample',['TJFLAG_FASTUPSAMPLE',['../group___turbo_j_p_e_g.html#ga4ee4506c81177a06f77e2504a22efd2d',1,'turbojpeg.h']]],
|
||||||
['tjflag_5fnorealloc',['TJFLAG_NOREALLOC',['../group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963',1,'turbojpeg.h']]],
|
['tjflag_5fnorealloc',['TJFLAG_NOREALLOC',['../group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963',1,'turbojpeg.h']]],
|
||||||
['tjfree',['tjFree',['../group___turbo_j_p_e_g.html#ga8c4a1231dc06a450514c835f6471f137',1,'turbojpeg.h']]],
|
['tjflag_5fprogressive',['TJFLAG_PROGRESSIVE',['../group___turbo_j_p_e_g.html#ga43b426750b46190a25d34a67ef76df1b',1,'turbojpeg.h']]],
|
||||||
['tjgeterrorstr',['tjGetErrorStr',['../group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf',1,'turbojpeg.h']]],
|
['tjflag_5fstoponwarning',['TJFLAG_STOPONWARNING',['../group___turbo_j_p_e_g.html#ga519cfa4ef6c18d9e5b455fdf59306a3a',1,'turbojpeg.h']]],
|
||||||
['tjgetscalingfactors',['tjGetScalingFactors',['../group___turbo_j_p_e_g.html#ga6449044b9af402999ccf52f401333be8',1,'turbojpeg.h']]],
|
['tjfree',['tjFree',['../group___turbo_j_p_e_g.html#gaea863d2da0cdb609563aabdf9196514b',1,'turbojpeg.h']]],
|
||||||
|
['tjgeterrorcode',['tjGetErrorCode',['../group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410',1,'turbojpeg.h']]],
|
||||||
|
['tjgeterrorstr2',['tjGetErrorStr2',['../group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa',1,'turbojpeg.h']]],
|
||||||
|
['tjgetscalingfactors',['tjGetScalingFactors',['../group___turbo_j_p_e_g.html#gac3854476006b10787bd128f7ede48057',1,'turbojpeg.h']]],
|
||||||
['tjgreenoffset',['tjGreenOffset',['../group___turbo_j_p_e_g.html#ga82d6e35da441112a411da41923c0ba2f',1,'turbojpeg.h']]],
|
['tjgreenoffset',['tjGreenOffset',['../group___turbo_j_p_e_g.html#ga82d6e35da441112a411da41923c0ba2f',1,'turbojpeg.h']]],
|
||||||
['tjhandle',['tjhandle',['../group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763',1,'turbojpeg.h']]],
|
['tjhandle',['tjhandle',['../group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763',1,'turbojpeg.h']]],
|
||||||
['tjinitcompress',['tjInitCompress',['../group___turbo_j_p_e_g.html#ga3d10c47fbe4a2489a2b30c931551d01a',1,'turbojpeg.h']]],
|
['tjinitcompress',['tjInitCompress',['../group___turbo_j_p_e_g.html#ga9d63a05fc6d813f4aae06107041a37e8',1,'turbojpeg.h']]],
|
||||||
['tjinitdecompress',['tjInitDecompress',['../group___turbo_j_p_e_g.html#gae5408179d041e2a2f7199c8283cf649e',1,'turbojpeg.h']]],
|
['tjinitdecompress',['tjInitDecompress',['../group___turbo_j_p_e_g.html#ga52300eac3f3d9ef4bab303bc244f62d3',1,'turbojpeg.h']]],
|
||||||
['tjinittransform',['tjInitTransform',['../group___turbo_j_p_e_g.html#ga3155b775bfbac9dbba869b95a0367902',1,'turbojpeg.h']]],
|
['tjinittransform',['tjInitTransform',['../group___turbo_j_p_e_g.html#ga928beff6ac248ceadf01089fc6b41957',1,'turbojpeg.h']]],
|
||||||
|
['tjloadimage',['tjLoadImage',['../group___turbo_j_p_e_g.html#gaffbd83c375e79f5db4b5c5d8ad4466e7',1,'turbojpeg.h']]],
|
||||||
['tjmcuheight',['tjMCUHeight',['../group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf',1,'turbojpeg.h']]],
|
['tjmcuheight',['tjMCUHeight',['../group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf',1,'turbojpeg.h']]],
|
||||||
['tjmcuwidth',['tjMCUWidth',['../group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c',1,'turbojpeg.h']]],
|
['tjmcuwidth',['tjMCUWidth',['../group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c',1,'turbojpeg.h']]],
|
||||||
['tjpad',['TJPAD',['../group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511',1,'turbojpeg.h']]],
|
['tjpad',['TJPAD',['../group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511',1,'turbojpeg.h']]],
|
||||||
@@ -53,11 +62,12 @@ var searchData=
|
|||||||
['tjpf_5frgb',['TJPF_RGB',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7ce93230bff449518ce387c17e6ed37c',1,'turbojpeg.h']]],
|
['tjpf_5frgb',['TJPF_RGB',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7ce93230bff449518ce387c17e6ed37c',1,'turbojpeg.h']]],
|
||||||
['tjpf_5frgba',['TJPF_RGBA',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa88d2e88fab67f6503cf972e14851cc12',1,'turbojpeg.h']]],
|
['tjpf_5frgba',['TJPF_RGBA',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa88d2e88fab67f6503cf972e14851cc12',1,'turbojpeg.h']]],
|
||||||
['tjpf_5frgbx',['TJPF_RGBX',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01',1,'turbojpeg.h']]],
|
['tjpf_5frgbx',['TJPF_RGBX',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01',1,'turbojpeg.h']]],
|
||||||
|
['tjpf_5funknown',['TJPF_UNKNOWN',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa84c1a6cead7952998e2fb895844a21ed',1,'turbojpeg.h']]],
|
||||||
['tjpf_5fxbgr',['TJPF_XBGR',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af',1,'turbojpeg.h']]],
|
['tjpf_5fxbgr',['TJPF_XBGR',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af',1,'turbojpeg.h']]],
|
||||||
['tjpf_5fxrgb',['TJPF_XRGB',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84',1,'turbojpeg.h']]],
|
['tjpf_5fxrgb',['TJPF_XRGB',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84',1,'turbojpeg.h']]],
|
||||||
['tjpixelsize',['tjPixelSize',['../group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c',1,'turbojpeg.h']]],
|
['tjpixelsize',['tjPixelSize',['../group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c',1,'turbojpeg.h']]],
|
||||||
['tjplaneheight',['tjPlaneHeight',['../group___turbo_j_p_e_g.html#ga1a209696c6a80748f20e134b3c64789f',1,'turbojpeg.h']]],
|
['tjplaneheight',['tjPlaneHeight',['../group___turbo_j_p_e_g.html#ga1a209696c6a80748f20e134b3c64789f',1,'turbojpeg.h']]],
|
||||||
['tjplanesizeyuv',['tjPlaneSizeYUV',['../group___turbo_j_p_e_g.html#ga6f98d977bfa9d167c97172e876ba61e2',1,'turbojpeg.h']]],
|
['tjplanesizeyuv',['tjPlaneSizeYUV',['../group___turbo_j_p_e_g.html#gab4ab7b24f6e797d79abaaa670373961d',1,'turbojpeg.h']]],
|
||||||
['tjplanewidth',['tjPlaneWidth',['../group___turbo_j_p_e_g.html#ga63fb66bb1e36c74008c4634360becbb1',1,'turbojpeg.h']]],
|
['tjplanewidth',['tjPlaneWidth',['../group___turbo_j_p_e_g.html#ga63fb66bb1e36c74008c4634360becbb1',1,'turbojpeg.h']]],
|
||||||
['tjredoffset',['tjRedOffset',['../group___turbo_j_p_e_g.html#gadd9b446742ac8a3923f7992c7988fea8',1,'turbojpeg.h']]],
|
['tjredoffset',['tjRedOffset',['../group___turbo_j_p_e_g.html#gadd9b446742ac8a3923f7992c7988fea8',1,'turbojpeg.h']]],
|
||||||
['tjregion',['tjregion',['../structtjregion.html',1,'']]],
|
['tjregion',['tjregion',['../structtjregion.html',1,'']]],
|
||||||
@@ -68,9 +78,10 @@ var searchData=
|
|||||||
['tjsamp_5f440',['TJSAMP_440',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074accf740e6f3aa6ba20ba922cad13cb974',1,'turbojpeg.h']]],
|
['tjsamp_5f440',['TJSAMP_440',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074accf740e6f3aa6ba20ba922cad13cb974',1,'turbojpeg.h']]],
|
||||||
['tjsamp_5f444',['TJSAMP_444',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074afb8da4f44197837bdec0a4f593dacae3',1,'turbojpeg.h']]],
|
['tjsamp_5f444',['TJSAMP_444',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074afb8da4f44197837bdec0a4f593dacae3',1,'turbojpeg.h']]],
|
||||||
['tjsamp_5fgray',['TJSAMP_GRAY',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a3f1c9504842ddc7a48d0f690754b6248',1,'turbojpeg.h']]],
|
['tjsamp_5fgray',['TJSAMP_GRAY',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a3f1c9504842ddc7a48d0f690754b6248',1,'turbojpeg.h']]],
|
||||||
|
['tjsaveimage',['tjSaveImage',['../group___turbo_j_p_e_g.html#ga6f445b22d8933ae4815b3370a538d879',1,'turbojpeg.h']]],
|
||||||
['tjscaled',['TJSCALED',['../group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df',1,'turbojpeg.h']]],
|
['tjscaled',['TJSCALED',['../group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df',1,'turbojpeg.h']]],
|
||||||
['tjscalingfactor',['tjscalingfactor',['../structtjscalingfactor.html',1,'']]],
|
['tjscalingfactor',['tjscalingfactor',['../structtjscalingfactor.html',1,'']]],
|
||||||
['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']]],
|
['tjtransform',['tjtransform',['../structtjtransform.html',1,'tjtransform'],['../group___turbo_j_p_e_g.html#gaa29f3189c41be12ec5dee7caec318a31',1,'tjtransform(): turbojpeg.h'],['../group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25',1,'tjTransform(tjhandle handle, const unsigned char *jpegBuf, unsigned long jpegSize, int n, unsigned char **dstBufs, unsigned long *dstSizes, tjtransform *transforms, int flags): turbojpeg.h']]],
|
||||||
['tjxop',['TJXOP',['../group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866',1,'turbojpeg.h']]],
|
['tjxop',['TJXOP',['../group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866',1,'turbojpeg.h']]],
|
||||||
['tjxop_5fhflip',['TJXOP_HFLIP',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aa0df69776caa30f0fa28e26332d311ce',1,'turbojpeg.h']]],
|
['tjxop_5fhflip',['TJXOP_HFLIP',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aa0df69776caa30f0fa28e26332d311ce',1,'turbojpeg.h']]],
|
||||||
['tjxop_5fnone',['TJXOP_NONE',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aad88c0366cd3f7d0eac9d7a3fa1c2c27',1,'turbojpeg.h']]],
|
['tjxop_5fnone',['TJXOP_NONE',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aad88c0366cd3f7d0eac9d7a3fa1c2c27',1,'turbojpeg.h']]],
|
||||||
@@ -80,10 +91,12 @@ var searchData=
|
|||||||
['tjxop_5ftranspose',['TJXOP_TRANSPOSE',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a31060aed199f886afdd417f80499c32d',1,'turbojpeg.h']]],
|
['tjxop_5ftranspose',['TJXOP_TRANSPOSE',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a31060aed199f886afdd417f80499c32d',1,'turbojpeg.h']]],
|
||||||
['tjxop_5ftransverse',['TJXOP_TRANSVERSE',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866af3b14d488aea6ece9e5b3df73a74d6a4',1,'turbojpeg.h']]],
|
['tjxop_5ftransverse',['TJXOP_TRANSVERSE',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866af3b14d488aea6ece9e5b3df73a74d6a4',1,'turbojpeg.h']]],
|
||||||
['tjxop_5fvflip',['TJXOP_VFLIP',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a324eddfbec53b7e691f61e56929d0d5d',1,'turbojpeg.h']]],
|
['tjxop_5fvflip',['TJXOP_VFLIP',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a324eddfbec53b7e691f61e56929d0d5d',1,'turbojpeg.h']]],
|
||||||
|
['tjxopt_5fcopynone',['TJXOPT_COPYNONE',['../group___turbo_j_p_e_g.html#ga153b468cfb905d0de61706c838986fe8',1,'turbojpeg.h']]],
|
||||||
['tjxopt_5fcrop',['TJXOPT_CROP',['../group___turbo_j_p_e_g.html#ga9c771a757fc1294add611906b89ab2d2',1,'turbojpeg.h']]],
|
['tjxopt_5fcrop',['TJXOPT_CROP',['../group___turbo_j_p_e_g.html#ga9c771a757fc1294add611906b89ab2d2',1,'turbojpeg.h']]],
|
||||||
['tjxopt_5fgray',['TJXOPT_GRAY',['../group___turbo_j_p_e_g.html#ga3acee7b48ade1b99e5588736007c2589',1,'turbojpeg.h']]],
|
['tjxopt_5fgray',['TJXOPT_GRAY',['../group___turbo_j_p_e_g.html#ga3acee7b48ade1b99e5588736007c2589',1,'turbojpeg.h']]],
|
||||||
['tjxopt_5fnooutput',['TJXOPT_NOOUTPUT',['../group___turbo_j_p_e_g.html#gafbf992bbf6e006705886333703ffab31',1,'turbojpeg.h']]],
|
['tjxopt_5fnooutput',['TJXOPT_NOOUTPUT',['../group___turbo_j_p_e_g.html#gafbf992bbf6e006705886333703ffab31',1,'turbojpeg.h']]],
|
||||||
['tjxopt_5fperfect',['TJXOPT_PERFECT',['../group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00',1,'turbojpeg.h']]],
|
['tjxopt_5fperfect',['TJXOPT_PERFECT',['../group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00',1,'turbojpeg.h']]],
|
||||||
|
['tjxopt_5fprogressive',['TJXOPT_PROGRESSIVE',['../group___turbo_j_p_e_g.html#gad2371c80674584ecc1a7d75e564cf026',1,'turbojpeg.h']]],
|
||||||
['tjxopt_5ftrim',['TJXOPT_TRIM',['../group___turbo_j_p_e_g.html#ga319826b7eb1583c0595bbe7b95428709',1,'turbojpeg.h']]],
|
['tjxopt_5ftrim',['TJXOPT_TRIM',['../group___turbo_j_p_e_g.html#ga319826b7eb1583c0595bbe7b95428709',1,'turbojpeg.h']]],
|
||||||
['turbojpeg',['TurboJPEG',['../group___turbo_j_p_e_g.html',1,'']]]
|
['turbojpeg',['TurboJPEG',['../group___turbo_j_p_e_g.html',1,'']]]
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
var searchData=
|
var searchData=
|
||||||
[
|
[
|
||||||
['tjcs',['TJCS',['../group___turbo_j_p_e_g.html#ga4f83ad3368e0e29d1957be0efa7c3720',1,'turbojpeg.h']]],
|
['tjcs',['TJCS',['../group___turbo_j_p_e_g.html#ga4f83ad3368e0e29d1957be0efa7c3720',1,'turbojpeg.h']]],
|
||||||
|
['tjerr',['TJERR',['../group___turbo_j_p_e_g.html#gafbc17cfa57d0d5d11fea35ac025950fe',1,'turbojpeg.h']]],
|
||||||
['tjpf',['TJPF',['../group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a',1,'turbojpeg.h']]],
|
['tjpf',['TJPF',['../group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a',1,'turbojpeg.h']]],
|
||||||
['tjsamp',['TJSAMP',['../group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074',1,'turbojpeg.h']]],
|
['tjsamp',['TJSAMP',['../group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074',1,'turbojpeg.h']]],
|
||||||
['tjxop',['TJXOP',['../group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866',1,'turbojpeg.h']]]
|
['tjxop',['TJXOP',['../group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866',1,'turbojpeg.h']]]
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ var searchData=
|
|||||||
['tjcs_5frgb',['TJCS_RGB',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a677cb7ccb85c4038ac41964a2e09e555',1,'turbojpeg.h']]],
|
['tjcs_5frgb',['TJCS_RGB',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a677cb7ccb85c4038ac41964a2e09e555',1,'turbojpeg.h']]],
|
||||||
['tjcs_5fycbcr',['TJCS_YCbCr',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a7389b8f65bb387ffedce3efd0d78ec75',1,'turbojpeg.h']]],
|
['tjcs_5fycbcr',['TJCS_YCbCr',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a7389b8f65bb387ffedce3efd0d78ec75',1,'turbojpeg.h']]],
|
||||||
['tjcs_5fycck',['TJCS_YCCK',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a53839e0fe867b76b58d16b0a1a7c598e',1,'turbojpeg.h']]],
|
['tjcs_5fycck',['TJCS_YCCK',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a53839e0fe867b76b58d16b0a1a7c598e',1,'turbojpeg.h']]],
|
||||||
|
['tjerr_5ffatal',['TJERR_FATAL',['../group___turbo_j_p_e_g.html#ggafbc17cfa57d0d5d11fea35ac025950feafc9cceeada13122b09e4851e3788039a',1,'turbojpeg.h']]],
|
||||||
|
['tjerr_5fwarning',['TJERR_WARNING',['../group___turbo_j_p_e_g.html#ggafbc17cfa57d0d5d11fea35ac025950fea342dd6e2aedb47bb257b4e7568329b59',1,'turbojpeg.h']]],
|
||||||
['tjpf_5fabgr',['TJPF_ABGR',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa1ba1a7f1631dbeaa49a0a85fc4a40081',1,'turbojpeg.h']]],
|
['tjpf_5fabgr',['TJPF_ABGR',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa1ba1a7f1631dbeaa49a0a85fc4a40081',1,'turbojpeg.h']]],
|
||||||
['tjpf_5fargb',['TJPF_ARGB',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aae8f846ed9d9de99b6e1dfe448848765c',1,'turbojpeg.h']]],
|
['tjpf_5fargb',['TJPF_ARGB',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aae8f846ed9d9de99b6e1dfe448848765c',1,'turbojpeg.h']]],
|
||||||
['tjpf_5fbgr',['TJPF_BGR',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aab10624437fb8ef495a0b153e65749839',1,'turbojpeg.h']]],
|
['tjpf_5fbgr',['TJPF_BGR',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aab10624437fb8ef495a0b153e65749839',1,'turbojpeg.h']]],
|
||||||
@@ -15,6 +17,7 @@ var searchData=
|
|||||||
['tjpf_5frgb',['TJPF_RGB',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7ce93230bff449518ce387c17e6ed37c',1,'turbojpeg.h']]],
|
['tjpf_5frgb',['TJPF_RGB',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7ce93230bff449518ce387c17e6ed37c',1,'turbojpeg.h']]],
|
||||||
['tjpf_5frgba',['TJPF_RGBA',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa88d2e88fab67f6503cf972e14851cc12',1,'turbojpeg.h']]],
|
['tjpf_5frgba',['TJPF_RGBA',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa88d2e88fab67f6503cf972e14851cc12',1,'turbojpeg.h']]],
|
||||||
['tjpf_5frgbx',['TJPF_RGBX',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01',1,'turbojpeg.h']]],
|
['tjpf_5frgbx',['TJPF_RGBX',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01',1,'turbojpeg.h']]],
|
||||||
|
['tjpf_5funknown',['TJPF_UNKNOWN',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa84c1a6cead7952998e2fb895844a21ed',1,'turbojpeg.h']]],
|
||||||
['tjpf_5fxbgr',['TJPF_XBGR',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af',1,'turbojpeg.h']]],
|
['tjpf_5fxbgr',['TJPF_XBGR',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af',1,'turbojpeg.h']]],
|
||||||
['tjpf_5fxrgb',['TJPF_XRGB',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84',1,'turbojpeg.h']]],
|
['tjpf_5fxrgb',['TJPF_XRGB',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84',1,'turbojpeg.h']]],
|
||||||
['tjsamp_5f411',['TJSAMP_411',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a28ec62575e5ea295c3fde3001dc628e2',1,'turbojpeg.h']]],
|
['tjsamp_5f411',['TJSAMP_411',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a28ec62575e5ea295c3fde3001dc628e2',1,'turbojpeg.h']]],
|
||||||
|
|||||||
@@ -1,28 +1,31 @@
|
|||||||
var searchData=
|
var searchData=
|
||||||
[
|
[
|
||||||
['tjalloc',['tjAlloc',['../group___turbo_j_p_e_g.html#ga5c9234bda6d993cdaffdd89bf81a00ff',1,'turbojpeg.h']]],
|
['tjalloc',['tjAlloc',['../group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83',1,'turbojpeg.h']]],
|
||||||
['tjbufsize',['tjBufSize',['../group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b',1,'turbojpeg.h']]],
|
['tjbufsize',['tjBufSize',['../group___turbo_j_p_e_g.html#ga67ac12fee79073242cb216e07c9f1f90',1,'turbojpeg.h']]],
|
||||||
['tjbufsizeyuv2',['tjBufSizeYUV2',['../group___turbo_j_p_e_g.html#gaf451664a62c1f6c7cc5a6401f32908c9',1,'turbojpeg.h']]],
|
['tjbufsizeyuv2',['tjBufSizeYUV2',['../group___turbo_j_p_e_g.html#ga2be2b9969d4df9ecce9b05deed273194',1,'turbojpeg.h']]],
|
||||||
['tjcompress2',['tjCompress2',['../group___turbo_j_p_e_g.html#gaf38f2ed44bdc88e730e08b632fa6e88e',1,'turbojpeg.h']]],
|
['tjcompress2',['tjCompress2',['../group___turbo_j_p_e_g.html#gafbdce0112fd78fd38efae841443a9bcf',1,'turbojpeg.h']]],
|
||||||
['tjcompressfromyuv',['tjCompressFromYUV',['../group___turbo_j_p_e_g.html#ga6f6de375d6ec0020faba627e37e5a060',1,'turbojpeg.h']]],
|
['tjcompressfromyuv',['tjCompressFromYUV',['../group___turbo_j_p_e_g.html#ga7622a459b79aa1007e005b58783f875b',1,'turbojpeg.h']]],
|
||||||
['tjcompressfromyuvplanes',['tjCompressFromYUVPlanes',['../group___turbo_j_p_e_g.html#ga0b84c682d8accf097d7a743c965d3464',1,'turbojpeg.h']]],
|
['tjcompressfromyuvplanes',['tjCompressFromYUVPlanes',['../group___turbo_j_p_e_g.html#ga29ec5dfbd2d84b8724e951d6fa0d5d9e',1,'turbojpeg.h']]],
|
||||||
['tjdecodeyuv',['tjDecodeYUV',['../group___turbo_j_p_e_g.html#ga077c61027b875afecd5a1613bf18b3c1',1,'turbojpeg.h']]],
|
['tjdecodeyuv',['tjDecodeYUV',['../group___turbo_j_p_e_g.html#ga70abbf38f77a26fd6da8813bef96f695',1,'turbojpeg.h']]],
|
||||||
['tjdecodeyuvplanes',['tjDecodeYUVPlanes',['../group___turbo_j_p_e_g.html#gaf42f19b7a496eb18bdc84fe61ee6d3e2',1,'turbojpeg.h']]],
|
['tjdecodeyuvplanes',['tjDecodeYUVPlanes',['../group___turbo_j_p_e_g.html#ga10e837c07fa9d25770565b237d3898d9',1,'turbojpeg.h']]],
|
||||||
['tjdecompress2',['tjDecompress2',['../group___turbo_j_p_e_g.html#gad8026a417e16a76313bc0a6c9e8b2ba2',1,'turbojpeg.h']]],
|
['tjdecompress2',['tjDecompress2',['../group___turbo_j_p_e_g.html#gae9eccef8b682a48f43a9117c231ed013',1,'turbojpeg.h']]],
|
||||||
['tjdecompressheader3',['tjDecompressHeader3',['../group___turbo_j_p_e_g.html#ga3fced455e504e8ff4fbad28ba94a3020',1,'turbojpeg.h']]],
|
['tjdecompressheader3',['tjDecompressHeader3',['../group___turbo_j_p_e_g.html#ga0595681096bba7199cc6f3533cb25f77',1,'turbojpeg.h']]],
|
||||||
['tjdecompresstoyuv2',['tjDecompressToYUV2',['../group___turbo_j_p_e_g.html#ga39e08906528db5a764670ea48d344b09',1,'turbojpeg.h']]],
|
['tjdecompresstoyuv2',['tjDecompressToYUV2',['../group___turbo_j_p_e_g.html#ga04d1e839ff9a0860dd1475cff78d3364',1,'turbojpeg.h']]],
|
||||||
['tjdecompresstoyuvplanes',['tjDecompressToYUVPlanes',['../group___turbo_j_p_e_g.html#ga38d0ef90692663b3ffb5b16da2541512',1,'turbojpeg.h']]],
|
['tjdecompresstoyuvplanes',['tjDecompressToYUVPlanes',['../group___turbo_j_p_e_g.html#gaa59f901a5258ada5bd0185ad59368540',1,'turbojpeg.h']]],
|
||||||
['tjdestroy',['tjDestroy',['../group___turbo_j_p_e_g.html#ga674adee917b95ad4a896f1ba39e12540',1,'turbojpeg.h']]],
|
['tjdestroy',['tjDestroy',['../group___turbo_j_p_e_g.html#ga75f355fa27225ba1a4ee392c852394d2',1,'turbojpeg.h']]],
|
||||||
['tjencodeyuv3',['tjEncodeYUV3',['../group___turbo_j_p_e_g.html#gaabe05acd734990053ad1294b5ef239aa',1,'turbojpeg.h']]],
|
['tjencodeyuv3',['tjEncodeYUV3',['../group___turbo_j_p_e_g.html#gac519b922cdf446e97d0cdcba513636bf',1,'turbojpeg.h']]],
|
||||||
['tjencodeyuvplanes',['tjEncodeYUVPlanes',['../group___turbo_j_p_e_g.html#ga8a65ed3bd12df57c219d46afbc9008f1',1,'turbojpeg.h']]],
|
['tjencodeyuvplanes',['tjEncodeYUVPlanes',['../group___turbo_j_p_e_g.html#gae2d04c72457fe7f4d60cf78ab1b1feb1',1,'turbojpeg.h']]],
|
||||||
['tjfree',['tjFree',['../group___turbo_j_p_e_g.html#ga8c4a1231dc06a450514c835f6471f137',1,'turbojpeg.h']]],
|
['tjfree',['tjFree',['../group___turbo_j_p_e_g.html#gaea863d2da0cdb609563aabdf9196514b',1,'turbojpeg.h']]],
|
||||||
['tjgeterrorstr',['tjGetErrorStr',['../group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf',1,'turbojpeg.h']]],
|
['tjgeterrorcode',['tjGetErrorCode',['../group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410',1,'turbojpeg.h']]],
|
||||||
['tjgetscalingfactors',['tjGetScalingFactors',['../group___turbo_j_p_e_g.html#ga6449044b9af402999ccf52f401333be8',1,'turbojpeg.h']]],
|
['tjgeterrorstr2',['tjGetErrorStr2',['../group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa',1,'turbojpeg.h']]],
|
||||||
['tjinitcompress',['tjInitCompress',['../group___turbo_j_p_e_g.html#ga3d10c47fbe4a2489a2b30c931551d01a',1,'turbojpeg.h']]],
|
['tjgetscalingfactors',['tjGetScalingFactors',['../group___turbo_j_p_e_g.html#gac3854476006b10787bd128f7ede48057',1,'turbojpeg.h']]],
|
||||||
['tjinitdecompress',['tjInitDecompress',['../group___turbo_j_p_e_g.html#gae5408179d041e2a2f7199c8283cf649e',1,'turbojpeg.h']]],
|
['tjinitcompress',['tjInitCompress',['../group___turbo_j_p_e_g.html#ga9d63a05fc6d813f4aae06107041a37e8',1,'turbojpeg.h']]],
|
||||||
['tjinittransform',['tjInitTransform',['../group___turbo_j_p_e_g.html#ga3155b775bfbac9dbba869b95a0367902',1,'turbojpeg.h']]],
|
['tjinitdecompress',['tjInitDecompress',['../group___turbo_j_p_e_g.html#ga52300eac3f3d9ef4bab303bc244f62d3',1,'turbojpeg.h']]],
|
||||||
|
['tjinittransform',['tjInitTransform',['../group___turbo_j_p_e_g.html#ga928beff6ac248ceadf01089fc6b41957',1,'turbojpeg.h']]],
|
||||||
|
['tjloadimage',['tjLoadImage',['../group___turbo_j_p_e_g.html#gaffbd83c375e79f5db4b5c5d8ad4466e7',1,'turbojpeg.h']]],
|
||||||
['tjplaneheight',['tjPlaneHeight',['../group___turbo_j_p_e_g.html#ga1a209696c6a80748f20e134b3c64789f',1,'turbojpeg.h']]],
|
['tjplaneheight',['tjPlaneHeight',['../group___turbo_j_p_e_g.html#ga1a209696c6a80748f20e134b3c64789f',1,'turbojpeg.h']]],
|
||||||
['tjplanesizeyuv',['tjPlaneSizeYUV',['../group___turbo_j_p_e_g.html#ga6f98d977bfa9d167c97172e876ba61e2',1,'turbojpeg.h']]],
|
['tjplanesizeyuv',['tjPlaneSizeYUV',['../group___turbo_j_p_e_g.html#gab4ab7b24f6e797d79abaaa670373961d',1,'turbojpeg.h']]],
|
||||||
['tjplanewidth',['tjPlaneWidth',['../group___turbo_j_p_e_g.html#ga63fb66bb1e36c74008c4634360becbb1',1,'turbojpeg.h']]],
|
['tjplanewidth',['tjPlaneWidth',['../group___turbo_j_p_e_g.html#ga63fb66bb1e36c74008c4634360becbb1',1,'turbojpeg.h']]],
|
||||||
['tjtransform',['tjTransform',['../group___turbo_j_p_e_g.html#gad02cd42b69f193a0623a9c801788df3a',1,'turbojpeg.h']]]
|
['tjsaveimage',['tjSaveImage',['../group___turbo_j_p_e_g.html#ga6f445b22d8933ae4815b3370a538d879',1,'turbojpeg.h']]],
|
||||||
|
['tjtransform',['tjTransform',['../group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25',1,'turbojpeg.h']]]
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
var searchData=
|
var searchData=
|
||||||
[
|
[
|
||||||
|
['tjalphaoffset',['tjAlphaOffset',['../group___turbo_j_p_e_g.html#ga5af0ab065feefd526debf1e20c43e837',1,'turbojpeg.h']]],
|
||||||
['tjblueoffset',['tjBlueOffset',['../group___turbo_j_p_e_g.html#ga84e2e35d3f08025f976ec1ec53693dea',1,'turbojpeg.h']]],
|
['tjblueoffset',['tjBlueOffset',['../group___turbo_j_p_e_g.html#ga84e2e35d3f08025f976ec1ec53693dea',1,'turbojpeg.h']]],
|
||||||
['tjgreenoffset',['tjGreenOffset',['../group___turbo_j_p_e_g.html#ga82d6e35da441112a411da41923c0ba2f',1,'turbojpeg.h']]],
|
['tjgreenoffset',['tjGreenOffset',['../group___turbo_j_p_e_g.html#ga82d6e35da441112a411da41923c0ba2f',1,'turbojpeg.h']]],
|
||||||
['tjmcuheight',['tjMCUHeight',['../group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf',1,'turbojpeg.h']]],
|
['tjmcuheight',['tjMCUHeight',['../group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf',1,'turbojpeg.h']]],
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<tr style="height: 56px;">
|
<tr style="height: 56px;">
|
||||||
<td style="padding-left: 0.5em;">
|
<td style="padding-left: 0.5em;">
|
||||||
<div id="projectname">TurboJPEG
|
<div id="projectname">TurboJPEG
|
||||||
 <span id="projectnumber">1.5</span>
|
 <span id="projectnumber">2.0</span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<tr style="height: 56px;">
|
<tr style="height: 56px;">
|
||||||
<td style="padding-left: 0.5em;">
|
<td style="padding-left: 0.5em;">
|
||||||
<div id="projectname">TurboJPEG
|
<div id="projectname">TurboJPEG
|
||||||
 <span id="projectnumber">1.5</span>
|
 <span id="projectnumber">2.0</span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<tr style="height: 56px;">
|
<tr style="height: 56px;">
|
||||||
<td style="padding-left: 0.5em;">
|
<td style="padding-left: 0.5em;">
|
||||||
<div id="projectname">TurboJPEG
|
<div id="projectname">TurboJPEG
|
||||||
 <span id="projectnumber">1.5</span>
|
 <span id="projectnumber">2.0</span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -133,7 +133,7 @@ Data Fields</h2></td></tr>
|
|||||||
<tr><td class="paramname">arrayRegion</td><td><a class="el" href="structtjregion.html" title="Cropping region.">tjregion</a> structure containing the width and height of the array pointed to by <code>coeffs</code> as well as its offset relative to the component plane. TurboJPEG implementations may choose to split each component plane into multiple DCT coefficient arrays and call the callback function once for each array.</td></tr>
|
<tr><td class="paramname">arrayRegion</td><td><a class="el" href="structtjregion.html" title="Cropping region.">tjregion</a> structure containing the width and height of the array pointed to by <code>coeffs</code> as well as its offset relative to the component plane. TurboJPEG implementations may choose to split each component plane into multiple DCT coefficient arrays and call the callback function once for each array.</td></tr>
|
||||||
<tr><td class="paramname">planeRegion</td><td><a class="el" href="structtjregion.html" title="Cropping region.">tjregion</a> structure containing the width and height of the component plane to which <code>coeffs</code> belongs</td></tr>
|
<tr><td class="paramname">planeRegion</td><td><a class="el" href="structtjregion.html" title="Cropping region.">tjregion</a> structure containing the width and height of the component plane to which <code>coeffs</code> belongs</td></tr>
|
||||||
<tr><td class="paramname">componentID</td><td>ID number of the component plane to which <code>coeffs</code> belongs (Y, Cb, and Cr have, respectively, ID's of 0, 1, and 2 in typical JPEG images.)</td></tr>
|
<tr><td class="paramname">componentID</td><td>ID number of the component plane to which <code>coeffs</code> belongs (Y, Cb, and Cr have, respectively, ID's of 0, 1, and 2 in typical JPEG images.)</td></tr>
|
||||||
<tr><td class="paramname">transformID</td><td>ID number of the transformed image to which <code>coeffs</code> belongs. This is the same as the index of the transform in the <code>transforms</code> array that was passed to <a class="el" href="group___turbo_j_p_e_g.html#gad02cd42b69f193a0623a9c801788df3a" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a>.</td></tr>
|
<tr><td class="paramname">transformID</td><td>ID number of the transformed image to which <code>coeffs</code> belongs. This is the same as the index of the transform in the <code>transforms</code> array that was passed to <a class="el" href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a>.</td></tr>
|
||||||
<tr><td class="paramname">transform</td><td>a pointer to a <a class="el" href="structtjtransform.html" title="Lossless transform.">tjtransform</a> structure that specifies the parameters and/or cropping region for this transform</td></tr>
|
<tr><td class="paramname">transform</td><td>a pointer to a <a class="el" href="structtjtransform.html" title="Lossless transform.">tjtransform</a> structure that specifies the parameters and/or cropping region for this transform</td></tr>
|
||||||
</table>
|
</table>
|
||||||
</dd>
|
</dd>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
PROJECT_NAME = TurboJPEG
|
PROJECT_NAME = TurboJPEG
|
||||||
PROJECT_NUMBER = 1.5
|
PROJECT_NUMBER = 2.0
|
||||||
OUTPUT_DIRECTORY = doc/
|
OUTPUT_DIRECTORY = doc/
|
||||||
USE_WINDOWS_ENCODING = NO
|
USE_WINDOWS_ENCODING = NO
|
||||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* example.c
|
* example.txt
|
||||||
*
|
*
|
||||||
* This file illustrates how to use the IJG code as a subroutine library
|
* This file illustrates how to use the IJG code as a subroutine library
|
||||||
* to read or write JPEG image files. You should look at this code in
|
* to read or write JPEG image files. You should look at this code in
|
||||||
@@ -13,6 +13,20 @@
|
|||||||
* routines in a different style if you prefer.
|
* routines in a different style if you prefer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* This example was part of the original libjpeg documentation and has been
|
||||||
|
* unchanged since 1994. It is, as described in libjpeg.txt, "heavily
|
||||||
|
* commented skeleton code for calling the JPEG library." It is not meant to
|
||||||
|
* be compiled as a standalone program, since it has no main() function and
|
||||||
|
* does not compress from/decompress to a real image buffer (corollary:
|
||||||
|
* put_scanline_someplace() is not a real function.) First-time users of
|
||||||
|
* libjpeg-turbo would be better served by looking at tjexample.c, which uses
|
||||||
|
* the more straightforward TurboJPEG API, or at cjpeg.c and djpeg.c, which are
|
||||||
|
* examples of libjpeg API usage that can be (and are) compiled into standalone
|
||||||
|
* programs. Note that this example, as well as the examples in cjpeg.c and
|
||||||
|
* djpeg.c, interleave disk I/O with JPEG compression/decompression, so none of
|
||||||
|
* these examples is suitable for benchmarking purposes.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -69,7 +83,7 @@ extern int image_width; /* Number of columns in image */
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
write_JPEG_file (char *filename, int quality)
|
write_JPEG_file(char *filename, int quality)
|
||||||
{
|
{
|
||||||
/* This struct contains the JPEG compression parameters and pointers to
|
/* This struct contains the JPEG compression parameters and pointers to
|
||||||
* working space (which is allocated as needed by the JPEG library).
|
* working space (which is allocated as needed by the JPEG library).
|
||||||
@@ -158,8 +172,8 @@ write_JPEG_file (char *filename, int quality)
|
|||||||
* Here the array is only one element long, but you could pass
|
* Here the array is only one element long, but you could pass
|
||||||
* more than one scanline at a time if that's more convenient.
|
* more than one scanline at a time if that's more convenient.
|
||||||
*/
|
*/
|
||||||
row_pointer[0] = & image_buffer[cinfo.next_scanline * row_stride];
|
row_pointer[0] = &image_buffer[cinfo.next_scanline * row_stride];
|
||||||
(void) jpeg_write_scanlines(&cinfo, row_pointer, 1);
|
(void)jpeg_write_scanlines(&cinfo, row_pointer, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Step 6: Finish compression */
|
/* Step 6: Finish compression */
|
||||||
@@ -260,10 +274,10 @@ typedef struct my_error_mgr *my_error_ptr;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
my_error_exit (j_common_ptr cinfo)
|
my_error_exit(j_common_ptr cinfo)
|
||||||
{
|
{
|
||||||
/* cinfo->err really points to a my_error_mgr struct, so coerce pointer */
|
/* cinfo->err really points to a my_error_mgr struct, so coerce pointer */
|
||||||
my_error_ptr myerr = (my_error_ptr) cinfo->err;
|
my_error_ptr myerr = (my_error_ptr)cinfo->err;
|
||||||
|
|
||||||
/* Always display the message. */
|
/* Always display the message. */
|
||||||
/* We could postpone this until after returning, if we chose. */
|
/* We could postpone this until after returning, if we chose. */
|
||||||
@@ -274,19 +288,36 @@ my_error_exit (j_common_ptr cinfo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
METHODDEF(int) do_read_JPEG_file(struct jpeg_decompress_struct *cinfo,
|
||||||
|
char *filename);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sample routine for JPEG decompression. We assume that the source file name
|
* Sample routine for JPEG decompression. We assume that the source file name
|
||||||
* is passed in. We want to return 1 on success, 0 on error.
|
* is passed in. We want to return 1 on success, 0 on error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
GLOBAL(int)
|
GLOBAL(int)
|
||||||
read_JPEG_file (char *filename)
|
read_JPEG_file(char *filename)
|
||||||
{
|
{
|
||||||
/* This struct contains the JPEG decompression parameters and pointers to
|
/* This struct contains the JPEG decompression parameters and pointers to
|
||||||
* working space (which is allocated as needed by the JPEG library).
|
* working space (which is allocated as needed by the JPEG library).
|
||||||
*/
|
*/
|
||||||
struct jpeg_decompress_struct cinfo;
|
struct jpeg_decompress_struct cinfo;
|
||||||
|
|
||||||
|
return do_read_JPEG_file(&cinfo, filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We call the libjpeg API from within a separate function, because modifying
|
||||||
|
* the local non-volatile jpeg_decompress_struct instance below the setjmp()
|
||||||
|
* return point and then accessing the instance after setjmp() returns would
|
||||||
|
* return in undefined behavior that may potentially overwrite all or part of
|
||||||
|
* the structure.
|
||||||
|
*/
|
||||||
|
|
||||||
|
METHODDEF(int)
|
||||||
|
do_read_JPEG_file(struct jpeg_decompress_struct *cinfo, char *filename)
|
||||||
|
{
|
||||||
/* We use our private extension JPEG error handler.
|
/* We use our private extension JPEG error handler.
|
||||||
* Note that this struct must live as long as the main JPEG parameter
|
* Note that this struct must live as long as the main JPEG parameter
|
||||||
* struct, to avoid dangling-pointer problems.
|
* struct, to avoid dangling-pointer problems.
|
||||||
@@ -311,27 +342,27 @@ read_JPEG_file (char *filename)
|
|||||||
/* Step 1: allocate and initialize JPEG decompression object */
|
/* Step 1: allocate and initialize JPEG decompression object */
|
||||||
|
|
||||||
/* We set up the normal JPEG error routines, then override error_exit. */
|
/* We set up the normal JPEG error routines, then override error_exit. */
|
||||||
cinfo.err = jpeg_std_error(&jerr.pub);
|
cinfo->err = jpeg_std_error(&jerr.pub);
|
||||||
jerr.pub.error_exit = my_error_exit;
|
jerr.pub.error_exit = my_error_exit;
|
||||||
/* Establish the setjmp return context for my_error_exit to use. */
|
/* Establish the setjmp return context for my_error_exit to use. */
|
||||||
if (setjmp(jerr.setjmp_buffer)) {
|
if (setjmp(jerr.setjmp_buffer)) {
|
||||||
/* If we get here, the JPEG code has signaled an error.
|
/* If we get here, the JPEG code has signaled an error.
|
||||||
* We need to clean up the JPEG object, close the input file, and return.
|
* We need to clean up the JPEG object, close the input file, and return.
|
||||||
*/
|
*/
|
||||||
jpeg_destroy_decompress(&cinfo);
|
jpeg_destroy_decompress(cinfo);
|
||||||
fclose(infile);
|
fclose(infile);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* Now we can initialize the JPEG decompression object. */
|
/* Now we can initialize the JPEG decompression object. */
|
||||||
jpeg_create_decompress(&cinfo);
|
jpeg_create_decompress(cinfo);
|
||||||
|
|
||||||
/* Step 2: specify data source (eg, a file) */
|
/* Step 2: specify data source (eg, a file) */
|
||||||
|
|
||||||
jpeg_stdio_src(&cinfo, infile);
|
jpeg_stdio_src(cinfo, infile);
|
||||||
|
|
||||||
/* Step 3: read file parameters with jpeg_read_header() */
|
/* Step 3: read file parameters with jpeg_read_header() */
|
||||||
|
|
||||||
(void) jpeg_read_header(&cinfo, TRUE);
|
(void)jpeg_read_header(cinfo, TRUE);
|
||||||
/* We can ignore the return value from jpeg_read_header since
|
/* We can ignore the return value from jpeg_read_header since
|
||||||
* (a) suspension is not possible with the stdio data source, and
|
* (a) suspension is not possible with the stdio data source, and
|
||||||
* (b) we passed TRUE to reject a tables-only JPEG file as an error.
|
* (b) we passed TRUE to reject a tables-only JPEG file as an error.
|
||||||
@@ -346,7 +377,7 @@ read_JPEG_file (char *filename)
|
|||||||
|
|
||||||
/* Step 5: Start decompressor */
|
/* Step 5: Start decompressor */
|
||||||
|
|
||||||
(void) jpeg_start_decompress(&cinfo);
|
(void)jpeg_start_decompress(cinfo);
|
||||||
/* We can ignore the return value since suspension is not possible
|
/* We can ignore the return value since suspension is not possible
|
||||||
* with the stdio data source.
|
* with the stdio data source.
|
||||||
*/
|
*/
|
||||||
@@ -358,30 +389,30 @@ read_JPEG_file (char *filename)
|
|||||||
* In this example, we need to make an output work buffer of the right size.
|
* In this example, we need to make an output work buffer of the right size.
|
||||||
*/
|
*/
|
||||||
/* JSAMPLEs per row in output buffer */
|
/* JSAMPLEs per row in output buffer */
|
||||||
row_stride = cinfo.output_width * cinfo.output_components;
|
row_stride = cinfo->output_width * cinfo->output_components;
|
||||||
/* Make a one-row-high sample array that will go away when done with image */
|
/* Make a one-row-high sample array that will go away when done with image */
|
||||||
buffer = (*cinfo.mem->alloc_sarray)
|
buffer = (*cinfo->mem->alloc_sarray)
|
||||||
((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1);
|
((j_common_ptr)cinfo, JPOOL_IMAGE, row_stride, 1);
|
||||||
|
|
||||||
/* Step 6: while (scan lines remain to be read) */
|
/* Step 6: while (scan lines remain to be read) */
|
||||||
/* jpeg_read_scanlines(...); */
|
/* jpeg_read_scanlines(...); */
|
||||||
|
|
||||||
/* Here we use the library's state variable cinfo.output_scanline as the
|
/* Here we use the library's state variable cinfo->output_scanline as the
|
||||||
* loop counter, so that we don't have to keep track ourselves.
|
* loop counter, so that we don't have to keep track ourselves.
|
||||||
*/
|
*/
|
||||||
while (cinfo.output_scanline < cinfo.output_height) {
|
while (cinfo->output_scanline < cinfo->output_height) {
|
||||||
/* jpeg_read_scanlines expects an array of pointers to scanlines.
|
/* jpeg_read_scanlines expects an array of pointers to scanlines.
|
||||||
* Here the array is only one element long, but you could ask for
|
* Here the array is only one element long, but you could ask for
|
||||||
* more than one scanline at a time if that's more convenient.
|
* more than one scanline at a time if that's more convenient.
|
||||||
*/
|
*/
|
||||||
(void) jpeg_read_scanlines(&cinfo, buffer, 1);
|
(void)jpeg_read_scanlines(cinfo, buffer, 1);
|
||||||
/* Assume put_scanline_someplace wants a pointer and sample count. */
|
/* Assume put_scanline_someplace wants a pointer and sample count. */
|
||||||
put_scanline_someplace(buffer[0], row_stride);
|
put_scanline_someplace(buffer[0], row_stride);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Step 7: Finish decompression */
|
/* Step 7: Finish decompression */
|
||||||
|
|
||||||
(void) jpeg_finish_decompress(&cinfo);
|
(void)jpeg_finish_decompress(cinfo);
|
||||||
/* We can ignore the return value since suspension is not possible
|
/* We can ignore the return value since suspension is not possible
|
||||||
* with the stdio data source.
|
* with the stdio data source.
|
||||||
*/
|
*/
|
||||||
@@ -389,7 +420,7 @@ read_JPEG_file (char *filename)
|
|||||||
/* Step 8: Release JPEG decompression object */
|
/* Step 8: Release JPEG decompression object */
|
||||||
|
|
||||||
/* This is an important step since it will release a good deal of memory. */
|
/* This is an important step since it will release a good deal of memory. */
|
||||||
jpeg_destroy_decompress(&cinfo);
|
jpeg_destroy_decompress(cinfo);
|
||||||
|
|
||||||
/* After finish_decompress, we can close the input file.
|
/* After finish_decompress, we can close the input file.
|
||||||
* Here we postpone it until after no more JPEG errors are possible,
|
* Here we postpone it until after no more JPEG errors are possible,
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Make a local, clean libjpeg-turbo branch that tracks the remote libjpeg-turbo.
|
|
||||||
# This will allow pushing of imported libjpeg-turbo commits to the mozjpeg repository.
|
|
||||||
# The libjpeg-turbo branch must only contain imported SVN commits (with git-svn-id: in the message).
|
|
||||||
git branch -f -t libjpeg-turbo origin/libjpeg-turbo
|
|
||||||
|
|
||||||
# Configure git-svn. "git svn fetch" will rebuild remaining git-svn metadata.
|
|
||||||
git config svn-remote.svn.url svn://svn.code.sf.net/p/libjpeg-turbo/code
|
|
||||||
git config svn-remote.svn.fetch trunk:refs/heads/libjpeg-turbo
|
|
||||||
|
|
||||||
# Enable mapping of SVN usernames to git authors.
|
|
||||||
git config svn.authorsfile .gitauthors
|
|
||||||
|
|
||||||
# Mark which libjpeg-turbo commit has been used to start mozjpeg.
|
|
||||||
# Required for accurate merging and blame.
|
|
||||||
echo > .git/info/grafts "72b66f9c77b3e4ae363b21e48145f635cec0b193 540789427ccae8e9e778151cbc16ab8ee88ac6a8"
|
|
||||||
|
|
||||||
# To get changes from SVN:
|
|
||||||
# git svn fetch
|
|
||||||
# git push origin libjpeg-turbo
|
|
||||||
#
|
|
||||||
# To merge SVN changes with mozjpeg:
|
|
||||||
# git checkout master
|
|
||||||
# git merge libjpeg-turbo
|
|
||||||
13
jaricom.c
13
jaricom.c
@@ -4,16 +4,16 @@
|
|||||||
* This file was part of the Independent JPEG Group's software:
|
* This file was part of the Independent JPEG Group's software:
|
||||||
* Developed 1997-2009 by Guido Vollbeding.
|
* Developed 1997-2009 by Guido Vollbeding.
|
||||||
* libjpeg-turbo Modifications:
|
* libjpeg-turbo Modifications:
|
||||||
* Copyright (C) 2015, D. R. Commander.
|
* Copyright (C) 2015, 2018, D. R. Commander.
|
||||||
* For conditions of distribution and use, see the accompanying README.ijg
|
* For conditions of distribution and use, see the accompanying README.ijg
|
||||||
* file.
|
* file.
|
||||||
*
|
*
|
||||||
* This file contains probability estimation tables for common use in
|
* This file contains probability estimation tables for common use in
|
||||||
* arithmetic entropy encoding and decoding routines.
|
* arithmetic entropy encoding and decoding routines.
|
||||||
*
|
*
|
||||||
* This data represents Table D.2 in the JPEG spec (ISO/IEC IS 10918-1
|
* This data represents Table D.2 in
|
||||||
* and CCITT Recommendation ITU-T T.81) and Table 24 in the JBIG spec
|
* Recommendation ITU-T T.81 (1992) | ISO/IEC 10918-1:1994 and Table 24 in
|
||||||
* (ISO/IEC IS 11544 and CCITT Recommendation ITU-T T.82).
|
* Recommendation ITU-T T.82 (1993) | ISO/IEC 11544:1993.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define JPEG_INTERNALS
|
#define JPEG_INTERNALS
|
||||||
@@ -29,9 +29,10 @@
|
|||||||
* implementation (jbig_tab.c).
|
* implementation (jbig_tab.c).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define V(i,a,b,c,d) (((JLONG)a << 16) | ((JLONG)c << 8) | ((JLONG)d << 7) | b)
|
#define V(i, a, b, c, d) \
|
||||||
|
(((JLONG)a << 16) | ((JLONG)c << 8) | ((JLONG)d << 7) | b)
|
||||||
|
|
||||||
const JLONG jpeg_aritab[113+1] = {
|
const JLONG jpeg_aritab[113 + 1] = {
|
||||||
/*
|
/*
|
||||||
* Index, Qe_Value, Next_Index_LPS, Next_Index_MPS, Switch_MPS
|
* Index, Qe_Value, Next_Index_LPS, Next_Index_MPS, Switch_MPS
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,58 +1,88 @@
|
|||||||
set(JAR_FILE turbojpeg.jar)
|
find_package(Java REQUIRED)
|
||||||
set(MANIFEST_FILE "${CMAKE_CURRENT_SOURCE_DIR}/MANIFEST.MF")
|
find_package(JNI REQUIRED)
|
||||||
|
|
||||||
set(JAVA_CLASSNAMES org/libjpegturbo/turbojpeg/TJ
|
# Allow the Java compiler flags to be set using an environment variable
|
||||||
org/libjpegturbo/turbojpeg/TJCompressor
|
if(NOT DEFINED CMAKE_JAVA_COMPILE_FLAGS AND DEFINED ENV{JAVAFLAGS})
|
||||||
org/libjpegturbo/turbojpeg/TJCustomFilter
|
set(CMAKE_JAVA_COMPILE_FLAGS $ENV{JAVAFLAGS})
|
||||||
org/libjpegturbo/turbojpeg/TJDecompressor
|
|
||||||
org/libjpegturbo/turbojpeg/TJException
|
|
||||||
org/libjpegturbo/turbojpeg/TJScalingFactor
|
|
||||||
org/libjpegturbo/turbojpeg/TJTransform
|
|
||||||
org/libjpegturbo/turbojpeg/TJTransformer
|
|
||||||
org/libjpegturbo/turbojpeg/YUVImage
|
|
||||||
TJUnitTest
|
|
||||||
TJExample
|
|
||||||
TJBench)
|
|
||||||
|
|
||||||
if(MSVC_IDE)
|
|
||||||
set(OBJDIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}")
|
|
||||||
else()
|
|
||||||
set(OBJDIR "${CMAKE_CURRENT_BINARY_DIR}")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
include(UseJava)
|
||||||
|
|
||||||
|
set(CMAKE_JAVA_COMPILE_FLAGS "${CMAKE_JAVA_COMPILE_FLAGS} -J-Dfile.encoding=UTF8")
|
||||||
|
message(STATUS "CMAKE_JAVA_COMPILE_FLAGS = ${CMAKE_JAVA_COMPILE_FLAGS}")
|
||||||
|
string(REGEX REPLACE " " ";" CMAKE_JAVA_COMPILE_FLAGS "${CMAKE_JAVA_COMPILE_FLAGS}")
|
||||||
|
|
||||||
|
set(JAVAARGS "" CACHE STRING "Additional arguments to pass to java when running unit tests (example: -d32)")
|
||||||
|
message(STATUS "JAVAARGS = ${JAVAARGS}")
|
||||||
|
|
||||||
|
set(JAVA_SOURCES org/libjpegturbo/turbojpeg/TJ.java
|
||||||
|
org/libjpegturbo/turbojpeg/TJCompressor.java
|
||||||
|
org/libjpegturbo/turbojpeg/TJCustomFilter.java
|
||||||
|
org/libjpegturbo/turbojpeg/TJDecompressor.java
|
||||||
|
org/libjpegturbo/turbojpeg/TJException.java
|
||||||
|
org/libjpegturbo/turbojpeg/TJScalingFactor.java
|
||||||
|
org/libjpegturbo/turbojpeg/TJTransform.java
|
||||||
|
org/libjpegturbo/turbojpeg/TJTransformer.java
|
||||||
|
org/libjpegturbo/turbojpeg/YUVImage.java
|
||||||
|
TJUnitTest.java
|
||||||
|
TJExample.java
|
||||||
|
TJBench.java)
|
||||||
|
|
||||||
set(TURBOJPEG_DLL_NAME "turbojpeg")
|
set(TURBOJPEG_DLL_NAME "turbojpeg")
|
||||||
if(MINGW)
|
if(MINGW)
|
||||||
set(TURBOJPEG_DLL_NAME "libturbojpeg")
|
set(TURBOJPEG_DLL_NAME "libturbojpeg")
|
||||||
endif()
|
endif()
|
||||||
configure_file(org/libjpegturbo/turbojpeg/TJLoader.java.in
|
if(WIN32)
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/org/libjpegturbo/turbojpeg/TJLoader.java")
|
configure_file(org/libjpegturbo/turbojpeg/TJLoader-win.java.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/org/libjpegturbo/turbojpeg/TJLoader.java)
|
||||||
|
else()
|
||||||
|
configure_file(org/libjpegturbo/turbojpeg/TJLoader-unix.java.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/org/libjpegturbo/turbojpeg/TJLoader.java)
|
||||||
|
endif()
|
||||||
|
set(JAVA_SOURCES ${JAVA_SOURCES}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/org/libjpegturbo/turbojpeg/TJLoader.java)
|
||||||
|
|
||||||
set(JAVA_SOURCES "")
|
if(MSYS)
|
||||||
set(JAVA_CLASSES "")
|
# UGLY HACK ALERT: If we don't do this, then UseJava.cmake will separate
|
||||||
set(JAVA_CLASSES_FULL "")
|
# class path members with a semicolon, which is interpreted as a command
|
||||||
foreach(class ${JAVA_CLASSNAMES})
|
# separator by the MSYS shell.
|
||||||
list(APPEND JAVA_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/${class}.java")
|
set(CMAKE_HOST_SYSTEM_NAME_BAK ${CMAKE_HOST_SYSTEM_NAME})
|
||||||
list(APPEND JAVA_CLASSES "${class}.class")
|
set(CMAKE_HOST_SYSTEM_NAME "MSYS")
|
||||||
list(APPEND JAVA_CLASSES_FULL "${OBJDIR}/${class}.class")
|
endif()
|
||||||
endforeach()
|
add_jar(turbojpeg-java ${JAVA_SOURCES} OUTPUT_NAME turbojpeg
|
||||||
|
ENTRY_POINT TJExample)
|
||||||
|
if(MSYS)
|
||||||
|
set(CMAKE_HOST_SYSTEM_NAME ${CMAKE_HOST_SYSTEM_NAME_BAK})
|
||||||
|
endif()
|
||||||
|
|
||||||
list(APPEND JAVA_SOURCES
|
add_custom_target(javadoc COMMAND
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/org/libjpegturbo/turbojpeg/TJLoader.java")
|
javadoc -notimestamp -d ${CMAKE_CURRENT_SOURCE_DIR}/doc -sourcepath ${CMAKE_CURRENT_SOURCE_DIR} org.libjpegturbo.turbojpeg)
|
||||||
list(APPEND JAVA_CLASSES org/libjpegturbo/turbojpeg/TJLoader.class)
|
set(JAVACLASSPATH ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/turbojpeg-java.dir)
|
||||||
list(APPEND JAVA_CLASSES_FULL
|
if(Java_VERSION_MAJOR GREATER 9)
|
||||||
"${OBJDIR}/org/libjpegturbo/turbojpeg/TJLoader.class")
|
add_custom_target(javah
|
||||||
|
COMMAND javac -h ${CMAKE_CURRENT_SOURCE_DIR} -classpath ${JAVACLASSPATH}
|
||||||
|
-d ${CMAKE_CURRENT_BINARY_DIR}/__unused
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/org/libjpegturbo/turbojpeg/TJ.java
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/org/libjpegturbo/turbojpeg/TJCompressor.java
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/org/libjpegturbo/turbojpeg/TJDecompressor.java
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/org/libjpegturbo/turbojpeg/TJTransformer.java)
|
||||||
|
else()
|
||||||
|
add_custom_target(javah
|
||||||
|
COMMAND javah -d ${CMAKE_CURRENT_SOURCE_DIR} -classpath ${JAVACLASSPATH} org.libjpegturbo.turbojpeg.TJ
|
||||||
|
COMMAND javah -d ${CMAKE_CURRENT_SOURCE_DIR} -classpath ${JAVACLASSPATH} org.libjpegturbo.turbojpeg.TJCompressor
|
||||||
|
COMMAND javah -d ${CMAKE_CURRENT_SOURCE_DIR} -classpath ${JAVACLASSPATH} org.libjpegturbo.turbojpeg.TJDecompressor
|
||||||
|
COMMAND javah -d ${CMAKE_CURRENT_SOURCE_DIR} -classpath ${JAVACLASSPATH} org.libjpegturbo.turbojpeg.TJTransformer)
|
||||||
|
endif()
|
||||||
|
|
||||||
string(REGEX REPLACE " " ";" JAVACFLAGS "${JAVACFLAGS}")
|
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_JAVADIR)
|
||||||
add_custom_command(OUTPUT ${JAVA_CLASSES_FULL} DEPENDS ${JAVA_SOURCES}
|
set(CMAKE_INSTALL_DEFAULT_JAVADIR "<CMAKE_INSTALL_DATAROOTDIR>/java")
|
||||||
COMMAND "${JAVA_COMPILE}" ARGS ${JAVACFLAGS} -d "${OBJDIR}" ${JAVA_SOURCES}
|
endif()
|
||||||
VERBATIM)
|
GNUInstallDirs_set_install_dir(JAVADIR
|
||||||
|
"The directory into which Java classes should be installed")
|
||||||
add_custom_command(OUTPUT "${JAR_FILE}" DEPENDS ${JAVA_CLASSES_FULL}
|
GNUInstallDirs_get_absolute_install_dir(CMAKE_INSTALL_FULL_JAVADIR
|
||||||
"${MANIFEST_FILE}"
|
CMAKE_INSTALL_JAVADIR)
|
||||||
COMMAND "${JAVA_ARCHIVE}" cfm "${JAR_FILE}" "${MANIFEST_FILE}" ${JAVA_CLASSES}
|
set(CMAKE_INSTALL_JAVADIR ${CMAKE_INSTALL_JAVADIR} PARENT_SCOPE)
|
||||||
WORKING_DIRECTORY "${OBJDIR}"
|
set(CMAKE_INSTALL_FULL_JAVADIR ${CMAKE_INSTALL_FULL_JAVADIR} PARENT_SCOPE)
|
||||||
VERBATIM)
|
report_directory(JAVADIR)
|
||||||
|
install_jar(turbojpeg-java ${CMAKE_INSTALL_JAVADIR})
|
||||||
add_custom_target(java ALL DEPENDS "${JAR_FILE}")
|
mark_as_advanced(CLEAR CMAKE_INSTALL_JAVADIR)
|
||||||
|
|
||||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${JAR_FILE}" DESTINATION classes)
|
|
||||||
|
|||||||
@@ -1,75 +0,0 @@
|
|||||||
JAVAROOT = .
|
|
||||||
|
|
||||||
org/libjpegturbo/turbojpeg/TJLoader.java: $(srcdir)/org/libjpegturbo/turbojpeg/TJLoader.java.tmpl
|
|
||||||
mkdir -p org/libjpegturbo/turbojpeg; \
|
|
||||||
cat $(srcdir)/org/libjpegturbo/turbojpeg/TJLoader.java.tmpl | \
|
|
||||||
sed s@%{__libdir}@$(libdir)@g > org/libjpegturbo/turbojpeg/TJLoader.java
|
|
||||||
|
|
||||||
|
|
||||||
JAVASOURCES = org/libjpegturbo/turbojpeg/TJ.java \
|
|
||||||
org/libjpegturbo/turbojpeg/TJCompressor.java \
|
|
||||||
org/libjpegturbo/turbojpeg/TJCustomFilter.java \
|
|
||||||
org/libjpegturbo/turbojpeg/TJDecompressor.java \
|
|
||||||
org/libjpegturbo/turbojpeg/TJException.java \
|
|
||||||
org/libjpegturbo/turbojpeg/TJScalingFactor.java \
|
|
||||||
org/libjpegturbo/turbojpeg/TJTransform.java \
|
|
||||||
org/libjpegturbo/turbojpeg/TJTransformer.java \
|
|
||||||
org/libjpegturbo/turbojpeg/YUVImage.java \
|
|
||||||
TJExample.java \
|
|
||||||
TJUnitTest.java \
|
|
||||||
TJBench.java
|
|
||||||
|
|
||||||
JNIHEADERS = org_libjpegturbo_turbojpeg_TJ.h \
|
|
||||||
org_libjpegturbo_turbojpeg_TJCompressor.h \
|
|
||||||
org_libjpegturbo_turbojpeg_TJDecompressor.h \
|
|
||||||
org_libjpegturbo_turbojpeg_TJTransformer.h
|
|
||||||
|
|
||||||
if WITH_JAVA
|
|
||||||
|
|
||||||
nodist_noinst_JAVA = ${JAVASOURCES} org/libjpegturbo/turbojpeg/TJLoader.java
|
|
||||||
|
|
||||||
JAVA_CLASSES = org/libjpegturbo/turbojpeg/TJ.class \
|
|
||||||
org/libjpegturbo/turbojpeg/TJCompressor.class \
|
|
||||||
org/libjpegturbo/turbojpeg/TJCustomFilter.class \
|
|
||||||
org/libjpegturbo/turbojpeg/TJDecompressor.class \
|
|
||||||
org/libjpegturbo/turbojpeg/TJException.class \
|
|
||||||
org/libjpegturbo/turbojpeg/TJLoader.class \
|
|
||||||
org/libjpegturbo/turbojpeg/TJScalingFactor.class \
|
|
||||||
org/libjpegturbo/turbojpeg/TJTransform.class \
|
|
||||||
org/libjpegturbo/turbojpeg/TJTransformer.class \
|
|
||||||
org/libjpegturbo/turbojpeg/YUVImage.class \
|
|
||||||
TJExample.class \
|
|
||||||
TJUnitTest.class \
|
|
||||||
TJBench.class
|
|
||||||
|
|
||||||
all: all-am turbojpeg.jar
|
|
||||||
|
|
||||||
turbojpeg.jar: classnoinst.stamp ${srcdir}/MANIFEST.MF
|
|
||||||
$(JAR) cfm turbojpeg.jar ${srcdir}/MANIFEST.MF $(JAVA_CLASSES)
|
|
||||||
|
|
||||||
clean-local:
|
|
||||||
rm -f turbojpeg.jar
|
|
||||||
|
|
||||||
install-exec-local: turbojpeg.jar
|
|
||||||
mkdir -p $(DESTDIR)/$(datadir)/classes
|
|
||||||
$(INSTALL) -m 644 turbojpeg.jar $(DESTDIR)/$(datadir)/classes/
|
|
||||||
|
|
||||||
uninstall-local:
|
|
||||||
rm -f $(DESTDIR)/$(datadir)/classes/turbojpeg.jar
|
|
||||||
if [ -d $(DESTDIR)/$(datadir)/classes ]; then rmdir $(DESTDIR)/$(datadir)/classes; fi
|
|
||||||
|
|
||||||
headers: all
|
|
||||||
javah -d ${srcdir} org.libjpegturbo.turbojpeg.TJ; \
|
|
||||||
javah -d ${srcdir} org.libjpegturbo.turbojpeg.TJCompressor; \
|
|
||||||
javah -d ${srcdir} org.libjpegturbo.turbojpeg.TJDecompressor; \
|
|
||||||
javah -d ${srcdir} org.libjpegturbo.turbojpeg.TJTransformer
|
|
||||||
|
|
||||||
docs: all
|
|
||||||
mkdir -p ${srcdir}/doc; \
|
|
||||||
javadoc -notimestamp -d ${srcdir}/doc -sourcepath ${srcdir} org.libjpegturbo.turbojpeg
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
EXTRA_DIST = MANIFEST.MF ${JAVASOURCES} ${JNIHEADERS} doc CMakeLists.txt \
|
|
||||||
org/libjpegturbo/turbojpeg/TJLoader.java.tmpl \
|
|
||||||
org/libjpegturbo/turbojpeg/TJLoader.java.in
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C)2009-2014, 2016-2017 D. R. Commander. All Rights Reserved.
|
* Copyright (C)2009-2014, 2016-2019 D. R. Commander. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@@ -32,50 +32,73 @@ import javax.imageio.*;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.libjpegturbo.turbojpeg.*;
|
import org.libjpegturbo.turbojpeg.*;
|
||||||
|
|
||||||
class TJBench {
|
final class TJBench {
|
||||||
|
|
||||||
static int flags = 0, quiet = 0, pf = TJ.PF_BGR, yuvpad = 1;
|
private TJBench() {}
|
||||||
static boolean compOnly, decompOnly, doTile, doYUV, write = true;
|
|
||||||
|
|
||||||
static final String[] pixFormatStr = {
|
private static int flags = 0, quiet = 0, pf = TJ.PF_BGR, yuvPad = 1;
|
||||||
|
private static boolean compOnly, decompOnly, doTile, doYUV, write = true;
|
||||||
|
|
||||||
|
static final String[] PIXFORMATSTR = {
|
||||||
"RGB", "BGR", "RGBX", "BGRX", "XBGR", "XRGB", "GRAY"
|
"RGB", "BGR", "RGBX", "BGRX", "XBGR", "XRGB", "GRAY"
|
||||||
};
|
};
|
||||||
|
|
||||||
static final String[] subNameLong = {
|
static final String[] SUBNAME_LONG = {
|
||||||
"4:4:4", "4:2:2", "4:2:0", "GRAY", "4:4:0", "4:1:1"
|
"4:4:4", "4:2:2", "4:2:0", "GRAY", "4:4:0", "4:1:1"
|
||||||
};
|
};
|
||||||
|
|
||||||
static final String[] subName = {
|
static final String[] SUBNAME = {
|
||||||
"444", "422", "420", "GRAY", "440", "411"
|
"444", "422", "420", "GRAY", "440", "411"
|
||||||
};
|
};
|
||||||
|
|
||||||
static final String[] csName = {
|
static final String[] CSNAME = {
|
||||||
"RGB", "YCbCr", "GRAY", "CMYK", "YCCK"
|
"RGB", "YCbCr", "GRAY", "CMYK", "YCCK"
|
||||||
};
|
};
|
||||||
|
|
||||||
static TJScalingFactor sf;
|
private static TJScalingFactor sf;
|
||||||
static int xformOp = TJTransform.OP_NONE, xformOpt = 0;
|
private static int xformOp = TJTransform.OP_NONE, xformOpt = 0;
|
||||||
static double benchTime = 5.0, warmup = 1.0;
|
private static double benchTime = 5.0, warmup = 1.0;
|
||||||
|
|
||||||
|
|
||||||
static final double getTime() {
|
static double getTime() {
|
||||||
return (double)System.nanoTime() / 1.0e9;
|
return (double)System.nanoTime() / 1.0e9;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static String tjErrorMsg;
|
||||||
|
private static int tjErrorCode = -1;
|
||||||
|
|
||||||
|
static void handleTJException(TJException e) throws TJException {
|
||||||
|
String errorMsg = e.getMessage();
|
||||||
|
int errorCode = e.getErrorCode();
|
||||||
|
|
||||||
|
if ((flags & TJ.FLAG_STOPONWARNING) == 0 &&
|
||||||
|
errorCode == TJ.ERR_WARNING) {
|
||||||
|
if (tjErrorMsg == null || !tjErrorMsg.equals(errorMsg) ||
|
||||||
|
tjErrorCode != errorCode) {
|
||||||
|
tjErrorMsg = errorMsg;
|
||||||
|
tjErrorCode = errorCode;
|
||||||
|
System.out.println("WARNING: " + errorMsg);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static String formatName(int subsamp, int cs) {
|
static String formatName(int subsamp, int cs) {
|
||||||
if (cs == TJ.CS_YCbCr)
|
if (cs == TJ.CS_YCbCr)
|
||||||
return subNameLong[subsamp];
|
return SUBNAME_LONG[subsamp];
|
||||||
else if (cs == TJ.CS_YCCK)
|
else if (cs == TJ.CS_YCCK)
|
||||||
return csName[cs] + " " + subNameLong[subsamp];
|
return CSNAME[cs] + " " + SUBNAME_LONG[subsamp];
|
||||||
else
|
else
|
||||||
return csName[cs];
|
return CSNAME[cs];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static String sigFig(double val, int figs) {
|
static String sigFig(double val, int figs) {
|
||||||
String format;
|
String format;
|
||||||
int digitsAfterDecimal = figs - (int)Math.ceil(Math.log10(Math.abs(val)));
|
int digitsAfterDecimal = figs - (int)Math.ceil(Math.log10(Math.abs(val)));
|
||||||
|
|
||||||
if (digitsAfterDecimal < 1)
|
if (digitsAfterDecimal < 1)
|
||||||
format = new String("%.0f");
|
format = new String("%.0f");
|
||||||
else
|
else
|
||||||
@@ -87,17 +110,22 @@ class TJBench {
|
|||||||
static byte[] loadImage(String fileName, int[] w, int[] h, int pixelFormat)
|
static byte[] loadImage(String fileName, int[] w, int[] h, int pixelFormat)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
BufferedImage img = ImageIO.read(new File(fileName));
|
BufferedImage img = ImageIO.read(new File(fileName));
|
||||||
|
|
||||||
if (img == null)
|
if (img == null)
|
||||||
throw new Exception("Could not read " + fileName);
|
throw new Exception("Could not read " + fileName);
|
||||||
w[0] = img.getWidth();
|
w[0] = img.getWidth();
|
||||||
h[0] = img.getHeight();
|
h[0] = img.getHeight();
|
||||||
|
|
||||||
int[] rgb = img.getRGB(0, 0, w[0], h[0], null, 0, w[0]);
|
int[] rgb = img.getRGB(0, 0, w[0], h[0], null, 0, w[0]);
|
||||||
int ps = TJ.getPixelSize(pixelFormat);
|
int ps = TJ.getPixelSize(pixelFormat);
|
||||||
int rindex = TJ.getRedOffset(pixelFormat);
|
int rindex = TJ.getRedOffset(pixelFormat);
|
||||||
int gindex = TJ.getGreenOffset(pixelFormat);
|
int gindex = TJ.getGreenOffset(pixelFormat);
|
||||||
int bindex = TJ.getBlueOffset(pixelFormat);
|
int bindex = TJ.getBlueOffset(pixelFormat);
|
||||||
|
if ((long)w[0] * (long)h[0] * (long)ps > (long)Integer.MAX_VALUE)
|
||||||
|
throw new Exception("Image is too large");
|
||||||
byte[] dstBuf = new byte[w[0] * h[0] * ps];
|
byte[] dstBuf = new byte[w[0] * h[0] * ps];
|
||||||
int pixels = w[0] * h[0], dstPtr = 0, rgbPtr = 0;
|
int pixels = w[0] * h[0], dstPtr = 0, rgbPtr = 0;
|
||||||
|
|
||||||
while (pixels-- > 0) {
|
while (pixels-- > 0) {
|
||||||
dstBuf[dstPtr + rindex] = (byte)((rgb[rgbPtr] >> 16) & 0xff);
|
dstBuf[dstPtr + rindex] = (byte)((rgb[rgbPtr] >> 16) & 0xff);
|
||||||
dstBuf[dstPtr + gindex] = (byte)((rgb[rgbPtr] >> 8) & 0xff);
|
dstBuf[dstPtr + gindex] = (byte)((rgb[rgbPtr] >> 8) & 0xff);
|
||||||
@@ -117,11 +145,13 @@ class TJBench {
|
|||||||
int rindex = TJ.getRedOffset(pixelFormat);
|
int rindex = TJ.getRedOffset(pixelFormat);
|
||||||
int gindex = TJ.getGreenOffset(pixelFormat);
|
int gindex = TJ.getGreenOffset(pixelFormat);
|
||||||
int bindex = TJ.getBlueOffset(pixelFormat);
|
int bindex = TJ.getBlueOffset(pixelFormat);
|
||||||
|
|
||||||
for (int y = 0; y < h; y++) {
|
for (int y = 0; y < h; y++) {
|
||||||
for (int x = 0; x < w; x++, srcPtr += ps) {
|
for (int x = 0; x < w; x++, srcPtr += ps) {
|
||||||
int pixel = (srcBuf[srcPtr + rindex] & 0xff) << 16 |
|
int pixel = (srcBuf[srcPtr + rindex] & 0xff) << 16 |
|
||||||
(srcBuf[srcPtr + gindex] & 0xff) << 8 |
|
(srcBuf[srcPtr + gindex] & 0xff) << 8 |
|
||||||
(srcBuf[srcPtr + bindex] & 0xff);
|
(srcBuf[srcPtr + bindex] & 0xff);
|
||||||
|
|
||||||
img.setRGB(x, y, pixel);
|
img.setRGB(x, y, pixel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -147,8 +177,11 @@ class TJBench {
|
|||||||
|
|
||||||
tjd = new TJDecompressor();
|
tjd = new TJDecompressor();
|
||||||
|
|
||||||
if (dstBuf == null)
|
if (dstBuf == null) {
|
||||||
|
if ((long)pitch * (long)scaledh > (long)Integer.MAX_VALUE)
|
||||||
|
throw new Exception("Image is too large");
|
||||||
dstBuf = new byte[pitch * scaledh];
|
dstBuf = new byte[pitch * scaledh];
|
||||||
|
}
|
||||||
|
|
||||||
/* Set the destination buffer to gray so we know whether the decompressor
|
/* Set the destination buffer to gray so we know whether the decompressor
|
||||||
attempted to write to it */
|
attempted to write to it */
|
||||||
@@ -157,7 +190,8 @@ class TJBench {
|
|||||||
if (doYUV) {
|
if (doYUV) {
|
||||||
int width = doTile ? tilew : scaledw;
|
int width = doTile ? tilew : scaledw;
|
||||||
int height = doTile ? tileh : scaledh;
|
int height = doTile ? tileh : scaledh;
|
||||||
yuvImage = new YUVImage(width, yuvpad, height, subsamp);
|
|
||||||
|
yuvImage = new YUVImage(width, yuvPad, height, subsamp);
|
||||||
Arrays.fill(yuvImage.getBuf(), (byte)127);
|
Arrays.fill(yuvImage.getBuf(), (byte)127);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,21 +201,32 @@ class TJBench {
|
|||||||
while (true) {
|
while (true) {
|
||||||
int tile = 0;
|
int tile = 0;
|
||||||
double start = getTime();
|
double start = getTime();
|
||||||
|
|
||||||
for (int y = 0; y < h; y += tileh) {
|
for (int y = 0; y < h; y += tileh) {
|
||||||
for (int x = 0; x < w; x += tilew, tile++) {
|
for (int x = 0; x < w; x += tilew, tile++) {
|
||||||
int width = doTile ? Math.min(tilew, w - x) : scaledw;
|
int width = doTile ? Math.min(tilew, w - x) : scaledw;
|
||||||
int height = doTile ? Math.min(tileh, h - y) : scaledh;
|
int height = doTile ? Math.min(tileh, h - y) : scaledh;
|
||||||
|
|
||||||
|
try {
|
||||||
tjd.setSourceImage(jpegBuf[tile], jpegSize[tile]);
|
tjd.setSourceImage(jpegBuf[tile], jpegSize[tile]);
|
||||||
|
} catch (TJException e) { handleTJException(e); }
|
||||||
if (doYUV) {
|
if (doYUV) {
|
||||||
yuvImage.setBuf(yuvImage.getBuf(), width, yuvpad, height, subsamp);
|
yuvImage.setBuf(yuvImage.getBuf(), width, yuvPad, height, subsamp);
|
||||||
|
try {
|
||||||
tjd.decompressToYUV(yuvImage, flags);
|
tjd.decompressToYUV(yuvImage, flags);
|
||||||
|
} catch (TJException e) { handleTJException(e); }
|
||||||
double startDecode = getTime();
|
double startDecode = getTime();
|
||||||
tjd.setSourceImage(yuvImage);
|
tjd.setSourceImage(yuvImage);
|
||||||
|
try {
|
||||||
tjd.decompress(dstBuf, x, y, width, pitch, height, pf, flags);
|
tjd.decompress(dstBuf, x, y, width, pitch, height, pf, flags);
|
||||||
|
} catch (TJException e) { handleTJException(e); }
|
||||||
if (iter >= 0)
|
if (iter >= 0)
|
||||||
elapsedDecode += getTime() - startDecode;
|
elapsedDecode += getTime() - startDecode;
|
||||||
} else
|
} else {
|
||||||
|
try {
|
||||||
tjd.decompress(dstBuf, x, y, width, pitch, height, pf, flags);
|
tjd.decompress(dstBuf, x, y, width, pitch, height, pf, flags);
|
||||||
|
} catch (TJException e) { handleTJException(e); }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elapsed += getTime() - start;
|
elapsed += getTime() - start;
|
||||||
@@ -194,7 +239,7 @@ class TJBench {
|
|||||||
elapsed = elapsedDecode = 0.0;
|
elapsed = elapsedDecode = 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(doYUV)
|
if (doYUV)
|
||||||
elapsed -= elapsedDecode;
|
elapsed -= elapsedDecode;
|
||||||
|
|
||||||
tjd = null;
|
tjd = null;
|
||||||
@@ -205,16 +250,18 @@ class TJBench {
|
|||||||
|
|
||||||
if (quiet != 0) {
|
if (quiet != 0) {
|
||||||
System.out.format("%-6s%s",
|
System.out.format("%-6s%s",
|
||||||
sigFig((double)(w * h) / 1000000. * (double)iter / elapsed, 4),
|
sigFig((double)(w * h) / 1000000. *
|
||||||
|
(double)iter / elapsed, 4),
|
||||||
quiet == 2 ? "\n" : " ");
|
quiet == 2 ? "\n" : " ");
|
||||||
if (doYUV)
|
if (doYUV)
|
||||||
System.out.format("%s\n",
|
System.out.format("%s\n",
|
||||||
sigFig((double)(w * h) / 1000000. * (double)iter / elapsedDecode, 4));
|
sigFig((double)(w * h) / 1000000. *
|
||||||
|
(double)iter / elapsedDecode, 4));
|
||||||
else if (quiet != 2)
|
else if (quiet != 2)
|
||||||
System.out.print("\n");
|
System.out.print("\n");
|
||||||
} else {
|
} else {
|
||||||
System.out.format("%s --> Frame rate: %f fps\n",
|
System.out.format("%s --> Frame rate: %f fps\n",
|
||||||
(doYUV ? "Decomp to YUV":"Decompress "),
|
(doYUV ? "Decomp to YUV" : "Decompress "),
|
||||||
(double)iter / elapsed);
|
(double)iter / elapsed);
|
||||||
System.out.format(" Throughput: %f Megapixels/sec\n",
|
System.out.format(" Throughput: %f Megapixels/sec\n",
|
||||||
(double)(w * h) / 1000000. * (double)iter / elapsed);
|
(double)(w * h) / 1000000. * (double)iter / elapsed);
|
||||||
@@ -222,7 +269,8 @@ class TJBench {
|
|||||||
System.out.format("YUV Decode --> Frame rate: %f fps\n",
|
System.out.format("YUV Decode --> Frame rate: %f fps\n",
|
||||||
(double)iter / elapsedDecode);
|
(double)iter / elapsedDecode);
|
||||||
System.out.format(" Throughput: %f Megapixels/sec\n",
|
System.out.format(" Throughput: %f Megapixels/sec\n",
|
||||||
(double)(w * h) / 1000000. * (double)iter / elapsedDecode);
|
(double)(w * h) / 1000000. *
|
||||||
|
(double)iter / elapsedDecode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,7 +285,7 @@ class TJBench {
|
|||||||
if (decompOnly)
|
if (decompOnly)
|
||||||
tempStr = new String(fileName + "_" + sizeStr + ".bmp");
|
tempStr = new String(fileName + "_" + sizeStr + ".bmp");
|
||||||
else
|
else
|
||||||
tempStr = new String(fileName + "_" + subName[subsamp] + qualStr +
|
tempStr = new String(fileName + "_" + SUBNAME[subsamp] + qualStr +
|
||||||
"_" + sizeStr + ".bmp");
|
"_" + sizeStr + ".bmp");
|
||||||
|
|
||||||
saveImage(tempStr, dstBuf, scaledw, scaledh, pf);
|
saveImage(tempStr, dstBuf, scaledw, scaledh, pf);
|
||||||
@@ -255,6 +303,7 @@ class TJBench {
|
|||||||
int lum = (int)((double)(srcBuf[rindex] & 0xff) * 0.299 +
|
int lum = (int)((double)(srcBuf[rindex] & 0xff) * 0.299 +
|
||||||
(double)(srcBuf[gindex] & 0xff) * 0.587 +
|
(double)(srcBuf[gindex] & 0xff) * 0.587 +
|
||||||
(double)(srcBuf[bindex] & 0xff) * 0.114 + 0.5);
|
(double)(srcBuf[bindex] & 0xff) * 0.114 + 0.5);
|
||||||
|
|
||||||
if (lum > 255) lum = 255;
|
if (lum > 255) lum = 255;
|
||||||
if (lum < 0) lum = 0;
|
if (lum < 0) lum = 0;
|
||||||
dstBuf[rindex] = (byte)Math.abs((dstBuf[rindex] & 0xff) - lum);
|
dstBuf[rindex] = (byte)Math.abs((dstBuf[rindex] & 0xff) - lum);
|
||||||
@@ -284,15 +333,18 @@ class TJBench {
|
|||||||
int totalJpegSize = 0, tilew, tileh, i, iter;
|
int totalJpegSize = 0, tilew, tileh, i, iter;
|
||||||
int ps = TJ.getPixelSize(pf);
|
int ps = TJ.getPixelSize(pf);
|
||||||
int ntilesw = 1, ntilesh = 1, pitch = w * ps;
|
int ntilesw = 1, ntilesh = 1, pitch = w * ps;
|
||||||
String pfStr = pixFormatStr[pf];
|
String pfStr = PIXFORMATSTR[pf];
|
||||||
YUVImage yuvImage = null;
|
YUVImage yuvImage = null;
|
||||||
|
|
||||||
|
if ((long)pitch * (long)h > (long)Integer.MAX_VALUE)
|
||||||
|
throw new Exception("Image is too large");
|
||||||
tmpBuf = new byte[pitch * h];
|
tmpBuf = new byte[pitch * h];
|
||||||
|
|
||||||
if (quiet == 0)
|
if (quiet == 0)
|
||||||
System.out.format(">>>>> %s (%s) <--> JPEG %s Q%d <<<<<\n", pfStr,
|
System.out.format(">>>>> %s (%s) <--> JPEG %s Q%d <<<<<\n", pfStr,
|
||||||
(flags & TJ.FLAG_BOTTOMUP) != 0 ? "Bottom-up" : "Top-down",
|
(flags & TJ.FLAG_BOTTOMUP) != 0 ?
|
||||||
subNameLong[subsamp], jpegQual);
|
"Bottom-up" : "Top-down",
|
||||||
|
SUBNAME_LONG[subsamp], jpegQual);
|
||||||
|
|
||||||
tjc = new TJCompressor();
|
tjc = new TJCompressor();
|
||||||
|
|
||||||
@@ -312,14 +364,14 @@ class TJBench {
|
|||||||
if (quiet == 1)
|
if (quiet == 1)
|
||||||
System.out.format("%-4s (%s) %-5s %-3d ", pfStr,
|
System.out.format("%-4s (%s) %-5s %-3d ", pfStr,
|
||||||
(flags & TJ.FLAG_BOTTOMUP) != 0 ? "BU" : "TD",
|
(flags & TJ.FLAG_BOTTOMUP) != 0 ? "BU" : "TD",
|
||||||
subNameLong[subsamp], jpegQual);
|
SUBNAME_LONG[subsamp], jpegQual);
|
||||||
for (i = 0; i < h; i++)
|
for (i = 0; i < h; i++)
|
||||||
System.arraycopy(srcBuf, w * ps * i, tmpBuf, pitch * i, w * ps);
|
System.arraycopy(srcBuf, w * ps * i, tmpBuf, pitch * i, w * ps);
|
||||||
tjc.setJPEGQuality(jpegQual);
|
tjc.setJPEGQuality(jpegQual);
|
||||||
tjc.setSubsamp(subsamp);
|
tjc.setSubsamp(subsamp);
|
||||||
|
|
||||||
if (doYUV) {
|
if (doYUV) {
|
||||||
yuvImage = new YUVImage(tilew, yuvpad, tileh, subsamp);
|
yuvImage = new YUVImage(tilew, yuvPad, tileh, subsamp);
|
||||||
Arrays.fill(yuvImage.getBuf(), (byte)127);
|
Arrays.fill(yuvImage.getBuf(), (byte)127);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -328,16 +380,19 @@ class TJBench {
|
|||||||
elapsed = elapsedEncode = 0.0;
|
elapsed = elapsedEncode = 0.0;
|
||||||
while (true) {
|
while (true) {
|
||||||
int tile = 0;
|
int tile = 0;
|
||||||
|
|
||||||
totalJpegSize = 0;
|
totalJpegSize = 0;
|
||||||
start = getTime();
|
start = getTime();
|
||||||
for (int y = 0; y < h; y += tileh) {
|
for (int y = 0; y < h; y += tileh) {
|
||||||
for (int x = 0; x < w; x += tilew, tile++) {
|
for (int x = 0; x < w; x += tilew, tile++) {
|
||||||
int width = Math.min(tilew, w - x);
|
int width = Math.min(tilew, w - x);
|
||||||
int height = Math.min(tileh, h - y);
|
int height = Math.min(tileh, h - y);
|
||||||
|
|
||||||
tjc.setSourceImage(srcBuf, x, y, width, pitch, height, pf);
|
tjc.setSourceImage(srcBuf, x, y, width, pitch, height, pf);
|
||||||
if (doYUV) {
|
if (doYUV) {
|
||||||
double startEncode = getTime();
|
double startEncode = getTime();
|
||||||
yuvImage.setBuf(yuvImage.getBuf(), width, yuvpad, height,
|
|
||||||
|
yuvImage.setBuf(yuvImage.getBuf(), width, yuvPad, height,
|
||||||
subsamp);
|
subsamp);
|
||||||
tjc.encodeYUV(yuvImage, flags);
|
tjc.encodeYUV(yuvImage, flags);
|
||||||
if (iter >= 0)
|
if (iter >= 0)
|
||||||
@@ -367,13 +422,16 @@ class TJBench {
|
|||||||
if (quiet != 0) {
|
if (quiet != 0) {
|
||||||
if (doYUV)
|
if (doYUV)
|
||||||
System.out.format("%-6s%s",
|
System.out.format("%-6s%s",
|
||||||
sigFig((double)(w * h) / 1000000. * (double)iter / elapsedEncode, 4),
|
sigFig((double)(w * h) / 1000000. *
|
||||||
|
(double)iter / elapsedEncode, 4),
|
||||||
quiet == 2 ? "\n" : " ");
|
quiet == 2 ? "\n" : " ");
|
||||||
System.out.format("%-6s%s",
|
System.out.format("%-6s%s",
|
||||||
sigFig((double)(w * h) / 1000000. * (double)iter / elapsed, 4),
|
sigFig((double)(w * h) / 1000000. *
|
||||||
|
(double)iter / elapsed, 4),
|
||||||
quiet == 2 ? "\n" : " ");
|
quiet == 2 ? "\n" : " ");
|
||||||
System.out.format("%-6s%s",
|
System.out.format("%-6s%s",
|
||||||
sigFig((double)(w * h * ps) / (double)totalJpegSize, 4),
|
sigFig((double)(w * h * ps) / (double)totalJpegSize,
|
||||||
|
4),
|
||||||
quiet == 2 ? "\n" : " ");
|
quiet == 2 ? "\n" : " ");
|
||||||
} else {
|
} else {
|
||||||
System.out.format("\n%s size: %d x %d\n", doTile ? "Tile" : "Image",
|
System.out.format("\n%s size: %d x %d\n", doTile ? "Tile" : "Image",
|
||||||
@@ -386,9 +444,11 @@ class TJBench {
|
|||||||
System.out.format(" Compression ratio: %f:1\n",
|
System.out.format(" Compression ratio: %f:1\n",
|
||||||
(double)(w * h * ps) / (double)yuvImage.getSize());
|
(double)(w * h * ps) / (double)yuvImage.getSize());
|
||||||
System.out.format(" Throughput: %f Megapixels/sec\n",
|
System.out.format(" Throughput: %f Megapixels/sec\n",
|
||||||
(double)(w * h) / 1000000. * (double)iter / elapsedEncode);
|
(double)(w * h) / 1000000. *
|
||||||
|
(double)iter / elapsedEncode);
|
||||||
System.out.format(" Output bit stream: %f Megabits/sec\n",
|
System.out.format(" Output bit stream: %f Megabits/sec\n",
|
||||||
(double)yuvImage.getSize() * 8. / 1000000. * (double)iter / elapsedEncode);
|
(double)yuvImage.getSize() * 8. / 1000000. *
|
||||||
|
(double)iter / elapsedEncode);
|
||||||
}
|
}
|
||||||
System.out.format("%s --> Frame rate: %f fps\n",
|
System.out.format("%s --> Frame rate: %f fps\n",
|
||||||
doYUV ? "Comp from YUV" : "Compress ",
|
doYUV ? "Comp from YUV" : "Compress ",
|
||||||
@@ -400,12 +460,14 @@ class TJBench {
|
|||||||
System.out.format(" Throughput: %f Megapixels/sec\n",
|
System.out.format(" Throughput: %f Megapixels/sec\n",
|
||||||
(double)(w * h) / 1000000. * (double)iter / elapsed);
|
(double)(w * h) / 1000000. * (double)iter / elapsed);
|
||||||
System.out.format(" Output bit stream: %f Megabits/sec\n",
|
System.out.format(" Output bit stream: %f Megabits/sec\n",
|
||||||
(double)totalJpegSize * 8. / 1000000. * (double)iter / elapsed);
|
(double)totalJpegSize * 8. / 1000000. *
|
||||||
|
(double)iter / elapsed);
|
||||||
}
|
}
|
||||||
if (tilew == w && tileh == h && write) {
|
if (tilew == w && tileh == h && write) {
|
||||||
String tempStr = fileName + "_" + subName[subsamp] + "_" + "Q" +
|
String tempStr = fileName + "_" + SUBNAME[subsamp] + "_" + "Q" +
|
||||||
jpegQual + ".jpg";
|
jpegQual + ".jpg";
|
||||||
FileOutputStream fos = new FileOutputStream(tempStr);
|
FileOutputStream fos = new FileOutputStream(tempStr);
|
||||||
|
|
||||||
fos.write(jpegBuf[0], 0, jpegSize[0]);
|
fos.write(jpegBuf[0], 0, jpegSize[0]);
|
||||||
fos.close();
|
fos.close();
|
||||||
if (quiet == 0)
|
if (quiet == 0)
|
||||||
@@ -416,6 +478,8 @@ class TJBench {
|
|||||||
if (!compOnly)
|
if (!compOnly)
|
||||||
decomp(srcBuf, jpegBuf, jpegSize, tmpBuf, w, h, subsamp, jpegQual,
|
decomp(srcBuf, jpegBuf, jpegSize, tmpBuf, w, h, subsamp, jpegQual,
|
||||||
fileName, tilew, tileh);
|
fileName, tilew, tileh);
|
||||||
|
else if (quiet == 1)
|
||||||
|
System.out.println("N/A");
|
||||||
|
|
||||||
if (tilew == w && tileh == h) break;
|
if (tilew == w && tileh == h) break;
|
||||||
}
|
}
|
||||||
@@ -428,13 +492,16 @@ class TJBench {
|
|||||||
byte[] srcBuf;
|
byte[] srcBuf;
|
||||||
int[] jpegSize = null;
|
int[] jpegSize = null;
|
||||||
int totalJpegSize;
|
int totalJpegSize;
|
||||||
int w = 0, h = 0, subsamp = -1, cs = -1, _w, _h, _tilew, _tileh,
|
|
||||||
_ntilesw, _ntilesh, _subsamp, x, y, iter;
|
|
||||||
int ntilesw = 1, ntilesh = 1;
|
|
||||||
double start, elapsed;
|
double start, elapsed;
|
||||||
int ps = TJ.getPixelSize(pf), tile;
|
int ps = TJ.getPixelSize(pf), tile, x, y, iter;
|
||||||
|
// Original image
|
||||||
|
int w = 0, h = 0, ntilesw = 1, ntilesh = 1, subsamp = -1, cs = -1;
|
||||||
|
// Transformed image
|
||||||
|
int tw, th, ttilew, ttileh, tntilesw, tntilesh, tsubsamp;
|
||||||
|
|
||||||
FileInputStream fis = new FileInputStream(fileName);
|
FileInputStream fis = new FileInputStream(fileName);
|
||||||
|
if (fis.getChannel().size() > (long)Integer.MAX_VALUE)
|
||||||
|
throw new Exception("Image is too large");
|
||||||
int srcSize = (int)fis.getChannel().size();
|
int srcSize = (int)fis.getChannel().size();
|
||||||
srcBuf = new byte[srcSize];
|
srcBuf = new byte[srcSize];
|
||||||
fis.read(srcBuf, 0, srcSize);
|
fis.read(srcBuf, 0, srcSize);
|
||||||
@@ -446,7 +513,9 @@ class TJBench {
|
|||||||
|
|
||||||
tjt = new TJTransformer();
|
tjt = new TJTransformer();
|
||||||
|
|
||||||
|
try {
|
||||||
tjt.setSourceImage(srcBuf, srcSize);
|
tjt.setSourceImage(srcBuf, srcSize);
|
||||||
|
} catch (TJException e) { handleTJException(e); }
|
||||||
w = tjt.getWidth();
|
w = tjt.getWidth();
|
||||||
h = tjt.getHeight();
|
h = tjt.getHeight();
|
||||||
subsamp = tjt.getSubsamp();
|
subsamp = tjt.getSubsamp();
|
||||||
@@ -466,8 +535,9 @@ class TJBench {
|
|||||||
System.out.println("\n");
|
System.out.println("\n");
|
||||||
} else if (quiet == 0)
|
} else if (quiet == 0)
|
||||||
System.out.format(">>>>> JPEG %s --> %s (%s) <<<<<\n",
|
System.out.format(">>>>> JPEG %s --> %s (%s) <<<<<\n",
|
||||||
formatName(subsamp, cs), pixFormatStr[pf],
|
formatName(subsamp, cs), PIXFORMATSTR[pf],
|
||||||
(flags & TJ.FLAG_BOTTOMUP) != 0 ? "Bottom-up" : "Top-down");
|
(flags & TJ.FLAG_BOTTOMUP) != 0 ?
|
||||||
|
"Bottom-up" : "Top-down");
|
||||||
|
|
||||||
for (int tilew = doTile ? 16 : w, tileh = doTile ? 16 : h; ;
|
for (int tilew = doTile ? 16 : w, tileh = doTile ? 16 : h; ;
|
||||||
tilew *= 2, tileh *= 2) {
|
tilew *= 2, tileh *= 2) {
|
||||||
@@ -478,65 +548,66 @@ class TJBench {
|
|||||||
ntilesw = (w + tilew - 1) / tilew;
|
ntilesw = (w + tilew - 1) / tilew;
|
||||||
ntilesh = (h + tileh - 1) / tileh;
|
ntilesh = (h + tileh - 1) / tileh;
|
||||||
|
|
||||||
_w = w; _h = h; _tilew = tilew; _tileh = tileh;
|
tw = w; th = h; ttilew = tilew; ttileh = tileh;
|
||||||
if (quiet == 0) {
|
if (quiet == 0) {
|
||||||
System.out.format("\n%s size: %d x %d", (doTile ? "Tile" : "Image"),
|
System.out.format("\n%s size: %d x %d", (doTile ? "Tile" : "Image"),
|
||||||
_tilew, _tileh);
|
ttilew, ttileh);
|
||||||
if (sf.getNum() != 1 || sf.getDenom() != 1)
|
if (sf.getNum() != 1 || sf.getDenom() != 1)
|
||||||
System.out.format(" --> %d x %d", sf.getScaled(_w),
|
System.out.format(" --> %d x %d", sf.getScaled(tw),
|
||||||
sf.getScaled(_h));
|
sf.getScaled(th));
|
||||||
System.out.println("");
|
System.out.println("");
|
||||||
} else if (quiet == 1) {
|
} else if (quiet == 1) {
|
||||||
System.out.format("%-4s (%s) %-5s %-5s ", pixFormatStr[pf],
|
System.out.format("%-4s (%s) %-5s %-5s ", PIXFORMATSTR[pf],
|
||||||
(flags & TJ.FLAG_BOTTOMUP) != 0 ? "BU" : "TD",
|
(flags & TJ.FLAG_BOTTOMUP) != 0 ? "BU" : "TD",
|
||||||
csName[cs], subNameLong[subsamp]);
|
CSNAME[cs], SUBNAME_LONG[subsamp]);
|
||||||
System.out.format("%-5d %-5d ", tilew, tileh);
|
System.out.format("%-5d %-5d ", tilew, tileh);
|
||||||
}
|
}
|
||||||
|
|
||||||
_subsamp = subsamp;
|
tsubsamp = subsamp;
|
||||||
if (doTile || xformOp != TJTransform.OP_NONE || xformOpt != 0) {
|
if (doTile || xformOp != TJTransform.OP_NONE || xformOpt != 0) {
|
||||||
if (xformOp == TJTransform.OP_TRANSPOSE ||
|
if (xformOp == TJTransform.OP_TRANSPOSE ||
|
||||||
xformOp == TJTransform.OP_TRANSVERSE ||
|
xformOp == TJTransform.OP_TRANSVERSE ||
|
||||||
xformOp == TJTransform.OP_ROT90 ||
|
xformOp == TJTransform.OP_ROT90 ||
|
||||||
xformOp == TJTransform.OP_ROT270) {
|
xformOp == TJTransform.OP_ROT270) {
|
||||||
_w = h; _h = w; _tilew = tileh; _tileh = tilew;
|
tw = h; th = w; ttilew = tileh; ttileh = tilew;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((xformOpt & TJTransform.OPT_GRAY) != 0)
|
if ((xformOpt & TJTransform.OPT_GRAY) != 0)
|
||||||
_subsamp = TJ.SAMP_GRAY;
|
tsubsamp = TJ.SAMP_GRAY;
|
||||||
if (xformOp == TJTransform.OP_HFLIP ||
|
if (xformOp == TJTransform.OP_HFLIP ||
|
||||||
xformOp == TJTransform.OP_ROT180)
|
xformOp == TJTransform.OP_ROT180)
|
||||||
_w = _w - (_w % TJ.getMCUWidth(_subsamp));
|
tw = tw - (tw % TJ.getMCUWidth(tsubsamp));
|
||||||
if (xformOp == TJTransform.OP_VFLIP ||
|
if (xformOp == TJTransform.OP_VFLIP ||
|
||||||
xformOp == TJTransform.OP_ROT180)
|
xformOp == TJTransform.OP_ROT180)
|
||||||
_h = _h - (_h % TJ.getMCUHeight(_subsamp));
|
th = th - (th % TJ.getMCUHeight(tsubsamp));
|
||||||
if (xformOp == TJTransform.OP_TRANSVERSE ||
|
if (xformOp == TJTransform.OP_TRANSVERSE ||
|
||||||
xformOp == TJTransform.OP_ROT90)
|
xformOp == TJTransform.OP_ROT90)
|
||||||
_w = _w - (_w % TJ.getMCUHeight(_subsamp));
|
tw = tw - (tw % TJ.getMCUHeight(tsubsamp));
|
||||||
if (xformOp == TJTransform.OP_TRANSVERSE ||
|
if (xformOp == TJTransform.OP_TRANSVERSE ||
|
||||||
xformOp == TJTransform.OP_ROT270)
|
xformOp == TJTransform.OP_ROT270)
|
||||||
_h = _h - (_h % TJ.getMCUWidth(_subsamp));
|
th = th - (th % TJ.getMCUWidth(tsubsamp));
|
||||||
_ntilesw = (_w + _tilew - 1) / _tilew;
|
tntilesw = (tw + ttilew - 1) / ttilew;
|
||||||
_ntilesh = (_h + _tileh - 1) / _tileh;
|
tntilesh = (th + ttileh - 1) / ttileh;
|
||||||
|
|
||||||
if (xformOp == TJTransform.OP_TRANSPOSE ||
|
if (xformOp == TJTransform.OP_TRANSPOSE ||
|
||||||
xformOp == TJTransform.OP_TRANSVERSE ||
|
xformOp == TJTransform.OP_TRANSVERSE ||
|
||||||
xformOp == TJTransform.OP_ROT90 ||
|
xformOp == TJTransform.OP_ROT90 ||
|
||||||
xformOp == TJTransform.OP_ROT270) {
|
xformOp == TJTransform.OP_ROT270) {
|
||||||
if (_subsamp == TJ.SAMP_422)
|
if (tsubsamp == TJ.SAMP_422)
|
||||||
_subsamp = TJ.SAMP_440;
|
tsubsamp = TJ.SAMP_440;
|
||||||
else if (_subsamp == TJ.SAMP_440)
|
else if (tsubsamp == TJ.SAMP_440)
|
||||||
_subsamp = TJ.SAMP_422;
|
tsubsamp = TJ.SAMP_422;
|
||||||
}
|
}
|
||||||
|
|
||||||
TJTransform[] t = new TJTransform[_ntilesw * _ntilesh];
|
TJTransform[] t = new TJTransform[tntilesw * tntilesh];
|
||||||
jpegBuf = new byte[_ntilesw * _ntilesh][TJ.bufSize(_tilew, _tileh, subsamp)];
|
jpegBuf =
|
||||||
|
new byte[tntilesw * tntilesh][TJ.bufSize(ttilew, ttileh, subsamp)];
|
||||||
|
|
||||||
for (y = 0, tile = 0; y < _h; y += _tileh) {
|
for (y = 0, tile = 0; y < th; y += ttileh) {
|
||||||
for (x = 0; x < _w; x += _tilew, tile++) {
|
for (x = 0; x < tw; x += ttilew, tile++) {
|
||||||
t[tile] = new TJTransform();
|
t[tile] = new TJTransform();
|
||||||
t[tile].width = Math.min(_tilew, _w - x);
|
t[tile].width = Math.min(ttilew, tw - x);
|
||||||
t[tile].height = Math.min(_tileh, _h - y);
|
t[tile].height = Math.min(ttileh, th - y);
|
||||||
t[tile].x = x;
|
t[tile].x = x;
|
||||||
t[tile].y = y;
|
t[tile].y = y;
|
||||||
t[tile].op = xformOp;
|
t[tile].op = xformOp;
|
||||||
@@ -551,7 +622,9 @@ class TJBench {
|
|||||||
elapsed = 0.;
|
elapsed = 0.;
|
||||||
while (true) {
|
while (true) {
|
||||||
start = getTime();
|
start = getTime();
|
||||||
|
try {
|
||||||
tjt.transform(jpegBuf, t, flags);
|
tjt.transform(jpegBuf, t, flags);
|
||||||
|
} catch (TJException e) { handleTJException(e); }
|
||||||
jpegSize = tjt.getTransformedSizes();
|
jpegSize = tjt.getTransformedSizes();
|
||||||
elapsed += getTime() - start;
|
elapsed += getTime() - start;
|
||||||
if (iter >= 0) {
|
if (iter >= 0) {
|
||||||
@@ -565,14 +638,15 @@ class TJBench {
|
|||||||
}
|
}
|
||||||
t = null;
|
t = null;
|
||||||
|
|
||||||
for (tile = 0, totalJpegSize = 0; tile < _ntilesw * _ntilesh; tile++)
|
for (tile = 0, totalJpegSize = 0; tile < tntilesw * tntilesh; tile++)
|
||||||
totalJpegSize += jpegSize[tile];
|
totalJpegSize += jpegSize[tile];
|
||||||
|
|
||||||
if (quiet != 0) {
|
if (quiet != 0) {
|
||||||
System.out.format("%-6s%s%-6s%s",
|
System.out.format("%-6s%s%-6s%s",
|
||||||
sigFig((double)(w * h) / 1000000. / elapsed, 4),
|
sigFig((double)(w * h) / 1000000. / elapsed, 4),
|
||||||
quiet == 2 ? "\n" : " ",
|
quiet == 2 ? "\n" : " ",
|
||||||
sigFig((double)(w * h * ps) / (double)totalJpegSize, 4),
|
sigFig((double)(w * h * ps) /
|
||||||
|
(double)totalJpegSize, 4),
|
||||||
quiet == 2 ? "\n" : " ");
|
quiet == 2 ? "\n" : " ");
|
||||||
} else if (quiet == 0) {
|
} else if (quiet == 0) {
|
||||||
System.out.format("Transform --> Frame rate: %f fps\n",
|
System.out.format("Transform --> Frame rate: %f fps\n",
|
||||||
@@ -589,19 +663,19 @@ class TJBench {
|
|||||||
} else {
|
} else {
|
||||||
if (quiet == 1)
|
if (quiet == 1)
|
||||||
System.out.print("N/A N/A ");
|
System.out.print("N/A N/A ");
|
||||||
jpegBuf = new byte[1][TJ.bufSize(_tilew, _tileh, subsamp)];
|
jpegBuf = new byte[1][TJ.bufSize(ttilew, ttileh, subsamp)];
|
||||||
jpegSize = new int[1];
|
jpegSize = new int[1];
|
||||||
jpegBuf[0] = srcBuf;
|
jpegBuf[0] = srcBuf;
|
||||||
jpegSize[0] = srcSize;
|
jpegSize[0] = srcSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (w == tilew)
|
if (w == tilew)
|
||||||
_tilew = _w;
|
ttilew = tw;
|
||||||
if (h == tileh)
|
if (h == tileh)
|
||||||
_tileh = _h;
|
ttileh = th;
|
||||||
if ((xformOpt & TJTransform.OPT_NOOUTPUT) == 0)
|
if ((xformOpt & TJTransform.OPT_NOOUTPUT) == 0)
|
||||||
decomp(null, jpegBuf, jpegSize, null, _w, _h, _subsamp, 0,
|
decomp(null, jpegBuf, jpegSize, null, tw, th, tsubsamp, 0,
|
||||||
fileName, _tilew, _tileh);
|
fileName, ttilew, ttileh);
|
||||||
else if (quiet == 1)
|
else if (quiet == 1)
|
||||||
System.out.println("N/A");
|
System.out.println("N/A");
|
||||||
|
|
||||||
@@ -636,6 +710,8 @@ class TJBench {
|
|||||||
System.out.println(" codec");
|
System.out.println(" codec");
|
||||||
System.out.println("-accuratedct = Use the most accurate DCT/IDCT algorithms available in the");
|
System.out.println("-accuratedct = Use the most accurate DCT/IDCT algorithms available in the");
|
||||||
System.out.println(" underlying codec");
|
System.out.println(" underlying codec");
|
||||||
|
System.out.println("-progressive = Use progressive entropy coding in JPEG images generated by");
|
||||||
|
System.out.println(" compression and transform operations.");
|
||||||
System.out.println("-subsamp <s> = When testing JPEG compression, this option specifies the level");
|
System.out.println("-subsamp <s> = When testing JPEG compression, this option specifies the level");
|
||||||
System.out.println(" of chrominance subsampling to use (<s> = 444, 422, 440, 420, 411, or");
|
System.out.println(" of chrominance subsampling to use (<s> = 444, 422, 440, 420, 411, or");
|
||||||
System.out.println(" GRAY). The default is to test Grayscale, 4:2:0, 4:2:2, and 4:4:4 in");
|
System.out.println(" GRAY). The default is to test Grayscale, 4:2:0, 4:2:2, and 4:4:4 in");
|
||||||
@@ -646,7 +722,7 @@ class TJBench {
|
|||||||
System.out.println(" bytes to which each row of each plane in the intermediate YUV image is");
|
System.out.println(" bytes to which each row of each plane in the intermediate YUV image is");
|
||||||
System.out.println(" padded (default = 1)");
|
System.out.println(" padded (default = 1)");
|
||||||
System.out.println("-scale M/N = Scale down the width/height of the decompressed JPEG image by a");
|
System.out.println("-scale M/N = Scale down the width/height of the decompressed JPEG image by a");
|
||||||
System.out.print (" factor of M/N (M/N = ");
|
System.out.print(" factor of M/N (M/N = ");
|
||||||
for (i = 0; i < nsf; i++) {
|
for (i = 0; i < nsf; i++) {
|
||||||
System.out.format("%d/%d", scalingFactors[i].getNum(),
|
System.out.format("%d/%d", scalingFactors[i].getNum(),
|
||||||
scalingFactors[i].getDenom());
|
scalingFactors[i].getDenom());
|
||||||
@@ -667,13 +743,18 @@ class TJBench {
|
|||||||
System.out.println(" decompression (these options are mutually exclusive)");
|
System.out.println(" decompression (these options are mutually exclusive)");
|
||||||
System.out.println("-grayscale = Perform lossless grayscale conversion prior to decompression");
|
System.out.println("-grayscale = Perform lossless grayscale conversion prior to decompression");
|
||||||
System.out.println(" test (can be combined with the other transforms above)");
|
System.out.println(" test (can be combined with the other transforms above)");
|
||||||
|
System.out.println("-copynone = Do not copy any extra markers (including EXIF and ICC profile data)");
|
||||||
|
System.out.println(" when transforming the image.");
|
||||||
System.out.println("-benchtime <t> = Run each benchmark for at least <t> seconds (default = 5.0)");
|
System.out.println("-benchtime <t> = Run each benchmark for at least <t> seconds (default = 5.0)");
|
||||||
System.out.println("-warmup <t> = Run each benchmark for <t> seconds (default = 1.0) prior to");
|
System.out.println("-warmup <t> = Run each benchmark for <t> seconds (default = 1.0) prior to");
|
||||||
System.out.println(" starting the timer, in order to prime the caches and thus improve the");
|
System.out.println(" starting the timer, in order to prime the caches and thus improve the");
|
||||||
System.out.println(" consistency of the results.");
|
System.out.println(" consistency of the results.");
|
||||||
System.out.println("-componly = Stop after running compression tests. Do not test decompression.");
|
System.out.println("-componly = Stop after running compression tests. Do not test decompression.");
|
||||||
System.out.println("-nowrite = Do not write reference or output images (improves consistency");
|
System.out.println("-nowrite = Do not write reference or output images (improves consistency");
|
||||||
System.out.println(" of performance measurements.)\n");
|
System.out.println(" of performance measurements.)");
|
||||||
|
System.out.println("-stoponwarning = Immediately discontinue the current");
|
||||||
|
System.out.println(" compression/decompression/transform operation if the underlying codec");
|
||||||
|
System.out.println(" throws a warning (non-fatal error)\n");
|
||||||
System.out.println("NOTE: If the quality is specified as a range (e.g. 90-100), a separate");
|
System.out.println("NOTE: If the quality is specified as a range (e.g. 90-100), a separate");
|
||||||
System.out.println("test will be performed for all quality values in the range.\n");
|
System.out.println("test will be performed for all quality values in the range.\n");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
@@ -681,9 +762,9 @@ class TJBench {
|
|||||||
|
|
||||||
|
|
||||||
public static void main(String[] argv) {
|
public static void main(String[] argv) {
|
||||||
byte[] srcBuf = null; int w = 0, h = 0;
|
byte[] srcBuf = null;
|
||||||
int minQual = -1, maxQual = -1;
|
int w = 0, h = 0, minQual = -1, maxQual = -1;
|
||||||
int minArg = 1; int retval = 0;
|
int minArg = 1, retval = 0;
|
||||||
int subsamp = -1;
|
int subsamp = -1;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -720,48 +801,49 @@ class TJBench {
|
|||||||
for (int i = minArg; i < argv.length; i++) {
|
for (int i = minArg; i < argv.length; i++) {
|
||||||
if (argv[i].equalsIgnoreCase("-tile")) {
|
if (argv[i].equalsIgnoreCase("-tile")) {
|
||||||
doTile = true; xformOpt |= TJTransform.OPT_CROP;
|
doTile = true; xformOpt |= TJTransform.OPT_CROP;
|
||||||
}
|
} else if (argv[i].equalsIgnoreCase("-fastupsample")) {
|
||||||
if (argv[i].equalsIgnoreCase("-fastupsample")) {
|
|
||||||
System.out.println("Using fast upsampling code\n");
|
System.out.println("Using fast upsampling code\n");
|
||||||
flags |= TJ.FLAG_FASTUPSAMPLE;
|
flags |= TJ.FLAG_FASTUPSAMPLE;
|
||||||
}
|
} else if (argv[i].equalsIgnoreCase("-fastdct")) {
|
||||||
if (argv[i].equalsIgnoreCase("-fastdct")) {
|
|
||||||
System.out.println("Using fastest DCT/IDCT algorithm\n");
|
System.out.println("Using fastest DCT/IDCT algorithm\n");
|
||||||
flags |= TJ.FLAG_FASTDCT;
|
flags |= TJ.FLAG_FASTDCT;
|
||||||
}
|
} else if (argv[i].equalsIgnoreCase("-accuratedct")) {
|
||||||
if (argv[i].equalsIgnoreCase("-accuratedct")) {
|
|
||||||
System.out.println("Using most accurate DCT/IDCT algorithm\n");
|
System.out.println("Using most accurate DCT/IDCT algorithm\n");
|
||||||
flags |= TJ.FLAG_ACCURATEDCT;
|
flags |= TJ.FLAG_ACCURATEDCT;
|
||||||
}
|
} else if (argv[i].equalsIgnoreCase("-progressive")) {
|
||||||
if (argv[i].equalsIgnoreCase("-rgb"))
|
System.out.println("Using progressive entropy coding\n");
|
||||||
|
flags |= TJ.FLAG_PROGRESSIVE;
|
||||||
|
} else if (argv[i].equalsIgnoreCase("-rgb"))
|
||||||
pf = TJ.PF_RGB;
|
pf = TJ.PF_RGB;
|
||||||
if (argv[i].equalsIgnoreCase("-rgbx"))
|
else if (argv[i].equalsIgnoreCase("-rgbx"))
|
||||||
pf = TJ.PF_RGBX;
|
pf = TJ.PF_RGBX;
|
||||||
if (argv[i].equalsIgnoreCase("-bgr"))
|
else if (argv[i].equalsIgnoreCase("-bgr"))
|
||||||
pf = TJ.PF_BGR;
|
pf = TJ.PF_BGR;
|
||||||
if (argv[i].equalsIgnoreCase("-bgrx"))
|
else if (argv[i].equalsIgnoreCase("-bgrx"))
|
||||||
pf = TJ.PF_BGRX;
|
pf = TJ.PF_BGRX;
|
||||||
if (argv[i].equalsIgnoreCase("-xbgr"))
|
else if (argv[i].equalsIgnoreCase("-xbgr"))
|
||||||
pf = TJ.PF_XBGR;
|
pf = TJ.PF_XBGR;
|
||||||
if (argv[i].equalsIgnoreCase("-xrgb"))
|
else if (argv[i].equalsIgnoreCase("-xrgb"))
|
||||||
pf = TJ.PF_XRGB;
|
pf = TJ.PF_XRGB;
|
||||||
if (argv[i].equalsIgnoreCase("-bottomup"))
|
else if (argv[i].equalsIgnoreCase("-bottomup"))
|
||||||
flags |= TJ.FLAG_BOTTOMUP;
|
flags |= TJ.FLAG_BOTTOMUP;
|
||||||
if (argv[i].equalsIgnoreCase("-quiet"))
|
else if (argv[i].equalsIgnoreCase("-quiet"))
|
||||||
quiet = 1;
|
quiet = 1;
|
||||||
if (argv[i].equalsIgnoreCase("-qq"))
|
else if (argv[i].equalsIgnoreCase("-qq"))
|
||||||
quiet = 2;
|
quiet = 2;
|
||||||
if (argv[i].equalsIgnoreCase("-scale") && i < argv.length - 1) {
|
else if (argv[i].equalsIgnoreCase("-scale") && i < argv.length - 1) {
|
||||||
int temp1 = 0, temp2 = 0;
|
int temp1 = 0, temp2 = 0;
|
||||||
boolean match = false, scanned = true;
|
boolean match = false, scanned = true;
|
||||||
Scanner scanner = new Scanner(argv[++i]).useDelimiter("/");
|
Scanner scanner = new Scanner(argv[++i]).useDelimiter("/");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
temp1 = scanner.nextInt();
|
temp1 = scanner.nextInt();
|
||||||
temp2 = scanner.nextInt();
|
temp2 = scanner.nextInt();
|
||||||
} catch(Exception e) {}
|
} catch (Exception e) {}
|
||||||
if (temp2 <= 0) temp2 = 1;
|
if (temp2 <= 0) temp2 = 1;
|
||||||
if (temp1 > 0) {
|
if (temp1 > 0) {
|
||||||
TJScalingFactor[] scalingFactors = TJ.getScalingFactors();
|
TJScalingFactor[] scalingFactors = TJ.getScalingFactors();
|
||||||
|
|
||||||
for (int j = 0; j < scalingFactors.length; j++) {
|
for (int j = 0; j < scalingFactors.length; j++) {
|
||||||
if ((double)temp1 / (double)temp2 ==
|
if ((double)temp1 / (double)temp2 ==
|
||||||
(double)scalingFactors[j].getNum() /
|
(double)scalingFactors[j].getNum() /
|
||||||
@@ -773,27 +855,30 @@ class TJBench {
|
|||||||
if (!match) usage();
|
if (!match) usage();
|
||||||
} else
|
} else
|
||||||
usage();
|
usage();
|
||||||
}
|
} else if (argv[i].equalsIgnoreCase("-hflip"))
|
||||||
if (argv[i].equalsIgnoreCase("-hflip"))
|
|
||||||
xformOp = TJTransform.OP_HFLIP;
|
xformOp = TJTransform.OP_HFLIP;
|
||||||
if (argv[i].equalsIgnoreCase("-vflip"))
|
else if (argv[i].equalsIgnoreCase("-vflip"))
|
||||||
xformOp = TJTransform.OP_VFLIP;
|
xformOp = TJTransform.OP_VFLIP;
|
||||||
if (argv[i].equalsIgnoreCase("-transpose"))
|
else if (argv[i].equalsIgnoreCase("-transpose"))
|
||||||
xformOp = TJTransform.OP_TRANSPOSE;
|
xformOp = TJTransform.OP_TRANSPOSE;
|
||||||
if (argv[i].equalsIgnoreCase("-transverse"))
|
else if (argv[i].equalsIgnoreCase("-transverse"))
|
||||||
xformOp = TJTransform.OP_TRANSVERSE;
|
xformOp = TJTransform.OP_TRANSVERSE;
|
||||||
if (argv[i].equalsIgnoreCase("-rot90"))
|
else if (argv[i].equalsIgnoreCase("-rot90"))
|
||||||
xformOp = TJTransform.OP_ROT90;
|
xformOp = TJTransform.OP_ROT90;
|
||||||
if (argv[i].equalsIgnoreCase("-rot180"))
|
else if (argv[i].equalsIgnoreCase("-rot180"))
|
||||||
xformOp = TJTransform.OP_ROT180;
|
xformOp = TJTransform.OP_ROT180;
|
||||||
if (argv[i].equalsIgnoreCase("-rot270"))
|
else if (argv[i].equalsIgnoreCase("-rot270"))
|
||||||
xformOp = TJTransform.OP_ROT270;
|
xformOp = TJTransform.OP_ROT270;
|
||||||
if (argv[i].equalsIgnoreCase("-grayscale"))
|
else if (argv[i].equalsIgnoreCase("-grayscale"))
|
||||||
xformOpt |= TJTransform.OPT_GRAY;
|
xformOpt |= TJTransform.OPT_GRAY;
|
||||||
if (argv[i].equalsIgnoreCase("-nooutput"))
|
else if (argv[i].equalsIgnoreCase("-nooutput"))
|
||||||
xformOpt |= TJTransform.OPT_NOOUTPUT;
|
xformOpt |= TJTransform.OPT_NOOUTPUT;
|
||||||
if (argv[i].equalsIgnoreCase("-benchtime") && i < argv.length - 1) {
|
else if (argv[i].equalsIgnoreCase("-copynone"))
|
||||||
|
xformOpt |= TJTransform.OPT_COPYNONE;
|
||||||
|
else if (argv[i].equalsIgnoreCase("-benchtime") &&
|
||||||
|
i < argv.length - 1) {
|
||||||
double temp = -1;
|
double temp = -1;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
temp = Double.parseDouble(argv[++i]);
|
temp = Double.parseDouble(argv[++i]);
|
||||||
} catch (NumberFormatException e) {}
|
} catch (NumberFormatException e) {}
|
||||||
@@ -801,20 +886,32 @@ class TJBench {
|
|||||||
benchTime = temp;
|
benchTime = temp;
|
||||||
else
|
else
|
||||||
usage();
|
usage();
|
||||||
}
|
} else if (argv[i].equalsIgnoreCase("-warmup") &&
|
||||||
if (argv[i].equalsIgnoreCase("-yuv")) {
|
i < argv.length - 1) {
|
||||||
|
double temp = -1;
|
||||||
|
|
||||||
|
try {
|
||||||
|
temp = Double.parseDouble(argv[++i]);
|
||||||
|
} catch (NumberFormatException e) {}
|
||||||
|
if (temp >= 0.0) {
|
||||||
|
warmup = temp;
|
||||||
|
System.out.format("Warmup time = %.1f seconds\n\n", warmup);
|
||||||
|
} else
|
||||||
|
usage();
|
||||||
|
} else if (argv[i].equalsIgnoreCase("-yuv")) {
|
||||||
System.out.println("Testing YUV planar encoding/decoding\n");
|
System.out.println("Testing YUV planar encoding/decoding\n");
|
||||||
doYUV = true;
|
doYUV = true;
|
||||||
}
|
} else if (argv[i].equalsIgnoreCase("-yuvpad") &&
|
||||||
if (argv[i].equalsIgnoreCase("-yuvpad") && i < argv.length - 1) {
|
i < argv.length - 1) {
|
||||||
int temp = 0;
|
int temp = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
temp = Integer.parseInt(argv[++i]);
|
temp = Integer.parseInt(argv[++i]);
|
||||||
} catch (NumberFormatException e) {}
|
} catch (NumberFormatException e) {}
|
||||||
if (temp >= 1)
|
if (temp >= 1)
|
||||||
yuvpad = temp;
|
yuvPad = temp;
|
||||||
}
|
} else if (argv[i].equalsIgnoreCase("-subsamp") &&
|
||||||
if (argv[i].equalsIgnoreCase("-subsamp") && i < argv.length - 1) {
|
i < argv.length - 1) {
|
||||||
i++;
|
i++;
|
||||||
if (argv[i].toUpperCase().startsWith("G"))
|
if (argv[i].toUpperCase().startsWith("G"))
|
||||||
subsamp = TJ.SAMP_GRAY;
|
subsamp = TJ.SAMP_GRAY;
|
||||||
@@ -828,24 +925,13 @@ class TJBench {
|
|||||||
subsamp = TJ.SAMP_420;
|
subsamp = TJ.SAMP_420;
|
||||||
else if (argv[i].equals("411"))
|
else if (argv[i].equals("411"))
|
||||||
subsamp = TJ.SAMP_411;
|
subsamp = TJ.SAMP_411;
|
||||||
}
|
} else if (argv[i].equalsIgnoreCase("-componly"))
|
||||||
if (argv[i].equalsIgnoreCase("-componly"))
|
|
||||||
compOnly = true;
|
compOnly = true;
|
||||||
if (argv[i].equalsIgnoreCase("-nowrite"))
|
else if (argv[i].equalsIgnoreCase("-nowrite"))
|
||||||
write = false;
|
write = false;
|
||||||
if (argv[i].equalsIgnoreCase("-warmup") && i < argv.length - 1) {
|
else if (argv[i].equalsIgnoreCase("-stoponwarning"))
|
||||||
double temp = -1;
|
flags |= TJ.FLAG_STOPONWARNING;
|
||||||
try {
|
else usage();
|
||||||
temp = Double.parseDouble(argv[++i]);
|
|
||||||
} catch (NumberFormatException e) {}
|
|
||||||
if (temp >= 0.0) {
|
|
||||||
warmup = temp;
|
|
||||||
System.out.format("Warmup time = %.1f seconds\n\n", warmup);
|
|
||||||
} else
|
|
||||||
usage();
|
|
||||||
}
|
|
||||||
if (argv[i].equalsIgnoreCase("-?"))
|
|
||||||
usage();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -860,6 +946,7 @@ class TJBench {
|
|||||||
|
|
||||||
if (!decompOnly) {
|
if (!decompOnly) {
|
||||||
int[] width = new int[1], height = new int[1];
|
int[] width = new int[1], height = new int[1];
|
||||||
|
|
||||||
srcBuf = loadImage(argv[0], width, height, pf);
|
srcBuf = loadImage(argv[0], width, height, pf);
|
||||||
w = width[0]; h = height[0];
|
w = width[0]; h = height[0];
|
||||||
int index = -1;
|
int index = -1;
|
||||||
@@ -870,7 +957,8 @@ class TJBench {
|
|||||||
if (quiet == 1 && !decompOnly) {
|
if (quiet == 1 && !decompOnly) {
|
||||||
System.out.println("All performance values in Mpixels/sec\n");
|
System.out.println("All performance values in Mpixels/sec\n");
|
||||||
System.out.format("Bitmap JPEG JPEG %s %s ",
|
System.out.format("Bitmap JPEG JPEG %s %s ",
|
||||||
(doTile ? "Tile " : "Image"), (doTile ? "Tile " : "Image"));
|
(doTile ? "Tile " : "Image"),
|
||||||
|
(doTile ? "Tile " : "Image"));
|
||||||
if (doYUV)
|
if (doYUV)
|
||||||
System.out.print("Encode ");
|
System.out.print("Encode ");
|
||||||
System.out.print("Comp Comp Decomp ");
|
System.out.print("Comp Comp Decomp ");
|
||||||
@@ -916,6 +1004,12 @@ class TJBench {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
if (e instanceof TJException) {
|
||||||
|
TJException tje = (TJException)e;
|
||||||
|
|
||||||
|
System.out.println((tje.getErrorCode() == TJ.ERR_WARNING ?
|
||||||
|
"WARNING: " : "ERROR: ") + tje.getMessage());
|
||||||
|
} else
|
||||||
System.out.println("ERROR: " + e.getMessage());
|
System.out.println("ERROR: " + e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
retval = -1;
|
retval = -1;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C)2011-2012, 2014-2015 D. R. Commander. All Rights Reserved.
|
* Copyright (C)2011-2012, 2014-2015, 2017-2018 D. R. Commander.
|
||||||
|
* All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@@ -27,8 +28,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This program demonstrates how to compress and decompress JPEG files using
|
* This program demonstrates how to compress, decompress, and transform JPEG
|
||||||
* the TurboJPEG JNI wrapper
|
* images using the TurboJPEG Java API
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
@@ -39,113 +40,161 @@ import javax.imageio.*;
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import org.libjpegturbo.turbojpeg.*;
|
import org.libjpegturbo.turbojpeg.*;
|
||||||
|
|
||||||
public class TJExample implements TJCustomFilter {
|
|
||||||
|
|
||||||
public static final String classname = new TJExample().getClass().getName();
|
@SuppressWarnings("checkstyle:JavadocType")
|
||||||
|
class TJExample implements TJCustomFilter {
|
||||||
|
|
||||||
private static void usage() throws Exception {
|
static final String CLASS_NAME =
|
||||||
System.out.println("\nUSAGE: java " + classname + " <Input file> <Output file> [options]\n");
|
new TJExample().getClass().getName();
|
||||||
System.out.println("Input and output files can be any image format that the Java Image I/O");
|
|
||||||
|
static final int DEFAULT_SUBSAMP = TJ.SAMP_444;
|
||||||
|
static final int DEFAULT_QUALITY = 95;
|
||||||
|
|
||||||
|
|
||||||
|
static final String[] SUBSAMP_NAME = {
|
||||||
|
"4:4:4", "4:2:2", "4:2:0", "Grayscale", "4:4:0", "4:1:1"
|
||||||
|
};
|
||||||
|
|
||||||
|
static final String[] COLORSPACE_NAME = {
|
||||||
|
"RGB", "YCbCr", "GRAY", "CMYK", "YCCK"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* DCT filter example. This produces a negative of the image. */
|
||||||
|
|
||||||
|
@SuppressWarnings("checkstyle:JavadocMethod")
|
||||||
|
public void customFilter(ShortBuffer coeffBuffer, Rectangle bufferRegion,
|
||||||
|
Rectangle planeRegion, int componentIndex,
|
||||||
|
int transformIndex, TJTransform transform)
|
||||||
|
throws TJException {
|
||||||
|
for (int i = 0; i < bufferRegion.width * bufferRegion.height; i++) {
|
||||||
|
coeffBuffer.put(i, (short)(-coeffBuffer.get(i)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void usage() throws Exception {
|
||||||
|
System.out.println("\nUSAGE: java [Java options] " + CLASS_NAME +
|
||||||
|
" <Input image> <Output image> [options]\n");
|
||||||
|
|
||||||
|
System.out.println("Input and output images can be in any image format that the Java Image I/O");
|
||||||
System.out.println("extensions understand. If either filename ends in a .jpg extension, then");
|
System.out.println("extensions understand. If either filename ends in a .jpg extension, then");
|
||||||
System.out.println("TurboJPEG will be used to compress or decompress the file.\n");
|
System.out.println("the TurboJPEG API will be used to compress or decompress the image.\n");
|
||||||
System.out.println("Options:\n");
|
|
||||||
System.out.println("-scale M/N = if the input image is a JPEG file, scale the width/height of the");
|
System.out.println("Compression Options (used if the output image is a JPEG image)");
|
||||||
System.out.print(" output image by a factor of M/N (M/N = ");
|
System.out.println("--------------------------------------------------------------\n");
|
||||||
for (int i = 0; i < sf.length; i++) {
|
|
||||||
System.out.print(sf[i].getNum() + "/" + sf[i].getDenom());
|
System.out.println("-subsamp <444|422|420|gray> = Apply this level of chrominance subsampling when");
|
||||||
if (sf.length == 2 && i != sf.length - 1)
|
System.out.println(" compressing the output image. The default is to use the same level of");
|
||||||
|
System.out.println(" subsampling as in the input image, if the input image is also a JPEG");
|
||||||
|
System.out.println(" image, or to use grayscale if the input image is a grayscale non-JPEG");
|
||||||
|
System.out.println(" image, or to use " +
|
||||||
|
SUBSAMP_NAME[DEFAULT_SUBSAMP] +
|
||||||
|
" subsampling otherwise.\n");
|
||||||
|
|
||||||
|
System.out.println("-q <1-100> = Compress the output image with this JPEG quality level");
|
||||||
|
System.out.println(" (default = " + DEFAULT_QUALITY + ").\n");
|
||||||
|
|
||||||
|
System.out.println("Decompression Options (used if the input image is a JPEG image)");
|
||||||
|
System.out.println("---------------------------------------------------------------\n");
|
||||||
|
|
||||||
|
System.out.println("-scale M/N = Scale the input image by a factor of M/N when decompressing it.");
|
||||||
|
System.out.print("(M/N = ");
|
||||||
|
for (int i = 0; i < SCALING_FACTORS.length; i++) {
|
||||||
|
System.out.print(SCALING_FACTORS[i].getNum() + "/" +
|
||||||
|
SCALING_FACTORS[i].getDenom());
|
||||||
|
if (SCALING_FACTORS.length == 2 && i != SCALING_FACTORS.length - 1)
|
||||||
System.out.print(" or ");
|
System.out.print(" or ");
|
||||||
else if (sf.length > 2) {
|
else if (SCALING_FACTORS.length > 2) {
|
||||||
if (i != sf.length - 1)
|
if (i != SCALING_FACTORS.length - 1)
|
||||||
System.out.print(", ");
|
System.out.print(", ");
|
||||||
if (i == sf.length - 2)
|
if (i == SCALING_FACTORS.length - 2)
|
||||||
System.out.print("or ");
|
System.out.print("or ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println(")\n");
|
System.out.println(")\n");
|
||||||
System.out.println("-samp <444|422|420|gray> = If the output image is a JPEG file, this specifies");
|
|
||||||
System.out.println(" the level of chrominance subsampling to use when");
|
|
||||||
System.out.println(" recompressing it. Default is to use the same level");
|
|
||||||
System.out.println(" of subsampling as the input, if the input is a JPEG");
|
|
||||||
System.out.println(" file, or 4:4:4 otherwise.\n");
|
|
||||||
System.out.println("-q <1-100> = If the output image is a JPEG file, this specifies the JPEG");
|
|
||||||
System.out.println(" quality to use when recompressing it (default = 95).\n");
|
|
||||||
System.out.println("-hflip, -vflip, -transpose, -transverse, -rot90, -rot180, -rot270 =");
|
System.out.println("-hflip, -vflip, -transpose, -transverse, -rot90, -rot180, -rot270 =");
|
||||||
System.out.println(" If the input image is a JPEG file, perform the corresponding lossless");
|
System.out.println(" Perform one of these lossless transform operations on the input image");
|
||||||
System.out.println(" transform prior to decompression (these options are mutually exclusive)\n");
|
System.out.println(" prior to decompressing it (these options are mutually exclusive.)\n");
|
||||||
System.out.println("-grayscale = If the input image is a JPEG file, perform lossless grayscale");
|
|
||||||
System.out.println(" conversion prior to decompression (can be combined with the other");
|
System.out.println("-grayscale = Perform lossless grayscale conversion on the input image prior");
|
||||||
System.out.println(" transforms above)\n");
|
System.out.println(" to decompressing it (can be combined with the other transform operations");
|
||||||
System.out.println("-crop X,Y,WxH = If the input image is a JPEG file, perform lossless cropping");
|
System.out.println(" above.)\n");
|
||||||
System.out.println(" prior to decompression. X,Y specifies the upper left corner of the");
|
|
||||||
System.out.println(" cropping region, and WxH specifies its width and height. X,Y must be");
|
System.out.println("-crop WxH+X+Y = Perform lossless cropping on the input image prior to");
|
||||||
System.out.println(" evenly divible by the MCU block size (8x8 if the source image was");
|
System.out.println(" decompressing it. X and Y specify the upper left corner of the cropping");
|
||||||
System.out.println(" compressed using no subsampling or grayscale, or 16x8 for 4:2:2 or 16x16");
|
System.out.println(" region, and W and H specify the width and height of the cropping region.");
|
||||||
System.out.println(" for 4:2:0.)\n");
|
System.out.println(" X and Y must be evenly divible by the MCU block size (8x8 if the input");
|
||||||
System.out.println("-display = Display output image (Output file need not be specified in this");
|
System.out.println(" image was compressed using no subsampling or grayscale, 16x8 if it was");
|
||||||
|
System.out.println(" compressed using 4:2:2 subsampling, or 16x16 if it was compressed using");
|
||||||
|
System.out.println(" 4:2:0 subsampling.)\n");
|
||||||
|
|
||||||
|
System.out.println("General Options");
|
||||||
|
System.out.println("---------------\n");
|
||||||
|
|
||||||
|
System.out.println("-display = Display output image (Output filename need not be specified in this");
|
||||||
System.out.println(" case.)\n");
|
System.out.println(" case.)\n");
|
||||||
|
|
||||||
System.out.println("-fastupsample = Use the fastest chrominance upsampling algorithm available in");
|
System.out.println("-fastupsample = Use the fastest chrominance upsampling algorithm available in");
|
||||||
System.out.println(" the underlying codec\n");
|
System.out.println(" the underlying codec.\n");
|
||||||
|
|
||||||
System.out.println("-fastdct = Use the fastest DCT/IDCT algorithms available in the underlying");
|
System.out.println("-fastdct = Use the fastest DCT/IDCT algorithms available in the underlying");
|
||||||
System.out.println(" codec\n");
|
System.out.println(" codec.\n");
|
||||||
|
|
||||||
System.out.println("-accuratedct = Use the most accurate DCT/IDCT algorithms available in the");
|
System.out.println("-accuratedct = Use the most accurate DCT/IDCT algorithms available in the");
|
||||||
System.out.println(" underlying codec\n");
|
System.out.println(" underlying codec.\n");
|
||||||
|
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String[] sampName = {
|
|
||||||
"4:4:4", "4:2:2", "4:2:0", "Grayscale", "4:4:0"
|
|
||||||
};
|
|
||||||
|
|
||||||
public static void main(String[] argv) {
|
public static void main(String[] argv) {
|
||||||
|
|
||||||
BufferedImage img = null;
|
|
||||||
byte[] bmpBuf = null;
|
|
||||||
TJTransform xform = new TJTransform();
|
|
||||||
int flags = 0;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
sf = TJ.getScalingFactors();
|
TJScalingFactor scalingFactor = new TJScalingFactor(1, 1);
|
||||||
|
int outSubsamp = -1, outQual = -1;
|
||||||
if (argv.length < 2) {
|
TJTransform xform = new TJTransform();
|
||||||
usage();
|
|
||||||
}
|
|
||||||
|
|
||||||
TJScalingFactor scaleFactor = new TJScalingFactor(1, 1);
|
|
||||||
String inFormat = "jpg", outFormat = "jpg";
|
|
||||||
int outSubsamp = -1, outQual = 95;
|
|
||||||
boolean display = false;
|
boolean display = false;
|
||||||
|
int flags = 0;
|
||||||
|
int width, height;
|
||||||
|
String inFormat = "jpg", outFormat = "jpg";
|
||||||
|
BufferedImage img = null;
|
||||||
|
byte[] imgBuf = null;
|
||||||
|
|
||||||
if (argv.length > 1) {
|
if (argv.length < 2)
|
||||||
for (int i = 1; i < argv.length; i++) {
|
usage();
|
||||||
|
|
||||||
|
if (argv[1].substring(0, 2).equalsIgnoreCase("-d"))
|
||||||
|
display = true;
|
||||||
|
|
||||||
|
/* Parse arguments. */
|
||||||
|
for (int i = 2; i < argv.length; i++) {
|
||||||
if (argv[i].length() < 2)
|
if (argv[i].length() < 2)
|
||||||
continue;
|
continue;
|
||||||
if (argv[i].length() > 2 &&
|
else if (argv[i].length() > 2 &&
|
||||||
argv[i].substring(0, 3).equalsIgnoreCase("-sc")) {
|
argv[i].substring(0, 3).equalsIgnoreCase("-sc") &&
|
||||||
|
i < argv.length - 1) {
|
||||||
int match = 0;
|
int match = 0;
|
||||||
if (i < argv.length - 1) {
|
|
||||||
String[] scaleArg = argv[++i].split("/");
|
String[] scaleArg = argv[++i].split("/");
|
||||||
if (scaleArg.length == 2) {
|
if (scaleArg.length == 2) {
|
||||||
TJScalingFactor tempsf =
|
TJScalingFactor tempsf =
|
||||||
new TJScalingFactor(Integer.parseInt(scaleArg[0]),
|
new TJScalingFactor(Integer.parseInt(scaleArg[0]),
|
||||||
Integer.parseInt(scaleArg[1]));
|
Integer.parseInt(scaleArg[1]));
|
||||||
for (int j = 0; j < sf.length; j++) {
|
for (int j = 0; j < SCALING_FACTORS.length; j++) {
|
||||||
if (tempsf.equals(sf[j])) {
|
if (tempsf.equals(SCALING_FACTORS[j])) {
|
||||||
scaleFactor = sf[j];
|
scalingFactor = SCALING_FACTORS[j];
|
||||||
match = 1;
|
match = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (match != 1)
|
||||||
if (match != 1) usage();
|
|
||||||
}
|
|
||||||
if (argv[i].equalsIgnoreCase("-h") || argv[i].equalsIgnoreCase("-?"))
|
|
||||||
usage();
|
usage();
|
||||||
if (argv[i].length() > 2 &&
|
} else if (argv[i].length() > 2 &&
|
||||||
argv[i].substring(0, 3).equalsIgnoreCase("-sa")) {
|
argv[i].substring(0, 3).equalsIgnoreCase("-su") &&
|
||||||
if (i < argv.length - 1) {
|
i < argv.length - 1) {
|
||||||
i++;
|
i++;
|
||||||
if (argv[i].substring(0, 1).equalsIgnoreCase("g"))
|
if (argv[i].substring(0, 1).equalsIgnoreCase("g"))
|
||||||
outSubsamp = TJ.SAMP_GRAY;
|
outSubsamp = TJ.SAMP_GRAY;
|
||||||
@@ -157,75 +206,58 @@ public class TJExample implements TJCustomFilter {
|
|||||||
outSubsamp = TJ.SAMP_420;
|
outSubsamp = TJ.SAMP_420;
|
||||||
else
|
else
|
||||||
usage();
|
usage();
|
||||||
} else
|
} else if (argv[i].substring(0, 2).equalsIgnoreCase("-q") &&
|
||||||
|
i < argv.length - 1) {
|
||||||
|
outQual = Integer.parseInt(argv[++i]);
|
||||||
|
if (outQual < 1 || outQual > 100)
|
||||||
usage();
|
usage();
|
||||||
}
|
} else if (argv[i].substring(0, 2).equalsIgnoreCase("-g"))
|
||||||
if (argv[i].substring(0, 2).equalsIgnoreCase("-q")) {
|
|
||||||
if (i < argv.length - 1) {
|
|
||||||
int qual = Integer.parseInt(argv[++i]);
|
|
||||||
if (qual >= 1 && qual <= 100)
|
|
||||||
outQual = qual;
|
|
||||||
else
|
|
||||||
usage();
|
|
||||||
} else
|
|
||||||
usage();
|
|
||||||
}
|
|
||||||
if (argv[i].substring(0, 2).equalsIgnoreCase("-g"))
|
|
||||||
xform.options |= TJTransform.OPT_GRAY;
|
xform.options |= TJTransform.OPT_GRAY;
|
||||||
if (argv[i].equalsIgnoreCase("-hflip"))
|
else if (argv[i].equalsIgnoreCase("-hflip"))
|
||||||
xform.op = TJTransform.OP_HFLIP;
|
xform.op = TJTransform.OP_HFLIP;
|
||||||
if (argv[i].equalsIgnoreCase("-vflip"))
|
else if (argv[i].equalsIgnoreCase("-vflip"))
|
||||||
xform.op = TJTransform.OP_VFLIP;
|
xform.op = TJTransform.OP_VFLIP;
|
||||||
if (argv[i].equalsIgnoreCase("-transpose"))
|
else if (argv[i].equalsIgnoreCase("-transpose"))
|
||||||
xform.op = TJTransform.OP_TRANSPOSE;
|
xform.op = TJTransform.OP_TRANSPOSE;
|
||||||
if (argv[i].equalsIgnoreCase("-transverse"))
|
else if (argv[i].equalsIgnoreCase("-transverse"))
|
||||||
xform.op = TJTransform.OP_TRANSVERSE;
|
xform.op = TJTransform.OP_TRANSVERSE;
|
||||||
if (argv[i].equalsIgnoreCase("-rot90"))
|
else if (argv[i].equalsIgnoreCase("-rot90"))
|
||||||
xform.op = TJTransform.OP_ROT90;
|
xform.op = TJTransform.OP_ROT90;
|
||||||
if (argv[i].equalsIgnoreCase("-rot180"))
|
else if (argv[i].equalsIgnoreCase("-rot180"))
|
||||||
xform.op = TJTransform.OP_ROT180;
|
xform.op = TJTransform.OP_ROT180;
|
||||||
if (argv[i].equalsIgnoreCase("-rot270"))
|
else if (argv[i].equalsIgnoreCase("-rot270"))
|
||||||
xform.op = TJTransform.OP_ROT270;
|
xform.op = TJTransform.OP_ROT270;
|
||||||
if (argv[i].equalsIgnoreCase("-custom"))
|
else if (argv[i].equalsIgnoreCase("-custom"))
|
||||||
xform.cf = new TJExample();
|
xform.cf = new TJExample();
|
||||||
else if (argv[i].length() > 2 &&
|
else if (argv[i].length() > 2 &&
|
||||||
argv[i].substring(0, 2).equalsIgnoreCase("-c")) {
|
argv[i].substring(0, 2).equalsIgnoreCase("-c") &&
|
||||||
if (i >= argv.length - 1)
|
i < argv.length - 1) {
|
||||||
|
String[] cropArg = argv[++i].split("[x\\+]");
|
||||||
|
if (cropArg.length != 4)
|
||||||
usage();
|
usage();
|
||||||
String[] cropArg = argv[++i].split(",");
|
xform.width = Integer.parseInt(cropArg[0]);
|
||||||
if (cropArg.length != 3)
|
xform.height = Integer.parseInt(cropArg[1]);
|
||||||
|
xform.x = Integer.parseInt(cropArg[2]);
|
||||||
|
xform.y = Integer.parseInt(cropArg[3]);
|
||||||
|
if (xform.x < 0 || xform.y < 0 || xform.width < 1 ||
|
||||||
|
xform.height < 1)
|
||||||
usage();
|
usage();
|
||||||
String[] dimArg = cropArg[2].split("[xX]");
|
|
||||||
if (dimArg.length != 2)
|
|
||||||
usage();
|
|
||||||
int tempx = Integer.parseInt(cropArg[0]);
|
|
||||||
int tempy = Integer.parseInt(cropArg[1]);
|
|
||||||
int tempw = Integer.parseInt(dimArg[0]);
|
|
||||||
int temph = Integer.parseInt(dimArg[1]);
|
|
||||||
if (tempx < 0 || tempy < 0 || tempw < 0 || temph < 0)
|
|
||||||
usage();
|
|
||||||
xform.x = tempx;
|
|
||||||
xform.y = tempy;
|
|
||||||
xform.width = tempw;
|
|
||||||
xform.height = temph;
|
|
||||||
xform.options |= TJTransform.OPT_CROP;
|
xform.options |= TJTransform.OPT_CROP;
|
||||||
}
|
} else if (argv[i].substring(0, 2).equalsIgnoreCase("-d"))
|
||||||
if (argv[i].substring(0, 2).equalsIgnoreCase("-d"))
|
|
||||||
display = true;
|
display = true;
|
||||||
if (argv[i].equalsIgnoreCase("-fastupsample")) {
|
else if (argv[i].equalsIgnoreCase("-fastupsample")) {
|
||||||
System.out.println("Using fast upsampling code");
|
System.out.println("Using fast upsampling code");
|
||||||
flags |= TJ.FLAG_FASTUPSAMPLE;
|
flags |= TJ.FLAG_FASTUPSAMPLE;
|
||||||
}
|
} else if (argv[i].equalsIgnoreCase("-fastdct")) {
|
||||||
if (argv[i].equalsIgnoreCase("-fastdct")) {
|
|
||||||
System.out.println("Using fastest DCT/IDCT algorithm");
|
System.out.println("Using fastest DCT/IDCT algorithm");
|
||||||
flags |= TJ.FLAG_FASTDCT;
|
flags |= TJ.FLAG_FASTDCT;
|
||||||
}
|
} else if (argv[i].equalsIgnoreCase("-accuratedct")) {
|
||||||
if (argv[i].equalsIgnoreCase("-accuratedct")) {
|
|
||||||
System.out.println("Using most accurate DCT/IDCT algorithm");
|
System.out.println("Using most accurate DCT/IDCT algorithm");
|
||||||
flags |= TJ.FLAG_ACCURATEDCT;
|
flags |= TJ.FLAG_ACCURATEDCT;
|
||||||
|
} else usage();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
/* Determine input and output image formats based on file extensions. */
|
||||||
String[] inFileTokens = argv[0].split("\\.");
|
String[] inFileTokens = argv[0].split("\\.");
|
||||||
if (inFileTokens.length > 1)
|
if (inFileTokens.length > 1)
|
||||||
inFormat = inFileTokens[inFileTokens.length - 1];
|
inFormat = inFileTokens[inFileTokens.length - 1];
|
||||||
@@ -238,61 +270,75 @@ public class TJExample implements TJCustomFilter {
|
|||||||
outFormat = outFileTokens[outFileTokens.length - 1];
|
outFormat = outFileTokens[outFileTokens.length - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
File file = new File(argv[0]);
|
|
||||||
int width, height;
|
|
||||||
|
|
||||||
if (inFormat.equalsIgnoreCase("jpg")) {
|
if (inFormat.equalsIgnoreCase("jpg")) {
|
||||||
FileInputStream fis = new FileInputStream(file);
|
/* Input image is a JPEG image. Decompress and/or transform it. */
|
||||||
int inputSize = fis.available();
|
boolean doTransform = (xform.op != TJTransform.OP_NONE ||
|
||||||
if (inputSize < 1) {
|
xform.options != 0 || xform.cf != null);
|
||||||
|
|
||||||
|
/* Read the JPEG file into memory. */
|
||||||
|
File jpegFile = new File(argv[0]);
|
||||||
|
FileInputStream fis = new FileInputStream(jpegFile);
|
||||||
|
int jpegSize = fis.available();
|
||||||
|
if (jpegSize < 1) {
|
||||||
System.out.println("Input file contains no data");
|
System.out.println("Input file contains no data");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
byte[] inputBuf = new byte[inputSize];
|
byte[] jpegBuf = new byte[jpegSize];
|
||||||
fis.read(inputBuf);
|
fis.read(jpegBuf);
|
||||||
fis.close();
|
fis.close();
|
||||||
|
|
||||||
TJDecompressor tjd;
|
TJDecompressor tjd;
|
||||||
if (xform.op != TJTransform.OP_NONE || xform.options != 0 ||
|
if (doTransform) {
|
||||||
xform.cf != null) {
|
/* Transform it. */
|
||||||
TJTransformer tjt = new TJTransformer(inputBuf);
|
TJTransformer tjt = new TJTransformer(jpegBuf);
|
||||||
TJTransform[] t = new TJTransform[1];
|
TJTransform[] xforms = new TJTransform[1];
|
||||||
t[0] = xform;
|
xforms[0] = xform;
|
||||||
t[0].options |= TJTransform.OPT_TRIM;
|
xforms[0].options |= TJTransform.OPT_TRIM;
|
||||||
TJDecompressor[] tjdx = tjt.transform(t, 0);
|
TJDecompressor[] tjds = tjt.transform(xforms, 0);
|
||||||
tjd = tjdx[0];
|
tjd = tjds[0];
|
||||||
|
tjt.close();
|
||||||
} else
|
} else
|
||||||
tjd = new TJDecompressor(inputBuf);
|
tjd = new TJDecompressor(jpegBuf);
|
||||||
|
|
||||||
width = tjd.getWidth();
|
width = tjd.getWidth();
|
||||||
height = tjd.getHeight();
|
height = tjd.getHeight();
|
||||||
int inSubsamp = tjd.getSubsamp();
|
int inSubsamp = tjd.getSubsamp();
|
||||||
System.out.println("Source Image: " + width + " x " + height +
|
int inColorspace = tjd.getColorspace();
|
||||||
" pixels, " + sampName[inSubsamp] + " subsampling");
|
|
||||||
if (outSubsamp < 0)
|
|
||||||
outSubsamp = inSubsamp;
|
|
||||||
|
|
||||||
if (outFormat.equalsIgnoreCase("jpg") &&
|
System.out.println((doTransform ? "Transformed" : "Input") +
|
||||||
(xform.op != TJTransform.OP_NONE || xform.options != 0) &&
|
" Image (jpg): " + width + " x " + height +
|
||||||
scaleFactor.isOne()) {
|
" pixels, " + SUBSAMP_NAME[inSubsamp] +
|
||||||
file = new File(argv[1]);
|
" subsampling, " + COLORSPACE_NAME[inColorspace]);
|
||||||
FileOutputStream fos = new FileOutputStream(file);
|
|
||||||
|
if (outFormat.equalsIgnoreCase("jpg") && doTransform &&
|
||||||
|
scalingFactor.isOne() && outSubsamp < 0 && outQual < 0) {
|
||||||
|
/* Input image has been transformed, and no re-compression options
|
||||||
|
have been selected. Write the transformed image to disk and
|
||||||
|
exit. */
|
||||||
|
File outFile = new File(argv[1]);
|
||||||
|
FileOutputStream fos = new FileOutputStream(outFile);
|
||||||
fos.write(tjd.getJPEGBuf(), 0, tjd.getJPEGSize());
|
fos.write(tjd.getJPEGBuf(), 0, tjd.getJPEGSize());
|
||||||
fos.close();
|
fos.close();
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
width = scaleFactor.getScaled(width);
|
/* Scaling and/or a non-JPEG output image format and/or compression
|
||||||
height = scaleFactor.getScaled(height);
|
options have been selected, so we need to decompress the
|
||||||
|
input/transformed image. */
|
||||||
|
width = scalingFactor.getScaled(width);
|
||||||
|
height = scalingFactor.getScaled(height);
|
||||||
|
if (outSubsamp < 0)
|
||||||
|
outSubsamp = inSubsamp;
|
||||||
|
|
||||||
if (!outFormat.equalsIgnoreCase("jpg"))
|
if (!outFormat.equalsIgnoreCase("jpg"))
|
||||||
img = tjd.decompress(width, height, BufferedImage.TYPE_INT_RGB,
|
img = tjd.decompress(width, height, BufferedImage.TYPE_INT_RGB,
|
||||||
flags);
|
flags);
|
||||||
else
|
else
|
||||||
bmpBuf = tjd.decompress(width, 0, height, TJ.PF_BGRX, flags);
|
imgBuf = tjd.decompress(width, 0, height, TJ.PF_BGRX, flags);
|
||||||
tjd.close();
|
tjd.close();
|
||||||
} else {
|
} else {
|
||||||
img = ImageIO.read(file);
|
/* Input image is not a JPEG image. Load it into memory. */
|
||||||
|
img = ImageIO.read(new File(argv[0]));
|
||||||
if (img == null)
|
if (img == null)
|
||||||
throw new Exception("Input image type not supported.");
|
throw new Exception("Input image type not supported.");
|
||||||
width = img.getWidth();
|
width = img.getWidth();
|
||||||
@@ -301,61 +347,59 @@ public class TJExample implements TJCustomFilter {
|
|||||||
if (img.getType() == BufferedImage.TYPE_BYTE_GRAY)
|
if (img.getType() == BufferedImage.TYPE_BYTE_GRAY)
|
||||||
outSubsamp = TJ.SAMP_GRAY;
|
outSubsamp = TJ.SAMP_GRAY;
|
||||||
else
|
else
|
||||||
outSubsamp = TJ.SAMP_444;
|
outSubsamp = DEFAULT_SUBSAMP;
|
||||||
}
|
}
|
||||||
|
System.out.println("Input Image: " + width + " x " + height +
|
||||||
|
" pixels");
|
||||||
}
|
}
|
||||||
System.gc();
|
System.gc();
|
||||||
if (!display)
|
if (!display)
|
||||||
System.out.print("Dest. Image (" + outFormat + "): " + width + " x " +
|
System.out.print("Output Image (" + outFormat + "): " + width +
|
||||||
height + " pixels");
|
" x " + height + " pixels");
|
||||||
|
|
||||||
if (display) {
|
if (display) {
|
||||||
|
/* Display the uncompressed image */
|
||||||
ImageIcon icon = new ImageIcon(img);
|
ImageIcon icon = new ImageIcon(img);
|
||||||
JLabel label = new JLabel(icon, JLabel.CENTER);
|
JLabel label = new JLabel(icon, JLabel.CENTER);
|
||||||
JOptionPane.showMessageDialog(null, label, "Output Image",
|
JOptionPane.showMessageDialog(null, label, "Output Image",
|
||||||
JOptionPane.PLAIN_MESSAGE);
|
JOptionPane.PLAIN_MESSAGE);
|
||||||
} else if (outFormat.equalsIgnoreCase("jpg")) {
|
} else if (outFormat.equalsIgnoreCase("jpg")) {
|
||||||
System.out.println(", " + sampName[outSubsamp] +
|
/* Output image format is JPEG. Compress the uncompressed image. */
|
||||||
|
if (outQual < 0)
|
||||||
|
outQual = DEFAULT_QUALITY;
|
||||||
|
System.out.println(", " + SUBSAMP_NAME[outSubsamp] +
|
||||||
" subsampling, quality = " + outQual);
|
" subsampling, quality = " + outQual);
|
||||||
TJCompressor tjc = new TJCompressor();
|
|
||||||
int jpegSize;
|
|
||||||
byte[] jpegBuf;
|
|
||||||
|
|
||||||
|
TJCompressor tjc = new TJCompressor();
|
||||||
tjc.setSubsamp(outSubsamp);
|
tjc.setSubsamp(outSubsamp);
|
||||||
tjc.setJPEGQuality(outQual);
|
tjc.setJPEGQuality(outQual);
|
||||||
if (img != null)
|
if (img != null)
|
||||||
tjc.setSourceImage(img, 0, 0, 0, 0);
|
tjc.setSourceImage(img, 0, 0, 0, 0);
|
||||||
else {
|
else
|
||||||
tjc.setSourceImage(bmpBuf, 0, 0, width, 0, height, TJ.PF_BGRX);
|
tjc.setSourceImage(imgBuf, 0, 0, width, 0, height, TJ.PF_BGRX);
|
||||||
}
|
byte[] jpegBuf = tjc.compress(flags);
|
||||||
jpegBuf = tjc.compress(flags);
|
int jpegSize = tjc.getCompressedSize();
|
||||||
jpegSize = tjc.getCompressedSize();
|
|
||||||
tjc.close();
|
tjc.close();
|
||||||
|
|
||||||
file = new File(argv[1]);
|
/* Write the JPEG image to disk. */
|
||||||
FileOutputStream fos = new FileOutputStream(file);
|
File outFile = new File(argv[1]);
|
||||||
|
FileOutputStream fos = new FileOutputStream(outFile);
|
||||||
fos.write(jpegBuf, 0, jpegSize);
|
fos.write(jpegBuf, 0, jpegSize);
|
||||||
fos.close();
|
fos.close();
|
||||||
} else {
|
} else {
|
||||||
|
/* Output image format is not JPEG. Save the uncompressed image
|
||||||
|
directly to disk. */
|
||||||
System.out.print("\n");
|
System.out.print("\n");
|
||||||
file = new File(argv[1]);
|
File outFile = new File(argv[1]);
|
||||||
ImageIO.write(img, outFormat, file);
|
ImageIO.write(img, outFormat, outFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch(Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void customFilter(ShortBuffer coeffBuffer, Rectangle bufferRegion,
|
static final TJScalingFactor[] SCALING_FACTORS =
|
||||||
Rectangle planeRegion, int componentIndex,
|
TJ.getScalingFactors();
|
||||||
int transformIndex, TJTransform transform)
|
|
||||||
throws TJException {
|
|
||||||
for (int i = 0; i < bufferRegion.width * bufferRegion.height; i++) {
|
|
||||||
coeffBuffer.put(i, (short)(-coeffBuffer.get(i)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static TJScalingFactor[] sf = null;
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C)2011-2016 D. R. Commander. All Rights Reserved.
|
* Copyright (C)2011-2018 D. R. Commander. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@@ -37,58 +37,57 @@ import javax.imageio.*;
|
|||||||
import java.nio.*;
|
import java.nio.*;
|
||||||
import org.libjpegturbo.turbojpeg.*;
|
import org.libjpegturbo.turbojpeg.*;
|
||||||
|
|
||||||
public class TJUnitTest {
|
@SuppressWarnings("checkstyle:JavadocType")
|
||||||
|
final class TJUnitTest {
|
||||||
|
|
||||||
private static final String classname =
|
private TJUnitTest() {}
|
||||||
|
|
||||||
|
static final String CLASS_NAME =
|
||||||
new TJUnitTest().getClass().getName();
|
new TJUnitTest().getClass().getName();
|
||||||
|
|
||||||
private static void usage() {
|
static void usage() {
|
||||||
System.out.println("\nUSAGE: java " + classname + " [options]\n");
|
System.out.println("\nUSAGE: java " + CLASS_NAME + " [options]\n");
|
||||||
System.out.println("Options:\n");
|
System.out.println("Options:");
|
||||||
System.out.println("-yuv = test YUV encoding/decoding support\n");
|
System.out.println("-yuv = test YUV encoding/decoding support");
|
||||||
System.out.println("-noyuvpad = do not pad each line of each Y, U, and V plane to the nearest\n");
|
System.out.println("-noyuvpad = do not pad each line of each Y, U, and V plane to the nearest");
|
||||||
System.out.println(" 4-byte boundary\n");
|
System.out.println(" 4-byte boundary");
|
||||||
System.out.println("-bi = test BufferedImage support\n");
|
System.out.println("-bi = test BufferedImage support\n");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String[] subNameLong = {
|
static final String[] SUBNAME_LONG = {
|
||||||
"4:4:4", "4:2:2", "4:2:0", "GRAY", "4:4:0", "4:1:1"
|
"4:4:4", "4:2:2", "4:2:0", "GRAY", "4:4:0", "4:1:1"
|
||||||
};
|
};
|
||||||
private static final String[] subName = {
|
static final String[] SUBNAME = {
|
||||||
"444", "422", "420", "GRAY", "440", "411"
|
"444", "422", "420", "GRAY", "440", "411"
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final String[] pixFormatStr = {
|
static final String[] PIXFORMATSTR = {
|
||||||
"RGB", "BGR", "RGBX", "BGRX", "XBGR", "XRGB", "Grayscale",
|
"RGB", "BGR", "RGBX", "BGRX", "XBGR", "XRGB", "Grayscale",
|
||||||
"RGBA", "BGRA", "ABGR", "ARGB", "CMYK"
|
"RGBA", "BGRA", "ABGR", "ARGB", "CMYK"
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final int[] alphaOffset = {
|
static final int[] FORMATS_3BYTE = {
|
||||||
-1, -1, -1, -1, -1, -1, -1, 3, 3, 0, 0, -1
|
|
||||||
};
|
|
||||||
|
|
||||||
private static final int[] _3byteFormats = {
|
|
||||||
TJ.PF_RGB, TJ.PF_BGR
|
TJ.PF_RGB, TJ.PF_BGR
|
||||||
};
|
};
|
||||||
private static final int[] _3byteFormatsBI = {
|
static final int[] FORMATS_3BYTEBI = {
|
||||||
BufferedImage.TYPE_3BYTE_BGR
|
BufferedImage.TYPE_3BYTE_BGR
|
||||||
};
|
};
|
||||||
private static final int[] _4byteFormats = {
|
static final int[] FORMATS_4BYTE = {
|
||||||
TJ.PF_RGBX, TJ.PF_BGRX, TJ.PF_XBGR, TJ.PF_XRGB, TJ.PF_CMYK
|
TJ.PF_RGBX, TJ.PF_BGRX, TJ.PF_XBGR, TJ.PF_XRGB, TJ.PF_CMYK
|
||||||
};
|
};
|
||||||
private static final int[] _4byteFormatsBI = {
|
static final int[] FORMATS_4BYTEBI = {
|
||||||
BufferedImage.TYPE_INT_BGR, BufferedImage.TYPE_INT_RGB,
|
BufferedImage.TYPE_INT_BGR, BufferedImage.TYPE_INT_RGB,
|
||||||
BufferedImage.TYPE_4BYTE_ABGR, BufferedImage.TYPE_4BYTE_ABGR_PRE,
|
BufferedImage.TYPE_4BYTE_ABGR, BufferedImage.TYPE_4BYTE_ABGR_PRE,
|
||||||
BufferedImage.TYPE_INT_ARGB, BufferedImage.TYPE_INT_ARGB_PRE
|
BufferedImage.TYPE_INT_ARGB, BufferedImage.TYPE_INT_ARGB_PRE
|
||||||
};
|
};
|
||||||
private static final int[] onlyGray = {
|
static final int[] FORMATS_GRAY = {
|
||||||
TJ.PF_GRAY
|
TJ.PF_GRAY
|
||||||
};
|
};
|
||||||
private static final int[] onlyGrayBI = {
|
static final int[] FORMATS_GRAYBI = {
|
||||||
BufferedImage.TYPE_BYTE_GRAY
|
BufferedImage.TYPE_BYTE_GRAY
|
||||||
};
|
};
|
||||||
private static final int[] onlyRGB = {
|
static final int[] FORMATS_RGB = {
|
||||||
TJ.PF_RGB
|
TJ.PF_RGB
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -98,9 +97,9 @@ public class TJUnitTest {
|
|||||||
|
|
||||||
private static int exitStatus = 0;
|
private static int exitStatus = 0;
|
||||||
|
|
||||||
private static int biTypePF(int biType) {
|
static int biTypePF(int biType) {
|
||||||
ByteOrder byteOrder = ByteOrder.nativeOrder();
|
ByteOrder byteOrder = ByteOrder.nativeOrder();
|
||||||
switch(biType) {
|
switch (biType) {
|
||||||
case BufferedImage.TYPE_3BYTE_BGR:
|
case BufferedImage.TYPE_3BYTE_BGR:
|
||||||
return TJ.PF_BGR;
|
return TJ.PF_BGR;
|
||||||
case BufferedImage.TYPE_4BYTE_ABGR:
|
case BufferedImage.TYPE_4BYTE_ABGR:
|
||||||
@@ -109,27 +108,19 @@ public class TJUnitTest {
|
|||||||
case BufferedImage.TYPE_BYTE_GRAY:
|
case BufferedImage.TYPE_BYTE_GRAY:
|
||||||
return TJ.PF_GRAY;
|
return TJ.PF_GRAY;
|
||||||
case BufferedImage.TYPE_INT_BGR:
|
case BufferedImage.TYPE_INT_BGR:
|
||||||
if (byteOrder == ByteOrder.BIG_ENDIAN)
|
|
||||||
return TJ.PF_XBGR;
|
|
||||||
else
|
|
||||||
return TJ.PF_RGBX;
|
return TJ.PF_RGBX;
|
||||||
case BufferedImage.TYPE_INT_RGB:
|
case BufferedImage.TYPE_INT_RGB:
|
||||||
if (byteOrder == ByteOrder.BIG_ENDIAN)
|
|
||||||
return TJ.PF_XRGB;
|
|
||||||
else
|
|
||||||
return TJ.PF_BGRX;
|
return TJ.PF_BGRX;
|
||||||
case BufferedImage.TYPE_INT_ARGB:
|
case BufferedImage.TYPE_INT_ARGB:
|
||||||
case BufferedImage.TYPE_INT_ARGB_PRE:
|
case BufferedImage.TYPE_INT_ARGB_PRE:
|
||||||
if (byteOrder == ByteOrder.BIG_ENDIAN)
|
|
||||||
return TJ.PF_ARGB;
|
|
||||||
else
|
|
||||||
return TJ.PF_BGRA;
|
return TJ.PF_BGRA;
|
||||||
}
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static String biTypeStr(int biType) {
|
static String biTypeStr(int biType) {
|
||||||
switch(biType) {
|
switch (biType) {
|
||||||
case BufferedImage.TYPE_3BYTE_BGR:
|
case BufferedImage.TYPE_3BYTE_BGR:
|
||||||
return "3BYTE_BGR";
|
return "3BYTE_BGR";
|
||||||
case BufferedImage.TYPE_4BYTE_ABGR:
|
case BufferedImage.TYPE_4BYTE_ABGR:
|
||||||
@@ -146,16 +137,17 @@ public class TJUnitTest {
|
|||||||
return "INT_ARGB";
|
return "INT_ARGB";
|
||||||
case BufferedImage.TYPE_INT_ARGB_PRE:
|
case BufferedImage.TYPE_INT_ARGB_PRE:
|
||||||
return "INT_ARGB_PRE";
|
return "INT_ARGB_PRE";
|
||||||
}
|
default:
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void initBuf(byte[] buf, int w, int pitch, int h, int pf,
|
static void initBuf(byte[] buf, int w, int pitch, int h, int pf, int flags)
|
||||||
int flags) throws Exception {
|
throws Exception {
|
||||||
int roffset = TJ.getRedOffset(pf);
|
int roffset = TJ.getRedOffset(pf);
|
||||||
int goffset = TJ.getGreenOffset(pf);
|
int goffset = TJ.getGreenOffset(pf);
|
||||||
int boffset = TJ.getBlueOffset(pf);
|
int boffset = TJ.getBlueOffset(pf);
|
||||||
int aoffset = alphaOffset[pf];
|
int aoffset = TJ.getAlphaOffset(pf);
|
||||||
int ps = TJ.getPixelSize(pf);
|
int ps = TJ.getPixelSize(pf);
|
||||||
int index, row, col, halfway = 16;
|
int index, row, col, halfway = 16;
|
||||||
|
|
||||||
@@ -219,12 +211,12 @@ public class TJUnitTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void initIntBuf(int[] buf, int w, int pitch, int h, int pf,
|
static void initIntBuf(int[] buf, int w, int pitch, int h, int pf, int flags)
|
||||||
int flags) throws Exception {
|
throws Exception {
|
||||||
int rshift = TJ.getRedOffset(pf) * 8;
|
int rshift = TJ.getRedOffset(pf) * 8;
|
||||||
int gshift = TJ.getGreenOffset(pf) * 8;
|
int gshift = TJ.getGreenOffset(pf) * 8;
|
||||||
int bshift = TJ.getBlueOffset(pf) * 8;
|
int bshift = TJ.getBlueOffset(pf) * 8;
|
||||||
int ashift = alphaOffset[pf] * 8;
|
int ashift = TJ.getAlphaOffset(pf) * 8;
|
||||||
int index, row, col, halfway = 16;
|
int index, row, col, halfway = 16;
|
||||||
|
|
||||||
Arrays.fill(buf, 0);
|
Arrays.fill(buf, 0);
|
||||||
@@ -251,10 +243,10 @@ public class TJUnitTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void initImg(BufferedImage img, int pf, int flags)
|
static void initImg(BufferedImage img, int pf, int flags) throws Exception {
|
||||||
throws Exception {
|
|
||||||
WritableRaster wr = img.getRaster();
|
WritableRaster wr = img.getRaster();
|
||||||
int imgType = img.getType();
|
int imgType = img.getType();
|
||||||
|
|
||||||
if (imgType == BufferedImage.TYPE_INT_RGB ||
|
if (imgType == BufferedImage.TYPE_INT_RGB ||
|
||||||
imgType == BufferedImage.TYPE_INT_BGR ||
|
imgType == BufferedImage.TYPE_INT_BGR ||
|
||||||
imgType == BufferedImage.TYPE_INT_ARGB ||
|
imgType == BufferedImage.TYPE_INT_ARGB ||
|
||||||
@@ -274,7 +266,7 @@ public class TJUnitTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkVal(int row, int col, int v, String vname, int cv)
|
static void checkVal(int row, int col, int v, String vname, int cv)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
v = (v < 0) ? v + 256 : v;
|
v = (v < 0) ? v + 256 : v;
|
||||||
if (v < cv - 1 || v > cv + 1) {
|
if (v < cv - 1 || v > cv + 1) {
|
||||||
@@ -283,7 +275,7 @@ public class TJUnitTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkVal0(int row, int col, int v, String vname)
|
static void checkVal0(int row, int col, int v, String vname)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
v = (v < 0) ? v + 256 : v;
|
v = (v < 0) ? v + 256 : v;
|
||||||
if (v > 1) {
|
if (v > 1) {
|
||||||
@@ -292,7 +284,7 @@ public class TJUnitTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkVal255(int row, int col, int v, String vname)
|
static void checkVal255(int row, int col, int v, String vname)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
v = (v < 0) ? v + 256 : v;
|
v = (v < 0) ? v + 256 : v;
|
||||||
if (v < 254) {
|
if (v < 254) {
|
||||||
@@ -301,13 +293,12 @@ public class TJUnitTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int checkBuf(byte[] buf, int w, int pitch, int h, int pf,
|
static int checkBuf(byte[] buf, int w, int pitch, int h, int pf, int subsamp,
|
||||||
int subsamp, TJScalingFactor sf, int flags)
|
TJScalingFactor sf, int flags) throws Exception {
|
||||||
throws Exception {
|
|
||||||
int roffset = TJ.getRedOffset(pf);
|
int roffset = TJ.getRedOffset(pf);
|
||||||
int goffset = TJ.getGreenOffset(pf);
|
int goffset = TJ.getGreenOffset(pf);
|
||||||
int boffset = TJ.getBlueOffset(pf);
|
int boffset = TJ.getBlueOffset(pf);
|
||||||
int aoffset = alphaOffset[pf];
|
int aoffset = TJ.getAlphaOffset(pf);
|
||||||
int ps = TJ.getPixelSize(pf);
|
int ps = TJ.getPixelSize(pf);
|
||||||
int index, row, col, retval = 1;
|
int index, row, col, retval = 1;
|
||||||
int halfway = 16 * sf.getNum() / sf.getDenom();
|
int halfway = 16 * sf.getNum() / sf.getDenom();
|
||||||
@@ -315,6 +306,9 @@ public class TJUnitTest {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
if (pf == TJ.PF_GRAY)
|
||||||
|
roffset = goffset = boffset = 0;
|
||||||
|
|
||||||
if (pf == TJ.PF_CMYK) {
|
if (pf == TJ.PF_CMYK) {
|
||||||
for (row = 0; row < h; row++) {
|
for (row = 0; row < h; row++) {
|
||||||
for (col = 0; col < w; col++) {
|
for (col = 0; col < w; col++) {
|
||||||
@@ -391,7 +385,7 @@ public class TJUnitTest {
|
|||||||
checkVal255(row, col, a, "A");
|
checkVal255(row, col, a, "A");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("\n" + e.getMessage());
|
System.out.println("\n" + e.getMessage());
|
||||||
retval = 0;
|
retval = 0;
|
||||||
}
|
}
|
||||||
@@ -425,13 +419,13 @@ public class TJUnitTest {
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int checkIntBuf(int[] buf, int w, int pitch, int h, int pf,
|
static int checkIntBuf(int[] buf, int w, int pitch, int h, int pf,
|
||||||
int subsamp, TJScalingFactor sf, int flags)
|
int subsamp, TJScalingFactor sf, int flags)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
int rshift = TJ.getRedOffset(pf) * 8;
|
int rshift = TJ.getRedOffset(pf) * 8;
|
||||||
int gshift = TJ.getGreenOffset(pf) * 8;
|
int gshift = TJ.getGreenOffset(pf) * 8;
|
||||||
int bshift = TJ.getBlueOffset(pf) * 8;
|
int bshift = TJ.getBlueOffset(pf) * 8;
|
||||||
int ashift = alphaOffset[pf] * 8;
|
int ashift = TJ.getAlphaOffset(pf) * 8;
|
||||||
int index, row, col, retval = 1;
|
int index, row, col, retval = 1;
|
||||||
int halfway = 16 * sf.getNum() / sf.getDenom();
|
int halfway = 16 * sf.getNum() / sf.getDenom();
|
||||||
int blockSize = 8 * sf.getNum() / sf.getDenom();
|
int blockSize = 8 * sf.getNum() / sf.getDenom();
|
||||||
@@ -481,7 +475,7 @@ public class TJUnitTest {
|
|||||||
checkVal255(row, col, a, "A");
|
checkVal255(row, col, a, "A");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("\n" + e.getMessage());
|
System.out.println("\n" + e.getMessage());
|
||||||
retval = 0;
|
retval = 0;
|
||||||
}
|
}
|
||||||
@@ -503,7 +497,7 @@ public class TJUnitTest {
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int checkImg(BufferedImage img, int pf, int subsamp,
|
static int checkImg(BufferedImage img, int pf, int subsamp,
|
||||||
TJScalingFactor sf, int flags) throws Exception {
|
TJScalingFactor sf, int flags) throws Exception {
|
||||||
WritableRaster wr = img.getRaster();
|
WritableRaster wr = img.getRaster();
|
||||||
int imgType = img.getType();
|
int imgType = img.getType();
|
||||||
@@ -528,18 +522,17 @@ public class TJUnitTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int PAD(int v, int p) {
|
static int pad(int v, int p) {
|
||||||
return ((v + (p) - 1) & (~((p) - 1)));
|
return ((v + (p) - 1) & (~((p) - 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int checkBufYUV(byte[] buf, int size, int w, int h,
|
static int checkBufYUV(byte[] buf, int size, int w, int h, int subsamp,
|
||||||
int subsamp, TJScalingFactor sf)
|
TJScalingFactor sf) throws Exception {
|
||||||
throws Exception {
|
|
||||||
int row, col;
|
int row, col;
|
||||||
int hsf = TJ.getMCUWidth(subsamp) / 8, vsf = TJ.getMCUHeight(subsamp) / 8;
|
int hsf = TJ.getMCUWidth(subsamp) / 8, vsf = TJ.getMCUHeight(subsamp) / 8;
|
||||||
int pw = PAD(w, hsf), ph = PAD(h, vsf);
|
int pw = pad(w, hsf), ph = pad(h, vsf);
|
||||||
int cw = pw / hsf, ch = ph / vsf;
|
int cw = pw / hsf, ch = ph / vsf;
|
||||||
int ypitch = PAD(pw, pad), uvpitch = PAD(cw, pad);
|
int ypitch = pad(pw, pad), uvpitch = pad(cw, pad);
|
||||||
int retval = 1;
|
int retval = 1;
|
||||||
int correctsize = ypitch * ph +
|
int correctsize = ypitch * ph +
|
||||||
(subsamp == TJ.SAMP_GRAY ? 0 : uvpitch * ch * 2);
|
(subsamp == TJ.SAMP_GRAY ? 0 : uvpitch * ch * 2);
|
||||||
@@ -588,7 +581,7 @@ public class TJUnitTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("\n" + e.getMessage());
|
System.out.println("\n" + e.getMessage());
|
||||||
retval = 0;
|
retval = 0;
|
||||||
}
|
}
|
||||||
@@ -625,17 +618,17 @@ public class TJUnitTest {
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void writeJPEG(byte[] jpegBuf, int jpegBufSize,
|
static void writeJPEG(byte[] jpegBuf, int jpegBufSize, String filename)
|
||||||
String filename) throws Exception {
|
throws Exception {
|
||||||
File file = new File(filename);
|
File file = new File(filename);
|
||||||
FileOutputStream fos = new FileOutputStream(file);
|
FileOutputStream fos = new FileOutputStream(file);
|
||||||
fos.write(jpegBuf, 0, jpegBufSize);
|
fos.write(jpegBuf, 0, jpegBufSize);
|
||||||
fos.close();
|
fos.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int compTest(TJCompressor tjc, byte[] dstBuf, int w,
|
static int compTest(TJCompressor tjc, byte[] dstBuf, int w, int h, int pf,
|
||||||
int h, int pf, String baseName, int subsamp,
|
String baseName, int subsamp, int jpegQual, int flags)
|
||||||
int jpegQual, int flags) throws Exception {
|
throws Exception {
|
||||||
String tempStr;
|
String tempStr;
|
||||||
byte[] srcBuf = null;
|
byte[] srcBuf = null;
|
||||||
BufferedImage img = null;
|
BufferedImage img = null;
|
||||||
@@ -648,9 +641,9 @@ public class TJUnitTest {
|
|||||||
if (bi) {
|
if (bi) {
|
||||||
pf = biTypePF(imgType);
|
pf = biTypePF(imgType);
|
||||||
pfStr = biTypeStr(imgType);
|
pfStr = biTypeStr(imgType);
|
||||||
pfStrLong = pfStr + " (" + pixFormatStr[pf] + ")";
|
pfStrLong = pfStr + " (" + PIXFORMATSTR[pf] + ")";
|
||||||
} else {
|
} else {
|
||||||
pfStr = pixFormatStr[pf];
|
pfStr = PIXFORMATSTR[pf];
|
||||||
pfStrLong = pfStr;
|
pfStrLong = pfStr;
|
||||||
}
|
}
|
||||||
ps = TJ.getPixelSize(pf);
|
ps = TJ.getPixelSize(pf);
|
||||||
@@ -659,7 +652,7 @@ public class TJUnitTest {
|
|||||||
img = new BufferedImage(w, h, imgType);
|
img = new BufferedImage(w, h, imgType);
|
||||||
initImg(img, pf, flags);
|
initImg(img, pf, flags);
|
||||||
tempStr = baseName + "_enc_" + pfStr + "_" + buStr + "_" +
|
tempStr = baseName + "_enc_" + pfStr + "_" + buStr + "_" +
|
||||||
subName[subsamp] + "_Q" + jpegQual + ".png";
|
SUBNAME[subsamp] + "_Q" + jpegQual + ".png";
|
||||||
File file = new File(tempStr);
|
File file = new File(tempStr);
|
||||||
ImageIO.write(img, "png", file);
|
ImageIO.write(img, "png", file);
|
||||||
tjc.setSourceImage(img, 0, 0, 0, 0);
|
tjc.setSourceImage(img, 0, 0, 0, 0);
|
||||||
@@ -674,7 +667,7 @@ public class TJUnitTest {
|
|||||||
tjc.setJPEGQuality(jpegQual);
|
tjc.setJPEGQuality(jpegQual);
|
||||||
if (doYUV) {
|
if (doYUV) {
|
||||||
System.out.format("%s %s -> YUV %s ... ", pfStrLong, buStrLong,
|
System.out.format("%s %s -> YUV %s ... ", pfStrLong, buStrLong,
|
||||||
subNameLong[subsamp]);
|
SUBNAME_LONG[subsamp]);
|
||||||
YUVImage yuvImage = tjc.encodeYUV(pad, flags);
|
YUVImage yuvImage = tjc.encodeYUV(pad, flags);
|
||||||
if (checkBufYUV(yuvImage.getBuf(), yuvImage.getSize(), w, h, subsamp,
|
if (checkBufYUV(yuvImage.getBuf(), yuvImage.getSize(), w, h, subsamp,
|
||||||
new TJScalingFactor(1, 1)) == 1)
|
new TJScalingFactor(1, 1)) == 1)
|
||||||
@@ -684,28 +677,27 @@ public class TJUnitTest {
|
|||||||
exitStatus = -1;
|
exitStatus = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.format("YUV %s %s -> JPEG Q%d ... ", subNameLong[subsamp],
|
System.out.format("YUV %s %s -> JPEG Q%d ... ", SUBNAME_LONG[subsamp],
|
||||||
buStrLong, jpegQual);
|
buStrLong, jpegQual);
|
||||||
tjc.setSourceImage(yuvImage);
|
tjc.setSourceImage(yuvImage);
|
||||||
} else {
|
} else {
|
||||||
System.out.format("%s %s -> %s Q%d ... ", pfStrLong, buStrLong,
|
System.out.format("%s %s -> %s Q%d ... ", pfStrLong, buStrLong,
|
||||||
subNameLong[subsamp], jpegQual);
|
SUBNAME_LONG[subsamp], jpegQual);
|
||||||
}
|
}
|
||||||
tjc.compress(dstBuf, flags);
|
tjc.compress(dstBuf, flags);
|
||||||
size = tjc.getCompressedSize();
|
size = tjc.getCompressedSize();
|
||||||
|
|
||||||
tempStr = baseName + "_enc_" + pfStr + "_" + buStr + "_" +
|
tempStr = baseName + "_enc_" + pfStr + "_" + buStr + "_" +
|
||||||
subName[subsamp] + "_Q" + jpegQual + ".jpg";
|
SUBNAME[subsamp] + "_Q" + jpegQual + ".jpg";
|
||||||
writeJPEG(dstBuf, size, tempStr);
|
writeJPEG(dstBuf, size, tempStr);
|
||||||
System.out.println("Done.\n Result in " + tempStr);
|
System.out.println("Done.\n Result in " + tempStr);
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void decompTest(TJDecompressor tjd, byte[] jpegBuf,
|
static void decompTest(TJDecompressor tjd, byte[] jpegBuf, int jpegSize,
|
||||||
int jpegSize, int w, int h, int pf,
|
int w, int h, int pf, String baseName, int subsamp,
|
||||||
String baseName, int subsamp, int flags,
|
int flags, TJScalingFactor sf) throws Exception {
|
||||||
TJScalingFactor sf) throws Exception {
|
|
||||||
String pfStr, pfStrLong, tempStr;
|
String pfStr, pfStrLong, tempStr;
|
||||||
String buStrLong = (flags & TJ.FLAG_BOTTOMUP) != 0 ?
|
String buStrLong = (flags & TJ.FLAG_BOTTOMUP) != 0 ?
|
||||||
"Bottom-Up" : "Top-Down ";
|
"Bottom-Up" : "Top-Down ";
|
||||||
@@ -718,9 +710,9 @@ public class TJUnitTest {
|
|||||||
if (bi) {
|
if (bi) {
|
||||||
pf = biTypePF(imgType);
|
pf = biTypePF(imgType);
|
||||||
pfStr = biTypeStr(imgType);
|
pfStr = biTypeStr(imgType);
|
||||||
pfStrLong = pfStr + " (" + pixFormatStr[pf] + ")";
|
pfStrLong = pfStr + " (" + PIXFORMATSTR[pf] + ")";
|
||||||
} else {
|
} else {
|
||||||
pfStr = pixFormatStr[pf];
|
pfStr = PIXFORMATSTR[pf];
|
||||||
pfStrLong = pfStr;
|
pfStrLong = pfStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -737,8 +729,8 @@ public class TJUnitTest {
|
|||||||
throw new Exception("Scaled size mismatch");
|
throw new Exception("Scaled size mismatch");
|
||||||
|
|
||||||
if (doYUV) {
|
if (doYUV) {
|
||||||
System.out.format("JPEG -> YUV %s ", subNameLong[subsamp]);
|
System.out.format("JPEG -> YUV %s ", SUBNAME_LONG[subsamp]);
|
||||||
if(!sf.isOne())
|
if (!sf.isOne())
|
||||||
System.out.format("%d/%d ... ", sf.getNum(), sf.getDenom());
|
System.out.format("%d/%d ... ", sf.getNum(), sf.getDenom());
|
||||||
else System.out.print("... ");
|
else System.out.print("... ");
|
||||||
YUVImage yuvImage = tjd.decompressToYUV(scaledWidth, pad, scaledHeight,
|
YUVImage yuvImage = tjd.decompressToYUV(scaledWidth, pad, scaledHeight,
|
||||||
@@ -750,12 +742,12 @@ public class TJUnitTest {
|
|||||||
System.out.print("FAILED!\n"); exitStatus = -1;
|
System.out.print("FAILED!\n"); exitStatus = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.format("YUV %s -> %s %s ... ", subNameLong[subsamp],
|
System.out.format("YUV %s -> %s %s ... ", SUBNAME_LONG[subsamp],
|
||||||
pfStrLong, buStrLong);
|
pfStrLong, buStrLong);
|
||||||
tjd.setSourceImage(yuvImage);
|
tjd.setSourceImage(yuvImage);
|
||||||
} else {
|
} else {
|
||||||
System.out.format("JPEG -> %s %s ", pfStrLong, buStrLong);
|
System.out.format("JPEG -> %s %s ", pfStrLong, buStrLong);
|
||||||
if(!sf.isOne())
|
if (!sf.isOne())
|
||||||
System.out.format("%d/%d ... ", sf.getNum(), sf.getDenom());
|
System.out.format("%d/%d ... ", sf.getNum(), sf.getDenom());
|
||||||
else System.out.print("... ");
|
else System.out.print("... ");
|
||||||
}
|
}
|
||||||
@@ -767,7 +759,7 @@ public class TJUnitTest {
|
|||||||
if (bi) {
|
if (bi) {
|
||||||
tempStr = baseName + "_dec_" + pfStr + "_" +
|
tempStr = baseName + "_dec_" + pfStr + "_" +
|
||||||
(((flags & TJ.FLAG_BOTTOMUP) != 0) ? "BU" : "TD") + "_" +
|
(((flags & TJ.FLAG_BOTTOMUP) != 0) ? "BU" : "TD") + "_" +
|
||||||
subName[subsamp] + "_" +
|
SUBNAME[subsamp] + "_" +
|
||||||
(double)sf.getNum() / (double)sf.getDenom() + "x" + ".png";
|
(double)sf.getNum() / (double)sf.getDenom() + "x" + ".png";
|
||||||
File file = new File(tempStr);
|
File file = new File(tempStr);
|
||||||
ImageIO.write(img, "png", file);
|
ImageIO.write(img, "png", file);
|
||||||
@@ -784,9 +776,8 @@ public class TJUnitTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void decompTest(TJDecompressor tjd, byte[] jpegBuf,
|
static void decompTest(TJDecompressor tjd, byte[] jpegBuf, int jpegSize,
|
||||||
int jpegSize, int w, int h, int pf,
|
int w, int h, int pf, String baseName, int subsamp,
|
||||||
String baseName, int subsamp,
|
|
||||||
int flags) throws Exception {
|
int flags) throws Exception {
|
||||||
int i;
|
int i;
|
||||||
TJScalingFactor[] sf = TJ.getScalingFactors();
|
TJScalingFactor[] sf = TJ.getScalingFactors();
|
||||||
@@ -803,8 +794,8 @@ public class TJUnitTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void doTest(int w, int h, int[] formats, int subsamp,
|
static void doTest(int w, int h, int[] formats, int subsamp, String baseName)
|
||||||
String baseName) throws Exception {
|
throws Exception {
|
||||||
TJCompressor tjc = null;
|
TJCompressor tjc = null;
|
||||||
TJDecompressor tjd = null;
|
TJDecompressor tjd = null;
|
||||||
int size;
|
int size;
|
||||||
@@ -837,7 +828,7 @@ public class TJUnitTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.print("--------------------\n\n");
|
System.out.print("--------------------\n\n");
|
||||||
} catch(Exception e) {
|
} catch (Exception e) {
|
||||||
if (tjc != null) tjc.close();
|
if (tjc != null) tjc.close();
|
||||||
if (tjd != null) tjd.close();
|
if (tjd != null) tjd.close();
|
||||||
throw e;
|
throw e;
|
||||||
@@ -846,7 +837,7 @@ public class TJUnitTest {
|
|||||||
if (tjd != null) tjd.close();
|
if (tjd != null) tjd.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void bufSizeTest() throws Exception {
|
static void bufSizeTest() throws Exception {
|
||||||
int w, h, i, subsamp;
|
int w, h, i, subsamp;
|
||||||
byte[] srcBuf, dstBuf = null;
|
byte[] srcBuf, dstBuf = null;
|
||||||
YUVImage dstImage = null;
|
YUVImage dstImage = null;
|
||||||
@@ -898,7 +889,7 @@ public class TJUnitTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("Done. ");
|
System.out.println("Done. ");
|
||||||
} catch(Exception e) {
|
} catch (Exception e) {
|
||||||
if (tjc != null) tjc.close();
|
if (tjc != null) tjc.close();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
@@ -911,57 +902,56 @@ public class TJUnitTest {
|
|||||||
for (int i = 0; i < argv.length; i++) {
|
for (int i = 0; i < argv.length; i++) {
|
||||||
if (argv[i].equalsIgnoreCase("-yuv"))
|
if (argv[i].equalsIgnoreCase("-yuv"))
|
||||||
doYUV = true;
|
doYUV = true;
|
||||||
if (argv[i].equalsIgnoreCase("-noyuvpad"))
|
else if (argv[i].equalsIgnoreCase("-noyuvpad"))
|
||||||
pad = 1;
|
pad = 1;
|
||||||
if (argv[i].substring(0, 1).equalsIgnoreCase("-h") ||
|
else if (argv[i].equalsIgnoreCase("-bi")) {
|
||||||
argv[i].equalsIgnoreCase("-?"))
|
|
||||||
usage();
|
|
||||||
if (argv[i].equalsIgnoreCase("-bi")) {
|
|
||||||
bi = true;
|
bi = true;
|
||||||
testName = "javabitest";
|
testName = "javabitest";
|
||||||
}
|
} else
|
||||||
|
usage();
|
||||||
}
|
}
|
||||||
if (doYUV)
|
if (doYUV)
|
||||||
_4byteFormats[4] = -1;
|
FORMATS_4BYTE[4] = -1;
|
||||||
doTest(35, 39, bi ? _3byteFormatsBI : _3byteFormats, TJ.SAMP_444,
|
doTest(35, 39, bi ? FORMATS_3BYTEBI : FORMATS_3BYTE, TJ.SAMP_444,
|
||||||
testName);
|
testName);
|
||||||
doTest(39, 41, bi ? _4byteFormatsBI : _4byteFormats, TJ.SAMP_444,
|
doTest(39, 41, bi ? FORMATS_4BYTEBI : FORMATS_4BYTE, TJ.SAMP_444,
|
||||||
testName);
|
testName);
|
||||||
doTest(41, 35, bi ? _3byteFormatsBI : _3byteFormats, TJ.SAMP_422,
|
doTest(41, 35, bi ? FORMATS_3BYTEBI : FORMATS_3BYTE, TJ.SAMP_422,
|
||||||
testName);
|
testName);
|
||||||
doTest(35, 39, bi ? _4byteFormatsBI : _4byteFormats, TJ.SAMP_422,
|
doTest(35, 39, bi ? FORMATS_4BYTEBI : FORMATS_4BYTE, TJ.SAMP_422,
|
||||||
testName);
|
testName);
|
||||||
doTest(39, 41, bi ? _3byteFormatsBI : _3byteFormats, TJ.SAMP_420,
|
doTest(39, 41, bi ? FORMATS_3BYTEBI : FORMATS_3BYTE, TJ.SAMP_420,
|
||||||
testName);
|
testName);
|
||||||
doTest(41, 35, bi ? _4byteFormatsBI : _4byteFormats, TJ.SAMP_420,
|
doTest(41, 35, bi ? FORMATS_4BYTEBI : FORMATS_4BYTE, TJ.SAMP_420,
|
||||||
testName);
|
testName);
|
||||||
doTest(35, 39, bi ? _3byteFormatsBI : _3byteFormats, TJ.SAMP_440,
|
doTest(35, 39, bi ? FORMATS_3BYTEBI : FORMATS_3BYTE, TJ.SAMP_440,
|
||||||
testName);
|
testName);
|
||||||
doTest(39, 41, bi ? _4byteFormatsBI : _4byteFormats, TJ.SAMP_440,
|
doTest(39, 41, bi ? FORMATS_4BYTEBI : FORMATS_4BYTE, TJ.SAMP_440,
|
||||||
testName);
|
testName);
|
||||||
doTest(41, 35, bi ? _3byteFormatsBI : _3byteFormats, TJ.SAMP_411,
|
doTest(41, 35, bi ? FORMATS_3BYTEBI : FORMATS_3BYTE, TJ.SAMP_411,
|
||||||
testName);
|
testName);
|
||||||
doTest(35, 39, bi ? _4byteFormatsBI : _4byteFormats, TJ.SAMP_411,
|
doTest(35, 39, bi ? FORMATS_4BYTEBI : FORMATS_4BYTE, TJ.SAMP_411,
|
||||||
testName);
|
testName);
|
||||||
doTest(39, 41, bi ? onlyGrayBI : onlyGray, TJ.SAMP_GRAY, testName);
|
doTest(39, 41, bi ? FORMATS_GRAYBI : FORMATS_GRAY, TJ.SAMP_GRAY,
|
||||||
doTest(41, 35, bi ? _3byteFormatsBI : _3byteFormats, TJ.SAMP_GRAY,
|
|
||||||
testName);
|
testName);
|
||||||
_4byteFormats[4] = -1;
|
doTest(41, 35, bi ? FORMATS_3BYTEBI : FORMATS_3BYTE, TJ.SAMP_GRAY,
|
||||||
doTest(35, 39, bi ? _4byteFormatsBI : _4byteFormats, TJ.SAMP_GRAY,
|
testName);
|
||||||
|
FORMATS_4BYTE[4] = -1;
|
||||||
|
doTest(35, 39, bi ? FORMATS_4BYTEBI : FORMATS_4BYTE, TJ.SAMP_GRAY,
|
||||||
testName);
|
testName);
|
||||||
if (!bi)
|
if (!bi)
|
||||||
bufSizeTest();
|
bufSizeTest();
|
||||||
if (doYUV && !bi) {
|
if (doYUV && !bi) {
|
||||||
System.out.print("\n--------------------\n\n");
|
System.out.print("\n--------------------\n\n");
|
||||||
doTest(48, 48, onlyRGB, TJ.SAMP_444, "javatest_yuv0");
|
doTest(48, 48, FORMATS_RGB, TJ.SAMP_444, "javatest_yuv0");
|
||||||
doTest(48, 48, onlyRGB, TJ.SAMP_422, "javatest_yuv0");
|
doTest(48, 48, FORMATS_RGB, TJ.SAMP_422, "javatest_yuv0");
|
||||||
doTest(48, 48, onlyRGB, TJ.SAMP_420, "javatest_yuv0");
|
doTest(48, 48, FORMATS_RGB, TJ.SAMP_420, "javatest_yuv0");
|
||||||
doTest(48, 48, onlyRGB, TJ.SAMP_440, "javatest_yuv0");
|
doTest(48, 48, FORMATS_RGB, TJ.SAMP_440, "javatest_yuv0");
|
||||||
doTest(48, 48, onlyRGB, TJ.SAMP_411, "javatest_yuv0");
|
doTest(48, 48, FORMATS_RGB, TJ.SAMP_411, "javatest_yuv0");
|
||||||
doTest(48, 48, onlyRGB, TJ.SAMP_GRAY, "javatest_yuv0");
|
doTest(48, 48, FORMATS_RGB, TJ.SAMP_GRAY, "javatest_yuv0");
|
||||||
doTest(48, 48, onlyGray, TJ.SAMP_GRAY, "javatest_yuv0");
|
doTest(48, 48, FORMATS_GRAY, TJ.SAMP_GRAY, "javatest_yuv0");
|
||||||
}
|
}
|
||||||
} catch(Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
exitStatus = -1;
|
exitStatus = -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,13 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
|
try {
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
parent.document.title="Constant Field Values";
|
parent.document.title="Constant Field Values";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
<noscript>
|
<noscript>
|
||||||
@@ -115,6 +119,20 @@
|
|||||||
<td class="colLast"><code>4</code></td>
|
<td class="colLast"><code>4</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="rowColor">
|
||||||
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.ERR_FATAL">
|
||||||
|
<!-- -->
|
||||||
|
</a><code>public static final int</code></td>
|
||||||
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#ERR_FATAL">ERR_FATAL</a></code></td>
|
||||||
|
<td class="colLast"><code>1</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="altColor">
|
||||||
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.ERR_WARNING">
|
||||||
|
<!-- -->
|
||||||
|
</a><code>public static final int</code></td>
|
||||||
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#ERR_WARNING">ERR_WARNING</a></code></td>
|
||||||
|
<td class="colLast"><code>0</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.FLAG_ACCURATEDCT">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.FLAG_ACCURATEDCT">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a><code>public static final int</code></td>
|
</a><code>public static final int</code></td>
|
||||||
@@ -171,6 +189,20 @@
|
|||||||
<td class="colLast"><code>128</code></td>
|
<td class="colLast"><code>128</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="rowColor">
|
||||||
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.FLAG_PROGRESSIVE">
|
||||||
|
<!-- -->
|
||||||
|
</a><code>public static final int</code></td>
|
||||||
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#FLAG_PROGRESSIVE">FLAG_PROGRESSIVE</a></code></td>
|
||||||
|
<td class="colLast"><code>16384</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="altColor">
|
||||||
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.FLAG_STOPONWARNING">
|
||||||
|
<!-- -->
|
||||||
|
</a><code>public static final int</code></td>
|
||||||
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING">FLAG_STOPONWARNING</a></code></td>
|
||||||
|
<td class="colLast"><code>8192</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.NUMCS">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.NUMCS">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a><code>public static final int</code></td>
|
</a><code>public static final int</code></td>
|
||||||
@@ -178,139 +210,146 @@
|
|||||||
<td class="colLast"><code>5</code></td>
|
<td class="colLast"><code>5</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="altColor">
|
||||||
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.NUMERR">
|
||||||
|
<!-- -->
|
||||||
|
</a><code>public static final int</code></td>
|
||||||
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#NUMERR">NUMERR</a></code></td>
|
||||||
|
<td class="colLast"><code>2</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.NUMPF">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.NUMPF">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a><code>public static final int</code></td>
|
</a><code>public static final int</code></td>
|
||||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#NUMPF">NUMPF</a></code></td>
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#NUMPF">NUMPF</a></code></td>
|
||||||
<td class="colLast"><code>12</code></td>
|
<td class="colLast"><code>12</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.NUMSAMP">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.NUMSAMP">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a><code>public static final int</code></td>
|
</a><code>public static final int</code></td>
|
||||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#NUMSAMP">NUMSAMP</a></code></td>
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#NUMSAMP">NUMSAMP</a></code></td>
|
||||||
<td class="colLast"><code>6</code></td>
|
<td class="colLast"><code>6</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_ABGR">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_ABGR">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a><code>public static final int</code></td>
|
</a><code>public static final int</code></td>
|
||||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_ABGR">PF_ABGR</a></code></td>
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_ABGR">PF_ABGR</a></code></td>
|
||||||
<td class="colLast"><code>9</code></td>
|
<td class="colLast"><code>9</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_ARGB">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_ARGB">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a><code>public static final int</code></td>
|
</a><code>public static final int</code></td>
|
||||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_ARGB">PF_ARGB</a></code></td>
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_ARGB">PF_ARGB</a></code></td>
|
||||||
<td class="colLast"><code>10</code></td>
|
<td class="colLast"><code>10</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_BGR">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_BGR">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a><code>public static final int</code></td>
|
</a><code>public static final int</code></td>
|
||||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_BGR">PF_BGR</a></code></td>
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_BGR">PF_BGR</a></code></td>
|
||||||
<td class="colLast"><code>1</code></td>
|
<td class="colLast"><code>1</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_BGRA">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_BGRA">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a><code>public static final int</code></td>
|
</a><code>public static final int</code></td>
|
||||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_BGRA">PF_BGRA</a></code></td>
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_BGRA">PF_BGRA</a></code></td>
|
||||||
<td class="colLast"><code>8</code></td>
|
<td class="colLast"><code>8</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_BGRX">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_BGRX">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a><code>public static final int</code></td>
|
</a><code>public static final int</code></td>
|
||||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_BGRX">PF_BGRX</a></code></td>
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_BGRX">PF_BGRX</a></code></td>
|
||||||
<td class="colLast"><code>3</code></td>
|
<td class="colLast"><code>3</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_CMYK">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_CMYK">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a><code>public static final int</code></td>
|
</a><code>public static final int</code></td>
|
||||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_CMYK">PF_CMYK</a></code></td>
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_CMYK">PF_CMYK</a></code></td>
|
||||||
<td class="colLast"><code>11</code></td>
|
<td class="colLast"><code>11</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_GRAY">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_GRAY">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a><code>public static final int</code></td>
|
</a><code>public static final int</code></td>
|
||||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_GRAY">PF_GRAY</a></code></td>
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_GRAY">PF_GRAY</a></code></td>
|
||||||
<td class="colLast"><code>6</code></td>
|
<td class="colLast"><code>6</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_RGB">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_RGB">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a><code>public static final int</code></td>
|
</a><code>public static final int</code></td>
|
||||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_RGB">PF_RGB</a></code></td>
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_RGB">PF_RGB</a></code></td>
|
||||||
<td class="colLast"><code>0</code></td>
|
<td class="colLast"><code>0</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_RGBA">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_RGBA">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a><code>public static final int</code></td>
|
</a><code>public static final int</code></td>
|
||||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_RGBA">PF_RGBA</a></code></td>
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_RGBA">PF_RGBA</a></code></td>
|
||||||
<td class="colLast"><code>7</code></td>
|
<td class="colLast"><code>7</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_RGBX">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_RGBX">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a><code>public static final int</code></td>
|
</a><code>public static final int</code></td>
|
||||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_RGBX">PF_RGBX</a></code></td>
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_RGBX">PF_RGBX</a></code></td>
|
||||||
<td class="colLast"><code>2</code></td>
|
<td class="colLast"><code>2</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_XBGR">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_XBGR">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a><code>public static final int</code></td>
|
</a><code>public static final int</code></td>
|
||||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_XBGR">PF_XBGR</a></code></td>
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_XBGR">PF_XBGR</a></code></td>
|
||||||
<td class="colLast"><code>4</code></td>
|
<td class="colLast"><code>4</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_XRGB">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_XRGB">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a><code>public static final int</code></td>
|
</a><code>public static final int</code></td>
|
||||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_XRGB">PF_XRGB</a></code></td>
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_XRGB">PF_XRGB</a></code></td>
|
||||||
<td class="colLast"><code>5</code></td>
|
<td class="colLast"><code>5</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.SAMP_411">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.SAMP_411">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a><code>public static final int</code></td>
|
</a><code>public static final int</code></td>
|
||||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_411">SAMP_411</a></code></td>
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_411">SAMP_411</a></code></td>
|
||||||
<td class="colLast"><code>5</code></td>
|
<td class="colLast"><code>5</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.SAMP_420">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.SAMP_420">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a><code>public static final int</code></td>
|
</a><code>public static final int</code></td>
|
||||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_420">SAMP_420</a></code></td>
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_420">SAMP_420</a></code></td>
|
||||||
<td class="colLast"><code>2</code></td>
|
<td class="colLast"><code>2</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.SAMP_422">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.SAMP_422">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a><code>public static final int</code></td>
|
</a><code>public static final int</code></td>
|
||||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_422">SAMP_422</a></code></td>
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_422">SAMP_422</a></code></td>
|
||||||
<td class="colLast"><code>1</code></td>
|
<td class="colLast"><code>1</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.SAMP_440">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.SAMP_440">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a><code>public static final int</code></td>
|
</a><code>public static final int</code></td>
|
||||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_440">SAMP_440</a></code></td>
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_440">SAMP_440</a></code></td>
|
||||||
<td class="colLast"><code>4</code></td>
|
<td class="colLast"><code>4</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.SAMP_444">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.SAMP_444">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a><code>public static final int</code></td>
|
</a><code>public static final int</code></td>
|
||||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_444">SAMP_444</a></code></td>
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_444">SAMP_444</a></code></td>
|
||||||
<td class="colLast"><code>0</code></td>
|
<td class="colLast"><code>0</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.SAMP_GRAY">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.SAMP_GRAY">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a><code>public static final int</code></td>
|
</a><code>public static final int</code></td>
|
||||||
@@ -393,33 +432,47 @@
|
|||||||
<td class="colLast"><code>2</code></td>
|
<td class="colLast"><code>2</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="rowColor">
|
||||||
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJTransform.OPT_COPYNONE">
|
||||||
|
<!-- -->
|
||||||
|
</a><code>public static final int</code></td>
|
||||||
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJTransform.html#OPT_COPYNONE">OPT_COPYNONE</a></code></td>
|
||||||
|
<td class="colLast"><code>64</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="altColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJTransform.OPT_CROP">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJTransform.OPT_CROP">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a><code>public static final int</code></td>
|
</a><code>public static final int</code></td>
|
||||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJTransform.html#OPT_CROP">OPT_CROP</a></code></td>
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJTransform.html#OPT_CROP">OPT_CROP</a></code></td>
|
||||||
<td class="colLast"><code>4</code></td>
|
<td class="colLast"><code>4</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJTransform.OPT_GRAY">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJTransform.OPT_GRAY">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a><code>public static final int</code></td>
|
</a><code>public static final int</code></td>
|
||||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJTransform.html#OPT_GRAY">OPT_GRAY</a></code></td>
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJTransform.html#OPT_GRAY">OPT_GRAY</a></code></td>
|
||||||
<td class="colLast"><code>8</code></td>
|
<td class="colLast"><code>8</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJTransform.OPT_NOOUTPUT">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJTransform.OPT_NOOUTPUT">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a><code>public static final int</code></td>
|
</a><code>public static final int</code></td>
|
||||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJTransform.html#OPT_NOOUTPUT">OPT_NOOUTPUT</a></code></td>
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJTransform.html#OPT_NOOUTPUT">OPT_NOOUTPUT</a></code></td>
|
||||||
<td class="colLast"><code>16</code></td>
|
<td class="colLast"><code>16</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJTransform.OPT_PERFECT">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJTransform.OPT_PERFECT">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a><code>public static final int</code></td>
|
</a><code>public static final int</code></td>
|
||||||
<td><code><a href="org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT">OPT_PERFECT</a></code></td>
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT">OPT_PERFECT</a></code></td>
|
||||||
<td class="colLast"><code>1</code></td>
|
<td class="colLast"><code>1</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr class="altColor">
|
||||||
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJTransform.OPT_PROGRESSIVE">
|
||||||
|
<!-- -->
|
||||||
|
</a><code>public static final int</code></td>
|
||||||
|
<td><code><a href="org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PROGRESSIVE">OPT_PROGRESSIVE</a></code></td>
|
||||||
|
<td class="colLast"><code>32</code></td>
|
||||||
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJTransform.OPT_TRIM">
|
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJTransform.OPT_TRIM">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
|||||||
@@ -7,9 +7,13 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
|
try {
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
parent.document.title="Deprecated List";
|
parent.document.title="Deprecated List";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
<noscript>
|
<noscript>
|
||||||
|
|||||||
@@ -7,9 +7,13 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
|
try {
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
parent.document.title="API Help";
|
parent.document.title="API Help";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
<noscript>
|
<noscript>
|
||||||
|
|||||||
@@ -7,9 +7,13 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
|
try {
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
parent.document.title="Index";
|
parent.document.title="Index";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
<noscript>
|
<noscript>
|
||||||
@@ -278,6 +282,15 @@
|
|||||||
<div class="block">Returns true or false, depending on whether this instance and
|
<div class="block">Returns true or false, depending on whether this instance and
|
||||||
<code>other</code> have the same numerator and denominator.</div>
|
<code>other</code> have the same numerator and denominator.</div>
|
||||||
</dd>
|
</dd>
|
||||||
|
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#ERR_FATAL">ERR_FATAL</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||||
|
<dd>
|
||||||
|
<div class="block">The error was fatal and non-recoverable.</div>
|
||||||
|
</dd>
|
||||||
|
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#ERR_WARNING">ERR_WARNING</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||||
|
<dd>
|
||||||
|
<div class="block">The error was non-fatal and recoverable, but the image may still be
|
||||||
|
corrupt.</div>
|
||||||
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<a name="_F_">
|
<a name="_F_">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
@@ -324,12 +337,27 @@
|
|||||||
<dd>
|
<dd>
|
||||||
<div class="block"><span class="strong">Deprecated.</span></div>
|
<div class="block"><span class="strong">Deprecated.</span></div>
|
||||||
</dd>
|
</dd>
|
||||||
|
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_PROGRESSIVE">FLAG_PROGRESSIVE</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||||
|
<dd>
|
||||||
|
<div class="block">Use progressive entropy coding in JPEG images generated by compression and
|
||||||
|
transform operations.</div>
|
||||||
|
</dd>
|
||||||
|
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING">FLAG_STOPONWARNING</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||||
|
<dd>
|
||||||
|
<div class="block">Immediately discontinue the current compression/decompression/transform
|
||||||
|
operation if the underlying codec throws a warning (non-fatal error).</div>
|
||||||
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<a name="_G_">
|
<a name="_G_">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a>
|
</a>
|
||||||
<h2 class="title">G</h2>
|
<h2 class="title">G</h2>
|
||||||
<dl>
|
<dl>
|
||||||
|
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#getAlphaOffset(int)">getAlphaOffset(int)</a></span> - Static method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||||
|
<dd>
|
||||||
|
<div class="block">For the given pixel format, returns the number of bytes that the alpha
|
||||||
|
component is offset from the start of the pixel.</div>
|
||||||
|
</dd>
|
||||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#getBlueOffset(int)">getBlueOffset(int)</a></span> - Static method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#getBlueOffset(int)">getBlueOffset(int)</a></span> - Static method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
<div class="block">For the given pixel format, returns the number of bytes that the blue
|
<div class="block">For the given pixel format, returns the number of bytes that the blue
|
||||||
@@ -354,6 +382,11 @@
|
|||||||
<dd>
|
<dd>
|
||||||
<div class="block">Returns denominator</div>
|
<div class="block">Returns denominator</div>
|
||||||
</dd>
|
</dd>
|
||||||
|
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJException.html#getErrorCode()">getErrorCode()</a></span> - Method in exception org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></dt>
|
||||||
|
<dd>
|
||||||
|
<div class="block">Returns a code (one of <a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><code>TJ.ERR_*</code></a>) indicating the severity of the
|
||||||
|
last error.</div>
|
||||||
|
</dd>
|
||||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#getGreenOffset(int)">getGreenOffset(int)</a></span> - Static method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#getGreenOffset(int)">getGreenOffset(int)</a></span> - Static method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
<div class="block">For the given pixel format, returns the number of bytes that the green
|
<div class="block">For the given pixel format, returns the number of bytes that the green
|
||||||
@@ -516,6 +549,10 @@
|
|||||||
<dd>
|
<dd>
|
||||||
<div class="block">The number of JPEG colorspaces</div>
|
<div class="block">The number of JPEG colorspaces</div>
|
||||||
</dd>
|
</dd>
|
||||||
|
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#NUMERR">NUMERR</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||||
|
<dd>
|
||||||
|
<div class="block">The number of error codes</div>
|
||||||
|
</dd>
|
||||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#NUMOP">NUMOP</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#NUMOP">NUMOP</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
<div class="block">The number of lossless transform operations</div>
|
<div class="block">The number of lossless transform operations</div>
|
||||||
@@ -571,6 +608,11 @@
|
|||||||
<dd>
|
<dd>
|
||||||
<div class="block">Flip (mirror) image vertically.</div>
|
<div class="block">Flip (mirror) image vertically.</div>
|
||||||
</dd>
|
</dd>
|
||||||
|
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_COPYNONE">OPT_COPYNONE</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
||||||
|
<dd>
|
||||||
|
<div class="block">This option will prevent <a href="./org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)"><code>TJTransformer.transform()</code></a> from copying any extra markers (including EXIF
|
||||||
|
and ICC profile data) from the source image to the output image.</div>
|
||||||
|
</dd>
|
||||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_CROP">OPT_CROP</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_CROP">OPT_CROP</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
<div class="block">This option will enable lossless cropping.</div>
|
<div class="block">This option will enable lossless cropping.</div>
|
||||||
@@ -590,6 +632,11 @@
|
|||||||
<div class="block">This option will cause <a href="./org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)"><code>TJTransformer.transform()</code></a> to throw an exception if the transform is not
|
<div class="block">This option will cause <a href="./org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)"><code>TJTransformer.transform()</code></a> to throw an exception if the transform is not
|
||||||
perfect.</div>
|
perfect.</div>
|
||||||
</dd>
|
</dd>
|
||||||
|
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PROGRESSIVE">OPT_PROGRESSIVE</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
||||||
|
<dd>
|
||||||
|
<div class="block">This option will enable progressive entropy coding in the output image
|
||||||
|
generated by this particular transform.</div>
|
||||||
|
</dd>
|
||||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_TRIM">OPT_TRIM</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_TRIM">OPT_TRIM</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
<div class="block">This option will discard any partial MCU blocks that cannot be
|
<div class="block">This option will discard any partial MCU blocks that cannot be
|
||||||
@@ -763,8 +810,6 @@
|
|||||||
<dd>
|
<dd>
|
||||||
<div class="block">TurboJPEG utility class (cannot be instantiated)</div>
|
<div class="block">TurboJPEG utility class (cannot be instantiated)</div>
|
||||||
</dd>
|
</dd>
|
||||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#TJ()">TJ()</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
|
||||||
<dd> </dd>
|
|
||||||
<dt><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg"><span class="strong">TJCompressor</span></a> - Class in <a href="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</a></dt>
|
<dt><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg"><span class="strong">TJCompressor</span></a> - Class in <a href="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
<div class="block">TurboJPEG compressor</div>
|
<div class="block">TurboJPEG compressor</div>
|
||||||
@@ -829,6 +874,8 @@
|
|||||||
<dd> </dd>
|
<dd> </dd>
|
||||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJException.html#TJException(java.lang.String)">TJException(String)</a></span> - Constructor for exception org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></dt>
|
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJException.html#TJException(java.lang.String)">TJException(String)</a></span> - Constructor for exception org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></dt>
|
||||||
<dd> </dd>
|
<dd> </dd>
|
||||||
|
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJException.html#TJException(java.lang.String,%20int)">TJException(String, int)</a></span> - Constructor for exception org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></dt>
|
||||||
|
<dd> </dd>
|
||||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJException.html#TJException(java.lang.Throwable)">TJException(Throwable)</a></span> - Constructor for exception org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></dt>
|
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJException.html#TJException(java.lang.Throwable)">TJException(Throwable)</a></span> - Constructor for exception org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></dt>
|
||||||
<dd> </dd>
|
<dd> </dd>
|
||||||
<dt><a href="./org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg"><span class="strong">TJScalingFactor</span></a> - Class in <a href="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</a></dt>
|
<dt><a href="./org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg"><span class="strong">TJScalingFactor</span></a> - Class in <a href="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</a></dt>
|
||||||
@@ -836,7 +883,9 @@
|
|||||||
<div class="block">Fractional scaling factor</div>
|
<div class="block">Fractional scaling factor</div>
|
||||||
</dd>
|
</dd>
|
||||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJScalingFactor.html#TJScalingFactor(int,%20int)">TJScalingFactor(int, int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</a></dt>
|
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJScalingFactor.html#TJScalingFactor(int,%20int)">TJScalingFactor(int, int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</a></dt>
|
||||||
<dd> </dd>
|
<dd>
|
||||||
|
<div class="block">Create a TurboJPEG scaling factor instance.</div>
|
||||||
|
</dd>
|
||||||
<dt><a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><span class="strong">TJTransform</span></a> - Class in <a href="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</a></dt>
|
<dt><a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><span class="strong">TJTransform</span></a> - Class in <a href="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
<div class="block">Lossless transform parameters</div>
|
<div class="block">Lossless transform parameters</div>
|
||||||
|
|||||||
@@ -4,11 +4,12 @@
|
|||||||
<head>
|
<head>
|
||||||
<title>Generated Documentation (Untitled)</title>
|
<title>Generated Documentation (Untitled)</title>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
targetPage = "" + window.location.search;
|
tmpTargetPage = "" + window.location.search;
|
||||||
if (targetPage != "" && targetPage != "undefined")
|
if (tmpTargetPage != "" && tmpTargetPage != "undefined")
|
||||||
targetPage = targetPage.substring(1);
|
tmpTargetPage = tmpTargetPage.substring(1);
|
||||||
if (targetPage.indexOf(":") != -1 || (targetPage != "" && !validURL(targetPage)))
|
if (tmpTargetPage.indexOf(":") != -1 || (tmpTargetPage != "" && !validURL(tmpTargetPage)))
|
||||||
targetPage = "undefined";
|
tmpTargetPage = "undefined";
|
||||||
|
targetPage = tmpTargetPage;
|
||||||
function validURL(url) {
|
function validURL(url) {
|
||||||
try {
|
try {
|
||||||
url = decodeURIComponent(url);
|
url = decodeURIComponent(url);
|
||||||
|
|||||||
@@ -7,9 +7,13 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
|
try {
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
parent.document.title="TJ";
|
parent.document.title="TJ";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
<noscript>
|
<noscript>
|
||||||
@@ -59,13 +63,13 @@
|
|||||||
<li>Summary: </li>
|
<li>Summary: </li>
|
||||||
<li>Nested | </li>
|
<li>Nested | </li>
|
||||||
<li><a href="#field_summary">Field</a> | </li>
|
<li><a href="#field_summary">Field</a> | </li>
|
||||||
<li><a href="#constructor_summary">Constr</a> | </li>
|
<li>Constr | </li>
|
||||||
<li><a href="#method_summary">Method</a></li>
|
<li><a href="#method_summary">Method</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="subNavList">
|
<ul class="subNavList">
|
||||||
<li>Detail: </li>
|
<li>Detail: </li>
|
||||||
<li><a href="#field_detail">Field</a> | </li>
|
<li><a href="#field_detail">Field</a> | </li>
|
||||||
<li><a href="#constructor_detail">Constr</a> | </li>
|
<li>Constr | </li>
|
||||||
<li><a href="#method_detail">Method</a></li>
|
<li><a href="#method_detail">Method</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -145,6 +149,19 @@ extends java.lang.Object</pre>
|
|||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#ERR_FATAL">ERR_FATAL</a></strong></code>
|
||||||
|
<div class="block">The error was fatal and non-recoverable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="altColor">
|
||||||
|
<td class="colFirst"><code>static int</code></td>
|
||||||
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#ERR_WARNING">ERR_WARNING</a></strong></code>
|
||||||
|
<div class="block">The error was non-fatal and recoverable, but the image may still be
|
||||||
|
corrupt.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="rowColor">
|
||||||
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_ACCURATEDCT">FLAG_ACCURATEDCT</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_ACCURATEDCT">FLAG_ACCURATEDCT</a></strong></code>
|
||||||
<div class="block">Use the most accurate DCT/IDCT algorithm available in the underlying
|
<div class="block">Use the most accurate DCT/IDCT algorithm available in the underlying
|
||||||
codec.</div>
|
codec.</div>
|
||||||
@@ -197,125 +214,145 @@ extends java.lang.Object</pre>
|
|||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_PROGRESSIVE">FLAG_PROGRESSIVE</a></strong></code>
|
||||||
|
<div class="block">Use progressive entropy coding in JPEG images generated by compression and
|
||||||
|
transform operations.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="altColor">
|
||||||
|
<td class="colFirst"><code>static int</code></td>
|
||||||
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING">FLAG_STOPONWARNING</a></strong></code>
|
||||||
|
<div class="block">Immediately discontinue the current compression/decompression/transform
|
||||||
|
operation if the underlying codec throws a warning (non-fatal error).</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="rowColor">
|
||||||
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#NUMCS">NUMCS</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#NUMCS">NUMCS</a></strong></code>
|
||||||
<div class="block">The number of JPEG colorspaces</div>
|
<div class="block">The number of JPEG colorspaces</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#NUMERR">NUMERR</a></strong></code>
|
||||||
|
<div class="block">The number of error codes</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="rowColor">
|
||||||
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#NUMPF">NUMPF</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#NUMPF">NUMPF</a></strong></code>
|
||||||
<div class="block">The number of pixel formats</div>
|
<div class="block">The number of pixel formats</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#NUMSAMP">NUMSAMP</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#NUMSAMP">NUMSAMP</a></strong></code>
|
||||||
<div class="block">The number of chrominance subsampling options</div>
|
<div class="block">The number of chrominance subsampling options</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_ABGR">PF_ABGR</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_ABGR">PF_ABGR</a></strong></code>
|
||||||
<div class="block">ABGR pixel format.</div>
|
<div class="block">ABGR pixel format.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_ARGB">PF_ARGB</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_ARGB">PF_ARGB</a></strong></code>
|
||||||
<div class="block">ARGB pixel format.</div>
|
<div class="block">ARGB pixel format.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_BGR">PF_BGR</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_BGR">PF_BGR</a></strong></code>
|
||||||
<div class="block">BGR pixel format.</div>
|
<div class="block">BGR pixel format.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_BGRA">PF_BGRA</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_BGRA">PF_BGRA</a></strong></code>
|
||||||
<div class="block">BGRA pixel format.</div>
|
<div class="block">BGRA pixel format.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_BGRX">PF_BGRX</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_BGRX">PF_BGRX</a></strong></code>
|
||||||
<div class="block">BGRX pixel format.</div>
|
<div class="block">BGRX pixel format.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_CMYK">PF_CMYK</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_CMYK">PF_CMYK</a></strong></code>
|
||||||
<div class="block">CMYK pixel format.</div>
|
<div class="block">CMYK pixel format.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_GRAY">PF_GRAY</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_GRAY">PF_GRAY</a></strong></code>
|
||||||
<div class="block">Grayscale pixel format.</div>
|
<div class="block">Grayscale pixel format.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB">PF_RGB</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB">PF_RGB</a></strong></code>
|
||||||
<div class="block">RGB pixel format.</div>
|
<div class="block">RGB pixel format.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGBA">PF_RGBA</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGBA">PF_RGBA</a></strong></code>
|
||||||
<div class="block">RGBA pixel format.</div>
|
<div class="block">RGBA pixel format.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGBX">PF_RGBX</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGBX">PF_RGBX</a></strong></code>
|
||||||
<div class="block">RGBX pixel format.</div>
|
<div class="block">RGBX pixel format.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_XBGR">PF_XBGR</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_XBGR">PF_XBGR</a></strong></code>
|
||||||
<div class="block">XBGR pixel format.</div>
|
<div class="block">XBGR pixel format.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_XRGB">PF_XRGB</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_XRGB">PF_XRGB</a></strong></code>
|
||||||
<div class="block">XRGB pixel format.</div>
|
<div class="block">XRGB pixel format.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_411">SAMP_411</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_411">SAMP_411</a></strong></code>
|
||||||
<div class="block">4:1:1 chrominance subsampling.</div>
|
<div class="block">4:1:1 chrominance subsampling.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_420">SAMP_420</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_420">SAMP_420</a></strong></code>
|
||||||
<div class="block">4:2:0 chrominance subsampling.</div>
|
<div class="block">4:2:0 chrominance subsampling.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_422">SAMP_422</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_422">SAMP_422</a></strong></code>
|
||||||
<div class="block">4:2:2 chrominance subsampling.</div>
|
<div class="block">4:2:2 chrominance subsampling.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_440">SAMP_440</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_440">SAMP_440</a></strong></code>
|
||||||
<div class="block">4:4:0 chrominance subsampling.</div>
|
<div class="block">4:4:0 chrominance subsampling.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444">SAMP_444</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444">SAMP_444</a></strong></code>
|
||||||
<div class="block">4:4:4 chrominance subsampling (no chrominance subsampling).</div>
|
<div class="block">4:4:4 chrominance subsampling (no chrominance subsampling).</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_GRAY">SAMP_GRAY</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_GRAY">SAMP_GRAY</a></strong></code>
|
||||||
<div class="block">Grayscale.</div>
|
<div class="block">Grayscale.</div>
|
||||||
@@ -324,23 +361,6 @@ extends java.lang.Object</pre>
|
|||||||
</table>
|
</table>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
|
|
||||||
<ul class="blockList">
|
|
||||||
<li class="blockList"><a name="constructor_summary">
|
|
||||||
<!-- -->
|
|
||||||
</a>
|
|
||||||
<h3>Constructor Summary</h3>
|
|
||||||
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
|
|
||||||
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
|
|
||||||
<tr>
|
|
||||||
<th class="colOne" scope="col">Constructor and Description</th>
|
|
||||||
</tr>
|
|
||||||
<tr class="altColor">
|
|
||||||
<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#TJ()">TJ</a></strong>()</code> </td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<!-- ========== METHOD SUMMARY =========== -->
|
<!-- ========== METHOD SUMMARY =========== -->
|
||||||
<ul class="blockList">
|
<ul class="blockList">
|
||||||
<li class="blockList"><a name="method_summary">
|
<li class="blockList"><a name="method_summary">
|
||||||
@@ -384,53 +404,60 @@ extends java.lang.Object</pre>
|
|||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getAlphaOffset(int)">getAlphaOffset</a></strong>(int pixelFormat)</code>
|
||||||
|
<div class="block">For the given pixel format, returns the number of bytes that the alpha
|
||||||
|
component is offset from the start of the pixel.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="altColor">
|
||||||
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getBlueOffset(int)">getBlueOffset</a></strong>(int pixelFormat)</code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getBlueOffset(int)">getBlueOffset</a></strong>(int pixelFormat)</code>
|
||||||
<div class="block">For the given pixel format, returns the number of bytes that the blue
|
<div class="block">For the given pixel format, returns the number of bytes that the blue
|
||||||
component is offset from the start of the pixel.</div>
|
component is offset from the start of the pixel.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getGreenOffset(int)">getGreenOffset</a></strong>(int pixelFormat)</code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getGreenOffset(int)">getGreenOffset</a></strong>(int pixelFormat)</code>
|
||||||
<div class="block">For the given pixel format, returns the number of bytes that the green
|
<div class="block">For the given pixel format, returns the number of bytes that the green
|
||||||
component is offset from the start of the pixel.</div>
|
component is offset from the start of the pixel.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getMCUHeight(int)">getMCUHeight</a></strong>(int subsamp)</code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getMCUHeight(int)">getMCUHeight</a></strong>(int subsamp)</code>
|
||||||
<div class="block">Returns the MCU block height for the given level of chrominance
|
<div class="block">Returns the MCU block height for the given level of chrominance
|
||||||
subsampling.</div>
|
subsampling.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getMCUWidth(int)">getMCUWidth</a></strong>(int subsamp)</code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getMCUWidth(int)">getMCUWidth</a></strong>(int subsamp)</code>
|
||||||
<div class="block">Returns the MCU block width for the given level of chrominance
|
<div class="block">Returns the MCU block width for the given level of chrominance
|
||||||
subsampling.</div>
|
subsampling.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getPixelSize(int)">getPixelSize</a></strong>(int pixelFormat)</code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getPixelSize(int)">getPixelSize</a></strong>(int pixelFormat)</code>
|
||||||
<div class="block">Returns the pixel size (in bytes) for the given pixel format.</div>
|
<div class="block">Returns the pixel size (in bytes) for the given pixel format.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getRedOffset(int)">getRedOffset</a></strong>(int pixelFormat)</code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getRedOffset(int)">getRedOffset</a></strong>(int pixelFormat)</code>
|
||||||
<div class="block">For the given pixel format, returns the number of bytes that the red
|
<div class="block">For the given pixel format, returns the number of bytes that the red
|
||||||
component is offset from the start of the pixel.</div>
|
component is offset from the start of the pixel.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><code>static <a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</a>[]</code></td>
|
<td class="colFirst"><code>static <a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</a>[]</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()">getScalingFactors</a></strong>()</code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()">getScalingFactors</a></strong>()</code>
|
||||||
<div class="block">Returns a list of fractional scaling factors that the JPEG decompressor in
|
<div class="block">Returns a list of fractional scaling factors that the JPEG decompressor in
|
||||||
this implementation of TurboJPEG supports.</div>
|
this implementation of TurboJPEG supports.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeHeight(int,%20int,%20int)">planeHeight</a></strong>(int componentID,
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeHeight(int,%20int,%20int)">planeHeight</a></strong>(int componentID,
|
||||||
int height,
|
int height,
|
||||||
@@ -438,7 +465,7 @@ extends java.lang.Object</pre>
|
|||||||
<div class="block">Returns the plane height of a YUV image plane with the given parameters.</div>
|
<div class="block">Returns the plane height of a YUV image plane with the given parameters.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeSizeYUV(int,%20int,%20int,%20int,%20int)">planeSizeYUV</a></strong>(int componentID,
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeSizeYUV(int,%20int,%20int,%20int,%20int)">planeSizeYUV</a></strong>(int componentID,
|
||||||
int width,
|
int width,
|
||||||
@@ -449,7 +476,7 @@ extends java.lang.Object</pre>
|
|||||||
plane with the given parameters.</div>
|
plane with the given parameters.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeWidth(int,%20int,%20int)">planeWidth</a></strong>(int componentID,
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeWidth(int,%20int,%20int)">planeWidth</a></strong>(int componentID,
|
||||||
int width,
|
int width,
|
||||||
@@ -938,7 +965,7 @@ public static final int FLAG_FORCESSE3</pre>
|
|||||||
<a name="FLAG_ACCURATEDCT">
|
<a name="FLAG_ACCURATEDCT">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a>
|
</a>
|
||||||
<ul class="blockListLast">
|
<ul class="blockList">
|
||||||
<li class="blockList">
|
<li class="blockList">
|
||||||
<h4>FLAG_ACCURATEDCT</h4>
|
<h4>FLAG_ACCURATEDCT</h4>
|
||||||
<pre>public static final int FLAG_ACCURATEDCT</pre>
|
<pre>public static final int FLAG_ACCURATEDCT</pre>
|
||||||
@@ -952,21 +979,76 @@ public static final int FLAG_FORCESSE3</pre>
|
|||||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_ACCURATEDCT">Constant Field Values</a></dd></dl>
|
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_ACCURATEDCT">Constant Field Values</a></dd></dl>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
<a name="FLAG_STOPONWARNING">
|
||||||
</ul>
|
|
||||||
<!-- ========= CONSTRUCTOR DETAIL ======== -->
|
|
||||||
<ul class="blockList">
|
|
||||||
<li class="blockList"><a name="constructor_detail">
|
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a>
|
</a>
|
||||||
<h3>Constructor Detail</h3>
|
<ul class="blockList">
|
||||||
<a name="TJ()">
|
<li class="blockList">
|
||||||
|
<h4>FLAG_STOPONWARNING</h4>
|
||||||
|
<pre>public static final int FLAG_STOPONWARNING</pre>
|
||||||
|
<div class="block">Immediately discontinue the current compression/decompression/transform
|
||||||
|
operation if the underlying codec throws a warning (non-fatal error). The
|
||||||
|
default behavior is to allow the operation to complete unless a fatal
|
||||||
|
error is encountered.
|
||||||
|
<p>
|
||||||
|
NOTE: due to the design of the TurboJPEG Java API, only certain methods
|
||||||
|
(specifically, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><code>TJDecompressor.decompress*()</code></a> methods
|
||||||
|
with a void return type) will complete and leave the output image in a
|
||||||
|
fully recoverable state after a non-fatal error occurs.</div>
|
||||||
|
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_STOPONWARNING">Constant Field Values</a></dd></dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="FLAG_PROGRESSIVE">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>FLAG_PROGRESSIVE</h4>
|
||||||
|
<pre>public static final int FLAG_PROGRESSIVE</pre>
|
||||||
|
<div class="block">Use progressive entropy coding in JPEG images generated by compression and
|
||||||
|
transform operations. Progressive entropy coding will generally improve
|
||||||
|
compression relative to baseline entropy coding (the default), but it will
|
||||||
|
reduce compression and decompression performance considerably.</div>
|
||||||
|
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_PROGRESSIVE">Constant Field Values</a></dd></dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="NUMERR">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>NUMERR</h4>
|
||||||
|
<pre>public static final int NUMERR</pre>
|
||||||
|
<div class="block">The number of error codes</div>
|
||||||
|
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.NUMERR">Constant Field Values</a></dd></dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="ERR_WARNING">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>ERR_WARNING</h4>
|
||||||
|
<pre>public static final int ERR_WARNING</pre>
|
||||||
|
<div class="block">The error was non-fatal and recoverable, but the image may still be
|
||||||
|
corrupt.
|
||||||
|
<p>
|
||||||
|
NOTE: due to the design of the TurboJPEG Java API, only certain methods
|
||||||
|
(specifically, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><code>TJDecompressor.decompress*()</code></a> methods
|
||||||
|
with a void return type) will complete and leave the output image in a
|
||||||
|
fully recoverable state after a non-fatal error occurs.</div>
|
||||||
|
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.ERR_WARNING">Constant Field Values</a></dd></dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="ERR_FATAL">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a>
|
</a>
|
||||||
<ul class="blockListLast">
|
<ul class="blockListLast">
|
||||||
<li class="blockList">
|
<li class="blockList">
|
||||||
<h4>TJ</h4>
|
<h4>ERR_FATAL</h4>
|
||||||
<pre>public TJ()</pre>
|
<pre>public static final int ERR_FATAL</pre>
|
||||||
|
<div class="block">The error was fatal and non-recoverable.</div>
|
||||||
|
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.ERR_FATAL">Constant Field Values</a></dd></dl>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
@@ -1032,7 +1114,8 @@ public static final int FLAG_FORCESSE3</pre>
|
|||||||
then the red component will be
|
then the red component will be
|
||||||
<code>pixel[TJ.getRedOffset(TJ.PF_BGRX)]</code>.</div>
|
<code>pixel[TJ.getRedOffset(TJ.PF_BGRX)]</code>.</div>
|
||||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
|
||||||
<dt><span class="strong">Returns:</span></dt><dd>the red offset for the given pixel format.</dd></dl>
|
<dt><span class="strong">Returns:</span></dt><dd>the red offset for the given pixel format, or -1 if the pixel
|
||||||
|
format does not have a red component.</dd></dl>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<a name="getGreenOffset(int)">
|
<a name="getGreenOffset(int)">
|
||||||
@@ -1048,7 +1131,8 @@ public static final int FLAG_FORCESSE3</pre>
|
|||||||
then the green component will be
|
then the green component will be
|
||||||
<code>pixel[TJ.getGreenOffset(TJ.PF_BGRX)]</code>.</div>
|
<code>pixel[TJ.getGreenOffset(TJ.PF_BGRX)]</code>.</div>
|
||||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
|
||||||
<dt><span class="strong">Returns:</span></dt><dd>the green offset for the given pixel format.</dd></dl>
|
<dt><span class="strong">Returns:</span></dt><dd>the green offset for the given pixel format, or -1 if the pixel
|
||||||
|
format does not have a green component.</dd></dl>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<a name="getBlueOffset(int)">
|
<a name="getBlueOffset(int)">
|
||||||
@@ -1064,7 +1148,25 @@ public static final int FLAG_FORCESSE3</pre>
|
|||||||
then the blue component will be
|
then the blue component will be
|
||||||
<code>pixel[TJ.getBlueOffset(TJ.PF_BGRX)]</code>.</div>
|
<code>pixel[TJ.getBlueOffset(TJ.PF_BGRX)]</code>.</div>
|
||||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
|
||||||
<dt><span class="strong">Returns:</span></dt><dd>the blue offset for the given pixel format.</dd></dl>
|
<dt><span class="strong">Returns:</span></dt><dd>the blue offset for the given pixel format, or -1 if the pixel
|
||||||
|
format does not have a blue component.</dd></dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="getAlphaOffset(int)">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>getAlphaOffset</h4>
|
||||||
|
<pre>public static int getAlphaOffset(int pixelFormat)</pre>
|
||||||
|
<div class="block">For the given pixel format, returns the number of bytes that the alpha
|
||||||
|
component is offset from the start of the pixel. For instance, if a pixel
|
||||||
|
of format <code>TJ.PF_BGRA</code> is stored in <code>char pixel[]</code>,
|
||||||
|
then the alpha component will be
|
||||||
|
<code>pixel[TJ.getAlphaOffset(TJ.PF_BGRA)]</code>.</div>
|
||||||
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
|
||||||
|
<dt><span class="strong">Returns:</span></dt><dd>the alpha offset for the given pixel format, or -1 if the pixel
|
||||||
|
format does not have a alpha component.</dd></dl>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<a name="bufSize(int, int, int)">
|
<a name="bufSize(int, int, int)">
|
||||||
@@ -1236,13 +1338,13 @@ public static int bufSizeYUV(int width,
|
|||||||
<li>Summary: </li>
|
<li>Summary: </li>
|
||||||
<li>Nested | </li>
|
<li>Nested | </li>
|
||||||
<li><a href="#field_summary">Field</a> | </li>
|
<li><a href="#field_summary">Field</a> | </li>
|
||||||
<li><a href="#constructor_summary">Constr</a> | </li>
|
<li>Constr | </li>
|
||||||
<li><a href="#method_summary">Method</a></li>
|
<li><a href="#method_summary">Method</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="subNavList">
|
<ul class="subNavList">
|
||||||
<li>Detail: </li>
|
<li>Detail: </li>
|
||||||
<li><a href="#field_detail">Field</a> | </li>
|
<li><a href="#field_detail">Field</a> | </li>
|
||||||
<li><a href="#constructor_detail">Constr</a> | </li>
|
<li>Constr | </li>
|
||||||
<li><a href="#method_detail">Method</a></li>
|
<li><a href="#method_detail">Method</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,9 +7,13 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
|
try {
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
parent.document.title="TJCompressor";
|
parent.document.title="TJCompressor";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
<noscript>
|
<noscript>
|
||||||
@@ -575,8 +579,8 @@ public void setSourceImage(byte[] srcImage,
|
|||||||
<p>
|
<p>
|
||||||
NOTE: This method has no effect when compressing a JPEG image from a YUV
|
NOTE: This method has no effect when compressing a JPEG image from a YUV
|
||||||
planar source. In that case, the level of chrominance subsampling in
|
planar source. In that case, the level of chrominance subsampling in
|
||||||
the JPEG image is determined by the source. Further, this method has no
|
the JPEG image is determined by the source. Furthermore, this method has
|
||||||
effect when encoding to a pre-allocated <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance. In
|
no effect when encoding to a pre-allocated <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance. In
|
||||||
that case, the level of chrominance subsampling is determined by the
|
that case, the level of chrominance subsampling is determined by the
|
||||||
destination.</div>
|
destination.</div>
|
||||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>newSubsamp</code> - the level of chrominance subsampling to use in
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>newSubsamp</code> - the level of chrominance subsampling to use in
|
||||||
|
|||||||
@@ -7,9 +7,13 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
|
try {
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
parent.document.title="TJCustomFilter";
|
parent.document.title="TJCustomFilter";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
<noscript>
|
<noscript>
|
||||||
|
|||||||
@@ -7,9 +7,13 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
|
try {
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
parent.document.title="TJDecompressor";
|
parent.document.title="TJDecompressor";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
<noscript>
|
<noscript>
|
||||||
@@ -785,7 +789,11 @@ public void setJPEGImage(byte[] jpegImage,
|
|||||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||||
<div class="block">Decompress the JPEG source image or decode the YUV source image associated
|
<div class="block">Decompress the JPEG source image or decode the YUV source image associated
|
||||||
with this decompressor instance and output a grayscale, RGB, or CMYK image
|
with this decompressor instance and output a grayscale, RGB, or CMYK image
|
||||||
to the given destination buffer.</div>
|
to the given destination buffer.
|
||||||
|
<p>
|
||||||
|
NOTE: The output image is fully recoverable if this method throws a
|
||||||
|
non-fatal <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg"><code>TJException</code></a> (unless
|
||||||
|
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING"><code>TJ.FLAG_STOPONWARNING</code></a> is specified.)</div>
|
||||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstBuf</code> - buffer that will receive the decompressed/decoded image.
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstBuf</code> - buffer that will receive the decompressed/decoded image.
|
||||||
If the source image is a JPEG image, then this buffer should normally be
|
If the source image is a JPEG image, then this buffer should normally be
|
||||||
<code>pitch * scaledHeight</code> bytes in size, where
|
<code>pitch * scaledHeight</code> bytes in size, where
|
||||||
@@ -895,7 +903,11 @@ public void decompress(byte[] dstBuf,
|
|||||||
<code>YUVImage</code> instance. This method performs JPEG decompression
|
<code>YUVImage</code> instance. This method performs JPEG decompression
|
||||||
but leaves out the color conversion step, so a planar YUV image is
|
but leaves out the color conversion step, so a planar YUV image is
|
||||||
generated instead of an RGB or grayscale image. This method cannot be
|
generated instead of an RGB or grayscale image. This method cannot be
|
||||||
used to decompress JPEG source images with the CMYK or YCCK colorspace.</div>
|
used to decompress JPEG source images with the CMYK or YCCK colorspace.
|
||||||
|
<p>
|
||||||
|
NOTE: The YUV planar output image is fully recoverable if this method
|
||||||
|
throws a non-fatal <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg"><code>TJException</code></a> (unless
|
||||||
|
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING"><code>TJ.FLAG_STOPONWARNING</code></a> is specified.)</div>
|
||||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstImage</code> - <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance that will receive the YUV planar
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstImage</code> - <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance that will receive the YUV planar
|
||||||
image. The level of subsampling specified in this <code>YUVImage</code>
|
image. The level of subsampling specified in this <code>YUVImage</code>
|
||||||
instance must match that of the JPEG image, and the width and height
|
instance must match that of the JPEG image, and the width and height
|
||||||
@@ -1035,7 +1047,11 @@ public byte[] decompressToYUV(int flags)
|
|||||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||||
<div class="block">Decompress the JPEG source image or decode the YUV source image associated
|
<div class="block">Decompress the JPEG source image or decode the YUV source image associated
|
||||||
with this decompressor instance and output a grayscale, RGB, or CMYK image
|
with this decompressor instance and output a grayscale, RGB, or CMYK image
|
||||||
to the given destination buffer.</div>
|
to the given destination buffer.
|
||||||
|
<p>
|
||||||
|
NOTE: The output image is fully recoverable if this method throws a
|
||||||
|
non-fatal <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg"><code>TJException</code></a> (unless
|
||||||
|
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING"><code>TJ.FLAG_STOPONWARNING</code></a> is specified.)</div>
|
||||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstBuf</code> - buffer that will receive the decompressed/decoded image.
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstBuf</code> - buffer that will receive the decompressed/decoded image.
|
||||||
If the source image is a JPEG image, then this buffer should normally be
|
If the source image is a JPEG image, then this buffer should normally be
|
||||||
<code>stride * scaledHeight</code> pixels in size, where
|
<code>stride * scaledHeight</code> pixels in size, where
|
||||||
@@ -1092,7 +1108,11 @@ public byte[] decompressToYUV(int flags)
|
|||||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||||
<div class="block">Decompress the JPEG source image or decode the YUV source image associated
|
<div class="block">Decompress the JPEG source image or decode the YUV source image associated
|
||||||
with this decompressor instance and output a decompressed/decoded image to
|
with this decompressor instance and output a decompressed/decoded image to
|
||||||
the given <code>BufferedImage</code> instance.</div>
|
the given <code>BufferedImage</code> instance.
|
||||||
|
<p>
|
||||||
|
NOTE: The output image is fully recoverable if this method throws a
|
||||||
|
non-fatal <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg"><code>TJException</code></a> (unless
|
||||||
|
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING"><code>TJ.FLAG_STOPONWARNING</code></a> is specified.)</div>
|
||||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstImage</code> - a <code>BufferedImage</code> instance that will receive
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstImage</code> - a <code>BufferedImage</code> instance that will receive
|
||||||
the decompressed/decoded image. If the source image is a JPEG image, then
|
the decompressed/decoded image. If the source image is a JPEG image, then
|
||||||
the width and height of the <code>BufferedImage</code> instance must match
|
the width and height of the <code>BufferedImage</code> instance must match
|
||||||
|
|||||||
@@ -7,9 +7,13 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
|
try {
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
parent.document.title="TJException";
|
parent.document.title="TJException";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
<noscript>
|
<noscript>
|
||||||
@@ -60,13 +64,13 @@
|
|||||||
<li>Nested | </li>
|
<li>Nested | </li>
|
||||||
<li>Field | </li>
|
<li>Field | </li>
|
||||||
<li><a href="#constructor_summary">Constr</a> | </li>
|
<li><a href="#constructor_summary">Constr</a> | </li>
|
||||||
<li><a href="#methods_inherited_from_class_java.lang.Throwable">Method</a></li>
|
<li><a href="#method_summary">Method</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="subNavList">
|
<ul class="subNavList">
|
||||||
<li>Detail: </li>
|
<li>Detail: </li>
|
||||||
<li>Field | </li>
|
<li>Field | </li>
|
||||||
<li><a href="#constructor_detail">Constr</a> | </li>
|
<li><a href="#constructor_detail">Constr</a> | </li>
|
||||||
<li>Method</li>
|
<li><a href="#method_detail">Method</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<a name="skip-navbar_top">
|
<a name="skip-navbar_top">
|
||||||
@@ -138,10 +142,14 @@ extends java.io.IOException</pre>
|
|||||||
<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJException.html#TJException(java.lang.String)">TJException</a></strong>(java.lang.String message)</code> </td>
|
<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJException.html#TJException(java.lang.String)">TJException</a></strong>(java.lang.String message)</code> </td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="altColor">
|
||||||
|
<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJException.html#TJException(java.lang.String,%20int)">TJException</a></strong>(java.lang.String message,
|
||||||
|
int code)</code> </td>
|
||||||
|
</tr>
|
||||||
|
<tr class="rowColor">
|
||||||
<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJException.html#TJException(java.lang.String,%20java.lang.Throwable)">TJException</a></strong>(java.lang.String message,
|
<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJException.html#TJException(java.lang.String,%20java.lang.Throwable)">TJException</a></strong>(java.lang.String message,
|
||||||
java.lang.Throwable cause)</code> </td>
|
java.lang.Throwable cause)</code> </td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJException.html#TJException(java.lang.Throwable)">TJException</a></strong>(java.lang.Throwable cause)</code> </td>
|
<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJException.html#TJException(java.lang.Throwable)">TJException</a></strong>(java.lang.Throwable cause)</code> </td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -153,6 +161,20 @@ extends java.io.IOException</pre>
|
|||||||
<!-- -->
|
<!-- -->
|
||||||
</a>
|
</a>
|
||||||
<h3>Method Summary</h3>
|
<h3>Method Summary</h3>
|
||||||
|
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
|
||||||
|
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
|
||||||
|
<tr>
|
||||||
|
<th class="colFirst" scope="col">Modifier and Type</th>
|
||||||
|
<th class="colLast" scope="col">Method and Description</th>
|
||||||
|
</tr>
|
||||||
|
<tr class="altColor">
|
||||||
|
<td class="colFirst"><code>int</code></td>
|
||||||
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJException.html#getErrorCode()">getErrorCode</a></strong>()</code>
|
||||||
|
<div class="block">Returns a code (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><code>TJ.ERR_*</code></a>) indicating the severity of the
|
||||||
|
last error.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
<ul class="blockList">
|
<ul class="blockList">
|
||||||
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Throwable">
|
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Throwable">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
@@ -209,6 +231,16 @@ extends java.io.IOException</pre>
|
|||||||
<pre>public TJException(java.lang.String message)</pre>
|
<pre>public TJException(java.lang.String message)</pre>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<a name="TJException(java.lang.String, int)">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>TJException</h4>
|
||||||
|
<pre>public TJException(java.lang.String message,
|
||||||
|
int code)</pre>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
<a name="TJException(java.lang.Throwable)">
|
<a name="TJException(java.lang.Throwable)">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a>
|
</a>
|
||||||
@@ -220,6 +252,27 @@ extends java.io.IOException</pre>
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<!-- ============ METHOD DETAIL ========== -->
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList"><a name="method_detail">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<h3>Method Detail</h3>
|
||||||
|
<a name="getErrorCode()">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockListLast">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>getErrorCode</h4>
|
||||||
|
<pre>public int getErrorCode()</pre>
|
||||||
|
<div class="block">Returns a code (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><code>TJ.ERR_*</code></a>) indicating the severity of the
|
||||||
|
last error.</div>
|
||||||
|
<dl><dt><span class="strong">Returns:</span></dt><dd>a code (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><code>TJ.ERR_*</code></a>) indicating the severity of the
|
||||||
|
last error.</dd></dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -270,13 +323,13 @@ extends java.io.IOException</pre>
|
|||||||
<li>Nested | </li>
|
<li>Nested | </li>
|
||||||
<li>Field | </li>
|
<li>Field | </li>
|
||||||
<li><a href="#constructor_summary">Constr</a> | </li>
|
<li><a href="#constructor_summary">Constr</a> | </li>
|
||||||
<li><a href="#methods_inherited_from_class_java.lang.Throwable">Method</a></li>
|
<li><a href="#method_summary">Method</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="subNavList">
|
<ul class="subNavList">
|
||||||
<li>Detail: </li>
|
<li>Detail: </li>
|
||||||
<li>Field | </li>
|
<li>Field | </li>
|
||||||
<li><a href="#constructor_detail">Constr</a> | </li>
|
<li><a href="#constructor_detail">Constr</a> | </li>
|
||||||
<li>Method</li>
|
<li><a href="#method_detail">Method</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<a name="skip-navbar_bottom">
|
<a name="skip-navbar_bottom">
|
||||||
|
|||||||
@@ -7,9 +7,13 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
|
try {
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
parent.document.title="TJScalingFactor";
|
parent.document.title="TJScalingFactor";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
<noscript>
|
<noscript>
|
||||||
@@ -114,7 +118,9 @@ extends java.lang.Object</pre>
|
|||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="altColor">
|
||||||
<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#TJScalingFactor(int,%20int)">TJScalingFactor</a></strong>(int num,
|
<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#TJScalingFactor(int,%20int)">TJScalingFactor</a></strong>(int num,
|
||||||
int denom)</code> </td>
|
int denom)</code>
|
||||||
|
<div class="block">Create a TurboJPEG scaling factor instance.</div>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</li>
|
</li>
|
||||||
@@ -193,6 +199,8 @@ extends java.lang.Object</pre>
|
|||||||
<h4>TJScalingFactor</h4>
|
<h4>TJScalingFactor</h4>
|
||||||
<pre>public TJScalingFactor(int num,
|
<pre>public TJScalingFactor(int num,
|
||||||
int denom)</pre>
|
int denom)</pre>
|
||||||
|
<div class="block">Create a TurboJPEG scaling factor instance.</div>
|
||||||
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>num</code> - numerator</dd><dd><code>denom</code> - denominator</dd></dl>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
@@ -235,7 +243,8 @@ extends java.lang.Object</pre>
|
|||||||
<div class="block">Returns the scaled value of <code>dimension</code>. This function
|
<div class="block">Returns the scaled value of <code>dimension</code>. This function
|
||||||
performs the integer equivalent of
|
performs the integer equivalent of
|
||||||
<code>ceil(dimension * scalingFactor)</code>.</div>
|
<code>ceil(dimension * scalingFactor)</code>.</div>
|
||||||
<dl><dt><span class="strong">Returns:</span></dt><dd>the scaled value of <code>dimension</code>.</dd></dl>
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dimension</code> - width or height to multiply by this scaling factor</dd>
|
||||||
|
<dt><span class="strong">Returns:</span></dt><dd>the scaled value of <code>dimension</code>.</dd></dl>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<a name="equals(org.libjpegturbo.turbojpeg.TJScalingFactor)">
|
<a name="equals(org.libjpegturbo.turbojpeg.TJScalingFactor)">
|
||||||
@@ -247,7 +256,8 @@ extends java.lang.Object</pre>
|
|||||||
<pre>public boolean equals(<a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</a> other)</pre>
|
<pre>public boolean equals(<a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</a> other)</pre>
|
||||||
<div class="block">Returns true or false, depending on whether this instance and
|
<div class="block">Returns true or false, depending on whether this instance and
|
||||||
<code>other</code> have the same numerator and denominator.</div>
|
<code>other</code> have the same numerator and denominator.</div>
|
||||||
<dl><dt><span class="strong">Returns:</span></dt><dd>true or false, depending on whether this instance and
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>other</code> - the scaling factor against which to compare this one</dd>
|
||||||
|
<dt><span class="strong">Returns:</span></dt><dd>true or false, depending on whether this instance and
|
||||||
<code>other</code> have the same numerator and denominator.</dd></dl>
|
<code>other</code> have the same numerator and denominator.</dd></dl>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -7,9 +7,13 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
|
try {
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
parent.document.title="TJTransform";
|
parent.document.title="TJTransform";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
<noscript>
|
<noscript>
|
||||||
@@ -217,31 +221,45 @@ extends java.awt.Rectangle</pre>
|
|||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_COPYNONE">OPT_COPYNONE</a></strong></code>
|
||||||
|
<div class="block">This option will prevent <a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)"><code>TJTransformer.transform()</code></a> from copying any extra markers (including EXIF
|
||||||
|
and ICC profile data) from the source image to the output image.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="altColor">
|
||||||
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_CROP">OPT_CROP</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_CROP">OPT_CROP</a></strong></code>
|
||||||
<div class="block">This option will enable lossless cropping.</div>
|
<div class="block">This option will enable lossless cropping.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_GRAY">OPT_GRAY</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_GRAY">OPT_GRAY</a></strong></code>
|
||||||
<div class="block">This option will discard the color data in the input image and produce
|
<div class="block">This option will discard the color data in the input image and produce
|
||||||
a grayscale output image.</div>
|
a grayscale output image.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_NOOUTPUT">OPT_NOOUTPUT</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_NOOUTPUT">OPT_NOOUTPUT</a></strong></code>
|
||||||
<div class="block">This option will prevent <a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)"><code>TJTransformer.transform()</code></a> from outputting a JPEG image for this
|
<div class="block">This option will prevent <a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)"><code>TJTransformer.transform()</code></a> from outputting a JPEG image for this
|
||||||
particular transform.</div>
|
particular transform.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT">OPT_PERFECT</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT">OPT_PERFECT</a></strong></code>
|
||||||
<div class="block">This option will cause <a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)"><code>TJTransformer.transform()</code></a> to throw an exception if the transform is not
|
<div class="block">This option will cause <a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)"><code>TJTransformer.transform()</code></a> to throw an exception if the transform is not
|
||||||
perfect.</div>
|
perfect.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr class="altColor">
|
||||||
|
<td class="colFirst"><code>static int</code></td>
|
||||||
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PROGRESSIVE">OPT_PROGRESSIVE</a></strong></code>
|
||||||
|
<div class="block">This option will enable progressive entropy coding in the output image
|
||||||
|
generated by this particular transform.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_TRIM">OPT_TRIM</a></strong></code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_TRIM">OPT_TRIM</a></strong></code>
|
||||||
@@ -548,6 +566,33 @@ extends java.awt.Rectangle</pre>
|
|||||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJTransform.OPT_NOOUTPUT">Constant Field Values</a></dd></dl>
|
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJTransform.OPT_NOOUTPUT">Constant Field Values</a></dd></dl>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<a name="OPT_PROGRESSIVE">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>OPT_PROGRESSIVE</h4>
|
||||||
|
<pre>public static final int OPT_PROGRESSIVE</pre>
|
||||||
|
<div class="block">This option will enable progressive entropy coding in the output image
|
||||||
|
generated by this particular transform. Progressive entropy coding will
|
||||||
|
generally improve compression relative to baseline entropy coding (the
|
||||||
|
default), but it will reduce compression and decompression performance
|
||||||
|
considerably.</div>
|
||||||
|
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJTransform.OPT_PROGRESSIVE">Constant Field Values</a></dd></dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="OPT_COPYNONE">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>OPT_COPYNONE</h4>
|
||||||
|
<pre>public static final int OPT_COPYNONE</pre>
|
||||||
|
<div class="block">This option will prevent <a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)"><code>TJTransformer.transform()</code></a> from copying any extra markers (including EXIF
|
||||||
|
and ICC profile data) from the source image to the output image.</div>
|
||||||
|
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJTransform.OPT_COPYNONE">Constant Field Values</a></dd></dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
<a name="op">
|
<a name="op">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -7,9 +7,13 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
|
try {
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
parent.document.title="TJTransformer";
|
parent.document.title="TJTransformer";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
<noscript>
|
<noscript>
|
||||||
|
|||||||
@@ -7,9 +7,13 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
|
try {
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
parent.document.title="YUVImage";
|
parent.document.title="YUVImage";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
<noscript>
|
<noscript>
|
||||||
|
|||||||
@@ -7,9 +7,13 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
|
try {
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
parent.document.title="org.libjpegturbo.turbojpeg";
|
parent.document.title="org.libjpegturbo.turbojpeg";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
<noscript>
|
<noscript>
|
||||||
|
|||||||
@@ -7,9 +7,13 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
|
try {
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
parent.document.title="org.libjpegturbo.turbojpeg Class Hierarchy";
|
parent.document.title="org.libjpegturbo.turbojpeg Class Hierarchy";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
<noscript>
|
<noscript>
|
||||||
|
|||||||
@@ -7,9 +7,13 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
|
try {
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
parent.document.title="Class Hierarchy";
|
parent.document.title="Class Hierarchy";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
<noscript>
|
<noscript>
|
||||||
|
|||||||
30
java/doc/script.js
Normal file
30
java/doc/script.js
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
function show(type)
|
||||||
|
{
|
||||||
|
count = 0;
|
||||||
|
for (var key in methods) {
|
||||||
|
var row = document.getElementById(key);
|
||||||
|
if ((methods[key] & type) != 0) {
|
||||||
|
row.style.display = '';
|
||||||
|
row.className = (count++ % 2) ? rowColor : altColor;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
row.style.display = 'none';
|
||||||
|
}
|
||||||
|
updateTabs(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateTabs(type)
|
||||||
|
{
|
||||||
|
for (var value in tabs) {
|
||||||
|
var sNode = document.getElementById(tabs[value][0]);
|
||||||
|
var spanNode = sNode.firstChild;
|
||||||
|
if (value == type) {
|
||||||
|
sNode.className = activeTableTab;
|
||||||
|
spanNode.innerHTML = tabs[value][1];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sNode.className = tableTab;
|
||||||
|
spanNode.innerHTML = "<a href=\"javascript:show("+ value + ");\">" + tabs[value][1] + "</a>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,9 +7,13 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
|
try {
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
parent.document.title="Serialized Form";
|
parent.document.title="Serialized Form";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
<noscript>
|
<noscript>
|
||||||
@@ -74,6 +78,19 @@
|
|||||||
<dt>serialVersionUID:</dt>
|
<dt>serialVersionUID:</dt>
|
||||||
<dd>1L</dd>
|
<dd>1L</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList"><a name="serializedForm">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<h3>Serialized Fields</h3>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockListLast">
|
||||||
|
<h4>errorCode</h4>
|
||||||
|
<pre>int errorCode</pre>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="blockList"><a name="org.libjpegturbo.turbojpeg.TJTransform">
|
<li class="blockList"><a name="org.libjpegturbo.turbojpeg.TJTransform">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C)2011-2013 D. R. Commander. All Rights Reserved.
|
* Copyright (C)2011-2013, 2017-2018 D. R. Commander. All Rights Reserved.
|
||||||
* Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
* Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -34,6 +34,7 @@ package org.libjpegturbo.turbojpeg;
|
|||||||
*/
|
*/
|
||||||
public final class TJ {
|
public final class TJ {
|
||||||
|
|
||||||
|
private TJ() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The number of chrominance subsampling options
|
* The number of chrominance subsampling options
|
||||||
@@ -90,10 +91,10 @@ public final class TJ {
|
|||||||
*/
|
*/
|
||||||
public static int getMCUWidth(int subsamp) {
|
public static int getMCUWidth(int subsamp) {
|
||||||
checkSubsampling(subsamp);
|
checkSubsampling(subsamp);
|
||||||
return mcuWidth[subsamp];
|
return MCU_WIDTH[subsamp];
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int[] mcuWidth = {
|
private static final int[] MCU_WIDTH = {
|
||||||
8, 16, 16, 8, 8, 32
|
8, 16, 16, 8, 8, 32
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -110,10 +111,10 @@ public final class TJ {
|
|||||||
*/
|
*/
|
||||||
public static int getMCUHeight(int subsamp) {
|
public static int getMCUHeight(int subsamp) {
|
||||||
checkSubsampling(subsamp);
|
checkSubsampling(subsamp);
|
||||||
return mcuHeight[subsamp];
|
return MCU_HEIGHT[subsamp];
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int[] mcuHeight = {
|
private static final int[] MCU_HEIGHT = {
|
||||||
8, 8, 16, 8, 16, 8
|
8, 8, 16, 8, 16, 8
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -218,10 +219,10 @@ public final class TJ {
|
|||||||
*/
|
*/
|
||||||
public static int getPixelSize(int pixelFormat) {
|
public static int getPixelSize(int pixelFormat) {
|
||||||
checkPixelFormat(pixelFormat);
|
checkPixelFormat(pixelFormat);
|
||||||
return pixelSize[pixelFormat];
|
return PIXEL_SIZE[pixelFormat];
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int[] pixelSize = {
|
private static final int[] PIXEL_SIZE = {
|
||||||
3, 3, 4, 4, 4, 4, 1, 4, 4, 4, 4, 4
|
3, 3, 4, 4, 4, 4, 1, 4, 4, 4, 4, 4
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -235,15 +236,16 @@ public final class TJ {
|
|||||||
*
|
*
|
||||||
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
||||||
*
|
*
|
||||||
* @return the red offset for the given pixel format.
|
* @return the red offset for the given pixel format, or -1 if the pixel
|
||||||
|
* format does not have a red component.
|
||||||
*/
|
*/
|
||||||
public static int getRedOffset(int pixelFormat) {
|
public static int getRedOffset(int pixelFormat) {
|
||||||
checkPixelFormat(pixelFormat);
|
checkPixelFormat(pixelFormat);
|
||||||
return redOffset[pixelFormat];
|
return RED_OFFSET[pixelFormat];
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int[] redOffset = {
|
private static final int[] RED_OFFSET = {
|
||||||
0, 2, 0, 2, 3, 1, 0, 0, 2, 3, 1, -1
|
0, 2, 0, 2, 3, 1, -1, 0, 2, 3, 1, -1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -256,15 +258,16 @@ public final class TJ {
|
|||||||
*
|
*
|
||||||
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
||||||
*
|
*
|
||||||
* @return the green offset for the given pixel format.
|
* @return the green offset for the given pixel format, or -1 if the pixel
|
||||||
|
* format does not have a green component.
|
||||||
*/
|
*/
|
||||||
public static int getGreenOffset(int pixelFormat) {
|
public static int getGreenOffset(int pixelFormat) {
|
||||||
checkPixelFormat(pixelFormat);
|
checkPixelFormat(pixelFormat);
|
||||||
return greenOffset[pixelFormat];
|
return GREEN_OFFSET[pixelFormat];
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int[] greenOffset = {
|
private static final int[] GREEN_OFFSET = {
|
||||||
1, 1, 1, 1, 2, 2, 0, 1, 1, 2, 2, -1
|
1, 1, 1, 1, 2, 2, -1, 1, 1, 2, 2, -1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -277,15 +280,38 @@ public final class TJ {
|
|||||||
*
|
*
|
||||||
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
||||||
*
|
*
|
||||||
* @return the blue offset for the given pixel format.
|
* @return the blue offset for the given pixel format, or -1 if the pixel
|
||||||
|
* format does not have a blue component.
|
||||||
*/
|
*/
|
||||||
public static int getBlueOffset(int pixelFormat) {
|
public static int getBlueOffset(int pixelFormat) {
|
||||||
checkPixelFormat(pixelFormat);
|
checkPixelFormat(pixelFormat);
|
||||||
return blueOffset[pixelFormat];
|
return BLUE_OFFSET[pixelFormat];
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int[] blueOffset = {
|
private static final int[] BLUE_OFFSET = {
|
||||||
2, 0, 2, 0, 1, 3, 0, 2, 0, 1, 3, -1
|
2, 0, 2, 0, 1, 3, -1, 2, 0, 1, 3, -1
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For the given pixel format, returns the number of bytes that the alpha
|
||||||
|
* component is offset from the start of the pixel. For instance, if a pixel
|
||||||
|
* of format <code>TJ.PF_BGRA</code> is stored in <code>char pixel[]</code>,
|
||||||
|
* then the alpha component will be
|
||||||
|
* <code>pixel[TJ.getAlphaOffset(TJ.PF_BGRA)]</code>.
|
||||||
|
*
|
||||||
|
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
||||||
|
*
|
||||||
|
* @return the alpha offset for the given pixel format, or -1 if the pixel
|
||||||
|
* format does not have a alpha component.
|
||||||
|
*/
|
||||||
|
public static int getAlphaOffset(int pixelFormat) {
|
||||||
|
checkPixelFormat(pixelFormat);
|
||||||
|
return ALPHA_OFFSET[pixelFormat];
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final int[] ALPHA_OFFSET = {
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, 3, 3, 0, 0, -1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -316,6 +342,7 @@ public final class TJ {
|
|||||||
* can be compressed from and decompressed to any of the extended RGB pixel
|
* can be compressed from and decompressed to any of the extended RGB pixel
|
||||||
* formats or grayscale, or they can be decompressed to YUV planar images.
|
* formats or grayscale, or they can be decompressed to YUV planar images.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("checkstyle:ConstantName")
|
||||||
public static final int CS_YCbCr = 1;
|
public static final int CS_YCbCr = 1;
|
||||||
/**
|
/**
|
||||||
* Grayscale colorspace. The JPEG image retains only the luminance data (Y
|
* Grayscale colorspace. The JPEG image retains only the luminance data (Y
|
||||||
@@ -350,12 +377,16 @@ public final class TJ {
|
|||||||
*/
|
*/
|
||||||
public static final int FLAG_BOTTOMUP = 2;
|
public static final int FLAG_BOTTOMUP = 2;
|
||||||
|
|
||||||
|
@SuppressWarnings("checkstyle:JavadocVariable")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static final int FLAG_FORCEMMX = 8;
|
public static final int FLAG_FORCEMMX = 8;
|
||||||
|
@SuppressWarnings("checkstyle:JavadocVariable")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static final int FLAG_FORCESSE = 16;
|
public static final int FLAG_FORCESSE = 16;
|
||||||
|
@SuppressWarnings("checkstyle:JavadocVariable")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static final int FLAG_FORCESSE2 = 32;
|
public static final int FLAG_FORCESSE2 = 32;
|
||||||
|
@SuppressWarnings("checkstyle:JavadocVariable")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static final int FLAG_FORCESSE3 = 128;
|
public static final int FLAG_FORCESSE3 = 128;
|
||||||
|
|
||||||
@@ -386,6 +417,45 @@ public final class TJ {
|
|||||||
* been shown to have a larger effect.
|
* been shown to have a larger effect.
|
||||||
*/
|
*/
|
||||||
public static final int FLAG_ACCURATEDCT = 4096;
|
public static final int FLAG_ACCURATEDCT = 4096;
|
||||||
|
/**
|
||||||
|
* Immediately discontinue the current compression/decompression/transform
|
||||||
|
* operation if the underlying codec throws a warning (non-fatal error). The
|
||||||
|
* default behavior is to allow the operation to complete unless a fatal
|
||||||
|
* error is encountered.
|
||||||
|
* <p>
|
||||||
|
* NOTE: due to the design of the TurboJPEG Java API, only certain methods
|
||||||
|
* (specifically, {@link TJDecompressor TJDecompressor.decompress*()} methods
|
||||||
|
* with a void return type) will complete and leave the output image in a
|
||||||
|
* fully recoverable state after a non-fatal error occurs.
|
||||||
|
*/
|
||||||
|
public static final int FLAG_STOPONWARNING = 8192;
|
||||||
|
/**
|
||||||
|
* Use progressive entropy coding in JPEG images generated by compression and
|
||||||
|
* transform operations. Progressive entropy coding will generally improve
|
||||||
|
* compression relative to baseline entropy coding (the default), but it will
|
||||||
|
* reduce compression and decompression performance considerably.
|
||||||
|
*/
|
||||||
|
public static final int FLAG_PROGRESSIVE = 16384;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of error codes
|
||||||
|
*/
|
||||||
|
public static final int NUMERR = 2;
|
||||||
|
/**
|
||||||
|
* The error was non-fatal and recoverable, but the image may still be
|
||||||
|
* corrupt.
|
||||||
|
* <p>
|
||||||
|
* NOTE: due to the design of the TurboJPEG Java API, only certain methods
|
||||||
|
* (specifically, {@link TJDecompressor TJDecompressor.decompress*()} methods
|
||||||
|
* with a void return type) will complete and leave the output image in a
|
||||||
|
* fully recoverable state after a non-fatal error occurs.
|
||||||
|
*/
|
||||||
|
public static final int ERR_WARNING = 0;
|
||||||
|
/**
|
||||||
|
* The error was fatal and non-recoverable.
|
||||||
|
*/
|
||||||
|
public static final int ERR_FATAL = 1;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -427,6 +497,7 @@ public final class TJ {
|
|||||||
/**
|
/**
|
||||||
* @deprecated Use {@link #bufSizeYUV(int, int, int, int)} instead.
|
* @deprecated Use {@link #bufSizeYUV(int, int, int, int)} instead.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("checkstyle:JavadocMethod")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static native int bufSizeYUV(int width, int height, int subsamp);
|
public static native int bufSizeYUV(int width, int height, int subsamp);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C)2011-2015 D. R. Commander. All Rights Reserved.
|
* Copyright (C)2011-2015, 2018, 2020 D. R. Commander. All Rights Reserved.
|
||||||
* Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
* Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -77,6 +77,7 @@ public class TJCompressor implements Closeable {
|
|||||||
* @deprecated Use
|
* @deprecated Use
|
||||||
* {@link #TJCompressor(byte[], int, int, int, int, int, int)} instead.
|
* {@link #TJCompressor(byte[], int, int, int, int, int, int)} instead.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("checkstyle:JavadocMethod")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public TJCompressor(byte[] srcImage, int width, int pitch, int height,
|
public TJCompressor(byte[] srcImage, int width, int pitch, int height,
|
||||||
int pixelFormat) throws TJException {
|
int pixelFormat) throws TJException {
|
||||||
@@ -164,6 +165,7 @@ public class TJCompressor implements Closeable {
|
|||||||
* @deprecated Use
|
* @deprecated Use
|
||||||
* {@link #setSourceImage(byte[], int, int, int, int, int, int)} instead.
|
* {@link #setSourceImage(byte[], int, int, int, int, int, int)} instead.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("checkstyle:JavadocMethod")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void setSourceImage(byte[] srcImage, int width, int pitch,
|
public void setSourceImage(byte[] srcImage, int width, int pitch,
|
||||||
int height, int pixelFormat) throws TJException {
|
int height, int pixelFormat) throws TJException {
|
||||||
@@ -199,7 +201,7 @@ public class TJCompressor implements Closeable {
|
|||||||
throw new IllegalArgumentException("Invalid argument in setSourceImage()");
|
throw new IllegalArgumentException("Invalid argument in setSourceImage()");
|
||||||
srcX = x;
|
srcX = x;
|
||||||
srcY = y;
|
srcY = y;
|
||||||
srcWidth = (width == 0) ? srcImage.getWidth(): width;
|
srcWidth = (width == 0) ? srcImage.getWidth() : width;
|
||||||
srcHeight = (height == 0) ? srcImage.getHeight() : height;
|
srcHeight = (height == 0) ? srcImage.getHeight() : height;
|
||||||
if (x + width > srcImage.getWidth() || y + height > srcImage.getHeight())
|
if (x + width > srcImage.getWidth() || y + height > srcImage.getHeight())
|
||||||
throw new IllegalArgumentException("Compression region exceeds the bounds of the source image");
|
throw new IllegalArgumentException("Compression region exceeds the bounds of the source image");
|
||||||
@@ -208,7 +210,7 @@ public class TJCompressor implements Closeable {
|
|||||||
boolean intPixels = false;
|
boolean intPixels = false;
|
||||||
if (byteOrder == null)
|
if (byteOrder == null)
|
||||||
byteOrder = ByteOrder.nativeOrder();
|
byteOrder = ByteOrder.nativeOrder();
|
||||||
switch(srcImage.getType()) {
|
switch (srcImage.getType()) {
|
||||||
case BufferedImage.TYPE_3BYTE_BGR:
|
case BufferedImage.TYPE_3BYTE_BGR:
|
||||||
pixelFormat = TJ.PF_BGR; break;
|
pixelFormat = TJ.PF_BGR; break;
|
||||||
case BufferedImage.TYPE_4BYTE_ABGR:
|
case BufferedImage.TYPE_4BYTE_ABGR:
|
||||||
@@ -285,8 +287,8 @@ public class TJCompressor implements Closeable {
|
|||||||
* <p>
|
* <p>
|
||||||
* NOTE: This method has no effect when compressing a JPEG image from a YUV
|
* NOTE: This method has no effect when compressing a JPEG image from a YUV
|
||||||
* planar source. In that case, the level of chrominance subsampling in
|
* planar source. In that case, the level of chrominance subsampling in
|
||||||
* the JPEG image is determined by the source. Further, this method has no
|
* the JPEG image is determined by the source. Furthermore, this method has
|
||||||
* effect when encoding to a pre-allocated {@link YUVImage} instance. In
|
* no effect when encoding to a pre-allocated {@link YUVImage} instance. In
|
||||||
* that case, the level of chrominance subsampling is determined by the
|
* that case, the level of chrominance subsampling is determined by the
|
||||||
* destination.
|
* destination.
|
||||||
*
|
*
|
||||||
@@ -375,8 +377,15 @@ public class TJCompressor implements Closeable {
|
|||||||
* #getCompressedSize} to obtain the size of the JPEG image.
|
* #getCompressedSize} to obtain the size of the JPEG image.
|
||||||
*/
|
*/
|
||||||
public byte[] compress(int flags) throws TJException {
|
public byte[] compress(int flags) throws TJException {
|
||||||
|
byte[] buf;
|
||||||
|
if (srcYUVImage != null) {
|
||||||
|
buf = new byte[TJ.bufSize(srcYUVImage.getWidth(),
|
||||||
|
srcYUVImage.getHeight(),
|
||||||
|
srcYUVImage.getSubsamp())];
|
||||||
|
} else {
|
||||||
checkSourceImage();
|
checkSourceImage();
|
||||||
byte[] buf = new byte[TJ.bufSize(srcWidth, srcHeight, subsamp)];
|
buf = new byte[TJ.bufSize(srcWidth, srcHeight, subsamp)];
|
||||||
|
}
|
||||||
compress(buf, flags);
|
compress(buf, flags);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
@@ -386,6 +395,7 @@ public class TJCompressor implements Closeable {
|
|||||||
* {@link #setSourceImage(BufferedImage, int, int, int, int)} and
|
* {@link #setSourceImage(BufferedImage, int, int, int, int)} and
|
||||||
* {@link #compress(byte[], int)} instead.
|
* {@link #compress(byte[], int)} instead.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("checkstyle:JavadocMethod")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void compress(BufferedImage srcImage, byte[] dstBuf, int flags)
|
public void compress(BufferedImage srcImage, byte[] dstBuf, int flags)
|
||||||
throws TJException {
|
throws TJException {
|
||||||
@@ -398,6 +408,7 @@ public class TJCompressor implements Closeable {
|
|||||||
* {@link #setSourceImage(BufferedImage, int, int, int, int)} and
|
* {@link #setSourceImage(BufferedImage, int, int, int, int)} and
|
||||||
* {@link #compress(int)} instead.
|
* {@link #compress(int)} instead.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("checkstyle:JavadocMethod")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public byte[] compress(BufferedImage srcImage, int flags)
|
public byte[] compress(BufferedImage srcImage, int flags)
|
||||||
throws TJException {
|
throws TJException {
|
||||||
@@ -445,14 +456,16 @@ public class TJCompressor implements Closeable {
|
|||||||
/**
|
/**
|
||||||
* @deprecated Use {@link #encodeYUV(YUVImage, int)} instead.
|
* @deprecated Use {@link #encodeYUV(YUVImage, int)} instead.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("checkstyle:JavadocMethod")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void encodeYUV(byte[] dstBuf, int flags) throws TJException {
|
public void encodeYUV(byte[] dstBuf, int flags) throws TJException {
|
||||||
if(dstBuf == null)
|
if (dstBuf == null)
|
||||||
throw new IllegalArgumentException("Invalid argument in encodeYUV()");
|
throw new IllegalArgumentException("Invalid argument in encodeYUV()");
|
||||||
checkSourceImage();
|
checkSourceImage();
|
||||||
checkSubsampling();
|
checkSubsampling();
|
||||||
YUVImage yuvImage = new YUVImage(dstBuf, srcWidth, 4, srcHeight, subsamp);
|
YUVImage dstYUVImage = new YUVImage(dstBuf, srcWidth, 4, srcHeight,
|
||||||
encodeYUV(yuvImage, flags);
|
subsamp);
|
||||||
|
encodeYUV(dstYUVImage, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -475,11 +488,11 @@ public class TJCompressor implements Closeable {
|
|||||||
public YUVImage encodeYUV(int pad, int flags) throws TJException {
|
public YUVImage encodeYUV(int pad, int flags) throws TJException {
|
||||||
checkSourceImage();
|
checkSourceImage();
|
||||||
checkSubsampling();
|
checkSubsampling();
|
||||||
if(pad < 1 || ((pad & (pad - 1)) != 0))
|
if (pad < 1 || ((pad & (pad - 1)) != 0))
|
||||||
throw new IllegalStateException("Invalid argument in encodeYUV()");
|
throw new IllegalStateException("Invalid argument in encodeYUV()");
|
||||||
YUVImage yuvImage = new YUVImage(srcWidth, pad, srcHeight, subsamp);
|
YUVImage dstYUVImage = new YUVImage(srcWidth, pad, srcHeight, subsamp);
|
||||||
encodeYUV(yuvImage, flags);
|
encodeYUV(dstYUVImage, flags);
|
||||||
return yuvImage;
|
return dstYUVImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -506,21 +519,22 @@ public class TJCompressor implements Closeable {
|
|||||||
public YUVImage encodeYUV(int[] strides, int flags) throws TJException {
|
public YUVImage encodeYUV(int[] strides, int flags) throws TJException {
|
||||||
checkSourceImage();
|
checkSourceImage();
|
||||||
checkSubsampling();
|
checkSubsampling();
|
||||||
YUVImage yuvImage = new YUVImage(srcWidth, strides, srcHeight, subsamp);
|
YUVImage dstYUVImage = new YUVImage(srcWidth, strides, srcHeight, subsamp);
|
||||||
encodeYUV(yuvImage, flags);
|
encodeYUV(dstYUVImage, flags);
|
||||||
return yuvImage;
|
return dstYUVImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Use {@link #encodeYUV(int, int)} instead.
|
* @deprecated Use {@link #encodeYUV(int, int)} instead.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("checkstyle:JavadocMethod")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public byte[] encodeYUV(int flags) throws TJException {
|
public byte[] encodeYUV(int flags) throws TJException {
|
||||||
checkSourceImage();
|
checkSourceImage();
|
||||||
checkSubsampling();
|
checkSubsampling();
|
||||||
YUVImage yuvImage = new YUVImage(srcWidth, 4, srcHeight, subsamp);
|
YUVImage dstYUVImage = new YUVImage(srcWidth, 4, srcHeight, subsamp);
|
||||||
encodeYUV(yuvImage, flags);
|
encodeYUV(dstYUVImage, flags);
|
||||||
return yuvImage.getBuf();
|
return dstYUVImage.getBuf();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -528,6 +542,7 @@ public class TJCompressor implements Closeable {
|
|||||||
* {@link #setSourceImage(BufferedImage, int, int, int, int)} and
|
* {@link #setSourceImage(BufferedImage, int, int, int, int)} and
|
||||||
* {@link #encodeYUV(byte[], int)} instead.
|
* {@link #encodeYUV(byte[], int)} instead.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("checkstyle:JavadocMethod")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void encodeYUV(BufferedImage srcImage, byte[] dstBuf, int flags)
|
public void encodeYUV(BufferedImage srcImage, byte[] dstBuf, int flags)
|
||||||
throws TJException {
|
throws TJException {
|
||||||
@@ -540,6 +555,7 @@ public class TJCompressor implements Closeable {
|
|||||||
* {@link #setSourceImage(BufferedImage, int, int, int, int)} and
|
* {@link #setSourceImage(BufferedImage, int, int, int, int)} and
|
||||||
* {@link #encodeYUV(int, int)} instead.
|
* {@link #encodeYUV(int, int)} instead.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("checkstyle:JavadocMethod")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public byte[] encodeYUV(BufferedImage srcImage, int flags)
|
public byte[] encodeYUV(BufferedImage srcImage, int flags)
|
||||||
throws TJException {
|
throws TJException {
|
||||||
@@ -567,11 +583,12 @@ public class TJCompressor implements Closeable {
|
|||||||
destroy();
|
destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("checkstyle:DesignForExtension")
|
||||||
@Override
|
@Override
|
||||||
protected void finalize() throws Throwable {
|
protected void finalize() throws Throwable {
|
||||||
try {
|
try {
|
||||||
close();
|
close();
|
||||||
} catch(TJException e) {
|
} catch (TJException e) {
|
||||||
} finally {
|
} finally {
|
||||||
super.finalize();
|
super.finalize();
|
||||||
}
|
}
|
||||||
@@ -582,44 +599,53 @@ public class TJCompressor implements Closeable {
|
|||||||
private native void destroy() throws TJException;
|
private native void destroy() throws TJException;
|
||||||
|
|
||||||
// JPEG size in bytes is returned
|
// JPEG size in bytes is returned
|
||||||
|
@SuppressWarnings("checkstyle:HiddenField")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
private native int compress(byte[] srcBuf, int width, int pitch,
|
private native int compress(byte[] srcBuf, int width, int pitch,
|
||||||
int height, int pixelFormat, byte[] dstBuf, int jpegSubsamp, int jpegQual,
|
int height, int pixelFormat, byte[] jpegBuf, int jpegSubsamp, int jpegQual,
|
||||||
int flags) throws TJException;
|
int flags) throws TJException;
|
||||||
|
|
||||||
|
@SuppressWarnings("checkstyle:HiddenField")
|
||||||
private native int compress(byte[] srcBuf, int x, int y, int width,
|
private native int compress(byte[] srcBuf, int x, int y, int width,
|
||||||
int pitch, int height, int pixelFormat, byte[] dstBuf, int jpegSubsamp,
|
int pitch, int height, int pixelFormat, byte[] jpegBuf, int jpegSubsamp,
|
||||||
int jpegQual, int flags) throws TJException;
|
int jpegQual, int flags) throws TJException;
|
||||||
|
|
||||||
|
@SuppressWarnings("checkstyle:HiddenField")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
private native int compress(int[] srcBuf, int width, int stride,
|
private native int compress(int[] srcBuf, int width, int stride,
|
||||||
int height, int pixelFormat, byte[] dstBuf, int jpegSubsamp, int jpegQual,
|
int height, int pixelFormat, byte[] jpegBuf, int jpegSubsamp, int jpegQual,
|
||||||
int flags) throws TJException;
|
int flags) throws TJException;
|
||||||
|
|
||||||
|
@SuppressWarnings("checkstyle:HiddenField")
|
||||||
private native int compress(int[] srcBuf, int x, int y, int width,
|
private native int compress(int[] srcBuf, int x, int y, int width,
|
||||||
int stride, int height, int pixelFormat, byte[] dstBuf, int jpegSubsamp,
|
int stride, int height, int pixelFormat, byte[] jpegBuf, int jpegSubsamp,
|
||||||
int jpegQual, int flags) throws TJException;
|
int jpegQual, int flags) throws TJException;
|
||||||
|
|
||||||
|
@SuppressWarnings("checkstyle:HiddenField")
|
||||||
private native int compressFromYUV(byte[][] srcPlanes, int[] srcOffsets,
|
private native int compressFromYUV(byte[][] srcPlanes, int[] srcOffsets,
|
||||||
int width, int[] srcStrides, int height, int subsamp, byte[] dstBuf,
|
int width, int[] srcStrides, int height, int subsamp, byte[] jpegBuf,
|
||||||
int jpegQual, int flags)
|
int jpegQual, int flags)
|
||||||
throws TJException;
|
throws TJException;
|
||||||
|
|
||||||
|
@SuppressWarnings("checkstyle:HiddenField")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
private native void encodeYUV(byte[] srcBuf, int width, int pitch,
|
private native void encodeYUV(byte[] srcBuf, int width, int pitch,
|
||||||
int height, int pixelFormat, byte[] dstBuf, int subsamp, int flags)
|
int height, int pixelFormat, byte[] dstBuf, int subsamp, int flags)
|
||||||
throws TJException;
|
throws TJException;
|
||||||
|
|
||||||
|
@SuppressWarnings("checkstyle:HiddenField")
|
||||||
private native void encodeYUV(byte[] srcBuf, int x, int y, int width,
|
private native void encodeYUV(byte[] srcBuf, int x, int y, int width,
|
||||||
int pitch, int height, int pixelFormat, byte[][] dstPlanes,
|
int pitch, int height, int pixelFormat, byte[][] dstPlanes,
|
||||||
int[] dstOffsets, int[] dstStrides, int subsamp, int flags)
|
int[] dstOffsets, int[] dstStrides, int subsamp, int flags)
|
||||||
throws TJException;
|
throws TJException;
|
||||||
|
|
||||||
|
@SuppressWarnings("checkstyle:HiddenField")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
private native void encodeYUV(int[] srcBuf, int width, int stride,
|
private native void encodeYUV(int[] srcBuf, int width, int stride,
|
||||||
int height, int pixelFormat, byte[] dstBuf, int subsamp, int flags)
|
int height, int pixelFormat, byte[] dstBuf, int subsamp, int flags)
|
||||||
throws TJException;
|
throws TJException;
|
||||||
|
|
||||||
|
@SuppressWarnings("checkstyle:HiddenField")
|
||||||
private native void encodeYUV(int[] srcBuf, int x, int y, int width,
|
private native void encodeYUV(int[] srcBuf, int x, int y, int width,
|
||||||
int srcStride, int height, int pixelFormat, byte[][] dstPlanes,
|
int srcStride, int height, int pixelFormat, byte[][] dstPlanes,
|
||||||
int[] dstOffsets, int[] dstStrides, int subsamp, int flags)
|
int[] dstOffsets, int[] dstStrides, int subsamp, int flags)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C)2011-2015 D. R. Commander. All Rights Reserved.
|
* Copyright (C)2011-2015, 2018 D. R. Commander. All Rights Reserved.
|
||||||
* Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
* Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -82,6 +82,7 @@ public class TJDecompressor implements Closeable {
|
|||||||
* @param yuvImage {@link YUVImage} instance containing a YUV planar
|
* @param yuvImage {@link YUVImage} instance containing a YUV planar
|
||||||
* image to be decoded. This image is not modified.
|
* image to be decoded. This image is not modified.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("checkstyle:HiddenField")
|
||||||
public TJDecompressor(YUVImage yuvImage) throws TJException {
|
public TJDecompressor(YUVImage yuvImage) throws TJException {
|
||||||
init();
|
init();
|
||||||
setSourceImage(yuvImage);
|
setSourceImage(yuvImage);
|
||||||
@@ -109,6 +110,7 @@ public class TJDecompressor implements Closeable {
|
|||||||
/**
|
/**
|
||||||
* @deprecated Use {@link #setSourceImage(byte[], int)} instead.
|
* @deprecated Use {@link #setSourceImage(byte[], int)} instead.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("checkstyle:JavadocMethod")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void setJPEGImage(byte[] jpegImage, int imageSize)
|
public void setJPEGImage(byte[] jpegImage, int imageSize)
|
||||||
throws TJException {
|
throws TJException {
|
||||||
@@ -308,6 +310,10 @@ public class TJDecompressor implements Closeable {
|
|||||||
* Decompress the JPEG source image or decode the YUV source image associated
|
* Decompress the JPEG source image or decode the YUV source image associated
|
||||||
* with this decompressor instance and output a grayscale, RGB, or CMYK image
|
* with this decompressor instance and output a grayscale, RGB, or CMYK image
|
||||||
* to the given destination buffer.
|
* to the given destination buffer.
|
||||||
|
* <p>
|
||||||
|
* NOTE: The output image is fully recoverable if this method throws a
|
||||||
|
* non-fatal {@link TJException} (unless
|
||||||
|
* {@link TJ#FLAG_STOPONWARNING TJ.FLAG_STOPONWARNING} is specified.)
|
||||||
*
|
*
|
||||||
* @param dstBuf buffer that will receive the decompressed/decoded image.
|
* @param dstBuf buffer that will receive the decompressed/decoded image.
|
||||||
* If the source image is a JPEG image, then this buffer should normally be
|
* If the source image is a JPEG image, then this buffer should normally be
|
||||||
@@ -396,6 +402,7 @@ public class TJDecompressor implements Closeable {
|
|||||||
* @deprecated Use
|
* @deprecated Use
|
||||||
* {@link #decompress(byte[], int, int, int, int, int, int, int)} instead.
|
* {@link #decompress(byte[], int, int, int, int, int, int, int)} instead.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("checkstyle:JavadocMethod")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void decompress(byte[] dstBuf, int desiredWidth, int pitch,
|
public void decompress(byte[] dstBuf, int desiredWidth, int pitch,
|
||||||
int desiredHeight, int pixelFormat, int flags)
|
int desiredHeight, int pixelFormat, int flags)
|
||||||
@@ -451,6 +458,10 @@ public class TJDecompressor implements Closeable {
|
|||||||
* but leaves out the color conversion step, so a planar YUV image is
|
* but leaves out the color conversion step, so a planar YUV image is
|
||||||
* generated instead of an RGB or grayscale image. This method cannot be
|
* generated instead of an RGB or grayscale image. This method cannot be
|
||||||
* used to decompress JPEG source images with the CMYK or YCCK colorspace.
|
* used to decompress JPEG source images with the CMYK or YCCK colorspace.
|
||||||
|
* <p>
|
||||||
|
* NOTE: The YUV planar output image is fully recoverable if this method
|
||||||
|
* throws a non-fatal {@link TJException} (unless
|
||||||
|
* {@link TJ#FLAG_STOPONWARNING TJ.FLAG_STOPONWARNING} is specified.)
|
||||||
*
|
*
|
||||||
* @param dstImage {@link YUVImage} instance that will receive the YUV planar
|
* @param dstImage {@link YUVImage} instance that will receive the YUV planar
|
||||||
* image. The level of subsampling specified in this <code>YUVImage</code>
|
* image. The level of subsampling specified in this <code>YUVImage</code>
|
||||||
@@ -486,11 +497,12 @@ public class TJDecompressor implements Closeable {
|
|||||||
/**
|
/**
|
||||||
* @deprecated Use {@link #decompressToYUV(YUVImage, int)} instead.
|
* @deprecated Use {@link #decompressToYUV(YUVImage, int)} instead.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("checkstyle:JavadocMethod")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void decompressToYUV(byte[] dstBuf, int flags) throws TJException {
|
public void decompressToYUV(byte[] dstBuf, int flags) throws TJException {
|
||||||
YUVImage dstImage = new YUVImage(dstBuf, jpegWidth, 4, jpegHeight,
|
YUVImage dstYUVImage = new YUVImage(dstBuf, jpegWidth, 4, jpegHeight,
|
||||||
jpegSubsamp);
|
jpegSubsamp);
|
||||||
decompressToYUV(dstImage, flags);
|
decompressToYUV(dstYUVImage, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -545,10 +557,10 @@ public class TJDecompressor implements Closeable {
|
|||||||
|
|
||||||
int scaledWidth = getScaledWidth(desiredWidth, desiredHeight);
|
int scaledWidth = getScaledWidth(desiredWidth, desiredHeight);
|
||||||
int scaledHeight = getScaledHeight(desiredWidth, desiredHeight);
|
int scaledHeight = getScaledHeight(desiredWidth, desiredHeight);
|
||||||
YUVImage yuvImage = new YUVImage(scaledWidth, null, scaledHeight,
|
YUVImage dstYUVImage = new YUVImage(scaledWidth, null, scaledHeight,
|
||||||
jpegSubsamp);
|
jpegSubsamp);
|
||||||
decompressToYUV(yuvImage, flags);
|
decompressToYUV(dstYUVImage, flags);
|
||||||
return yuvImage;
|
return dstYUVImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -598,26 +610,31 @@ public class TJDecompressor implements Closeable {
|
|||||||
|
|
||||||
int scaledWidth = getScaledWidth(desiredWidth, desiredHeight);
|
int scaledWidth = getScaledWidth(desiredWidth, desiredHeight);
|
||||||
int scaledHeight = getScaledHeight(desiredWidth, desiredHeight);
|
int scaledHeight = getScaledHeight(desiredWidth, desiredHeight);
|
||||||
YUVImage yuvImage = new YUVImage(scaledWidth, pad, scaledHeight,
|
YUVImage dstYUVImage = new YUVImage(scaledWidth, pad, scaledHeight,
|
||||||
jpegSubsamp);
|
jpegSubsamp);
|
||||||
decompressToYUV(yuvImage, flags);
|
decompressToYUV(dstYUVImage, flags);
|
||||||
return yuvImage;
|
return dstYUVImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Use {@link #decompressToYUV(int, int, int, int)} instead.
|
* @deprecated Use {@link #decompressToYUV(int, int, int, int)} instead.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("checkstyle:JavadocMethod")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public byte[] decompressToYUV(int flags) throws TJException {
|
public byte[] decompressToYUV(int flags) throws TJException {
|
||||||
YUVImage dstImage = new YUVImage(jpegWidth, 4, jpegHeight, jpegSubsamp);
|
YUVImage dstYUVImage = new YUVImage(jpegWidth, 4, jpegHeight, jpegSubsamp);
|
||||||
decompressToYUV(dstImage, flags);
|
decompressToYUV(dstYUVImage, flags);
|
||||||
return dstImage.getBuf();
|
return dstYUVImage.getBuf();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decompress the JPEG source image or decode the YUV source image associated
|
* Decompress the JPEG source image or decode the YUV source image associated
|
||||||
* with this decompressor instance and output a grayscale, RGB, or CMYK image
|
* with this decompressor instance and output a grayscale, RGB, or CMYK image
|
||||||
* to the given destination buffer.
|
* to the given destination buffer.
|
||||||
|
* <p>
|
||||||
|
* NOTE: The output image is fully recoverable if this method throws a
|
||||||
|
* non-fatal {@link TJException} (unless
|
||||||
|
* {@link TJ#FLAG_STOPONWARNING TJ.FLAG_STOPONWARNING} is specified.)
|
||||||
*
|
*
|
||||||
* @param dstBuf buffer that will receive the decompressed/decoded image.
|
* @param dstBuf buffer that will receive the decompressed/decoded image.
|
||||||
* If the source image is a JPEG image, then this buffer should normally be
|
* If the source image is a JPEG image, then this buffer should normally be
|
||||||
@@ -699,6 +716,10 @@ public class TJDecompressor implements Closeable {
|
|||||||
* Decompress the JPEG source image or decode the YUV source image associated
|
* Decompress the JPEG source image or decode the YUV source image associated
|
||||||
* with this decompressor instance and output a decompressed/decoded image to
|
* with this decompressor instance and output a decompressed/decoded image to
|
||||||
* the given <code>BufferedImage</code> instance.
|
* the given <code>BufferedImage</code> instance.
|
||||||
|
* <p>
|
||||||
|
* NOTE: The output image is fully recoverable if this method throws a
|
||||||
|
* non-fatal {@link TJException} (unless
|
||||||
|
* {@link TJ#FLAG_STOPONWARNING TJ.FLAG_STOPONWARNING} is specified.)
|
||||||
*
|
*
|
||||||
* @param dstImage a <code>BufferedImage</code> instance that will receive
|
* @param dstImage a <code>BufferedImage</code> instance that will receive
|
||||||
* the decompressed/decoded image. If the source image is a JPEG image, then
|
* the decompressed/decoded image. If the source image is a JPEG image, then
|
||||||
@@ -734,7 +755,7 @@ public class TJDecompressor implements Closeable {
|
|||||||
int pixelFormat; boolean intPixels = false;
|
int pixelFormat; boolean intPixels = false;
|
||||||
if (byteOrder == null)
|
if (byteOrder == null)
|
||||||
byteOrder = ByteOrder.nativeOrder();
|
byteOrder = ByteOrder.nativeOrder();
|
||||||
switch(dstImage.getType()) {
|
switch (dstImage.getType()) {
|
||||||
case BufferedImage.TYPE_3BYTE_BGR:
|
case BufferedImage.TYPE_3BYTE_BGR:
|
||||||
pixelFormat = TJ.PF_BGR; break;
|
pixelFormat = TJ.PF_BGR; break;
|
||||||
case BufferedImage.TYPE_4BYTE_ABGR:
|
case BufferedImage.TYPE_4BYTE_ABGR:
|
||||||
@@ -842,11 +863,12 @@ public class TJDecompressor implements Closeable {
|
|||||||
destroy();
|
destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("checkstyle:DesignForExtension")
|
||||||
@Override
|
@Override
|
||||||
protected void finalize() throws Throwable {
|
protected void finalize() throws Throwable {
|
||||||
try {
|
try {
|
||||||
close();
|
close();
|
||||||
} catch(TJException e) {
|
} catch (TJException e) {
|
||||||
} finally {
|
} finally {
|
||||||
super.finalize();
|
super.finalize();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
* Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
||||||
|
* Copyright (C)2017-2018 D. R. Commander. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@@ -30,24 +31,48 @@ package org.libjpegturbo.turbojpeg;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@SuppressWarnings("checkstyle:JavadocType")
|
||||||
public class TJException extends IOException {
|
public class TJException extends IOException {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@SuppressWarnings("checkstyle:JavadocMethod")
|
||||||
public TJException() {
|
public TJException() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("checkstyle:JavadocMethod")
|
||||||
public TJException(String message, Throwable cause) {
|
public TJException(String message, Throwable cause) {
|
||||||
super(message, cause);
|
super(message, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("checkstyle:JavadocMethod")
|
||||||
public TJException(String message) {
|
public TJException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("checkstyle:JavadocMethod")
|
||||||
|
public TJException(String message, int code) {
|
||||||
|
super(message);
|
||||||
|
if (errorCode >= 0 && errorCode < TJ.NUMERR)
|
||||||
|
errorCode = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("checkstyle:JavadocMethod")
|
||||||
public TJException(Throwable cause) {
|
public TJException(Throwable cause) {
|
||||||
super(cause);
|
super(cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a code (one of {@link TJ TJ.ERR_*}) indicating the severity of the
|
||||||
|
* last error.
|
||||||
|
*
|
||||||
|
* @return a code (one of {@link TJ TJ.ERR_*}) indicating the severity of the
|
||||||
|
* last error.
|
||||||
|
*/
|
||||||
|
public int getErrorCode() {
|
||||||
|
return errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int errorCode = TJ.ERR_FATAL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C)2011-2013 D. R. Commander. All Rights Reserved.
|
* Copyright (C)2011-2013, 2016 D. R. Commander. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@@ -36,19 +36,19 @@ final class TJLoader {
|
|||||||
String os = System.getProperty("os.name").toLowerCase();
|
String os = System.getProperty("os.name").toLowerCase();
|
||||||
if (os.indexOf("mac") >= 0) {
|
if (os.indexOf("mac") >= 0) {
|
||||||
try {
|
try {
|
||||||
System.load("%{__libdir}/libturbojpeg.jnilib");
|
System.load("@CMAKE_INSTALL_FULL_LIBDIR@/libturbojpeg.jnilib");
|
||||||
} catch (java.lang.UnsatisfiedLinkError e2) {
|
} catch (java.lang.UnsatisfiedLinkError e2) {
|
||||||
System.load("/usr/lib/libturbojpeg.jnilib");
|
System.load("/usr/lib/libturbojpeg.jnilib");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
System.load("%{__libdir}/libturbojpeg.so");
|
System.load("@CMAKE_INSTALL_FULL_LIBDIR@/libturbojpeg.so");
|
||||||
} catch (java.lang.UnsatisfiedLinkError e3) {
|
} catch (java.lang.UnsatisfiedLinkError e3) {
|
||||||
String libdir = "%{__libdir}";
|
String libdir = "@CMAKE_INSTALL_FULL_LIBDIR@";
|
||||||
if (libdir.equals("/opt/libjpeg-turbo/lib64")) {
|
if (libdir.equals("@CMAKE_INSTALL_DEFAULT_PREFIX@/lib64")) {
|
||||||
System.load("/opt/libjpeg-turbo/lib32/libturbojpeg.so");
|
System.load("@CMAKE_INSTALL_DEFAULT_PREFIX@/lib32/libturbojpeg.so");
|
||||||
} else if (libdir.equals("/opt/libjpeg-turbo/lib32")) {
|
} else if (libdir.equals("@CMAKE_INSTALL_DEFAULT_PREFIX@/lib32")) {
|
||||||
System.load("/opt/libjpeg-turbo/lib64/libturbojpeg.so");
|
System.load("@CMAKE_INSTALL_DEFAULT_PREFIX@/lib64/libturbojpeg.so");
|
||||||
} else {
|
} else {
|
||||||
throw e3;
|
throw e3;
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C)2011 D. R. Commander. All Rights Reserved.
|
* Copyright (C)2011, 2018 D. R. Commander. All Rights Reserved.
|
||||||
* Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
* Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -34,6 +34,13 @@ package org.libjpegturbo.turbojpeg;
|
|||||||
*/
|
*/
|
||||||
public class TJScalingFactor {
|
public class TJScalingFactor {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a TurboJPEG scaling factor instance.
|
||||||
|
*
|
||||||
|
* @param num numerator
|
||||||
|
* @param denom denominator
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("checkstyle:HiddenField")
|
||||||
public TJScalingFactor(int num, int denom) {
|
public TJScalingFactor(int num, int denom) {
|
||||||
if (num < 1 || denom < 1)
|
if (num < 1 || denom < 1)
|
||||||
throw new IllegalArgumentException("Numerator and denominator must be >= 1");
|
throw new IllegalArgumentException("Numerator and denominator must be >= 1");
|
||||||
@@ -64,6 +71,8 @@ public class TJScalingFactor {
|
|||||||
* performs the integer equivalent of
|
* performs the integer equivalent of
|
||||||
* <code>ceil(dimension * scalingFactor)</code>.
|
* <code>ceil(dimension * scalingFactor)</code>.
|
||||||
*
|
*
|
||||||
|
* @param dimension width or height to multiply by this scaling factor
|
||||||
|
*
|
||||||
* @return the scaled value of <code>dimension</code>.
|
* @return the scaled value of <code>dimension</code>.
|
||||||
*/
|
*/
|
||||||
public int getScaled(int dimension) {
|
public int getScaled(int dimension) {
|
||||||
@@ -74,6 +83,8 @@ public class TJScalingFactor {
|
|||||||
* Returns true or false, depending on whether this instance and
|
* Returns true or false, depending on whether this instance and
|
||||||
* <code>other</code> have the same numerator and denominator.
|
* <code>other</code> have the same numerator and denominator.
|
||||||
*
|
*
|
||||||
|
* @param other the scaling factor against which to compare this one
|
||||||
|
*
|
||||||
* @return true or false, depending on whether this instance and
|
* @return true or false, depending on whether this instance and
|
||||||
* <code>other</code> have the same numerator and denominator.
|
* <code>other</code> have the same numerator and denominator.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C)2011, 2013 D. R. Commander. All Rights Reserved.
|
* Copyright (C)2011, 2013, 2018 D. R. Commander. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@@ -126,6 +126,20 @@ public class TJTransform extends Rectangle {
|
|||||||
* them.
|
* them.
|
||||||
*/
|
*/
|
||||||
public static final int OPT_NOOUTPUT = 16;
|
public static final int OPT_NOOUTPUT = 16;
|
||||||
|
/**
|
||||||
|
* This option will enable progressive entropy coding in the output image
|
||||||
|
* generated by this particular transform. Progressive entropy coding will
|
||||||
|
* generally improve compression relative to baseline entropy coding (the
|
||||||
|
* default), but it will reduce compression and decompression performance
|
||||||
|
* considerably.
|
||||||
|
*/
|
||||||
|
public static final int OPT_PROGRESSIVE = 32;
|
||||||
|
/**
|
||||||
|
* This option will prevent {@link TJTransformer#transform
|
||||||
|
* TJTransformer.transform()} from copying any extra markers (including EXIF
|
||||||
|
* and ICC profile data) from the source image to the output image.
|
||||||
|
*/
|
||||||
|
public static final int OPT_COPYNONE = 64;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -159,6 +173,7 @@ public class TJTransform extends Rectangle {
|
|||||||
* @param cf an instance of an object that implements the {@link
|
* @param cf an instance of an object that implements the {@link
|
||||||
* TJCustomFilter} interface, or null if no custom filter is needed
|
* TJCustomFilter} interface, or null if no custom filter is needed
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("checkstyle:HiddenField")
|
||||||
public TJTransform(int x, int y, int w, int h, int op, int options,
|
public TJTransform(int x, int y, int w, int h, int op, int options,
|
||||||
TJCustomFilter cf) {
|
TJCustomFilter cf) {
|
||||||
super(x, y, w, h);
|
super(x, y, w, h);
|
||||||
@@ -183,6 +198,7 @@ public class TJTransform extends Rectangle {
|
|||||||
* @param cf an instance of an object that implements the {@link
|
* @param cf an instance of an object that implements the {@link
|
||||||
* TJCustomFilter} interface, or null if no custom filter is needed
|
* TJCustomFilter} interface, or null if no custom filter is needed
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("checkstyle:HiddenField")
|
||||||
public TJTransform(Rectangle r, int op, int options,
|
public TJTransform(Rectangle r, int op, int options,
|
||||||
TJCustomFilter cf) {
|
TJCustomFilter cf) {
|
||||||
super(r);
|
super(r);
|
||||||
@@ -194,15 +210,18 @@ public class TJTransform extends Rectangle {
|
|||||||
/**
|
/**
|
||||||
* Transform operation (one of <code>OP_*</code>)
|
* Transform operation (one of <code>OP_*</code>)
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("checkstyle:VisibilityModifier")
|
||||||
public int op = 0;
|
public int op = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform options (bitwise OR of one or more of <code>OPT_*</code>)
|
* Transform options (bitwise OR of one or more of <code>OPT_*</code>)
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("checkstyle:VisibilityModifier")
|
||||||
public int options = 0;
|
public int options = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom filter instance
|
* Custom filter instance
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("checkstyle:VisibilityModifier")
|
||||||
public TJCustomFilter cf = null;
|
public TJCustomFilter cf = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,11 +111,11 @@ public class TJTransformer extends TJDecompressor {
|
|||||||
* which specifies the transform parameters and/or cropping region for the
|
* which specifies the transform parameters and/or cropping region for the
|
||||||
* corresponding transformed output image
|
* corresponding transformed output image
|
||||||
*
|
*
|
||||||
* @return an array of {@link TJDecompressor} instances, each of
|
|
||||||
* which has a transformed JPEG image associated with it.
|
|
||||||
*
|
|
||||||
* @param flags the bitwise OR of one or more of
|
* @param flags the bitwise OR of one or more of
|
||||||
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
|
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
|
||||||
|
*
|
||||||
|
* @return an array of {@link TJDecompressor} instances, each of
|
||||||
|
* which has a transformed JPEG image associated with it.
|
||||||
*/
|
*/
|
||||||
public TJDecompressor[] transform(TJTransform[] transforms, int flags)
|
public TJDecompressor[] transform(TJTransform[] transforms, int flags)
|
||||||
throws TJException {
|
throws TJException {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C)2014 D. R. Commander. All Rights Reserved.
|
* Copyright (C)2014, 2017 D. R. Commander. All Rights Reserved.
|
||||||
* Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
* Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -208,22 +208,25 @@ public class YUVImage {
|
|||||||
* @param subsamp the level of chrominance subsampling used in the YUV
|
* @param subsamp the level of chrominance subsampling used in the YUV
|
||||||
* image (one of {@link TJ#SAMP_444 TJ.SAMP_*})
|
* image (one of {@link TJ#SAMP_444 TJ.SAMP_*})
|
||||||
*/
|
*/
|
||||||
public void setBuf(byte[][] planes, int[] offsets, int width, int strides[],
|
public void setBuf(byte[][] planes, int[] offsets, int width, int[] strides,
|
||||||
int height, int subsamp) {
|
int height, int subsamp) {
|
||||||
setBuf(planes, offsets, width, strides, height, subsamp, false);
|
setBuf(planes, offsets, width, strides, height, subsamp, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setBuf(byte[][] planes, int[] offsets, int width, int strides[],
|
private void setBuf(byte[][] planes, int[] offsets, int width, int[] strides,
|
||||||
int height, int subsamp, boolean alloc) {
|
int height, int subsamp, boolean alloc) {
|
||||||
if ((planes == null && !alloc) || width < 1 || height < 1 || subsamp < 0 ||
|
if ((planes == null && !alloc) || width < 1 || height < 1 || subsamp < 0 ||
|
||||||
subsamp >= TJ.NUMSAMP)
|
subsamp >= TJ.NUMSAMP)
|
||||||
throw new IllegalArgumentException("Invalid argument in YUVImage::setBuf()");
|
throw new IllegalArgumentException("Invalid argument in YUVImage::setBuf()");
|
||||||
|
|
||||||
int nc = (subsamp == TJ.SAMP_GRAY ? 1 : 3);
|
int nc = (subsamp == TJ.SAMP_GRAY ? 1 : 3);
|
||||||
if (planes.length != nc || (offsets != null && offsets.length != nc) ||
|
if ((planes != null && planes.length != nc) ||
|
||||||
|
(offsets != null && offsets.length != nc) ||
|
||||||
(strides != null && strides.length != nc))
|
(strides != null && strides.length != nc))
|
||||||
throw new IllegalArgumentException("YUVImage::setBuf(): planes, offsets, or strides array is the wrong size");
|
throw new IllegalArgumentException("YUVImage::setBuf(): planes, offsets, or strides array is the wrong size");
|
||||||
|
|
||||||
|
if (planes == null)
|
||||||
|
planes = new byte[nc][];
|
||||||
if (offsets == null)
|
if (offsets == null)
|
||||||
offsets = new int[nc];
|
offsets = new int[nc];
|
||||||
if (strides == null)
|
if (strides == null)
|
||||||
@@ -244,9 +247,11 @@ public class YUVImage {
|
|||||||
if (planes[i] == null || offsets[i] < 0)
|
if (planes[i] == null || offsets[i] < 0)
|
||||||
throw new IllegalArgumentException("Invalid argument in YUVImage::setBuf()");
|
throw new IllegalArgumentException("Invalid argument in YUVImage::setBuf()");
|
||||||
if (strides[i] < 0 && offsets[i] - planeSize + pw < 0)
|
if (strides[i] < 0 && offsets[i] - planeSize + pw < 0)
|
||||||
throw new IllegalArgumentException("Stride for plane " + i + " would cause memory to be accessed below plane boundary");
|
throw new IllegalArgumentException("Stride for plane " + i +
|
||||||
|
" would cause memory to be accessed below plane boundary");
|
||||||
if (planes[i].length < offsets[i] + planeSize)
|
if (planes[i].length < offsets[i] + planeSize)
|
||||||
throw new IllegalArgumentException("Image plane " + i + " is not large enough");
|
throw new IllegalArgumentException("Image plane " + i +
|
||||||
|
" is not large enough");
|
||||||
}
|
}
|
||||||
|
|
||||||
yuvPlanes = planes;
|
yuvPlanes = planes;
|
||||||
@@ -291,9 +296,9 @@ public class YUVImage {
|
|||||||
int[] offsets = new int[nc];
|
int[] offsets = new int[nc];
|
||||||
|
|
||||||
planes[0] = yuvImage;
|
planes[0] = yuvImage;
|
||||||
strides[0] = PAD(TJ.planeWidth(0, width, subsamp), pad);
|
strides[0] = pad(TJ.planeWidth(0, width, subsamp), pad);
|
||||||
if (subsamp != TJ.SAMP_GRAY) {
|
if (subsamp != TJ.SAMP_GRAY) {
|
||||||
strides[1] = strides[2] = PAD(TJ.planeWidth(1, width, subsamp), pad);
|
strides[1] = strides[2] = pad(TJ.planeWidth(1, width, subsamp), pad);
|
||||||
planes[1] = planes[2] = yuvImage;
|
planes[1] = planes[2] = yuvImage;
|
||||||
offsets[1] = offsets[0] +
|
offsets[1] = offsets[0] +
|
||||||
strides[0] * TJ.planeHeight(0, height, subsamp);
|
strides[0] * TJ.planeHeight(0, height, subsamp);
|
||||||
@@ -425,7 +430,7 @@ public class YUVImage {
|
|||||||
return TJ.bufSizeYUV(yuvWidth, yuvPad, yuvHeight, yuvSubsamp);
|
return TJ.bufSizeYUV(yuvWidth, yuvPad, yuvHeight, yuvSubsamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int PAD(int v, int p) {
|
private static int pad(int v, int p) {
|
||||||
return (v + p - 1) & (~(p - 1));
|
return (v + p - 1) & (~(p - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
44
jcapimin.c
44
jcapimin.c
@@ -32,7 +32,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize)
|
jpeg_CreateCompress(j_compress_ptr cinfo, int version, size_t structsize)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize)
|
|||||||
ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version);
|
ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version);
|
||||||
if (structsize != sizeof(struct jpeg_compress_struct))
|
if (structsize != sizeof(struct jpeg_compress_struct))
|
||||||
ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE,
|
ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE,
|
||||||
(int) sizeof(struct jpeg_compress_struct), (int) structsize);
|
(int)sizeof(struct jpeg_compress_struct), (int)structsize);
|
||||||
|
|
||||||
/* For debugging purposes, we zero the whole master structure.
|
/* For debugging purposes, we zero the whole master structure.
|
||||||
* But the application has already set the err pointer, and may have set
|
* But the application has already set the err pointer, and may have set
|
||||||
@@ -60,7 +60,7 @@ jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize)
|
|||||||
cinfo->is_decompressor = FALSE;
|
cinfo->is_decompressor = FALSE;
|
||||||
|
|
||||||
/* Initialize a memory manager instance for this object */
|
/* Initialize a memory manager instance for this object */
|
||||||
jinit_memory_mgr((j_common_ptr) cinfo);
|
jinit_memory_mgr((j_common_ptr)cinfo);
|
||||||
|
|
||||||
/* Zero out pointers to permanent structures. */
|
/* Zero out pointers to permanent structures. */
|
||||||
cinfo->progress = NULL;
|
cinfo->progress = NULL;
|
||||||
@@ -84,7 +84,7 @@ jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize)
|
|||||||
/* Must do it here for emit_dqt in case jpeg_write_tables is used */
|
/* Must do it here for emit_dqt in case jpeg_write_tables is used */
|
||||||
cinfo->block_size = DCTSIZE;
|
cinfo->block_size = DCTSIZE;
|
||||||
cinfo->natural_order = jpeg_natural_order;
|
cinfo->natural_order = jpeg_natural_order;
|
||||||
cinfo->lim_Se = DCTSIZE2-1;
|
cinfo->lim_Se = DCTSIZE2 - 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cinfo->script_space = NULL;
|
cinfo->script_space = NULL;
|
||||||
@@ -111,9 +111,9 @@ jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jpeg_destroy_compress (j_compress_ptr cinfo)
|
jpeg_destroy_compress(j_compress_ptr cinfo)
|
||||||
{
|
{
|
||||||
jpeg_destroy((j_common_ptr) cinfo); /* use common routine */
|
jpeg_destroy((j_common_ptr)cinfo); /* use common routine */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -123,9 +123,9 @@ jpeg_destroy_compress (j_compress_ptr cinfo)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jpeg_abort_compress (j_compress_ptr cinfo)
|
jpeg_abort_compress(j_compress_ptr cinfo)
|
||||||
{
|
{
|
||||||
jpeg_abort((j_common_ptr) cinfo); /* use common routine */
|
jpeg_abort((j_common_ptr)cinfo); /* use common routine */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ jpeg_abort_compress (j_compress_ptr cinfo)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jpeg_suppress_tables (j_compress_ptr cinfo, boolean suppress)
|
jpeg_suppress_tables(j_compress_ptr cinfo, boolean suppress)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
JQUANT_TBL *qtbl;
|
JQUANT_TBL *qtbl;
|
||||||
@@ -170,7 +170,7 @@ jpeg_suppress_tables (j_compress_ptr cinfo, boolean suppress)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jpeg_finish_compress (j_compress_ptr cinfo)
|
jpeg_finish_compress(j_compress_ptr cinfo)
|
||||||
{
|
{
|
||||||
JDIMENSION iMCU_row;
|
JDIMENSION iMCU_row;
|
||||||
|
|
||||||
@@ -183,18 +183,18 @@ jpeg_finish_compress (j_compress_ptr cinfo)
|
|||||||
} else if (cinfo->global_state != CSTATE_WRCOEFS)
|
} else if (cinfo->global_state != CSTATE_WRCOEFS)
|
||||||
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
||||||
/* Perform any remaining passes */
|
/* Perform any remaining passes */
|
||||||
while (! cinfo->master->is_last_pass) {
|
while (!cinfo->master->is_last_pass) {
|
||||||
(*cinfo->master->prepare_for_pass) (cinfo);
|
(*cinfo->master->prepare_for_pass) (cinfo);
|
||||||
for (iMCU_row = 0; iMCU_row < cinfo->total_iMCU_rows; iMCU_row++) {
|
for (iMCU_row = 0; iMCU_row < cinfo->total_iMCU_rows; iMCU_row++) {
|
||||||
if (cinfo->progress != NULL) {
|
if (cinfo->progress != NULL) {
|
||||||
cinfo->progress->pass_counter = (long) iMCU_row;
|
cinfo->progress->pass_counter = (long)iMCU_row;
|
||||||
cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows;
|
cinfo->progress->pass_limit = (long)cinfo->total_iMCU_rows;
|
||||||
(*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
|
(*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
|
||||||
}
|
}
|
||||||
/* We bypass the main controller and invoke coef controller directly;
|
/* We bypass the main controller and invoke coef controller directly;
|
||||||
* all work is being done from the coefficient buffer.
|
* all work is being done from the coefficient buffer.
|
||||||
*/
|
*/
|
||||||
if (! (*cinfo->coef->compress_data) (cinfo, (JSAMPIMAGE) NULL))
|
if (!(*cinfo->coef->compress_data) (cinfo, (JSAMPIMAGE)NULL))
|
||||||
ERREXIT(cinfo, JERR_CANT_SUSPEND);
|
ERREXIT(cinfo, JERR_CANT_SUSPEND);
|
||||||
}
|
}
|
||||||
(*cinfo->master->finish_pass) (cinfo);
|
(*cinfo->master->finish_pass) (cinfo);
|
||||||
@@ -203,7 +203,7 @@ jpeg_finish_compress (j_compress_ptr cinfo)
|
|||||||
(*cinfo->marker->write_file_trailer) (cinfo);
|
(*cinfo->marker->write_file_trailer) (cinfo);
|
||||||
(*cinfo->dest->term_destination) (cinfo);
|
(*cinfo->dest->term_destination) (cinfo);
|
||||||
/* We can use jpeg_abort to release memory and reset global_state */
|
/* We can use jpeg_abort to release memory and reset global_state */
|
||||||
jpeg_abort((j_common_ptr) cinfo);
|
jpeg_abort((j_common_ptr)cinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -215,8 +215,8 @@ jpeg_finish_compress (j_compress_ptr cinfo)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jpeg_write_marker (j_compress_ptr cinfo, int marker,
|
jpeg_write_marker(j_compress_ptr cinfo, int marker, const JOCTET *dataptr,
|
||||||
const JOCTET *dataptr, unsigned int datalen)
|
unsigned int datalen)
|
||||||
{
|
{
|
||||||
void (*write_marker_byte) (j_compress_ptr info, int val);
|
void (*write_marker_byte) (j_compress_ptr info, int val);
|
||||||
|
|
||||||
@@ -237,7 +237,7 @@ jpeg_write_marker (j_compress_ptr cinfo, int marker,
|
|||||||
/* Same, but piecemeal. */
|
/* Same, but piecemeal. */
|
||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jpeg_write_m_header (j_compress_ptr cinfo, int marker, unsigned int datalen)
|
jpeg_write_m_header(j_compress_ptr cinfo, int marker, unsigned int datalen)
|
||||||
{
|
{
|
||||||
if (cinfo->next_scanline != 0 ||
|
if (cinfo->next_scanline != 0 ||
|
||||||
(cinfo->global_state != CSTATE_SCANNING &&
|
(cinfo->global_state != CSTATE_SCANNING &&
|
||||||
@@ -249,7 +249,7 @@ jpeg_write_m_header (j_compress_ptr cinfo, int marker, unsigned int datalen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jpeg_write_m_byte (j_compress_ptr cinfo, int val)
|
jpeg_write_m_byte(j_compress_ptr cinfo, int val)
|
||||||
{
|
{
|
||||||
(*cinfo->marker->write_marker_byte) (cinfo, val);
|
(*cinfo->marker->write_marker_byte) (cinfo, val);
|
||||||
}
|
}
|
||||||
@@ -277,13 +277,13 @@ jpeg_write_m_byte (j_compress_ptr cinfo, int val)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jpeg_write_tables (j_compress_ptr cinfo)
|
jpeg_write_tables(j_compress_ptr cinfo)
|
||||||
{
|
{
|
||||||
if (cinfo->global_state != CSTATE_START)
|
if (cinfo->global_state != CSTATE_START)
|
||||||
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
||||||
|
|
||||||
/* (Re)initialize error mgr and destination modules */
|
/* (Re)initialize error mgr and destination modules */
|
||||||
(*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
|
(*cinfo->err->reset_error_mgr) ((j_common_ptr)cinfo);
|
||||||
(*cinfo->dest->init_destination) (cinfo);
|
(*cinfo->dest->init_destination) (cinfo);
|
||||||
/* Initialize the marker writer ... bit of a crock to do it here. */
|
/* Initialize the marker writer ... bit of a crock to do it here. */
|
||||||
jinit_marker_writer(cinfo);
|
jinit_marker_writer(cinfo);
|
||||||
|
|||||||
22
jcapistd.c
22
jcapistd.c
@@ -37,7 +37,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables)
|
jpeg_start_compress(j_compress_ptr cinfo, boolean write_all_tables)
|
||||||
{
|
{
|
||||||
if (cinfo->global_state != CSTATE_START)
|
if (cinfo->global_state != CSTATE_START)
|
||||||
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
||||||
@@ -51,7 +51,7 @@ jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables)
|
|||||||
cinfo->master->optimize_scans = FALSE;
|
cinfo->master->optimize_scans = FALSE;
|
||||||
|
|
||||||
/* (Re)initialize error mgr and destination modules */
|
/* (Re)initialize error mgr and destination modules */
|
||||||
(*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
|
(*cinfo->err->reset_error_mgr) ((j_common_ptr)cinfo);
|
||||||
(*cinfo->dest->init_destination) (cinfo);
|
(*cinfo->dest->init_destination) (cinfo);
|
||||||
/* Perform master selection of active modules */
|
/* Perform master selection of active modules */
|
||||||
jinit_compress_master(cinfo);
|
jinit_compress_master(cinfo);
|
||||||
@@ -81,7 +81,7 @@ jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GLOBAL(JDIMENSION)
|
GLOBAL(JDIMENSION)
|
||||||
jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines,
|
jpeg_write_scanlines(j_compress_ptr cinfo, JSAMPARRAY scanlines,
|
||||||
JDIMENSION num_lines)
|
JDIMENSION num_lines)
|
||||||
{
|
{
|
||||||
JDIMENSION row_ctr, rows_left;
|
JDIMENSION row_ctr, rows_left;
|
||||||
@@ -93,9 +93,9 @@ jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines,
|
|||||||
|
|
||||||
/* Call progress monitor hook if present */
|
/* Call progress monitor hook if present */
|
||||||
if (cinfo->progress != NULL) {
|
if (cinfo->progress != NULL) {
|
||||||
cinfo->progress->pass_counter = (long) cinfo->next_scanline;
|
cinfo->progress->pass_counter = (long)cinfo->next_scanline;
|
||||||
cinfo->progress->pass_limit = (long) cinfo->image_height;
|
cinfo->progress->pass_limit = (long)cinfo->image_height;
|
||||||
(*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
|
(*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Give master control module another chance if this is first call to
|
/* Give master control module another chance if this is first call to
|
||||||
@@ -124,7 +124,7 @@ jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GLOBAL(JDIMENSION)
|
GLOBAL(JDIMENSION)
|
||||||
jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data,
|
jpeg_write_raw_data(j_compress_ptr cinfo, JSAMPIMAGE data,
|
||||||
JDIMENSION num_lines)
|
JDIMENSION num_lines)
|
||||||
{
|
{
|
||||||
JDIMENSION lines_per_iMCU_row;
|
JDIMENSION lines_per_iMCU_row;
|
||||||
@@ -138,9 +138,9 @@ jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data,
|
|||||||
|
|
||||||
/* Call progress monitor hook if present */
|
/* Call progress monitor hook if present */
|
||||||
if (cinfo->progress != NULL) {
|
if (cinfo->progress != NULL) {
|
||||||
cinfo->progress->pass_counter = (long) cinfo->next_scanline;
|
cinfo->progress->pass_counter = (long)cinfo->next_scanline;
|
||||||
cinfo->progress->pass_limit = (long) cinfo->image_height;
|
cinfo->progress->pass_limit = (long)cinfo->image_height;
|
||||||
(*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
|
(*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Give master control module another chance if this is first call to
|
/* Give master control module another chance if this is first call to
|
||||||
@@ -157,7 +157,7 @@ jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data,
|
|||||||
ERREXIT(cinfo, JERR_BUFFER_SIZE);
|
ERREXIT(cinfo, JERR_BUFFER_SIZE);
|
||||||
|
|
||||||
/* Directly compress the row. */
|
/* Directly compress the row. */
|
||||||
if (! (*cinfo->coef->compress_data) (cinfo, data)) {
|
if (!(*cinfo->coef->compress_data) (cinfo, data)) {
|
||||||
/* If compressor did not consume the whole row, suspend processing. */
|
/* If compressor did not consume the whole row, suspend processing. */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
89
jcarith.c
89
jcarith.c
@@ -3,16 +3,20 @@
|
|||||||
*
|
*
|
||||||
* This file was part of the Independent JPEG Group's software:
|
* This file was part of the Independent JPEG Group's software:
|
||||||
* Developed 1997-2009 by Guido Vollbeding.
|
* Developed 1997-2009 by Guido Vollbeding.
|
||||||
* It was modified by The libjpeg-turbo Project to include only code relevant
|
* libjpeg-turbo Modifications:
|
||||||
* to libjpeg-turbo.
|
* Copyright (C) 2015, 2018, D. R. Commander.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* For conditions of distribution and use, see the accompanying README.ijg
|
||||||
|
* file.
|
||||||
*
|
*
|
||||||
* This file contains portable arithmetic entropy encoding routines for JPEG
|
* This file contains portable arithmetic entropy encoding routines for JPEG
|
||||||
* (implementing the ISO/IEC IS 10918-1 and CCITT Recommendation ITU-T T.81).
|
* (implementing Recommendation ITU-T T.81 | ISO/IEC 10918-1).
|
||||||
*
|
*
|
||||||
* Both sequential and progressive modes are supported in this single module.
|
* Both sequential and progressive modes are supported in this single module.
|
||||||
*
|
*
|
||||||
* Suspension is not currently supported in this module.
|
* Suspension is not currently supported in this module.
|
||||||
|
*
|
||||||
|
* NOTE: All referenced figures are from
|
||||||
|
* Recommendation ITU-T T.81 (1992) | ISO/IEC 10918-1:1994.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define JPEG_INTERNALS
|
#define JPEG_INTERNALS
|
||||||
@@ -104,18 +108,18 @@ typedef arith_entropy_encoder *arith_entropy_ptr;
|
|||||||
|
|
||||||
#ifdef RIGHT_SHIFT_IS_UNSIGNED
|
#ifdef RIGHT_SHIFT_IS_UNSIGNED
|
||||||
#define ISHIFT_TEMPS int ishift_temp;
|
#define ISHIFT_TEMPS int ishift_temp;
|
||||||
#define IRIGHT_SHIFT(x,shft) \
|
#define IRIGHT_SHIFT(x, shft) \
|
||||||
((ishift_temp = (x)) < 0 ? \
|
((ishift_temp = (x)) < 0 ? \
|
||||||
(ishift_temp >> (shft)) | ((~0) << (16-(shft))) : \
|
(ishift_temp >> (shft)) | ((~0) << (16 - (shft))) : \
|
||||||
(ishift_temp >> (shft)))
|
(ishift_temp >> (shft)))
|
||||||
#else
|
#else
|
||||||
#define ISHIFT_TEMPS
|
#define ISHIFT_TEMPS
|
||||||
#define IRIGHT_SHIFT(x,shft) ((x) >> (shft))
|
#define IRIGHT_SHIFT(x, shft) ((x) >> (shft))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
emit_byte (int val, j_compress_ptr cinfo)
|
emit_byte(int val, j_compress_ptr cinfo)
|
||||||
/* Write next output byte; we do not support suspension in this module. */
|
/* Write next output byte; we do not support suspension in this module. */
|
||||||
{
|
{
|
||||||
struct jpeg_destination_mgr *dest = cinfo->dest;
|
struct jpeg_destination_mgr *dest = cinfo->dest;
|
||||||
@@ -126,7 +130,7 @@ emit_byte (int val, j_compress_ptr cinfo)
|
|||||||
|
|
||||||
*dest->next_output_byte++ = (JOCTET) val;
|
*dest->next_output_byte++ = (JOCTET) val;
|
||||||
if (--dest->free_in_buffer == 0)
|
if (--dest->free_in_buffer == 0)
|
||||||
if (! (*dest->empty_output_buffer) (cinfo))
|
if (!(*dest->empty_output_buffer) (cinfo))
|
||||||
ERREXIT(cinfo, JERR_CANT_SUSPEND);
|
ERREXIT(cinfo, JERR_CANT_SUSPEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,22 +140,22 @@ emit_byte (int val, j_compress_ptr cinfo)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
finish_pass (j_compress_ptr cinfo)
|
finish_pass(j_compress_ptr cinfo)
|
||||||
{
|
{
|
||||||
arith_entropy_ptr e = (arith_entropy_ptr) cinfo->entropy;
|
arith_entropy_ptr e = (arith_entropy_ptr)cinfo->entropy;
|
||||||
JLONG temp;
|
JLONG temp;
|
||||||
|
|
||||||
/* Section D.1.8: Termination of encoding */
|
/* Section D.1.8: Termination of encoding */
|
||||||
|
|
||||||
/* Find the e->c in the coding interval with the largest
|
/* Find the e->c in the coding interval with the largest
|
||||||
* number of trailing zero bits */
|
* number of trailing zero bits */
|
||||||
if ((temp = (e->a - 1 + e->c) & 0xFFFF0000L) < e->c)
|
if ((temp = (e->a - 1 + e->c) & 0xFFFF0000UL) < e->c)
|
||||||
e->c = temp + 0x8000L;
|
e->c = temp + 0x8000L;
|
||||||
else
|
else
|
||||||
e->c = temp;
|
e->c = temp;
|
||||||
/* Send remaining bytes to output */
|
/* Send remaining bytes to output */
|
||||||
e->c <<= e->ct;
|
e->c <<= e->ct;
|
||||||
if (e->c & 0xF8000000L) {
|
if (e->c & 0xF8000000UL) {
|
||||||
/* One final overflow has to be handled */
|
/* One final overflow has to be handled */
|
||||||
if (e->buffer >= 0) {
|
if (e->buffer >= 0) {
|
||||||
if (e->zc)
|
if (e->zc)
|
||||||
@@ -222,9 +226,9 @@ finish_pass (j_compress_ptr cinfo)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
arith_encode (j_compress_ptr cinfo, unsigned char *st, int val)
|
arith_encode(j_compress_ptr cinfo, unsigned char *st, int val)
|
||||||
{
|
{
|
||||||
register arith_entropy_ptr e = (arith_entropy_ptr) cinfo->entropy;
|
register arith_entropy_ptr e = (arith_entropy_ptr)cinfo->entropy;
|
||||||
register unsigned char nl, nm;
|
register unsigned char nl, nm;
|
||||||
register JLONG qe, temp;
|
register JLONG qe, temp;
|
||||||
register int sv;
|
register int sv;
|
||||||
@@ -322,9 +326,9 @@ arith_encode (j_compress_ptr cinfo, unsigned char *st, int val)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
emit_restart (j_compress_ptr cinfo, int restart_num)
|
emit_restart(j_compress_ptr cinfo, int restart_num)
|
||||||
{
|
{
|
||||||
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
|
arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
|
||||||
int ci;
|
int ci;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
|
|
||||||
@@ -365,9 +369,9 @@ emit_restart (j_compress_ptr cinfo, int restart_num)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(boolean)
|
METHODDEF(boolean)
|
||||||
encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
encode_mcu_DC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||||
{
|
{
|
||||||
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
|
arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
|
||||||
JBLOCKROW block;
|
JBLOCKROW block;
|
||||||
unsigned char *st;
|
unsigned char *st;
|
||||||
int blkn, ci, tbl;
|
int blkn, ci, tbl;
|
||||||
@@ -394,7 +398,7 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
/* Compute the DC value after the required point transform by Al.
|
/* Compute the DC value after the required point transform by Al.
|
||||||
* This is simply an arithmetic right shift.
|
* This is simply an arithmetic right shift.
|
||||||
*/
|
*/
|
||||||
m = IRIGHT_SHIFT((int) ((*block)[0]), cinfo->Al);
|
m = IRIGHT_SHIFT((int)((*block)[0]), cinfo->Al);
|
||||||
|
|
||||||
/* Sections F.1.4.1 & F.1.4.4.1: Encoding of DC coefficients */
|
/* Sections F.1.4.1 & F.1.4.4.1: Encoding of DC coefficients */
|
||||||
|
|
||||||
@@ -435,9 +439,9 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
}
|
}
|
||||||
arith_encode(cinfo, st, 0);
|
arith_encode(cinfo, st, 0);
|
||||||
/* Section F.1.4.4.1.2: Establish dc_context conditioning category */
|
/* Section F.1.4.4.1.2: Establish dc_context conditioning category */
|
||||||
if (m < (int) ((1L << cinfo->arith_dc_L[tbl]) >> 1))
|
if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
|
||||||
entropy->dc_context[ci] = 0; /* zero diff category */
|
entropy->dc_context[ci] = 0; /* zero diff category */
|
||||||
else if (m > (int) ((1L << cinfo->arith_dc_U[tbl]) >> 1))
|
else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
|
||||||
entropy->dc_context[ci] += 8; /* large diff category */
|
entropy->dc_context[ci] += 8; /* large diff category */
|
||||||
/* Figure F.9: Encoding the magnitude bit pattern of v */
|
/* Figure F.9: Encoding the magnitude bit pattern of v */
|
||||||
st += 14;
|
st += 14;
|
||||||
@@ -456,9 +460,9 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(boolean)
|
METHODDEF(boolean)
|
||||||
encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
encode_mcu_AC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||||
{
|
{
|
||||||
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
|
arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
|
||||||
JBLOCKROW block;
|
JBLOCKROW block;
|
||||||
unsigned char *st;
|
unsigned char *st;
|
||||||
int tbl, k, ke;
|
int tbl, k, ke;
|
||||||
@@ -555,9 +559,9 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(boolean)
|
METHODDEF(boolean)
|
||||||
encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
encode_mcu_DC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||||
{
|
{
|
||||||
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
|
arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
|
||||||
unsigned char *st;
|
unsigned char *st;
|
||||||
int Al, blkn;
|
int Al, blkn;
|
||||||
|
|
||||||
@@ -590,9 +594,9 @@ encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(boolean)
|
METHODDEF(boolean)
|
||||||
encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
encode_mcu_AC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||||
{
|
{
|
||||||
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
|
arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
|
||||||
JBLOCKROW block;
|
JBLOCKROW block;
|
||||||
unsigned char *st;
|
unsigned char *st;
|
||||||
int tbl, k, ke, kex;
|
int tbl, k, ke, kex;
|
||||||
@@ -683,9 +687,9 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(boolean)
|
METHODDEF(boolean)
|
||||||
encode_mcu (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
encode_mcu(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||||
{
|
{
|
||||||
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
|
arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
JBLOCKROW block;
|
JBLOCKROW block;
|
||||||
unsigned char *st;
|
unsigned char *st;
|
||||||
@@ -750,9 +754,9 @@ encode_mcu (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
}
|
}
|
||||||
arith_encode(cinfo, st, 0);
|
arith_encode(cinfo, st, 0);
|
||||||
/* Section F.1.4.4.1.2: Establish dc_context conditioning category */
|
/* Section F.1.4.4.1.2: Establish dc_context conditioning category */
|
||||||
if (m < (int) ((1L << cinfo->arith_dc_L[tbl]) >> 1))
|
if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
|
||||||
entropy->dc_context[ci] = 0; /* zero diff category */
|
entropy->dc_context[ci] = 0; /* zero diff category */
|
||||||
else if (m > (int) ((1L << cinfo->arith_dc_U[tbl]) >> 1))
|
else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
|
||||||
entropy->dc_context[ci] += 8; /* large diff category */
|
entropy->dc_context[ci] += 8; /* large diff category */
|
||||||
/* Figure F.9: Encoding the magnitude bit pattern of v */
|
/* Figure F.9: Encoding the magnitude bit pattern of v */
|
||||||
st += 14;
|
st += 14;
|
||||||
@@ -825,9 +829,9 @@ encode_mcu (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
start_pass (j_compress_ptr cinfo, boolean gather_statistics)
|
start_pass(j_compress_ptr cinfo, boolean gather_statistics)
|
||||||
{
|
{
|
||||||
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
|
arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
|
||||||
int ci, tbl;
|
int ci, tbl;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
boolean progressive_mode;
|
boolean progressive_mode;
|
||||||
@@ -870,8 +874,8 @@ start_pass (j_compress_ptr cinfo, boolean gather_statistics)
|
|||||||
if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
|
if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
|
||||||
ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
|
ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
|
||||||
if (entropy->dc_stats[tbl] == NULL)
|
if (entropy->dc_stats[tbl] == NULL)
|
||||||
entropy->dc_stats[tbl] = (unsigned char *) (*cinfo->mem->alloc_small)
|
entropy->dc_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
|
||||||
((j_common_ptr) cinfo, JPOOL_IMAGE, DC_STAT_BINS);
|
((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
|
||||||
MEMZERO(entropy->dc_stats[tbl], DC_STAT_BINS);
|
MEMZERO(entropy->dc_stats[tbl], DC_STAT_BINS);
|
||||||
/* Initialize DC predictions to 0 */
|
/* Initialize DC predictions to 0 */
|
||||||
entropy->last_dc_val[ci] = 0;
|
entropy->last_dc_val[ci] = 0;
|
||||||
@@ -883,13 +887,14 @@ start_pass (j_compress_ptr cinfo, boolean gather_statistics)
|
|||||||
if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
|
if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
|
||||||
ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
|
ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
|
||||||
if (entropy->ac_stats[tbl] == NULL)
|
if (entropy->ac_stats[tbl] == NULL)
|
||||||
entropy->ac_stats[tbl] = (unsigned char *) (*cinfo->mem->alloc_small)
|
entropy->ac_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
|
||||||
((j_common_ptr) cinfo, JPOOL_IMAGE, AC_STAT_BINS);
|
((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
|
||||||
MEMZERO(entropy->ac_stats[tbl], AC_STAT_BINS);
|
MEMZERO(entropy->ac_stats[tbl], AC_STAT_BINS);
|
||||||
#ifdef CALCULATE_SPECTRAL_CONDITIONING
|
#ifdef CALCULATE_SPECTRAL_CONDITIONING
|
||||||
if (progressive_mode)
|
if (progressive_mode)
|
||||||
/* Section G.1.3.2: Set appropriate arithmetic conditioning value Kx */
|
/* Section G.1.3.2: Set appropriate arithmetic conditioning value Kx */
|
||||||
cinfo->arith_ac_K[tbl] = cinfo->Ss + ((8 + cinfo->Se - cinfo->Ss) >> 4);
|
cinfo->arith_ac_K[tbl] = cinfo->Ss +
|
||||||
|
((8 + cinfo->Se - cinfo->Ss) >> 4);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -913,15 +918,15 @@ start_pass (j_compress_ptr cinfo, boolean gather_statistics)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jinit_arith_encoder (j_compress_ptr cinfo)
|
jinit_arith_encoder(j_compress_ptr cinfo)
|
||||||
{
|
{
|
||||||
arith_entropy_ptr entropy;
|
arith_entropy_ptr entropy;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
entropy = (arith_entropy_ptr)
|
entropy = (arith_entropy_ptr)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||||
sizeof(arith_entropy_encoder));
|
sizeof(arith_entropy_encoder));
|
||||||
cinfo->entropy = (struct jpeg_entropy_encoder *) entropy;
|
cinfo->entropy = (struct jpeg_entropy_encoder *)entropy;
|
||||||
entropy->pub.start_pass = start_pass;
|
entropy->pub.start_pass = start_pass;
|
||||||
entropy->pub.finish_pass = finish_pass;
|
entropy->pub.finish_pass = finish_pass;
|
||||||
|
|
||||||
|
|||||||
82
jccoefct.c
82
jccoefct.c
@@ -63,23 +63,21 @@ typedef my_coef_controller *my_coef_ptr;
|
|||||||
|
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
METHODDEF(boolean) compress_data
|
METHODDEF(boolean) compress_data(j_compress_ptr cinfo, JSAMPIMAGE input_buf);
|
||||||
(j_compress_ptr cinfo, JSAMPIMAGE input_buf);
|
|
||||||
#ifdef FULL_COEF_BUFFER_SUPPORTED
|
#ifdef FULL_COEF_BUFFER_SUPPORTED
|
||||||
METHODDEF(boolean) compress_first_pass
|
METHODDEF(boolean) compress_first_pass(j_compress_ptr cinfo,
|
||||||
(j_compress_ptr cinfo, JSAMPIMAGE input_buf);
|
JSAMPIMAGE input_buf);
|
||||||
METHODDEF(boolean) compress_output
|
METHODDEF(boolean) compress_output(j_compress_ptr cinfo, JSAMPIMAGE input_buf);
|
||||||
(j_compress_ptr cinfo, JSAMPIMAGE input_buf);
|
|
||||||
#endif
|
#endif
|
||||||
METHODDEF(boolean) compress_trellis_pass
|
METHODDEF(boolean) compress_trellis_pass
|
||||||
(j_compress_ptr cinfo, JSAMPIMAGE input_buf);
|
(j_compress_ptr cinfo, JSAMPIMAGE input_buf);
|
||||||
|
|
||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
start_iMCU_row (j_compress_ptr cinfo)
|
start_iMCU_row(j_compress_ptr cinfo)
|
||||||
/* Reset within-iMCU-row counters for a new row */
|
/* Reset within-iMCU-row counters for a new row */
|
||||||
{
|
{
|
||||||
my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
|
my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
|
||||||
|
|
||||||
/* In an interleaved scan, an MCU row is the same as an iMCU row.
|
/* In an interleaved scan, an MCU row is the same as an iMCU row.
|
||||||
* In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
|
* In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
|
||||||
@@ -88,7 +86,7 @@ start_iMCU_row (j_compress_ptr cinfo)
|
|||||||
if (cinfo->comps_in_scan > 1) {
|
if (cinfo->comps_in_scan > 1) {
|
||||||
coef->MCU_rows_per_iMCU_row = 1;
|
coef->MCU_rows_per_iMCU_row = 1;
|
||||||
} else {
|
} else {
|
||||||
if (coef->iMCU_row_num < (cinfo->total_iMCU_rows-1))
|
if (coef->iMCU_row_num < (cinfo->total_iMCU_rows - 1))
|
||||||
coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
|
coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
|
||||||
else
|
else
|
||||||
coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
|
coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
|
||||||
@@ -104,9 +102,9 @@ start_iMCU_row (j_compress_ptr cinfo)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
|
start_pass_coef(j_compress_ptr cinfo, J_BUF_MODE pass_mode)
|
||||||
{
|
{
|
||||||
my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
|
my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
|
||||||
|
|
||||||
coef->iMCU_row_num = 0;
|
coef->iMCU_row_num = 0;
|
||||||
start_iMCU_row(cinfo);
|
start_iMCU_row(cinfo);
|
||||||
@@ -153,9 +151,9 @@ start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(boolean)
|
METHODDEF(boolean)
|
||||||
compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
compress_data(j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
||||||
{
|
{
|
||||||
my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
|
my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
|
||||||
JDIMENSION MCU_col_num; /* index of current MCU within row */
|
JDIMENSION MCU_col_num; /* index of current MCU within row */
|
||||||
JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
|
JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
|
||||||
JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
|
JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
|
||||||
@@ -180,13 +178,13 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
|||||||
blkn = 0;
|
blkn = 0;
|
||||||
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
|
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
|
||||||
compptr = cinfo->cur_comp_info[ci];
|
compptr = cinfo->cur_comp_info[ci];
|
||||||
blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
|
blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width :
|
||||||
: compptr->last_col_width;
|
compptr->last_col_width;
|
||||||
xpos = MCU_col_num * compptr->MCU_sample_width;
|
xpos = MCU_col_num * compptr->MCU_sample_width;
|
||||||
ypos = yoffset * DCTSIZE; /* ypos == (yoffset+yindex) * DCTSIZE */
|
ypos = yoffset * DCTSIZE; /* ypos == (yoffset+yindex) * DCTSIZE */
|
||||||
for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
|
for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
|
||||||
if (coef->iMCU_row_num < last_iMCU_row ||
|
if (coef->iMCU_row_num < last_iMCU_row ||
|
||||||
yoffset+yindex < compptr->last_row_height) {
|
yoffset + yindex < compptr->last_row_height) {
|
||||||
(*cinfo->fdct->forward_DCT) (cinfo, compptr,
|
(*cinfo->fdct->forward_DCT) (cinfo, compptr,
|
||||||
input_buf[compptr->component_index],
|
input_buf[compptr->component_index],
|
||||||
coef->MCU_buffer[blkn],
|
coef->MCU_buffer[blkn],
|
||||||
@@ -194,18 +192,20 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
|||||||
NULL);
|
NULL);
|
||||||
if (blockcnt < compptr->MCU_width) {
|
if (blockcnt < compptr->MCU_width) {
|
||||||
/* Create some dummy blocks at the right edge of the image. */
|
/* Create some dummy blocks at the right edge of the image. */
|
||||||
jzero_far((void *) coef->MCU_buffer[blkn + blockcnt],
|
jzero_far((void *)coef->MCU_buffer[blkn + blockcnt],
|
||||||
(compptr->MCU_width - blockcnt) * sizeof(JBLOCK));
|
(compptr->MCU_width - blockcnt) * sizeof(JBLOCK));
|
||||||
for (bi = blockcnt; bi < compptr->MCU_width; bi++) {
|
for (bi = blockcnt; bi < compptr->MCU_width; bi++) {
|
||||||
coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn+bi-1][0][0];
|
coef->MCU_buffer[blkn + bi][0][0] =
|
||||||
|
coef->MCU_buffer[blkn + bi - 1][0][0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Create a row of dummy blocks at the bottom of the image. */
|
/* Create a row of dummy blocks at the bottom of the image. */
|
||||||
jzero_far((void *) coef->MCU_buffer[blkn],
|
jzero_far((void *)coef->MCU_buffer[blkn],
|
||||||
compptr->MCU_width * sizeof(JBLOCK));
|
compptr->MCU_width * sizeof(JBLOCK));
|
||||||
for (bi = 0; bi < compptr->MCU_width; bi++) {
|
for (bi = 0; bi < compptr->MCU_width; bi++) {
|
||||||
coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn-1][0][0];
|
coef->MCU_buffer[blkn + bi][0][0] =
|
||||||
|
coef->MCU_buffer[blkn - 1][0][0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
blkn += compptr->MCU_width;
|
blkn += compptr->MCU_width;
|
||||||
@@ -215,7 +215,7 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
|||||||
/* Try to write the MCU. In event of a suspension failure, we will
|
/* Try to write the MCU. In event of a suspension failure, we will
|
||||||
* re-DCT the MCU on restart (a bit inefficient, could be fixed...)
|
* re-DCT the MCU on restart (a bit inefficient, could be fixed...)
|
||||||
*/
|
*/
|
||||||
if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
|
if (!(*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
|
||||||
/* Suspension forced; update state counters and exit */
|
/* Suspension forced; update state counters and exit */
|
||||||
coef->MCU_vert_offset = yoffset;
|
coef->MCU_vert_offset = yoffset;
|
||||||
coef->mcu_ctr = MCU_col_num;
|
coef->mcu_ctr = MCU_col_num;
|
||||||
@@ -256,9 +256,9 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(boolean)
|
METHODDEF(boolean)
|
||||||
compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
compress_first_pass(j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
||||||
{
|
{
|
||||||
my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
|
my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
|
||||||
JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
|
JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
|
||||||
JDIMENSION blocks_across, MCUs_across, MCUindex;
|
JDIMENSION blocks_across, MCUs_across, MCUindex;
|
||||||
int bi, ci, h_samp_factor, block_row, block_rows, ndummy;
|
int bi, ci, h_samp_factor, block_row, block_rows, ndummy;
|
||||||
@@ -272,7 +272,7 @@ compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
|||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
/* Align the virtual buffer for this component. */
|
/* Align the virtual buffer for this component. */
|
||||||
buffer = (*cinfo->mem->access_virt_barray)
|
buffer = (*cinfo->mem->access_virt_barray)
|
||||||
((j_common_ptr) cinfo, coef->whole_image[ci],
|
((j_common_ptr)cinfo, coef->whole_image[ci],
|
||||||
coef->iMCU_row_num * compptr->v_samp_factor,
|
coef->iMCU_row_num * compptr->v_samp_factor,
|
||||||
(JDIMENSION) compptr->v_samp_factor, TRUE);
|
(JDIMENSION) compptr->v_samp_factor, TRUE);
|
||||||
|
|
||||||
@@ -286,13 +286,13 @@ compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
|||||||
block_rows = compptr->v_samp_factor;
|
block_rows = compptr->v_samp_factor;
|
||||||
else {
|
else {
|
||||||
/* NB: can't use last_row_height here, since may not be set! */
|
/* NB: can't use last_row_height here, since may not be set! */
|
||||||
block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor);
|
block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
|
||||||
if (block_rows == 0) block_rows = compptr->v_samp_factor;
|
if (block_rows == 0) block_rows = compptr->v_samp_factor;
|
||||||
}
|
}
|
||||||
blocks_across = compptr->width_in_blocks;
|
blocks_across = compptr->width_in_blocks;
|
||||||
h_samp_factor = compptr->h_samp_factor;
|
h_samp_factor = compptr->h_samp_factor;
|
||||||
/* Count number of dummy blocks to be added at the right margin. */
|
/* Count number of dummy blocks to be added at the right margin. */
|
||||||
ndummy = (int) (blocks_across % h_samp_factor);
|
ndummy = (int)(blocks_across % h_samp_factor);
|
||||||
if (ndummy > 0)
|
if (ndummy > 0)
|
||||||
ndummy = h_samp_factor - ndummy;
|
ndummy = h_samp_factor - ndummy;
|
||||||
/* Perform DCT for all non-dummy blocks in this iMCU row. Each call
|
/* Perform DCT for all non-dummy blocks in this iMCU row. Each call
|
||||||
@@ -308,7 +308,7 @@ compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
|||||||
if (ndummy > 0) {
|
if (ndummy > 0) {
|
||||||
/* Create dummy blocks at the right edge of the image. */
|
/* Create dummy blocks at the right edge of the image. */
|
||||||
thisblockrow += blocks_across; /* => first dummy block */
|
thisblockrow += blocks_across; /* => first dummy block */
|
||||||
jzero_far((void *) thisblockrow, ndummy * sizeof(JBLOCK));
|
jzero_far((void *)thisblockrow, ndummy * sizeof(JBLOCK));
|
||||||
lastDC = thisblockrow[-1][0];
|
lastDC = thisblockrow[-1][0];
|
||||||
for (bi = 0; bi < ndummy; bi++) {
|
for (bi = 0; bi < ndummy; bi++) {
|
||||||
thisblockrow[bi][0] = lastDC;
|
thisblockrow[bi][0] = lastDC;
|
||||||
@@ -326,11 +326,11 @@ compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
|||||||
for (block_row = block_rows; block_row < compptr->v_samp_factor;
|
for (block_row = block_rows; block_row < compptr->v_samp_factor;
|
||||||
block_row++) {
|
block_row++) {
|
||||||
thisblockrow = buffer[block_row];
|
thisblockrow = buffer[block_row];
|
||||||
lastblockrow = buffer[block_row-1];
|
lastblockrow = buffer[block_row - 1];
|
||||||
jzero_far((void *) thisblockrow,
|
jzero_far((void *)thisblockrow,
|
||||||
(size_t) (blocks_across * sizeof(JBLOCK)));
|
(size_t)(blocks_across * sizeof(JBLOCK)));
|
||||||
for (MCUindex = 0; MCUindex < MCUs_across; MCUindex++) {
|
for (MCUindex = 0; MCUindex < MCUs_across; MCUindex++) {
|
||||||
lastDC = lastblockrow[h_samp_factor-1][0];
|
lastDC = lastblockrow[h_samp_factor - 1][0];
|
||||||
for (bi = 0; bi < h_samp_factor; bi++) {
|
for (bi = 0; bi < h_samp_factor; bi++) {
|
||||||
thisblockrow[bi][0] = lastDC;
|
thisblockrow[bi][0] = lastDC;
|
||||||
}
|
}
|
||||||
@@ -490,9 +490,9 @@ compress_trellis_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(boolean)
|
METHODDEF(boolean)
|
||||||
compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
compress_output(j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
||||||
{
|
{
|
||||||
my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
|
my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
|
||||||
JDIMENSION MCU_col_num; /* index of current MCU within row */
|
JDIMENSION MCU_col_num; /* index of current MCU within row */
|
||||||
int blkn, ci, xindex, yindex, yoffset;
|
int blkn, ci, xindex, yindex, yoffset;
|
||||||
JDIMENSION start_col;
|
JDIMENSION start_col;
|
||||||
@@ -507,9 +507,9 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
|||||||
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
|
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
|
||||||
compptr = cinfo->cur_comp_info[ci];
|
compptr = cinfo->cur_comp_info[ci];
|
||||||
buffer[ci] = (*cinfo->mem->access_virt_barray)
|
buffer[ci] = (*cinfo->mem->access_virt_barray)
|
||||||
((j_common_ptr) cinfo, coef->whole_image[compptr->component_index],
|
((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
|
||||||
coef->iMCU_row_num * compptr->v_samp_factor,
|
coef->iMCU_row_num * compptr->v_samp_factor,
|
||||||
(JDIMENSION) compptr->v_samp_factor, FALSE);
|
(JDIMENSION)compptr->v_samp_factor, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Loop to process one whole iMCU row */
|
/* Loop to process one whole iMCU row */
|
||||||
@@ -523,14 +523,14 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
|||||||
compptr = cinfo->cur_comp_info[ci];
|
compptr = cinfo->cur_comp_info[ci];
|
||||||
start_col = MCU_col_num * compptr->MCU_width;
|
start_col = MCU_col_num * compptr->MCU_width;
|
||||||
for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
|
for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
|
||||||
buffer_ptr = buffer[ci][yindex+yoffset] + start_col;
|
buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
|
||||||
for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
|
for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
|
||||||
coef->MCU_buffer[blkn++] = buffer_ptr++;
|
coef->MCU_buffer[blkn++] = buffer_ptr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Try to write the MCU. */
|
/* Try to write the MCU. */
|
||||||
if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
|
if (!(*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
|
||||||
/* Suspension forced; update state counters and exit */
|
/* Suspension forced; update state counters and exit */
|
||||||
coef->MCU_vert_offset = yoffset;
|
coef->MCU_vert_offset = yoffset;
|
||||||
coef->mcu_ctr = MCU_col_num;
|
coef->mcu_ctr = MCU_col_num;
|
||||||
@@ -554,14 +554,14 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jinit_c_coef_controller (j_compress_ptr cinfo, boolean need_full_buffer)
|
jinit_c_coef_controller(j_compress_ptr cinfo, boolean need_full_buffer)
|
||||||
{
|
{
|
||||||
my_coef_ptr coef;
|
my_coef_ptr coef;
|
||||||
|
|
||||||
coef = (my_coef_ptr)
|
coef = (my_coef_ptr)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||||
sizeof(my_coef_controller));
|
sizeof(my_coef_controller));
|
||||||
cinfo->coef = (struct jpeg_c_coef_controller *) coef;
|
cinfo->coef = (struct jpeg_c_coef_controller *)coef;
|
||||||
coef->pub.start_pass = start_pass_coef;
|
coef->pub.start_pass = start_pass_coef;
|
||||||
|
|
||||||
/* Create the coefficient buffer. */
|
/* Create the coefficient buffer. */
|
||||||
@@ -599,7 +599,7 @@ jinit_c_coef_controller (j_compress_ptr cinfo, boolean need_full_buffer)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
buffer = (JBLOCKROW)
|
buffer = (JBLOCKROW)
|
||||||
(*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||||
C_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
|
C_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
|
||||||
for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) {
|
for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) {
|
||||||
coef->MCU_buffer[i] = buffer + i;
|
coef->MCU_buffer[i] = buffer + i;
|
||||||
|
|||||||
46
jccolext.c
46
jccolext.c
@@ -29,13 +29,13 @@
|
|||||||
|
|
||||||
INLINE
|
INLINE
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
rgb_ycc_convert_internal (j_compress_ptr cinfo,
|
rgb_ycc_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf,
|
||||||
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
JSAMPIMAGE output_buf, JDIMENSION output_row,
|
||||||
JDIMENSION output_row, int num_rows)
|
int num_rows)
|
||||||
{
|
{
|
||||||
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
|
||||||
register int r, g, b;
|
register int r, g, b;
|
||||||
register JLONG * ctab = cconvert->rgb_ycc_tab;
|
register JLONG *ctab = cconvert->rgb_ycc_tab;
|
||||||
register JSAMPROW inptr;
|
register JSAMPROW inptr;
|
||||||
register JSAMPROW outptr0, outptr1, outptr2;
|
register JSAMPROW outptr0, outptr1, outptr2;
|
||||||
register JDIMENSION col;
|
register JDIMENSION col;
|
||||||
@@ -58,17 +58,14 @@ rgb_ycc_convert_internal (j_compress_ptr cinfo,
|
|||||||
* need the general RIGHT_SHIFT macro.
|
* need the general RIGHT_SHIFT macro.
|
||||||
*/
|
*/
|
||||||
/* Y */
|
/* Y */
|
||||||
outptr0[col] = (JSAMPLE)
|
outptr0[col] = (JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
|
||||||
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
|
ctab[b + B_Y_OFF]) >> SCALEBITS);
|
||||||
>> SCALEBITS);
|
|
||||||
/* Cb */
|
/* Cb */
|
||||||
outptr1[col] = (JSAMPLE)
|
outptr1[col] = (JSAMPLE)((ctab[r + R_CB_OFF] + ctab[g + G_CB_OFF] +
|
||||||
((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF])
|
ctab[b + B_CB_OFF]) >> SCALEBITS);
|
||||||
>> SCALEBITS);
|
|
||||||
/* Cr */
|
/* Cr */
|
||||||
outptr2[col] = (JSAMPLE)
|
outptr2[col] = (JSAMPLE)((ctab[r + R_CR_OFF] + ctab[g + G_CR_OFF] +
|
||||||
((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF])
|
ctab[b + B_CR_OFF]) >> SCALEBITS);
|
||||||
>> SCALEBITS);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,13 +83,13 @@ rgb_ycc_convert_internal (j_compress_ptr cinfo,
|
|||||||
|
|
||||||
INLINE
|
INLINE
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
rgb_gray_convert_internal (j_compress_ptr cinfo,
|
rgb_gray_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf,
|
||||||
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
JSAMPIMAGE output_buf, JDIMENSION output_row,
|
||||||
JDIMENSION output_row, int num_rows)
|
int num_rows)
|
||||||
{
|
{
|
||||||
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
|
||||||
register int r, g, b;
|
register int r, g, b;
|
||||||
register JLONG * ctab = cconvert->rgb_ycc_tab;
|
register JLONG *ctab = cconvert->rgb_ycc_tab;
|
||||||
register JSAMPROW inptr;
|
register JSAMPROW inptr;
|
||||||
register JSAMPROW outptr;
|
register JSAMPROW outptr;
|
||||||
register JDIMENSION col;
|
register JDIMENSION col;
|
||||||
@@ -108,9 +105,8 @@ rgb_gray_convert_internal (j_compress_ptr cinfo,
|
|||||||
b = GETJSAMPLE(inptr[RGB_BLUE]);
|
b = GETJSAMPLE(inptr[RGB_BLUE]);
|
||||||
inptr += RGB_PIXELSIZE;
|
inptr += RGB_PIXELSIZE;
|
||||||
/* Y */
|
/* Y */
|
||||||
outptr[col] = (JSAMPLE)
|
outptr[col] = (JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
|
||||||
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
|
ctab[b + B_Y_OFF]) >> SCALEBITS);
|
||||||
>> SCALEBITS);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -123,9 +119,9 @@ rgb_gray_convert_internal (j_compress_ptr cinfo,
|
|||||||
|
|
||||||
INLINE
|
INLINE
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
rgb_rgb_convert_internal (j_compress_ptr cinfo,
|
rgb_rgb_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf,
|
||||||
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
JSAMPIMAGE output_buf, JDIMENSION output_row,
|
||||||
JDIMENSION output_row, int num_rows)
|
int num_rows)
|
||||||
{
|
{
|
||||||
register JSAMPROW inptr;
|
register JSAMPROW inptr;
|
||||||
register JSAMPROW outptr0, outptr1, outptr2;
|
register JSAMPROW outptr0, outptr1, outptr2;
|
||||||
|
|||||||
99
jccolor.c
99
jccolor.c
@@ -63,9 +63,9 @@ typedef my_color_converter *my_cconvert_ptr;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define SCALEBITS 16 /* speediest right-shift on some machines */
|
#define SCALEBITS 16 /* speediest right-shift on some machines */
|
||||||
#define CBCR_OFFSET ((JLONG) CENTERJSAMPLE << SCALEBITS)
|
#define CBCR_OFFSET ((JLONG)CENTERJSAMPLE << SCALEBITS)
|
||||||
#define ONE_HALF ((JLONG) 1 << (SCALEBITS-1))
|
#define ONE_HALF ((JLONG)1 << (SCALEBITS - 1))
|
||||||
#define FIX(x) ((JLONG) ((x) * (1L<<SCALEBITS) + 0.5))
|
#define FIX(x) ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
|
||||||
|
|
||||||
/* We allocate one big table and divide it up into eight parts, instead of
|
/* We allocate one big table and divide it up into eight parts, instead of
|
||||||
* doing eight alloc_small requests. This lets us use a single table base
|
* doing eight alloc_small requests. This lets us use a single table base
|
||||||
@@ -74,15 +74,15 @@ typedef my_color_converter *my_cconvert_ptr;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define R_Y_OFF 0 /* offset to R => Y section */
|
#define R_Y_OFF 0 /* offset to R => Y section */
|
||||||
#define G_Y_OFF (1*(MAXJSAMPLE+1)) /* offset to G => Y section */
|
#define G_Y_OFF (1 * (MAXJSAMPLE + 1)) /* offset to G => Y section */
|
||||||
#define B_Y_OFF (2*(MAXJSAMPLE+1)) /* etc. */
|
#define B_Y_OFF (2 * (MAXJSAMPLE + 1)) /* etc. */
|
||||||
#define R_CB_OFF (3*(MAXJSAMPLE+1))
|
#define R_CB_OFF (3 * (MAXJSAMPLE + 1))
|
||||||
#define G_CB_OFF (4*(MAXJSAMPLE+1))
|
#define G_CB_OFF (4 * (MAXJSAMPLE + 1))
|
||||||
#define B_CB_OFF (5*(MAXJSAMPLE+1))
|
#define B_CB_OFF (5 * (MAXJSAMPLE + 1))
|
||||||
#define R_CR_OFF B_CB_OFF /* B=>Cb, R=>Cr are the same */
|
#define R_CR_OFF B_CB_OFF /* B=>Cb, R=>Cr are the same */
|
||||||
#define G_CR_OFF (6*(MAXJSAMPLE+1))
|
#define G_CR_OFF (6 * (MAXJSAMPLE + 1))
|
||||||
#define B_CR_OFF (7*(MAXJSAMPLE+1))
|
#define B_CR_OFF (7 * (MAXJSAMPLE + 1))
|
||||||
#define TABLE_SIZE (8*(MAXJSAMPLE+1))
|
#define TABLE_SIZE (8 * (MAXJSAMPLE + 1))
|
||||||
|
|
||||||
|
|
||||||
/* Include inline routines for colorspace extensions */
|
/* Include inline routines for colorspace extensions */
|
||||||
@@ -195,33 +195,33 @@ typedef my_color_converter *my_cconvert_ptr;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
rgb_ycc_start (j_compress_ptr cinfo)
|
rgb_ycc_start(j_compress_ptr cinfo)
|
||||||
{
|
{
|
||||||
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
|
||||||
JLONG *rgb_ycc_tab;
|
JLONG *rgb_ycc_tab;
|
||||||
JLONG i;
|
JLONG i;
|
||||||
|
|
||||||
/* Allocate and fill in the conversion tables. */
|
/* Allocate and fill in the conversion tables. */
|
||||||
cconvert->rgb_ycc_tab = rgb_ycc_tab = (JLONG *)
|
cconvert->rgb_ycc_tab = rgb_ycc_tab = (JLONG *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||||
(TABLE_SIZE * sizeof(JLONG)));
|
(TABLE_SIZE * sizeof(JLONG)));
|
||||||
|
|
||||||
for (i = 0; i <= MAXJSAMPLE; i++) {
|
for (i = 0; i <= MAXJSAMPLE; i++) {
|
||||||
rgb_ycc_tab[i+R_Y_OFF] = FIX(0.29900) * i;
|
rgb_ycc_tab[i + R_Y_OFF] = FIX(0.29900) * i;
|
||||||
rgb_ycc_tab[i+G_Y_OFF] = FIX(0.58700) * i;
|
rgb_ycc_tab[i + G_Y_OFF] = FIX(0.58700) * i;
|
||||||
rgb_ycc_tab[i+B_Y_OFF] = FIX(0.11400) * i + ONE_HALF;
|
rgb_ycc_tab[i + B_Y_OFF] = FIX(0.11400) * i + ONE_HALF;
|
||||||
rgb_ycc_tab[i+R_CB_OFF] = (-FIX(0.16874)) * i;
|
rgb_ycc_tab[i + R_CB_OFF] = (-FIX(0.16874)) * i;
|
||||||
rgb_ycc_tab[i+G_CB_OFF] = (-FIX(0.33126)) * i;
|
rgb_ycc_tab[i + G_CB_OFF] = (-FIX(0.33126)) * i;
|
||||||
/* We use a rounding fudge-factor of 0.5-epsilon for Cb and Cr.
|
/* We use a rounding fudge-factor of 0.5-epsilon for Cb and Cr.
|
||||||
* This ensures that the maximum output will round to MAXJSAMPLE
|
* This ensures that the maximum output will round to MAXJSAMPLE
|
||||||
* not MAXJSAMPLE+1, and thus that we don't have to range-limit.
|
* not MAXJSAMPLE+1, and thus that we don't have to range-limit.
|
||||||
*/
|
*/
|
||||||
rgb_ycc_tab[i+B_CB_OFF] = FIX(0.50000) * i + CBCR_OFFSET + ONE_HALF-1;
|
rgb_ycc_tab[i + B_CB_OFF] = FIX(0.50000) * i + CBCR_OFFSET + ONE_HALF - 1;
|
||||||
/* B=>Cb and R=>Cr tables are the same
|
/* B=>Cb and R=>Cr tables are the same
|
||||||
rgb_ycc_tab[i+R_CR_OFF] = FIX(0.50000) * i + CBCR_OFFSET + ONE_HALF-1;
|
rgb_ycc_tab[i + R_CR_OFF] = FIX(0.50000) * i + CBCR_OFFSET + ONE_HALF - 1;
|
||||||
*/
|
*/
|
||||||
rgb_ycc_tab[i+G_CR_OFF] = (-FIX(0.41869)) * i;
|
rgb_ycc_tab[i + G_CR_OFF] = (-FIX(0.41869)) * i;
|
||||||
rgb_ycc_tab[i+B_CR_OFF] = (-FIX(0.08131)) * i;
|
rgb_ycc_tab[i + B_CR_OFF] = (-FIX(0.08131)) * i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,9 +231,8 @@ rgb_ycc_start (j_compress_ptr cinfo)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
rgb_ycc_convert (j_compress_ptr cinfo,
|
rgb_ycc_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
|
||||||
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
|
||||||
JDIMENSION output_row, int num_rows)
|
|
||||||
{
|
{
|
||||||
switch (cinfo->in_color_space) {
|
switch (cinfo->in_color_space) {
|
||||||
case JCS_EXT_RGB:
|
case JCS_EXT_RGB:
|
||||||
@@ -280,9 +279,8 @@ rgb_ycc_convert (j_compress_ptr cinfo,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
rgb_gray_convert (j_compress_ptr cinfo,
|
rgb_gray_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
|
||||||
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
|
||||||
JDIMENSION output_row, int num_rows)
|
|
||||||
{
|
{
|
||||||
switch (cinfo->in_color_space) {
|
switch (cinfo->in_color_space) {
|
||||||
case JCS_EXT_RGB:
|
case JCS_EXT_RGB:
|
||||||
@@ -326,9 +324,8 @@ rgb_gray_convert (j_compress_ptr cinfo,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
rgb_rgb_convert (j_compress_ptr cinfo,
|
rgb_rgb_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
|
||||||
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
|
||||||
JDIMENSION output_row, int num_rows)
|
|
||||||
{
|
{
|
||||||
switch (cinfo->in_color_space) {
|
switch (cinfo->in_color_space) {
|
||||||
case JCS_EXT_RGB:
|
case JCS_EXT_RGB:
|
||||||
@@ -376,11 +373,10 @@ rgb_rgb_convert (j_compress_ptr cinfo,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
cmyk_ycck_convert (j_compress_ptr cinfo,
|
cmyk_ycck_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
|
||||||
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
|
||||||
JDIMENSION output_row, int num_rows)
|
|
||||||
{
|
{
|
||||||
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
|
||||||
register int r, g, b;
|
register int r, g, b;
|
||||||
register JLONG *ctab = cconvert->rgb_ycc_tab;
|
register JLONG *ctab = cconvert->rgb_ycc_tab;
|
||||||
register JSAMPROW inptr;
|
register JSAMPROW inptr;
|
||||||
@@ -408,17 +404,14 @@ cmyk_ycck_convert (j_compress_ptr cinfo,
|
|||||||
* need the general RIGHT_SHIFT macro.
|
* need the general RIGHT_SHIFT macro.
|
||||||
*/
|
*/
|
||||||
/* Y */
|
/* Y */
|
||||||
outptr0[col] = (JSAMPLE)
|
outptr0[col] = (JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
|
||||||
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
|
ctab[b + B_Y_OFF]) >> SCALEBITS);
|
||||||
>> SCALEBITS);
|
|
||||||
/* Cb */
|
/* Cb */
|
||||||
outptr1[col] = (JSAMPLE)
|
outptr1[col] = (JSAMPLE)((ctab[r + R_CB_OFF] + ctab[g + G_CB_OFF] +
|
||||||
((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF])
|
ctab[b + B_CB_OFF]) >> SCALEBITS);
|
||||||
>> SCALEBITS);
|
|
||||||
/* Cr */
|
/* Cr */
|
||||||
outptr2[col] = (JSAMPLE)
|
outptr2[col] = (JSAMPLE)((ctab[r + R_CR_OFF] + ctab[g + G_CR_OFF] +
|
||||||
((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF])
|
ctab[b + B_CR_OFF]) >> SCALEBITS);
|
||||||
>> SCALEBITS);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -431,9 +424,8 @@ cmyk_ycck_convert (j_compress_ptr cinfo,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
grayscale_convert (j_compress_ptr cinfo,
|
grayscale_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
|
||||||
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
|
||||||
JDIMENSION output_row, int num_rows)
|
|
||||||
{
|
{
|
||||||
register JSAMPROW inptr;
|
register JSAMPROW inptr;
|
||||||
register JSAMPROW outptr;
|
register JSAMPROW outptr;
|
||||||
@@ -460,8 +452,7 @@ grayscale_convert (j_compress_ptr cinfo,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
null_convert (j_compress_ptr cinfo,
|
null_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
||||||
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
|
||||||
JDIMENSION output_row, int num_rows)
|
JDIMENSION output_row, int num_rows)
|
||||||
{
|
{
|
||||||
register JSAMPROW inptr;
|
register JSAMPROW inptr;
|
||||||
@@ -522,7 +513,7 @@ null_convert (j_compress_ptr cinfo,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
null_method (j_compress_ptr cinfo)
|
null_method(j_compress_ptr cinfo)
|
||||||
{
|
{
|
||||||
/* no work needed */
|
/* no work needed */
|
||||||
}
|
}
|
||||||
@@ -533,14 +524,14 @@ null_method (j_compress_ptr cinfo)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jinit_color_converter (j_compress_ptr cinfo)
|
jinit_color_converter(j_compress_ptr cinfo)
|
||||||
{
|
{
|
||||||
my_cconvert_ptr cconvert;
|
my_cconvert_ptr cconvert;
|
||||||
|
|
||||||
cconvert = (my_cconvert_ptr)
|
cconvert = (my_cconvert_ptr)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||||
sizeof(my_color_converter));
|
sizeof(my_color_converter));
|
||||||
cinfo->cconvert = (struct jpeg_color_converter *) cconvert;
|
cinfo->cconvert = (struct jpeg_color_converter *)cconvert;
|
||||||
/* set start_pass to null method until we find out differently */
|
/* set start_pass to null method until we find out differently */
|
||||||
cconvert->pub.start_pass = null_method;
|
cconvert->pub.start_pass = null_method;
|
||||||
|
|
||||||
|
|||||||
11
jcdctmgr.c
11
jcdctmgr.c
@@ -225,7 +225,7 @@ compute_reciprocal (UINT16 divisor, DCTELEM *dtbl)
|
|||||||
#endif
|
#endif
|
||||||
dtbl[DCTSIZE2 * 3] = (DCTELEM) r - sizeof(DCTELEM)*8; /* shift */
|
dtbl[DCTSIZE2 * 3] = (DCTELEM) r - sizeof(DCTELEM)*8; /* shift */
|
||||||
|
|
||||||
if(r <= 16) return 0;
|
if (r <= 16) return 0;
|
||||||
else return 1;
|
else return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -755,16 +755,16 @@ forward_DCT (j_compress_ptr cinfo, jpeg_component_info *compptr,
|
|||||||
if (coef_blocks[bi][i] > maxval)
|
if (coef_blocks[bi][i] > maxval)
|
||||||
coef_blocks[bi][i] = maxval;
|
coef_blocks[bi][i] = maxval;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef DCT_FLOAT_SUPPORTED
|
#ifdef DCT_FLOAT_SUPPORTED
|
||||||
|
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT *workspace)
|
convsamp_float(JSAMPARRAY sample_data, JDIMENSION start_col,
|
||||||
|
FAST_FLOAT *workspace)
|
||||||
{
|
{
|
||||||
register FAST_FLOAT *workspaceptr;
|
register FAST_FLOAT *workspaceptr;
|
||||||
register JSAMPROW elemptr;
|
register JSAMPROW elemptr;
|
||||||
@@ -795,7 +795,8 @@ convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT *worksp
|
|||||||
|
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
quantize_float (JCOEFPTR coef_block, FAST_FLOAT *divisors, FAST_FLOAT *workspace)
|
quantize_float(JCOEFPTR coef_block, FAST_FLOAT *divisors,
|
||||||
|
FAST_FLOAT *workspace)
|
||||||
{
|
{
|
||||||
register FAST_FLOAT temp;
|
register FAST_FLOAT temp;
|
||||||
register int i;
|
register int i;
|
||||||
|
|||||||
195
jchuff.c
195
jchuff.c
@@ -4,7 +4,7 @@
|
|||||||
* This file was part of the Independent JPEG Group's software:
|
* This file was part of the Independent JPEG Group's software:
|
||||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||||
* libjpeg-turbo Modifications:
|
* libjpeg-turbo Modifications:
|
||||||
* Copyright (C) 2009-2011, 2014-2016, D. R. Commander.
|
* Copyright (C) 2009-2011, 2014-2016, 2018-2019, D. R. Commander.
|
||||||
* Copyright (C) 2015, Matthieu Darbois.
|
* Copyright (C) 2015, Matthieu Darbois.
|
||||||
* For conditions of distribution and use, see the accompanying README.ijg
|
* For conditions of distribution and use, see the accompanying README.ijg
|
||||||
* file.
|
* file.
|
||||||
@@ -16,6 +16,9 @@
|
|||||||
* back up to the start of the current MCU. To do this, we copy state
|
* back up to the start of the current MCU. To do this, we copy state
|
||||||
* variables into local working storage, and update them back to the
|
* variables into local working storage, and update them back to the
|
||||||
* permanent JPEG objects only upon successful completion of an MCU.
|
* permanent JPEG objects only upon successful completion of an MCU.
|
||||||
|
*
|
||||||
|
* NOTE: All referenced figures are from
|
||||||
|
* Recommendation ITU-T T.81 (1992) | ISO/IEC 10918-1:1994.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define JPEG_INTERNALS
|
#define JPEG_INTERNALS
|
||||||
@@ -40,8 +43,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* NOTE: Both GCC and Clang define __GNUC__ */
|
/* NOTE: Both GCC and Clang define __GNUC__ */
|
||||||
#if defined __GNUC__ && (defined __arm__ || defined __aarch64__)
|
#if defined(__GNUC__) && (defined(__arm__) || defined(__aarch64__))
|
||||||
#if !defined __thumb__ || defined __thumb2__
|
#if !defined(__thumb__) || defined(__thumb2__)
|
||||||
#define USE_CLZ_INTRINSIC
|
#define USE_CLZ_INTRINSIC
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -55,10 +58,6 @@
|
|||||||
#define JPEG_NBITS_NONZERO(x) JPEG_NBITS(x)
|
#define JPEG_NBITS_NONZERO(x) JPEG_NBITS(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef min
|
|
||||||
#define min(a,b) ((a)<(b)?(a):(b))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Expanded entropy encoder object for Huffman encoding.
|
/* Expanded entropy encoder object for Huffman encoding.
|
||||||
*
|
*
|
||||||
@@ -78,10 +77,10 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef NO_STRUCT_ASSIGN
|
#ifndef NO_STRUCT_ASSIGN
|
||||||
#define ASSIGN_STATE(dest,src) ((dest) = (src))
|
#define ASSIGN_STATE(dest, src) ((dest) = (src))
|
||||||
#else
|
#else
|
||||||
#if MAX_COMPS_IN_SCAN == 4
|
#if MAX_COMPS_IN_SCAN == 4
|
||||||
#define ASSIGN_STATE(dest,src) \
|
#define ASSIGN_STATE(dest, src) \
|
||||||
((dest).put_buffer = (src).put_buffer, \
|
((dest).put_buffer = (src).put_buffer, \
|
||||||
(dest).put_bits = (src).put_bits, \
|
(dest).put_bits = (src).put_bits, \
|
||||||
(dest).last_dc_val[0] = (src).last_dc_val[0], \
|
(dest).last_dc_val[0] = (src).last_dc_val[0], \
|
||||||
@@ -128,12 +127,12 @@ typedef struct {
|
|||||||
|
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
METHODDEF(boolean) encode_mcu_huff (j_compress_ptr cinfo, JBLOCKROW *MCU_data);
|
METHODDEF(boolean) encode_mcu_huff(j_compress_ptr cinfo, JBLOCKROW *MCU_data);
|
||||||
METHODDEF(void) finish_pass_huff (j_compress_ptr cinfo);
|
METHODDEF(void) finish_pass_huff(j_compress_ptr cinfo);
|
||||||
#ifdef ENTROPY_OPT_SUPPORTED
|
#ifdef ENTROPY_OPT_SUPPORTED
|
||||||
METHODDEF(boolean) encode_mcu_gather (j_compress_ptr cinfo,
|
METHODDEF(boolean) encode_mcu_gather(j_compress_ptr cinfo,
|
||||||
JBLOCKROW *MCU_data);
|
JBLOCKROW *MCU_data);
|
||||||
METHODDEF(void) finish_pass_gather (j_compress_ptr cinfo);
|
METHODDEF(void) finish_pass_gather(j_compress_ptr cinfo);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -144,9 +143,9 @@ METHODDEF(void) finish_pass_gather (j_compress_ptr cinfo);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics)
|
start_pass_huff(j_compress_ptr cinfo, boolean gather_statistics)
|
||||||
{
|
{
|
||||||
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
|
huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
|
||||||
int ci, dctbl, actbl;
|
int ci, dctbl, actbl;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
|
|
||||||
@@ -180,12 +179,12 @@ start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics)
|
|||||||
/* Note that jpeg_gen_optimal_table expects 257 entries in each table! */
|
/* Note that jpeg_gen_optimal_table expects 257 entries in each table! */
|
||||||
if (entropy->dc_count_ptrs[dctbl] == NULL)
|
if (entropy->dc_count_ptrs[dctbl] == NULL)
|
||||||
entropy->dc_count_ptrs[dctbl] = (long *)
|
entropy->dc_count_ptrs[dctbl] = (long *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||||
257 * sizeof(long));
|
257 * sizeof(long));
|
||||||
MEMZERO(entropy->dc_count_ptrs[dctbl], 257 * sizeof(long));
|
MEMZERO(entropy->dc_count_ptrs[dctbl], 257 * sizeof(long));
|
||||||
if (entropy->ac_count_ptrs[actbl] == NULL)
|
if (entropy->ac_count_ptrs[actbl] == NULL)
|
||||||
entropy->ac_count_ptrs[actbl] = (long *)
|
entropy->ac_count_ptrs[actbl] = (long *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||||
257 * sizeof(long));
|
257 * sizeof(long));
|
||||||
MEMZERO(entropy->ac_count_ptrs[actbl], 257 * sizeof(long));
|
MEMZERO(entropy->ac_count_ptrs[actbl], 257 * sizeof(long));
|
||||||
#endif
|
#endif
|
||||||
@@ -193,9 +192,9 @@ start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics)
|
|||||||
/* Compute derived values for Huffman tables */
|
/* Compute derived values for Huffman tables */
|
||||||
/* We may do this more than once for a table, but it's not expensive */
|
/* We may do this more than once for a table, but it's not expensive */
|
||||||
jpeg_make_c_derived_tbl(cinfo, TRUE, dctbl,
|
jpeg_make_c_derived_tbl(cinfo, TRUE, dctbl,
|
||||||
& entropy->dc_derived_tbls[dctbl]);
|
&entropy->dc_derived_tbls[dctbl]);
|
||||||
jpeg_make_c_derived_tbl(cinfo, FALSE, actbl,
|
jpeg_make_c_derived_tbl(cinfo, FALSE, actbl,
|
||||||
& entropy->ac_derived_tbls[actbl]);
|
&entropy->ac_derived_tbls[actbl]);
|
||||||
}
|
}
|
||||||
/* Initialize DC predictions to 0 */
|
/* Initialize DC predictions to 0 */
|
||||||
entropy->saved.last_dc_val[ci] = 0;
|
entropy->saved.last_dc_val[ci] = 0;
|
||||||
@@ -219,7 +218,7 @@ start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno,
|
jpeg_make_c_derived_tbl(j_compress_ptr cinfo, boolean isDC, int tblno,
|
||||||
c_derived_tbl **pdtbl)
|
c_derived_tbl **pdtbl)
|
||||||
{
|
{
|
||||||
JHUFF_TBL *htbl;
|
JHUFF_TBL *htbl;
|
||||||
@@ -244,7 +243,7 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno,
|
|||||||
/* Allocate a workspace if we haven't already done so. */
|
/* Allocate a workspace if we haven't already done so. */
|
||||||
if (*pdtbl == NULL)
|
if (*pdtbl == NULL)
|
||||||
*pdtbl = (c_derived_tbl *)
|
*pdtbl = (c_derived_tbl *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||||
sizeof(c_derived_tbl));
|
sizeof(c_derived_tbl));
|
||||||
dtbl = *pdtbl;
|
dtbl = *pdtbl;
|
||||||
|
|
||||||
@@ -252,11 +251,11 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno,
|
|||||||
|
|
||||||
p = 0;
|
p = 0;
|
||||||
for (l = 1; l <= 16; l++) {
|
for (l = 1; l <= 16; l++) {
|
||||||
i = (int) htbl->bits[l];
|
i = (int)htbl->bits[l];
|
||||||
if (i < 0 || p + i > 256) /* protect against table overrun */
|
if (i < 0 || p + i > 256) /* protect against table overrun */
|
||||||
ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
|
ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
|
||||||
while (i--)
|
while (i--)
|
||||||
huffsize[p++] = (char) l;
|
huffsize[p++] = (char)l;
|
||||||
}
|
}
|
||||||
huffsize[p] = 0;
|
huffsize[p] = 0;
|
||||||
lastp = p;
|
lastp = p;
|
||||||
@@ -268,14 +267,14 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno,
|
|||||||
si = huffsize[0];
|
si = huffsize[0];
|
||||||
p = 0;
|
p = 0;
|
||||||
while (huffsize[p]) {
|
while (huffsize[p]) {
|
||||||
while (((int) huffsize[p]) == si) {
|
while (((int)huffsize[p]) == si) {
|
||||||
huffcode[p++] = code;
|
huffcode[p++] = code;
|
||||||
code++;
|
code++;
|
||||||
}
|
}
|
||||||
/* code is now 1 more than the last code used for codelength si; but
|
/* code is now 1 more than the last code used for codelength si; but
|
||||||
* it must still fit in si bits, since no code is allowed to be all ones.
|
* it must still fit in si bits, since no code is allowed to be all ones.
|
||||||
*/
|
*/
|
||||||
if (((JLONG) code) >= (((JLONG) 1) << si))
|
if (((JLONG)code) >= (((JLONG)1) << si))
|
||||||
ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
|
ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
|
||||||
code <<= 1;
|
code <<= 1;
|
||||||
si++;
|
si++;
|
||||||
@@ -310,20 +309,21 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno,
|
|||||||
/* Outputting bytes to the file */
|
/* Outputting bytes to the file */
|
||||||
|
|
||||||
/* Emit a byte, taking 'action' if must suspend. */
|
/* Emit a byte, taking 'action' if must suspend. */
|
||||||
#define emit_byte(state,val,action) \
|
#define emit_byte(state, val, action) { \
|
||||||
{ *(state)->next_output_byte++ = (JOCTET) (val); \
|
*(state)->next_output_byte++ = (JOCTET)(val); \
|
||||||
if (--(state)->free_in_buffer == 0) \
|
if (--(state)->free_in_buffer == 0) \
|
||||||
if (! dump_buffer(state)) \
|
if (!dump_buffer(state)) \
|
||||||
{ action; } }
|
{ action; } \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
LOCAL(boolean)
|
LOCAL(boolean)
|
||||||
dump_buffer (working_state *state)
|
dump_buffer(working_state *state)
|
||||||
/* Empty the output buffer; return TRUE if successful, FALSE if must suspend */
|
/* Empty the output buffer; return TRUE if successful, FALSE if must suspend */
|
||||||
{
|
{
|
||||||
struct jpeg_destination_mgr *dest = state->cinfo->dest;
|
struct jpeg_destination_mgr *dest = state->cinfo->dest;
|
||||||
|
|
||||||
if (! (*dest->empty_output_buffer) (state->cinfo))
|
if (!(*dest->empty_output_buffer) (state->cinfo))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
/* After a successful buffer dump, must reset buffer pointers */
|
/* After a successful buffer dump, must reset buffer pointers */
|
||||||
state->next_output_byte = dest->next_output_byte;
|
state->next_output_byte = dest->next_output_byte;
|
||||||
@@ -349,13 +349,15 @@ dump_buffer (working_state *state)
|
|||||||
*buffer++ = c; \
|
*buffer++ = c; \
|
||||||
if (c == 0xFF) /* need to stuff a zero byte? */ \
|
if (c == 0xFF) /* need to stuff a zero byte? */ \
|
||||||
*buffer++ = 0; \
|
*buffer++ = 0; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PUT_BITS(code, size) { \
|
#define PUT_BITS(code, size) { \
|
||||||
put_bits += size; \
|
put_bits += size; \
|
||||||
put_buffer = (put_buffer << size) | code; \
|
put_buffer = (put_buffer << size) | code; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SIZEOF_SIZE_T != 8 && !defined(_WIN64)
|
||||||
|
|
||||||
#define CHECKBUF15() { \
|
#define CHECKBUF15() { \
|
||||||
if (put_bits > 15) { \
|
if (put_bits > 15) { \
|
||||||
EMIT_BYTE() \
|
EMIT_BYTE() \
|
||||||
@@ -363,6 +365,8 @@ dump_buffer (working_state *state)
|
|||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CHECKBUF31() { \
|
#define CHECKBUF31() { \
|
||||||
if (put_bits > 31) { \
|
if (put_bits > 31) { \
|
||||||
EMIT_BYTE() \
|
EMIT_BYTE() \
|
||||||
@@ -387,7 +391,7 @@ dump_buffer (working_state *state)
|
|||||||
#error Cannot determine word size
|
#error Cannot determine word size
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SIZEOF_SIZE_T==8 || defined(_WIN64)
|
#if SIZEOF_SIZE_T == 8 || defined(_WIN64)
|
||||||
|
|
||||||
#define EMIT_BITS(code, size) { \
|
#define EMIT_BITS(code, size) { \
|
||||||
CHECKBUF47() \
|
CHECKBUF47() \
|
||||||
@@ -395,11 +399,11 @@ dump_buffer (working_state *state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define EMIT_CODE(code, size) { \
|
#define EMIT_CODE(code, size) { \
|
||||||
temp2 &= (((JLONG) 1)<<nbits) - 1; \
|
temp2 &= (((JLONG)1) << nbits) - 1; \
|
||||||
CHECKBUF31() \
|
CHECKBUF31() \
|
||||||
PUT_BITS(code, size) \
|
PUT_BITS(code, size) \
|
||||||
PUT_BITS(temp2, nbits) \
|
PUT_BITS(temp2, nbits) \
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@@ -409,12 +413,12 @@ dump_buffer (working_state *state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define EMIT_CODE(code, size) { \
|
#define EMIT_CODE(code, size) { \
|
||||||
temp2 &= (((JLONG) 1)<<nbits) - 1; \
|
temp2 &= (((JLONG)1) << nbits) - 1; \
|
||||||
PUT_BITS(code, size) \
|
PUT_BITS(code, size) \
|
||||||
CHECKBUF15() \
|
CHECKBUF15() \
|
||||||
PUT_BITS(temp2, nbits) \
|
PUT_BITS(temp2, nbits) \
|
||||||
CHECKBUF15() \
|
CHECKBUF15() \
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -428,40 +432,39 @@ dump_buffer (working_state *state)
|
|||||||
* scanning order-- 1, 8, 16, etc.), then this will produce an encoded block
|
* scanning order-- 1, 8, 16, etc.), then this will produce an encoded block
|
||||||
* larger than 200 bytes.
|
* larger than 200 bytes.
|
||||||
*/
|
*/
|
||||||
#define BUFSIZE (DCTSIZE2 * 4)
|
#define BUFSIZE (DCTSIZE2 * 8)
|
||||||
|
|
||||||
#define LOAD_BUFFER() { \
|
#define LOAD_BUFFER() { \
|
||||||
if (state->free_in_buffer < BUFSIZE) { \
|
if (state->free_in_buffer < BUFSIZE) { \
|
||||||
localbuf = 1; \
|
localbuf = 1; \
|
||||||
buffer = _buffer; \
|
buffer = _buffer; \
|
||||||
} \
|
} else \
|
||||||
else buffer = state->next_output_byte; \
|
buffer = state->next_output_byte; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define STORE_BUFFER() { \
|
#define STORE_BUFFER() { \
|
||||||
if (localbuf) { \
|
if (localbuf) { \
|
||||||
bytes = buffer - _buffer; \
|
bytes = buffer - _buffer; \
|
||||||
buffer = _buffer; \
|
buffer = _buffer; \
|
||||||
while (bytes > 0) { \
|
while (bytes > 0) { \
|
||||||
bytestocopy = min(bytes, state->free_in_buffer); \
|
bytestocopy = MIN(bytes, state->free_in_buffer); \
|
||||||
MEMCOPY(state->next_output_byte, buffer, bytestocopy); \
|
MEMCOPY(state->next_output_byte, buffer, bytestocopy); \
|
||||||
state->next_output_byte += bytestocopy; \
|
state->next_output_byte += bytestocopy; \
|
||||||
buffer += bytestocopy; \
|
buffer += bytestocopy; \
|
||||||
state->free_in_buffer -= bytestocopy; \
|
state->free_in_buffer -= bytestocopy; \
|
||||||
if (state->free_in_buffer == 0) \
|
if (state->free_in_buffer == 0) \
|
||||||
if (! dump_buffer(state)) return FALSE; \
|
if (!dump_buffer(state)) return FALSE; \
|
||||||
bytes -= bytestocopy; \
|
bytes -= bytestocopy; \
|
||||||
} \
|
} \
|
||||||
} \
|
} else { \
|
||||||
else { \
|
|
||||||
state->free_in_buffer -= (buffer - state->next_output_byte); \
|
state->free_in_buffer -= (buffer - state->next_output_byte); \
|
||||||
state->next_output_byte = buffer; \
|
state->next_output_byte = buffer; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LOCAL(boolean)
|
LOCAL(boolean)
|
||||||
flush_bits (working_state *state)
|
flush_bits(working_state *state)
|
||||||
{
|
{
|
||||||
JOCTET _buffer[BUFSIZE], *buffer;
|
JOCTET _buffer[BUFSIZE], *buffer;
|
||||||
size_t put_buffer; int put_bits;
|
size_t put_buffer; int put_bits;
|
||||||
@@ -486,7 +489,7 @@ flush_bits (working_state *state)
|
|||||||
/* Encode a single block's worth of coefficients */
|
/* Encode a single block's worth of coefficients */
|
||||||
|
|
||||||
LOCAL(boolean)
|
LOCAL(boolean)
|
||||||
encode_one_block_simd (working_state *state, JCOEFPTR block, int last_dc_val,
|
encode_one_block_simd(working_state *state, JCOEFPTR block, int last_dc_val,
|
||||||
c_derived_tbl *dctbl, c_derived_tbl *actbl)
|
c_derived_tbl *dctbl, c_derived_tbl *actbl)
|
||||||
{
|
{
|
||||||
JOCTET _buffer[BUFSIZE], *buffer;
|
JOCTET _buffer[BUFSIZE], *buffer;
|
||||||
@@ -503,7 +506,7 @@ encode_one_block_simd (working_state *state, JCOEFPTR block, int last_dc_val,
|
|||||||
}
|
}
|
||||||
|
|
||||||
LOCAL(boolean)
|
LOCAL(boolean)
|
||||||
encode_one_block (working_state *state, JCOEFPTR block, int last_dc_val,
|
encode_one_block(working_state *state, JCOEFPTR block, int last_dc_val,
|
||||||
c_derived_tbl *dctbl, c_derived_tbl *actbl)
|
c_derived_tbl *dctbl, c_derived_tbl *actbl)
|
||||||
{
|
{
|
||||||
int temp, temp2, temp3;
|
int temp, temp2, temp3;
|
||||||
@@ -544,7 +547,7 @@ encode_one_block (working_state *state, JCOEFPTR block, int last_dc_val,
|
|||||||
EMIT_BITS(code, size)
|
EMIT_BITS(code, size)
|
||||||
|
|
||||||
/* Mask off any extra bits in code */
|
/* Mask off any extra bits in code */
|
||||||
temp2 &= (((JLONG) 1)<<nbits) - 1;
|
temp2 &= (((JLONG)1) << nbits) - 1;
|
||||||
|
|
||||||
/* Emit that number of bits of the value, if positive, */
|
/* Emit that number of bits of the value, if positive, */
|
||||||
/* or the complement of its magnitude, if negative. */
|
/* or the complement of its magnitude, if negative. */
|
||||||
@@ -616,11 +619,11 @@ encode_one_block (working_state *state, JCOEFPTR block, int last_dc_val,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
LOCAL(boolean)
|
LOCAL(boolean)
|
||||||
emit_restart (working_state *state, int restart_num)
|
emit_restart(working_state *state, int restart_num)
|
||||||
{
|
{
|
||||||
int ci;
|
int ci;
|
||||||
|
|
||||||
if (! flush_bits(state))
|
if (!flush_bits(state))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
emit_byte(state, 0xFF, return FALSE);
|
emit_byte(state, 0xFF, return FALSE);
|
||||||
@@ -641,9 +644,9 @@ emit_restart (working_state *state, int restart_num)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(boolean)
|
METHODDEF(boolean)
|
||||||
encode_mcu_huff (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
encode_mcu_huff(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||||
{
|
{
|
||||||
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
|
huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
|
||||||
working_state state;
|
working_state state;
|
||||||
int blkn, ci;
|
int blkn, ci;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
@@ -657,7 +660,7 @@ encode_mcu_huff (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
/* Emit restart marker if needed */
|
/* Emit restart marker if needed */
|
||||||
if (cinfo->restart_interval) {
|
if (cinfo->restart_interval) {
|
||||||
if (entropy->restarts_to_go == 0)
|
if (entropy->restarts_to_go == 0)
|
||||||
if (! emit_restart(&state, entropy->next_restart_num))
|
if (!emit_restart(&state, entropy->next_restart_num))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -666,7 +669,7 @@ encode_mcu_huff (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
|
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
|
||||||
ci = cinfo->MCU_membership[blkn];
|
ci = cinfo->MCU_membership[blkn];
|
||||||
compptr = cinfo->cur_comp_info[ci];
|
compptr = cinfo->cur_comp_info[ci];
|
||||||
if (! encode_one_block_simd(&state,
|
if (!encode_one_block_simd(&state,
|
||||||
MCU_data[blkn][0], state.cur.last_dc_val[ci],
|
MCU_data[blkn][0], state.cur.last_dc_val[ci],
|
||||||
entropy->dc_derived_tbls[compptr->dc_tbl_no],
|
entropy->dc_derived_tbls[compptr->dc_tbl_no],
|
||||||
entropy->ac_derived_tbls[compptr->ac_tbl_no]))
|
entropy->ac_derived_tbls[compptr->ac_tbl_no]))
|
||||||
@@ -678,7 +681,7 @@ encode_mcu_huff (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
|
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
|
||||||
ci = cinfo->MCU_membership[blkn];
|
ci = cinfo->MCU_membership[blkn];
|
||||||
compptr = cinfo->cur_comp_info[ci];
|
compptr = cinfo->cur_comp_info[ci];
|
||||||
if (! encode_one_block(&state,
|
if (!encode_one_block(&state,
|
||||||
MCU_data[blkn][0], state.cur.last_dc_val[ci],
|
MCU_data[blkn][0], state.cur.last_dc_val[ci],
|
||||||
entropy->dc_derived_tbls[compptr->dc_tbl_no],
|
entropy->dc_derived_tbls[compptr->dc_tbl_no],
|
||||||
entropy->ac_derived_tbls[compptr->ac_tbl_no]))
|
entropy->ac_derived_tbls[compptr->ac_tbl_no]))
|
||||||
@@ -712,9 +715,9 @@ encode_mcu_huff (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
finish_pass_huff (j_compress_ptr cinfo)
|
finish_pass_huff(j_compress_ptr cinfo)
|
||||||
{
|
{
|
||||||
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
|
huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
|
||||||
working_state state;
|
working_state state;
|
||||||
|
|
||||||
/* Load up working state ... flush_bits needs it */
|
/* Load up working state ... flush_bits needs it */
|
||||||
@@ -724,7 +727,7 @@ finish_pass_huff (j_compress_ptr cinfo)
|
|||||||
state.cinfo = cinfo;
|
state.cinfo = cinfo;
|
||||||
|
|
||||||
/* Flush out the last data */
|
/* Flush out the last data */
|
||||||
if (! flush_bits(&state))
|
if (!flush_bits(&state))
|
||||||
ERREXIT(cinfo, JERR_CANT_SUSPEND);
|
ERREXIT(cinfo, JERR_CANT_SUSPEND);
|
||||||
|
|
||||||
/* Update state */
|
/* Update state */
|
||||||
@@ -751,7 +754,7 @@ finish_pass_huff (j_compress_ptr cinfo)
|
|||||||
/* Process a single block's worth of coefficients */
|
/* Process a single block's worth of coefficients */
|
||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
|
htest_one_block(j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
|
||||||
long dc_counts[], long ac_counts[])
|
long dc_counts[], long ac_counts[])
|
||||||
{
|
{
|
||||||
register int temp;
|
register int temp;
|
||||||
@@ -773,7 +776,7 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
|
|||||||
/* Check for out-of-range coefficient values.
|
/* Check for out-of-range coefficient values.
|
||||||
* Since we're encoding a difference, the range limit is twice as much.
|
* Since we're encoding a difference, the range limit is twice as much.
|
||||||
*/
|
*/
|
||||||
if (nbits > MAX_COEF_BITS+1)
|
if (nbits > MAX_COEF_BITS + 1)
|
||||||
ERREXIT(cinfo, JERR_BAD_DCT_COEF);
|
ERREXIT(cinfo, JERR_BAD_DCT_COEF);
|
||||||
|
|
||||||
/* Count the Huffman symbol for the number of bits */
|
/* Count the Huffman symbol for the number of bits */
|
||||||
@@ -824,9 +827,9 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(boolean)
|
METHODDEF(boolean)
|
||||||
encode_mcu_gather (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
encode_mcu_gather(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||||
{
|
{
|
||||||
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
|
huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
|
||||||
int blkn, ci;
|
int blkn, ci;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
|
|
||||||
@@ -863,13 +866,14 @@ encode_mcu_gather (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
* one bits (so that padding bits added at the end of a compressed segment
|
* one bits (so that padding bits added at the end of a compressed segment
|
||||||
* can't look like a valid code). Because of the canonical ordering of
|
* can't look like a valid code). Because of the canonical ordering of
|
||||||
* codewords, this just means that there must be an unused slot in the
|
* codewords, this just means that there must be an unused slot in the
|
||||||
* longest codeword length category. Section K.2 of the JPEG spec suggests
|
* longest codeword length category. Annex K (Clause K.2) of
|
||||||
* reserving such a slot by pretending that symbol 256 is a valid symbol
|
* Rec. ITU-T T.81 (1992) | ISO/IEC 10918-1:1994 suggests reserving such a slot
|
||||||
* with count 1. In theory that's not optimal; giving it count zero but
|
* by pretending that symbol 256 is a valid symbol with count 1. In theory
|
||||||
* including it in the symbol set anyway should give a better Huffman code.
|
* that's not optimal; giving it count zero but including it in the symbol set
|
||||||
* But the theoretically better code actually seems to come out worse in
|
* anyway should give a better Huffman code. But the theoretically better code
|
||||||
* practice, because it produces more all-ones bytes (which incur stuffed
|
* actually seems to come out worse in practice, because it produces more
|
||||||
* zero bytes in the final file). In any case the difference is tiny.
|
* all-ones bytes (which incur stuffed zero bytes in the final file). In any
|
||||||
|
* case the difference is tiny.
|
||||||
*
|
*
|
||||||
* The JPEG standard requires Huffman codes to be no more than 16 bits long.
|
* The JPEG standard requires Huffman codes to be no more than 16 bits long.
|
||||||
* If some symbols have a very small but nonzero probability, the Huffman tree
|
* If some symbols have a very small but nonzero probability, the Huffman tree
|
||||||
@@ -884,10 +888,10 @@ encode_mcu_gather (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL *htbl, long freq[])
|
jpeg_gen_optimal_table(j_compress_ptr cinfo, JHUFF_TBL *htbl, long freq[])
|
||||||
{
|
{
|
||||||
#define MAX_CLEN 32 /* assumed maximum initial code length */
|
#define MAX_CLEN 32 /* assumed maximum initial code length */
|
||||||
UINT8 bits[MAX_CLEN+1]; /* bits[k] = # of symbols with code length k */
|
UINT8 bits[MAX_CLEN + 1]; /* bits[k] = # of symbols with code length k */
|
||||||
int codesize[257]; /* codesize[k] = code length of symbol k */
|
int codesize[257]; /* codesize[k] = code length of symbol k */
|
||||||
int others[257]; /* next symbol in current branch of tree */
|
int others[257]; /* next symbol in current branch of tree */
|
||||||
int c1, c2;
|
int c1, c2;
|
||||||
@@ -971,13 +975,13 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL *htbl, long freq[])
|
|||||||
|
|
||||||
/* JPEG doesn't allow symbols with code lengths over 16 bits, so if the pure
|
/* JPEG doesn't allow symbols with code lengths over 16 bits, so if the pure
|
||||||
* Huffman procedure assigned any such lengths, we must adjust the coding.
|
* Huffman procedure assigned any such lengths, we must adjust the coding.
|
||||||
* Here is what the JPEG spec says about how this next bit works:
|
* Here is what Rec. ITU-T T.81 | ISO/IEC 10918-1 says about how this next
|
||||||
* Since symbols are paired for the longest Huffman code, the symbols are
|
* bit works: Since symbols are paired for the longest Huffman code, the
|
||||||
* removed from this length category two at a time. The prefix for the pair
|
* symbols are removed from this length category two at a time. The prefix
|
||||||
* (which is one bit shorter) is allocated to one of the pair; then,
|
* for the pair (which is one bit shorter) is allocated to one of the pair;
|
||||||
* skipping the BITS entry for that prefix length, a code word from the next
|
* then, skipping the BITS entry for that prefix length, a code word from the
|
||||||
* shortest nonzero BITS entry is converted into a prefix for two code words
|
* next shortest nonzero BITS entry is converted into a prefix for two code
|
||||||
* one bit longer.
|
* words one bit longer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (i = MAX_CLEN; i > 16; i--) {
|
for (i = MAX_CLEN; i > 16; i--) {
|
||||||
@@ -987,8 +991,8 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL *htbl, long freq[])
|
|||||||
j--;
|
j--;
|
||||||
|
|
||||||
bits[i] -= 2; /* remove two symbols */
|
bits[i] -= 2; /* remove two symbols */
|
||||||
bits[i-1]++; /* one goes in this length */
|
bits[i - 1]++; /* one goes in this length */
|
||||||
bits[j+1] += 2; /* two new symbols in this length */
|
bits[j + 1] += 2; /* two new symbols in this length */
|
||||||
bits[j]--; /* symbol of this length is now a prefix */
|
bits[j]--; /* symbol of this length is now a prefix */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1003,13 +1007,14 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL *htbl, long freq[])
|
|||||||
|
|
||||||
/* Return a list of the symbols sorted by code length */
|
/* Return a list of the symbols sorted by code length */
|
||||||
/* It's not real clear to me why we don't need to consider the codelength
|
/* It's not real clear to me why we don't need to consider the codelength
|
||||||
* changes made above, but the JPEG spec seems to think this works.
|
* changes made above, but Rec. ITU-T T.81 | ISO/IEC 10918-1 seems to think
|
||||||
|
* this works.
|
||||||
*/
|
*/
|
||||||
p = 0;
|
p = 0;
|
||||||
for (i = 1; i <= MAX_CLEN; i++) {
|
for (i = 1; i <= MAX_CLEN; i++) {
|
||||||
for (j = 0; j <= 255; j++) {
|
for (j = 0; j <= 255; j++) {
|
||||||
if (codesize[j] == i) {
|
if (codesize[j] == i) {
|
||||||
htbl->huffval[p] = (UINT8) j;
|
htbl->huffval[p] = (UINT8)j;
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1025,9 +1030,9 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL *htbl, long freq[])
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
finish_pass_gather (j_compress_ptr cinfo)
|
finish_pass_gather(j_compress_ptr cinfo)
|
||||||
{
|
{
|
||||||
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
|
huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
|
||||||
int ci, dctbl, actbl;
|
int ci, dctbl, actbl;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
JHUFF_TBL **htblptr;
|
JHUFF_TBL **htblptr;
|
||||||
@@ -1044,17 +1049,17 @@ finish_pass_gather (j_compress_ptr cinfo)
|
|||||||
compptr = cinfo->cur_comp_info[ci];
|
compptr = cinfo->cur_comp_info[ci];
|
||||||
dctbl = compptr->dc_tbl_no;
|
dctbl = compptr->dc_tbl_no;
|
||||||
actbl = compptr->ac_tbl_no;
|
actbl = compptr->ac_tbl_no;
|
||||||
if (! did_dc[dctbl]) {
|
if (!did_dc[dctbl]) {
|
||||||
htblptr = & cinfo->dc_huff_tbl_ptrs[dctbl];
|
htblptr = &cinfo->dc_huff_tbl_ptrs[dctbl];
|
||||||
if (*htblptr == NULL)
|
if (*htblptr == NULL)
|
||||||
*htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
|
*htblptr = jpeg_alloc_huff_table((j_common_ptr)cinfo);
|
||||||
jpeg_gen_optimal_table(cinfo, *htblptr, entropy->dc_count_ptrs[dctbl]);
|
jpeg_gen_optimal_table(cinfo, *htblptr, entropy->dc_count_ptrs[dctbl]);
|
||||||
did_dc[dctbl] = TRUE;
|
did_dc[dctbl] = TRUE;
|
||||||
}
|
}
|
||||||
if (! did_ac[actbl]) {
|
if (!did_ac[actbl]) {
|
||||||
htblptr = & cinfo->ac_huff_tbl_ptrs[actbl];
|
htblptr = &cinfo->ac_huff_tbl_ptrs[actbl];
|
||||||
if (*htblptr == NULL)
|
if (*htblptr == NULL)
|
||||||
*htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
|
*htblptr = jpeg_alloc_huff_table((j_common_ptr)cinfo);
|
||||||
jpeg_gen_optimal_table(cinfo, *htblptr, entropy->ac_count_ptrs[actbl]);
|
jpeg_gen_optimal_table(cinfo, *htblptr, entropy->ac_count_ptrs[actbl]);
|
||||||
did_ac[actbl] = TRUE;
|
did_ac[actbl] = TRUE;
|
||||||
}
|
}
|
||||||
@@ -1070,15 +1075,15 @@ finish_pass_gather (j_compress_ptr cinfo)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jinit_huff_encoder (j_compress_ptr cinfo)
|
jinit_huff_encoder(j_compress_ptr cinfo)
|
||||||
{
|
{
|
||||||
huff_entropy_ptr entropy;
|
huff_entropy_ptr entropy;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
entropy = (huff_entropy_ptr)
|
entropy = (huff_entropy_ptr)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||||
sizeof(huff_entropy_encoder));
|
sizeof(huff_entropy_encoder));
|
||||||
cinfo->entropy = (struct jpeg_entropy_encoder *) entropy;
|
cinfo->entropy = (struct jpeg_entropy_encoder *)entropy;
|
||||||
entropy->pub.start_pass = start_pass_huff;
|
entropy->pub.start_pass = start_pass_huff;
|
||||||
|
|
||||||
/* Mark tables unallocated */
|
/* Mark tables unallocated */
|
||||||
|
|||||||
5
jchuff.h
5
jchuff.h
@@ -35,9 +35,8 @@ typedef struct {
|
|||||||
} c_derived_tbl;
|
} c_derived_tbl;
|
||||||
|
|
||||||
/* Expand a Huffman table definition into the derived format */
|
/* Expand a Huffman table definition into the derived format */
|
||||||
EXTERN(void) jpeg_make_c_derived_tbl
|
EXTERN(void) jpeg_make_c_derived_tbl(j_compress_ptr cinfo, boolean isDC,
|
||||||
(j_compress_ptr cinfo, boolean isDC, int tblno,
|
int tblno, c_derived_tbl **pdtbl);
|
||||||
c_derived_tbl ** pdtbl);
|
|
||||||
|
|
||||||
/* Generate an optimal table definition given the specified counts */
|
/* Generate an optimal table definition given the specified counts */
|
||||||
EXTERN(void) jpeg_gen_optimal_table
|
EXTERN(void) jpeg_gen_optimal_table
|
||||||
|
|||||||
105
jcicc.c
Normal file
105
jcicc.c
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
/*
|
||||||
|
* jcicc.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 1997-1998, Thomas G. Lane, Todd Newman.
|
||||||
|
* Copyright (C) 2017, D. R. Commander.
|
||||||
|
* For conditions of distribution and use, see the accompanying README.ijg
|
||||||
|
* file.
|
||||||
|
*
|
||||||
|
* This file provides code to write International Color Consortium (ICC) device
|
||||||
|
* profiles embedded in JFIF JPEG image files. The ICC has defined a standard
|
||||||
|
* for including such data in JPEG "APP2" markers. The code given here does
|
||||||
|
* not know anything about the internal structure of the ICC profile data; it
|
||||||
|
* just knows how to embed the profile data in a JPEG file while writing it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define JPEG_INTERNALS
|
||||||
|
#include "jinclude.h"
|
||||||
|
#include "jpeglib.h"
|
||||||
|
#include "jerror.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Since an ICC profile can be larger than the maximum size of a JPEG marker
|
||||||
|
* (64K), we need provisions to split it into multiple markers. The format
|
||||||
|
* defined by the ICC specifies one or more APP2 markers containing the
|
||||||
|
* following data:
|
||||||
|
* Identifying string ASCII "ICC_PROFILE\0" (12 bytes)
|
||||||
|
* Marker sequence number 1 for first APP2, 2 for next, etc (1 byte)
|
||||||
|
* Number of markers Total number of APP2's used (1 byte)
|
||||||
|
* Profile data (remainder of APP2 data)
|
||||||
|
* Decoders should use the marker sequence numbers to reassemble the profile,
|
||||||
|
* rather than assuming that the APP2 markers appear in the correct sequence.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define ICC_MARKER (JPEG_APP0 + 2) /* JPEG marker code for ICC */
|
||||||
|
#define ICC_OVERHEAD_LEN 14 /* size of non-profile data in APP2 */
|
||||||
|
#define MAX_BYTES_IN_MARKER 65533 /* maximum data len of a JPEG marker */
|
||||||
|
#define MAX_DATA_BYTES_IN_MARKER (MAX_BYTES_IN_MARKER - ICC_OVERHEAD_LEN)
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This routine writes the given ICC profile data into a JPEG file. It *must*
|
||||||
|
* be called AFTER calling jpeg_start_compress() and BEFORE the first call to
|
||||||
|
* jpeg_write_scanlines(). (This ordering ensures that the APP2 marker(s) will
|
||||||
|
* appear after the SOI and JFIF or Adobe markers, but before all else.)
|
||||||
|
*/
|
||||||
|
|
||||||
|
GLOBAL(void)
|
||||||
|
jpeg_write_icc_profile(j_compress_ptr cinfo, const JOCTET *icc_data_ptr,
|
||||||
|
unsigned int icc_data_len)
|
||||||
|
{
|
||||||
|
unsigned int num_markers; /* total number of markers we'll write */
|
||||||
|
int cur_marker = 1; /* per spec, counting starts at 1 */
|
||||||
|
unsigned int length; /* number of bytes to write in this marker */
|
||||||
|
|
||||||
|
if (icc_data_ptr == NULL || icc_data_len == 0)
|
||||||
|
ERREXIT(cinfo, JERR_BUFFER_SIZE);
|
||||||
|
if (cinfo->global_state < CSTATE_SCANNING)
|
||||||
|
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
||||||
|
|
||||||
|
/* Calculate the number of markers we'll need, rounding up of course */
|
||||||
|
num_markers = icc_data_len / MAX_DATA_BYTES_IN_MARKER;
|
||||||
|
if (num_markers * MAX_DATA_BYTES_IN_MARKER != icc_data_len)
|
||||||
|
num_markers++;
|
||||||
|
|
||||||
|
while (icc_data_len > 0) {
|
||||||
|
/* length of profile to put in this marker */
|
||||||
|
length = icc_data_len;
|
||||||
|
if (length > MAX_DATA_BYTES_IN_MARKER)
|
||||||
|
length = MAX_DATA_BYTES_IN_MARKER;
|
||||||
|
icc_data_len -= length;
|
||||||
|
|
||||||
|
/* Write the JPEG marker header (APP2 code and marker length) */
|
||||||
|
jpeg_write_m_header(cinfo, ICC_MARKER,
|
||||||
|
(unsigned int)(length + ICC_OVERHEAD_LEN));
|
||||||
|
|
||||||
|
/* Write the marker identifying string "ICC_PROFILE" (null-terminated). We
|
||||||
|
* code it in this less-than-transparent way so that the code works even if
|
||||||
|
* the local character set is not ASCII.
|
||||||
|
*/
|
||||||
|
jpeg_write_m_byte(cinfo, 0x49);
|
||||||
|
jpeg_write_m_byte(cinfo, 0x43);
|
||||||
|
jpeg_write_m_byte(cinfo, 0x43);
|
||||||
|
jpeg_write_m_byte(cinfo, 0x5F);
|
||||||
|
jpeg_write_m_byte(cinfo, 0x50);
|
||||||
|
jpeg_write_m_byte(cinfo, 0x52);
|
||||||
|
jpeg_write_m_byte(cinfo, 0x4F);
|
||||||
|
jpeg_write_m_byte(cinfo, 0x46);
|
||||||
|
jpeg_write_m_byte(cinfo, 0x49);
|
||||||
|
jpeg_write_m_byte(cinfo, 0x4C);
|
||||||
|
jpeg_write_m_byte(cinfo, 0x45);
|
||||||
|
jpeg_write_m_byte(cinfo, 0x0);
|
||||||
|
|
||||||
|
/* Add the sequencing info */
|
||||||
|
jpeg_write_m_byte(cinfo, cur_marker);
|
||||||
|
jpeg_write_m_byte(cinfo, (int)num_markers);
|
||||||
|
|
||||||
|
/* Add the profile data */
|
||||||
|
while (length--) {
|
||||||
|
jpeg_write_m_byte(cinfo, *icc_data_ptr);
|
||||||
|
icc_data_ptr++;
|
||||||
|
}
|
||||||
|
cur_marker++;
|
||||||
|
}
|
||||||
|
}
|
||||||
38
jcmainct.c
38
jcmainct.c
@@ -39,8 +39,9 @@ typedef my_main_controller *my_main_ptr;
|
|||||||
|
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
METHODDEF(void) process_data_simple_main
|
METHODDEF(void) process_data_simple_main(j_compress_ptr cinfo,
|
||||||
(j_compress_ptr cinfo, JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
|
JSAMPARRAY input_buf,
|
||||||
|
JDIMENSION *in_row_ctr,
|
||||||
JDIMENSION in_rows_avail);
|
JDIMENSION in_rows_avail);
|
||||||
|
|
||||||
|
|
||||||
@@ -49,9 +50,9 @@ METHODDEF(void) process_data_simple_main
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
|
start_pass_main(j_compress_ptr cinfo, J_BUF_MODE pass_mode)
|
||||||
{
|
{
|
||||||
my_main_ptr main_ptr = (my_main_ptr) cinfo->main;
|
my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
|
||||||
|
|
||||||
/* Do nothing in raw-data mode. */
|
/* Do nothing in raw-data mode. */
|
||||||
if (cinfo->raw_data_in)
|
if (cinfo->raw_data_in)
|
||||||
@@ -75,19 +76,18 @@ start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
process_data_simple_main (j_compress_ptr cinfo,
|
process_data_simple_main(j_compress_ptr cinfo, JSAMPARRAY input_buf,
|
||||||
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
|
JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail)
|
||||||
JDIMENSION in_rows_avail)
|
|
||||||
{
|
{
|
||||||
my_main_ptr main_ptr = (my_main_ptr) cinfo->main;
|
my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
|
||||||
|
|
||||||
while (main_ptr->cur_iMCU_row < cinfo->total_iMCU_rows) {
|
while (main_ptr->cur_iMCU_row < cinfo->total_iMCU_rows) {
|
||||||
/* Read input data if we haven't filled the main buffer yet */
|
/* Read input data if we haven't filled the main buffer yet */
|
||||||
if (main_ptr->rowgroup_ctr < DCTSIZE)
|
if (main_ptr->rowgroup_ctr < DCTSIZE)
|
||||||
(*cinfo->prep->pre_process_data) (cinfo,
|
(*cinfo->prep->pre_process_data) (cinfo, input_buf, in_row_ctr,
|
||||||
input_buf, in_row_ctr, in_rows_avail,
|
in_rows_avail, main_ptr->buffer,
|
||||||
main_ptr->buffer, &main_ptr->rowgroup_ctr,
|
&main_ptr->rowgroup_ctr,
|
||||||
(JDIMENSION) DCTSIZE);
|
(JDIMENSION)DCTSIZE);
|
||||||
|
|
||||||
/* If we don't have a full iMCU row buffered, return to application for
|
/* If we don't have a full iMCU row buffered, return to application for
|
||||||
* more data. Note that preprocessor will always pad to fill the iMCU row
|
* more data. Note that preprocessor will always pad to fill the iMCU row
|
||||||
@@ -97,14 +97,14 @@ process_data_simple_main (j_compress_ptr cinfo,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* Send the completed row to the compressor */
|
/* Send the completed row to the compressor */
|
||||||
if (! (*cinfo->coef->compress_data) (cinfo, main_ptr->buffer)) {
|
if (!(*cinfo->coef->compress_data) (cinfo, main_ptr->buffer)) {
|
||||||
/* If compressor did not consume the whole row, then we must need to
|
/* If compressor did not consume the whole row, then we must need to
|
||||||
* suspend processing and return to the application. In this situation
|
* suspend processing and return to the application. In this situation
|
||||||
* we pretend we didn't yet consume the last input row; otherwise, if
|
* we pretend we didn't yet consume the last input row; otherwise, if
|
||||||
* it happened to be the last row of the image, the application would
|
* it happened to be the last row of the image, the application would
|
||||||
* think we were done.
|
* think we were done.
|
||||||
*/
|
*/
|
||||||
if (! main_ptr->suspended) {
|
if (!main_ptr->suspended) {
|
||||||
(*in_row_ctr)--;
|
(*in_row_ctr)--;
|
||||||
main_ptr->suspended = TRUE;
|
main_ptr->suspended = TRUE;
|
||||||
}
|
}
|
||||||
@@ -128,16 +128,16 @@ process_data_simple_main (j_compress_ptr cinfo,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
|
jinit_c_main_controller(j_compress_ptr cinfo, boolean need_full_buffer)
|
||||||
{
|
{
|
||||||
my_main_ptr main_ptr;
|
my_main_ptr main_ptr;
|
||||||
int ci;
|
int ci;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
|
|
||||||
main_ptr = (my_main_ptr)
|
main_ptr = (my_main_ptr)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||||
sizeof(my_main_controller));
|
sizeof(my_main_controller));
|
||||||
cinfo->main = (struct jpeg_c_main_controller *) main_ptr;
|
cinfo->main = (struct jpeg_c_main_controller *)main_ptr;
|
||||||
main_ptr->pub.start_pass = start_pass_main;
|
main_ptr->pub.start_pass = start_pass_main;
|
||||||
|
|
||||||
/* We don't need to create a buffer in raw-data mode. */
|
/* We don't need to create a buffer in raw-data mode. */
|
||||||
@@ -154,9 +154,9 @@ jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
|
|||||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
main_ptr->buffer[ci] = (*cinfo->mem->alloc_sarray)
|
main_ptr->buffer[ci] = (*cinfo->mem->alloc_sarray)
|
||||||
((j_common_ptr) cinfo, JPOOL_IMAGE,
|
((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||||
compptr->width_in_blocks * DCTSIZE,
|
compptr->width_in_blocks * DCTSIZE,
|
||||||
(JDIMENSION) (compptr->v_samp_factor * DCTSIZE));
|
(JDIMENSION)(compptr->v_samp_factor * DCTSIZE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
93
jcmarker.c
93
jcmarker.c
@@ -110,30 +110,30 @@ typedef my_marker_writer *my_marker_ptr;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
emit_byte (j_compress_ptr cinfo, int val)
|
emit_byte(j_compress_ptr cinfo, int val)
|
||||||
/* Emit a byte */
|
/* Emit a byte */
|
||||||
{
|
{
|
||||||
struct jpeg_destination_mgr *dest = cinfo->dest;
|
struct jpeg_destination_mgr *dest = cinfo->dest;
|
||||||
|
|
||||||
*(dest->next_output_byte)++ = (JOCTET) val;
|
*(dest->next_output_byte)++ = (JOCTET)val;
|
||||||
if (--dest->free_in_buffer == 0) {
|
if (--dest->free_in_buffer == 0) {
|
||||||
if (! (*dest->empty_output_buffer) (cinfo))
|
if (!(*dest->empty_output_buffer) (cinfo))
|
||||||
ERREXIT(cinfo, JERR_CANT_SUSPEND);
|
ERREXIT(cinfo, JERR_CANT_SUSPEND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
emit_marker (j_compress_ptr cinfo, JPEG_MARKER mark)
|
emit_marker(j_compress_ptr cinfo, JPEG_MARKER mark)
|
||||||
/* Emit a marker code */
|
/* Emit a marker code */
|
||||||
{
|
{
|
||||||
emit_byte(cinfo, 0xFF);
|
emit_byte(cinfo, 0xFF);
|
||||||
emit_byte(cinfo, (int) mark);
|
emit_byte(cinfo, (int)mark);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
emit_2bytes (j_compress_ptr cinfo, int value)
|
emit_2bytes(j_compress_ptr cinfo, int value)
|
||||||
/* Emit a 2-byte integer; these are always MSB first in JPEG files */
|
/* Emit a 2-byte integer; these are always MSB first in JPEG files */
|
||||||
{
|
{
|
||||||
emit_byte(cinfo, (value >> 8) & 0xFF);
|
emit_byte(cinfo, (value >> 8) & 0xFF);
|
||||||
@@ -146,7 +146,7 @@ emit_2bytes (j_compress_ptr cinfo, int value)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
LOCAL(int)
|
LOCAL(int)
|
||||||
emit_dqt (j_compress_ptr cinfo, int index)
|
emit_dqt(j_compress_ptr cinfo, int index)
|
||||||
/* Emit a DQT marker */
|
/* Emit a DQT marker */
|
||||||
/* Returns the precision used (0 = 8bits, 1 = 16bits) for baseline checking */
|
/* Returns the precision used (0 = 8bits, 1 = 16bits) for baseline checking */
|
||||||
{
|
{
|
||||||
@@ -163,19 +163,19 @@ emit_dqt (j_compress_ptr cinfo, int index)
|
|||||||
prec = 1;
|
prec = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! qtbl->sent_table) {
|
if (!qtbl->sent_table) {
|
||||||
emit_marker(cinfo, M_DQT);
|
emit_marker(cinfo, M_DQT);
|
||||||
|
|
||||||
emit_2bytes(cinfo, prec ? DCTSIZE2*2 + 1 + 2 : DCTSIZE2 + 1 + 2);
|
emit_2bytes(cinfo, prec ? DCTSIZE2 * 2 + 1 + 2 : DCTSIZE2 + 1 + 2);
|
||||||
|
|
||||||
emit_byte(cinfo, index + (prec<<4));
|
emit_byte(cinfo, index + (prec << 4));
|
||||||
|
|
||||||
for (i = 0; i < DCTSIZE2; i++) {
|
for (i = 0; i < DCTSIZE2; i++) {
|
||||||
/* The table entries must be emitted in zigzag order. */
|
/* The table entries must be emitted in zigzag order. */
|
||||||
unsigned int qval = qtbl->quantval[jpeg_natural_order[i]];
|
unsigned int qval = qtbl->quantval[jpeg_natural_order[i]];
|
||||||
if (prec)
|
if (prec)
|
||||||
emit_byte(cinfo, (int) (qval >> 8));
|
emit_byte(cinfo, (int)(qval >> 8));
|
||||||
emit_byte(cinfo, (int) (qval & 0xFF));
|
emit_byte(cinfo, (int)(qval & 0xFF));
|
||||||
}
|
}
|
||||||
|
|
||||||
qtbl->sent_table = TRUE;
|
qtbl->sent_table = TRUE;
|
||||||
@@ -252,7 +252,7 @@ emit_multi_dqt (j_compress_ptr cinfo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
emit_dht (j_compress_ptr cinfo, int index, boolean is_ac)
|
emit_dht(j_compress_ptr cinfo, int index, boolean is_ac)
|
||||||
/* Emit a DHT marker */
|
/* Emit a DHT marker */
|
||||||
{
|
{
|
||||||
JHUFF_TBL *htbl;
|
JHUFF_TBL *htbl;
|
||||||
@@ -268,7 +268,7 @@ emit_dht (j_compress_ptr cinfo, int index, boolean is_ac)
|
|||||||
if (htbl == NULL)
|
if (htbl == NULL)
|
||||||
ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, index);
|
ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, index);
|
||||||
|
|
||||||
if (! htbl->sent_table) {
|
if (!htbl->sent_table) {
|
||||||
emit_marker(cinfo, M_DHT);
|
emit_marker(cinfo, M_DHT);
|
||||||
|
|
||||||
length = 0;
|
length = 0;
|
||||||
@@ -399,7 +399,7 @@ emit_multi_dht (j_compress_ptr cinfo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
emit_dac (j_compress_ptr cinfo)
|
emit_dac(j_compress_ptr cinfo)
|
||||||
/* Emit a DAC marker */
|
/* Emit a DAC marker */
|
||||||
/* Since the useful info is so small, we want to emit all the tables in */
|
/* Since the useful info is so small, we want to emit all the tables in */
|
||||||
/* one DAC marker. Therefore this routine does its own scan of the table. */
|
/* one DAC marker. Therefore this routine does its own scan of the table. */
|
||||||
@@ -430,12 +430,12 @@ emit_dac (j_compress_ptr cinfo)
|
|||||||
if (length) {
|
if (length) {
|
||||||
emit_marker(cinfo, M_DAC);
|
emit_marker(cinfo, M_DAC);
|
||||||
|
|
||||||
emit_2bytes(cinfo, length*2 + 2);
|
emit_2bytes(cinfo, length * 2 + 2);
|
||||||
|
|
||||||
for (i = 0; i < NUM_ARITH_TBLS; i++) {
|
for (i = 0; i < NUM_ARITH_TBLS; i++) {
|
||||||
if (dc_in_use[i]) {
|
if (dc_in_use[i]) {
|
||||||
emit_byte(cinfo, i);
|
emit_byte(cinfo, i);
|
||||||
emit_byte(cinfo, cinfo->arith_dc_L[i] + (cinfo->arith_dc_U[i]<<4));
|
emit_byte(cinfo, cinfo->arith_dc_L[i] + (cinfo->arith_dc_U[i] << 4));
|
||||||
}
|
}
|
||||||
if (ac_in_use[i]) {
|
if (ac_in_use[i]) {
|
||||||
emit_byte(cinfo, i + 0x10);
|
emit_byte(cinfo, i + 0x10);
|
||||||
@@ -448,19 +448,19 @@ emit_dac (j_compress_ptr cinfo)
|
|||||||
|
|
||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
emit_dri (j_compress_ptr cinfo)
|
emit_dri(j_compress_ptr cinfo)
|
||||||
/* Emit a DRI marker */
|
/* Emit a DRI marker */
|
||||||
{
|
{
|
||||||
emit_marker(cinfo, M_DRI);
|
emit_marker(cinfo, M_DRI);
|
||||||
|
|
||||||
emit_2bytes(cinfo, 4); /* fixed length */
|
emit_2bytes(cinfo, 4); /* fixed length */
|
||||||
|
|
||||||
emit_2bytes(cinfo, (int) cinfo->restart_interval);
|
emit_2bytes(cinfo, (int)cinfo->restart_interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
emit_sof (j_compress_ptr cinfo, JPEG_MARKER code)
|
emit_sof(j_compress_ptr cinfo, JPEG_MARKER code)
|
||||||
/* Emit a SOF marker */
|
/* Emit a SOF marker */
|
||||||
{
|
{
|
||||||
int ci;
|
int ci;
|
||||||
@@ -471,13 +471,12 @@ emit_sof (j_compress_ptr cinfo, JPEG_MARKER code)
|
|||||||
emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */
|
emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */
|
||||||
|
|
||||||
/* Make sure image isn't bigger than SOF field can handle */
|
/* Make sure image isn't bigger than SOF field can handle */
|
||||||
if ((long) cinfo->_jpeg_height > 65535L ||
|
if ((long)cinfo->_jpeg_height > 65535L || (long)cinfo->_jpeg_width > 65535L)
|
||||||
(long) cinfo->_jpeg_width > 65535L)
|
ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int)65535);
|
||||||
ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) 65535);
|
|
||||||
|
|
||||||
emit_byte(cinfo, cinfo->data_precision);
|
emit_byte(cinfo, cinfo->data_precision);
|
||||||
emit_2bytes(cinfo, (int) cinfo->_jpeg_height);
|
emit_2bytes(cinfo, (int)cinfo->_jpeg_height);
|
||||||
emit_2bytes(cinfo, (int) cinfo->_jpeg_width);
|
emit_2bytes(cinfo, (int)cinfo->_jpeg_width);
|
||||||
|
|
||||||
emit_byte(cinfo, cinfo->num_components);
|
emit_byte(cinfo, cinfo->num_components);
|
||||||
|
|
||||||
@@ -491,7 +490,7 @@ emit_sof (j_compress_ptr cinfo, JPEG_MARKER code)
|
|||||||
|
|
||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
emit_sos (j_compress_ptr cinfo)
|
emit_sos(j_compress_ptr cinfo)
|
||||||
/* Emit a SOS marker */
|
/* Emit a SOS marker */
|
||||||
{
|
{
|
||||||
int i, td, ta;
|
int i, td, ta;
|
||||||
@@ -526,7 +525,7 @@ emit_sos (j_compress_ptr cinfo)
|
|||||||
|
|
||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
emit_jfif_app0 (j_compress_ptr cinfo)
|
emit_jfif_app0(j_compress_ptr cinfo)
|
||||||
/* Emit a JFIF-compliant APP0 marker */
|
/* Emit a JFIF-compliant APP0 marker */
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -553,15 +552,15 @@ emit_jfif_app0 (j_compress_ptr cinfo)
|
|||||||
emit_byte(cinfo, cinfo->JFIF_major_version); /* Version fields */
|
emit_byte(cinfo, cinfo->JFIF_major_version); /* Version fields */
|
||||||
emit_byte(cinfo, cinfo->JFIF_minor_version);
|
emit_byte(cinfo, cinfo->JFIF_minor_version);
|
||||||
emit_byte(cinfo, cinfo->density_unit); /* Pixel size information */
|
emit_byte(cinfo, cinfo->density_unit); /* Pixel size information */
|
||||||
emit_2bytes(cinfo, (int) cinfo->X_density);
|
emit_2bytes(cinfo, (int)cinfo->X_density);
|
||||||
emit_2bytes(cinfo, (int) cinfo->Y_density);
|
emit_2bytes(cinfo, (int)cinfo->Y_density);
|
||||||
emit_byte(cinfo, 0); /* No thumbnail image */
|
emit_byte(cinfo, 0); /* No thumbnail image */
|
||||||
emit_byte(cinfo, 0);
|
emit_byte(cinfo, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
emit_adobe_app14 (j_compress_ptr cinfo)
|
emit_adobe_app14(j_compress_ptr cinfo)
|
||||||
/* Emit an Adobe APP14 marker */
|
/* Emit an Adobe APP14 marker */
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -615,19 +614,19 @@ emit_adobe_app14 (j_compress_ptr cinfo)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
write_marker_header (j_compress_ptr cinfo, int marker, unsigned int datalen)
|
write_marker_header(j_compress_ptr cinfo, int marker, unsigned int datalen)
|
||||||
/* Emit an arbitrary marker header */
|
/* Emit an arbitrary marker header */
|
||||||
{
|
{
|
||||||
if (datalen > (unsigned int) 65533) /* safety check */
|
if (datalen > (unsigned int)65533) /* safety check */
|
||||||
ERREXIT(cinfo, JERR_BAD_LENGTH);
|
ERREXIT(cinfo, JERR_BAD_LENGTH);
|
||||||
|
|
||||||
emit_marker(cinfo, (JPEG_MARKER) marker);
|
emit_marker(cinfo, (JPEG_MARKER)marker);
|
||||||
|
|
||||||
emit_2bytes(cinfo, (int) (datalen + 2)); /* total length */
|
emit_2bytes(cinfo, (int)(datalen + 2)); /* total length */
|
||||||
}
|
}
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
write_marker_byte (j_compress_ptr cinfo, int val)
|
write_marker_byte(j_compress_ptr cinfo, int val)
|
||||||
/* Emit one byte of marker parameters following write_marker_header */
|
/* Emit one byte of marker parameters following write_marker_header */
|
||||||
{
|
{
|
||||||
emit_byte(cinfo, val);
|
emit_byte(cinfo, val);
|
||||||
@@ -646,9 +645,9 @@ write_marker_byte (j_compress_ptr cinfo, int val)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
write_file_header (j_compress_ptr cinfo)
|
write_file_header(j_compress_ptr cinfo)
|
||||||
{
|
{
|
||||||
my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
|
my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
|
||||||
|
|
||||||
emit_marker(cinfo, M_SOI); /* first the SOI */
|
emit_marker(cinfo, M_SOI); /* first the SOI */
|
||||||
|
|
||||||
@@ -671,7 +670,7 @@ write_file_header (j_compress_ptr cinfo)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
write_frame_header (j_compress_ptr cinfo)
|
write_frame_header(j_compress_ptr cinfo)
|
||||||
{
|
{
|
||||||
int ci, prec;
|
int ci, prec;
|
||||||
boolean is_baseline;
|
boolean is_baseline;
|
||||||
@@ -734,9 +733,9 @@ write_frame_header (j_compress_ptr cinfo)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
write_scan_header (j_compress_ptr cinfo)
|
write_scan_header(j_compress_ptr cinfo)
|
||||||
{
|
{
|
||||||
my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
|
my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
|
||||||
int i;
|
int i;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
|
|
||||||
@@ -780,7 +779,7 @@ write_scan_header (j_compress_ptr cinfo)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
write_file_trailer (j_compress_ptr cinfo)
|
write_file_trailer(j_compress_ptr cinfo)
|
||||||
{
|
{
|
||||||
emit_marker(cinfo, M_EOI);
|
emit_marker(cinfo, M_EOI);
|
||||||
}
|
}
|
||||||
@@ -794,7 +793,7 @@ write_file_trailer (j_compress_ptr cinfo)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
write_tables_only (j_compress_ptr cinfo)
|
write_tables_only(j_compress_ptr cinfo)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -802,10 +801,10 @@ write_tables_only (j_compress_ptr cinfo)
|
|||||||
|
|
||||||
for (i = 0; i < NUM_QUANT_TBLS; i++) {
|
for (i = 0; i < NUM_QUANT_TBLS; i++) {
|
||||||
if (cinfo->quant_tbl_ptrs[i] != NULL)
|
if (cinfo->quant_tbl_ptrs[i] != NULL)
|
||||||
(void) emit_dqt(cinfo, i);
|
(void)emit_dqt(cinfo, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! cinfo->arith_code) {
|
if (!cinfo->arith_code) {
|
||||||
for (i = 0; i < NUM_HUFF_TBLS; i++) {
|
for (i = 0; i < NUM_HUFF_TBLS; i++) {
|
||||||
if (cinfo->dc_huff_tbl_ptrs[i] != NULL)
|
if (cinfo->dc_huff_tbl_ptrs[i] != NULL)
|
||||||
emit_dht(cinfo, i, FALSE);
|
emit_dht(cinfo, i, FALSE);
|
||||||
@@ -823,15 +822,15 @@ write_tables_only (j_compress_ptr cinfo)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jinit_marker_writer (j_compress_ptr cinfo)
|
jinit_marker_writer(j_compress_ptr cinfo)
|
||||||
{
|
{
|
||||||
my_marker_ptr marker;
|
my_marker_ptr marker;
|
||||||
|
|
||||||
/* Create the subobject */
|
/* Create the subobject */
|
||||||
marker = (my_marker_ptr)
|
marker = (my_marker_ptr)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||||
sizeof(my_marker_writer));
|
sizeof(my_marker_writer));
|
||||||
cinfo->marker = (struct jpeg_marker_writer *) marker;
|
cinfo->marker = (struct jpeg_marker_writer *)marker;
|
||||||
/* Initialize method pointers */
|
/* Initialize method pointers */
|
||||||
marker->pub.write_file_header = write_file_header;
|
marker->pub.write_file_header = write_file_header;
|
||||||
marker->pub.write_frame_header = write_frame_header;
|
marker->pub.write_frame_header = write_frame_header;
|
||||||
|
|||||||
20
jcmaster.c
20
jcmaster.c
@@ -5,7 +5,7 @@
|
|||||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||||
* Modified 2003-2010 by Guido Vollbeding.
|
* Modified 2003-2010 by Guido Vollbeding.
|
||||||
* libjpeg-turbo Modifications:
|
* libjpeg-turbo Modifications:
|
||||||
* Copyright (C) 2010, 2016, D. R. Commander.
|
* Copyright (C) 2010, 2016, 2018, D. R. Commander.
|
||||||
* mozjpeg Modifications:
|
* mozjpeg Modifications:
|
||||||
* Copyright (C) 2014, Mozilla Corporation.
|
* Copyright (C) 2014, Mozilla Corporation.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
@@ -66,8 +66,8 @@ initial_setup (j_compress_ptr cinfo, boolean transcode_only)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Sanity check on image dimensions */
|
/* Sanity check on image dimensions */
|
||||||
if (cinfo->_jpeg_height <= 0 || cinfo->_jpeg_width <= 0
|
if (cinfo->_jpeg_height <= 0 || cinfo->_jpeg_width <= 0 ||
|
||||||
|| cinfo->num_components <= 0 || cinfo->input_components <= 0)
|
cinfo->num_components <= 0 || cinfo->input_components <= 0)
|
||||||
ERREXIT(cinfo, JERR_EMPTY_IMAGE);
|
ERREXIT(cinfo, JERR_EMPTY_IMAGE);
|
||||||
|
|
||||||
/* Make sure image isn't bigger than I can handle */
|
/* Make sure image isn't bigger than I can handle */
|
||||||
@@ -95,8 +95,10 @@ initial_setup (j_compress_ptr cinfo, boolean transcode_only)
|
|||||||
cinfo->max_v_samp_factor = 1;
|
cinfo->max_v_samp_factor = 1;
|
||||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR ||
|
if (compptr->h_samp_factor <= 0 ||
|
||||||
compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR)
|
compptr->h_samp_factor > MAX_SAMP_FACTOR ||
|
||||||
|
compptr->v_samp_factor <= 0 ||
|
||||||
|
compptr->v_samp_factor > MAX_SAMP_FACTOR)
|
||||||
ERREXIT(cinfo, JERR_BAD_SAMPLING);
|
ERREXIT(cinfo, JERR_BAD_SAMPLING);
|
||||||
cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
|
cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
|
||||||
compptr->h_samp_factor);
|
compptr->h_samp_factor);
|
||||||
@@ -211,9 +213,9 @@ validate_script (j_compress_ptr cinfo)
|
|||||||
Al = scanptr->Al;
|
Al = scanptr->Al;
|
||||||
if (cinfo->progressive_mode) {
|
if (cinfo->progressive_mode) {
|
||||||
#ifdef C_PROGRESSIVE_SUPPORTED
|
#ifdef C_PROGRESSIVE_SUPPORTED
|
||||||
/* The JPEG spec simply gives the ranges 0..13 for Ah and Al, but that
|
/* Rec. ITU-T T.81 | ISO/IEC 10918-1 simply gives the ranges 0..13 for Ah
|
||||||
* seems wrong: the upper bound ought to depend on data precision.
|
* and Al, but that seems wrong: the upper bound ought to depend on data
|
||||||
* Perhaps they really meant 0..N+1 for N-bit precision.
|
* precision. Perhaps they really meant 0..N+1 for N-bit precision.
|
||||||
* Here we allow 0..10 for 8-bit data; Al larger than 10 results in
|
* Here we allow 0..10 for 8-bit data; Al larger than 10 results in
|
||||||
* out-of-range reconstructed DC values during the first DC scan,
|
* out-of-range reconstructed DC values during the first DC scan,
|
||||||
* which might cause problems for some decoders.
|
* which might cause problems for some decoders.
|
||||||
@@ -505,8 +507,8 @@ prepare_for_pass (j_compress_ptr cinfo)
|
|||||||
*/
|
*/
|
||||||
master->pass_type = output_pass;
|
master->pass_type = output_pass;
|
||||||
master->pass_number++;
|
master->pass_number++;
|
||||||
/*FALLTHROUGH*/
|
|
||||||
#endif
|
#endif
|
||||||
|
/*FALLTHROUGH*/
|
||||||
case output_pass:
|
case output_pass:
|
||||||
/* Do a data-output pass. */
|
/* Do a data-output pass. */
|
||||||
/* We need not repeat per-scan setup if prior optimization pass did it. */
|
/* We need not repeat per-scan setup if prior optimization pass did it. */
|
||||||
|
|||||||
12
jcomapi.c
12
jcomapi.c
@@ -29,7 +29,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jpeg_abort (j_common_ptr cinfo)
|
jpeg_abort(j_common_ptr cinfo)
|
||||||
{
|
{
|
||||||
int pool;
|
int pool;
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ jpeg_abort (j_common_ptr cinfo)
|
|||||||
/* Releasing pools in reverse order might help avoid fragmentation
|
/* Releasing pools in reverse order might help avoid fragmentation
|
||||||
* with some (brain-damaged) malloc libraries.
|
* with some (brain-damaged) malloc libraries.
|
||||||
*/
|
*/
|
||||||
for (pool = JPOOL_NUMPOOLS-1; pool > JPOOL_PERMANENT; pool--) {
|
for (pool = JPOOL_NUMPOOLS - 1; pool > JPOOL_PERMANENT; pool--) {
|
||||||
(*cinfo->mem->free_pool) (cinfo, pool);
|
(*cinfo->mem->free_pool) (cinfo, pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ jpeg_abort (j_common_ptr cinfo)
|
|||||||
/* Try to keep application from accessing now-deleted marker list.
|
/* Try to keep application from accessing now-deleted marker list.
|
||||||
* A bit kludgy to do it here, but this is the most central place.
|
* A bit kludgy to do it here, but this is the most central place.
|
||||||
*/
|
*/
|
||||||
((j_decompress_ptr) cinfo)->marker_list = NULL;
|
((j_decompress_ptr)cinfo)->marker_list = NULL;
|
||||||
} else {
|
} else {
|
||||||
cinfo->global_state = CSTATE_START;
|
cinfo->global_state = CSTATE_START;
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ jpeg_abort (j_common_ptr cinfo)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jpeg_destroy (j_common_ptr cinfo)
|
jpeg_destroy(j_common_ptr cinfo)
|
||||||
{
|
{
|
||||||
/* We need only tell the memory manager to release everything. */
|
/* We need only tell the memory manager to release everything. */
|
||||||
/* NB: mem pointer is NULL if memory mgr failed to initialize. */
|
/* NB: mem pointer is NULL if memory mgr failed to initialize. */
|
||||||
@@ -86,7 +86,7 @@ jpeg_destroy (j_common_ptr cinfo)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GLOBAL(JQUANT_TBL *)
|
GLOBAL(JQUANT_TBL *)
|
||||||
jpeg_alloc_quant_table (j_common_ptr cinfo)
|
jpeg_alloc_quant_table(j_common_ptr cinfo)
|
||||||
{
|
{
|
||||||
JQUANT_TBL *tbl;
|
JQUANT_TBL *tbl;
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ jpeg_alloc_quant_table (j_common_ptr cinfo)
|
|||||||
|
|
||||||
|
|
||||||
GLOBAL(JHUFF_TBL *)
|
GLOBAL(JHUFF_TBL *)
|
||||||
jpeg_alloc_huff_table (j_common_ptr cinfo)
|
jpeg_alloc_huff_table(j_common_ptr cinfo)
|
||||||
{
|
{
|
||||||
JHUFF_TBL *tbl;
|
JHUFF_TBL *tbl;
|
||||||
|
|
||||||
|
|||||||
63
jconfig.h.in
63
jconfig.h.in
@@ -1,19 +1,25 @@
|
|||||||
/* Version ID for the JPEG library.
|
/* Version ID for the JPEG library.
|
||||||
* Might be useful for tests like "#if JPEG_LIB_VERSION >= 60".
|
* Might be useful for tests like "#if JPEG_LIB_VERSION >= 60".
|
||||||
*/
|
*/
|
||||||
#define JPEG_LIB_VERSION 62 /* Version 6b */
|
#define JPEG_LIB_VERSION @JPEG_LIB_VERSION@
|
||||||
|
|
||||||
/* libjpeg-turbo version */
|
/* libjpeg-turbo version */
|
||||||
#define LIBJPEG_TURBO_VERSION 0
|
#define LIBJPEG_TURBO_VERSION @VERSION@
|
||||||
|
|
||||||
/* libjpeg-turbo version in integer form */
|
/* libjpeg-turbo version in integer form */
|
||||||
#define LIBJPEG_TURBO_VERSION_NUMBER 0
|
#define LIBJPEG_TURBO_VERSION_NUMBER @LIBJPEG_TURBO_VERSION_NUMBER@
|
||||||
|
|
||||||
/* Support arithmetic encoding */
|
/* Support arithmetic encoding */
|
||||||
#undef C_ARITH_CODING_SUPPORTED
|
#cmakedefine C_ARITH_CODING_SUPPORTED 1
|
||||||
|
|
||||||
/* Support arithmetic decoding */
|
/* Support arithmetic decoding */
|
||||||
#undef D_ARITH_CODING_SUPPORTED
|
#cmakedefine D_ARITH_CODING_SUPPORTED 1
|
||||||
|
|
||||||
|
/* Support in-memory source/destination managers */
|
||||||
|
#cmakedefine MEM_SRCDST_SUPPORTED 1
|
||||||
|
|
||||||
|
/* Use accelerated SIMD routines. */
|
||||||
|
#cmakedefine WITH_SIMD 1
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Define BITS_IN_JSAMPLE as either
|
* Define BITS_IN_JSAMPLE as either
|
||||||
@@ -24,53 +30,44 @@
|
|||||||
* We do not support run-time selection of data precision, sorry.
|
* We do not support run-time selection of data precision, sorry.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */
|
#define BITS_IN_JSAMPLE @BITS_IN_JSAMPLE@ /* use 8 or 12 */
|
||||||
|
|
||||||
/* Define to 1 if you have the <locale.h> header file. */
|
/* Define to 1 if you have the <locale.h> header file. */
|
||||||
#undef HAVE_LOCALE_H
|
#cmakedefine HAVE_LOCALE_H 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <stddef.h> header file. */
|
/* Define to 1 if you have the <stddef.h> header file. */
|
||||||
#undef HAVE_STDDEF_H
|
#cmakedefine HAVE_STDDEF_H 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||||
#undef HAVE_STDLIB_H
|
#cmakedefine HAVE_STDLIB_H 1
|
||||||
|
|
||||||
/* Define to 1 if the system has the type `unsigned char'. */
|
/* Define if you need to include <sys/types.h> to get size_t. */
|
||||||
#undef HAVE_UNSIGNED_CHAR
|
#cmakedefine NEED_SYS_TYPES_H 1
|
||||||
|
|
||||||
/* Define to 1 if the system has the type `unsigned short'. */
|
|
||||||
#undef HAVE_UNSIGNED_SHORT
|
|
||||||
|
|
||||||
/* Compiler does not support pointers to undefined structures. */
|
|
||||||
#undef INCOMPLETE_TYPES_BROKEN
|
|
||||||
|
|
||||||
/* Support in-memory source/destination managers */
|
|
||||||
#undef MEM_SRCDST_SUPPORTED
|
|
||||||
|
|
||||||
/* Define if you have BSD-like bzero and bcopy in <strings.h> rather than
|
/* Define if you have BSD-like bzero and bcopy in <strings.h> rather than
|
||||||
memset/memcpy in <string.h>. */
|
memset/memcpy in <string.h>. */
|
||||||
#undef NEED_BSD_STRINGS
|
#cmakedefine NEED_BSD_STRINGS 1
|
||||||
|
|
||||||
/* Define if you need to include <sys/types.h> to get size_t. */
|
/* Define to 1 if the system has the type `unsigned char'. */
|
||||||
#undef NEED_SYS_TYPES_H
|
#cmakedefine HAVE_UNSIGNED_CHAR 1
|
||||||
|
|
||||||
|
/* Define to 1 if the system has the type `unsigned short'. */
|
||||||
|
#cmakedefine HAVE_UNSIGNED_SHORT 1
|
||||||
|
|
||||||
|
/* Compiler does not support pointers to undefined structures. */
|
||||||
|
#cmakedefine INCOMPLETE_TYPES_BROKEN 1
|
||||||
|
|
||||||
/* Define if your (broken) compiler shifts signed values as if they were
|
/* Define if your (broken) compiler shifts signed values as if they were
|
||||||
unsigned. */
|
unsigned. */
|
||||||
#undef RIGHT_SHIFT_IS_UNSIGNED
|
#cmakedefine RIGHT_SHIFT_IS_UNSIGNED 1
|
||||||
|
|
||||||
/* Use accelerated SIMD routines. */
|
|
||||||
#undef WITH_SIMD
|
|
||||||
|
|
||||||
/* Define to 1 if type `char' is unsigned and you are not using gcc. */
|
/* Define to 1 if type `char' is unsigned and you are not using gcc. */
|
||||||
#ifndef __CHAR_UNSIGNED__
|
#ifndef __CHAR_UNSIGNED__
|
||||||
# undef __CHAR_UNSIGNED__
|
#cmakedefine __CHAR_UNSIGNED__ 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Define to empty if `const' does not conform to ANSI C. */
|
/* Define to empty if `const' does not conform to ANSI C. */
|
||||||
#undef const
|
/* #undef const */
|
||||||
|
|
||||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||||
#undef size_t
|
/* #undef size_t */
|
||||||
|
|
||||||
/* The size of `size_t', as computed by sizeof. */
|
|
||||||
#undef SIZEOF_SIZE_T
|
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ typedef unsigned char boolean;
|
|||||||
*/
|
*/
|
||||||
#undef TWO_FILE_COMMANDLINE
|
#undef TWO_FILE_COMMANDLINE
|
||||||
|
|
||||||
/* By default, we open image files with fopen(...,"rb") or fopen(...,"wb").
|
/* By default, we open image files with fopen(..., "rb") or fopen(..., "wb").
|
||||||
* This is necessary on systems that distinguish text files from binary files,
|
* This is necessary on systems that distinguish text files from binary files,
|
||||||
* and is harmless on most systems that don't. If you have one of the rare
|
* and is harmless on most systems that don't. If you have one of the rare
|
||||||
* systems that complains about the "b" spec, define this symbol.
|
* systems that complains about the "b" spec, define this symbol.
|
||||||
|
|||||||
@@ -1,17 +1,34 @@
|
|||||||
/* libjpeg-turbo build number */
|
/* libjpeg-turbo build number */
|
||||||
#undef BUILD
|
#define BUILD "@BUILD@"
|
||||||
|
|
||||||
/* Compiler's inline keyword */
|
/* Compiler's inline keyword */
|
||||||
#undef inline
|
#undef inline
|
||||||
|
|
||||||
/* How to obtain function inlining. */
|
/* How to obtain function inlining. */
|
||||||
#undef INLINE
|
#define INLINE @INLINE@
|
||||||
|
|
||||||
|
/* How to obtain thread-local storage */
|
||||||
|
#define THREAD_LOCAL @THREAD_LOCAL@
|
||||||
|
|
||||||
/* Define to the full name of this package. */
|
/* Define to the full name of this package. */
|
||||||
#undef PACKAGE_NAME
|
#define PACKAGE_NAME "@CMAKE_PROJECT_NAME@"
|
||||||
|
|
||||||
/* Version number of package */
|
/* Version number of package */
|
||||||
#undef VERSION
|
#define VERSION "@VERSION@"
|
||||||
|
|
||||||
/* The size of `size_t', as computed by sizeof. */
|
/* The size of `size_t', as computed by sizeof. */
|
||||||
#undef SIZEOF_SIZE_T
|
#define SIZEOF_SIZE_T @SIZE_T@
|
||||||
|
|
||||||
|
/* Define if your compiler has __builtin_ctzl() and sizeof(unsigned long) == sizeof(size_t). */
|
||||||
|
#cmakedefine HAVE_BUILTIN_CTZL
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <intrin.h> header file. */
|
||||||
|
#cmakedefine HAVE_INTRIN_H
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && defined(HAVE_INTRIN_H)
|
||||||
|
#if (SIZEOF_SIZE_T == 8)
|
||||||
|
#define HAVE_BITSCANFORWARD64
|
||||||
|
#elif (SIZEOF_SIZE_T == 4)
|
||||||
|
#define HAVE_BITSCANFORWARD
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|||||||
12
jcparam.c
12
jcparam.c
@@ -5,7 +5,7 @@
|
|||||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||||
* Modified 2003-2008 by Guido Vollbeding.
|
* Modified 2003-2008 by Guido Vollbeding.
|
||||||
* libjpeg-turbo Modifications:
|
* libjpeg-turbo Modifications:
|
||||||
* Copyright (C) 2009-2011, D. R. Commander.
|
* Copyright (C) 2009-2011, 2018, D. R. Commander.
|
||||||
* mozjpeg Modifications:
|
* mozjpeg Modifications:
|
||||||
* Copyright (C) 2014, Mozilla Corporation.
|
* Copyright (C) 2014, Mozilla Corporation.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
@@ -27,8 +27,8 @@
|
|||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl,
|
jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl,
|
||||||
const unsigned int *basic_table,
|
const unsigned int *basic_table, int scale_factor,
|
||||||
int scale_factor, boolean force_baseline)
|
boolean force_baseline)
|
||||||
/* Define a quantization table equal to the basic_table times
|
/* Define a quantization table equal to the basic_table times
|
||||||
* a scale factor (given as a percentage).
|
* a scale factor (given as a percentage).
|
||||||
* If force_baseline is TRUE, the computed quantization table entries
|
* If force_baseline is TRUE, the computed quantization table entries
|
||||||
@@ -66,7 +66,8 @@ jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* These are the sample quantization tables given in JPEG spec section K.1.
|
/* These are the sample quantization tables given in Annex K (Clause K.1) of
|
||||||
|
* Recommendation ITU-T T.81 (1992) | ISO/IEC 10918-1:1994.
|
||||||
* The spec says that the values given produce "good" quality, and
|
* The spec says that the values given produce "good" quality, and
|
||||||
* when divided by 2, "very good" quality.
|
* when divided by 2, "very good" quality.
|
||||||
*/
|
*/
|
||||||
@@ -645,8 +646,7 @@ jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace)
|
|||||||
#ifdef C_PROGRESSIVE_SUPPORTED
|
#ifdef C_PROGRESSIVE_SUPPORTED
|
||||||
|
|
||||||
LOCAL(jpeg_scan_info *)
|
LOCAL(jpeg_scan_info *)
|
||||||
fill_a_scan (jpeg_scan_info *scanptr, int ci,
|
fill_a_scan(jpeg_scan_info *scanptr, int ci, int Ss, int Se, int Ah, int Al)
|
||||||
int Ss, int Se, int Ah, int Al)
|
|
||||||
/* Support routine: generate one scan for specified component */
|
/* Support routine: generate one scan for specified component */
|
||||||
{
|
{
|
||||||
scanptr->comps_in_scan = 1;
|
scanptr->comps_in_scan = 1;
|
||||||
|
|||||||
564
jcphuff.c
564
jcphuff.c
@@ -3,11 +3,12 @@
|
|||||||
*
|
*
|
||||||
* This file was part of the Independent JPEG Group's software:
|
* This file was part of the Independent JPEG Group's software:
|
||||||
* Copyright (C) 1995-1997, Thomas G. Lane.
|
* Copyright (C) 1995-1997, Thomas G. Lane.
|
||||||
* It was modified by The libjpeg-turbo Project to include only code relevant
|
* libjpeg-turbo Modifications:
|
||||||
* to libjpeg-turbo.
|
* Copyright (C) 2011, 2015, 2018, D. R. Commander.
|
||||||
* mozjpeg Modifications:
|
* Copyright (C) 2016, 2018, Matthieu Darbois.
|
||||||
* Copyright (C) 2014, Mozilla Corporation.
|
* Copyright (C) 2014, Mozilla Corporation.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* For conditions of distribution and use, see the accompanying README.ijg
|
||||||
|
* file.
|
||||||
*
|
*
|
||||||
* This file contains Huffman entropy encoding routines for progressive JPEG.
|
* This file contains Huffman entropy encoding routines for progressive JPEG.
|
||||||
*
|
*
|
||||||
@@ -19,15 +20,69 @@
|
|||||||
#define JPEG_INTERNALS
|
#define JPEG_INTERNALS
|
||||||
#include "jinclude.h"
|
#include "jinclude.h"
|
||||||
#include "jpeglib.h"
|
#include "jpeglib.h"
|
||||||
#include "jchuff.h" /* Declarations shared with jchuff.c */
|
#include "jsimd.h"
|
||||||
|
#include "jconfigint.h"
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_INTRIN_H
|
||||||
|
#include <intrin.h>
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#ifdef HAVE_BITSCANFORWARD64
|
||||||
|
#pragma intrinsic(_BitScanForward64)
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_BITSCANFORWARD
|
||||||
|
#pragma intrinsic(_BitScanForward)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef C_PROGRESSIVE_SUPPORTED
|
#ifdef C_PROGRESSIVE_SUPPORTED
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NOTE: If USE_CLZ_INTRINSIC is defined, then clz/bsr instructions will be
|
||||||
|
* used for bit counting rather than the lookup table. This will reduce the
|
||||||
|
* memory footprint by 64k, which is important for some mobile applications
|
||||||
|
* that create many isolated instances of libjpeg-turbo (web browsers, for
|
||||||
|
* instance.) This may improve performance on some mobile platforms as well.
|
||||||
|
* This feature is enabled by default only on ARM processors, because some x86
|
||||||
|
* chips have a slow implementation of bsr, and the use of clz/bsr cannot be
|
||||||
|
* shown to have a significant performance impact even on the x86 chips that
|
||||||
|
* have a fast implementation of it. When building for ARMv6, you can
|
||||||
|
* explicitly disable the use of clz/bsr by adding -mthumb to the compiler
|
||||||
|
* flags (this defines __thumb__).
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* NOTE: Both GCC and Clang define __GNUC__ */
|
||||||
|
#if defined(__GNUC__) && (defined(__arm__) || defined(__aarch64__))
|
||||||
|
#if !defined(__thumb__) || defined(__thumb2__)
|
||||||
|
#define USE_CLZ_INTRINSIC
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_CLZ_INTRINSIC
|
||||||
|
#define JPEG_NBITS_NONZERO(x) (32 - __builtin_clz(x))
|
||||||
|
#define JPEG_NBITS(x) (x ? JPEG_NBITS_NONZERO(x) : 0)
|
||||||
|
#else
|
||||||
|
#include "jpeg_nbits_table.h"
|
||||||
|
#define JPEG_NBITS(x) (jpeg_nbits_table[x])
|
||||||
|
#define JPEG_NBITS_NONZERO(x) JPEG_NBITS(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Expanded entropy encoder object for progressive Huffman encoding. */
|
/* Expanded entropy encoder object for progressive Huffman encoding. */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
struct jpeg_entropy_encoder pub; /* public fields */
|
struct jpeg_entropy_encoder pub; /* public fields */
|
||||||
|
|
||||||
|
/* Pointer to routine to prepare data for encode_mcu_AC_first() */
|
||||||
|
void (*AC_first_prepare) (const JCOEF *block,
|
||||||
|
const int *jpeg_natural_order_start, int Sl,
|
||||||
|
int Al, JCOEF *values, size_t *zerobits);
|
||||||
|
/* Pointer to routine to prepare data for encode_mcu_AC_refine() */
|
||||||
|
int (*AC_refine_prepare) (const JCOEF *block,
|
||||||
|
const int *jpeg_natural_order_start, int Sl,
|
||||||
|
int Al, JCOEF *absvalues, size_t *bits);
|
||||||
|
|
||||||
/* Mode flag: TRUE for optimization, FALSE for actual data output */
|
/* Mode flag: TRUE for optimization, FALSE for actual data output */
|
||||||
boolean gather_statistics;
|
boolean gather_statistics;
|
||||||
|
|
||||||
@@ -89,19 +144,53 @@ typedef phuff_entropy_encoder *phuff_entropy_ptr;
|
|||||||
#define IRIGHT_SHIFT(x,shft) ((x) >> (shft))
|
#define IRIGHT_SHIFT(x,shft) ((x) >> (shft))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define PAD(v, p) ((v + (p) - 1) & (~((p) - 1)))
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
METHODDEF(boolean) encode_mcu_DC_first (j_compress_ptr cinfo,
|
METHODDEF(boolean) encode_mcu_DC_first (j_compress_ptr cinfo,
|
||||||
JBLOCKROW *MCU_data);
|
JBLOCKROW *MCU_data);
|
||||||
|
METHODDEF(void) encode_mcu_AC_first_prepare
|
||||||
|
(const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al,
|
||||||
|
JCOEF *values, size_t *zerobits);
|
||||||
METHODDEF(boolean) encode_mcu_AC_first (j_compress_ptr cinfo,
|
METHODDEF(boolean) encode_mcu_AC_first (j_compress_ptr cinfo,
|
||||||
JBLOCKROW *MCU_data);
|
JBLOCKROW *MCU_data);
|
||||||
METHODDEF(boolean) encode_mcu_DC_refine (j_compress_ptr cinfo,
|
METHODDEF(boolean) encode_mcu_DC_refine (j_compress_ptr cinfo,
|
||||||
JBLOCKROW *MCU_data);
|
JBLOCKROW *MCU_data);
|
||||||
|
METHODDEF(int) encode_mcu_AC_refine_prepare
|
||||||
|
(const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al,
|
||||||
|
JCOEF *absvalues, size_t *bits);
|
||||||
METHODDEF(boolean) encode_mcu_AC_refine (j_compress_ptr cinfo,
|
METHODDEF(boolean) encode_mcu_AC_refine (j_compress_ptr cinfo,
|
||||||
JBLOCKROW *MCU_data);
|
JBLOCKROW *MCU_data);
|
||||||
METHODDEF(void) finish_pass_phuff (j_compress_ptr cinfo);
|
METHODDEF(void) finish_pass_phuff (j_compress_ptr cinfo);
|
||||||
METHODDEF(void) finish_pass_gather_phuff (j_compress_ptr cinfo);
|
METHODDEF(void) finish_pass_gather_phuff (j_compress_ptr cinfo);
|
||||||
|
|
||||||
|
|
||||||
|
/* Count bit loop zeroes */
|
||||||
|
INLINE
|
||||||
|
METHODDEF(int)
|
||||||
|
count_zeroes(size_t *x)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
#if defined(HAVE_BUILTIN_CTZL)
|
||||||
|
result = __builtin_ctzl(*x);
|
||||||
|
*x >>= result;
|
||||||
|
#elif defined(HAVE_BITSCANFORWARD64)
|
||||||
|
_BitScanForward64(&result, *x);
|
||||||
|
*x >>= result;
|
||||||
|
#elif defined(HAVE_BITSCANFORWARD)
|
||||||
|
_BitScanForward(&result, *x);
|
||||||
|
*x >>= result;
|
||||||
|
#else
|
||||||
|
result = 0;
|
||||||
|
while ((*x & 1) == 0) {
|
||||||
|
++result;
|
||||||
|
*x >>= 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize for a Huffman-compressed scan using progressive JPEG.
|
* Initialize for a Huffman-compressed scan using progressive JPEG.
|
||||||
*/
|
*/
|
||||||
@@ -127,11 +216,19 @@ start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics)
|
|||||||
entropy->pub.encode_mcu = encode_mcu_DC_first;
|
entropy->pub.encode_mcu = encode_mcu_DC_first;
|
||||||
else
|
else
|
||||||
entropy->pub.encode_mcu = encode_mcu_AC_first;
|
entropy->pub.encode_mcu = encode_mcu_AC_first;
|
||||||
|
if (jsimd_can_encode_mcu_AC_first_prepare())
|
||||||
|
entropy->AC_first_prepare = jsimd_encode_mcu_AC_first_prepare;
|
||||||
|
else
|
||||||
|
entropy->AC_first_prepare = encode_mcu_AC_first_prepare;
|
||||||
} else {
|
} else {
|
||||||
if (is_DC_band)
|
if (is_DC_band)
|
||||||
entropy->pub.encode_mcu = encode_mcu_DC_refine;
|
entropy->pub.encode_mcu = encode_mcu_DC_refine;
|
||||||
else {
|
else {
|
||||||
entropy->pub.encode_mcu = encode_mcu_AC_refine;
|
entropy->pub.encode_mcu = encode_mcu_AC_refine;
|
||||||
|
if (jsimd_can_encode_mcu_AC_refine_prepare())
|
||||||
|
entropy->AC_refine_prepare = jsimd_encode_mcu_AC_refine_prepare;
|
||||||
|
else
|
||||||
|
entropy->AC_refine_prepare = encode_mcu_AC_refine_prepare;
|
||||||
/* AC refinement needs a correction bit buffer */
|
/* AC refinement needs a correction bit buffer */
|
||||||
if (entropy->bit_buffer == NULL)
|
if (entropy->bit_buffer == NULL)
|
||||||
entropy->bit_buffer = (char *)
|
entropy->bit_buffer = (char *)
|
||||||
@@ -207,10 +304,11 @@ start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Emit a byte */
|
/* Emit a byte */
|
||||||
#define emit_byte(entropy,val) \
|
#define emit_byte(entropy, val) { \
|
||||||
{ *(entropy)->next_output_byte++ = (JOCTET) (val); \
|
*(entropy)->next_output_byte++ = (JOCTET)(val); \
|
||||||
if (--(entropy)->free_in_buffer == 0) \
|
if (--(entropy)->free_in_buffer == 0) \
|
||||||
dump_buffer(entropy); }
|
dump_buffer(entropy); \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
@@ -329,9 +427,7 @@ emit_eobrun (phuff_entropy_ptr entropy)
|
|||||||
|
|
||||||
if (entropy->EOBRUN > 0) { /* if there is any pending EOBRUN */
|
if (entropy->EOBRUN > 0) { /* if there is any pending EOBRUN */
|
||||||
temp = entropy->EOBRUN;
|
temp = entropy->EOBRUN;
|
||||||
nbits = 0;
|
nbits = JPEG_NBITS_NONZERO(temp) - 1;
|
||||||
while ((temp >>= 1))
|
|
||||||
nbits++;
|
|
||||||
/* safety check: shouldn't happen given limited correction-bit buffer */
|
/* safety check: shouldn't happen given limited correction-bit buffer */
|
||||||
if (nbits > 14)
|
if (nbits > 14)
|
||||||
ERREXIT(entropy->cinfo, JERR_HUFF_MISSING_CODE);
|
ERREXIT(entropy->cinfo, JERR_HUFF_MISSING_CODE);
|
||||||
@@ -387,7 +483,7 @@ METHODDEF(boolean)
|
|||||||
encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||||
{
|
{
|
||||||
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
|
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
|
||||||
register int temp, temp2;
|
register int temp, temp2, temp3;
|
||||||
register int nbits;
|
register int nbits;
|
||||||
int blkn, ci;
|
int blkn, ci;
|
||||||
int Al = cinfo->Al;
|
int Al = cinfo->Al;
|
||||||
@@ -419,20 +515,20 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
entropy->last_dc_val[ci] = temp2;
|
entropy->last_dc_val[ci] = temp2;
|
||||||
|
|
||||||
/* Encode the DC coefficient difference per section G.1.2.1 */
|
/* Encode the DC coefficient difference per section G.1.2.1 */
|
||||||
temp2 = temp;
|
|
||||||
if (temp < 0) {
|
/* This is a well-known technique for obtaining the absolute value without
|
||||||
temp = -temp; /* temp is abs value of input */
|
* a branch. It is derived from an assembly language technique presented
|
||||||
|
* in "How to Optimize for the Pentium Processors", Copyright (c) 1996,
|
||||||
|
* 1997 by Agner Fog.
|
||||||
|
*/
|
||||||
|
temp3 = temp >> (CHAR_BIT * sizeof(int) - 1);
|
||||||
|
temp ^= temp3;
|
||||||
|
temp -= temp3; /* temp is abs value of input */
|
||||||
/* For a negative input, want temp2 = bitwise complement of abs(input) */
|
/* For a negative input, want temp2 = bitwise complement of abs(input) */
|
||||||
/* This code assumes we are on a two's complement machine */
|
temp2 = temp ^ temp3;
|
||||||
temp2--;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Find the number of bits needed for the magnitude of the coefficient */
|
/* Find the number of bits needed for the magnitude of the coefficient */
|
||||||
nbits = 0;
|
nbits = JPEG_NBITS(temp);
|
||||||
while (temp) {
|
|
||||||
nbits++;
|
|
||||||
temp >>= 1;
|
|
||||||
}
|
|
||||||
/* Check for out-of-range coefficient values.
|
/* Check for out-of-range coefficient values.
|
||||||
* Since we're encoding a difference, the range limit is twice as much.
|
* Since we're encoding a difference, the range limit is twice as much.
|
||||||
*/
|
*/
|
||||||
@@ -465,23 +561,116 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Data preparation for encode_mcu_AC_first().
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define COMPUTE_ABSVALUES_AC_FIRST(Sl) { \
|
||||||
|
for (k = 0; k < Sl; k++) { \
|
||||||
|
temp = block[jpeg_natural_order_start[k]]; \
|
||||||
|
if (temp == 0) \
|
||||||
|
continue; \
|
||||||
|
/* We must apply the point transform by Al. For AC coefficients this \
|
||||||
|
* is an integer division with rounding towards 0. To do this portably \
|
||||||
|
* in C, we shift after obtaining the absolute value; so the code is \
|
||||||
|
* interwoven with finding the abs value (temp) and output bits (temp2). \
|
||||||
|
*/ \
|
||||||
|
temp2 = temp >> (CHAR_BIT * sizeof(int) - 1); \
|
||||||
|
temp ^= temp2; \
|
||||||
|
temp -= temp2; /* temp is abs value of input */ \
|
||||||
|
temp >>= Al; /* apply the point transform */ \
|
||||||
|
/* Watch out for case that nonzero coef is zero after point transform */ \
|
||||||
|
if (temp == 0) \
|
||||||
|
continue; \
|
||||||
|
/* For a negative coef, want temp2 = bitwise complement of abs(coef) */ \
|
||||||
|
temp2 ^= temp; \
|
||||||
|
values[k] = temp; \
|
||||||
|
values[k + DCTSIZE2] = temp2; \
|
||||||
|
zerobits |= ((size_t)1U) << k; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
METHODDEF(void)
|
||||||
|
encode_mcu_AC_first_prepare(const JCOEF *block,
|
||||||
|
const int *jpeg_natural_order_start, int Sl,
|
||||||
|
int Al, JCOEF *values, size_t *bits)
|
||||||
|
{
|
||||||
|
register int k, temp, temp2;
|
||||||
|
size_t zerobits = 0U;
|
||||||
|
int Sl0 = Sl;
|
||||||
|
|
||||||
|
#if SIZEOF_SIZE_T == 4
|
||||||
|
if (Sl0 > 32)
|
||||||
|
Sl0 = 32;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
COMPUTE_ABSVALUES_AC_FIRST(Sl0);
|
||||||
|
|
||||||
|
bits[0] = zerobits;
|
||||||
|
#if SIZEOF_SIZE_T == 4
|
||||||
|
zerobits = 0U;
|
||||||
|
|
||||||
|
if (Sl > 32) {
|
||||||
|
Sl -= 32;
|
||||||
|
jpeg_natural_order_start += 32;
|
||||||
|
values += 32;
|
||||||
|
|
||||||
|
COMPUTE_ABSVALUES_AC_FIRST(Sl);
|
||||||
|
}
|
||||||
|
bits[1] = zerobits;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MCU encoding for AC initial scan (either spectral selection,
|
* MCU encoding for AC initial scan (either spectral selection,
|
||||||
* or first pass of successive approximation).
|
* or first pass of successive approximation).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define ENCODE_COEFS_AC_FIRST(label) { \
|
||||||
|
while (zerobits) { \
|
||||||
|
r = count_zeroes(&zerobits); \
|
||||||
|
cvalue += r; \
|
||||||
|
label \
|
||||||
|
temp = cvalue[0]; \
|
||||||
|
temp2 = cvalue[DCTSIZE2]; \
|
||||||
|
\
|
||||||
|
/* if run length > 15, must emit special run-length-16 codes (0xF0) */ \
|
||||||
|
while (r > 15) { \
|
||||||
|
emit_symbol(entropy, entropy->ac_tbl_no, 0xF0); \
|
||||||
|
r -= 16; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
/* Find the number of bits needed for the magnitude of the coefficient */ \
|
||||||
|
nbits = JPEG_NBITS_NONZERO(temp); /* there must be at least one 1 bit */ \
|
||||||
|
/* Check for out-of-range coefficient values */ \
|
||||||
|
if (nbits > MAX_COEF_BITS) \
|
||||||
|
ERREXIT(cinfo, JERR_BAD_DCT_COEF); \
|
||||||
|
\
|
||||||
|
/* Count/emit Huffman symbol for run length / number of bits */ \
|
||||||
|
emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + nbits); \
|
||||||
|
\
|
||||||
|
/* Emit that number of bits of the value, if positive, */ \
|
||||||
|
/* or the complement of its magnitude, if negative. */ \
|
||||||
|
emit_bits(entropy, (unsigned int)temp2, nbits); \
|
||||||
|
\
|
||||||
|
cvalue++; \
|
||||||
|
zerobits >>= 1; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
METHODDEF(boolean)
|
METHODDEF(boolean)
|
||||||
encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||||
{
|
{
|
||||||
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
|
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
|
||||||
register int temp, temp2;
|
register int temp, temp2;
|
||||||
register int nbits;
|
register int nbits, r;
|
||||||
register int r, k;
|
int Sl = cinfo->Se - cinfo->Ss + 1;
|
||||||
int Se = cinfo->Se;
|
|
||||||
int Al = cinfo->Al;
|
int Al = cinfo->Al;
|
||||||
JBLOCKROW block;
|
JCOEF values_unaligned[2 * DCTSIZE2 + 15];
|
||||||
int deadzone = (1 << Al) - 1;
|
JCOEF *values;
|
||||||
int sign;
|
const JCOEF *cvalue;
|
||||||
|
size_t zerobits;
|
||||||
|
size_t bits[8 / SIZEOF_SIZE_T];
|
||||||
|
|
||||||
entropy->next_output_byte = cinfo->dest->next_output_byte;
|
entropy->next_output_byte = cinfo->dest->next_output_byte;
|
||||||
entropy->free_in_buffer = cinfo->dest->free_in_buffer;
|
entropy->free_in_buffer = cinfo->dest->free_in_buffer;
|
||||||
@@ -491,61 +680,48 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
if (entropy->restarts_to_go == 0)
|
if (entropy->restarts_to_go == 0)
|
||||||
emit_restart(entropy, entropy->next_restart_num);
|
emit_restart(entropy, entropy->next_restart_num);
|
||||||
|
|
||||||
/* Encode the MCU data block */
|
#ifdef WITH_SIMD
|
||||||
block = MCU_data[0];
|
cvalue = values = (JCOEF *)PAD((size_t)values_unaligned, 16);
|
||||||
|
#else
|
||||||
|
/* Not using SIMD, so alignment is not needed */
|
||||||
|
cvalue = values = values_unaligned;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Prepare data */
|
||||||
|
entropy->AC_first_prepare(MCU_data[0][0], jpeg_natural_order + cinfo->Ss,
|
||||||
|
Sl, Al, values, bits);
|
||||||
|
|
||||||
|
zerobits = bits[0];
|
||||||
|
#if SIZEOF_SIZE_T == 4
|
||||||
|
zerobits |= bits[1];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Emit any pending EOBRUN */
|
||||||
|
if (zerobits && (entropy->EOBRUN > 0))
|
||||||
|
emit_eobrun(entropy);
|
||||||
|
|
||||||
|
#if SIZEOF_SIZE_T == 4
|
||||||
|
zerobits = bits[0];
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Encode the AC coefficients per section G.1.2.2, fig. G.3 */
|
/* Encode the AC coefficients per section G.1.2.2, fig. G.3 */
|
||||||
|
|
||||||
r = 0; /* r = run length of zeros */
|
ENCODE_COEFS_AC_FIRST((void)0;);
|
||||||
|
|
||||||
for (k = cinfo->Ss; k <= Se; k++) {
|
#if SIZEOF_SIZE_T == 4
|
||||||
temp = (*block)[jpeg_natural_order[k]];
|
zerobits = bits[1];
|
||||||
if ((unsigned)(temp + deadzone) <= 2*deadzone) {
|
if (zerobits) {
|
||||||
r++;
|
int diff = ((values + DCTSIZE2 / 2) - cvalue);
|
||||||
continue;
|
r = count_zeroes(&zerobits);
|
||||||
|
r += diff;
|
||||||
|
cvalue += r;
|
||||||
|
goto first_iter_ac_first;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We must apply the point transform by Al. For AC coefficients this
|
ENCODE_COEFS_AC_FIRST(first_iter_ac_first:);
|
||||||
* is an integer division with rounding towards 0. The code is
|
|
||||||
* interwoven with finding the abs value (temp) and output bits (temp2).
|
|
||||||
*/
|
|
||||||
#ifdef RIGHT_SHIFT_IS_UNSIGNED
|
|
||||||
sign = (temp < 0) ? ~0 : 0;
|
|
||||||
#else
|
|
||||||
sign = temp >> (8*sizeof(temp)-1);
|
|
||||||
#endif
|
#endif
|
||||||
temp += sign;
|
|
||||||
temp = (temp ^ sign) >> Al;
|
|
||||||
temp2 = temp ^ sign;
|
|
||||||
|
|
||||||
/* Emit any pending EOBRUN */
|
if (cvalue < (values + Sl)) { /* If there are trailing zeroes, */
|
||||||
if (entropy->EOBRUN > 0)
|
|
||||||
emit_eobrun(entropy);
|
|
||||||
/* if run length > 15, must emit special run-length-16 codes (0xF0) */
|
|
||||||
while (r > 15) {
|
|
||||||
emit_symbol(entropy, entropy->ac_tbl_no, 0xF0);
|
|
||||||
r -= 16;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Find the number of bits needed for the magnitude of the coefficient */
|
|
||||||
nbits = 1; /* there must be at least one 1 bit */
|
|
||||||
while ((temp >>= 1))
|
|
||||||
nbits++;
|
|
||||||
/* Check for out-of-range coefficient values */
|
|
||||||
if (nbits > MAX_COEF_BITS)
|
|
||||||
ERREXIT(cinfo, JERR_BAD_DCT_COEF);
|
|
||||||
|
|
||||||
/* Count/emit Huffman symbol for run length / number of bits */
|
|
||||||
emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + nbits);
|
|
||||||
|
|
||||||
/* Emit that number of bits of the value, if positive, */
|
|
||||||
/* or the complement of its magnitude, if negative. */
|
|
||||||
emit_bits(entropy, (unsigned int) temp2, nbits);
|
|
||||||
|
|
||||||
r = 0; /* reset zero run length */
|
|
||||||
}
|
|
||||||
|
|
||||||
if (r > 0) { /* If there are trailing zeroes, */
|
|
||||||
entropy->EOBRUN++; /* count an EOB */
|
entropy->EOBRUN++; /* count an EOB */
|
||||||
if (entropy->EOBRUN == 0x7FFF)
|
if (entropy->EOBRUN == 0x7FFF)
|
||||||
emit_eobrun(entropy); /* force it out to avoid overflow */
|
emit_eobrun(entropy); /* force it out to avoid overflow */
|
||||||
@@ -617,23 +793,149 @@ encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Data preparation for encode_mcu_AC_refine().
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define COMPUTE_ABSVALUES_AC_REFINE(Sl, koffset) { \
|
||||||
|
/* It is convenient to make a pre-pass to determine the transformed \
|
||||||
|
* coefficients' absolute values and the EOB position. \
|
||||||
|
*/ \
|
||||||
|
for (k = 0; k < Sl; k++) { \
|
||||||
|
temp = block[jpeg_natural_order_start[k]]; \
|
||||||
|
/* We must apply the point transform by Al. For AC coefficients this \
|
||||||
|
* is an integer division with rounding towards 0. To do this portably \
|
||||||
|
* in C, we shift after obtaining the absolute value. \
|
||||||
|
*/ \
|
||||||
|
temp2 = temp >> (CHAR_BIT * sizeof(int) - 1); \
|
||||||
|
temp ^= temp2; \
|
||||||
|
temp -= temp2; /* temp is abs value of input */ \
|
||||||
|
temp >>= Al; /* apply the point transform */ \
|
||||||
|
if (temp != 0) { \
|
||||||
|
zerobits |= ((size_t)1U) << k; \
|
||||||
|
signbits |= ((size_t)(temp2 + 1)) << k; \
|
||||||
|
} \
|
||||||
|
absvalues[k] = (JCOEF)temp; /* save abs value for main pass */ \
|
||||||
|
if (temp == 1) \
|
||||||
|
EOB = k + koffset; /* EOB = index of last newly-nonzero coef */ \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
METHODDEF(int)
|
||||||
|
encode_mcu_AC_refine_prepare(const JCOEF *block,
|
||||||
|
const int *jpeg_natural_order_start, int Sl,
|
||||||
|
int Al, JCOEF *absvalues, size_t *bits)
|
||||||
|
{
|
||||||
|
register int k, temp, temp2;
|
||||||
|
int EOB = 0;
|
||||||
|
size_t zerobits = 0U, signbits = 0U;
|
||||||
|
int Sl0 = Sl;
|
||||||
|
|
||||||
|
#if SIZEOF_SIZE_T == 4
|
||||||
|
if (Sl0 > 32)
|
||||||
|
Sl0 = 32;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
COMPUTE_ABSVALUES_AC_REFINE(Sl0, 0);
|
||||||
|
|
||||||
|
bits[0] = zerobits;
|
||||||
|
#if SIZEOF_SIZE_T == 8
|
||||||
|
bits[1] = signbits;
|
||||||
|
#else
|
||||||
|
bits[2] = signbits;
|
||||||
|
|
||||||
|
zerobits = 0U;
|
||||||
|
signbits = 0U;
|
||||||
|
|
||||||
|
if (Sl > 32) {
|
||||||
|
Sl -= 32;
|
||||||
|
jpeg_natural_order_start += 32;
|
||||||
|
absvalues += 32;
|
||||||
|
|
||||||
|
COMPUTE_ABSVALUES_AC_REFINE(Sl, 32);
|
||||||
|
}
|
||||||
|
|
||||||
|
bits[1] = zerobits;
|
||||||
|
bits[3] = signbits;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return EOB;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MCU encoding for AC successive approximation refinement scan.
|
* MCU encoding for AC successive approximation refinement scan.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define ENCODE_COEFS_AC_REFINE(label) { \
|
||||||
|
while (zerobits) { \
|
||||||
|
int idx = count_zeroes(&zerobits); \
|
||||||
|
r += idx; \
|
||||||
|
cabsvalue += idx; \
|
||||||
|
signbits >>= idx; \
|
||||||
|
label \
|
||||||
|
/* Emit any required ZRLs, but not if they can be folded into EOB */ \
|
||||||
|
while (r > 15 && (cabsvalue <= EOBPTR)) { \
|
||||||
|
/* emit any pending EOBRUN and the BE correction bits */ \
|
||||||
|
emit_eobrun(entropy); \
|
||||||
|
/* Emit ZRL */ \
|
||||||
|
emit_symbol(entropy, entropy->ac_tbl_no, 0xF0); \
|
||||||
|
r -= 16; \
|
||||||
|
/* Emit buffered correction bits that must be associated with ZRL */ \
|
||||||
|
emit_buffered_bits(entropy, BR_buffer, BR); \
|
||||||
|
BR_buffer = entropy->bit_buffer; /* BE bits are gone now */ \
|
||||||
|
BR = 0; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
temp = *cabsvalue++; \
|
||||||
|
\
|
||||||
|
/* If the coef was previously nonzero, it only needs a correction bit. \
|
||||||
|
* NOTE: a straight translation of the spec's figure G.7 would suggest \
|
||||||
|
* that we also need to test r > 15. But if r > 15, we can only get here \
|
||||||
|
* if k > EOB, which implies that this coefficient is not 1. \
|
||||||
|
*/ \
|
||||||
|
if (temp > 1) { \
|
||||||
|
/* The correction bit is the next bit of the absolute value. */ \
|
||||||
|
BR_buffer[BR++] = (char)(temp & 1); \
|
||||||
|
signbits >>= 1; \
|
||||||
|
zerobits >>= 1; \
|
||||||
|
continue; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
/* Emit any pending EOBRUN and the BE correction bits */ \
|
||||||
|
emit_eobrun(entropy); \
|
||||||
|
\
|
||||||
|
/* Count/emit Huffman symbol for run length / number of bits */ \
|
||||||
|
emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + 1); \
|
||||||
|
\
|
||||||
|
/* Emit output bit for newly-nonzero coef */ \
|
||||||
|
temp = signbits & 1; /* ((*block)[jpeg_natural_order_start[k]] < 0) ? 0 : 1 */ \
|
||||||
|
emit_bits(entropy, (unsigned int)temp, 1); \
|
||||||
|
\
|
||||||
|
/* Emit buffered correction bits that must be associated with this code */ \
|
||||||
|
emit_buffered_bits(entropy, BR_buffer, BR); \
|
||||||
|
BR_buffer = entropy->bit_buffer; /* BE bits are gone now */ \
|
||||||
|
BR = 0; \
|
||||||
|
r = 0; /* reset zero run length */ \
|
||||||
|
signbits >>= 1; \
|
||||||
|
zerobits >>= 1; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
METHODDEF(boolean)
|
METHODDEF(boolean)
|
||||||
encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||||
{
|
{
|
||||||
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
|
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
|
||||||
register int temp;
|
register int temp, r;
|
||||||
register int r, k;
|
|
||||||
int EOB;
|
|
||||||
char *BR_buffer;
|
char *BR_buffer;
|
||||||
unsigned int BR;
|
unsigned int BR;
|
||||||
int Se = cinfo->Se;
|
int Sl = cinfo->Se - cinfo->Ss + 1;
|
||||||
int Al = cinfo->Al;
|
int Al = cinfo->Al;
|
||||||
JBLOCKROW block;
|
JCOEF absvalues_unaligned[DCTSIZE2 + 15];
|
||||||
int absvalues[DCTSIZE2];
|
JCOEF *absvalues;
|
||||||
|
const JCOEF *cabsvalue, *EOBPTR;
|
||||||
|
size_t zerobits, signbits;
|
||||||
|
size_t bits[16 / SIZEOF_SIZE_T];
|
||||||
|
|
||||||
entropy->next_output_byte = cinfo->dest->next_output_byte;
|
entropy->next_output_byte = cinfo->dest->next_output_byte;
|
||||||
entropy->free_in_buffer = cinfo->dest->free_in_buffer;
|
entropy->free_in_buffer = cinfo->dest->free_in_buffer;
|
||||||
@@ -643,26 +945,17 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
if (entropy->restarts_to_go == 0)
|
if (entropy->restarts_to_go == 0)
|
||||||
emit_restart(entropy, entropy->next_restart_num);
|
emit_restart(entropy, entropy->next_restart_num);
|
||||||
|
|
||||||
/* Encode the MCU data block */
|
#ifdef WITH_SIMD
|
||||||
block = MCU_data[0];
|
cabsvalue = absvalues = (JCOEF *)PAD((size_t)absvalues_unaligned, 16);
|
||||||
|
#else
|
||||||
|
/* Not using SIMD, so alignment is not needed */
|
||||||
|
cabsvalue = absvalues = absvalues_unaligned;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* It is convenient to make a pre-pass to determine the transformed
|
/* Prepare data */
|
||||||
* coefficients' absolute values and the EOB position.
|
EOBPTR = absvalues +
|
||||||
*/
|
entropy->AC_refine_prepare(MCU_data[0][0], jpeg_natural_order + cinfo->Ss,
|
||||||
EOB = 0;
|
Sl, Al, absvalues, bits);
|
||||||
for (k = cinfo->Ss; k <= Se; k++) {
|
|
||||||
temp = (*block)[jpeg_natural_order[k]];
|
|
||||||
/* We must apply the point transform by Al. For AC coefficients this
|
|
||||||
* is an integer division with rounding towards 0. To do this portably
|
|
||||||
* in C, we shift after obtaining the absolute value.
|
|
||||||
*/
|
|
||||||
if (temp < 0)
|
|
||||||
temp = -temp; /* temp is abs value of input */
|
|
||||||
temp >>= Al; /* apply the point transform */
|
|
||||||
absvalues[k] = temp; /* save abs value for main pass */
|
|
||||||
if (temp == 1)
|
|
||||||
EOB = k; /* EOB = index of last newly-nonzero coef */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Encode the AC coefficients per section G.1.2.3, fig. G.7 */
|
/* Encode the AC coefficients per section G.1.2.3, fig. G.7 */
|
||||||
|
|
||||||
@@ -670,52 +963,32 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
BR = 0; /* BR = count of buffered bits added now */
|
BR = 0; /* BR = count of buffered bits added now */
|
||||||
BR_buffer = entropy->bit_buffer + entropy->BE; /* Append bits to buffer */
|
BR_buffer = entropy->bit_buffer + entropy->BE; /* Append bits to buffer */
|
||||||
|
|
||||||
for (k = cinfo->Ss; k <= Se; k++) {
|
zerobits = bits[0];
|
||||||
if ((temp = absvalues[k]) == 0) {
|
#if SIZEOF_SIZE_T == 8
|
||||||
r++;
|
signbits = bits[1];
|
||||||
continue;
|
#else
|
||||||
|
signbits = bits[2];
|
||||||
|
#endif
|
||||||
|
ENCODE_COEFS_AC_REFINE((void)0;);
|
||||||
|
|
||||||
|
#if SIZEOF_SIZE_T == 4
|
||||||
|
zerobits = bits[1];
|
||||||
|
signbits = bits[3];
|
||||||
|
|
||||||
|
if (zerobits) {
|
||||||
|
int diff = ((absvalues + DCTSIZE2 / 2) - cabsvalue);
|
||||||
|
int idx = count_zeroes(&zerobits);
|
||||||
|
signbits >>= idx;
|
||||||
|
idx += diff;
|
||||||
|
r += idx;
|
||||||
|
cabsvalue += idx;
|
||||||
|
goto first_iter_ac_refine;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Emit any required ZRLs, but not if they can be folded into EOB */
|
ENCODE_COEFS_AC_REFINE(first_iter_ac_refine:);
|
||||||
while (r > 15 && k <= EOB) {
|
#endif
|
||||||
/* emit any pending EOBRUN and the BE correction bits */
|
|
||||||
emit_eobrun(entropy);
|
|
||||||
/* Emit ZRL */
|
|
||||||
emit_symbol(entropy, entropy->ac_tbl_no, 0xF0);
|
|
||||||
r -= 16;
|
|
||||||
/* Emit buffered correction bits that must be associated with ZRL */
|
|
||||||
emit_buffered_bits(entropy, BR_buffer, BR);
|
|
||||||
BR_buffer = entropy->bit_buffer; /* BE bits are gone now */
|
|
||||||
BR = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If the coef was previously nonzero, it only needs a correction bit.
|
r |= (int)((absvalues + Sl) - cabsvalue);
|
||||||
* NOTE: a straight translation of the spec's figure G.7 would suggest
|
|
||||||
* that we also need to test r > 15. But if r > 15, we can only get here
|
|
||||||
* if k > EOB, which implies that this coefficient is not 1.
|
|
||||||
*/
|
|
||||||
if (temp > 1) {
|
|
||||||
/* The correction bit is the next bit of the absolute value. */
|
|
||||||
BR_buffer[BR++] = (char) (temp & 1);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Emit any pending EOBRUN and the BE correction bits */
|
|
||||||
emit_eobrun(entropy);
|
|
||||||
|
|
||||||
/* Count/emit Huffman symbol for run length / number of bits */
|
|
||||||
emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + 1);
|
|
||||||
|
|
||||||
/* Emit output bit for newly-nonzero coef */
|
|
||||||
temp = ((*block)[jpeg_natural_order[k]] < 0) ? 0 : 1;
|
|
||||||
emit_bits(entropy, (unsigned int) temp, 1);
|
|
||||||
|
|
||||||
/* Emit buffered correction bits that must be associated with this code */
|
|
||||||
emit_buffered_bits(entropy, BR_buffer, BR);
|
|
||||||
BR_buffer = entropy->bit_buffer; /* BE bits are gone now */
|
|
||||||
BR = 0;
|
|
||||||
r = 0; /* reset zero run length */
|
|
||||||
}
|
|
||||||
|
|
||||||
if (r > 0 || BR > 0) { /* If there are trailing zeroes, */
|
if (r > 0 || BR > 0) { /* If there are trailing zeroes, */
|
||||||
entropy->EOBRUN++; /* count an EOB */
|
entropy->EOBRUN++; /* count an EOB */
|
||||||
@@ -724,7 +997,8 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
* 1. overflow of the EOB counter;
|
* 1. overflow of the EOB counter;
|
||||||
* 2. overflow of the correction bit buffer during the next MCU.
|
* 2. overflow of the correction bit buffer during the next MCU.
|
||||||
*/
|
*/
|
||||||
if (entropy->EOBRUN == 0x7FFF || entropy->BE > (MAX_CORR_BITS-DCTSIZE2+1))
|
if (entropy->EOBRUN == 0x7FFF ||
|
||||||
|
entropy->BE > (MAX_CORR_BITS - DCTSIZE2 + 1))
|
||||||
emit_eobrun(entropy);
|
emit_eobrun(entropy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user