2770 Commits

Author SHA1 Message Date
DRC
5550c80fdc Doc: "compress operation"="compression operation"
(consistification)
2024-09-03 17:20:10 -04:00
DRC
939f3814ab Test: Replace test2.icc with test3.icc
test3.icc is smaller, and it is also an RGB profile rather than a CMYK
profile.  (test1.icc is a CMYK profile.)
2024-09-03 15:47:57 -04:00
DRC
a5689cd45b Test: Replace big_tree8.bmp and big_building16.ppm
These images were only used with tjbenchtest and tjexampletest, but I
was concerned about introducing additional licensing provisions into the
libjpeg-turbo source tree.  Thus, this commit replaces them with images
that I own and can thus make available under the libjpeg-turbo licenses
with no additional provisions.
2024-09-03 15:47:37 -04:00
DRC
a4d19a4592 Merge branch 'main' into dev 2024-09-03 09:27:04 -04:00
DRC
37851a32c0 TurboJPEG: Add restart markers when transforming 2024-09-03 09:26:33 -04:00
DRC
f5f8f5aadc TJ: Reorder functions to improve readability
Put all general functions at the top of the list, and ensure that all
functions are defined before they are mentioned.  Also consistify the
function ordering between turbojpeg.h and turbojpeg.c
2024-09-03 09:02:55 -04:00
DRC
a66398fee8 Move md5cmp/md5sum into ${CMAKE_BINARY_DIR}/test 2024-09-02 17:31:56 -04:00
DRC
f0bc90d9e0 Test: Move test logs into ${CMAKE_BINARY_DIR}/test 2024-09-02 17:31:34 -04:00
DRC
df04d26a99 Test: Clean up TurboJPEG example test logs 2024-09-02 17:31:30 -04:00
DRC
f464728a2b ChangeLog.md: Minor wordsmithing 2024-09-02 08:00:27 -04:00
DRC
debf57bc1d TJBench: Improve usage screen readability 2024-09-01 14:05:37 -04:00
DRC
fad6100704 Replace TJExample with IJG workalike programs 2024-09-01 14:05:15 -04:00
DRC
6d9f1f816c Merge branch 'main' into dev 2024-09-01 14:04:20 -04:00
DRC
843d04d9d4 CI: Run regression tests in parallel 2024-09-01 11:52:01 -04:00
DRC
797c6ccd98 Doc: Further clarify MCU definition 2024-09-01 11:25:29 -04:00
DRC
7f45663d30 Merge branch 'main' into dev 2024-09-01 10:05:57 -04:00
DRC
7ec70ee891 testclean.cmake: Remove croptest.log 2024-09-01 09:59:10 -04:00
DRC
174672af4e jquant1.c: Formatting tweak
Extending the Bayer matrix past Column 80 seems like a lesser
readability sin than not putting a space after each comma, especially
since we had to explicitly whitelist the file in checkstyle.
2024-09-01 09:55:52 -04:00
DRC
3e303e7235 TJBench: Allow British spellings in arguments 2024-08-31 18:42:19 -04:00
DRC
9b1198968b Move test scripts into test/ 2024-08-31 18:07:13 -04:00
DRC
645673810f Merge branch 'main' into dev 2024-08-31 17:41:03 -04:00
DRC
eb75363004 Update URLs
- Eliminate unnecessary "www."
- Use HTTPS.
- Update Java, MSYS, tdm-gcc, and NSIS URLs.
- Update URL and title of Agner Fog's assembly language optimization
  manual.
- Remove extraneous information about MASM and Borland Turbo Assembler
  and outdated NASM URLs from the x86 assembly headers, and mention
  Yasm.
2024-08-31 16:50:08 -04:00
DRC
0fb8fbe158 CMakeLists.txt: libjpeg-turbo "2.2.x" = "3.0.x" 2024-08-31 15:39:34 -04:00
DRC
8d76e4e550 Doc: "EXIF" = "Exif" 2024-08-31 15:33:55 -04:00
DRC
9983840eb6 TJ/xform: Check crop region against dest. image
Lossless cropping is performed after other lossless transform
operations, so the cropping region must be specified relative to the
destination image dimensions and level of chrominance subsampling, not
the source image dimensions and level of chrominance subsampling.

