<tr class="memitem:ga0b931126c7a615ddc3bbd0cca6698d67"><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#ga0b931126c7a615ddc3bbd0cca6698d67">tjCompressFromYUV</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *srcBuf, int width, int pad, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags)</td></tr>
<tr class="memdesc:ga0b931126c7a615ddc3bbd0cca6698d67"><td class="mdescLeft"> </td><td class="mdescRight">Compress a YUV planar image into a JPEG image. <a href="#ga0b931126c7a615ddc3bbd0cca6698d67">More...</a><br/></td></tr>
<tr class="separator:ga0b931126c7a615ddc3bbd0cca6698d67"><td class="memSeparator" colspan="2"> </td></tr>
-<tr class="memitem:gab87b2b19ee8bdd8dba395b74d66a4835"><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#gab87b2b19ee8bdd8dba395b74d66a4835">tjCompressFromYUVPlanes</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char **srcBufs, int width, int *strides, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags)</td></tr>
-<tr class="memdesc:gab87b2b19ee8bdd8dba395b74d66a4835"><td class="mdescLeft"> </td><td class="mdescRight">Compress a set of Y, U (Cb), and V (Cr) image planes into a JPEG image. <a href="#gab87b2b19ee8bdd8dba395b74d66a4835">More...</a><br/></td></tr>
-<tr class="separator:gab87b2b19ee8bdd8dba395b74d66a4835"><td class="memSeparator" colspan="2"> </td></tr>
+<tr class="memitem:gaa89a1982cb4556b12ae7af4439991af6"><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#gaa89a1982cb4556b12ae7af4439991af6">tjCompressFromYUVPlanes</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char **srcPlanes, int width, int *strides, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags)</td></tr>
+<tr class="memdesc:gaa89a1982cb4556b12ae7af4439991af6"><td class="mdescLeft"> </td><td class="mdescRight">Compress a set of Y, U (Cb), and V (Cr) image planes into a JPEG image. <a href="#gaa89a1982cb4556b12ae7af4439991af6">More...</a><br/></td></tr>
+<tr class="separator:gaa89a1982cb4556b12ae7af4439991af6"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaccc5bca7f12fcdcc302e6e1c6d4b311b"><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#gaccc5bca7f12fcdcc302e6e1c6d4b311b">tjBufSize</a> (int width, int height, int jpegSubsamp)</td></tr>
<tr class="memdesc:gaccc5bca7f12fcdcc302e6e1c6d4b311b"><td class="mdescLeft"> </td><td class="mdescRight">The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters. <a href="#gaccc5bca7f12fcdcc302e6e1c6d4b311b">More...</a><br/></td></tr>
<tr class="separator:gaccc5bca7f12fcdcc302e6e1c6d4b311b"><td class="memSeparator" colspan="2"> </td></tr>
<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 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">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">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">width</td><td>width of the image (in pixels)</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">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>
<p>Compress an RGB, grayscale, or CMYK image into a JPEG image. </p>
<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">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">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">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">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">
<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>
<li>set <code>*jpegBuf</code> to NULL to tell TurboJPEG to allocate the buffer for you, or</li>
<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b" title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters...">tjBufSize()</a>. This should ensure that the buffer never has to be re-allocated (setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees this.)</li>
</ol>
-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">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>
+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">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>
</table>
</dd>
<p>Compress a YUV planar image into a JPEG image. </p>
<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">srcBuf</td><td>pointer to an image buffer containing a YUV planar image to be compressed. The size of this buffer should match the value returned by <a class="el" href="group___turbo_j_p_e_g.html#gaf451664a62c1f6c7cc5a6401f32908c9" title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters...">tjBufSizeYUV2()</a> for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer (refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.) </td></tr>
- <tr><td class="paramname">width</td><td>width (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a>), then an intermediate buffer copy will be performed within TurboJPEG. </td></tr>
- <tr><td class="paramname">pad</td><td>the line padding used in the source image. For instance, if each line in each plane of the YUV image is padded to the nearest multiple of 4 bytes, then <code>pad</code> should be set to 4. </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">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 a YUV planar image to be compressed. The size of this buffer should match the value returned by <a class="el" href="group___turbo_j_p_e_g.html#gaf451664a62c1f6c7cc5a6401f32908c9" title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters...">tjBufSizeYUV2()</a> for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer (refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.)</td></tr>
+ <tr><td class="paramname">width</td><td>width (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
+ <tr><td class="paramname">pad</td><td>the line padding used in the source image. For instance, if each line in each plane of the YUV image is padded to the nearest multiple of 4 bytes, then <code>pad</code> should be set to 4.</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">
<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>
<li>set <code>*jpegBuf</code> to NULL to tell TurboJPEG to allocate the buffer for you, or</li>
<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b" title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters...">tjBufSize()</a>. This should ensure that the buffer never has to be re-allocated (setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees this.)</li>
</ol>
-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>
+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>
</table>
</dd>
</div>
</div>
-<a class="anchor" id="gab87b2b19ee8bdd8dba395b74d66a4835"></a>
+<a class="anchor" id="gaa89a1982cb4556b12ae7af4439991af6"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned char ** </td>
- <td class="paramname"><em>srcBufs</em>, </td>
+ <td class="paramname"><em>srcPlanes</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<p>Compress a set of Y, U (Cb), and V (Cr) image planes into a JPEG image. </p>
<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">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>stride</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">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">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">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>stride</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">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">
<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>
<li>set <code>*jpegBuf</code> to NULL to tell TurboJPEG to allocate the buffer for you, or</li>
<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b" title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters...">tjBufSize()</a>. This should ensure that the buffer never has to be re-allocated (setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees this.)</li>
</ol>
-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>
+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>
</table>
</dd>
<p>This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG decompression process.</p>
<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">srcBuf</td><td>pointer to an image buffer containing a YUV planar image to be decoded. The size of this buffer should match the value returned by <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> for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source 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>Use this parameter to specify that the width of each line in each plane of the YUV source image is padded to the nearest multiple of this number of bytes (must be a power of 2.) </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">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">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</td></tr>
+ <tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing a YUV planar image to be decoded. The size of this buffer should match the value returned by <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> for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source 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>Use this parameter to specify that the width of each line in each plane of the YUV source image is padded to the nearest multiple of this number of bytes (must be a power of 2.)</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">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>
</table>
</dd>
<p>This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG decompression process.</p>
<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>stride</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">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">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">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>stride</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">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">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>
</table>
</dd>
<p>Decompress a JPEG image to an RGB, grayscale, or CMYK image. </p>
<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">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">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">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">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">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">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>
</table>
</dd>
<p>Retrieve information about a JPEG image without decompressing it. </p>
<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">jpegBuf</td><td>pointer to a buffer containing a JPEG image </td></tr>
- <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">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 a JPEG image</td></tr>
+ <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">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>
<p>This function performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of an RGB image.</p>
<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">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">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 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">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">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">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 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">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>
</table>
</dd>
<p>This function performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of an RGB image.</p>
<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">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">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>stride</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">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">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">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>stride</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">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>
</table>
</dd>
<p>This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG compression process.</p>
<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">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">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">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">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>
</table>
</dd>
<p>This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG compression process.</p>
<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">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">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>stride</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">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">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">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>stride</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">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>
</table>
</dd>
<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>
<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">n</td><td>the number of transformed JPEG images to generate </td></tr>
+ <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">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>
<li>set <code>dstBufs[i]</code> to NULL to tell TurboJPEG to allocate the buffer for you, or</li>
<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b" title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters...">tjBufSize()</a> with the transformed or cropped width and height. This should ensure that the buffer never has to be re-allocated (setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees this.)</li>
</ol>
-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>
+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>
</table>
</dd>
* to be applied in the frequency domain.
*
* @param coeffs pointer to an array of transformed DCT coefficients. (NOTE:
- * this pointer is not guaranteed to be valid once the callback
- * returns, so applications wishing to hand off the DCT coefficients
- * to another function or library should make a copy of them within
- * the body of the callback.)
+ * this pointer is not guaranteed to be valid once the callback returns, so
+ * applications wishing to hand off the DCT coefficients to another function
+ * or library should make a copy of them within the body of the callback.)
+ *
* @param arrayRegion #tjregion structure containing the width and height of
- * the array pointed to by <tt>coeffs</tt> as well as its offset
- * relative to the component plane. TurboJPEG implementations may
- * choose to split each component plane into multiple DCT coefficient
- * arrays and call the callback function once for each array.
+ * the array pointed to by <tt>coeffs</tt> as well as its offset relative to
+ * the component plane. TurboJPEG implementations may choose to split each
+ * component plane into multiple DCT coefficient arrays and call the callback
+ * function once for each array.
+ *
* @param planeRegion #tjregion structure containing the width and height of
- * the component plane to which <tt>coeffs</tt> belongs
+ * the component plane to which <tt>coeffs</tt> belongs
+ *
* @param componentID ID number of the component plane to which
- * <tt>coeffs</tt> belongs (Y, Cb, and Cr have, respectively, ID's of
- * 0, 1, and 2 in typical JPEG images.)
+ * <tt>coeffs</tt> belongs (Y, Cb, and Cr have, respectively, ID's of 0, 1,
+ * and 2 in typical JPEG images.)
+ *
* @param transformID ID number of the transformed image to which
- * <tt>coeffs</tt> belongs. This is the same as the index of the
- * transform in the <tt>transforms</tt> array that was passed to
- * #tjTransform().
+ * <tt>coeffs</tt> belongs. This is the same as the index of the transform
+ * in the <tt>transforms</tt> array that was passed to #tjTransform().
+ *
* @param transform a pointer to a #tjtransform structure that specifies the
- * parameters and/or cropping region for this transform
+ * parameters and/or cropping region for this transform
*
* @return 0 if the callback was successful, or -1 if an error occurred.
*/
* Compress an RGB, grayscale, or CMYK image into a JPEG image.
*
* @param handle a handle to a TurboJPEG compressor or transformer instance
+ *
* @param srcBuf pointer to an image buffer containing RGB, grayscale, or
- * CMYK pixels to be compressed
+ * CMYK pixels to be compressed
+ *
* @param width width (in pixels) of the source image
+ *
* @param pitch bytes per line of 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 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 <tt>width * #tjPixelSize[pixelFormat]</tt>.
+ * <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
+ * 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
+ * <tt>width * #tjPixelSize[pixelFormat]</tt>.
+ *
* @param height height (in pixels) of the source image
+ *
* @param pixelFormat pixel format of the source image (see @ref TJPF
- * "Pixel formats".)
+ * "Pixel formats".)
+ *
* @param jpegBuf 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:
- * -# pre-allocate the JPEG buffer with an arbitrary size using
- * #tjAlloc() and let TurboJPEG grow the buffer as needed,
- * -# set <tt>*jpegBuf</tt> to NULL to tell TurboJPEG to allocate the
- * buffer for you, or
- * -# pre-allocate the buffer to a "worst case" size determined by
- * calling #tjBufSize(). This should ensure that the buffer never has
- * to be re-allocated (setting #TJFLAG_NOREALLOC guarantees this.)
- * .
- * If you choose option 1, <tt>*jpegSize</tt> should be set to the
- * size of your pre-allocated buffer. In any case, unless you have
- * set #TJFLAG_NOREALLOC, you should always check <tt>*jpegBuf</tt> upon
- * return from this function, as it may have changed.
+ * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer
+ * to accommodate the size of the JPEG image. Thus, you can choose to:
+ * -# pre-allocate the JPEG buffer with an arbitrary size using #tjAlloc() and
+ * let TurboJPEG grow the buffer as needed,
+ * -# set <tt>*jpegBuf</tt> to NULL to tell TurboJPEG to allocate the buffer
+ * for you, or
+ * -# pre-allocate the buffer to a "worst case" size determined by calling
+ * #tjBufSize(). This should ensure that the buffer never has to be
+ * re-allocated (setting #TJFLAG_NOREALLOC guarantees this.)
+ * .
+ * If you choose option 1, <tt>*jpegSize</tt> should be set to the size of your
+ * pre-allocated buffer. In any case, unless you have set #TJFLAG_NOREALLOC,
+ * you should always check <tt>*jpegBuf</tt> upon return from this function, as
+ * it may have changed.
+ *
* @param jpegSize pointer to an unsigned long variable that holds the size of
- * the JPEG image buffer. If <tt>*jpegBuf</tt> points to a
- * pre-allocated buffer, then <tt>*jpegSize</tt> should be set to the
- * size of the buffer. Upon return, <tt>*jpegSize</tt> will contain the
- * size of the JPEG image (in bytes.)
+ * the JPEG image buffer. If <tt>*jpegBuf</tt> points to a pre-allocated
+ * buffer, then <tt>*jpegSize</tt> should be set to the size of the buffer.
+ * Upon return, <tt>*jpegSize</tt> will contain the size of the JPEG image (in
+ * bytes.)
+ *
* @param jpegSubsamp the level of chrominance subsampling to be used when
- * generating the JPEG image (see @ref TJSAMP
- * "Chrominance subsampling options".)
+ * generating the JPEG image (see @ref TJSAMP
+ * "Chrominance subsampling options".)
+ *
* @param jpegQual the image quality of the generated JPEG image (1 = worst,
- 100 = best)
+ * 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().)
*/
* Compress a YUV planar image into a JPEG image.
*
* @param handle a handle to a TurboJPEG compressor or transformer instance
+ *
* @param srcBuf pointer to an image buffer containing a YUV planar image to be
- * compressed. The size of this buffer should match the value returned
- * by #tjBufSizeYUV2() for the given image width, height, padding, and
- * level of chrominance subsampling. The Y, U (Cb), and V (Cr) image
- * planes should be stored sequentially in the source buffer (refer to
- * @ref YUVnotes "YUV Image Format Notes".)
+ * compressed. The size of this buffer should match the value returned by
+ * #tjBufSizeYUV2() for the given image width, height, padding, and level of
+ * chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be
+ * stored sequentially in the source buffer (refer to @ref YUVnotes
+ * "YUV Image Format Notes".)
+ *
* @param width width (in pixels) of the source image. If the width is not an
- * even multiple of the MCU block width (see #tjMCUWidth), then an
- * intermediate buffer copy will be performed within TurboJPEG.
+ * even multiple of the MCU block width (see #tjMCUWidth), then an intermediate
+ * buffer copy will be performed within TurboJPEG.
+ *
* @param pad the line padding used in the source image. For instance, if each
- * line in each plane of the YUV image is padded to the nearest multiple
- * of 4 bytes, then <tt>pad</tt> should be set to 4.
+ * line in each plane of the YUV image is padded to the nearest multiple of 4
+ * bytes, then <tt>pad</tt> should be set to 4.
+ *
* @param height height (in pixels) of the source image. If the height is not
- * an even multiple of the MCU block height (see #tjMCUHeight), then an
- * intermediate buffer copy will be performed within TurboJPEG.
+ * an even multiple of the MCU block height (see #tjMCUHeight), then an
+ * intermediate buffer copy will be performed within TurboJPEG.
+ *
* @param subsamp the level of chrominance subsampling used in the source
- * image (see @ref TJSAMP "Chrominance subsampling options".)
+ * image (see @ref TJSAMP "Chrominance subsampling options".)
+ *
* @param jpegBuf 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:
- * -# pre-allocate the JPEG buffer with an arbitrary size using
- * #tjAlloc() and let TurboJPEG grow the buffer as needed,
- * -# set <tt>*jpegBuf</tt> to NULL to tell TurboJPEG to allocate the
- * buffer for you, or
- * -# pre-allocate the buffer to a "worst case" size determined by
- * calling #tjBufSize(). This should ensure that the buffer never has
- * to be re-allocated (setting #TJFLAG_NOREALLOC guarantees this.)
- * .
- * If you choose option 1, <tt>*jpegSize</tt> should be set to the
- * size of your pre-allocated buffer. In any case, unless you have
- * set #TJFLAG_NOREALLOC, you should always check <tt>*jpegBuf</tt> upon
- * return from this function, as it may have changed.
+ * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to
+ * accommodate the size of the JPEG image. Thus, you can choose to:
+ * -# pre-allocate the JPEG buffer with an arbitrary size using #tjAlloc() and
+ * let TurboJPEG grow the buffer as needed,
+ * -# set <tt>*jpegBuf</tt> to NULL to tell TurboJPEG to allocate the buffer
+ * for you, or
+ * -# pre-allocate the buffer to a "worst case" size determined by calling
+ * #tjBufSize(). This should ensure that the buffer never has to be
+ * re-allocated (setting #TJFLAG_NOREALLOC guarantees this.)
+ * .
+ * If you choose option 1, <tt>*jpegSize</tt> should be set to the size of your
+ * pre-allocated buffer. In any case, unless you have set #TJFLAG_NOREALLOC,
+ * you should always check <tt>*jpegBuf</tt> upon return from this function, as
+ * it may have changed.
+ *
* @param jpegSize pointer to an unsigned long variable that holds the size of
- * the JPEG image buffer. If <tt>*jpegBuf</tt> points to a
- * pre-allocated buffer, then <tt>*jpegSize</tt> should be set to the
- * size of the buffer. Upon return, <tt>*jpegSize</tt> will contain the
- * size of the JPEG image (in bytes.)
+ * the JPEG image buffer. If <tt>*jpegBuf</tt> points to a pre-allocated
+ * buffer, then <tt>*jpegSize</tt> should be set to the size of the buffer.
+ * Upon return, <tt>*jpegSize</tt> will contain the size of the JPEG image (in
+ * bytes.)
+ *
* @param jpegQual the image quality of the generated JPEG image (1 = worst,
- 100 = best)
+ * 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().)
*/
* Compress a set of Y, U (Cb), and V (Cr) image planes into a JPEG image.
*
* @param handle a handle to a TurboJPEG compressor or transformer instance
+ *
* @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.)
+ * (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.)
+ *
* @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 buffer copy will be performed within TurboJPEG.
+ * even multiple of the MCU block width (see #tjMCUWidth), then an intermediate
+ * buffer copy will be performed within TurboJPEG.
+ *
* @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>stride</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.
+ * 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>stride</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.
+ *
* @param height height (in pixels) of the source image. If the height is not
- * an even multiple of the MCU block height (see #tjMCUHeight), then an
- * intermediate buffer copy will be performed within TurboJPEG.
+ * an even multiple of the MCU block height (see #tjMCUHeight), then an
+ * intermediate buffer copy will be performed within TurboJPEG.
+ *
* @param subsamp the level of chrominance subsampling used in the source
- * image (see @ref TJSAMP "Chrominance subsampling options".)
+ * image (see @ref TJSAMP "Chrominance subsampling options".)
+ *
* @param jpegBuf 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:
- * -# pre-allocate the JPEG buffer with an arbitrary size using
- * #tjAlloc() and let TurboJPEG grow the buffer as needed,
- * -# set <tt>*jpegBuf</tt> to NULL to tell TurboJPEG to allocate the
- * buffer for you, or
- * -# pre-allocate the buffer to a "worst case" size determined by
- * calling #tjBufSize(). This should ensure that the buffer never has
- * to be re-allocated (setting #TJFLAG_NOREALLOC guarantees this.)
- * .
- * If you choose option 1, <tt>*jpegSize</tt> should be set to the
- * size of your pre-allocated buffer. In any case, unless you have
- * set #TJFLAG_NOREALLOC, you should always check <tt>*jpegBuf</tt> upon
- * return from this function, as it may have changed.
+ * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to
+ * accommodate the size of the JPEG image. Thus, you can choose to:
+ * -# pre-allocate the JPEG buffer with an arbitrary size using #tjAlloc() and
+ * let TurboJPEG grow the buffer as needed,
+ * -# set <tt>*jpegBuf</tt> to NULL to tell TurboJPEG to allocate the buffer
+ * for you, or
+ * -# pre-allocate the buffer to a "worst case" size determined by calling
+ * #tjBufSize(). This should ensure that the buffer never has to be
+ * re-allocated (setting #TJFLAG_NOREALLOC guarantees this.)
+ * .
+ * If you choose option 1, <tt>*jpegSize</tt> should be set to the size of your
+ * pre-allocated buffer. In any case, unless you have set #TJFLAG_NOREALLOC,
+ * you should always check <tt>*jpegBuf</tt> upon return from this function, as
+ * it may have changed.
+ *
* @param jpegSize pointer to an unsigned long variable that holds the size of
- * the JPEG image buffer. If <tt>*jpegBuf</tt> points to a
- * pre-allocated buffer, then <tt>*jpegSize</tt> should be set to the
- * size of the buffer. Upon return, <tt>*jpegSize</tt> will contain the
- * size of the JPEG image (in bytes.)
+ * the JPEG image buffer. If <tt>*jpegBuf</tt> points to a pre-allocated
+ * buffer, then <tt>*jpegSize</tt> should be set to the size of the buffer.
+ * Upon return, <tt>*jpegSize</tt> will contain the size of the JPEG image (in
+ * bytes.)
+ *
* @param jpegQual the image quality of the generated JPEG image (1 = worst,
- 100 = best)
+ * 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().)
*/
DLLEXPORT int DLLCALL tjCompressFromYUVPlanes(tjhandle handle,
- unsigned char **srcBufs, int width, int *strides, int height, int subsamp,
+ unsigned char **srcPlanes, int width, int *strides, int height, int subsamp,
unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags);
* handled.
*
* @param width width of the image (in pixels)
+ *
* @param height height of the image (in pixels)
+ *
* @param jpegSubsamp the level of chrominance subsampling to be used when
- * generating the JPEG image (see @ref TJSAMP
- * "Chrominance subsampling options".)
+ * generating the JPEG image (see @ref TJSAMP
+ * "Chrominance subsampling options".)
*
* @return the maximum size of the buffer (in bytes) required to hold the
* image, or -1 if the arguments are out of bounds.
* the given parameters.
*
* @param width width of the image (in pixels)
+ *
* @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 height of the image (in pixels)
+ *
* @param subsamp level of chrominance subsampling in the image (see
- * @ref TJSAMP "Chrominance subsampling options".)
+ * @ref TJSAMP "Chrominance subsampling options".)
*
* @return the size of the buffer (in bytes) required to hold the image, or
* -1 if the arguments are out of bounds.
* process.
*
* @param handle a handle to a TurboJPEG compressor or transformer instance
+ *
* @param srcBuf pointer to an image buffer containing RGB or grayscale pixels
- * to be encoded
+ * to be encoded
+ *
* @param width width (in pixels) of the source image
+ *
* @param pitch bytes per line of 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 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 <tt>width * #tjPixelSize[pixelFormat]</tt>.
+ * <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
+ * 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
+ * <tt>width * #tjPixelSize[pixelFormat]</tt>.
+ *
* @param height height (in pixels) of the source image
+ *
* @param pixelFormat pixel format of the source image (see @ref TJPF
- * "Pixel formats".)
+ * "Pixel formats".)
+ *
* @param dstBuf pointer to an image buffer that will receive the YUV image.
- * Use #tjBufSizeYUV2() 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 @ref YUVnotes
- * "YUV Image Format Notes".)
+ * Use #tjBufSizeYUV2() 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 @ref YUVnotes "YUV Image Format Notes".)
+ *
* @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 2.) To generate images suitable for X Video, <tt>pad</tt>
- * should be set to 4.
+ * padded to the nearest multiple of this number of bytes (must be a power of
+ * 2.) To generate images suitable for X Video, <tt>pad</tt> should be set to
+ * 4.
+ *
* @param subsamp the level of chrominance subsampling to be used when
- * generating the YUV image (see @ref TJSAMP
- * "Chrominance subsampling options".) To generate images suitable for
- * X Video, <tt>subsamp</tt> should be set to @ref TJSAMP_420. This
- * produces an image compatible with the I420 (AKA "YUV420P") format.
+ * generating the YUV image (see @ref TJSAMP
+ * "Chrominance subsampling options".) To generate images suitable for X
+ * Video, <tt>subsamp</tt> should be set to @ref TJSAMP_420. This produces an
+ * 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().)
*/
* compression process.
*
* @param handle a handle to a TurboJPEG compressor or transformer instance
+ *
* @param srcBuf pointer to an image buffer containing RGB or grayscale pixels
- * to be encoded
+ * to be encoded
+ *
* @param width width (in pixels) of the source image
+ *
* @param pitch bytes per line of 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 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 <tt>width * #tjPixelSize[pixelFormat]</tt>.
+ * <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
+ * 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
+ * <tt>width * #tjPixelSize[pixelFormat]</tt>.
+ *
* @param height height (in pixels) of the source image
+ *
* @param pixelFormat pixel format of the source image (see @ref TJPF
- * "Pixel formats".)
+ * "Pixel formats".)
+ *
* @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.)
+ * (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.)
+ *
* @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>stride</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.
+ * 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>stride</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.
+ *
* @param subsamp the level of chrominance subsampling to be used when
- * generating the YUV image (see @ref TJSAMP
- * "Chrominance subsampling options".) To generate images suitable for
- * X Video, <tt>subsamp</tt> should be set to @ref TJSAMP_420. This
- * produces an image compatible with the I420 (AKA "YUV420P") format.
+ * generating the YUV image (see @ref TJSAMP
+ * "Chrominance subsampling options".) To generate images suitable for X
+ * Video, <tt>subsamp</tt> should be set to @ref TJSAMP_420. This produces an
+ * 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().)
*/
* Retrieve information about a JPEG image without decompressing it.
*
* @param handle a handle to a TurboJPEG decompressor or transformer instance
+ *
* @param jpegBuf pointer to a buffer containing a JPEG image
+ *
* @param jpegSize size of the JPEG image (in bytes)
+ *
* @param width pointer to an integer variable that will receive the width (in
- * pixels) of the JPEG image
+ * pixels) of the JPEG image
+ *
* @param height pointer to an integer variable that will receive the height
- * (in pixels) of the JPEG image
+ * (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 compressing the JPEG image (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 image (see @ref TJCS "JPEG colorspaces".)
+ * of the JPEG colorspace constants, indicating the colorspace of the JPEG
+ * image (see @ref TJCS "JPEG colorspaces".)
*
* @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
*/
* this implementation of TurboJPEG supports.
*
* @param numscalingfactors pointer to an integer variable that will receive
- * the number of elements in the list
+ * the number of elements in the list
*
* @return a pointer to a list of fractional scaling factors, or NULL if an
* error is encountered (see #tjGetErrorStr().)
* Decompress a JPEG image to an RGB, grayscale, or CMYK image.
*
* @param handle a handle to a TurboJPEG decompressor or transformer instance
+ *
* @param jpegBuf pointer to a buffer containing the JPEG image to decompress
+ *
* @param jpegSize size of the JPEG image (in bytes)
+ *
* @param dstBuf pointer to an image buffer that will receive the decompressed
- * image. This buffer should normally be <tt>pitch * scaledHeight</tt>
- * bytes in size, where <tt>scaledHeight</tt> can be determined by
- * calling #TJSCALED() with the JPEG image height and one of the scaling
- * factors returned by #tjGetScalingFactors(). The <tt>dstBuf</tt>
- * pointer may also be used to decompress into a specific region of a
- * larger buffer.
+ * image. This buffer should normally be <tt>pitch * scaledHeight</tt> bytes
+ * in size, where <tt>scaledHeight</tt> can be determined by calling
+ * #TJSCALED() with the JPEG image height and one of the scaling factors
+ * returned by #tjGetScalingFactors(). The <tt>dstBuf</tt> pointer may also be
+ * used to decompress into a specific region of a larger buffer.
+ *
* @param width 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
- * <tt>width</tt> is set to 0, then only the height will be considered
- * when determining the scaled image size.
+ * 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 <tt>width</tt> is
+ * 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
- * <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 boundary, as is the case for
- * Windows bitmaps. (NOTE: <tt>scaledWidth</tt> can be determined by
- * calling #TJSCALED() with the JPEG image width and one of the scaling
- * factors returned by #tjGetScalingFactors().) 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
- * <tt>scaledWidth * #tjPixelSize[pixelFormat]</tt>.
+ * <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
+ * boundary, as is the case for Windows bitmaps. (NOTE: <tt>scaledWidth</tt>
+ * can be determined by calling #TJSCALED() with the JPEG image width and one
+ * of the scaling factors returned by #tjGetScalingFactors().) 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
+ * <tt>scaledWidth * #tjPixelSize[pixelFormat]</tt>.
+ *
* @param height 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 <tt>height</tt> is set to 0, then only the width will be
- * considered when determining the scaled image size.
+ * 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 <tt>height</tt>
+ * is set to 0, then only the width will be considered when determining the
+ * scaled image size.
+ *
* @param pixelFormat pixel format of the destination image (see @ref
- * TJPF "Pixel formats".)
+ * 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().)
*/
* image is generated instead of an RGB image.
*
* @param handle a handle to a TurboJPEG decompressor or transformer instance
+ *
* @param jpegBuf pointer to a buffer containing the JPEG image to decompress
+ *
* @param jpegSize size of the JPEG image (in bytes)
+ *
* @param dstBuf pointer to an image buffer that will receive the YUV image.
- * Use #tjBufSizeYUV2() to determine the appropriate size for this
- * buffer based on the image width, height, padding, and level of
- * subsampling. The Y, U (Cb), and V (Cr) image planes will be stored
- * sequentially in the buffer (refer to @ref YUVnotes
- * "YUV Image Format Notes".)
+ * Use #tjBufSizeYUV2() to determine the appropriate size for this buffer based
+ * on the image width, height, padding, and level of subsampling. The Y,
+ * U (Cb), and V (Cr) image planes will be stored sequentially in the buffer
+ * (refer to @ref YUVnotes "YUV Image Format Notes".)
+ *
* @param width 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
- * <tt>width</tt> 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 #tjMCUWidth), then an
- * intermediate buffer copy will be performed within TurboJPEG.
+ * 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 <tt>width</tt> 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 #tjMCUWidth), then an intermediate buffer copy will be
+ * performed within TurboJPEG.
+ *
* @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 2.) To generate images suitable for X Video, <tt>pad</tt>
- * should be set to 4.
+ * padded to the nearest multiple of this number of bytes (must be a power of
+ * 2.) To generate images suitable for X Video, <tt>pad</tt> should be set to
+ * 4.
+ *
* @param height 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
- * <tt>height</tt> 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 #tjMCUHeight), then an
- * intermediate buffer copy will be performed within TurboJPEG.
+ * 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 <tt>height</tt>
+ * 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 #tjMCUHeight), then an intermediate buffer copy will be
+ * 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().)
*/
* conversion step, so a planar YUV image is generated instead of an RGB image.
*
* @param handle a handle to a TurboJPEG decompressor or transformer instance
+ *
* @param jpegBuf pointer to a buffer containing the JPEG image to decompress
+ *
* @param jpegSize size of the JPEG image (in bytes)
+ *
* @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.)
+ * (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.)
+ *
* @param width 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
- * <tt>width</tt> 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 #tjMCUWidth), then an
- * intermediate buffer copy will be performed within TurboJPEG.
+ * 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 <tt>width</tt> 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 #tjMCUWidth), then an intermediate buffer copy will be
+ * performed within TurboJPEG.
+ *
* @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>stride</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.
+ * 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>stride</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.
+ *
* @param height 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
- * <tt>height</tt> 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 #tjMCUHeight), then an
- * intermediate buffer copy will be performed within TurboJPEG.
+ * 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 <tt>height</tt>
+ * 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 #tjMCUHeight), then an intermediate buffer copy will be
+ * 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().)
*/
* process.
*
* @param handle a handle to a TurboJPEG decompressor or transformer instance
+ *
* @param srcBuf pointer to an image buffer containing a YUV planar image to be
- * decoded. The size of this buffer should match the value returned
- * by #tjBufSizeYUV2() for the given image width, height, padding, and
- * level of chrominance subsampling. The Y, U (Cb), and V (Cr) image
- * planes should be stored sequentially in the source buffer (refer to
- * @ref YUVnotes "YUV Image Format Notes".)
+ * decoded. The size of this buffer should match the value returned by
+ * #tjBufSizeYUV2() for the given image width, height, padding, and level of
+ * chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be
+ * stored sequentially in the source buffer (refer to @ref YUVnotes
+ * "YUV Image Format Notes".)
+ *
* @param pad Use this parameter to specify that the width of each line in each
- * plane of the YUV source image is padded to the nearest multiple of
- * this number of bytes (must be a power of 2.)
+ * plane of the YUV source image is padded to the nearest multiple of this
+ * number of bytes (must be a power of 2.)
+ *
* @param subsamp the level of chrominance subsampling used in the YUV source
- * image (see @ref TJSAMP "Chrominance subsampling options".)
+ * image (see @ref TJSAMP "Chrominance subsampling options".)
+ *
* @param dstBuf pointer to an image buffer that will receive the decoded
- * image. This buffer should normally be <tt>pitch * height</tt>
- * bytes in size, but the <tt>dstBuf</tt> pointer can also be used to
- * decode into a specific region of a larger buffer.
+ * image. This buffer should normally be <tt>pitch * height</tt> bytes in
+ * size, but the <tt>dstBuf</tt> pointer can also be used to decode into a
+ * specific region of a larger buffer.
+ *
* @param width width (in pixels) of the source and destination images
+ *
* @param pitch bytes per line of 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 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 <tt>width *
- * #tjPixelSize[pixelFormat]</tt>.
+ * 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
+ * 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 <tt>width * #tjPixelSize[pixelFormat]</tt>.
+ *
* @param height height (in pixels) of the source and destination images
+ *
* @param pixelFormat pixel format of the destination image (see @ref TJPF
- * "Pixel formats".)
+ * "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().)
*/
* decompression process.
*
* @param handle a handle to a TurboJPEG decompressor or transformer instance
+ *
* @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.)
+ * (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.)
+ *
* @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>stride</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.
+ * 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>stride</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.
+ *
* @param subsamp the level of chrominance subsampling used in the YUV source
- * image (see @ref TJSAMP "Chrominance subsampling options".)
+ * image (see @ref TJSAMP "Chrominance subsampling options".)
+ *
* @param dstBuf pointer to an image buffer that will receive the decoded
- * image. This buffer should normally be <tt>pitch * height</tt>
- * bytes in size, but the <tt>dstBuf</tt> pointer can also be used to
- * decode into a specific region of a larger buffer.
+ * image. This buffer should normally be <tt>pitch * height</tt> bytes in
+ * size, but the <tt>dstBuf</tt> pointer can also be used to decode into a
+ * specific region of a larger buffer.
+ *
* @param width width (in pixels) of the source and destination images
+ *
* @param pitch bytes per line of 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 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 <tt>width *
- * #tjPixelSize[pixelFormat]</tt>.
+ * 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
+ * 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 <tt>width * #tjPixelSize[pixelFormat]</tt>.
+ *
* @param height height (in pixels) of the source and destination images
+ *
* @param pixelFormat pixel format of the destination image (see @ref TJPF
- * "Pixel formats".)
+ * "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().)
*/
* source coefficients multiple times.
*
* @param handle a handle to a TurboJPEG transformer instance
+ *
* @param jpegBuf pointer to a buffer containing the JPEG image to transform
+ *
* @param jpegSize size of the JPEG image (in bytes)
+ *
* @param n the number of transformed JPEG images to generate
+ *
* @param dstBufs pointer to an array of n image buffers. <tt>dstBufs[i]</tt>
- * will receive a JPEG image that has been transformed using the
- * parameters in <tt>transforms[i]</tt>. TurboJPEG has the ability to
- * reallocate the JPEG buffer to accommodate the size of the JPEG image.
- * Thus, you can choose to:
- * -# pre-allocate the JPEG buffer with an arbitrary size using
- * #tjAlloc() and let TurboJPEG grow the buffer as needed,
- * -# set <tt>dstBufs[i]</tt> to NULL to tell TurboJPEG to allocate the
- * buffer for you, or
- * -# pre-allocate the buffer to a "worst case" size determined by
- * calling #tjBufSize() with the transformed or cropped width and
- * height. This should ensure that the buffer never has to be
- * re-allocated (setting #TJFLAG_NOREALLOC guarantees this.)
- * .
- * If you choose option 1, <tt>dstSizes[i]</tt> should be set to
- * the size of your pre-allocated buffer. In any case, unless you have
- * set #TJFLAG_NOREALLOC, you should always check <tt>dstBufs[i]</tt>
- * upon return from this function, as it may have changed.
+ * will receive a JPEG image that has been transformed using the parameters in
+ * <tt>transforms[i]</tt>. TurboJPEG has the ability to reallocate the JPEG
+ * buffer to accommodate the size of the JPEG image. Thus, you can choose to:
+ * -# pre-allocate the JPEG buffer with an arbitrary size using #tjAlloc() and
+ * let TurboJPEG grow the buffer as needed,
+ * -# set <tt>dstBufs[i]</tt> to NULL to tell TurboJPEG to allocate the buffer
+ * for you, or
+ * -# pre-allocate the buffer to a "worst case" size determined by calling
+ * #tjBufSize() with the transformed or cropped width and height. This should
+ * ensure that the buffer never has to be re-allocated (setting
+ * #TJFLAG_NOREALLOC guarantees this.)
+ * .
+ * If you choose option 1, <tt>dstSizes[i]</tt> should be set to the size of
+ * your pre-allocated buffer. In any case, unless you have set
+ * #TJFLAG_NOREALLOC, you should always check <tt>dstBufs[i]</tt> upon return
+ * from this function, as it may have changed.
+ *
* @param dstSizes pointer to an array of n unsigned long variables that will
- * receive the actual sizes (in bytes) of each transformed JPEG image.
- * If <tt>dstBufs[i]</tt> points to a pre-allocated buffer, then
- * <tt>dstSizes[i]</tt> should be set to the size of the buffer. Upon
- * return, <tt>dstSizes[i]</tt> will contain the size of the JPEG image
- * (in bytes.)
+ * receive the actual sizes (in bytes) of each transformed JPEG image. If
+ * <tt>dstBufs[i]</tt> points to a pre-allocated buffer, then
+ * <tt>dstSizes[i]</tt> should be set to the size of the buffer. Upon return,
+ * <tt>dstSizes[i]</tt> will contain the size of the JPEG image (in bytes.)
+ *
* @param transforms pointer to an array of n #tjtransform structures, each of
- * which specifies the transform parameters and/or cropping region for
- * the corresponding transformed output image.
+ * which specifies the transform parameters and/or cropping region for the
+ * 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().)
*/
* Destroy a TurboJPEG compressor, decompressor, or transformer instance.
*
* @param handle a handle to a TurboJPEG compressor, decompressor or
- * transformer instance
+ * transformer instance
*
* @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()
*/