38 Commits

Author SHA1 Message Date
DRC
94c64ead85 Various doc tweaks
- "bits per component" = "bits per sample"

  Describing the data precision of a JPEG image using "bits per
  component" is technically correct, but "bits per sample" is the
  terminology that the JPEG-1 spec uses.  Also, "bits per component" is
  more commonly used to describe the precision of packed-pixel formats
  (as opposed to "bits per pixel") rather than planar formats, in which
  all components are grouped together.

- Unmention legacy display technologies.  Colormapped and monochrome
  displays aren't a thing anymore, and even when they were still a
  thing, it was possible to display full-color images to them.  In 1991,
  when JPEG decompression time was measured in minutes per megapixel, it
  made sense to keep a decompressed copy of JPEG images on disk, in a
  format that could be displayed without further color conversion (since
  color conversion was slow and memory-intensive.)  In 2024, JPEG
  decompression time is measured in milliseconds per megapixel, and
  color conversion is even faster.  Thus, JPEG images can be
  decompressed, displayed, and color-converted (if necessary) "on the
  fly" at speeds too fast for human vision to perceive.  (In fact, your
  TV performs much more complicated decompression algorithms at least 60
  times per second.)

- Document that color quantization (and associated features), GIF
  input/output, Targa input/output, and OS/2 BMP input/output are legacy
  features.  Legacy status doesn't necessarily mean that the features
  are deprecated.  Rather, it is meant to discourage users from using
  features that may be of little or no benefit on modern machines (such
  as low-quality modes that had significant performance advantages in
  the early 1990s but no longer do) and that are maintained on a
  break/fix basis only.

- General wordsmithing, grammar/punctuation policing, and formatting
  tweaks

- Clarify which data precisions each cjpeg input format and each djpeg
  output format supports.

- cjpeg.1: Remove unnecessary and impolitic statement about the -targa
  switch.

- Adjust or remove performance claims to reflect the fact that:
  * On modern machines, the djpeg "-fast" switch has a negligible effect
    on performance.
  * There is a measurable difference between the performance of Floyd-
    Steinberg dithering and no dithering, but it is not likely
    perceptible to most users.
  * There is a measurable difference between the performance of 1-pass
    and 2-pass color quantization, but it is not likely perceptible to
    most users.
  * There is a measurable difference between the performance of
    full-color and grayscale output when decompressing a full-color JPEG
    image, but it is not likely perceptible to most users.
  * IDCT scaling does not necessarily improve performance.  (It
    generally does if the scaling factor is <= 1/2 and generally doesn't
    if the scaling factor is > 1/2, at least on my machine.  The
    performance claim made in jpeg-6b was probably invalidated when we
    merged the additional scaling factors from jpeg-7.)

- Clarify which djpeg switches/output formats cannot be used when
  decompressing lossless JPEG images.

- Remove djpeg hints, since those involve quality vs. speed tradeoffs
  that are no longer relevant for modern machines.

- Remove documentation regarding using color quantization with 16-bit
  data precision.  (Color quantization requires lossy mode.)

- Java: Fix typos in TJDecompressor.decompress12() and
  TJDecompressor.decompress16() documentation.

- jpegtran.1: Fix truncated paragraph

  In a man page, a single quote at the start of a line is interpreted as
  a macro.

  Closes #775

- libjpeg.txt:
  * Mention J16SAMPLE data type (oversight.)
  * Remove statement about extending jdcolor.c.  (libjpeg-turbo is not
    quite as DIY as libjpeg once was.)
  * Remove paragraph about tweaking the various typedefs in jmorecfg.h.
    It is no longer relevant for modern machines.
  * Remove caveat regarding systems with ints less than 16 bits wide.
    (ANSI/ISO C requires an int to be at least 16 bits wide, and
    libjpeg-turbo has never supported non-ANSI compilers.)

- usage.txt:
  * Add copyright header.
  * Document cjpeg -icc, -memdst, -report, -strict, and -version
    switches.
  * Document djpeg -icc, -maxscans, -memsrc, -report, -skip, -crop,
    -strict, and -version switches.
  * Document jpegtran -icc, -maxscans, -report, -strict, and -version
    switches.
