Include some comments/doc tweaks from jpeg-9+

This commit is contained in:
DRC
2016-02-18 15:16:17 -06:00
9 changed files with 87 additions and 33 deletions

View File

@@ -128,7 +128,7 @@ with respect to this software, its quality, accuracy, merchantability, or
fitness for a particular purpose. This software is provided "AS IS", and you, fitness for a particular purpose. This software is provided "AS IS", and you,
its user, assume the entire risk as to its quality and accuracy. its user, assume the entire risk as to its quality and accuracy.
This software is copyright (C) 1991-2012, Thomas G. Lane, Guido Vollbeding. This software is copyright (C) 1991-2016, Thomas G. Lane, Guido Vollbeding.
All Rights Reserved except as specified below. All Rights Reserved except as specified below.
Permission is hereby granted to use, copy, modify, and distribute this Permission is hereby granted to use, copy, modify, and distribute this
@@ -166,11 +166,11 @@ ltmain.sh). Another support script, install-sh, is copyright by X Consortium
but is also freely distributable. 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, GIF reading support has To avoid entanglement with the Unisys LZW patent (now expired), GIF reading
been removed altogether, and the GIF writer has been simplified to produce support has been removed altogether, and the GIF writer has been simplified
"uncompressed GIFs". This technique does not use the LZW algorithm; the to produce "uncompressed GIFs". This technique does not use the LZW
resulting GIF files are larger than usual, but are readable by all standard algorithm; the resulting GIF files are larger than usual, but are readable
GIF decoders. by all standard GIF decoders.
We are required to state that We are required to state that
"The Graphics Interchange Format(c) is the Copyright property of "The Graphics Interchange Format(c) is the Copyright property of
@@ -189,8 +189,8 @@ The best short technical introduction to the JPEG compression algorithm is
Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44. Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44.
(Adjacent articles in that issue discuss MPEG motion picture compression, (Adjacent articles in that issue discuss MPEG motion picture compression,
applications of JPEG, and related topics.) If you don't have the CACM issue applications of JPEG, and related topics.) If you don't have the CACM issue
handy, a PostScript file containing a revised version of Wallace's article is handy, a PDF file containing a revised version of Wallace's article is
available at http://www.ijg.org/files/wallace.ps.gz. The file (actually available at http://www.ijg.org/files/Wallace.JPEG.pdf. The file (actually
a preprint for an article that appeared in IEEE Trans. Consumer Electronics) a preprint for an article that appeared in IEEE Trans. Consumer Electronics)
omits the sample images that appeared in CACM, but it includes corrections omits the sample images that appeared in CACM, but it includes corrections
and some added material. Note: the Wallace article is copyright ACM and IEEE, and some added material. Note: the Wallace article is copyright ACM and IEEE,
@@ -246,9 +246,7 @@ ARCHIVE LOCATIONS
The "official" archive site for this software is www.ijg.org. The "official" archive site for this software is www.ijg.org.
The most recent released version can always be found there in The most recent released version can always be found there in
directory "files". This particular version will be archived as directory "files".
http://www.ijg.org/files/jpegsrc.v8d.tar.gz, and in Windows-compatible
"zip" archive format as http://www.ijg.org/files/jpegsr8d.zip.
The JPEG FAQ (Frequently Asked Questions) article is a source of some The JPEG FAQ (Frequently Asked Questions) article is a source of some
general information about JPEG. general information about JPEG.

View File

@@ -4,6 +4,23 @@ information relevant to libjpeg-turbo.
CHANGE LOG for Independent JPEG Group's JPEG software CHANGE LOG for Independent JPEG Group's JPEG software
Version 9b 17-Jan-2016
-----------------------
Document 'f' specifier for jpegtran -crop specification.
Thank to Michele Martone for suggestion.
Version 9 13-Jan-2013
----------------------
Add remark for jpeg_mem_dest() in jdatadst.c.
Thank to Elie-Gregoire Khoury for the hint.
Correct argument type in format string, avoid compiler warnings.
Thank to Vincent Torri for hint.
Version 8d 15-Jan-2012 Version 8d 15-Jan-2012
----------------------- -----------------------

View File

@@ -3,6 +3,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.
* Modified 2013 by Guido Vollbeding.
* libjpeg-turbo Modifications: * libjpeg-turbo Modifications:
* Copyright (C) 2010-2011, 2013-2015, D. R. Commander. * Copyright (C) 2010-2011, 2013-2015, D. R. Commander.
* Copyright (C) 2015, Google, Inc. * Copyright (C) 2015, Google, Inc.
@@ -373,7 +374,7 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv,
/* Scale the output image by a fraction M/N. */ /* Scale the output image by a fraction M/N. */
if (++argn >= argc) /* advance to next argument */ if (++argn >= argc) /* advance to next argument */
usage(); usage();
if (sscanf(argv[argn], "%d/%d", if (sscanf(argv[argn], "%u/%u",
&cinfo->scale_num, &cinfo->scale_denom) != 2) &cinfo->scale_num, &cinfo->scale_denom) != 2)
usage(); usage();

