From 8456d2b98cf1dd4867abcad9088fabac549959ba Mon Sep 17 00:00:00 2001
From: DRC This option causes tj3Transform() to return an error if the transform is not perfect.
-#define TJXOPT_TRIM
+ Discard any partial MCU blocks that cannot be transformed. Discard any partial iMCUs that cannot be transformed. #define TJXOPT_CROP
@@ -386,10 +386,10 @@ Functions
Enable lossless cropping.
Variables
-static const int tjMCUWidth [TJ_NUMSAMP]
+ MCU block width (in pixels) for a given level of chrominance subsampling. iMCU width (in pixels) for a given level of chrominance subsampling
-static const int tjMCUHeight [TJ_NUMSAMP]
+ MCU block height (in pixels) for a given level of chrominance subsampling. iMCU height (in pixels) for a given level of chrominance subsampling static const int tjRedOffset [TJ_NUMPF]
@@ -664,7 +664,7 @@ scalingFactor). Red offset (in samples) for a given pixel format.
This option causes tj3Transform() to return an error if the transform is not perfect.
-Lossless transforms operate on MCU blocks, the size of which depends on the level of chrominance subsampling used (see tjMCUWidth and tjMCUHeight.) If the image's width or height is not evenly divisible by the MCU block size, then there will be partial MCU blocks on the right and/or bottom edges. It is not possible to move these partial MCU blocks to the top or left of the image, so any transform that would require that is "imperfect." If this option is not specified, then any partial MCU blocks that cannot be transformed will be left in place, which will create odd-looking strips on the right or bottom edge of the image.
+Lossless transforms operate on iMCUs, the size of which depends on the level of chrominance subsampling used (see tjMCUWidth and tjMCUHeight.) If the image's width or height is not evenly divisible by the iMCU size, then there will be partial iMCUs on the right and/or bottom edges. It is not possible to move these partial iMCUs to the top or left of the image, so any transform that would require that is "imperfect." If this option is not specified, then any partial iMCUs that cannot be transformed will be left in place, which will create odd-looking strips on the right or bottom edge of the image.
Discard any partial MCU blocks that cannot be transformed.
+Discard any partial iMCUs that cannot be transformed.
Huffman table optimization improves compression slightly (generally 5% or less), but it reduces compression performance considerably.
Progressive JPEG.
-In a progressive JPEG image, the DCT coefficients are split across multiple "scans" of increasing quality. Thus, a low-quality scan containing the lowest-frequency DCT coefficients can be transmitted first and refined with subsequent higher-quality scans containing higher-frequency DCT coefficients. When using Huffman entropy coding, the progressive JPEG format also provides an "end-of-bands (EOB) run" feature that allows large groups of zeroes, potentially spanning multiple MCU blocks, to be represented using only a few bytes.
+In a progressive JPEG image, the DCT coefficients are split across multiple "scans" of increasing quality. Thus, a low-quality scan containing the lowest-frequency DCT coefficients can be transmitted first and refined with subsequent higher-quality scans containing higher-frequency DCT coefficients. When using Huffman entropy coding, the progressive JPEG format also provides an "end-of-bands (EOB) run" feature that allows large groups of zeroes, potentially spanning multiple MCUs, to be represented using only a few bytes.
Value
0 [default for compression, lossless transformation] The lossy JPEG image is (decompression) or will be (compression, lossless transformation) single-scan.1 The lossy JPEG image is (decompression) or will be (compression, lossless transformation) progressive. For lossless transformation, this can also be specified using TJXOPT_PROGRESSIVE.A point transform value of 0 is necessary in order to generate a fully lossless JPEG image. (A non-zero point transform value right-shifts the input samples by the specified number of bits, which is effectively a form of lossy color quantization.)
JPEG restart marker interval in MCU blocks [lossy compression only].
+JPEG restart marker interval in MCUs [lossy compression only].
The nature of entropy coding is such that a corrupt JPEG image cannot be decompressed beyond the point of corruption unless it contains restart markers. A restart marker stops and restarts the entropy coding algorithm so that, if a JPEG image is corrupted, decompression can resume at the next marker. Thus, adding more restart markers improves the fault tolerance of the JPEG image, but adding too many restart markers can adversely affect the compression ratio and performance.
+In typical JPEG images, an MCU (Minimum Coded Unit) is the minimum set of interleaved "data units" (8x8 DCT blocks if the image is lossy or samples if the image is lossless) necessary to represent at least one data unit per component. (For example, an MCU in an interleaved lossy JPEG image that uses 4:2:2 subsampling consists of two luminance blocks followed by one block for each chrominance component.) In single-component or non-interleaved JPEG images, an MCU is the same as a data unit.
Value
0 (no restart markers)]0 (no restart markers)]Setting this parameter to a non-zero value sets TJPARAM_RESTARTROWS to 0.
+Setting this parameter to a non-zero value sets TJPARAM_RESTARTROWS to 0.
JPEG restart marker interval in MCU rows (lossy) or sample rows (lossless) [compression only].
-See TJPARAM_RESTARTBLOCKS for a description of restart markers.
+JPEG restart marker interval in MCU rows [compression only].
+See TJPARAM_RESTARTBLOCKS for a description of restart markers and MCUs. An MCU row is a row of MCUs spanning the entire width of the image.
Value
0 (no restart markers)]0 (no restart markers)]Setting this parameter to a non-zero value sets TJPARAM_RESTARTBLOCKS to 0.
+Setting this parameter to a non-zero value sets TJPARAM_RESTARTBLOCKS to 0.
JPEG horizontal pixel density.
Value
Do not transform the position of the image pixels.
Flip (mirror) image horizontally.
-This transform is imperfect if there are any partial MCU blocks on the right edge (see TJXOPT_PERFECT.)
+This transform is imperfect if there are any partial iMCUs on the right edge (see TJXOPT_PERFECT.)
Flip (mirror) image vertically.
-This transform is imperfect if there are any partial MCU blocks on the bottom edge (see TJXOPT_PERFECT.)
+This transform is imperfect if there are any partial iMCUs on the bottom edge (see TJXOPT_PERFECT.)
Transpose image (flip/mirror along upper left to lower right axis.) This transform is always perfect.
Transverse transpose image (flip/mirror along upper right to lower left axis.) This transform is imperfect if there are any partial MCU blocks in the image (see TJXOPT_PERFECT.)
+Transverse transpose image (flip/mirror along upper right to lower left axis.) This transform is imperfect if there are any partial iMCUs in the image (see TJXOPT_PERFECT.)
Rotate image clockwise by 90 degrees.
-This transform is imperfect if there are any partial MCU blocks on the bottom edge (see TJXOPT_PERFECT.)
+This transform is imperfect if there are any partial iMCUs on the bottom edge (see TJXOPT_PERFECT.)
Rotate image 180 degrees.
-This transform is imperfect if there are any partial MCU blocks in the image (see TJXOPT_PERFECT.)
+This transform is imperfect if there are any partial iMCUs in the image (see TJXOPT_PERFECT.)
Rotate image counter-clockwise by 90 degrees.
-This transform is imperfect if there are any partial MCU blocks on the right edge (see TJXOPT_PERFECT.)
+This transform is imperfect if there are any partial iMCUs on the right edge (see TJXOPT_PERFECT.)
*jpegSize should be set to the size of
| handle | handle to a TurboJPEG instance that has been initialized for compression | ||||||||||||||||||||||||||||
| srcBuf | pointer to a buffer containing a unified planar YUV source image to be compressed. The size of this buffer should match the value returned by tj3YUVBufSize() for the given image width, height, row alignment, and level of chrominance subsampling (see TJPARAM_SUBSAMP.) The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the buffer. (Refer to YUV Image Format Notes.) | ||||||||||||||||||||||||||||
| width | width (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed. | ||||||||||||||||||||||||||||
| width | width (in pixels) of the source image. If the width is not an even multiple of the iMCU width (see tjMCUWidth), then an intermediate buffer copy will be performed. | ||||||||||||||||||||||||||||
| align | row alignment (in bytes) of the source image (must be a power of 2.) Setting this parameter to n indicates that each row in each plane of the source image is padded to the nearest multiple of n bytes (1 = unpadded.) | ||||||||||||||||||||||||||||
| height | height (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed. | ||||||||||||||||||||||||||||
| height | height (in pixels) of the source image. If the height is not an even multiple of the iMCU height (see tjMCUHeight), then an intermediate buffer copy will be performed. | ||||||||||||||||||||||||||||
| jpegBuf | address of a pointer to a byte buffer that will receive the JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:
*jpegSize should be set to the size of
- MCU block height (in pixels) for a given level of chrominance subsampling. -MCU block sizes:
iMCU height (in pixels) for a given level of chrominance subsampling +In a typical lossy JPEG image, 8x8 blocks of DCT coefficients for each component are interleaved in a single scan. If the image uses chrominance subsampling, then multiple luminance blocks are stored together, followed by a single block for each chrominance component. The combination of the full-resolution luminance block(s) and the (possibly subsampled) chrominance blocks corresponding to the same pixels is called a "Minimum Coded Unit" (MCU.) In a non-interleaved lossy JPEG image, each component is stored in a separate scan, and an MCU is a single DCT block, so we use the term "iMCU" (interleaved MCU) to refer to the equivalent of an MCU in an interleaved JPEG image. For the common case of interleaved JPEG images, an iMCU is the same as an MCU. +iMCU sizes: dstSizes[i] should be set to the size
|
MCU block width (in pixels) for a given level of chrominance subsampling.
-MCU block sizes:
iMCU width (in pixels) for a given level of chrominance subsampling
+In a typical lossy JPEG image, 8x8 blocks of DCT coefficients for each component are interleaved in a single scan. If the image uses chrominance subsampling, then multiple luminance blocks are stored together, followed by a single block for each chrominance component. The combination of the full-resolution luminance block(s) and the (possibly subsampled) chrominance blocks corresponding to the same pixels is called a "Minimum Coded Unit" (MCU.) In a non-interleaved lossy JPEG image, each component is stored in a separate scan, and an MCU is a single DCT block, so we use the term "iMCU" (interleaved MCU) to refer to the equivalent of an MCU in an interleaved JPEG image. For the common case of interleaved JPEG images, an iMCU is the same as an MCU.
+iMCU sizes:
The left boundary of the cropping region.
-This must be evenly divisible by the MCU block width (see tjMCUWidth.)
+This must be evenly divisible by the iMCU width (see tjMCUWidth.)
The upper boundary of the cropping region.
-For lossless transformation, this must be evenly divisible by the MCU block height (see tjMCUHeight.)
+For lossless transformation, this must be evenly divisible by the iMCU height (see tjMCUHeight.)
static intPARAM_RESTARTBLOCKSstatic intPARAM_RESTARTROWSstatic intgetMCUHeight(int subsamp)static intgetMCUWidth(int subsamp)Value
public static final int PARAM_RESTARTBLOCKS-
The nature of entropy coding is such that a corrupt JPEG image cannot be decompressed beyond the point of corruption unless it contains restart @@ -1813,9 +1810,18 @@ extends java.lang.Object tolerance of the JPEG image, but adding too many restart markers can adversely affect the compression ratio and performance. +
In typical JPEG images, an MCU (Minimum Coded Unit) is the minimum set + of interleaved "data units" (8x8 DCT blocks if the image is lossy or + samples if the image is lossless) necessary to represent at least one data + unit per component. (For example, an MCU in an interleaved lossy JPEG + image that uses 4:2:2 subsampling consists of two luminance blocks + followed by one block for each chrominance component.) In + single-component or non-interleaved JPEG images, an MCU is the same as a + data unit. +
Value
0 (no restart markers)]
public static final int PARAM_RESTARTROWS-
See PARAM_RESTARTBLOCKS for a description of restart markers.
+
See PARAM_RESTARTBLOCKS for a description of restart markers
+ and MCUs. An MCU row is a row of MCUs spanning the entire width of the
+ image.
Value
0 (no restart markers)]
+ 0 (no restart markers)]
Setting this parameter to a non-zero value sets @@ -2186,15 +2193,25 @@ public static final int FLAG_LIMITSCANS
public static int getMCUWidth(int subsamp)-
In a typical lossy JPEG image, 8x8 blocks of DCT coefficients for each + component are interleaved in a single scan. If the image uses chrominance + subsampling, then multiple luminance blocks are stored together, followed + by a single block for each chrominance component. The combination of the + full-resolution luminance block(s) and the (possibly subsampled) + chrominance blocks corresponding to the same pixels is called a "Minimum + Coded Unit" (MCU.) In a non-interleaved lossy JPEG image, each component + is stored in a separate scan, and an MCU is a single DCT block, so we use + the term "iMCU" (interleaved MCU) to refer to the equivalent of an MCU in + an interleaved JPEG image. For the common case of interleaved JPEG + images, an iMCU is the same as an MCU.
subsamp - the level of chrominance subsampling (one of
SAMP_*)public static int getMCUHeight(int subsamp)-
In a typical lossy JPEG image, 8x8 blocks of DCT coefficients for each + component are interleaved in a single scan. If the image uses chrominance + subsampling, then multiple luminance blocks are stored together, followed + by a single block for each chrominance component. The combination of the + full-resolution luminance block(s) and the (possibly subsampled) + chrominance blocks corresponding to the same pixels is called a "Minimum + Coded Unit" (MCU.) In a non-interleaved lossy JPEG image, each component + is stored in a separate scan, and an MCU is a single DCT block, so we use + the term "iMCU" (interleaved MCU) to refer to the equivalent of an MCU in + an interleaved JPEG image. For the common case of interleaved JPEG + images, an iMCU is the same as an MCU.
subsamp - the level of chrominance subsampling (one of
SAMP_*)getWidth() and
getHeight().) When decompressing into a planar YUV image, an
intermediate buffer copy will be performed if the width or height of the
- scaled destination image is not an even multiple of the MCU block size
- (see TJ.getMCUWidth() and TJ.getMCUHeight().) Note that decompression scaling is not available
+ scaled destination image is not an even multiple of the iMCU size (see
+ TJ.getMCUWidth() and TJ.getMCUHeight().) Note that decompression scaling is not available
(and the specified scaling factor is ignored) when decompressing lossless
JPEG images (see TJ.PARAM_LOSSLESS), since the IDCT algorithm is
not used with those images. Note also that TJ.PARAM_FASTDCT is
@@ -862,10 +862,10 @@ implements java.io.Closeable
croppingRegion - java.awt.Rectangle instance that
specifies a subregion of the JPEG image to decompress, or
TJ.UNCROPPED for no cropping. The left boundary of the cropping
- region must be evenly divisible by the scaled MCU block width, which can
- be determined by calling TJScalingFactor.getScaled() with the specified scaling factor (see
- setScalingFactor()) and the MCU block width
- (see TJ.getMCUWidth()) for the level of chrominance
+ region must be evenly divisible by the scaled iMCU width, which can be
+ determined by calling TJScalingFactor.getScaled() with the specified scaling factor (see
+ setScalingFactor()) and the iMCU width (see
+ TJ.getMCUWidth()) for the level of chrominance
subsampling in the JPEG image (see TJ.PARAM_SUBSAMP.) The
cropping region should be specified relative to the scaled image
dimensions. Unless croppingRegion is TJ.UNCROPPED,
diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJTransform.html b/java/doc/org/libjpegturbo/turbojpeg/TJTransform.html
index a8d5b329..d871218d 100644
--- a/java/doc/org/libjpegturbo/turbojpeg/TJTransform.html
+++ b/java/doc/org/libjpegturbo/turbojpeg/TJTransform.html
@@ -329,7 +329,7 @@ extends java.awt.Rectangle
static intOPT_TRIMpublic static final int OP_HFLIP
OPT_PERFECT,
@@ -512,7 +512,7 @@ extends java.awt.Rectangle
public static final int OP_VFLIP
OPT_PERFECT,
@@ -544,8 +544,8 @@ extends java.awt.Rectangle
public static final int OP_TRANSVERSE
OPT_PERFECT,
@@ -561,7 +561,7 @@ extends java.awt.Rectangle
public static final int OP_ROT90
OPT_PERFECT,
@@ -577,7 +577,7 @@ extends java.awt.Rectangle
public static final int OP_ROT180
OPT_PERFECT,
@@ -593,7 +593,7 @@ extends java.awt.Rectangle
public static final int OP_ROT270
OPT_PERFECT,
@@ -609,15 +609,15 @@ extends java.awt.Rectangle
public static final int OPT_PERFECT
TJTransformer.transform() to throw an exception if the transform is not
- perfect. Lossless transforms operate on MCU blocks, the size of which
- depends on the level of chrominance subsampling used. If the image's
- width or height is not evenly divisible by the MCU block size (see
- TJ.getMCUWidth() and TJ.getMCUHeight()), then there will be partial MCU blocks on the right
- and/or bottom edges. It is not possible to move these partial MCU blocks
- to the top or left of the image, so any transform that would require that
- is "imperfect." If this option is not specified, then any partial MCU
- blocks that cannot be transformed will be left in place, which will create
- odd-looking strips on the right or bottom edge of the image.TJ.getMCUWidth() and TJ.getMCUHeight()), then
+ there will be partial iMCUs on the right and/or bottom edges. It is not
+ possible to move these partial iMCUs to the top or left of the image, so
+ any transform that would require that is "imperfect." If this option is
+ not specified, then any partial iMCUs that cannot be transformed will be
+ left in place, which will create odd-looking strips on the right or bottom
+ edge of the image.
public static final int OPT_TRIM-
x - the left boundary of the cropping region. This must be evenly
- divisible by the MCU block width (see TJ.getMCUWidth())TJ.getMCUWidth())y - the upper boundary of the cropping region. This must be evenly
- divisible by the MCU block height (see TJ.getMCUHeight())TJ.getMCUHeight())w - the width of the cropping region. Setting this to 0 is the
equivalent of setting it to (width of the source JPEG image -
x).In a typical lossy JPEG image, 8x8 blocks of DCT coefficients for each + * component are interleaved in a single scan. If the image uses chrominance + * subsampling, then multiple luminance blocks are stored together, followed + * by a single block for each chrominance component. The combination of the + * full-resolution luminance block(s) and the (possibly subsampled) + * chrominance blocks corresponding to the same pixels is called a "Minimum + * Coded Unit" (MCU.) In a non-interleaved lossy JPEG image, each component + * is stored in a separate scan, and an MCU is a single DCT block, so we use + * the term "iMCU" (interleaved MCU) to refer to the equivalent of an MCU in + * an interleaved JPEG image. For the common case of interleaved JPEG + * images, an iMCU is the same as an MCU. * * @param subsamp the level of chrominance subsampling (one of * {@link #SAMP_444 SAMP_*}) * - * @return the MCU block width for the given level of chrominance - * subsampling. + * @return the iMCU width for the given level of chrominance subsampling. */ public static int getMCUWidth(int subsamp) { checkSubsampling(subsamp); @@ -140,14 +150,24 @@ public final class TJ { /** - * Returns the MCU block height for the given level of chrominance - * subsampling. + * Returns the iMCU height for the given level of chrominance subsampling. + * + *
In a typical lossy JPEG image, 8x8 blocks of DCT coefficients for each + * component are interleaved in a single scan. If the image uses chrominance + * subsampling, then multiple luminance blocks are stored together, followed + * by a single block for each chrominance component. The combination of the + * full-resolution luminance block(s) and the (possibly subsampled) + * chrominance blocks corresponding to the same pixels is called a "Minimum + * Coded Unit" (MCU.) In a non-interleaved lossy JPEG image, each component + * is stored in a separate scan, and an MCU is a single DCT block, so we use + * the term "iMCU" (interleaved MCU) to refer to the equivalent of an MCU in + * an interleaved JPEG image. For the common case of interleaved JPEG + * images, an iMCU is the same as an MCU. * * @param subsamp the level of chrominance subsampling (one of * {@link #SAMP_444 SAMP_*}) * - * @return the MCU block height for the given level of chrominance - * subsampling. + * @return the iMCU height for the given level of chrominance subsampling. */ public static int getMCUHeight(int subsamp) { checkSubsampling(subsamp); @@ -608,8 +628,8 @@ public final class TJ { * and refined with subsequent higher-quality scans containing * higher-frequency DCT coefficients. When using Huffman entropy coding, the * progressive JPEG format also provides an "end-of-bands (EOB) run" feature - * that allows large groups of zeroes, potentially spanning multiple MCU - * blocks, to be represented using only a few bytes. + * that allows large groups of zeroes, potentially spanning multiple MCUs, to + * be represented using only a few bytes. * *
Value *
The nature of entropy coding is such that a corrupt JPEG image cannot * be decompressed beyond the point of corruption unless it contains restart @@ -775,9 +795,18 @@ public final class TJ { * tolerance of the JPEG image, but adding too many restart markers can * adversely affect the compression ratio and performance. * + *
In typical JPEG images, an MCU (Minimum Coded Unit) is the minimum set + * of interleaved "data units" (8x8 DCT blocks if the image is lossy or + * samples if the image is lossless) necessary to represent at least one data + * unit per component. (For example, an MCU in an interleaved lossy JPEG + * image that uses 4:2:2 subsampling consists of two luminance blocks + * followed by one block for each chrominance component.) In + * single-component or non-interleaved JPEG images, an MCU is the same as a + * data unit. + * *
Value *
0 (no restart markers)]
* See {@link #PARAM_RESTARTBLOCKS} for a description of restart markers. + *
See {@link #PARAM_RESTARTBLOCKS} for a description of restart markers + * and MCUs. An MCU row is a row of MCUs spanning the entire width of the + * image. * *
Value *
0 (no restart markers)]
+ * 0 (no restart markers)]
* Setting this parameter to a non-zero value sets
diff --git a/java/org/libjpegturbo/turbojpeg/TJDecompressor.java b/java/org/libjpegturbo/turbojpeg/TJDecompressor.java
index f896d91a..23da0321 100644
--- a/java/org/libjpegturbo/turbojpeg/TJDecompressor.java
+++ b/java/org/libjpegturbo/turbojpeg/TJDecompressor.java
@@ -222,8 +222,8 @@ public class TJDecompressor implements Closeable {
* with the JPEG image width and height (see {@link #getWidth} and
* {@link #getHeight}.) When decompressing into a planar YUV image, an
* intermediate buffer copy will be performed if the width or height of the
- * scaled destination image is not an even multiple of the MCU block size
- * (see {@link TJ#getMCUWidth TJ.getMCUWidth()} and {@link TJ#getMCUHeight
+ * scaled destination image is not an even multiple of the iMCU size (see
+ * {@link TJ#getMCUWidth TJ.getMCUWidth()} and {@link TJ#getMCUHeight
* TJ.getMCUHeight()}.) Note that decompression scaling is not available
* (and the specified scaling factor is ignored) when decompressing lossless
* JPEG images (see {@link TJ#PARAM_LOSSLESS}), since the IDCT algorithm is
@@ -255,11 +255,11 @@ public class TJDecompressor implements Closeable {
* @param croppingRegion java.awt.Rectangle instance that
* specifies a subregion of the JPEG image to decompress, or
* {@link TJ#UNCROPPED} for no cropping. The left boundary of the cropping
- * region must be evenly divisible by the scaled MCU block width, which can
- * be determined by calling {@link TJScalingFactor#getScaled
+ * region must be evenly divisible by the scaled iMCU width, which can be
+ * determined by calling {@link TJScalingFactor#getScaled
* TJScalingFactor.getScaled()} with the specified scaling factor (see
- * {@link #setScalingFactor setScalingFactor()}) and the MCU block width
- * (see {@link TJ#getMCUWidth TJ.getMCUWidth()}) for the level of chrominance
+ * {@link #setScalingFactor setScalingFactor()}) and the iMCU width (see
+ * {@link TJ#getMCUWidth TJ.getMCUWidth()}) for the level of chrominance
* subsampling in the JPEG image (see {@link TJ#PARAM_SUBSAMP}.) The
* cropping region should be specified relative to the scaled image
* dimensions. Unless croppingRegion is {@link TJ#UNCROPPED},
diff --git a/java/org/libjpegturbo/turbojpeg/TJTransform.java b/java/org/libjpegturbo/turbojpeg/TJTransform.java
index 69981900..021263f2 100644
--- a/java/org/libjpegturbo/turbojpeg/TJTransform.java
+++ b/java/org/libjpegturbo/turbojpeg/TJTransform.java
@@ -48,13 +48,13 @@ public class TJTransform extends Rectangle {
public static final int OP_NONE = 0;
/**
* Flip (mirror) image horizontally. This transform is imperfect if there
- * are any partial MCU blocks on the right edge.
+ * are any partial iMCUs on the right edge.
* @see #OPT_PERFECT
*/
public static final int OP_HFLIP = 1;
/**
* Flip (mirror) image vertically. This transform is imperfect if there are
- * any partial MCU blocks on the bottom edge.
+ * any partial iMCUs on the bottom edge.
* @see #OPT_PERFECT
*/
public static final int OP_VFLIP = 2;
@@ -66,26 +66,26 @@ public class TJTransform extends Rectangle {
public static final int OP_TRANSPOSE = 3;
/**
* Transverse transpose image (flip/mirror along upper right to lower left
- * axis). This transform is imperfect if there are any partial MCU blocks in
- * the image.
+ * axis). This transform is imperfect if there are any partial iMCUs in the
+ * image.
* @see #OPT_PERFECT
*/
public static final int OP_TRANSVERSE = 4;
/**
* Rotate image clockwise by 90 degrees. This transform is imperfect if
- * there are any partial MCU blocks on the bottom edge.
+ * there are any partial iMCUs on the bottom edge.
* @see #OPT_PERFECT
*/
public static final int OP_ROT90 = 5;
/**
* Rotate image 180 degrees. This transform is imperfect if there are any
- * partial MCU blocks in the image.
+ * partial iMCUs in the image.
* @see #OPT_PERFECT
*/
public static final int OP_ROT180 = 6;
/**
* Rotate image counter-clockwise by 90 degrees. This transform is imperfect
- * if there are any partial MCU blocks on the right edge.
+ * if there are any partial iMCUs on the right edge.
* @see #OPT_PERFECT
*/
public static final int OP_ROT270 = 7;
@@ -94,20 +94,20 @@ public class TJTransform extends Rectangle {
/**
* This option causes {@link TJTransformer#transform
* TJTransformer.transform()} to throw an exception if the transform is not
- * perfect. Lossless transforms operate on MCU blocks, the size of which
- * depends on the level of chrominance subsampling used. If the image's
- * width or height is not evenly divisible by the MCU block size (see
- * {@link TJ#getMCUWidth TJ.getMCUWidth()} and {@link TJ#getMCUHeight
- * TJ.getMCUHeight()}), then there will be partial MCU blocks on the right
- * and/or bottom edges. It is not possible to move these partial MCU blocks
- * to the top or left of the image, so any transform that would require that
- * is "imperfect." If this option is not specified, then any partial MCU
- * blocks that cannot be transformed will be left in place, which will create
- * odd-looking strips on the right or bottom edge of the image.
+ * perfect. Lossless transforms operate on iMCUs, the size of which depends
+ * on the level of chrominance subsampling used. If the image's width or
+ * height is not evenly divisible by the iMCU size (see {@link TJ#getMCUWidth
+ * TJ.getMCUWidth()} and {@link TJ#getMCUHeight TJ.getMCUHeight()}), then
+ * there will be partial iMCUs on the right and/or bottom edges. It is not
+ * possible to move these partial iMCUs to the top or left of the image, so
+ * any transform that would require that is "imperfect." If this option is
+ * not specified, then any partial iMCUs that cannot be transformed will be
+ * left in place, which will create odd-looking strips on the right or bottom
+ * edge of the image.
*/
public static final int OPT_PERFECT = (1 << 0);
/**
- * Discard any partial MCU blocks that cannot be transformed.
+ * Discard any partial iMCUs that cannot be transformed.
*/
public static final int OPT_TRIM = (1 << 1);
/**
@@ -164,11 +164,10 @@ public class TJTransform extends Rectangle {
* Create a new lossless transform instance with the given parameters.
*
* @param x the left boundary of the cropping region. This must be evenly
- * divisible by the MCU block width (see {@link TJ#getMCUWidth
- * TJ.getMCUWidth()})
+ * divisible by the iMCU width (see {@link TJ#getMCUWidth TJ.getMCUWidth()})
*
* @param y the upper boundary of the cropping region. This must be evenly
- * divisible by the MCU block height (see {@link TJ#getMCUHeight
+ * divisible by the iMCU height (see {@link TJ#getMCUHeight
* TJ.getMCUHeight()})
*
* @param w the width of the cropping region. Setting this to 0 is the
diff --git a/jpegtran.1 b/jpegtran.1
index e52259b7..a4ba3839 100644
--- a/jpegtran.1
+++ b/jpegtran.1
@@ -1,4 +1,4 @@
-.TH JPEGTRAN 1 "17 June 2024"
+.TH JPEGTRAN 1 "30 August 2024"
.SH NAME
jpegtran \- lossless transformation of JPEG files
.SH SYNOPSIS
@@ -68,8 +68,8 @@ Create progressive JPEG file.
Use arithmetic coding.
.TP
.BI \-restart " N"
-Emit a JPEG restart marker every N MCU rows, or every N MCU blocks if "B" is
-attached to the number.
+Emit a JPEG restart marker every N MCU rows, or every N MCUs if "B" is attached
+to the number.
.TP
.BI \-scans " file"
Use the scan script given in the specified text file.
diff --git a/libjpeg.txt b/libjpeg.txt
index 01a486b7..cca5739d 100644
--- a/libjpeg.txt
+++ b/libjpeg.txt
@@ -1150,15 +1150,14 @@ boolean optimize_coding
unsigned int restart_interval
int restart_in_rows
To emit restart markers in the JPEG file, set one of these nonzero.
- Set restart_interval to specify the exact interval in MCU blocks
- (samples in lossless mode). Set restart_in_rows to specify the
- interval in MCU rows. (If restart_in_rows is not 0, then
- restart_interval is set after the image width in MCUs is computed.)
- Defaults are zero (no restarts). One restart marker per MCU row is
- often a good choice. NOTE: the overhead of restart markers is higher
- in grayscale JPEG files than in color files, and MUCH higher in
- progressive JPEGs. If you use restarts, you may want to use larger
- intervals in those cases.
+ Set restart_interval to specify the exact interval in MCUs. Set
+ restart_in_rows to specify the interval in MCU rows. (If
+ restart_in_rows is not 0, then restart_interval is set after the image
+ width in MCUs is computed.) Defaults are zero (no restarts). One
+ restart marker per MCU row is often a good choice. NOTE: the overhead
+ of restart markers is higher in grayscale JPEG files than in color
+ files, and MUCH higher in progressive JPEGs. If you use restarts, you
+ may want to use larger intervals in those cases.
const jpeg_scan_info *scan_info
int num_scans
diff --git a/tjbench.c b/tjbench.c
index 5925f90e..7cc15047 100644
--- a/tjbench.c
+++ b/tjbench.c
@@ -934,10 +934,9 @@ static void usage(char *progName)
printf(" default = 8; if N is 16, then -lossless must also be specified]\n");
printf(" (-precision 12 implies -optimize unless -arithmetic is also specified)\n");
printf("-quiet = Output results in tabular rather than verbose format\n");
- printf("-restart N = When compressing, add a restart marker every N MCU rows (lossy) or\n");
- printf(" N sample rows (lossless) [default = 0 (no restart markers)]. Append 'B'\n");
- printf(" to specify the restart marker interval in MCU blocks (lossy) or samples\n");
- printf(" (lossless).\n");
+ printf("-restart N = When compressing, add a restart marker every N MCU rows\n");
+ printf(" [default = 0 (no restart markers)]. Append 'B' to specify the restart\n");
+ printf(" marker interval in MCUs (lossy only.)\n");
printf("-stoponwarning = Immediately discontinue the current\n");
printf(" compression/decompression/transform operation if a warning (non-fatal\n");
printf(" error) occurs\n");
@@ -955,7 +954,7 @@ static void usage(char *progName)
printf(" and H are the width and height of the region (0 = maximum possible width\n");
printf(" or height) and X and Y are the left and upper boundary of the region, all\n");
printf(" specified relative to the scaled image dimensions. X must be divible by\n");
- printf(" the scaled MCU width.\n");
+ printf(" the scaled iMCU width.\n");
printf("-fastdct = Use the fastest DCT/IDCT algorithm available\n");
printf("-fastupsample = Use the fastest chrominance upsampling algorithm available\n");
printf("-optimize = Compute optimal Huffman tables for JPEG images generated by\n");
diff --git a/tjexample.c b/tjexample.c
index aa3a4b92..ca61f553 100644
--- a/tjexample.c
+++ b/tjexample.c
@@ -145,8 +145,8 @@ static void usage(char *programName)
printf("-crop WxH+X+Y = Perform lossless cropping on the input image prior to\n");
printf(" decompressing it. X and Y specify the upper left corner of the cropping\n");
printf(" region, and W and H specify the width and height of the cropping region.\n");
- printf(" X and Y must be evenly divible by the MCU block size (8x8 if the input\n");
- printf(" image was compressed using no subsampling or grayscale, 16x8 if it was\n");
+ printf(" X and Y must be evenly divible by the iMCU size (8x8 if the input image\n");
+ printf(" was compressed using no subsampling or grayscale, 16x8 if it was\n");
printf(" compressed using 4:2:2 subsampling, or 16x16 if it was compressed using\n");
printf(" 4:2:0 subsampling.)\n\n");
diff --git a/turbojpeg.c b/turbojpeg.c
index 6c484d5b..62c99f27 100644
--- a/turbojpeg.c
+++ b/turbojpeg.c
@@ -1940,7 +1940,7 @@ DLLEXPORT int tj3SetCroppingRegion(tjhandle handle, tjregion croppingRegion)
if (croppingRegion.x %
TJSCALED(tjMCUWidth[this->subsamp], this->scalingFactor) != 0)
THROWI("The left boundary of the cropping region (%d) is not\n"
- "divisible by the scaled MCU width (%d)",
+ "divisible by the scaled iMCU width (%d)",
croppingRegion.x,
TJSCALED(tjMCUWidth[this->subsamp], this->scalingFactor));
if (croppingRegion.w == 0)
diff --git a/turbojpeg.h b/turbojpeg.h
index 4f091be2..6a2271c0 100644
--- a/turbojpeg.h
+++ b/turbojpeg.h
@@ -195,9 +195,21 @@ enum TJSAMP {
};
/**
- * MCU block width (in pixels) for a given level of chrominance subsampling
+ * iMCU width (in pixels) for a given level of chrominance subsampling
*
- * MCU block sizes:
+ * In a typical lossy JPEG image, 8x8 blocks of DCT coefficients for each
+ * component are interleaved in a single scan. If the image uses chrominance
+ * subsampling, then multiple luminance blocks are stored together, followed by
+ * a single block for each chrominance component. The combination of the
+ * full-resolution luminance block(s) and the (possibly subsampled) chrominance
+ * blocks corresponding to the same pixels is called a "Minimum Coded Unit"
+ * (MCU.) In a non-interleaved lossy JPEG image, each component is stored in a
+ * separate scan, and an MCU is a single DCT block, so we use the term "iMCU"
+ * (interleaved MCU) to refer to the equivalent of an MCU in an interleaved
+ * JPEG image. For the common case of interleaved JPEG images, an iMCU is the
+ * same as an MCU.
+ *
+ * iMCU sizes:
* - 8x8 for no subsampling or grayscale
* - 16x8 for 4:2:2
* - 8x16 for 4:4:0
@@ -208,9 +220,21 @@ enum TJSAMP {
static const int tjMCUWidth[TJ_NUMSAMP] = { 8, 16, 16, 8, 8, 32, 8 };
/**
- * MCU block height (in pixels) for a given level of chrominance subsampling
+ * iMCU height (in pixels) for a given level of chrominance subsampling
*
- * MCU block sizes:
+ * In a typical lossy JPEG image, 8x8 blocks of DCT coefficients for each
+ * component are interleaved in a single scan. If the image uses chrominance
+ * subsampling, then multiple luminance blocks are stored together, followed by
+ * a single block for each chrominance component. The combination of the
+ * full-resolution luminance block(s) and the (possibly subsampled) chrominance
+ * blocks corresponding to the same pixels is called a "Minimum Coded Unit"
+ * (MCU.) In a non-interleaved lossy JPEG image, each component is stored in a
+ * separate scan, and an MCU is a single DCT block, so we use the term "iMCU"
+ * (interleaved MCU) to refer to the equivalent of an MCU in an interleaved
+ * JPEG image. For the common case of interleaved JPEG images, an iMCU is the
+ * same as an MCU.
+ *
+ * iMCU sizes:
* - 8x8 for no subsampling or grayscale
* - 16x8 for 4:2:2
* - 8x16 for 4:4:0
@@ -620,8 +644,8 @@ enum TJPARAM {
* and refined with subsequent higher-quality scans containing
* higher-frequency DCT coefficients. When using Huffman entropy coding, the
* progressive JPEG format also provides an "end-of-bands (EOB) run" feature
- * that allows large groups of zeroes, potentially spanning multiple MCU
- * blocks, to be represented using only a few bytes.
+ * that allows large groups of zeroes, potentially spanning multiple MCUs,
+ * to be represented using only a few bytes.
*
* **Value**
* - `0` *[default for compression, lossless transformation]* The lossy JPEG
@@ -752,7 +776,7 @@ enum TJPARAM {
*/
TJPARAM_LOSSLESSPT,
/**
- * JPEG restart marker interval in MCU blocks [lossy compression only]
+ * JPEG restart marker interval in MCUs [lossy compression only]
*
* The nature of entropy coding is such that a corrupt JPEG image cannot
* be decompressed beyond the point of corruption unless it contains restart
@@ -762,22 +786,30 @@ enum TJPARAM {
* tolerance of the JPEG image, but adding too many restart markers can
* adversely affect the compression ratio and performance.
*
+ * In typical JPEG images, an MCU (Minimum Coded Unit) is the minimum set of
+ * interleaved "data units" (8x8 DCT blocks if the image is lossy or samples
+ * if the image is lossless) necessary to represent at least one data unit
+ * per component. (For example, an MCU in an interleaved lossy JPEG image
+ * that uses 4:2:2 subsampling consists of two luminance blocks followed by
+ * one block for each chrominance component.) In single-component or
+ * non-interleaved JPEG images, an MCU is the same as a data unit.
+ *
* **Value**
- * - the number of MCU blocks between each restart marker *[default: `0` (no
+ * - the number of MCUs between each restart marker *[default: `0` (no
* restart markers)]*
*
* Setting this parameter to a non-zero value sets #TJPARAM_RESTARTROWS to 0.
*/
TJPARAM_RESTARTBLOCKS,
/**
- * JPEG restart marker interval in MCU rows (lossy) or sample rows (lossless)
- * [compression only]
+ * JPEG restart marker interval in MCU rows [compression only]
*
- * See #TJPARAM_RESTARTBLOCKS for a description of restart markers.
+ * See #TJPARAM_RESTARTBLOCKS for a description of restart markers and MCUs.
+ * An MCU row is a row of MCUs spanning the entire width of the image.
*
* **Value**
- * - the number of MCU rows or sample rows between each restart marker
- * *[default: `0` (no restart markers)]*
+ * - the number of MCU rows between each restart marker *[default: `0` (no
+ * restart markers)]*
*
* Setting this parameter to a non-zero value sets #TJPARAM_RESTARTBLOCKS to
* 0.
@@ -901,12 +933,12 @@ enum TJXOP {
TJXOP_NONE,
/**
* Flip (mirror) image horizontally. This transform is imperfect if there
- * are any partial MCU blocks on the right edge (see #TJXOPT_PERFECT.)
+ * are any partial iMCUs on the right edge (see #TJXOPT_PERFECT.)
*/
TJXOP_HFLIP,
/**
* Flip (mirror) image vertically. This transform is imperfect if there are
- * any partial MCU blocks on the bottom edge (see #TJXOPT_PERFECT.)
+ * any partial iMCUs on the bottom edge (see #TJXOPT_PERFECT.)
*/
TJXOP_VFLIP,
/**
@@ -916,25 +948,23 @@ enum TJXOP {
TJXOP_TRANSPOSE,
/**
* Transverse transpose image (flip/mirror along upper right to lower left
- * axis.) This transform is imperfect if there are any partial MCU blocks in
- * the image (see #TJXOPT_PERFECT.)
+ * axis.) This transform is imperfect if there are any partial iMCUs in the
+ * image (see #TJXOPT_PERFECT.)
*/
TJXOP_TRANSVERSE,
/**
* Rotate image clockwise by 90 degrees. This transform is imperfect if
- * there are any partial MCU blocks on the bottom edge (see
- * #TJXOPT_PERFECT.)
+ * there are any partial iMCUs on the bottom edge (see #TJXOPT_PERFECT.)
*/
TJXOP_ROT90,
/**
* Rotate image 180 degrees. This transform is imperfect if there are any
- * partial MCU blocks in the image (see #TJXOPT_PERFECT.)
+ * partial iMCUs in the image (see #TJXOPT_PERFECT.)
*/
TJXOP_ROT180,
/**
* Rotate image counter-clockwise by 90 degrees. This transform is imperfect
- * if there are any partial MCU blocks on the right edge (see
- * #TJXOPT_PERFECT.)
+ * if there are any partial iMCUs on the right edge (see #TJXOPT_PERFECT.)
*/
TJXOP_ROT270
};
@@ -942,19 +972,19 @@ enum TJXOP {
/**
* This option causes #tj3Transform() to return an error if the transform is
- * not perfect. Lossless transforms operate on MCU blocks, the size of which
+ * not perfect. Lossless transforms operate on iMCUs, the size of which
* depends on the level of chrominance subsampling used (see #tjMCUWidth and
* #tjMCUHeight.) If the image's width or height is not evenly divisible by
- * the MCU block size, then there will be partial MCU blocks on the right
- * and/or bottom edges. It is not possible to move these partial MCU blocks to
- * the top or left of the image, so any transform that would require that is
- * "imperfect." If this option is not specified, then any partial MCU blocks
- * that cannot be transformed will be left in place, which will create
- * odd-looking strips on the right or bottom edge of the image.
+ * the iMCU size, then there will be partial iMCUs on the right and/or bottom
+ * edges. It is not possible to move these partial iMCUs to the top or left of
+ * the image, so any transform that would require that is "imperfect." If this
+ * option is not specified, then any partial iMCUs that cannot be transformed
+ * will be left in place, which will create odd-looking strips on the right or
+ * bottom edge of the image.
*/
#define TJXOPT_PERFECT (1 << 0)
/**
- * Discard any partial MCU blocks that cannot be transformed.
+ * Discard any partial iMCUs that cannot be transformed.
*/
#define TJXOPT_TRIM (1 << 1)
/**
@@ -1021,12 +1051,12 @@ typedef struct {
typedef struct {
/**
* The left boundary of the cropping region. This must be evenly divisible
- * by the MCU block width (see #tjMCUWidth.)
+ * by the iMCU width (see #tjMCUWidth.)
*/
int x;
/**
* The upper boundary of the cropping region. For lossless transformation,
- * this must be evenly divisible by the MCU block height (see #tjMCUHeight.)
+ * this must be evenly divisible by the iMCU height (see #tjMCUHeight.)
*/
int y;
/**
@@ -1263,7 +1293,7 @@ DLLEXPORT int tj3Compress16(tjhandle handle, const unsigned short *srcBuf,
* buffer. (Refer to @ref YUVnotes "YUV Image Format Notes".)
*
* @param width width (in pixels) of the source image. If the width is not an
- * even multiple of the MCU block width (see #tjMCUWidth), then an intermediate
+ * even multiple of the iMCU width (see #tjMCUWidth), then an intermediate
* buffer copy will be performed.
*
* @param align row alignment (in bytes) of the source image (must be a power
@@ -1272,8 +1302,8 @@ DLLEXPORT int tj3Compress16(tjhandle handle, const unsigned short *srcBuf,
* (1 = unpadded.)
*
* @param height height (in pixels) of the source image. If the height is not
- * an even multiple of the MCU block height (see #tjMCUHeight), then an
- * intermediate buffer copy will be performed.
+ * an even multiple of the iMCU height (see #tjMCUHeight), then an intermediate
+ * buffer copy will be performed.
*
* @param jpegBuf address of a pointer to a byte buffer that will receive the
* JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to
@@ -1323,7 +1353,7 @@ DLLEXPORT int tj3CompressFromYUV8(tjhandle handle,
* @ref YUVnotes "YUV Image Format Notes" for more details.
*
* @param width width (in pixels) of the source image. If the width is not an
- * even multiple of the MCU block width (see #tjMCUWidth), then an intermediate
+ * even multiple of the iMCU width (see #tjMCUWidth), then an intermediate
* buffer copy will be performed.
*
* @param strides an array of integers, each specifying the number of bytes per
@@ -1336,8 +1366,8 @@ DLLEXPORT int tj3CompressFromYUV8(tjhandle handle,
* planar YUV image.
*
* @param height height (in pixels) of the source image. If the height is not
- * an even multiple of the MCU block height (see #tjMCUHeight), then an
- * intermediate buffer copy will be performed.
+ * an even multiple of the iMCU height (see #tjMCUHeight), then an intermediate
+ * buffer copy will be performed.
*
* @param jpegBuf address of a pointer to a byte buffer that will receive the
* JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to
@@ -1640,7 +1670,7 @@ DLLEXPORT tjscalingfactor *tj3GetScalingFactors(int *numScalingFactors);
* #TJPARAM_JPEGHEIGHT) and the specified scaling factor. When decompressing
* into a planar YUV image, an intermediate buffer copy will be performed if
* the width or height of the scaled destination image is not an even multiple
- * of the MCU block size (see #tjMCUWidth and #tjMCUHeight.) Note that
+ * of the iMCU size (see #tjMCUWidth and #tjMCUHeight.) Note that
* decompression scaling is not available (and the specified scaling factor is
* ignored) when decompressing lossless JPEG images (see #TJPARAM_LOSSLESS),
* since the IDCT algorithm is not used with those images. Note also that
@@ -1662,12 +1692,12 @@ DLLEXPORT int tj3SetScalingFactor(tjhandle handle,
* @param croppingRegion #tjregion structure that specifies a subregion of the
* JPEG image to decompress, or #TJUNCROPPED for no cropping. The
* left boundary of the cropping region must be evenly divisible by the scaled
- * MCU block width-- #TJSCALED(#tjMCUWidth[subsamp], scalingFactor),
- * where `subsamp` is the level of chrominance subsampling in the JPEG image
- * (see #TJPARAM_SUBSAMP) and `scalingFactor` is the decompression scaling
- * factor (see #tj3SetScalingFactor().) The cropping region should be
- * specified relative to the scaled image dimensions. Unless `croppingRegion`
- * is #TJUNCROPPED, the JPEG header must be read (see
+ * iMCU width-- #TJSCALED(#tjMCUWidth[subsamp], scalingFactor), where
+ * `subsamp` is the level of chrominance subsampling in the JPEG image (see
+ * #TJPARAM_SUBSAMP) and `scalingFactor` is the decompression scaling factor
+ * (see #tj3SetScalingFactor().) The cropping region should be specified
+ * relative to the scaled image dimensions. Unless `croppingRegion` is
+ * #TJUNCROPPED, the JPEG header must be read (see
* #tj3DecompressHeader()) prior to calling this function.
*
* @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr().)
diff --git a/usage.txt b/usage.txt
index 9d8af6fe..1bcea5f2 100644
--- a/usage.txt
+++ b/usage.txt
@@ -261,10 +261,22 @@ Switches for advanced users:
-icc FILE Embed ICC color management profile contained in the
specified file.
- -restart N Emit a JPEG restart marker every N MCU rows, or every
- N MCU blocks (samples in lossless mode) if "B" is
- attached to the number. -restart 0 (the default) means
- no restart markers.
+ -restart N Emit a JPEG restart marker every N MCU rows, or every N
+ MCUs if "B" is attached to the number.
+
+ In typical JPEG images, an MCU (Minimum Coded Unit) is
+ the minimum set of interleaved "data units" (8x8 DCT
+ blocks if the image is lossy or samples if the image is
+ lossless) necessary to represent at least one data unit
+ per component. (For example, an MCU in an interleaved
+ lossy JPEG image that uses 4:2:2 subsampling consists
+ of two luminance blocks followed by one block for each
+ chrominance component.) In single-component or
+ non-interleaved JPEG images, an MCU is the same as a
+ data unit. An MCU row is a row of MCUs spanning the
+ entire width of the image.
+
+ -restart 0 (the default) means no restart markers.
-smooth N Smooth the input image to eliminate dithering noise.
N, ranging from 1 to 100, indicates the strength of
@@ -604,7 +616,7 @@ jpegtran accepts a subset of the switches recognized by cjpeg:
-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.
+ N MCUs if "B" is attached to the number.
-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