2024-06-24 22:11:43 -04:00
DRC
7c1a1789d2 Merge branch 'master' into dev 2020-11-05 16:04:55 -06:00
DRC
6e632af9f6 Demote "fast" [I]DCT algorithms to legacy status
- Refer to the "slow" [I]DCT algorithms as "accurate" instead, since
  they are not slow under libjpeg-turbo.
- Adjust documentation claims to reflect the fact that the "slow" and
  "fast" algorithms produce about the same performance on AVX2-equipped
  CPUs (because of the dual-lane nature of AVX2, it was not possible to
  accelerate the "fast" algorithm beyond what was achievable with SSE2.)
  Also adjust the claims to reflect the fact that the "fast" algorithm
  tends to be ~5-15% faster than the "slow" algorithm on
  non-AVX2-equipped CPUs, regardless of the use of the libjpeg-turbo
  SIMD extensions.
- Indicate the legacy status of the "fast" and float algorithms in the
  documentation and cjpeg/djpeg usage info.
- Remove obsolete paragraph in the djpeg man page that suggested that
  the float algorithm could be faster than the "fast" algorithm on some
  CPUs.
2020-11-05 15:59:31 -06:00
DRC
88ae60986e Merge branch 'ijg' into dev
- Restore GIF read/compressed GIF write support from jpeg-6a and
  jpeg-9d.
- Integrate jpegtran -wipe and -drop options from jpeg-9a and jpeg-9d.
- Integrate jpegtran -crop extension (for expanding the image size) from
  jpeg-9a and jpeg-9d.
- Integrate other minor code tweaks from jpeg-9*
2020-10-27 13:32:13 -05:00
Guido Vollbeding
9fc018fd1a The Independent JPEG Group's JPEG software v9d 2020-10-23 10:00:48 -05:00
DRC
80acd5c4a7 Remove code for the obsolete RLE image format
libjpeg-turbo never included that code, because it requires an external
library (the Utah Raster Toolkit.)  The RLE image format was supplanted
by GIF in the late 1980s, so it is rarely seen these days.  (It had a
lousy Weissman score, anyhow.)
2019-12-19 10:36:26 -06:00
DRC
e98b061282 Add fault tolerance features to djpeg and jpegtran
- Enable progress reporting at run time using a new -report argument
  (cjpeg now supports that argument as well)
- Limit the allowable number of scans using a new -maxscans argument
- Treat warnings as fatal using a new -strict argument

This mainly demonstrates how to work around the two issues with the
JPEG standard described here:
https://libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf
since those and similar issues continue to be erroneously reported as
libjpeg-turbo bugs.
2019-12-18 15:35:56 -06:00
DRC
4893e5d8b8 Merge branch 'master' into dev 2017-11-17 19:00:53 -06:00
DRC
5bc43c7821 Further partial image decompression fixes
- Referring to 073b0e88a1 and #185, the
  reason why BMP and RLE didn't (and won't) work with partial image
  decompression is that the output engines for both formats maintain a
  whole-image buffer, which is used to reverse the order of scanlines.
  However, it was straightforward to add -crop support for GIF and
  Targa, which is useful for testing partial image decompression along
  with color quantization.
- Such testing reproduced a bug reported by Mozilla (refer to PR #182)
  whereby jpeg_skip_scanlines() would segfault if color quantization was
  enabled.  To fix this issue, read_and_discard_scanlines() now sets up
  a dummy quantize function in the same manner that it sets up a dummy
  color conversion function.

Closes #182
2017-11-13 21:01:53 -06:00
DRC
073b0e88a1 djpeg -crop: Exit gracefully with non-PPM formats
... and document that only PPM/PGM output images are supported with the
-crop option for the moment.

I investigated the possibility of supporting -crop with -bmp, but even
after resetting the buffer dimensions, I still kept getting virtual
array access errors.  It seems that doing this the "right way" would
require creating a re-initialization function for each image format's
destination manager.  I'm disinclined to do that right now, given that
this feature was Google's baby (developed as a prerequisite for
including libjpeg-turbo in Android), and the -crop option in djpeg is
intended only as an example of how to use the partial image
decompression API.  Real-world applications would need to handle this
in their own destination managers.