View File

@@ -2,7 +2,7 @@
* jdarith.c * jdarith.c
* *
* 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-2015 by Guido Vollbeding.
* libjpeg-turbo Modifications: * libjpeg-turbo Modifications:
* Copyright (C) 2015, D. R. Commander. * Copyright (C) 2015, 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
@@ -97,7 +97,7 @@ get_byte (j_decompress_ptr cinfo)
* (instead of fixed) with the bit shift counter CT. * (instead of fixed) with the bit shift counter CT.
* Thus, we also need only one (variable instead of * Thus, we also need only one (variable instead of
* fixed size) shift for the LPS/MPS decision, and * fixed size) shift for the LPS/MPS decision, and
* we can get away with any renormalization update * we can do away with any renormalization update
* of C (except for new data insertion, of course). * of C (except for new data insertion, of course).
* *
* I've also introduced a new scheme for accessing * I've also introduced a new scheme for accessing

View File

@@ -238,6 +238,9 @@ jpeg_stdio_dest (j_compress_ptr cinfo, FILE * outfile)
* larger memory, so the buffer is available to the application after * larger memory, so the buffer is available to the application after
* finishing compression, and then the application is responsible for * finishing compression, and then the application is responsible for
* freeing the requested memory. * freeing the requested memory.
* Note: An initial buffer supplied by the caller is expected to be
* managed by the application. The library does not free such buffer
* when allocating a larger buffer.
*/ */
GLOBAL(void) GLOBAL(void)

View File

@@ -1,4 +1,4 @@
.TH JPEGTRAN 1 "21 November 2014" .TH JPEGTRAN 1 "18 February 2016"
.SH NAME .SH NAME
jpegtran \- lossless transformation of JPEG files jpegtran \- lossless transformation of JPEG files
.SH SYNOPSIS .SH SYNOPSIS
@@ -19,6 +19,10 @@ for example from baseline JPEG to progressive JPEG or vice versa. It can also
perform some rearrangements of the image data, for example turning an image perform some rearrangements of the image data, for example turning an image
from landscape to portrait format by rotation. from landscape to portrait format by rotation.
.PP .PP
For EXIF files and JPEG files containing Exif data, you may prefer to use
.B exiftran
instead.
.PP
.B jpegtran .B jpegtran
works by rearranging the compressed data (DCT coefficients), without works by rearranging the compressed data (DCT coefficients), without
ever fully decoding the image. Therefore, its transformations are lossless: ever fully decoding the image. Therefore, its transformations are lossless:
@@ -28,7 +32,11 @@ followed by
.B cjpeg .B cjpeg
to accomplish the same conversion. But by the same token, to accomplish the same conversion. But by the same token,
.B jpegtran .B jpegtran
cannot perform lossy operations such as changing the image quality. cannot perform lossy operations such as changing the image quality. However,
while the image data is losslessly transformed, metadata can be removed. See
the
.B \-copy
option for specifics.
.PP .PP
.B jpegtran .B jpegtran
reads the named JPEG/JFIF file, or the standard input if no file is reads the named JPEG/JFIF file, or the standard input if no file is
@@ -150,6 +158,18 @@ For example, you may want to do
.B | pnmflip \-r90 | cjpeg) .B | pnmflip \-r90 | cjpeg)
.IP .IP
to do a perfect rotation, if available, or an approximated one if not. to do a perfect rotation, if available, or an approximated one if not.
.PP
This version of \fBjpegtran\fR also offers a lossless crop option, which
discards data outside of a given image region but losslessly preserves what is
inside. Like the rotate and flip transforms, lossless crop is restricted by the
current JPEG format; the upper left corner of the selected region must fall on
an iMCU boundary. If it doesn't, then it is silently moved up and/or left to
the nearest iMCU boundary (the lower right corner is unchanged.) Thus, the
output image covers at least the requested region, but it may cover more. The
adjustment of the region dimensions may be optionally disabled by attaching
an 'f' character ("force") to the width or height number.
The image can be losslessly cropped by giving the switch:
.TP .TP
.B \-crop WxH+X+Y .B \-crop WxH+X+Y
Crop the image to a rectangular region of width W and height H, starting at Crop the image to a rectangular region of width W and height H, starting at
@@ -180,16 +200,17 @@ such as comment blocks:
.TP .TP
.B \-copy none .B \-copy none
Copy no extra markers from source file. This setting suppresses all Copy no extra markers from source file. This setting suppresses all
comments and other excess baggage present in the source file. comments and other metadata in the source file.
.TP .TP
.B \-copy comments .B \-copy comments
Copy only comment markers. This setting copies comments from the source file Copy only comment markers. This setting copies comments from the source file
but discards any other data that is inessential for image display. but discards any other metadata.
.TP .TP
.B \-copy all .B \-copy all
Copy all extra markers. This setting preserves miscellaneous markers Copy all extra markers. This setting preserves miscellaneous markers
found in the source file, such as JFIF thumbnails, Exif data, and Photoshop found in the source file, such as JFIF thumbnails, Exif data, and Photoshop
settings. In some files, these extra markers can be sizable. settings. In some files, these extra markers can be sizable. Note that this
option will copy thumbnails as-is; they will not be transformed.
.PP .PP
The default behavior is \fB-copy comments\fR. (Note: in IJG releases v6 and The default behavior is \fB-copy comments\fR. (Note: in IJG releases v6 and
v6a, \fBjpegtran\fR always did the equivalent of \fB-copy none\fR.) v6a, \fBjpegtran\fR always did the equivalent of \fB-copy none\fR.)

