<tr class="memitem:gaf451664a62c1f6c7cc5a6401f32908c9"><td class="memItemLeft" align="right" valign="top">DLLEXPORT unsigned long DLLCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gaf451664a62c1f6c7cc5a6401f32908c9">tjBufSizeYUV2</a> (int width, int pad, int height, int subsamp)</td></tr>
<tr class="memdesc:gaf451664a62c1f6c7cc5a6401f32908c9"><td class="mdescLeft"> </td><td class="mdescRight">The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters. <a href="#gaf451664a62c1f6c7cc5a6401f32908c9">More...</a><br/></td></tr>
<tr class="separator:gaf451664a62c1f6c7cc5a6401f32908c9"><td class="memSeparator" colspan="2"> </td></tr>
+<tr class="memitem:ga6f98d977bfa9d167c97172e876ba61e2"><td class="memItemLeft" align="right" valign="top">DLLEXPORT unsigned long DLLCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga6f98d977bfa9d167c97172e876ba61e2">tjPlaneSizeYUV</a> (int componentID, int width, int stride, int height, int subsamp)</td></tr>
+<tr class="memdesc:ga6f98d977bfa9d167c97172e876ba61e2"><td class="mdescLeft"> </td><td class="mdescRight">The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters. <a href="#ga6f98d977bfa9d167c97172e876ba61e2">More...</a><br/></td></tr>
+<tr class="separator:ga6f98d977bfa9d167c97172e876ba61e2"><td class="memSeparator" colspan="2"> </td></tr>
+<tr class="memitem:ga63fb66bb1e36c74008c4634360becbb1"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga63fb66bb1e36c74008c4634360becbb1">tjPlaneWidth</a> (int componentID, int width, int subsamp)</td></tr>
+<tr class="memdesc:ga63fb66bb1e36c74008c4634360becbb1"><td class="mdescLeft"> </td><td class="mdescRight">The plane width of a YUV image plane with the given parameters. <a href="#ga63fb66bb1e36c74008c4634360becbb1">More...</a><br/></td></tr>
+<tr class="separator:ga63fb66bb1e36c74008c4634360becbb1"><td class="memSeparator" colspan="2"> </td></tr>
+<tr class="memitem:ga1a209696c6a80748f20e134b3c64789f"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga1a209696c6a80748f20e134b3c64789f">tjPlaneHeight</a> (int componentID, int height, int subsamp)</td></tr>
+<tr class="memdesc:ga1a209696c6a80748f20e134b3c64789f"><td class="mdescLeft"> </td><td class="mdescRight">The plane height of a YUV image plane with the given parameters. <a href="#ga1a209696c6a80748f20e134b3c64789f">More...</a><br/></td></tr>
+<tr class="separator:ga1a209696c6a80748f20e134b3c64789f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga0a5ffbf7cb58a5b6a8201114fe889360"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int DLLCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga0a5ffbf7cb58a5b6a8201114fe889360">tjEncodeYUV3</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char *dstBuf, int pad, int subsamp, int flags)</td></tr>
<tr class="memdesc:ga0a5ffbf7cb58a5b6a8201114fe889360"><td class="mdescLeft"> </td><td class="mdescRight">Encode an RGB or grayscale image into a YUV planar image. <a href="#ga0a5ffbf7cb58a5b6a8201114fe889360">More...</a><br/></td></tr>
<tr class="separator:ga0a5ffbf7cb58a5b6a8201114fe889360"><td class="memSeparator" colspan="2"> </td></tr>
<p><a class="anchor" id="YUVnotes"></a></p>
<h2>YUV Image Format Notes</h2>
<p>Technically, the JPEG format uses the YCbCr colorspace (which is technically not a colorspace but 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.</p>
-<p>Each plane is simply a 2D array of bytes, each byte representing the value of one of the components (Y, Cb, or Cr) 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.) This is irrespective of any additional padding that may be specified as an argument to the various YUV functions. 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>
+<p>Each plane is simply a 2D array of bytes, each byte representing the value of one of the components (Y, Cb, or Cr) at a particular location in the image. The width and height of each plane are determined by the image width, height, and level of chrominance subsampling. The luminance plane 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 luminance plane height 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.) This is irrespective of any additional padding that may be specified as an argument to the various YUV functions. The chrominance plane width is equal to the luminance plane width divided by the horizontal subsampling factor, and the chrominance plane height is equal to the luminance plane height divided by the vertical subsampling factor.</p>
<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. </p>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a class="anchor" id="ga39f57a6fb02d9cf32e7b6890099b5a71"></a>
</table>
</dd>
</dl>
-<dl class="section return"><dt>Returns</dt><dd>a pointer to a newly-allocated buffer with the specified number of bytes</dd></dl>
+<dl class="section return"><dt>Returns</dt><dd>a pointer to a newly-allocated buffer with the specified number of bytes.</dd></dl>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="group___turbo_j_p_e_g.html#ga8c4a1231dc06a450514c835f6471f137" title="Free an image buffer previously allocated by TurboJPEG.">tjFree()</a> </dd></dl>
</div>
<p>The number of bytes returned by this function is larger than the size of the uncompressed source image. The reason for this is that the JPEG format uses 16-bit coefficients, and it is thus possible for a very high-quality JPEG image with very high-frequency content to expand rather than compress when converted to the JPEG format. Such images represent a very rare corner case, but since there is no way to predict the size of a JPEG image prior to compression, the corner case has to be handled.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
- <tr><td class="paramname">width</td><td>width of the image (in pixels)</td></tr>
- <tr><td class="paramname">height</td><td>height of the image (in pixels)</td></tr>
+ <tr><td class="paramname">width</td><td>width (in pixels) of the image</td></tr>
+ <tr><td class="paramname">height</td><td>height (in pixels) of the image</td></tr>
<tr><td class="paramname">jpegSubsamp</td><td>the level of chrominance subsampling to be used when generating the JPEG image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
</table>
</dd>
<p>The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
- <tr><td class="paramname">width</td><td>width of the image (in pixels)</td></tr>
+ <tr><td class="paramname">width</td><td>width (in pixels) of the image</td></tr>
<tr><td class="paramname">pad</td><td>the width of each line in each plane of the image is padded to the nearest multiple of this number of bytes (must be a power of 2.)</td></tr>
- <tr><td class="paramname">height</td><td>height of the image (in pixels)</td></tr>
+ <tr><td class="paramname">height</td><td>height (in pixels) of the image</td></tr>
<tr><td class="paramname">subsamp</td><td>level of chrominance subsampling in the image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
</table>
</dd>
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance</td></tr>
<tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing RGB, grayscale, or CMYK pixels to be compressed</td></tr>
<tr><td class="paramname">width</td><td>width (in pixels) of the source image</td></tr>
- <tr><td class="paramname">pitch</td><td>bytes per line of the source image. Normally, this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
+ <tr><td class="paramname">pitch</td><td>bytes per line in the source image. Normally, this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
<tr><td class="paramname">height</td><td>height (in pixels) of the source image</td></tr>
<tr><td class="paramname">pixelFormat</td><td>pixel format of the source image (see <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.)</td></tr>
<tr><td class="paramname">jpegBuf</td><td>address of a pointer to an image 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">
<tr><td class="paramname">jpegSize</td><td>pointer to an unsigned long variable that holds the size of the JPEG image buffer. If <code>*jpegBuf</code> points to a pre-allocated buffer, then <code>*jpegSize</code> should be set to the size of the buffer. Upon return, <code>*jpegSize</code> will contain the size of the JPEG image (in bytes.)</td></tr>
<tr><td class="paramname">jpegSubsamp</td><td>the level of chrominance subsampling to be used when generating the JPEG image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
<tr><td class="paramname">jpegQual</td><td>the image quality of the generated JPEG image (1 = worst, 100 = best)</td></tr>
- <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a>.</td></tr>
+ <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a></td></tr>
</table>
</dd>
</dl>
If you choose option 1, <code>*jpegSize</code> should be set to the size of your pre-allocated buffer. In any case, unless you have set <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a>, you should always check <code>*jpegBuf</code> upon return from this function, as it may have changed.</td></tr>
<tr><td class="paramname">jpegSize</td><td>pointer to an unsigned long variable that holds the size of the JPEG image buffer. If <code>*jpegBuf</code> points to a pre-allocated buffer, then <code>*jpegSize</code> should be set to the size of the buffer. Upon return, <code>*jpegSize</code> will contain the size of the JPEG image (in bytes.)</td></tr>
<tr><td class="paramname">jpegQual</td><td>the image quality of the generated JPEG image (1 = worst, 100 = best)</td></tr>
- <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a>.</td></tr>
+ <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a></td></tr>
</table>
</dd>
</dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance</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 image to be compressed. These planes can be contiguous or non-contiguous in memory. Each plane should be at least <b><em>{component stride} * {component height}</em></b> bytes in size. (See below for a description of stride, and refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for a description of component height.)</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 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#ga6f98d977bfa9d167c97172e876ba61e2" title="The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters...">tjPlaneSizeYUV()</a> for the given image width, height, strides, and level of chrominance subsampling. 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 within TurboJPEG.</td></tr>
- <tr><td class="paramname">strides</td><td>an array of integers, each specifying the number of bytes per line 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 component width for the plane. If <code>strides</code> is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to create a JPEG image from a subregion of a larger YUV planar image.</td></tr>
+ <tr><td class="paramname">strides</td><td>an array of integers, each specifying the number of bytes per line 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 line padding in each plane or to create a JPEG image from a subregion of a larger YUV planar 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 within TurboJPEG.</td></tr>
<tr><td class="paramname">subsamp</td><td>the level of chrominance subsampling used in the source image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
<tr><td class="paramname">jpegBuf</td><td>address of a pointer to an image 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">
If you choose option 1, <code>*jpegSize</code> should be set to the size of your pre-allocated buffer. In any case, unless you have set <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a>, you should always check <code>*jpegBuf</code> upon return from this function, as it may have changed.</td></tr>
<tr><td class="paramname">jpegSize</td><td>pointer to an unsigned long variable that holds the size of the JPEG image buffer. If <code>*jpegBuf</code> points to a pre-allocated buffer, then <code>*jpegSize</code> should be set to the size of the buffer. Upon return, <code>*jpegSize</code> will contain the size of the JPEG image (in bytes.)</td></tr>
<tr><td class="paramname">jpegQual</td><td>the image quality of the generated JPEG image (1 = worst, 100 = best)</td></tr>
- <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a>.</td></tr>
+ <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a></td></tr>
</table>
</dd>
</dl>
<tr><td class="paramname">subsamp</td><td>the level of chrominance subsampling used in the YUV source image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
<tr><td class="paramname">dstBuf</td><td>pointer to an image buffer that will receive the decoded image. This buffer should normally be <code>pitch * height</code> bytes in size, but the <code>dstBuf</code> pointer can also be used to decode into a specific region of a larger buffer.</td></tr>
<tr><td class="paramname">width</td><td>width (in pixels) of the source and destination images</td></tr>
- <tr><td class="paramname">pitch</td><td>bytes per line of the destination image. Normally, this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the destination image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the destination image should be padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
+ <tr><td class="paramname">pitch</td><td>bytes per line in the destination image. Normally, this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the destination image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the destination image should be padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
<tr><td class="paramname">height</td><td>height (in pixels) of the source and destination images</td></tr>
<tr><td class="paramname">pixelFormat</td><td>pixel format of the destination image (see <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.)</td></tr>
- <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a>.</td></tr>
+ <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a></td></tr>
</table>
</dd>
</dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</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 decoding a grayscale image) that contain a YUV image to be decoded. These planes can be contiguous or non-contiguous in memory. Each plane should be at least <b><em>{component stride} * {component height}</em></b> bytes in size. (See below for a description of stride, and refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for a description of component height.)</td></tr>
- <tr><td class="paramname">strides</td><td>an array of integers, each specifying the number of bytes per line 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 component width for the plane. If <code>strides</code> is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to decode a subregion of a larger YUV planar image.</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 decoding a grayscale image) that contain a YUV image to be decoded. 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#ga6f98d977bfa9d167c97172e876ba61e2" title="The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters...">tjPlaneSizeYUV()</a> for the given image width, height, strides, and level of chrominance subsampling. 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">strides</td><td>an array of integers, each specifying the number of bytes per line 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 line padding in each plane or to decode a subregion of a larger YUV planar image.</td></tr>
<tr><td class="paramname">subsamp</td><td>the level of chrominance subsampling used in the YUV source image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
<tr><td class="paramname">dstBuf</td><td>pointer to an image buffer that will receive the decoded image. This buffer should normally be <code>pitch * height</code> bytes in size, but the <code>dstBuf</code> pointer can also be used to decode into a specific region of a larger buffer.</td></tr>
<tr><td class="paramname">width</td><td>width (in pixels) of the source and destination images</td></tr>
- <tr><td class="paramname">pitch</td><td>bytes per line of the destination image. Normally, this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the destination image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the destination image should be padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
+ <tr><td class="paramname">pitch</td><td>bytes per line in the destination image. Normally, this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the destination image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the destination image should be padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
<tr><td class="paramname">height</td><td>height (in pixels) of the source and destination images</td></tr>
<tr><td class="paramname">pixelFormat</td><td>pixel format of the destination image (see <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.)</td></tr>
- <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a>.</td></tr>
+ <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a></td></tr>
</table>
</dd>
</dl>
<tr><td class="paramname">jpegSize</td><td>size of the JPEG image (in bytes)</td></tr>
<tr><td class="paramname">dstBuf</td><td>pointer to an image buffer that will receive the decompressed image. This buffer should normally be <code>pitch * scaledHeight</code> bytes in size, where <code>scaledHeight</code> 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 image height and one of the scaling factors returned by <a class="el" href="group___turbo_j_p_e_g.html#ga6449044b9af402999ccf52f401333be8" title="Returns a list of fractional scaling factors that the JPEG decompressor in this implementation of Tur...">tjGetScalingFactors()</a>. The <code>dstBuf</code> pointer may also be used to decompress into a specific region of a larger buffer.</td></tr>
<tr><td class="paramname">width</td><td>desired width (in pixels) of the destination image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If <code>width</code> is set to 0, then only the height will be considered when determining the scaled image size.</td></tr>
- <tr><td class="paramname">pitch</td><td>bytes per line of the destination image. Normally, this is <code>scaledWidth * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the decompressed image is unpadded, else <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(scaledWidth * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the decompressed image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. (NOTE: <code>scaledWidth</code> 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 image width and one of the scaling factors returned by <a class="el" href="group___turbo_j_p_e_g.html#ga6449044b9af402999ccf52f401333be8" title="Returns a list of fractional scaling factors that the JPEG decompressor in this implementation of Tur...">tjGetScalingFactors()</a>.) You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>scaledWidth * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
+ <tr><td class="paramname">pitch</td><td>bytes per line in the destination image. Normally, this is <code>scaledWidth * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the decompressed image is unpadded, else <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(scaledWidth * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the decompressed image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. (NOTE: <code>scaledWidth</code> 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 image width and one of the scaling factors returned by <a class="el" href="group___turbo_j_p_e_g.html#ga6449044b9af402999ccf52f401333be8" title="Returns a list of fractional scaling factors that the JPEG decompressor in this implementation of Tur...">tjGetScalingFactors()</a>.) You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>scaledWidth * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
<tr><td class="paramname">height</td><td>desired height (in pixels) of the destination image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If <code>height</code> is set to 0, then only the width will be considered when determining the scaled image size.</td></tr>
<tr><td class="paramname">pixelFormat</td><td>pixel format of the destination image (see <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.)</td></tr>
- <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a>.</td></tr>
+ <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a></td></tr>
</table>
</dd>
</dl>
<tr><td class="paramname">jpegSize</td><td>size of the JPEG image (in bytes)</td></tr>
<tr><td class="paramname">width</td><td>pointer to an integer variable that will receive the width (in pixels) of the JPEG image</td></tr>
<tr><td class="paramname">height</td><td>pointer to an integer variable that will receive the height (in pixels) of the JPEG image</td></tr>
- <tr><td class="paramname">jpegSubsamp</td><td>pointer to an integer variable that will receive the level of chrominance subsampling used when compressing the JPEG image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
+ <tr><td class="paramname">jpegSubsamp</td><td>pointer to an integer variable that will receive the level of chrominance subsampling used when the JPEG image was compressed (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
<tr><td class="paramname">jpegColorspace</td><td>pointer to an integer variable that will receive one of the JPEG colorspace constants, indicating the colorspace of the JPEG image (see <a class="el" href="group___turbo_j_p_e_g.html#ga4f83ad3368e0e29d1957be0efa7c3720">JPEG colorspaces</a>.)</td></tr>
</table>
</dd>
<tr><td class="paramname">width</td><td>desired width (in pixels) of the YUV image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If <code>width</code> is set to 0, then only the height will be considered when determining the scaled image size. If the scaled 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 within TurboJPEG.</td></tr>
<tr><td class="paramname">pad</td><td>the width of each line in each plane of the YUV image will be padded to the nearest multiple of this number of bytes (must be a power of 2.) To generate images suitable for X Video, <code>pad</code> should be set to 4.</td></tr>
<tr><td class="paramname">height</td><td>desired height (in pixels) of the YUV image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If <code>height</code> is set to 0, then only the width will be considered when determining the scaled image size. If the scaled 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 within TurboJPEG.</td></tr>
- <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a>.</td></tr>
+ <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a></td></tr>
</table>
</dd>
</dl>
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</td></tr>
<tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG image to decompress</td></tr>
<tr><td class="paramname">jpegSize</td><td>size of the JPEG image (in bytes)</td></tr>
- <tr><td class="paramname">dstPlanes</td><td>an array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decompressing a grayscale image) that will receive the YUV image. These planes can be contiguous or non-contiguous in memory. Each plane should be at least <b><em>{component stride} * {scaled component height}</em></b> bytes in size. (See below for a description of stride, and refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for a description of component height.)</td></tr>
+ <tr><td class="paramname">dstPlanes</td><td>an array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decompressing a grayscale image) that will receive the YUV image. These planes can be contiguous or non-contiguous in memory. Use <a class="el" href="group___turbo_j_p_e_g.html#ga6f98d977bfa9d167c97172e876ba61e2" title="The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters...">tjPlaneSizeYUV()</a> to determine the appropriate size for each plane based on the scaled image width, scaled image height, strides, and level of chrominance subsampling. 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>desired width (in pixels) of the YUV image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If <code>width</code> is set to 0, then only the height will be considered when determining the scaled image size. If the scaled 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 within TurboJPEG.</td></tr>
- <tr><td class="paramname">strides</td><td>an array of integers, each specifying the number of bytes per line in the corresponding plane of the output image. Setting the stride for any plane to 0 is the same as setting it to the scaled component width for the plane. If <code>strides</code> is NULL, then the strides for all planes will be set to their respective scaled component widths. You can adjust the strides in order to add an arbitrary amount of line padding to each plane or to decompress the JPEG image into a subregion of a larger YUV planar image.</td></tr>
+ <tr><td class="paramname">strides</td><td>an array of integers, each specifying the number of bytes per line in the corresponding plane of the output image. Setting the stride for any plane to 0 is the same as setting it to the scaled 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 scaled plane widths. You can adjust the strides in order to add an arbitrary amount of line padding to each plane or to decompress the JPEG image into a subregion of a larger YUV planar image.</td></tr>
<tr><td class="paramname">height</td><td>desired height (in pixels) of the YUV image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If <code>height</code> is set to 0, then only the width will be considered when determining the scaled image size. If the scaled 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 within TurboJPEG.</td></tr>
- <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a>.</td></tr>
+ <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a></td></tr>
</table>
</dd>
</dl>
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance</td></tr>
<tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing RGB or grayscale pixels to be encoded</td></tr>
<tr><td class="paramname">width</td><td>width (in pixels) of the source image</td></tr>
- <tr><td class="paramname">pitch</td><td>bytes per line of the source image. Normally, this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
+ <tr><td class="paramname">pitch</td><td>bytes per line in the source image. Normally, this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
<tr><td class="paramname">height</td><td>height (in pixels) of the source image</td></tr>
<tr><td class="paramname">pixelFormat</td><td>pixel format of the source image (see <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.)</td></tr>
<tr><td class="paramname">dstBuf</td><td>pointer to an image buffer that will receive the YUV image. Use <a class="el" href="group___turbo_j_p_e_g.html#gaf451664a62c1f6c7cc5a6401f32908c9" title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters...">tjBufSizeYUV2()</a> to determine the appropriate size for this buffer based on the image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes will 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">pad</td><td>the width of each line in each plane of the YUV image will be padded to the nearest multiple of this number of bytes (must be a power of 2.) To generate images suitable for X Video, <code>pad</code> should be set to 4.</td></tr>
<tr><td class="paramname">subsamp</td><td>the level of chrominance subsampling to be used when generating the YUV image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.) To generate images suitable for X Video, <code>subsamp</code> should be set to <a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a63085dbf683cfe39e513cdb6343e3737">TJSAMP_420</a>. This produces an image compatible with the I420 (AKA "YUV420P") format.</td></tr>
- <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a>.</td></tr>
+ <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a></td></tr>
</table>
</dd>
</dl>
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance</td></tr>
<tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing RGB or grayscale pixels to be encoded</td></tr>
<tr><td class="paramname">width</td><td>width (in pixels) of the source image</td></tr>
- <tr><td class="paramname">pitch</td><td>bytes per line of the source image. Normally, this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
+ <tr><td class="paramname">pitch</td><td>bytes per line in the source image. Normally, this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
<tr><td class="paramname">height</td><td>height (in pixels) of the source image</td></tr>
<tr><td class="paramname">pixelFormat</td><td>pixel format of the source image (see <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.)</td></tr>
- <tr><td class="paramname">dstPlanes</td><td>an array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if generating a grayscale image) that will receive the encoded image. These planes can be contiguous or non-contiguous in memory. Each plane should be at least <b><em>{component stride} * {component height}</em></b> bytes in size. (See below for a description of stride, and refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for a description of component height.)</td></tr>
- <tr><td class="paramname">strides</td><td>an array of integers, each specifying the number of bytes per line in the corresponding plane of the output image. Setting the stride for any plane to 0 is the same as setting it to the component width for the plane. If <code>strides</code> is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to add an arbitrary amount of line padding to each plane or to encode an RGB or grayscale image into a subregion of a larger YUV planar image.</td></tr>
+ <tr><td class="paramname">dstPlanes</td><td>an array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if generating a grayscale image) that will receive the encoded image. These planes can be contiguous or non-contiguous in memory. Use <a class="el" href="group___turbo_j_p_e_g.html#ga6f98d977bfa9d167c97172e876ba61e2" title="The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters...">tjPlaneSizeYUV()</a> to determine the appropriate size for each plane based on the image width, height, strides, and level of chrominance subsampling. 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">strides</td><td>an array of integers, each specifying the number of bytes per line in the corresponding plane of the output 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 add an arbitrary amount of line padding to each plane or to encode an RGB or grayscale image into a subregion of a larger YUV planar image.</td></tr>
<tr><td class="paramname">subsamp</td><td>the level of chrominance subsampling to be used when generating the YUV image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.) To generate images suitable for X Video, <code>subsamp</code> should be set to <a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a63085dbf683cfe39e513cdb6343e3737">TJSAMP_420</a>. This produces an image compatible with the I420 (AKA "YUV420P") format.</td></tr>
- <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a>.</td></tr>
+ <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a></td></tr>
</table>
</dd>
</dl>
<p>Create a new TurboJPEG transformer instance. </p>
<dl class="section return"><dt>Returns</dt><dd>a handle to the newly-created instance, or NULL if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr()</a>.) </dd></dl>
+</div>
+</div>
+<a class="anchor" id="ga1a209696c6a80748f20e134b3c64789f"></a>
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">DLLEXPORT int tjPlaneHeight </td>
+ <td>(</td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>componentID</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>height</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>subsamp</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>The plane height of a YUV image plane with the given parameters. </p>
+<p>Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for a description of plane height.</p>
+<dl class="params"><dt>Parameters</dt><dd>
+ <table class="params">
+ <tr><td class="paramname">componentID</td><td>ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr)</td></tr>
+ <tr><td class="paramname">height</td><td>height (in pixels) of the YUV image</td></tr>
+ <tr><td class="paramname">subsamp</td><td>level of chrominance subsampling in the image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="section return"><dt>Returns</dt><dd>the plane height of a YUV image plane with the given parameters, or -1 if the arguments are out of bounds. </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="ga6f98d977bfa9d167c97172e876ba61e2"></a>
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">DLLEXPORT unsigned long DLLCALL tjPlaneSizeYUV </td>
+ <td>(</td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>componentID</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>width</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>stride</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>height</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>subsamp</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+ <table class="params">
+ <tr><td class="paramname">componentID</td><td>ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr)</td></tr>
+ <tr><td class="paramname">width</td><td>width (in pixels) of the YUV image. NOTE: this is the width of the whole image, not the plane width.</td></tr>
+ <tr><td class="paramname">stride</td><td>bytes per line in the image plane. Setting this to 0 is the equivalent of setting it to the plane width.</td></tr>
+ <tr><td class="paramname">height</td><td>height (in pixels) of the YUV image. NOTE: this is the height of the whole image, not the plane height.</td></tr>
+ <tr><td class="paramname">subsamp</td><td>level of chrominance subsampling in the image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="section return"><dt>Returns</dt><dd>the size of the buffer (in bytes) required to hold the YUV image plane, or -1 if the arguments are out of bounds. </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="ga63fb66bb1e36c74008c4634360becbb1"></a>
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">DLLEXPORT int tjPlaneWidth </td>
+ <td>(</td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>componentID</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>width</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>subsamp</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>The plane width of a YUV image plane with the given parameters. </p>
+<p>Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for a description of plane width.</p>
+<dl class="params"><dt>Parameters</dt><dd>
+ <table class="params">
+ <tr><td class="paramname">componentID</td><td>ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr)</td></tr>
+ <tr><td class="paramname">width</td><td>width (in pixels) of the YUV image</td></tr>
+ <tr><td class="paramname">subsamp</td><td>level of chrominance subsampling in the image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="section return"><dt>Returns</dt><dd>the plane width of a YUV image plane with the given parameters, or -1 if the arguments are out of bounds. </dd></dl>
+
</div>
</div>
<a class="anchor" id="gae403193ceb4aafb7e0f56ab587b48616"></a>
</div><div class="memdoc">
<p>Losslessly transform a JPEG image into another JPEG image. </p>
-<p>Lossless transforms work by moving the raw coefficients from one JPEG image structure to another without altering the values of the coefficients. While this is typically faster than decompressing the image, transforming it, and re-compressing it, lossless transforms are not free. Each lossless transform requires reading and performing Huffman decoding on all of the coefficients in the source image, regardless of the size of the destination image. Thus, this function provides a means of generating multiple transformed images from the same source or applying multiple transformations simultaneously, in order to eliminate the need to read the source coefficients multiple times.</p>
+<p>Lossless transforms work by moving the raw DCT coefficients from one JPEG image structure to another without altering the values of the coefficients. While this is typically faster than decompressing the image, transforming it, and re-compressing it, lossless transforms are not free. Each lossless transform requires reading and performing Huffman decoding on all of the coefficients in the source image, regardless of the size of the destination image. Thus, this function provides a means of generating multiple transformed images from the same source or applying multiple transformations simultaneously, in order to eliminate the need to read the source coefficients multiple times.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG transformer instance</td></tr>
- <tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG image to transform</td></tr>
- <tr><td class="paramname">jpegSize</td><td>size of the JPEG image (in bytes)</td></tr>
+ <tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG source image to transform</td></tr>
+ <tr><td class="paramname">jpegSize</td><td>size of the JPEG source image (in bytes)</td></tr>
<tr><td class="paramname">n</td><td>the number of transformed JPEG images to generate</td></tr>
<tr><td class="paramname">dstBufs</td><td>pointer to an array of n image buffers. <code>dstBufs[i]</code> will receive a JPEG image that has been transformed using the parameters in <code>transforms[i]</code>. 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#ga5c9234bda6d993cdaffdd89bf81a00ff" title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a> and let TurboJPEG grow the buffer as needed,</li>
If you choose option 1, <code>dstSizes[i]</code> should be set to the size of your pre-allocated buffer. In any case, unless you have set <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a>, you should always check <code>dstBufs[i]</code> upon return from this function, as it may have changed.</td></tr>
<tr><td class="paramname">dstSizes</td><td>pointer to an array of n unsigned long variables that will receive the actual sizes (in bytes) of each transformed JPEG image. If <code>dstBufs[i]</code> points to a pre-allocated buffer, then <code>dstSizes[i]</code> should be set to the size of the buffer. Upon return, <code>dstSizes[i]</code> will contain the size of the JPEG image (in bytes.)</td></tr>
<tr><td class="paramname">transforms</td><td>pointer to an array of n <a class="el" href="structtjtransform.html" title="Lossless transform.">tjtransform</a> structures, each of which specifies the transform parameters and/or cropping region for the corresponding transformed output image.</td></tr>
- <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a>.</td></tr>
+ <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a></td></tr>
</table>
</dd>
</dl>
['tjpf_5fxbgr',['TJPF_XBGR',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af',1,'turbojpeg.h']]],
['tjpf_5fxrgb',['TJPF_XRGB',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84',1,'turbojpeg.h']]],
['tjpixelsize',['tjPixelSize',['../group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c',1,'turbojpeg.h']]],
+ ['tjplaneheight',['tjPlaneHeight',['../group___turbo_j_p_e_g.html#ga1a209696c6a80748f20e134b3c64789f',1,'turbojpeg.h']]],
+ ['tjplanesizeyuv',['tjPlaneSizeYUV',['../group___turbo_j_p_e_g.html#ga6f98d977bfa9d167c97172e876ba61e2',1,'turbojpeg.h']]],
+ ['tjplanewidth',['tjPlaneWidth',['../group___turbo_j_p_e_g.html#ga63fb66bb1e36c74008c4634360becbb1',1,'turbojpeg.h']]],
['tjredoffset',['tjRedOffset',['../group___turbo_j_p_e_g.html#gadd9b446742ac8a3923f7992c7988fea8',1,'turbojpeg.h']]],
['tjregion',['tjregion',['../structtjregion.html',1,'']]],
['tjsamp',['TJSAMP',['../group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074',1,'turbojpeg.h']]],
['tjsamp_5fgray',['TJSAMP_GRAY',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a3f1c9504842ddc7a48d0f690754b6248',1,'turbojpeg.h']]],
['tjscaled',['TJSCALED',['../group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df',1,'turbojpeg.h']]],
['tjscalingfactor',['tjscalingfactor',['../structtjscalingfactor.html',1,'']]],
- ['tjtransform',['tjtransform',['../structtjtransform.html',1,'tjtransform'],['../group___turbo_j_p_e_g.html#gaa29f3189c41be12ec5dee7caec318a31',1,'tjtransform(): turbojpeg.h'],['../group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616',1,'tjTransform(tjhandle handle, unsigned char *jpegBuf, unsigned long jpegSize, int n, unsigned char **dstBufs, unsigned long *dstSizes, tjtransform *transforms, int flags): turbojpeg.h']]],
+ ['tjtransform',['tjtransform',['../structtjtransform.html',1,'tjtransform'],['../group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616',1,'tjTransform(tjhandle handle, unsigned char *jpegBuf, unsigned long jpegSize, int n, unsigned char **dstBufs, unsigned long *dstSizes, tjtransform *transforms, int flags): turbojpeg.h'],['../group___turbo_j_p_e_g.html#gaa29f3189c41be12ec5dee7caec318a31',1,'tjtransform(): turbojpeg.h']]],
['tjxop',['TJXOP',['../group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866',1,'turbojpeg.h']]],
['tjxop_5fhflip',['TJXOP_HFLIP',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aa0df69776caa30f0fa28e26332d311ce',1,'turbojpeg.h']]],
['tjxop_5fnone',['TJXOP_NONE',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aad88c0366cd3f7d0eac9d7a3fa1c2c27',1,'turbojpeg.h']]],
['tjinitcompress',['tjInitCompress',['../group___turbo_j_p_e_g.html#ga3d10c47fbe4a2489a2b30c931551d01a',1,'turbojpeg.h']]],
['tjinitdecompress',['tjInitDecompress',['../group___turbo_j_p_e_g.html#gae5408179d041e2a2f7199c8283cf649e',1,'turbojpeg.h']]],
['tjinittransform',['tjInitTransform',['../group___turbo_j_p_e_g.html#ga3155b775bfbac9dbba869b95a0367902',1,'turbojpeg.h']]],
+ ['tjplaneheight',['tjPlaneHeight',['../group___turbo_j_p_e_g.html#ga1a209696c6a80748f20e134b3c64789f',1,'turbojpeg.h']]],
+ ['tjplanesizeyuv',['tjPlaneSizeYUV',['../group___turbo_j_p_e_g.html#ga6f98d977bfa9d167c97172e876ba61e2',1,'turbojpeg.h']]],
+ ['tjplanewidth',['tjPlaneWidth',['../group___turbo_j_p_e_g.html#ga63fb66bb1e36c74008c4634360becbb1',1,'turbojpeg.h']]],
['tjtransform',['tjTransform',['../group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616',1,'turbojpeg.h']]]
];
scaleFactor.isOne()) {
file = new File(argv[1]);
FileOutputStream fos = new FileOutputStream(file);
- fos.write(tjd.getSourceBuf(), 0, tjd.getSourceSize());
+ fos.write(tjd.getJPEGBuf(), 0, tjd.getJPEGSize());
fos.close();
System.exit(0);
}
</tr>
<tbody>
<tr class="altColor">
-<td class="colOne"><a href="org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int)">org.libjpegturbo.turbojpeg.TJ.bufSizeYUV(int, int, int)</a>
-<div class="block"><i>Use <a href="org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int, int)"><code>TJ.bufSizeYUV(int, int, int, int)</code></a> instead.</i></div>
+<td class="colOne"><a href="org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int,%20int,%20int)">org.libjpegturbo.turbojpeg.TJ.bufSizeYUV(int, int, int)</a>
+<div class="block"><i>Use <a href="org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int,%20int,%20int,%20int)"><code>TJ.bufSizeYUV(int, int, int, int)</code></a> instead.</i></div>
</td>
</tr>
<tr class="rowColor">
-<td class="colOne"><a href="org/libjpegturbo/turbojpeg/TJCompressor.html#compress(java.awt.image.BufferedImage, byte[], int)">org.libjpegturbo.turbojpeg.TJCompressor.compress(BufferedImage, byte[], int)</a>
+<td class="colOne"><a href="org/libjpegturbo/turbojpeg/TJCompressor.html#compress(java.awt.image.BufferedImage,%20byte[],%20int)">org.libjpegturbo.turbojpeg.TJCompressor.compress(BufferedImage, byte[], int)</a>
<div class="block"><i>Use
- <a href="org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><code>TJCompressor.setSourceImage(BufferedImage, int, int, int, int)</code></a> and
- <a href="org/libjpegturbo/turbojpeg/TJCompressor.html#compress(byte[], int)"><code>TJCompressor.compress(byte[], int)</code></a> instead.</i></div>
+ <a href="org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>TJCompressor.setSourceImage(BufferedImage, int, int, int, int)</code></a> and
+ <a href="org/libjpegturbo/turbojpeg/TJCompressor.html#compress(byte[],%20int)"><code>TJCompressor.compress(byte[], int)</code></a> instead.</i></div>
</td>
</tr>
<tr class="altColor">
-<td class="colOne"><a href="org/libjpegturbo/turbojpeg/TJCompressor.html#compress(java.awt.image.BufferedImage, int)">org.libjpegturbo.turbojpeg.TJCompressor.compress(BufferedImage, int)</a>
+<td class="colOne"><a href="org/libjpegturbo/turbojpeg/TJCompressor.html#compress(java.awt.image.BufferedImage,%20int)">org.libjpegturbo.turbojpeg.TJCompressor.compress(BufferedImage, int)</a>
<div class="block"><i>Use
- <a href="org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><code>TJCompressor.setSourceImage(BufferedImage, int, int, int, int)</code></a> and
+ <a href="org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>TJCompressor.setSourceImage(BufferedImage, int, int, int, int)</code></a> and
<a href="org/libjpegturbo/turbojpeg/TJCompressor.html#compress(int)"><code>TJCompressor.compress(int)</code></a> instead.</i></div>
</td>
</tr>
<tr class="rowColor">
-<td class="colOne"><a href="org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)">org.libjpegturbo.turbojpeg.TJDecompressor.decompress(byte[], int, int, int, int, int)</a>
+<td class="colOne"><a href="org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int)">org.libjpegturbo.turbojpeg.TJDecompressor.decompress(byte[], int, int, int, int, int)</a>
<div class="block"><i>Use
- <a href="org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int, int, int)"><code>TJDecompressor.decompress(byte[], int, int, int, int, int, int, int)</code></a> instead.</i></div>
+ <a href="org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)"><code>TJDecompressor.decompress(byte[], int, int, int, int, int, int, int)</code></a> instead.</i></div>
</td>
</tr>
<tr class="altColor">
-<td class="colOne"><a href="org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int)">org.libjpegturbo.turbojpeg.TJDecompressor.decompressToYUV(byte[], int)</a>
-<div class="block"><i>Use <a href="org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage, int)"><code>TJDecompressor.decompressToYUV(YUVImage, int)</code></a> instead.</i></div>
+<td class="colOne"><a href="org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[],%20int)">org.libjpegturbo.turbojpeg.TJDecompressor.decompressToYUV(byte[], int)</a>
+<div class="block"><i>Use <a href="org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)"><code>TJDecompressor.decompressToYUV(YUVImage, int)</code></a> instead.</i></div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><a href="org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int)">org.libjpegturbo.turbojpeg.TJDecompressor.decompressToYUV(int)</a>
-<div class="block"><i>Use <a href="org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int, int, int, int)"><code>TJDecompressor.decompressToYUV(int, int, int, int)</code></a> instead.</i></div>
+<div class="block"><i>Use <a href="org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int,%20int,%20int,%20int)"><code>TJDecompressor.decompressToYUV(int, int, int, int)</code></a> instead.</i></div>
</td>
</tr>
<tr class="altColor">
-<td class="colOne"><a href="org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(java.awt.image.BufferedImage, byte[], int)">org.libjpegturbo.turbojpeg.TJCompressor.encodeYUV(BufferedImage, byte[], int)</a>
+<td class="colOne"><a href="org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(java.awt.image.BufferedImage,%20byte[],%20int)">org.libjpegturbo.turbojpeg.TJCompressor.encodeYUV(BufferedImage, byte[], int)</a>
<div class="block"><i>Use
- <a href="org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><code>TJCompressor.setSourceImage(BufferedImage, int, int, int, int)</code></a> and
- <a href="org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[], int)"><code>TJCompressor.encodeYUV(byte[], int)</code></a> instead.</i></div>
+ <a href="org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>TJCompressor.setSourceImage(BufferedImage, int, int, int, int)</code></a> and
+ <a href="org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[],%20int)"><code>TJCompressor.encodeYUV(byte[], int)</code></a> instead.</i></div>
</td>
</tr>
<tr class="rowColor">
-<td class="colOne"><a href="org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(java.awt.image.BufferedImage, int)">org.libjpegturbo.turbojpeg.TJCompressor.encodeYUV(BufferedImage, int)</a>
+<td class="colOne"><a href="org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(java.awt.image.BufferedImage,%20int)">org.libjpegturbo.turbojpeg.TJCompressor.encodeYUV(BufferedImage, int)</a>
<div class="block"><i>Use
- <a href="org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><code>TJCompressor.setSourceImage(BufferedImage, int, int, int, int)</code></a> and
- <a href="org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int)"><code>TJCompressor.encodeYUV(int)</code></a> instead.</i></div>
+ <a href="org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>TJCompressor.setSourceImage(BufferedImage, int, int, int, int)</code></a> and
+ <a href="org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int,%20int)"><code>TJCompressor.encodeYUV(int, int)</code></a> instead.</i></div>
</td>
</tr>
<tr class="altColor">
-<td class="colOne"><a href="org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[], int)">org.libjpegturbo.turbojpeg.TJCompressor.encodeYUV(byte[], int)</a>
-<div class="block"><i>Use <a href="org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(org.libjpegturbo.turbojpeg.YUVImage, int)"><code>TJCompressor.encodeYUV(YUVImage, int)</code></a> instead.</i></div>
+<td class="colOne"><a href="org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[],%20int)">org.libjpegturbo.turbojpeg.TJCompressor.encodeYUV(byte[], int)</a>
+<div class="block"><i>Use <a href="org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)"><code>TJCompressor.encodeYUV(YUVImage, int)</code></a> instead.</i></div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><a href="org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int)">org.libjpegturbo.turbojpeg.TJCompressor.encodeYUV(int)</a>
-<div class="block"><i>Use <a href="org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int, int)"><code>TJCompressor.encodeYUV(int, int)</code></a> instead.</i></div>
+<div class="block"><i>Use <a href="org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int,%20int)"><code>TJCompressor.encodeYUV(int, int)</code></a> instead.</i></div>
</td>
</tr>
<tr class="altColor">
-<td class="colOne"><a href="org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGBuf()">org.libjpegturbo.turbojpeg.TJDecompressor.getJPEGBuf()</a>
-<div class="block"><i>Use <a href="org/libjpegturbo/turbojpeg/TJDecompressor.html#getSourceBuf()"><code>TJDecompressor.getSourceBuf()</code></a> instead.</i></div>
+<td class="colOne"><a href="org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGImage(byte[],%20int)">org.libjpegturbo.turbojpeg.TJDecompressor.setJPEGImage(byte[], int)</a>
+<div class="block"><i>Use <a href="org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte[],%20int)"><code>TJDecompressor.setSourceImage(byte[], int)</code></a> instead.</i></div>
</td>
</tr>
<tr class="rowColor">
-<td class="colOne"><a href="org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGSize()">org.libjpegturbo.turbojpeg.TJDecompressor.getJPEGSize()</a>
-<div class="block"><i>Use <a href="org/libjpegturbo/turbojpeg/TJDecompressor.html#getSourceSize()"><code>TJDecompressor.getSourceSize()</code></a> instead.</i></div>
-</td>
-</tr>
-<tr class="altColor">
-<td class="colOne"><a href="org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGImage(byte[], int)">org.libjpegturbo.turbojpeg.TJDecompressor.setJPEGImage(byte[], int)</a>
-<div class="block"><i>Use <a href="org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte[], int)"><code>TJDecompressor.setSourceImage(byte[], int)</code></a> instead.</i></div>
-</td>
-</tr>
-<tr class="rowColor">
-<td class="colOne"><a href="org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int)">org.libjpegturbo.turbojpeg.TJCompressor.setSourceImage(byte[], int, int, int, int)</a>
+<td class="colOne"><a href="org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int)">org.libjpegturbo.turbojpeg.TJCompressor.setSourceImage(byte[], int, int, int, int)</a>
<div class="block"><i>Use
- <a href="org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int, int, int)"><code>TJCompressor.setSourceImage(byte[], int, int, int, int, int, int)</code></a> instead.</i></div>
+ <a href="org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>TJCompressor.setSourceImage(byte[], int, int, int, int, int, int)</code></a> instead.</i></div>
</td>
</tr>
</tbody>
</tr>
<tbody>
<tr class="altColor">
-<td class="colOne"><a href="org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[], int, int, int, int)">org.libjpegturbo.turbojpeg.TJCompressor(byte[], int, int, int, int)</a>
+<td class="colOne"><a href="org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[],%20int,%20int,%20int,%20int)">org.libjpegturbo.turbojpeg.TJCompressor(byte[], int, int, int, int)</a>
<div class="block"><i>Use
- <a href="org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[], int, int, int, int, int, int)"><code>TJCompressor.TJCompressor(byte[], int, int, int, int, int, int)</code></a> instead.</i></div>
+ <a href="org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>TJCompressor.TJCompressor(byte[], int, int, int, int, int, int)</code></a> instead.</i></div>
</td>
</tr>
</tbody>
</a>
<h2 class="title">B</h2>
<dl>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#bufSize(int, int, int)">bufSize(int, int, 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>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#bufSize(int,%20int,%20int)">bufSize(int, int, 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 maximum size of the buffer (in bytes) required to hold a JPEG
image with the given width, height, and level of chrominance subsampling.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int, int)">bufSizeYUV(int, int, int, 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>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int,%20int,%20int,%20int)">bufSizeYUV(int, int, int, 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 size of the buffer (in bytes) required to hold a YUV planar
image with the given width, height, and level of chrominance subsampling.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int)">bufSizeYUV(int, int, 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>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int,%20int,%20int)">bufSizeYUV(int, int, 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"><span class="strong">Deprecated.</span>
-<div class="block"><i>Use <a href="./org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int, int)"><code>TJ.bufSizeYUV(int, int, int, int)</code></a> instead.</i></div>
+<div class="block"><i>Use <a href="./org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int,%20int,%20int,%20int)"><code>TJ.bufSizeYUV(int, int, int, int)</code></a> instead.</i></div>
</div>
</dd>
</dl>
<dd>
<div class="block">Free the native structures associated with this decompressor instance.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#compress(byte[], int)">compress(byte[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#compress(byte[],%20int)">compress(byte[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
<dd>
<div class="block">Compress the uncompressed source image associated with this compressor
instance and output a JPEG image to the given destination buffer.</div>
<div class="block">Compress the uncompressed source image associated with this compressor
instance and return a buffer containing a JPEG image.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#compress(java.awt.image.BufferedImage, byte[], int)">compress(BufferedImage, byte[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#compress(java.awt.image.BufferedImage,%20byte[],%20int)">compress(BufferedImage, byte[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
<dd>
<div class="block"><span class="strong">Deprecated.</span>
<div class="block"><i>Use
- <a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><code>TJCompressor.setSourceImage(BufferedImage, int, int, int, int)</code></a> and
- <a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#compress(byte[], int)"><code>TJCompressor.compress(byte[], int)</code></a> instead.</i></div>
+ <a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>TJCompressor.setSourceImage(BufferedImage, int, int, int, int)</code></a> and
+ <a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#compress(byte[],%20int)"><code>TJCompressor.compress(byte[], int)</code></a> instead.</i></div>
</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#compress(java.awt.image.BufferedImage, int)">compress(BufferedImage, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#compress(java.awt.image.BufferedImage,%20int)">compress(BufferedImage, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
<dd>
<div class="block"><span class="strong">Deprecated.</span>
<div class="block"><i>Use
- <a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><code>TJCompressor.setSourceImage(BufferedImage, int, int, int, int)</code></a> and
+ <a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>TJCompressor.setSourceImage(BufferedImage, int, int, int, int)</code></a> and
<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#compress(int)"><code>TJCompressor.compress(int)</code></a> instead.</i></div>
</div>
</dd>
<dd>
<div class="block">YCCK colorspace.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCustomFilter.html#customFilter(java.nio.ShortBuffer, java.awt.Rectangle, java.awt.Rectangle, int, int, org.libjpegturbo.turbojpeg.TJTransform)">customFilter(ShortBuffer, Rectangle, Rectangle, int, int, TJTransform)</a></span> - Method in interface org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg">TJCustomFilter</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCustomFilter.html#customFilter(java.nio.ShortBuffer,%20java.awt.Rectangle,%20java.awt.Rectangle,%20int,%20int,%20org.libjpegturbo.turbojpeg.TJTransform)">customFilter(ShortBuffer, Rectangle, Rectangle, int, int, TJTransform)</a></span> - Method in interface org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg">TJCustomFilter</a></dt>
<dd>
<div class="block">A callback function that can be used to modify the DCT coefficients after
they are losslessly transformed but before they are transcoded to a new
</a>
<h2 class="title">D</h2>
<dl>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int, int, int)">decompress(byte[], int, int, int, int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)">decompress(byte[], int, int, int, int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
<dd>
<div class="block">Decompress the JPEG source image or decode the YUV source image associated
with this decompressor instance and output a grayscale, RGB, or CMYK image
to the given destination buffer.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)">decompress(byte[], int, int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int)">decompress(byte[], int, int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
<dd>
<div class="block"><span class="strong">Deprecated.</span>
<div class="block"><i>Use
- <a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int, int, int)"><code>TJDecompressor.decompress(byte[], int, int, int, int, int, int, int)</code></a> instead.</i></div>
+ <a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)"><code>TJDecompressor.decompress(byte[], int, int, int, int, int, int, int)</code></a> instead.</i></div>
</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int, int, int, int, int)">decompress(int, int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int,%20int,%20int,%20int,%20int)">decompress(int, int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
<dd>
<div class="block">Decompress the JPEG source image associated with this decompressor
instance and return a buffer containing the decompressed image.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int[], int, int, int, int, int, int, int)">decompress(int[], int, int, int, int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)">decompress(int[], int, int, int, int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
<dd>
<div class="block">Decompress the JPEG source image or decode the YUV source image associated
with this decompressor instance and output a grayscale, RGB, or CMYK image
to the given destination buffer.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(java.awt.image.BufferedImage, int)">decompress(BufferedImage, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(java.awt.image.BufferedImage,%20int)">decompress(BufferedImage, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
<dd>
<div class="block">Decompress the JPEG source image or decode the YUV source image associated
with this decompressor instance and output a decompressed/decoded image to
the given <code>BufferedImage</code> instance.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int, int, int, int)">decompress(int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int,%20int,%20int,%20int)">decompress(int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
<dd>
<div class="block">Decompress the JPEG source image or decode the YUV source image associated
with this decompressor instance and return a <code>BufferedImage</code>
instance containing the decompressed/decoded image.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage, int)">decompressToYUV(YUVImage, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)">decompressToYUV(YUVImage, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
<dd>
<div class="block">Decompress the JPEG source image associated with this decompressor
instance into a YUV planar image and store it in the given
<code>YUVImage</code> instance.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int)">decompressToYUV(byte[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[],%20int)">decompressToYUV(byte[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
<dd>
<div class="block"><span class="strong">Deprecated.</span>
-<div class="block"><i>Use <a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage, int)"><code>TJDecompressor.decompressToYUV(YUVImage, int)</code></a> instead.</i></div>
+<div class="block"><i>Use <a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)"><code>TJDecompressor.decompressToYUV(YUVImage, int)</code></a> instead.</i></div>
</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int, int, int, int)">decompressToYUV(int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int,%20int[],%20int,%20int)">decompressToYUV(int, int[], int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
<dd>
<div class="block">Decompress the JPEG source image associated with this decompressor
- instance into a YUV planar image and return a <code>YUVImage</code>
- instance containing the decompressed image.</div>
+ instance into a set of Y, U (Cb), and V (Cr) image planes and return a
+ <code>YUVImage</code> instance containing the decompressed image planes.</div>
+</dd>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int,%20int,%20int,%20int)">decompressToYUV(int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
+<dd>
+<div class="block">Decompress the JPEG source image associated with this decompressor
+ instance into a unified YUV planar image buffer and return a
+ <code>YUVImage</code> instance containing the decompressed image.</div>
</dd>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int)">decompressToYUV(int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
<dd>
<div class="block"><span class="strong">Deprecated.</span>
-<div class="block"><i>Use <a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int, int, int, int)"><code>TJDecompressor.decompressToYUV(int, int, int, int)</code></a> instead.</i></div>
+<div class="block"><i>Use <a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int,%20int,%20int,%20int)"><code>TJDecompressor.decompressToYUV(int, int, int, int)</code></a> instead.</i></div>
</div>
</dd>
</dl>
</a>
<h2 class="title">E</h2>
<dl>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(org.libjpegturbo.turbojpeg.YUVImage, int)">encodeYUV(YUVImage, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)">encodeYUV(YUVImage, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
<dd>
<div class="block">Encode the uncompressed source image associated with this compressor
instance into a YUV planar image and store it in the given
<code>YUVImage</code> instance.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[], int)">encodeYUV(byte[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[],%20int)">encodeYUV(byte[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
<dd>
<div class="block"><span class="strong">Deprecated.</span>
-<div class="block"><i>Use <a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(org.libjpegturbo.turbojpeg.YUVImage, int)"><code>TJCompressor.encodeYUV(YUVImage, int)</code></a> instead.</i></div>
+<div class="block"><i>Use <a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)"><code>TJCompressor.encodeYUV(YUVImage, int)</code></a> instead.</i></div>
</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int, int)">encodeYUV(int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int,%20int)">encodeYUV(int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
+<dd>
+<div class="block">Encode the uncompressed source image associated with this compressor
+ instance into a unified YUV planar image buffer and return a
+ <code>YUVImage</code> instance containing the encoded image.</div>
+</dd>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int[],%20int)">encodeYUV(int[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
<dd>
<div class="block">Encode the uncompressed source image associated with this compressor
- instance into a YUV planar image and return a <code>YUVImage</code>
- instance containing the encoded image.</div>
+ instance into separate Y, U (Cb), and V (Cr) image planes and return a
+ <code>YUVImage</code> instance containing the encoded image planes.</div>
</dd>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int)">encodeYUV(int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
<dd>
<div class="block"><span class="strong">Deprecated.</span>
-<div class="block"><i>Use <a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int, int)"><code>TJCompressor.encodeYUV(int, int)</code></a> instead.</i></div>
+<div class="block"><i>Use <a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int,%20int)"><code>TJCompressor.encodeYUV(int, int)</code></a> instead.</i></div>
</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(java.awt.image.BufferedImage, byte[], int)">encodeYUV(BufferedImage, byte[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(java.awt.image.BufferedImage,%20byte[],%20int)">encodeYUV(BufferedImage, byte[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
<dd>
<div class="block"><span class="strong">Deprecated.</span>
<div class="block"><i>Use
- <a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><code>TJCompressor.setSourceImage(BufferedImage, int, int, int, int)</code></a> and
- <a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[], int)"><code>TJCompressor.encodeYUV(byte[], int)</code></a> instead.</i></div>
+ <a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>TJCompressor.setSourceImage(BufferedImage, int, int, int, int)</code></a> and
+ <a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[],%20int)"><code>TJCompressor.encodeYUV(byte[], int)</code></a> instead.</i></div>
</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(java.awt.image.BufferedImage, int)">encodeYUV(BufferedImage, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(java.awt.image.BufferedImage,%20int)">encodeYUV(BufferedImage, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
<dd>
<div class="block"><span class="strong">Deprecated.</span>
<div class="block"><i>Use
- <a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><code>TJCompressor.setSourceImage(BufferedImage, int, int, int, int)</code></a> and
- <a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int)"><code>TJCompressor.encodeYUV(int)</code></a> instead.</i></div>
+ <a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>TJCompressor.setSourceImage(BufferedImage, int, int, int, int)</code></a> and
+ <a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int,%20int)"><code>TJCompressor.encodeYUV(int, int)</code></a> instead.</i></div>
</div>
</dd>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJScalingFactor.html#equals(org.libjpegturbo.turbojpeg.TJScalingFactor)">equals(TJScalingFactor)</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>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#getBuf()">getBuf()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
<dd>
-<div class="block">Returns the YUV image buffer</div>
+<div class="block">Returns the YUV image buffer (if this image is stored in a unified
+ buffer rather than separate image planes.)</div>
</dd>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getColorspace()">getColorspace()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
<dd>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#getCompressedSize()">getCompressedSize()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
<dd>
<div class="block">Returns the size of the image (in bytes) generated by the most recent
- compress/encode operation.</div>
+ compress operation.</div>
</dd>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJScalingFactor.html#getDenom()">getDenom()</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>
</dd>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#getHeight()">getHeight()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
<dd>
-<div class="block">Returns the height of the YUV image.</div>
+<div class="block">Returns the height of the YUV image (or subregion.)</div>
</dd>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGBuf()">getJPEGBuf()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
<dd>
-<div class="block"><span class="strong">Deprecated.</span>
-<div class="block"><i>Use <a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getSourceBuf()"><code>TJDecompressor.getSourceBuf()</code></a> instead.</i></div>
-</div>
+<div class="block">Returns the JPEG image buffer associated with this decompressor instance.</div>
</dd>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGSize()">getJPEGSize()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
<dd>
-<div class="block"><span class="strong">Deprecated.</span>
-<div class="block"><i>Use <a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getSourceSize()"><code>TJDecompressor.getSourceSize()</code></a> instead.</i></div>
-</div>
+<div class="block">Returns the size of the JPEG image (in bytes) associated with this
+ decompressor instance.</div>
</dd>
<dt><span class="strong"><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>
<dd>
<div class="block">Returns numerator</div>
</dd>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#getOffsets()">getOffsets()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
+<dd>
+<div class="block">Returns the offsets (in bytes) of each plane within the planes of a larger
+ YUV image.</div>
+</dd>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#getPad()">getPad()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
<dd>
-<div class="block">Returns the line padding used in the YUV image buffer.</div>
+<div class="block">Returns the line padding used in the YUV image buffer (if this image is
+ stored in a unified buffer rather than separate image planes.)</div>
</dd>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#getPixelSize(int)">getPixelSize(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 pixel size (in bytes) for the given pixel format.</div>
</dd>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#getPlanes()">getPlanes()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
+<dd>
+<div class="block">Returns the YUV image planes.</div>
+</dd>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#getRedOffset(int)">getRedOffset(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">For the given pixel format, returns the number of bytes that the red
<dd>
<div class="block">Returns the scaled value of <code>dimension</code>.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int, int)">getScaledHeight(int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int,%20int)">getScaledHeight(int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
<dd>
<div class="block">Returns the height of the largest scaled-down image that the TurboJPEG
decompressor can generate without exceeding the desired image width and
height.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int, int)">getScaledWidth(int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int,%20int)">getScaledWidth(int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
<dd>
<div class="block">Returns the width of the largest scaled-down image that the TurboJPEG
decompressor can generate without exceeding the desired image width and
</dd>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#getSize()">getSize()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
<dd>
-<div class="block">Returns the size (in bytes) of the YUV image buffer</div>
+<div class="block">Returns the size (in bytes) of the YUV image buffer (if this image is
+ stored in a unified buffer rather than separate image planes.)</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getSourceBuf()">getSourceBuf()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#getStrides()">getStrides()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
<dd>
-<div class="block">Returns the source image buffer associated with this decompressor
- instance.</div>
-</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getSourceSize()">getSourceSize()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
-<dd>
-<div class="block">Returns the size of the source image (in bytes) associated with this
- decompressor instance.</div>
+<div class="block">Returns the number of bytes per line of each plane in the YUV image.</div>
</dd>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getSubsamp()">getSubsamp()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
<dd>
</dd>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#getWidth()">getWidth()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
<dd>
-<div class="block">Returns the width of the YUV image.</div>
+<div class="block">Returns the width of the YUV image (or subregion.)</div>
</dd>
</dl>
<a name="_H_">
<dd> </dd>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegBufSize">jpegBufSize</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
<dd> </dd>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegColorspace">jpegColorspace</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
+<dd> </dd>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegHeight">jpegHeight</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
+<dd> </dd>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegSubsamp">jpegSubsamp</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
+<dd> </dd>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegWidth">jpegWidth</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
+<dd> </dd>
</dl>
<a name="_N_">
<!-- -->
</dd>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_NOOUTPUT">OPT_NOOUTPUT</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">This option will prevent <a href="./org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)"><code>TJTransformer.transform()</code></a> from outputting a JPEG image for this
+<div class="block">This option will prevent <a href="./org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)"><code>TJTransformer.transform()</code></a> from outputting a JPEG image for this
particular transform.</div>
</dd>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT">OPT_PERFECT</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">This option will cause <a href="./org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)"><code>TJTransformer.transform()</code></a> to throw an exception if the transform is not
+<div class="block">This option will cause <a href="./org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)"><code>TJTransformer.transform()</code></a> to throw an exception if the transform is not
perfect.</div>
</dd>
<dt><span class="strong"><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">XRGB pixel format.</div>
</dd>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#planeHeight(int,%20int,%20int)">planeHeight(int, int, 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 plane height of a YUV image plane with the given parameters.</div>
+</dd>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#planeSizeYUV(int,%20int,%20int,%20int,%20int)">planeSizeYUV(int, int, int, int, 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 size of the buffer (in bytes) required to hold a YUV image
+ plane with the given parameters.</div>
+</dd>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#planeWidth(int,%20int,%20int)">planeWidth(int, int, 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 plane width of a YUV image plane with the given parameters.</div>
+</dd>
</dl>
<a name="_S_">
<!-- -->
<dd>
<div class="block">Grayscale.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#setBuf(byte[], int, int, int, int)">setBuf(byte[], int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#setBuf(byte[][],%20int[],%20int,%20int[],%20int,%20int)">setBuf(byte[][], int[], int, int[], int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
<dd>
-<div class="block">Assign an existing YUV planar image buffer to this <code>YUVImage</code>
- instance.</div>
+<div class="block">Assign a set of image planes to this <code>YUVImage</code> instance.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGImage(byte[], int)">setJPEGImage(byte[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#setBuf(byte[],%20int,%20int,%20int,%20int)">setBuf(byte[], int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
+<dd>
+<div class="block">Assign a unified image buffer to this <code>YUVImage</code> instance.</div>
+</dd>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGImage(byte[],%20int)">setJPEGImage(byte[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
<dd>
<div class="block"><span class="strong">Deprecated.</span>
-<div class="block"><i>Use <a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte[], int)"><code>TJDecompressor.setSourceImage(byte[], int)</code></a> instead.</i></div>
+<div class="block"><i>Use <a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte[],%20int)"><code>TJDecompressor.setSourceImage(byte[], int)</code></a> instead.</i></div>
</div>
</dd>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setJPEGQuality(int)">setJPEGQuality(int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
<dd>
<div class="block">Set the JPEG image quality level for subsequent compress operations.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int, int, int)">setSourceImage(byte[], int, int, int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)">setSourceImage(byte[], int, int, int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
<dd>
<div class="block">Associate an uncompressed RGB, grayscale, or CMYK source image with this
compressor instance.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int)">setSourceImage(byte[], int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int)">setSourceImage(byte[], int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
<dd>
<div class="block"><span class="strong">Deprecated.</span>
<div class="block"><i>Use
- <a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int, int, int)"><code>TJCompressor.setSourceImage(byte[], int, int, int, int, int, int)</code></a> instead.</i></div>
+ <a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>TJCompressor.setSourceImage(byte[], int, int, int, int, int, int)</code></a> instead.</i></div>
</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)">setSourceImage(BufferedImage, int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)">setSourceImage(BufferedImage, int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
<dd>
<div class="block">Associate an uncompressed RGB or grayscale source image with this
compressor instance.</div>
<div class="block">Associate an uncompressed YUV planar source image with this compressor
instance.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte[], int)">setSourceImage(byte[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte[],%20int)">setSourceImage(byte[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
<dd>
<div class="block">Associate the JPEG image of length <code>imageSize</code> bytes stored in
- <code>srcImage</code> with this decompressor instance.</div>
+ <code>jpegImage</code> with this decompressor instance.</div>
</dd>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)">setSourceImage(YUVImage)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
<dd>
<div class="block">Set the level of chrominance subsampling for subsequent compress/encode
operations.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#srcColorspace">srcColorspace</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
-<dd> </dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#srcHeight">srcHeight</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
-<dd> </dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#srcSubsamp">srcSubsamp</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
-<dd> </dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#srcWidth">srcWidth</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
-<dd> </dd>
</dl>
<a name="_T_">
<!-- -->
<dd>
<div class="block">Create a TurboJPEG compressor instance.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[], int, int, int, int, int, int)">TJCompressor(byte[], int, int, int, int, int, int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[],%20int,%20int,%20int,%20int,%20int,%20int)">TJCompressor(byte[], int, int, int, int, int, int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
<dd>
<div class="block">Create a TurboJPEG compressor instance and associate the uncompressed
source image stored in <code>srcImage</code> with the newly created
instance.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[], int, int, int, int)">TJCompressor(byte[], int, int, int, int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[],%20int,%20int,%20int,%20int)">TJCompressor(byte[], int, int, int, int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
<dd>
<div class="block"><span class="strong">Deprecated.</span>
<div class="block"><i>Use
- <a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[], int, int, int, int, int, int)"><code>TJCompressor.TJCompressor(byte[], int, int, int, int, int, int)</code></a> instead.</i></div>
+ <a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>TJCompressor.TJCompressor(byte[], int, int, int, int, int, int)</code></a> instead.</i></div>
</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(java.awt.image.BufferedImage, int, int, int, int)">TJCompressor(BufferedImage, int, int, int, int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)">TJCompressor(BufferedImage, int, int, int, int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
<dd>
<div class="block">Create a TurboJPEG compressor instance and associate the uncompressed
source image stored in <code>srcImage</code> with the newly created
<div class="block">Create a TurboJPEG decompressor instance and associate the JPEG source
image stored in <code>jpegImage</code> with the newly created instance.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(byte[], int)">TJDecompressor(byte[], int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(byte[],%20int)">TJDecompressor(byte[], int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
<dd>
<div class="block">Create a TurboJPEG decompressor instance and associate the JPEG source
image of length <code>imageSize</code> bytes stored in
<dd>
<div class="block">Fractional scaling factor</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJScalingFactor.html#TJScalingFactor(int, int)">TJScalingFactor(int, int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJScalingFactor.html#TJScalingFactor(int,%20int)">TJScalingFactor(int, int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</a></dt>
<dd> </dd>
<dt><a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><span class="strong">TJTransform</span></a> - Class in <a href="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</a></dt>
<dd>
<dd>
<div class="block">Create a new lossless transform instance.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#TJTransform(int, int, int, int, int, int, org.libjpegturbo.turbojpeg.TJCustomFilter)">TJTransform(int, int, int, int, int, int, TJCustomFilter)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#TJTransform(int,%20int,%20int,%20int,%20int,%20int,%20org.libjpegturbo.turbojpeg.TJCustomFilter)">TJTransform(int, int, int, int, int, int, TJCustomFilter)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
<dd>
<div class="block">Create a new lossless transform instance with the given parameters.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#TJTransform(java.awt.Rectangle, int, int, org.libjpegturbo.turbojpeg.TJCustomFilter)">TJTransform(Rectangle, int, int, TJCustomFilter)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#TJTransform(java.awt.Rectangle,%20int,%20int,%20org.libjpegturbo.turbojpeg.TJCustomFilter)">TJTransform(Rectangle, int, int, TJCustomFilter)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
<dd>
<div class="block">Create a new lossless transform instance with the given parameters.</div>
</dd>
<div class="block">Create a TurboJPEG lossless transformer instance and associate the JPEG
image stored in <code>jpegImage</code> with the newly created instance.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransformer.html#TJTransformer(byte[], int)">TJTransformer(byte[], int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransformer.html#TJTransformer(byte[],%20int)">TJTransformer(byte[], int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</a></dt>
<dd>
<div class="block">Create a TurboJPEG lossless transformer instance and associate the JPEG
image of length <code>imageSize</code> bytes stored in
<code>jpegImage</code> with the newly created instance.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)">transform(byte[][], TJTransform[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)">transform(byte[][], TJTransform[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</a></dt>
<dd>
<div class="block">Losslessly transform the JPEG image associated with this transformer
instance into one or more JPEG images stored in the given destination
buffers.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransformer.html#transform(org.libjpegturbo.turbojpeg.TJTransform[], int)">transform(TJTransform[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</a></dt>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransformer.html#transform(org.libjpegturbo.turbojpeg.TJTransform[],%20int)">transform(TJTransform[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</a></dt>
<dd>
<div class="block">Losslessly transform the JPEG image associated with this transformer
instance and return an array of <a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><code>TJDecompressor</code></a> instances, each of
</a>
<h2 class="title">Y</h2>
<dl>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#yuvBuf">yuvBuf</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
-<dd> </dd>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#yuvHeight">yuvHeight</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#yuvImage">yuvImage</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
<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>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(int,%20int[],%20int,%20int)">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>
+<dd>
+<div class="block">Create a new <code>YUVImage</code> instance backed by separate image
+ planes, and allocate memory for the image planes.</div>
+</dd>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(int,%20int,%20int,%20int)">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>
<dd>
-<div class="block">Create a <code>YUVImage</code> instance with a new image buffer.</div>
+<div class="block">Create a new <code>YUVImage</code> instance backed by a unified image
+ buffer, and allocate memory for the image buffer.</div>
</dd>
-<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(byte[], int, int, int, int)">YUVImage(byte[], 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>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(byte[][],%20int[],%20int,%20int[],%20int,%20int)">YUVImage(byte[][], int[], 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>
<dd>
-<div class="block">Create a <code>YUVImage</code> instance from an existing YUV planar image
+<div class="block">Create a new <code>YUVImage</code> instance from a set of existing image
+ planes.</div>
+</dd>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(byte[],%20int,%20int,%20int,%20int)">YUVImage(byte[], 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>
+<dd>
+<div class="block">Create a new <code>YUVImage</code> instance from an existing unified image
buffer.</div>
</dd>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#yuvOffsets">yuvOffsets</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
+<dd> </dd>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#yuvPad">yuvPad</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
<dd> </dd>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#yuvPlanes">yuvPlanes</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
+<dd> </dd>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#yuvStrides">yuvStrides</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
+<dd> </dd>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#yuvSubsamp">yuvSubsamp</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#yuvWidth">yuvWidth</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
if (targetPage.indexOf(":") != -1 || (targetPage != "" && !validURL(targetPage)))
targetPage = "undefined";
function validURL(url) {
+ try {
+ url = decodeURIComponent(url);
+ }
+ catch (error) {
+ return false;
+ }
var pos = url.indexOf(".html");
if (pos == -1 || pos != url.length - 5)
return false;
if ('a' <= ch && ch <= 'z' ||
'A' <= ch && ch <= 'Z' ||
ch == '$' ||
- ch == '_') {
+ ch == '_' ||
+ ch.charCodeAt(0) > 127) {
allowNumber = true;
allowSep = true;
} else if ('0' <= ch && ch <= '9'
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSize(int, int, int)">bufSize</a></strong>(int width,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSize(int,%20int,%20int)">bufSize</a></strong>(int width,
int height,
int jpegSubsamp)</code>
<div class="block">Returns the maximum size of the buffer (in bytes) required to hold a JPEG
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int)">bufSizeYUV</a></strong>(int width,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int,%20int,%20int)">bufSizeYUV</a></strong>(int width,
int height,
int subsamp)</code>
<div class="block"><strong>Deprecated.</strong>
-<div class="block"><i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int, int)"><code>bufSizeYUV(int, int, int, int)</code></a> instead.</i></div>
+<div class="block"><i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int,%20int,%20int,%20int)"><code>bufSizeYUV(int, int, int, int)</code></a> instead.</i></div>
</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int, int)">bufSizeYUV</a></strong>(int width,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int,%20int,%20int,%20int)">bufSizeYUV</a></strong>(int width,
int pad,
int height,
int subsamp)</code>
this implementation of TurboJPEG supports.</div>
</td>
</tr>
+<tr class="altColor">
+<td class="colFirst"><code>static int</code></td>
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeHeight(int,%20int,%20int)">planeHeight</a></strong>(int componentID,
+ int height,
+ int subsamp)</code>
+<div class="block">Returns the plane height of a YUV image plane with the given parameters.</div>
+</td>
+</tr>
+<tr class="rowColor">
+<td class="colFirst"><code>static int</code></td>
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeSizeYUV(int,%20int,%20int,%20int,%20int)">planeSizeYUV</a></strong>(int componentID,
+ int width,
+ int stride,
+ int height,
+ int subsamp)</code>
+<div class="block">Returns the size of the buffer (in bytes) required to hold a YUV image
+ plane with the given parameters.</div>
+</td>
+</tr>
+<tr class="altColor">
+<td class="colFirst"><code>static int</code></td>
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeWidth(int,%20int,%20int)">planeWidth</a></strong>(int componentID,
+ int width,
+ int subsamp)</code>
+<div class="block">Returns the plane width of a YUV image plane with the given parameters.</div>
+</td>
+</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
subsampling.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>subsamp</code> - the level of chrominance subsampling (one of
<code>SAMP_*</code>)</dd>
-<dt><span class="strong">Returns:</span></dt><dd>the MCU block width for the given level of chrominance subsampling</dd>
+<dt><span class="strong">Returns:</span></dt><dd>the MCU block width for the given level of chrominance
+ subsampling.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>subsamp</code> - the level of chrominance subsampling (one of
<code>SAMP_*</code>)</dd>
<dt><span class="strong">Returns:</span></dt><dd>the MCU block height for the given level of chrominance
- subsampling</dd>
+ subsampling.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
throws java.lang.Exception</pre>
<div class="block">Returns the pixel size (in bytes) for the given pixel format.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
-<dt><span class="strong">Returns:</span></dt><dd>the pixel size (in bytes) for the given pixel format</dd>
+<dt><span class="strong">Returns:</span></dt><dd>the pixel size (in bytes) for the given pixel format.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
then the red component will be
<code>pixel[TJ.getRedOffset(TJ.PF_BGRX)]</code>.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
-<dt><span class="strong">Returns:</span></dt><dd>the red offset for the given pixel format</dd>
+<dt><span class="strong">Returns:</span></dt><dd>the red offset for the given pixel format.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
then the green component will be
<code>pixel[TJ.getGreenOffset(TJ.PF_BGRX)]</code>.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
-<dt><span class="strong">Returns:</span></dt><dd>the green offset for the given pixel format</dd>
+<dt><span class="strong">Returns:</span></dt><dd>the green offset for the given pixel format.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
then the blue component will be
<code>pixel[TJ.getBlueOffset(TJ.PF_BGRX)]</code>.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
-<dt><span class="strong">Returns:</span></dt><dd>the blue offset for the given pixel format</dd>
+<dt><span class="strong">Returns:</span></dt><dd>the blue offset for the given pixel format.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>width</code> - the width (in pixels) of the JPEG image</dd><dd><code>height</code> - the height (in pixels) of the JPEG image</dd><dd><code>jpegSubsamp</code> - the level of chrominance subsampling to be used when
generating the JPEG image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><code>TJ.SAMP_*</code></a>)</dd>
<dt><span class="strong">Returns:</span></dt><dd>the maximum size of the buffer (in bytes) required to hold a JPEG
- image with the given width, height, and level of chrominance subsampling</dd>
+ image with the given width, height, and level of chrominance subsampling.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
<div class="block">Returns the size of the buffer (in bytes) required to hold a YUV planar
image with the given width, height, and level of chrominance subsampling.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>width</code> - the width (in pixels) of the YUV image</dd><dd><code>pad</code> - the width of each line in each plane of the image is padded to
- the nearest multiple of this number of bytes (must be a power of
- 2.)</dd><dd><code>height</code> - the height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV
+ the nearest multiple of this number of bytes (must be a power of 2.)</dd><dd><code>height</code> - the 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" title="class in org.libjpegturbo.turbojpeg"><code>TJ.SAMP_*</code></a>)</dd>
<dt><span class="strong">Returns:</span></dt><dd>the size of the buffer (in bytes) required to hold a YUV planar
- image with the given width, height, and level of chrominance subsampling</dd>
+ image with the given width, height, and level of chrominance subsampling.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
int height,
int subsamp)
throws java.lang.Exception</pre>
-<div class="block"><span class="strong">Deprecated.</span> <i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int, int)"><code>bufSizeYUV(int, int, int, int)</code></a> instead.</i></div>
+<div class="block"><span class="strong">Deprecated.</span> <i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int,%20int,%20int,%20int)"><code>bufSizeYUV(int, int, int, int)</code></a> instead.</i></div>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
</ul>
+<a name="planeSizeYUV(int, int, int, int, int)">
+<!-- -->
+</a>
+<ul class="blockList">
+<li class="blockList">
+<h4>planeSizeYUV</h4>
+<pre>public static int planeSizeYUV(int componentID,
+ int width,
+ int stride,
+ int height,
+ int subsamp)
+ throws java.lang.Exception</pre>
+<div class="block">Returns the size of the buffer (in bytes) required to hold a YUV image
+ plane with the given parameters.</div>
+<dl><dt><span class="strong">Parameters:</span></dt><dd><code>componentID</code> - ID number of the image plane (0 = Y, 1 = U/Cb,
+ 2 = V/Cr)</dd><dd><code>width</code> - width (in pixels) of the YUV image. NOTE: this is the width
+ of the whole image, not the plane width.</dd><dd><code>stride</code> - bytes per line in the image plane.</dd><dd><code>height</code> - height (in pixels) of the YUV image. NOTE: this is the
+ height of the whole image, not the plane height.</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV
+ image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><code>TJ.SAMP_*</code></a>)</dd>
+<dt><span class="strong">Returns:</span></dt><dd>the size of the buffer (in bytes) required to hold a YUV planar
+ image with the given parameters.</dd>
+<dt><span class="strong">Throws:</span></dt>
+<dd><code>java.lang.Exception</code></dd></dl>
+</li>
+</ul>
+<a name="planeWidth(int, int, int)">
+<!-- -->
+</a>
+<ul class="blockList">
+<li class="blockList">
+<h4>planeWidth</h4>
+<pre>public static int planeWidth(int componentID,
+ int width,
+ int subsamp)
+ throws java.lang.Exception</pre>
+<div class="block">Returns the plane width of a YUV image plane with the given parameters.
+ Refer to <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> for a description of plane width.</div>
+<dl><dt><span class="strong">Parameters:</span></dt><dd><code>componentID</code> - ID number of the image plane (0 = Y, 1 = U/Cb,
+ 2 = V/Cr)</dd><dd><code>width</code> - width (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" title="class in org.libjpegturbo.turbojpeg"><code>TJ.SAMP_*</code></a>)</dd>
+<dt><span class="strong">Returns:</span></dt><dd>the plane width of a YUV image plane with the given parameters.</dd>
+<dt><span class="strong">Throws:</span></dt>
+<dd><code>java.lang.Exception</code></dd></dl>
+</li>
+</ul>
+<a name="planeHeight(int, int, int)">
+<!-- -->
+</a>
+<ul class="blockList">
+<li class="blockList">
+<h4>planeHeight</h4>
+<pre>public static int planeHeight(int componentID,
+ int height,
+ int subsamp)
+ throws java.lang.Exception</pre>
+<div class="block">Returns the plane height of a YUV image plane with the given parameters.
+ Refer to <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> for a description of plane height.</div>
+<dl><dt><span class="strong">Parameters:</span></dt><dd><code>componentID</code> - ID number of the image plane (0 = Y, 1 = U/Cb,
+ 2 = V/Cr)</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" title="class in org.libjpegturbo.turbojpeg"><code>TJ.SAMP_*</code></a>)</dd>
+<dt><span class="strong">Returns:</span></dt><dd>the plane height of a YUV image plane with the given parameters.</dd>
+<dt><span class="strong">Throws:</span></dt>
+<dd><code>java.lang.Exception</code></dd></dl>
+</li>
+</ul>
<a name="getScalingFactors()">
<!-- -->
</a>
<div class="block">Returns a list of fractional scaling factors that the JPEG decompressor in
this implementation of TurboJPEG supports.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>a list of fractional scaling factors that the JPEG decompressor in
- this implementation of TurboJPEG supports</dd>
+ this implementation of TurboJPEG supports.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
</td>
</tr>
<tr class="rowColor">
-<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(java.awt.image.BufferedImage, int, int, int, int)">TJCompressor</a></strong>(java.awt.image.BufferedImage srcImage,
+<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)">TJCompressor</a></strong>(java.awt.image.BufferedImage srcImage,
int x,
int y,
int width,
</td>
</tr>
<tr class="altColor">
-<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[], int, int, int, int)">TJCompressor</a></strong>(byte[] srcImage,
+<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[],%20int,%20int,%20int,%20int)">TJCompressor</a></strong>(byte[] srcImage,
int width,
int pitch,
int height,
int pixelFormat)</code>
<div class="block"><strong>Deprecated.</strong>
<div class="block"><i>Use
- <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[], int, int, int, int, int, int)"><code>TJCompressor(byte[], int, int, int, int, int, int)</code></a> instead.</i></div>
+ <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>TJCompressor(byte[], int, int, int, int, int, int)</code></a> instead.</i></div>
</div>
</td>
</tr>
<tr class="rowColor">
-<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[], int, int, int, int, int, int)">TJCompressor</a></strong>(byte[] srcImage,
+<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[],%20int,%20int,%20int,%20int,%20int,%20int)">TJCompressor</a></strong>(byte[] srcImage,
int x,
int y,
int width,
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(java.awt.image.BufferedImage, byte[], int)">compress</a></strong>(java.awt.image.BufferedImage srcImage,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(java.awt.image.BufferedImage,%20byte[],%20int)">compress</a></strong>(java.awt.image.BufferedImage srcImage,
byte[] dstBuf,
int flags)</code>
<div class="block"><strong>Deprecated.</strong>
<div class="block"><i>Use
- <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> and
- <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(byte[], int)"><code>compress(byte[], int)</code></a> instead.</i></div>
+ <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> and
+ <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(byte[],%20int)"><code>compress(byte[], int)</code></a> instead.</i></div>
</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>byte[]</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(java.awt.image.BufferedImage, int)">compress</a></strong>(java.awt.image.BufferedImage srcImage,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(java.awt.image.BufferedImage,%20int)">compress</a></strong>(java.awt.image.BufferedImage srcImage,
int flags)</code>
<div class="block"><strong>Deprecated.</strong>
<div class="block"><i>Use
- <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> and
+ <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> and
<a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(int)"><code>compress(int)</code></a> instead.</i></div>
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(byte[], int)">compress</a></strong>(byte[] dstBuf,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(byte[],%20int)">compress</a></strong>(byte[] dstBuf,
int flags)</code>
<div class="block">Compress the uncompressed source image associated with this compressor
instance and output a JPEG image to the given destination buffer.</div>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(java.awt.image.BufferedImage, byte[], int)">encodeYUV</a></strong>(java.awt.image.BufferedImage srcImage,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(java.awt.image.BufferedImage,%20byte[],%20int)">encodeYUV</a></strong>(java.awt.image.BufferedImage srcImage,
byte[] dstBuf,
int flags)</code>
<div class="block"><strong>Deprecated.</strong>
<div class="block"><i>Use
- <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> and
- <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[], int)"><code>encodeYUV(byte[], int)</code></a> instead.</i></div>
+ <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> and
+ <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[],%20int)"><code>encodeYUV(byte[], int)</code></a> instead.</i></div>
</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>byte[]</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(java.awt.image.BufferedImage, int)">encodeYUV</a></strong>(java.awt.image.BufferedImage srcImage,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(java.awt.image.BufferedImage,%20int)">encodeYUV</a></strong>(java.awt.image.BufferedImage srcImage,
int flags)</code>
<div class="block"><strong>Deprecated.</strong>
<div class="block"><i>Use
- <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> and
- <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int)"><code>encodeYUV(int)</code></a> instead.</i></div>
+ <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> and
+ <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int,%20int)"><code>encodeYUV(int, int)</code></a> instead.</i></div>
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[], int)">encodeYUV</a></strong>(byte[] dstBuf,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[],%20int)">encodeYUV</a></strong>(byte[] dstBuf,
int flags)</code>
<div class="block"><strong>Deprecated.</strong>
-<div class="block"><i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(org.libjpegturbo.turbojpeg.YUVImage, int)"><code>encodeYUV(YUVImage, int)</code></a> instead.</i></div>
+<div class="block"><i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)"><code>encodeYUV(YUVImage, int)</code></a> instead.</i></div>
</div>
</td>
</tr>
<td class="colFirst"><code>byte[]</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int)">encodeYUV</a></strong>(int flags)</code>
<div class="block"><strong>Deprecated.</strong>
-<div class="block"><i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int, int)"><code>encodeYUV(int, int)</code></a> instead.</i></div>
+<div class="block"><i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int,%20int)"><code>encodeYUV(int, int)</code></a> instead.</i></div>
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int, int)">encodeYUV</a></strong>(int pad,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int[],%20int)">encodeYUV</a></strong>(int[] strides,
int flags)</code>
<div class="block">Encode the uncompressed source image associated with this compressor
- instance into a YUV planar image and return a <code>YUVImage</code>
- instance containing the encoded image.</div>
+ instance into separate Y, U (Cb), and V (Cr) image planes and return a
+ <code>YUVImage</code> instance containing the encoded image planes.</div>
</td>
</tr>
<tr class="altColor">
+<td class="colFirst"><code><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></code></td>
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int,%20int)">encodeYUV</a></strong>(int pad,
+ int flags)</code>
+<div class="block">Encode the uncompressed source image associated with this compressor
+ instance into a unified YUV planar image buffer and return a
+ <code>YUVImage</code> instance containing the encoded image.</div>
+</td>
+</tr>
+<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(org.libjpegturbo.turbojpeg.YUVImage, int)">encodeYUV</a></strong>(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> dstImage,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)">encodeYUV</a></strong>(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> dstImage,
int flags)</code>
<div class="block">Encode the uncompressed source image associated with this compressor
instance into a YUV planar image and store it in the given
<code>YUVImage</code> instance.</div>
</td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><code>protected void</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#finalize()">finalize</a></strong>()</code> </td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#getCompressedSize()">getCompressedSize</a></strong>()</code>
<div class="block">Returns the size of the image (in bytes) generated by the most recent
- compress/encode operation.</div>
+ compress operation.</div>
</td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setJPEGQuality(int)">setJPEGQuality</a></strong>(int quality)</code>
<div class="block">Set the JPEG image quality level for subsequent compress operations.</div>
</td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)">setSourceImage</a></strong>(java.awt.image.BufferedImage srcImage,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)">setSourceImage</a></strong>(java.awt.image.BufferedImage srcImage,
int x,
int y,
int width,
compressor instance.</div>
</td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><code>void</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int)">setSourceImage</a></strong>(byte[] srcImage,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int)">setSourceImage</a></strong>(byte[] srcImage,
int width,
int pitch,
int height,
int pixelFormat)</code>
<div class="block"><strong>Deprecated.</strong>
<div class="block"><i>Use
- <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int, int, int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> instead.</i></div>
+ <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> instead.</i></div>
</div>
</td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int, int, int)">setSourceImage</a></strong>(byte[] srcImage,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)">setSourceImage</a></strong>(byte[] srcImage,
int x,
int y,
int width,
compressor instance.</div>
</td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)">setSourceImage</a></strong>(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> srcImage)</code>
<div class="block">Associate an uncompressed YUV planar source image with this compressor
instance.</div>
</td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSubsamp(int)">setSubsamp</a></strong>(int newSubsamp)</code>
<div class="block">Set the level of chrominance subsampling for subsequent compress/encode
<div class="block">Create a TurboJPEG compressor instance and associate the uncompressed
source image stored in <code>srcImage</code> with the newly created
instance.</div>
-<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int, int, int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>x</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int, int, int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>y</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int, int, int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>width</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int, int, int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>pitch</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int, int, int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>height</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int, int, int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>pixelFormat</code> - pixel format of the source image (one of
+<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>x</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>y</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>width</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>pitch</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>height</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>pixelFormat</code> - pixel format of the source image (one of
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB"><code>TJ.PF_*</code></a>)</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
int pixelFormat)
throws java.lang.Exception</pre>
<div class="block"><span class="strong">Deprecated.</span> <i>Use
- <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[], int, int, int, int, int, int)"><code>TJCompressor(byte[], int, int, int, int, int, int)</code></a> instead.</i></div>
+ <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>TJCompressor(byte[], int, int, int, int, int, int)</code></a> instead.</i></div>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
source image stored in <code>srcImage</code> with the newly created
instance.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - see
- <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> for description</dd><dd><code>x</code> - see
- <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> for description</dd><dd><code>y</code> - see
- <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> for description</dd><dd><code>width</code> - see
- <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> for description</dd><dd><code>height</code> - see
- <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> for description</dd>
+ <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> for description</dd><dd><code>x</code> - see
+ <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> for description</dd><dd><code>y</code> - see
+ <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> for description</dd><dd><code>width</code> - see
+ <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> for description</dd><dd><code>height</code> - see
+ <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> for description</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
int pixelFormat)
throws java.lang.Exception</pre>
<div class="block"><span class="strong">Deprecated.</span> <i>Use
- <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int, int, int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> instead.</i></div>
+ <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> instead.</i></div>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
<div class="block">Compress the uncompressed source image associated with this compressor
instance and output a JPEG image to the given destination buffer.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstBuf</code> - buffer that will receive the JPEG image. Use
- <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSize(int, int, int)"><code>TJ.bufSize(int, int, int)</code></a> to determine the maximum size for this buffer based on
+ <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSize(int,%20int,%20int)"><code>TJ.bufSize(int, int, int)</code></a> to determine the maximum size for this buffer based on
the source image's width and height and the desired level of chrominance
subsampling.</dd><dd><code>flags</code> - the bitwise OR of one or more of
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
int flags)
throws java.lang.Exception</pre>
<div class="block"><span class="strong">Deprecated.</span> <i>Use
- <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> and
- <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(byte[], int)"><code>compress(byte[], int)</code></a> instead.</i></div>
+ <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> and
+ <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(byte[],%20int)"><code>compress(byte[], int)</code></a> instead.</i></div>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
int flags)
throws java.lang.Exception</pre>
<div class="block"><span class="strong">Deprecated.</span> <i>Use
- <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> and
+ <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> and
<a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(int)"><code>compress(int)</code></a> instead.</i></div>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
public void encodeYUV(byte[] dstBuf,
int flags)
throws java.lang.Exception</pre>
-<div class="block"><span class="strong">Deprecated.</span> <i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(org.libjpegturbo.turbojpeg.YUVImage, int)"><code>encodeYUV(YUVImage, int)</code></a> instead.</i></div>
+<div class="block"><span class="strong">Deprecated.</span> <i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)"><code>encodeYUV(YUVImage, int)</code></a> instead.</i></div>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
int flags)
throws java.lang.Exception</pre>
<div class="block">Encode the uncompressed source image associated with this compressor
- instance into a YUV planar image and return a <code>YUVImage</code>
- instance containing the encoded image. This method uses the accelerated
- color conversion routines in TurboJPEG's underlying codec but does not
- execute any of the other steps in the JPEG compression process. Encoding
- CMYK source images to YUV is not supported.</div>
+ instance into a unified YUV planar image buffer and return a
+ <code>YUVImage</code> instance containing the encoded image. This method
+ uses the accelerated color conversion routines in TurboJPEG's underlying
+ codec but does not execute any of the other steps in the JPEG compression
+ process. Encoding CMYK source images to YUV is not supported.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pad</code> - the width of each line in each plane of the YUV image will be
padded to the nearest multiple of this number of bytes (must be a power of
2.)</dd><dd><code>flags</code> - the bitwise OR of one or more of
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
-<dt><span class="strong">Returns:</span></dt><dd>a YUV planar image</dd>
+<dt><span class="strong">Returns:</span></dt><dd>a YUV planar image.</dd>
+<dt><span class="strong">Throws:</span></dt>
+<dd><code>java.lang.Exception</code></dd></dl>
+</li>
+</ul>
+<a name="encodeYUV(int[], int)">
+<!-- -->
+</a>
+<ul class="blockList">
+<li class="blockList">
+<h4>encodeYUV</h4>
+<pre>public <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> encodeYUV(int[] strides,
+ int flags)
+ throws java.lang.Exception</pre>
+<div class="block">Encode the uncompressed source image associated with this compressor
+ instance into separate Y, U (Cb), and V (Cr) image planes and return a
+ <code>YUVImage</code> instance containing the encoded image planes. This
+ method uses the accelerated color conversion routines in TurboJPEG's
+ underlying codec but does not execute any of the other steps in the JPEG
+ compression process. Encoding CMYK source images to YUV is not supported.</div>
+<dl><dt><span class="strong">Parameters:</span></dt><dd><code>strides</code> - an array of integers, each specifying the number of bytes
+ per line in the corresponding plane of the output image. Setting the
+ stride for any plane to 0 is the same as setting it to the component width
+ of the plane. If <code>strides</code> is null, then the strides for all
+ planes will be set to their respective component widths. You can adjust
+ the strides in order to add an arbitrary amount of line padding to each
+ plane.</dd><dd><code>flags</code> - the bitwise OR of one or more of
+ <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
+<dt><span class="strong">Returns:</span></dt><dd>a YUV planar image.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
<pre>@Deprecated
public byte[] encodeYUV(int flags)
throws java.lang.Exception</pre>
-<div class="block"><span class="strong">Deprecated.</span> <i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int, int)"><code>encodeYUV(int, int)</code></a> instead.</i></div>
+<div class="block"><span class="strong">Deprecated.</span> <i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int,%20int)"><code>encodeYUV(int, int)</code></a> instead.</i></div>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
int flags)
throws java.lang.Exception</pre>
<div class="block"><span class="strong">Deprecated.</span> <i>Use
- <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> and
- <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[], int)"><code>encodeYUV(byte[], int)</code></a> instead.</i></div>
+ <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> and
+ <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[],%20int)"><code>encodeYUV(byte[], int)</code></a> instead.</i></div>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
int flags)
throws java.lang.Exception</pre>
<div class="block"><span class="strong">Deprecated.</span> <i>Use
- <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> and
- <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int)"><code>encodeYUV(int)</code></a> instead.</i></div>
+ <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)"><code>setSourceImage(BufferedImage, int, int, int, int)</code></a> and
+ <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int,%20int)"><code>encodeYUV(int, int)</code></a> instead.</i></div>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
<h4>getCompressedSize</h4>
<pre>public int getCompressedSize()</pre>
<div class="block">Returns the size of the image (in bytes) generated by the most recent
- compress/encode operation.</div>
+ compress operation.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>the size of the image (in bytes) generated by the most recent
- compress/encode operation</dd></dl>
+ compress operation.</dd></dl>
</li>
</ul>
<a name="close()">
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html#customFilter(java.nio.ShortBuffer, java.awt.Rectangle, java.awt.Rectangle, int, int, org.libjpegturbo.turbojpeg.TJTransform)">customFilter</a></strong>(java.nio.ShortBuffer coeffBuffer,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html#customFilter(java.nio.ShortBuffer,%20java.awt.Rectangle,%20java.awt.Rectangle,%20int,%20int,%20org.libjpegturbo.turbojpeg.TJTransform)">customFilter</a></strong>(java.nio.ShortBuffer coeffBuffer,
java.awt.Rectangle bufferRegion,
java.awt.Rectangle planeRegion,
int componentID,
<code>coeffBuffer</code> belongs (Y, Cb, and Cr have, respectively, ID's
of 0, 1, and 2 in typical JPEG images.)</dd><dd><code>transformID</code> - ID number of the transformed image to which
<code>coeffBuffer</code> belongs. This is the same as the index of the
- transform in the <code>transforms</code> array that was passed to <a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)"><code>TJTransformer.transform()</code></a>.</dd><dd><code>transform</code> - a <a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><code>TJTransform</code></a> instance that specifies the
+ transform in the <code>transforms</code> array that was passed to <a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)"><code>TJTransformer.transform()</code></a>.</dd><dd><code>transform</code> - a <a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><code>TJTransform</code></a> instance that specifies the
parameters and/or cropping region for this transform</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected int</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#srcColorspace">srcColorspace</a></strong></code> </td>
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegColorspace">jpegColorspace</a></strong></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected int</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#srcHeight">srcHeight</a></strong></code> </td>
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegHeight">jpegHeight</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected int</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#srcSubsamp">srcSubsamp</a></strong></code> </td>
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegSubsamp">jpegSubsamp</a></strong></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected int</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#srcWidth">srcWidth</a></strong></code> </td>
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegWidth">jpegWidth</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></code></td>
</td>
</tr>
<tr class="altColor">
-<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(byte[], int)">TJDecompressor</a></strong>(byte[] jpegImage,
+<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(byte[],%20int)">TJDecompressor</a></strong>(byte[] jpegImage,
int imageSize)</code>
<div class="block">Create a TurboJPEG decompressor instance and associate the JPEG source
image of length <code>imageSize</code> bytes stored in
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(java.awt.image.BufferedImage, int)">decompress</a></strong>(java.awt.image.BufferedImage dstImage,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(java.awt.image.BufferedImage,%20int)">decompress</a></strong>(java.awt.image.BufferedImage dstImage,
int flags)</code>
<div class="block">Decompress the JPEG source image or decode the YUV source image associated
with this decompressor instance and output a decompressed/decoded image to
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)">decompress</a></strong>(byte[] dstBuf,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int)">decompress</a></strong>(byte[] dstBuf,
int desiredWidth,
int pitch,
int desiredHeight,
int flags)</code>
<div class="block"><strong>Deprecated.</strong>
<div class="block"><i>Use
- <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int, int, int)"><code>decompress(byte[], int, int, int, int, int, int, int)</code></a> instead.</i></div>
+ <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)"><code>decompress(byte[], int, int, int, int, int, int, int)</code></a> instead.</i></div>
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int, int, int)">decompress</a></strong>(byte[] dstBuf,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)">decompress</a></strong>(byte[] dstBuf,
int x,
int y,
int desiredWidth,
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int[], int, int, int, int, int, int, int)">decompress</a></strong>(int[] dstBuf,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)">decompress</a></strong>(int[] dstBuf,
int x,
int y,
int desiredWidth,
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.awt.image.BufferedImage</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int, int, int, int)">decompress</a></strong>(int desiredWidth,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int,%20int,%20int,%20int)">decompress</a></strong>(int desiredWidth,
int desiredHeight,
int bufferedImageType,
int flags)</code>
</tr>
<tr class="altColor">
<td class="colFirst"><code>byte[]</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int, int, int, int, int)">decompress</a></strong>(int desiredWidth,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int,%20int,%20int,%20int,%20int)">decompress</a></strong>(int desiredWidth,
int pitch,
int desiredHeight,
int pixelFormat,
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int)">decompressToYUV</a></strong>(byte[] dstBuf,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[],%20int)">decompressToYUV</a></strong>(byte[] dstBuf,
int flags)</code>
<div class="block"><strong>Deprecated.</strong>
-<div class="block"><i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage, int)"><code>decompressToYUV(YUVImage, int)</code></a> instead.</i></div>
+<div class="block"><i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)"><code>decompressToYUV(YUVImage, int)</code></a> instead.</i></div>
</div>
</td>
</tr>
<td class="colFirst"><code>byte[]</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int)">decompressToYUV</a></strong>(int flags)</code>
<div class="block"><strong>Deprecated.</strong>
-<div class="block"><i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int, int, int, int)"><code>decompressToYUV(int, int, int, int)</code></a> instead.</i></div>
+<div class="block"><i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int,%20int,%20int,%20int)"><code>decompressToYUV(int, int, int, int)</code></a> instead.</i></div>
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int, int, int, int)">decompressToYUV</a></strong>(int desiredWidth,
- int pad,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int,%20int[],%20int,%20int)">decompressToYUV</a></strong>(int desiredWidth,
+ int[] strides,
int desiredHeight,
int flags)</code>
<div class="block">Decompress the JPEG source image associated with this decompressor
- instance into a YUV planar image and return a <code>YUVImage</code>
- instance containing the decompressed image.</div>
+ instance into a set of Y, U (Cb), and V (Cr) image planes and return a
+ <code>YUVImage</code> instance containing the decompressed image planes.</div>
</td>
</tr>
<tr class="altColor">
+<td class="colFirst"><code><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></code></td>
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int,%20int,%20int,%20int)">decompressToYUV</a></strong>(int desiredWidth,
+ int pad,
+ int desiredHeight,
+ int flags)</code>
+<div class="block">Decompress the JPEG source image associated with this decompressor
+ instance into a unified YUV planar image buffer and return a
+ <code>YUVImage</code> instance containing the decompressed image.</div>
+</td>
+</tr>
+<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage, int)">decompressToYUV</a></strong>(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> dstImage,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)">decompressToYUV</a></strong>(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> dstImage,
int flags)</code>
<div class="block">Decompress the JPEG source image associated with this decompressor
instance into a YUV planar image and store it in the given
<code>YUVImage</code> instance.</div>
</td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><code>protected void</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#finalize()">finalize</a></strong>()</code> </td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getColorspace()">getColorspace</a></strong>()</code>
<div class="block">Returns the colorspace used in the source image (JPEG or YUV) associated
with this decompressor instance.</div>
</td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getHeight()">getHeight</a></strong>()</code>
<div class="block">Returns the height of the source image (JPEG or YUV) associated with this
decompressor instance.</div>
</td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><code>byte[]</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGBuf()">getJPEGBuf</a></strong>()</code>
-<div class="block"><strong>Deprecated.</strong>
-<div class="block"><i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSourceBuf()"><code>getSourceBuf()</code></a> instead.</i></div>
-</div>
+<div class="block">Returns the JPEG image buffer associated with this decompressor instance.</div>
</td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGSize()">getJPEGSize</a></strong>()</code>
-<div class="block"><strong>Deprecated.</strong>
-<div class="block"><i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSourceSize()"><code>getSourceSize()</code></a> instead.</i></div>
-</div>
+<div class="block">Returns the size of the JPEG image (in bytes) associated with this
+ decompressor instance.</div>
</td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int, int)">getScaledHeight</a></strong>(int desiredWidth,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int,%20int)">getScaledHeight</a></strong>(int desiredWidth,
int desiredHeight)</code>
<div class="block">Returns the height of the largest scaled-down image that the TurboJPEG
decompressor can generate without exceeding the desired image width and
height.</div>
</td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><code>int</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int, int)">getScaledWidth</a></strong>(int desiredWidth,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int,%20int)">getScaledWidth</a></strong>(int desiredWidth,
int desiredHeight)</code>
<div class="block">Returns the width of the largest scaled-down image that the TurboJPEG
decompressor can generate without exceeding the desired image width and
height.</div>
</td>
</tr>
-<tr class="altColor">
-<td class="colFirst"><code>byte[]</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSourceBuf()">getSourceBuf</a></strong>()</code>
-<div class="block">Returns the source image buffer associated with this decompressor
- instance.</div>
-</td>
-</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSourceSize()">getSourceSize</a></strong>()</code>
-<div class="block">Returns the size of the source image (in bytes) associated with this
- decompressor instance.</div>
-</td>
-</tr>
-<tr class="altColor">
-<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSubsamp()">getSubsamp</a></strong>()</code>
<div class="block">Returns the level of chrominance subsampling used in the source image
(JPEG or YUV) associated with this decompressor instance.</div>
</td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getWidth()">getWidth</a></strong>()</code>
<div class="block">Returns the width of the source image (JPEG or YUV) associated with this
decompressor instance.</div>
</td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGImage(byte[], int)">setJPEGImage</a></strong>(byte[] jpegImage,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGImage(byte[],%20int)">setJPEGImage</a></strong>(byte[] jpegImage,
int imageSize)</code>
<div class="block"><strong>Deprecated.</strong>
-<div class="block"><i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte[], int)"><code>setSourceImage(byte[], int)</code></a> instead.</i></div>
+<div class="block"><i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte[],%20int)"><code>setSourceImage(byte[], int)</code></a> instead.</i></div>
</div>
</td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><code>void</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte[], int)">setSourceImage</a></strong>(byte[] srcImage,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte[],%20int)">setSourceImage</a></strong>(byte[] jpegImage,
int imageSize)</code>
<div class="block">Associate the JPEG image of length <code>imageSize</code> bytes stored in
- <code>srcImage</code> with this decompressor instance.</div>
+ <code>jpegImage</code> with this decompressor instance.</div>
</td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)">setSourceImage</a></strong>(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> srcImage)</code>
<div class="block">Associate the specified YUV planar source image with this decompressor
<pre>protected <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> yuvImage</pre>
</li>
</ul>
-<a name="srcWidth">
+<a name="jpegWidth">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
-<h4>srcWidth</h4>
-<pre>protected int srcWidth</pre>
+<h4>jpegWidth</h4>
+<pre>protected int jpegWidth</pre>
</li>
</ul>
-<a name="srcHeight">
+<a name="jpegHeight">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
-<h4>srcHeight</h4>
-<pre>protected int srcHeight</pre>
+<h4>jpegHeight</h4>
+<pre>protected int jpegHeight</pre>
</li>
</ul>
-<a name="srcSubsamp">
+<a name="jpegSubsamp">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
-<h4>srcSubsamp</h4>
-<pre>protected int srcSubsamp</pre>
+<h4>jpegSubsamp</h4>
+<pre>protected int jpegSubsamp</pre>
</li>
</ul>
-<a name="srcColorspace">
+<a name="jpegColorspace">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
-<h4>srcColorspace</h4>
-<pre>protected int srcColorspace</pre>
+<h4>jpegColorspace</h4>
+<pre>protected int jpegColorspace</pre>
</li>
</ul>
</li>
<ul class="blockList">
<li class="blockList">
<h4>setSourceImage</h4>
-<pre>public void setSourceImage(byte[] srcImage,
+<pre>public void setSourceImage(byte[] jpegImage,
int imageSize)
throws java.lang.Exception</pre>
<div class="block">Associate the JPEG image of length <code>imageSize</code> bytes stored in
- <code>srcImage</code> with this decompressor instance. This image will
+ <code>jpegImage</code> with this decompressor instance. This image will
be used as the source image for subsequent decompress operations.</div>
-<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - JPEG image buffer</dd><dd><code>imageSize</code> - size of the JPEG image (in bytes)</dd>
+<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - JPEG image buffer</dd><dd><code>imageSize</code> - size of the JPEG image (in bytes)</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
public void setJPEGImage(byte[] jpegImage,
int imageSize)
throws java.lang.Exception</pre>
-<div class="block"><span class="strong">Deprecated.</span> <i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte[], int)"><code>setSourceImage(byte[], int)</code></a> instead.</i></div>
+<div class="block"><span class="strong">Deprecated.</span> <i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte[],%20int)"><code>setSourceImage(byte[], int)</code></a> instead.</i></div>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
<div class="block">Returns the width of the source image (JPEG or YUV) associated with this
decompressor instance.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>the width of the source image (JPEG or YUV) associated with this
- decompressor instance</dd>
+ decompressor instance.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
<div class="block">Returns the height of the source image (JPEG or YUV) associated with this
decompressor instance.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>the height of the source image (JPEG or YUV) associated with this
- decompressor instance</dd>
+ decompressor instance.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
(JPEG or YUV) associated with this decompressor instance. See
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>the level of chrominance subsampling used in the source image
- (JPEG or YUV) associated with this decompressor instance</dd>
+ (JPEG or YUV) associated with this decompressor instance.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
with this decompressor instance. See <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#CS_RGB"><code>TJ.CS_*</code></a>. If the
source image is YUV, then this always returns <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#CS_YCbCr"><code>TJ.CS_YCbCr</code></a>.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>the colorspace used in the source image (JPEG or YUV) associated
- with this decompressor instance</dd>
-<dt><span class="strong">Throws:</span></dt>
-<dd><code>java.lang.Exception</code></dd></dl>
-</li>
-</ul>
-<a name="getSourceBuf()">
-<!-- -->
-</a>
-<ul class="blockList">
-<li class="blockList">
-<h4>getSourceBuf</h4>
-<pre>public byte[] getSourceBuf()
- throws java.lang.Exception</pre>
-<div class="block">Returns the source image buffer associated with this decompressor
- instance.</div>
-<dl><dt><span class="strong">Returns:</span></dt><dd>the source image buffer associated with this decompressor instance</dd>
+ with this decompressor instance.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
<ul class="blockList">
<li class="blockList">
<h4>getJPEGBuf</h4>
-<pre>@Deprecated
-public byte[] getJPEGBuf()
+<pre>public byte[] getJPEGBuf()
throws java.lang.Exception</pre>
-<div class="block"><span class="strong">Deprecated.</span> <i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSourceBuf()"><code>getSourceBuf()</code></a> instead.</i></div>
-<dl><dt><span class="strong">Throws:</span></dt>
-<dd><code>java.lang.Exception</code></dd></dl>
-</li>
-</ul>
-<a name="getSourceSize()">
-<!-- -->
-</a>
-<ul class="blockList">
-<li class="blockList">
-<h4>getSourceSize</h4>
-<pre>public int getSourceSize()
- throws java.lang.Exception</pre>
-<div class="block">Returns the size of the source image (in bytes) associated with this
- decompressor instance.</div>
-<dl><dt><span class="strong">Returns:</span></dt><dd>the size of the source image (in bytes) associated with this
- decompressor instance</dd>
+<div class="block">Returns the JPEG image buffer associated with this decompressor instance.</div>
+<dl><dt><span class="strong">Returns:</span></dt><dd>the JPEG image buffer associated with this decompressor instance.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
<ul class="blockList">
<li class="blockList">
<h4>getJPEGSize</h4>
-<pre>@Deprecated
-public int getJPEGSize()
+<pre>public int getJPEGSize()
throws java.lang.Exception</pre>
-<div class="block"><span class="strong">Deprecated.</span> <i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSourceSize()"><code>getSourceSize()</code></a> instead.</i></div>
-<dl><dt><span class="strong">Throws:</span></dt>
+<div class="block">Returns the size of the JPEG image (in bytes) associated with this
+ decompressor instance.</div>
+<dl><dt><span class="strong">Returns:</span></dt><dd>the size of the JPEG image (in bytes) associated with this
+ decompressor instance.</dd>
+<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
</ul>
the scaled image size.)</dd>
<dt><span class="strong">Returns:</span></dt><dd>the width of the largest scaled-down image that the TurboJPEG
decompressor can generate without exceeding the desired image width and
- height</dd>
+ height.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
the scaled image size.)</dd>
<dt><span class="strong">Returns:</span></dt><dd>the height of the largest scaled-down image that the TurboJPEG
decompressor can generate without exceeding the desired image width and
- height</dd>
+ height.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
<code>pitch * scaledHeight</code> bytes in size, where
<code>scaledHeight</code> can be determined by calling <code>
scalingFactor.<a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><code>getScaled</code></a>(jpegHeight)
- </code> with one of the scaling factors returned from <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()"><code>TJ.getScalingFactors()</code></a> or by calling <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int, int)"><code>getScaledHeight(int, int)</code></a>. If the
+ </code> with one of the scaling factors returned from <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()"><code>TJ.getScalingFactors()</code></a> or by calling <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int,%20int)"><code>getScaledHeight(int, int)</code></a>. If the
source image is a YUV image, then this buffer should normally be
<code>pitch * height</code> bytes in size, where <code>height</code> is
the height of the YUV image. However, the buffer may also be larger than
if the source image is a JPEG image, then <code>scaledWidth</code> can be
determined by calling <code>
scalingFactor.<a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><code>getScaled</code></a>(jpegWidth)
- </code> or by calling <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int, int)"><code>getScaledWidth(int, int)</code></a>. If the source image is a
+ </code> or by calling <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int,%20int)"><code>getScaledWidth(int, int)</code></a>. If the source image is a
YUV image, then <code>scaledWidth</code> is the width of the YUV image.
Setting this parameter to 0 is the equivalent of setting it to
<code>scaledWidth * TJ.pixelSize(pixelFormat)</code>.</dd><dd><code>desiredHeight</code> - If the source image is a JPEG image, then this
int flags)
throws java.lang.Exception</pre>
<div class="block"><span class="strong">Deprecated.</span> <i>Use
- <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int, int, int)"><code>decompress(byte[], int, int, int, int, int, int, int)</code></a> instead.</i></div>
+ <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)"><code>decompress(byte[], int, int, int, int, int, int, int)</code></a> instead.</i></div>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
<div class="block">Decompress the JPEG source image associated with this decompressor
instance and return a buffer containing the decompressed image.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>desiredWidth</code> - see
- <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int, int, int)"><code>decompress(byte[], int, int, int, int, int, int, int)</code></a>
+ <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)"><code>decompress(byte[], int, int, int, int, int, int, int)</code></a>
for description</dd><dd><code>pitch</code> - see
- <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int, int, int)"><code>decompress(byte[], int, int, int, int, int, int, int)</code></a>
+ <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)"><code>decompress(byte[], int, int, int, int, int, int, int)</code></a>
for description</dd><dd><code>desiredHeight</code> - see
- <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int, int, int)"><code>decompress(byte[], int, int, int, int, int, int, int)</code></a>
+ <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)"><code>decompress(byte[], int, int, int, int, int, int, int)</code></a>
for description</dd><dd><code>pixelFormat</code> - pixel format of the decompressed image (one of
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB"><code>TJ.PF_*</code></a>)</dd><dd><code>flags</code> - the bitwise OR of one or more of
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
-<dt><span class="strong">Returns:</span></dt><dd>a buffer containing the decompressed image</dd>
+<dt><span class="strong">Returns:</span></dt><dd>a buffer containing the decompressed image.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
public void decompressToYUV(byte[] dstBuf,
int flags)
throws java.lang.Exception</pre>
-<div class="block"><span class="strong">Deprecated.</span> <i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage, int)"><code>decompressToYUV(YUVImage, int)</code></a> instead.</i></div>
+<div class="block"><span class="strong">Deprecated.</span> <i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)"><code>decompressToYUV(YUVImage, int)</code></a> instead.</i></div>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
</ul>
+<a name="decompressToYUV(int, int[], int, int)">
+<!-- -->
+</a>
+<ul class="blockList">
+<li class="blockList">
+<h4>decompressToYUV</h4>
+<pre>public <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> decompressToYUV(int desiredWidth,
+ int[] strides,
+ int desiredHeight,
+ int flags)
+ throws java.lang.Exception</pre>
+<div class="block">Decompress the JPEG source image associated with this decompressor
+ instance into a set of Y, U (Cb), and V (Cr) image planes and return a
+ <code>YUVImage</code> instance containing the decompressed image planes.
+ This method performs JPEG decompression but leaves out the color
+ conversion step, so a planar YUV image is generated instead of an RGB or
+ grayscale image. This method cannot be used to decompress JPEG source
+ images with the CMYK or YCCK colorspace.</div>
+<dl><dt><span class="strong">Parameters:</span></dt><dd><code>desiredWidth</code> - desired width (in pixels) of the YUV image. If the
+ desired image dimensions are different than the dimensions of the JPEG
+ image being decompressed, then TurboJPEG will use scaling in the JPEG
+ decompressor to generate the largest possible image that will fit within
+ the desired dimensions. Setting this to 0 is the same as setting it to
+ the width of the JPEG image (in other words, the width will not be
+ considered when determining the scaled image size.)</dd><dd><code>strides</code> - an array of integers, each specifying the number of bytes
+ per line in the corresponding plane of the output image. Setting the
+ stride for any plane to 0 is the same as setting it to the scaled
+ component width of the plane. If <tt>strides</tt> is NULL, then the
+ strides for all planes will be set to their respective scaled component
+ widths. You can adjust the strides in order to add an arbitrary amount of
+ line padding to each plane.</dd><dd><code>desiredHeight</code> - desired height (in pixels) of the YUV image. If the
+ desired image dimensions are different than the dimensions of the JPEG
+ image being decompressed, then TurboJPEG will use scaling in the JPEG
+ decompressor to generate the largest possible image that will fit within
+ the desired dimensions. Setting this to 0 is the same as setting it to
+ the height of the JPEG image (in other words, the height will not be
+ considered when determining the scaled image size.)</dd><dd><code>flags</code> - the bitwise OR of one or more of
+ <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
+<dt><span class="strong">Returns:</span></dt><dd>a YUV planar image.</dd>
+<dt><span class="strong">Throws:</span></dt>
+<dd><code>java.lang.Exception</code></dd></dl>
+</li>
+</ul>
<a name="decompressToYUV(int, int, int, int)">
<!-- -->
</a>
int flags)
throws java.lang.Exception</pre>
<div class="block">Decompress the JPEG source image associated with this decompressor
- instance into a YUV planar image and return a <code>YUVImage</code>
- instance containing the decompressed image. This method performs JPEG
- decompression but leaves out the color conversion step, so a planar YUV
- image is generated instead of an RGB or grayscale image. This method
- cannot be used to decompress JPEG source images with the CMYK or YCCK
- colorspace.</div>
+ instance into a unified YUV planar image buffer and return a
+ <code>YUVImage</code> instance containing the decompressed image. This
+ method performs JPEG decompression but leaves out the color conversion
+ step, so a planar YUV image is generated instead of an RGB or grayscale
+ image. This method cannot be used to decompress JPEG source images with
+ the CMYK or YCCK colorspace.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>desiredWidth</code> - desired width (in pixels) of the YUV image. If the
desired image dimensions are different than the dimensions of the JPEG
image being decompressed, then TurboJPEG will use scaling in the JPEG
the height of the JPEG image (in other words, the height will not be
considered when determining the scaled image size.)</dd><dd><code>flags</code> - the bitwise OR of one or more of
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
-<dt><span class="strong">Returns:</span></dt><dd>a YUV planar image</dd>
+<dt><span class="strong">Returns:</span></dt><dd>a YUV planar image.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
<pre>@Deprecated
public byte[] decompressToYUV(int flags)
throws java.lang.Exception</pre>
-<div class="block"><span class="strong">Deprecated.</span> <i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int, int, int, int)"><code>decompressToYUV(int, int, int, int)</code></a> instead.</i></div>
+<div class="block"><span class="strong">Deprecated.</span> <i>Use <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int,%20int,%20int,%20int)"><code>decompressToYUV(int, int, int, int)</code></a> instead.</i></div>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
<code>stride * scaledHeight</code> pixels in size, where
<code>scaledHeight</code> can be determined by calling <code>
scalingFactor.<a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><code>getScaled</code></a>(jpegHeight)
- </code> with one of the scaling factors returned from <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()"><code>TJ.getScalingFactors()</code></a> or by calling <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int, int)"><code>getScaledHeight(int, int)</code></a>. If the
+ </code> with one of the scaling factors returned from <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()"><code>TJ.getScalingFactors()</code></a> or by calling <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int,%20int)"><code>getScaledHeight(int, int)</code></a>. If the
source image is a YUV image, then this buffer should normally be
<code>stride * height</code> pixels in size, where <code>height</code> is
the height of the YUV image. However, the buffer may also be larger than
NOTE: if the source image is a JPEG image, then <code>scaledWidth</code>
can be determined by calling <code>
scalingFactor.<a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><code>getScaled</code></a>(jpegWidth)
- </code> or by calling <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int, int)"><code>getScaledWidth(int, int)</code></a>. If the source image is a
+ </code> or by calling <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int,%20int)"><code>getScaledWidth(int, int)</code></a>. If the source image is a
YUV image, then <code>scaledWidth</code> is the width of the YUV image.
Setting this parameter to 0 is the equivalent of setting it to
<code>scaledWidth</code>.</dd><dd><code>desiredHeight</code> - If the source image is a JPEG image, then this
with this decompressor instance and return a <code>BufferedImage</code>
instance containing the decompressed/decoded image.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>desiredWidth</code> - see
- <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int, int, int)"><code>decompress(byte[], int, int, int, int, int, int, int)</code></a> for
+ <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)"><code>decompress(byte[], int, int, int, int, int, int, int)</code></a> for
description</dd><dd><code>desiredHeight</code> - see
- <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int, int, int)"><code>decompress(byte[], int, int, int, int, int, int, int)</code></a> for
+ <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)"><code>decompress(byte[], int, int, int, int, int, int, int)</code></a> for
description</dd><dd><code>bufferedImageType</code> - the image type of the <code>BufferedImage</code>
instance that will be created (for instance,
<code>BufferedImage.TYPE_INT_RGB</code>)</dd><dd><code>flags</code> - the bitwise OR of one or more of
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
<dt><span class="strong">Returns:</span></dt><dd>a <code>BufferedImage</code> instance containing the
- decompressed/decoded image</dd>
+ decompressed/decoded image.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
-<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#TJScalingFactor(int, int)">TJScalingFactor</a></strong>(int num,
+<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#TJScalingFactor(int,%20int)">TJScalingFactor</a></strong>(int num,
int denom)</code> </td>
</tr>
</table>
<div class="block">Returns the scaled value of <code>dimension</code>. This function
performs the integer equivalent of
<code>ceil(dimension * scalingFactor)</code>.</div>
-<dl><dt><span class="strong">Returns:</span></dt><dd>the scaled value of <code>dimension</code></dd></dl>
+<dl><dt><span class="strong">Returns:</span></dt><dd>the scaled value of <code>dimension</code>.</dd></dl>
</li>
</ul>
<a name="equals(org.libjpegturbo.turbojpeg.TJScalingFactor)">
<div class="block">Returns true or false, depending on whether this instance and
<code>other</code> have the same numerator and denominator.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>true or false, depending on whether this instance and
- <code>other</code> have the same numerator and denominator</dd></dl>
+ <code>other</code> have the same numerator and denominator.</dd></dl>
</li>
</ul>
<a name="isOne()">
<div class="block">Returns true or false, depending on whether this instance is equal to
1/1.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>true or false, depending on whether this instance is equal to
- 1/1</dd></dl>
+ 1/1.</dd></dl>
</li>
</ul>
</li>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_NOOUTPUT">OPT_NOOUTPUT</a></strong></code>
-<div class="block">This option will prevent <a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)"><code>TJTransformer.transform()</code></a> from outputting a JPEG image for this
+<div class="block">This option will prevent <a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)"><code>TJTransformer.transform()</code></a> from outputting a JPEG image for this
particular transform.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT">OPT_PERFECT</a></strong></code>
-<div class="block">This option will cause <a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)"><code>TJTransformer.transform()</code></a> to throw an exception if the transform is not
+<div class="block">This option will cause <a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)"><code>TJTransformer.transform()</code></a> to throw an exception if the transform is not
perfect.</div>
</td>
</tr>
</td>
</tr>
<tr class="rowColor">
-<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#TJTransform(int, int, int, int, int, int, org.libjpegturbo.turbojpeg.TJCustomFilter)">TJTransform</a></strong>(int x,
+<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#TJTransform(int,%20int,%20int,%20int,%20int,%20int,%20org.libjpegturbo.turbojpeg.TJCustomFilter)">TJTransform</a></strong>(int x,
int y,
int w,
int h,
</td>
</tr>
<tr class="altColor">
-<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#TJTransform(java.awt.Rectangle, int, int, org.libjpegturbo.turbojpeg.TJCustomFilter)">TJTransform</a></strong>(java.awt.Rectangle r,
+<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#TJTransform(java.awt.Rectangle,%20int,%20int,%20org.libjpegturbo.turbojpeg.TJCustomFilter)">TJTransform</a></strong>(java.awt.Rectangle r,
int op,
int options,
<a href="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg">TJCustomFilter</a> cf)</code>
<li class="blockList">
<h4>OPT_PERFECT</h4>
<pre>public static final int OPT_PERFECT</pre>
-<div class="block">This option will cause <a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)"><code>TJTransformer.transform()</code></a> to throw an exception if the transform is not
+<div class="block">This option will cause <a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)"><code>TJTransformer.transform()</code></a> to throw an exception if the transform is not
perfect. Lossless transforms operate on MCU blocks, whose size 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="../../../org/libjpegturbo/turbojpeg/TJ.html#getMCUWidth(int)"><code>TJ.getMCUWidth(int)</code></a>
<li class="blockList">
<h4>OPT_NOOUTPUT</h4>
<pre>public static final int OPT_NOOUTPUT</pre>
-<div class="block">This option will prevent <a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)"><code>TJTransformer.transform()</code></a> from outputting a JPEG image for this
+<div class="block">This option will prevent <a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)"><code>TJTransformer.transform()</code></a> from outputting a JPEG image for this
particular transform. This can be used in conjunction with a custom
filter to capture the transformed DCT coefficients without transcoding
them.</div>
throws java.lang.Exception</pre>
<div class="block">Create a new lossless transform instance with the given parameters.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>r</code> - a <code>Rectangle</code> instance that specifies the cropping
- region. See <a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#TJTransform(int, int, int, int, int, int, org.libjpegturbo.turbojpeg.TJCustomFilter)"><code>TJTransform(int, int, int, int, int, int, TJCustomFilter)</code></a> for more
+ region. See <a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#TJTransform(int,%20int,%20int,%20int,%20int,%20int,%20org.libjpegturbo.turbojpeg.TJCustomFilter)"><code>TJTransform(int, int, int, int, int, int, TJCustomFilter)</code></a> for more
detail.</dd><dd><code>op</code> - one of the transform operations (<code>OP_*</code>)</dd><dd><code>options</code> - the bitwise OR of one or more of the transform options
(<code>OPT_*</code>)</dd><dd><code>cf</code> - an instance of an object that implements the <a href="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg"><code>TJCustomFilter</code></a> interface, or null if no custom filter is needed</dd>
<dt><span class="strong">Throws:</span></dt>
<!-- -->
</a>
<h3>Fields inherited from class org.libjpegturbo.turbojpeg.<a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></h3>
-<code><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#handle">handle</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegBuf">jpegBuf</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegBufSize">jpegBufSize</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#srcColorspace">srcColorspace</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#srcHeight">srcHeight</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#srcSubsamp">srcSubsamp</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#srcWidth">srcWidth</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#yuvImage">yuvImage</a></code></li>
+<code><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#handle">handle</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegBuf">jpegBuf</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegBufSize">jpegBufSize</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegColorspace">jpegColorspace</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegHeight">jpegHeight</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegSubsamp">jpegSubsamp</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegWidth">jpegWidth</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#yuvImage">yuvImage</a></code></li>
</ul>
</li>
</ul>
</td>
</tr>
<tr class="altColor">
-<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#TJTransformer(byte[], int)">TJTransformer</a></strong>(byte[] jpegImage,
+<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#TJTransformer(byte[],%20int)">TJTransformer</a></strong>(byte[] jpegImage,
int imageSize)</code>
<div class="block">Create a TurboJPEG lossless transformer instance and associate the JPEG
image of length <code>imageSize</code> bytes stored in
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)">transform</a></strong>(byte[][] dstBufs,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)">transform</a></strong>(byte[][] dstBufs,
<a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a>[] transforms,
int flags)</code>
<div class="block">Losslessly transform the JPEG image associated with this transformer
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a>[]</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(org.libjpegturbo.turbojpeg.TJTransform[], int)">transform</a></strong>(<a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a>[] transforms,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(org.libjpegturbo.turbojpeg.TJTransform[],%20int)">transform</a></strong>(<a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a>[] transforms,
int flags)</code>
<div class="block">Losslessly transform the JPEG image associated with this transformer
instance and return an array of <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><code>TJDecompressor</code></a> instances, each of
<!-- -->
</a>
<h3>Methods inherited from class org.libjpegturbo.turbojpeg.<a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></h3>
-<code><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#close()">close</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(java.awt.image.BufferedImage, int)">decompress</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)">decompress</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int, int, int)">decompress</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int[], int, int, int, int, int, int, int)">decompress</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int, int, int, int)">decompress</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int, int, int, int, int)">decompress</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int)">decompressToYUV</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int)">decompressToYUV</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int, int, int, int)">decompressToYUV</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage, int)">decompressToYUV</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#finalize()">finalize</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getColorspace()">getColorspace</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getHeight()">getHeight</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGBuf()">getJPEGBuf</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGSize()">getJPEGSize</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int, int)">getScaledHeight</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int, int)">getScaledWidth</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSourceBuf()">getSourceBuf</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSourceSize()">getSourceSize</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSubsamp()">getSubsamp</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getWidth()">getWidth</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGImage(byte[], int)">setJPEGImage</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte[], int)">setSourceImage</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)">setSourceImage</a></code></li>
+<code><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#close()">close</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(java.awt.image.BufferedImage,%20int)">decompress</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int)">decompress</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)">decompress</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)">decompress</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int,%20int,%20int,%20int)">decompress</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int,%20int,%20int,%20int,%20int)">decompress</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[],%20int)">decompressToYUV</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int)">decompressToYUV</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int,%20int[],%20int,%20int)">decompressToYUV</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int,%20int,%20int,%20int)">decompressToYUV</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)">decompressToYUV</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#finalize()">finalize</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getColorspace()">getColorspace</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getHeight()">getHeight</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGBuf()">getJPEGBuf</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGSize()">getJPEGSize</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int,%20int)">getScaledHeight</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int,%20int)">getScaledWidth</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSubsamp()">getSubsamp</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getWidth()">getWidth</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGImage(byte[],%20int)">setJPEGImage</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte[],%20int)">setSourceImage</a>, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)">setSourceImage</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
read the source coefficients multiple times.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstBufs</code> - an array of image buffers. <code>dstbufs[i]</code> will
receive a JPEG image that has been transformed using the parameters in
- <code>transforms[i]</code>. Use <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSize(int, int, int)"><code>TJ.bufSize(int, int, int)</code></a> to determine the
+ <code>transforms[i]</code>. Use <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSize(int,%20int,%20int)"><code>TJ.bufSize(int, int, int)</code></a> to determine the
maximum size for each buffer based on the transformed or cropped width and
height and the level of subsampling used in the source image.</dd><dd><code>transforms</code> - an array of <a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><code>TJTransform</code></a> instances, each of
which specifies the transform parameters and/or cropping region for the
corresponding transformed output image</dd><dd><code>flags</code> - the bitwise OR of one or more of
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><code>TJ.FLAG_*</code></a></dd>
<dt><span class="strong">Returns:</span></dt><dd>an array of <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><code>TJDecompressor</code></a> instances, each of
- which has a transformed JPEG image associated with it</dd>
+ which has a transformed JPEG image associated with it.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
<div class="block">Returns an array containing the sizes of the transformed JPEG images
generated by the most recent transform operation.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>an array containing the sizes of the transformed JPEG images
- generated by the most recent transform operation</dd>
+ generated by the most recent transform operation.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
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.
+ of one of the components (Y, Cb, or Cr) at a particular location in the
+ image. The width and height of each plane are determined by the image
+ width, height, and level of chrominance subsampling. The luminance plane
+ 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 luminance plane
+ height 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 chrominance plane width is equal to the luminance plane
+ width divided by the horizontal subsampling factor, and the chrominance
+ plane height is equal to the luminance plane height 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
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#handle">handle</a></strong></code> </td>
</tr>
<tr class="rowColor">
-<td class="colFirst"><code>protected byte[]</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#yuvBuf">yuvBuf</a></strong></code> </td>
-</tr>
-<tr class="altColor">
<td class="colFirst"><code>protected int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#yuvHeight">yuvHeight</a></strong></code> </td>
</tr>
+<tr class="altColor">
+<td class="colFirst"><code>protected int[]</code></td>
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#yuvOffsets">yuvOffsets</a></strong></code> </td>
+</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#yuvPad">yuvPad</a></strong></code> </td>
</tr>
<tr class="altColor">
+<td class="colFirst"><code>protected byte[][]</code></td>
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#yuvPlanes">yuvPlanes</a></strong></code> </td>
+</tr>
+<tr class="rowColor">
+<td class="colFirst"><code>protected int[]</code></td>
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#yuvStrides">yuvStrides</a></strong></code> </td>
+</tr>
+<tr class="altColor">
<td class="colFirst"><code>protected int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#yuvSubsamp">yuvSubsamp</a></strong></code> </td>
</tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
-<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(byte[], int, int, int, int)">YUVImage</a></strong>(byte[] yuvImage,
+<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(byte[][],%20int[],%20int,%20int[],%20int,%20int)">YUVImage</a></strong>(byte[][] planes,
+ int[] offsets,
+ int width,
+ int[] strides,
+ int height,
+ int subsamp)</code>
+<div class="block">Create a new <code>YUVImage</code> instance from a set of existing image
+ planes.</div>
+</td>
+</tr>
+<tr class="rowColor">
+<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(byte[],%20int,%20int,%20int,%20int)">YUVImage</a></strong>(byte[] yuvImage,
int width,
int pad,
int height,
int subsamp)</code>
-<div class="block">Create a <code>YUVImage</code> instance from an existing YUV planar image
+<div class="block">Create a new <code>YUVImage</code> instance from an existing unified image
buffer.</div>
</td>
</tr>
+<tr class="altColor">
+<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(int,%20int[],%20int,%20int)">YUVImage</a></strong>(int width,
+ int[] strides,
+ int height,
+ int subsamp)</code>
+<div class="block">Create a new <code>YUVImage</code> instance backed by separate image
+ planes, and allocate memory for the image planes.</div>
+</td>
+</tr>
<tr class="rowColor">
-<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(int, int, int, int)">YUVImage</a></strong>(int width,
+<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(int,%20int,%20int,%20int)">YUVImage</a></strong>(int width,
int pad,
int height,
int subsamp)</code>
-<div class="block">Create a <code>YUVImage</code> instance with a new image buffer.</div>
+<div class="block">Create a new <code>YUVImage</code> instance backed by a unified image
+ buffer, and allocate memory for the image buffer.</div>
</td>
</tr>
</table>
<tr class="altColor">
<td class="colFirst"><code>byte[]</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#getBuf()">getBuf</a></strong>()</code>
-<div class="block">Returns the YUV image buffer</div>
+<div class="block">Returns the YUV image buffer (if this image is stored in a unified
+ buffer rather than separate image planes.)</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#getHeight()">getHeight</a></strong>()</code>
-<div class="block">Returns the height of the YUV image.</div>
+<div class="block">Returns the height of the YUV image (or subregion.)</div>
</td>
</tr>
<tr class="altColor">
+<td class="colFirst"><code>int[]</code></td>
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#getOffsets()">getOffsets</a></strong>()</code>
+<div class="block">Returns the offsets (in bytes) of each plane within the planes of a larger
+ YUV image.</div>
+</td>
+</tr>
+<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#getPad()">getPad</a></strong>()</code>
-<div class="block">Returns the line padding used in the YUV image buffer.</div>
+<div class="block">Returns the line padding used in the YUV image buffer (if this image is
+ stored in a unified buffer rather than separate image planes.)</div>
+</td>
+</tr>
+<tr class="altColor">
+<td class="colFirst"><code>byte[][]</code></td>
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#getPlanes()">getPlanes</a></strong>()</code>
+<div class="block">Returns the YUV image planes.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#getSize()">getSize</a></strong>()</code>
-<div class="block">Returns the size (in bytes) of the YUV image buffer</div>
+<div class="block">Returns the size (in bytes) of the YUV image buffer (if this image is
+ stored in a unified buffer rather than separate image planes.)</div>
</td>
</tr>
<tr class="altColor">
+<td class="colFirst"><code>int[]</code></td>
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#getStrides()">getStrides</a></strong>()</code>
+<div class="block">Returns the number of bytes per line of each plane in the YUV image.</div>
+</td>
+</tr>
+<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#getSubsamp()">getSubsamp</a></strong>()</code>
<div class="block">Returns the level of chrominance subsampling used in the YUV image.</div>
</td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#getWidth()">getWidth</a></strong>()</code>
-<div class="block">Returns the width of the YUV image.</div>
+<div class="block">Returns the width of the YUV image (or subregion.)</div>
+</td>
+</tr>
+<tr class="rowColor">
+<td class="colFirst"><code>void</code></td>
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#setBuf(byte[][],%20int[],%20int,%20int[],%20int,%20int)">setBuf</a></strong>(byte[][] planes,
+ int[] offsets,
+ int width,
+ int[] strides,
+ int height,
+ int subsamp)</code>
+<div class="block">Assign a set of image planes to this <code>YUVImage</code> instance.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
-<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#setBuf(byte[], int, int, int, int)">setBuf</a></strong>(byte[] yuvImage,
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#setBuf(byte[],%20int,%20int,%20int,%20int)">setBuf</a></strong>(byte[] yuvImage,
int width,
int pad,
int height,
int subsamp)</code>
-<div class="block">Assign an existing YUV planar image buffer to this <code>YUVImage</code>
- instance.</div>
+<div class="block">Assign a unified image buffer to this <code>YUVImage</code> instance.</div>
</td>
</tr>
</table>
<pre>protected long handle</pre>
</li>
</ul>
-<a name="yuvBuf">
+<a name="yuvPlanes">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
-<h4>yuvBuf</h4>
-<pre>protected byte[] yuvBuf</pre>
+<h4>yuvPlanes</h4>
+<pre>protected byte[][] yuvPlanes</pre>
+</li>
+</ul>
+<a name="yuvOffsets">
+<!-- -->
+</a>
+<ul class="blockList">
+<li class="blockList">
+<h4>yuvOffsets</h4>
+<pre>protected int[] yuvOffsets</pre>
+</li>
+</ul>
+<a name="yuvStrides">
+<!-- -->
+</a>
+<ul class="blockList">
+<li class="blockList">
+<h4>yuvStrides</h4>
+<pre>protected int[] yuvStrides</pre>
</li>
</ul>
<a name="yuvPad">
<!-- -->
</a>
<h3>Constructor Detail</h3>
+<a name="YUVImage(int, int[], int, int)">
+<!-- -->
+</a>
+<ul class="blockList">
+<li class="blockList">
+<h4>YUVImage</h4>
+<pre>public YUVImage(int width,
+ int[] strides,
+ int height,
+ int subsamp)
+ throws java.lang.Exception</pre>
+<div class="block">Create a new <code>YUVImage</code> instance backed by separate image
+ planes, and allocate memory for the image planes.</div>
+<dl><dt><span class="strong">Parameters:</span></dt><dd><code>width</code> - width (in pixels) of the YUV image</dd><dd><code>strides</code> - an array of integers, each specifying the number of bytes
+ per line in the corresponding plane of the YUV image. Setting the stride
+ for any plane to 0 is the same as setting it to the plane width (see
+ <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>above</code></a>.) If <code>strides</code> is null, then the
+ strides for all planes will be set to their respective plane widths. When
+ using this constructor, the stride for each plane must be equal to or
+ greater than the plane width.</dd><dd><code>height</code> - height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling to be used in the YUV
+ image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd>
+<dt><span class="strong">Throws:</span></dt>
+<dd><code>java.lang.Exception</code></dd></dl>
+</li>
+</ul>
<a name="YUVImage(int, int, int, int)">
<!-- -->
</a>
int height,
int subsamp)
throws java.lang.Exception</pre>
-<div class="block">Create a <code>YUVImage</code> instance with a new image buffer.</div>
+<div class="block">Create a new <code>YUVImage</code> instance backed by a unified image
+ buffer, and allocate memory for the image buffer.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>width</code> - width (in pixels) of the YUV image</dd><dd><code>pad</code> - Each line of each plane in the YUV image buffer will be padded
to this number of bytes (must be a power of 2.)</dd><dd><code>height</code> - height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling to be used in the YUV
image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
</ul>
+<a name="YUVImage(byte[][], int[], int, int[], int, int)">
+<!-- -->
+</a>
+<ul class="blockList">
+<li class="blockList">
+<h4>YUVImage</h4>
+<pre>public YUVImage(byte[][] planes,
+ int[] offsets,
+ int width,
+ int[] strides,
+ int height,
+ int subsamp)
+ throws java.lang.Exception</pre>
+<div class="block">Create a new <code>YUVImage</code> instance from a set of existing image
+ planes.</div>
+<dl><dt><span class="strong">Parameters:</span></dt><dd><code>planes</code> - an array of buffers representing the Y, U (Cb), and V (Cr)
+ image planes (or just the Y plane, if the image is grayscale.) These
+ planes can be contiguous or non-contiguous in memory. Plane
+ <code>i</code> should be at least <code>offsets[i] +
+ <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeSizeYUV(int,%20int,%20int,%20int,%20int)"><code>TJ.planeSizeYUV</code></a>(i, width, strides[i], height, subsamp)</code>
+ bytes in size.</dd><dd><code>offsets</code> - If this <code>YUVImage</code> instance represents a
+ subregion of a larger image, then <code>offsets[i]</code> specifies the
+ offset (in bytes) of the subregion within plane <code>i</code> of the
+ larger image. Setting this to null is the same as setting the offsets for
+ all planes to 0.</dd><dd><code>width</code> - width (in pixels) of the new YUV image (or subregion)</dd><dd><code>strides</code> - an array of integers, each specifying the number of bytes
+ per line in the corresponding plane of the YUV image. Setting the stride
+ for any plane to 0 is the same as setting it to the plane width (see
+ <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>above</code></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 add an arbitrary amount of line padding
+ to each plane or to specify that this <code>YUVImage</code> instance is a
+ subregion of a larger image (in which case, <code>strides[i]</code> should
+ be set to the plane width of plane <code>i</code> in the larger image.)</dd><dd><code>height</code> - height (in pixels) of the new YUV image (or subregion)</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>
+<dt><span class="strong">Throws:</span></dt>
+<dd><code>java.lang.Exception</code></dd></dl>
+</li>
+</ul>
<a name="YUVImage(byte[], int, int, int, int)">
<!-- -->
</a>
int height,
int subsamp)
throws java.lang.Exception</pre>
-<div class="block">Create a <code>YUVImage</code> instance from an existing YUV planar image
+<div class="block">Create a new <code>YUVImage</code> instance from an existing unified 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. 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
+ image data. Use <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int,%20int,%20int,%20int)"><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
<!-- -->
</a>
<h3>Method Detail</h3>
+<a name="setBuf(byte[][], int[], int, int[], int, int)">
+<!-- -->
+</a>
+<ul class="blockList">
+<li class="blockList">
+<h4>setBuf</h4>
+<pre>public void setBuf(byte[][] planes,
+ int[] offsets,
+ int width,
+ int[] strides,
+ int height,
+ int subsamp)
+ throws java.lang.Exception</pre>
+<div class="block">Assign a set of image planes to this <code>YUVImage</code> instance.</div>
+<dl><dt><span class="strong">Parameters:</span></dt><dd><code>planes</code> - an array of buffers representing the Y, U (Cb), and V (Cr)
+ image planes (or just the Y plane, if the image is grayscale.) These
+ planes can be contiguous or non-contiguous in memory. Plane
+ <code>i</code> should be at least <code>offsets[i] +
+ <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeSizeYUV(int,%20int,%20int,%20int,%20int)"><code>TJ.planeSizeYUV</code></a>(i, width, strides[i], height, subsamp)</code>
+ bytes in size.</dd><dd><code>offsets</code> - If this <code>YUVImage</code> instance represents a
+ subregion of a larger image, then <code>offsets[i]</code> specifies the
+ offset (in bytes) of the subregion within plane <code>i</code> of the
+ larger image. Setting this to null is the same as setting the offsets for
+ all planes to 0.</dd><dd><code>width</code> - width (in pixels) of the YUV image (or subregion)</dd><dd><code>strides</code> - an array of integers, each specifying the number of bytes
+ per line in the corresponding plane of the YUV image. Setting the stride
+ for any plane to 0 is the same as setting it to the plane width (see
+ <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>above</code></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 add an arbitrary amount of line padding
+ to each plane or to specify that this <code>YUVImage</code> image is a
+ subregion of a larger image (in which case, <code>strides[i]</code> should
+ be set to the plane width of plane <code>i</code> in the larger image.)</dd><dd><code>height</code> - height (in pixels) of the YUV image (or subregion)</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>
+<dt><span class="strong">Throws:</span></dt>
+<dd><code>java.lang.Exception</code></dd></dl>
+</li>
+</ul>
<a name="setBuf(byte[], int, int, int, int)">
<!-- -->
</a>
int height,
int subsamp)
throws java.lang.Exception</pre>
-<div class="block">Assign an existing YUV planar image buffer to this <code>YUVImage</code>
- instance.</div>
+<div class="block">Assign a unified 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. 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
+ image data. Use <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int,%20int,%20int,%20int)"><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
<h4>getWidth</h4>
<pre>public int getWidth()
throws java.lang.Exception</pre>
-<div class="block">Returns the width of the YUV image.</div>
-<dl><dt><span class="strong">Returns:</span></dt><dd>the width of the YUV image</dd>
+<div class="block">Returns the width of the YUV image (or subregion.)</div>
+<dl><dt><span class="strong">Returns:</span></dt><dd>the width of the YUV image (or subregion)</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
<h4>getHeight</h4>
<pre>public int getHeight()
throws java.lang.Exception</pre>
-<div class="block">Returns the height of the YUV image.</div>
-<dl><dt><span class="strong">Returns:</span></dt><dd>the height of the YUV image</dd>
+<div class="block">Returns the height of the YUV image (or subregion.)</div>
+<dl><dt><span class="strong">Returns:</span></dt><dd>the height of the YUV image (or subregion)</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
<h4>getPad</h4>
<pre>public int getPad()
throws java.lang.Exception</pre>
-<div class="block">Returns the line padding used in the YUV image buffer.</div>
+<div class="block">Returns the line padding used in the YUV image buffer (if this image is
+ stored in a unified buffer rather than separate image planes.)</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>the line padding used in the YUV image buffer</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
</ul>
+<a name="getStrides()">
+<!-- -->
+</a>
+<ul class="blockList">
+<li class="blockList">
+<h4>getStrides</h4>
+<pre>public int[] getStrides()
+ throws java.lang.Exception</pre>
+<div class="block">Returns the number of bytes per line of each plane in the YUV image.</div>
+<dl><dt><span class="strong">Returns:</span></dt><dd>the number of bytes per line of each plane in the YUV image</dd>
+<dt><span class="strong">Throws:</span></dt>
+<dd><code>java.lang.Exception</code></dd></dl>
+</li>
+</ul>
+<a name="getOffsets()">
+<!-- -->
+</a>
+<ul class="blockList">
+<li class="blockList">
+<h4>getOffsets</h4>
+<pre>public int[] getOffsets()
+ throws java.lang.Exception</pre>
+<div class="block">Returns the offsets (in bytes) of each plane within the planes of a larger
+ YUV image.</div>
+<dl><dt><span class="strong">Returns:</span></dt><dd>the offsets (in bytes) of each plane within the planes of a larger
+ YUV image</dd>
+<dt><span class="strong">Throws:</span></dt>
+<dd><code>java.lang.Exception</code></dd></dl>
+</li>
+</ul>
<a name="getSubsamp()">
<!-- -->
</a>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
</ul>
+<a name="getPlanes()">
+<!-- -->
+</a>
+<ul class="blockList">
+<li class="blockList">
+<h4>getPlanes</h4>
+<pre>public byte[][] getPlanes()
+ throws java.lang.Exception</pre>
+<div class="block">Returns the YUV image planes. If the image is stored in a unified buffer,
+ then all image planes will point to that buffer.</div>
+<dl><dt><span class="strong">Returns:</span></dt><dd>the YUV image planes</dd>
+<dt><span class="strong">Throws:</span></dt>
+<dd><code>java.lang.Exception</code></dd></dl>
+</li>
+</ul>
<a name="getBuf()">
<!-- -->
</a>
<h4>getBuf</h4>
<pre>public byte[] getBuf()
throws java.lang.Exception</pre>
-<div class="block">Returns the YUV image buffer</div>
+<div class="block">Returns the YUV image buffer (if this image is stored in a unified
+ buffer rather than separate image planes.)</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>the YUV image buffer</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
<h4>getSize</h4>
<pre>public int getSize()
throws java.lang.Exception</pre>
-<div class="block">Returns the size (in bytes) of the YUV image buffer</div>
+<div class="block">Returns the size (in bytes) of the YUV image buffer (if this image is
+ stored in a unified buffer rather than separate image planes.)</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>the size (in bytes) of the YUV image buffer</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
* @param subsamp the level of chrominance subsampling (one of
* <code>SAMP_*</code>)
*
- * @return the MCU block width for the given level of chrominance subsampling
+ * @return the MCU block width for the given level of chrominance
+ * subsampling.
*/
public static int getMCUWidth(int subsamp) throws Exception {
if (subsamp < 0 || subsamp >= NUMSAMP)
* <code>SAMP_*</code>)
*
* @return the MCU block height for the given level of chrominance
- * subsampling
+ * subsampling.
*/
public static int getMCUHeight(int subsamp) throws Exception {
if (subsamp < 0 || subsamp >= NUMSAMP)
*
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
*
- * @return the pixel size (in bytes) for the given pixel format
+ * @return the pixel size (in bytes) for the given pixel format.
*/
public static int getPixelSize(int pixelFormat) throws Exception {
if (pixelFormat < 0 || pixelFormat >= NUMPF)
*
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
*
- * @return the red offset for the given pixel format
+ * @return the red offset for the given pixel format.
*/
public static int getRedOffset(int pixelFormat) throws Exception {
if (pixelFormat < 0 || pixelFormat >= NUMPF)
*
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
*
- * @return the green offset for the given pixel format
+ * @return the green offset for the given pixel format.
*/
public static int getGreenOffset(int pixelFormat) throws Exception {
if (pixelFormat < 0 || pixelFormat >= NUMPF)
*
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
*
- * @return the blue offset for the given pixel format
+ * @return the blue offset for the given pixel format.
*/
public static int getBlueOffset(int pixelFormat) throws Exception {
if (pixelFormat < 0 || pixelFormat >= NUMPF)
* generating the JPEG image (one of {@link TJ TJ.SAMP_*})
*
* @return the maximum size of the buffer (in bytes) required to hold a JPEG
- * image with the given width, height, and level of chrominance subsampling
+ * image with the given width, height, and level of chrominance subsampling.
*/
public static native int bufSize(int width, int height, int jpegSubsamp)
throws Exception;
* @param width the width (in pixels) of the YUV image
*
* @param pad the width of each line in each plane of the image is padded to
- * the nearest multiple of this number of bytes (must be a power of
- * 2.)
+ * the nearest multiple of this number of bytes (must be a power of 2.)
*
* @param height the height (in pixels) of the YUV image
*
* image (one of {@link TJ TJ.SAMP_*})
*
* @return the size of the buffer (in bytes) required to hold a YUV planar
- * image with the given width, height, and level of chrominance subsampling
+ * image with the given width, height, and level of chrominance subsampling.
*/
public static native int bufSizeYUV(int width, int pad, int height,
int subsamp)
public static native int bufSizeYUV(int width, int height, int subsamp)
throws Exception;
+ /**
+ * Returns the size of the buffer (in bytes) required to hold a YUV image
+ * plane with the given parameters.
+ *
+ * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb,
+ * 2 = V/Cr)
+ *
+ * @param width width (in pixels) of the YUV image. NOTE: this is the width
+ * of the whole image, not the plane width.
+ *
+ * @param stride bytes per line in the image plane.
+ *
+ * @param height height (in pixels) of the YUV image. NOTE: this is the
+ * height of the whole image, not the plane height.
+ *
+ * @param subsamp the level of chrominance subsampling used in the YUV
+ * image (one of {@link TJ TJ.SAMP_*})
+ *
+ * @return the size of the buffer (in bytes) required to hold a YUV planar
+ * image with the given parameters.
+ */
+ public static native int planeSizeYUV(int componentID, int width, int stride,
+ int height, int subsamp)
+ throws Exception;
+
+ /**
+ * Returns the plane width of a YUV image plane with the given parameters.
+ * Refer to {@link YUVImage YUVImage} for a description of plane width.
+ *
+ * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb,
+ * 2 = V/Cr)
+ *
+ * @param width width (in pixels) of the YUV image
+ *
+ * @param subsamp the level of chrominance subsampling used in the YUV image
+ * (one of {@link TJ TJ.SAMP_*})
+ *
+ * @return the plane width of a YUV image plane with the given parameters.
+ */
+ public static native int planeWidth(int componentID, int width, int subsamp)
+ throws Exception;
+
+ /**
+ * Returns the plane height of a YUV image plane with the given parameters.
+ * Refer to {@link YUVImage YUVImage} for a description of plane height.
+ *
+ * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb,
+ * 2 = V/Cr)
+ *
+ * @param height height (in pixels) of the YUV image
+ *
+ * @param subsamp the level of chrominance subsampling used in the YUV image
+ * (one of {@link TJ TJ.SAMP_*})
+ *
+ * @return the plane height of a YUV image plane with the given parameters.
+ */
+ public static native int planeHeight(int componentID, int height,
+ int subsamp)
+ throws Exception;
+
/**
* Returns a list of fractional scaling factors that the JPEG decompressor in
* this implementation of TurboJPEG supports.
*
* @return a list of fractional scaling factors that the JPEG decompressor in
- * this implementation of TurboJPEG supports
+ * this implementation of TurboJPEG supports.
*/
public static native TJScalingFactor[] getScalingFactors()
throws Exception;
throw new Exception("Subsampling level not set");
if (srcYUVImage != null)
- compressedSize = compressFromYUV(srcYUVImage.getBuf(),
+ compressedSize = compressFromYUV(srcYUVImage.getPlanes(),
+ srcYUVImage.getOffsets(),
srcYUVImage.getWidth(),
- srcYUVImage.getPad(),
+ srcYUVImage.getStrides(),
srcYUVImage.getHeight(),
srcYUVImage.getSubsamp(),
dstBuf, jpegQuality, flags);
if (srcBufInt != null) {
encodeYUV(srcBufInt, srcX, srcY, srcWidth, srcStride, srcHeight,
- srcPixelFormat, dstImage.getBuf(), dstImage.getPad(),
- dstImage.getSubsamp(), flags);
+ srcPixelFormat, dstImage.getPlanes(), dstImage.getOffsets(),
+ dstImage.getStrides(), dstImage.getSubsamp(), flags);
} else {
encodeYUV(srcBuf, srcX, srcY, srcWidth, srcPitch, srcHeight,
- srcPixelFormat, dstImage.getBuf(), dstImage.getPad(),
- dstImage.getSubsamp(), flags);
+ srcPixelFormat, dstImage.getPlanes(), dstImage.getOffsets(),
+ dstImage.getStrides(), dstImage.getSubsamp(), flags);
}
- compressedSize = dstImage.getSize();
+ compressedSize = 0;
}
/**
/**
* Encode the uncompressed source image associated with this compressor
- * instance into a YUV planar image and return a <code>YUVImage</code>
- * instance containing the encoded image. This method uses the accelerated
- * color conversion routines in TurboJPEG's underlying codec but does not
- * execute any of the other steps in the JPEG compression process. Encoding
- * CMYK source images to YUV is not supported.
+ * instance into a unified YUV planar image buffer and return a
+ * <code>YUVImage</code> instance containing the encoded image. This method
+ * uses the accelerated color conversion routines in TurboJPEG's underlying
+ * codec but does not execute any of the other steps in the JPEG compression
+ * process. Encoding CMYK source images to YUV is not supported.
*
* @param pad the width of each line in each plane of the YUV image will be
* padded to the nearest multiple of this number of bytes (must be a power of
* @param flags the bitwise OR of one or more of
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
*
- * @return a YUV planar image
+ * @return a YUV planar image.
*/
public YUVImage encodeYUV(int pad, int flags) throws Exception {
if (srcWidth < 1 || srcHeight < 1)
return yuvImage;
}
+ /**
+ * Encode the uncompressed source image associated with this compressor
+ * instance into separate Y, U (Cb), and V (Cr) image planes and return a
+ * <code>YUVImage</code> instance containing the encoded image planes. This
+ * method uses the accelerated color conversion routines in TurboJPEG's
+ * underlying codec but does not execute any of the other steps in the JPEG
+ * compression process. Encoding CMYK source images to YUV is not supported.
+ *
+ * @param strides an array of integers, each specifying the number of bytes
+ * per line in the corresponding plane of the output image. Setting the
+ * stride for any plane to 0 is the same as setting it to the component width
+ * of the plane. If <code>strides</code> is null, then the strides for all
+ * planes will be set to their respective component widths. You can adjust
+ * the strides in order to add an arbitrary amount of line padding to each
+ * plane.
+ *
+ * @param flags the bitwise OR of one or more of
+ * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
+ *
+ * @return a YUV planar image.
+ */
+ public YUVImage encodeYUV(int[] strides, int flags) throws Exception {
+ if (srcWidth < 1 || srcHeight < 1)
+ throw new Exception(NO_ASSOC_ERROR);
+ if (subsamp < 0)
+ throw new Exception("Subsampling level not set");
+ YUVImage yuvImage = new YUVImage(srcWidth, strides, srcHeight, subsamp);
+ encodeYUV(yuvImage, flags);
+ return yuvImage;
+ }
+
/**
* @deprecated Use {@link #encodeYUV(int, int)} instead.
*/
/**
* @deprecated Use
* {@link #setSourceImage(BufferedImage, int, int, int, int)} and
- * {@link #encodeYUV(int)} instead.
+ * {@link #encodeYUV(int, int)} instead.
*/
@Deprecated
public byte[] encodeYUV(BufferedImage srcImage, int flags) throws Exception {
/**
* Returns the size of the image (in bytes) generated by the most recent
- * compress/encode operation.
+ * compress operation.
*
* @return the size of the image (in bytes) generated by the most recent
- * compress/encode operation
+ * compress operation.
*/
public int getCompressedSize() {
return compressedSize;
int stride, int height, int pixelFormat, byte[] dstBuf, int jpegSubsamp,
int jpegQual, int flags) throws Exception;
- private native int compressFromYUV(byte[] srcBuf, int width, int pad,
- int height, int subsamp, byte[] dstBuf, int jpegQual, int flags)
+ private native int compressFromYUV(byte[][] srcPlanes, int[] srcOffsets,
+ int width, int[] srcStrides, int height, int subsamp, byte[] dstBuf,
+ int jpegQual, int flags)
throws Exception;
private native void encodeYUV(byte[] srcBuf, int width, int pitch,
throws Exception; // deprecated
private native void encodeYUV(byte[] srcBuf, int x, int y, int width,
- int pitch, int height, int pixelFormat, byte[] dstBuf, int pad,
- int subsamp, int flags) throws Exception;
+ int pitch, int height, int pixelFormat, byte[][] dstPlanes,
+ int[] dstOffsets, int[] dstStrides, int subsamp, int flags)
+ throws Exception;
private native void encodeYUV(int[] srcBuf, int width, int stride,
int height, int pixelFormat, byte[] dstBuf, int subsamp, int flags)
throws Exception; // deprecated
private native void encodeYUV(int[] srcBuf, int x, int y, int width,
- int pitch, int height, int pixelFormat, byte[] dstBuf, int pad,
- int subsamp, int flags) throws Exception;
+ int srcStride, int height, int pixelFormat, byte[][] dstPlanes,
+ int[] dstOffsets, int[] dstStrides, int subsamp, int flags)
+ throws Exception;
static {
TJLoader.load();
/**
* Associate the JPEG image of length <code>imageSize</code> bytes stored in
- * <code>srcImage</code> with this decompressor instance. This image will
+ * <code>jpegImage</code> with this decompressor instance. This image will
* be used as the source image for subsequent decompress operations.
*
- * @param srcImage JPEG image buffer
+ * @param jpegImage JPEG image buffer
*
* @param imageSize size of the JPEG image (in bytes)
*/
- public void setSourceImage(byte[] srcImage, int imageSize)
+ public void setSourceImage(byte[] jpegImage, int imageSize)
throws Exception {
- if (srcImage == null || imageSize < 1)
+ if (jpegImage == null || imageSize < 1)
throw new Exception("Invalid argument in setSourceImage()");
- jpegBuf = srcImage;
+ jpegBuf = jpegImage;
jpegBufSize = imageSize;
decompressHeader(jpegBuf, jpegBufSize);
yuvImage = null;
* decompressor instance.
*
* @return the width of the source image (JPEG or YUV) associated with this
- * decompressor instance
+ * decompressor instance.
*/
public int getWidth() throws Exception {
if (yuvImage != null)
* decompressor instance.
*
* @return the height of the source image (JPEG or YUV) associated with this
- * decompressor instance
+ * decompressor instance.
*/
public int getHeight() throws Exception {
if (yuvImage != null)
* {@link TJ#SAMP_444 TJ.SAMP_*}.
*
* @return the level of chrominance subsampling used in the source image
- * (JPEG or YUV) associated with this decompressor instance
+ * (JPEG or YUV) associated with this decompressor instance.
*/
public int getSubsamp() throws Exception {
if (yuvImage != null)
* source image is YUV, then this always returns {@link TJ#CS_YCbCr}.
*
* @return the colorspace used in the source image (JPEG or YUV) associated
- * with this decompressor instance
+ * with this decompressor instance.
*/
public int getColorspace() throws Exception {
if (yuvImage != null)
}
/**
- * Returns the source image buffer associated with this decompressor
- * instance.
+ * Returns the JPEG image buffer associated with this decompressor instance.
*
- * @return the source image buffer associated with this decompressor instance
+ * @return the JPEG image buffer associated with this decompressor instance.
*/
- public byte[] getSourceBuf() throws Exception {
- if (yuvImage != null)
- return yuvImage.getBuf();
- if (jpegBuf == null)
- throw new Exception(NO_ASSOC_ERROR);
- return jpegBuf;
- }
-
- /**
- * @deprecated Use {@link #getSourceBuf} instead.
- */
- @Deprecated
public byte[] getJPEGBuf() throws Exception {
if (jpegBuf == null)
throw new Exception(NO_ASSOC_ERROR);
}
/**
- * Returns the size of the source image (in bytes) associated with this
+ * Returns the size of the JPEG image (in bytes) associated with this
* decompressor instance.
*
- * @return the size of the source image (in bytes) associated with this
- * decompressor instance
- */
- public int getSourceSize() throws Exception {
- if (yuvImage != null)
- return yuvImage.getSize();
- if (jpegBufSize < 1)
- throw new Exception(NO_ASSOC_ERROR);
- return jpegBufSize;
- }
-
- /**
- * @deprecated Use {@link #getSourceSize} instead.
+ * @return the size of the JPEG image (in bytes) associated with this
+ * decompressor instance.
*/
- @Deprecated
public int getJPEGSize() throws Exception {
if (jpegBufSize < 1)
throw new Exception(NO_ASSOC_ERROR);
*
* @return the width of the largest scaled-down image that the TurboJPEG
* decompressor can generate without exceeding the desired image width and
- * height
+ * height.
*/
public int getScaledWidth(int desiredWidth, int desiredHeight)
throws Exception {
*
* @return the height of the largest scaled-down image that the TurboJPEG
* decompressor can generate without exceeding the desired image width and
- * height
+ * height.
*/
public int getScaledHeight(int desiredWidth, int desiredHeight)
throws Exception {
pixelFormat < 0 || pixelFormat >= TJ.NUMPF || flags < 0)
throw new Exception("Invalid argument in decompress()");
if (yuvImage != null)
- decodeYUV(yuvImage.getBuf(), yuvImage.getPad(), yuvImage.getSubsamp(),
- dstBuf, x, y, yuvImage.getWidth(), pitch, yuvImage.getHeight(),
- pixelFormat, flags);
+ decodeYUV(yuvImage.getPlanes(), yuvImage.getOffsets(),
+ yuvImage.getStrides(), yuvImage.getSubsamp(), dstBuf, x, y,
+ yuvImage.getWidth(), pitch, yuvImage.getHeight(), pixelFormat,
+ flags);
else {
if (x > 0 || y > 0)
decompress(jpegBuf, jpegBufSize, dstBuf, x, y, desiredWidth, pitch,
* @param flags the bitwise OR of one or more of
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
*
- * @return a buffer containing the decompressed image
+ * @return a buffer containing the decompressed image.
*/
public byte[] decompress(int desiredWidth, int pitch, int desiredHeight,
int pixelFormat, int flags) throws Exception {
if (jpegSubsamp != dstImage.getSubsamp())
throw new Exception("YUVImage subsampling level does not match that of the JPEG image");
- decompressToYUV(jpegBuf, jpegBufSize, dstImage.getBuf(),
- dstImage.getWidth(), dstImage.getPad(),
- dstImage.getHeight(), flags);
+ decompressToYUV(jpegBuf, jpegBufSize, dstImage.getPlanes(),
+ dstImage.getOffsets(), dstImage.getWidth(),
+ dstImage.getStrides(), dstImage.getHeight(), flags);
}
/**
/**
* Decompress the JPEG source image associated with this decompressor
- * instance into a YUV planar image and return a <code>YUVImage</code>
- * instance containing the decompressed image. This method performs JPEG
- * decompression but leaves out the color conversion step, so a planar YUV
- * image is generated instead of an RGB or grayscale image. This method
- * cannot be used to decompress JPEG source images with the CMYK or YCCK
- * colorspace.
+ * instance into a set of Y, U (Cb), and V (Cr) image planes and return a
+ * <code>YUVImage</code> instance containing the decompressed image planes.
+ * This method performs JPEG decompression but leaves out the color
+ * conversion step, so a planar YUV image is generated instead of an RGB or
+ * grayscale image. This method cannot be used to decompress JPEG source
+ * images with the CMYK or YCCK colorspace.
+ *
+ * @param desiredWidth desired width (in pixels) of the YUV image. If the
+ * desired image dimensions are different than the dimensions of the JPEG
+ * image being decompressed, then TurboJPEG will use scaling in the JPEG
+ * decompressor to generate the largest possible image that will fit within
+ * the desired dimensions. Setting this to 0 is the same as setting it to
+ * the width of the JPEG image (in other words, the width will not be
+ * considered when determining the scaled image size.)
+ *
+ * @param strides an array of integers, each specifying the number of bytes
+ * per line in the corresponding plane of the output image. Setting the
+ * stride for any plane to 0 is the same as setting it to the scaled
+ * component width of the plane. If <tt>strides</tt> is NULL, then the
+ * strides for all planes will be set to their respective scaled component
+ * widths. You can adjust the strides in order to add an arbitrary amount of
+ * line padding to each plane.
+ *
+ * @param desiredHeight desired height (in pixels) of the YUV image. If the
+ * desired image dimensions are different than the dimensions of the JPEG
+ * image being decompressed, then TurboJPEG will use scaling in the JPEG
+ * decompressor to generate the largest possible image that will fit within
+ * the desired dimensions. Setting this to 0 is the same as setting it to
+ * the height of the JPEG image (in other words, the height will not be
+ * considered when determining the scaled image size.)
+ *
+ * @param flags the bitwise OR of one or more of
+ * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
+ *
+ * @return a YUV planar image.
+ */
+ public YUVImage decompressToYUV(int desiredWidth, int[] strides,
+ int desiredHeight,
+ int flags) throws Exception {
+ if (flags < 0)
+ throw new Exception("Invalid argument in decompressToYUV()");
+ if (jpegWidth < 1 || jpegHeight < 1 || jpegSubsamp < 0)
+ throw new Exception(NO_ASSOC_ERROR);
+ if (jpegSubsamp >= TJ.NUMSAMP)
+ throw new Exception("JPEG header information is invalid");
+ if (yuvImage != null)
+ throw new Exception("Source image is the wrong type");
+
+ int scaledWidth = getScaledWidth(desiredWidth, desiredHeight);
+ int scaledHeight = getScaledHeight(desiredWidth, desiredHeight);
+ YUVImage yuvImage = new YUVImage(scaledWidth, null, scaledHeight,
+ jpegSubsamp);
+ decompressToYUV(yuvImage, flags);
+ return yuvImage;
+ }
+
+ /**
+ * Decompress the JPEG source image associated with this decompressor
+ * instance into a unified YUV planar image buffer and return a
+ * <code>YUVImage</code> instance containing the decompressed image. This
+ * method performs JPEG decompression but leaves out the color conversion
+ * step, so a planar YUV image is generated instead of an RGB or grayscale
+ * image. This method cannot be used to decompress JPEG source images with
+ * the CMYK or YCCK colorspace.
*
* @param desiredWidth desired width (in pixels) of the YUV image. If the
* desired image dimensions are different than the dimensions of the JPEG
* @param flags the bitwise OR of one or more of
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
*
- * @return a YUV planar image
+ * @return a YUV planar image.
*/
public YUVImage decompressToYUV(int desiredWidth, int pad, int desiredHeight,
int flags) throws Exception {
pixelFormat < 0 || pixelFormat >= TJ.NUMPF || flags < 0)
throw new Exception("Invalid argument in decompress()");
if (yuvImage != null)
- decodeYUV(yuvImage.getBuf(), yuvImage.getPad(), yuvImage.getSubsamp(),
- dstBuf, x, y, yuvImage.getWidth(), stride,
- yuvImage.getHeight(), pixelFormat, flags);
+ decodeYUV(yuvImage.getPlanes(), yuvImage.getOffsets(),
+ yuvImage.getStrides(), yuvImage.getSubsamp(), dstBuf, x, y,
+ yuvImage.getWidth(), stride, yuvImage.getHeight(), pixelFormat,
+ flags);
else
decompress(jpegBuf, jpegBufSize, dstBuf, x, y, desiredWidth, stride,
desiredHeight, pixelFormat, flags);
DataBufferInt db = (DataBufferInt)wr.getDataBuffer();
int[] buf = db.getData();
if (yuvImage != null)
- decodeYUV(yuvImage.getBuf(), yuvImage.getPad(), yuvImage.getSubsamp(),
- buf, 0, 0, yuvImage.getWidth(), stride, yuvImage.getHeight(),
+ decodeYUV(yuvImage.getPlanes(), yuvImage.getOffsets(),
+ yuvImage.getStrides(), yuvImage.getSubsamp(), buf, 0, 0,
+ yuvImage.getWidth(), stride, yuvImage.getHeight(),
pixelFormat, flags);
else {
if (jpegBuf == null)
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
*
* @return a <code>BufferedImage</code> instance containing the
- * decompressed/decoded image
+ * decompressed/decoded image.
*/
public BufferedImage decompress(int desiredWidth, int desiredHeight,
int bufferedImageType, int flags)
private native void decompressToYUV(byte[] srcBuf, int size, byte[] dstBuf,
int flags) throws Exception; // deprecated
- private native void decompressToYUV(byte[] srcBuf, int size, byte[] dstBuf,
- int desiredWidth, int pad, int desiredheight, int flags) throws Exception;
+ private native void decompressToYUV(byte[] srcBuf, int size,
+ byte[][] dstPlanes, int[] dstOffsets, int desiredWidth, int[] dstStrides,
+ int desiredheight, int flags) throws Exception;
- private native void decodeYUV(byte[] srcBuf, int pad, int subsamp,
- byte[] dstBuf, int x, int y, int width, int pitch, int height,
- int pixelFormat, int flags) throws Exception;
+ private native void decodeYUV(byte[][] srcPlanes, int[] srcOffsets,
+ int[] srcStrides, int subsamp, byte[] dstBuf, int x, int y, int width,
+ int pitch, int height, int pixelFormat, int flags) throws Exception;
- private native void decodeYUV(byte[] srcBuf, int pad, int subsamp,
- int[] dstBuf, int x, int y, int width, int stride, int height,
- int pixelFormat, int flags) throws Exception;
+ private native void decodeYUV(byte[][] srcPlanes, int[] srcOffsets,
+ int[] srcStrides, int subsamp, int[] dstBuf, int x, int y, int width,
+ int stride, int height, int pixelFormat, int flags) throws Exception;
static {
TJLoader.load();
/**
* Returns numerator
+ *
* @return numerator
*/
public int getNum() {
/**
* Returns denominator
+ *
* @return denominator
*/
public int getDenom() {
* Returns the scaled value of <code>dimension</code>. This function
* performs the integer equivalent of
* <code>ceil(dimension * scalingFactor)</code>.
- * @return the scaled value of <code>dimension</code>
+ *
+ * @return the scaled value of <code>dimension</code>.
*/
public int getScaled(int dimension) {
return (dimension * num + denom - 1) / denom;
/**
* Returns true or false, depending on whether this instance and
* <code>other</code> have the same numerator and denominator.
+ *
* @return true or false, depending on whether this instance and
- * <code>other</code> have the same numerator and denominator
+ * <code>other</code> have the same numerator and denominator.
*/
public boolean equals(TJScalingFactor other) {
return (this.num == other.num && this.denom == other.denom);
/**
* Returns true or false, depending on whether this instance is equal to
* 1/1.
+ *
* @return true or false, depending on whether this instance is equal to
- * 1/1
+ * 1/1.
*/
public boolean isOne() {
return (num == 1 && denom == 1);
* corresponding transformed output image
*
* @return an array of {@link TJDecompressor} instances, each of
- * which has a transformed JPEG image associated with it
+ * which has a transformed JPEG image associated with it.
*
* @param flags the bitwise OR of one or more of
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
* generated by the most recent transform operation.
*
* @return an array containing the sizes of the transformed JPEG images
- * generated by the most recent transform operation
+ * generated by the most recent transform operation.
*/
public int[] getTransformedSizes() throws Exception {
if (transformedSizes == null)
* 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.
+ * of one of the components (Y, Cb, or Cr) at a particular location in the
+ * image. The width and height of each plane are determined by the image
+ * width, height, and level of chrominance subsampling. The luminance plane
+ * 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 luminance plane
+ * height 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 chrominance plane width is equal to the luminance plane
+ * width divided by the horizontal subsampling factor, and the chrominance
+ * plane height is equal to the luminance plane height 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
public class YUVImage {
private static final String NO_ASSOC_ERROR =
- "No YUV buffer is associated with this instance";
+ "No image data is associated with this instance";
/**
- * Create a <code>YUVImage</code> instance with a new image buffer.
+ * Create a new <code>YUVImage</code> instance backed by separate image
+ * planes, and allocate memory for the image planes.
+ *
+ * @param width width (in pixels) of the YUV image
+ *
+ * @param strides an array of integers, each specifying the number of bytes
+ * per line in the corresponding plane of the YUV image. Setting the stride
+ * for any plane to 0 is the same as setting it to the plane width (see
+ * {@link YUVImage above}.) If <code>strides</code> is null, then the
+ * strides for all planes will be set to their respective plane widths. When
+ * using this constructor, the stride for each plane must be equal to or
+ * greater than the plane width.
+ *
+ * @param height height (in pixels) of the YUV image
+ *
+ * @param subsamp the level of chrominance subsampling to be used in the YUV
+ * image (one of {@link TJ#SAMP_444 TJ.SAMP_*})
+ */
+ public YUVImage(int width, int[] strides, int height, int subsamp)
+ throws Exception {
+ setBuf(null, null, width, strides, height, subsamp, true);
+ }
+
+ /**
+ * Create a new <code>YUVImage</code> instance backed by a unified image
+ * buffer, and allocate memory for the image buffer.
*
* @param width width (in pixels) of the YUV image
*
* image (one of {@link TJ#SAMP_444 TJ.SAMP_*})
*/
public YUVImage(int width, int pad, int height, int subsamp)
- throws Exception {
+ throws Exception {
setBuf(new byte[TJ.bufSizeYUV(width, pad, height, subsamp)], width, pad,
height, subsamp);
}
/**
- * Create a <code>YUVImage</code> instance from an existing YUV planar image
+ * Create a new <code>YUVImage</code> instance from a set of existing image
+ * planes.
+ *
+ * @param planes an array of buffers representing the Y, U (Cb), and V (Cr)
+ * image planes (or just the Y plane, if the image is grayscale.) These
+ * planes can be contiguous or non-contiguous in memory. Plane
+ * <code>i</code> should be at least <code>offsets[i] +
+ * {@link TJ#planeSizeYUV TJ.planeSizeYUV}(i, width, strides[i], height, subsamp)</code>
+ * bytes in size.
+ *
+ * @param offsets If this <code>YUVImage</code> instance represents a
+ * subregion of a larger image, then <code>offsets[i]</code> specifies the
+ * offset (in bytes) of the subregion within plane <code>i</code> of the
+ * larger image. Setting this to null is the same as setting the offsets for
+ * all planes to 0.
+ *
+ * @param width width (in pixels) of the new YUV image (or subregion)
+ *
+ * @param strides an array of integers, each specifying the number of bytes
+ * per line in the corresponding plane of the YUV image. Setting the stride
+ * for any plane to 0 is the same as setting it to the plane width (see
+ * {@link YUVImage above}.) 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 add an arbitrary amount of line padding
+ * to each plane or to specify that this <code>YUVImage</code> instance is a
+ * subregion of a larger image (in which case, <code>strides[i]</code> should
+ * be set to the plane width of plane <code>i</code> in the larger image.)
+ *
+ * @param height height (in pixels) of the new YUV image (or subregion)
+ *
+ * @param subsamp the level of chrominance subsampling used in the YUV
+ * image (one of {@link TJ#SAMP_444 TJ.SAMP_*})
+ */
+ public YUVImage(byte[][] planes, int[] offsets, int width, int[] strides,
+ int height, int subsamp) throws Exception {
+ setBuf(planes, offsets, width, strides, height, subsamp, false);
+ }
+
+ /**
+ * Create a new <code>YUVImage</code> instance from an existing unified image
* buffer.
*
* @param yuvImage image buffer that contains or will contain YUV planar
}
/**
- * Assign an existing YUV planar image buffer to this <code>YUVImage</code>
- * instance.
+ * Assign a set of image planes to this <code>YUVImage</code> instance.
+ *
+ * @param planes an array of buffers representing the Y, U (Cb), and V (Cr)
+ * image planes (or just the Y plane, if the image is grayscale.) These
+ * planes can be contiguous or non-contiguous in memory. Plane
+ * <code>i</code> should be at least <code>offsets[i] +
+ * {@link TJ#planeSizeYUV TJ.planeSizeYUV}(i, width, strides[i], height, subsamp)</code>
+ * bytes in size.
+ *
+ * @param offsets If this <code>YUVImage</code> instance represents a
+ * subregion of a larger image, then <code>offsets[i]</code> specifies the
+ * offset (in bytes) of the subregion within plane <code>i</code> of the
+ * larger image. Setting this to null is the same as setting the offsets for
+ * all planes to 0.
+ *
+ * @param width width (in pixels) of the YUV image (or subregion)
+ *
+ * @param strides an array of integers, each specifying the number of bytes
+ * per line in the corresponding plane of the YUV image. Setting the stride
+ * for any plane to 0 is the same as setting it to the plane width (see
+ * {@link YUVImage above}.) 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 add an arbitrary amount of line padding
+ * to each plane or to specify that this <code>YUVImage</code> image is a
+ * subregion of a larger image (in which case, <code>strides[i]</code> should
+ * be set to the plane width of plane <code>i</code> in the larger image.)
+ *
+ * @param height height (in pixels) of the YUV image (or subregion)
+ *
+ * @param subsamp the level of chrominance subsampling used in the YUV
+ * image (one of {@link TJ#SAMP_444 TJ.SAMP_*})
+ */
+ public void setBuf(byte[][] planes, int[] offsets, int width, int strides[],
+ int height, int subsamp) throws Exception {
+ setBuf(planes, offsets, width, strides, height, subsamp, false);
+ }
+
+ private void setBuf(byte[][] planes, int[] offsets, int width, int strides[],
+ int height, int subsamp, boolean alloc) throws Exception {
+ if ((planes == null && !alloc) || width < 1 || height < 1 || subsamp < 0 ||
+ subsamp >= TJ.NUMSAMP)
+ throw new Exception("Invalid argument in YUVImage::setBuf()");
+
+ int nc = (subsamp == TJ.SAMP_GRAY ? 1 : 3);
+ if (planes.length != nc || (offsets != null && offsets.length != nc) ||
+ (strides != null && strides.length != nc))
+ throw new Exception("YUVImage::setBuf(): planes, offsets, or strides array is the wrong size");
+
+ if (offsets == null)
+ offsets = new int[nc];
+ if (strides == null)
+ strides = new int[nc];
+
+ for (int i = 0; i < nc; i++) {
+ int pw = TJ.planeWidth(i, width, subsamp);
+ int ph = TJ.planeHeight(i, height, subsamp);
+ int planeSize = TJ.planeSizeYUV(i, width, strides[i], height, subsamp);
+
+ if (strides[i] == 0)
+ strides[i] = pw;
+ if (alloc) {
+ if (strides[i] < pw)
+ throw new Exception("Stride must be >= plane width when allocating a new YUV image");
+ planes[i] = new byte[strides[i] * ph];
+ }
+ if (planes[i] == null || offsets[i] < 0)
+ throw new Exception("Invalid argument in YUVImage::setBuf()");
+ if (strides[i] < 0 && offsets[i] - planeSize + pw < 0)
+ throw new Exception("Stride for plane " + i + " would cause memory to be accessed below plane boundary");
+ if (planes[i].length < offsets[i] + planeSize)
+ throw new Exception("Image plane " + i + " is not large enough");
+ }
+
+ yuvPlanes = planes;
+ yuvOffsets = offsets;
+ yuvWidth = width;
+ yuvStrides = strides;
+ yuvHeight = height;
+ yuvSubsamp = subsamp;
+ }
+
+ /**
+ * Assign a unified image buffer to this <code>YUVImage</code> instance.
*
* @param yuvImage image buffer that contains or will contain YUV planar
* image data. Use {@link TJ#bufSizeYUV} to determine the minimum size for
int subsamp) throws Exception {
if (yuvImage == null || width < 1 || pad < 1 || ((pad & (pad - 1)) != 0) ||
height < 1 || subsamp < 0 || subsamp >= TJ.NUMSAMP)
- throw new Exception("Invalid argument in YUVImage()");
+ throw new Exception("Invalid argument in YUVImage::setBuf()");
if (yuvImage.length < TJ.bufSizeYUV(width, pad, height, subsamp))
throw new Exception("YUV image buffer is not large enough");
- yuvBuf = yuvImage;
- yuvWidth = width;
+
+ int nc = (subsamp == TJ.SAMP_GRAY ? 1 : 3);
+ byte[][] planes = new byte[nc][];
+ int[] strides = new int[nc];
+ int[] offsets = new int[nc];
+
+ planes[0] = yuvImage;
+ strides[0] = PAD(TJ.planeWidth(0, width, subsamp), pad);
+ if (subsamp != TJ.SAMP_GRAY) {
+ strides[1] = strides[2] = PAD(TJ.planeWidth(1, width, subsamp), pad);
+ planes[1] = planes[2] = yuvImage;
+ offsets[1] = offsets[0] +
+ strides[0] * TJ.planeHeight(0, height, subsamp);
+ offsets[2] = offsets[1] +
+ strides[1] * TJ.planeHeight(1, height, subsamp);
+ }
+
yuvPad = pad;
- yuvHeight = height;
- yuvSubsamp = subsamp;
+ setBuf(planes, offsets, width, strides, height, subsamp);
}
/**
- * Returns the width of the YUV image.
+ * Returns the width of the YUV image (or subregion.)
*
- * @return the width of the YUV image
+ * @return the width of the YUV image (or subregion)
*/
public int getWidth() throws Exception {
if (yuvWidth < 1)
}
/**
- * Returns the height of the YUV image.
+ * Returns the height of the YUV image (or subregion.)
*
- * @return the height of the YUV image
+ * @return the height of the YUV image (or subregion)
*/
public int getHeight() throws Exception {
if (yuvHeight < 1)
}
/**
- * Returns the line padding used in the YUV image buffer.
+ * Returns the line padding used in the YUV image buffer (if this image is
+ * stored in a unified buffer rather than separate image planes.)
*
* @return the line padding used in the YUV image buffer
*/
public int getPad() throws Exception {
- if (yuvPad < 1 || ((yuvPad & (yuvPad - 1)) != 0))
+ if (yuvPlanes == null)
throw new Exception(NO_ASSOC_ERROR);
+ if (yuvPad < 1 || ((yuvPad & (yuvPad - 1)) != 0))
+ throw new Exception("Image is not stored in a unified buffer");
return yuvPad;
}
+ /**
+ * Returns the number of bytes per line of each plane in the YUV image.
+ *
+ * @return the number of bytes per line of each plane in the YUV image
+ */
+ public int[] getStrides() throws Exception {
+ if (yuvStrides == null)
+ throw new Exception(NO_ASSOC_ERROR);
+ return yuvStrides;
+ }
+
+ /**
+ * Returns the offsets (in bytes) of each plane within the planes of a larger
+ * YUV image.
+ *
+ * @return the offsets (in bytes) of each plane within the planes of a larger
+ * YUV image
+ */
+ public int[] getOffsets() throws Exception {
+ if (yuvOffsets == null)
+ throw new Exception(NO_ASSOC_ERROR);
+ return yuvOffsets;
+ }
+
/**
* Returns the level of chrominance subsampling used in the YUV image. See
* {@link TJ#SAMP_444 TJ.SAMP_*}.
}
/**
- * Returns the YUV image buffer
+ * Returns the YUV image planes. If the image is stored in a unified buffer,
+ * then all image planes will point to that buffer.
+ *
+ * @return the YUV image planes
+ */
+ public byte[][] getPlanes() throws Exception {
+ if (yuvPlanes == null)
+ throw new Exception(NO_ASSOC_ERROR);
+ return yuvPlanes;
+ }
+
+ /**
+ * Returns the YUV image buffer (if this image is stored in a unified
+ * buffer rather than separate image planes.)
*
* @return the YUV image buffer
*/
public byte[] getBuf() throws Exception {
- if (yuvBuf == null)
+ if (yuvPlanes == null || yuvSubsamp < 0 || yuvSubsamp >= TJ.NUMSAMP)
throw new Exception(NO_ASSOC_ERROR);
- return yuvBuf;
+ int nc = (yuvSubsamp == TJ.SAMP_GRAY ? 1 : 3);
+ for (int i = 1; i < nc; i++) {
+ if (yuvPlanes[i] != yuvPlanes[0])
+ throw new Exception("Image is not stored in a unified buffer");
+ }
+ return yuvPlanes[0];
}
/**
- * Returns the size (in bytes) of the YUV image buffer
+ * Returns the size (in bytes) of the YUV image buffer (if this image is
+ * stored in a unified buffer rather than separate image planes.)
*
* @return the size (in bytes) of the YUV image buffer
*/
- public int getSize() throws Exception {
- if (yuvBuf == null)
- throw new Exception(NO_ASSOC_ERROR);
- return TJ.bufSizeYUV(yuvWidth, yuvPad, yuvHeight, yuvSubsamp);
- }
+ public int getSize() throws Exception {
+ if (yuvPlanes == null || yuvSubsamp < 0 || yuvSubsamp >= TJ.NUMSAMP)
+ throw new Exception(NO_ASSOC_ERROR);
+ int nc = (yuvSubsamp == TJ.SAMP_GRAY ? 1 : 3);
+ if (yuvPad < 1)
+ throw new Exception("Image is not stored in a unified buffer");
+ for (int i = 1; i < nc; i++) {
+ if (yuvPlanes[i] != yuvPlanes[0])
+ throw new Exception("Image is not stored in a unified buffer");
+ }
+ return TJ.bufSizeYUV(yuvWidth, yuvPad, yuvHeight, yuvSubsamp);
+ }
+
+ private static final int PAD(int v, int p) {
+ return (v + p - 1) & (~(p - 1));
+ }
protected long handle = 0;
- protected byte[] yuvBuf = null;
+ protected byte[][] yuvPlanes = null;
+ protected int[] yuvOffsets = null;
+ protected int[] yuvStrides = null;
protected int yuvPad = 0;
protected int yuvWidth = 0;
protected int yuvHeight = 0;
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV__III
(JNIEnv *, jclass, jint, jint, jint);
+/*
+ * Class: org_libjpegturbo_turbojpeg_TJ
+ * Method: planeSizeYUV
+ * Signature: (IIIII)I
+ */
+JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_planeSizeYUV__IIIII
+ (JNIEnv *, jclass, jint, jint, jint, jint, jint);
+
+/*
+ * Class: org_libjpegturbo_turbojpeg_TJ
+ * Method: planeWidth
+ * Signature: (III)I
+ */
+JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_planeWidth__III
+ (JNIEnv *, jclass, jint, jint, jint);
+
+/*
+ * Class: org_libjpegturbo_turbojpeg_TJ
+ * Method: planeHeight
+ * Signature: (III)I
+ */
+JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_planeHeight__III
+ (JNIEnv *, jclass, jint, jint, jint);
+
/*
* Class: org_libjpegturbo_turbojpeg_TJ
* Method: getScalingFactors
/*
* Class: org_libjpegturbo_turbojpeg_TJCompressor
* Method: compressFromYUV
- * Signature: ([BIIII[BII)I
+ * Signature: ([[B[II[III[BII)I
*/
-JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFromYUV___3BIIII_3BII
- (JNIEnv *, jobject, jbyteArray, jint, jint, jint, jint, jbyteArray, jint, jint);
+JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFromYUV___3_3B_3II_3III_3BII
+ (JNIEnv *, jobject, jobjectArray, jintArray, jint, jintArray, jint, jint, jbyteArray, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJCompressor
/*
* Class: org_libjpegturbo_turbojpeg_TJCompressor
* Method: encodeYUV
- * Signature: ([BIIIIII[BIII)V
+ * Signature: ([BIIIIII[[B[I[III)V
*/
-JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIIIII_3BIII
- (JNIEnv *, jobject, jbyteArray, jint, jint, jint, jint, jint, jint, jbyteArray, jint, jint, jint);
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIIIII_3_3B_3I_3III
+ (JNIEnv *, jobject, jbyteArray, jint, jint, jint, jint, jint, jint, jobjectArray, jintArray, jintArray, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJCompressor
/*
* Class: org_libjpegturbo_turbojpeg_TJCompressor
* Method: encodeYUV
- * Signature: ([IIIIIII[BIII)V
+ * Signature: ([IIIIIII[[B[I[III)V
*/
-JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIIIII_3BIII
- (JNIEnv *, jobject, jintArray, jint, jint, jint, jint, jint, jint, jbyteArray, jint, jint, jint);
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIIIII_3_3B_3I_3III
+ (JNIEnv *, jobject, jintArray, jint, jint, jint, jint, jint, jint, jobjectArray, jintArray, jintArray, jint, jint);
#ifdef __cplusplus
}
/*
* Class: org_libjpegturbo_turbojpeg_TJDecompressor
* Method: decompressToYUV
- * Signature: ([BI[BIIII)V
+ * Signature: ([BI[[B[II[III)V
*/
-JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3BIIII
- (JNIEnv *, jobject, jbyteArray, jint, jbyteArray, jint, jint, jint, jint);
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3_3B_3II_3III
+ (JNIEnv *, jobject, jbyteArray, jint, jobjectArray, jintArray, jint, jintArray, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJDecompressor
* Method: decodeYUV
- * Signature: ([BII[BIIIIIII)V
+ * Signature: ([[B[I[II[BIIIIIII)V
*/
-JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3BIIIIIII
- (JNIEnv *, jobject, jbyteArray, jint, jint, jbyteArray, jint, jint, jint, jint, jint, jint, jint);
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3_3B_3I_3II_3BIIIIIII
+ (JNIEnv *, jobject, jobjectArray, jintArray, jintArray, jint, jbyteArray, jint, jint, jint, jint, jint, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJDecompressor
* Method: decodeYUV
- * Signature: ([BII[IIIIIIII)V
+ * Signature: ([[B[I[II[IIIIIIII)V
*/
-JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3IIIIIIII
- (JNIEnv *, jobject, jbyteArray, jint, jint, jintArray, jint, jint, jint, jint, jint, jint, jint);
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3_3B_3I_3II_3IIIIIIII
+ (JNIEnv *, jobject, jobjectArray, jintArray, jintArray, jint, jintArray, jint, jint, jint, jint, jint, jint, jint);
#ifdef __cplusplus
}
#include "java/org_libjpegturbo_turbojpeg_TJDecompressor.h"
#include "java/org_libjpegturbo_turbojpeg_TJ.h"
+#define PAD(v, p) ((v+(p)-1)&(~((p)-1)))
+
#define _throw(msg) { \
jclass _exccls=(*env)->FindClass(env, "java/lang/Exception"); \
if(!_exccls) goto bailout; \
4, height, subsamp);
}
+/* TurboJPEG 1.4.x: TJ::planeSizeYUV() */
+JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_planeSizeYUV__IIIII
+ (JNIEnv *env, jclass cls, jint componentID, jint width, jint stride,
+ jint height, jint subsamp)
+{
+ jint retval=(jint)tjPlaneSizeYUV(componentID, width, stride, height,
+ subsamp);
+ if(retval==-1) _throw(tjGetErrorStr());
+
+ bailout:
+ return retval;
+}
+
+/* TurboJPEG 1.4.x: TJ::planeWidth() */
+JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_planeWidth__III
+ (JNIEnv *env, jclass cls, jint componentID, jint width, jint subsamp)
+{
+ jint retval=(jint)tjPlaneWidth(componentID, width, subsamp);
+ if(retval==-1) _throw(tjGetErrorStr());
+
+ bailout:
+ return retval;
+}
+
+/* TurboJPEG 1.4.x: TJ::planeHeight() */
+JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_planeHeight__III
+ (JNIEnv *env, jclass cls, jint componentID, jint height, jint subsamp)
+{
+ jint retval=(jint)tjPlaneHeight(componentID, height, subsamp);
+ if(retval==-1) _throw(tjGetErrorStr());
+
+ bailout:
+ return retval;
+}
+
/* TurboJPEG 1.2.x: TJCompressor::init() */
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_init
(JNIEnv *env, jobject obj)
}
/* TurboJPEG 1.4.x: TJCompressor::compressFromYUV() */
-JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFromYUV___3BIIII_3BII
- (JNIEnv *env, jobject obj, jbyteArray src, jint width, jint pad, jint height,
- jint subsamp, jbyteArray dst, jint jpegQual, jint flags)
+JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFromYUV___3_3B_3II_3III_3BII
+ (JNIEnv *env, jobject obj, jobjectArray srcobjs, jintArray jSrcOffsets,
+ jint width, jintArray jSrcStrides, jint height, jint subsamp,
+ jbyteArray dst, jint jpegQual, jint flags)
{
tjhandle handle=0;
unsigned long jpegSize=0;
- jsize arraySize=0;
- unsigned char *srcBuf=NULL, *jpegBuf=NULL;
+ jbyteArray jSrcPlanes[3]={NULL, NULL, NULL};
+ unsigned char *srcPlanes[3], *jpegBuf=NULL;
+ int *srcOffsets=NULL, *srcStrides=NULL;
+ int nc=(subsamp==org_libjpegturbo_turbojpeg_TJ_SAMP_GRAY? 1:3), i;
gethandle();
- arraySize=tjBufSizeYUV2(width, pad, height, subsamp);
- if((*env)->GetArrayLength(env, src)<arraySize)
- _throw("Source buffer is not large enough");
+ if(subsamp<0 || subsamp>=org_libjpegturbo_turbojpeg_TJ_NUMSAMP)
+ _throw("Invalid argument in compressFromYUV()");
+ if(org_libjpegturbo_turbojpeg_TJ_NUMSAMP!=TJ_NUMSAMP)
+ _throw("Mismatch between Java and C API");
+
+ if((*env)->GetArrayLength(env, srcobjs)<nc)
+ _throw("Planes array is too small for the subsampling type");
+ if((*env)->GetArrayLength(env, jSrcOffsets)<nc)
+ _throw("Offsets array is too small for the subsampling type");
+ if((*env)->GetArrayLength(env, jSrcStrides)<nc)
+ _throw("Strides array is too small for the subsampling type");
+
jpegSize=tjBufSize(width, height, subsamp);
if((*env)->GetArrayLength(env, dst)<(jsize)jpegSize)
_throw("Destination buffer is not large enough");
- bailif0(srcBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));
+ bailif0(srcOffsets=(*env)->GetPrimitiveArrayCritical(env, jSrcOffsets, 0));
+ bailif0(srcStrides=(*env)->GetPrimitiveArrayCritical(env, jSrcStrides, 0));
+ for(i=0; i<nc; i++)
+ {
+ int planeSize=tjPlaneSizeYUV(i, width, srcStrides[i], height, subsamp);
+ int pw=tjPlaneWidth(i, width, subsamp);
+
+ if(planeSize<0 || pw<0)
+ _throw(tjGetErrorStr());
+
+ if(srcOffsets[i]<0)
+ _throw("Invalid argument in compressFromYUV()");
+ if(srcStrides[i]<0 && srcOffsets[i]-planeSize+pw<0)
+ _throw("Negative plane stride would cause memory to be accessed below plane boundary");
+
+ bailif0(jSrcPlanes[i]=(*env)->GetObjectArrayElement(env, srcobjs, i));
+ if((*env)->GetArrayLength(env, jSrcPlanes[i])<srcOffsets[i]+planeSize)
+ _throw("Source plane is not large enough");
+
+ bailif0(srcPlanes[i]=(*env)->GetPrimitiveArrayCritical(env, jSrcPlanes[i],
+ 0));
+ srcPlanes[i]=&srcPlanes[i][srcOffsets[i]];
+ }
bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));
- if(tjCompressFromYUV(handle, srcBuf, width, pad, height, subsamp, &jpegBuf,
- &jpegSize, jpegQual, flags|TJFLAG_NOREALLOC)==-1)
+ if(tjCompressFromYUVPlanes(handle, srcPlanes, width, srcStrides, height,
+ subsamp, &jpegBuf, &jpegSize, jpegQual, flags|TJFLAG_NOREALLOC)==-1)
_throw(tjGetErrorStr());
bailout:
if(jpegBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, jpegBuf, 0);
- if(srcBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0);
+ for(i=0; i<nc; i++)
+ {
+ if(srcPlanes[i] && jSrcPlanes[i])
+ (*env)->ReleasePrimitiveArrayCritical(env, jSrcPlanes[i], srcPlanes[i],
+ 0);
+ }
+ if(srcStrides)
+ (*env)->ReleasePrimitiveArrayCritical(env, jSrcStrides, srcStrides, 0);
+ if(srcOffsets)
+ (*env)->ReleasePrimitiveArrayCritical(env, jSrcOffsets, srcOffsets, 0);
return (jint)jpegSize;
}
static void TJCompressor_encodeYUV
(JNIEnv *env, jobject obj, jarray src, jint srcElementSize, jint x, jint y,
- jint width, jint pitch, jint height, jint pf, jbyteArray dst, jint pad,
- jint subsamp, jint flags)
+ jint width, jint pitch, jint height, jint pf, jobjectArray dstobjs,
+ jintArray jDstOffsets, jintArray jDstStrides, jint subsamp, jint flags)
{
tjhandle handle=0;
- jsize arraySize=0, actualPitch, yuvSize;
- unsigned char *srcBuf=NULL, *dstBuf=NULL;
+ jsize arraySize=0, actualPitch;
+ jbyteArray jDstPlanes[3]={NULL, NULL, NULL};
+ unsigned char *srcBuf=NULL, *dstPlanes[3];
+ int *dstOffsets=NULL, *dstStrides=NULL;
+ int nc=(subsamp==org_libjpegturbo_turbojpeg_TJ_SAMP_GRAY? 1:3), i;
gethandle();
if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF || width<1 || height<1
- || pitch<0)
+ || pitch<0 || subsamp<0 || subsamp>=org_libjpegturbo_turbojpeg_TJ_NUMSAMP)
_throw("Invalid argument in encodeYUV()");
- if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF)
+ if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF
+ || org_libjpegturbo_turbojpeg_TJ_NUMSAMP!=TJ_NUMSAMP)
_throw("Mismatch between Java and C API");
+ if((*env)->GetArrayLength(env, dstobjs)<nc)
+ _throw("Planes array is too small for the subsampling type");
+ if((*env)->GetArrayLength(env, jDstOffsets)<nc)
+ _throw("Offsets array is too small for the subsampling type");
+ if((*env)->GetArrayLength(env, jDstStrides)<nc)
+ _throw("Strides array is too small for the subsampling type");
+
actualPitch=(pitch==0)? width*tjPixelSize[pf]:pitch;
arraySize=(y+height-1)*actualPitch + (x+width)*tjPixelSize[pf];
if((*env)->GetArrayLength(env, src)*srcElementSize<arraySize)
_throw("Source buffer is not large enough");
- yuvSize=(jsize)tjBufSizeYUV2(width, pad, height, subsamp);
- if(yuvSize==(unsigned long)-1)
- _throw(tjGetErrorStr());
- if((*env)->GetArrayLength(env, dst)<yuvSize)
- _throw("Destination buffer is not large enough");
+ bailif0(dstOffsets=(*env)->GetPrimitiveArrayCritical(env, jDstOffsets, 0));
+ bailif0(dstStrides=(*env)->GetPrimitiveArrayCritical(env, jDstStrides, 0));
+ for(i=0; i<nc; i++)
+ {
+ int planeSize=tjPlaneSizeYUV(i, width, dstStrides[i], height, subsamp);
+ int pw=tjPlaneWidth(i, width, subsamp);
+
+ if(planeSize<0 || pw<0)
+ _throw(tjGetErrorStr());
+
+ if(dstOffsets[i]<0)
+ _throw("Invalid argument in encodeYUV()");
+ if(dstStrides[i]<0 && dstOffsets[i]-planeSize+pw<0)
+ _throw("Negative plane stride would cause memory to be accessed below plane boundary");
+
+ bailif0(jDstPlanes[i]=(*env)->GetObjectArrayElement(env, dstobjs, i));
+ if((*env)->GetArrayLength(env, jDstPlanes[i])<dstOffsets[i]+planeSize)
+ _throw("Destination plane is not large enough");
+
+ bailif0(dstPlanes[i]=(*env)->GetPrimitiveArrayCritical(env, jDstPlanes[i],
+ 0));
+ dstPlanes[i]=&dstPlanes[i][dstOffsets[i]];
+ }
bailif0(srcBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));
- bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));
- if(tjEncodeYUV3(handle, &srcBuf[y*actualPitch + x*tjPixelSize[pf]], width,
- pitch, height, pf, dstBuf, pad, subsamp, flags)==-1)
+ if(tjEncodeYUVPlanes(handle, &srcBuf[y*actualPitch + x*tjPixelSize[pf]],
+ width, pitch, height, pf, dstPlanes, dstStrides, subsamp, flags)==-1)
_throw(tjGetErrorStr());
bailout:
- if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
if(srcBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0);
+ for(i=0; i<nc; i++)
+ {
+ if(dstPlanes[i] && jDstPlanes[i])
+ (*env)->ReleasePrimitiveArrayCritical(env, jDstPlanes[i], dstPlanes[i],
+ 0);
+ }
+ if(dstStrides)
+ (*env)->ReleasePrimitiveArrayCritical(env, jDstStrides, dstStrides, 0);
+ if(dstOffsets)
+ (*env)->ReleasePrimitiveArrayCritical(env, jDstOffsets, dstOffsets, 0);
return;
}
/* TurboJPEG 1.4.x: TJCompressor::encodeYUV() byte source */
-JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIIIII_3BIII
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIIIII_3_3B_3I_3III
(JNIEnv *env, jobject obj, jbyteArray src, jint x, jint y, jint width,
- jint pitch, jint height, jint pf, jbyteArray dst, jint pad, jint subsamp,
- jint flags)
-{
- TJCompressor_encodeYUV(env, obj, src, 1, x, y, width, pitch, height, pf, dst,
- pad, subsamp, flags);
-}
-
-/* TurboJPEG 1.2.x: TJCompressor::encodeYUV() byte source */
-JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIII_3BII
- (JNIEnv *env, jobject obj, jbyteArray src, jint width, jint pitch,
- jint height, jint pf, jbyteArray dst, jint subsamp, jint flags)
+ jint pitch, jint height, jint pf, jobjectArray dstobjs,
+ jintArray jDstOffsets, jintArray jDstStrides, jint subsamp, jint flags)
{
- TJCompressor_encodeYUV(env, obj, src, 1, 0, 0, width, pitch, height, pf, dst,
- 4, subsamp, flags);
+ TJCompressor_encodeYUV(env, obj, src, 1, x, y, width, pitch, height, pf,
+ dstobjs, jDstOffsets, jDstStrides, subsamp, flags);
}
/* TurboJPEG 1.4.x: TJCompressor::encodeYUV() int source */
-JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIIIII_3BIII
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIIIII_3_3B_3I_3III
(JNIEnv *env, jobject obj, jintArray src, jint x, jint y, jint width,
- jint stride, jint height, jint pf, jbyteArray dst, jint pad, jint subsamp,
- jint flags)
+ jint stride, jint height, jint pf, jobjectArray dstobjs,
+ jintArray jDstOffsets, jintArray jDstStrides, jint subsamp, jint flags)
{
if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF)
_throw("Invalid argument in encodeYUV()");
_throw("Pixel format must be 32-bit when encoding from an integer buffer.");
TJCompressor_encodeYUV(env, obj, src, sizeof(jint), x, y, width,
- stride*sizeof(jint), height, pf, dst, pad, subsamp, flags);
+ stride*sizeof(jint), height, pf, dstobjs, jDstOffsets, jDstStrides,
+ subsamp, flags);
bailout:
return;
}
+JNIEXPORT void JNICALL TJCompressor_encodeYUV_12
+ (JNIEnv *env, jobject obj, jarray src, jint srcElementSize, jint width,
+ jint pitch, jint height, jint pf, jbyteArray dst, jint subsamp, jint flags)
+{
+ tjhandle handle=0;
+ jsize arraySize=0;
+ unsigned char *srcBuf=NULL, *dstBuf=NULL;
+
+ gethandle();
+
+ if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF || width<1 || height<1
+ || pitch<0)
+ _throw("Invalid argument in encodeYUV()");
+ if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF)
+ _throw("Mismatch between Java and C API");
+
+ arraySize=(pitch==0)? width*tjPixelSize[pf]*height:pitch*height;
+ if((*env)->GetArrayLength(env, src)*srcElementSize<arraySize)
+ _throw("Source buffer is not large enough");
+ if((*env)->GetArrayLength(env, dst)
+ <(jsize)tjBufSizeYUV(width, height, subsamp))
+ _throw("Destination buffer is not large enough");
+
+ bailif0(srcBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));
+ bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));
+
+ if(tjEncodeYUV2(handle, srcBuf, width, pitch, height, pf, dstBuf, subsamp,
+ flags)==-1)
+ _throw(tjGetErrorStr());
+
+ bailout:
+ if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
+ if(srcBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0);
+ return;
+}
+
+/* TurboJPEG 1.2.x: TJCompressor::encodeYUV() byte source */
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIII_3BII
+ (JNIEnv *env, jobject obj, jbyteArray src, jint width, jint pitch,
+ jint height, jint pf, jbyteArray dst, jint subsamp, jint flags)
+{
+ TJCompressor_encodeYUV_12(env, obj, src, 1, width, pitch, height, pf, dst,
+ subsamp, flags);
+}
+
/* TurboJPEG 1.2.x: TJCompressor::encodeYUV() int source */
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIII_3BII
(JNIEnv *env, jobject obj, jintArray src, jint width, jint stride,
if(tjPixelSize[pf]!=sizeof(jint))
_throw("Pixel format must be 32-bit when encoding from an integer buffer.");
- TJCompressor_encodeYUV(env, obj, src, sizeof(jint), 0, 0, width,
- stride*sizeof(jint), height, pf, dst, 4, subsamp, flags);
+ TJCompressor_encodeYUV_12(env, obj, src, sizeof(jint), width,
+ stride*sizeof(jint), height, pf, dst, subsamp, flags);
bailout:
return;
}
/* TurboJPEG 1.4.x: TJDecompressor::decompressToYUV() */
-JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3BIIII
- (JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jbyteArray dst,
- jint desiredWidth, jint pad, jint desiredHeight, jint flags)
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3_3B_3II_3III
+ (JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize,
+ jobjectArray dstobjs, jintArray jDstOffsets, jint desiredWidth,
+ jintArray jDstStrides, jint desiredHeight, jint flags)
{
tjhandle handle=0;
- unsigned char *jpegBuf=NULL, *dstBuf=NULL;
+ jbyteArray jDstPlanes[3]={NULL, NULL, NULL};
+ unsigned char *jpegBuf=NULL, *dstPlanes[3];
+ int *dstOffsets=NULL, *dstStrides=NULL;
int jpegSubsamp=-1, jpegWidth=0, jpegHeight=0;
- jsize yuvSize;
+ int nc=0, i, width, height, scaledWidth, scaledHeight, nsf=0;
+ tjscalingfactor *sf;
+
gethandle();
bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegHeight", "I"));
jpegHeight=(int)(*env)->GetIntField(env, obj, _fid);
- yuvSize=(jsize)tjBufSizeYUV2(desiredWidth==0? jpegWidth:desiredWidth,
- pad, desiredHeight==0? jpegHeight:desiredHeight, jpegSubsamp);
- if(yuvSize==(unsigned long)-1)
+ nc=(jpegSubsamp==org_libjpegturbo_turbojpeg_TJ_SAMP_GRAY? 1:3);
+
+ width=desiredWidth; height=desiredHeight;
+ if(width==0) width=jpegWidth;
+ if(height==0) height=jpegHeight;
+ sf=tjGetScalingFactors(&nsf);
+ if(!sf || nsf<1)
_throw(tjGetErrorStr());
- if((*env)->GetArrayLength(env, dst)<yuvSize)
- _throw("Destination buffer is not large enough");
+ for(i=0; i<nsf; i++)
+ {
+ scaledWidth=TJSCALED(jpegWidth, sf[i]);
+ scaledHeight=TJSCALED(jpegHeight, sf[i]);
+ if(scaledWidth<=width && scaledHeight<=height)
+ break;
+ }
+
+ bailif0(dstOffsets=(*env)->GetPrimitiveArrayCritical(env, jDstOffsets, 0));
+ bailif0(dstStrides=(*env)->GetPrimitiveArrayCritical(env, jDstStrides, 0));
+ for(i=0; i<nc; i++)
+ {
+ int planeSize=tjPlaneSizeYUV(i, scaledWidth, dstStrides[i], scaledHeight,
+ jpegSubsamp);
+ int pw=tjPlaneWidth(i, scaledWidth, jpegSubsamp);
+
+ if(planeSize<0 || pw<0)
+ _throw(tjGetErrorStr());
+
+ if(dstOffsets[i]<0)
+ _throw("Invalid argument in decompressToYUV()");
+ if(dstStrides[i]<0 && dstOffsets[i]-planeSize+pw<0)
+ _throw("Negative plane stride would cause memory to be accessed below plane boundary");
+
+ bailif0(jDstPlanes[i]=(*env)->GetObjectArrayElement(env, dstobjs, i));
+ if((*env)->GetArrayLength(env, jDstPlanes[i])<dstOffsets[i]+planeSize)
+ _throw("Destination plane is not large enough");
+
+ bailif0(dstPlanes[i]=(*env)->GetPrimitiveArrayCritical(env, jDstPlanes[i],
+ 0));
+ dstPlanes[i]=&dstPlanes[i][dstOffsets[i]];
+ }
bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));
- bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));
- if(tjDecompressToYUV2(handle, jpegBuf, (unsigned long)jpegSize, dstBuf,
- desiredWidth, pad, desiredHeight, flags)==-1)
+ if(tjDecompressToYUVPlanes(handle, jpegBuf, (unsigned long)jpegSize,
+ dstPlanes, desiredWidth, dstStrides, desiredHeight, flags)==-1)
_throw(tjGetErrorStr());
bailout:
- if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
if(jpegBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0);
+ for(i=0; i<nc; i++)
+ {
+ if(dstPlanes[i] && jDstPlanes[i])
+ (*env)->ReleasePrimitiveArrayCritical(env, jDstPlanes[i], dstPlanes[i],
+ 0);
+ }
+ if(dstStrides)
+ (*env)->ReleasePrimitiveArrayCritical(env, jDstStrides, dstStrides, 0);
+ if(dstOffsets)
+ (*env)->ReleasePrimitiveArrayCritical(env, jDstOffsets, dstOffsets, 0);
return;
}
(JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jbyteArray dst,
jint flags)
{
- Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3BIIII(
- env, obj, src, jpegSize, dst, 0, 4, 0, flags);
+ tjhandle handle=0;
+ unsigned char *jpegBuf=NULL, *dstBuf=NULL;
+ int jpegSubsamp=-1, jpegWidth=0, jpegHeight=0;
+
+ gethandle();
+
+ if((*env)->GetArrayLength(env, src)<jpegSize)
+ _throw("Source buffer is not large enough");
+ bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegSubsamp", "I"));
+ jpegSubsamp=(int)(*env)->GetIntField(env, obj, _fid);
+ bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegWidth", "I"));
+ jpegWidth=(int)(*env)->GetIntField(env, obj, _fid);
+ bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegHeight", "I"));
+ jpegHeight=(int)(*env)->GetIntField(env, obj, _fid);
+ if((*env)->GetArrayLength(env, dst)
+ <(jsize)tjBufSizeYUV(jpegWidth, jpegHeight, jpegSubsamp))
+ _throw("Destination buffer is not large enough");
+
+ bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));
+ bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));
+
+ if(tjDecompressToYUV(handle, jpegBuf, (unsigned long)jpegSize, dstBuf,
+ flags)==-1)
+ _throw(tjGetErrorStr());
+
+ bailout:
+ if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
+ if(jpegBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0);
+ return;
}
static void TJDecompressor_decodeYUV
- (JNIEnv *env, jobject obj, jbyteArray src, jint pad, jint subsamp,
- jarray dst, jint dstElementSize, jint x, jint y, jint width, jint pitch,
- jint height, jint pf, jint flags)
+ (JNIEnv *env, jobject obj, jobjectArray srcobjs, jintArray jSrcOffsets,
+ jintArray jSrcStrides, jint subsamp, jarray dst, jint dstElementSize,
+ jint x, jint y, jint width, jint pitch, jint height, jint pf, jint flags)
{
tjhandle handle=0;
jsize arraySize=0, actualPitch;
- unsigned char *srcBuf=NULL, *dstBuf=NULL;
+ jbyteArray jSrcPlanes[3]={NULL, NULL, NULL};
+ unsigned char *srcPlanes[3], *dstBuf=NULL;
+ int *srcOffsets=NULL, *srcStrides=NULL;
+ int nc=(subsamp==org_libjpegturbo_turbojpeg_TJ_SAMP_GRAY? 1:3), i;
gethandle();
- if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF)
+ if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF || subsamp<0
+ || subsamp>=org_libjpegturbo_turbojpeg_TJ_NUMSAMP)
_throw("Invalid argument in decodeYUV()");
- if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF)
+ if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF
+ || org_libjpegturbo_turbojpeg_TJ_NUMSAMP!=TJ_NUMSAMP)
_throw("Mismatch between Java and C API");
- arraySize=tjBufSizeYUV2(width, pad, height, subsamp);
- if((*env)->GetArrayLength(env, src)<arraySize)
- _throw("Source buffer is not large enough");
+ if((*env)->GetArrayLength(env, srcobjs)<nc)
+ _throw("Planes array is too small for the subsampling type");
+ if((*env)->GetArrayLength(env, jSrcOffsets)<nc)
+ _throw("Offsets array is too small for the subsampling type");
+ if((*env)->GetArrayLength(env, jSrcStrides)<nc)
+ _throw("Strides array is too small for the subsampling type");
+
actualPitch=(pitch==0)? width*tjPixelSize[pf]:pitch;
arraySize=(y+height-1)*actualPitch + (x+width)*tjPixelSize[pf];
if((*env)->GetArrayLength(env, dst)*dstElementSize<arraySize)
_throw("Destination buffer is not large enough");
- bailif0(srcBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));
+ bailif0(srcOffsets=(*env)->GetPrimitiveArrayCritical(env, jSrcOffsets, 0));
+ bailif0(srcStrides=(*env)->GetPrimitiveArrayCritical(env, jSrcStrides, 0));
+ for(i=0; i<nc; i++)
+ {
+ int planeSize=tjPlaneSizeYUV(i, width, srcStrides[i], height, subsamp);
+ int pw=tjPlaneWidth(i, width, subsamp);
+
+ if(planeSize<0 || pw<0)
+ _throw(tjGetErrorStr());
+
+ if(srcOffsets[i]<0)
+ _throw("Invalid argument in decodeYUV()");
+ if(srcStrides[i]<0 && srcOffsets[i]-planeSize+pw<0)
+ _throw("Negative plane stride would cause memory to be accessed below plane boundary");
+
+ bailif0(jSrcPlanes[i]=(*env)->GetObjectArrayElement(env, srcobjs, i));
+ if((*env)->GetArrayLength(env, jSrcPlanes[i])<srcOffsets[i]+planeSize)
+ _throw("Source plane is not large enough");
+
+ bailif0(srcPlanes[i]=(*env)->GetPrimitiveArrayCritical(env, jSrcPlanes[i],
+ 0));
+ srcPlanes[i]=&srcPlanes[i][srcOffsets[i]];
+ }
bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));
- if(tjDecodeYUV(handle, srcBuf, pad, subsamp,
+ if(tjDecodeYUVPlanes(handle, srcPlanes, srcStrides, subsamp,
&dstBuf[y*actualPitch + x*tjPixelSize[pf]], width, pitch, height, pf,
flags)==-1)
_throw(tjGetErrorStr());
bailout:
if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
- if(srcBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0);
+ for(i=0; i<nc; i++)
+ {
+ if(srcPlanes[i] && jSrcPlanes[i])
+ (*env)->ReleasePrimitiveArrayCritical(env, jSrcPlanes[i], srcPlanes[i],
+ 0);
+ }
+ if(srcStrides)
+ (*env)->ReleasePrimitiveArrayCritical(env, jSrcStrides, srcStrides, 0);
+ if(srcOffsets)
+ (*env)->ReleasePrimitiveArrayCritical(env, jSrcOffsets, srcOffsets, 0);
return;
}
/* TurboJPEG 1.4.x: TJDecompressor::decodeYUV() byte destination */
-JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3BIIIIIII
- (JNIEnv *env, jobject obj, jbyteArray src, jint pad, jint subsamp,
- jbyteArray dst, jint x, jint y, jint width, jint pitch, jint height,
- jint pf, jint flags)
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3_3B_3I_3II_3BIIIIIII
+ (JNIEnv *env, jobject obj, jobjectArray srcobjs, jintArray jSrcOffsets,
+ jintArray jSrcStrides, jint subsamp, jbyteArray dst, jint x, jint y,
+ jint width, jint pitch, jint height, jint pf, jint flags)
{
- TJDecompressor_decodeYUV(env, obj, src, pad, subsamp, dst, 1, x, y, width,
- pitch, height, pf, flags);
+ TJDecompressor_decodeYUV(env, obj, srcobjs, jSrcOffsets, jSrcStrides,
+ subsamp, dst, 1, x, y, width, pitch, height, pf, flags);
}
/* TurboJPEG 1.4.x: TJDecompressor::decodeYUV() int destination */
-JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3IIIIIIII
- (JNIEnv *env, jobject obj, jbyteArray src, jint pad, jint subsamp,
- jintArray dst, jint x, jint y, jint width, jint stride, jint height,
- jint pf, jint flags)
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3_3B_3I_3II_3IIIIIIII
+ (JNIEnv *env, jobject obj, jobjectArray srcobjs, jintArray jSrcOffsets,
+ jintArray jSrcStrides, jint subsamp, jintArray dst, jint x, jint y,
+ jint width, jint stride, jint height, jint pf, jint flags)
{
if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF)
_throw("Invalid argument in decodeYUV()");
if(tjPixelSize[pf]!=sizeof(jint))
_throw("Pixel format must be 32-bit when decoding to an integer buffer.");
- TJDecompressor_decodeYUV(env, obj, src, pad, subsamp, dst, sizeof(jint), x,
- y, width, stride*sizeof(jint), height, pf, flags);
+ TJDecompressor_decodeYUV(env, obj, srcobjs, jSrcOffsets, jSrcStrides,
+ subsamp, dst, sizeof(jint), x, y, width, stride*sizeof(jint), height, pf,
+ flags);
bailout:
return;
tjEncodeYUV3;
tjEncodeYUVPlanes;
Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV__IIII;
- Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFromYUV___3BIIII_3BII;
- Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIIIII_3BIII;
- Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIIIII_3BIII;
- Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3BIIII;
- Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3BIIIIIII;
- Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3IIIIIIII;
+ Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFromYUV___3_3B_3II_3III_3BII;
+ Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIIIII_3_3B_3I_3III;
+ Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIIIII_3_3B_3I_3III;
+ Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3_3B_3II_3III;
+ Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3_3B_3I_3II_3BIIIIIII;
+ Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3_3B_3I_3II_3IIIIIIII;
+ Java_org_libjpegturbo_turbojpeg_TJ_planeHeight__III;
+ Java_org_libjpegturbo_turbojpeg_TJ_planeSizeYUV__IIIII;
+ Java_org_libjpegturbo_turbojpeg_TJ_planeWidth__III;
} TURBOJPEG_1.3;
DLLEXPORT unsigned long DLLCALL tjBufSizeYUV2(int width, int pad, int height,
int subsamp)
{
- unsigned long retval=0;
- int pw, ph, cw, ch;
- if(width<1 || height<1 || pad<1 || !isPow2(pad) || subsamp<0
- || subsamp>=NUMSUBOPT)
+ int retval=0, nc, i;
+
+ if(subsamp<0 || subsamp>=NUMSUBOPT)
_throw("tjBufSizeYUV2(): Invalid argument");
- pw=PAD(width, tjMCUWidth[subsamp]/8);
- ph=PAD(height, tjMCUHeight[subsamp]/8);
- cw=pw*8/tjMCUWidth[subsamp]; ch=ph*8/tjMCUHeight[subsamp];
- retval=PAD(pw, pad)*ph + (subsamp==TJSAMP_GRAY? 0:PAD(cw, pad)*ch*2);
+
+ nc=(subsamp==TJSAMP_GRAY? 1:3);
+ for(i=0; i<nc; i++)
+ {
+ int stride=PAD(tjPlaneWidth(i, width, subsamp), pad);
+ int ph=tjPlaneHeight(i, height, subsamp);
+ if(stride<0 || ph<0) return -1;
+ else retval+=stride*ph;
+ }
bailout:
return retval;
}
+DLLEXPORT int tjPlaneWidth(int componentID, int width, int subsamp)
+{
+ int pw, nc, retval=0;
+
+ if(width<1 || subsamp<0 || subsamp>=TJ_NUMSAMP)
+ _throw("tjPlaneWidth(): Invalid argument");
+ nc=(subsamp==TJSAMP_GRAY? 1:3);
+ if(componentID<0 || componentID>=nc)
+ _throw("tjPlaneWidth(): Invalid argument");
+
+ pw=PAD(width, tjMCUWidth[subsamp]/8);
+ if(componentID==0)
+ retval=pw;
+ else
+ retval=pw*8/tjMCUWidth[subsamp];
+
+ bailout:
+ return retval;
+}
+
+
+DLLEXPORT int tjPlaneHeight(int componentID, int height, int subsamp)
+{
+ int ph, nc, retval=0;
+
+ if(height<1 || subsamp<0 || subsamp>=TJ_NUMSAMP)
+ _throw("tjPlaneHeight(): Invalid argument");
+ nc=(subsamp==TJSAMP_GRAY? 1:3);
+ if(componentID<0 || componentID>=nc)
+ _throw("tjPlaneHeight(): Invalid argument");
+
+ ph=PAD(height, tjMCUHeight[subsamp]/8);
+ if(componentID==0)
+ retval=ph;
+ else
+ retval=ph*8/tjMCUHeight[subsamp];
+
+ bailout:
+ return retval;
+}
+
+
+DLLEXPORT unsigned long DLLCALL tjPlaneSizeYUV(int componentID, int width,
+ int stride, int height, int subsamp)
+{
+ unsigned long retval=0;
+ int pw, ph;
+
+ if(width<1 || height<1 || subsamp<0 || subsamp>=NUMSUBOPT)
+ _throw("tjPlaneSizeYUV(): Invalid argument");
+
+ pw=tjPlaneWidth(componentID, width, subsamp);
+ ph=tjPlaneHeight(componentID, height, subsamp);
+
+ if(stride==0) stride=pw;
+ else stride=abs(stride);
+
+ retval=stride*(ph-1)+pw;
+
+ bailout:
+ return retval;
+}
+
+
DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, unsigned char *srcBuf,
int width, int pitch, int height, int pixelFormat, unsigned char **jpegBuf,
unsigned long *jpegSize, int jpegSubsamp, int jpegQual, int flags)
JSAMPLE *_tmpbuf[MAX_COMPONENTS], *_tmpbuf2[MAX_COMPONENTS];
JSAMPROW *tmpbuf[MAX_COMPONENTS], *tmpbuf2[MAX_COMPONENTS];
JSAMPROW *outbuf[MAX_COMPONENTS];
- int row, pw, ph, cw[MAX_COMPONENTS], ch[MAX_COMPONENTS];
+ int row, pw0, ph0, pw[MAX_COMPONENTS], ph[MAX_COMPONENTS];
JSAMPLE *ptr;
jpeg_component_info *compptr;
#ifndef JCS_EXTENSIONS
jinit_downsampler(cinfo);
(*cinfo->cconvert->start_pass)(cinfo);
- pw=PAD(width, cinfo->max_h_samp_factor);
- ph=PAD(height, cinfo->max_v_samp_factor);
+ pw0=PAD(width, cinfo->max_h_samp_factor);
+ ph0=PAD(height, cinfo->max_v_samp_factor);
- if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ph))==NULL)
+ if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ph0))==NULL)
_throw("tjEncodeYUVPlanes(): Memory allocation failure");
for(i=0; i<height; i++)
{
if(flags&TJFLAG_BOTTOMUP) row_pointer[i]=&srcBuf[(height-i-1)*pitch];
else row_pointer[i]=&srcBuf[i*pitch];
}
- if(height<ph)
- for(i=height; i<ph; i++) row_pointer[i]=row_pointer[height-1];
+ if(height<ph0)
+ for(i=height; i<ph0; i++) row_pointer[i]=row_pointer[height-1];
for(i=0; i<cinfo->num_components; i++)
{
tmpbuf2[i][row]=&_tmpbuf2_aligned[
PAD(compptr->width_in_blocks*DCTSIZE, 16) * row];
}
- cw[i]=pw*compptr->h_samp_factor/cinfo->max_h_samp_factor;
- ch[i]=ph*compptr->v_samp_factor/cinfo->max_v_samp_factor;
- outbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ch[i]);
+ pw[i]=pw0*compptr->h_samp_factor/cinfo->max_h_samp_factor;
+ ph[i]=ph0*compptr->v_samp_factor/cinfo->max_v_samp_factor;
+ outbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ph[i]);
if(!outbuf[i]) _throw("tjEncodeYUVPlanes(): Memory allocation failure");
ptr=dstPlanes[i];
- for(row=0; row<ch[i]; row++)
+ for(row=0; row<ph[i]; row++)
{
outbuf[i][row]=ptr;
- ptr+=(strides && strides[i]>0)? strides[i]:cw[i];
+ ptr+=(strides && strides[i]!=0)? strides[i]:pw[i];
}
}
- for(row=0; row<ph; row+=cinfo->max_v_samp_factor)
+ for(row=0; row<ph0; row+=cinfo->max_v_samp_factor)
{
(*cinfo->cconvert->color_convert)(cinfo, &row_pointer[row], tmpbuf, 0,
cinfo->max_v_samp_factor);
for(i=0, compptr=cinfo->comp_info; i<cinfo->num_components; i++, compptr++)
jcopy_sample_rows(tmpbuf2[i], 0, outbuf[i],
row*compptr->v_samp_factor/cinfo->max_v_samp_factor,
- compptr->v_samp_factor, cw[i]);
+ compptr->v_samp_factor, pw[i]);
}
cinfo->next_scanline+=height;
jpeg_abort_compress(cinfo);
int pad, int subsamp, int flags)
{
unsigned char *dstPlanes[3];
- int pw, ph, cw, ch, strides[3], retval=-1;
+ int pw0, ph0, strides[3], retval=-1;
if(width<=0 || height<=0 || dstBuf==NULL || pad<0 || !isPow2(pad)
|| subsamp<0 || subsamp>=NUMSUBOPT)
_throw("tjEncodeYUV3(): Invalid argument");
- pw=PAD(width, tjMCUWidth[subsamp]/8);
- ph=PAD(height, tjMCUHeight[subsamp]/8);
- cw=pw*8/tjMCUWidth[subsamp]; ch=ph*8/tjMCUHeight[subsamp];
-
- strides[0]=PAD(pw, pad);
- strides[1]=strides[2]=(subsamp==TJSAMP_GRAY? 0:PAD(cw, pad));
+ pw0=tjPlaneWidth(0, width, subsamp);
+ ph0=tjPlaneHeight(0, height, subsamp);
dstPlanes[0]=dstBuf;
- dstPlanes[1]=(subsamp==TJSAMP_GRAY? NULL:dstPlanes[0]+strides[0]*ph);
- dstPlanes[2]=(subsamp==TJSAMP_GRAY? NULL:dstPlanes[1]+strides[1]*ch);
+ strides[0]=PAD(pw0, pad);
+ if(subsamp==TJSAMP_GRAY)
+ {
+ strides[1]=strides[2]=0;
+ dstPlanes[1]=dstPlanes[2]=NULL;
+ }
+ else
+ {
+ int pw1=tjPlaneWidth(1, width, subsamp);
+ int ph1=tjPlaneHeight(1, height, subsamp);
+ strides[1]=strides[2]=PAD(pw1, pad);
+ dstPlanes[1]=dstPlanes[0]+strides[0]*ph0;
+ dstPlanes[2]=dstPlanes[1]+strides[1]*ph1;
+ }
return tjEncodeYUVPlanes(handle, srcBuf, width, pitch, height, pixelFormat,
dstPlanes, strides, subsamp, flags);
unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags)
{
int i, row, retval=0, alloc=1; JSAMPROW *inbuf[MAX_COMPONENTS];
- int cw[MAX_COMPONENTS], ch[MAX_COMPONENTS], iw[MAX_COMPONENTS],
+ int pw[MAX_COMPONENTS], ph[MAX_COMPONENTS], iw[MAX_COMPONENTS],
tmpbufsize=0, usetmpbuf=0, th[MAX_COMPONENTS];
JSAMPLE *_tmpbuf=NULL, *ptr; JSAMPROW *tmpbuf[MAX_COMPONENTS];
int ih;
iw[i]=compptr->width_in_blocks*DCTSIZE;
ih=compptr->height_in_blocks*DCTSIZE;
- cw[i]=PAD(cinfo->image_width, cinfo->max_h_samp_factor)
+ pw[i]=PAD(cinfo->image_width, cinfo->max_h_samp_factor)
*compptr->h_samp_factor/cinfo->max_h_samp_factor;
- ch[i]=PAD(cinfo->image_height, cinfo->max_v_samp_factor)
+ ph[i]=PAD(cinfo->image_height, cinfo->max_v_samp_factor)
*compptr->v_samp_factor/cinfo->max_v_samp_factor;
- if(iw[i]!=cw[i] || ih!=ch[i]) usetmpbuf=1;
+ if(iw[i]!=pw[i] || ih!=ph[i]) usetmpbuf=1;
th[i]=compptr->v_samp_factor*DCTSIZE;
tmpbufsize+=iw[i]*th[i];
- if((inbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ch[i]))==NULL)
+ if((inbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ph[i]))==NULL)
_throw("tjCompressFromYUVPlanes(): Memory allocation failure");
ptr=srcPlanes[i];
- for(row=0; row<ch[i]; row++)
+ for(row=0; row<ph[i]; row++)
{
inbuf[i][row]=ptr;
- ptr+=(strides && strides[i]>0)? strides[i]:cw[i];
+ ptr+=(strides && strides[i]!=0)? strides[i]:pw[i];
}
}
if(usetmpbuf)
if(usetmpbuf)
{
int j, k;
- for(j=0; j<min(th[i], ch[i]-crow[i]); j++)
+ for(j=0; j<min(th[i], ph[i]-crow[i]); j++)
{
- memcpy(tmpbuf[i][j], inbuf[i][crow[i]+j], cw[i]);
+ memcpy(tmpbuf[i][j], inbuf[i][crow[i]+j], pw[i]);
/* Duplicate last sample in row to fill out MCU */
- for(k=cw[i]; k<iw[i]; k++) tmpbuf[i][j][k]=tmpbuf[i][j][cw[i]-1];
+ for(k=pw[i]; k<iw[i]; k++) tmpbuf[i][j][k]=tmpbuf[i][j][pw[i]-1];
}
/* Duplicate last row to fill out MCU */
- for(j=ch[i]-crow[i]; j<th[i]; j++)
- memcpy(tmpbuf[i][j], tmpbuf[i][ch[i]-crow[i]-1], iw[i]);
+ for(j=ph[i]-crow[i]; j<th[i]; j++)
+ memcpy(tmpbuf[i][j], tmpbuf[i][ph[i]-crow[i]-1], iw[i]);
yuvptr[i]=tmpbuf[i];
}
else
unsigned long *jpegSize, int jpegQual, int flags)
{
unsigned char *srcPlanes[3];
- int pw, ph, cw, ch, strides[3], retval=-1;
+ int pw0, ph0, strides[3], retval=-1;
if(srcBuf==NULL || width<=0 || pad<1 || height<=0 || subsamp<0
|| subsamp>=NUMSUBOPT)
_throw("tjCompressFromYUV(): Invalid argument");
- pw=PAD(width, tjMCUWidth[subsamp]/8);
- ph=PAD(height, tjMCUHeight[subsamp]/8);
- cw=pw*8/tjMCUWidth[subsamp]; ch=ph*8/tjMCUHeight[subsamp];
-
- strides[0]=PAD(pw, pad);
- strides[1]=strides[2]=(subsamp==TJSAMP_GRAY? 0:PAD(cw, pad));
+ pw0=tjPlaneWidth(0, width, subsamp);
+ ph0=tjPlaneHeight(0, height, subsamp);
srcPlanes[0]=srcBuf;
- srcPlanes[1]=(subsamp==TJSAMP_GRAY? NULL:srcPlanes[0]+strides[0]*ph);
- srcPlanes[2]=(subsamp==TJSAMP_GRAY? NULL:srcPlanes[1]+strides[1]*ch);
+ strides[0]=PAD(pw0, pad);
+ if(subsamp==TJSAMP_GRAY)
+ {
+ strides[1]=strides[2]=0;
+ srcPlanes[1]=srcPlanes[2]=NULL;
+ }
+ else
+ {
+ int pw1=tjPlaneWidth(1, width, subsamp);
+ int ph1=tjPlaneHeight(1, height, subsamp);
+ strides[1]=strides[2]=PAD(pw1, pad);
+ srcPlanes[1]=srcPlanes[0]+strides[0]*ph0;
+ srcPlanes[2]=srcPlanes[1]+strides[1]*ph1;
+ }
return tjCompressFromYUVPlanes(handle, srcPlanes, width, strides, height,
subsamp, jpegBuf, jpegSize, jpegQual, flags);
int i, retval=0; JSAMPROW *row_pointer=NULL;
JSAMPLE *_tmpbuf[MAX_COMPONENTS];
JSAMPROW *tmpbuf[MAX_COMPONENTS], *inbuf[MAX_COMPONENTS];
- int row, pw, ph, cw[MAX_COMPONENTS], ch[MAX_COMPONENTS];
+ int row, pw0, ph0, pw[MAX_COMPONENTS], ph[MAX_COMPONENTS];
JSAMPLE *ptr;
jpeg_component_info *compptr;
#ifndef JCS_EXTENSIONS
jinit_master_decompress(dinfo);
(*dinfo->upsample->start_pass)(dinfo);
- pw=PAD(width, dinfo->max_h_samp_factor);
- ph=PAD(height, dinfo->max_v_samp_factor);
+ pw0=PAD(width, dinfo->max_h_samp_factor);
+ ph0=PAD(height, dinfo->max_v_samp_factor);
if(pitch==0) pitch=dinfo->output_width*tjPixelSize[pixelFormat];
}
#endif
- if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ph))==NULL)
+ if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ph0))==NULL)
_throw("tjDecodeYUVPlanes(): Memory allocation failure");
for(i=0; i<height; i++)
{
if(flags&TJFLAG_BOTTOMUP) row_pointer[i]=&dstBuf[(height-i-1)*pitch];
else row_pointer[i]=&dstBuf[i*pitch];
}
- if(height<ph)
- for(i=height; i<ph; i++) row_pointer[i]=row_pointer[height-1];
+ if(height<ph0)
+ for(i=height; i<ph0; i++) row_pointer[i]=row_pointer[height-1];
for(i=0; i<dinfo->num_components; i++)
{
tmpbuf[i][row]=&_tmpbuf_aligned[
PAD(compptr->width_in_blocks*DCTSIZE, 16) * row];
}
- cw[i]=pw*compptr->h_samp_factor/dinfo->max_h_samp_factor;
- ch[i]=ph*compptr->v_samp_factor/dinfo->max_v_samp_factor;
- inbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ch[i]);
+ pw[i]=pw0*compptr->h_samp_factor/dinfo->max_h_samp_factor;
+ ph[i]=ph0*compptr->v_samp_factor/dinfo->max_v_samp_factor;
+ inbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ph[i]);
if(!inbuf[i]) _throw("tjDecodeYUVPlanes(): Memory allocation failure");
ptr=srcPlanes[i];
- for(row=0; row<ch[i]; row++)
+ for(row=0; row<ph[i]; row++)
{
inbuf[i][row]=ptr;
- ptr+=(strides && strides[i]>0)? strides[i]:cw[i];
+ ptr+=(strides && strides[i]!=0)? strides[i]:pw[i];
}
}
- for(row=0; row<ph; row+=dinfo->max_v_samp_factor)
+ for(row=0; row<ph0; row+=dinfo->max_v_samp_factor)
{
JDIMENSION inrow=0, outrow=0;
for(i=0, compptr=dinfo->comp_info; i<dinfo->num_components; i++, compptr++)
jcopy_sample_rows(inbuf[i],
row*compptr->v_samp_factor/dinfo->max_v_samp_factor, tmpbuf[i], 0,
- compptr->v_samp_factor, cw[i]);
+ compptr->v_samp_factor, pw[i]);
(dinfo->upsample->upsample)(dinfo, tmpbuf, &inrow,
dinfo->max_v_samp_factor, &row_pointer[row], &outrow,
dinfo->max_v_samp_factor);
int height, int pixelFormat, int flags)
{
unsigned char *srcPlanes[3];
- int pw, ph, cw, ch, strides[3], retval=-1;
+ int pw0, ph0, strides[3], retval=-1;
if(srcBuf==NULL || pad<0 || !isPow2(pad) || subsamp<0 || subsamp>=NUMSUBOPT
|| width<=0 || height<=0)
_throw("tjDecodeYUV(): Invalid argument");
- pw=PAD(width, tjMCUWidth[subsamp]/8);
- ph=PAD(height, tjMCUHeight[subsamp]/8);
- cw=pw*8/tjMCUWidth[subsamp]; ch=ph*8/tjMCUHeight[subsamp];
-
- strides[0]=PAD(pw, pad);
- strides[1]=strides[2]=(subsamp==TJSAMP_GRAY? 0:PAD(cw, pad));
+ pw0=tjPlaneWidth(0, width, subsamp);
+ ph0=tjPlaneHeight(0, height, subsamp);
srcPlanes[0]=srcBuf;
- srcPlanes[1]=(subsamp==TJSAMP_GRAY? NULL:srcPlanes[0]+strides[0]*ph);
- srcPlanes[2]=(subsamp==TJSAMP_GRAY? NULL:srcPlanes[1]+strides[1]*ch);
+ strides[0]=PAD(pw0, pad);
+ if(subsamp==TJSAMP_GRAY)
+ {
+ strides[1]=strides[2]=0;
+ srcPlanes[1]=srcPlanes[2]=NULL;
+ }
+ else
+ {
+ int pw1=tjPlaneWidth(1, width, subsamp);
+ int ph1=tjPlaneHeight(1, height, subsamp);
+ strides[1]=strides[2]=PAD(pw1, pad);
+ srcPlanes[1]=srcPlanes[0]+strides[0]*ph0;
+ srcPlanes[2]=srcPlanes[1]+strides[1]*ph1;
+ }
return tjDecodeYUVPlanes(handle, srcPlanes, strides, subsamp, dstBuf, width,
pitch, height, pixelFormat, flags);
{
int i, sfi, row, retval=0; JSAMPROW *outbuf[MAX_COMPONENTS];
int jpegwidth, jpegheight, jpegSubsamp, scaledw, scaledh;
- int cw[MAX_COMPONENTS], ch[MAX_COMPONENTS], iw[MAX_COMPONENTS],
+ int pw[MAX_COMPONENTS], ph[MAX_COMPONENTS], iw[MAX_COMPONENTS],
tmpbufsize=0, usetmpbuf=0, th[MAX_COMPONENTS];
JSAMPLE *_tmpbuf=NULL, *ptr; JSAMPROW *tmpbuf[MAX_COMPONENTS];
int dctsize;
int ih;
iw[i]=compptr->width_in_blocks*dctsize;
ih=compptr->height_in_blocks*dctsize;
- cw[i]=PAD(dinfo->output_width, dinfo->max_h_samp_factor)
+ pw[i]=PAD(dinfo->output_width, dinfo->max_h_samp_factor)
*compptr->h_samp_factor/dinfo->max_h_samp_factor;
- ch[i]=PAD(dinfo->output_height, dinfo->max_v_samp_factor)
+ ph[i]=PAD(dinfo->output_height, dinfo->max_v_samp_factor)
*compptr->v_samp_factor/dinfo->max_v_samp_factor;
- if(iw[i]!=cw[i] || ih!=ch[i]) usetmpbuf=1;
+ if(iw[i]!=pw[i] || ih!=ph[i]) usetmpbuf=1;
th[i]=compptr->v_samp_factor*dctsize;
tmpbufsize+=iw[i]*th[i];
- if((outbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ch[i]))==NULL)
+ if((outbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ph[i]))==NULL)
_throw("tjDecompressToYUVPlanes(): Memory allocation failure");
ptr=dstPlanes[i];
- for(row=0; row<ch[i]; row++)
+ for(row=0; row<ph[i]; row++)
{
outbuf[i][row]=ptr;
- ptr+=(strides && strides[i]>0)? strides[i]:cw[i];
+ ptr+=(strides && strides[i]!=0)? strides[i]:pw[i];
}
}
if(usetmpbuf)
int j;
for(i=0; i<dinfo->num_components; i++)
{
- for(j=0; j<min(th[i], ch[i]-crow[i]); j++)
+ for(j=0; j<min(th[i], ph[i]-crow[i]); j++)
{
- memcpy(outbuf[i][crow[i]+j], tmpbuf[i][j], cw[i]);
+ memcpy(outbuf[i][crow[i]+j], tmpbuf[i][j], pw[i]);
}
}
}
int width, int pad, int height, int flags)
{
unsigned char *dstPlanes[3];
- int pw, ph, cw, ch, strides[3], retval=-1, jpegSubsamp=-1;
+ int pw0, ph0, strides[3], retval=-1, jpegSubsamp=-1;
int i, jpegwidth, jpegheight, scaledw, scaledh;
getdinstance(handle);
if(scaledw>width || scaledh>height)
_throw("tjDecompressToYUV2(): Could not scale down to desired image dimensions");
- pw=PAD(scaledw, tjMCUWidth[jpegSubsamp]/8);
- ph=PAD(scaledh, tjMCUHeight[jpegSubsamp]/8);
- cw=pw*8/tjMCUWidth[jpegSubsamp]; ch=ph*8/tjMCUHeight[jpegSubsamp];
-
- strides[0]=PAD(pw, pad);
- strides[1]=strides[2]=(jpegSubsamp==TJSAMP_GRAY? 0:PAD(cw, pad));
+ pw0=tjPlaneWidth(0, width, jpegSubsamp);
+ ph0=tjPlaneHeight(0, height, jpegSubsamp);
dstPlanes[0]=dstBuf;
- dstPlanes[1]=(jpegSubsamp==TJSAMP_GRAY? NULL:dstPlanes[0]+strides[0]*ph);
- dstPlanes[2]=(jpegSubsamp==TJSAMP_GRAY? NULL:dstPlanes[1]+strides[1]*ch);
+ strides[0]=PAD(pw0, pad);
+ if(jpegSubsamp==TJSAMP_GRAY)
+ {
+ strides[1]=strides[2]=0;
+ dstPlanes[1]=dstPlanes[2]=NULL;
+ }
+ else
+ {
+ int pw1=tjPlaneWidth(1, width, jpegSubsamp);
+ int ph1=tjPlaneHeight(1, height, jpegSubsamp);
+ strides[1]=strides[2]=PAD(pw1, pad);
+ dstPlanes[1]=dstPlanes[0]+strides[0]*ph0;
+ dstPlanes[2]=dstPlanes[1]+strides[1]*ph1;
+ }
this->headerRead=1;
return tjDecompressToYUVPlanes(handle, jpegBuf, jpegSize, dstPlanes, width,
*
* Each plane is simply a 2D array of bytes, each byte representing the value
* of one of the components (Y, Cb, or Cr) 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.) This is irrespective of any additional padding that may be
- * specified as an argument to the various YUV functions. 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.
+ * image. The width and height of each plane are determined by the image
+ * width, height, and level of chrominance subsampling. The luminance plane
+ * 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 luminance plane
+ * height 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.) This is irrespective of any additional padding that may be
+ * specified as an argument to the various YUV functions. The chrominance
+ * plane width is equal to the luminance plane width divided by the horizontal
+ * subsampling factor, and the chrominance plane height is equal to the
+ * luminance plane height divided by the vertical subsampling factor.
*
* 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
*
* @param width width (in pixels) of the source image
*
- * @param pitch bytes per line of the source image. Normally, this should be
+ * @param pitch bytes per line in the source image. Normally, this should be
* <tt>width * #tjPixelSize[pixelFormat]</tt> if the image is unpadded, or
* <tt>#TJPAD(width * #tjPixelSize[pixelFormat])</tt> if each line of the image
* is padded to the nearest 32-bit boundary, as is the case for Windows
* 100 = best)
*
* @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
- * "flags".
+ * "flags"
*
* @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
*/
* 100 = best)
*
* @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
- * "flags".
+ * "flags"
*
* @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
*/
* @param srcPlanes 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
* image to be compressed. These planes can be contiguous or non-contiguous in
- * memory. Each plane should be at least
- * <b><i>{component stride} * {component height}</i></b> bytes in size. (See
- * below for a description of stride, and refer to @ref YUVnotes
- * "YUV Image Format Notes" for a description of component height.)
+ * memory. The size of each plane should match the value returned by
+ * #tjPlaneSizeYUV() for the given image width, height, strides, and level of
+ * chrominance subsampling. Refer to @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
*
* @param strides an array of integers, each specifying the number of bytes per
* line 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 component width for the
- * plane. If <tt>strides</tt> is NULL, then the strides for all planes will be
- * set to their respective component widths. You can adjust the strides in
- * order to specify an arbitrary amount of line padding in each plane or to
- * create a JPEG image from a subregion of a larger YUV planar image.
+ * for any plane to 0 is the same as setting it to the plane width (see
+ * @ref YUVnotes "YUV Image Format Notes".) If <tt>strides</tt> 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 line
+ * padding in each plane or to create a JPEG image from a subregion of a larger
+ * YUV planar 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
* 100 = best)
*
* @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
- * "flags".
+ * "flags"
*
* @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
*/
* size of a JPEG image prior to compression, the corner case has to be
* handled.
*
- * @param width width of the image (in pixels)
+ * @param width width (in pixels) of the image
*
- * @param height height of the image (in pixels)
+ * @param height height (in pixels) of the image
*
* @param jpegSubsamp the level of chrominance subsampling to be used when
* generating the JPEG image (see @ref TJSAMP
* The size of the buffer (in bytes) required to hold a YUV planar image with
* the given parameters.
*
- * @param width width of the image (in pixels)
+ * @param width width (in pixels) of the image
*
* @param pad the width of each line in each plane of the image is padded to
* the nearest multiple of this number of bytes (must be a power of 2.)
*
- * @param height height of the image (in pixels)
+ * @param height height (in pixels) of the image
*
* @param subsamp level of chrominance subsampling in the image (see
* @ref TJSAMP "Chrominance subsampling options".)
int subsamp);
+/**
+ * The size of the buffer (in bytes) required to hold a YUV image plane with
+ * the given parameters.
+ *
+ * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr)
+ *
+ * @param width width (in pixels) of the YUV image. NOTE: this is the width of
+ * the whole image, not the plane width.
+ *
+ * @param stride bytes per line in the image plane. Setting this to 0 is the
+ * equivalent of setting it to the plane width.
+ *
+ * @param height height (in pixels) of the YUV image. NOTE: this is the height
+ * of the whole image, not the plane height.
+ *
+ * @param subsamp level of chrominance subsampling in the image (see
+ * @ref TJSAMP "Chrominance subsampling options".)
+ *
+ * @return the size of the buffer (in bytes) required to hold the YUV image
+ * plane, or -1 if the arguments are out of bounds.
+ */
+DLLEXPORT unsigned long DLLCALL tjPlaneSizeYUV(int componentID, int width,
+ int stride, int height, int subsamp);
+
+
+/**
+ * The plane width of a YUV image plane with the given parameters. Refer to
+ * @ref YUVnotes "YUV Image Format Notes" for a description of plane width.
+ *
+ * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr)
+ *
+ * @param width width (in pixels) of the YUV image
+ *
+ * @param subsamp level of chrominance subsampling in the image (see
+ * @ref TJSAMP "Chrominance subsampling options".)
+ *
+ * @return the plane width of a YUV image plane with the given parameters, or
+ * -1 if the arguments are out of bounds.
+ */
+DLLEXPORT int tjPlaneWidth(int componentID, int width, int subsamp);
+
+
+/**
+ * The plane height of a YUV image plane with the given parameters. Refer to
+ * @ref YUVnotes "YUV Image Format Notes" for a description of plane height.
+ *
+ * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr)
+ *
+ * @param height height (in pixels) of the YUV image
+ *
+ * @param subsamp level of chrominance subsampling in the image (see
+ * @ref TJSAMP "Chrominance subsampling options".)
+ *
+ * @return the plane height of a YUV image plane with the given parameters, or
+ * -1 if the arguments are out of bounds.
+ */
+DLLEXPORT int tjPlaneHeight(int componentID, int height, int subsamp);
+
+
/**
* Encode an RGB or grayscale image into a YUV planar image. This function
* uses the accelerated color conversion routines in the underlying
*
* @param width width (in pixels) of the source image
*
- * @param pitch bytes per line of the source image. Normally, this should be
+ * @param pitch bytes per line in the source image. Normally, this should be
* <tt>width * #tjPixelSize[pixelFormat]</tt> if the image is unpadded, or
* <tt>#TJPAD(width * #tjPixelSize[pixelFormat])</tt> if each line of the image
* is padded to the nearest 32-bit boundary, as is the case for Windows
* image compatible with the I420 (AKA "YUV420P") format.
*
* @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
- * "flags".
+ * "flags"
*
* @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
*/
*
* @param width width (in pixels) of the source image
*
- * @param pitch bytes per line of the source image. Normally, this should be
+ * @param pitch bytes per line in the source image. Normally, this should be
* <tt>width * #tjPixelSize[pixelFormat]</tt> if the image is unpadded, or
* <tt>#TJPAD(width * #tjPixelSize[pixelFormat])</tt> if each line of the image
* is padded to the nearest 32-bit boundary, as is the case for Windows
* @param dstPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes
* (or just a Y plane, if generating a grayscale image) that will receive the
* encoded image. These planes can be contiguous or non-contiguous in memory.
- * Each plane should be at least
- * <b><i>{component stride} * {component height}</i></b> bytes in size.
- * (See below for a description of stride, and refer to @ref YUVnotes
- * "YUV Image Format Notes" for a description of component height.)
+ * Use #tjPlaneSizeYUV() to determine the appropriate size for each plane based
+ * on the image width, height, strides, and level of chrominance subsampling.
+ * Refer to @ref YUVnotes "YUV Image Format Notes" for more details.
*
* @param strides an array of integers, each specifying the number of bytes per
* line in the corresponding plane of the output image. Setting the stride for
- * any plane to 0 is the same as setting it to the component width for the
- * plane. If <tt>strides</tt> is NULL, then the strides for all planes will be
- * set to their respective component widths. You can adjust the strides in
- * order to add an arbitrary amount of line padding to each plane or to encode
- * an RGB or grayscale image into a subregion of a larger YUV planar image.
+ * any plane to 0 is the same as setting it to the plane width (see
+ * @ref YUVnotes "YUV Image Format Notes".) If <tt>strides</tt> is NULL, then
+ * the strides for all planes will be set to their respective plane widths.
+ * You can adjust the strides in order to add an arbitrary amount of line
+ * padding to each plane or to encode an RGB or grayscale image into a
+ * subregion of a larger YUV planar image.
*
* @param subsamp the level of chrominance subsampling to be used when
* generating the YUV image (see @ref TJSAMP
* image compatible with the I420 (AKA "YUV420P") format.
*
* @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
- * "flags".
+ * "flags"
*
* @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
*/
* (in pixels) of the JPEG image
*
* @param jpegSubsamp pointer to an integer variable that will receive the
- * level of chrominance subsampling used when compressing the JPEG image (see
- * @ref TJSAMP "Chrominance subsampling options".)
+ * level of chrominance subsampling used when the JPEG image was compressed
+ * (see @ref TJSAMP "Chrominance subsampling options".)
*
* @param jpegColorspace pointer to an integer variable that will receive one
* of the JPEG colorspace constants, indicating the colorspace of the JPEG
* set to 0, then only the height will be considered when determining the
* scaled image size.
*
- * @param pitch bytes per line of the destination image. Normally, this is
+ * @param pitch bytes per line in the destination image. Normally, this is
* <tt>scaledWidth * #tjPixelSize[pixelFormat]</tt> if the decompressed image
* is unpadded, else <tt>#TJPAD(scaledWidth * #tjPixelSize[pixelFormat])</tt>
* if each line of the decompressed image is padded to the nearest 32-bit
* TJPF "Pixel formats".)
*
* @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
- * "flags".
+ * "flags"
*
* @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
*/
* performed within TurboJPEG.
*
* @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
- * "flags".
+ * "flags"
*
* @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
*/
* @param dstPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes
* (or just a Y plane, if decompressing a grayscale image) that will receive
* the YUV image. These planes can be contiguous or non-contiguous in memory.
- * Each plane should be at least
- * <b><i>{component stride} * {scaled component height}</i></b> bytes in size.
- * (See below for a description of stride, and refer to @ref YUVnotes
- * "YUV Image Format Notes" for a description of component height.)
+ * Use #tjPlaneSizeYUV() to determine the appropriate size for each plane based
+ * on the scaled image width, scaled image height, strides, and level of
+ * chrominance subsampling. Refer to @ref YUVnotes "YUV Image Format Notes"
+ * for more details.
*
* @param width desired width (in pixels) of the YUV image. If this is
* different than the width of the JPEG image being decompressed, then
*
* @param strides an array of integers, each specifying the number of bytes per
* line in the corresponding plane of the output image. Setting the stride for
- * any plane to 0 is the same as setting it to the scaled component width for
- * the plane. If <tt>strides</tt> is NULL, then the strides for all planes
- * will be set to their respective scaled component widths. You can adjust the
- * strides in order to add an arbitrary amount of line padding to each plane or
- * to decompress the JPEG image into a subregion of a larger YUV planar image.
+ * any plane to 0 is the same as setting it to the scaled plane width (see
+ * @ref YUVnotes "YUV Image Format Notes".) If <tt>strides</tt> is NULL, then
+ * the strides for all planes will be set to their respective scaled plane
+ * widths. You can adjust the strides in order to add an arbitrary amount of
+ * line padding to each plane or to decompress the JPEG image into a subregion
+ * of a larger YUV planar image.
*
* @param height desired height (in pixels) of the YUV image. If this is
* different than the height of the JPEG image being decompressed, then
* performed within TurboJPEG.
*
* @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
- * "flags".
+ * "flags"
*
* @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
*/
*
* @param width width (in pixels) of the source and destination images
*
- * @param pitch bytes per line of the destination image. Normally, this should
+ * @param pitch bytes per line in the destination image. Normally, this should
* be <tt>width * #tjPixelSize[pixelFormat]</tt> if the destination image is
* unpadded, or <tt>#TJPAD(width * #tjPixelSize[pixelFormat])</tt> if each line
* of the destination image should be padded to the nearest 32-bit boundary, as
* "Pixel formats".)
*
* @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
- * "flags".
+ * "flags"
*
* @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
*/
* @param srcPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes
* (or just a Y plane, if decoding a grayscale image) that contain a YUV image
* to be decoded. These planes can be contiguous or non-contiguous in memory.
- * Each plane should be at least
- * <b><i>{component stride} * {component height}</i></b> bytes in size.
- * (See below for a description of stride, and refer to @ref YUVnotes
- * "YUV Image Format Notes" for a description of component height.)
+ * The size of each plane should match the value returned by #tjPlaneSizeYUV()
+ * for the given image width, height, strides, and level of chrominance
+ * subsampling. Refer to @ref YUVnotes "YUV Image Format Notes" for more
+ * details.
*
* @param strides an array of integers, each specifying the number of bytes per
* line 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 component width for the
- * plane. If <tt>strides</tt> is NULL, then the strides for all planes will be
- * set to their respective component widths. You can adjust the strides in
- * order to specify an arbitrary amount of line padding in each plane or to
- * decode a subregion of a larger YUV planar image.
+ * for any plane to 0 is the same as setting it to the plane width (see
+ * @ref YUVnotes "YUV Image Format Notes".) If <tt>strides</tt> 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 line
+ * padding in each plane or to decode a subregion of a larger YUV planar image.
*
* @param subsamp the level of chrominance subsampling used in the YUV source
* image (see @ref TJSAMP "Chrominance subsampling options".)
*
* @param width width (in pixels) of the source and destination images
*
- * @param pitch bytes per line of the destination image. Normally, this should
+ * @param pitch bytes per line in the destination image. Normally, this should
* be <tt>width * #tjPixelSize[pixelFormat]</tt> if the destination image is
* unpadded, or <tt>#TJPAD(width * #tjPixelSize[pixelFormat])</tt> if each line
* of the destination image should be padded to the nearest 32-bit boundary, as
* "Pixel formats".)
*
* @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
- * "flags".
+ * "flags"
*
* @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
*/
/**
* Losslessly transform a JPEG image into another JPEG image. Lossless
- * transforms work by moving the raw coefficients from one JPEG image structure
- * to another without altering the values of the coefficients. While this is
- * typically faster than decompressing the image, transforming it, and
+ * transforms work by moving the raw DCT coefficients from one JPEG image
+ * structure to another without altering the values of the coefficients. While
+ * this is typically faster than decompressing the image, transforming it, and
* re-compressing it, lossless transforms are not free. Each lossless
* transform requires reading and performing Huffman decoding on all of the
* coefficients in the source image, regardless of the size of the destination
*
* @param handle a handle to a TurboJPEG transformer instance
*
- * @param jpegBuf pointer to a buffer containing the JPEG image to transform
+ * @param jpegBuf pointer to a buffer containing the JPEG source image to
+ * transform
*
- * @param jpegSize size of the JPEG image (in bytes)
+ * @param jpegSize size of the JPEG source image (in bytes)
*
* @param n the number of transformed JPEG images to generate
*
* corresponding transformed output image.
*
* @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
- * "flags".
+ * "flags"
*
* @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
*/
* @param bytes the number of bytes to allocate
*
* @return a pointer to a newly-allocated buffer with the specified number of
- * bytes
+ * bytes.
*
* @sa tjFree()
*/