blob: caf54ec4fe2e479a2d01b114500d002d207bb288 [file] [log] [blame]
DRC9b28def2011-05-21 14:37:15 +00001<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml">
3<head>
4<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5<title>TurboJPEG: TurboJPEG</title>
6<link href="tabs.css" rel="stylesheet" type="text/css"/>
7<link href="search/search.css" rel="stylesheet" type="text/css"/>
8<script type="text/javascript" src="search/search.js"></script>
9<link href="doxygen.css" rel="stylesheet" type="text/css"/>
10</head>
11<body onload='searchBox.OnSelectItem(0);'>
12<!-- Generated by Doxygen 1.7.4 -->
13<script type="text/javascript"><!--
14var searchBox = new SearchBox("searchBox", "search",false,'Search');
15--></script>
16<div id="top">
17<div id="titlearea">
18<table cellspacing="0" cellpadding="0">
19 <tbody>
20 <tr style="height: 56px;">
21 <td style="padding-left: 0.5em;">
22 <div id="projectname">TurboJPEG&#160;<span id="projectnumber">1.2</span></div>
23 </td>
24 </tr>
25 </tbody>
26</table>
27</div>
28 <div id="navrow1" class="tabs">
29 <ul class="tablist">
30 <li><a href="index.html"><span>Main&#160;Page</span></a></li>
31 <li><a href="modules.html"><span>Modules</span></a></li>
32 <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
33 <li id="searchli">
34 <div id="MSearchBox" class="MSearchBoxInactive">
35 <span class="left">
36 <img id="MSearchSelect" src="search/mag_sel.png"
37 onmouseover="return searchBox.OnSearchSelectShow()"
38 onmouseout="return searchBox.OnSearchSelectHide()"
39 alt=""/>
40 <input type="text" id="MSearchField" value="Search" accesskey="S"
41 onfocus="searchBox.OnSearchFieldFocus(true)"
42 onblur="searchBox.OnSearchFieldFocus(false)"
43 onkeyup="searchBox.OnSearchFieldChange(event)"/>
44 </span><span class="right">
45 <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
46 </span>
47 </div>
48 </li>
49 </ul>
50 </div>
51</div>
52<div class="header">
53 <div class="summary">
54<a href="#nested-classes">Data Structures</a> &#124;
55<a href="#define-members">Defines</a> &#124;
56<a href="#typedef-members">Typedefs</a> &#124;
57<a href="#enum-members">Enumerations</a> &#124;
58<a href="#func-members">Functions</a> &#124;
59<a href="#var-members">Variables</a> </div>
60 <div class="headertitle">
61<div class="title">TurboJPEG</div> </div>
62</div>
63<div class="contents">
64
65<p>TurboJPEG API.
66<a href="#details">More...</a></p>
67<table class="memberdecls">
68<tr><td colspan="2"><h2><a name="nested-classes"></a>
69Data Structures</h2></td></tr>
70<tr><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structtjscalingfactor.html">tjscalingfactor</a></td></tr>
71<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Scaling factor. <a href="structtjscalingfactor.html#details">More...</a><br/></td></tr>
72<tr><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structtjregion.html">tjregion</a></td></tr>
73<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Cropping region. <a href="structtjregion.html#details">More...</a><br/></td></tr>
74<tr><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structtjtransform.html">tjtransform</a></td></tr>
75<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Lossless transform. <a href="structtjtransform.html#details">More...</a><br/></td></tr>
76<tr><td colspan="2"><h2><a name="define-members"></a>
77Defines</h2></td></tr>
DRC25b995a2011-05-21 15:34:54 +000078<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga5ef3d169162ce77ce348e292a0b7477c">TJ_NUMSAMP</a></td></tr>
79<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The number of chrominance subsampling options. <a href="#ga5ef3d169162ce77ce348e292a0b7477c"></a><br/></td></tr>
80<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga7010a4402f54a45ba822ad8675a4655e">TJ_NUMPF</a></td></tr>
81<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The number of pixel formats. <a href="#ga7010a4402f54a45ba822ad8675a4655e"></a><br/></td></tr>
82<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">TJFLAG_BOTTOMUP</a></td></tr>
83<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The uncompressed source/destination image is stored in bottom-up (Windows, OpenGL) order, not top-down (X11) order. <a href="#ga72ecf4ebe6eb702d3c6f5ca27455e1ec"></a><br/></td></tr>
84<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga4e872f11c82f241736fa8297920f24e5">TJFLAG_FORCEMMX</a></td></tr>
85<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Turn off CPU auto-detection and force TurboJPEG to use MMX code (IPP and 32-bit libjpeg-turbo versions only.) <a href="#ga4e872f11c82f241736fa8297920f24e5"></a><br/></td></tr>
86<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gae17e63189e8cd730feed3efbd2454f38">TJFLAG_FORCESSE</a></td></tr>
87<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Turn off CPU auto-detection and force TurboJPEG to use SSE code (32-bit IPP and 32-bit libjpeg-turbo versions only) <a href="#gae17e63189e8cd730feed3efbd2454f38"></a><br/></td></tr>
88<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga8cf0bca96ea4d472563f4b0ebf8c48e7">TJFLAG_FORCESSE2</a></td></tr>
89<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Turn off CPU auto-detection and force TurboJPEG to use SSE2 code (32-bit IPP and 32-bit libjpeg-turbo versions only) <a href="#ga8cf0bca96ea4d472563f4b0ebf8c48e7"></a><br/></td></tr>
90<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gaf9d49066633404da4386d70820295dd2">TJFLAG_FORCESSE3</a></td></tr>
91<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Turn off CPU auto-detection and force TurboJPEG to use SSE3 code (64-bit IPP version only) <a href="#gaf9d49066633404da4386d70820295dd2"></a><br/></td></tr>
92<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga4ee4506c81177a06f77e2504a22efd2d">TJFLAG_FASTUPSAMPLE</a></td></tr>
93<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Use fast, inaccurate chrominance upsampling routines in the JPEG decompressor (libjpeg and libjpeg-turbo versions only) <a href="#ga4ee4506c81177a06f77e2504a22efd2d"></a><br/></td></tr>
94<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963">TJFLAG_NOREALLOC</a></td></tr>
95<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Disable buffer (re)allocation. <a href="#ga8808d403c68b62aaa58a4c1e58e98963"></a><br/></td></tr>
96<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga0f6dbd18adf38b7d46ac547f0f4d562c">TJ_NUMXOP</a></td></tr>
97<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Number of transform operations. <a href="#ga0f6dbd18adf38b7d46ac547f0f4d562c"></a><br/></td></tr>
98<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00">TJXOPT_PERFECT</a></td></tr>
99<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">This option will cause <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> to return an error if the transform is not perfect. <a href="#ga50e03cb5ed115330e212417429600b00"></a><br/></td></tr>
100<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga319826b7eb1583c0595bbe7b95428709">TJXOPT_TRIM</a></td></tr>
101<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">This option will cause <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> to discard any partial MCU blocks that cannot be transformed. <a href="#ga319826b7eb1583c0595bbe7b95428709"></a><br/></td></tr>
102<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga9c771a757fc1294add611906b89ab2d2">TJXOPT_CROP</a></td></tr>
103<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">This option will enable lossless cropping. <a href="#ga9c771a757fc1294add611906b89ab2d2"></a><br/></td></tr>
104<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga3acee7b48ade1b99e5588736007c2589">TJXOPT_GRAY</a></td></tr>
105<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">This option will discard the color data in the input image and produce a grayscale output image. <a href="#ga3acee7b48ade1b99e5588736007c2589"></a><br/></td></tr>
DRC7bf04d32011-09-17 00:18:31 +0000106<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gafbf992bbf6e006705886333703ffab31">TJXOPT_NOOUTPUT</a></td></tr>
107<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">This option will prevent <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> from outputting a JPEG image for this particular transform (this can be used in conjunction with a custom filter to capture the transformed DCT coefficients without transcoding them.) <a href="#gafbf992bbf6e006705886333703ffab31"></a><br/></td></tr>
DRC25b995a2011-05-21 15:34:54 +0000108<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511">TJPAD</a>(width)</td></tr>
109<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Pad the given width to the nearest 32-bit boundary. <a href="#ga0aba955473315e405295d978f0c16511"></a><br/></td></tr>
DRC9b28def2011-05-21 14:37:15 +0000110<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df">TJSCALED</a>(dimension, scalingFactor)</td></tr>
DRC25b995a2011-05-21 15:34:54 +0000111<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Compute the scaled value of <code>dimension</code> using the given scaling factor. <a href="#ga84878bb65404204743aa18cac02781df"></a><br/></td></tr>
DRC9b28def2011-05-21 14:37:15 +0000112<tr><td colspan="2"><h2><a name="typedef-members"></a>
113Typedefs</h2></td></tr>
DRC25b995a2011-05-21 15:34:54 +0000114<tr><td class="memItemLeft" align="right" valign="top">typedef void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a></td></tr>
115<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">TurboJPEG instance handle. <a href="#ga758d2634ecb4949de7815cba621f5763"></a><br/></td></tr>
DRC9b28def2011-05-21 14:37:15 +0000116<tr><td colspan="2"><h2><a name="enum-members"></a>
117Enumerations</h2></td></tr>
DRC25b995a2011-05-21 15:34:54 +0000118<tr><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">TJSAMP</a> { <br/>
119&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074afb8da4f44197837bdec0a4f593dacae3">TJSAMP_444</a>,
120<a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a136130902cc578f11f32429b59368404">TJSAMP_422</a>,
121<a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a63085dbf683cfe39e513cdb6343e3737">TJSAMP_420</a>,
122<a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a3f1c9504842ddc7a48d0f690754b6248">TJSAMP_GRAY</a>,
DRC9b28def2011-05-21 14:37:15 +0000123<br/>
DRC25b995a2011-05-21 15:34:54 +0000124&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074accf740e6f3aa6ba20ba922cad13cb974">TJSAMP_440</a>
DRC9b28def2011-05-21 14:37:15 +0000125<br/>
126 }</td></tr>
DRC25b995a2011-05-21 15:34:54 +0000127<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Chrominance subsampling options. <a href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">More...</a><br/></td></tr>
128<tr><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">TJPF</a> { <br/>
129&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7ce93230bff449518ce387c17e6ed37c">TJPF_RGB</a>,
130<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aab10624437fb8ef495a0b153e65749839">TJPF_BGR</a>,
131<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01">TJPF_RGBX</a>,
132<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa2a1fbf569ca79897eae886e3376ca4c8">TJPF_BGRX</a>,
DRC9b28def2011-05-21 14:37:15 +0000133<br/>
DRC25b995a2011-05-21 15:34:54 +0000134&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af">TJPF_XBGR</a>,
135<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84">TJPF_XRGB</a>,
136<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a">TJPF_GRAY</a>
DRC9b28def2011-05-21 14:37:15 +0000137<br/>
138 }</td></tr>
DRC25b995a2011-05-21 15:34:54 +0000139<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Pixel formats. <a href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">More...</a><br/></td></tr>
140<tr><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866">TJXOP</a> { <br/>
141&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aad88c0366cd3f7d0eac9d7a3fa1c2c27">TJXOP_NONE</a>,
142<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aa0df69776caa30f0fa28e26332d311ce">TJXOP_HFLIP</a>,
143<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a324eddfbec53b7e691f61e56929d0d5d">TJXOP_VFLIP</a>,
144<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a31060aed199f886afdd417f80499c32d">TJXOP_TRANSPOSE</a>,
DRC9b28def2011-05-21 14:37:15 +0000145<br/>
DRC25b995a2011-05-21 15:34:54 +0000146&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866af3b14d488aea6ece9e5b3df73a74d6a4">TJXOP_TRANSVERSE</a>,
147<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a43b2bbb23bc4bd548422d43fbe9af128">TJXOP_ROT90</a>,
148<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a140952eb8dd0300accfcc22726d69692">TJXOP_ROT180</a>,
149<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a3064ee5dfb7f032df332818587567a08">TJXOP_ROT270</a>
DRC9b28def2011-05-21 14:37:15 +0000150<br/>
151 }</td></tr>
DRC25b995a2011-05-21 15:34:54 +0000152<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Transform operations for <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> <a href="group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866">More...</a><br/></td></tr>
DRC9b28def2011-05-21 14:37:15 +0000153<tr><td colspan="2"><h2><a name="func-members"></a>
154Functions</h2></td></tr>
155<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> DLLCALL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga3d10c47fbe4a2489a2b30c931551d01a">tjInitCompress</a> (void)</td></tr>
156<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a TurboJPEG compressor instance. <a href="#ga3d10c47fbe4a2489a2b30c931551d01a"></a><br/></td></tr>
157<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT int DLLCALL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gaba62b7a98f960839b588579898495cf2">tjCompress2</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegSubsamp, int jpegQual, int flags)</td></tr>
158<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Compress an RGB or grayscale image into a JPEG image. <a href="#gaba62b7a98f960839b588579898495cf2"></a><br/></td></tr>
DRC9b49f0e2011-07-12 03:17:23 +0000159<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT unsigned long DLLCALL&#160;</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>
160<tr><td class="mdescLeft">&#160;</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"></a><br/></td></tr>
161<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT unsigned long DLLCALL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga9d0cb06fd5052d21b6f2b382db8b219c">tjBufSizeYUV</a> (int width, int height, int subsamp)</td></tr>
162<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters. <a href="#ga9d0cb06fd5052d21b6f2b382db8b219c"></a><br/></td></tr>
DRC9b28def2011-05-21 14:37:15 +0000163<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT int DLLCALL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga0fa4e7b1943687c6a0c0304529c55d35">tjEncodeYUV2</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char *dstBuf, int subsamp, int flags)</td></tr>
164<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Encode an RGB or grayscale image into a YUV planar image. <a href="#ga0fa4e7b1943687c6a0c0304529c55d35"></a><br/></td></tr>
165<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> DLLCALL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gae5408179d041e2a2f7199c8283cf649e">tjInitDecompress</a> (void)</td></tr>
166<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a TurboJPEG decompressor instance. <a href="#gae5408179d041e2a2f7199c8283cf649e"></a><br/></td></tr>
167<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT int DLLCALL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gac5675fceb7997b385516cdffdb34e6aa">tjDecompressHeader2</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *jpegBuf, unsigned long jpegSize, int *width, int *height, int *jpegSubsamp)</td></tr>
168<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Retrieve information about a JPEG image without decompressing it. <a href="#gac5675fceb7997b385516cdffdb34e6aa"></a><br/></td></tr>
169<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT <a class="el" href="structtjscalingfactor.html">tjscalingfactor</a> *DLLCALL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga6449044b9af402999ccf52f401333be8">tjGetScalingFactors</a> (int *numscalingfactors)</td></tr>
170<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a list of fractional scaling factors that the JPEG decompressor in this implementation of TurboJPEG supports. <a href="#ga6449044b9af402999ccf52f401333be8"></a><br/></td></tr>
171<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT int DLLCALL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gada69cc6443d1bb493b40f1626259e5e9">tjDecompress2</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)</td></tr>
172<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Decompress a JPEG image to an RGB or grayscale image. <a href="#gada69cc6443d1bb493b40f1626259e5e9"></a><br/></td></tr>
173<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT int DLLCALL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gad7810af095624a4016e72957a50f77d8">tjDecompressToYUV</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, int flags)</td></tr>
174<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Decompress a JPEG image to a YUV planar image. <a href="#gad7810af095624a4016e72957a50f77d8"></a><br/></td></tr>
175<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> DLLCALL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga3155b775bfbac9dbba869b95a0367902">tjInitTransform</a> (void)</td></tr>
176<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a new TurboJPEG transformer instance. <a href="#ga3155b775bfbac9dbba869b95a0367902"></a><br/></td></tr>
177<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT int DLLCALL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616">tjTransform</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *jpegBuf, unsigned long jpegSize, int n, unsigned char **dstBufs, unsigned long *dstSizes, <a class="el" href="structtjtransform.html">tjtransform</a> *transforms, int flags)</td></tr>
178<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Losslessly transform a JPEG image into another JPEG image. <a href="#gae403193ceb4aafb7e0f56ab587b48616"></a><br/></td></tr>
179<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT int DLLCALL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga674adee917b95ad4a896f1ba39e12540">tjDestroy</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle)</td></tr>
180<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroy a TurboJPEG compressor, decompressor, or transformer instance. <a href="#ga674adee917b95ad4a896f1ba39e12540"></a><br/></td></tr>
DRC6b76f752011-05-24 16:52:47 +0000181<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT unsigned char *DLLCALL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga5c9234bda6d993cdaffdd89bf81a00ff">tjAlloc</a> (int bytes)</td></tr>
182<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocate an image buffer for use with TurboJPEG. <a href="#ga5c9234bda6d993cdaffdd89bf81a00ff"></a><br/></td></tr>
183<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT void DLLCALL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga8c4a1231dc06a450514c835f6471f137">tjFree</a> (unsigned char *buffer)</td></tr>
184<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Free an image buffer previously allocated by TurboJPEG. <a href="#ga8c4a1231dc06a450514c835f6471f137"></a><br/></td></tr>
DRC9b28def2011-05-21 14:37:15 +0000185<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT char *DLLCALL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf">tjGetErrorStr</a> (void)</td></tr>
186<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a descriptive error message explaining why the last command failed. <a href="#ga9af79c908ec131b1ae8d52fe40375abf"></a><br/></td></tr>
187<tr><td colspan="2"><h2><a name="var-members"></a>
188Variables</h2></td></tr>
189<tr><td class="memItemLeft" align="right" valign="top">static const int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c">tjMCUWidth</a> [TJ_NUMSAMP]</td></tr>
190<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">MCU block width (in pixels) for a given level of chrominance subsampling. <a href="#ga9e61e7cd47a15a173283ba94e781308c"></a><br/></td></tr>
191<tr><td class="memItemLeft" align="right" valign="top">static const int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf">tjMCUHeight</a> [TJ_NUMSAMP]</td></tr>
192<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">MCU block height (in pixels) for a given level of chrominance subsampling. <a href="#gabd247bb9fecb393eca57366feb8327bf"></a><br/></td></tr>
193<tr><td class="memItemLeft" align="right" valign="top">static const int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gadd9b446742ac8a3923f7992c7988fea8">tjRedOffset</a> [TJ_NUMPF]</td></tr>
194<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Red offset (in bytes) for a given pixel format. <a href="#gadd9b446742ac8a3923f7992c7988fea8"></a><br/></td></tr>
195<tr><td class="memItemLeft" align="right" valign="top">static const int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga82d6e35da441112a411da41923c0ba2f">tjGreenOffset</a> [TJ_NUMPF]</td></tr>
196<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Green offset (in bytes) for a given pixel format. <a href="#ga82d6e35da441112a411da41923c0ba2f"></a><br/></td></tr>
197<tr><td class="memItemLeft" align="right" valign="top">static const int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga84e2e35d3f08025f976ec1ec53693dea">tjBlueOffset</a> [TJ_NUMPF]</td></tr>
198<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Blue offset (in bytes) for a given pixel format. <a href="#ga84e2e35d3f08025f976ec1ec53693dea"></a><br/></td></tr>
DRC25b995a2011-05-21 15:34:54 +0000199<tr><td class="memItemLeft" align="right" valign="top">static const int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c">tjPixelSize</a> [TJ_NUMPF]</td></tr>
200<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Pixel size (in bytes) for a given pixel format. <a href="#gad77cf8fe5b2bfd3cb3f53098146abb4c"></a><br/></td></tr>
DRC9b28def2011-05-21 14:37:15 +0000201</table>
202<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
203<p>TurboJPEG API. </p>
204<p>This API provides an interface for generating, decoding, and transforming planar YUV and JPEG images in memory. </p>
205<hr/><h2>Define Documentation</h2>
DRC25b995a2011-05-21 15:34:54 +0000206<a class="anchor" id="ga7010a4402f54a45ba822ad8675a4655e"></a><!-- doxytag: member="turbojpeg.h::TJ_NUMPF" ref="ga7010a4402f54a45ba822ad8675a4655e" args="" -->
DRC9b28def2011-05-21 14:37:15 +0000207<div class="memitem">
208<div class="memproto">
209 <table class="memname">
210 <tr>
DRC25b995a2011-05-21 15:34:54 +0000211 <td class="memname">#define TJ_NUMPF</td>
DRC9b28def2011-05-21 14:37:15 +0000212 </tr>
213 </table>
214</div>
215<div class="memdoc">
216
DRC25b995a2011-05-21 15:34:54 +0000217<p>The number of pixel formats. </p>
DRC9b28def2011-05-21 14:37:15 +0000218
219</div>
220</div>
DRC25b995a2011-05-21 15:34:54 +0000221<a class="anchor" id="ga5ef3d169162ce77ce348e292a0b7477c"></a><!-- doxytag: member="turbojpeg.h::TJ_NUMSAMP" ref="ga5ef3d169162ce77ce348e292a0b7477c" args="" -->
DRC9b28def2011-05-21 14:37:15 +0000222<div class="memitem">
223<div class="memproto">
224 <table class="memname">
225 <tr>
DRC25b995a2011-05-21 15:34:54 +0000226 <td class="memname">#define TJ_NUMSAMP</td>
DRC9b28def2011-05-21 14:37:15 +0000227 </tr>
228 </table>
229</div>
230<div class="memdoc">
231
DRC25b995a2011-05-21 15:34:54 +0000232<p>The number of chrominance subsampling options. </p>
233
234</div>
235</div>
236<a class="anchor" id="ga0f6dbd18adf38b7d46ac547f0f4d562c"></a><!-- doxytag: member="turbojpeg.h::TJ_NUMXOP" ref="ga0f6dbd18adf38b7d46ac547f0f4d562c" args="" -->
237<div class="memitem">
238<div class="memproto">
239 <table class="memname">
240 <tr>
241 <td class="memname">#define TJ_NUMXOP</td>
242 </tr>
243 </table>
244</div>
245<div class="memdoc">
246
247<p>Number of transform operations. </p>
248
249</div>
250</div>
251<a class="anchor" id="ga72ecf4ebe6eb702d3c6f5ca27455e1ec"></a><!-- doxytag: member="turbojpeg.h::TJFLAG_BOTTOMUP" ref="ga72ecf4ebe6eb702d3c6f5ca27455e1ec" args="" -->
252<div class="memitem">
253<div class="memproto">
254 <table class="memname">
255 <tr>
256 <td class="memname">#define TJFLAG_BOTTOMUP</td>
257 </tr>
258 </table>
259</div>
260<div class="memdoc">
261
262<p>The uncompressed source/destination image is stored in bottom-up (Windows, OpenGL) order, not top-down (X11) order. </p>
263
264</div>
265</div>
266<a class="anchor" id="ga4ee4506c81177a06f77e2504a22efd2d"></a><!-- doxytag: member="turbojpeg.h::TJFLAG_FASTUPSAMPLE" ref="ga4ee4506c81177a06f77e2504a22efd2d" args="" -->
267<div class="memitem">
268<div class="memproto">
269 <table class="memname">
270 <tr>
271 <td class="memname">#define TJFLAG_FASTUPSAMPLE</td>
272 </tr>
273 </table>
274</div>
275<div class="memdoc">
276
DRC9b28def2011-05-21 14:37:15 +0000277<p>Use fast, inaccurate chrominance upsampling routines in the JPEG decompressor (libjpeg and libjpeg-turbo versions only) </p>
278
279</div>
280</div>
DRC25b995a2011-05-21 15:34:54 +0000281<a class="anchor" id="ga4e872f11c82f241736fa8297920f24e5"></a><!-- doxytag: member="turbojpeg.h::TJFLAG_FORCEMMX" ref="ga4e872f11c82f241736fa8297920f24e5" args="" -->
DRC9b28def2011-05-21 14:37:15 +0000282<div class="memitem">
283<div class="memproto">
284 <table class="memname">
285 <tr>
DRC25b995a2011-05-21 15:34:54 +0000286 <td class="memname">#define TJFLAG_FORCEMMX</td>
DRC9b28def2011-05-21 14:37:15 +0000287 </tr>
288 </table>
289</div>
290<div class="memdoc">
291
DRC9b28def2011-05-21 14:37:15 +0000292<p>Turn off CPU auto-detection and force TurboJPEG to use MMX code (IPP and 32-bit libjpeg-turbo versions only.) </p>
293
294</div>
295</div>
DRC25b995a2011-05-21 15:34:54 +0000296<a class="anchor" id="gae17e63189e8cd730feed3efbd2454f38"></a><!-- doxytag: member="turbojpeg.h::TJFLAG_FORCESSE" ref="gae17e63189e8cd730feed3efbd2454f38" args="" -->
DRC9b28def2011-05-21 14:37:15 +0000297<div class="memitem">
298<div class="memproto">
299 <table class="memname">
300 <tr>
DRC25b995a2011-05-21 15:34:54 +0000301 <td class="memname">#define TJFLAG_FORCESSE</td>
DRC9b28def2011-05-21 14:37:15 +0000302 </tr>
303 </table>
304</div>
305<div class="memdoc">
306
DRC9b28def2011-05-21 14:37:15 +0000307<p>Turn off CPU auto-detection and force TurboJPEG to use SSE code (32-bit IPP and 32-bit libjpeg-turbo versions only) </p>
308
309</div>
310</div>
DRC25b995a2011-05-21 15:34:54 +0000311<a class="anchor" id="ga8cf0bca96ea4d472563f4b0ebf8c48e7"></a><!-- doxytag: member="turbojpeg.h::TJFLAG_FORCESSE2" ref="ga8cf0bca96ea4d472563f4b0ebf8c48e7" args="" -->
DRC9b28def2011-05-21 14:37:15 +0000312<div class="memitem">
313<div class="memproto">
314 <table class="memname">
315 <tr>
DRC25b995a2011-05-21 15:34:54 +0000316 <td class="memname">#define TJFLAG_FORCESSE2</td>
DRC9b28def2011-05-21 14:37:15 +0000317 </tr>
318 </table>
319</div>
320<div class="memdoc">
321
DRC9b28def2011-05-21 14:37:15 +0000322<p>Turn off CPU auto-detection and force TurboJPEG to use SSE2 code (32-bit IPP and 32-bit libjpeg-turbo versions only) </p>
323
324</div>
325</div>
DRC25b995a2011-05-21 15:34:54 +0000326<a class="anchor" id="gaf9d49066633404da4386d70820295dd2"></a><!-- doxytag: member="turbojpeg.h::TJFLAG_FORCESSE3" ref="gaf9d49066633404da4386d70820295dd2" args="" -->
DRC9b28def2011-05-21 14:37:15 +0000327<div class="memitem">
328<div class="memproto">
329 <table class="memname">
330 <tr>
DRC25b995a2011-05-21 15:34:54 +0000331 <td class="memname">#define TJFLAG_FORCESSE3</td>
DRC9b28def2011-05-21 14:37:15 +0000332 </tr>
333 </table>
334</div>
335<div class="memdoc">
336
DRC9b28def2011-05-21 14:37:15 +0000337<p>Turn off CPU auto-detection and force TurboJPEG to use SSE3 code (64-bit IPP version only) </p>
338
339</div>
340</div>
DRC25b995a2011-05-21 15:34:54 +0000341<a class="anchor" id="ga8808d403c68b62aaa58a4c1e58e98963"></a><!-- doxytag: member="turbojpeg.h::TJFLAG_NOREALLOC" ref="ga8808d403c68b62aaa58a4c1e58e98963" args="" -->
DRC9b28def2011-05-21 14:37:15 +0000342<div class="memitem">
343<div class="memproto">
344 <table class="memname">
345 <tr>
DRC25b995a2011-05-21 15:34:54 +0000346 <td class="memname">#define TJFLAG_NOREALLOC</td>
DRC9b28def2011-05-21 14:37:15 +0000347 </tr>
348 </table>
349</div>
350<div class="memdoc">
351
DRC25b995a2011-05-21 15:34:54 +0000352<p>Disable buffer (re)allocation. </p>
DRC9b28def2011-05-21 14:37:15 +0000353<p>If passed to <a class="el" href="group___turbo_j_p_e_g.html#gaba62b7a98f960839b588579898495cf2" title="Compress an RGB or grayscale image into a JPEG image.">tjCompress2()</a> or <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a>, this flag will cause those functions to generate an error if the JPEG image buffer is invalid or too small rather than attempting to allocate or reallocate that buffer. This reproduces the behavior of earlier versions of TurboJPEG. </p>
354
355</div>
356</div>
DRC25b995a2011-05-21 15:34:54 +0000357<a class="anchor" id="ga0aba955473315e405295d978f0c16511"></a><!-- doxytag: member="turbojpeg.h::TJPAD" ref="ga0aba955473315e405295d978f0c16511" args="(width)" -->
358<div class="memitem">
359<div class="memproto">
360 <table class="memname">
361 <tr>
362 <td class="memname">#define TJPAD</td>
363 <td>(</td>
364 <td class="paramtype">&#160;</td>
365 <td class="paramname">width</td><td>)</td>
366 <td></td>
367 </tr>
368 </table>
369</div>
370<div class="memdoc">
371
372<p>Pad the given width to the nearest 32-bit boundary. </p>
373
374</div>
375</div>
DRC9b28def2011-05-21 14:37:15 +0000376<a class="anchor" id="ga84878bb65404204743aa18cac02781df"></a><!-- doxytag: member="turbojpeg.h::TJSCALED" ref="ga84878bb65404204743aa18cac02781df" args="(dimension, scalingFactor)" -->
377<div class="memitem">
378<div class="memproto">
379 <table class="memname">
380 <tr>
381 <td class="memname">#define TJSCALED</td>
382 <td>(</td>
383 <td class="paramtype">&#160;</td>
384 <td class="paramname">dimension, </td>
385 </tr>
386 <tr>
387 <td class="paramkey"></td>
388 <td></td>
389 <td class="paramtype">&#160;</td>
390 <td class="paramname">scalingFactor&#160;</td>
391 </tr>
392 <tr>
393 <td></td>
394 <td>)</td>
395 <td></td><td></td>
396 </tr>
397 </table>
398</div>
399<div class="memdoc">
400
DRC25b995a2011-05-21 15:34:54 +0000401<p>Compute the scaled value of <code>dimension</code> using the given scaling factor. </p>
DRC9b28def2011-05-21 14:37:15 +0000402<p>This macro performs the integer equivalent of <code>ceil(dimension * scalingFactor)</code>. </p>
403
404</div>
405</div>
DRC25b995a2011-05-21 15:34:54 +0000406<a class="anchor" id="ga9c771a757fc1294add611906b89ab2d2"></a><!-- doxytag: member="turbojpeg.h::TJXOPT_CROP" ref="ga9c771a757fc1294add611906b89ab2d2" args="" -->
DRC9b28def2011-05-21 14:37:15 +0000407<div class="memitem">
408<div class="memproto">
409 <table class="memname">
410 <tr>
DRC25b995a2011-05-21 15:34:54 +0000411 <td class="memname">#define TJXOPT_CROP</td>
DRC9b28def2011-05-21 14:37:15 +0000412 </tr>
413 </table>
414</div>
415<div class="memdoc">
416
417<p>This option will enable lossless cropping. </p>
DRC25b995a2011-05-21 15:34:54 +0000418<p>See <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> for more information. </p>
DRC9b28def2011-05-21 14:37:15 +0000419
420</div>
421</div>
DRC25b995a2011-05-21 15:34:54 +0000422<a class="anchor" id="ga3acee7b48ade1b99e5588736007c2589"></a><!-- doxytag: member="turbojpeg.h::TJXOPT_GRAY" ref="ga3acee7b48ade1b99e5588736007c2589" args="" -->
DRC9b28def2011-05-21 14:37:15 +0000423<div class="memitem">
424<div class="memproto">
425 <table class="memname">
426 <tr>
DRC25b995a2011-05-21 15:34:54 +0000427 <td class="memname">#define TJXOPT_GRAY</td>
DRC9b28def2011-05-21 14:37:15 +0000428 </tr>
429 </table>
430</div>
431<div class="memdoc">
432
433<p>This option will discard the color data in the input image and produce a grayscale output image. </p>
DRC9b28def2011-05-21 14:37:15 +0000434
435</div>
436</div>
DRC7bf04d32011-09-17 00:18:31 +0000437<a class="anchor" id="gafbf992bbf6e006705886333703ffab31"></a><!-- doxytag: member="turbojpeg.h::TJXOPT_NOOUTPUT" ref="gafbf992bbf6e006705886333703ffab31" args="" -->
438<div class="memitem">
439<div class="memproto">
440 <table class="memname">
441 <tr>
442 <td class="memname">#define TJXOPT_NOOUTPUT</td>
443 </tr>
444 </table>
445</div>
446<div class="memdoc">
447
448<p>This option will prevent <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> from outputting a JPEG image for this particular transform (this can be used in conjunction with a custom filter to capture the transformed DCT coefficients without transcoding them.) </p>
449
450</div>
451</div>
DRC25b995a2011-05-21 15:34:54 +0000452<a class="anchor" id="ga50e03cb5ed115330e212417429600b00"></a><!-- doxytag: member="turbojpeg.h::TJXOPT_PERFECT" ref="ga50e03cb5ed115330e212417429600b00" args="" -->
DRC9b28def2011-05-21 14:37:15 +0000453<div class="memitem">
454<div class="memproto">
455 <table class="memname">
456 <tr>
DRC25b995a2011-05-21 15:34:54 +0000457 <td class="memname">#define TJXOPT_PERFECT</td>
DRC9b28def2011-05-21 14:37:15 +0000458 </tr>
459 </table>
460</div>
461<div class="memdoc">
462
DRC25b995a2011-05-21 15:34:54 +0000463<p>This option will cause <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> to return an error if the transform is not perfect. </p>
DRC9b28def2011-05-21 14:37:15 +0000464<p>Lossless transforms operate on MCU blocks, whose size depends on the level of chrominance subsampling used (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a> and <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>.) If the image's width or height is not evenly divisible by the MCU block size, then there will be partial MCU blocks on the right and/or bottom edges. It is not possible to move these partial MCU blocks to the top or left of the image, so any transform that would require that is "imperfect." If this option is not specified, then any partial MCU blocks that cannot be transformed will be left in place, which will create odd-looking strips on the right or bottom edge of the image. </p>
465
466</div>
467</div>
DRC25b995a2011-05-21 15:34:54 +0000468<a class="anchor" id="ga319826b7eb1583c0595bbe7b95428709"></a><!-- doxytag: member="turbojpeg.h::TJXOPT_TRIM" ref="ga319826b7eb1583c0595bbe7b95428709" args="" -->
DRC9b28def2011-05-21 14:37:15 +0000469<div class="memitem">
470<div class="memproto">
471 <table class="memname">
472 <tr>
DRC25b995a2011-05-21 15:34:54 +0000473 <td class="memname">#define TJXOPT_TRIM</td>
DRC9b28def2011-05-21 14:37:15 +0000474 </tr>
475 </table>
476</div>
477<div class="memdoc">
478
DRC25b995a2011-05-21 15:34:54 +0000479<p>This option will cause <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> to discard any partial MCU blocks that cannot be transformed. </p>
DRC9b28def2011-05-21 14:37:15 +0000480
481</div>
482</div>
DRC25b995a2011-05-21 15:34:54 +0000483<hr/><h2>Typedef Documentation</h2>
484<a class="anchor" id="ga758d2634ecb4949de7815cba621f5763"></a><!-- doxytag: member="turbojpeg.h::tjhandle" ref="ga758d2634ecb4949de7815cba621f5763" args="" -->
DRC9b28def2011-05-21 14:37:15 +0000485<div class="memitem">
486<div class="memproto">
487 <table class="memname">
488 <tr>
DRC25b995a2011-05-21 15:34:54 +0000489 <td class="memname">typedef void* <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a></td>
490 </tr>
491 </table>
492</div>
493<div class="memdoc">
494
495<p>TurboJPEG instance handle. </p>
496
497</div>
498</div>
499<hr/><h2>Enumeration Type Documentation</h2>
500<a class="anchor" id="gac916144e26c3817ac514e64ae5d12e2a"></a><!-- doxytag: member="turbojpeg.h::TJPF" ref="gac916144e26c3817ac514e64ae5d12e2a" args="" -->
501<div class="memitem">
502<div class="memproto">
503 <table class="memname">
504 <tr>
505 <td class="memname">enum <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">TJPF</a></td>
DRC9b28def2011-05-21 14:37:15 +0000506 </tr>
507 </table>
508</div>
509<div class="memdoc">
510
511<p>Pixel formats. </p>
DRC9b28def2011-05-21 14:37:15 +0000512<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
DRC25b995a2011-05-21 15:34:54 +0000513<tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa7ce93230bff449518ce387c17e6ed37c"></a><!-- doxytag: member="TJPF_RGB" ref="ggac916144e26c3817ac514e64ae5d12e2aa7ce93230bff449518ce387c17e6ed37c" args="" -->TJPF_RGB</em>&nbsp;</td><td>
DRC9b28def2011-05-21 14:37:15 +0000514<p>RGB pixel format. </p>
515<p>The red, green, and blue components in the image are stored in 3-byte pixels in the order R, G, B from lowest to highest byte address within each pixel. </p>
516</td></tr>
DRC25b995a2011-05-21 15:34:54 +0000517<tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aab10624437fb8ef495a0b153e65749839"></a><!-- doxytag: member="TJPF_BGR" ref="ggac916144e26c3817ac514e64ae5d12e2aab10624437fb8ef495a0b153e65749839" args="" -->TJPF_BGR</em>&nbsp;</td><td>
DRC9b28def2011-05-21 14:37:15 +0000518<p>BGR pixel format. </p>
519<p>The red, green, and blue components in the image are stored in 3-byte pixels in the order B, G, R from lowest to highest byte address within each pixel. </p>
520</td></tr>
DRC25b995a2011-05-21 15:34:54 +0000521<tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01"></a><!-- doxytag: member="TJPF_RGBX" ref="ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01" args="" -->TJPF_RGBX</em>&nbsp;</td><td>
DRC9b28def2011-05-21 14:37:15 +0000522<p>RGBX pixel format. </p>
523<p>The red, green, and blue components in the image are stored in 4-byte pixels in the order R, G, B from lowest to highest byte address within each pixel. </p>
524</td></tr>
DRC25b995a2011-05-21 15:34:54 +0000525<tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa2a1fbf569ca79897eae886e3376ca4c8"></a><!-- doxytag: member="TJPF_BGRX" ref="ggac916144e26c3817ac514e64ae5d12e2aa2a1fbf569ca79897eae886e3376ca4c8" args="" -->TJPF_BGRX</em>&nbsp;</td><td>
DRC9b28def2011-05-21 14:37:15 +0000526<p>BGRX pixel format. </p>
527<p>The red, green, and blue components in the image are stored in 4-byte pixels in the order B, G, R from lowest to highest byte address within each pixel. </p>
528</td></tr>
DRC25b995a2011-05-21 15:34:54 +0000529<tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af"></a><!-- doxytag: member="TJPF_XBGR" ref="ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af" args="" -->TJPF_XBGR</em>&nbsp;</td><td>
DRC9b28def2011-05-21 14:37:15 +0000530<p>XBGR pixel format. </p>
531<p>The red, green, and blue components in the image are stored in 4-byte pixels in the order R, G, B from highest to lowest byte address within each pixel. </p>
532</td></tr>
DRC25b995a2011-05-21 15:34:54 +0000533<tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84"></a><!-- doxytag: member="TJPF_XRGB" ref="ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84" args="" -->TJPF_XRGB</em>&nbsp;</td><td>
DRC9b28def2011-05-21 14:37:15 +0000534<p>XRGB pixel format. </p>
535<p>The red, green, and blue components in the image are stored in 4-byte pixels in the order B, G, R from highest to lowest byte address within each pixel. </p>
536</td></tr>
DRC25b995a2011-05-21 15:34:54 +0000537<tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a"></a><!-- doxytag: member="TJPF_GRAY" ref="ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a" args="" -->TJPF_GRAY</em>&nbsp;</td><td>
DRC9b28def2011-05-21 14:37:15 +0000538<p>Grayscale pixel format. </p>
539<p>Each 1-byte pixel represents a luminance (brightness) level from 0 to 255. </p>
540</td></tr>
541</table>
542</dd>
543</dl>
544
545</div>
546</div>
DRC25b995a2011-05-21 15:34:54 +0000547<a class="anchor" id="ga1d047060ea80bb9820d540bb928e9074"></a><!-- doxytag: member="turbojpeg.h::TJSAMP" ref="ga1d047060ea80bb9820d540bb928e9074" args="" -->
DRC9b28def2011-05-21 14:37:15 +0000548<div class="memitem">
549<div class="memproto">
550 <table class="memname">
551 <tr>
DRC25b995a2011-05-21 15:34:54 +0000552 <td class="memname">enum <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">TJSAMP</a></td>
DRC9b28def2011-05-21 14:37:15 +0000553 </tr>
554 </table>
555</div>
556<div class="memdoc">
557
DRC25b995a2011-05-21 15:34:54 +0000558<p>Chrominance subsampling options. </p>
559<p>When an image is converted from the RGB to the YCbCr colorspace as part of the JPEG compression process, some of the Cb and Cr (chrominance) components can be discarded or averaged together to produce a smaller image with little perceptible loss of image clarity (the human eye is more sensitive to small changes in brightness than small changes in color.) This is called "chrominance subsampling". </p>
DRC9b28def2011-05-21 14:37:15 +0000560<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
DRC25b995a2011-05-21 15:34:54 +0000561<tr><td valign="top"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074afb8da4f44197837bdec0a4f593dacae3"></a><!-- doxytag: member="TJSAMP_444" ref="gga1d047060ea80bb9820d540bb928e9074afb8da4f44197837bdec0a4f593dacae3" args="" -->TJSAMP_444</em>&nbsp;</td><td>
562<p>4:4:4 chrominance subsampling (no chrominance subsampling). </p>
563<p>The JPEG or YUV image will contain one chrominance component for every pixel in the source image. </p>
564</td></tr>
565<tr><td valign="top"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074a136130902cc578f11f32429b59368404"></a><!-- doxytag: member="TJSAMP_422" ref="gga1d047060ea80bb9820d540bb928e9074a136130902cc578f11f32429b59368404" args="" -->TJSAMP_422</em>&nbsp;</td><td>
566<p>4:2:2 chrominance subsampling. </p>
567<p>The JPEG or YUV image will contain one chrominance component for every 2x1 block of pixels in the source image. </p>
568</td></tr>
569<tr><td valign="top"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074a63085dbf683cfe39e513cdb6343e3737"></a><!-- doxytag: member="TJSAMP_420" ref="gga1d047060ea80bb9820d540bb928e9074a63085dbf683cfe39e513cdb6343e3737" args="" -->TJSAMP_420</em>&nbsp;</td><td>
570<p>4:2:0 chrominance subsampling. </p>
571<p>The JPEG or YUV image will contain one chrominance component for every 2x2 block of pixels in the source image. </p>
572</td></tr>
573<tr><td valign="top"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074a3f1c9504842ddc7a48d0f690754b6248"></a><!-- doxytag: member="TJSAMP_GRAY" ref="gga1d047060ea80bb9820d540bb928e9074a3f1c9504842ddc7a48d0f690754b6248" args="" -->TJSAMP_GRAY</em>&nbsp;</td><td>
574<p>Grayscale. </p>
575<p>The JPEG or YUV image will contain no chrominance components. </p>
576</td></tr>
577<tr><td valign="top"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074accf740e6f3aa6ba20ba922cad13cb974"></a><!-- doxytag: member="TJSAMP_440" ref="gga1d047060ea80bb9820d540bb928e9074accf740e6f3aa6ba20ba922cad13cb974" args="" -->TJSAMP_440</em>&nbsp;</td><td>
578<p>4:4:0 chrominance subsampling. </p>
579<p>The JPEG or YUV image will contain one chrominance component for every 1x2 block of pixels in the source image. </p>
580</td></tr>
581</table>
582</dd>
583</dl>
584
585</div>
586</div>
587<a class="anchor" id="ga2de531af4e7e6c4f124908376b354866"></a><!-- doxytag: member="turbojpeg.h::TJXOP" ref="ga2de531af4e7e6c4f124908376b354866" args="" -->
588<div class="memitem">
589<div class="memproto">
590 <table class="memname">
591 <tr>
592 <td class="memname">enum <a class="el" href="group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866">TJXOP</a></td>
593 </tr>
594 </table>
595</div>
596<div class="memdoc">
597
598<p>Transform operations for <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> </p>
599<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
600<tr><td valign="top"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866aad88c0366cd3f7d0eac9d7a3fa1c2c27"></a><!-- doxytag: member="TJXOP_NONE" ref="gga2de531af4e7e6c4f124908376b354866aad88c0366cd3f7d0eac9d7a3fa1c2c27" args="" -->TJXOP_NONE</em>&nbsp;</td><td>
DRC9b28def2011-05-21 14:37:15 +0000601<p>Do not transform the position of the image pixels. </p>
602</td></tr>
DRC25b995a2011-05-21 15:34:54 +0000603<tr><td valign="top"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866aa0df69776caa30f0fa28e26332d311ce"></a><!-- doxytag: member="TJXOP_HFLIP" ref="gga2de531af4e7e6c4f124908376b354866aa0df69776caa30f0fa28e26332d311ce" args="" -->TJXOP_HFLIP</em>&nbsp;</td><td>
DRC9b28def2011-05-21 14:37:15 +0000604<p>Flip (mirror) image horizontally. </p>
DRC25b995a2011-05-21 15:34:54 +0000605<p>This transform is imperfect if there are any partial MCU blocks on the right edge (see <a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00" title="This option will cause tjTransform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
DRC9b28def2011-05-21 14:37:15 +0000606</td></tr>
DRC25b995a2011-05-21 15:34:54 +0000607<tr><td valign="top"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866a324eddfbec53b7e691f61e56929d0d5d"></a><!-- doxytag: member="TJXOP_VFLIP" ref="gga2de531af4e7e6c4f124908376b354866a324eddfbec53b7e691f61e56929d0d5d" args="" -->TJXOP_VFLIP</em>&nbsp;</td><td>
DRC9b28def2011-05-21 14:37:15 +0000608<p>Flip (mirror) image vertically. </p>
DRC25b995a2011-05-21 15:34:54 +0000609<p>This transform is imperfect if there are any partial MCU blocks on the bottom edge (see <a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00" title="This option will cause tjTransform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
DRC9b28def2011-05-21 14:37:15 +0000610</td></tr>
DRC25b995a2011-05-21 15:34:54 +0000611<tr><td valign="top"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866a31060aed199f886afdd417f80499c32d"></a><!-- doxytag: member="TJXOP_TRANSPOSE" ref="gga2de531af4e7e6c4f124908376b354866a31060aed199f886afdd417f80499c32d" args="" -->TJXOP_TRANSPOSE</em>&nbsp;</td><td>
DRC9b28def2011-05-21 14:37:15 +0000612<p>Transpose image (flip/mirror along upper left to lower right axis.) This transform is always perfect. </p>
613</td></tr>
DRC25b995a2011-05-21 15:34:54 +0000614<tr><td valign="top"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866af3b14d488aea6ece9e5b3df73a74d6a4"></a><!-- doxytag: member="TJXOP_TRANSVERSE" ref="gga2de531af4e7e6c4f124908376b354866af3b14d488aea6ece9e5b3df73a74d6a4" args="" -->TJXOP_TRANSVERSE</em>&nbsp;</td><td>
615<p>Transverse transpose image (flip/mirror along upper right to lower left axis.) This transform is imperfect if there are any partial MCU blocks in the image (see <a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00" title="This option will cause tjTransform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
DRC9b28def2011-05-21 14:37:15 +0000616</td></tr>
DRC25b995a2011-05-21 15:34:54 +0000617<tr><td valign="top"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866a43b2bbb23bc4bd548422d43fbe9af128"></a><!-- doxytag: member="TJXOP_ROT90" ref="gga2de531af4e7e6c4f124908376b354866a43b2bbb23bc4bd548422d43fbe9af128" args="" -->TJXOP_ROT90</em>&nbsp;</td><td>
DRC9b28def2011-05-21 14:37:15 +0000618<p>Rotate image clockwise by 90 degrees. </p>
DRC25b995a2011-05-21 15:34:54 +0000619<p>This transform is imperfect if there are any partial MCU blocks on the bottom edge (see <a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00" title="This option will cause tjTransform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
DRC9b28def2011-05-21 14:37:15 +0000620</td></tr>
DRC25b995a2011-05-21 15:34:54 +0000621<tr><td valign="top"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866a140952eb8dd0300accfcc22726d69692"></a><!-- doxytag: member="TJXOP_ROT180" ref="gga2de531af4e7e6c4f124908376b354866a140952eb8dd0300accfcc22726d69692" args="" -->TJXOP_ROT180</em>&nbsp;</td><td>
DRC9b28def2011-05-21 14:37:15 +0000622<p>Rotate image 180 degrees. </p>
DRC25b995a2011-05-21 15:34:54 +0000623<p>This transform is imperfect if there are any partial MCU blocks in the image (see <a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00" title="This option will cause tjTransform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
DRC9b28def2011-05-21 14:37:15 +0000624</td></tr>
DRC25b995a2011-05-21 15:34:54 +0000625<tr><td valign="top"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866a3064ee5dfb7f032df332818587567a08"></a><!-- doxytag: member="TJXOP_ROT270" ref="gga2de531af4e7e6c4f124908376b354866a3064ee5dfb7f032df332818587567a08" args="" -->TJXOP_ROT270</em>&nbsp;</td><td>
DRC9b28def2011-05-21 14:37:15 +0000626<p>Rotate image counter-clockwise by 90 degrees. </p>
DRC25b995a2011-05-21 15:34:54 +0000627<p>This transform is imperfect if there are any partial MCU blocks on the right edge (see <a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00" title="This option will cause tjTransform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
DRC9b28def2011-05-21 14:37:15 +0000628</td></tr>
629</table>
630</dd>
631</dl>
632
633</div>
634</div>
635<hr/><h2>Function Documentation</h2>
DRC6b76f752011-05-24 16:52:47 +0000636<a class="anchor" id="ga5c9234bda6d993cdaffdd89bf81a00ff"></a><!-- doxytag: member="turbojpeg.h::tjAlloc" ref="ga5c9234bda6d993cdaffdd89bf81a00ff" args="(int bytes)" -->
637<div class="memitem">
638<div class="memproto">
639 <table class="memname">
640 <tr>
641 <td class="memname">DLLEXPORT unsigned char* DLLCALL tjAlloc </td>
642 <td>(</td>
643 <td class="paramtype">int&#160;</td>
644 <td class="paramname"><em>bytes</em></td><td>)</td>
645 <td></td>
646 </tr>
647 </table>
648</div>
649<div class="memdoc">
650
651<p>Allocate an image buffer for use with TurboJPEG. </p>
652<p>You should always use this function to allocate the JPEG destination buffer(s) for <a class="el" href="group___turbo_j_p_e_g.html#gaba62b7a98f960839b588579898495cf2" title="Compress an RGB or grayscale image into a JPEG image.">tjCompress2()</a> and <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> unless you are disabling automatic buffer (re)allocation (by setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a>.)</p>
653<dl><dt><b>Parameters:</b></dt><dd>
654 <table class="params">
655 <tr><td class="paramname">bytes</td><td>the number of bytes to allocate</td></tr>
656 </table>
657 </dd>
658</dl>
DRCd4411072011-05-24 17:00:15 +0000659<dl class="return"><dt><b>Returns:</b></dt><dd>a pointer to a newly-allocated buffer with the specified number of bytes</dd></dl>
660<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group___turbo_j_p_e_g.html#ga8c4a1231dc06a450514c835f6471f137" title="Free an image buffer previously allocated by TurboJPEG.">tjFree()</a> </dd></dl>
DRC6b76f752011-05-24 16:52:47 +0000661
662</div>
663</div>
DRC9b49f0e2011-07-12 03:17:23 +0000664<a class="anchor" id="gaccc5bca7f12fcdcc302e6e1c6d4b311b"></a><!-- doxytag: member="turbojpeg.h::tjBufSize" ref="gaccc5bca7f12fcdcc302e6e1c6d4b311b" args="(int width, int height, int jpegSubsamp)" -->
DRC9b28def2011-05-21 14:37:15 +0000665<div class="memitem">
666<div class="memproto">
667 <table class="memname">
668 <tr>
DRC9b49f0e2011-07-12 03:17:23 +0000669 <td class="memname">DLLEXPORT unsigned long DLLCALL tjBufSize </td>
DRC9b28def2011-05-21 14:37:15 +0000670 <td>(</td>
671 <td class="paramtype">int&#160;</td>
672 <td class="paramname"><em>width</em>, </td>
673 </tr>
674 <tr>
675 <td class="paramkey"></td>
676 <td></td>
677 <td class="paramtype">int&#160;</td>
678 <td class="paramname"><em>height</em>, </td>
679 </tr>
680 <tr>
681 <td class="paramkey"></td>
682 <td></td>
683 <td class="paramtype">int&#160;</td>
684 <td class="paramname"><em>jpegSubsamp</em>&#160;</td>
685 </tr>
686 <tr>
687 <td></td>
688 <td>)</td>
689 <td></td><td></td>
690 </tr>
691 </table>
692</div>
693<div class="memdoc">
694
DRC9b49f0e2011-07-12 03:17:23 +0000695<p>The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters. </p>
696<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>
697<dl><dt><b>Parameters:</b></dt><dd>
698 <table class="params">
699 <tr><td class="paramname">width</td><td>width of the image (in pixels) </td></tr>
700 <tr><td class="paramname">height</td><td>height of the image (in pixels) </td></tr>
701 <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>
702 </table>
703 </dd>
704</dl>
705<dl class="return"><dt><b>Returns:</b></dt><dd>the maximum size of the buffer (in bytes) required to hold the image, or -1 if the arguments are out of bounds. </dd></dl>
706
707</div>
708</div>
709<a class="anchor" id="ga9d0cb06fd5052d21b6f2b382db8b219c"></a><!-- doxytag: member="turbojpeg.h::tjBufSizeYUV" ref="ga9d0cb06fd5052d21b6f2b382db8b219c" args="(int width, int height, int subsamp)" -->
710<div class="memitem">
711<div class="memproto">
712 <table class="memname">
713 <tr>
714 <td class="memname">DLLEXPORT unsigned long DLLCALL tjBufSizeYUV </td>
715 <td>(</td>
716 <td class="paramtype">int&#160;</td>
717 <td class="paramname"><em>width</em>, </td>
718 </tr>
719 <tr>
720 <td class="paramkey"></td>
721 <td></td>
722 <td class="paramtype">int&#160;</td>
723 <td class="paramname"><em>height</em>, </td>
724 </tr>
725 <tr>
726 <td class="paramkey"></td>
727 <td></td>
728 <td class="paramtype">int&#160;</td>
729 <td class="paramname"><em>subsamp</em>&#160;</td>
730 </tr>
731 <tr>
732 <td></td>
733 <td>)</td>
734 <td></td><td></td>
735 </tr>
736 </table>
737</div>
738<div class="memdoc">
739
DRC9b28def2011-05-21 14:37:15 +0000740<p>The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters. </p>
741<dl><dt><b>Parameters:</b></dt><dd>
742 <table class="params">
743 <tr><td class="paramname">width</td><td>width of the image (in pixels) </td></tr>
744 <tr><td class="paramname">height</td><td>height of the image (in pixels) </td></tr>
DRC9b49f0e2011-07-12 03:17:23 +0000745 <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>
DRC9b28def2011-05-21 14:37:15 +0000746 </table>
747 </dd>
748</dl>
749<dl class="return"><dt><b>Returns:</b></dt><dd>the size of the buffer (in bytes) required to hold the image, or -1 if the arguments are out of bounds. </dd></dl>
750
751</div>
752</div>
753<a class="anchor" id="gaba62b7a98f960839b588579898495cf2"></a><!-- doxytag: member="turbojpeg.h::tjCompress2" ref="gaba62b7a98f960839b588579898495cf2" args="(tjhandle handle, unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegSubsamp, int jpegQual, int flags)" -->
754<div class="memitem">
755<div class="memproto">
756 <table class="memname">
757 <tr>
758 <td class="memname">DLLEXPORT int DLLCALL tjCompress2 </td>
759 <td>(</td>
760 <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
761 <td class="paramname"><em>handle</em>, </td>
762 </tr>
763 <tr>
764 <td class="paramkey"></td>
765 <td></td>
766 <td class="paramtype">unsigned char *&#160;</td>
767 <td class="paramname"><em>srcBuf</em>, </td>
768 </tr>
769 <tr>
770 <td class="paramkey"></td>
771 <td></td>
772 <td class="paramtype">int&#160;</td>
773 <td class="paramname"><em>width</em>, </td>
774 </tr>
775 <tr>
776 <td class="paramkey"></td>
777 <td></td>
778 <td class="paramtype">int&#160;</td>
779 <td class="paramname"><em>pitch</em>, </td>
780 </tr>
781 <tr>
782 <td class="paramkey"></td>
783 <td></td>
784 <td class="paramtype">int&#160;</td>
785 <td class="paramname"><em>height</em>, </td>
786 </tr>
787 <tr>
788 <td class="paramkey"></td>
789 <td></td>
790 <td class="paramtype">int&#160;</td>
791 <td class="paramname"><em>pixelFormat</em>, </td>
792 </tr>
793 <tr>
794 <td class="paramkey"></td>
795 <td></td>
796 <td class="paramtype">unsigned char **&#160;</td>
797 <td class="paramname"><em>jpegBuf</em>, </td>
798 </tr>
799 <tr>
800 <td class="paramkey"></td>
801 <td></td>
802 <td class="paramtype">unsigned long *&#160;</td>
803 <td class="paramname"><em>jpegSize</em>, </td>
804 </tr>
805 <tr>
806 <td class="paramkey"></td>
807 <td></td>
808 <td class="paramtype">int&#160;</td>
809 <td class="paramname"><em>jpegSubsamp</em>, </td>
810 </tr>
811 <tr>
812 <td class="paramkey"></td>
813 <td></td>
814 <td class="paramtype">int&#160;</td>
815 <td class="paramname"><em>jpegQual</em>, </td>
816 </tr>
817 <tr>
818 <td class="paramkey"></td>
819 <td></td>
820 <td class="paramtype">int&#160;</td>
821 <td class="paramname"><em>flags</em>&#160;</td>
822 </tr>
823 <tr>
824 <td></td>
825 <td>)</td>
826 <td></td><td></td>
827 </tr>
828 </table>
829</div>
830<div class="memdoc">
831
832<p>Compress an RGB or grayscale image into a JPEG image. </p>
833<dl><dt><b>Parameters:</b></dt><dd>
834 <table class="params">
835 <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance </td></tr>
836 <tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing RGB or grayscale pixels to be compressed </td></tr>
837 <tr><td class="paramname">width</td><td>width (in pixels) of the source image </td></tr>
838 <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>
839 <tr><td class="paramname">height</td><td>height (in pixels) of the source image </td></tr>
DRC25b995a2011-05-21 15:34:54 +0000840 <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>
DRC9b28def2011-05-21 14:37:15 +0000841 <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">
DRC6b76f752011-05-24 16:52:47 +0000842<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>
DRC9b28def2011-05-21 14:37:15 +0000843<li>set <code>*jpegBuf</code> to NULL to tell TurboJPEG to allocate the buffer for you, or</li>
DRC9b49f0e2011-07-12 03:17:23 +0000844<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>
DRC9b28def2011-05-21 14:37:15 +0000845</ol>
DRCff78e372011-05-24 10:17:32 +0000846If 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>
DRC9b28def2011-05-21 14:37:15 +0000847 <tr><td class="paramname">jpegSize</td><td>pointer to an unsigned long variable which 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>
DRC25b995a2011-05-21 15:34:54 +0000848 <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>
DRC9b28def2011-05-21 14:37:15 +0000849 <tr><td class="paramname">jpegQual</td><td>the image quality of the generated JPEG image (1 = worst, 100 = best) </td></tr>
DRC25b995a2011-05-21 15:34:54 +0000850 <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>
DRC9b28def2011-05-21 14:37:15 +0000851 </table>
852 </dd>
853</dl>
854<dl class="return"><dt><b>Returns:</b></dt><dd>0 if successful, or -1 if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr()</a>.) </dd></dl>
855
856</div>
857</div>
858<a class="anchor" id="gada69cc6443d1bb493b40f1626259e5e9"></a><!-- doxytag: member="turbojpeg.h::tjDecompress2" ref="gada69cc6443d1bb493b40f1626259e5e9" args="(tjhandle handle, unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)" -->
859<div class="memitem">
860<div class="memproto">
861 <table class="memname">
862 <tr>
863 <td class="memname">DLLEXPORT int DLLCALL tjDecompress2 </td>
864 <td>(</td>
865 <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
866 <td class="paramname"><em>handle</em>, </td>
867 </tr>
868 <tr>
869 <td class="paramkey"></td>
870 <td></td>
871 <td class="paramtype">unsigned char *&#160;</td>
872 <td class="paramname"><em>jpegBuf</em>, </td>
873 </tr>
874 <tr>
875 <td class="paramkey"></td>
876 <td></td>
877 <td class="paramtype">unsigned long&#160;</td>
878 <td class="paramname"><em>jpegSize</em>, </td>
879 </tr>
880 <tr>
881 <td class="paramkey"></td>
882 <td></td>
883 <td class="paramtype">unsigned char *&#160;</td>
884 <td class="paramname"><em>dstBuf</em>, </td>
885 </tr>
886 <tr>
887 <td class="paramkey"></td>
888 <td></td>
889 <td class="paramtype">int&#160;</td>
890 <td class="paramname"><em>width</em>, </td>
891 </tr>
892 <tr>
893 <td class="paramkey"></td>
894 <td></td>
895 <td class="paramtype">int&#160;</td>
896 <td class="paramname"><em>pitch</em>, </td>
897 </tr>
898 <tr>
899 <td class="paramkey"></td>
900 <td></td>
901 <td class="paramtype">int&#160;</td>
902 <td class="paramname"><em>height</em>, </td>
903 </tr>
904 <tr>
905 <td class="paramkey"></td>
906 <td></td>
907 <td class="paramtype">int&#160;</td>
908 <td class="paramname"><em>pixelFormat</em>, </td>
909 </tr>
910 <tr>
911 <td class="paramkey"></td>
912 <td></td>
913 <td class="paramtype">int&#160;</td>
914 <td class="paramname"><em>flags</em>&#160;</td>
915 </tr>
916 <tr>
917 <td></td>
918 <td>)</td>
919 <td></td><td></td>
920 </tr>
921 </table>
922</div>
923<div class="memdoc">
924
925<p>Decompress a JPEG image to an RGB or grayscale image. </p>
926<dl><dt><b>Parameters:</b></dt><dd>
927 <table class="params">
928 <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance </td></tr>
929 <tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG image to decompress </td></tr>
930 <tr><td class="paramname">jpegSize</td><td>size of the JPEG image (in bytes) </td></tr>
931 <tr><td class="paramname">dstBuf</td><td>pointer to an image buffer which 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 dstBuf pointer may also be used to decompress into a specific region of a larger buffer. </td></tr>
932 <tr><td class="paramname">width</td><td>desired width (in pixels) of the destination image. If this is smaller 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 width is set to 0, then only the height will be considered when determining the scaled image size. </td></tr>
933 <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>
934 <tr><td class="paramname">height</td><td>desired height (in pixels) of the destination image. If this is smaller 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 height is set to 0, then only the width will be considered when determining the scaled image size. </td></tr>
DRC25b995a2011-05-21 15:34:54 +0000935 <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>
936 <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>
DRC9b28def2011-05-21 14:37:15 +0000937 </table>
938 </dd>
939</dl>
940<dl class="return"><dt><b>Returns:</b></dt><dd>0 if successful, or -1 if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr()</a>.) </dd></dl>
941
942</div>
943</div>
944<a class="anchor" id="gac5675fceb7997b385516cdffdb34e6aa"></a><!-- doxytag: member="turbojpeg.h::tjDecompressHeader2" ref="gac5675fceb7997b385516cdffdb34e6aa" args="(tjhandle handle, unsigned char *jpegBuf, unsigned long jpegSize, int *width, int *height, int *jpegSubsamp)" -->
945<div class="memitem">
946<div class="memproto">
947 <table class="memname">
948 <tr>
949 <td class="memname">DLLEXPORT int DLLCALL tjDecompressHeader2 </td>
950 <td>(</td>
951 <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
952 <td class="paramname"><em>handle</em>, </td>
953 </tr>
954 <tr>
955 <td class="paramkey"></td>
956 <td></td>
957 <td class="paramtype">unsigned char *&#160;</td>
958 <td class="paramname"><em>jpegBuf</em>, </td>
959 </tr>
960 <tr>
961 <td class="paramkey"></td>
962 <td></td>
963 <td class="paramtype">unsigned long&#160;</td>
964 <td class="paramname"><em>jpegSize</em>, </td>
965 </tr>
966 <tr>
967 <td class="paramkey"></td>
968 <td></td>
969 <td class="paramtype">int *&#160;</td>
970 <td class="paramname"><em>width</em>, </td>
971 </tr>
972 <tr>
973 <td class="paramkey"></td>
974 <td></td>
975 <td class="paramtype">int *&#160;</td>
976 <td class="paramname"><em>height</em>, </td>
977 </tr>
978 <tr>
979 <td class="paramkey"></td>
980 <td></td>
981 <td class="paramtype">int *&#160;</td>
982 <td class="paramname"><em>jpegSubsamp</em>&#160;</td>
983 </tr>
984 <tr>
985 <td></td>
986 <td>)</td>
987 <td></td><td></td>
988 </tr>
989 </table>
990</div>
991<div class="memdoc">
992
993<p>Retrieve information about a JPEG image without decompressing it. </p>
994<dl><dt><b>Parameters:</b></dt><dd>
995 <table class="params">
996 <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance </td></tr>
997 <tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing a JPEG image </td></tr>
998 <tr><td class="paramname">jpegSize</td><td>size of the JPEG image (in bytes) </td></tr>
999 <tr><td class="paramname">width</td><td>pointer to an integer variable which will receive the width (in pixels) of the JPEG image </td></tr>
1000 <tr><td class="paramname">height</td><td>pointer to an integer variable which will receive the height (in pixels) of the JPEG image </td></tr>
DRC25b995a2011-05-21 15:34:54 +00001001 <tr><td class="paramname">jpegSubsamp</td><td>pointer to an integer variable which 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>
DRC9b28def2011-05-21 14:37:15 +00001002 </table>
1003 </dd>
1004</dl>
1005<dl class="return"><dt><b>Returns:</b></dt><dd>0 if successful, or -1 if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr()</a>.) </dd></dl>
1006
1007</div>
1008</div>
1009<a class="anchor" id="gad7810af095624a4016e72957a50f77d8"></a><!-- doxytag: member="turbojpeg.h::tjDecompressToYUV" ref="gad7810af095624a4016e72957a50f77d8" args="(tjhandle handle, unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, int flags)" -->
1010<div class="memitem">
1011<div class="memproto">
1012 <table class="memname">
1013 <tr>
1014 <td class="memname">DLLEXPORT int DLLCALL tjDecompressToYUV </td>
1015 <td>(</td>
1016 <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1017 <td class="paramname"><em>handle</em>, </td>
1018 </tr>
1019 <tr>
1020 <td class="paramkey"></td>
1021 <td></td>
1022 <td class="paramtype">unsigned char *&#160;</td>
1023 <td class="paramname"><em>jpegBuf</em>, </td>
1024 </tr>
1025 <tr>
1026 <td class="paramkey"></td>
1027 <td></td>
1028 <td class="paramtype">unsigned long&#160;</td>
1029 <td class="paramname"><em>jpegSize</em>, </td>
1030 </tr>
1031 <tr>
1032 <td class="paramkey"></td>
1033 <td></td>
1034 <td class="paramtype">unsigned char *&#160;</td>
1035 <td class="paramname"><em>dstBuf</em>, </td>
1036 </tr>
1037 <tr>
1038 <td class="paramkey"></td>
1039 <td></td>
1040 <td class="paramtype">int&#160;</td>
1041 <td class="paramname"><em>flags</em>&#160;</td>
1042 </tr>
1043 <tr>
1044 <td></td>
1045 <td>)</td>
1046 <td></td><td></td>
1047 </tr>
1048 </table>
1049</div>
1050<div class="memdoc">
1051
1052<p>Decompress a JPEG image to a YUV planar image. </p>
1053<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. The padding of the planes in this image is the same as the images generated by <a class="el" href="group___turbo_j_p_e_g.html#ga0fa4e7b1943687c6a0c0304529c55d35" title="Encode an RGB or grayscale image into a YUV planar image.">tjEncodeYUV2()</a>. Note that, if the width or height of the image is not an even multiple of the MCU block size (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a> and <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>), then an intermediate buffer copy will be performed within TurboJPEG.</p>
1054<dl><dt><b>Parameters:</b></dt><dd>
1055 <table class="params">
1056 <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance </td></tr>
1057 <tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG image to decompress </td></tr>
1058 <tr><td class="paramname">jpegSize</td><td>size of the JPEG image (in bytes) </td></tr>
DRC9b49f0e2011-07-12 03:17:23 +00001059 <tr><td class="paramname">dstBuf</td><td>pointer to an image buffer which will receive the YUV image. Use <a class="el" href="group___turbo_j_p_e_g.html#ga9d0cb06fd5052d21b6f2b382db8b219c" title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters...">tjBufSizeYUV</a> to determine the appropriate size for this buffer based on the image width, height, and level of subsampling. </td></tr>
DRC25b995a2011-05-21 15:34:54 +00001060 <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>
DRC9b28def2011-05-21 14:37:15 +00001061 </table>
1062 </dd>
1063</dl>
1064<dl class="return"><dt><b>Returns:</b></dt><dd>0 if successful, or -1 if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr()</a>.) </dd></dl>
1065
1066</div>
1067</div>
1068<a class="anchor" id="ga674adee917b95ad4a896f1ba39e12540"></a><!-- doxytag: member="turbojpeg.h::tjDestroy" ref="ga674adee917b95ad4a896f1ba39e12540" args="(tjhandle handle)" -->
1069<div class="memitem">
1070<div class="memproto">
1071 <table class="memname">
1072 <tr>
1073 <td class="memname">DLLEXPORT int DLLCALL tjDestroy </td>
1074 <td>(</td>
1075 <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1076 <td class="paramname"><em>handle</em></td><td>)</td>
1077 <td></td>
1078 </tr>
1079 </table>
1080</div>
1081<div class="memdoc">
1082
1083<p>Destroy a TurboJPEG compressor, decompressor, or transformer instance. </p>
1084<dl><dt><b>Parameters:</b></dt><dd>
1085 <table class="params">
1086 <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor, decompressor or transformer instance</td></tr>
1087 </table>
1088 </dd>
1089</dl>
1090<dl class="return"><dt><b>Returns:</b></dt><dd>0 if successful, or -1 if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr()</a>.) </dd></dl>
1091
1092</div>
1093</div>
1094<a class="anchor" id="ga0fa4e7b1943687c6a0c0304529c55d35"></a><!-- doxytag: member="turbojpeg.h::tjEncodeYUV2" ref="ga0fa4e7b1943687c6a0c0304529c55d35" args="(tjhandle handle, unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char *dstBuf, int subsamp, int flags)" -->
1095<div class="memitem">
1096<div class="memproto">
1097 <table class="memname">
1098 <tr>
1099 <td class="memname">DLLEXPORT int DLLCALL tjEncodeYUV2 </td>
1100 <td>(</td>
1101 <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1102 <td class="paramname"><em>handle</em>, </td>
1103 </tr>
1104 <tr>
1105 <td class="paramkey"></td>
1106 <td></td>
1107 <td class="paramtype">unsigned char *&#160;</td>
1108 <td class="paramname"><em>srcBuf</em>, </td>
1109 </tr>
1110 <tr>
1111 <td class="paramkey"></td>
1112 <td></td>
1113 <td class="paramtype">int&#160;</td>
1114 <td class="paramname"><em>width</em>, </td>
1115 </tr>
1116 <tr>
1117 <td class="paramkey"></td>
1118 <td></td>
1119 <td class="paramtype">int&#160;</td>
1120 <td class="paramname"><em>pitch</em>, </td>
1121 </tr>
1122 <tr>
1123 <td class="paramkey"></td>
1124 <td></td>
1125 <td class="paramtype">int&#160;</td>
1126 <td class="paramname"><em>height</em>, </td>
1127 </tr>
1128 <tr>
1129 <td class="paramkey"></td>
1130 <td></td>
1131 <td class="paramtype">int&#160;</td>
1132 <td class="paramname"><em>pixelFormat</em>, </td>
1133 </tr>
1134 <tr>
1135 <td class="paramkey"></td>
1136 <td></td>
1137 <td class="paramtype">unsigned char *&#160;</td>
1138 <td class="paramname"><em>dstBuf</em>, </td>
1139 </tr>
1140 <tr>
1141 <td class="paramkey"></td>
1142 <td></td>
1143 <td class="paramtype">int&#160;</td>
1144 <td class="paramname"><em>subsamp</em>, </td>
1145 </tr>
1146 <tr>
1147 <td class="paramkey"></td>
1148 <td></td>
1149 <td class="paramtype">int&#160;</td>
1150 <td class="paramname"><em>flags</em>&#160;</td>
1151 </tr>
1152 <tr>
1153 <td></td>
1154 <td>)</td>
1155 <td></td><td></td>
1156 </tr>
1157 </table>
1158</div>
1159<div class="memdoc">
1160
1161<p>Encode an RGB or grayscale image into a YUV planar image. </p>
1162<p>This function uses the accelerated color conversion routines in TurboJPEG's underlying codec to produce a planar YUV image that is suitable for X Video. Specifically, if the chrominance components are subsampled along the horizontal dimension, then the width of the luminance plane is padded to 2 in the output image (same goes for the height of the luminance plane, if the chrominance components are subsampled along the vertical dimension.) Also, each line of each plane in the output image is padded to 4 bytes. Although this will work with any subsampling option, it is really only useful in combination with TJ_420, which produces an image compatible with the I420 (AKA "YUV420P") format.</p>
1163<dl><dt><b>Parameters:</b></dt><dd>
1164 <table class="params">
1165 <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance </td></tr>
1166 <tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing RGB or grayscale pixels to be encoded </td></tr>
1167 <tr><td class="paramname">width</td><td>width (in pixels) of the source image </td></tr>
1168 <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>
1169 <tr><td class="paramname">height</td><td>height (in pixels) of the source image </td></tr>
DRC25b995a2011-05-21 15:34:54 +00001170 <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>
DRC9b49f0e2011-07-12 03:17:23 +00001171 <tr><td class="paramname">dstBuf</td><td>pointer to an image buffer which will receive the YUV image. Use <a class="el" href="group___turbo_j_p_e_g.html#ga9d0cb06fd5052d21b6f2b382db8b219c" title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters...">tjBufSizeYUV()</a> to determine the appropriate size for this buffer based on the image width, height, and level of chrominance subsampling. </td></tr>
DRC25b995a2011-05-21 15:34:54 +00001172 <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>.) </td></tr>
1173 <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>
DRC9b28def2011-05-21 14:37:15 +00001174 </table>
1175 </dd>
1176</dl>
1177<dl class="return"><dt><b>Returns:</b></dt><dd>0 if successful, or -1 if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr()</a>.) </dd></dl>
1178
1179</div>
1180</div>
DRC6b76f752011-05-24 16:52:47 +00001181<a class="anchor" id="ga8c4a1231dc06a450514c835f6471f137"></a><!-- doxytag: member="turbojpeg.h::tjFree" ref="ga8c4a1231dc06a450514c835f6471f137" args="(unsigned char *buffer)" -->
1182<div class="memitem">
1183<div class="memproto">
1184 <table class="memname">
1185 <tr>
1186 <td class="memname">DLLEXPORT void DLLCALL tjFree </td>
1187 <td>(</td>
1188 <td class="paramtype">unsigned char *&#160;</td>
1189 <td class="paramname"><em>buffer</em></td><td>)</td>
1190 <td></td>
1191 </tr>
1192 </table>
1193</div>
1194<div class="memdoc">
1195
1196<p>Free an image buffer previously allocated by TurboJPEG. </p>
1197<p>You should always use this function to free JPEG destination buffer(s) that were automatically (re)allocated by <a class="el" href="group___turbo_j_p_e_g.html#gaba62b7a98f960839b588579898495cf2" title="Compress an RGB or grayscale image into a JPEG image.">tjCompress2()</a> or <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> or that were manually allocated using <a class="el" href="group___turbo_j_p_e_g.html#ga5c9234bda6d993cdaffdd89bf81a00ff" title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a>.</p>
1198<dl><dt><b>Parameters:</b></dt><dd>
1199 <table class="params">
DRCd4411072011-05-24 17:00:15 +00001200 <tr><td class="paramname">buffer</td><td>address of the buffer to free</td></tr>
DRC6b76f752011-05-24 16:52:47 +00001201 </table>
1202 </dd>
1203</dl>
DRCd4411072011-05-24 17:00:15 +00001204<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group___turbo_j_p_e_g.html#ga5c9234bda6d993cdaffdd89bf81a00ff" title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a> </dd></dl>
DRC6b76f752011-05-24 16:52:47 +00001205
1206</div>
1207</div>
DRC9b28def2011-05-21 14:37:15 +00001208<a class="anchor" id="ga9af79c908ec131b1ae8d52fe40375abf"></a><!-- doxytag: member="turbojpeg.h::tjGetErrorStr" ref="ga9af79c908ec131b1ae8d52fe40375abf" args="(void)" -->
1209<div class="memitem">
1210<div class="memproto">
1211 <table class="memname">
1212 <tr>
1213 <td class="memname">DLLEXPORT char* DLLCALL tjGetErrorStr </td>
1214 <td>(</td>
1215 <td class="paramtype">void&#160;</td>
1216 <td class="paramname"></td><td>)</td>
1217 <td></td>
1218 </tr>
1219 </table>
1220</div>
1221<div class="memdoc">
1222
1223<p>Returns a descriptive error message explaining why the last command failed. </p>
1224<dl class="return"><dt><b>Returns:</b></dt><dd>a descriptive error message explaining why the last command failed. </dd></dl>
1225
1226</div>
1227</div>
1228<a class="anchor" id="ga6449044b9af402999ccf52f401333be8"></a><!-- doxytag: member="turbojpeg.h::tjGetScalingFactors" ref="ga6449044b9af402999ccf52f401333be8" args="(int *numscalingfactors)" -->
1229<div class="memitem">
1230<div class="memproto">
1231 <table class="memname">
1232 <tr>
1233 <td class="memname">DLLEXPORT <a class="el" href="structtjscalingfactor.html">tjscalingfactor</a>* DLLCALL tjGetScalingFactors </td>
1234 <td>(</td>
1235 <td class="paramtype">int *&#160;</td>
1236 <td class="paramname"><em>numscalingfactors</em></td><td>)</td>
1237 <td></td>
1238 </tr>
1239 </table>
1240</div>
1241<div class="memdoc">
1242
1243<p>Returns a list of fractional scaling factors that the JPEG decompressor in this implementation of TurboJPEG supports. </p>
1244<dl><dt><b>Parameters:</b></dt><dd>
1245 <table class="params">
1246 <tr><td class="paramname">numscalingfactors</td><td>pointer to an integer variable that will receive the number of elements in the list</td></tr>
1247 </table>
1248 </dd>
1249</dl>
1250<dl class="return"><dt><b>Returns:</b></dt><dd>a pointer to a list of fractional scaling factors, or NULL if an error is encountered (see <a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr()</a>.) </dd></dl>
1251
1252</div>
1253</div>
1254<a class="anchor" id="ga3d10c47fbe4a2489a2b30c931551d01a"></a><!-- doxytag: member="turbojpeg.h::tjInitCompress" ref="ga3d10c47fbe4a2489a2b30c931551d01a" args="(void)" -->
1255<div class="memitem">
1256<div class="memproto">
1257 <table class="memname">
1258 <tr>
1259 <td class="memname">DLLEXPORT <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> DLLCALL tjInitCompress </td>
1260 <td>(</td>
1261 <td class="paramtype">void&#160;</td>
1262 <td class="paramname"></td><td>)</td>
1263 <td></td>
1264 </tr>
1265 </table>
1266</div>
1267<div class="memdoc">
1268
1269<p>Create a TurboJPEG compressor instance. </p>
1270<dl class="return"><dt><b>Returns:</b></dt><dd>a handle to the newly-created instance, or NULL if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr()</a>.) </dd></dl>
1271
1272</div>
1273</div>
1274<a class="anchor" id="gae5408179d041e2a2f7199c8283cf649e"></a><!-- doxytag: member="turbojpeg.h::tjInitDecompress" ref="gae5408179d041e2a2f7199c8283cf649e" args="(void)" -->
1275<div class="memitem">
1276<div class="memproto">
1277 <table class="memname">
1278 <tr>
1279 <td class="memname">DLLEXPORT <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> DLLCALL tjInitDecompress </td>
1280 <td>(</td>
1281 <td class="paramtype">void&#160;</td>
1282 <td class="paramname"></td><td>)</td>
1283 <td></td>
1284 </tr>
1285 </table>
1286</div>
1287<div class="memdoc">
1288
1289<p>Create a TurboJPEG decompressor instance. </p>
1290<dl class="return"><dt><b>Returns:</b></dt><dd>a handle to the newly-created instance, or NULL if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr()</a>.) </dd></dl>
1291
1292</div>
1293</div>
1294<a class="anchor" id="ga3155b775bfbac9dbba869b95a0367902"></a><!-- doxytag: member="turbojpeg.h::tjInitTransform" ref="ga3155b775bfbac9dbba869b95a0367902" args="(void)" -->
1295<div class="memitem">
1296<div class="memproto">
1297 <table class="memname">
1298 <tr>
1299 <td class="memname">DLLEXPORT <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> DLLCALL tjInitTransform </td>
1300 <td>(</td>
1301 <td class="paramtype">void&#160;</td>
1302 <td class="paramname"></td><td>)</td>
1303 <td></td>
1304 </tr>
1305 </table>
1306</div>
1307<div class="memdoc">
1308
1309<p>Create a new TurboJPEG transformer instance. </p>
1310<dl class="return"><dt><b>Returns:</b></dt><dd>a handle to the newly-created instance, or NULL if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr()</a>.) </dd></dl>
1311
1312</div>
1313</div>
1314<a class="anchor" id="gae403193ceb4aafb7e0f56ab587b48616"></a><!-- doxytag: member="turbojpeg.h::tjTransform" ref="gae403193ceb4aafb7e0f56ab587b48616" args="(tjhandle handle, unsigned char *jpegBuf, unsigned long jpegSize, int n, unsigned char **dstBufs, unsigned long *dstSizes, tjtransform *transforms, int flags)" -->
1315<div class="memitem">
1316<div class="memproto">
1317 <table class="memname">
1318 <tr>
1319 <td class="memname">DLLEXPORT int DLLCALL tjTransform </td>
1320 <td>(</td>
1321 <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1322 <td class="paramname"><em>handle</em>, </td>
1323 </tr>
1324 <tr>
1325 <td class="paramkey"></td>
1326 <td></td>
1327 <td class="paramtype">unsigned char *&#160;</td>
1328 <td class="paramname"><em>jpegBuf</em>, </td>
1329 </tr>
1330 <tr>
1331 <td class="paramkey"></td>
1332 <td></td>
1333 <td class="paramtype">unsigned long&#160;</td>
1334 <td class="paramname"><em>jpegSize</em>, </td>
1335 </tr>
1336 <tr>
1337 <td class="paramkey"></td>
1338 <td></td>
1339 <td class="paramtype">int&#160;</td>
1340 <td class="paramname"><em>n</em>, </td>
1341 </tr>
1342 <tr>
1343 <td class="paramkey"></td>
1344 <td></td>
1345 <td class="paramtype">unsigned char **&#160;</td>
1346 <td class="paramname"><em>dstBufs</em>, </td>
1347 </tr>
1348 <tr>
1349 <td class="paramkey"></td>
1350 <td></td>
1351 <td class="paramtype">unsigned long *&#160;</td>
1352 <td class="paramname"><em>dstSizes</em>, </td>
1353 </tr>
1354 <tr>
1355 <td class="paramkey"></td>
1356 <td></td>
1357 <td class="paramtype"><a class="el" href="structtjtransform.html">tjtransform</a> *&#160;</td>
1358 <td class="paramname"><em>transforms</em>, </td>
1359 </tr>
1360 <tr>
1361 <td class="paramkey"></td>
1362 <td></td>
1363 <td class="paramtype">int&#160;</td>
1364 <td class="paramname"><em>flags</em>&#160;</td>
1365 </tr>
1366 <tr>
1367 <td></td>
1368 <td>)</td>
1369 <td></td><td></td>
1370 </tr>
1371 </table>
1372</div>
1373<div class="memdoc">
1374
1375<p>Losslessly transform a JPEG image into another JPEG image. </p>
1376<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 Huffman decoding 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 of applying multiple transformations simultaneously, in order to eliminate the need to read the source coefficients multiple times.</p>
1377<dl><dt><b>Parameters:</b></dt><dd>
1378 <table class="params">
1379 <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG transformer instance </td></tr>
1380 <tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG image to transform </td></tr>
1381 <tr><td class="paramname">jpegSize</td><td>size of the JPEG image (in bytes) </td></tr>
1382 <tr><td class="paramname">n</td><td>the number of transformed JPEG images to generate </td></tr>
1383 <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">
DRC6b76f752011-05-24 16:52:47 +00001384<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>
DRC9b28def2011-05-21 14:37:15 +00001385<li>set <code>dstBufs[i]</code> to NULL to tell TurboJPEG to allocate the buffer for you, or</li>
DRC9b49f0e2011-07-12 03:17:23 +00001386<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 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>
DRC9b28def2011-05-21 14:37:15 +00001387</ol>
DRCff78e372011-05-24 10:17:32 +00001388If 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>
DRC9b28def2011-05-21 14:37:15 +00001389 <tr><td class="paramname">dstSizes</td><td>pointer to an array of n unsigned long variables which 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>
1390 <tr><td class="paramname">transforms</td><td>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. </td></tr>
DRC25b995a2011-05-21 15:34:54 +00001391 <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>
DRC9b28def2011-05-21 14:37:15 +00001392 </table>
1393 </dd>
1394</dl>
1395<dl class="return"><dt><b>Returns:</b></dt><dd>0 if successful, or -1 if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr()</a>.) </dd></dl>
1396
1397</div>
1398</div>
1399<hr/><h2>Variable Documentation</h2>
1400<a class="anchor" id="ga84e2e35d3f08025f976ec1ec53693dea"></a><!-- doxytag: member="turbojpeg.h::tjBlueOffset" ref="ga84e2e35d3f08025f976ec1ec53693dea" args="[TJ_NUMPF]" -->
1401<div class="memitem">
1402<div class="memproto">
1403 <table class="memname">
1404 <tr>
1405 <td class="memname">const int <a class="el" href="group___turbo_j_p_e_g.html#ga84e2e35d3f08025f976ec1ec53693dea">tjBlueOffset</a>[TJ_NUMPF]<code> [static]</code></td>
1406 </tr>
1407 </table>
1408</div>
1409<div class="memdoc">
1410
1411<p>Blue offset (in bytes) for a given pixel format. </p>
1412<p>This specifies the number of bytes that the Blue component is offset from the start of the pixel. For instance, if a pixel of format TJ_BGRX is stored in <code>char pixel[]</code>, then the blue component will be <code>pixel[tjBlueOffset[TJ_BGRX]]</code>. </p>
1413
1414</div>
1415</div>
1416<a class="anchor" id="ga82d6e35da441112a411da41923c0ba2f"></a><!-- doxytag: member="turbojpeg.h::tjGreenOffset" ref="ga82d6e35da441112a411da41923c0ba2f" args="[TJ_NUMPF]" -->
1417<div class="memitem">
1418<div class="memproto">
1419 <table class="memname">
1420 <tr>
1421 <td class="memname">const int <a class="el" href="group___turbo_j_p_e_g.html#ga82d6e35da441112a411da41923c0ba2f">tjGreenOffset</a>[TJ_NUMPF]<code> [static]</code></td>
1422 </tr>
1423 </table>
1424</div>
1425<div class="memdoc">
1426
1427<p>Green offset (in bytes) for a given pixel format. </p>
1428<p>This specifies the number of bytes that the green component is offset from the start of the pixel. For instance, if a pixel of format TJ_BGRX is stored in <code>char pixel[]</code>, then the green component will be <code>pixel[tjGreenOffset[TJ_BGRX]]</code>. </p>
1429
1430</div>
1431</div>
1432<a class="anchor" id="gabd247bb9fecb393eca57366feb8327bf"></a><!-- doxytag: member="turbojpeg.h::tjMCUHeight" ref="gabd247bb9fecb393eca57366feb8327bf" args="[TJ_NUMSAMP]" -->
1433<div class="memitem">
1434<div class="memproto">
1435 <table class="memname">
1436 <tr>
1437 <td class="memname">const int <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf">tjMCUHeight</a>[TJ_NUMSAMP]<code> [static]</code></td>
1438 </tr>
1439 </table>
1440</div>
1441<div class="memdoc">
1442
1443<p>MCU block height (in pixels) for a given level of chrominance subsampling. </p>
1444<p>MCU block sizes:</p>
1445<ul>
1446<li>8x8 for no subsampling or grayscale</li>
1447<li>16x8 for 4:2:2</li>
1448<li>8x16 for 4:4:0</li>
1449<li>16x16 for 4:2:0 </li>
1450</ul>
1451
1452</div>
1453</div>
1454<a class="anchor" id="ga9e61e7cd47a15a173283ba94e781308c"></a><!-- doxytag: member="turbojpeg.h::tjMCUWidth" ref="ga9e61e7cd47a15a173283ba94e781308c" args="[TJ_NUMSAMP]" -->
1455<div class="memitem">
1456<div class="memproto">
1457 <table class="memname">
1458 <tr>
1459 <td class="memname">const int <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c">tjMCUWidth</a>[TJ_NUMSAMP]<code> [static]</code></td>
1460 </tr>
1461 </table>
1462</div>
1463<div class="memdoc">
1464
1465<p>MCU block width (in pixels) for a given level of chrominance subsampling. </p>
1466<p>MCU block sizes:</p>
1467<ul>
1468<li>8x8 for no subsampling or grayscale</li>
1469<li>16x8 for 4:2:2</li>
1470<li>8x16 for 4:4:0</li>
1471<li>16x16 for 4:2:0 </li>
1472</ul>
1473
1474</div>
1475</div>
DRC25b995a2011-05-21 15:34:54 +00001476<a class="anchor" id="gad77cf8fe5b2bfd3cb3f53098146abb4c"></a><!-- doxytag: member="turbojpeg.h::tjPixelSize" ref="gad77cf8fe5b2bfd3cb3f53098146abb4c" args="[TJ_NUMPF]" -->
1477<div class="memitem">
1478<div class="memproto">
1479 <table class="memname">
1480 <tr>
1481 <td class="memname">const int <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c">tjPixelSize</a>[TJ_NUMPF]<code> [static]</code></td>
1482 </tr>
1483 </table>
1484</div>
1485<div class="memdoc">
1486
1487<p>Pixel size (in bytes) for a given pixel format. </p>
1488
1489</div>
1490</div>
DRC9b28def2011-05-21 14:37:15 +00001491<a class="anchor" id="gadd9b446742ac8a3923f7992c7988fea8"></a><!-- doxytag: member="turbojpeg.h::tjRedOffset" ref="gadd9b446742ac8a3923f7992c7988fea8" args="[TJ_NUMPF]" -->
1492<div class="memitem">
1493<div class="memproto">
1494 <table class="memname">
1495 <tr>
1496 <td class="memname">const int <a class="el" href="group___turbo_j_p_e_g.html#gadd9b446742ac8a3923f7992c7988fea8">tjRedOffset</a>[TJ_NUMPF]<code> [static]</code></td>
1497 </tr>
1498 </table>
1499</div>
1500<div class="memdoc">
1501
1502<p>Red offset (in bytes) for a given pixel format. </p>
1503<p>This specifies the number of bytes that the red component is offset from the start of the pixel. For instance, if a pixel of format TJ_BGRX is stored in <code>char pixel[]</code>, then the red component will be <code>pixel[tjRedOffset[TJ_BGRX]]</code>. </p>
1504
1505</div>
1506</div>
1507</div>
1508<!-- window showing the filter options -->
1509<div id="MSearchSelectWindow"
1510 onmouseover="return searchBox.OnSearchSelectShow()"
1511 onmouseout="return searchBox.OnSearchSelectHide()"
1512 onkeydown="return searchBox.OnSearchSelectKey(event)">
1513<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Variables</a></div>
1514
1515<!-- iframe showing the search results (closed by default) -->
1516<div id="MSearchResultsWindow">
1517<iframe src="javascript:void(0)" frameborder="0"
1518 name="MSearchResults" id="MSearchResults">
1519</iframe>
1520</div>
1521
DRC7bf04d32011-09-17 00:18:31 +00001522<hr class="footer"/><address class="footer"><small>Generated on Fri Sep 16 2011 19:05:46 for TurboJPEG by&#160;
DRC9b28def2011-05-21 14:37:15 +00001523<a href="http://www.doxygen.org/index.html">
1524<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
1525</body>
1526</html>