Clean up and consolidate notes regarding the YUV image format. This also corrects a factual error regarding the padding of the luminance plane-- because we now support 4:1:1, the component width is not necessarily padded to the nearest multiple of 2 if horizontal subsampling is used.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1342 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
@@ -857,7 +857,7 @@
|
||||
<dd> </dd>
|
||||
<dt><a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><span class="strong">YUVImage</span></a> - Class in <a href="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</a></dt>
|
||||
<dd>
|
||||
<div class="block">This class encapsulates a YUV planar image buffer and the metadata
|
||||
<div class="block">This class encapsulates a YUV planar image and the metadata
|
||||
associated with it.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(int, int, int, int)">YUVImage(int, int, int, int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
<br>
|
||||
<pre>public class <span class="strong">YUVImage</span>
|
||||
extends java.lang.Object</pre>
|
||||
<div class="block">This class encapsulates a YUV planar image buffer and the metadata
|
||||
<div class="block">This class encapsulates a YUV planar image and the metadata
|
||||
associated with it. The TurboJPEG API allows both the JPEG compression and
|
||||
decompression pipelines to be split into stages: YUV encode, compress from
|
||||
YUV, decompress to YUV, and YUV decode. A <code>YUVImage</code> instance
|
||||
@@ -105,18 +105,28 @@ extends java.lang.Object</pre>
|
||||
Technically, the JPEG format uses the YCbCr colorspace (which technically is
|
||||
not a "colorspace" but rather a "color transform"), but per the convention
|
||||
of the digital video community, the TurboJPEG API uses "YUV" to refer to an
|
||||
image format consisting of Y, Cb, and Cr image planes. In this image
|
||||
format, the Y, Cb (U), and Cr (V) planes are stored sequentially in the same
|
||||
image buffer, and the size of each plane is determined by the image width,
|
||||
height, line padding, and level of chrominance subsampling. If the
|
||||
chrominance components are subsampled along the horizontal dimension, then
|
||||
the width of the luminance plane would be padded to the nearest multiple of
|
||||
2 (same goes for the height of the luminance plane, if the chrominance
|
||||
components are subsampled along the vertical dimension.) For instance, if
|
||||
the source image is 35 x 35 pixels and 4:2:2 subsampling is used, then the
|
||||
luminance plane would be 36 x 35 bytes, and each of the chrominance planes
|
||||
would be 18 x 35 bytes. If you specify, for instance, a line padding of 4
|
||||
bytes on top of this, then the luminance plane would be 36 x 35 bytes, and
|
||||
image format consisting of Y, Cb, and Cr image planes.
|
||||
<p>
|
||||
Each plane is simply a 2D array of bytes, each byte representing the value
|
||||
of one of the components at a particular location in the image. The
|
||||
"component width" and "component height" of each plane are determined by the
|
||||
image width, height, and level of chrominance subsampling. For the
|
||||
luminance plane, the component width is the image width padded to the
|
||||
nearest multiple of the horizontal subsampling factor (2 in the case of
|
||||
4:2:0 and 4:2:2, 4 in the case of 4:1:1, 1 in the case of 4:4:4 or
|
||||
grayscale.) Similarly, the component height of the luminance plane is the
|
||||
image height padded to the nearest multiple of the vertical subsampling
|
||||
factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4 or
|
||||
grayscale.) The component width of the chrominance planes is equal to the
|
||||
component width of the luminance plane divided by the horizontal subsampling
|
||||
factor, and the component height of the chrominance planes is equal to the
|
||||
component height of the luminance plane divided by the vertical subsampling
|
||||
factor.
|
||||
<p>
|
||||
For example, if the source image is 35 x 35 pixels and 4:2:2 subsampling is
|
||||
used, then the luminance plane would be 36 x 35 bytes, and each of the
|
||||
chrominance planes would be 18 x 35 bytes. If you specify a line padding of
|
||||
4 bytes on top of this, then the luminance plane would be 36 x 35 bytes, and
|
||||
each of the chrominance planes would be 20 x 35 bytes.</div>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -372,9 +382,10 @@ extends java.lang.Object</pre>
|
||||
<div class="block">Create a <code>YUVImage</code> instance from an existing YUV planar image
|
||||
buffer.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>yuvImage</code> - image buffer that contains or will contain YUV planar
|
||||
image data. See <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>above</code></a> for a description of the image
|
||||
format. Use <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int, int)"><code>TJ.bufSizeYUV(int, int, int, int)</code></a> to determine the minimum size for this
|
||||
buffer.</dd><dd><code>width</code> - width (in pixels) of the YUV image</dd><dd><code>pad</code> - the line padding used in the YUV image buffer. For
|
||||
image data. Use <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int, int)"><code>TJ.bufSizeYUV(int, int, int, int)</code></a> to determine the minimum size for
|
||||
this buffer. The Y, U (Cb), and V (Cr) image planes are stored
|
||||
sequentially in the buffer (see <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>above</code></a> for a description
|
||||
of the image format.)</dd><dd><code>width</code> - width (in pixels) of the YUV image</dd><dd><code>pad</code> - the line padding used in the YUV image buffer. For
|
||||
instance, if each line in each plane of the buffer is padded to the
|
||||
nearest multiple of 4 bytes, then <code>pad</code> should be set to 4.</dd><dd><code>height</code> - height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV
|
||||
image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd>
|
||||
@@ -405,9 +416,10 @@ extends java.lang.Object</pre>
|
||||
<div class="block">Assign an existing YUV planar image buffer to this <code>YUVImage</code>
|
||||
instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>yuvImage</code> - image buffer that contains or will contain YUV planar
|
||||
image data. See <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>above</code></a> for a description of the image
|
||||
format. Use <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int, int)"><code>TJ.bufSizeYUV(int, int, int, int)</code></a> to determine the minimum size for this
|
||||
buffer.</dd><dd><code>width</code> - width (in pixels) of the YUV image</dd><dd><code>pad</code> - the line padding used in the YUV image buffer. For
|
||||
image data. Use <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int, int)"><code>TJ.bufSizeYUV(int, int, int, int)</code></a> to determine the minimum size for
|
||||
this buffer. The Y, U (Cb), and V (Cr) image planes are stored
|
||||
sequentially in the buffer (see <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>above</code></a> for a description
|
||||
of the image format.)</dd><dd><code>width</code> - width (in pixels) of the YUV image</dd><dd><code>pad</code> - the line padding used in the YUV image buffer. For
|
||||
instance, if each line in each plane of the buffer is padded to the
|
||||
nearest multiple of 4 bytes, then <code>pad</code> should be set to 4.</dd><dd><code>height</code> - height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV
|
||||
image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd>
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></td>
|
||||
<td class="colLast">
|
||||
<div class="block">This class encapsulates a YUV planar image buffer and the metadata
|
||||
<div class="block">This class encapsulates a YUV planar image and the metadata
|
||||
associated with it.</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
package org.libjpegturbo.turbojpeg;
|
||||
|
||||
/**
|
||||
* This class encapsulates a YUV planar image buffer and the metadata
|
||||
* This class encapsulates a YUV planar image and the metadata
|
||||
* associated with it. The TurboJPEG API allows both the JPEG compression and
|
||||
* decompression pipelines to be split into stages: YUV encode, compress from
|
||||
* YUV, decompress to YUV, and YUV decode. A <code>YUVImage</code> instance
|
||||
@@ -40,18 +40,28 @@ package org.libjpegturbo.turbojpeg;
|
||||
* Technically, the JPEG format uses the YCbCr colorspace (which technically is
|
||||
* not a "colorspace" but rather a "color transform"), but per the convention
|
||||
* of the digital video community, the TurboJPEG API uses "YUV" to refer to an
|
||||
* image format consisting of Y, Cb, and Cr image planes. In this image
|
||||
* format, the Y, Cb (U), and Cr (V) planes are stored sequentially in the same
|
||||
* image buffer, and the size of each plane is determined by the image width,
|
||||
* height, line padding, and level of chrominance subsampling. If the
|
||||
* chrominance components are subsampled along the horizontal dimension, then
|
||||
* the width of the luminance plane would be padded to the nearest multiple of
|
||||
* 2 (same goes for the height of the luminance plane, if the chrominance
|
||||
* components are subsampled along the vertical dimension.) For instance, if
|
||||
* the source image is 35 x 35 pixels and 4:2:2 subsampling is used, then the
|
||||
* luminance plane would be 36 x 35 bytes, and each of the chrominance planes
|
||||
* would be 18 x 35 bytes. If you specify, for instance, a line padding of 4
|
||||
* bytes on top of this, then the luminance plane would be 36 x 35 bytes, and
|
||||
* image format consisting of Y, Cb, and Cr image planes.
|
||||
* <p>
|
||||
* Each plane is simply a 2D array of bytes, each byte representing the value
|
||||
* of one of the components at a particular location in the image. The
|
||||
* "component width" and "component height" of each plane are determined by the
|
||||
* image width, height, and level of chrominance subsampling. For the
|
||||
* luminance plane, the component width is the image width padded to the
|
||||
* nearest multiple of the horizontal subsampling factor (2 in the case of
|
||||
* 4:2:0 and 4:2:2, 4 in the case of 4:1:1, 1 in the case of 4:4:4 or
|
||||
* grayscale.) Similarly, the component height of the luminance plane is the
|
||||
* image height padded to the nearest multiple of the vertical subsampling
|
||||
* factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4 or
|
||||
* grayscale.) The component width of the chrominance planes is equal to the
|
||||
* component width of the luminance plane divided by the horizontal subsampling
|
||||
* factor, and the component height of the chrominance planes is equal to the
|
||||
* component height of the luminance plane divided by the vertical subsampling
|
||||
* factor.
|
||||
* <p>
|
||||
* For example, if the source image is 35 x 35 pixels and 4:2:2 subsampling is
|
||||
* used, then the luminance plane would be 36 x 35 bytes, and each of the
|
||||
* chrominance planes would be 18 x 35 bytes. If you specify a line padding of
|
||||
* 4 bytes on top of this, then the luminance plane would be 36 x 35 bytes, and
|
||||
* each of the chrominance planes would be 20 x 35 bytes.
|
||||
*/
|
||||
public class YUVImage {
|
||||
@@ -83,9 +93,10 @@ public class YUVImage {
|
||||
* buffer.
|
||||
*
|
||||
* @param yuvImage image buffer that contains or will contain YUV planar
|
||||
* image data. See {@link YUVImage above} for a description of the image
|
||||
* format. Use {@link TJ#bufSizeYUV} to determine the minimum size for this
|
||||
* buffer.
|
||||
* image data. Use {@link TJ#bufSizeYUV} to determine the minimum size for
|
||||
* this buffer. The Y, U (Cb), and V (Cr) image planes are stored
|
||||
* sequentially in the buffer (see {@link YUVImage above} for a description
|
||||
* of the image format.)
|
||||
*
|
||||
* @param width width (in pixels) of the YUV image
|
||||
*
|
||||
@@ -108,9 +119,10 @@ public class YUVImage {
|
||||
* instance.
|
||||
*
|
||||
* @param yuvImage image buffer that contains or will contain YUV planar
|
||||
* image data. See {@link YUVImage above} for a description of the image
|
||||
* format. Use {@link TJ#bufSizeYUV} to determine the minimum size for this
|
||||
* buffer.
|
||||
* image data. Use {@link TJ#bufSizeYUV} to determine the minimum size for
|
||||
* this buffer. The Y, U (Cb), and V (Cr) image planes are stored
|
||||
* sequentially in the buffer (see {@link YUVImage above} for a description
|
||||
* of the image format.)
|
||||
*
|
||||
* @param width width (in pixels) of the YUV image
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user