More specifically, if the lossless transform operation swaps the X and Y
axes, or if the image is converted to grayscale, then that changes the
cropping region requirements.
2024-08-31 15:04:30 -04:00
DRC
8456d2b98c Doc: "MCU block" = "iMCU" or "MCU"
The JPEG-1 spec never uses the term "MCU block".  That term is rarely
used in other literature to describe the equivalent of an MCU in an
interleaved JPEG image, but the libjpeg documentation uses "iMCU" to
describe the same thing.  "iMCU" is a better term, since the equivalent
of an interleaved MCU can contain multiple DCT blocks (or samples in
lossless mode) that are only grouped together if the image is
interleaved.

In the case of restart markers, "MCU block" was used in the libjpeg
documentation instead of "MCU", but "MCU" is more accurate and less
confusing.  (The restart interval is literally in MCUs, where one MCU
is one data unit in a non-interleaved JPEG image and multiple data units
in a multi-component interleaved JPEG image.)

In the case of 9b704f96b2, the issue was
actually with progressive JPEG images exactly two DCT blocks wide, not
two MCU blocks wide.

This commit also defines "MCU" and "MCU row" in the description of the
various restart marker options/parameters.  Although an MCU row is
technically always a row of samples in lossless mode, "sample row" was
confusing, since it is used in other places to describe a row of samples
for a single component (whereas an MCU row in a typical lossless JPEG
image consists of a row of interleaved samples for all components.)
2024-08-30 14:16:09 -04:00
DRC
2858783db5 JNI: Set srcX, srcY = 0 in loadSourceImage()
(oversight from 79b8d65f0f)
2024-08-28 18:58:27 -04:00
DRC
4ceaf8b700 TJBench: Allow 'X' in crop spec
(for consistency with djpeg and jpegtran)
2024-08-28 18:58:27 -04:00
DRC
fd9b21b69b Merge branch 'main' into dev 2024-08-28 18:58:21 -04:00
DRC
5cf7960678 Undocument TJ*PARAM_RESTARTBLOCKS for lossless
TJ*PARAM_RESTARTBLOCKS technically works with lossless compression, but
it is not useful, since the value must be equal to the number of samples
in a row.  (In other words, it is no different than
TJ*PARAM_RESTARTINROWS, except that it requires the user to do more
math.)
2024-08-28 18:36:37 -04:00
DRC
d62079717c TJBench: Don't override subsamp until args parsed
Otherwise, passing -subsamp after -lossless might cause the worst-case
JPEG buffer size to be too small.
2024-08-28 18:21:55 -04:00
DRC
c72bbd9c06 tjbench.c: (Re)allow unreduced scaling factors
For reasons I can't recall, fc01f4673b
(the TurboJPEG 3 API overhaul) changed the C version of TJBench, but not
the Java version, so that it requires an exact scaling factor match (as
opposed to allowing unreduced scaling factors, as djpeg does and prior
versions of TJBench did.)  That might have been temporary testing code
that was accidentally committed.
2024-08-26 18:14:12 -04:00
DRC
6a9565ce6e Merge branch 'main' into dev 2024-08-26 16:45:41 -04:00
DRC
35199878f6 TurboJPEG doc: Fix incorrect/confusing parentheses 2024-08-26 16:35:30 -04:00
DRC
00a261c473 tjbench.c: Code formatting tweak 2024-08-26 16:31:02 -04:00
DRC
4851cbe406 djpeg/jpeg_crop_scanline(): Disallow crop vals < 0
Because the crop spec was parsed using unsigned 32-bit integers,
negative numbers were interpreted as values ~= UINT_MAX (4,294,967,295).
This had the following ramifications:

- If the cropping region width was negative and the adjusted width + the
  adjusted left boundary was greater than 0, then the 32-bit unsigned
  integer bounds checks in djpeg and jpeg_crop_scanline() overflowed and
  failed to detect the out-of-bounds width, jpeg_crop_scanline() set
  cinfo->output_width to a value ~= UINT_MAX, and a buffer overrun and
  subsequent segfault occurred in the upsampling or color conversion
  routine.  The segfault occurred in the body of
  jpeg_skip_scanlines() --> read_and_discard_scanlines() if the cropping
  region upper boundary was greater than 0 and the JPEG image used
  chrominance subsampling and in the body of jpeg_read_scanlines()
  otherwise.

