Incorporate a few upstream doc changes; grammar police; wordsmithing; Move -arithmetic into "switches for advanced users"; Additional documentation for IDCT scaling extensions


git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@765 632fc199-4ca6-4c93-a231-07263d6284db
diff --git a/README b/README
index 32e062b..0e9b429 100644
--- a/README
+++ b/README
@@ -1,7 +1,8 @@
-libjpeg-turbo note:  This file is mostly taken from the libjpeg README
-file, and it is included only for reference.  Some parts of it may not apply to
-libjpeg-turbo.  Please see README-turbo.txt for information specific to the
-turbo version.
+libjpeg-turbo note:  This file contains portions of the libjpeg v6b and v8
+README files, with additional wordsmithing by The libjpeg-turbo Project.
+It is included only for reference, as some parts of it may not apply to
+libjpeg-turbo.  Please see README-turbo.txt for information specific to
+libjpeg-turbo.
 
 
 The Independent JPEG Group's JPEG software
@@ -256,8 +257,8 @@
 The "official" archive site for this software is www.ijg.org.
 The most recent released version can always be found there in
 directory "files".  This particular version will be archived as
-http://www.ijg.org/files/jpegsrc.v8b.tar.gz, and in Windows-compatible
-"zip" archive format as http://www.ijg.org/files/jpegsr8b.zip.
+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
 general information about JPEG.
diff --git a/cjpeg.1 b/cjpeg.1
index d348964..6fb7299 100644
--- a/cjpeg.1
+++ b/cjpeg.1
@@ -1,4 +1,4 @@
-.TH CJPEG 1 "27 January 2012"
+.TH CJPEG 1 "31 January 2012"
 .SH NAME
 cjpeg \- compress an image file to a JPEG file
 .SH SYNOPSIS
@@ -121,7 +121,7 @@
 subsampling may be unacceptable.
 .PP
 The \fB-quality\fR option accepts a comma-separated list of parameters, which
