Doc: "MCU block" = "iMCU" or "MCU"

The JPEG-1 spec never uses the term "MCU block".  That term is rarely
used in other literature to describe the equivalent of an MCU in an
interleaved JPEG image, but the libjpeg documentation uses "iMCU" to
describe the same thing.  "iMCU" is a better term, since the equivalent
of an interleaved MCU can contain multiple DCT blocks (or samples in
lossless mode) that are only grouped together if the image is
interleaved.

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

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

This commit also defines "MCU" and "MCU row" in the description of the
various restart marker options/parameters.  Although an MCU row is
technically always a row of samples in lossless mode, "sample row" was
confusing, since it is used in other places to describe a row of samples
for a single component (whereas an MCU row in a typical lossless JPEG
image consists of a row of interleaved samples for all components.)
This commit is contained in:
DRC
2024-08-30 10:50:13 -04:00
parent 5cf7960678
commit 8456d2b98c
23 changed files with 323 additions and 218 deletions

View File

@@ -114,7 +114,7 @@ within the functions.
2. Fixed two minor issues in the interblock smoothing algorithm that caused
mathematical (but not necessarily perceptible) edge block errors when
decompressing progressive JPEG images exactly two MCU blocks in width or that
decompressing progressive JPEG images exactly two DCT blocks in width or that
use vertical chrominance subsampling.
3. Fixed a regression introduced by 3.0 beta2[6] that, in rare cases, caused
@@ -471,9 +471,9 @@ prevented libjpeg-turbo from working properly with other linkers and also
represented a potential security risk.
2. Fixed an issue whereby the `tjTransform()` function incorrectly computed the
MCU block size for 4:4:4 JPEG images with non-unary sampling factors and thus
unduly rejected some cropping regions, even though those regions aligned with
8x8 MCU block boundaries.
iMCU size for 4:4:4 JPEG images with non-unary sampling factors and thus unduly
rejected some cropping regions, even though those regions aligned with 8x8 iMCU
boundaries.
3. Fixed a regression introduced by 2.1 beta1[13] that caused the build system
to enable the Arm Neon SIMD extensions when targetting Armv6 and other legacy

16
cjpeg.1
View File

@@ -1,4 +1,4 @@
.TH CJPEG 1 "24 June 2024"
.TH CJPEG 1 "30 August 2024"
.SH NAME
cjpeg \- compress an image file to a JPEG file
.SH SYNOPSIS
@@ -270,8 +270,18 @@ machines.
Embed ICC color management profile contained in the specified file.
.TP
.BI \-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.
Emit a JPEG restart marker every N MCU rows, or every N MCUs if "B" is attached
to the number.
.IP
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.
.IP
.B \-restart 0
(the default) means no restart markers.
.TP

View File