- If the cropping region width was negative and the adjusted width + the
  adjusted left boundary was 0, then a zero-width output image was
  generated.

- If the cropping region left boundary was negative, then an output
  image with bogus data was generated.

This commit modifies djpeg and jpeg_crop_scanline() so that the
aforementioned bounds checks use 64-bit unsigned integers, thus guarding
against overflow.  It similarly modifies jpeg_skip_scanlines().  In the
case of jpeg_skip_scanlines(), the issue was not reproducible with
djpeg, but passing a negative number of lines to jpeg_skip_scanlines()
caused a similar overflow if the number of lines +
cinfo->output_scanline was greater than 0.  That caused
jpeg_skip_scanlines() to read past the end of the JPEG image, throw a
warning ("Corrupt JPEG data: premature end of data segment"), and fail
to return unless warnings were treated as fatal.  Also, djpeg now parses
the crop spec using signed integers and checks for negative values.
2024-08-26 16:24:33 -04:00
DRC
548f732432 TJBench: Usage screen tweak
Indicate that -maxmemory and -maxpixels take an integer argument.
2024-08-26 10:14:11 -04:00
DRC
de4bbac55e TJCompressor.compress(): Fix lossls buf size calc 2024-08-23 12:48:34 -04:00
DRC
4eedf5085d appveyor.yml: Require Java 8 or later
Public support for Java 6 ended in April 2013, and extended support for
it ended in October 2018.  Public support for Java 7 ended in July 2015,
and extended support for it ended in July 2022.  Technically speaking,
the only code that requires Java 8 at the moment is in TJUnitTest.java
(introduced in 79b8d65f0f86af77afc5979ecc104b1fbc97c82d.)  It is
possible to refactor that code to be compatible with Java 6, but there
are much better uses of our project's limited resources than supporting
long-dead platforms.
2024-08-23 11:15:48 -04:00
DRC
acbb493759 JNI: Fix Windows CI build failure
(introduced by previous commit)

jint and int are technically the same thing, but certain compilers are a
bit pedantic.
2024-08-22 18:32:30 -04:00
DRC
79b8d65f0f Java: Add official packed-pixel image I/O methods 2024-08-22 18:19:09 -04:00
DRC
8088dfc08c TJUnitTest.java: Use boolean ret vals for check*() 2024-08-22 18:16:15 -04:00
DRC
e2932b68ac ChangeLog.md: Formatting tweak
(oversight from d6ce7df352)
2024-08-22 17:14:45 -04:00
DRC
b577504f1d JNI: Remove deprecated constants
(oversight from 0737844235)
2024-08-22 17:14:45 -04:00
DRC
a98bc9a54f Merge branch 'main' into dev 2024-08-22 17:14:37 -04:00
DRC
0acb084464 JNI: Fix *Image() array size issues w/ align != 1
+ check for mismatch between C and Java APIs in *saveImage().
2024-08-22 16:58:50 -04:00
DRC
d44fc54f94 Java: Unset srcBuf12/16 with BufferedImage/YUV src
Due to an oversight in the multi-precision feature,
TJCompressor.srcBuf12 and TJCompressor.srcBuf16 were not set to null
in TJCompressor.setSourceImage(YUVImage) or
TJCompressor.setSourceImage(BufferedImage, ...).  Thus, if an
application set a 12-bit or 16-bit packed-pixel buffer as the source
image then set a BufferedImage with integer pixels as the source image,
TJCompress.compress() would compress from the 12-bit or 16-bit
packed-pixel buffer instead of the BufferedImage.  The odds of an
application actually doing that are very slim, however.
2024-08-21 16:44:46 -04:00
DRC
ecf7c8b168 Merge branch 'main' into dev 2024-08-21 13:09:53 -04:00
DRC
24fbf64d31 TJBench: Consistify args with djpeg
-fastdct --> -dct fast
-fastupsample --> -nosmooth
2024-08-21 13:07:46 -04:00
DRC
d6ce7df352 TJBench: Consistify args with cjpeg/djpeg/jpegtran
-hflip --> -flip horizontal
-limitscans --> -maxscans N
-rot90 --> -rotate 90
-rot180 --> -rotate 180
-rot270 --> -rotate 270
-stoponwarning --> -strict
-vflip --> -flip vertical
2024-08-21 13:07:46 -04:00