-respectively refer to the quality levels which should be assigned to the
+respectively refer to the quality levels that should be assigned to the
 quantization table slots.  If there are more q-table slots than parameters,
 then the last parameter is replicated.  Thus, if only one quality parameter is
 given, this is used for both luminance and chrominance (slots 0 and 1,
diff --git a/jpegtran.1 b/jpegtran.1
index f10cdbb..160b47d 100644
--- a/jpegtran.1
+++ b/jpegtran.1
@@ -1,4 +1,4 @@
-.TH JPEGTRAN 1 "11 October 2010"
+.TH JPEGTRAN 1 "31 January 2012"
 .SH NAME
 jpegtran \- lossless transformation of JPEG files
 .SH SYNOPSIS
@@ -184,7 +184,7 @@
 .TP
 .B \-copy comments
 Copy only comment markers.  This setting copies comments from the source file
-but discards any other data which is inessential for image display.
+but discards any other data that is inessential for image display.
 .TP
 .B \-copy all
 Copy all extra markers.  This setting preserves miscellaneous markers
diff --git a/libjpeg.txt b/libjpeg.txt
index 0153542..7b1661b 100644
--- a/libjpeg.txt
+++ b/libjpeg.txt
@@ -983,7 +983,7 @@
 	See rdswitch.c and cjpeg.c for an example of usage.
 	Note that the q_scale_factor[] values use "linear" scales, so JPEG
 	quality levels chosen by the user must be converted to these scales
-	using jpeg_quality_scaling().  Here is an example which corresponds to
+	using jpeg_quality_scaling().  Here is an example that corresponds to
 	cjpeg -quality 90,70:
 
 		jpeg_set_defaults(cinfo);
@@ -1019,7 +1019,8 @@
 given by the following fields.  These are computed from the input image
 dimensions and the compression parameters by jpeg_start_compress().  You can
 also call jpeg_calc_jpeg_dimensions() to obtain the values that will result
-from the current parameter settings.
+from the current parameter settings.  This can be useful if you are trying
+to pick a scaling ratio that will get close to a desired target size.
 
 JDIMENSION jpeg_width		Actual dimensions of output image.
 JDIMENSION jpeg_height
diff --git a/structure.txt b/structure.txt
index 779233a..83f552f 100644
--- a/structure.txt
+++ b/structure.txt
@@ -1,6 +1,6 @@
 IJG JPEG LIBRARY:  SYSTEM ARCHITECTURE
 
-Copyright (C) 1991-2009, Thomas G. Lane, Guido Vollbeding.
+Copyright (C) 1991-2012, Thomas G. Lane, Guido Vollbeding.
 This file is part of the Independent JPEG Group's software.
 For conditions of distribution and use, see the accompanying README file.
 
@@ -385,8 +385,9 @@
 
 * Data destination manager: writes the output JPEG datastream to its final
   destination (e.g., a file).  The destination manager supplied with the
-  library knows how to write to a stdio stream; for other behaviors, the
-  surrounding application may provide its own destination manager.
+  library knows how to write to a stdio stream or to a memory buffer;
+  for other behaviors, the surrounding application may provide its own
+  destination manager.
 
 * Memory manager: allocates and releases memory, controls virtual arrays
   (with backing store management, where required).
@@ -454,8 +455,8 @@
   buffered by the coefficient controller have NOT been dequantized; we
   merge dequantization and inverse DCT into a single step for speed reasons.
   When scaled-down output is asked for, simplified DCT algorithms may be used
-  that emit only 1x1, 2x2, or 4x4 samples per DCT block, not the full 8x8.
-  Works on one DCT block at a time.
+  that emit fewer samples per DCT block, not the full 8x8.  Works on one DCT
+  block at a time.
 
 * Postprocessing controller: buffer controller for the color quantization
   input buffer, when quantization is in use.  (Without quantization, this
@@ -504,9 +505,9 @@
 * Marker reading: decodes JPEG markers (except for RSTn).
 
 * Data source manager: supplies the input JPEG datastream.  The source
-  manager supplied with the library knows how to read from a stdio stream;
-  for other behaviors, the surrounding application may provide its own source
-  manager.
+  manager supplied with the library knows how to read from a stdio stream
+  or from a memory buffer;  for other behaviors, the surrounding application
+  may provide its own source manager.
 
 * Memory manager: same as for compression library.
 
@@ -586,8 +587,7 @@
 With these conventions, JSAMPLE values can be assumed to be >= 0.  This helps
 simplify correct rounding during downsampling, etc.  The JPEG standard's
 specification that sample values run from -128..127 is accommodated by
-subtracting 128 just as the sample value is copied into the source array for
-the DCT step (this will be an array of signed ints).  Similarly, during
+subtracting 128 from the sample value in the DCT step.  Similarly, during
 decompression the output of the IDCT step will be immediately shifted back to
 0..255.  (NB: different values are required when 12-bit samples are in use.
 The code is written in terms of MAXJSAMPLE and CENTERJSAMPLE, which will be
diff --git a/usage.txt b/usage.txt
index 7af75a8..4902c9b 100644
--- a/usage.txt
+++ b/usage.txt
@@ -131,7 +131,7 @@
 subsampling may be unacceptable.
 
 The -quality option accepts a comma-separated list of parameters, which
-respectively refer to the quality levels which should be assigned to the
+respectively refer to the quality levels that should be assigned to the
 quantization table slots.  If there are more q-table slots than parameters,
 then the last parameter is replicated.  Thus, if only one quality parameter is
 given, this is used for both luminance and chrominance (slots 0 and 1,
@@ -157,6 +157,11 @@
 
 Switches for advanced users:
 
+	-arithmetic	Use arithmetic coding.  CAUTION: arithmetic coded JPEG
+			is not yet widely implemented, so many decoders will
+			be unable to view an arithmetic coded JPEG file at
+			all.
+
 	-dct int	Use integer DCT method (default).
 	-dct fast	Use fast integer DCT (less accurate).
 	-dct float	Use floating-point DCT method.
@@ -201,11 +206,6 @@
 
 Switches for wizards:
 
-	-arithmetic	Use arithmetic coding.  CAUTION: arithmetic coded JPEG
-			is not yet widely implemented, so many decoders will
-			be unable to view an arithmetic coded JPEG file at
-			all.
-
 	-baseline	Force baseline-compatible quantization tables to be
 			generated.  This clamps quantization values to 8 bits
 			even at low quality settings.  (This switch is poorly
@@ -250,10 +250,11 @@
 			djpeg runs noticeably faster in this mode.
 
 	-scale M/N	Scale the output image by a factor M/N.  Currently
-			the scale factor must be 1/1, 1/2, 1/4, or 1/8.
-			Scaling is handy if the image is larger than your
-			screen; also, djpeg runs much faster when scaling
-			down the output.
+			the scale factor must be M/8, where M is an integer
+			between 1 and 16 inclusive, or any reduced fraction
+			thereof (such as 1/2, 3/4, etc.  Scaling is handy if
+			the image is larger than your screen; also, djpeg runs
+			much faster when scaling down the output.
 
 	-bmp		Select BMP output format (Windows flavor).  8-bit
 			colormapped format is emitted if -colors or -grayscale
@@ -447,9 +448,9 @@
 jpegtran accepts a subset of the switches recognized by cjpeg:
 	-optimize	Perform optimization of entropy encoding parameters.
 	-progressive	Create progressive JPEG file.
+	-arithmetic	Use arithmetic coding.
 	-restart N	Emit a JPEG restart marker every N MCU rows, or every
 			N MCU blocks if "B" is attached to the number.
-	-arithmetic	Use arithmetic coding.
 	-scans file	Use the scan script given in the specified text file.
 See the previous discussion of cjpeg for more details about these switches.
 If you specify none of these switches, you get a plain baseline-JPEG output
@@ -527,7 +528,7 @@
 			present in the source file.
 	-copy comments	Copy only comment markers.  This setting copies
 			comments from the source file but discards
-			any other data which is inessential for image display.
+			any other data that is inessential for image display.
 	-copy all	Copy all extra markers.  This setting preserves
 			miscellaneous markers found in the source file, such
 			as JFIF thumbnails, Exif data, and Photoshop settings.