View File

@@ -26,7 +26,7 @@
#endif #endif
#define JCOPYRIGHT "Copyright (C) 1991-2012 Thomas G. Lane, Guido Vollbeding\n" \ #define JCOPYRIGHT "Copyright (C) 1991-2016 Thomas G. Lane, Guido Vollbeding\n" \
"Copyright (C) 1999-2006 MIYASAKA Masaru\n" \ "Copyright (C) 1999-2006 MIYASAKA Masaru\n" \
"Copyright (C) 2009 Pierre Ossman for Cendio AB\n" \ "Copyright (C) 2009 Pierre Ossman for Cendio AB\n" \
"Copyright (C) 2009-2016 D. R. Commander\n" \ "Copyright (C) 2009-2016 D. R. Commander\n" \

View File

@@ -1,7 +1,7 @@
USING THE IJG JPEG LIBRARY USING THE IJG JPEG LIBRARY
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-2011, Thomas G. Lane, Guido Vollbeding. Copyright (C) 1994-2013, Thomas G. Lane, Guido Vollbeding.
libjpeg-turbo Modifications: libjpeg-turbo Modifications:
Copyright (C) 2010, 2014, 2015, D. R. Commander. Copyright (C) 2010, 2014, 2015, D. R. Commander.
Copyright (C) 2015, Google, Inc. Copyright (C) 2015, Google, Inc.
@@ -916,6 +916,10 @@ jpeg_simple_progression (j_compress_ptr cinfo)
Compression parameters (cinfo fields) include: Compression parameters (cinfo fields) include:
boolean arith_code
If TRUE, use arithmetic coding.
If FALSE, use Huffman coding.
J_DCT_METHOD dct_method J_DCT_METHOD dct_method
Selects the algorithm used for the DCT step. Choices are: Selects the algorithm used for the DCT step. Choices are:
JDCT_ISLOW: slow but accurate integer algorithm JDCT_ISLOW: slow but accurate integer algorithm

View File