It would probably be possible to make this work with Targa by employing
a similar hack to the one we used with PPM, but Targa isn't popular
enough to bother.

Fixes #185
2017-11-08 21:30:19 -06:00
DRC
2ac4e9d914 Merge branch 'master' into dev 2017-06-26 22:03:32 -05:00
DRC
da2a27ef05 Honor max_memory_to_use/JPEGMEM/-maxmemory
This re-introduces a feature of the obsolete system-specific libjpeg
memory managers-- namely the ability to limit the amount of main memory
used by the library during decompression or multi-pass compression.
This is mainly beneficial for two reasons:

- Works around a 2 GB limit in libFuzzer
- Allows security-sensitive applications to set a memory limit for the
  JPEG decoder so as to work around the progressive JPEG exploit
  (LJT-01-004) described here:
  http://www.libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf

This commit also removes obsolete documentation regarding the MS-DOS
memory manager (which itself was removed long ago) and changes the
documentation of the -maxmemory switch and JPEGMEM environment variable
to reflect the fact that backing stores are never used in libjpeg-turbo.

Inspired by:
066fee2e7d

Closes #143
2017-03-18 17:42:34 -05:00
DRC
44b2399a94 libjpeg API: Support reading/writing ICC profiles
This commit does the following:

-- Merges the two glueware functions (read_icc_profile() and
write_icc_profile()) from iccjpeg.c, which is contained in downstream
projects such as LCMS, Ghostscript, Mozilla, etc.  These functions were
originally intended for inclusion in libjpeg, but Tom Lane left the IJG
before that could be accomplished.  Since then, programs and libraries
that needed to embed/extract ICC profiles in JPEG files had to include
their own local copy of iccjpeg.c, which is suboptimal.

   -- The new functions were prefixed with jpeg_ and split into separate
   files for the compressor and decompressor, per the existing libjpeg
   coding standards.

   -- jpeg_write_icc_profile() was made slightly more fault-tolerant.
   It will now trigger a libjpeg error if it is called before
   jpeg_start_compress() or if it is passed NULL arguments.

   -- jpeg_read_icc_profile() was made slightly more fault-tolerant.
   It will now trigger a libjpeg error if it is called before
   jpeg_read_header() or if it is passed NULL arguments.  It will also
   now trigger libjpeg warnings if the ICC profile data is corrupt.

   -- The code comments have been wordsmithed.

   -- Note that the one-line setup_read_icc_profile() function was not
   included.  Instead, libjpeg.txt now documents the need to call
   jpeg_save_markers(cinfo, JPEG_APP0 + 2, 0xFFFF) prior to calling
   jpeg_read_header(), if jpeg_read_icc_profile() is to be used.

-- Adds documentation for the new functions to libjpeg.txt.

-- Adds an -icc switch to cjpeg and jpegtran that allows those programs
to embed an ICC profile in the JPEG files they generate.

-- Adds an -icc switch to djpeg that allows that program to extract an
ICC profile from a JPEG file while decompressing.

-- Adds appropriate unit tests for all of the above.

-- Bumps the SO_AGE of the libjpeg API library to indicate the presence
of new API functions.

Note that the licensing information was obtained from:
https://github.com/mm2/Little-CMS/issues/37#issuecomment-66450180
2017-01-19 19:06:22 -06:00
DRC
3ab68cf563 libjpeg API: Partial scanline decompression
This, in combination with the existing jpeg_skip_scanlines() function,
provides the ability to crop the image both horizontally and vertically
while decompressing (certain restrictions apply-- see libjpeg.txt.)

This also cleans up the documentation of the line skipping feature and
removes the "strip decompression" feature from djpeg, since the new
cropping feature is a superset of it.

Refer to #34 for discussion.

