mirror of
https://github.com/libjpeg-turbo/libjpeg-turbo.git
synced 2026-01-18 21:41:20 +01:00
Merge branch 'main' into dev
This commit is contained in:
@@ -797,10 +797,9 @@ final class TJBench {
|
||||
System.out.println(" if N is not 8 or 12, 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("-strict = Immediately discontinue the current");
|
||||
System.out.println(" compression/decompression/transform operation if a warning (non-fatal");
|
||||
System.out.println(" error) occurs");
|
||||
@@ -814,13 +813,13 @@ final class TJBench {
|
||||
System.out.println("---------------------------------------");
|
||||
System.out.println("-arithmetic = Use arithmetic entropy coding in JPEG images generated by");
|
||||
System.out.println(" compression and transform operations (can be combined with -progressive)");
|
||||
System.out.println("-copynone = Do not copy any extra markers (including EXIF and ICC profile data)");
|
||||
System.out.println("-copynone = Do not copy any extra markers (including Exif and ICC profile data)");
|
||||
System.out.println(" when transforming the input image");
|
||||
System.out.println("-crop WxH+X+Y = Decompress only the specified region of the JPEG image, where W");
|
||||
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("-dct fast = Use less accurate DCT/IDCT algorithm [legacy feature]");
|
||||
System.out.println("-dct int = Use more accurate DCT/IDCT algorithm [default]");
|
||||
System.out.println("-flip {horizontal|vertical}, -rotate {90|180|270}, -transpose, -transverse =");
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
@@ -370,13 +370,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>
|
||||
@@ -559,7 +557,7 @@ $('.navPadding').css('padding-top', $('.fixedNav').css("height"));
|
||||
</dd>
|
||||
<dt><span class="memberNameLink"><a href="org/libjpegturbo/turbojpeg/TJTransform.html#OPT_COPYNONE">OPT_COPYNONE</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">Do not copy any extra markers (including EXIF and ICC profile data) from
|
||||
<div class="block">Do not copy any extra markers (including Exif and ICC profile data) from
|
||||
the source image to the destination image.</div>
|
||||
</dd>
|
||||
<dt><span class="memberNameLink"><a href="org/libjpegturbo/turbojpeg/TJTransform.html#OPT_CROP">OPT_CROP</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>
|
||||
@@ -591,7 +589,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>
|
||||
@@ -676,12 +674,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.
@@ -354,15 +354,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="rowColor">
|
||||
<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="altColor">
|
||||
@@ -635,16 +634,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>​(int 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>​(int 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">
|
||||
@@ -883,7 +880,8 @@ extends java.lang.Object</pre>
|
||||
images can be decompressed into packed-pixel images, but they cannot be
|
||||
<ul>
|
||||
<li> decompressed into planar YUV images,
|
||||
<li> losslessly transformed if <a href="TJTransform.html#OPT_CROP"><code>TJTransform.OPT_CROP</code></a> is specified,
|
||||
<li> losslessly transformed if <a href="TJTransform.html#OPT_CROP"><code>TJTransform.OPT_CROP</code></a> is specified
|
||||
and <a href="TJTransform.html#OPT_GRAY"><code>TJTransform.OPT_GRAY</code></a> is not specified,
|
||||
or
|
||||
<li> partially decompressed using a cropping region.
|
||||
</ul></div>
|
||||
@@ -1565,8 +1563,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>
|
||||
@@ -1778,7 +1776,7 @@ extends java.lang.Object</pre>
|
||||
<li class="blockList">
|
||||
<h4>PARAM_RESTARTBLOCKS</h4>
|
||||
<pre>public static final 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
|
||||
@@ -1788,9 +1786,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>
|
||||
|
||||
@@ -1809,15 +1816,16 @@ extends java.lang.Object</pre>
|
||||
<li class="blockList">
|
||||
<h4>PARAM_RESTARTROWS</h4>
|
||||
<pre>public static final 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
|
||||
@@ -2057,15 +2065,25 @@ extends java.lang.Object</pre>
|
||||
<li class="blockList">
|
||||
<h4>getMCUWidth</h4>
|
||||
<pre class="methodSignature">public static int getMCUWidth​(int 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>
|
||||
@@ -2076,15 +2094,25 @@ extends java.lang.Object</pre>
|
||||
<li class="blockList">
|
||||
<h4>getMCUHeight</h4>
|
||||
<pre class="methodSignature">public static int getMCUHeight​(int 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>
|
||||
|
||||
@@ -707,8 +707,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
|
||||
@@ -731,10 +731,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>,
|
||||
|
||||
@@ -276,7 +276,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_COPYNONE">OPT_COPYNONE</a></span></code></th>
|
||||
<td class="colLast">
|
||||
<div class="block">Do not copy any extra markers (including EXIF and ICC profile data) from
|
||||
<div class="block">Do not copy any extra markers (including Exif and ICC profile data) from
|
||||
the source image to the destination image.</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -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 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 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 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 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 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 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 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 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>
|
||||
@@ -710,7 +710,7 @@ extends java.awt.Rectangle</pre>
|
||||
<li class="blockList">
|
||||
<h4>OPT_COPYNONE</h4>
|
||||
<pre>public static final int OPT_COPYNONE</pre>
|
||||
<div class="block">Do not copy any extra markers (including EXIF and ICC profile data) from
|
||||
<div class="block">Do not copy any extra markers (including Exif and ICC profile data) from
|
||||
the source image to the destination image.</div>
|
||||
<dl>
|
||||
<dt><span class="seeLabel">See Also:</span></dt>
|
||||
@@ -818,9 +818,10 @@ 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>)
|
||||
of the destination image.</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>) of the destination image.</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.
@@ -112,7 +112,8 @@ public final class TJ {
|
||||
* images can be decompressed into packed-pixel images, but they cannot be
|
||||
* <ul>
|
||||
* <li> decompressed into planar YUV images,
|
||||
* <li> losslessly transformed if {@link TJTransform#OPT_CROP} is specified,
|
||||
* <li> losslessly transformed if {@link TJTransform#OPT_CROP} is specified
|
||||
* and {@link TJTransform#OPT_GRAY} is not specified,
|
||||
* or
|
||||
* <li> partially decompressed using a cropping region.
|
||||
* </ul>
|
||||
@@ -120,14 +121,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 +151,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);
|
||||
@@ -625,8 +646,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>
|
||||
@@ -782,7 +803,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
|
||||
@@ -792,9 +813,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>
|
||||
*
|
||||
@@ -803,15 +833,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
|
||||
|
||||
@@ -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},
|
||||
|
||||
@@ -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);
|
||||
/**
|
||||
@@ -136,7 +136,7 @@ public class TJTransform extends Rectangle {
|
||||
*/
|
||||
public static final int OPT_PROGRESSIVE = (1 << 5);
|
||||
/**
|
||||
* Do not copy any extra markers (including EXIF and ICC profile data) from
|
||||
* Do not copy any extra markers (including Exif and ICC profile data) from
|
||||
* the source image to the destination image.
|
||||
*/
|
||||
public static final int OPT_COPYNONE = (1 << 6);
|
||||
@@ -164,12 +164,12 @@ 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()})
|
||||
* of the destination image.
|
||||
*
|
||||
* @param y the upper boundary of the cropping region. This must be evenly
|
||||
* divisible by the MCU block height (see {@link TJ#getMCUHeight
|
||||
* TJ.getMCUHeight()})
|
||||
* divisible by the iMCU height (see {@link TJ#getMCUHeight
|
||||
* TJ.getMCUHeight()}) of the destination image.
|
||||
*
|
||||
* @param w the width of the cropping region. Setting this to 0 is the
|
||||
* equivalent of setting it to (width of the source JPEG image -
|
||||
|
||||
@@ -1141,7 +1141,7 @@ JNIEXPORT jintArray JNICALL Java_org_libjpegturbo_turbojpeg_TJTransformer_transf
|
||||
size_t *dstSizes = NULL;
|
||||
tjtransform *t = NULL;
|
||||
jbyteArray *jdstBufs = NULL;
|
||||
int i, jpegWidth = 0, jpegHeight = 0, jpegSubsamp;
|
||||
int i, jpegWidth = 0, jpegHeight = 0, srcSubsamp;
|
||||
jintArray jdstSizes = 0;
|
||||
jint *dstSizesi = NULL;
|
||||
JNICustomFilterParams *params = NULL;
|
||||
@@ -1154,8 +1154,7 @@ JNIEXPORT jintArray JNICALL Java_org_libjpegturbo_turbojpeg_TJTransformer_transf
|
||||
THROW_ARG("JPEG header has not yet been read");
|
||||
if ((jpegHeight = tj3Get(handle, TJPARAM_JPEGHEIGHT)) == -1)
|
||||
THROW_ARG("JPEG header has not yet been read");
|
||||
if ((jpegSubsamp = tj3Get(handle, TJPARAM_SUBSAMP)) == TJSAMP_UNKNOWN)
|
||||
THROW_ARG("TJPARAM_SUBSAMP must be specified");
|
||||
srcSubsamp = tj3Get(handle, TJPARAM_SUBSAMP);
|
||||
|
||||
n = (*env)->GetArrayLength(env, dstobjs);
|
||||
if (n != (*env)->GetArrayLength(env, tobjs))
|
||||
@@ -1214,6 +1213,7 @@ JNIEXPORT jintArray JNICALL Java_org_libjpegturbo_turbojpeg_TJTransformer_transf
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
int w = jpegWidth, h = jpegHeight;
|
||||
int dstSubsamp = (t[i].options & TJXOPT_GRAY) ? TJSAMP_GRAY : srcSubsamp;
|
||||
|
||||
if (t[i].op == TJXOP_TRANSPOSE || t[i].op == TJXOP_TRANSVERSE ||
|
||||
t[i].op == TJXOP_ROT90 || t[i].op == TJXOP_ROT270) {
|
||||
@@ -1223,7 +1223,7 @@ JNIEXPORT jintArray JNICALL Java_org_libjpegturbo_turbojpeg_TJTransformer_transf
|
||||
if (t[i].r.h != 0) h = t[i].r.h;
|
||||
BAILIF0(jdstBufs[i] = (*env)->GetObjectArrayElement(env, dstobjs, i));
|
||||
if ((size_t)(*env)->GetArrayLength(env, jdstBufs[i]) <
|
||||
tj3JPEGBufSize(w, h, jpegSubsamp))
|
||||
tj3JPEGBufSize(w, h, dstSubsamp))
|
||||
THROW_ARG("Destination buffer is not large enough");
|
||||
}
|
||||
BAILIF0NOEC(jpegBuf = (*env)->GetPrimitiveArrayCritical(env, jsrcBuf, 0));
|
||||
|
||||
Reference in New Issue
Block a user