@@ -120,7 +120,7 @@ Macros</h2></td></tr>
<tr class="memdesc:ga50e03cb5ed115330e212417429600b00"><td class="mdescLeft">&#160;</td><td class="mdescRight">This option causes <a class="el" href="group___turbo_j_p_e_g.html#gaff23ba1dcabed456794b844791613920" title="Losslessly transform a JPEG image into another JPEG image.">tj3Transform()</a> to return an error if the transform is not perfect. <br /></td></tr>
<tr class="separator:ga50e03cb5ed115330e212417429600b00"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga319826b7eb1583c0595bbe7b95428709" id="r_ga319826b7eb1583c0595bbe7b95428709"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga319826b7eb1583c0595bbe7b95428709">TJXOPT_TRIM</a></td></tr>
<tr class="memdesc:ga319826b7eb1583c0595bbe7b95428709"><td class="mdescLeft">&#160;</td><td class="mdescRight">Discard any partial MCU blocks that cannot be transformed. <br /></td></tr>
<tr class="memdesc:ga319826b7eb1583c0595bbe7b95428709"><td class="mdescLeft">&#160;</td><td class="mdescRight">Discard any partial iMCUs that cannot be transformed. <br /></td></tr>
<tr class="separator:ga319826b7eb1583c0595bbe7b95428709"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9c771a757fc1294add611906b89ab2d2" id="r_ga9c771a757fc1294add611906b89ab2d2"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga9c771a757fc1294add611906b89ab2d2">TJXOPT_CROP</a></td></tr>
<tr class="memdesc:ga9c771a757fc1294add611906b89ab2d2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enable lossless cropping. <br /></td></tr>
@@ -386,10 +386,10 @@ Functions</h2></td></tr>
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="var-members" name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:ga9e61e7cd47a15a173283ba94e781308c" id="r_ga9e61e7cd47a15a173283ba94e781308c"><td class="memItemLeft" align="right" valign="top">static const int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c">tjMCUWidth</a> [<a class="el" href="group___turbo_j_p_e_g.html#ga5ef3d169162ce77ce348e292a0b7477c">TJ_NUMSAMP</a>]</td></tr>
<tr class="memdesc:ga9e61e7cd47a15a173283ba94e781308c"><td class="mdescLeft">&#160;</td><td class="mdescRight">MCU block width (in pixels) for a given level of chrominance subsampling. <br /></td></tr>
<tr class="memdesc:ga9e61e7cd47a15a173283ba94e781308c"><td class="mdescLeft">&#160;</td><td class="mdescRight">iMCU width (in pixels) for a given level of chrominance subsampling <br /></td></tr>
<tr class="separator:ga9e61e7cd47a15a173283ba94e781308c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gabd247bb9fecb393eca57366feb8327bf" id="r_gabd247bb9fecb393eca57366feb8327bf"><td class="memItemLeft" align="right" valign="top">static const int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf">tjMCUHeight</a> [<a class="el" href="group___turbo_j_p_e_g.html#ga5ef3d169162ce77ce348e292a0b7477c">TJ_NUMSAMP</a>]</td></tr>
<tr class="memdesc:gabd247bb9fecb393eca57366feb8327bf"><td class="mdescLeft">&#160;</td><td class="mdescRight">MCU block height (in pixels) for a given level of chrominance subsampling. <br /></td></tr>
<tr class="memdesc:gabd247bb9fecb393eca57366feb8327bf"><td class="mdescLeft">&#160;</td><td class="mdescRight">iMCU height (in pixels) for a given level of chrominance subsampling <br /></td></tr>
<tr class="separator:gabd247bb9fecb393eca57366feb8327bf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gadd9b446742ac8a3923f7992c7988fea8" id="r_gadd9b446742ac8a3923f7992c7988fea8"><td class="memItemLeft" align="right" valign="top">static const int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gadd9b446742ac8a3923f7992c7988fea8">tjRedOffset</a> [<a class="el" href="group___turbo_j_p_e_g.html#ga7010a4402f54a45ba822ad8675a4655e">TJ_NUMPF</a>]</td></tr>
<tr class="memdesc:gadd9b446742ac8a3923f7992c7988fea8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Red offset (in samples) for a given pixel format. <br /></td></tr>
@@ -664,7 +664,7 @@ scalingFactor)</code>. </p>
</div><div class="memdoc">
<p>This option causes <a class="el" href="group___turbo_j_p_e_g.html#gaff23ba1dcabed456794b844791613920" title="Losslessly transform a JPEG image into another JPEG image.">tj3Transform()</a> to return an error if the transform is not perfect. </p>
<p>Lossless transforms operate on MCU blocks, the size of which depends on the level of chrominance subsampling used (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a> and <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>.) 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. </p>
<p>Lossless transforms operate on iMCUs, the size of which depends on the level of chrominance subsampling used (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="iMCU width (in pixels) for a given level of chrominance subsampling">tjMCUWidth</a> and <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="iMCU height (in pixels) for a given level of chrominance subsampling">tjMCUHeight</a>.) 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. </p>
</div>
</div>
@@ -697,7 +697,7 @@ scalingFactor)</code>. </p>
</table>
</div><div class="memdoc">
<p>Discard any partial MCU blocks that cannot be transformed. </p>
<p>Discard any partial iMCUs that cannot be transformed. </p>
</div>
</div>
@@ -900,7 +900,7 @@ scalingFactor)</code>. </p>
<p>Huffman table optimization improves compression slightly (generally 5% or less), but it reduces compression performance considerably. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggaa0f6be63ba78278299c9f5c12031fe82a1716f242b3859905b4a317dae8cfb75f" name="ggaa0f6be63ba78278299c9f5c12031fe82a1716f242b3859905b4a317dae8cfb75f"></a>TJPARAM_PROGRESSIVE&#160;</td><td class="fielddoc"><p>Progressive JPEG. </p>
<p>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.</p>
<p>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.</p>
<p><b>Value</b></p><ul>
<li><code>0</code> <em>[default for compression, lossless transformation]</em> The lossy JPEG image is (decompression) or will be (compression, lossless transformation) single-scan.</li>
<li><code>1</code> The lossy JPEG image is (decompression) or will be (compression, lossless transformation) progressive. For lossless transformation, this can also be specified using <a class="el" href="group___turbo_j_p_e_g.html#gad2371c80674584ecc1a7d75e564cf026" title="Generate a progressive destination image instead of a single-scan destination image.">TJXOPT_PROGRESSIVE</a>.</li>
@@ -972,19 +972,20 @@ scalingFactor)</code>. </p>
<p>A point transform value of <code>0</code> 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.)</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a249f35f0770792b19f995e603bb17c6f" title="Lossless JPEG.">TJPARAM_LOSSLESS</a>, <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a781db82741934e8cd008d308597c59d8" title="JPEG data precision (bits per sample) [decompression only, read-only].">TJPARAM_PRECISION</a> </dd></dl>
</td></tr>
<tr><td class="fieldname"><a id="ggaa0f6be63ba78278299c9f5c12031fe82a343c72883b7160f23f3ef46fc548a0ec" name="ggaa0f6be63ba78278299c9f5c12031fe82a343c72883b7160f23f3ef46fc548a0ec"></a>TJPARAM_RESTARTBLOCKS&#160;</td><td class="fielddoc"><p>JPEG restart marker interval in MCU blocks [lossy compression only]. </p>
<tr><td class="fieldname"><a id="ggaa0f6be63ba78278299c9f5c12031fe82a343c72883b7160f23f3ef46fc548a0ec" name="ggaa0f6be63ba78278299c9f5c12031fe82a343c72883b7160f23f3ef46fc548a0ec"></a>TJPARAM_RESTARTBLOCKS&#160;</td><td class="fielddoc"><p>JPEG restart marker interval in MCUs [lossy compression only]. </p>
<p>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.</p>
<p>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.</p>
<p><b>Value</b></p><ul>
<li>the number of MCU blocks between each restart marker <em>[default: <code>0</code> (no restart markers)]</em></li>
<li>the number of MCUs between each restart marker <em>[default: <code>0</code> (no restart markers)]</em></li>
</ul>
<p>Setting this parameter to a non-zero value sets <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a714367585952fe5c863f0dba5bd37e5c" title="JPEG restart marker interval in MCU rows (lossy) or sample rows (lossless) [compression only].">TJPARAM_RESTARTROWS</a> to 0. </p>
<p>Setting this parameter to a non-zero value sets <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a714367585952fe5c863f0dba5bd37e5c" title="JPEG restart marker interval in MCU rows [compression only].">TJPARAM_RESTARTROWS</a> to 0. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggaa0f6be63ba78278299c9f5c12031fe82a714367585952fe5c863f0dba5bd37e5c" name="ggaa0f6be63ba78278299c9f5c12031fe82a714367585952fe5c863f0dba5bd37e5c"></a>TJPARAM_RESTARTROWS&#160;</td><td class="fielddoc"><p>JPEG restart marker interval in MCU rows (lossy) or sample rows (lossless) [compression only]. </p>
<p>See <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a343c72883b7160f23f3ef46fc548a0ec" title="JPEG restart marker interval in MCU blocks [lossy compression only].">TJPARAM_RESTARTBLOCKS</a> for a description of restart markers.</p>
<tr><td class="fieldname"><a id="ggaa0f6be63ba78278299c9f5c12031fe82a714367585952fe5c863f0dba5bd37e5c" name="ggaa0f6be63ba78278299c9f5c12031fe82a714367585952fe5c863f0dba5bd37e5c"></a>TJPARAM_RESTARTROWS&#160;</td><td class="fielddoc"><p>JPEG restart marker interval in MCU rows [compression only]. </p>
<p>See <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a343c72883b7160f23f3ef46fc548a0ec" title="JPEG restart marker interval in MCUs [lossy compression only].">TJPARAM_RESTARTBLOCKS</a> for a description of restart markers and MCUs. An MCU row is a row of MCUs spanning the entire width of the image.</p>
<p><b>Value</b></p><ul>
<li>the number of MCU rows or sample rows between each restart marker <em>[default: <code>0</code> (no restart markers)]</em></li>
<li>the number of MCU rows between each restart marker <em>[default: <code>0</code> (no restart markers)]</em></li>
</ul>
<p>Setting this parameter to a non-zero value sets <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a343c72883b7160f23f3ef46fc548a0ec" title="JPEG restart marker interval in MCU blocks [lossy compression only].">TJPARAM_RESTARTBLOCKS</a> to 0. </p>
<p>Setting this parameter to a non-zero value sets <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a343c72883b7160f23f3ef46fc548a0ec" title="JPEG restart marker interval in MCUs [lossy compression only].">TJPARAM_RESTARTBLOCKS</a> to 0. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggaa0f6be63ba78278299c9f5c12031fe82a4de5c9d7cab5be806143a43c3b0e0877" name="ggaa0f6be63ba78278299c9f5c12031fe82a4de5c9d7cab5be806143a43c3b0e0877"></a>TJPARAM_XDENSITY&#160;</td><td class="fielddoc"><p>JPEG horizontal pixel density. </p>
<p><b>Value</b></p><ul>
@@ -1148,23 +1149,23 @@ scalingFactor)</code>. </p>
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="gga2de531af4e7e6c4f124908376b354866aad88c0366cd3f7d0eac9d7a3fa1c2c27" name="gga2de531af4e7e6c4f124908376b354866aad88c0366cd3f7d0eac9d7a3fa1c2c27"></a>TJXOP_NONE&#160;</td><td class="fielddoc"><p>Do not transform the position of the image pixels. </p>
</td></tr>
<tr><td class="fieldname"><a id="gga2de531af4e7e6c4f124908376b354866aa0df69776caa30f0fa28e26332d311ce" name="gga2de531af4e7e6c4f124908376b354866aa0df69776caa30f0fa28e26332d311ce"></a>TJXOP_HFLIP&#160;</td><td class="fielddoc"><p>Flip (mirror) image horizontally. </p>
<p>This transform is imperfect if there are any partial MCU blocks on the right edge (see <a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00" title="This option causes tj3Transform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
<p>This transform is imperfect if there are any partial iMCUs on the right edge (see <a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00" title="This option causes tj3Transform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
</td></tr>
<tr><td class="fieldname"><a id="gga2de531af4e7e6c4f124908376b354866a324eddfbec53b7e691f61e56929d0d5d" name="gga2de531af4e7e6c4f124908376b354866a324eddfbec53b7e691f61e56929d0d5d"></a>TJXOP_VFLIP&#160;</td><td class="fielddoc"><p>Flip (mirror) image vertically. </p>
<p>This transform is imperfect if there are any partial MCU blocks on the bottom edge (see <a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00" title="This option causes tj3Transform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
<p>This transform is imperfect if there are any partial iMCUs on the bottom edge (see <a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00" title="This option causes tj3Transform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
</td></tr>
<tr><td class="fieldname"><a id="gga2de531af4e7e6c4f124908376b354866a31060aed199f886afdd417f80499c32d" name="gga2de531af4e7e6c4f124908376b354866a31060aed199f886afdd417f80499c32d"></a>TJXOP_TRANSPOSE&#160;</td><td class="fielddoc"><p>Transpose image (flip/mirror along upper left to lower right axis.) This transform is always perfect. </p>
</td></tr>
<tr><td class="fieldname"><a id="gga2de531af4e7e6c4f124908376b354866af3b14d488aea6ece9e5b3df73a74d6a4" name="gga2de531af4e7e6c4f124908376b354866af3b14d488aea6ece9e5b3df73a74d6a4"></a>TJXOP_TRANSVERSE&#160;</td><td class="fielddoc"><p>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 <a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00" title="This option causes tj3Transform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
<tr><td class="fieldname"><a id="gga2de531af4e7e6c4f124908376b354866af3b14d488aea6ece9e5b3df73a74d6a4" name="gga2de531af4e7e6c4f124908376b354866af3b14d488aea6ece9e5b3df73a74d6a4"></a>TJXOP_TRANSVERSE&#160;</td><td class="fielddoc"><p>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 <a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00" title="This option causes tj3Transform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
</td></tr>
<tr><td class="fieldname"><a id="gga2de531af4e7e6c4f124908376b354866a43b2bbb23bc4bd548422d43fbe9af128" name="gga2de531af4e7e6c4f124908376b354866a43b2bbb23bc4bd548422d43fbe9af128"></a>TJXOP_ROT90&#160;</td><td class="fielddoc"><p>Rotate image clockwise by 90 degrees. </p>
<p>This transform is imperfect if there are any partial MCU blocks on the bottom edge (see <a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00" title="This option causes tj3Transform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
<p>This transform is imperfect if there are any partial iMCUs on the bottom edge (see <a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00" title="This option causes tj3Transform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
</td></tr>
<tr><td class="fieldname"><a id="gga2de531af4e7e6c4f124908376b354866a140952eb8dd0300accfcc22726d69692" name="gga2de531af4e7e6c4f124908376b354866a140952eb8dd0300accfcc22726d69692"></a>TJXOP_ROT180&#160;</td><td class="fielddoc"><p>Rotate image 180 degrees. </p>
<p>This transform is imperfect if there are any partial MCU blocks in the image (see <a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00" title="This option causes tj3Transform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
<p>This transform is imperfect if there are any partial iMCUs in the image (see <a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00" title="This option causes tj3Transform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
</td></tr>
<tr><td class="fieldname"><a id="gga2de531af4e7e6c4f124908376b354866a3064ee5dfb7f032df332818587567a08" name="gga2de531af4e7e6c4f124908376b354866a3064ee5dfb7f032df332818587567a08"></a>TJXOP_ROT270&#160;</td><td class="fielddoc"><p>Rotate image counter-clockwise by 90 degrees. </p>
<p>This transform is imperfect if there are any partial MCU blocks on the right edge (see <a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00" title="This option causes tj3Transform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
<p>This transform is imperfect if there are any partial iMCUs on the right edge (see <a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00" title="This option causes tj3Transform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
</td></tr>
</table>
@@ -1516,9 +1517,9 @@ If you choose option 1, then <code>*jpegSize</code> should be set to the size of
<table class="params">
<tr><td class="paramname">handle</td><td>handle to a TurboJPEG instance that has been initialized for compression</td></tr>
<tr><td class="paramname">srcBuf</td><td>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 <a class="el" href="group___turbo_j_p_e_g.html#gaaebaa16973a0f550a66eca5765ed0546" title="The size of the buffer (in bytes) required to hold a unified planar YUV image with the given paramete...">tj3YUVBufSize()</a> for the given image width, height, row alignment, and level of chrominance subsampling (see <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a2a3494a8215d3de4fdbaeb2ba6f6b03a" title="Chrominance subsampling level.">TJPARAM_SUBSAMP</a>.) The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the buffer. (Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.)</td></tr>
<tr><td class="paramname">width</td><td>width (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a>), then an intermediate buffer copy will be performed.</td></tr>
<tr><td class="paramname">width</td><td>width (in pixels) of the source image. If the width is not an even multiple of the iMCU width (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="iMCU width (in pixels) for a given level of chrominance subsampling">tjMCUWidth</a>), then an intermediate buffer copy will be performed.</td></tr>
<tr><td class="paramname">align</td><td>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.)</td></tr>
<tr><td class="paramname">height</td><td>height (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>), then an intermediate buffer copy will be performed.</td></tr>
<tr><td class="paramname">height</td><td>height (in pixels) of the source image. If the height is not an even multiple of the iMCU height (see <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="iMCU height (in pixels) for a given level of chrominance subsampling">tjMCUHeight</a>), then an intermediate buffer copy will be performed.</td></tr>
<tr><td class="paramname">jpegBuf</td><td>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:<ol type="1">
<li>pre-allocate the JPEG buffer with an arbitrary size using <a class="el" href="group___turbo_j_p_e_g.html#ga1a2c96d8b47530b6e6050ba6f10b7c57" title="Allocate a byte buffer for use with TurboJPEG.">tj3Alloc()</a> and let TurboJPEG grow the buffer as needed,</li>
<li>set <code>*jpegBuf</code> to NULL to tell TurboJPEG to allocate the buffer for you, or</li>
@@ -1594,9 +1595,9 @@ If you choose option 1, then <code>*jpegSize</code> should be set to the size of
<table class="params">
<tr><td class="paramname">handle</td><td>handle to a TurboJPEG instance that has been initialized for compression</td></tr>
<tr><td class="paramname">srcPlanes</td><td>an array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if compressing a grayscale image) that contain a YUV source image to be compressed. These planes can be contiguous or non-contiguous in memory. The size of each plane should match the value returned by <a class="el" href="group___turbo_j_p_e_g.html#gacc19d265edce76b46146f59579f9438d" title="The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters.">tj3YUVPlaneSize()</a> for the given image width, height, strides, and level of chrominance subsampling (see <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a2a3494a8215d3de4fdbaeb2ba6f6b03a" title="Chrominance subsampling level.">TJPARAM_SUBSAMP</a>.) Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for more details.</td></tr>
<tr><td class="paramname">width</td><td>width (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a>), then an intermediate buffer copy will be performed.</td></tr>
<tr><td class="paramname">width</td><td>width (in pixels) of the source image. If the width is not an even multiple of the iMCU width (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="iMCU width (in pixels) for a given level of chrominance subsampling">tjMCUWidth</a>), then an intermediate buffer copy will be performed.</td></tr>
<tr><td class="paramname">strides</td><td>an array of integers, each specifying the number of bytes per row in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the plane width (see <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.) If <code>strides</code> is NULL, then the strides for all planes will be set to their respective plane widths. You can adjust the strides in order to specify an arbitrary amount of row padding in each plane or to create a JPEG image from a subregion of a larger planar YUV image.</td></tr>
<tr><td class="paramname">height</td><td>height (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>), then an intermediate buffer copy will be performed.</td></tr>
<tr><td class="paramname">height</td><td>height (in pixels) of the source image. If the height is not an even multiple of the iMCU height (see <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="iMCU height (in pixels) for a given level of chrominance subsampling">tjMCUHeight</a>), then an intermediate buffer copy will be performed.</td></tr>
<tr><td class="paramname">jpegBuf</td><td>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:<ol type="1">
<li>pre-allocate the JPEG buffer with an arbitrary size using <a class="el" href="group___turbo_j_p_e_g.html#ga1a2c96d8b47530b6e6050ba6f10b7c57" title="Allocate a byte buffer for use with TurboJPEG.">tj3Alloc()</a> and let TurboJPEG grow the buffer as needed,</li>
<li>set <code>*jpegBuf</code> to NULL to tell TurboJPEG to allocate the buffer for you, or</li>
@@ -3059,7 +3060,7 @@ If you choose option 1, then <code>*jpegSize</code> should be set to the size of
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>handle to a TurboJPEG instance that has been initialized for decompression</td></tr>
<tr><td class="paramname">croppingRegion</td><td><a class="el" href="structtjregion.html" title="Cropping region.">tjregion</a> structure that specifies a subregion of the JPEG image to decompress, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga6f192ad58a5a5802e145149d83c643bf" title="A tjregion structure that specifies no cropping.">TJUNCROPPED</a></code> for no cropping. The left boundary of the cropping region must be evenly divisible by the scaled MCU block width&ndash; <code><a class="el" href="group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df" title="Compute the scaled value of dimension using the given scaling factor.">TJSCALED</a>(<a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a>[subsamp], scalingFactor)</code>, where <code>subsamp</code> is the level of chrominance subsampling in the JPEG image (see <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a2a3494a8215d3de4fdbaeb2ba6f6b03a" title="Chrominance subsampling level.">TJPARAM_SUBSAMP</a>) and <code>scalingFactor</code> is the decompression scaling factor (see <a class="el" href="group___turbo_j_p_e_g.html#ga89da17ee1e43ff423382cbc145803c75" title="Set the scaling factor for subsequent lossy decompression operations.">tj3SetScalingFactor()</a>.) The cropping region should be specified relative to the scaled image dimensions. Unless <code>croppingRegion</code> is <code><a class="el" href="group___turbo_j_p_e_g.html#ga6f192ad58a5a5802e145149d83c643bf" title="A tjregion structure that specifies no cropping.">TJUNCROPPED</a></code>, the JPEG header must be read (see <a class="el" href="group___turbo_j_p_e_g.html#ga96d2c4b3432f9d88ad14758ae240b8d1" title="Retrieve information about a JPEG image without decompressing it, or prime the decompressor with quan...">tj3DecompressHeader()</a>) prior to calling this function.</td></tr>
<tr><td class="paramname">croppingRegion</td><td><a class="el" href="structtjregion.html" title="Cropping region.">tjregion</a> structure that specifies a subregion of the JPEG image to decompress, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga6f192ad58a5a5802e145149d83c643bf" title="A tjregion structure that specifies no cropping.">TJUNCROPPED</a></code> for no cropping. The left boundary of the cropping region must be evenly divisible by the scaled iMCU width&ndash; <code><a class="el" href="group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df" title="Compute the scaled value of dimension using the given scaling factor.">TJSCALED</a>(<a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="iMCU width (in pixels) for a given level of chrominance subsampling">tjMCUWidth</a>[subsamp], scalingFactor)</code>, where <code>subsamp</code> is the level of chrominance subsampling in the JPEG image (see <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a2a3494a8215d3de4fdbaeb2ba6f6b03a" title="Chrominance subsampling level.">TJPARAM_SUBSAMP</a>) and <code>scalingFactor</code> is the decompression scaling factor (see <a class="el" href="group___turbo_j_p_e_g.html#ga89da17ee1e43ff423382cbc145803c75" title="Set the scaling factor for subsequent lossy decompression operations.">tj3SetScalingFactor()</a>.) The cropping region should be specified relative to the scaled image dimensions. Unless <code>croppingRegion</code> is <code><a class="el" href="group___turbo_j_p_e_g.html#ga6f192ad58a5a5802e145149d83c643bf" title="A tjregion structure that specifies no cropping.">TJUNCROPPED</a></code>, the JPEG header must be read (see <a class="el" href="group___turbo_j_p_e_g.html#ga96d2c4b3432f9d88ad14758ae240b8d1" title="Retrieve information about a JPEG image without decompressing it, or prime the decompressor with quan...">tj3DecompressHeader()</a>) prior to calling this function.</td></tr>
</table>
</dd>
</dl>
@@ -3097,7 +3098,7 @@ If you choose option 1, then <code>*jpegSize</code> should be set to the size of
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>handle to a TurboJPEG instance that has been initialized for decompression</td></tr>
<tr><td class="paramname">scalingFactor</td><td><a class="el" href="structtjscalingfactor.html" title="Scaling factor.">tjscalingfactor</a> structure that specifies a fractional scaling factor that the decompressor supports (see <a class="el" href="group___turbo_j_p_e_g.html#gaf9253e0c2e9f464142d389673da085fa" title="Returns a list of fractional scaling factors that the JPEG decompressor supports.">tj3GetScalingFactors()</a>), or <code><a class="el" href="group___turbo_j_p_e_g.html#ga7880644a0849161ad20933536169ee19" title="A tjscalingfactor structure that specifies a scaling factor of 1/1 (no scaling)">TJUNSCALED</a></code> for no scaling. Decompression scaling is a function of the IDCT algorithm, so scaling factors are generally limited to multiples of 1/8. If the entire JPEG image will be decompressed, then the width and height of the scaled destination image can be determined by calling <a class="el" href="group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df" title="Compute the scaled value of dimension using the given scaling factor.">TJSCALED()</a> with the JPEG width and height (see <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a02ab77fb294a0c9061a78cd424c82dd8" title="JPEG width (in pixels) [decompression only, read-only].">TJPARAM_JPEGWIDTH</a> and <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a8f76673be73f2b659440a9572a65a95f" title="JPEG height (in pixels) [decompression only, read-only].">TJPARAM_JPEGHEIGHT</a>) 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 <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a> and <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>.) Note that decompression scaling is not available (and the specified scaling factor is ignored) when decompressing lossless JPEG images (see <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a249f35f0770792b19f995e603bb17c6f" title="Lossless JPEG.">TJPARAM_LOSSLESS</a>), since the IDCT algorithm is not used with those images. Note also that <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a6914692ac6ec5567787d592b7563f627" title="DCT/IDCT algorithm [lossy compression and decompression].">TJPARAM_FASTDCT</a> is ignored when decompression scaling is enabled.</td></tr>
<tr><td class="paramname">scalingFactor</td><td><a class="el" href="structtjscalingfactor.html" title="Scaling factor.">tjscalingfactor</a> structure that specifies a fractional scaling factor that the decompressor supports (see <a class="el" href="group___turbo_j_p_e_g.html#gaf9253e0c2e9f464142d389673da085fa" title="Returns a list of fractional scaling factors that the JPEG decompressor supports.">tj3GetScalingFactors()</a>), or <code><a class="el" href="group___turbo_j_p_e_g.html#ga7880644a0849161ad20933536169ee19" title="A tjscalingfactor structure that specifies a scaling factor of 1/1 (no scaling)">TJUNSCALED</a></code> for no scaling. Decompression scaling is a function of the IDCT algorithm, so scaling factors are generally limited to multiples of 1/8. If the entire JPEG image will be decompressed, then the width and height of the scaled destination image can be determined by calling <a class="el" href="group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df" title="Compute the scaled value of dimension using the given scaling factor.">TJSCALED()</a> with the JPEG width and height (see <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a02ab77fb294a0c9061a78cd424c82dd8" title="JPEG width (in pixels) [decompression only, read-only].">TJPARAM_JPEGWIDTH</a> and <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a8f76673be73f2b659440a9572a65a95f" title="JPEG height (in pixels) [decompression only, read-only].">TJPARAM_JPEGHEIGHT</a>) 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 iMCU size (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="iMCU width (in pixels) for a given level of chrominance subsampling">tjMCUWidth</a> and <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="iMCU height (in pixels) for a given level of chrominance subsampling">tjMCUHeight</a>.) Note that decompression scaling is not available (and the specified scaling factor is ignored) when decompressing lossless JPEG images (see <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a249f35f0770792b19f995e603bb17c6f" title="Lossless JPEG.">TJPARAM_LOSSLESS</a>), since the IDCT algorithm is not used with those images. Note also that <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a6914692ac6ec5567787d592b7563f627" title="DCT/IDCT algorithm [lossy compression and decompression].">TJPARAM_FASTDCT</a> is ignored when decompression scaling is enabled.</td></tr>
</table>
</dd>
</dl>
@@ -3483,8 +3484,9 @@ If you choose option 1, then <code>dstSizes[i]</code> should be set to the size
</table>
</div><div class="memdoc">
<p>MCU block height (in pixels) for a given level of chrominance subsampling. </p>
<p>MCU block sizes:</p><ul>
<p>iMCU height (in pixels) for a given level of chrominance subsampling </p>
<p>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.</p>
<p>iMCU sizes:</p><ul>
<li>8x8 for no subsampling or grayscale</li>
<li>16x8 for 4:2:2</li>
<li>8x16 for 4:4:0</li>
@@ -3515,8 +3517,9 @@ If you choose option 1, then <code>dstSizes[i]</code> should be set to the size
</table>
</div><div class="memdoc">
<p>MCU block width (in pixels) for a given level of chrominance subsampling. </p>
<p>MCU block sizes:</p><ul>
<p>iMCU width (in pixels) for a given level of chrominance subsampling </p>
<p>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.</p>
<p>iMCU sizes:</p><ul>
<li>8x8 for no subsampling or grayscale</li>
<li>16x8 for 4:2:2</li>
<li>8x16 for 4:4:0</li>

View File

@@ -146,7 +146,7 @@ Data Fields</h2></td></tr>
</div><div class="memdoc">
<p>The left boundary of the cropping region. </p>
<p>This must be evenly divisible by the MCU block width (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a>.) </p>
<p>This must be evenly divisible by the iMCU width (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="iMCU width (in pixels) for a given level of chrominance subsampling">tjMCUWidth</a>.) </p>
</div>
</div>
@@ -163,7 +163,7 @@ Data Fields</h2></td></tr>
</div><div class="memdoc">
<p>The upper boundary of the cropping region. </p>
<p>For lossless transformation, this must be evenly divisible by the MCU block height (see <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>.) </p>
<p>For lossless transformation, this must be evenly divisible by the iMCU height (see <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="iMCU height (in pixels) for a given level of chrominance subsampling">tjMCUHeight</a>.) </p>
</div>
</div>

View File

@@ -797,10 +797,9 @@ final class TJBench {
System.out.println(" default = 8; if N is 16, then -lossless must also be specified]");
System.out.println(" (-precision 12 implies -optimize unless -arithmetic is also specified)");
System.out.println("-quiet = Output results in tabular rather than verbose format");
System.out.println("-restart N = When compressing, add a restart marker every N MCU rows (lossy) or");
System.out.println(" N sample rows (lossless) [default = 0 (no restart markers)]. Append 'B'");
System.out.println(" to specify the restart marker interval in MCU blocks (lossy) or samples");
System.out.println(" (lossless).");
System.out.println("-restart N = When compressing, add a restart marker every N MCU rows");
System.out.println(" [default = 0 (no restart markers)]. Append 'B' to specify the restart");
System.out.println(" marker interval in MCUs (lossy only.)");
System.out.println("-stoponwarning = Immediately discontinue the current");
System.out.println(" compression/decompression/transform operation if a warning (non-fatal");
System.out.println(" error) occurs");
@@ -818,7 +817,7 @@ final class TJBench {
System.out.println(" and H are the width and height of the region (0 = maximum possible width");
System.out.println(" or height) and X and Y are the left and upper boundary of the region, all");
System.out.println(" specified relative to the scaled image dimensions. X must be divible by");
System.out.println(" the scaled MCU width.");
System.out.println(" the scaled iMCU width.");
System.out.println("-fastdct = Use the fastest DCT/IDCT algorithm available");
System.out.println("-fastupsample = Use the fastest chrominance upsampling algorithm available");
System.out.println("-optimize = Compute optimal Huffman tables for JPEG images generated by");

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C)2011-2012, 2014-2015, 2017-2018, 2022-2023 D. R. Commander.
* Copyright (C)2011-2012, 2014-2015, 2017-2018, 2022-2024 D. R. Commander.
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -125,8 +125,8 @@ class TJExample implements TJCustomFilter {
System.out.println("-crop WxH+X+Y = Perform lossless cropping on the input image prior to");
System.out.println(" decompressing it. X and Y specify the upper left corner of the cropping");
System.out.println(" region, and W and H specify the width and height of the cropping region.");
System.out.println(" X and Y must be evenly divible by the MCU block size (8x8 if the input");
System.out.println(" image was compressed using no subsampling or grayscale, 16x8 if it was");
System.out.println(" X and Y must be evenly divible by the iMCU size (8x8 if the input image");
System.out.println(" was compressed using no subsampling or grayscale, 16x8 if it was");
System.out.println(" compressed using 4:2:2 subsampling, or 16x16 if it was compressed using");
System.out.println(" 4:2:0 subsampling.)\n");

View File

@@ -496,13 +496,11 @@ $('.navPadding').css('padding-top', $('.fixedNav').css("height"));
</dd>
<dt><span class="memberNameLink"><a href="org/libjpegturbo/turbojpeg/TJ.html#getMCUHeight(int)">getMCUHeight(int)</a></span> - Static method in class org.libjpegturbo.turbojpeg.<a href="org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
<dd>
<div class="block">Returns the MCU block height for the given level of chrominance
subsampling.</div>
<div class="block">Returns the iMCU height for the given level of chrominance subsampling.</div>
</dd>
<dt><span class="memberNameLink"><a href="org/libjpegturbo/turbojpeg/TJ.html#getMCUWidth(int)">getMCUWidth(int)</a></span> - Static method in class org.libjpegturbo.turbojpeg.<a href="org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
<dd>
<div class="block">Returns the MCU block width for the given level of chrominance
subsampling.</div>
<div class="block">Returns the iMCU width for the given level of chrominance subsampling.</div>
</dd>
<dt><span class="memberNameLink"><a href="org/libjpegturbo/turbojpeg/TJScalingFactor.html#getNum()">getNum()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</a></dt>
<dd>
@@ -706,7 +704,7 @@ $('.navPadding').css('padding-top', $('.fixedNav').css("height"));
</dd>
<dt><span class="memberNameLink"><a href="org/libjpegturbo/turbojpeg/TJTransform.html#OPT_TRIM">OPT_TRIM</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
<dd>
<div class="block">Discard any partial MCU blocks that cannot be transformed.</div>
<div class="block">Discard any partial iMCUs that cannot be transformed.</div>
</dd>
<dt><span class="memberNameLink"><a href="org/libjpegturbo/turbojpeg/TJTransform.html#options">options</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
<dd>
@@ -791,12 +789,11 @@ $('.navPadding').css('padding-top', $('.fixedNav').css("height"));
</dd>
<dt><span class="memberNameLink"><a href="org/libjpegturbo/turbojpeg/TJ.html#PARAM_RESTARTBLOCKS">PARAM_RESTARTBLOCKS</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
<dd>
<div class="block">JPEG restart marker interval in MCU blocks [lossy compression only]</div>
<div class="block">JPEG restart marker interval in MCUs [lossy compression only]</div>
</dd>
<dt><span class="memberNameLink"><a href="org/libjpegturbo/turbojpeg/TJ.html#PARAM_RESTARTROWS">PARAM_RESTARTROWS</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
<dd>
<div class="block">JPEG restart marker interval in MCU rows (lossy) or sample rows (lossless)
[compression only]</div>
<div class="block">JPEG restart marker interval in MCU rows [compression only]</div>
</dd>
<dt><span class="memberNameLink"><a href="org/libjpegturbo/turbojpeg/TJ.html#PARAM_SCANLIMIT">PARAM_SCANLIMIT</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
<dd>

Binary file not shown.

View File

@@ -417,15 +417,14 @@ extends java.lang.Object</pre>
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PARAM_RESTARTBLOCKS">PARAM_RESTARTBLOCKS</a></span></code></th>
<td class="colLast">
<div class="block">JPEG restart marker interval in MCU blocks [lossy compression only]</div>
<div class="block">JPEG restart marker interval in MCUs [lossy compression only]</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PARAM_RESTARTROWS">PARAM_RESTARTROWS</a></span></code></th>
<td class="colLast">
<div class="block">JPEG restart marker interval in MCU rows (lossy) or sample rows (lossless)
[compression only]</div>
<div class="block">JPEG restart marker interval in MCU rows [compression only]</div>
</td>
</tr>
<tr class="rowColor">
@@ -687,16 +686,14 @@ extends java.lang.Object</pre>
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMCUHeight(int)">getMCUHeight</a></span>&#8203;(int&nbsp;subsamp)</code></th>
<td class="colLast">
<div class="block">Returns the MCU block height for the given level of chrominance
subsampling.</div>
<div class="block">Returns the iMCU height for the given level of chrominance subsampling.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMCUWidth(int)">getMCUWidth</a></span>&#8203;(int&nbsp;subsamp)</code></th>
<td class="colLast">
<div class="block">Returns the MCU block width for the given level of chrominance
subsampling.</div>
<div class="block">Returns the iMCU width for the given level of chrominance subsampling.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
@@ -1590,8 +1587,8 @@ extends java.lang.Object</pre>
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.
<p><b>Value</b>
<ul>
@@ -1803,7 +1800,7 @@ extends java.lang.Object</pre>
<li class="blockList">
<h4>PARAM_RESTARTBLOCKS</h4>
<pre>public static final&nbsp;int PARAM_RESTARTBLOCKS</pre>
<div class="block">JPEG restart marker interval in MCU blocks [lossy compression only]
<div class="block">JPEG restart marker interval in MCUs [lossy compression only]
<p>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</pre>
tolerance of the JPEG image, but adding too many restart markers can
adversely affect the compression ratio and performance.
<p>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.
<p><b>Value</b>
<ul>
<li> the number of MCU blocks between each restart marker <i>[default:
<li> the number of MCUs between each restart marker <i>[default:
<code>0</code> (no restart markers)]</i>
</ul>
@@ -1834,15 +1840,16 @@ extends java.lang.Object</pre>
<li class="blockList">
<h4>PARAM_RESTARTROWS</h4>
<pre>public static final&nbsp;int PARAM_RESTARTROWS</pre>
<div class="block">JPEG restart marker interval in MCU rows (lossy) or sample rows (lossless)
[compression only]
<div class="block">JPEG restart marker interval in MCU rows [compression only]
<p>See <a href="#PARAM_RESTARTBLOCKS"><code>PARAM_RESTARTBLOCKS</code></a> for a description of restart markers.
<p>See <a href="#PARAM_RESTARTBLOCKS"><code>PARAM_RESTARTBLOCKS</code></a> for a description of restart markers
and MCUs. An MCU row is a row of MCUs spanning the entire width of the
image.
<p><b>Value</b>
<ul>
<li> the number of MCU rows or sample rows between each restart marker
<i>[default: <code>0</code> (no restart markers)]</i>
<li> the number of MCU rows between each restart marker <i>[default:
<code>0</code> (no restart markers)]</i>
</ul>
<p>Setting this parameter to a non-zero value sets
@@ -2186,15 +2193,25 @@ public static final&nbsp;int FLAG_LIMITSCANS</pre>
<li class="blockList">
<h4>getMCUWidth</h4>
<pre class="methodSignature">public static&nbsp;int&nbsp;getMCUWidth&#8203;(int&nbsp;subsamp)</pre>
<div class="block">Returns the MCU block width for the given level of chrominance
subsampling.</div>
<div class="block">Returns the iMCU width for the given level of chrominance subsampling.
<p>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.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>subsamp</code> - the level of chrominance subsampling (one of
<a href="#SAMP_444"><code>SAMP_*</code></a>)</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the MCU block width for the given level of chrominance
subsampling.</dd>
<dd>the iMCU width for the given level of chrominance subsampling.</dd>
</dl>
</li>
</ul>
@@ -2205,15 +2222,25 @@ public static final&nbsp;int FLAG_LIMITSCANS</pre>
<li class="blockList">
<h4>getMCUHeight</h4>
<pre class="methodSignature">public static&nbsp;int&nbsp;getMCUHeight&#8203;(int&nbsp;subsamp)</pre>
<div class="block">Returns the MCU block height for the given level of chrominance
subsampling.</div>
<div class="block">Returns the iMCU height for the given level of chrominance subsampling.
<p>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.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>subsamp</code> - the level of chrominance subsampling (one of
<a href="#SAMP_444"><code>SAMP_*</code></a>)</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the MCU block height for the given level of chrominance
subsampling.</dd>
<dd>the iMCU height for the given level of chrominance subsampling.</dd>
</dl>
</li>
</ul>

View File

@@ -838,8 +838,8 @@ implements java.io.Closeable</pre>
with the JPEG image width and height (see <a href="#getWidth()"><code>getWidth()</code></a> and
<a href="#getHeight()"><code>getHeight()</code></a>.) 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 <a href="TJ.html#getMCUWidth(int)"><code>TJ.getMCUWidth()</code></a> and <a href="TJ.html#getMCUHeight(int)"><code>TJ.getMCUHeight()</code></a>.) Note that decompression scaling is not available
scaled destination image is not an even multiple of the iMCU size (see
<a href="TJ.html#getMCUWidth(int)"><code>TJ.getMCUWidth()</code></a> and <a href="TJ.html#getMCUHeight(int)"><code>TJ.getMCUHeight()</code></a>.) Note that decompression scaling is not available
(and the specified scaling factor is ignored) when decompressing lossless
JPEG images (see <a href="TJ.html#PARAM_LOSSLESS"><code>TJ.PARAM_LOSSLESS</code></a>), since the IDCT algorithm is
not used with those images. Note also that <a href="TJ.html#PARAM_FASTDCT"><code>TJ.PARAM_FASTDCT</code></a> is
@@ -862,10 +862,10 @@ implements java.io.Closeable</pre>
<dd><code>croppingRegion</code> - <code>java.awt.Rectangle</code> instance that
specifies a subregion of the JPEG image to decompress, or
<a href="TJ.html#UNCROPPED"><code>TJ.UNCROPPED</code></a> 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 <a href="TJScalingFactor.html#getScaled(int)"><code>TJScalingFactor.getScaled()</code></a> with the specified scaling factor (see
<a href="#setScalingFactor(org.libjpegturbo.turbojpeg.TJScalingFactor)"><code>setScalingFactor()</code></a>) and the MCU block width
(see <a href="TJ.html#getMCUWidth(int)"><code>TJ.getMCUWidth()</code></a>) for the level of chrominance
region must be evenly divisible by the scaled iMCU width, which can be
determined by calling <a href="TJScalingFactor.html#getScaled(int)"><code>TJScalingFactor.getScaled()</code></a> with the specified scaling factor (see
<a href="#setScalingFactor(org.libjpegturbo.turbojpeg.TJScalingFactor)"><code>setScalingFactor()</code></a>) and the iMCU width (see
<a href="TJ.html#getMCUWidth(int)"><code>TJ.getMCUWidth()</code></a>) for the level of chrominance
subsampling in the JPEG image (see <a href="TJ.html#PARAM_SUBSAMP"><code>TJ.PARAM_SUBSAMP</code></a>.) The
cropping region should be specified relative to the scaled image
dimensions. Unless <code>croppingRegion</code> is <a href="TJ.html#UNCROPPED"><code>TJ.UNCROPPED</code></a>,

View File

@@ -329,7 +329,7 @@ extends java.awt.Rectangle</pre>
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#OPT_TRIM">OPT_TRIM</a></span></code></th>
<td class="colLast">
<div class="block">Discard any partial MCU blocks that cannot be transformed.</div>
<div class="block">Discard any partial iMCUs that cannot be transformed.</div>
</td>
</tr>
<tr class="altColor">
@@ -496,7 +496,7 @@ extends java.awt.Rectangle</pre>
<h4>OP_HFLIP</h4>
<pre>public static final&nbsp;int OP_HFLIP</pre>
<div class="block">Flip (mirror) image horizontally. This transform is imperfect if there
are any partial MCU blocks on the right edge.</div>
are any partial iMCUs on the right edge.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="#OPT_PERFECT"><code>OPT_PERFECT</code></a>,
@@ -512,7 +512,7 @@ extends java.awt.Rectangle</pre>
<h4>OP_VFLIP</h4>
<pre>public static final&nbsp;int OP_VFLIP</pre>
<div class="block">Flip (mirror) image vertically. This transform is imperfect if there are
any partial MCU blocks on the bottom edge.</div>
any partial iMCUs on the bottom edge.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="#OPT_PERFECT"><code>OPT_PERFECT</code></a>,
@@ -544,8 +544,8 @@ extends java.awt.Rectangle</pre>
<h4>OP_TRANSVERSE</h4>
<pre>public static final&nbsp;int OP_TRANSVERSE</pre>
<div class="block">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.</div>
axis). This transform is imperfect if there are any partial iMCUs in the
image.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="#OPT_PERFECT"><code>OPT_PERFECT</code></a>,
@@ -561,7 +561,7 @@ extends java.awt.Rectangle</pre>
<h4>OP_ROT90</h4>
<pre>public static final&nbsp;int OP_ROT90</pre>
<div class="block">Rotate image clockwise by 90 degrees. This transform is imperfect if
there are any partial MCU blocks on the bottom edge.</div>
there are any partial iMCUs on the bottom edge.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="#OPT_PERFECT"><code>OPT_PERFECT</code></a>,
@@ -577,7 +577,7 @@ extends java.awt.Rectangle</pre>
<h4>OP_ROT180</h4>
<pre>public static final&nbsp;int OP_ROT180</pre>
<div class="block">Rotate image 180 degrees. This transform is imperfect if there are any
partial MCU blocks in the image.</div>
partial iMCUs in the image.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="#OPT_PERFECT"><code>OPT_PERFECT</code></a>,
@@ -593,7 +593,7 @@ extends java.awt.Rectangle</pre>
<h4>OP_ROT270</h4>
<pre>public static final&nbsp;int OP_ROT270</pre>
<div class="block">Rotate image counter-clockwise by 90 degrees. This transform is imperfect
if there are any partial MCU blocks on the right edge.</div>
if there are any partial iMCUs on the right edge.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="#OPT_PERFECT"><code>OPT_PERFECT</code></a>,
@@ -609,15 +609,15 @@ extends java.awt.Rectangle</pre>
<h4>OPT_PERFECT</h4>
<pre>public static final&nbsp;int OPT_PERFECT</pre>
<div class="block">This option causes <a href="TJTransformer.html#transform(byte%5B%5D%5B%5D,org.libjpegturbo.turbojpeg.TJTransform%5B%5D)"><code>TJTransformer.transform()</code></a> 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
<a href="TJ.html#getMCUWidth(int)"><code>TJ.getMCUWidth()</code></a> and <a href="TJ.html#getMCUHeight(int)"><code>TJ.getMCUHeight()</code></a>), 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.</div>
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 <a href="TJ.html#getMCUWidth(int)"><code>TJ.getMCUWidth()</code></a> and <a href="TJ.html#getMCUHeight(int)"><code>TJ.getMCUHeight()</code></a>), 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.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJTransform.OPT_PERFECT">Constant Field Values</a></dd>
@@ -631,7 +631,7 @@ extends java.awt.Rectangle</pre>
<li class="blockList">
<h4>OPT_TRIM</h4>
<pre>public static final&nbsp;int OPT_TRIM</pre>
<div class="block">Discard any partial MCU blocks that cannot be transformed.</div>
<div class="block">Discard any partial iMCUs that cannot be transformed.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJTransform.OPT_TRIM">Constant Field Values</a></dd>
@@ -818,9 +818,9 @@ extends java.awt.Rectangle</pre>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>x</code> - the left boundary of the cropping region. This must be evenly
divisible by the MCU block width (see <a href="TJ.html#getMCUWidth(int)"><code>TJ.getMCUWidth()</code></a>)</dd>
divisible by the iMCU width (see <a href="TJ.html#getMCUWidth(int)"><code>TJ.getMCUWidth()</code></a>)</dd>
<dd><code>y</code> - the upper boundary of the cropping region. This must be evenly
divisible by the MCU block height (see <a href="TJ.html#getMCUHeight(int)"><code>TJ.getMCUHeight()</code></a>)</dd>
divisible by the iMCU height (see <a href="TJ.html#getMCUHeight(int)"><code>TJ.getMCUHeight()</code></a>)</dd>
<dd><code>w</code> - the width of the cropping region. Setting this to 0 is the
equivalent of setting it to (width of the source JPEG image -
<code>x</code>).</dd>

Binary file not shown.

Binary file not shown.

View File

@@ -120,14 +120,24 @@ public final class TJ {
public static final int SAMP_UNKNOWN = -1;
/**
* Returns the MCU block width for the given level of chrominance
* subsampling.
* Returns the iMCU width for the given level of chrominance subsampling.
*
* <p>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.
*
* <p>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.
*
* <p><b>Value</b>
* <ul>
@@ -765,7 +785,7 @@ public final class TJ {
*/
public static final int PARAM_LOSSLESSPT = 17;
/**
* JPEG restart marker interval in MCU blocks [lossy compression only]
* JPEG restart marker interval in MCUs [lossy compression only]
*
* <p>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.
*
* <p>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.
*
* <p><b>Value</b>
* <ul>
* <li> the number of MCU blocks between each restart marker <i>[default:
* <li> the number of MCUs between each restart marker <i>[default:
* <code>0</code> (no restart markers)]</i>
* </ul>
*
@@ -786,15 +815,16 @@ public final class TJ {
*/
public static final int PARAM_RESTARTBLOCKS = 18;
/**
* JPEG restart marker interval in MCU rows (lossy) or sample rows (lossless)
* [compression only]
* JPEG restart marker interval in MCU rows [compression only]
*
* <p>See {@link #PARAM_RESTARTBLOCKS} for a description of restart markers.
* <p>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.
*
* <p><b>Value</b>
* <ul>
* <li> the number of MCU rows or sample rows between each restart marker
* <i>[default: <code>0</code> (no restart markers)]</i>
* <li> the number of MCU rows between each restart marker <i>[default:
* <code>0</code> (no restart markers)]</i>
* </ul>
*
* <p>Setting this parameter to a non-zero value sets

View File

@@ -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 <code>java.awt.Rectangle</code> 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 <code>croppingRegion</code> is {@link TJ#UNCROPPED},

View File

@@ -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

View File

@@ -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.

View File

@@ -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

View File

@@ -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");

View File

@@ -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");

View File

@@ -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)

View File

@@ -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 <tt>#TJUNCROPPED</tt> for no cropping. The
* left boundary of the cropping region must be evenly divisible by the scaled
* MCU block width-- <tt>#TJSCALED(#tjMCUWidth[subsamp], scalingFactor)</tt>,
* 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 <tt>#TJUNCROPPED</tt>, the JPEG header must be read (see
* iMCU width-- <tt>#TJSCALED(#tjMCUWidth[subsamp], scalingFactor)</tt>, 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
* <tt>#TJUNCROPPED</tt>, 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().)

View File

@@ -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