Closes #34
2016-02-19 21:07:39 -06:00
DRC
83aeb7b28c Wordsmith GIF limitations in cjpeg.1/djpeg.1 2016-02-17 20:05:44 -06:00
Guido Vollbeding
a560e4b423 The Independent JPEG Group's JPEG software v9b 2016-02-16 12:27:41 -06:00
Guido Vollbeding
fc11193e7a The Independent JPEG Group's JPEG software v9a 2016-02-16 12:26:00 -06:00
Guido Vollbeding
989630f70c The Independent JPEG Group's JPEG software v8 2015-07-27 13:45:31 -05:00
Guido Vollbeding
5996a25e2f The Independent JPEG Group's JPEG software v7 2015-07-27 13:44:25 -05:00
Thomas G. Lane
5ead57a34a The Independent JPEG Group's JPEG software v6b 2015-07-27 13:43:00 -05:00
Thomas G. Lane
bc79e0680a The Independent JPEG Group's JPEG software v6 2015-07-29 15:31:30 -05:00
Thomas G. Lane
a8b67c4fbb The Independent JPEG Group's JPEG software v5b 2015-07-29 15:30:19 -05:00
Thomas G. Lane
36a4ccccd3 The Independent JPEG Group's JPEG software v5 2015-07-29 15:28:00 -05:00
Thomas G. Lane
cc7150e281 The Independent JPEG Group's JPEG software v4a 2015-07-29 15:25:01 -05:00
Thomas G. Lane
88aeed428f The Independent JPEG Group's JPEG software v4 2015-07-29 15:23:45 -05:00
Thomas G. Lane
4a6b730364 The Independent JPEG Group's JPEG software v3 2015-07-29 15:21:19 -05:00
Thomas G. Lane
bd543f030e The Independent JPEG Group's JPEG software v2 2015-07-29 15:20:00 -05:00
DRC
7a7da9460a Add regression tests for jpeg_skip_scanlines(); change "stripe" to "strip" in djpeg; document -strip and -skip parameters in djpeg
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1587 632fc199-4ca6-4c93-a231-07263d6284db
2015-06-27 08:10:31 +00:00
DRC
9665f5e3f9 Print the library version and exit whenever -version is passed to cjpeg, djpeg, or jpegtran.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.4.x@1422 632fc199-4ca6-4c93-a231-07263d6284db
2014-11-22 04:04:38 +00:00
DRC
90d6c3824b Document -rgb option in djpeg man page; "gray-scale"="grayscale"
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.3.x@1293 632fc199-4ca6-4c93-a231-07263d6284db
2014-05-12 09:08:39 +00:00
DRC
05524e671e Document the fact that the fast integer FDCT is not fully accelerated for quality levels above 97 + additional wordsmithing
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.3.x@1289 632fc199-4ca6-4c93-a231-07263d6284db
2014-05-11 23:14:43 +00:00
DRC
8940e6ca86 Provide a more thorough description of the trade-offs between the various DCT/IDCT algorithms, based on new resarch
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.3.x@1286 632fc199-4ca6-4c93-a231-07263d6284db
2014-05-11 09:46:28 +00:00
DRC
ab70623eb2 Implement in-memory source/destination managers even when not emulating the libjpeg v8 API/ABI
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@913 632fc199-4ca6-4c93-a231-07263d6284db
2013-01-18 23:42:31 +00:00
DRC
03badeab66 Further changes to the copyright/attribution notices to make it clear that our modified files are not part of the IJG's software.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@875 632fc199-4ca6-4c93-a231-07263d6284db
2013-01-01 09:49:47 +00:00
DRC
cf763c0cd8 Further changes to the copyright/attribution notices to make it clear that our modified files are not part of the IJG's software.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.2.x@876 632fc199-4ca6-4c93-a231-07263d6284db
2013-01-01 09:51:37 +00:00
DRC
27fb3fc589 Support additional scaling factors when decompressing
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@753 632fc199-4ca6-4c93-a231-07263d6284db
2012-01-28 01:48:07 +00:00
DRC
66f97e6820 Support arithmetic encoding and decoding
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@299 632fc199-4ca6-4c93-a231-07263d6284db
2010-11-23 05:49:54 +00:00
DRC
39ea562c07 Document new v7/v8 features; .doc = .txt
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@252 632fc199-4ca6-4c93-a231-07263d6284db
2010-10-12 01:55:31 +00:00