@@ -51,9 +51,9 @@ This syntax works on all systems, so it is useful for scripts.
The currently supported image file formats are: PPM (PBMPLUS color format), The currently supported image file formats are: PPM (PBMPLUS color format),
PGM (PBMPLUS grayscale format), BMP, Targa, and RLE (Utah Raster Toolkit PGM (PBMPLUS grayscale format), BMP, Targa, and RLE (Utah Raster Toolkit
format). (RLE is supported only if the URT library is available.) format). (RLE is supported only if the URT library is available, which it
cjpeg recognizes the input image format automatically, with the exception isn't on most non-Unix systems.) cjpeg recognizes the input image format
of some Targa-format files. You have to tell djpeg which format to generate. automatically, with the exception of some Targa files.
JPEG files are in the defacto standard JFIF file format. There are other, JPEG files are in the defacto standard JFIF file format. There are other,
less widely used JPEG-based file formats, but we don't support them. less widely used JPEG-based file formats, but we don't support them.
@@ -275,6 +275,8 @@ The basic command line switches for djpeg are:
Useful for viewing on monochrome displays; also, Useful for viewing on monochrome displays; also,
djpeg runs noticeably faster in this mode. djpeg runs noticeably faster in this mode.
-rgb Force RGB output even if JPEG file is grayscale.
-scale M/N Scale the output image by a factor M/N. Currently -scale M/N Scale the output image by a factor M/N. Currently
the scale factor must be M/8, where M is an integer the scale factor must be M/8, where M is an integer
between 1 and 16 inclusive, or any reduced fraction between 1 and 16 inclusive, or any reduced fraction
@@ -425,8 +427,9 @@ it may run out of memory even with -maxmemory 0. In that case you can still
decompress, with some loss of image quality, by specifying -onepass for decompress, with some loss of image quality, by specifying -onepass for
one-pass quantization. one-pass quantization.
To avoid the Unisys LZW patent, djpeg produces uncompressed GIF files. These To avoid the Unisys LZW patent (now expired), djpeg produces uncompressed GIF
are larger than they should be, but are readable by standard GIF decoders. files. These are larger than they should be, but are readable by standard GIF
decoders.
HINTS FOR BOTH PROGRAMS HINTS FOR BOTH PROGRAMS
@@ -468,14 +471,16 @@ jpegtran performs various useful transformations of JPEG files.
It can translate the coded representation from one variant of JPEG to another, It can translate the coded representation from one variant of JPEG to another,
for example from baseline JPEG to progressive JPEG or vice versa. It can also for example from baseline JPEG to progressive JPEG or vice versa. It can also
perform some rearrangements of the image data, for example turning an image perform some rearrangements of the image data, for example turning an image
from landscape to portrait format by rotation. from landscape to portrait format by rotation. For EXIF files and JPEG files
containing Exif data, you may prefer to use exiftran instead.
jpegtran works by rearranging the compressed data (DCT coefficients), without jpegtran works by rearranging the compressed data (DCT coefficients), without
ever fully decoding the image. Therefore, its transformations are lossless: ever fully decoding the image. Therefore, its transformations are lossless:
there is no image degradation at all, which would not be true if you used there is no image degradation at all, which would not be true if you used
djpeg followed by cjpeg to accomplish the same conversion. But by the same djpeg followed by cjpeg to accomplish the same conversion. But by the same
token, jpegtran cannot perform lossy operations such as changing the image token, jpegtran cannot perform lossy operations such as changing the image
quality. quality. However, while the image data is losslessly transformed, metadata
can be removed. See the -copy option for specifics.
jpegtran uses a command line syntax similar to cjpeg or djpeg. jpegtran uses a command line syntax similar to cjpeg or djpeg.
On Unix-like systems, you say: On Unix-like systems, you say:
@@ -543,7 +548,10 @@ data outside of a given image region but losslessly preserves what is inside.
Like the rotate and flip transforms, lossless crop is restricted by the current Like the rotate and flip transforms, lossless crop is restricted by the current
JPEG format; the upper left corner of the selected region must fall on an iMCU JPEG format; the upper left corner of the selected region must fall on an iMCU
boundary. If it doesn't, then it is silently moved up and/or left to the boundary. If it doesn't, then it is silently moved up and/or left to the
nearest iMCU boundary (the lower right corner is unchanged.) nearest iMCU boundary (the lower right corner is unchanged.) Thus, the output
image covers at least the requested region, but it may cover more. The
adjustment of the region dimensions may be optionally disabled by attaching an
'f' character ("force") to the width or height number.
The image can be losslessly cropped by giving the switch: The image can be losslessly cropped by giving the switch:
-crop WxH+X+Y Crop to a rectangular region of width W and height H, -crop WxH+X+Y Crop to a rectangular region of width W and height H,
@@ -564,15 +572,17 @@ a grayscale JPEG is substantially less than that for a color JPEG.)
jpegtran also recognizes these switches that control what to do with "extra" jpegtran also recognizes these switches that control what to do with "extra"
markers, such as comment blocks: markers, such as comment blocks:
-copy none Copy no extra markers from source file. This setting -copy none Copy no extra markers from source file. This setting
suppresses all comments and other excess baggage suppresses all comments and other metadata in the
present in the source file. source file.
-copy comments Copy only comment markers. This setting copies -copy comments Copy only comment markers. This setting copies
comments from the source file but discards comments from the source file but discards any other
any other data that is inessential for image display. metadata.
-copy all Copy all extra markers. This setting preserves -copy all Copy all extra markers. This setting preserves
miscellaneous markers found in the source file, such miscellaneous markers found in the source file, such
as JFIF thumbnails, Exif data, and Photoshop settings. as JFIF thumbnails, Exif data, and Photoshop settings.
In some files, these extra markers can be sizable. In some files, these extra markers can be sizable.
Note that this option will copy thumbnails as-is;
they will not be transformed.
The default behavior is -copy comments. (Note: in IJG releases v6 and v6a, The default behavior is -copy comments. (Note: in IJG releases v6 and v6a,
jpegtran always did the equivalent of -copy none.) jpegtran always did the equivalent of -copy none.)