1<!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<meta http-equiv="X-UA-Compatible" content="IE=9"/>
6<meta name="generator" content="Doxygen 1.8.3.1"/>
7<title>TurboJPEG: TurboJPEG</title>
8<link href="tabs.css" rel="stylesheet" type="text/css"/>
9<script type="text/javascript" src="jquery.js"></script>
10<script type="text/javascript" src="dynsections.js"></script>
11<link href="search/search.css" rel="stylesheet" type="text/css"/>
12<script type="text/javascript" src="search/search.js"></script>
13<script type="text/javascript">
14  $(document).ready(function() { searchBox.OnSelectItem(0); });
15</script>
16<link href="doxygen.css" rel="stylesheet" type="text/css" />
17<link href="doxygen-extra.css" rel="stylesheet" type="text/css"/>
18</head>
19<body>
20<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
21<div id="titlearea">
22<table cellspacing="0" cellpadding="0">
23 <tbody>
24 <tr style="height: 56px;">
25  <td style="padding-left: 0.5em;">
26   <div id="projectname">TurboJPEG
27   &#160;<span id="projectnumber">1.4</span>
28   </div>
29  </td>
30 </tr>
31 </tbody>
32</table>
33</div>
34<!-- end header part -->
35<!-- Generated by Doxygen 1.8.3.1 -->
36<script type="text/javascript">
37var searchBox = new SearchBox("searchBox", "search",false,'Search');
38</script>
39  <div id="navrow1" class="tabs">
40    <ul class="tablist">
41      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
42      <li><a href="modules.html"><span>Modules</span></a></li>
43      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
44      <li>
45        <div id="MSearchBox" class="MSearchBoxInactive">
46        <span class="left">
47          <img id="MSearchSelect" src="search/mag_sel.png"
48               onmouseover="return searchBox.OnSearchSelectShow()"
49               onmouseout="return searchBox.OnSearchSelectHide()"
50               alt=""/>
51          <input type="text" id="MSearchField" value="Search" accesskey="S"
52               onfocus="searchBox.OnSearchFieldFocus(true)"
53               onblur="searchBox.OnSearchFieldFocus(false)"
54               onkeyup="searchBox.OnSearchFieldChange(event)"/>
55          </span><span class="right">
56            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
57          </span>
58        </div>
59      </li>
60    </ul>
61  </div>
62</div><!-- top -->
63<!-- window showing the filter options -->
64<div id="MSearchSelectWindow"
65     onmouseover="return searchBox.OnSearchSelectShow()"
66     onmouseout="return searchBox.OnSearchSelectHide()"
67     onkeydown="return searchBox.OnSearchSelectKey(event)">
68<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>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Groups</a></div>
69
70<!-- iframe showing the search results (closed by default) -->
71<div id="MSearchResultsWindow">
72<iframe src="javascript:void(0)" frameborder="0"
73        name="MSearchResults" id="MSearchResults">
74</iframe>
75</div>
76
77<div class="header">
78  <div class="summary">
79<a href="#nested-classes">Data Structures</a> &#124;
80<a href="#define-members">Macros</a> &#124;
81<a href="#typedef-members">Typedefs</a> &#124;
82<a href="#enum-members">Enumerations</a> &#124;
83<a href="#func-members">Functions</a> &#124;
84<a href="#var-members">Variables</a>  </div>
85  <div class="headertitle">
86<div class="title">TurboJPEG</div>  </div>
87</div><!--header-->
88<div class="contents">
89
90<p>TurboJPEG API.
91<a href="#details">More...</a></p>
92<table class="memberdecls">
93<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
94Data Structures</h2></td></tr>
95<tr class="memitem:"><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>
96<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Scaling factor.  <a href="structtjscalingfactor.html#details">More...</a><br/></td></tr>
97<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
98<tr class="memitem:"><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>
99<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Cropping region.  <a href="structtjregion.html#details">More...</a><br/></td></tr>
100<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
101<tr class="memitem:"><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>
102<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Lossless transform.  <a href="structtjtransform.html#details">More...</a><br/></td></tr>
103<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
104</table><table class="memberdecls">
105<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
106Macros</h2></td></tr>
107<tr class="memitem:ga5ef3d169162ce77ce348e292a0b7477c"><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>
108<tr class="memdesc:ga5ef3d169162ce77ce348e292a0b7477c"><td class="mdescLeft">&#160;</td><td class="mdescRight">The number of chrominance subsampling options.  <a href="#ga5ef3d169162ce77ce348e292a0b7477c">More...</a><br/></td></tr>
109<tr class="separator:ga5ef3d169162ce77ce348e292a0b7477c"><td class="memSeparator" colspan="2">&#160;</td></tr>
110<tr class="memitem:ga7010a4402f54a45ba822ad8675a4655e"><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>
111<tr class="memdesc:ga7010a4402f54a45ba822ad8675a4655e"><td class="mdescLeft">&#160;</td><td class="mdescRight">The number of pixel formats.  <a href="#ga7010a4402f54a45ba822ad8675a4655e">More...</a><br/></td></tr>
112<tr class="separator:ga7010a4402f54a45ba822ad8675a4655e"><td class="memSeparator" colspan="2">&#160;</td></tr>
113<tr class="memitem:ga39f57a6fb02d9cf32e7b6890099b5a71"><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#ga39f57a6fb02d9cf32e7b6890099b5a71">TJ_NUMCS</a></td></tr>
114<tr class="memdesc:ga39f57a6fb02d9cf32e7b6890099b5a71"><td class="mdescLeft">&#160;</td><td class="mdescRight">The number of JPEG colorspaces.  <a href="#ga39f57a6fb02d9cf32e7b6890099b5a71">More...</a><br/></td></tr>
115<tr class="separator:ga39f57a6fb02d9cf32e7b6890099b5a71"><td class="memSeparator" colspan="2">&#160;</td></tr>
116<tr class="memitem:ga72ecf4ebe6eb702d3c6f5ca27455e1ec"><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>
117<tr class="memdesc:ga72ecf4ebe6eb702d3c6f5ca27455e1ec"><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">More...</a><br/></td></tr>
118<tr class="separator:ga72ecf4ebe6eb702d3c6f5ca27455e1ec"><td class="memSeparator" colspan="2">&#160;</td></tr>
119<tr class="memitem:ga4ee4506c81177a06f77e2504a22efd2d"><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>
120<tr class="memdesc:ga4ee4506c81177a06f77e2504a22efd2d"><td class="mdescLeft">&#160;</td><td class="mdescRight">When decompressing an image that was compressed using chrominance subsampling, use the fastest chrominance upsampling algorithm available in the underlying codec.  <a href="#ga4ee4506c81177a06f77e2504a22efd2d">More...</a><br/></td></tr>
121<tr class="separator:ga4ee4506c81177a06f77e2504a22efd2d"><td class="memSeparator" colspan="2">&#160;</td></tr>
122<tr class="memitem:ga8808d403c68b62aaa58a4c1e58e98963"><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>
123<tr class="memdesc:ga8808d403c68b62aaa58a4c1e58e98963"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disable buffer (re)allocation.  <a href="#ga8808d403c68b62aaa58a4c1e58e98963">More...</a><br/></td></tr>
124<tr class="separator:ga8808d403c68b62aaa58a4c1e58e98963"><td class="memSeparator" colspan="2">&#160;</td></tr>
125<tr class="memitem:gaabce235db80d3f698b27f36cbd453da2"><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#gaabce235db80d3f698b27f36cbd453da2">TJFLAG_FASTDCT</a></td></tr>
126<tr class="memdesc:gaabce235db80d3f698b27f36cbd453da2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Use the fastest DCT/IDCT algorithm available in the underlying codec.  <a href="#gaabce235db80d3f698b27f36cbd453da2">More...</a><br/></td></tr>
127<tr class="separator:gaabce235db80d3f698b27f36cbd453da2"><td class="memSeparator" colspan="2">&#160;</td></tr>
128<tr class="memitem:gacb233cfd722d66d1ccbf48a7de81f0e0"><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#gacb233cfd722d66d1ccbf48a7de81f0e0">TJFLAG_ACCURATEDCT</a></td></tr>
129<tr class="memdesc:gacb233cfd722d66d1ccbf48a7de81f0e0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Use the most accurate DCT/IDCT algorithm available in the underlying codec.  <a href="#gacb233cfd722d66d1ccbf48a7de81f0e0">More...</a><br/></td></tr>
130<tr class="separator:gacb233cfd722d66d1ccbf48a7de81f0e0"><td class="memSeparator" colspan="2">&#160;</td></tr>
131<tr class="memitem:ga0f6dbd18adf38b7d46ac547f0f4d562c"><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>
132<tr class="memdesc:ga0f6dbd18adf38b7d46ac547f0f4d562c"><td class="mdescLeft">&#160;</td><td class="mdescRight">The number of transform operations.  <a href="#ga0f6dbd18adf38b7d46ac547f0f4d562c">More...</a><br/></td></tr>
133<tr class="separator:ga0f6dbd18adf38b7d46ac547f0f4d562c"><td class="memSeparator" colspan="2">&#160;</td></tr>
134<tr class="memitem:ga50e03cb5ed115330e212417429600b00"><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>
135<tr class="memdesc:ga50e03cb5ed115330e212417429600b00"><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">More...</a><br/></td></tr>
136<tr class="separator:ga50e03cb5ed115330e212417429600b00"><td class="memSeparator" colspan="2">&#160;</td></tr>
137<tr class="memitem:ga319826b7eb1583c0595bbe7b95428709"><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>
138<tr class="memdesc:ga319826b7eb1583c0595bbe7b95428709"><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">More...</a><br/></td></tr>
139<tr class="separator:ga319826b7eb1583c0595bbe7b95428709"><td class="memSeparator" colspan="2">&#160;</td></tr>
140<tr class="memitem:ga9c771a757fc1294add611906b89ab2d2"><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>
141<tr class="memdesc:ga9c771a757fc1294add611906b89ab2d2"><td class="mdescLeft">&#160;</td><td class="mdescRight">This option will enable lossless cropping.  <a href="#ga9c771a757fc1294add611906b89ab2d2">More...</a><br/></td></tr>
142<tr class="separator:ga9c771a757fc1294add611906b89ab2d2"><td class="memSeparator" colspan="2">&#160;</td></tr>
143<tr class="memitem:ga3acee7b48ade1b99e5588736007c2589"><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>
144<tr class="memdesc:ga3acee7b48ade1b99e5588736007c2589"><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">More...</a><br/></td></tr>
145<tr class="separator:ga3acee7b48ade1b99e5588736007c2589"><td class="memSeparator" colspan="2">&#160;</td></tr>
146<tr class="memitem:gafbf992bbf6e006705886333703ffab31"><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>
147<tr class="memdesc:gafbf992bbf6e006705886333703ffab31"><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">More...</a><br/></td></tr>
148<tr class="separator:gafbf992bbf6e006705886333703ffab31"><td class="memSeparator" colspan="2">&#160;</td></tr>
149<tr class="memitem:ga0aba955473315e405295d978f0c16511"><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>
150<tr class="memdesc:ga0aba955473315e405295d978f0c16511"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pad the given width to the nearest 32-bit boundary.  <a href="#ga0aba955473315e405295d978f0c16511">More...</a><br/></td></tr>
151<tr class="separator:ga0aba955473315e405295d978f0c16511"><td class="memSeparator" colspan="2">&#160;</td></tr>
152<tr class="memitem:ga84878bb65404204743aa18cac02781df"><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>
153<tr class="memdesc:ga84878bb65404204743aa18cac02781df"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compute the scaled value of <code>dimension</code> using the given scaling factor.  <a href="#ga84878bb65404204743aa18cac02781df">More...</a><br/></td></tr>
154<tr class="separator:ga84878bb65404204743aa18cac02781df"><td class="memSeparator" colspan="2">&#160;</td></tr>
155</table><table class="memberdecls">
156<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
157Typedefs</h2></td></tr>
158<tr class="memitem:gaa29f3189c41be12ec5dee7caec318a31"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structtjtransform.html">tjtransform</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gaa29f3189c41be12ec5dee7caec318a31">tjtransform</a></td></tr>
159<tr class="memdesc:gaa29f3189c41be12ec5dee7caec318a31"><td class="mdescLeft">&#160;</td><td class="mdescRight">Lossless transform.  <a href="#gaa29f3189c41be12ec5dee7caec318a31">More...</a><br/></td></tr>
160<tr class="separator:gaa29f3189c41be12ec5dee7caec318a31"><td class="memSeparator" colspan="2">&#160;</td></tr>
161<tr class="memitem:ga758d2634ecb4949de7815cba621f5763"><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>
162<tr class="memdesc:ga758d2634ecb4949de7815cba621f5763"><td class="mdescLeft">&#160;</td><td class="mdescRight">TurboJPEG instance handle.  <a href="#ga758d2634ecb4949de7815cba621f5763">More...</a><br/></td></tr>
163<tr class="separator:ga758d2634ecb4949de7815cba621f5763"><td class="memSeparator" colspan="2">&#160;</td></tr>
164</table><table class="memberdecls">
165<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a>
166Enumerations</h2></td></tr>
167<tr class="memitem:ga1d047060ea80bb9820d540bb928e9074"><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/>
168&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074afb8da4f44197837bdec0a4f593dacae3">TJSAMP_444</a>,
169<a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a136130902cc578f11f32429b59368404">TJSAMP_422</a>,
170<a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a63085dbf683cfe39e513cdb6343e3737">TJSAMP_420</a>,
171<a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a3f1c9504842ddc7a48d0f690754b6248">TJSAMP_GRAY</a>,
172<br/>
173&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074accf740e6f3aa6ba20ba922cad13cb974">TJSAMP_440</a>,
174<a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a28ec62575e5ea295c3fde3001dc628e2">TJSAMP_411</a>
175<br/>
176 }</td></tr>
177<tr class="memdesc:ga1d047060ea80bb9820d540bb928e9074"><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>
178<tr class="separator:ga1d047060ea80bb9820d540bb928e9074"><td class="memSeparator" colspan="2">&#160;</td></tr>
179<tr class="memitem:gac916144e26c3817ac514e64ae5d12e2a"><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/>
180&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7ce93230bff449518ce387c17e6ed37c">TJPF_RGB</a>,
181<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aab10624437fb8ef495a0b153e65749839">TJPF_BGR</a>,
182<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01">TJPF_RGBX</a>,
183<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa2a1fbf569ca79897eae886e3376ca4c8">TJPF_BGRX</a>,
184<br/>
185&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af">TJPF_XBGR</a>,
186<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84">TJPF_XRGB</a>,
187<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a">TJPF_GRAY</a>,
188<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa88d2e88fab67f6503cf972e14851cc12">TJPF_RGBA</a>,
189<br/>
190&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aac037ff1845cf9b74bb81a3659c2b9fb4">TJPF_BGRA</a>,
191<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa1ba1a7f1631dbeaa49a0a85fc4a40081">TJPF_ABGR</a>,
192<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aae8f846ed9d9de99b6e1dfe448848765c">TJPF_ARGB</a>,
193<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7f5100ec44c91994e243f1cf55553f8b">TJPF_CMYK</a>
194<br/>
195 }</td></tr>
196<tr class="memdesc:gac916144e26c3817ac514e64ae5d12e2a"><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>
197<tr class="separator:gac916144e26c3817ac514e64ae5d12e2a"><td class="memSeparator" colspan="2">&#160;</td></tr>
198<tr class="memitem:ga4f83ad3368e0e29d1957be0efa7c3720"><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#ga4f83ad3368e0e29d1957be0efa7c3720">TJCS</a> { <br/>
199&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a677cb7ccb85c4038ac41964a2e09e555">TJCS_RGB</a>,
200<a class="el" href="group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a7389b8f65bb387ffedce3efd0d78ec75">TJCS_YCbCr</a>,
201<a class="el" href="group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720ab3e7d6a87f695e45b81c1b5262b5a50a">TJCS_GRAY</a>,
202<a class="el" href="group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a6c8b636152ac8195b869587db315ee53">TJCS_CMYK</a>,
203<br/>
204&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a53839e0fe867b76b58d16b0a1a7c598e">TJCS_YCCK</a>
205<br/>
206 }</td></tr>
207<tr class="memdesc:ga4f83ad3368e0e29d1957be0efa7c3720"><td class="mdescLeft">&#160;</td><td class="mdescRight">JPEG colorspaces.  <a href="group___turbo_j_p_e_g.html#ga4f83ad3368e0e29d1957be0efa7c3720">More...</a><br/></td></tr>
208<tr class="separator:ga4f83ad3368e0e29d1957be0efa7c3720"><td class="memSeparator" colspan="2">&#160;</td></tr>
209<tr class="memitem:ga2de531af4e7e6c4f124908376b354866"><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/>
210&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aad88c0366cd3f7d0eac9d7a3fa1c2c27">TJXOP_NONE</a>,
211<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aa0df69776caa30f0fa28e26332d311ce">TJXOP_HFLIP</a>,
212<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a324eddfbec53b7e691f61e56929d0d5d">TJXOP_VFLIP</a>,
213<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a31060aed199f886afdd417f80499c32d">TJXOP_TRANSPOSE</a>,
214<br/>
215&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866af3b14d488aea6ece9e5b3df73a74d6a4">TJXOP_TRANSVERSE</a>,
216<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a43b2bbb23bc4bd548422d43fbe9af128">TJXOP_ROT90</a>,
217<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a140952eb8dd0300accfcc22726d69692">TJXOP_ROT180</a>,
218<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a3064ee5dfb7f032df332818587567a08">TJXOP_ROT270</a>
219<br/>
220 }</td></tr>
221<tr class="memdesc:ga2de531af4e7e6c4f124908376b354866"><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>
222<tr class="separator:ga2de531af4e7e6c4f124908376b354866"><td class="memSeparator" colspan="2">&#160;</td></tr>
223</table><table class="memberdecls">
224<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
225Functions</h2></td></tr>
226<tr class="memitem:ga3d10c47fbe4a2489a2b30c931551d01a"><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>
227<tr class="memdesc:ga3d10c47fbe4a2489a2b30c931551d01a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a TurboJPEG compressor instance.  <a href="#ga3d10c47fbe4a2489a2b30c931551d01a">More...</a><br/></td></tr>
228<tr class="separator:ga3d10c47fbe4a2489a2b30c931551d01a"><td class="memSeparator" colspan="2">&#160;</td></tr>
229<tr class="memitem:gaba62b7a98f960839b588579898495cf2"><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>
230<tr class="memdesc:gaba62b7a98f960839b588579898495cf2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compress an RGB, grayscale, or CMYK image into a JPEG image.  <a href="#gaba62b7a98f960839b588579898495cf2">More...</a><br/></td></tr>
231<tr class="separator:gaba62b7a98f960839b588579898495cf2"><td class="memSeparator" colspan="2">&#160;</td></tr>
232<tr class="memitem:ga0b931126c7a615ddc3bbd0cca6698d67"><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#ga0b931126c7a615ddc3bbd0cca6698d67">tjCompressFromYUV</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *srcBuf, int width, int pad, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags)</td></tr>
233<tr class="memdesc:ga0b931126c7a615ddc3bbd0cca6698d67"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compress a YUV planar image into a JPEG image.  <a href="#ga0b931126c7a615ddc3bbd0cca6698d67">More...</a><br/></td></tr>
234<tr class="separator:ga0b931126c7a615ddc3bbd0cca6698d67"><td class="memSeparator" colspan="2">&#160;</td></tr>
235<tr class="memitem:gaa89a1982cb4556b12ae7af4439991af6"><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#gaa89a1982cb4556b12ae7af4439991af6">tjCompressFromYUVPlanes</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char **srcPlanes, int width, int *strides, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags)</td></tr>
236<tr class="memdesc:gaa89a1982cb4556b12ae7af4439991af6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compress a set of Y, U (Cb), and V (Cr) image planes into a JPEG image.  <a href="#gaa89a1982cb4556b12ae7af4439991af6">More...</a><br/></td></tr>
237<tr class="separator:gaa89a1982cb4556b12ae7af4439991af6"><td class="memSeparator" colspan="2">&#160;</td></tr>
238<tr class="memitem:gaccc5bca7f12fcdcc302e6e1c6d4b311b"><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>
239<tr class="memdesc:gaccc5bca7f12fcdcc302e6e1c6d4b311b"><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">More...</a><br/></td></tr>
240<tr class="separator:gaccc5bca7f12fcdcc302e6e1c6d4b311b"><td class="memSeparator" colspan="2">&#160;</td></tr>
241<tr class="memitem:gaf451664a62c1f6c7cc5a6401f32908c9"><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#gaf451664a62c1f6c7cc5a6401f32908c9">tjBufSizeYUV2</a> (int width, int pad, int height, int subsamp)</td></tr>
242<tr class="memdesc:gaf451664a62c1f6c7cc5a6401f32908c9"><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="#gaf451664a62c1f6c7cc5a6401f32908c9">More...</a><br/></td></tr>
243<tr class="separator:gaf451664a62c1f6c7cc5a6401f32908c9"><td class="memSeparator" colspan="2">&#160;</td></tr>
244<tr class="memitem:ga6f98d977bfa9d167c97172e876ba61e2"><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#ga6f98d977bfa9d167c97172e876ba61e2">tjPlaneSizeYUV</a> (int componentID, int width, int stride, int height, int subsamp)</td></tr>
245<tr class="memdesc:ga6f98d977bfa9d167c97172e876ba61e2"><td class="mdescLeft">&#160;</td><td class="mdescRight">The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters.  <a href="#ga6f98d977bfa9d167c97172e876ba61e2">More...</a><br/></td></tr>
246<tr class="separator:ga6f98d977bfa9d167c97172e876ba61e2"><td class="memSeparator" colspan="2">&#160;</td></tr>
247<tr class="memitem:ga63fb66bb1e36c74008c4634360becbb1"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga63fb66bb1e36c74008c4634360becbb1">tjPlaneWidth</a> (int componentID, int width, int subsamp)</td></tr>
248<tr class="memdesc:ga63fb66bb1e36c74008c4634360becbb1"><td class="mdescLeft">&#160;</td><td class="mdescRight">The plane width of a YUV image plane with the given parameters.  <a href="#ga63fb66bb1e36c74008c4634360becbb1">More...</a><br/></td></tr>
249<tr class="separator:ga63fb66bb1e36c74008c4634360becbb1"><td class="memSeparator" colspan="2">&#160;</td></tr>
250<tr class="memitem:ga1a209696c6a80748f20e134b3c64789f"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga1a209696c6a80748f20e134b3c64789f">tjPlaneHeight</a> (int componentID, int height, int subsamp)</td></tr>
251<tr class="memdesc:ga1a209696c6a80748f20e134b3c64789f"><td class="mdescLeft">&#160;</td><td class="mdescRight">The plane height of a YUV image plane with the given parameters.  <a href="#ga1a209696c6a80748f20e134b3c64789f">More...</a><br/></td></tr>
252<tr class="separator:ga1a209696c6a80748f20e134b3c64789f"><td class="memSeparator" colspan="2">&#160;</td></tr>
253<tr class="memitem:ga0a5ffbf7cb58a5b6a8201114fe889360"><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#ga0a5ffbf7cb58a5b6a8201114fe889360">tjEncodeYUV3</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char *dstBuf, int pad, int subsamp, int flags)</td></tr>
254<tr class="memdesc:ga0a5ffbf7cb58a5b6a8201114fe889360"><td class="mdescLeft">&#160;</td><td class="mdescRight">Encode an RGB or grayscale image into a YUV planar image.  <a href="#ga0a5ffbf7cb58a5b6a8201114fe889360">More...</a><br/></td></tr>
255<tr class="separator:ga0a5ffbf7cb58a5b6a8201114fe889360"><td class="memSeparator" colspan="2">&#160;</td></tr>
256<tr class="memitem:gaa791db8598853ddcad24e42897ef1269"><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#gaa791db8598853ddcad24e42897ef1269">tjEncodeYUVPlanes</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 **dstPlanes, int *strides, int subsamp, int flags)</td></tr>
257<tr class="memdesc:gaa791db8598853ddcad24e42897ef1269"><td class="mdescLeft">&#160;</td><td class="mdescRight">Encode an RGB or grayscale image into separate Y, U (Cb), and V (Cr) image planes.  <a href="#gaa791db8598853ddcad24e42897ef1269">More...</a><br/></td></tr>
258<tr class="separator:gaa791db8598853ddcad24e42897ef1269"><td class="memSeparator" colspan="2">&#160;</td></tr>
259<tr class="memitem:gae5408179d041e2a2f7199c8283cf649e"><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>
260<tr class="memdesc:gae5408179d041e2a2f7199c8283cf649e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a TurboJPEG decompressor instance.  <a href="#gae5408179d041e2a2f7199c8283cf649e">More...</a><br/></td></tr>
261<tr class="separator:gae5408179d041e2a2f7199c8283cf649e"><td class="memSeparator" colspan="2">&#160;</td></tr>
262<tr class="memitem:gacd0fac3af74b3511d39b4781b7103086"><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#gacd0fac3af74b3511d39b4781b7103086">tjDecompressHeader3</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, int *jpegColorspace)</td></tr>
263<tr class="memdesc:gacd0fac3af74b3511d39b4781b7103086"><td class="mdescLeft">&#160;</td><td class="mdescRight">Retrieve information about a JPEG image without decompressing it.  <a href="#gacd0fac3af74b3511d39b4781b7103086">More...</a><br/></td></tr>
264<tr class="separator:gacd0fac3af74b3511d39b4781b7103086"><td class="memSeparator" colspan="2">&#160;</td></tr>
265<tr class="memitem:ga6449044b9af402999ccf52f401333be8"><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>
266<tr class="memdesc:ga6449044b9af402999ccf52f401333be8"><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">More...</a><br/></td></tr>
267<tr class="separator:ga6449044b9af402999ccf52f401333be8"><td class="memSeparator" colspan="2">&#160;</td></tr>
268<tr class="memitem:gada69cc6443d1bb493b40f1626259e5e9"><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>
269<tr class="memdesc:gada69cc6443d1bb493b40f1626259e5e9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decompress a JPEG image to an RGB, grayscale, or CMYK image.  <a href="#gada69cc6443d1bb493b40f1626259e5e9">More...</a><br/></td></tr>
270<tr class="separator:gada69cc6443d1bb493b40f1626259e5e9"><td class="memSeparator" colspan="2">&#160;</td></tr>
271<tr class="memitem:ga7c08b340ad7f8e85d407bd9e81d44d07"><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#ga7c08b340ad7f8e85d407bd9e81d44d07">tjDecompressToYUV2</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 pad, int height, int flags)</td></tr>
272<tr class="memdesc:ga7c08b340ad7f8e85d407bd9e81d44d07"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decompress a JPEG image to a YUV planar image.  <a href="#ga7c08b340ad7f8e85d407bd9e81d44d07">More...</a><br/></td></tr>
273<tr class="separator:ga7c08b340ad7f8e85d407bd9e81d44d07"><td class="memSeparator" colspan="2">&#160;</td></tr>
274<tr class="memitem:ga0828a38ae29631ac28b6857cefb0eebf"><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#ga0828a38ae29631ac28b6857cefb0eebf">tjDecompressToYUVPlanes</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *jpegBuf, unsigned long jpegSize, unsigned char **dstPlanes, int width, int *strides, int height, int flags)</td></tr>
275<tr class="memdesc:ga0828a38ae29631ac28b6857cefb0eebf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decompress a JPEG image into separate Y, U (Cb), and V (Cr) image planes.  <a href="#ga0828a38ae29631ac28b6857cefb0eebf">More...</a><br/></td></tr>
276<tr class="separator:ga0828a38ae29631ac28b6857cefb0eebf"><td class="memSeparator" colspan="2">&#160;</td></tr>
277<tr class="memitem:ga132ae2c2cadcf64c8bb0f3bdf69da3ed"><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#ga132ae2c2cadcf64c8bb0f3bdf69da3ed">tjDecodeYUV</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *srcBuf, int pad, int subsamp, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)</td></tr>
278<tr class="memdesc:ga132ae2c2cadcf64c8bb0f3bdf69da3ed"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decode a YUV planar image into an RGB or grayscale image.  <a href="#ga132ae2c2cadcf64c8bb0f3bdf69da3ed">More...</a><br/></td></tr>
279<tr class="separator:ga132ae2c2cadcf64c8bb0f3bdf69da3ed"><td class="memSeparator" colspan="2">&#160;</td></tr>
280<tr class="memitem:ga6cb5b0e1101a2b20edea576e11faf93d"><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#ga6cb5b0e1101a2b20edea576e11faf93d">tjDecodeYUVPlanes</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char **srcPlanes, int *strides, int subsamp, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)</td></tr>
281<tr class="memdesc:ga6cb5b0e1101a2b20edea576e11faf93d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decode a set of Y, U (Cb), and V (Cr) image planes into an RGB or grayscale image.  <a href="#ga6cb5b0e1101a2b20edea576e11faf93d">More...</a><br/></td></tr>
282<tr class="separator:ga6cb5b0e1101a2b20edea576e11faf93d"><td class="memSeparator" colspan="2">&#160;</td></tr>
283<tr class="memitem:ga3155b775bfbac9dbba869b95a0367902"><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>
284<tr class="memdesc:ga3155b775bfbac9dbba869b95a0367902"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a new TurboJPEG transformer instance.  <a href="#ga3155b775bfbac9dbba869b95a0367902">More...</a><br/></td></tr>
285<tr class="separator:ga3155b775bfbac9dbba869b95a0367902"><td class="memSeparator" colspan="2">&#160;</td></tr>
286<tr class="memitem:gae403193ceb4aafb7e0f56ab587b48616"><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>
287<tr class="memdesc:gae403193ceb4aafb7e0f56ab587b48616"><td class="mdescLeft">&#160;</td><td class="mdescRight">Losslessly transform a JPEG image into another JPEG image.  <a href="#gae403193ceb4aafb7e0f56ab587b48616">More...</a><br/></td></tr>
288<tr class="separator:gae403193ceb4aafb7e0f56ab587b48616"><td class="memSeparator" colspan="2">&#160;</td></tr>
289<tr class="memitem:ga674adee917b95ad4a896f1ba39e12540"><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>
290<tr class="memdesc:ga674adee917b95ad4a896f1ba39e12540"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroy a TurboJPEG compressor, decompressor, or transformer instance.  <a href="#ga674adee917b95ad4a896f1ba39e12540">More...</a><br/></td></tr>
291<tr class="separator:ga674adee917b95ad4a896f1ba39e12540"><td class="memSeparator" colspan="2">&#160;</td></tr>
292<tr class="memitem:ga5c9234bda6d993cdaffdd89bf81a00ff"><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>
293<tr class="memdesc:ga5c9234bda6d993cdaffdd89bf81a00ff"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocate an image buffer for use with TurboJPEG.  <a href="#ga5c9234bda6d993cdaffdd89bf81a00ff">More...</a><br/></td></tr>
294<tr class="separator:ga5c9234bda6d993cdaffdd89bf81a00ff"><td class="memSeparator" colspan="2">&#160;</td></tr>
295<tr class="memitem:ga8c4a1231dc06a450514c835f6471f137"><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>
296<tr class="memdesc:ga8c4a1231dc06a450514c835f6471f137"><td class="mdescLeft">&#160;</td><td class="mdescRight">Free an image buffer previously allocated by TurboJPEG.  <a href="#ga8c4a1231dc06a450514c835f6471f137">More...</a><br/></td></tr>
297<tr class="separator:ga8c4a1231dc06a450514c835f6471f137"><td class="memSeparator" colspan="2">&#160;</td></tr>
298<tr class="memitem:ga9af79c908ec131b1ae8d52fe40375abf"><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>
299<tr class="memdesc:ga9af79c908ec131b1ae8d52fe40375abf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a descriptive error message explaining why the last command failed.  <a href="#ga9af79c908ec131b1ae8d52fe40375abf">More...</a><br/></td></tr>
300<tr class="separator:ga9af79c908ec131b1ae8d52fe40375abf"><td class="memSeparator" colspan="2">&#160;</td></tr>
301</table><table class="memberdecls">
302<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
303Variables</h2></td></tr>
304<tr class="memitem:ga9e61e7cd47a15a173283ba94e781308c"><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> [<a class="el" href="group___turbo_j_p_e_g.html#ga5ef3d169162ce77ce348e292a0b7477c">TJ_NUMSAMP</a>]</td></tr>
305<tr class="memdesc:ga9e61e7cd47a15a173283ba94e781308c"><td class="mdescLeft">&#160;</td><td class="mdescRight">MCU block width (in pixels) for a given level of chrominance subsampling.  <a href="#ga9e61e7cd47a15a173283ba94e781308c">More...</a><br/></td></tr>
306<tr class="separator:ga9e61e7cd47a15a173283ba94e781308c"><td class="memSeparator" colspan="2">&#160;</td></tr>
307<tr class="memitem:gabd247bb9fecb393eca57366feb8327bf"><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> [<a class="el" href="group___turbo_j_p_e_g.html#ga5ef3d169162ce77ce348e292a0b7477c">TJ_NUMSAMP</a>]</td></tr>
308<tr class="memdesc:gabd247bb9fecb393eca57366feb8327bf"><td class="mdescLeft">&#160;</td><td class="mdescRight">MCU block height (in pixels) for a given level of chrominance subsampling.  <a href="#gabd247bb9fecb393eca57366feb8327bf">More...</a><br/></td></tr>
309<tr class="separator:gabd247bb9fecb393eca57366feb8327bf"><td class="memSeparator" colspan="2">&#160;</td></tr>
310<tr class="memitem:gadd9b446742ac8a3923f7992c7988fea8"><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> [<a class="el" href="group___turbo_j_p_e_g.html#ga7010a4402f54a45ba822ad8675a4655e">TJ_NUMPF</a>]</td></tr>
311<tr class="memdesc:gadd9b446742ac8a3923f7992c7988fea8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Red offset (in bytes) for a given pixel format.  <a href="#gadd9b446742ac8a3923f7992c7988fea8">More...</a><br/></td></tr>
312<tr class="separator:gadd9b446742ac8a3923f7992c7988fea8"><td class="memSeparator" colspan="2">&#160;</td></tr>
313<tr class="memitem:ga82d6e35da441112a411da41923c0ba2f"><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> [<a class="el" href="group___turbo_j_p_e_g.html#ga7010a4402f54a45ba822ad8675a4655e">TJ_NUMPF</a>]</td></tr>
314<tr class="memdesc:ga82d6e35da441112a411da41923c0ba2f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Green offset (in bytes) for a given pixel format.  <a href="#ga82d6e35da441112a411da41923c0ba2f">More...</a><br/></td></tr>
315<tr class="separator:ga82d6e35da441112a411da41923c0ba2f"><td class="memSeparator" colspan="2">&#160;</td></tr>
316<tr class="memitem:ga84e2e35d3f08025f976ec1ec53693dea"><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> [<a class="el" href="group___turbo_j_p_e_g.html#ga7010a4402f54a45ba822ad8675a4655e">TJ_NUMPF</a>]</td></tr>
317<tr class="memdesc:ga84e2e35d3f08025f976ec1ec53693dea"><td class="mdescLeft">&#160;</td><td class="mdescRight">Blue offset (in bytes) for a given pixel format.  <a href="#ga84e2e35d3f08025f976ec1ec53693dea">More...</a><br/></td></tr>
318<tr class="separator:ga84e2e35d3f08025f976ec1ec53693dea"><td class="memSeparator" colspan="2">&#160;</td></tr>
319<tr class="memitem:gad77cf8fe5b2bfd3cb3f53098146abb4c"><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> [<a class="el" href="group___turbo_j_p_e_g.html#ga7010a4402f54a45ba822ad8675a4655e">TJ_NUMPF</a>]</td></tr>
320<tr class="memdesc:gad77cf8fe5b2bfd3cb3f53098146abb4c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pixel size (in bytes) for a given pixel format.  <a href="#gad77cf8fe5b2bfd3cb3f53098146abb4c">More...</a><br/></td></tr>
321<tr class="separator:gad77cf8fe5b2bfd3cb3f53098146abb4c"><td class="memSeparator" colspan="2">&#160;</td></tr>
322</table>
323<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
324<p>TurboJPEG API. </p>
325<p>This API provides an interface for generating, decoding, and transforming planar YUV and JPEG images in memory.</p>
326<p><a class="anchor" id="YUVnotes"></a></p>
327<h2>YUV Image Format Notes</h2>
328<p>Technically, the JPEG format uses the YCbCr colorspace (which is technically not a colorspace but a color transform), but per the convention of the digital video community, the TurboJPEG API uses "YUV" to refer to an image format consisting of Y, Cb, and Cr image planes.</p>
329<p>Each plane is simply a 2D array of bytes, each byte representing the value of one of the components (Y, Cb, or Cr) at a particular location in the image. The width and height of each plane are determined by the image width, height, and level of chrominance subsampling. The luminance plane width is the image width padded to the nearest multiple of the horizontal subsampling factor (2 in the case of 4:2:0 and 4:2:2, 4 in the case of 4:1:1, 1 in the case of 4:4:4 or grayscale.) Similarly, the luminance plane height is the image height padded to the nearest multiple of the vertical subsampling factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4 or grayscale.) This is irrespective of any additional padding that may be specified as an argument to the various YUV functions. The chrominance plane width is equal to the luminance plane width divided by the horizontal subsampling factor, and the chrominance plane height is equal to the luminance plane height divided by the vertical subsampling factor.</p>
330<p>For example, if the source image is 35 x 35 pixels and 4:2:2 subsampling is used, then the luminance plane would be 36 x 35 bytes, and each of the chrominance planes would be 18 x 35 bytes. If you specify a line padding of 4 bytes on top of this, then the luminance plane would be 36 x 35 bytes, and each of the chrominance planes would be 20 x 35 bytes. </p>
331<h2 class="groupheader">Macro Definition Documentation</h2>
332<a class="anchor" id="ga39f57a6fb02d9cf32e7b6890099b5a71"></a>
333<div class="memitem">
334<div class="memproto">
335      <table class="memname">
336        <tr>
337          <td class="memname">#define TJ_NUMCS</td>
338        </tr>
339      </table>
340</div><div class="memdoc">
341
342<p>The number of JPEG colorspaces. </p>
343
344</div>
345</div>
346<a class="anchor" id="ga7010a4402f54a45ba822ad8675a4655e"></a>
347<div class="memitem">
348<div class="memproto">
349      <table class="memname">
350        <tr>
351          <td class="memname">#define TJ_NUMPF</td>
352        </tr>
353      </table>
354</div><div class="memdoc">
355
356<p>The number of pixel formats. </p>
357
358</div>
359</div>
360<a class="anchor" id="ga5ef3d169162ce77ce348e292a0b7477c"></a>
361<div class="memitem">
362<div class="memproto">
363      <table class="memname">
364        <tr>
365          <td class="memname">#define TJ_NUMSAMP</td>
366        </tr>
367      </table>
368</div><div class="memdoc">
369
370<p>The number of chrominance subsampling options. </p>
371
372</div>
373</div>
374<a class="anchor" id="ga0f6dbd18adf38b7d46ac547f0f4d562c"></a>
375<div class="memitem">
376<div class="memproto">
377      <table class="memname">
378        <tr>
379          <td class="memname">#define TJ_NUMXOP</td>
380        </tr>
381      </table>
382</div><div class="memdoc">
383
384<p>The number of transform operations. </p>
385
386</div>
387</div>
388<a class="anchor" id="gacb233cfd722d66d1ccbf48a7de81f0e0"></a>
389<div class="memitem">
390<div class="memproto">
391      <table class="memname">
392        <tr>
393          <td class="memname">#define TJFLAG_ACCURATEDCT</td>
394        </tr>
395      </table>
396</div><div class="memdoc">
397
398<p>Use the most accurate DCT/IDCT algorithm available in the underlying codec. </p>
399<p>The default if this flag is not specified is implementation-specific. For example, the implementation of TurboJPEG for libjpeg[-turbo] uses the fast algorithm by default when compressing, because this has been shown to have only a very slight effect on accuracy, but it uses the accurate algorithm when decompressing, because this has been shown to have a larger effect. </p>
400
401</div>
402</div>
403<a class="anchor" id="ga72ecf4ebe6eb702d3c6f5ca27455e1ec"></a>
404<div class="memitem">
405<div class="memproto">
406      <table class="memname">
407        <tr>
408          <td class="memname">#define TJFLAG_BOTTOMUP</td>
409        </tr>
410      </table>
411</div><div class="memdoc">
412
413<p>The uncompressed source/destination image is stored in bottom-up (Windows, OpenGL) order, not top-down (X11) order. </p>
414
415</div>
416</div>
417<a class="anchor" id="gaabce235db80d3f698b27f36cbd453da2"></a>
418<div class="memitem">
419<div class="memproto">
420      <table class="memname">
421        <tr>
422          <td class="memname">#define TJFLAG_FASTDCT</td>
423        </tr>
424      </table>
425</div><div class="memdoc">
426
427<p>Use the fastest DCT/IDCT algorithm available in the underlying codec. </p>
428<p>The default if this flag is not specified is implementation-specific. For example, the implementation of TurboJPEG for libjpeg[-turbo] uses the fast algorithm by default when compressing, because this has been shown to have only a very slight effect on accuracy, but it uses the accurate algorithm when decompressing, because this has been shown to have a larger effect. </p>
429
430</div>
431</div>
432<a class="anchor" id="ga4ee4506c81177a06f77e2504a22efd2d"></a>
433<div class="memitem">
434<div class="memproto">
435      <table class="memname">
436        <tr>
437          <td class="memname">#define TJFLAG_FASTUPSAMPLE</td>
438        </tr>
439      </table>
440</div><div class="memdoc">
441
442<p>When decompressing an image that was compressed using chrominance subsampling, use the fastest chrominance upsampling algorithm available in the underlying codec. </p>
443<p>The default is to use smooth upsampling, which creates a smooth transition between neighboring chrominance components in order to reduce upsampling artifacts in the decompressed image. </p>
444
445</div>
446</div>
447<a class="anchor" id="ga8808d403c68b62aaa58a4c1e58e98963"></a>
448<div class="memitem">
449<div class="memproto">
450      <table class="memname">
451        <tr>
452          <td class="memname">#define TJFLAG_NOREALLOC</td>
453        </tr>
454      </table>
455</div><div class="memdoc">
456
457<p>Disable buffer (re)allocation. </p>
458<p>If passed to <a class="el" href="group___turbo_j_p_e_g.html#gaba62b7a98f960839b588579898495cf2" title="Compress an RGB, grayscale, or CMYK 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>
459
460</div>
461</div>
462<a class="anchor" id="ga0aba955473315e405295d978f0c16511"></a>
463<div class="memitem">
464<div class="memproto">
465      <table class="memname">
466        <tr>
467          <td class="memname">#define TJPAD</td>
468          <td>(</td>
469          <td class="paramtype">&#160;</td>
470          <td class="paramname">width</td><td>)</td>
471          <td></td>
472        </tr>
473      </table>
474</div><div class="memdoc">
475
476<p>Pad the given width to the nearest 32-bit boundary. </p>
477
478</div>
479</div>
480<a class="anchor" id="ga84878bb65404204743aa18cac02781df"></a>
481<div class="memitem">
482<div class="memproto">
483      <table class="memname">
484        <tr>
485          <td class="memname">#define TJSCALED</td>
486          <td>(</td>
487          <td class="paramtype">&#160;</td>
488          <td class="paramname">dimension, </td>
489        </tr>
490        <tr>
491          <td class="paramkey"></td>
492          <td></td>
493          <td class="paramtype">&#160;</td>
494          <td class="paramname">scalingFactor&#160;</td>
495        </tr>
496        <tr>
497          <td></td>
498          <td>)</td>
499          <td></td><td></td>
500        </tr>
501      </table>
502</div><div class="memdoc">
503
504<p>Compute the scaled value of <code>dimension</code> using the given scaling factor. </p>
505<p>This macro performs the integer equivalent of <code>ceil(dimension * scalingFactor)</code>. </p>
506
507</div>
508</div>
509<a class="anchor" id="ga9c771a757fc1294add611906b89ab2d2"></a>
510<div class="memitem">
511<div class="memproto">
512      <table class="memname">
513        <tr>
514          <td class="memname">#define TJXOPT_CROP</td>
515        </tr>
516      </table>
517</div><div class="memdoc">
518
519<p>This option will enable lossless cropping. </p>
520<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>
521
522</div>
523</div>
524<a class="anchor" id="ga3acee7b48ade1b99e5588736007c2589"></a>
525<div class="memitem">
526<div class="memproto">
527      <table class="memname">
528        <tr>
529          <td class="memname">#define TJXOPT_GRAY</td>
530        </tr>
531      </table>
532</div><div class="memdoc">
533
534<p>This option will discard the color data in the input image and produce a grayscale output image. </p>
535
536</div>
537</div>
538<a class="anchor" id="gafbf992bbf6e006705886333703ffab31"></a>
539<div class="memitem">
540<div class="memproto">
541      <table class="memname">
542        <tr>
543          <td class="memname">#define TJXOPT_NOOUTPUT</td>
544        </tr>
545      </table>
546</div><div class="memdoc">
547
548<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>
549
550</div>
551</div>
552<a class="anchor" id="ga50e03cb5ed115330e212417429600b00"></a>
553<div class="memitem">
554<div class="memproto">
555      <table class="memname">
556        <tr>
557          <td class="memname">#define TJXOPT_PERFECT</td>
558        </tr>
559      </table>
560</div><div class="memdoc">
561
562<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>
563<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>
564
565</div>
566</div>
567<a class="anchor" id="ga319826b7eb1583c0595bbe7b95428709"></a>
568<div class="memitem">
569<div class="memproto">
570      <table class="memname">
571        <tr>
572          <td class="memname">#define TJXOPT_TRIM</td>
573        </tr>
574      </table>
575</div><div class="memdoc">
576
577<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>
578
579</div>
580</div>
581<h2 class="groupheader">Typedef Documentation</h2>
582<a class="anchor" id="ga758d2634ecb4949de7815cba621f5763"></a>
583<div class="memitem">
584<div class="memproto">
585      <table class="memname">
586        <tr>
587          <td class="memname">typedef void* <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a></td>
588        </tr>
589      </table>
590</div><div class="memdoc">
591
592<p>TurboJPEG instance handle. </p>
593
594</div>
595</div>
596<a class="anchor" id="gaa29f3189c41be12ec5dee7caec318a31"></a>
597<div class="memitem">
598<div class="memproto">
599      <table class="memname">
600        <tr>
601          <td class="memname">typedef struct <a class="el" href="structtjtransform.html">tjtransform</a>  <a class="el" href="structtjtransform.html">tjtransform</a></td>
602        </tr>
603      </table>
604</div><div class="memdoc">
605
606<p>Lossless transform. </p>
607
608</div>
609</div>
610<h2 class="groupheader">Enumeration Type Documentation</h2>
611<a class="anchor" id="ga4f83ad3368e0e29d1957be0efa7c3720"></a>
612<div class="memitem">
613<div class="memproto">
614      <table class="memname">
615        <tr>
616          <td class="memname">enum <a class="el" href="group___turbo_j_p_e_g.html#ga4f83ad3368e0e29d1957be0efa7c3720">TJCS</a></td>
617        </tr>
618      </table>
619</div><div class="memdoc">
620
621<p>JPEG colorspaces. </p>
622<table class="fieldtable">
623<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><em><a class="anchor" id="gga4f83ad3368e0e29d1957be0efa7c3720a677cb7ccb85c4038ac41964a2e09e555"></a>TJCS_RGB</em>&nbsp;</td><td class="fielddoc">
624<p>RGB colorspace. </p>
625<p>When compressing the JPEG image, the R, G, and B components in the source image are reordered into image planes, but no colorspace conversion or subsampling is performed. RGB JPEG images can be decompressed to any of the extended RGB pixel formats or grayscale, but they cannot be decompressed to YUV images. </p>
626</td></tr>
627<tr><td class="fieldname"><em><a class="anchor" id="gga4f83ad3368e0e29d1957be0efa7c3720a7389b8f65bb387ffedce3efd0d78ec75"></a>TJCS_YCbCr</em>&nbsp;</td><td class="fielddoc">
628<p>YCbCr colorspace. </p>
629<p>YCbCr is not an absolute colorspace but rather a mathematical transformation of RGB designed solely for storage and transmission. YCbCr images must be converted to RGB before they can actually be displayed. In the YCbCr colorspace, the Y (luminance) component represents the black &amp; white portion of the original image, and the Cb and Cr (chrominance) components represent the color portion of the original image. Originally, the analog equivalent of this transformation allowed the same signal to drive both black &amp; white and color televisions, but JPEG images use YCbCr primarily because it allows the color data to be optionally subsampled for the purposes of reducing bandwidth or disk space. YCbCr is the most common JPEG colorspace, and YCbCr JPEG images can be compressed from and decompressed to any of the extended RGB pixel formats or grayscale, or they can be decompressed to YUV planar images. </p>
630</td></tr>
631<tr><td class="fieldname"><em><a class="anchor" id="gga4f83ad3368e0e29d1957be0efa7c3720ab3e7d6a87f695e45b81c1b5262b5a50a"></a>TJCS_GRAY</em>&nbsp;</td><td class="fielddoc">
632<p>Grayscale colorspace. </p>
633<p>The JPEG image retains only the luminance data (Y component), and any color data from the source image is discarded. Grayscale JPEG images can be compressed from and decompressed to any of the extended RGB pixel formats or grayscale, or they can be decompressed to YUV planar images. </p>
634</td></tr>
635<tr><td class="fieldname"><em><a class="anchor" id="gga4f83ad3368e0e29d1957be0efa7c3720a6c8b636152ac8195b869587db315ee53"></a>TJCS_CMYK</em>&nbsp;</td><td class="fielddoc">
636<p>CMYK colorspace. </p>
637<p>When compressing the JPEG image, the C, M, Y, and K components in the source image are reordered into image planes, but no colorspace conversion or subsampling is performed. CMYK JPEG images can only be decompressed to CMYK pixels. </p>
638</td></tr>
639<tr><td class="fieldname"><em><a class="anchor" id="gga4f83ad3368e0e29d1957be0efa7c3720a53839e0fe867b76b58d16b0a1a7c598e"></a>TJCS_YCCK</em>&nbsp;</td><td class="fielddoc">
640<p>YCCK colorspace. </p>
641<p>YCCK (AKA "YCbCrK") is not an absolute colorspace but rather a mathematical transformation of CMYK designed solely for storage and transmission. It is to CMYK as YCbCr is to RGB. CMYK pixels can be reversibly transformed into YCCK, and as with YCbCr, the chrominance components in the YCCK pixels can be subsampled without incurring major perceptual loss. YCCK JPEG images can only be compressed from and decompressed to CMYK pixels. </p>
642</td></tr>
643</table>
644
645</div>
646</div>
647<a class="anchor" id="gac916144e26c3817ac514e64ae5d12e2a"></a>
648<div class="memitem">
649<div class="memproto">
650      <table class="memname">
651        <tr>
652          <td class="memname">enum <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">TJPF</a></td>
653        </tr>
654      </table>
655</div><div class="memdoc">
656
657<p>Pixel formats. </p>
658<table class="fieldtable">
659<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa7ce93230bff449518ce387c17e6ed37c"></a>TJPF_RGB</em>&nbsp;</td><td class="fielddoc">
660<p>RGB pixel format. </p>
661<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>
662</td></tr>
663<tr><td class="fieldname"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aab10624437fb8ef495a0b153e65749839"></a>TJPF_BGR</em>&nbsp;</td><td class="fielddoc">
664<p>BGR pixel format. </p>
665<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>
666</td></tr>
667<tr><td class="fieldname"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01"></a>TJPF_RGBX</em>&nbsp;</td><td class="fielddoc">
668<p>RGBX pixel format. </p>
669<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. The X component is ignored when compressing and undefined when decompressing. </p>
670</td></tr>
671<tr><td class="fieldname"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa2a1fbf569ca79897eae886e3376ca4c8"></a>TJPF_BGRX</em>&nbsp;</td><td class="fielddoc">
672<p>BGRX pixel format. </p>
673<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. The X component is ignored when compressing and undefined when decompressing. </p>
674</td></tr>
675<tr><td class="fieldname"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af"></a>TJPF_XBGR</em>&nbsp;</td><td class="fielddoc">
676<p>XBGR pixel format. </p>
677<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. The X component is ignored when compressing and undefined when decompressing. </p>
678</td></tr>
679<tr><td class="fieldname"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84"></a>TJPF_XRGB</em>&nbsp;</td><td class="fielddoc">
680<p>XRGB pixel format. </p>
681<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. The X component is ignored when compressing and undefined when decompressing. </p>
682</td></tr>
683<tr><td class="fieldname"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a"></a>TJPF_GRAY</em>&nbsp;</td><td class="fielddoc">
684<p>Grayscale pixel format. </p>
685<p>Each 1-byte pixel represents a luminance (brightness) level from 0 to 255. </p>
686</td></tr>
687<tr><td class="fieldname"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa88d2e88fab67f6503cf972e14851cc12"></a>TJPF_RGBA</em>&nbsp;</td><td class="fielddoc">
688<p>RGBA pixel format. </p>
689<p>This is the same as <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01">TJPF_RGBX</a>, except that when decompressing, the X component is guaranteed to be 0xFF, which can be interpreted as an opaque alpha channel. </p>
690</td></tr>
691<tr><td class="fieldname"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aac037ff1845cf9b74bb81a3659c2b9fb4"></a>TJPF_BGRA</em>&nbsp;</td><td class="fielddoc">
692<p>BGRA pixel format. </p>
693<p>This is the same as <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa2a1fbf569ca79897eae886e3376ca4c8">TJPF_BGRX</a>, except that when decompressing, the X component is guaranteed to be 0xFF, which can be interpreted as an opaque alpha channel. </p>
694</td></tr>
695<tr><td class="fieldname"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa1ba1a7f1631dbeaa49a0a85fc4a40081"></a>TJPF_ABGR</em>&nbsp;</td><td class="fielddoc">
696<p>ABGR pixel format. </p>
697<p>This is the same as <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af">TJPF_XBGR</a>, except that when decompressing, the X component is guaranteed to be 0xFF, which can be interpreted as an opaque alpha channel. </p>
698</td></tr>
699<tr><td class="fieldname"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aae8f846ed9d9de99b6e1dfe448848765c"></a>TJPF_ARGB</em>&nbsp;</td><td class="fielddoc">
700<p>ARGB pixel format. </p>
701<p>This is the same as <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84">TJPF_XRGB</a>, except that when decompressing, the X component is guaranteed to be 0xFF, which can be interpreted as an opaque alpha channel. </p>
702</td></tr>
703<tr><td class="fieldname"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa7f5100ec44c91994e243f1cf55553f8b"></a>TJPF_CMYK</em>&nbsp;</td><td class="fielddoc">
704<p>CMYK pixel format. </p>
705<p>Unlike RGB, which is an additive color model used primarily for display, CMYK (Cyan/Magenta/Yellow/Key) is a subtractive color model used primarily for printing. In the CMYK color model, the value of each color component typically corresponds to an amount of cyan, magenta, yellow, or black ink that is applied to a white background. In order to convert between CMYK and RGB, it is necessary to use a color management system (CMS.) A CMS will attempt to map colors within the printer's gamut to perceptually similar colors in the display's gamut and vice versa, but the mapping is typically not 1:1 or reversible, nor can it be defined with a simple formula. Thus, such a conversion is out of scope for a codec library. However, the TurboJPEG API allows for compressing CMYK pixels into a YCCK JPEG image (see <a class="el" href="group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a53839e0fe867b76b58d16b0a1a7c598e" title="YCCK colorspace.">TJCS_YCCK</a>) and decompressing YCCK JPEG images into CMYK pixels. </p>
706</td></tr>
707</table>
708
709</div>
710</div>
711<a class="anchor" id="ga1d047060ea80bb9820d540bb928e9074"></a>
712<div class="memitem">
713<div class="memproto">
714      <table class="memname">
715        <tr>
716          <td class="memname">enum <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">TJSAMP</a></td>
717        </tr>
718      </table>
719</div><div class="memdoc">
720
721<p>Chrominance subsampling options. </p>
722<p>When pixels are converted from RGB to YCbCr (see <a class="el" href="group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a7389b8f65bb387ffedce3efd0d78ec75" title="YCbCr colorspace.">TJCS_YCbCr</a>) or from CMYK to YCCK (see <a class="el" href="group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a53839e0fe867b76b58d16b0a1a7c598e" title="YCCK colorspace.">TJCS_YCCK</a>) 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 to small changes in color.) This is called "chrominance subsampling". </p>
723<table class="fieldtable">
724<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074afb8da4f44197837bdec0a4f593dacae3"></a>TJSAMP_444</em>&nbsp;</td><td class="fielddoc">
725<p>4:4:4 chrominance subsampling (no chrominance subsampling). </p>
726<p>The JPEG or YUV image will contain one chrominance component for every pixel in the source image. </p>
727</td></tr>
728<tr><td class="fieldname"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074a136130902cc578f11f32429b59368404"></a>TJSAMP_422</em>&nbsp;</td><td class="fielddoc">
729<p>4:2:2 chrominance subsampling. </p>
730<p>The JPEG or YUV image will contain one chrominance component for every 2x1 block of pixels in the source image. </p>
731</td></tr>
732<tr><td class="fieldname"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074a63085dbf683cfe39e513cdb6343e3737"></a>TJSAMP_420</em>&nbsp;</td><td class="fielddoc">
733<p>4:2:0 chrominance subsampling. </p>
734<p>The JPEG or YUV image will contain one chrominance component for every 2x2 block of pixels in the source image. </p>
735</td></tr>
736<tr><td class="fieldname"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074a3f1c9504842ddc7a48d0f690754b6248"></a>TJSAMP_GRAY</em>&nbsp;</td><td class="fielddoc">
737<p>Grayscale. </p>
738<p>The JPEG or YUV image will contain no chrominance components. </p>
739</td></tr>
740<tr><td class="fieldname"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074accf740e6f3aa6ba20ba922cad13cb974"></a>TJSAMP_440</em>&nbsp;</td><td class="fielddoc">
741<p>4:4:0 chrominance subsampling. </p>
742<p>The JPEG or YUV image will contain one chrominance component for every 1x2 block of pixels in the source image.</p>
743<dl class="section note"><dt>Note</dt><dd>4:4:0 subsampling is not fully accelerated in libjpeg-turbo. </dd></dl>
744</td></tr>
745<tr><td class="fieldname"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074a28ec62575e5ea295c3fde3001dc628e2"></a>TJSAMP_411</em>&nbsp;</td><td class="fielddoc">
746<p>4:1:1 chrominance subsampling. </p>
747<p>The JPEG or YUV image will contain one chrominance component for every 4x1 block of pixels in the source image. JPEG images compressed with 4:1:1 subsampling will be almost exactly the same size as those compressed with 4:2:0 subsampling, and in the aggregate, both subsampling methods produce approximately the same perceptual quality. However, 4:1:1 is better able to reproduce sharp horizontal features.</p>
748<dl class="section note"><dt>Note</dt><dd>4:1:1 subsampling is not fully accelerated in libjpeg-turbo. </dd></dl>
749</td></tr>
750</table>
751
752</div>
753</div>
754<a class="anchor" id="ga2de531af4e7e6c4f124908376b354866"></a>
755<div class="memitem">
756<div class="memproto">
757      <table class="memname">
758        <tr>
759          <td class="memname">enum <a class="el" href="group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866">TJXOP</a></td>
760        </tr>
761      </table>
762</div><div class="memdoc">
763
764<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>
765<table class="fieldtable">
766<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866aad88c0366cd3f7d0eac9d7a3fa1c2c27"></a>TJXOP_NONE</em>&nbsp;</td><td class="fielddoc">
767<p>Do not transform the position of the image pixels. </p>
768</td></tr>
769<tr><td class="fieldname"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866aa0df69776caa30f0fa28e26332d311ce"></a>TJXOP_HFLIP</em>&nbsp;</td><td class="fielddoc">
770<p>Flip (mirror) image horizontally. </p>
771<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>
772</td></tr>
773<tr><td class="fieldname"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866a324eddfbec53b7e691f61e56929d0d5d"></a>TJXOP_VFLIP</em>&nbsp;</td><td class="fielddoc">
774<p>Flip (mirror) image vertically. </p>
775<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>
776</td></tr>
777<tr><td class="fieldname"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866a31060aed199f886afdd417f80499c32d"></a>TJXOP_TRANSPOSE</em>&nbsp;</td><td class="fielddoc">
778<p>Transpose image (flip/mirror along upper left to lower right axis.) This transform is always perfect. </p>
779</td></tr>
780<tr><td class="fieldname"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866af3b14d488aea6ece9e5b3df73a74d6a4"></a>TJXOP_TRANSVERSE</em>&nbsp;</td><td class="fielddoc">
781<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>
782</td></tr>
783<tr><td class="fieldname"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866a43b2bbb23bc4bd548422d43fbe9af128"></a>TJXOP_ROT90</em>&nbsp;</td><td class="fielddoc">
784<p>Rotate image clockwise by 90 degrees. </p>
785<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>
786</td></tr>
787<tr><td class="fieldname"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866a140952eb8dd0300accfcc22726d69692"></a>TJXOP_ROT180</em>&nbsp;</td><td class="fielddoc">
788<p>Rotate image 180 degrees. </p>
789<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>
790</td></tr>
791<tr><td class="fieldname"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866a3064ee5dfb7f032df332818587567a08"></a>TJXOP_ROT270</em>&nbsp;</td><td class="fielddoc">
792<p>Rotate image counter-clockwise by 90 degrees. </p>
793<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>
794</td></tr>
795</table>
796
797</div>
798</div>
799<h2 class="groupheader">Function Documentation</h2>
800<a class="anchor" id="ga5c9234bda6d993cdaffdd89bf81a00ff"></a>
801<div class="memitem">
802<div class="memproto">
803      <table class="memname">
804        <tr>
805          <td class="memname">DLLEXPORT unsigned char* DLLCALL tjAlloc </td>
806          <td>(</td>
807          <td class="paramtype">int&#160;</td>
808          <td class="paramname"><em>bytes</em></td><td>)</td>
809          <td></td>
810        </tr>
811      </table>
812</div><div class="memdoc">
813
814<p>Allocate an image buffer for use with TurboJPEG. </p>
815<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, grayscale, or CMYK 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>
816<dl class="params"><dt>Parameters</dt><dd>
817  <table class="params">
818    <tr><td class="paramname">bytes</td><td>the number of bytes to allocate</td></tr>
819  </table>
820  </dd>
821</dl>
822<dl class="section return"><dt>Returns</dt><dd>a pointer to a newly-allocated buffer with the specified number of bytes.</dd></dl>
823<dl class="section see"><dt>See Also</dt><dd><a class="el" href="group___turbo_j_p_e_g.html#ga8c4a1231dc06a450514c835f6471f137" title="Free an image buffer previously allocated by TurboJPEG.">tjFree()</a> </dd></dl>
824
825</div>
826</div>
827<a class="anchor" id="gaccc5bca7f12fcdcc302e6e1c6d4b311b"></a>
828<div class="memitem">
829<div class="memproto">
830      <table class="memname">
831        <tr>
832          <td class="memname">DLLEXPORT unsigned long DLLCALL tjBufSize </td>
833          <td>(</td>
834          <td class="paramtype">int&#160;</td>
835          <td class="paramname"><em>width</em>, </td>
836        </tr>
837        <tr>
838          <td class="paramkey"></td>
839          <td></td>
840          <td class="paramtype">int&#160;</td>
841          <td class="paramname"><em>height</em>, </td>
842        </tr>
843        <tr>
844          <td class="paramkey"></td>
845          <td></td>
846          <td class="paramtype">int&#160;</td>
847          <td class="paramname"><em>jpegSubsamp</em>&#160;</td>
848        </tr>
849        <tr>
850          <td></td>
851          <td>)</td>
852          <td></td><td></td>
853        </tr>
854      </table>
855</div><div class="memdoc">
856
857<p>The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters. </p>
858<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>
859<dl class="params"><dt>Parameters</dt><dd>
860  <table class="params">
861    <tr><td class="paramname">width</td><td>width (in pixels) of the image</td></tr>
862    <tr><td class="paramname">height</td><td>height (in pixels) of the image</td></tr>
863    <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>
864  </table>
865  </dd>
866</dl>
867<dl class="section return"><dt>Returns</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>
868
869</div>
870</div>
871<a class="anchor" id="gaf451664a62c1f6c7cc5a6401f32908c9"></a>
872<div class="memitem">
873<div class="memproto">
874      <table class="memname">
875        <tr>
876          <td class="memname">DLLEXPORT unsigned long DLLCALL tjBufSizeYUV2 </td>
877          <td>(</td>
878          <td class="paramtype">int&#160;</td>
879          <td class="paramname"><em>width</em>, </td>
880        </tr>
881        <tr>
882          <td class="paramkey"></td>
883          <td></td>
884          <td class="paramtype">int&#160;</td>
885          <td class="paramname"><em>pad</em>, </td>
886        </tr>
887        <tr>
888          <td class="paramkey"></td>
889          <td></td>
890          <td class="paramtype">int&#160;</td>
891          <td class="paramname"><em>height</em>, </td>
892        </tr>
893        <tr>
894          <td class="paramkey"></td>
895          <td></td>
896          <td class="paramtype">int&#160;</td>
897          <td class="paramname"><em>subsamp</em>&#160;</td>
898        </tr>
899        <tr>
900          <td></td>
901          <td>)</td>
902          <td></td><td></td>
903        </tr>
904      </table>
905</div><div class="memdoc">
906
907<p>The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters. </p>
908<dl class="params"><dt>Parameters</dt><dd>
909  <table class="params">
910    <tr><td class="paramname">width</td><td>width (in pixels) of the image</td></tr>
911    <tr><td class="paramname">pad</td><td>the width of each line in each plane of the image is padded to the nearest multiple of this number of bytes (must be a power of 2.)</td></tr>
912    <tr><td class="paramname">height</td><td>height (in pixels) of the image</td></tr>
913    <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>
914  </table>
915  </dd>
916</dl>
917<dl class="section return"><dt>Returns</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>
918
919</div>
920</div>
921<a class="anchor" id="gaba62b7a98f960839b588579898495cf2"></a>
922<div class="memitem">
923<div class="memproto">
924      <table class="memname">
925        <tr>
926          <td class="memname">DLLEXPORT int DLLCALL tjCompress2 </td>
927          <td>(</td>
928          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
929          <td class="paramname"><em>handle</em>, </td>
930        </tr>
931        <tr>
932          <td class="paramkey"></td>
933          <td></td>
934          <td class="paramtype">unsigned char *&#160;</td>
935          <td class="paramname"><em>srcBuf</em>, </td>
936        </tr>
937        <tr>
938          <td class="paramkey"></td>
939          <td></td>
940          <td class="paramtype">int&#160;</td>
941          <td class="paramname"><em>width</em>, </td>
942        </tr>
943        <tr>
944          <td class="paramkey"></td>
945          <td></td>
946          <td class="paramtype">int&#160;</td>
947          <td class="paramname"><em>pitch</em>, </td>
948        </tr>
949        <tr>
950          <td class="paramkey"></td>
951          <td></td>
952          <td class="paramtype">int&#160;</td>
953          <td class="paramname"><em>height</em>, </td>
954        </tr>
955        <tr>
956          <td class="paramkey"></td>
957          <td></td>
958          <td class="paramtype">int&#160;</td>
959          <td class="paramname"><em>pixelFormat</em>, </td>
960        </tr>
961        <tr>
962          <td class="paramkey"></td>
963          <td></td>
964          <td class="paramtype">unsigned char **&#160;</td>
965          <td class="paramname"><em>jpegBuf</em>, </td>
966        </tr>
967        <tr>
968          <td class="paramkey"></td>
969          <td></td>
970          <td class="paramtype">unsigned long *&#160;</td>
971          <td class="paramname"><em>jpegSize</em>, </td>
972        </tr>
973        <tr>
974          <td class="paramkey"></td>
975          <td></td>
976          <td class="paramtype">int&#160;</td>
977          <td class="paramname"><em>jpegSubsamp</em>, </td>
978        </tr>
979        <tr>
980          <td class="paramkey"></td>
981          <td></td>
982          <td class="paramtype">int&#160;</td>
983          <td class="paramname"><em>jpegQual</em>, </td>
984        </tr>
985        <tr>
986          <td class="paramkey"></td>
987          <td></td>
988          <td class="paramtype">int&#160;</td>
989          <td class="paramname"><em>flags</em>&#160;</td>
990        </tr>
991        <tr>
992          <td></td>
993          <td>)</td>
994          <td></td><td></td>
995        </tr>
996      </table>
997</div><div class="memdoc">
998
999<p>Compress an RGB, grayscale, or CMYK image into a JPEG image. </p>
1000<dl class="params"><dt>Parameters</dt><dd>
1001  <table class="params">
1002    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance</td></tr>
1003    <tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing RGB, grayscale, or CMYK pixels to be compressed. This buffer is not modified.</td></tr>
1004    <tr><td class="paramname">width</td><td>width (in pixels) of the source image</td></tr>
1005    <tr><td class="paramname">pitch</td><td>bytes per line in the source image. Normally, this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
1006    <tr><td class="paramname">height</td><td>height (in pixels) of the source image</td></tr>
1007    <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>
1008    <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">
1009<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>
1010<li>set <code>*jpegBuf</code> to NULL to tell TurboJPEG to allocate the buffer for you, or</li>
1011<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>
1012</ol>
1013If 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>
1014    <tr><td class="paramname">jpegSize</td><td>pointer to an unsigned long variable that holds the size of the JPEG image buffer. If <code>*jpegBuf</code> points to a pre-allocated buffer, then <code>*jpegSize</code> should be set to the size of the buffer. Upon return, <code>*jpegSize</code> will contain the size of the JPEG image (in bytes.) If <code>*jpegBuf</code> points to a JPEG image buffer that is being reused from a previous call to one of the JPEG compression functions, then <code>*jpegSize</code> is ignored.</td></tr>
1015    <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>
1016    <tr><td class="paramname">jpegQual</td><td>the image quality of the generated JPEG image (1 = worst, 100 = best)</td></tr>
1017    <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>
1018  </table>
1019  </dd>
1020</dl>
1021<dl class="section return"><dt>Returns</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>
1022
1023</div>
1024</div>
1025<a class="anchor" id="ga0b931126c7a615ddc3bbd0cca6698d67"></a>
1026<div class="memitem">
1027<div class="memproto">
1028      <table class="memname">
1029        <tr>
1030          <td class="memname">DLLEXPORT int DLLCALL tjCompressFromYUV </td>
1031          <td>(</td>
1032          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1033          <td class="paramname"><em>handle</em>, </td>
1034        </tr>
1035        <tr>
1036          <td class="paramkey"></td>
1037          <td></td>
1038          <td class="paramtype">unsigned char *&#160;</td>
1039          <td class="paramname"><em>srcBuf</em>, </td>
1040        </tr>
1041        <tr>
1042          <td class="paramkey"></td>
1043          <td></td>
1044          <td class="paramtype">int&#160;</td>
1045          <td class="paramname"><em>width</em>, </td>
1046        </tr>
1047        <tr>
1048          <td class="paramkey"></td>
1049          <td></td>
1050          <td class="paramtype">int&#160;</td>
1051          <td class="paramname"><em>pad</em>, </td>
1052        </tr>
1053        <tr>
1054          <td class="paramkey"></td>
1055          <td></td>
1056          <td class="paramtype">int&#160;</td>
1057          <td class="paramname"><em>height</em>, </td>
1058        </tr>
1059        <tr>
1060          <td class="paramkey"></td>
1061          <td></td>
1062          <td class="paramtype">int&#160;</td>
1063          <td class="paramname"><em>subsamp</em>, </td>
1064        </tr>
1065        <tr>
1066          <td class="paramkey"></td>
1067          <td></td>
1068          <td class="paramtype">unsigned char **&#160;</td>
1069          <td class="paramname"><em>jpegBuf</em>, </td>
1070        </tr>
1071        <tr>
1072          <td class="paramkey"></td>
1073          <td></td>
1074          <td class="paramtype">unsigned long *&#160;</td>
1075          <td class="paramname"><em>jpegSize</em>, </td>
1076        </tr>
1077        <tr>
1078          <td class="paramkey"></td>
1079          <td></td>
1080          <td class="paramtype">int&#160;</td>
1081          <td class="paramname"><em>jpegQual</em>, </td>
1082        </tr>
1083        <tr>
1084          <td class="paramkey"></td>
1085          <td></td>
1086          <td class="paramtype">int&#160;</td>
1087          <td class="paramname"><em>flags</em>&#160;</td>
1088        </tr>
1089        <tr>
1090          <td></td>
1091          <td>)</td>
1092          <td></td><td></td>
1093        </tr>
1094      </table>
1095</div><div class="memdoc">
1096
1097<p>Compress a YUV planar image into a JPEG image. </p>
1098<dl class="params"><dt>Parameters</dt><dd>
1099  <table class="params">
1100    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance</td></tr>
1101    <tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing a YUV planar image to be compressed. The size of this buffer should match the value returned by <a class="el" href="group___turbo_j_p_e_g.html#gaf451664a62c1f6c7cc5a6401f32908c9" title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters...">tjBufSizeYUV2()</a> for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer (refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.) This buffer is not modified.</td></tr>
1102    <tr><td class="paramname">width</td><td>width (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
1103    <tr><td class="paramname">pad</td><td>the line padding used in the source image. For instance, if each line in each plane of the YUV image is padded to the nearest multiple of 4 bytes, then <code>pad</code> should be set to 4.</td></tr>
1104    <tr><td class="paramname">height</td><td>height (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
1105    <tr><td class="paramname">subsamp</td><td>the level of chrominance subsampling used in the source image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
1106    <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">
1107<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>
1108<li>set <code>*jpegBuf</code> to NULL to tell TurboJPEG to allocate the buffer for you, or</li>
1109<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>
1110</ol>
1111If 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>
1112    <tr><td class="paramname">jpegSize</td><td>pointer to an unsigned long variable that holds the size of the JPEG image buffer. If <code>*jpegBuf</code> points to a pre-allocated buffer, then <code>*jpegSize</code> should be set to the size of the buffer. Upon return, <code>*jpegSize</code> will contain the size of the JPEG image (in bytes.) If <code>*jpegBuf</code> points to a JPEG image buffer that is being reused from a previous call to one of the JPEG compression functions, then <code>*jpegSize</code> is ignored.</td></tr>
1113    <tr><td class="paramname">jpegQual</td><td>the image quality of the generated JPEG image (1 = worst, 100 = best)</td></tr>
1114    <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>
1115  </table>
1116  </dd>
1117</dl>
1118<dl class="section return"><dt>Returns</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>
1119
1120</div>
1121</div>
1122<a class="anchor" id="gaa89a1982cb4556b12ae7af4439991af6"></a>
1123<div class="memitem">
1124<div class="memproto">
1125      <table class="memname">
1126        <tr>
1127          <td class="memname">DLLEXPORT int DLLCALL tjCompressFromYUVPlanes </td>
1128          <td>(</td>
1129          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1130          <td class="paramname"><em>handle</em>, </td>
1131        </tr>
1132        <tr>
1133          <td class="paramkey"></td>
1134          <td></td>
1135          <td class="paramtype">unsigned char **&#160;</td>
1136          <td class="paramname"><em>srcPlanes</em>, </td>
1137        </tr>
1138        <tr>
1139          <td class="paramkey"></td>
1140          <td></td>
1141          <td class="paramtype">int&#160;</td>
1142          <td class="paramname"><em>width</em>, </td>
1143        </tr>
1144        <tr>
1145          <td class="paramkey"></td>
1146          <td></td>
1147          <td class="paramtype">int *&#160;</td>
1148          <td class="paramname"><em>strides</em>, </td>
1149        </tr>
1150        <tr>
1151          <td class="paramkey"></td>
1152          <td></td>
1153          <td class="paramtype">int&#160;</td>
1154          <td class="paramname"><em>height</em>, </td>
1155        </tr>
1156        <tr>
1157          <td class="paramkey"></td>
1158          <td></td>
1159          <td class="paramtype">int&#160;</td>
1160          <td class="paramname"><em>subsamp</em>, </td>
1161        </tr>
1162        <tr>
1163          <td class="paramkey"></td>
1164          <td></td>
1165          <td class="paramtype">unsigned char **&#160;</td>
1166          <td class="paramname"><em>jpegBuf</em>, </td>
1167        </tr>
1168        <tr>
1169          <td class="paramkey"></td>
1170          <td></td>
1171          <td class="paramtype">unsigned long *&#160;</td>
1172          <td class="paramname"><em>jpegSize</em>, </td>
1173        </tr>
1174        <tr>
1175          <td class="paramkey"></td>
1176          <td></td>
1177          <td class="paramtype">int&#160;</td>
1178          <td class="paramname"><em>jpegQual</em>, </td>
1179        </tr>
1180        <tr>
1181          <td class="paramkey"></td>
1182          <td></td>
1183          <td class="paramtype">int&#160;</td>
1184          <td class="paramname"><em>flags</em>&#160;</td>
1185        </tr>
1186        <tr>
1187          <td></td>
1188          <td>)</td>
1189          <td></td><td></td>
1190        </tr>
1191      </table>
1192</div><div class="memdoc">
1193
1194<p>Compress a set of Y, U (Cb), and V (Cr) image planes into a JPEG image. </p>
1195<dl class="params"><dt>Parameters</dt><dd>
1196  <table class="params">
1197    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance</td></tr>
1198    <tr><td class="paramname">srcPlanes</td><td>an array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if compressing a grayscale image) that contain a YUV image to be compressed. These planes can be contiguous or non-contiguous in memory. The size of each plane should match the value returned by <a class="el" href="group___turbo_j_p_e_g.html#ga6f98d977bfa9d167c97172e876ba61e2" title="The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters...">tjPlaneSizeYUV()</a> for the given image width, height, strides, and level of chrominance subsampling. Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for more details. These image planes are not modified.</td></tr>
1199    <tr><td class="paramname">width</td><td>width (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
1200    <tr><td class="paramname">strides</td><td>an array of integers, each specifying the number of bytes per line in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the plane width (see <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.) If <code>strides</code> is NULL, then the strides for all planes will be set to their respective plane widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to create a JPEG image from a subregion of a larger YUV planar image.</td></tr>
1201    <tr><td class="paramname">height</td><td>height (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
1202    <tr><td class="paramname">subsamp</td><td>the level of chrominance subsampling used in the source image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
1203    <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">
1204<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>
1205<li>set <code>*jpegBuf</code> to NULL to tell TurboJPEG to allocate the buffer for you, or</li>
1206<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>
1207</ol>
1208If 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>
1209    <tr><td class="paramname">jpegSize</td><td>pointer to an unsigned long variable that holds the size of the JPEG image buffer. If <code>*jpegBuf</code> points to a pre-allocated buffer, then <code>*jpegSize</code> should be set to the size of the buffer. Upon return, <code>*jpegSize</code> will contain the size of the JPEG image (in bytes.) If <code>*jpegBuf</code> points to a JPEG image buffer that is being reused from a previous call to one of the JPEG compression functions, then <code>*jpegSize</code> is ignored.</td></tr>
1210    <tr><td class="paramname">jpegQual</td><td>the image quality of the generated JPEG image (1 = worst, 100 = best)</td></tr>
1211    <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>
1212  </table>
1213  </dd>
1214</dl>
1215<dl class="section return"><dt>Returns</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>
1216
1217</div>
1218</div>
1219<a class="anchor" id="ga132ae2c2cadcf64c8bb0f3bdf69da3ed"></a>
1220<div class="memitem">
1221<div class="memproto">
1222      <table class="memname">
1223        <tr>
1224          <td class="memname">DLLEXPORT int DLLCALL tjDecodeYUV </td>
1225          <td>(</td>
1226          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1227          <td class="paramname"><em>handle</em>, </td>
1228        </tr>
1229        <tr>
1230          <td class="paramkey"></td>
1231          <td></td>
1232          <td class="paramtype">unsigned char *&#160;</td>
1233          <td class="paramname"><em>srcBuf</em>, </td>
1234        </tr>
1235        <tr>
1236          <td class="paramkey"></td>
1237          <td></td>
1238          <td class="paramtype">int&#160;</td>
1239          <td class="paramname"><em>pad</em>, </td>
1240        </tr>
1241        <tr>
1242          <td class="paramkey"></td>
1243          <td></td>
1244          <td class="paramtype">int&#160;</td>
1245          <td class="paramname"><em>subsamp</em>, </td>
1246        </tr>
1247        <tr>
1248          <td class="paramkey"></td>
1249          <td></td>
1250          <td class="paramtype">unsigned char *&#160;</td>
1251          <td class="paramname"><em>dstBuf</em>, </td>
1252        </tr>
1253        <tr>
1254          <td class="paramkey"></td>
1255          <td></td>
1256          <td class="paramtype">int&#160;</td>
1257          <td class="paramname"><em>width</em>, </td>
1258        </tr>
1259        <tr>
1260          <td class="paramkey"></td>
1261          <td></td>
1262          <td class="paramtype">int&#160;</td>
1263          <td class="paramname"><em>pitch</em>, </td>
1264        </tr>
1265        <tr>
1266          <td class="paramkey"></td>
1267          <td></td>
1268          <td class="paramtype">int&#160;</td>
1269          <td class="paramname"><em>height</em>, </td>
1270        </tr>
1271        <tr>
1272          <td class="paramkey"></td>
1273          <td></td>
1274          <td class="paramtype">int&#160;</td>
1275          <td class="paramname"><em>pixelFormat</em>, </td>
1276        </tr>
1277        <tr>
1278          <td class="paramkey"></td>
1279          <td></td>
1280          <td class="paramtype">int&#160;</td>
1281          <td class="paramname"><em>flags</em>&#160;</td>
1282        </tr>
1283        <tr>
1284          <td></td>
1285          <td>)</td>
1286          <td></td><td></td>
1287        </tr>
1288      </table>
1289</div><div class="memdoc">
1290
1291<p>Decode a YUV planar image into an RGB or grayscale image. </p>
1292<p>This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG decompression process.</p>
1293<dl class="params"><dt>Parameters</dt><dd>
1294  <table class="params">
1295    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</td></tr>
1296    <tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing a YUV planar image to be decoded. The size of this buffer should match the value returned by <a class="el" href="group___turbo_j_p_e_g.html#gaf451664a62c1f6c7cc5a6401f32908c9" title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters...">tjBufSizeYUV2()</a> for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer (refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.) This buffer is not modified.</td></tr>
1297    <tr><td class="paramname">pad</td><td>Use this parameter to specify that the width of each line in each plane of the YUV source image is padded to the nearest multiple of this number of bytes (must be a power of 2.)</td></tr>
1298    <tr><td class="paramname">subsamp</td><td>the level of chrominance subsampling used in the YUV source image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
1299    <tr><td class="paramname">dstBuf</td><td>pointer to an image buffer that will receive the decoded image. This buffer should normally be <code>pitch * height</code> bytes in size, but the <code>dstBuf</code> pointer can also be used to decode into a specific region of a larger buffer.</td></tr>
1300    <tr><td class="paramname">width</td><td>width (in pixels) of the source and destination images</td></tr>
1301    <tr><td class="paramname">pitch</td><td>bytes per line in the destination image. Normally, this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the destination image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the destination image should be padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
1302    <tr><td class="paramname">height</td><td>height (in pixels) of the source and destination images</td></tr>
1303    <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>
1304    <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>
1305  </table>
1306  </dd>
1307</dl>
1308<dl class="section return"><dt>Returns</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>
1309
1310</div>
1311</div>
1312<a class="anchor" id="ga6cb5b0e1101a2b20edea576e11faf93d"></a>
1313<div class="memitem">
1314<div class="memproto">
1315      <table class="memname">
1316        <tr>
1317          <td class="memname">DLLEXPORT int DLLCALL tjDecodeYUVPlanes </td>
1318          <td>(</td>
1319          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1320          <td class="paramname"><em>handle</em>, </td>
1321        </tr>
1322        <tr>
1323          <td class="paramkey"></td>
1324          <td></td>
1325          <td class="paramtype">unsigned char **&#160;</td>
1326          <td class="paramname"><em>srcPlanes</em>, </td>
1327        </tr>
1328        <tr>
1329          <td class="paramkey"></td>
1330          <td></td>
1331          <td class="paramtype">int *&#160;</td>
1332          <td class="paramname"><em>strides</em>, </td>
1333        </tr>
1334        <tr>
1335          <td class="paramkey"></td>
1336          <td></td>
1337          <td class="paramtype">int&#160;</td>
1338          <td class="paramname"><em>subsamp</em>, </td>
1339        </tr>
1340        <tr>
1341          <td class="paramkey"></td>
1342          <td></td>
1343          <td class="paramtype">unsigned char *&#160;</td>
1344          <td class="paramname"><em>dstBuf</em>, </td>
1345        </tr>
1346        <tr>
1347          <td class="paramkey"></td>
1348          <td></td>
1349          <td class="paramtype">int&#160;</td>
1350          <td class="paramname"><em>width</em>, </td>
1351        </tr>
1352        <tr>
1353          <td class="paramkey"></td>
1354          <td></td>
1355          <td class="paramtype">int&#160;</td>
1356          <td class="paramname"><em>pitch</em>, </td>
1357        </tr>
1358        <tr>
1359          <td class="paramkey"></td>
1360          <td></td>
1361          <td class="paramtype">int&#160;</td>
1362          <td class="paramname"><em>height</em>, </td>
1363        </tr>
1364        <tr>
1365          <td class="paramkey"></td>
1366          <td></td>
1367          <td class="paramtype">int&#160;</td>
1368          <td class="paramname"><em>pixelFormat</em>, </td>
1369        </tr>
1370        <tr>
1371          <td class="paramkey"></td>
1372          <td></td>
1373          <td class="paramtype">int&#160;</td>
1374          <td class="paramname"><em>flags</em>&#160;</td>
1375        </tr>
1376        <tr>
1377          <td></td>
1378          <td>)</td>
1379          <td></td><td></td>
1380        </tr>
1381      </table>
1382</div><div class="memdoc">
1383
1384<p>Decode a set of Y, U (Cb), and V (Cr) image planes into an RGB or grayscale image. </p>
1385<p>This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG decompression process.</p>
1386<dl class="params"><dt>Parameters</dt><dd>
1387  <table class="params">
1388    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</td></tr>
1389    <tr><td class="paramname">srcPlanes</td><td>an array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decoding a grayscale image) that contain a YUV image to be decoded. These planes can be contiguous or non-contiguous in memory. The size of each plane should match the value returned by <a class="el" href="group___turbo_j_p_e_g.html#ga6f98d977bfa9d167c97172e876ba61e2" title="The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters...">tjPlaneSizeYUV()</a> for the given image width, height, strides, and level of chrominance subsampling. Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for more details. These image planes are not modified.</td></tr>
1390    <tr><td class="paramname">strides</td><td>an array of integers, each specifying the number of bytes per line in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the plane width (see <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.) If <code>strides</code> is NULL, then the strides for all planes will be set to their respective plane widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to decode a subregion of a larger YUV planar image.</td></tr>
1391    <tr><td class="paramname">subsamp</td><td>the level of chrominance subsampling used in the YUV source image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
1392    <tr><td class="paramname">dstBuf</td><td>pointer to an image buffer that will receive the decoded image. This buffer should normally be <code>pitch * height</code> bytes in size, but the <code>dstBuf</code> pointer can also be used to decode into a specific region of a larger buffer.</td></tr>
1393    <tr><td class="paramname">width</td><td>width (in pixels) of the source and destination images</td></tr>
1394    <tr><td class="paramname">pitch</td><td>bytes per line in the destination image. Normally, this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the destination image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the destination image should be padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
1395    <tr><td class="paramname">height</td><td>height (in pixels) of the source and destination images</td></tr>
1396    <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>
1397    <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>
1398  </table>
1399  </dd>
1400</dl>
1401<dl class="section return"><dt>Returns</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>
1402
1403</div>
1404</div>
1405<a class="anchor" id="gada69cc6443d1bb493b40f1626259e5e9"></a>
1406<div class="memitem">
1407<div class="memproto">
1408      <table class="memname">
1409        <tr>
1410          <td class="memname">DLLEXPORT int DLLCALL tjDecompress2 </td>
1411          <td>(</td>
1412          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1413          <td class="paramname"><em>handle</em>, </td>
1414        </tr>
1415        <tr>
1416          <td class="paramkey"></td>
1417          <td></td>
1418          <td class="paramtype">unsigned char *&#160;</td>
1419          <td class="paramname"><em>jpegBuf</em>, </td>
1420        </tr>
1421        <tr>
1422          <td class="paramkey"></td>
1423          <td></td>
1424          <td class="paramtype">unsigned long&#160;</td>
1425          <td class="paramname"><em>jpegSize</em>, </td>
1426        </tr>
1427        <tr>
1428          <td class="paramkey"></td>
1429          <td></td>
1430          <td class="paramtype">unsigned char *&#160;</td>
1431          <td class="paramname"><em>dstBuf</em>, </td>
1432        </tr>
1433        <tr>
1434          <td class="paramkey"></td>
1435          <td></td>
1436          <td class="paramtype">int&#160;</td>
1437          <td class="paramname"><em>width</em>, </td>
1438        </tr>
1439        <tr>
1440          <td class="paramkey"></td>
1441          <td></td>
1442          <td class="paramtype">int&#160;</td>
1443          <td class="paramname"><em>pitch</em>, </td>
1444        </tr>
1445        <tr>
1446          <td class="paramkey"></td>
1447          <td></td>
1448          <td class="paramtype">int&#160;</td>
1449          <td class="paramname"><em>height</em>, </td>
1450        </tr>
1451        <tr>
1452          <td class="paramkey"></td>
1453          <td></td>
1454          <td class="paramtype">int&#160;</td>
1455          <td class="paramname"><em>pixelFormat</em>, </td>
1456        </tr>
1457        <tr>
1458          <td class="paramkey"></td>
1459          <td></td>
1460          <td class="paramtype">int&#160;</td>
1461          <td class="paramname"><em>flags</em>&#160;</td>
1462        </tr>
1463        <tr>
1464          <td></td>
1465          <td>)</td>
1466          <td></td><td></td>
1467        </tr>
1468      </table>
1469</div><div class="memdoc">
1470
1471<p>Decompress a JPEG image to an RGB, grayscale, or CMYK image. </p>
1472<dl class="params"><dt>Parameters</dt><dd>
1473  <table class="params">
1474    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</td></tr>
1475    <tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG image to decompress. This buffer is not modified.</td></tr>
1476    <tr><td class="paramname">jpegSize</td><td>size of the JPEG image (in bytes)</td></tr>
1477    <tr><td class="paramname">dstBuf</td><td>pointer to an image buffer that will receive the decompressed image. This buffer should normally be <code>pitch * scaledHeight</code> bytes in size, where <code>scaledHeight</code> can be determined by calling <a class="el" href="group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df" title="Compute the scaled value of dimension using the given scaling factor.">TJSCALED()</a> with the JPEG image height and one of the scaling factors returned by <a class="el" href="group___turbo_j_p_e_g.html#ga6449044b9af402999ccf52f401333be8" title="Returns a list of fractional scaling factors that the JPEG decompressor in this implementation of Tur...">tjGetScalingFactors()</a>. The <code>dstBuf</code> pointer may also be used to decompress into a specific region of a larger buffer.</td></tr>
1478    <tr><td class="paramname">width</td><td>desired width (in pixels) of the destination image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If <code>width</code> is set to 0, then only the height will be considered when determining the scaled image size.</td></tr>
1479    <tr><td class="paramname">pitch</td><td>bytes per line in the destination image. Normally, this is <code>scaledWidth * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the decompressed image is unpadded, else <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(scaledWidth * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the decompressed image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. (NOTE: <code>scaledWidth</code> can be determined by calling <a class="el" href="group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df" title="Compute the scaled value of dimension using the given scaling factor.">TJSCALED()</a> with the JPEG image width and one of the scaling factors returned by <a class="el" href="group___turbo_j_p_e_g.html#ga6449044b9af402999ccf52f401333be8" title="Returns a list of fractional scaling factors that the JPEG decompressor in this implementation of Tur...">tjGetScalingFactors()</a>.) You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>scaledWidth * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
1480    <tr><td class="paramname">height</td><td>desired height (in pixels) of the destination image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If <code>height</code> is set to 0, then only the width will be considered when determining the scaled image size.</td></tr>
1481    <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>
1482    <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>
1483  </table>
1484  </dd>
1485</dl>
1486<dl class="section return"><dt>Returns</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>
1487
1488</div>
1489</div>
1490<a class="anchor" id="gacd0fac3af74b3511d39b4781b7103086"></a>
1491<div class="memitem">
1492<div class="memproto">
1493      <table class="memname">
1494        <tr>
1495          <td class="memname">DLLEXPORT int DLLCALL tjDecompressHeader3 </td>
1496          <td>(</td>
1497          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1498          <td class="paramname"><em>handle</em>, </td>
1499        </tr>
1500        <tr>
1501          <td class="paramkey"></td>
1502          <td></td>
1503          <td class="paramtype">unsigned char *&#160;</td>
1504          <td class="paramname"><em>jpegBuf</em>, </td>
1505        </tr>
1506        <tr>
1507          <td class="paramkey"></td>
1508          <td></td>
1509          <td class="paramtype">unsigned long&#160;</td>
1510          <td class="paramname"><em>jpegSize</em>, </td>
1511        </tr>
1512        <tr>
1513          <td class="paramkey"></td>
1514          <td></td>
1515          <td class="paramtype">int *&#160;</td>
1516          <td class="paramname"><em>width</em>, </td>
1517        </tr>
1518        <tr>
1519          <td class="paramkey"></td>
1520          <td></td>
1521          <td class="paramtype">int *&#160;</td>
1522          <td class="paramname"><em>height</em>, </td>
1523        </tr>
1524        <tr>
1525          <td class="paramkey"></td>
1526          <td></td>
1527          <td class="paramtype">int *&#160;</td>
1528          <td class="paramname"><em>jpegSubsamp</em>, </td>
1529        </tr>
1530        <tr>
1531          <td class="paramkey"></td>
1532          <td></td>
1533          <td class="paramtype">int *&#160;</td>
1534          <td class="paramname"><em>jpegColorspace</em>&#160;</td>
1535        </tr>
1536        <tr>
1537          <td></td>
1538          <td>)</td>
1539          <td></td><td></td>
1540        </tr>
1541      </table>
1542</div><div class="memdoc">
1543
1544<p>Retrieve information about a JPEG image without decompressing it. </p>
1545<dl class="params"><dt>Parameters</dt><dd>
1546  <table class="params">
1547    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</td></tr>
1548    <tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing a JPEG image. This buffer is not modified.</td></tr>
1549    <tr><td class="paramname">jpegSize</td><td>size of the JPEG image (in bytes)</td></tr>
1550    <tr><td class="paramname">width</td><td>pointer to an integer variable that will receive the width (in pixels) of the JPEG image</td></tr>
1551    <tr><td class="paramname">height</td><td>pointer to an integer variable that will receive the height (in pixels) of the JPEG image</td></tr>
1552    <tr><td class="paramname">jpegSubsamp</td><td>pointer to an integer variable that will receive the level of chrominance subsampling used when the JPEG image was compressed (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
1553    <tr><td class="paramname">jpegColorspace</td><td>pointer to an integer variable that will receive one of the JPEG colorspace constants, indicating the colorspace of the JPEG image (see <a class="el" href="group___turbo_j_p_e_g.html#ga4f83ad3368e0e29d1957be0efa7c3720">JPEG colorspaces</a>.)</td></tr>
1554  </table>
1555  </dd>
1556</dl>
1557<dl class="section return"><dt>Returns</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>
1558
1559</div>
1560</div>
1561<a class="anchor" id="ga7c08b340ad7f8e85d407bd9e81d44d07"></a>
1562<div class="memitem">
1563<div class="memproto">
1564      <table class="memname">
1565        <tr>
1566          <td class="memname">DLLEXPORT int DLLCALL tjDecompressToYUV2 </td>
1567          <td>(</td>
1568          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1569          <td class="paramname"><em>handle</em>, </td>
1570        </tr>
1571        <tr>
1572          <td class="paramkey"></td>
1573          <td></td>
1574          <td class="paramtype">unsigned char *&#160;</td>
1575          <td class="paramname"><em>jpegBuf</em>, </td>
1576        </tr>
1577        <tr>
1578          <td class="paramkey"></td>
1579          <td></td>
1580          <td class="paramtype">unsigned long&#160;</td>
1581          <td class="paramname"><em>jpegSize</em>, </td>
1582        </tr>
1583        <tr>
1584          <td class="paramkey"></td>
1585          <td></td>
1586          <td class="paramtype">unsigned char *&#160;</td>
1587          <td class="paramname"><em>dstBuf</em>, </td>
1588        </tr>
1589        <tr>
1590          <td class="paramkey"></td>
1591          <td></td>
1592          <td class="paramtype">int&#160;</td>
1593          <td class="paramname"><em>width</em>, </td>
1594        </tr>
1595        <tr>
1596          <td class="paramkey"></td>
1597          <td></td>
1598          <td class="paramtype">int&#160;</td>
1599          <td class="paramname"><em>pad</em>, </td>
1600        </tr>
1601        <tr>
1602          <td class="paramkey"></td>
1603          <td></td>
1604          <td class="paramtype">int&#160;</td>
1605          <td class="paramname"><em>height</em>, </td>
1606        </tr>
1607        <tr>
1608          <td class="paramkey"></td>
1609          <td></td>
1610          <td class="paramtype">int&#160;</td>
1611          <td class="paramname"><em>flags</em>&#160;</td>
1612        </tr>
1613        <tr>
1614          <td></td>
1615          <td>)</td>
1616          <td></td><td></td>
1617        </tr>
1618      </table>
1619</div><div class="memdoc">
1620
1621<p>Decompress a JPEG image to a YUV planar image. </p>
1622<p>This function performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of an RGB image.</p>
1623<dl class="params"><dt>Parameters</dt><dd>
1624  <table class="params">
1625    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</td></tr>
1626    <tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG image to decompress. This buffer is not modified.</td></tr>
1627    <tr><td class="paramname">jpegSize</td><td>size of the JPEG image (in bytes)</td></tr>
1628    <tr><td class="paramname">dstBuf</td><td>pointer to an image buffer that will receive the YUV image. Use <a class="el" href="group___turbo_j_p_e_g.html#gaf451664a62c1f6c7cc5a6401f32908c9" title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters...">tjBufSizeYUV2()</a> to determine the appropriate size for this buffer based on the image width, height, padding, and level of subsampling. The Y, U (Cb), and V (Cr) image planes will be stored sequentially in the buffer (refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.)</td></tr>
1629    <tr><td class="paramname">width</td><td>desired width (in pixels) of the YUV image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If <code>width</code> is set to 0, then only the height will be considered when determining the scaled image size. If the scaled width is not an even multiple of the MCU block width (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
1630    <tr><td class="paramname">pad</td><td>the width of each line in each plane of the YUV image will be padded to the nearest multiple of this number of bytes (must be a power of 2.) To generate images suitable for X Video, <code>pad</code> should be set to 4.</td></tr>
1631    <tr><td class="paramname">height</td><td>desired height (in pixels) of the YUV image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If <code>height</code> is set to 0, then only the width will be considered when determining the scaled image size. If the scaled height is not an even multiple of the MCU block height (see <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
1632    <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>
1633  </table>
1634  </dd>
1635</dl>
1636<dl class="section return"><dt>Returns</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>
1637
1638</div>
1639</div>
1640<a class="anchor" id="ga0828a38ae29631ac28b6857cefb0eebf"></a>
1641<div class="memitem">
1642<div class="memproto">
1643      <table class="memname">
1644        <tr>
1645          <td class="memname">DLLEXPORT int DLLCALL tjDecompressToYUVPlanes </td>
1646          <td>(</td>
1647          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1648          <td class="paramname"><em>handle</em>, </td>
1649        </tr>
1650        <tr>
1651          <td class="paramkey"></td>
1652          <td></td>
1653          <td class="paramtype">unsigned char *&#160;</td>
1654          <td class="paramname"><em>jpegBuf</em>, </td>
1655        </tr>
1656        <tr>
1657          <td class="paramkey"></td>
1658          <td></td>
1659          <td class="paramtype">unsigned long&#160;</td>
1660          <td class="paramname"><em>jpegSize</em>, </td>
1661        </tr>
1662        <tr>
1663          <td class="paramkey"></td>
1664          <td></td>
1665          <td class="paramtype">unsigned char **&#160;</td>
1666          <td class="paramname"><em>dstPlanes</em>, </td>
1667        </tr>
1668        <tr>
1669          <td class="paramkey"></td>
1670          <td></td>
1671          <td class="paramtype">int&#160;</td>
1672          <td class="paramname"><em>width</em>, </td>
1673        </tr>
1674        <tr>
1675          <td class="paramkey"></td>
1676          <td></td>
1677          <td class="paramtype">int *&#160;</td>
1678          <td class="paramname"><em>strides</em>, </td>
1679        </tr>
1680        <tr>
1681          <td class="paramkey"></td>
1682          <td></td>
1683          <td class="paramtype">int&#160;</td>
1684          <td class="paramname"><em>height</em>, </td>
1685        </tr>
1686        <tr>
1687          <td class="paramkey"></td>
1688          <td></td>
1689          <td class="paramtype">int&#160;</td>
1690          <td class="paramname"><em>flags</em>&#160;</td>
1691        </tr>
1692        <tr>
1693          <td></td>
1694          <td>)</td>
1695          <td></td><td></td>
1696        </tr>
1697      </table>
1698</div><div class="memdoc">
1699
1700<p>Decompress a JPEG image into separate Y, U (Cb), and V (Cr) image planes. </p>
1701<p>This function performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of an RGB image.</p>
1702<dl class="params"><dt>Parameters</dt><dd>
1703  <table class="params">
1704    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</td></tr>
1705    <tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG image to decompress. This buffer is not modified.</td></tr>
1706    <tr><td class="paramname">jpegSize</td><td>size of the JPEG image (in bytes)</td></tr>
1707    <tr><td class="paramname">dstPlanes</td><td>an array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decompressing a grayscale image) that will receive the YUV image. These planes can be contiguous or non-contiguous in memory. Use <a class="el" href="group___turbo_j_p_e_g.html#ga6f98d977bfa9d167c97172e876ba61e2" title="The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters...">tjPlaneSizeYUV()</a> to determine the appropriate size for each plane based on the scaled image width, scaled image height, strides, and level of chrominance subsampling. Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for more details.</td></tr>
1708    <tr><td class="paramname">width</td><td>desired width (in pixels) of the YUV image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If <code>width</code> is set to 0, then only the height will be considered when determining the scaled image size. If the scaled width is not an even multiple of the MCU block width (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
1709    <tr><td class="paramname">strides</td><td>an array of integers, each specifying the number of bytes per line in the corresponding plane of the output image. Setting the stride for any plane to 0 is the same as setting it to the scaled plane width (see <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.) If <code>strides</code> is NULL, then the strides for all planes will be set to their respective scaled plane widths. You can adjust the strides in order to add an arbitrary amount of line padding to each plane or to decompress the JPEG image into a subregion of a larger YUV planar image.</td></tr>
1710    <tr><td class="paramname">height</td><td>desired height (in pixels) of the YUV image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If <code>height</code> is set to 0, then only the width will be considered when determining the scaled image size. If the scaled height is not an even multiple of the MCU block height (see <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
1711    <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>
1712  </table>
1713  </dd>
1714</dl>
1715<dl class="section return"><dt>Returns</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>
1716
1717</div>
1718</div>
1719<a class="anchor" id="ga674adee917b95ad4a896f1ba39e12540"></a>
1720<div class="memitem">
1721<div class="memproto">
1722      <table class="memname">
1723        <tr>
1724          <td class="memname">DLLEXPORT int DLLCALL tjDestroy </td>
1725          <td>(</td>
1726          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1727          <td class="paramname"><em>handle</em></td><td>)</td>
1728          <td></td>
1729        </tr>
1730      </table>
1731</div><div class="memdoc">
1732
1733<p>Destroy a TurboJPEG compressor, decompressor, or transformer instance. </p>
1734<dl class="params"><dt>Parameters</dt><dd>
1735  <table class="params">
1736    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor, decompressor or transformer instance</td></tr>
1737  </table>
1738  </dd>
1739</dl>
1740<dl class="section return"><dt>Returns</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>
1741
1742</div>
1743</div>
1744<a class="anchor" id="ga0a5ffbf7cb58a5b6a8201114fe889360"></a>
1745<div class="memitem">
1746<div class="memproto">
1747      <table class="memname">
1748        <tr>
1749          <td class="memname">DLLEXPORT int DLLCALL tjEncodeYUV3 </td>
1750          <td>(</td>
1751          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1752          <td class="paramname"><em>handle</em>, </td>
1753        </tr>
1754        <tr>
1755          <td class="paramkey"></td>
1756          <td></td>
1757          <td class="paramtype">unsigned char *&#160;</td>
1758          <td class="paramname"><em>srcBuf</em>, </td>
1759        </tr>
1760        <tr>
1761          <td class="paramkey"></td>
1762          <td></td>
1763          <td class="paramtype">int&#160;</td>
1764          <td class="paramname"><em>width</em>, </td>
1765        </tr>
1766        <tr>
1767          <td class="paramkey"></td>
1768          <td></td>
1769          <td class="paramtype">int&#160;</td>
1770          <td class="paramname"><em>pitch</em>, </td>
1771        </tr>
1772        <tr>
1773          <td class="paramkey"></td>
1774          <td></td>
1775          <td class="paramtype">int&#160;</td>
1776          <td class="paramname"><em>height</em>, </td>
1777        </tr>
1778        <tr>
1779          <td class="paramkey"></td>
1780          <td></td>
1781          <td class="paramtype">int&#160;</td>
1782          <td class="paramname"><em>pixelFormat</em>, </td>
1783        </tr>
1784        <tr>
1785          <td class="paramkey"></td>
1786          <td></td>
1787          <td class="paramtype">unsigned char *&#160;</td>
1788          <td class="paramname"><em>dstBuf</em>, </td>
1789        </tr>
1790        <tr>
1791          <td class="paramkey"></td>
1792          <td></td>
1793          <td class="paramtype">int&#160;</td>
1794          <td class="paramname"><em>pad</em>, </td>
1795        </tr>
1796        <tr>
1797          <td class="paramkey"></td>
1798          <td></td>
1799          <td class="paramtype">int&#160;</td>
1800          <td class="paramname"><em>subsamp</em>, </td>
1801        </tr>
1802        <tr>
1803          <td class="paramkey"></td>
1804          <td></td>
1805          <td class="paramtype">int&#160;</td>
1806          <td class="paramname"><em>flags</em>&#160;</td>
1807        </tr>
1808        <tr>
1809          <td></td>
1810          <td>)</td>
1811          <td></td><td></td>
1812        </tr>
1813      </table>
1814</div><div class="memdoc">
1815
1816<p>Encode an RGB or grayscale image into a YUV planar image. </p>
1817<p>This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG compression process.</p>
1818<dl class="params"><dt>Parameters</dt><dd>
1819  <table class="params">
1820    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance</td></tr>
1821    <tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing RGB or grayscale pixels to be encoded. This buffer is not modified.</td></tr>
1822    <tr><td class="paramname">width</td><td>width (in pixels) of the source image</td></tr>
1823    <tr><td class="paramname">pitch</td><td>bytes per line in the source image. Normally, this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
1824    <tr><td class="paramname">height</td><td>height (in pixels) of the source image</td></tr>
1825    <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>
1826    <tr><td class="paramname">dstBuf</td><td>pointer to an image buffer that will receive the YUV image. Use <a class="el" href="group___turbo_j_p_e_g.html#gaf451664a62c1f6c7cc5a6401f32908c9" title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters...">tjBufSizeYUV2()</a> to determine the appropriate size for this buffer based on the image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes will be stored sequentially in the buffer (refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.)</td></tr>
1827    <tr><td class="paramname">pad</td><td>the width of each line in each plane of the YUV image will be padded to the nearest multiple of this number of bytes (must be a power of 2.) To generate images suitable for X Video, <code>pad</code> should be set to 4.</td></tr>
1828    <tr><td class="paramname">subsamp</td><td>the level of chrominance subsampling to be used when generating the YUV image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.) To generate images suitable for X Video, <code>subsamp</code> should be set to <a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a63085dbf683cfe39e513cdb6343e3737">TJSAMP_420</a>. This produces an image compatible with the I420 (AKA "YUV420P") format.</td></tr>
1829    <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>
1830  </table>
1831  </dd>
1832</dl>
1833<dl class="section return"><dt>Returns</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>
1834
1835</div>
1836</div>
1837<a class="anchor" id="gaa791db8598853ddcad24e42897ef1269"></a>
1838<div class="memitem">
1839<div class="memproto">
1840      <table class="memname">
1841        <tr>
1842          <td class="memname">DLLEXPORT int DLLCALL tjEncodeYUVPlanes </td>
1843          <td>(</td>
1844          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1845          <td class="paramname"><em>handle</em>, </td>
1846        </tr>
1847        <tr>
1848          <td class="paramkey"></td>
1849          <td></td>
1850          <td class="paramtype">unsigned char *&#160;</td>
1851          <td class="paramname"><em>srcBuf</em>, </td>
1852        </tr>
1853        <tr>
1854          <td class="paramkey"></td>
1855          <td></td>
1856          <td class="paramtype">int&#160;</td>
1857          <td class="paramname"><em>width</em>, </td>
1858        </tr>
1859        <tr>
1860          <td class="paramkey"></td>
1861          <td></td>
1862          <td class="paramtype">int&#160;</td>
1863          <td class="paramname"><em>pitch</em>, </td>
1864        </tr>
1865        <tr>
1866          <td class="paramkey"></td>
1867          <td></td>
1868          <td class="paramtype">int&#160;</td>
1869          <td class="paramname"><em>height</em>, </td>
1870        </tr>
1871        <tr>
1872          <td class="paramkey"></td>
1873          <td></td>
1874          <td class="paramtype">int&#160;</td>
1875          <td class="paramname"><em>pixelFormat</em>, </td>
1876        </tr>
1877        <tr>
1878          <td class="paramkey"></td>
1879          <td></td>
1880          <td class="paramtype">unsigned char **&#160;</td>
1881          <td class="paramname"><em>dstPlanes</em>, </td>
1882        </tr>
1883        <tr>
1884          <td class="paramkey"></td>
1885          <td></td>
1886          <td class="paramtype">int *&#160;</td>
1887          <td class="paramname"><em>strides</em>, </td>
1888        </tr>
1889        <tr>
1890          <td class="paramkey"></td>
1891          <td></td>
1892          <td class="paramtype">int&#160;</td>
1893          <td class="paramname"><em>subsamp</em>, </td>
1894        </tr>
1895        <tr>
1896          <td class="paramkey"></td>
1897          <td></td>
1898          <td class="paramtype">int&#160;</td>
1899          <td class="paramname"><em>flags</em>&#160;</td>
1900        </tr>
1901        <tr>
1902          <td></td>
1903          <td>)</td>
1904          <td></td><td></td>
1905        </tr>
1906      </table>
1907</div><div class="memdoc">
1908
1909<p>Encode an RGB or grayscale image into separate Y, U (Cb), and V (Cr) image planes. </p>
1910<p>This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG compression process.</p>
1911<dl class="params"><dt>Parameters</dt><dd>
1912  <table class="params">
1913    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance</td></tr>
1914    <tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing RGB or grayscale pixels to be encoded. This buffer is not modified.</td></tr>
1915    <tr><td class="paramname">width</td><td>width (in pixels) of the source image</td></tr>
1916    <tr><td class="paramname">pitch</td><td>bytes per line in the source image. Normally, this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
1917    <tr><td class="paramname">height</td><td>height (in pixels) of the source image</td></tr>
1918    <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>
1919    <tr><td class="paramname">dstPlanes</td><td>an array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if generating a grayscale image) that will receive the encoded image. These planes can be contiguous or non-contiguous in memory. Use <a class="el" href="group___turbo_j_p_e_g.html#ga6f98d977bfa9d167c97172e876ba61e2" title="The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters...">tjPlaneSizeYUV()</a> to determine the appropriate size for each plane based on the image width, height, strides, and level of chrominance subsampling. Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for more details.</td></tr>
1920    <tr><td class="paramname">strides</td><td>an array of integers, each specifying the number of bytes per line in the corresponding plane of the output image. Setting the stride for any plane to 0 is the same as setting it to the plane width (see <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.) If <code>strides</code> is NULL, then the strides for all planes will be set to their respective plane widths. You can adjust the strides in order to add an arbitrary amount of line padding to each plane or to encode an RGB or grayscale image into a subregion of a larger YUV planar image.</td></tr>
1921    <tr><td class="paramname">subsamp</td><td>the level of chrominance subsampling to be used when generating the YUV image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.) To generate images suitable for X Video, <code>subsamp</code> should be set to <a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a63085dbf683cfe39e513cdb6343e3737">TJSAMP_420</a>. This produces an image compatible with the I420 (AKA "YUV420P") format.</td></tr>
1922    <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>
1923  </table>
1924  </dd>
1925</dl>
1926<dl class="section return"><dt>Returns</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>
1927
1928</div>
1929</div>
1930<a class="anchor" id="ga8c4a1231dc06a450514c835f6471f137"></a>
1931<div class="memitem">
1932<div class="memproto">
1933      <table class="memname">
1934        <tr>
1935          <td class="memname">DLLEXPORT void DLLCALL tjFree </td>
1936          <td>(</td>
1937          <td class="paramtype">unsigned char *&#160;</td>
1938          <td class="paramname"><em>buffer</em></td><td>)</td>
1939          <td></td>
1940        </tr>
1941      </table>
1942</div><div class="memdoc">
1943
1944<p>Free an image buffer previously allocated by TurboJPEG. </p>
1945<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, grayscale, or CMYK 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>
1946<dl class="params"><dt>Parameters</dt><dd>
1947  <table class="params">
1948    <tr><td class="paramname">buffer</td><td>address of the buffer to free</td></tr>
1949  </table>
1950  </dd>
1951</dl>
1952<dl class="section see"><dt>See Also</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>
1953
1954</div>
1955</div>
1956<a class="anchor" id="ga9af79c908ec131b1ae8d52fe40375abf"></a>
1957<div class="memitem">
1958<div class="memproto">
1959      <table class="memname">
1960        <tr>
1961          <td class="memname">DLLEXPORT char* DLLCALL tjGetErrorStr </td>
1962          <td>(</td>
1963          <td class="paramtype">void&#160;</td>
1964          <td class="paramname"></td><td>)</td>
1965          <td></td>
1966        </tr>
1967      </table>
1968</div><div class="memdoc">
1969
1970<p>Returns a descriptive error message explaining why the last command failed. </p>
1971<dl class="section return"><dt>Returns</dt><dd>a descriptive error message explaining why the last command failed. </dd></dl>
1972
1973</div>
1974</div>
1975<a class="anchor" id="ga6449044b9af402999ccf52f401333be8"></a>
1976<div class="memitem">
1977<div class="memproto">
1978      <table class="memname">
1979        <tr>
1980          <td class="memname">DLLEXPORT <a class="el" href="structtjscalingfactor.html">tjscalingfactor</a>* DLLCALL tjGetScalingFactors </td>
1981          <td>(</td>
1982          <td class="paramtype">int *&#160;</td>
1983          <td class="paramname"><em>numscalingfactors</em></td><td>)</td>
1984          <td></td>
1985        </tr>
1986      </table>
1987</div><div class="memdoc">
1988
1989<p>Returns a list of fractional scaling factors that the JPEG decompressor in this implementation of TurboJPEG supports. </p>
1990<dl class="params"><dt>Parameters</dt><dd>
1991  <table class="params">
1992    <tr><td class="paramname">numscalingfactors</td><td>pointer to an integer variable that will receive the number of elements in the list</td></tr>
1993  </table>
1994  </dd>
1995</dl>
1996<dl class="section return"><dt>Returns</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>
1997
1998</div>
1999</div>
2000<a class="anchor" id="ga3d10c47fbe4a2489a2b30c931551d01a"></a>
2001<div class="memitem">
2002<div class="memproto">
2003      <table class="memname">
2004        <tr>
2005          <td class="memname">DLLEXPORT <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> DLLCALL tjInitCompress </td>
2006          <td>(</td>
2007          <td class="paramtype">void&#160;</td>
2008          <td class="paramname"></td><td>)</td>
2009          <td></td>
2010        </tr>
2011      </table>
2012</div><div class="memdoc">
2013
2014<p>Create a TurboJPEG compressor instance. </p>
2015<dl class="section return"><dt>Returns</dt><dd>a handle to the newly-created instance, or NULL if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr()</a>.) </dd></dl>
2016
2017</div>
2018</div>
2019<a class="anchor" id="gae5408179d041e2a2f7199c8283cf649e"></a>
2020<div class="memitem">
2021<div class="memproto">
2022      <table class="memname">
2023        <tr>
2024          <td class="memname">DLLEXPORT <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> DLLCALL tjInitDecompress </td>
2025          <td>(</td>
2026          <td class="paramtype">void&#160;</td>
2027          <td class="paramname"></td><td>)</td>
2028          <td></td>
2029        </tr>
2030      </table>
2031</div><div class="memdoc">
2032
2033<p>Create a TurboJPEG decompressor instance. </p>
2034<dl class="section return"><dt>Returns</dt><dd>a handle to the newly-created instance, or NULL if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr()</a>.) </dd></dl>
2035
2036</div>
2037</div>
2038<a class="anchor" id="ga3155b775bfbac9dbba869b95a0367902"></a>
2039<div class="memitem">
2040<div class="memproto">
2041      <table class="memname">
2042        <tr>
2043          <td class="memname">DLLEXPORT <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> DLLCALL tjInitTransform </td>
2044          <td>(</td>
2045          <td class="paramtype">void&#160;</td>
2046          <td class="paramname"></td><td>)</td>
2047          <td></td>
2048        </tr>
2049      </table>
2050</div><div class="memdoc">
2051
2052<p>Create a new TurboJPEG transformer instance. </p>
2053<dl class="section return"><dt>Returns</dt><dd>a handle to the newly-created instance, or NULL if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr()</a>.) </dd></dl>
2054
2055</div>
2056</div>
2057<a class="anchor" id="ga1a209696c6a80748f20e134b3c64789f"></a>
2058<div class="memitem">
2059<div class="memproto">
2060      <table class="memname">
2061        <tr>
2062          <td class="memname">DLLEXPORT int tjPlaneHeight </td>
2063          <td>(</td>
2064          <td class="paramtype">int&#160;</td>
2065          <td class="paramname"><em>componentID</em>, </td>
2066        </tr>
2067        <tr>
2068          <td class="paramkey"></td>
2069          <td></td>
2070          <td class="paramtype">int&#160;</td>
2071          <td class="paramname"><em>height</em>, </td>
2072        </tr>
2073        <tr>
2074          <td class="paramkey"></td>
2075          <td></td>
2076          <td class="paramtype">int&#160;</td>
2077          <td class="paramname"><em>subsamp</em>&#160;</td>
2078        </tr>
2079        <tr>
2080          <td></td>
2081          <td>)</td>
2082          <td></td><td></td>
2083        </tr>
2084      </table>
2085</div><div class="memdoc">
2086
2087<p>The plane height of a YUV image plane with the given parameters. </p>
2088<p>Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for a description of plane height.</p>
2089<dl class="params"><dt>Parameters</dt><dd>
2090  <table class="params">
2091    <tr><td class="paramname">componentID</td><td>ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr)</td></tr>
2092    <tr><td class="paramname">height</td><td>height (in pixels) of the YUV image</td></tr>
2093    <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>
2094  </table>
2095  </dd>
2096</dl>
2097<dl class="section return"><dt>Returns</dt><dd>the plane height of a YUV image plane with the given parameters, or -1 if the arguments are out of bounds. </dd></dl>
2098
2099</div>
2100</div>
2101<a class="anchor" id="ga6f98d977bfa9d167c97172e876ba61e2"></a>
2102<div class="memitem">
2103<div class="memproto">
2104      <table class="memname">
2105        <tr>
2106          <td class="memname">DLLEXPORT unsigned long DLLCALL tjPlaneSizeYUV </td>
2107          <td>(</td>
2108          <td class="paramtype">int&#160;</td>
2109          <td class="paramname"><em>componentID</em>, </td>
2110        </tr>
2111        <tr>
2112          <td class="paramkey"></td>
2113          <td></td>
2114          <td class="paramtype">int&#160;</td>
2115          <td class="paramname"><em>width</em>, </td>
2116        </tr>
2117        <tr>
2118          <td class="paramkey"></td>
2119          <td></td>
2120          <td class="paramtype">int&#160;</td>
2121          <td class="paramname"><em>stride</em>, </td>
2122        </tr>
2123        <tr>
2124          <td class="paramkey"></td>
2125          <td></td>
2126          <td class="paramtype">int&#160;</td>
2127          <td class="paramname"><em>height</em>, </td>
2128        </tr>
2129        <tr>
2130          <td class="paramkey"></td>
2131          <td></td>
2132          <td class="paramtype">int&#160;</td>
2133          <td class="paramname"><em>subsamp</em>&#160;</td>
2134        </tr>
2135        <tr>
2136          <td></td>
2137          <td>)</td>
2138          <td></td><td></td>
2139        </tr>
2140      </table>
2141</div><div class="memdoc">
2142
2143<p>The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters. </p>
2144<dl class="params"><dt>Parameters</dt><dd>
2145  <table class="params">
2146    <tr><td class="paramname">componentID</td><td>ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr)</td></tr>
2147    <tr><td class="paramname">width</td><td>width (in pixels) of the YUV image. NOTE: this is the width of the whole image, not the plane width.</td></tr>
2148    <tr><td class="paramname">stride</td><td>bytes per line in the image plane. Setting this to 0 is the equivalent of setting it to the plane width.</td></tr>
2149    <tr><td class="paramname">height</td><td>height (in pixels) of the YUV image. NOTE: this is the height of the whole image, not the plane height.</td></tr>
2150    <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>
2151  </table>
2152  </dd>
2153</dl>
2154<dl class="section return"><dt>Returns</dt><dd>the size of the buffer (in bytes) required to hold the YUV image plane, or -1 if the arguments are out of bounds. </dd></dl>
2155
2156</div>
2157</div>
2158<a class="anchor" id="ga63fb66bb1e36c74008c4634360becbb1"></a>
2159<div class="memitem">
2160<div class="memproto">
2161      <table class="memname">
2162        <tr>
2163          <td class="memname">DLLEXPORT int tjPlaneWidth </td>
2164          <td>(</td>
2165          <td class="paramtype">int&#160;</td>
2166          <td class="paramname"><em>componentID</em>, </td>
2167        </tr>
2168        <tr>
2169          <td class="paramkey"></td>
2170          <td></td>
2171          <td class="paramtype">int&#160;</td>
2172          <td class="paramname"><em>width</em>, </td>
2173        </tr>
2174        <tr>
2175          <td class="paramkey"></td>
2176          <td></td>
2177          <td class="paramtype">int&#160;</td>
2178          <td class="paramname"><em>subsamp</em>&#160;</td>
2179        </tr>
2180        <tr>
2181          <td></td>
2182          <td>)</td>
2183          <td></td><td></td>
2184        </tr>
2185      </table>
2186</div><div class="memdoc">
2187
2188<p>The plane width of a YUV image plane with the given parameters. </p>
2189<p>Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for a description of plane width.</p>
2190<dl class="params"><dt>Parameters</dt><dd>
2191  <table class="params">
2192    <tr><td class="paramname">componentID</td><td>ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr)</td></tr>
2193    <tr><td class="paramname">width</td><td>width (in pixels) of the YUV image</td></tr>
2194    <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>
2195  </table>
2196  </dd>
2197</dl>
2198<dl class="section return"><dt>Returns</dt><dd>the plane width of a YUV image plane with the given parameters, or -1 if the arguments are out of bounds. </dd></dl>
2199
2200</div>
2201</div>
2202<a class="anchor" id="gae403193ceb4aafb7e0f56ab587b48616"></a>
2203<div class="memitem">
2204<div class="memproto">
2205      <table class="memname">
2206        <tr>
2207          <td class="memname">DLLEXPORT int DLLCALL tjTransform </td>
2208          <td>(</td>
2209          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
2210          <td class="paramname"><em>handle</em>, </td>
2211        </tr>
2212        <tr>
2213          <td class="paramkey"></td>
2214          <td></td>
2215          <td class="paramtype">unsigned char *&#160;</td>
2216          <td class="paramname"><em>jpegBuf</em>, </td>
2217        </tr>
2218        <tr>
2219          <td class="paramkey"></td>
2220          <td></td>
2221          <td class="paramtype">unsigned long&#160;</td>
2222          <td class="paramname"><em>jpegSize</em>, </td>
2223        </tr>
2224        <tr>
2225          <td class="paramkey"></td>
2226          <td></td>
2227          <td class="paramtype">int&#160;</td>
2228          <td class="paramname"><em>n</em>, </td>
2229        </tr>
2230        <tr>
2231          <td class="paramkey"></td>
2232          <td></td>
2233          <td class="paramtype">unsigned char **&#160;</td>
2234          <td class="paramname"><em>dstBufs</em>, </td>
2235        </tr>
2236        <tr>
2237          <td class="paramkey"></td>
2238          <td></td>
2239          <td class="paramtype">unsigned long *&#160;</td>
2240          <td class="paramname"><em>dstSizes</em>, </td>
2241        </tr>
2242        <tr>
2243          <td class="paramkey"></td>
2244          <td></td>
2245          <td class="paramtype"><a class="el" href="structtjtransform.html">tjtransform</a> *&#160;</td>
2246          <td class="paramname"><em>transforms</em>, </td>
2247        </tr>
2248        <tr>
2249          <td class="paramkey"></td>
2250          <td></td>
2251          <td class="paramtype">int&#160;</td>
2252          <td class="paramname"><em>flags</em>&#160;</td>
2253        </tr>
2254        <tr>
2255          <td></td>
2256          <td>)</td>
2257          <td></td><td></td>
2258        </tr>
2259      </table>
2260</div><div class="memdoc">
2261
2262<p>Losslessly transform a JPEG image into another JPEG image. </p>
2263<p>Lossless transforms work by moving the raw DCT coefficients from one JPEG image structure to another without altering the values of the coefficients. While this is typically faster than decompressing the image, transforming it, and re-compressing it, lossless transforms are not free. Each lossless transform requires reading and performing Huffman decoding on all of the coefficients in the source image, regardless of the size of the destination image. Thus, this function provides a means of generating multiple transformed images from the same source or applying multiple transformations simultaneously, in order to eliminate the need to read the source coefficients multiple times.</p>
2264<dl class="params"><dt>Parameters</dt><dd>
2265  <table class="params">
2266    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG transformer instance</td></tr>
2267    <tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG source image to transform. This buffer is not modified.</td></tr>
2268    <tr><td class="paramname">jpegSize</td><td>size of the JPEG source image (in bytes)</td></tr>
2269    <tr><td class="paramname">n</td><td>the number of transformed JPEG images to generate</td></tr>
2270    <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">
2271<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>
2272<li>set <code>dstBufs[i]</code> to NULL to tell TurboJPEG to allocate the buffer for you, or</li>
2273<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b" title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters...">tjBufSize()</a> with the transformed or cropped width and height. This should ensure that the buffer never has to be re-allocated (setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees this.)</li>
2274</ol>
2275If 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>
2276    <tr><td class="paramname">dstSizes</td><td>pointer to an array of n unsigned long variables that will receive the actual sizes (in bytes) of each transformed JPEG image. If <code>dstBufs[i]</code> points to a pre-allocated buffer, then <code>dstSizes[i]</code> should be set to the size of the buffer. Upon return, <code>dstSizes[i]</code> will contain the size of the JPEG image (in bytes.)</td></tr>
2277    <tr><td class="paramname">transforms</td><td>pointer to an array of n <a class="el" href="structtjtransform.html" title="Lossless transform.">tjtransform</a> structures, each of which specifies the transform parameters and/or cropping region for the corresponding transformed output image.</td></tr>
2278    <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>
2279  </table>
2280  </dd>
2281</dl>
2282<dl class="section return"><dt>Returns</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>
2283
2284</div>
2285</div>
2286<h2 class="groupheader">Variable Documentation</h2>
2287<a class="anchor" id="ga84e2e35d3f08025f976ec1ec53693dea"></a>
2288<div class="memitem">
2289<div class="memproto">
2290<table class="mlabels">
2291  <tr>
2292  <td class="mlabels-left">
2293      <table class="memname">
2294        <tr>
2295          <td class="memname">const int tjBlueOffset[<a class="el" href="group___turbo_j_p_e_g.html#ga7010a4402f54a45ba822ad8675a4655e">TJ_NUMPF</a>]</td>
2296        </tr>
2297      </table>
2298  </td>
2299  <td class="mlabels-right">
2300<span class="mlabels"><span class="mlabel">static</span></span>  </td>
2301  </tr>
2302</table>
2303</div><div class="memdoc">
2304
2305<p>Blue offset (in bytes) for a given pixel format. </p>
2306<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>
2307
2308</div>
2309</div>
2310<a class="anchor" id="ga82d6e35da441112a411da41923c0ba2f"></a>
2311<div class="memitem">
2312<div class="memproto">
2313<table class="mlabels">
2314  <tr>
2315  <td class="mlabels-left">
2316      <table class="memname">
2317        <tr>
2318          <td class="memname">const int tjGreenOffset[<a class="el" href="group___turbo_j_p_e_g.html#ga7010a4402f54a45ba822ad8675a4655e">TJ_NUMPF</a>]</td>
2319        </tr>
2320      </table>
2321  </td>
2322  <td class="mlabels-right">
2323<span class="mlabels"><span class="mlabel">static</span></span>  </td>
2324  </tr>
2325</table>
2326</div><div class="memdoc">
2327
2328<p>Green offset (in bytes) for a given pixel format. </p>
2329<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>
2330
2331</div>
2332</div>
2333<a class="anchor" id="gabd247bb9fecb393eca57366feb8327bf"></a>
2334<div class="memitem">
2335<div class="memproto">
2336<table class="mlabels">
2337  <tr>
2338  <td class="mlabels-left">
2339      <table class="memname">
2340        <tr>
2341          <td class="memname">const int tjMCUHeight[<a class="el" href="group___turbo_j_p_e_g.html#ga5ef3d169162ce77ce348e292a0b7477c">TJ_NUMSAMP</a>]</td>
2342        </tr>
2343      </table>
2344  </td>
2345  <td class="mlabels-right">
2346<span class="mlabels"><span class="mlabel">static</span></span>  </td>
2347  </tr>
2348</table>
2349</div><div class="memdoc">
2350
2351<p>MCU block height (in pixels) for a given level of chrominance subsampling. </p>
2352<p>MCU block sizes:</p>
2353<ul>
2354<li>8x8 for no subsampling or grayscale</li>
2355<li>16x8 for 4:2:2</li>
2356<li>8x16 for 4:4:0</li>
2357<li>16x16 for 4:2:0</li>
2358<li>32x8 for 4:1:1 </li>
2359</ul>
2360
2361</div>
2362</div>
2363<a class="anchor" id="ga9e61e7cd47a15a173283ba94e781308c"></a>
2364<div class="memitem">
2365<div class="memproto">
2366<table class="mlabels">
2367  <tr>
2368  <td class="mlabels-left">
2369      <table class="memname">
2370        <tr>
2371          <td class="memname">const int tjMCUWidth[<a class="el" href="group___turbo_j_p_e_g.html#ga5ef3d169162ce77ce348e292a0b7477c">TJ_NUMSAMP</a>]</td>
2372        </tr>
2373      </table>
2374  </td>
2375  <td class="mlabels-right">
2376<span class="mlabels"><span class="mlabel">static</span></span>  </td>
2377  </tr>
2378</table>
2379</div><div class="memdoc">
2380
2381<p>MCU block width (in pixels) for a given level of chrominance subsampling. </p>
2382<p>MCU block sizes:</p>
2383<ul>
2384<li>8x8 for no subsampling or grayscale</li>
2385<li>16x8 for 4:2:2</li>
2386<li>8x16 for 4:4:0</li>
2387<li>16x16 for 4:2:0</li>
2388<li>32x8 for 4:1:1 </li>
2389</ul>
2390
2391</div>
2392</div>
2393<a class="anchor" id="gad77cf8fe5b2bfd3cb3f53098146abb4c"></a>
2394<div class="memitem">
2395<div class="memproto">
2396<table class="mlabels">
2397  <tr>
2398  <td class="mlabels-left">
2399      <table class="memname">
2400        <tr>
2401          <td class="memname">const int tjPixelSize[<a class="el" href="group___turbo_j_p_e_g.html#ga7010a4402f54a45ba822ad8675a4655e">TJ_NUMPF</a>]</td>
2402        </tr>
2403      </table>
2404  </td>
2405  <td class="mlabels-right">
2406<span class="mlabels"><span class="mlabel">static</span></span>  </td>
2407  </tr>
2408</table>
2409</div><div class="memdoc">
2410
2411<p>Pixel size (in bytes) for a given pixel format. </p>
2412
2413</div>
2414</div>
2415<a class="anchor" id="gadd9b446742ac8a3923f7992c7988fea8"></a>
2416<div class="memitem">
2417<div class="memproto">
2418<table class="mlabels">
2419  <tr>
2420  <td class="mlabels-left">
2421      <table class="memname">
2422        <tr>
2423          <td class="memname">const int tjRedOffset[<a class="el" href="group___turbo_j_p_e_g.html#ga7010a4402f54a45ba822ad8675a4655e">TJ_NUMPF</a>]</td>
2424        </tr>
2425      </table>
2426  </td>
2427  <td class="mlabels-right">
2428<span class="mlabels"><span class="mlabel">static</span></span>  </td>
2429  </tr>
2430</table>
2431</div><div class="memdoc">
2432
2433<p>Red offset (in bytes) for a given pixel format. </p>
2434<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>
2435
2436</div>
2437</div>
2438</div><!-- contents -->
2439<!-- start footer part -->
2440<hr class="footer"/><address class="footer"><small>
2441Generated by &#160;<a href="http://www.doxygen.org/index.html">
2442<img class="footer" src="doxygen.png" alt="doxygen"/>
2443</a> 1.8.3.1
2444</small></address>
2445</body>
2446</html>
2447