• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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">2.0</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:ga519cfa4ef6c18d9e5b455fdf59306a3a"><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#ga519cfa4ef6c18d9e5b455fdf59306a3a">TJFLAG_STOPONWARNING</a></td></tr>
132<tr class="memdesc:ga519cfa4ef6c18d9e5b455fdf59306a3a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Immediately discontinue the current compression/decompression/transform operation if the underlying codec throws a warning (non-fatal error).  <a href="#ga519cfa4ef6c18d9e5b455fdf59306a3a">More...</a><br/></td></tr>
133<tr class="separator:ga519cfa4ef6c18d9e5b455fdf59306a3a"><td class="memSeparator" colspan="2">&#160;</td></tr>
134<tr class="memitem:ga43b426750b46190a25d34a67ef76df1b"><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#ga43b426750b46190a25d34a67ef76df1b">TJFLAG_PROGRESSIVE</a></td></tr>
135<tr class="memdesc:ga43b426750b46190a25d34a67ef76df1b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Use progressive entropy coding in JPEG images generated by the compression and transform functions.  <a href="#ga43b426750b46190a25d34a67ef76df1b">More...</a><br/></td></tr>
136<tr class="separator:ga43b426750b46190a25d34a67ef76df1b"><td class="memSeparator" colspan="2">&#160;</td></tr>
137<tr class="memitem:ga79bde1b4a3e2351e00887e47781b966e"><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#ga79bde1b4a3e2351e00887e47781b966e">TJ_NUMERR</a></td></tr>
138<tr class="memdesc:ga79bde1b4a3e2351e00887e47781b966e"><td class="mdescLeft">&#160;</td><td class="mdescRight">The number of error codes.  <a href="#ga79bde1b4a3e2351e00887e47781b966e">More...</a><br/></td></tr>
139<tr class="separator:ga79bde1b4a3e2351e00887e47781b966e"><td class="memSeparator" colspan="2">&#160;</td></tr>
140<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>
141<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>
142<tr class="separator:ga0f6dbd18adf38b7d46ac547f0f4d562c"><td class="memSeparator" colspan="2">&#160;</td></tr>
143<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>
144<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#ga9cb8abf4cc91881e04a0329b2270be25" 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>
145<tr class="separator:ga50e03cb5ed115330e212417429600b00"><td class="memSeparator" colspan="2">&#160;</td></tr>
146<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>
147<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#ga9cb8abf4cc91881e04a0329b2270be25" 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>
148<tr class="separator:ga319826b7eb1583c0595bbe7b95428709"><td class="memSeparator" colspan="2">&#160;</td></tr>
149<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>
150<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>
151<tr class="separator:ga9c771a757fc1294add611906b89ab2d2"><td class="memSeparator" colspan="2">&#160;</td></tr>
152<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>
153<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>
154<tr class="separator:ga3acee7b48ade1b99e5588736007c2589"><td class="memSeparator" colspan="2">&#160;</td></tr>
155<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>
156<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#ga9cb8abf4cc91881e04a0329b2270be25" 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>
157<tr class="separator:gafbf992bbf6e006705886333703ffab31"><td class="memSeparator" colspan="2">&#160;</td></tr>
158<tr class="memitem:gad2371c80674584ecc1a7d75e564cf026"><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#gad2371c80674584ecc1a7d75e564cf026">TJXOPT_PROGRESSIVE</a></td></tr>
159<tr class="memdesc:gad2371c80674584ecc1a7d75e564cf026"><td class="mdescLeft">&#160;</td><td class="mdescRight">This option will enable progressive entropy coding in the output image generated by this particular transform.  <a href="#gad2371c80674584ecc1a7d75e564cf026">More...</a><br/></td></tr>
160<tr class="separator:gad2371c80674584ecc1a7d75e564cf026"><td class="memSeparator" colspan="2">&#160;</td></tr>
161<tr class="memitem:ga153b468cfb905d0de61706c838986fe8"><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#ga153b468cfb905d0de61706c838986fe8">TJXOPT_COPYNONE</a></td></tr>
162<tr class="memdesc:ga153b468cfb905d0de61706c838986fe8"><td class="mdescLeft">&#160;</td><td class="mdescRight">This option will prevent <a class="el" href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> from copying any extra markers (including EXIF and ICC profile data) from the source image to the output image.  <a href="#ga153b468cfb905d0de61706c838986fe8">More...</a><br/></td></tr>
163<tr class="separator:ga153b468cfb905d0de61706c838986fe8"><td class="memSeparator" colspan="2">&#160;</td></tr>
164<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>
165<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>
166<tr class="separator:ga0aba955473315e405295d978f0c16511"><td class="memSeparator" colspan="2">&#160;</td></tr>
167<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>
168<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>
169<tr class="separator:ga84878bb65404204743aa18cac02781df"><td class="memSeparator" colspan="2">&#160;</td></tr>
170</table><table class="memberdecls">
171<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
172Typedefs</h2></td></tr>
173<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>
174<tr class="memdesc:gaa29f3189c41be12ec5dee7caec318a31"><td class="mdescLeft">&#160;</td><td class="mdescRight">Lossless transform.  <a href="#gaa29f3189c41be12ec5dee7caec318a31">More...</a><br/></td></tr>
175<tr class="separator:gaa29f3189c41be12ec5dee7caec318a31"><td class="memSeparator" colspan="2">&#160;</td></tr>
176<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>
177<tr class="memdesc:ga758d2634ecb4949de7815cba621f5763"><td class="mdescLeft">&#160;</td><td class="mdescRight">TurboJPEG instance handle.  <a href="#ga758d2634ecb4949de7815cba621f5763">More...</a><br/></td></tr>
178<tr class="separator:ga758d2634ecb4949de7815cba621f5763"><td class="memSeparator" colspan="2">&#160;</td></tr>
179</table><table class="memberdecls">
180<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a>
181Enumerations</h2></td></tr>
182<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/>
183&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074afb8da4f44197837bdec0a4f593dacae3">TJSAMP_444</a>,
184<a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a136130902cc578f11f32429b59368404">TJSAMP_422</a>,
185<a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a63085dbf683cfe39e513cdb6343e3737">TJSAMP_420</a>,
186<a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a3f1c9504842ddc7a48d0f690754b6248">TJSAMP_GRAY</a>,
187<br/>
188&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074accf740e6f3aa6ba20ba922cad13cb974">TJSAMP_440</a>,
189<a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a28ec62575e5ea295c3fde3001dc628e2">TJSAMP_411</a>
190<br/>
191 }</td></tr>
192<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>
193<tr class="separator:ga1d047060ea80bb9820d540bb928e9074"><td class="memSeparator" colspan="2">&#160;</td></tr>
194<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/>
195&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7ce93230bff449518ce387c17e6ed37c">TJPF_RGB</a>,
196<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aab10624437fb8ef495a0b153e65749839">TJPF_BGR</a>,
197<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01">TJPF_RGBX</a>,
198<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa2a1fbf569ca79897eae886e3376ca4c8">TJPF_BGRX</a>,
199<br/>
200&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af">TJPF_XBGR</a>,
201<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84">TJPF_XRGB</a>,
202<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a">TJPF_GRAY</a>,
203<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa88d2e88fab67f6503cf972e14851cc12">TJPF_RGBA</a>,
204<br/>
205&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aac037ff1845cf9b74bb81a3659c2b9fb4">TJPF_BGRA</a>,
206<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa1ba1a7f1631dbeaa49a0a85fc4a40081">TJPF_ABGR</a>,
207<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aae8f846ed9d9de99b6e1dfe448848765c">TJPF_ARGB</a>,
208<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7f5100ec44c91994e243f1cf55553f8b">TJPF_CMYK</a>,
209<br/>
210&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa84c1a6cead7952998e2fb895844a21ed">TJPF_UNKNOWN</a>
211<br/>
212 }</td></tr>
213<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>
214<tr class="separator:gac916144e26c3817ac514e64ae5d12e2a"><td class="memSeparator" colspan="2">&#160;</td></tr>
215<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/>
216&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a677cb7ccb85c4038ac41964a2e09e555">TJCS_RGB</a>,
217<a class="el" href="group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a7389b8f65bb387ffedce3efd0d78ec75">TJCS_YCbCr</a>,
218<a class="el" href="group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720ab3e7d6a87f695e45b81c1b5262b5a50a">TJCS_GRAY</a>,
219<a class="el" href="group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a6c8b636152ac8195b869587db315ee53">TJCS_CMYK</a>,
220<br/>
221&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a53839e0fe867b76b58d16b0a1a7c598e">TJCS_YCCK</a>
222<br/>
223 }</td></tr>
224<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>
225<tr class="separator:ga4f83ad3368e0e29d1957be0efa7c3720"><td class="memSeparator" colspan="2">&#160;</td></tr>
226<tr class="memitem:gafbc17cfa57d0d5d11fea35ac025950fe"><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#gafbc17cfa57d0d5d11fea35ac025950fe">TJERR</a> { <a class="el" href="group___turbo_j_p_e_g.html#ggafbc17cfa57d0d5d11fea35ac025950fea342dd6e2aedb47bb257b4e7568329b59">TJERR_WARNING</a>,
227<a class="el" href="group___turbo_j_p_e_g.html#ggafbc17cfa57d0d5d11fea35ac025950feafc9cceeada13122b09e4851e3788039a">TJERR_FATAL</a>
228 }</td></tr>
229<tr class="memdesc:gafbc17cfa57d0d5d11fea35ac025950fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Error codes.  <a href="group___turbo_j_p_e_g.html#gafbc17cfa57d0d5d11fea35ac025950fe">More...</a><br/></td></tr>
230<tr class="separator:gafbc17cfa57d0d5d11fea35ac025950fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
231<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/>
232&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aad88c0366cd3f7d0eac9d7a3fa1c2c27">TJXOP_NONE</a>,
233<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aa0df69776caa30f0fa28e26332d311ce">TJXOP_HFLIP</a>,
234<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a324eddfbec53b7e691f61e56929d0d5d">TJXOP_VFLIP</a>,
235<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a31060aed199f886afdd417f80499c32d">TJXOP_TRANSPOSE</a>,
236<br/>
237&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866af3b14d488aea6ece9e5b3df73a74d6a4">TJXOP_TRANSVERSE</a>,
238<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a43b2bbb23bc4bd548422d43fbe9af128">TJXOP_ROT90</a>,
239<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a140952eb8dd0300accfcc22726d69692">TJXOP_ROT180</a>,
240<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a3064ee5dfb7f032df332818587567a08">TJXOP_ROT270</a>
241<br/>
242 }</td></tr>
243<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#ga9cb8abf4cc91881e04a0329b2270be25" 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>
244<tr class="separator:ga2de531af4e7e6c4f124908376b354866"><td class="memSeparator" colspan="2">&#160;</td></tr>
245</table><table class="memberdecls">
246<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
247Functions</h2></td></tr>
248<tr class="memitem:ga9d63a05fc6d813f4aae06107041a37e8"><td class="memItemLeft" align="right" valign="top">DLLEXPORT <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga9d63a05fc6d813f4aae06107041a37e8">tjInitCompress</a> (void)</td></tr>
249<tr class="memdesc:ga9d63a05fc6d813f4aae06107041a37e8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a TurboJPEG compressor instance.  <a href="#ga9d63a05fc6d813f4aae06107041a37e8">More...</a><br/></td></tr>
250<tr class="separator:ga9d63a05fc6d813f4aae06107041a37e8"><td class="memSeparator" colspan="2">&#160;</td></tr>
251<tr class="memitem:gafbdce0112fd78fd38efae841443a9bcf"><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#gafbdce0112fd78fd38efae841443a9bcf">tjCompress2</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const 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>
252<tr class="memdesc:gafbdce0112fd78fd38efae841443a9bcf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compress an RGB, grayscale, or CMYK image into a JPEG image.  <a href="#gafbdce0112fd78fd38efae841443a9bcf">More...</a><br/></td></tr>
253<tr class="separator:gafbdce0112fd78fd38efae841443a9bcf"><td class="memSeparator" colspan="2">&#160;</td></tr>
254<tr class="memitem:ga7622a459b79aa1007e005b58783f875b"><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#ga7622a459b79aa1007e005b58783f875b">tjCompressFromYUV</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *srcBuf, int width, int pad, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags)</td></tr>
255<tr class="memdesc:ga7622a459b79aa1007e005b58783f875b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compress a YUV planar image into a JPEG image.  <a href="#ga7622a459b79aa1007e005b58783f875b">More...</a><br/></td></tr>
256<tr class="separator:ga7622a459b79aa1007e005b58783f875b"><td class="memSeparator" colspan="2">&#160;</td></tr>
257<tr class="memitem:ga29ec5dfbd2d84b8724e951d6fa0d5d9e"><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#ga29ec5dfbd2d84b8724e951d6fa0d5d9e">tjCompressFromYUVPlanes</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char **srcPlanes, int width, const int *strides, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags)</td></tr>
258<tr class="memdesc:ga29ec5dfbd2d84b8724e951d6fa0d5d9e"><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="#ga29ec5dfbd2d84b8724e951d6fa0d5d9e">More...</a><br/></td></tr>
259<tr class="separator:ga29ec5dfbd2d84b8724e951d6fa0d5d9e"><td class="memSeparator" colspan="2">&#160;</td></tr>
260<tr class="memitem:ga67ac12fee79073242cb216e07c9f1f90"><td class="memItemLeft" align="right" valign="top">DLLEXPORT unsigned long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga67ac12fee79073242cb216e07c9f1f90">tjBufSize</a> (int width, int height, int jpegSubsamp)</td></tr>
261<tr class="memdesc:ga67ac12fee79073242cb216e07c9f1f90"><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="#ga67ac12fee79073242cb216e07c9f1f90">More...</a><br/></td></tr>
262<tr class="separator:ga67ac12fee79073242cb216e07c9f1f90"><td class="memSeparator" colspan="2">&#160;</td></tr>
263<tr class="memitem:ga2be2b9969d4df9ecce9b05deed273194"><td class="memItemLeft" align="right" valign="top">DLLEXPORT unsigned long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga2be2b9969d4df9ecce9b05deed273194">tjBufSizeYUV2</a> (int width, int pad, int height, int subsamp)</td></tr>
264<tr class="memdesc:ga2be2b9969d4df9ecce9b05deed273194"><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="#ga2be2b9969d4df9ecce9b05deed273194">More...</a><br/></td></tr>
265<tr class="separator:ga2be2b9969d4df9ecce9b05deed273194"><td class="memSeparator" colspan="2">&#160;</td></tr>
266<tr class="memitem:gab4ab7b24f6e797d79abaaa670373961d"><td class="memItemLeft" align="right" valign="top">DLLEXPORT unsigned long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gab4ab7b24f6e797d79abaaa670373961d">tjPlaneSizeYUV</a> (int componentID, int width, int stride, int height, int subsamp)</td></tr>
267<tr class="memdesc:gab4ab7b24f6e797d79abaaa670373961d"><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="#gab4ab7b24f6e797d79abaaa670373961d">More...</a><br/></td></tr>
268<tr class="separator:gab4ab7b24f6e797d79abaaa670373961d"><td class="memSeparator" colspan="2">&#160;</td></tr>
269<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>
270<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>
271<tr class="separator:ga63fb66bb1e36c74008c4634360becbb1"><td class="memSeparator" colspan="2">&#160;</td></tr>
272<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>
273<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>
274<tr class="separator:ga1a209696c6a80748f20e134b3c64789f"><td class="memSeparator" colspan="2">&#160;</td></tr>
275<tr class="memitem:gac519b922cdf446e97d0cdcba513636bf"><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#gac519b922cdf446e97d0cdcba513636bf">tjEncodeYUV3</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char *dstBuf, int pad, int subsamp, int flags)</td></tr>
276<tr class="memdesc:gac519b922cdf446e97d0cdcba513636bf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Encode an RGB or grayscale image into a YUV planar image.  <a href="#gac519b922cdf446e97d0cdcba513636bf">More...</a><br/></td></tr>
277<tr class="separator:gac519b922cdf446e97d0cdcba513636bf"><td class="memSeparator" colspan="2">&#160;</td></tr>
278<tr class="memitem:gae2d04c72457fe7f4d60cf78ab1b1feb1"><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#gae2d04c72457fe7f4d60cf78ab1b1feb1">tjEncodeYUVPlanes</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char **dstPlanes, int *strides, int subsamp, int flags)</td></tr>
279<tr class="memdesc:gae2d04c72457fe7f4d60cf78ab1b1feb1"><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="#gae2d04c72457fe7f4d60cf78ab1b1feb1">More...</a><br/></td></tr>
280<tr class="separator:gae2d04c72457fe7f4d60cf78ab1b1feb1"><td class="memSeparator" colspan="2">&#160;</td></tr>
281<tr class="memitem:ga52300eac3f3d9ef4bab303bc244f62d3"><td class="memItemLeft" align="right" valign="top">DLLEXPORT <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga52300eac3f3d9ef4bab303bc244f62d3">tjInitDecompress</a> (void)</td></tr>
282<tr class="memdesc:ga52300eac3f3d9ef4bab303bc244f62d3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a TurboJPEG decompressor instance.  <a href="#ga52300eac3f3d9ef4bab303bc244f62d3">More...</a><br/></td></tr>
283<tr class="separator:ga52300eac3f3d9ef4bab303bc244f62d3"><td class="memSeparator" colspan="2">&#160;</td></tr>
284<tr class="memitem:ga0595681096bba7199cc6f3533cb25f77"><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#ga0595681096bba7199cc6f3533cb25f77">tjDecompressHeader3</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *jpegBuf, unsigned long jpegSize, int *width, int *height, int *jpegSubsamp, int *jpegColorspace)</td></tr>
285<tr class="memdesc:ga0595681096bba7199cc6f3533cb25f77"><td class="mdescLeft">&#160;</td><td class="mdescRight">Retrieve information about a JPEG image without decompressing it.  <a href="#ga0595681096bba7199cc6f3533cb25f77">More...</a><br/></td></tr>
286<tr class="separator:ga0595681096bba7199cc6f3533cb25f77"><td class="memSeparator" colspan="2">&#160;</td></tr>
287<tr class="memitem:gac3854476006b10787bd128f7ede48057"><td class="memItemLeft" align="right" valign="top">DLLEXPORT <a class="el" href="structtjscalingfactor.html">tjscalingfactor</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gac3854476006b10787bd128f7ede48057">tjGetScalingFactors</a> (int *numscalingfactors)</td></tr>
288<tr class="memdesc:gac3854476006b10787bd128f7ede48057"><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="#gac3854476006b10787bd128f7ede48057">More...</a><br/></td></tr>
289<tr class="separator:gac3854476006b10787bd128f7ede48057"><td class="memSeparator" colspan="2">&#160;</td></tr>
290<tr class="memitem:gae9eccef8b682a48f43a9117c231ed013"><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#gae9eccef8b682a48f43a9117c231ed013">tjDecompress2</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)</td></tr>
291<tr class="memdesc:gae9eccef8b682a48f43a9117c231ed013"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decompress a JPEG image to an RGB, grayscale, or CMYK image.  <a href="#gae9eccef8b682a48f43a9117c231ed013">More...</a><br/></td></tr>
292<tr class="separator:gae9eccef8b682a48f43a9117c231ed013"><td class="memSeparator" colspan="2">&#160;</td></tr>
293<tr class="memitem:ga04d1e839ff9a0860dd1475cff78d3364"><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#ga04d1e839ff9a0860dd1475cff78d3364">tjDecompressToYUV2</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, int width, int pad, int height, int flags)</td></tr>
294<tr class="memdesc:ga04d1e839ff9a0860dd1475cff78d3364"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decompress a JPEG image to a YUV planar image.  <a href="#ga04d1e839ff9a0860dd1475cff78d3364">More...</a><br/></td></tr>
295<tr class="separator:ga04d1e839ff9a0860dd1475cff78d3364"><td class="memSeparator" colspan="2">&#160;</td></tr>
296<tr class="memitem:gaa59f901a5258ada5bd0185ad59368540"><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#gaa59f901a5258ada5bd0185ad59368540">tjDecompressToYUVPlanes</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *jpegBuf, unsigned long jpegSize, unsigned char **dstPlanes, int width, int *strides, int height, int flags)</td></tr>
297<tr class="memdesc:gaa59f901a5258ada5bd0185ad59368540"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decompress a JPEG image into separate Y, U (Cb), and V (Cr) image planes.  <a href="#gaa59f901a5258ada5bd0185ad59368540">More...</a><br/></td></tr>
298<tr class="separator:gaa59f901a5258ada5bd0185ad59368540"><td class="memSeparator" colspan="2">&#160;</td></tr>
299<tr class="memitem:ga70abbf38f77a26fd6da8813bef96f695"><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#ga70abbf38f77a26fd6da8813bef96f695">tjDecodeYUV</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *srcBuf, int pad, int subsamp, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)</td></tr>
300<tr class="memdesc:ga70abbf38f77a26fd6da8813bef96f695"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decode a YUV planar image into an RGB or grayscale image.  <a href="#ga70abbf38f77a26fd6da8813bef96f695">More...</a><br/></td></tr>
301<tr class="separator:ga70abbf38f77a26fd6da8813bef96f695"><td class="memSeparator" colspan="2">&#160;</td></tr>
302<tr class="memitem:ga10e837c07fa9d25770565b237d3898d9"><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#ga10e837c07fa9d25770565b237d3898d9">tjDecodeYUVPlanes</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char **srcPlanes, const int *strides, int subsamp, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)</td></tr>
303<tr class="memdesc:ga10e837c07fa9d25770565b237d3898d9"><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="#ga10e837c07fa9d25770565b237d3898d9">More...</a><br/></td></tr>
304<tr class="separator:ga10e837c07fa9d25770565b237d3898d9"><td class="memSeparator" colspan="2">&#160;</td></tr>
305<tr class="memitem:ga928beff6ac248ceadf01089fc6b41957"><td class="memItemLeft" align="right" valign="top">DLLEXPORT <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga928beff6ac248ceadf01089fc6b41957">tjInitTransform</a> (void)</td></tr>
306<tr class="memdesc:ga928beff6ac248ceadf01089fc6b41957"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a new TurboJPEG transformer instance.  <a href="#ga928beff6ac248ceadf01089fc6b41957">More...</a><br/></td></tr>
307<tr class="separator:ga928beff6ac248ceadf01089fc6b41957"><td class="memSeparator" colspan="2">&#160;</td></tr>
308<tr class="memitem:ga9cb8abf4cc91881e04a0329b2270be25"><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#ga9cb8abf4cc91881e04a0329b2270be25">tjTransform</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const 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>
309<tr class="memdesc:ga9cb8abf4cc91881e04a0329b2270be25"><td class="mdescLeft">&#160;</td><td class="mdescRight">Losslessly transform a JPEG image into another JPEG image.  <a href="#ga9cb8abf4cc91881e04a0329b2270be25">More...</a><br/></td></tr>
310<tr class="separator:ga9cb8abf4cc91881e04a0329b2270be25"><td class="memSeparator" colspan="2">&#160;</td></tr>
311<tr class="memitem:ga75f355fa27225ba1a4ee392c852394d2"><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#ga75f355fa27225ba1a4ee392c852394d2">tjDestroy</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle)</td></tr>
312<tr class="memdesc:ga75f355fa27225ba1a4ee392c852394d2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroy a TurboJPEG compressor, decompressor, or transformer instance.  <a href="#ga75f355fa27225ba1a4ee392c852394d2">More...</a><br/></td></tr>
313<tr class="separator:ga75f355fa27225ba1a4ee392c852394d2"><td class="memSeparator" colspan="2">&#160;</td></tr>
314<tr class="memitem:gaec627dd4c5f30b7a775a7aea3bec5d83"><td class="memItemLeft" align="right" valign="top">DLLEXPORT unsigned char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83">tjAlloc</a> (int bytes)</td></tr>
315<tr class="memdesc:gaec627dd4c5f30b7a775a7aea3bec5d83"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocate an image buffer for use with TurboJPEG.  <a href="#gaec627dd4c5f30b7a775a7aea3bec5d83">More...</a><br/></td></tr>
316<tr class="separator:gaec627dd4c5f30b7a775a7aea3bec5d83"><td class="memSeparator" colspan="2">&#160;</td></tr>
317<tr class="memitem:gaffbd83c375e79f5db4b5c5d8ad4466e7"><td class="memItemLeft" align="right" valign="top">DLLEXPORT unsigned char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gaffbd83c375e79f5db4b5c5d8ad4466e7">tjLoadImage</a> (const char *filename, int *width, int align, int *height, int *pixelFormat, int flags)</td></tr>
318<tr class="memdesc:gaffbd83c375e79f5db4b5c5d8ad4466e7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Load an uncompressed image from disk into memory.  <a href="#gaffbd83c375e79f5db4b5c5d8ad4466e7">More...</a><br/></td></tr>
319<tr class="separator:gaffbd83c375e79f5db4b5c5d8ad4466e7"><td class="memSeparator" colspan="2">&#160;</td></tr>
320<tr class="memitem:ga6f445b22d8933ae4815b3370a538d879"><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#ga6f445b22d8933ae4815b3370a538d879">tjSaveImage</a> (const char *filename, unsigned char *buffer, int width, int pitch, int height, int pixelFormat, int flags)</td></tr>
321<tr class="memdesc:ga6f445b22d8933ae4815b3370a538d879"><td class="mdescLeft">&#160;</td><td class="mdescRight">Save an uncompressed image from memory to disk.  <a href="#ga6f445b22d8933ae4815b3370a538d879">More...</a><br/></td></tr>
322<tr class="separator:ga6f445b22d8933ae4815b3370a538d879"><td class="memSeparator" colspan="2">&#160;</td></tr>
323<tr class="memitem:gaea863d2da0cdb609563aabdf9196514b"><td class="memItemLeft" align="right" valign="top">DLLEXPORT void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gaea863d2da0cdb609563aabdf9196514b">tjFree</a> (unsigned char *buffer)</td></tr>
324<tr class="memdesc:gaea863d2da0cdb609563aabdf9196514b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Free an image buffer previously allocated by TurboJPEG.  <a href="#gaea863d2da0cdb609563aabdf9196514b">More...</a><br/></td></tr>
325<tr class="separator:gaea863d2da0cdb609563aabdf9196514b"><td class="memSeparator" colspan="2">&#160;</td></tr>
326<tr class="memitem:ga1ead8574f9f39fbafc6b497124e7aafa"><td class="memItemLeft" align="right" valign="top">DLLEXPORT char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa">tjGetErrorStr2</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle)</td></tr>
327<tr class="memdesc:ga1ead8574f9f39fbafc6b497124e7aafa"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a descriptive error message explaining why the last command failed.  <a href="#ga1ead8574f9f39fbafc6b497124e7aafa">More...</a><br/></td></tr>
328<tr class="separator:ga1ead8574f9f39fbafc6b497124e7aafa"><td class="memSeparator" colspan="2">&#160;</td></tr>
329<tr class="memitem:ga414feeffbf860ebd31c745df203de410"><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#ga414feeffbf860ebd31c745df203de410">tjGetErrorCode</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle)</td></tr>
330<tr class="memdesc:ga414feeffbf860ebd31c745df203de410"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a code indicating the severity of the last error.  <a href="#ga414feeffbf860ebd31c745df203de410">More...</a><br/></td></tr>
331<tr class="separator:ga414feeffbf860ebd31c745df203de410"><td class="memSeparator" colspan="2">&#160;</td></tr>
332</table><table class="memberdecls">
333<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
334Variables</h2></td></tr>
335<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>
336<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>
337<tr class="separator:ga9e61e7cd47a15a173283ba94e781308c"><td class="memSeparator" colspan="2">&#160;</td></tr>
338<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>
339<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>
340<tr class="separator:gabd247bb9fecb393eca57366feb8327bf"><td class="memSeparator" colspan="2">&#160;</td></tr>
341<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>
342<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>
343<tr class="separator:gadd9b446742ac8a3923f7992c7988fea8"><td class="memSeparator" colspan="2">&#160;</td></tr>
344<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>
345<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>
346<tr class="separator:ga82d6e35da441112a411da41923c0ba2f"><td class="memSeparator" colspan="2">&#160;</td></tr>
347<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>
348<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>
349<tr class="separator:ga84e2e35d3f08025f976ec1ec53693dea"><td class="memSeparator" colspan="2">&#160;</td></tr>
350<tr class="memitem:ga5af0ab065feefd526debf1e20c43e837"><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#ga5af0ab065feefd526debf1e20c43e837">tjAlphaOffset</a> [<a class="el" href="group___turbo_j_p_e_g.html#ga7010a4402f54a45ba822ad8675a4655e">TJ_NUMPF</a>]</td></tr>
351<tr class="memdesc:ga5af0ab065feefd526debf1e20c43e837"><td class="mdescLeft">&#160;</td><td class="mdescRight">Alpha offset (in bytes) for a given pixel format.  <a href="#ga5af0ab065feefd526debf1e20c43e837">More...</a><br/></td></tr>
352<tr class="separator:ga5af0ab065feefd526debf1e20c43e837"><td class="memSeparator" colspan="2">&#160;</td></tr>
353<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>
354<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>
355<tr class="separator:gad77cf8fe5b2bfd3cb3f53098146abb4c"><td class="memSeparator" colspan="2">&#160;</td></tr>
356</table>
357<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
358<p>TurboJPEG API. </p>
359<p>This API provides an interface for generating, decoding, and transforming planar YUV and JPEG images in memory.</p>
360<p><a class="anchor" id="YUVnotes"></a></p>
361<h2>YUV Image Format Notes</h2>
362<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>
363<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>
364<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>
365<h2 class="groupheader">Macro Definition Documentation</h2>
366<a class="anchor" id="ga39f57a6fb02d9cf32e7b6890099b5a71"></a>
367<div class="memitem">
368<div class="memproto">
369      <table class="memname">
370        <tr>
371          <td class="memname">#define TJ_NUMCS</td>
372        </tr>
373      </table>
374</div><div class="memdoc">
375
376<p>The number of JPEG colorspaces. </p>
377
378</div>
379</div>
380<a class="anchor" id="ga79bde1b4a3e2351e00887e47781b966e"></a>
381<div class="memitem">
382<div class="memproto">
383      <table class="memname">
384        <tr>
385          <td class="memname">#define TJ_NUMERR</td>
386        </tr>
387      </table>
388</div><div class="memdoc">
389
390<p>The number of error codes. </p>
391
392</div>
393</div>
394<a class="anchor" id="ga7010a4402f54a45ba822ad8675a4655e"></a>
395<div class="memitem">
396<div class="memproto">
397      <table class="memname">
398        <tr>
399          <td class="memname">#define TJ_NUMPF</td>
400        </tr>
401      </table>
402</div><div class="memdoc">
403
404<p>The number of pixel formats. </p>
405
406</div>
407</div>
408<a class="anchor" id="ga5ef3d169162ce77ce348e292a0b7477c"></a>
409<div class="memitem">
410<div class="memproto">
411      <table class="memname">
412        <tr>
413          <td class="memname">#define TJ_NUMSAMP</td>
414        </tr>
415      </table>
416</div><div class="memdoc">
417
418<p>The number of chrominance subsampling options. </p>
419
420</div>
421</div>
422<a class="anchor" id="ga0f6dbd18adf38b7d46ac547f0f4d562c"></a>
423<div class="memitem">
424<div class="memproto">
425      <table class="memname">
426        <tr>
427          <td class="memname">#define TJ_NUMXOP</td>
428        </tr>
429      </table>
430</div><div class="memdoc">
431
432<p>The number of transform operations. </p>
433
434</div>
435</div>
436<a class="anchor" id="gacb233cfd722d66d1ccbf48a7de81f0e0"></a>
437<div class="memitem">
438<div class="memproto">
439      <table class="memname">
440        <tr>
441          <td class="memname">#define TJFLAG_ACCURATEDCT</td>
442        </tr>
443      </table>
444</div><div class="memdoc">
445
446<p>Use the most accurate DCT/IDCT algorithm available in the underlying codec. </p>
447<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>
448
449</div>
450</div>
451<a class="anchor" id="ga72ecf4ebe6eb702d3c6f5ca27455e1ec"></a>
452<div class="memitem">
453<div class="memproto">
454      <table class="memname">
455        <tr>
456          <td class="memname">#define TJFLAG_BOTTOMUP</td>
457        </tr>
458      </table>
459</div><div class="memdoc">
460
461<p>The uncompressed source/destination image is stored in bottom-up (Windows, OpenGL) order, not top-down (X11) order. </p>
462
463</div>
464</div>
465<a class="anchor" id="gaabce235db80d3f698b27f36cbd453da2"></a>
466<div class="memitem">
467<div class="memproto">
468      <table class="memname">
469        <tr>
470          <td class="memname">#define TJFLAG_FASTDCT</td>
471        </tr>
472      </table>
473</div><div class="memdoc">
474
475<p>Use the fastest DCT/IDCT algorithm available in the underlying codec. </p>
476<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>
477
478</div>
479</div>
480<a class="anchor" id="ga4ee4506c81177a06f77e2504a22efd2d"></a>
481<div class="memitem">
482<div class="memproto">
483      <table class="memname">
484        <tr>
485          <td class="memname">#define TJFLAG_FASTUPSAMPLE</td>
486        </tr>
487      </table>
488</div><div class="memdoc">
489
490<p>When decompressing an image that was compressed using chrominance subsampling, use the fastest chrominance upsampling algorithm available in the underlying codec. </p>
491<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>
492
493</div>
494</div>
495<a class="anchor" id="ga8808d403c68b62aaa58a4c1e58e98963"></a>
496<div class="memitem">
497<div class="memproto">
498      <table class="memname">
499        <tr>
500          <td class="memname">#define TJFLAG_NOREALLOC</td>
501        </tr>
502      </table>
503</div><div class="memdoc">
504
505<p>Disable buffer (re)allocation. </p>
506<p>If passed to one of the JPEG compression or transform functions, 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>
507
508</div>
509</div>
510<a class="anchor" id="ga43b426750b46190a25d34a67ef76df1b"></a>
511<div class="memitem">
512<div class="memproto">
513      <table class="memname">
514        <tr>
515          <td class="memname">#define TJFLAG_PROGRESSIVE</td>
516        </tr>
517      </table>
518</div><div class="memdoc">
519
520<p>Use progressive entropy coding in JPEG images generated by the compression and transform functions. </p>
521<p>Progressive entropy coding will generally improve compression relative to baseline entropy coding (the default), but it will reduce compression and decompression performance considerably. </p>
522
523</div>
524</div>
525<a class="anchor" id="ga519cfa4ef6c18d9e5b455fdf59306a3a"></a>
526<div class="memitem">
527<div class="memproto">
528      <table class="memname">
529        <tr>
530          <td class="memname">#define TJFLAG_STOPONWARNING</td>
531        </tr>
532      </table>
533</div><div class="memdoc">
534
535<p>Immediately discontinue the current compression/decompression/transform operation if the underlying codec throws a warning (non-fatal error). </p>
536<p>The default behavior is to allow the operation to complete unless a fatal error is encountered. </p>
537
538</div>
539</div>
540<a class="anchor" id="ga0aba955473315e405295d978f0c16511"></a>
541<div class="memitem">
542<div class="memproto">
543      <table class="memname">
544        <tr>
545          <td class="memname">#define TJPAD</td>
546          <td>(</td>
547          <td class="paramtype">&#160;</td>
548          <td class="paramname">width</td><td>)</td>
549          <td></td>
550        </tr>
551      </table>
552</div><div class="memdoc">
553
554<p>Pad the given width to the nearest 32-bit boundary. </p>
555
556</div>
557</div>
558<a class="anchor" id="ga84878bb65404204743aa18cac02781df"></a>
559<div class="memitem">
560<div class="memproto">
561      <table class="memname">
562        <tr>
563          <td class="memname">#define TJSCALED</td>
564          <td>(</td>
565          <td class="paramtype">&#160;</td>
566          <td class="paramname">dimension, </td>
567        </tr>
568        <tr>
569          <td class="paramkey"></td>
570          <td></td>
571          <td class="paramtype">&#160;</td>
572          <td class="paramname">scalingFactor&#160;</td>
573        </tr>
574        <tr>
575          <td></td>
576          <td>)</td>
577          <td></td><td></td>
578        </tr>
579      </table>
580</div><div class="memdoc">
581
582<p>Compute the scaled value of <code>dimension</code> using the given scaling factor. </p>
583<p>This macro performs the integer equivalent of <code>ceil(dimension * scalingFactor)</code>. </p>
584
585</div>
586</div>
587<a class="anchor" id="ga153b468cfb905d0de61706c838986fe8"></a>
588<div class="memitem">
589<div class="memproto">
590      <table class="memname">
591        <tr>
592          <td class="memname">#define TJXOPT_COPYNONE</td>
593        </tr>
594      </table>
595</div><div class="memdoc">
596
597<p>This option will prevent <a class="el" href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> from copying any extra markers (including EXIF and ICC profile data) from the source image to the output image. </p>
598
599</div>
600</div>
601<a class="anchor" id="ga9c771a757fc1294add611906b89ab2d2"></a>
602<div class="memitem">
603<div class="memproto">
604      <table class="memname">
605        <tr>
606          <td class="memname">#define TJXOPT_CROP</td>
607        </tr>
608      </table>
609</div><div class="memdoc">
610
611<p>This option will enable lossless cropping. </p>
612<p>See <a class="el" href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> for more information. </p>
613
614</div>
615</div>
616<a class="anchor" id="ga3acee7b48ade1b99e5588736007c2589"></a>
617<div class="memitem">
618<div class="memproto">
619      <table class="memname">
620        <tr>
621          <td class="memname">#define TJXOPT_GRAY</td>
622        </tr>
623      </table>
624</div><div class="memdoc">
625
626<p>This option will discard the color data in the input image and produce a grayscale output image. </p>
627
628</div>
629</div>
630<a class="anchor" id="gafbf992bbf6e006705886333703ffab31"></a>
631<div class="memitem">
632<div class="memproto">
633      <table class="memname">
634        <tr>
635          <td class="memname">#define TJXOPT_NOOUTPUT</td>
636        </tr>
637      </table>
638</div><div class="memdoc">
639
640<p>This option will prevent <a class="el" href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25" 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>
641
642</div>
643</div>
644<a class="anchor" id="ga50e03cb5ed115330e212417429600b00"></a>
645<div class="memitem">
646<div class="memproto">
647      <table class="memname">
648        <tr>
649          <td class="memname">#define TJXOPT_PERFECT</td>
650        </tr>
651      </table>
652</div><div class="memdoc">
653
654<p>This option will cause <a class="el" href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> to return an error if the transform is not perfect. </p>
655<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>
656
657</div>
658</div>
659<a class="anchor" id="gad2371c80674584ecc1a7d75e564cf026"></a>
660<div class="memitem">
661<div class="memproto">
662      <table class="memname">
663        <tr>
664          <td class="memname">#define TJXOPT_PROGRESSIVE</td>
665        </tr>
666      </table>
667</div><div class="memdoc">
668
669<p>This option will enable progressive entropy coding in the output image generated by this particular transform. </p>
670<p>Progressive entropy coding will generally improve compression relative to baseline entropy coding (the default), but it will reduce compression and decompression performance considerably. </p>
671
672</div>
673</div>
674<a class="anchor" id="ga319826b7eb1583c0595bbe7b95428709"></a>
675<div class="memitem">
676<div class="memproto">
677      <table class="memname">
678        <tr>
679          <td class="memname">#define TJXOPT_TRIM</td>
680        </tr>
681      </table>
682</div><div class="memdoc">
683
684<p>This option will cause <a class="el" href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> to discard any partial MCU blocks that cannot be transformed. </p>
685
686</div>
687</div>
688<h2 class="groupheader">Typedef Documentation</h2>
689<a class="anchor" id="ga758d2634ecb4949de7815cba621f5763"></a>
690<div class="memitem">
691<div class="memproto">
692      <table class="memname">
693        <tr>
694          <td class="memname">typedef void* <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a></td>
695        </tr>
696      </table>
697</div><div class="memdoc">
698
699<p>TurboJPEG instance handle. </p>
700
701</div>
702</div>
703<a class="anchor" id="gaa29f3189c41be12ec5dee7caec318a31"></a>
704<div class="memitem">
705<div class="memproto">
706      <table class="memname">
707        <tr>
708          <td class="memname">typedef struct <a class="el" href="structtjtransform.html">tjtransform</a>  <a class="el" href="structtjtransform.html">tjtransform</a></td>
709        </tr>
710      </table>
711</div><div class="memdoc">
712
713<p>Lossless transform. </p>
714
715</div>
716</div>
717<h2 class="groupheader">Enumeration Type Documentation</h2>
718<a class="anchor" id="ga4f83ad3368e0e29d1957be0efa7c3720"></a>
719<div class="memitem">
720<div class="memproto">
721      <table class="memname">
722        <tr>
723          <td class="memname">enum <a class="el" href="group___turbo_j_p_e_g.html#ga4f83ad3368e0e29d1957be0efa7c3720">TJCS</a></td>
724        </tr>
725      </table>
726</div><div class="memdoc">
727
728<p>JPEG colorspaces. </p>
729<table class="fieldtable">
730<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">
731<p>RGB colorspace. </p>
732<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>
733</td></tr>
734<tr><td class="fieldname"><em><a class="anchor" id="gga4f83ad3368e0e29d1957be0efa7c3720a7389b8f65bb387ffedce3efd0d78ec75"></a>TJCS_YCbCr</em>&nbsp;</td><td class="fielddoc">
735<p>YCbCr colorspace. </p>
736<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>
737</td></tr>
738<tr><td class="fieldname"><em><a class="anchor" id="gga4f83ad3368e0e29d1957be0efa7c3720ab3e7d6a87f695e45b81c1b5262b5a50a"></a>TJCS_GRAY</em>&nbsp;</td><td class="fielddoc">
739<p>Grayscale colorspace. </p>
740<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>
741</td></tr>
742<tr><td class="fieldname"><em><a class="anchor" id="gga4f83ad3368e0e29d1957be0efa7c3720a6c8b636152ac8195b869587db315ee53"></a>TJCS_CMYK</em>&nbsp;</td><td class="fielddoc">
743<p>CMYK colorspace. </p>
744<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>
745</td></tr>
746<tr><td class="fieldname"><em><a class="anchor" id="gga4f83ad3368e0e29d1957be0efa7c3720a53839e0fe867b76b58d16b0a1a7c598e"></a>TJCS_YCCK</em>&nbsp;</td><td class="fielddoc">
747<p>YCCK colorspace. </p>
748<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>
749</td></tr>
750</table>
751
752</div>
753</div>
754<a class="anchor" id="gafbc17cfa57d0d5d11fea35ac025950fe"></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#gafbc17cfa57d0d5d11fea35ac025950fe">TJERR</a></td>
760        </tr>
761      </table>
762</div><div class="memdoc">
763
764<p>Error codes. </p>
765<table class="fieldtable">
766<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><em><a class="anchor" id="ggafbc17cfa57d0d5d11fea35ac025950fea342dd6e2aedb47bb257b4e7568329b59"></a>TJERR_WARNING</em>&nbsp;</td><td class="fielddoc">
767<p>The error was non-fatal and recoverable, but the image may still be corrupt. </p>
768</td></tr>
769<tr><td class="fieldname"><em><a class="anchor" id="ggafbc17cfa57d0d5d11fea35ac025950feafc9cceeada13122b09e4851e3788039a"></a>TJERR_FATAL</em>&nbsp;</td><td class="fielddoc">
770<p>The error was fatal and non-recoverable. </p>
771</td></tr>
772</table>
773
774</div>
775</div>
776<a class="anchor" id="gac916144e26c3817ac514e64ae5d12e2a"></a>
777<div class="memitem">
778<div class="memproto">
779      <table class="memname">
780        <tr>
781          <td class="memname">enum <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">TJPF</a></td>
782        </tr>
783      </table>
784</div><div class="memdoc">
785
786<p>Pixel formats. </p>
787<table class="fieldtable">
788<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">
789<p>RGB pixel format. </p>
790<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>
791</td></tr>
792<tr><td class="fieldname"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aab10624437fb8ef495a0b153e65749839"></a>TJPF_BGR</em>&nbsp;</td><td class="fielddoc">
793<p>BGR pixel format. </p>
794<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>
795</td></tr>
796<tr><td class="fieldname"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01"></a>TJPF_RGBX</em>&nbsp;</td><td class="fielddoc">
797<p>RGBX pixel format. </p>
798<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>
799</td></tr>
800<tr><td class="fieldname"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa2a1fbf569ca79897eae886e3376ca4c8"></a>TJPF_BGRX</em>&nbsp;</td><td class="fielddoc">
801<p>BGRX pixel format. </p>
802<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>
803</td></tr>
804<tr><td class="fieldname"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af"></a>TJPF_XBGR</em>&nbsp;</td><td class="fielddoc">
805<p>XBGR pixel format. </p>
806<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>
807</td></tr>
808<tr><td class="fieldname"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84"></a>TJPF_XRGB</em>&nbsp;</td><td class="fielddoc">
809<p>XRGB pixel format. </p>
810<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>
811</td></tr>
812<tr><td class="fieldname"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a"></a>TJPF_GRAY</em>&nbsp;</td><td class="fielddoc">
813<p>Grayscale pixel format. </p>
814<p>Each 1-byte pixel represents a luminance (brightness) level from 0 to 255. </p>
815</td></tr>
816<tr><td class="fieldname"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa88d2e88fab67f6503cf972e14851cc12"></a>TJPF_RGBA</em>&nbsp;</td><td class="fielddoc">
817<p>RGBA pixel format. </p>
818<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>
819</td></tr>
820<tr><td class="fieldname"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aac037ff1845cf9b74bb81a3659c2b9fb4"></a>TJPF_BGRA</em>&nbsp;</td><td class="fielddoc">
821<p>BGRA pixel format. </p>
822<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>
823</td></tr>
824<tr><td class="fieldname"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa1ba1a7f1631dbeaa49a0a85fc4a40081"></a>TJPF_ABGR</em>&nbsp;</td><td class="fielddoc">
825<p>ABGR pixel format. </p>
826<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>
827</td></tr>
828<tr><td class="fieldname"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aae8f846ed9d9de99b6e1dfe448848765c"></a>TJPF_ARGB</em>&nbsp;</td><td class="fielddoc">
829<p>ARGB pixel format. </p>
830<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>
831</td></tr>
832<tr><td class="fieldname"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa7f5100ec44c91994e243f1cf55553f8b"></a>TJPF_CMYK</em>&nbsp;</td><td class="fielddoc">
833<p>CMYK pixel format. </p>
834<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>
835</td></tr>
836<tr><td class="fieldname"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa84c1a6cead7952998e2fb895844a21ed"></a>TJPF_UNKNOWN</em>&nbsp;</td><td class="fielddoc">
837<p>Unknown pixel format. </p>
838<p>Currently this is only used by <a class="el" href="group___turbo_j_p_e_g.html#gaffbd83c375e79f5db4b5c5d8ad4466e7" title="Load an uncompressed image from disk into memory.">tjLoadImage()</a>. </p>
839</td></tr>
840</table>
841
842</div>
843</div>
844<a class="anchor" id="ga1d047060ea80bb9820d540bb928e9074"></a>
845<div class="memitem">
846<div class="memproto">
847      <table class="memname">
848        <tr>
849          <td class="memname">enum <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">TJSAMP</a></td>
850        </tr>
851      </table>
852</div><div class="memdoc">
853
854<p>Chrominance subsampling options. </p>
855<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>
856<table class="fieldtable">
857<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">
858<p>4:4:4 chrominance subsampling (no chrominance subsampling). </p>
859<p>The JPEG or YUV image will contain one chrominance component for every pixel in the source image. </p>
860</td></tr>
861<tr><td class="fieldname"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074a136130902cc578f11f32429b59368404"></a>TJSAMP_422</em>&nbsp;</td><td class="fielddoc">
862<p>4:2:2 chrominance subsampling. </p>
863<p>The JPEG or YUV image will contain one chrominance component for every 2x1 block of pixels in the source image. </p>
864</td></tr>
865<tr><td class="fieldname"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074a63085dbf683cfe39e513cdb6343e3737"></a>TJSAMP_420</em>&nbsp;</td><td class="fielddoc">
866<p>4:2:0 chrominance subsampling. </p>
867<p>The JPEG or YUV image will contain one chrominance component for every 2x2 block of pixels in the source image. </p>
868</td></tr>
869<tr><td class="fieldname"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074a3f1c9504842ddc7a48d0f690754b6248"></a>TJSAMP_GRAY</em>&nbsp;</td><td class="fielddoc">
870<p>Grayscale. </p>
871<p>The JPEG or YUV image will contain no chrominance components. </p>
872</td></tr>
873<tr><td class="fieldname"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074accf740e6f3aa6ba20ba922cad13cb974"></a>TJSAMP_440</em>&nbsp;</td><td class="fielddoc">
874<p>4:4:0 chrominance subsampling. </p>
875<p>The JPEG or YUV image will contain one chrominance component for every 1x2 block of pixels in the source image.</p>
876<dl class="section note"><dt>Note</dt><dd>4:4:0 subsampling is not fully accelerated in libjpeg-turbo. </dd></dl>
877</td></tr>
878<tr><td class="fieldname"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074a28ec62575e5ea295c3fde3001dc628e2"></a>TJSAMP_411</em>&nbsp;</td><td class="fielddoc">
879<p>4:1:1 chrominance subsampling. </p>
880<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>
881<dl class="section note"><dt>Note</dt><dd>4:1:1 subsampling is not fully accelerated in libjpeg-turbo. </dd></dl>
882</td></tr>
883</table>
884
885</div>
886</div>
887<a class="anchor" id="ga2de531af4e7e6c4f124908376b354866"></a>
888<div class="memitem">
889<div class="memproto">
890      <table class="memname">
891        <tr>
892          <td class="memname">enum <a class="el" href="group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866">TJXOP</a></td>
893        </tr>
894      </table>
895</div><div class="memdoc">
896
897<p>Transform operations for <a class="el" href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> </p>
898<table class="fieldtable">
899<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">
900<p>Do not transform the position of the image pixels. </p>
901</td></tr>
902<tr><td class="fieldname"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866aa0df69776caa30f0fa28e26332d311ce"></a>TJXOP_HFLIP</em>&nbsp;</td><td class="fielddoc">
903<p>Flip (mirror) image horizontally. </p>
904<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>
905</td></tr>
906<tr><td class="fieldname"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866a324eddfbec53b7e691f61e56929d0d5d"></a>TJXOP_VFLIP</em>&nbsp;</td><td class="fielddoc">
907<p>Flip (mirror) image vertically. </p>
908<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>
909</td></tr>
910<tr><td class="fieldname"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866a31060aed199f886afdd417f80499c32d"></a>TJXOP_TRANSPOSE</em>&nbsp;</td><td class="fielddoc">
911<p>Transpose image (flip/mirror along upper left to lower right axis.) This transform is always perfect. </p>
912</td></tr>
913<tr><td class="fieldname"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866af3b14d488aea6ece9e5b3df73a74d6a4"></a>TJXOP_TRANSVERSE</em>&nbsp;</td><td class="fielddoc">
914<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>
915</td></tr>
916<tr><td class="fieldname"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866a43b2bbb23bc4bd548422d43fbe9af128"></a>TJXOP_ROT90</em>&nbsp;</td><td class="fielddoc">
917<p>Rotate image clockwise by 90 degrees. </p>
918<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>
919</td></tr>
920<tr><td class="fieldname"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866a140952eb8dd0300accfcc22726d69692"></a>TJXOP_ROT180</em>&nbsp;</td><td class="fielddoc">
921<p>Rotate image 180 degrees. </p>
922<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>
923</td></tr>
924<tr><td class="fieldname"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866a3064ee5dfb7f032df332818587567a08"></a>TJXOP_ROT270</em>&nbsp;</td><td class="fielddoc">
925<p>Rotate image counter-clockwise by 90 degrees. </p>
926<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>
927</td></tr>
928</table>
929
930</div>
931</div>
932<h2 class="groupheader">Function Documentation</h2>
933<a class="anchor" id="gaec627dd4c5f30b7a775a7aea3bec5d83"></a>
934<div class="memitem">
935<div class="memproto">
936      <table class="memname">
937        <tr>
938          <td class="memname">DLLEXPORT unsigned char* tjAlloc </td>
939          <td>(</td>
940          <td class="paramtype">int&#160;</td>
941          <td class="paramname"><em>bytes</em></td><td>)</td>
942          <td></td>
943        </tr>
944      </table>
945</div><div class="memdoc">
946
947<p>Allocate an image buffer for use with TurboJPEG. </p>
948<p>You should always use this function to allocate the JPEG destination buffer(s) for the compression and transform functions 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>
949<dl class="params"><dt>Parameters</dt><dd>
950  <table class="params">
951    <tr><td class="paramname">bytes</td><td>the number of bytes to allocate</td></tr>
952  </table>
953  </dd>
954</dl>
955<dl class="section return"><dt>Returns</dt><dd>a pointer to a newly-allocated buffer with the specified number of bytes.</dd></dl>
956<dl class="section see"><dt>See Also</dt><dd><a class="el" href="group___turbo_j_p_e_g.html#gaea863d2da0cdb609563aabdf9196514b" title="Free an image buffer previously allocated by TurboJPEG.">tjFree()</a> </dd></dl>
957
958</div>
959</div>
960<a class="anchor" id="ga67ac12fee79073242cb216e07c9f1f90"></a>
961<div class="memitem">
962<div class="memproto">
963      <table class="memname">
964        <tr>
965          <td class="memname">DLLEXPORT unsigned long tjBufSize </td>
966          <td>(</td>
967          <td class="paramtype">int&#160;</td>
968          <td class="paramname"><em>width</em>, </td>
969        </tr>
970        <tr>
971          <td class="paramkey"></td>
972          <td></td>
973          <td class="paramtype">int&#160;</td>
974          <td class="paramname"><em>height</em>, </td>
975        </tr>
976        <tr>
977          <td class="paramkey"></td>
978          <td></td>
979          <td class="paramtype">int&#160;</td>
980          <td class="paramname"><em>jpegSubsamp</em>&#160;</td>
981        </tr>
982        <tr>
983          <td></td>
984          <td>)</td>
985          <td></td><td></td>
986        </tr>
987      </table>
988</div><div class="memdoc">
989
990<p>The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters. </p>
991<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>
992<dl class="params"><dt>Parameters</dt><dd>
993  <table class="params">
994    <tr><td class="paramname">width</td><td>width (in pixels) of the image</td></tr>
995    <tr><td class="paramname">height</td><td>height (in pixels) of the image</td></tr>
996    <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>
997  </table>
998  </dd>
999</dl>
1000<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>
1001
1002</div>
1003</div>
1004<a class="anchor" id="ga2be2b9969d4df9ecce9b05deed273194"></a>
1005<div class="memitem">
1006<div class="memproto">
1007      <table class="memname">
1008        <tr>
1009          <td class="memname">DLLEXPORT unsigned long tjBufSizeYUV2 </td>
1010          <td>(</td>
1011          <td class="paramtype">int&#160;</td>
1012          <td class="paramname"><em>width</em>, </td>
1013        </tr>
1014        <tr>
1015          <td class="paramkey"></td>
1016          <td></td>
1017          <td class="paramtype">int&#160;</td>
1018          <td class="paramname"><em>pad</em>, </td>
1019        </tr>
1020        <tr>
1021          <td class="paramkey"></td>
1022          <td></td>
1023          <td class="paramtype">int&#160;</td>
1024          <td class="paramname"><em>height</em>, </td>
1025        </tr>
1026        <tr>
1027          <td class="paramkey"></td>
1028          <td></td>
1029          <td class="paramtype">int&#160;</td>
1030          <td class="paramname"><em>subsamp</em>&#160;</td>
1031        </tr>
1032        <tr>
1033          <td></td>
1034          <td>)</td>
1035          <td></td><td></td>
1036        </tr>
1037      </table>
1038</div><div class="memdoc">
1039
1040<p>The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters. </p>
1041<dl class="params"><dt>Parameters</dt><dd>
1042  <table class="params">
1043    <tr><td class="paramname">width</td><td>width (in pixels) of the image</td></tr>
1044    <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>
1045    <tr><td class="paramname">height</td><td>height (in pixels) of the image</td></tr>
1046    <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>
1047  </table>
1048  </dd>
1049</dl>
1050<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>
1051
1052</div>
1053</div>
1054<a class="anchor" id="gafbdce0112fd78fd38efae841443a9bcf"></a>
1055<div class="memitem">
1056<div class="memproto">
1057      <table class="memname">
1058        <tr>
1059          <td class="memname">DLLEXPORT int tjCompress2 </td>
1060          <td>(</td>
1061          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1062          <td class="paramname"><em>handle</em>, </td>
1063        </tr>
1064        <tr>
1065          <td class="paramkey"></td>
1066          <td></td>
1067          <td class="paramtype">const unsigned char *&#160;</td>
1068          <td class="paramname"><em>srcBuf</em>, </td>
1069        </tr>
1070        <tr>
1071          <td class="paramkey"></td>
1072          <td></td>
1073          <td class="paramtype">int&#160;</td>
1074          <td class="paramname"><em>width</em>, </td>
1075        </tr>
1076        <tr>
1077          <td class="paramkey"></td>
1078          <td></td>
1079          <td class="paramtype">int&#160;</td>
1080          <td class="paramname"><em>pitch</em>, </td>
1081        </tr>
1082        <tr>
1083          <td class="paramkey"></td>
1084          <td></td>
1085          <td class="paramtype">int&#160;</td>
1086          <td class="paramname"><em>height</em>, </td>
1087        </tr>
1088        <tr>
1089          <td class="paramkey"></td>
1090          <td></td>
1091          <td class="paramtype">int&#160;</td>
1092          <td class="paramname"><em>pixelFormat</em>, </td>
1093        </tr>
1094        <tr>
1095          <td class="paramkey"></td>
1096          <td></td>
1097          <td class="paramtype">unsigned char **&#160;</td>
1098          <td class="paramname"><em>jpegBuf</em>, </td>
1099        </tr>
1100        <tr>
1101          <td class="paramkey"></td>
1102          <td></td>
1103          <td class="paramtype">unsigned long *&#160;</td>
1104          <td class="paramname"><em>jpegSize</em>, </td>
1105        </tr>
1106        <tr>
1107          <td class="paramkey"></td>
1108          <td></td>
1109          <td class="paramtype">int&#160;</td>
1110          <td class="paramname"><em>jpegSubsamp</em>, </td>
1111        </tr>
1112        <tr>
1113          <td class="paramkey"></td>
1114          <td></td>
1115          <td class="paramtype">int&#160;</td>
1116          <td class="paramname"><em>jpegQual</em>, </td>
1117        </tr>
1118        <tr>
1119          <td class="paramkey"></td>
1120          <td></td>
1121          <td class="paramtype">int&#160;</td>
1122          <td class="paramname"><em>flags</em>&#160;</td>
1123        </tr>
1124        <tr>
1125          <td></td>
1126          <td>)</td>
1127          <td></td><td></td>
1128        </tr>
1129      </table>
1130</div><div class="memdoc">
1131
1132<p>Compress an RGB, grayscale, or CMYK image into a JPEG image. </p>
1133<dl class="params"><dt>Parameters</dt><dd>
1134  <table class="params">
1135    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance</td></tr>
1136    <tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing RGB, grayscale, or CMYK pixels to be compressed</td></tr>
1137    <tr><td class="paramname">width</td><td>width (in pixels) of the source image</td></tr>
1138    <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>
1139    <tr><td class="paramname">height</td><td>height (in pixels) of the source image</td></tr>
1140    <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>
1141    <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">
1142<li>pre-allocate the JPEG buffer with an arbitrary size using <a class="el" href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83" title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a> and let TurboJPEG grow the buffer as needed,</li>
1143<li>set <code>*jpegBuf</code> to NULL to tell TurboJPEG to allocate the buffer for you, or</li>
1144<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#ga67ac12fee79073242cb216e07c9f1f90" 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 that it won't be.)</li>
1145</ol>
1146If 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>
1147    <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>
1148    <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>
1149    <tr><td class="paramname">jpegQual</td><td>the image quality of the generated JPEG image (1 = worst, 100 = best)</td></tr>
1150    <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#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
1151  </table>
1152  </dd>
1153</dl>
1154<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#ga1ead8574f9f39fbafc6b497124e7aafa" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a> and <a class="el" href="group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410" title="Returns a code indicating the severity of the last error.">tjGetErrorCode()</a>.) </dd></dl>
1155
1156</div>
1157</div>
1158<a class="anchor" id="ga7622a459b79aa1007e005b58783f875b"></a>
1159<div class="memitem">
1160<div class="memproto">
1161      <table class="memname">
1162        <tr>
1163          <td class="memname">DLLEXPORT int tjCompressFromYUV </td>
1164          <td>(</td>
1165          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1166          <td class="paramname"><em>handle</em>, </td>
1167        </tr>
1168        <tr>
1169          <td class="paramkey"></td>
1170          <td></td>
1171          <td class="paramtype">const unsigned char *&#160;</td>
1172          <td class="paramname"><em>srcBuf</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>width</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>pad</em>, </td>
1185        </tr>
1186        <tr>
1187          <td class="paramkey"></td>
1188          <td></td>
1189          <td class="paramtype">int&#160;</td>
1190          <td class="paramname"><em>height</em>, </td>
1191        </tr>
1192        <tr>
1193          <td class="paramkey"></td>
1194          <td></td>
1195          <td class="paramtype">int&#160;</td>
1196          <td class="paramname"><em>subsamp</em>, </td>
1197        </tr>
1198        <tr>
1199          <td class="paramkey"></td>
1200          <td></td>
1201          <td class="paramtype">unsigned char **&#160;</td>
1202          <td class="paramname"><em>jpegBuf</em>, </td>
1203        </tr>
1204        <tr>
1205          <td class="paramkey"></td>
1206          <td></td>
1207          <td class="paramtype">unsigned long *&#160;</td>
1208          <td class="paramname"><em>jpegSize</em>, </td>
1209        </tr>
1210        <tr>
1211          <td class="paramkey"></td>
1212          <td></td>
1213          <td class="paramtype">int&#160;</td>
1214          <td class="paramname"><em>jpegQual</em>, </td>
1215        </tr>
1216        <tr>
1217          <td class="paramkey"></td>
1218          <td></td>
1219          <td class="paramtype">int&#160;</td>
1220          <td class="paramname"><em>flags</em>&#160;</td>
1221        </tr>
1222        <tr>
1223          <td></td>
1224          <td>)</td>
1225          <td></td><td></td>
1226        </tr>
1227      </table>
1228</div><div class="memdoc">
1229
1230<p>Compress a YUV planar image into a JPEG image. </p>
1231<dl class="params"><dt>Parameters</dt><dd>
1232  <table class="params">
1233    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance</td></tr>
1234    <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#ga2be2b9969d4df9ecce9b05deed273194" title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters...">tjBufSizeYUV2()</a> for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer (refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.)</td></tr>
1235    <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>
1236    <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>
1237    <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>
1238    <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>
1239    <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">
1240<li>pre-allocate the JPEG buffer with an arbitrary size using <a class="el" href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83" title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a> and let TurboJPEG grow the buffer as needed,</li>
1241<li>set <code>*jpegBuf</code> to NULL to tell TurboJPEG to allocate the buffer for you, or</li>
1242<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#ga67ac12fee79073242cb216e07c9f1f90" 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 that it won't be.)</li>
1243</ol>
1244If 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>
1245    <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>
1246    <tr><td class="paramname">jpegQual</td><td>the image quality of the generated JPEG image (1 = worst, 100 = best)</td></tr>
1247    <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#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
1248  </table>
1249  </dd>
1250</dl>
1251<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#ga1ead8574f9f39fbafc6b497124e7aafa" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a> and <a class="el" href="group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410" title="Returns a code indicating the severity of the last error.">tjGetErrorCode()</a>.) </dd></dl>
1252
1253</div>
1254</div>
1255<a class="anchor" id="ga29ec5dfbd2d84b8724e951d6fa0d5d9e"></a>
1256<div class="memitem">
1257<div class="memproto">
1258      <table class="memname">
1259        <tr>
1260          <td class="memname">DLLEXPORT int tjCompressFromYUVPlanes </td>
1261          <td>(</td>
1262          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1263          <td class="paramname"><em>handle</em>, </td>
1264        </tr>
1265        <tr>
1266          <td class="paramkey"></td>
1267          <td></td>
1268          <td class="paramtype">const unsigned char **&#160;</td>
1269          <td class="paramname"><em>srcPlanes</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>width</em>, </td>
1276        </tr>
1277        <tr>
1278          <td class="paramkey"></td>
1279          <td></td>
1280          <td class="paramtype">const int *&#160;</td>
1281          <td class="paramname"><em>strides</em>, </td>
1282        </tr>
1283        <tr>
1284          <td class="paramkey"></td>
1285          <td></td>
1286          <td class="paramtype">int&#160;</td>
1287          <td class="paramname"><em>height</em>, </td>
1288        </tr>
1289        <tr>
1290          <td class="paramkey"></td>
1291          <td></td>
1292          <td class="paramtype">int&#160;</td>
1293          <td class="paramname"><em>subsamp</em>, </td>
1294        </tr>
1295        <tr>
1296          <td class="paramkey"></td>
1297          <td></td>
1298          <td class="paramtype">unsigned char **&#160;</td>
1299          <td class="paramname"><em>jpegBuf</em>, </td>
1300        </tr>
1301        <tr>
1302          <td class="paramkey"></td>
1303          <td></td>
1304          <td class="paramtype">unsigned long *&#160;</td>
1305          <td class="paramname"><em>jpegSize</em>, </td>
1306        </tr>
1307        <tr>
1308          <td class="paramkey"></td>
1309          <td></td>
1310          <td class="paramtype">int&#160;</td>
1311          <td class="paramname"><em>jpegQual</em>, </td>
1312        </tr>
1313        <tr>
1314          <td class="paramkey"></td>
1315          <td></td>
1316          <td class="paramtype">int&#160;</td>
1317          <td class="paramname"><em>flags</em>&#160;</td>
1318        </tr>
1319        <tr>
1320          <td></td>
1321          <td>)</td>
1322          <td></td><td></td>
1323        </tr>
1324      </table>
1325</div><div class="memdoc">
1326
1327<p>Compress a set of Y, U (Cb), and V (Cr) image planes into a JPEG image. </p>
1328<dl class="params"><dt>Parameters</dt><dd>
1329  <table class="params">
1330    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance</td></tr>
1331    <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#gab4ab7b24f6e797d79abaaa670373961d" title="The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters...">tjPlaneSizeYUV()</a> for the given image width, height, strides, and level of chrominance subsampling. Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for more details.</td></tr>
1332    <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>
1333    <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>
1334    <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>
1335    <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>
1336    <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">
1337<li>pre-allocate the JPEG buffer with an arbitrary size using <a class="el" href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83" title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a> and let TurboJPEG grow the buffer as needed,</li>
1338<li>set <code>*jpegBuf</code> to NULL to tell TurboJPEG to allocate the buffer for you, or</li>
1339<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#ga67ac12fee79073242cb216e07c9f1f90" 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 that it won't be.)</li>
1340</ol>
1341If 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>
1342    <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>
1343    <tr><td class="paramname">jpegQual</td><td>the image quality of the generated JPEG image (1 = worst, 100 = best)</td></tr>
1344    <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#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
1345  </table>
1346  </dd>
1347</dl>
1348<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#ga1ead8574f9f39fbafc6b497124e7aafa" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a> and <a class="el" href="group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410" title="Returns a code indicating the severity of the last error.">tjGetErrorCode()</a>.) </dd></dl>
1349
1350</div>
1351</div>
1352<a class="anchor" id="ga70abbf38f77a26fd6da8813bef96f695"></a>
1353<div class="memitem">
1354<div class="memproto">
1355      <table class="memname">
1356        <tr>
1357          <td class="memname">DLLEXPORT int tjDecodeYUV </td>
1358          <td>(</td>
1359          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1360          <td class="paramname"><em>handle</em>, </td>
1361        </tr>
1362        <tr>
1363          <td class="paramkey"></td>
1364          <td></td>
1365          <td class="paramtype">const unsigned char *&#160;</td>
1366          <td class="paramname"><em>srcBuf</em>, </td>
1367        </tr>
1368        <tr>
1369          <td class="paramkey"></td>
1370          <td></td>
1371          <td class="paramtype">int&#160;</td>
1372          <td class="paramname"><em>pad</em>, </td>
1373        </tr>
1374        <tr>
1375          <td class="paramkey"></td>
1376          <td></td>
1377          <td class="paramtype">int&#160;</td>
1378          <td class="paramname"><em>subsamp</em>, </td>
1379        </tr>
1380        <tr>
1381          <td class="paramkey"></td>
1382          <td></td>
1383          <td class="paramtype">unsigned char *&#160;</td>
1384          <td class="paramname"><em>dstBuf</em>, </td>
1385        </tr>
1386        <tr>
1387          <td class="paramkey"></td>
1388          <td></td>
1389          <td class="paramtype">int&#160;</td>
1390          <td class="paramname"><em>width</em>, </td>
1391        </tr>
1392        <tr>
1393          <td class="paramkey"></td>
1394          <td></td>
1395          <td class="paramtype">int&#160;</td>
1396          <td class="paramname"><em>pitch</em>, </td>
1397        </tr>
1398        <tr>
1399          <td class="paramkey"></td>
1400          <td></td>
1401          <td class="paramtype">int&#160;</td>
1402          <td class="paramname"><em>height</em>, </td>
1403        </tr>
1404        <tr>
1405          <td class="paramkey"></td>
1406          <td></td>
1407          <td class="paramtype">int&#160;</td>
1408          <td class="paramname"><em>pixelFormat</em>, </td>
1409        </tr>
1410        <tr>
1411          <td class="paramkey"></td>
1412          <td></td>
1413          <td class="paramtype">int&#160;</td>
1414          <td class="paramname"><em>flags</em>&#160;</td>
1415        </tr>
1416        <tr>
1417          <td></td>
1418          <td>)</td>
1419          <td></td><td></td>
1420        </tr>
1421      </table>
1422</div><div class="memdoc">
1423
1424<p>Decode a YUV planar image into an RGB or grayscale image. </p>
1425<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>
1426<dl class="params"><dt>Parameters</dt><dd>
1427  <table class="params">
1428    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</td></tr>
1429    <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#ga2be2b9969d4df9ecce9b05deed273194" title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters...">tjBufSizeYUV2()</a> for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer (refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.)</td></tr>
1430    <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>
1431    <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>
1432    <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>
1433    <tr><td class="paramname">width</td><td>width (in pixels) of the source and destination images</td></tr>
1434    <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>
1435    <tr><td class="paramname">height</td><td>height (in pixels) of the source and destination images</td></tr>
1436    <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>
1437    <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#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
1438  </table>
1439  </dd>
1440</dl>
1441<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#ga1ead8574f9f39fbafc6b497124e7aafa" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a> and <a class="el" href="group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410" title="Returns a code indicating the severity of the last error.">tjGetErrorCode()</a>.) </dd></dl>
1442
1443</div>
1444</div>
1445<a class="anchor" id="ga10e837c07fa9d25770565b237d3898d9"></a>
1446<div class="memitem">
1447<div class="memproto">
1448      <table class="memname">
1449        <tr>
1450          <td class="memname">DLLEXPORT int tjDecodeYUVPlanes </td>
1451          <td>(</td>
1452          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1453          <td class="paramname"><em>handle</em>, </td>
1454        </tr>
1455        <tr>
1456          <td class="paramkey"></td>
1457          <td></td>
1458          <td class="paramtype">const unsigned char **&#160;</td>
1459          <td class="paramname"><em>srcPlanes</em>, </td>
1460        </tr>
1461        <tr>
1462          <td class="paramkey"></td>
1463          <td></td>
1464          <td class="paramtype">const int *&#160;</td>
1465          <td class="paramname"><em>strides</em>, </td>
1466        </tr>
1467        <tr>
1468          <td class="paramkey"></td>
1469          <td></td>
1470          <td class="paramtype">int&#160;</td>
1471          <td class="paramname"><em>subsamp</em>, </td>
1472        </tr>
1473        <tr>
1474          <td class="paramkey"></td>
1475          <td></td>
1476          <td class="paramtype">unsigned char *&#160;</td>
1477          <td class="paramname"><em>dstBuf</em>, </td>
1478        </tr>
1479        <tr>
1480          <td class="paramkey"></td>
1481          <td></td>
1482          <td class="paramtype">int&#160;</td>
1483          <td class="paramname"><em>width</em>, </td>
1484        </tr>
1485        <tr>
1486          <td class="paramkey"></td>
1487          <td></td>
1488          <td class="paramtype">int&#160;</td>
1489          <td class="paramname"><em>pitch</em>, </td>
1490        </tr>
1491        <tr>
1492          <td class="paramkey"></td>
1493          <td></td>
1494          <td class="paramtype">int&#160;</td>
1495          <td class="paramname"><em>height</em>, </td>
1496        </tr>
1497        <tr>
1498          <td class="paramkey"></td>
1499          <td></td>
1500          <td class="paramtype">int&#160;</td>
1501          <td class="paramname"><em>pixelFormat</em>, </td>
1502        </tr>
1503        <tr>
1504          <td class="paramkey"></td>
1505          <td></td>
1506          <td class="paramtype">int&#160;</td>
1507          <td class="paramname"><em>flags</em>&#160;</td>
1508        </tr>
1509        <tr>
1510          <td></td>
1511          <td>)</td>
1512          <td></td><td></td>
1513        </tr>
1514      </table>
1515</div><div class="memdoc">
1516
1517<p>Decode a set of Y, U (Cb), and V (Cr) image planes into an RGB or grayscale image. </p>
1518<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>
1519<dl class="params"><dt>Parameters</dt><dd>
1520  <table class="params">
1521    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</td></tr>
1522    <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#gab4ab7b24f6e797d79abaaa670373961d" title="The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters...">tjPlaneSizeYUV()</a> for the given image width, height, strides, and level of chrominance subsampling. Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for more details.</td></tr>
1523    <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>
1524    <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>
1525    <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>
1526    <tr><td class="paramname">width</td><td>width (in pixels) of the source and destination images</td></tr>
1527    <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>
1528    <tr><td class="paramname">height</td><td>height (in pixels) of the source and destination images</td></tr>
1529    <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>
1530    <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#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
1531  </table>
1532  </dd>
1533</dl>
1534<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#ga1ead8574f9f39fbafc6b497124e7aafa" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a> and <a class="el" href="group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410" title="Returns a code indicating the severity of the last error.">tjGetErrorCode()</a>.) </dd></dl>
1535
1536</div>
1537</div>
1538<a class="anchor" id="gae9eccef8b682a48f43a9117c231ed013"></a>
1539<div class="memitem">
1540<div class="memproto">
1541      <table class="memname">
1542        <tr>
1543          <td class="memname">DLLEXPORT int tjDecompress2 </td>
1544          <td>(</td>
1545          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1546          <td class="paramname"><em>handle</em>, </td>
1547        </tr>
1548        <tr>
1549          <td class="paramkey"></td>
1550          <td></td>
1551          <td class="paramtype">const unsigned char *&#160;</td>
1552          <td class="paramname"><em>jpegBuf</em>, </td>
1553        </tr>
1554        <tr>
1555          <td class="paramkey"></td>
1556          <td></td>
1557          <td class="paramtype">unsigned long&#160;</td>
1558          <td class="paramname"><em>jpegSize</em>, </td>
1559        </tr>
1560        <tr>
1561          <td class="paramkey"></td>
1562          <td></td>
1563          <td class="paramtype">unsigned char *&#160;</td>
1564          <td class="paramname"><em>dstBuf</em>, </td>
1565        </tr>
1566        <tr>
1567          <td class="paramkey"></td>
1568          <td></td>
1569          <td class="paramtype">int&#160;</td>
1570          <td class="paramname"><em>width</em>, </td>
1571        </tr>
1572        <tr>
1573          <td class="paramkey"></td>
1574          <td></td>
1575          <td class="paramtype">int&#160;</td>
1576          <td class="paramname"><em>pitch</em>, </td>
1577        </tr>
1578        <tr>
1579          <td class="paramkey"></td>
1580          <td></td>
1581          <td class="paramtype">int&#160;</td>
1582          <td class="paramname"><em>height</em>, </td>
1583        </tr>
1584        <tr>
1585          <td class="paramkey"></td>
1586          <td></td>
1587          <td class="paramtype">int&#160;</td>
1588          <td class="paramname"><em>pixelFormat</em>, </td>
1589        </tr>
1590        <tr>
1591          <td class="paramkey"></td>
1592          <td></td>
1593          <td class="paramtype">int&#160;</td>
1594          <td class="paramname"><em>flags</em>&#160;</td>
1595        </tr>
1596        <tr>
1597          <td></td>
1598          <td>)</td>
1599          <td></td><td></td>
1600        </tr>
1601      </table>
1602</div><div class="memdoc">
1603
1604<p>Decompress a JPEG image to an RGB, grayscale, or CMYK image. </p>
1605<dl class="params"><dt>Parameters</dt><dd>
1606  <table class="params">
1607    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</td></tr>
1608    <tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG image to decompress</td></tr>
1609    <tr><td class="paramname">jpegSize</td><td>size of the JPEG image (in bytes)</td></tr>
1610    <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#gac3854476006b10787bd128f7ede48057" 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>
1611    <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>
1612    <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#gac3854476006b10787bd128f7ede48057" 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>
1613    <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>
1614    <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>
1615    <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#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
1616  </table>
1617  </dd>
1618</dl>
1619<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#ga1ead8574f9f39fbafc6b497124e7aafa" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a> and <a class="el" href="group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410" title="Returns a code indicating the severity of the last error.">tjGetErrorCode()</a>.) </dd></dl>
1620
1621</div>
1622</div>
1623<a class="anchor" id="ga0595681096bba7199cc6f3533cb25f77"></a>
1624<div class="memitem">
1625<div class="memproto">
1626      <table class="memname">
1627        <tr>
1628          <td class="memname">DLLEXPORT int tjDecompressHeader3 </td>
1629          <td>(</td>
1630          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1631          <td class="paramname"><em>handle</em>, </td>
1632        </tr>
1633        <tr>
1634          <td class="paramkey"></td>
1635          <td></td>
1636          <td class="paramtype">const unsigned char *&#160;</td>
1637          <td class="paramname"><em>jpegBuf</em>, </td>
1638        </tr>
1639        <tr>
1640          <td class="paramkey"></td>
1641          <td></td>
1642          <td class="paramtype">unsigned long&#160;</td>
1643          <td class="paramname"><em>jpegSize</em>, </td>
1644        </tr>
1645        <tr>
1646          <td class="paramkey"></td>
1647          <td></td>
1648          <td class="paramtype">int *&#160;</td>
1649          <td class="paramname"><em>width</em>, </td>
1650        </tr>
1651        <tr>
1652          <td class="paramkey"></td>
1653          <td></td>
1654          <td class="paramtype">int *&#160;</td>
1655          <td class="paramname"><em>height</em>, </td>
1656        </tr>
1657        <tr>
1658          <td class="paramkey"></td>
1659          <td></td>
1660          <td class="paramtype">int *&#160;</td>
1661          <td class="paramname"><em>jpegSubsamp</em>, </td>
1662        </tr>
1663        <tr>
1664          <td class="paramkey"></td>
1665          <td></td>
1666          <td class="paramtype">int *&#160;</td>
1667          <td class="paramname"><em>jpegColorspace</em>&#160;</td>
1668        </tr>
1669        <tr>
1670          <td></td>
1671          <td>)</td>
1672          <td></td><td></td>
1673        </tr>
1674      </table>
1675</div><div class="memdoc">
1676
1677<p>Retrieve information about a JPEG image without decompressing it. </p>
1678<dl class="params"><dt>Parameters</dt><dd>
1679  <table class="params">
1680    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</td></tr>
1681    <tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing a JPEG image</td></tr>
1682    <tr><td class="paramname">jpegSize</td><td>size of the JPEG image (in bytes)</td></tr>
1683    <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>
1684    <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>
1685    <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>
1686    <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>
1687  </table>
1688  </dd>
1689</dl>
1690<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#ga1ead8574f9f39fbafc6b497124e7aafa" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a> and <a class="el" href="group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410" title="Returns a code indicating the severity of the last error.">tjGetErrorCode()</a>.) </dd></dl>
1691
1692</div>
1693</div>
1694<a class="anchor" id="ga04d1e839ff9a0860dd1475cff78d3364"></a>
1695<div class="memitem">
1696<div class="memproto">
1697      <table class="memname">
1698        <tr>
1699          <td class="memname">DLLEXPORT int tjDecompressToYUV2 </td>
1700          <td>(</td>
1701          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1702          <td class="paramname"><em>handle</em>, </td>
1703        </tr>
1704        <tr>
1705          <td class="paramkey"></td>
1706          <td></td>
1707          <td class="paramtype">const unsigned char *&#160;</td>
1708          <td class="paramname"><em>jpegBuf</em>, </td>
1709        </tr>
1710        <tr>
1711          <td class="paramkey"></td>
1712          <td></td>
1713          <td class="paramtype">unsigned long&#160;</td>
1714          <td class="paramname"><em>jpegSize</em>, </td>
1715        </tr>
1716        <tr>
1717          <td class="paramkey"></td>
1718          <td></td>
1719          <td class="paramtype">unsigned char *&#160;</td>
1720          <td class="paramname"><em>dstBuf</em>, </td>
1721        </tr>
1722        <tr>
1723          <td class="paramkey"></td>
1724          <td></td>
1725          <td class="paramtype">int&#160;</td>
1726          <td class="paramname"><em>width</em>, </td>
1727        </tr>
1728        <tr>
1729          <td class="paramkey"></td>
1730          <td></td>
1731          <td class="paramtype">int&#160;</td>
1732          <td class="paramname"><em>pad</em>, </td>
1733        </tr>
1734        <tr>
1735          <td class="paramkey"></td>
1736          <td></td>
1737          <td class="paramtype">int&#160;</td>
1738          <td class="paramname"><em>height</em>, </td>
1739        </tr>
1740        <tr>
1741          <td class="paramkey"></td>
1742          <td></td>
1743          <td class="paramtype">int&#160;</td>
1744          <td class="paramname"><em>flags</em>&#160;</td>
1745        </tr>
1746        <tr>
1747          <td></td>
1748          <td>)</td>
1749          <td></td><td></td>
1750        </tr>
1751      </table>
1752</div><div class="memdoc">
1753
1754<p>Decompress a JPEG image to a YUV planar image. </p>
1755<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>
1756<dl class="params"><dt>Parameters</dt><dd>
1757  <table class="params">
1758    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</td></tr>
1759    <tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG image to decompress</td></tr>
1760    <tr><td class="paramname">jpegSize</td><td>size of the JPEG image (in bytes)</td></tr>
1761    <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#ga2be2b9969d4df9ecce9b05deed273194" 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>
1762    <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>
1763    <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>
1764    <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>
1765    <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#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
1766  </table>
1767  </dd>
1768</dl>
1769<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#ga1ead8574f9f39fbafc6b497124e7aafa" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a> and <a class="el" href="group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410" title="Returns a code indicating the severity of the last error.">tjGetErrorCode()</a>.) </dd></dl>
1770
1771</div>
1772</div>
1773<a class="anchor" id="gaa59f901a5258ada5bd0185ad59368540"></a>
1774<div class="memitem">
1775<div class="memproto">
1776      <table class="memname">
1777        <tr>
1778          <td class="memname">DLLEXPORT int tjDecompressToYUVPlanes </td>
1779          <td>(</td>
1780          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1781          <td class="paramname"><em>handle</em>, </td>
1782        </tr>
1783        <tr>
1784          <td class="paramkey"></td>
1785          <td></td>
1786          <td class="paramtype">const unsigned char *&#160;</td>
1787          <td class="paramname"><em>jpegBuf</em>, </td>
1788        </tr>
1789        <tr>
1790          <td class="paramkey"></td>
1791          <td></td>
1792          <td class="paramtype">unsigned long&#160;</td>
1793          <td class="paramname"><em>jpegSize</em>, </td>
1794        </tr>
1795        <tr>
1796          <td class="paramkey"></td>
1797          <td></td>
1798          <td class="paramtype">unsigned char **&#160;</td>
1799          <td class="paramname"><em>dstPlanes</em>, </td>
1800        </tr>
1801        <tr>
1802          <td class="paramkey"></td>
1803          <td></td>
1804          <td class="paramtype">int&#160;</td>
1805          <td class="paramname"><em>width</em>, </td>
1806        </tr>
1807        <tr>
1808          <td class="paramkey"></td>
1809          <td></td>
1810          <td class="paramtype">int *&#160;</td>
1811          <td class="paramname"><em>strides</em>, </td>
1812        </tr>
1813        <tr>
1814          <td class="paramkey"></td>
1815          <td></td>
1816          <td class="paramtype">int&#160;</td>
1817          <td class="paramname"><em>height</em>, </td>
1818        </tr>
1819        <tr>
1820          <td class="paramkey"></td>
1821          <td></td>
1822          <td class="paramtype">int&#160;</td>
1823          <td class="paramname"><em>flags</em>&#160;</td>
1824        </tr>
1825        <tr>
1826          <td></td>
1827          <td>)</td>
1828          <td></td><td></td>
1829        </tr>
1830      </table>
1831</div><div class="memdoc">
1832
1833<p>Decompress a JPEG image into separate Y, U (Cb), and V (Cr) image planes. </p>
1834<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>
1835<dl class="params"><dt>Parameters</dt><dd>
1836  <table class="params">
1837    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</td></tr>
1838    <tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG image to decompress</td></tr>
1839    <tr><td class="paramname">jpegSize</td><td>size of the JPEG image (in bytes)</td></tr>
1840    <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#gab4ab7b24f6e797d79abaaa670373961d" 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>
1841    <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>
1842    <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>
1843    <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>
1844    <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#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
1845  </table>
1846  </dd>
1847</dl>
1848<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#ga1ead8574f9f39fbafc6b497124e7aafa" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a> and <a class="el" href="group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410" title="Returns a code indicating the severity of the last error.">tjGetErrorCode()</a>.) </dd></dl>
1849
1850</div>
1851</div>
1852<a class="anchor" id="ga75f355fa27225ba1a4ee392c852394d2"></a>
1853<div class="memitem">
1854<div class="memproto">
1855      <table class="memname">
1856        <tr>
1857          <td class="memname">DLLEXPORT int tjDestroy </td>
1858          <td>(</td>
1859          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1860          <td class="paramname"><em>handle</em></td><td>)</td>
1861          <td></td>
1862        </tr>
1863      </table>
1864</div><div class="memdoc">
1865
1866<p>Destroy a TurboJPEG compressor, decompressor, or transformer instance. </p>
1867<dl class="params"><dt>Parameters</dt><dd>
1868  <table class="params">
1869    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor, decompressor or transformer instance</td></tr>
1870  </table>
1871  </dd>
1872</dl>
1873<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#ga1ead8574f9f39fbafc6b497124e7aafa" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a>.) </dd></dl>
1874
1875</div>
1876</div>
1877<a class="anchor" id="gac519b922cdf446e97d0cdcba513636bf"></a>
1878<div class="memitem">
1879<div class="memproto">
1880      <table class="memname">
1881        <tr>
1882          <td class="memname">DLLEXPORT int tjEncodeYUV3 </td>
1883          <td>(</td>
1884          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1885          <td class="paramname"><em>handle</em>, </td>
1886        </tr>
1887        <tr>
1888          <td class="paramkey"></td>
1889          <td></td>
1890          <td class="paramtype">const unsigned char *&#160;</td>
1891          <td class="paramname"><em>srcBuf</em>, </td>
1892        </tr>
1893        <tr>
1894          <td class="paramkey"></td>
1895          <td></td>
1896          <td class="paramtype">int&#160;</td>
1897          <td class="paramname"><em>width</em>, </td>
1898        </tr>
1899        <tr>
1900          <td class="paramkey"></td>
1901          <td></td>
1902          <td class="paramtype">int&#160;</td>
1903          <td class="paramname"><em>pitch</em>, </td>
1904        </tr>
1905        <tr>
1906          <td class="paramkey"></td>
1907          <td></td>
1908          <td class="paramtype">int&#160;</td>
1909          <td class="paramname"><em>height</em>, </td>
1910        </tr>
1911        <tr>
1912          <td class="paramkey"></td>
1913          <td></td>
1914          <td class="paramtype">int&#160;</td>
1915          <td class="paramname"><em>pixelFormat</em>, </td>
1916        </tr>
1917        <tr>
1918          <td class="paramkey"></td>
1919          <td></td>
1920          <td class="paramtype">unsigned char *&#160;</td>
1921          <td class="paramname"><em>dstBuf</em>, </td>
1922        </tr>
1923        <tr>
1924          <td class="paramkey"></td>
1925          <td></td>
1926          <td class="paramtype">int&#160;</td>
1927          <td class="paramname"><em>pad</em>, </td>
1928        </tr>
1929        <tr>
1930          <td class="paramkey"></td>
1931          <td></td>
1932          <td class="paramtype">int&#160;</td>
1933          <td class="paramname"><em>subsamp</em>, </td>
1934        </tr>
1935        <tr>
1936          <td class="paramkey"></td>
1937          <td></td>
1938          <td class="paramtype">int&#160;</td>
1939          <td class="paramname"><em>flags</em>&#160;</td>
1940        </tr>
1941        <tr>
1942          <td></td>
1943          <td>)</td>
1944          <td></td><td></td>
1945        </tr>
1946      </table>
1947</div><div class="memdoc">
1948
1949<p>Encode an RGB or grayscale image into a YUV planar image. </p>
1950<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>
1951<dl class="params"><dt>Parameters</dt><dd>
1952  <table class="params">
1953    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance</td></tr>
1954    <tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing RGB or grayscale pixels to be encoded</td></tr>
1955    <tr><td class="paramname">width</td><td>width (in pixels) of the source image</td></tr>
1956    <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>
1957    <tr><td class="paramname">height</td><td>height (in pixels) of the source image</td></tr>
1958    <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>
1959    <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#ga2be2b9969d4df9ecce9b05deed273194" 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>
1960    <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>
1961    <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>
1962    <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#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
1963  </table>
1964  </dd>
1965</dl>
1966<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#ga1ead8574f9f39fbafc6b497124e7aafa" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a> and <a class="el" href="group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410" title="Returns a code indicating the severity of the last error.">tjGetErrorCode()</a>.) </dd></dl>
1967
1968</div>
1969</div>
1970<a class="anchor" id="gae2d04c72457fe7f4d60cf78ab1b1feb1"></a>
1971<div class="memitem">
1972<div class="memproto">
1973      <table class="memname">
1974        <tr>
1975          <td class="memname">DLLEXPORT int tjEncodeYUVPlanes </td>
1976          <td>(</td>
1977          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
1978          <td class="paramname"><em>handle</em>, </td>
1979        </tr>
1980        <tr>
1981          <td class="paramkey"></td>
1982          <td></td>
1983          <td class="paramtype">const unsigned char *&#160;</td>
1984          <td class="paramname"><em>srcBuf</em>, </td>
1985        </tr>
1986        <tr>
1987          <td class="paramkey"></td>
1988          <td></td>
1989          <td class="paramtype">int&#160;</td>
1990          <td class="paramname"><em>width</em>, </td>
1991        </tr>
1992        <tr>
1993          <td class="paramkey"></td>
1994          <td></td>
1995          <td class="paramtype">int&#160;</td>
1996          <td class="paramname"><em>pitch</em>, </td>
1997        </tr>
1998        <tr>
1999          <td class="paramkey"></td>
2000          <td></td>
2001          <td class="paramtype">int&#160;</td>
2002          <td class="paramname"><em>height</em>, </td>
2003        </tr>
2004        <tr>
2005          <td class="paramkey"></td>
2006          <td></td>
2007          <td class="paramtype">int&#160;</td>
2008          <td class="paramname"><em>pixelFormat</em>, </td>
2009        </tr>
2010        <tr>
2011          <td class="paramkey"></td>
2012          <td></td>
2013          <td class="paramtype">unsigned char **&#160;</td>
2014          <td class="paramname"><em>dstPlanes</em>, </td>
2015        </tr>
2016        <tr>
2017          <td class="paramkey"></td>
2018          <td></td>
2019          <td class="paramtype">int *&#160;</td>
2020          <td class="paramname"><em>strides</em>, </td>
2021        </tr>
2022        <tr>
2023          <td class="paramkey"></td>
2024          <td></td>
2025          <td class="paramtype">int&#160;</td>
2026          <td class="paramname"><em>subsamp</em>, </td>
2027        </tr>
2028        <tr>
2029          <td class="paramkey"></td>
2030          <td></td>
2031          <td class="paramtype">int&#160;</td>
2032          <td class="paramname"><em>flags</em>&#160;</td>
2033        </tr>
2034        <tr>
2035          <td></td>
2036          <td>)</td>
2037          <td></td><td></td>
2038        </tr>
2039      </table>
2040</div><div class="memdoc">
2041
2042<p>Encode an RGB or grayscale image into separate Y, U (Cb), and V (Cr) image planes. </p>
2043<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>
2044<dl class="params"><dt>Parameters</dt><dd>
2045  <table class="params">
2046    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance</td></tr>
2047    <tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing RGB or grayscale pixels to be encoded</td></tr>
2048    <tr><td class="paramname">width</td><td>width (in pixels) of the source image</td></tr>
2049    <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>
2050    <tr><td class="paramname">height</td><td>height (in pixels) of the source image</td></tr>
2051    <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>
2052    <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#gab4ab7b24f6e797d79abaaa670373961d" 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>
2053    <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>
2054    <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>
2055    <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#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
2056  </table>
2057  </dd>
2058</dl>
2059<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#ga1ead8574f9f39fbafc6b497124e7aafa" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a> and <a class="el" href="group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410" title="Returns a code indicating the severity of the last error.">tjGetErrorCode()</a>.) </dd></dl>
2060
2061</div>
2062</div>
2063<a class="anchor" id="gaea863d2da0cdb609563aabdf9196514b"></a>
2064<div class="memitem">
2065<div class="memproto">
2066      <table class="memname">
2067        <tr>
2068          <td class="memname">DLLEXPORT void tjFree </td>
2069          <td>(</td>
2070          <td class="paramtype">unsigned char *&#160;</td>
2071          <td class="paramname"><em>buffer</em></td><td>)</td>
2072          <td></td>
2073        </tr>
2074      </table>
2075</div><div class="memdoc">
2076
2077<p>Free an image buffer previously allocated by TurboJPEG. </p>
2078<p>You should always use this function to free JPEG destination buffer(s) that were automatically (re)allocated by the compression and transform functions or that were manually allocated using <a class="el" href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83" title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a>.</p>
2079<dl class="params"><dt>Parameters</dt><dd>
2080  <table class="params">
2081    <tr><td class="paramname">buffer</td><td>address of the buffer to free</td></tr>
2082  </table>
2083  </dd>
2084</dl>
2085<dl class="section see"><dt>See Also</dt><dd><a class="el" href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83" title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a> </dd></dl>
2086
2087</div>
2088</div>
2089<a class="anchor" id="ga414feeffbf860ebd31c745df203de410"></a>
2090<div class="memitem">
2091<div class="memproto">
2092      <table class="memname">
2093        <tr>
2094          <td class="memname">DLLEXPORT int tjGetErrorCode </td>
2095          <td>(</td>
2096          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
2097          <td class="paramname"><em>handle</em></td><td>)</td>
2098          <td></td>
2099        </tr>
2100      </table>
2101</div><div class="memdoc">
2102
2103<p>Returns a code indicating the severity of the last error. </p>
2104<p>See <a class="el" href="group___turbo_j_p_e_g.html#gafbc17cfa57d0d5d11fea35ac025950fe">Error codes</a>.</p>
2105<dl class="params"><dt>Parameters</dt><dd>
2106  <table class="params">
2107    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor, decompressor or transformer instance</td></tr>
2108  </table>
2109  </dd>
2110</dl>
2111<dl class="section return"><dt>Returns</dt><dd>a code indicating the severity of the last error. See <a class="el" href="group___turbo_j_p_e_g.html#gafbc17cfa57d0d5d11fea35ac025950fe">Error codes</a>. </dd></dl>
2112
2113</div>
2114</div>
2115<a class="anchor" id="ga1ead8574f9f39fbafc6b497124e7aafa"></a>
2116<div class="memitem">
2117<div class="memproto">
2118      <table class="memname">
2119        <tr>
2120          <td class="memname">DLLEXPORT char* tjGetErrorStr2 </td>
2121          <td>(</td>
2122          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
2123          <td class="paramname"><em>handle</em></td><td>)</td>
2124          <td></td>
2125        </tr>
2126      </table>
2127</div><div class="memdoc">
2128
2129<p>Returns a descriptive error message explaining why the last command failed. </p>
2130<dl class="params"><dt>Parameters</dt><dd>
2131  <table class="params">
2132    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor, decompressor, or transformer instance, or NULL if the error was generated by a global function (but note that retrieving the error message for a global function is not thread-safe.)</td></tr>
2133  </table>
2134  </dd>
2135</dl>
2136<dl class="section return"><dt>Returns</dt><dd>a descriptive error message explaining why the last command failed. </dd></dl>
2137
2138</div>
2139</div>
2140<a class="anchor" id="gac3854476006b10787bd128f7ede48057"></a>
2141<div class="memitem">
2142<div class="memproto">
2143      <table class="memname">
2144        <tr>
2145          <td class="memname">DLLEXPORT <a class="el" href="structtjscalingfactor.html">tjscalingfactor</a>* tjGetScalingFactors </td>
2146          <td>(</td>
2147          <td class="paramtype">int *&#160;</td>
2148          <td class="paramname"><em>numscalingfactors</em></td><td>)</td>
2149          <td></td>
2150        </tr>
2151      </table>
2152</div><div class="memdoc">
2153
2154<p>Returns a list of fractional scaling factors that the JPEG decompressor in this implementation of TurboJPEG supports. </p>
2155<dl class="params"><dt>Parameters</dt><dd>
2156  <table class="params">
2157    <tr><td class="paramname">numscalingfactors</td><td>pointer to an integer variable that will receive the number of elements in the list</td></tr>
2158  </table>
2159  </dd>
2160</dl>
2161<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#ga1ead8574f9f39fbafc6b497124e7aafa" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a>.) </dd></dl>
2162
2163</div>
2164</div>
2165<a class="anchor" id="ga9d63a05fc6d813f4aae06107041a37e8"></a>
2166<div class="memitem">
2167<div class="memproto">
2168      <table class="memname">
2169        <tr>
2170          <td class="memname">DLLEXPORT <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> tjInitCompress </td>
2171          <td>(</td>
2172          <td class="paramtype">void&#160;</td>
2173          <td class="paramname"></td><td>)</td>
2174          <td></td>
2175        </tr>
2176      </table>
2177</div><div class="memdoc">
2178
2179<p>Create a TurboJPEG compressor instance. </p>
2180<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#ga1ead8574f9f39fbafc6b497124e7aafa" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a>.) </dd></dl>
2181
2182</div>
2183</div>
2184<a class="anchor" id="ga52300eac3f3d9ef4bab303bc244f62d3"></a>
2185<div class="memitem">
2186<div class="memproto">
2187      <table class="memname">
2188        <tr>
2189          <td class="memname">DLLEXPORT <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> tjInitDecompress </td>
2190          <td>(</td>
2191          <td class="paramtype">void&#160;</td>
2192          <td class="paramname"></td><td>)</td>
2193          <td></td>
2194        </tr>
2195      </table>
2196</div><div class="memdoc">
2197
2198<p>Create a TurboJPEG decompressor instance. </p>
2199<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#ga1ead8574f9f39fbafc6b497124e7aafa" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a>.) </dd></dl>
2200
2201</div>
2202</div>
2203<a class="anchor" id="ga928beff6ac248ceadf01089fc6b41957"></a>
2204<div class="memitem">
2205<div class="memproto">
2206      <table class="memname">
2207        <tr>
2208          <td class="memname">DLLEXPORT <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> tjInitTransform </td>
2209          <td>(</td>
2210          <td class="paramtype">void&#160;</td>
2211          <td class="paramname"></td><td>)</td>
2212          <td></td>
2213        </tr>
2214      </table>
2215</div><div class="memdoc">
2216
2217<p>Create a new TurboJPEG transformer instance. </p>
2218<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#ga1ead8574f9f39fbafc6b497124e7aafa" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a>.) </dd></dl>
2219
2220</div>
2221</div>
2222<a class="anchor" id="gaffbd83c375e79f5db4b5c5d8ad4466e7"></a>
2223<div class="memitem">
2224<div class="memproto">
2225      <table class="memname">
2226        <tr>
2227          <td class="memname">DLLEXPORT unsigned char* tjLoadImage </td>
2228          <td>(</td>
2229          <td class="paramtype">const char *&#160;</td>
2230          <td class="paramname"><em>filename</em>, </td>
2231        </tr>
2232        <tr>
2233          <td class="paramkey"></td>
2234          <td></td>
2235          <td class="paramtype">int *&#160;</td>
2236          <td class="paramname"><em>width</em>, </td>
2237        </tr>
2238        <tr>
2239          <td class="paramkey"></td>
2240          <td></td>
2241          <td class="paramtype">int&#160;</td>
2242          <td class="paramname"><em>align</em>, </td>
2243        </tr>
2244        <tr>
2245          <td class="paramkey"></td>
2246          <td></td>
2247          <td class="paramtype">int *&#160;</td>
2248          <td class="paramname"><em>height</em>, </td>
2249        </tr>
2250        <tr>
2251          <td class="paramkey"></td>
2252          <td></td>
2253          <td class="paramtype">int *&#160;</td>
2254          <td class="paramname"><em>pixelFormat</em>, </td>
2255        </tr>
2256        <tr>
2257          <td class="paramkey"></td>
2258          <td></td>
2259          <td class="paramtype">int&#160;</td>
2260          <td class="paramname"><em>flags</em>&#160;</td>
2261        </tr>
2262        <tr>
2263          <td></td>
2264          <td>)</td>
2265          <td></td><td></td>
2266        </tr>
2267      </table>
2268</div><div class="memdoc">
2269
2270<p>Load an uncompressed image from disk into memory. </p>
2271<dl class="params"><dt>Parameters</dt><dd>
2272  <table class="params">
2273    <tr><td class="paramname">filename</td><td>name of a file containing an uncompressed image in Windows BMP or PBMPLUS (PPM/PGM) format</td></tr>
2274    <tr><td class="paramname">width</td><td>pointer to an integer variable that will receive the width (in pixels) of the uncompressed image</td></tr>
2275    <tr><td class="paramname">align</td><td>row alignment of the image buffer to be returned (must be a power of 2.) For instance, setting this parameter to 4 will cause all rows in the image buffer to be padded to the nearest 32-bit boundary, and setting this parameter to 1 will cause all rows in the image buffer to be unpadded.</td></tr>
2276    <tr><td class="paramname">height</td><td>pointer to an integer variable that will receive the height (in pixels) of the uncompressed image</td></tr>
2277    <tr><td class="paramname">pixelFormat</td><td>pointer to an integer variable that specifies or will receive the pixel format of the uncompressed image buffer. The behavior of <a class="el" href="group___turbo_j_p_e_g.html#gaffbd83c375e79f5db4b5c5d8ad4466e7" title="Load an uncompressed image from disk into memory.">tjLoadImage()</a> will vary depending on the value of <code>*pixelFormat</code> passed to the function:<ul>
2278<li><a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa84c1a6cead7952998e2fb895844a21ed">TJPF_UNKNOWN</a> : The uncompressed image buffer returned by the function will use the most optimal pixel format for the file type, and <code>*pixelFormat</code> will contain the ID of this pixel format upon successful return from the function.</li>
2279<li><a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a">TJPF_GRAY</a> : Only PGM files and 8-bit BMP files with a grayscale colormap can be loaded.</li>
2280<li><a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7f5100ec44c91994e243f1cf55553f8b">TJPF_CMYK</a> : The RGB or grayscale pixels stored in the file will be converted using a quick &amp; dirty algorithm that is suitable only for testing purposes (proper conversion between CMYK and other formats requires a color management system.)</li>
2281<li>Other <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">pixel formats</a> : The uncompressed image buffer will use the specified pixel format, and pixel format conversion will be performed if necessary.</li>
2282</ul>
2283</td></tr>
2284    <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>
2285  </table>
2286  </dd>
2287</dl>
2288<dl class="section return"><dt>Returns</dt><dd>a pointer to a newly-allocated buffer containing the uncompressed image, converted to the chosen pixel format and with the chosen row alignment, or NULL if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a>.) This buffer should be freed using <a class="el" href="group___turbo_j_p_e_g.html#gaea863d2da0cdb609563aabdf9196514b" title="Free an image buffer previously allocated by TurboJPEG.">tjFree()</a>. </dd></dl>
2289
2290</div>
2291</div>
2292<a class="anchor" id="ga1a209696c6a80748f20e134b3c64789f"></a>
2293<div class="memitem">
2294<div class="memproto">
2295      <table class="memname">
2296        <tr>
2297          <td class="memname">DLLEXPORT int tjPlaneHeight </td>
2298          <td>(</td>
2299          <td class="paramtype">int&#160;</td>
2300          <td class="paramname"><em>componentID</em>, </td>
2301        </tr>
2302        <tr>
2303          <td class="paramkey"></td>
2304          <td></td>
2305          <td class="paramtype">int&#160;</td>
2306          <td class="paramname"><em>height</em>, </td>
2307        </tr>
2308        <tr>
2309          <td class="paramkey"></td>
2310          <td></td>
2311          <td class="paramtype">int&#160;</td>
2312          <td class="paramname"><em>subsamp</em>&#160;</td>
2313        </tr>
2314        <tr>
2315          <td></td>
2316          <td>)</td>
2317          <td></td><td></td>
2318        </tr>
2319      </table>
2320</div><div class="memdoc">
2321
2322<p>The plane height of a YUV image plane with the given parameters. </p>
2323<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>
2324<dl class="params"><dt>Parameters</dt><dd>
2325  <table class="params">
2326    <tr><td class="paramname">componentID</td><td>ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr)</td></tr>
2327    <tr><td class="paramname">height</td><td>height (in pixels) of the YUV image</td></tr>
2328    <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>
2329  </table>
2330  </dd>
2331</dl>
2332<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>
2333
2334</div>
2335</div>
2336<a class="anchor" id="gab4ab7b24f6e797d79abaaa670373961d"></a>
2337<div class="memitem">
2338<div class="memproto">
2339      <table class="memname">
2340        <tr>
2341          <td class="memname">DLLEXPORT unsigned long tjPlaneSizeYUV </td>
2342          <td>(</td>
2343          <td class="paramtype">int&#160;</td>
2344          <td class="paramname"><em>componentID</em>, </td>
2345        </tr>
2346        <tr>
2347          <td class="paramkey"></td>
2348          <td></td>
2349          <td class="paramtype">int&#160;</td>
2350          <td class="paramname"><em>width</em>, </td>
2351        </tr>
2352        <tr>
2353          <td class="paramkey"></td>
2354          <td></td>
2355          <td class="paramtype">int&#160;</td>
2356          <td class="paramname"><em>stride</em>, </td>
2357        </tr>
2358        <tr>
2359          <td class="paramkey"></td>
2360          <td></td>
2361          <td class="paramtype">int&#160;</td>
2362          <td class="paramname"><em>height</em>, </td>
2363        </tr>
2364        <tr>
2365          <td class="paramkey"></td>
2366          <td></td>
2367          <td class="paramtype">int&#160;</td>
2368          <td class="paramname"><em>subsamp</em>&#160;</td>
2369        </tr>
2370        <tr>
2371          <td></td>
2372          <td>)</td>
2373          <td></td><td></td>
2374        </tr>
2375      </table>
2376</div><div class="memdoc">
2377
2378<p>The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters. </p>
2379<dl class="params"><dt>Parameters</dt><dd>
2380  <table class="params">
2381    <tr><td class="paramname">componentID</td><td>ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr)</td></tr>
2382    <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>
2383    <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>
2384    <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>
2385    <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>
2386  </table>
2387  </dd>
2388</dl>
2389<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>
2390
2391</div>
2392</div>
2393<a class="anchor" id="ga63fb66bb1e36c74008c4634360becbb1"></a>
2394<div class="memitem">
2395<div class="memproto">
2396      <table class="memname">
2397        <tr>
2398          <td class="memname">DLLEXPORT int tjPlaneWidth </td>
2399          <td>(</td>
2400          <td class="paramtype">int&#160;</td>
2401          <td class="paramname"><em>componentID</em>, </td>
2402        </tr>
2403        <tr>
2404          <td class="paramkey"></td>
2405          <td></td>
2406          <td class="paramtype">int&#160;</td>
2407          <td class="paramname"><em>width</em>, </td>
2408        </tr>
2409        <tr>
2410          <td class="paramkey"></td>
2411          <td></td>
2412          <td class="paramtype">int&#160;</td>
2413          <td class="paramname"><em>subsamp</em>&#160;</td>
2414        </tr>
2415        <tr>
2416          <td></td>
2417          <td>)</td>
2418          <td></td><td></td>
2419        </tr>
2420      </table>
2421</div><div class="memdoc">
2422
2423<p>The plane width of a YUV image plane with the given parameters. </p>
2424<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>
2425<dl class="params"><dt>Parameters</dt><dd>
2426  <table class="params">
2427    <tr><td class="paramname">componentID</td><td>ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr)</td></tr>
2428    <tr><td class="paramname">width</td><td>width (in pixels) of the YUV image</td></tr>
2429    <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>
2430  </table>
2431  </dd>
2432</dl>
2433<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>
2434
2435</div>
2436</div>
2437<a class="anchor" id="ga6f445b22d8933ae4815b3370a538d879"></a>
2438<div class="memitem">
2439<div class="memproto">
2440      <table class="memname">
2441        <tr>
2442          <td class="memname">DLLEXPORT int tjSaveImage </td>
2443          <td>(</td>
2444          <td class="paramtype">const char *&#160;</td>
2445          <td class="paramname"><em>filename</em>, </td>
2446        </tr>
2447        <tr>
2448          <td class="paramkey"></td>
2449          <td></td>
2450          <td class="paramtype">unsigned char *&#160;</td>
2451          <td class="paramname"><em>buffer</em>, </td>
2452        </tr>
2453        <tr>
2454          <td class="paramkey"></td>
2455          <td></td>
2456          <td class="paramtype">int&#160;</td>
2457          <td class="paramname"><em>width</em>, </td>
2458        </tr>
2459        <tr>
2460          <td class="paramkey"></td>
2461          <td></td>
2462          <td class="paramtype">int&#160;</td>
2463          <td class="paramname"><em>pitch</em>, </td>
2464        </tr>
2465        <tr>
2466          <td class="paramkey"></td>
2467          <td></td>
2468          <td class="paramtype">int&#160;</td>
2469          <td class="paramname"><em>height</em>, </td>
2470        </tr>
2471        <tr>
2472          <td class="paramkey"></td>
2473          <td></td>
2474          <td class="paramtype">int&#160;</td>
2475          <td class="paramname"><em>pixelFormat</em>, </td>
2476        </tr>
2477        <tr>
2478          <td class="paramkey"></td>
2479          <td></td>
2480          <td class="paramtype">int&#160;</td>
2481          <td class="paramname"><em>flags</em>&#160;</td>
2482        </tr>
2483        <tr>
2484          <td></td>
2485          <td>)</td>
2486          <td></td><td></td>
2487        </tr>
2488      </table>
2489</div><div class="memdoc">
2490
2491<p>Save an uncompressed image from memory to disk. </p>
2492<dl class="params"><dt>Parameters</dt><dd>
2493  <table class="params">
2494    <tr><td class="paramname">filename</td><td>name of a file to which to save the uncompressed image. The image will be stored in Windows BMP or PBMPLUS (PPM/PGM) format, depending on the file extension.</td></tr>
2495    <tr><td class="paramname">buffer</td><td>pointer to an image buffer containing RGB, grayscale, or CMYK pixels to be saved</td></tr>
2496    <tr><td class="paramname">width</td><td>width (in pixels) of the uncompressed image</td></tr>
2497    <tr><td class="paramname">pitch</td><td>bytes per line in the image buffer. 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>
2498    <tr><td class="paramname">height</td><td>height (in pixels) of the uncompressed image</td></tr>
2499    <tr><td class="paramname">pixelFormat</td><td>pixel format of the image buffer (see <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.) If this parameter is set to <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a">TJPF_GRAY</a>, then the image will be stored in PGM or 8-bit (indexed color) BMP format. Otherwise, the image will be stored in PPM or 24-bit BMP format. If this parameter is set to <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7f5100ec44c91994e243f1cf55553f8b">TJPF_CMYK</a>, then the CMYK pixels will be converted to RGB using a quick &amp; dirty algorithm that is suitable only for testing (proper conversion between CMYK and other formats requires a color management system.)</td></tr>
2500    <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>
2501  </table>
2502  </dd>
2503</dl>
2504<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#ga1ead8574f9f39fbafc6b497124e7aafa" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a>.) </dd></dl>
2505
2506</div>
2507</div>
2508<a class="anchor" id="ga9cb8abf4cc91881e04a0329b2270be25"></a>
2509<div class="memitem">
2510<div class="memproto">
2511      <table class="memname">
2512        <tr>
2513          <td class="memname">DLLEXPORT int tjTransform </td>
2514          <td>(</td>
2515          <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a>&#160;</td>
2516          <td class="paramname"><em>handle</em>, </td>
2517        </tr>
2518        <tr>
2519          <td class="paramkey"></td>
2520          <td></td>
2521          <td class="paramtype">const unsigned char *&#160;</td>
2522          <td class="paramname"><em>jpegBuf</em>, </td>
2523        </tr>
2524        <tr>
2525          <td class="paramkey"></td>
2526          <td></td>
2527          <td class="paramtype">unsigned long&#160;</td>
2528          <td class="paramname"><em>jpegSize</em>, </td>
2529        </tr>
2530        <tr>
2531          <td class="paramkey"></td>
2532          <td></td>
2533          <td class="paramtype">int&#160;</td>
2534          <td class="paramname"><em>n</em>, </td>
2535        </tr>
2536        <tr>
2537          <td class="paramkey"></td>
2538          <td></td>
2539          <td class="paramtype">unsigned char **&#160;</td>
2540          <td class="paramname"><em>dstBufs</em>, </td>
2541        </tr>
2542        <tr>
2543          <td class="paramkey"></td>
2544          <td></td>
2545          <td class="paramtype">unsigned long *&#160;</td>
2546          <td class="paramname"><em>dstSizes</em>, </td>
2547        </tr>
2548        <tr>
2549          <td class="paramkey"></td>
2550          <td></td>
2551          <td class="paramtype"><a class="el" href="structtjtransform.html">tjtransform</a> *&#160;</td>
2552          <td class="paramname"><em>transforms</em>, </td>
2553        </tr>
2554        <tr>
2555          <td class="paramkey"></td>
2556          <td></td>
2557          <td class="paramtype">int&#160;</td>
2558          <td class="paramname"><em>flags</em>&#160;</td>
2559        </tr>
2560        <tr>
2561          <td></td>
2562          <td>)</td>
2563          <td></td><td></td>
2564        </tr>
2565      </table>
2566</div><div class="memdoc">
2567
2568<p>Losslessly transform a JPEG image into another JPEG image. </p>
2569<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>
2570<dl class="params"><dt>Parameters</dt><dd>
2571  <table class="params">
2572    <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG transformer instance</td></tr>
2573    <tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG source image to transform</td></tr>
2574    <tr><td class="paramname">jpegSize</td><td>size of the JPEG source image (in bytes)</td></tr>
2575    <tr><td class="paramname">n</td><td>the number of transformed JPEG images to generate</td></tr>
2576    <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">
2577<li>pre-allocate the JPEG buffer with an arbitrary size using <a class="el" href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83" title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a> and let TurboJPEG grow the buffer as needed,</li>
2578<li>set <code>dstBufs[i]</code> to NULL to tell TurboJPEG to allocate the buffer for you, or</li>
2579<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#ga67ac12fee79073242cb216e07c9f1f90" 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. Under normal circumstances, 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 that it won't be.) Note, however, that there are some rare cases (such as transforming images with a large amount of embedded EXIF or ICC profile data) in which the output image will be larger than the worst-case size, and <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> cannot be used in those cases.</li>
2580</ol>
2581If 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>
2582    <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>
2583    <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>
2584    <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#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
2585  </table>
2586  </dd>
2587</dl>
2588<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#ga1ead8574f9f39fbafc6b497124e7aafa" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a> and <a class="el" href="group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410" title="Returns a code indicating the severity of the last error.">tjGetErrorCode()</a>.) </dd></dl>
2589
2590</div>
2591</div>
2592<h2 class="groupheader">Variable Documentation</h2>
2593<a class="anchor" id="ga5af0ab065feefd526debf1e20c43e837"></a>
2594<div class="memitem">
2595<div class="memproto">
2596<table class="mlabels">
2597  <tr>
2598  <td class="mlabels-left">
2599      <table class="memname">
2600        <tr>
2601          <td class="memname">const int tjAlphaOffset[<a class="el" href="group___turbo_j_p_e_g.html#ga7010a4402f54a45ba822ad8675a4655e">TJ_NUMPF</a>]</td>
2602        </tr>
2603      </table>
2604  </td>
2605  <td class="mlabels-right">
2606<span class="mlabels"><span class="mlabel">static</span></span>  </td>
2607  </tr>
2608</table>
2609</div><div class="memdoc">
2610
2611<p>Alpha offset (in bytes) for a given pixel format. </p>
2612<p>This specifies the number of bytes that the Alpha component is offset from the start of the pixel. For instance, if a pixel of format TJ_BGRA is stored in <code>char pixel[]</code>, then the alpha component will be <code>pixel[tjAlphaOffset[TJ_BGRA]]</code>. This will be -1 if the pixel format does not have an alpha component. </p>
2613
2614</div>
2615</div>
2616<a class="anchor" id="ga84e2e35d3f08025f976ec1ec53693dea"></a>
2617<div class="memitem">
2618<div class="memproto">
2619<table class="mlabels">
2620  <tr>
2621  <td class="mlabels-left">
2622      <table class="memname">
2623        <tr>
2624          <td class="memname">const int tjBlueOffset[<a class="el" href="group___turbo_j_p_e_g.html#ga7010a4402f54a45ba822ad8675a4655e">TJ_NUMPF</a>]</td>
2625        </tr>
2626      </table>
2627  </td>
2628  <td class="mlabels-right">
2629<span class="mlabels"><span class="mlabel">static</span></span>  </td>
2630  </tr>
2631</table>
2632</div><div class="memdoc">
2633
2634<p>Blue offset (in bytes) for a given pixel format. </p>
2635<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>. This will be -1 if the pixel format does not have a blue component. </p>
2636
2637</div>
2638</div>
2639<a class="anchor" id="ga82d6e35da441112a411da41923c0ba2f"></a>
2640<div class="memitem">
2641<div class="memproto">
2642<table class="mlabels">
2643  <tr>
2644  <td class="mlabels-left">
2645      <table class="memname">
2646        <tr>
2647          <td class="memname">const int tjGreenOffset[<a class="el" href="group___turbo_j_p_e_g.html#ga7010a4402f54a45ba822ad8675a4655e">TJ_NUMPF</a>]</td>
2648        </tr>
2649      </table>
2650  </td>
2651  <td class="mlabels-right">
2652<span class="mlabels"><span class="mlabel">static</span></span>  </td>
2653  </tr>
2654</table>
2655</div><div class="memdoc">
2656
2657<p>Green offset (in bytes) for a given pixel format. </p>
2658<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>. This will be -1 if the pixel format does not have a green component. </p>
2659
2660</div>
2661</div>
2662<a class="anchor" id="gabd247bb9fecb393eca57366feb8327bf"></a>
2663<div class="memitem">
2664<div class="memproto">
2665<table class="mlabels">
2666  <tr>
2667  <td class="mlabels-left">
2668      <table class="memname">
2669        <tr>
2670          <td class="memname">const int tjMCUHeight[<a class="el" href="group___turbo_j_p_e_g.html#ga5ef3d169162ce77ce348e292a0b7477c">TJ_NUMSAMP</a>]</td>
2671        </tr>
2672      </table>
2673  </td>
2674  <td class="mlabels-right">
2675<span class="mlabels"><span class="mlabel">static</span></span>  </td>
2676  </tr>
2677</table>
2678</div><div class="memdoc">
2679
2680<p>MCU block height (in pixels) for a given level of chrominance subsampling. </p>
2681<p>MCU block sizes:</p>
2682<ul>
2683<li>8x8 for no subsampling or grayscale</li>
2684<li>16x8 for 4:2:2</li>
2685<li>8x16 for 4:4:0</li>
2686<li>16x16 for 4:2:0</li>
2687<li>32x8 for 4:1:1 </li>
2688</ul>
2689
2690</div>
2691</div>
2692<a class="anchor" id="ga9e61e7cd47a15a173283ba94e781308c"></a>
2693<div class="memitem">
2694<div class="memproto">
2695<table class="mlabels">
2696  <tr>
2697  <td class="mlabels-left">
2698      <table class="memname">
2699        <tr>
2700          <td class="memname">const int tjMCUWidth[<a class="el" href="group___turbo_j_p_e_g.html#ga5ef3d169162ce77ce348e292a0b7477c">TJ_NUMSAMP</a>]</td>
2701        </tr>
2702      </table>
2703  </td>
2704  <td class="mlabels-right">
2705<span class="mlabels"><span class="mlabel">static</span></span>  </td>
2706  </tr>
2707</table>
2708</div><div class="memdoc">
2709
2710<p>MCU block width (in pixels) for a given level of chrominance subsampling. </p>
2711<p>MCU block sizes:</p>
2712<ul>
2713<li>8x8 for no subsampling or grayscale</li>
2714<li>16x8 for 4:2:2</li>
2715<li>8x16 for 4:4:0</li>
2716<li>16x16 for 4:2:0</li>
2717<li>32x8 for 4:1:1 </li>
2718</ul>
2719
2720</div>
2721</div>
2722<a class="anchor" id="gad77cf8fe5b2bfd3cb3f53098146abb4c"></a>
2723<div class="memitem">
2724<div class="memproto">
2725<table class="mlabels">
2726  <tr>
2727  <td class="mlabels-left">
2728      <table class="memname">
2729        <tr>
2730          <td class="memname">const int tjPixelSize[<a class="el" href="group___turbo_j_p_e_g.html#ga7010a4402f54a45ba822ad8675a4655e">TJ_NUMPF</a>]</td>
2731        </tr>
2732      </table>
2733  </td>
2734  <td class="mlabels-right">
2735<span class="mlabels"><span class="mlabel">static</span></span>  </td>
2736  </tr>
2737</table>
2738</div><div class="memdoc">
2739
2740<p>Pixel size (in bytes) for a given pixel format. </p>
2741
2742</div>
2743</div>
2744<a class="anchor" id="gadd9b446742ac8a3923f7992c7988fea8"></a>
2745<div class="memitem">
2746<div class="memproto">
2747<table class="mlabels">
2748  <tr>
2749  <td class="mlabels-left">
2750      <table class="memname">
2751        <tr>
2752          <td class="memname">const int tjRedOffset[<a class="el" href="group___turbo_j_p_e_g.html#ga7010a4402f54a45ba822ad8675a4655e">TJ_NUMPF</a>]</td>
2753        </tr>
2754      </table>
2755  </td>
2756  <td class="mlabels-right">
2757<span class="mlabels"><span class="mlabel">static</span></span>  </td>
2758  </tr>
2759</table>
2760</div><div class="memdoc">
2761
2762<p>Red offset (in bytes) for a given pixel format. </p>
2763<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>. This will be -1 if the pixel format does not have a red component. </p>
2764
2765</div>
2766</div>
2767</div><!-- contents -->
2768<!-- start footer part -->
2769<hr class="footer"/><address class="footer"><small>
2770Generated by &#160;<a href="http://www.doxygen.org/index.html">
2771<img class="footer" src="doxygen.png" alt="doxygen"/>
2772</a> 1.8.3.1
2773</small></address>
2774</body>
2775</html>
2776