Clean up constants so that flags, pixel formats, etc. are clearly differentiated; Update documentation accordingly; Name the enums to make it easier to reference them in the docs and clean up the references accordingly; Set Doxygen option to force a detailed description for the constants to always be generated


git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@617 632fc199-4ca6-4c93-a231-07263d6284db
diff --git a/doc/html/annotated.html b/doc/html/annotated.html
index 78d47fb..3c791b8 100644
--- a/doc/html/annotated.html
+++ b/doc/html/annotated.html
@@ -81,7 +81,7 @@
 </iframe>
 </div>
 
-<hr class="footer"/><address class="footer"><small>Generated on Sat May 21 2011 09:17:13 for TurboJPEG by&#160;
+<hr class="footer"/><address class="footer"><small>Generated on Sat May 21 2011 10:32:20 for TurboJPEG by&#160;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
 </body>
diff --git a/doc/html/classes.html b/doc/html/classes.html
index db2e269..a294b86 100644
--- a/doc/html/classes.html
+++ b/doc/html/classes.html
@@ -80,7 +80,7 @@
 </iframe>
 </div>
 
-<hr class="footer"/><address class="footer"><small>Generated on Sat May 21 2011 09:17:13 for TurboJPEG by&#160;
+<hr class="footer"/><address class="footer"><small>Generated on Sat May 21 2011 10:32:20 for TurboJPEG by&#160;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
 </body>
diff --git a/doc/html/functions.html b/doc/html/functions.html
index 3e04f69..4ffd7c9 100644
--- a/doc/html/functions.html
+++ b/doc/html/functions.html
@@ -107,7 +107,7 @@
 </iframe>
 </div>
 
-<hr class="footer"/><address class="footer"><small>Generated on Sat May 21 2011 09:17:13 for TurboJPEG by&#160;
+<hr class="footer"/><address class="footer"><small>Generated on Sat May 21 2011 10:32:20 for TurboJPEG by&#160;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
 </body>
diff --git a/doc/html/functions_vars.html b/doc/html/functions_vars.html
index 3d53433..13d8121 100644
--- a/doc/html/functions_vars.html
+++ b/doc/html/functions_vars.html
@@ -107,7 +107,7 @@
 </iframe>
 </div>
 
-<hr class="footer"/><address class="footer"><small>Generated on Sat May 21 2011 09:17:13 for TurboJPEG by&#160;
+<hr class="footer"/><address class="footer"><small>Generated on Sat May 21 2011 10:32:20 for TurboJPEG by&#160;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
 </body>
diff --git a/doc/html/group___turbo_j_p_e_g.html b/doc/html/group___turbo_j_p_e_g.html
index 43c14c3..a79eb9a 100644
--- a/doc/html/group___turbo_j_p_e_g.html
+++ b/doc/html/group___turbo_j_p_e_g.html
@@ -75,85 +75,79 @@
 <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Lossless transform.  <a href="structtjtransform.html#details">More...</a><br/></td></tr>
 <tr><td colspan="2"><h2><a name="define-members"></a>
 Defines</h2></td></tr>
-<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga5ef3d169162ce77ce348e292a0b7477c"></a><!-- doxytag: member="TurboJPEG::TJ_NUMSAMP" ref="ga5ef3d169162ce77ce348e292a0b7477c" args="" -->
-#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>
-<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The number of chrominance subsampling options. <br/></td></tr>
-<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga7010a4402f54a45ba822ad8675a4655e"></a><!-- doxytag: member="TurboJPEG::TJ_NUMPF" ref="ga7010a4402f54a45ba822ad8675a4655e" args="" -->
-#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>
-<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The number of pixel formats. <br/></td></tr>
-<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga109343795e7845e921a490a834809d64">TJ_BOTTOMUP</a></td></tr>
-<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Bottom-up flag.  <a href="#ga109343795e7845e921a490a834809d64"></a><br/></td></tr>
-<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga5592507320e240386d9ae06bf34a522a">TJ_FORCEMMX</a></td></tr>
-<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Force MMX flag.  <a href="#ga5592507320e240386d9ae06bf34a522a"></a><br/></td></tr>
-<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga7a71fec0a95f179db6ba478aa3f4258b">TJ_FORCESSE</a></td></tr>
-<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Force SSE flag.  <a href="#ga7a71fec0a95f179db6ba478aa3f4258b"></a><br/></td></tr>
-<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gaa1f9581ec7c9bbaaa927b058843b859c">TJ_FORCESSE2</a></td></tr>
-<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Force SSE2 flag.  <a href="#gaa1f9581ec7c9bbaaa927b058843b859c"></a><br/></td></tr>
-<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gad26795eaa44f3829b84ac738c0e3254d">TJ_FORCESSE3</a></td></tr>
-<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Force SSE3 flag.  <a href="#gad26795eaa44f3829b84ac738c0e3254d"></a><br/></td></tr>
-<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gaac2d4b966a497ad5db3cc8ba88e739b5">TJ_FASTUPSAMPLE</a></td></tr>
-<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Fast upsampling flag.  <a href="#gaac2d4b966a497ad5db3cc8ba88e739b5"></a><br/></td></tr>
-<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga928d11244f17d473b507be12655c0d81">TJ_NOREALLOC</a></td></tr>
-<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">No reallocation flag.  <a href="#ga928d11244f17d473b507be12655c0d81"></a><br/></td></tr>
-<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga9c18c2d64582faf6d690e371be4dfac4"></a><!-- doxytag: member="TurboJPEG::NUMXFORMOPT" ref="ga9c18c2d64582faf6d690e371be4dfac4" args="" -->
-#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga9c18c2d64582faf6d690e371be4dfac4">NUMXFORMOPT</a></td></tr>
-<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Number of transform operations. <br/></td></tr>
-<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gacf0de2c44b5e8c1b82147279443b87f5">TJXFORM_PERFECT</a></td></tr>
-<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">This option will cause <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform</a> to return an error if the transform is not perfect.  <a href="#gacf0de2c44b5e8c1b82147279443b87f5"></a><br/></td></tr>
-<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga94541868bc454c1af315a586d9c8e86c"></a><!-- doxytag: member="TurboJPEG::TJXFORM_TRIM" ref="ga94541868bc454c1af315a586d9c8e86c" args="" -->
-#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga94541868bc454c1af315a586d9c8e86c">TJXFORM_TRIM</a></td></tr>
-<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">This option will cause <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform</a> to discard any partial MCU blocks that cannot be transformed. <br/></td></tr>
-<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga3c57cabb332f276103ab2d142bf3138f">TJXFORM_CROP</a></td></tr>
-<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">This option will enable lossless cropping.  <a href="#ga3c57cabb332f276103ab2d142bf3138f"></a><br/></td></tr>
-<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gabc33fd8dc6c0b1512d071555796e9d59">TJXFORM_GRAY</a></td></tr>
-<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">This option will discard the color data in the input image and produce a grayscale output image.  <a href="#gabc33fd8dc6c0b1512d071555796e9d59"></a><br/></td></tr>
-<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga0aba955473315e405295d978f0c16511"></a><!-- doxytag: member="TurboJPEG::TJPAD" ref="ga0aba955473315e405295d978f0c16511" args="(width)" -->
-#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>
-<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Pad the given width to the nearest 32-bit boundary. <br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga5ef3d169162ce77ce348e292a0b7477c">TJ_NUMSAMP</a></td></tr>
+<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The number of chrominance subsampling options.  <a href="#ga5ef3d169162ce77ce348e292a0b7477c"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga7010a4402f54a45ba822ad8675a4655e">TJ_NUMPF</a></td></tr>
+<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The number of pixel formats.  <a href="#ga7010a4402f54a45ba822ad8675a4655e"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">TJFLAG_BOTTOMUP</a></td></tr>
+<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The uncompressed source/destination image is stored in bottom-up (Windows, OpenGL) order, not top-down (X11) order.  <a href="#ga72ecf4ebe6eb702d3c6f5ca27455e1ec"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga4e872f11c82f241736fa8297920f24e5">TJFLAG_FORCEMMX</a></td></tr>
+<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Turn off CPU auto-detection and force TurboJPEG to use MMX code (IPP and 32-bit libjpeg-turbo versions only.)  <a href="#ga4e872f11c82f241736fa8297920f24e5"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gae17e63189e8cd730feed3efbd2454f38">TJFLAG_FORCESSE</a></td></tr>
+<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Turn off CPU auto-detection and force TurboJPEG to use SSE code (32-bit IPP and 32-bit libjpeg-turbo versions only)  <a href="#gae17e63189e8cd730feed3efbd2454f38"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga8cf0bca96ea4d472563f4b0ebf8c48e7">TJFLAG_FORCESSE2</a></td></tr>
+<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Turn off CPU auto-detection and force TurboJPEG to use SSE2 code (32-bit IPP and 32-bit libjpeg-turbo versions only)  <a href="#ga8cf0bca96ea4d472563f4b0ebf8c48e7"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gaf9d49066633404da4386d70820295dd2">TJFLAG_FORCESSE3</a></td></tr>
+<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Turn off CPU auto-detection and force TurboJPEG to use SSE3 code (64-bit IPP version only)  <a href="#gaf9d49066633404da4386d70820295dd2"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga4ee4506c81177a06f77e2504a22efd2d">TJFLAG_FASTUPSAMPLE</a></td></tr>
+<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Use fast, inaccurate chrominance upsampling routines in the JPEG decompressor (libjpeg and libjpeg-turbo versions only)  <a href="#ga4ee4506c81177a06f77e2504a22efd2d"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963">TJFLAG_NOREALLOC</a></td></tr>
+<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Disable buffer (re)allocation.  <a href="#ga8808d403c68b62aaa58a4c1e58e98963"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga0f6dbd18adf38b7d46ac547f0f4d562c">TJ_NUMXOP</a></td></tr>
+<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Number of transform operations.  <a href="#ga0f6dbd18adf38b7d46ac547f0f4d562c"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00">TJXOPT_PERFECT</a></td></tr>
+<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">This option will cause <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> to return an error if the transform is not perfect.  <a href="#ga50e03cb5ed115330e212417429600b00"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga319826b7eb1583c0595bbe7b95428709">TJXOPT_TRIM</a></td></tr>
+<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">This option will cause <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> to discard any partial MCU blocks that cannot be transformed.  <a href="#ga319826b7eb1583c0595bbe7b95428709"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga9c771a757fc1294add611906b89ab2d2">TJXOPT_CROP</a></td></tr>
+<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">This option will enable lossless cropping.  <a href="#ga9c771a757fc1294add611906b89ab2d2"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga3acee7b48ade1b99e5588736007c2589">TJXOPT_GRAY</a></td></tr>
+<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">This option will discard the color data in the input image and produce a grayscale output image.  <a href="#ga3acee7b48ade1b99e5588736007c2589"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511">TJPAD</a>(width)</td></tr>
+<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Pad the given width to the nearest 32-bit boundary.  <a href="#ga0aba955473315e405295d978f0c16511"></a><br/></td></tr>
 <tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df">TJSCALED</a>(dimension, scalingFactor)</td></tr>
-<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Compute the scaled value of dimension using the given scaling factor.  <a href="#ga84878bb65404204743aa18cac02781df"></a><br/></td></tr>
+<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Compute the scaled value of <code>dimension</code> using the given scaling factor.  <a href="#ga84878bb65404204743aa18cac02781df"></a><br/></td></tr>
 <tr><td colspan="2"><h2><a name="typedef-members"></a>
 Typedefs</h2></td></tr>
-<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga758d2634ecb4949de7815cba621f5763"></a><!-- doxytag: member="TurboJPEG::tjhandle" ref="ga758d2634ecb4949de7815cba621f5763" args="" -->
-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>
-<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">TurboJPEG instance handle. <br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">typedef void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a></td></tr>
+<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">TurboJPEG instance handle.  <a href="#ga758d2634ecb4949de7815cba621f5763"></a><br/></td></tr>
 <tr><td colspan="2"><h2><a name="enum-members"></a>
 Enumerations</h2></td></tr>
-<tr><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom">{ <br/>
-&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#gga06fc87d81c62e9abb8790b6e5713c55ba599596595046eaf11990aa00951035cc">TJ_444</a>, 
-<a class="el" href="group___turbo_j_p_e_g.html#gga06fc87d81c62e9abb8790b6e5713c55bacaba016bd306c7b3d8ae97e5aef30807">TJ_422</a>, 
-<a class="el" href="group___turbo_j_p_e_g.html#gga06fc87d81c62e9abb8790b6e5713c55bae879a3c3c53178e19b14e2e5ef54e9b7">TJ_420</a>, 
-<a class="el" href="group___turbo_j_p_e_g.html#gga06fc87d81c62e9abb8790b6e5713c55ba0437a6ea7c98bfe8d2950bba0c7bee6e">TJ_GRAYSCALE</a>, 
+<tr><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">TJSAMP</a> { <br/>
+&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074afb8da4f44197837bdec0a4f593dacae3">TJSAMP_444</a>, 
+<a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a136130902cc578f11f32429b59368404">TJSAMP_422</a>, 
+<a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a63085dbf683cfe39e513cdb6343e3737">TJSAMP_420</a>, 
+<a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a3f1c9504842ddc7a48d0f690754b6248">TJSAMP_GRAY</a>, 
 <br/>
-&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#gga06fc87d81c62e9abb8790b6e5713c55ba443c25f3448fa61584c9b8c32c3f0951">TJ_440</a>
+&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074accf740e6f3aa6ba20ba922cad13cb974">TJSAMP_440</a>
 <br/>
  }</td></tr>
-<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Chrominance subsampling options.  <a href="group___turbo_j_p_e_g.html#ga06fc87d81c62e9abb8790b6e5713c55b">More...</a><br/></td></tr>
-<tr><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom">{ <br/>
-&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#ggadf764cbdea00d65edcd07bb9953ad2b7a74af394f6c7769ac9401a10d1d9be53c">TJ_RGB</a>, 
-<a class="el" href="group___turbo_j_p_e_g.html#ggadf764cbdea00d65edcd07bb9953ad2b7a74132a675a886956727f9a2a916b54b0">TJ_BGR</a>, 
-<a class="el" href="group___turbo_j_p_e_g.html#ggadf764cbdea00d65edcd07bb9953ad2b7aee389b6e87ef5b13cf03f86b88286f97">TJ_RGBX</a>, 
-<a class="el" href="group___turbo_j_p_e_g.html#ggadf764cbdea00d65edcd07bb9953ad2b7a67c69a5a0c0e99b17b1f409c8193dc61">TJ_BGRX</a>, 
+<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Chrominance subsampling options.  <a href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">More...</a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">TJPF</a> { <br/>
+&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7ce93230bff449518ce387c17e6ed37c">TJPF_RGB</a>, 
+<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aab10624437fb8ef495a0b153e65749839">TJPF_BGR</a>, 
+<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01">TJPF_RGBX</a>, 
+<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa2a1fbf569ca79897eae886e3376ca4c8">TJPF_BGRX</a>, 
 <br/>
-&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#ggadf764cbdea00d65edcd07bb9953ad2b7a4e6bcc27376f00171bb6803d1fbeaac2">TJ_XBGR</a>, 
-<a class="el" href="group___turbo_j_p_e_g.html#ggadf764cbdea00d65edcd07bb9953ad2b7ad92888632971887d4ed62e04a2d2256d">TJ_XRGB</a>, 
-<a class="el" href="group___turbo_j_p_e_g.html#ggadf764cbdea00d65edcd07bb9953ad2b7aeee1a57b7d6670a8c92482d673afe9df">TJ_GRAY</a>
+&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af">TJPF_XBGR</a>, 
+<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84">TJPF_XRGB</a>, 
+<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a">TJPF_GRAY</a>
 <br/>
  }</td></tr>
-<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Pixel formats.  <a href="group___turbo_j_p_e_g.html#gadf764cbdea00d65edcd07bb9953ad2b7">More...</a><br/></td></tr>
-<tr><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom">{ <br/>
-&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#gga99fb83031ce9923c84392b4e92f956b5a23735f831ff620902a6b2ebf57450e58">TJXFORM_NONE</a>, 
-<a class="el" href="group___turbo_j_p_e_g.html#gga99fb83031ce9923c84392b4e92f956b5ab70bca72789cb695d5c99ffc06152d45">TJXFORM_HFLIP</a>, 
-<a class="el" href="group___turbo_j_p_e_g.html#gga99fb83031ce9923c84392b4e92f956b5a54561bd932092708eddcac697092e766">TJXFORM_VFLIP</a>, 
-<a class="el" href="group___turbo_j_p_e_g.html#gga99fb83031ce9923c84392b4e92f956b5ac2ea856cee65b962b49824075119fa4c">TJXFORM_TRANSPOSE</a>, 
+<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Pixel formats.  <a href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">More...</a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866">TJXOP</a> { <br/>
+&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aad88c0366cd3f7d0eac9d7a3fa1c2c27">TJXOP_NONE</a>, 
+<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aa0df69776caa30f0fa28e26332d311ce">TJXOP_HFLIP</a>, 
+<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a324eddfbec53b7e691f61e56929d0d5d">TJXOP_VFLIP</a>, 
+<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a31060aed199f886afdd417f80499c32d">TJXOP_TRANSPOSE</a>, 
 <br/>
-&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#gga99fb83031ce9923c84392b4e92f956b5a26b8e50a16084c032a2249646b2badc8">TJXFORM_TRANSVERSE</a>, 
-<a class="el" href="group___turbo_j_p_e_g.html#gga99fb83031ce9923c84392b4e92f956b5a820a77baba633ed44e86aae1ba0af7ca">TJXFORM_ROT90</a>, 
-<a class="el" href="group___turbo_j_p_e_g.html#gga99fb83031ce9923c84392b4e92f956b5a72830c4f667d5453cb52ce2d323ce280">TJXFORM_ROT180</a>, 
-<a class="el" href="group___turbo_j_p_e_g.html#gga99fb83031ce9923c84392b4e92f956b5a41481b0bd887df6403e0f69c06115e18">TJXFORM_ROT270</a>
+&#160;&#160;<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866af3b14d488aea6ece9e5b3df73a74d6a4">TJXOP_TRANSVERSE</a>, 
+<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a43b2bbb23bc4bd548422d43fbe9af128">TJXOP_ROT90</a>, 
+<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a140952eb8dd0300accfcc22726d69692">TJXOP_ROT180</a>, 
+<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a3064ee5dfb7f032df332818587567a08">TJXOP_ROT270</a>
 <br/>
  }</td></tr>
-<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Transform operations for <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform</a>.  <a href="group___turbo_j_p_e_g.html#ga99fb83031ce9923c84392b4e92f956b5">More...</a><br/></td></tr>
+<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Transform operations for <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a>  <a href="group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866">More...</a><br/></td></tr>
 <tr><td colspan="2"><h2><a name="func-members"></a>
 Functions</h2></td></tr>
 <tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> DLLCALL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga3d10c47fbe4a2489a2b30c931551d01a">tjInitCompress</a> (void)</td></tr>
@@ -196,126 +190,183 @@
 <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Green offset (in bytes) for a given pixel format.  <a href="#ga82d6e35da441112a411da41923c0ba2f"></a><br/></td></tr>
 <tr><td class="memItemLeft" align="right" valign="top">static const int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga84e2e35d3f08025f976ec1ec53693dea">tjBlueOffset</a> [TJ_NUMPF]</td></tr>
 <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Blue offset (in bytes) for a given pixel format.  <a href="#ga84e2e35d3f08025f976ec1ec53693dea"></a><br/></td></tr>
-<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gad77cf8fe5b2bfd3cb3f53098146abb4c"></a><!-- doxytag: member="TurboJPEG::tjPixelSize" ref="gad77cf8fe5b2bfd3cb3f53098146abb4c" args="[TJ_NUMPF]" -->
-static const int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c">tjPixelSize</a> [TJ_NUMPF]</td></tr>
-<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Pixel size (in bytes) for a given pixel format. <br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">static const int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c">tjPixelSize</a> [TJ_NUMPF]</td></tr>
+<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Pixel size (in bytes) for a given pixel format.  <a href="#gad77cf8fe5b2bfd3cb3f53098146abb4c"></a><br/></td></tr>
 </table>
 <hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
 <p>TurboJPEG API. </p>
 <p>This API provides an interface for generating, decoding, and transforming planar YUV and JPEG images in memory. </p>
 <hr/><h2>Define Documentation</h2>
-<a class="anchor" id="ga109343795e7845e921a490a834809d64"></a><!-- doxytag: member="turbojpeg.h::TJ_BOTTOMUP" ref="ga109343795e7845e921a490a834809d64" args="" -->
+<a class="anchor" id="ga7010a4402f54a45ba822ad8675a4655e"></a><!-- doxytag: member="turbojpeg.h::TJ_NUMPF" ref="ga7010a4402f54a45ba822ad8675a4655e" args="" -->
 <div class="memitem">
 <div class="memproto">
       <table class="memname">
         <tr>
-          <td class="memname">#define TJ_BOTTOMUP</td>
+          <td class="memname">#define TJ_NUMPF</td>
         </tr>
       </table>
 </div>
 <div class="memdoc">
 
-<p>Bottom-up flag. </p>
-<p><a class="anchor" id="flags"></a> The uncompressed source/destination image is stored in bottom-up (Windows, OpenGL) order, not top-down (X11) order. </p>
+<p>The number of pixel formats. </p>
 
 </div>
 </div>
-<a class="anchor" id="gaac2d4b966a497ad5db3cc8ba88e739b5"></a><!-- doxytag: member="turbojpeg.h::TJ_FASTUPSAMPLE" ref="gaac2d4b966a497ad5db3cc8ba88e739b5" args="" -->
+<a class="anchor" id="ga5ef3d169162ce77ce348e292a0b7477c"></a><!-- doxytag: member="turbojpeg.h::TJ_NUMSAMP" ref="ga5ef3d169162ce77ce348e292a0b7477c" args="" -->
 <div class="memitem">
 <div class="memproto">
       <table class="memname">
         <tr>
-          <td class="memname">#define TJ_FASTUPSAMPLE</td>
+          <td class="memname">#define TJ_NUMSAMP</td>
         </tr>
       </table>
 </div>
 <div class="memdoc">
 
-<p>Fast upsampling flag. </p>
+<p>The number of chrominance subsampling options. </p>
+
+</div>
+</div>
+<a class="anchor" id="ga0f6dbd18adf38b7d46ac547f0f4d562c"></a><!-- doxytag: member="turbojpeg.h::TJ_NUMXOP" ref="ga0f6dbd18adf38b7d46ac547f0f4d562c" args="" -->
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">#define TJ_NUMXOP</td>
+        </tr>
+      </table>
+</div>
+<div class="memdoc">
+
+<p>Number of transform operations. </p>
+
+</div>
+</div>
+<a class="anchor" id="ga72ecf4ebe6eb702d3c6f5ca27455e1ec"></a><!-- doxytag: member="turbojpeg.h::TJFLAG_BOTTOMUP" ref="ga72ecf4ebe6eb702d3c6f5ca27455e1ec" args="" -->
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">#define TJFLAG_BOTTOMUP</td>
+        </tr>
+      </table>
+</div>
+<div class="memdoc">
+
+<p>The uncompressed source/destination image is stored in bottom-up (Windows, OpenGL) order, not top-down (X11) order. </p>
+
+</div>
+</div>
+<a class="anchor" id="ga4ee4506c81177a06f77e2504a22efd2d"></a><!-- doxytag: member="turbojpeg.h::TJFLAG_FASTUPSAMPLE" ref="ga4ee4506c81177a06f77e2504a22efd2d" args="" -->
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">#define TJFLAG_FASTUPSAMPLE</td>
+        </tr>
+      </table>
+</div>
+<div class="memdoc">
+
 <p>Use fast, inaccurate chrominance upsampling routines in the JPEG decompressor (libjpeg and libjpeg-turbo versions only) </p>
 
 </div>
 </div>
-<a class="anchor" id="ga5592507320e240386d9ae06bf34a522a"></a><!-- doxytag: member="turbojpeg.h::TJ_FORCEMMX" ref="ga5592507320e240386d9ae06bf34a522a" args="" -->
+<a class="anchor" id="ga4e872f11c82f241736fa8297920f24e5"></a><!-- doxytag: member="turbojpeg.h::TJFLAG_FORCEMMX" ref="ga4e872f11c82f241736fa8297920f24e5" args="" -->
 <div class="memitem">
 <div class="memproto">
       <table class="memname">
         <tr>
-          <td class="memname">#define TJ_FORCEMMX</td>
+          <td class="memname">#define TJFLAG_FORCEMMX</td>
         </tr>
       </table>
 </div>
 <div class="memdoc">
 
-<p>Force MMX flag. </p>
 <p>Turn off CPU auto-detection and force TurboJPEG to use MMX code (IPP and 32-bit libjpeg-turbo versions only.) </p>
 
 </div>
 </div>
-<a class="anchor" id="ga7a71fec0a95f179db6ba478aa3f4258b"></a><!-- doxytag: member="turbojpeg.h::TJ_FORCESSE" ref="ga7a71fec0a95f179db6ba478aa3f4258b" args="" -->
+<a class="anchor" id="gae17e63189e8cd730feed3efbd2454f38"></a><!-- doxytag: member="turbojpeg.h::TJFLAG_FORCESSE" ref="gae17e63189e8cd730feed3efbd2454f38" args="" -->
 <div class="memitem">
 <div class="memproto">
       <table class="memname">
         <tr>
-          <td class="memname">#define TJ_FORCESSE</td>
+          <td class="memname">#define TJFLAG_FORCESSE</td>
         </tr>
       </table>
 </div>
 <div class="memdoc">
 
-<p>Force SSE flag. </p>
 <p>Turn off CPU auto-detection and force TurboJPEG to use SSE code (32-bit IPP and 32-bit libjpeg-turbo versions only) </p>
 
 </div>
 </div>
-<a class="anchor" id="gaa1f9581ec7c9bbaaa927b058843b859c"></a><!-- doxytag: member="turbojpeg.h::TJ_FORCESSE2" ref="gaa1f9581ec7c9bbaaa927b058843b859c" args="" -->
+<a class="anchor" id="ga8cf0bca96ea4d472563f4b0ebf8c48e7"></a><!-- doxytag: member="turbojpeg.h::TJFLAG_FORCESSE2" ref="ga8cf0bca96ea4d472563f4b0ebf8c48e7" args="" -->
 <div class="memitem">
 <div class="memproto">
       <table class="memname">
         <tr>
-          <td class="memname">#define TJ_FORCESSE2</td>
+          <td class="memname">#define TJFLAG_FORCESSE2</td>
         </tr>
       </table>
 </div>
 <div class="memdoc">
 
-<p>Force SSE2 flag. </p>
 <p>Turn off CPU auto-detection and force TurboJPEG to use SSE2 code (32-bit IPP and 32-bit libjpeg-turbo versions only) </p>
 
 </div>
 </div>
-<a class="anchor" id="gad26795eaa44f3829b84ac738c0e3254d"></a><!-- doxytag: member="turbojpeg.h::TJ_FORCESSE3" ref="gad26795eaa44f3829b84ac738c0e3254d" args="" -->
+<a class="anchor" id="gaf9d49066633404da4386d70820295dd2"></a><!-- doxytag: member="turbojpeg.h::TJFLAG_FORCESSE3" ref="gaf9d49066633404da4386d70820295dd2" args="" -->
 <div class="memitem">
 <div class="memproto">
       <table class="memname">
         <tr>
-          <td class="memname">#define TJ_FORCESSE3</td>
+          <td class="memname">#define TJFLAG_FORCESSE3</td>
         </tr>
       </table>
 </div>
 <div class="memdoc">
 
-<p>Force SSE3 flag. </p>
 <p>Turn off CPU auto-detection and force TurboJPEG to use SSE3 code (64-bit IPP version only) </p>
 
 </div>
 </div>
-<a class="anchor" id="ga928d11244f17d473b507be12655c0d81"></a><!-- doxytag: member="turbojpeg.h::TJ_NOREALLOC" ref="ga928d11244f17d473b507be12655c0d81" args="" -->
+<a class="anchor" id="ga8808d403c68b62aaa58a4c1e58e98963"></a><!-- doxytag: member="turbojpeg.h::TJFLAG_NOREALLOC" ref="ga8808d403c68b62aaa58a4c1e58e98963" args="" -->
 <div class="memitem">
 <div class="memproto">
       <table class="memname">
         <tr>
-          <td class="memname">#define TJ_NOREALLOC</td>
+          <td class="memname">#define TJFLAG_NOREALLOC</td>
         </tr>
       </table>
 </div>
 <div class="memdoc">
 
-<p>No reallocation flag. </p>
+<p>Disable buffer (re)allocation. </p>
 <p>If passed to <a class="el" href="group___turbo_j_p_e_g.html#gaba62b7a98f960839b588579898495cf2" title="Compress an RGB or grayscale image into a JPEG image.">tjCompress2()</a> or <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a>, this flag will cause those functions to generate an error if the JPEG image buffer is invalid or too small rather than attempting to allocate or reallocate that buffer. This reproduces the behavior of earlier versions of TurboJPEG. </p>
 
 </div>
 </div>
+<a class="anchor" id="ga0aba955473315e405295d978f0c16511"></a><!-- doxytag: member="turbojpeg.h::TJPAD" ref="ga0aba955473315e405295d978f0c16511" args="(width)" -->
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">#define TJPAD</td>
+          <td>(</td>
+          <td class="paramtype">&#160;</td>
+          <td class="paramname">width</td><td>)</td>
+          <td></td>
+        </tr>
+      </table>
+</div>
+<div class="memdoc">
+
+<p>Pad the given width to the nearest 32-bit boundary. </p>
+
+</div>
+</div>
 <a class="anchor" id="ga84878bb65404204743aa18cac02781df"></a><!-- doxytag: member="turbojpeg.h::TJSCALED" ref="ga84878bb65404204743aa18cac02781df" args="(dimension, scalingFactor)" -->
 <div class="memitem">
 <div class="memproto">
@@ -341,139 +392,128 @@
 </div>
 <div class="memdoc">
 
-<p>Compute the scaled value of dimension using the given scaling factor. </p>
+<p>Compute the scaled value of <code>dimension</code> using the given scaling factor. </p>
 <p>This macro performs the integer equivalent of <code>ceil(dimension * scalingFactor)</code>. </p>
 
 </div>
 </div>
-<a class="anchor" id="ga3c57cabb332f276103ab2d142bf3138f"></a><!-- doxytag: member="turbojpeg.h::TJXFORM_CROP" ref="ga3c57cabb332f276103ab2d142bf3138f" args="" -->
+<a class="anchor" id="ga9c771a757fc1294add611906b89ab2d2"></a><!-- doxytag: member="turbojpeg.h::TJXOPT_CROP" ref="ga9c771a757fc1294add611906b89ab2d2" args="" -->
 <div class="memitem">
 <div class="memproto">
       <table class="memname">
         <tr>
-          <td class="memname">#define TJXFORM_CROP</td>
+          <td class="memname">#define TJXOPT_CROP</td>
         </tr>
       </table>
 </div>
 <div class="memdoc">
 
 <p>This option will enable lossless cropping. </p>
-<p>See <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform</a> for more information. </p>
+<p>See <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> for more information. </p>
 
 </div>
 </div>
-<a class="anchor" id="gabc33fd8dc6c0b1512d071555796e9d59"></a><!-- doxytag: member="turbojpeg.h::TJXFORM_GRAY" ref="gabc33fd8dc6c0b1512d071555796e9d59" args="" -->
+<a class="anchor" id="ga3acee7b48ade1b99e5588736007c2589"></a><!-- doxytag: member="turbojpeg.h::TJXOPT_GRAY" ref="ga3acee7b48ade1b99e5588736007c2589" args="" -->
 <div class="memitem">
 <div class="memproto">
       <table class="memname">
         <tr>
-          <td class="memname">#define TJXFORM_GRAY</td>
+          <td class="memname">#define TJXOPT_GRAY</td>
         </tr>
       </table>
 </div>
 <div class="memdoc">
 
 <p>This option will discard the color data in the input image and produce a grayscale output image. </p>
-<p><a class="anchor" id="xformopt"></a> </p>
 
 </div>
 </div>
-<a class="anchor" id="gacf0de2c44b5e8c1b82147279443b87f5"></a><!-- doxytag: member="turbojpeg.h::TJXFORM_PERFECT" ref="gacf0de2c44b5e8c1b82147279443b87f5" args="" -->
+<a class="anchor" id="ga50e03cb5ed115330e212417429600b00"></a><!-- doxytag: member="turbojpeg.h::TJXOPT_PERFECT" ref="ga50e03cb5ed115330e212417429600b00" args="" -->
 <div class="memitem">
 <div class="memproto">
       <table class="memname">
         <tr>
-          <td class="memname">#define TJXFORM_PERFECT</td>
+          <td class="memname">#define TJXOPT_PERFECT</td>
         </tr>
       </table>
 </div>
 <div class="memdoc">
 
-<p>This option will cause <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform</a> to return an error if the transform is not perfect. </p>
+<p>This option will cause <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> to return an error if the transform is not perfect. </p>
 <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>
 
 </div>
 </div>
-<hr/><h2>Enumeration Type Documentation</h2>
-<a class="anchor" id="ga06fc87d81c62e9abb8790b6e5713c55b"></a><!-- doxytag: member="turbojpeg.h::@0" ref="ga06fc87d81c62e9abb8790b6e5713c55b" args="" -->
+<a class="anchor" id="ga319826b7eb1583c0595bbe7b95428709"></a><!-- doxytag: member="turbojpeg.h::TJXOPT_TRIM" ref="ga319826b7eb1583c0595bbe7b95428709" args="" -->
 <div class="memitem">
 <div class="memproto">
       <table class="memname">
         <tr>
-          <td class="memname">anonymous enum</td>
+          <td class="memname">#define TJXOPT_TRIM</td>
         </tr>
       </table>
 </div>
 <div class="memdoc">
 
-<p>Chrominance subsampling options. </p>
-<p><a class="anchor" id="subsamp"></a> When an image is converted from the RGB to the YCbCr colorspace as part of the JPEG compression process, some of the Cb and Cr (chrominance) components can be discarded or averaged together to produce a smaller image with little perceptible loss of image clarity (the human eye is more sensitive to small changes in brightness than small changes in color.) This is called "chrominance subsampling". </p>
-<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
-<tr><td valign="top"><em><a class="anchor" id="gga06fc87d81c62e9abb8790b6e5713c55ba599596595046eaf11990aa00951035cc"></a><!-- doxytag: member="TJ_444" ref="gga06fc87d81c62e9abb8790b6e5713c55ba599596595046eaf11990aa00951035cc" args="" -->TJ_444</em>&nbsp;</td><td>
-<p>4:4:4 chrominance subsampling (no chrominance subsampling). </p>
-<p>The JPEG or YUV image will contain one chrominance component for every pixel in the source image. </p>
-</td></tr>
-<tr><td valign="top"><em><a class="anchor" id="gga06fc87d81c62e9abb8790b6e5713c55bacaba016bd306c7b3d8ae97e5aef30807"></a><!-- doxytag: member="TJ_422" ref="gga06fc87d81c62e9abb8790b6e5713c55bacaba016bd306c7b3d8ae97e5aef30807" args="" -->TJ_422</em>&nbsp;</td><td>
-<p>4:2:2 chrominance subsampling. </p>
-<p>The JPEG or YUV image will contain one chrominance component for every 2x1 block of pixels in the source image. </p>
-</td></tr>
-<tr><td valign="top"><em><a class="anchor" id="gga06fc87d81c62e9abb8790b6e5713c55bae879a3c3c53178e19b14e2e5ef54e9b7"></a><!-- doxytag: member="TJ_420" ref="gga06fc87d81c62e9abb8790b6e5713c55bae879a3c3c53178e19b14e2e5ef54e9b7" args="" -->TJ_420</em>&nbsp;</td><td>
-<p>4:2:0 chrominance subsampling. </p>
-<p>The JPEG or YUV image will contain one chrominance component for every 2x2 block of pixels in the source image. </p>
-</td></tr>
-<tr><td valign="top"><em><a class="anchor" id="gga06fc87d81c62e9abb8790b6e5713c55ba0437a6ea7c98bfe8d2950bba0c7bee6e"></a><!-- doxytag: member="TJ_GRAYSCALE" ref="gga06fc87d81c62e9abb8790b6e5713c55ba0437a6ea7c98bfe8d2950bba0c7bee6e" args="" -->TJ_GRAYSCALE</em>&nbsp;</td><td>
-<p>Grayscale. </p>
-<p>The JPEG or YUV image will contain no chrominance components. </p>
-</td></tr>
-<tr><td valign="top"><em><a class="anchor" id="gga06fc87d81c62e9abb8790b6e5713c55ba443c25f3448fa61584c9b8c32c3f0951"></a><!-- doxytag: member="TJ_440" ref="gga06fc87d81c62e9abb8790b6e5713c55ba443c25f3448fa61584c9b8c32c3f0951" args="" -->TJ_440</em>&nbsp;</td><td>
-<p>4:4:0 chrominance subsampling. </p>
-<p>The JPEG or YUV image will contain one chrominance component for every 1x2 block of pixels in the source image. </p>
-</td></tr>
-</table>
-</dd>
-</dl>
+<p>This option will cause <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> to discard any partial MCU blocks that cannot be transformed. </p>
 
 </div>
 </div>
-<a class="anchor" id="gadf764cbdea00d65edcd07bb9953ad2b7"></a><!-- doxytag: member="turbojpeg.h::@1" ref="gadf764cbdea00d65edcd07bb9953ad2b7" args="" -->
+<hr/><h2>Typedef Documentation</h2>
+<a class="anchor" id="ga758d2634ecb4949de7815cba621f5763"></a><!-- doxytag: member="turbojpeg.h::tjhandle" ref="ga758d2634ecb4949de7815cba621f5763" args="" -->
 <div class="memitem">
 <div class="memproto">
       <table class="memname">
         <tr>
-          <td class="memname">anonymous enum</td>
+          <td class="memname">typedef void* <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a></td>
+        </tr>
+      </table>
+</div>
+<div class="memdoc">
+
+<p>TurboJPEG instance handle. </p>
+
+</div>
+</div>
+<hr/><h2>Enumeration Type Documentation</h2>
+<a class="anchor" id="gac916144e26c3817ac514e64ae5d12e2a"></a><!-- doxytag: member="turbojpeg.h::TJPF" ref="gac916144e26c3817ac514e64ae5d12e2a" args="" -->
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">enum <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">TJPF</a></td>
         </tr>
       </table>
 </div>
 <div class="memdoc">
 
 <p>Pixel formats. </p>
-<p><a class="anchor" id="pixelformats"></a> </p>
 <dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
-<tr><td valign="top"><em><a class="anchor" id="ggadf764cbdea00d65edcd07bb9953ad2b7a74af394f6c7769ac9401a10d1d9be53c"></a><!-- doxytag: member="TJ_RGB" ref="ggadf764cbdea00d65edcd07bb9953ad2b7a74af394f6c7769ac9401a10d1d9be53c" args="" -->TJ_RGB</em>&nbsp;</td><td>
+<tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa7ce93230bff449518ce387c17e6ed37c"></a><!-- doxytag: member="TJPF_RGB" ref="ggac916144e26c3817ac514e64ae5d12e2aa7ce93230bff449518ce387c17e6ed37c" args="" -->TJPF_RGB</em>&nbsp;</td><td>
 <p>RGB pixel format. </p>
 <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>
 </td></tr>
-<tr><td valign="top"><em><a class="anchor" id="ggadf764cbdea00d65edcd07bb9953ad2b7a74132a675a886956727f9a2a916b54b0"></a><!-- doxytag: member="TJ_BGR" ref="ggadf764cbdea00d65edcd07bb9953ad2b7a74132a675a886956727f9a2a916b54b0" args="" -->TJ_BGR</em>&nbsp;</td><td>
+<tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aab10624437fb8ef495a0b153e65749839"></a><!-- doxytag: member="TJPF_BGR" ref="ggac916144e26c3817ac514e64ae5d12e2aab10624437fb8ef495a0b153e65749839" args="" -->TJPF_BGR</em>&nbsp;</td><td>
 <p>BGR pixel format. </p>
 <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>
 </td></tr>
-<tr><td valign="top"><em><a class="anchor" id="ggadf764cbdea00d65edcd07bb9953ad2b7aee389b6e87ef5b13cf03f86b88286f97"></a><!-- doxytag: member="TJ_RGBX" ref="ggadf764cbdea00d65edcd07bb9953ad2b7aee389b6e87ef5b13cf03f86b88286f97" args="" -->TJ_RGBX</em>&nbsp;</td><td>
+<tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01"></a><!-- doxytag: member="TJPF_RGBX" ref="ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01" args="" -->TJPF_RGBX</em>&nbsp;</td><td>
 <p>RGBX pixel format. </p>
 <p>The red, green, and blue components in the image are stored in 4-byte pixels in the order R, G, B from lowest to highest byte address within each pixel. </p>
 </td></tr>
-<tr><td valign="top"><em><a class="anchor" id="ggadf764cbdea00d65edcd07bb9953ad2b7a67c69a5a0c0e99b17b1f409c8193dc61"></a><!-- doxytag: member="TJ_BGRX" ref="ggadf764cbdea00d65edcd07bb9953ad2b7a67c69a5a0c0e99b17b1f409c8193dc61" args="" -->TJ_BGRX</em>&nbsp;</td><td>
+<tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa2a1fbf569ca79897eae886e3376ca4c8"></a><!-- doxytag: member="TJPF_BGRX" ref="ggac916144e26c3817ac514e64ae5d12e2aa2a1fbf569ca79897eae886e3376ca4c8" args="" -->TJPF_BGRX</em>&nbsp;</td><td>
 <p>BGRX pixel format. </p>
 <p>The red, green, and blue components in the image are stored in 4-byte pixels in the order B, G, R from lowest to highest byte address within each pixel. </p>
 </td></tr>
-<tr><td valign="top"><em><a class="anchor" id="ggadf764cbdea00d65edcd07bb9953ad2b7a4e6bcc27376f00171bb6803d1fbeaac2"></a><!-- doxytag: member="TJ_XBGR" ref="ggadf764cbdea00d65edcd07bb9953ad2b7a4e6bcc27376f00171bb6803d1fbeaac2" args="" -->TJ_XBGR</em>&nbsp;</td><td>
+<tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af"></a><!-- doxytag: member="TJPF_XBGR" ref="ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af" args="" -->TJPF_XBGR</em>&nbsp;</td><td>
 <p>XBGR pixel format. </p>
 <p>The red, green, and blue components in the image are stored in 4-byte pixels in the order R, G, B from highest to lowest byte address within each pixel. </p>
 </td></tr>
-<tr><td valign="top"><em><a class="anchor" id="ggadf764cbdea00d65edcd07bb9953ad2b7ad92888632971887d4ed62e04a2d2256d"></a><!-- doxytag: member="TJ_XRGB" ref="ggadf764cbdea00d65edcd07bb9953ad2b7ad92888632971887d4ed62e04a2d2256d" args="" -->TJ_XRGB</em>&nbsp;</td><td>
+<tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84"></a><!-- doxytag: member="TJPF_XRGB" ref="ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84" args="" -->TJPF_XRGB</em>&nbsp;</td><td>
 <p>XRGB pixel format. </p>
 <p>The red, green, and blue components in the image are stored in 4-byte pixels in the order B, G, R from highest to lowest byte address within each pixel. </p>
 </td></tr>
-<tr><td valign="top"><em><a class="anchor" id="ggadf764cbdea00d65edcd07bb9953ad2b7aeee1a57b7d6670a8c92482d673afe9df"></a><!-- doxytag: member="TJ_GRAY" ref="ggadf764cbdea00d65edcd07bb9953ad2b7aeee1a57b7d6670a8c92482d673afe9df" args="" -->TJ_GRAY</em>&nbsp;</td><td>
+<tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a"></a><!-- doxytag: member="TJPF_GRAY" ref="ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a" args="" -->TJPF_GRAY</em>&nbsp;</td><td>
 <p>Grayscale pixel format. </p>
 <p>Each 1-byte pixel represents a luminance (brightness) level from 0 to 255. </p>
 </td></tr>
@@ -483,48 +523,87 @@
 
 </div>
 </div>
-<a class="anchor" id="ga99fb83031ce9923c84392b4e92f956b5"></a><!-- doxytag: member="turbojpeg.h::@2" ref="ga99fb83031ce9923c84392b4e92f956b5" args="" -->
+<a class="anchor" id="ga1d047060ea80bb9820d540bb928e9074"></a><!-- doxytag: member="turbojpeg.h::TJSAMP" ref="ga1d047060ea80bb9820d540bb928e9074" args="" -->
 <div class="memitem">
 <div class="memproto">
       <table class="memname">
         <tr>
-          <td class="memname">anonymous enum</td>
+          <td class="memname">enum <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">TJSAMP</a></td>
         </tr>
       </table>
 </div>
 <div class="memdoc">
 
-<p>Transform operations for <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform</a>. </p>
-<p><a class="anchor" id="xformop"></a> </p>
+<p>Chrominance subsampling options. </p>
+<p>When an image is converted from the RGB to the YCbCr colorspace as part of the JPEG compression process, some of the Cb and Cr (chrominance) components can be discarded or averaged together to produce a smaller image with little perceptible loss of image clarity (the human eye is more sensitive to small changes in brightness than small changes in color.) This is called "chrominance subsampling". </p>
 <dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
-<tr><td valign="top"><em><a class="anchor" id="gga99fb83031ce9923c84392b4e92f956b5a23735f831ff620902a6b2ebf57450e58"></a><!-- doxytag: member="TJXFORM_NONE" ref="gga99fb83031ce9923c84392b4e92f956b5a23735f831ff620902a6b2ebf57450e58" args="" -->TJXFORM_NONE</em>&nbsp;</td><td>
+<tr><td valign="top"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074afb8da4f44197837bdec0a4f593dacae3"></a><!-- doxytag: member="TJSAMP_444" ref="gga1d047060ea80bb9820d540bb928e9074afb8da4f44197837bdec0a4f593dacae3" args="" -->TJSAMP_444</em>&nbsp;</td><td>
+<p>4:4:4 chrominance subsampling (no chrominance subsampling). </p>
+<p>The JPEG or YUV image will contain one chrominance component for every pixel in the source image. </p>
+</td></tr>
+<tr><td valign="top"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074a136130902cc578f11f32429b59368404"></a><!-- doxytag: member="TJSAMP_422" ref="gga1d047060ea80bb9820d540bb928e9074a136130902cc578f11f32429b59368404" args="" -->TJSAMP_422</em>&nbsp;</td><td>
+<p>4:2:2 chrominance subsampling. </p>
+<p>The JPEG or YUV image will contain one chrominance component for every 2x1 block of pixels in the source image. </p>
+</td></tr>
+<tr><td valign="top"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074a63085dbf683cfe39e513cdb6343e3737"></a><!-- doxytag: member="TJSAMP_420" ref="gga1d047060ea80bb9820d540bb928e9074a63085dbf683cfe39e513cdb6343e3737" args="" -->TJSAMP_420</em>&nbsp;</td><td>
+<p>4:2:0 chrominance subsampling. </p>
+<p>The JPEG or YUV image will contain one chrominance component for every 2x2 block of pixels in the source image. </p>
+</td></tr>
+<tr><td valign="top"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074a3f1c9504842ddc7a48d0f690754b6248"></a><!-- doxytag: member="TJSAMP_GRAY" ref="gga1d047060ea80bb9820d540bb928e9074a3f1c9504842ddc7a48d0f690754b6248" args="" -->TJSAMP_GRAY</em>&nbsp;</td><td>
+<p>Grayscale. </p>
+<p>The JPEG or YUV image will contain no chrominance components. </p>
+</td></tr>
+<tr><td valign="top"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074accf740e6f3aa6ba20ba922cad13cb974"></a><!-- doxytag: member="TJSAMP_440" ref="gga1d047060ea80bb9820d540bb928e9074accf740e6f3aa6ba20ba922cad13cb974" args="" -->TJSAMP_440</em>&nbsp;</td><td>
+<p>4:4:0 chrominance subsampling. </p>
+<p>The JPEG or YUV image will contain one chrominance component for every 1x2 block of pixels in the source image. </p>
+</td></tr>
+</table>
+</dd>
+</dl>
+
+</div>
+</div>
+<a class="anchor" id="ga2de531af4e7e6c4f124908376b354866"></a><!-- doxytag: member="turbojpeg.h::TJXOP" ref="ga2de531af4e7e6c4f124908376b354866" args="" -->
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">enum <a class="el" href="group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866">TJXOP</a></td>
+        </tr>
+      </table>
+</div>
+<div class="memdoc">
+
+<p>Transform operations for <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> </p>
+<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
+<tr><td valign="top"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866aad88c0366cd3f7d0eac9d7a3fa1c2c27"></a><!-- doxytag: member="TJXOP_NONE" ref="gga2de531af4e7e6c4f124908376b354866aad88c0366cd3f7d0eac9d7a3fa1c2c27" args="" -->TJXOP_NONE</em>&nbsp;</td><td>
 <p>Do not transform the position of the image pixels. </p>
 </td></tr>
-<tr><td valign="top"><em><a class="anchor" id="gga99fb83031ce9923c84392b4e92f956b5ab70bca72789cb695d5c99ffc06152d45"></a><!-- doxytag: member="TJXFORM_HFLIP" ref="gga99fb83031ce9923c84392b4e92f956b5ab70bca72789cb695d5c99ffc06152d45" args="" -->TJXFORM_HFLIP</em>&nbsp;</td><td>
+<tr><td valign="top"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866aa0df69776caa30f0fa28e26332d311ce"></a><!-- doxytag: member="TJXOP_HFLIP" ref="gga2de531af4e7e6c4f124908376b354866aa0df69776caa30f0fa28e26332d311ce" args="" -->TJXOP_HFLIP</em>&nbsp;</td><td>
 <p>Flip (mirror) image horizontally. </p>
-<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#gacf0de2c44b5e8c1b82147279443b87f5" title="This option will cause tjTransform to return an error if the transform is not perfect.">TJXFORM_PERFECT</a>.) </p>
+<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>
 </td></tr>
-<tr><td valign="top"><em><a class="anchor" id="gga99fb83031ce9923c84392b4e92f956b5a54561bd932092708eddcac697092e766"></a><!-- doxytag: member="TJXFORM_VFLIP" ref="gga99fb83031ce9923c84392b4e92f956b5a54561bd932092708eddcac697092e766" args="" -->TJXFORM_VFLIP</em>&nbsp;</td><td>
+<tr><td valign="top"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866a324eddfbec53b7e691f61e56929d0d5d"></a><!-- doxytag: member="TJXOP_VFLIP" ref="gga2de531af4e7e6c4f124908376b354866a324eddfbec53b7e691f61e56929d0d5d" args="" -->TJXOP_VFLIP</em>&nbsp;</td><td>
 <p>Flip (mirror) image vertically. </p>
-<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#gacf0de2c44b5e8c1b82147279443b87f5" title="This option will cause tjTransform to return an error if the transform is not perfect.">TJXFORM_PERFECT</a>.) </p>
+<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>
 </td></tr>
-<tr><td valign="top"><em><a class="anchor" id="gga99fb83031ce9923c84392b4e92f956b5ac2ea856cee65b962b49824075119fa4c"></a><!-- doxytag: member="TJXFORM_TRANSPOSE" ref="gga99fb83031ce9923c84392b4e92f956b5ac2ea856cee65b962b49824075119fa4c" args="" -->TJXFORM_TRANSPOSE</em>&nbsp;</td><td>
+<tr><td valign="top"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866a31060aed199f886afdd417f80499c32d"></a><!-- doxytag: member="TJXOP_TRANSPOSE" ref="gga2de531af4e7e6c4f124908376b354866a31060aed199f886afdd417f80499c32d" args="" -->TJXOP_TRANSPOSE</em>&nbsp;</td><td>
 <p>Transpose image (flip/mirror along upper left to lower right axis.) This transform is always perfect. </p>
 </td></tr>
-<tr><td valign="top"><em><a class="anchor" id="gga99fb83031ce9923c84392b4e92f956b5a26b8e50a16084c032a2249646b2badc8"></a><!-- doxytag: member="TJXFORM_TRANSVERSE" ref="gga99fb83031ce9923c84392b4e92f956b5a26b8e50a16084c032a2249646b2badc8" args="" -->TJXFORM_TRANSVERSE</em>&nbsp;</td><td>
-<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#gacf0de2c44b5e8c1b82147279443b87f5" title="This option will cause tjTransform to return an error if the transform is not perfect.">TJXFORM_PERFECT</a>.) </p>
+<tr><td valign="top"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866af3b14d488aea6ece9e5b3df73a74d6a4"></a><!-- doxytag: member="TJXOP_TRANSVERSE" ref="gga2de531af4e7e6c4f124908376b354866af3b14d488aea6ece9e5b3df73a74d6a4" args="" -->TJXOP_TRANSVERSE</em>&nbsp;</td><td>
+<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>
 </td></tr>
-<tr><td valign="top"><em><a class="anchor" id="gga99fb83031ce9923c84392b4e92f956b5a820a77baba633ed44e86aae1ba0af7ca"></a><!-- doxytag: member="TJXFORM_ROT90" ref="gga99fb83031ce9923c84392b4e92f956b5a820a77baba633ed44e86aae1ba0af7ca" args="" -->TJXFORM_ROT90</em>&nbsp;</td><td>
+<tr><td valign="top"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866a43b2bbb23bc4bd548422d43fbe9af128"></a><!-- doxytag: member="TJXOP_ROT90" ref="gga2de531af4e7e6c4f124908376b354866a43b2bbb23bc4bd548422d43fbe9af128" args="" -->TJXOP_ROT90</em>&nbsp;</td><td>
 <p>Rotate image clockwise by 90 degrees. </p>
-<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#gacf0de2c44b5e8c1b82147279443b87f5" title="This option will cause tjTransform to return an error if the transform is not perfect.">TJXFORM_PERFECT</a>.) </p>
+<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>
 </td></tr>
-<tr><td valign="top"><em><a class="anchor" id="gga99fb83031ce9923c84392b4e92f956b5a72830c4f667d5453cb52ce2d323ce280"></a><!-- doxytag: member="TJXFORM_ROT180" ref="gga99fb83031ce9923c84392b4e92f956b5a72830c4f667d5453cb52ce2d323ce280" args="" -->TJXFORM_ROT180</em>&nbsp;</td><td>
+<tr><td valign="top"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866a140952eb8dd0300accfcc22726d69692"></a><!-- doxytag: member="TJXOP_ROT180" ref="gga2de531af4e7e6c4f124908376b354866a140952eb8dd0300accfcc22726d69692" args="" -->TJXOP_ROT180</em>&nbsp;</td><td>
 <p>Rotate image 180 degrees. </p>
-<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#gacf0de2c44b5e8c1b82147279443b87f5" title="This option will cause tjTransform to return an error if the transform is not perfect.">TJXFORM_PERFECT</a>.) </p>
+<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>
 </td></tr>
-<tr><td valign="top"><em><a class="anchor" id="gga99fb83031ce9923c84392b4e92f956b5a41481b0bd887df6403e0f69c06115e18"></a><!-- doxytag: member="TJXFORM_ROT270" ref="gga99fb83031ce9923c84392b4e92f956b5a41481b0bd887df6403e0f69c06115e18" args="" -->TJXFORM_ROT270</em>&nbsp;</td><td>
+<tr><td valign="top"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866a3064ee5dfb7f032df332818587567a08"></a><!-- doxytag: member="TJXOP_ROT270" ref="gga2de531af4e7e6c4f124908376b354866a3064ee5dfb7f032df332818587567a08" args="" -->TJXOP_ROT270</em>&nbsp;</td><td>
 <p>Rotate image counter-clockwise by 90 degrees. </p>
-<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#gacf0de2c44b5e8c1b82147279443b87f5" title="This option will cause tjTransform to return an error if the transform is not perfect.">TJXFORM_PERFECT</a>.) </p>
+<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>
 </td></tr>
 </table>
 </dd>
@@ -606,7 +685,7 @@
   <table class="params">
     <tr><td class="paramname">width</td><td>width of the image (in pixels) </td></tr>
     <tr><td class="paramname">height</td><td>height of the image (in pixels) </td></tr>
-    <tr><td class="paramname">jpegSubsamp</td><td>level of chrominance subsampling in the image (see <a class="el" href="group___turbo_j_p_e_g.html#subsamp">Chrominance subsampling options</a>.)</td></tr>
+    <tr><td class="paramname">jpegSubsamp</td><td>level of chrominance subsampling in the image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
   </table>
   </dd>
 </dl>
@@ -701,17 +780,17 @@
     <tr><td class="paramname">width</td><td>width (in pixels) of the source image </td></tr>
     <tr><td class="paramname">pitch</td><td>bytes per line of the source image. Normally, this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>. </td></tr>
     <tr><td class="paramname">height</td><td>height (in pixels) of the source image </td></tr>
-    <tr><td class="paramname">pixelFormat</td><td>pixel format of the source image (see <a class="el" href="group___turbo_j_p_e_g.html#pixelformats">Pixel formats</a>.) </td></tr>
+    <tr><td class="paramname">pixelFormat</td><td>pixel format of the source image (see <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.) </td></tr>
     <tr><td class="paramname">jpegBuf</td><td>address of a pointer to an image buffer that will receive the JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:<ol type="1">
 <li>pre-allocate the JPEG buffer with an arbitrary size and let TurboJPEG grow the buffer as needed,</li>
 <li>set <code>*jpegBuf</code> to NULL to tell TurboJPEG to allocate the buffer for you, or</li>
-<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#ga68f4761dc5213cb9653a2f6ce236716e" 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 the <a class="el" href="group___turbo_j_p_e_g.html#ga928d11244f17d473b507be12655c0d81" title="No reallocation flag.">TJ_NOREALLOC</a> flag guarantees this.)</li>
+<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#ga68f4761dc5213cb9653a2f6ce236716e" title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters...">TJBUFSIZE()</a>. This should ensure that the buffer never has to be re-allocated (setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees this.)</li>
 </ol>
-If you choose option 1 or 3, <code>*jpegSize</code> should be set to the size of your pre-allocated buffer. In any case, unless you have set the <a class="el" href="group___turbo_j_p_e_g.html#ga928d11244f17d473b507be12655c0d81" title="No reallocation flag.">TJ_NOREALLOC</a> flag, you should always check <code>*jpegBuf</code> upon return from this function, as it may have changed. </td></tr>
+If you choose option 1 or 3, <code>*jpegSize</code> should be set to the size of your pre-allocated buffer. In any case, unless you have set <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a>, you should always check <code>*jpegBuf</code> upon return from this function, as it may have changed. </td></tr>
     <tr><td class="paramname">jpegSize</td><td>pointer to an unsigned long variable which holds the size of the JPEG image buffer. If <code>*jpegBuf</code> points to a pre-allocated buffer, then <code>*jpegSize</code> should be set to the size of the buffer. Upon return, <code>*jpegSize</code> will contain the size of the JPEG image (in bytes.) </td></tr>
-    <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#subsamp">Chrominance subsampling options</a>.) </td></tr>
+    <tr><td class="paramname">jpegSubsamp</td><td>the level of chrominance subsampling to be used when generating the JPEG image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.) </td></tr>
     <tr><td class="paramname">jpegQual</td><td>the image quality of the generated JPEG image (1 = worst, 100 = best) </td></tr>
-    <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#flags">flags</a>.</td></tr>
+    <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a>.</td></tr>
   </table>
   </dd>
 </dl>
@@ -796,8 +875,8 @@
     <tr><td class="paramname">width</td><td>desired width (in pixels) of the destination image. If this is smaller than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If width is set to 0, then only the height will be considered when determining the scaled image size. </td></tr>
     <tr><td class="paramname">pitch</td><td>bytes per line of the destination image. Normally, this is <code>scaledWidth * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the decompressed image is unpadded, else <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(scaledWidth * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the decompressed image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. (NOTE: <code>scaledWidth</code> can be determined by calling <a class="el" href="group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df" title="Compute the scaled value of dimension using the given scaling factor.">TJSCALED()</a> with the JPEG image width and one of the scaling factors returned by <a class="el" href="group___turbo_j_p_e_g.html#ga6449044b9af402999ccf52f401333be8" title="Returns a list of fractional scaling factors that the JPEG decompressor in this implementation of Tur...">tjGetScalingFactors()</a>.) You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>scaledWidth * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>. </td></tr>
     <tr><td class="paramname">height</td><td>desired height (in pixels) of the destination image. If this is smaller than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If height is set to 0, then only the width will be considered when determining the scaled image size. </td></tr>
-    <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#pixelformats">Pixel formats</a>.) </td></tr>
-    <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#flags">flags</a>.</td></tr>
+    <tr><td class="paramname">pixelFormat</td><td>pixel format of the destination image (see <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.) </td></tr>
+    <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a>.</td></tr>
   </table>
   </dd>
 </dl>
@@ -862,7 +941,7 @@
     <tr><td class="paramname">jpegSize</td><td>size of the JPEG image (in bytes) </td></tr>
     <tr><td class="paramname">width</td><td>pointer to an integer variable which will receive the width (in pixels) of the JPEG image </td></tr>
     <tr><td class="paramname">height</td><td>pointer to an integer variable which will receive the height (in pixels) of the JPEG image </td></tr>
-    <tr><td class="paramname">jpegSubsamp</td><td>pointer to an integer variable which will receive the level of chrominance subsampling used when compressing the JPEG image (see <a class="el" href="group___turbo_j_p_e_g.html#subsamp">Chrominance subsampling options</a>.)</td></tr>
+    <tr><td class="paramname">jpegSubsamp</td><td>pointer to an integer variable which will receive the level of chrominance subsampling used when compressing the JPEG image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
   </table>
   </dd>
 </dl>
@@ -921,7 +1000,7 @@
     <tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG image to decompress </td></tr>
     <tr><td class="paramname">jpegSize</td><td>size of the JPEG image (in bytes) </td></tr>
     <tr><td class="paramname">dstBuf</td><td>pointer to an image buffer which will receive the YUV image. Use <a class="el" href="group___turbo_j_p_e_g.html#ga8e624b291053bf850b7409af9b2d7ac8" title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters...">TJBUFSIZEYUV</a> to determine the appropriate size for this buffer based on the image width, height, and level of subsampling. </td></tr>
-    <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#flags">flags</a>.</td></tr>
+    <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a>.</td></tr>
   </table>
   </dd>
 </dl>
@@ -1031,10 +1110,10 @@
     <tr><td class="paramname">width</td><td>width (in pixels) of the source image </td></tr>
     <tr><td class="paramname">pitch</td><td>bytes per line of the source image. Normally, this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>. </td></tr>
     <tr><td class="paramname">height</td><td>height (in pixels) of the source image </td></tr>
-    <tr><td class="paramname">pixelFormat</td><td>pixel format of the source image (see <a class="el" href="group___turbo_j_p_e_g.html#pixelformats">Pixel formats</a>.) </td></tr>
+    <tr><td class="paramname">pixelFormat</td><td>pixel format of the source image (see <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.) </td></tr>
     <tr><td class="paramname">dstBuf</td><td>pointer to an image buffer which will receive the YUV image. Use <a class="el" href="group___turbo_j_p_e_g.html#ga8e624b291053bf850b7409af9b2d7ac8" title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters...">TJBUFSIZEYUV()</a> to determine the appropriate size for this buffer based on the image width, height, and level of chrominance subsampling. </td></tr>
-    <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#subsamp">Chrominance subsampling options</a>.) </td></tr>
-    <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#flags">flags</a>.</td></tr>
+    <tr><td class="paramname">subsamp</td><td>the level of chrominance subsampling to be used when generating the YUV image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.) </td></tr>
+    <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a>.</td></tr>
   </table>
   </dd>
 </dl>
@@ -1220,12 +1299,12 @@
     <tr><td class="paramname">dstBufs</td><td>pointer to an array of n image buffers. <code>dstBufs[i]</code> will receive a JPEG image that has been transformed using the parameters in <code>transforms[i]</code>. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:<ol type="1">
 <li>pre-allocate the JPEG buffer with an arbitrary size and let TurboJPEG grow the buffer as needed,</li>
 <li>set <code>dstBufs[i]</code> to NULL to tell TurboJPEG to allocate the buffer for you, or</li>
-<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#ga68f4761dc5213cb9653a2f6ce236716e" title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters...">TJBUFSIZE()</a> with the cropped width and height. This should ensure that the buffer never has to be re-allocated (setting the <a class="el" href="group___turbo_j_p_e_g.html#ga928d11244f17d473b507be12655c0d81" title="No reallocation flag.">TJ_NOREALLOC</a> flag guarantees this.)</li>
+<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#ga68f4761dc5213cb9653a2f6ce236716e" title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters...">TJBUFSIZE()</a> with the cropped width and height. This should ensure that the buffer never has to be re-allocated (setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees this.)</li>
 </ol>
-If you choose option 1 or 3, <code>dstSizes[i]</code> should be set to the size of your pre-allocated buffer. In any case, unless you have set the <a class="el" href="group___turbo_j_p_e_g.html#ga928d11244f17d473b507be12655c0d81" title="No reallocation flag.">TJ_NOREALLOC</a> flag, you should always check <code>dstBufs[i]</code> upon return from this function, as it may have changed. </td></tr>
+If you choose option 1 or 3, <code>dstSizes[i]</code> should be set to the size of your pre-allocated buffer. In any case, unless you have set <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a>, you should always check <code>dstBufs[i]</code> upon return from this function, as it may have changed. </td></tr>
     <tr><td class="paramname">dstSizes</td><td>pointer to an array of n unsigned long variables which will receive the actual sizes (in bytes) of each transformed JPEG image. If <code>dstBufs[i]</code> points to a pre-allocated buffer, then <code>dstSizes[i]</code> should be set to the size of the buffer. Upon return, <code>dstSizes[i]</code> will contain the size of the JPEG image (in bytes.) </td></tr>
     <tr><td class="paramname">transforms</td><td>pointer to an array of n tjtransform structures, each of which specifies the transform parameters and/or cropping region for the corresponding transformed output image. </td></tr>
-    <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#flags">flags</a>.</td></tr>
+    <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a>.</td></tr>
   </table>
   </dd>
 </dl>
@@ -1310,6 +1389,21 @@
 
 </div>
 </div>
+<a class="anchor" id="gad77cf8fe5b2bfd3cb3f53098146abb4c"></a><!-- doxytag: member="turbojpeg.h::tjPixelSize" ref="gad77cf8fe5b2bfd3cb3f53098146abb4c" args="[TJ_NUMPF]" -->
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">const int <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c">tjPixelSize</a>[TJ_NUMPF]<code> [static]</code></td>
+        </tr>
+      </table>
+</div>
+<div class="memdoc">
+
+<p>Pixel size (in bytes) for a given pixel format. </p>
+
+</div>
+</div>
 <a class="anchor" id="gadd9b446742ac8a3923f7992c7988fea8"></a><!-- doxytag: member="turbojpeg.h::tjRedOffset" ref="gadd9b446742ac8a3923f7992c7988fea8" args="[TJ_NUMPF]" -->
 <div class="memitem">
 <div class="memproto">
@@ -1341,7 +1435,7 @@
 </iframe>
 </div>
 
-<hr class="footer"/><address class="footer"><small>Generated on Sat May 21 2011 09:17:13 for TurboJPEG by&#160;
+<hr class="footer"/><address class="footer"><small>Generated on Sat May 21 2011 10:32:20 for TurboJPEG by&#160;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
 </body>
diff --git a/doc/html/index.html b/doc/html/index.html
index 99ae4df..44528e9 100644
--- a/doc/html/index.html
+++ b/doc/html/index.html
@@ -69,7 +69,7 @@
 </iframe>
 </div>
 
-<hr class="footer"/><address class="footer"><small>Generated on Sat May 21 2011 09:17:13 for TurboJPEG by&#160;
+<hr class="footer"/><address class="footer"><small>Generated on Sat May 21 2011 10:32:20 for TurboJPEG by&#160;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
 </body>
diff --git a/doc/html/modules.html b/doc/html/modules.html
index eaf4ba0..78d13cc 100644
--- a/doc/html/modules.html
+++ b/doc/html/modules.html
@@ -72,7 +72,7 @@
 </iframe>
 </div>
 
-<hr class="footer"/><address class="footer"><small>Generated on Sat May 21 2011 09:17:13 for TurboJPEG by&#160;
+<hr class="footer"/><address class="footer"><small>Generated on Sat May 21 2011 10:32:20 for TurboJPEG by&#160;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
 </body>
diff --git a/doc/html/structtjregion.html b/doc/html/structtjregion.html
index d94603d..792f0f2 100644
--- a/doc/html/structtjregion.html
+++ b/doc/html/structtjregion.html
@@ -165,7 +165,7 @@
 </iframe>
 </div>
 
-<hr class="footer"/><address class="footer"><small>Generated on Sat May 21 2011 09:17:13 for TurboJPEG by&#160;
+<hr class="footer"/><address class="footer"><small>Generated on Sat May 21 2011 10:32:20 for TurboJPEG by&#160;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
 </body>
diff --git a/doc/html/structtjscalingfactor.html b/doc/html/structtjscalingfactor.html
index d99350f..c7be357 100644
--- a/doc/html/structtjscalingfactor.html
+++ b/doc/html/structtjscalingfactor.html
@@ -71,16 +71,45 @@
 <table class="memberdecls">
 <tr><td colspan="2"><h2><a name="pub-attribs"></a>
 Data Fields</h2></td></tr>
-<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9b011e57f981ee23083e2c1aa5e640ec"></a><!-- doxytag: member="tjscalingfactor::num" ref="a9b011e57f981ee23083e2c1aa5e640ec" args="" -->
-int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structtjscalingfactor.html#a9b011e57f981ee23083e2c1aa5e640ec">num</a></td></tr>
-<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Numerator. <br/></td></tr>
-<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aefbcdf3e9e62274b2d312c695f133ce3"></a><!-- doxytag: member="tjscalingfactor::denom" ref="aefbcdf3e9e62274b2d312c695f133ce3" args="" -->
-int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structtjscalingfactor.html#aefbcdf3e9e62274b2d312c695f133ce3">denom</a></td></tr>
-<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Denominator. <br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structtjscalingfactor.html#a9b011e57f981ee23083e2c1aa5e640ec">num</a></td></tr>
+<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Numerator.  <a href="#a9b011e57f981ee23083e2c1aa5e640ec"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structtjscalingfactor.html#aefbcdf3e9e62274b2d312c695f133ce3">denom</a></td></tr>
+<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Denominator.  <a href="#aefbcdf3e9e62274b2d312c695f133ce3"></a><br/></td></tr>
 </table>
 <hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
 <div class="textblock"><p>Scaling factor. </p>
-</div><hr/>The documentation for this struct was generated from the following file:<ul>
+</div><hr/><h2>Field Documentation</h2>
+<a class="anchor" id="aefbcdf3e9e62274b2d312c695f133ce3"></a><!-- doxytag: member="tjscalingfactor::denom" ref="aefbcdf3e9e62274b2d312c695f133ce3" args="" -->
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">int <a class="el" href="structtjscalingfactor.html#aefbcdf3e9e62274b2d312c695f133ce3">tjscalingfactor::denom</a></td>
+        </tr>
+      </table>
+</div>
+<div class="memdoc">
+
+<p>Denominator. </p>
+
+</div>
+</div>
+<a class="anchor" id="a9b011e57f981ee23083e2c1aa5e640ec"></a><!-- doxytag: member="tjscalingfactor::num" ref="a9b011e57f981ee23083e2c1aa5e640ec" args="" -->
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">int <a class="el" href="structtjscalingfactor.html#a9b011e57f981ee23083e2c1aa5e640ec">tjscalingfactor::num</a></td>
+        </tr>
+      </table>
+</div>
+<div class="memdoc">
+
+<p>Numerator. </p>
+
+</div>
+</div>
+<hr/>The documentation for this struct was generated from the following file:<ul>
 <li>turbojpeg.h</li>
 </ul>
 </div>
@@ -98,7 +127,7 @@
 </iframe>
 </div>
 
-<hr class="footer"/><address class="footer"><small>Generated on Sat May 21 2011 09:17:13 for TurboJPEG by&#160;
+<hr class="footer"/><address class="footer"><small>Generated on Sat May 21 2011 10:32:20 for TurboJPEG by&#160;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
 </body>
diff --git a/doc/html/structtjtransform.html b/doc/html/structtjtransform.html
index b70bc4a..3ff7d6e 100644
--- a/doc/html/structtjtransform.html
+++ b/doc/html/structtjtransform.html
@@ -71,19 +71,62 @@
 <table class="memberdecls">
 <tr><td colspan="2"><h2><a name="pub-attribs"></a>
 Data Fields</h2></td></tr>
-<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac324e5e442abec8a961e5bf219db12cf"></a><!-- doxytag: member="tjtransform::r" ref="ac324e5e442abec8a961e5bf219db12cf" args="" -->
-<a class="el" href="structtjregion.html">tjregion</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structtjtransform.html#ac324e5e442abec8a961e5bf219db12cf">r</a></td></tr>
-<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Cropping region. <br/></td></tr>
-<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2525aab4ba6978a1c273f74fef50e498"></a><!-- doxytag: member="tjtransform::op" ref="a2525aab4ba6978a1c273f74fef50e498" args="" -->
-int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structtjtransform.html#a2525aab4ba6978a1c273f74fef50e498">op</a></td></tr>
-<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">One of the transform operations (see <a class="el" href="group___turbo_j_p_e_g.html#xformop">Transform operations</a>.) <br/></td></tr>
-<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac0e74655baa4402209a21e1ae481c8f6"></a><!-- doxytag: member="tjtransform::options" ref="ac0e74655baa4402209a21e1ae481c8f6" args="" -->
-int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structtjtransform.html#ac0e74655baa4402209a21e1ae481c8f6">options</a></td></tr>
-<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The bitwise OR of one of more of the transform options (see <a class="el" href="group___turbo_j_p_e_g.html#xformopt">Transform options</a>.) <br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structtjregion.html">tjregion</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structtjtransform.html#ac324e5e442abec8a961e5bf219db12cf">r</a></td></tr>
+<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Cropping region.  <a href="#ac324e5e442abec8a961e5bf219db12cf"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structtjtransform.html#a2525aab4ba6978a1c273f74fef50e498">op</a></td></tr>
+<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">One of the <a class="el" href="group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866">transform operations</a>.  <a href="#a2525aab4ba6978a1c273f74fef50e498"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structtjtransform.html#ac0e74655baa4402209a21e1ae481c8f6">options</a></td></tr>
+<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The bitwise OR of one of more of the <a class="el" href="group___turbo_j_p_e_g.html#ga9c771a757fc1294add611906b89ab2d2">transform options</a>.  <a href="#ac0e74655baa4402209a21e1ae481c8f6"></a><br/></td></tr>
 </table>
 <hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
 <div class="textblock"><p>Lossless transform. </p>
-</div><hr/>The documentation for this struct was generated from the following file:<ul>
+</div><hr/><h2>Field Documentation</h2>
+<a class="anchor" id="a2525aab4ba6978a1c273f74fef50e498"></a><!-- doxytag: member="tjtransform::op" ref="a2525aab4ba6978a1c273f74fef50e498" args="" -->
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">int <a class="el" href="structtjtransform.html#a2525aab4ba6978a1c273f74fef50e498">tjtransform::op</a></td>
+        </tr>
+      </table>
+</div>
+<div class="memdoc">
+
+<p>One of the <a class="el" href="group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866">transform operations</a>. </p>
+
+</div>
+</div>
+<a class="anchor" id="ac0e74655baa4402209a21e1ae481c8f6"></a><!-- doxytag: member="tjtransform::options" ref="ac0e74655baa4402209a21e1ae481c8f6" args="" -->
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">int <a class="el" href="structtjtransform.html#ac0e74655baa4402209a21e1ae481c8f6">tjtransform::options</a></td>
+        </tr>
+      </table>
+</div>
+<div class="memdoc">
+
+<p>The bitwise OR of one of more of the <a class="el" href="group___turbo_j_p_e_g.html#ga9c771a757fc1294add611906b89ab2d2">transform options</a>. </p>
+
+</div>
+</div>
+<a class="anchor" id="ac324e5e442abec8a961e5bf219db12cf"></a><!-- doxytag: member="tjtransform::r" ref="ac324e5e442abec8a961e5bf219db12cf" args="" -->
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname"><a class="el" href="structtjregion.html">tjregion</a> <a class="el" href="structtjtransform.html#ac324e5e442abec8a961e5bf219db12cf">tjtransform::r</a></td>
+        </tr>
+      </table>
+</div>
+<div class="memdoc">
+
+<p>Cropping region. </p>
+
+</div>
+</div>
+<hr/>The documentation for this struct was generated from the following file:<ul>
 <li>turbojpeg.h</li>
 </ul>
 </div>
@@ -101,7 +144,7 @@
 </iframe>
 </div>
 
-<hr class="footer"/><address class="footer"><small>Generated on Sat May 21 2011 09:17:13 for TurboJPEG by&#160;
+<hr class="footer"/><address class="footer"><small>Generated on Sat May 21 2011 10:32:20 for TurboJPEG by&#160;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
 </body>
diff --git a/doxygen.config b/doxygen.config
index 6c6e8ee..5fb34b3 100644
--- a/doxygen.config
+++ b/doxygen.config
@@ -11,3 +11,4 @@
 EXTRACT_STATIC = YES
 JAVADOC_AUTOBRIEF = YES
 MAX_INITIALIZER_LINES = 0
+ALWAYS_DETAILED_SEC = YES
diff --git a/jpegut.c b/jpegut.c
index 961c51f..a9db8b6 100644
--- a/jpegut.c
+++ b/jpegut.c
@@ -576,8 +576,8 @@
 		dotest(35, 39, _4byteformats, 4, TJ_422, "test");
 		dotest(39, 41, _3byteformats, 2, TJ_420, "test");
 		dotest(41, 35, _4byteformats, 4, TJ_420, "test");
-		dotest(35, 39, _3byteformats, 2, TJ_440, "test");
-		dotest(39, 41, _4byteformats, 4, TJ_440, "test");
+		dotest(35, 39, _3byteformats, 2, TJSAMP_440, "test");
+		dotest(39, 41, _4byteformats, 4, TJSAMP_440, "test");
 	}
 	dotest(35, 39, _onlygray, 1, TJ_GRAYSCALE, "test");
 	dotest(39, 41, _3byteformats, 2, TJ_GRAYSCALE, "test");
@@ -592,8 +592,8 @@
 		dotest(39, 41, _onlyrgb, 1, TJ_422, "test_yuv1");
 		dotest(48, 48, _onlyrgb, 1, TJ_420, "test_yuv0");
 		dotest(41, 35, _onlyrgb, 1, TJ_420, "test_yuv1");
-		dotest(48, 48, _onlyrgb, 1, TJ_440, "test_yuv0");
-		dotest(35, 39, _onlyrgb, 1, TJ_440, "test_yuv1");
+		dotest(48, 48, _onlyrgb, 1, TJSAMP_440, "test_yuv0");
+		dotest(35, 39, _onlyrgb, 1, TJSAMP_440, "test_yuv1");
 		dotest(48, 48, _onlyrgb, 1, TJ_GRAYSCALE, "test_yuv0");
 		dotest(35, 39, _onlyrgb, 1, TJ_GRAYSCALE, "test_yuv1");
 		dotest(48, 48, _onlygray, 1, TJ_GRAYSCALE, "test_yuv0");
diff --git a/jpgtest.c b/jpgtest.c
index f069b6e..ac838a2 100644
--- a/jpgtest.c
+++ b/jpgtest.c
@@ -44,7 +44,7 @@
 const char *_subnamel[NUMSUBOPT]={"4:4:4", "4:2:2", "4:2:0", "GRAY", "4:4:0"};
 const char *_subnames[NUMSUBOPT]={"444", "422", "420", "GRAY", "440"};
 tjscalingfactor *sf=NULL;  int nsf=0;
-int xformop=TJXFORM_NONE, xformopt=0;
+int xformop=TJXOP_NONE, xformopt=0;
 double benchtime=5.0;
 
 void printsigfig(double val, int figs)
@@ -477,26 +477,26 @@
 		}
 
 		_jpegsub=jpegsub;
-		if(dotile || xformop!=TJXFORM_NONE || xformopt!=0)
+		if(dotile || xformop!=TJXOP_NONE || xformopt!=0)
 		{
 			if((t=(tjtransform *)malloc(sizeof(tjtransform)*numtilesx*numtilesy))
 				==NULL)
 				_throwunix("allocating image transform array");
 
-			if(xformop==TJXFORM_TRANSPOSE || xformop==TJXFORM_TRANSVERSE
-				|| xformop==TJXFORM_ROT90 || xformop==TJXFORM_ROT270)
+			if(xformop==TJXOP_TRANSPOSE || xformop==TJXOP_TRANSVERSE
+				|| xformop==TJXOP_ROT90 || xformop==TJXOP_ROT270)
 			{
 				_w=h;  _h=w;  _tilesizex=tilesizey;  _tilesizey=tilesizex;
 			}
 
-			if(xformopt&TJXFORM_GRAY) _jpegsub=TJ_GRAYSCALE;
-			if(xformop==TJXFORM_HFLIP || xformop==TJXFORM_ROT180)
+			if(xformopt&TJXOPT_GRAY) _jpegsub=TJ_GRAYSCALE;
+			if(xformop==TJXOP_HFLIP || xformop==TJXOP_ROT180)
 				_w=_w-(_w%tjMCUWidth[_jpegsub]);
-			if(xformop==TJXFORM_VFLIP || xformop==TJXFORM_ROT180)
+			if(xformop==TJXOP_VFLIP || xformop==TJXOP_ROT180)
 				_h=_h-(_h%tjMCUHeight[_jpegsub]);
-			if(xformop==TJXFORM_TRANSVERSE || xformop==TJXFORM_ROT90)
+			if(xformop==TJXOP_TRANSVERSE || xformop==TJXOP_ROT90)
 				_w=_w-(_w%tjMCUHeight[_jpegsub]);
-			if(xformop==TJXFORM_TRANSVERSE || xformop==TJXFORM_ROT270)
+			if(xformop==TJXOP_TRANSVERSE || xformop==TJXOP_ROT270)
 				_h=_h-(_h%tjMCUWidth[_jpegsub]);
 			_numtilesx=(_w+_tilesizex-1)/_tilesizex;
 			_numtilesy=(_h+_tilesizey-1)/_tilesizey;
@@ -510,7 +510,7 @@
 					t[tilen].r.x=j;
 					t[tilen].r.y=i;
 					t[tilen].op=xformop;
-					t[tilen].options=xformopt|TJXFORM_TRIM;
+					t[tilen].options=xformopt|TJXOPT_TRIM;
 				}
 			}
 
@@ -679,7 +679,7 @@
 		{
 			if(!stricmp(argv[i], "-tile"))
 			{
-				dotile=1;  xformopt|=TJXFORM_CROP;
+				dotile=1;  xformopt|=TJXOPT_CROP;
 			}
 			if(!stricmp(argv[i], "-forcesse3"))
 			{
@@ -732,14 +732,14 @@
 				}
 				else usage(argv[0]);
 			}
-			if(!stricmp(argv[i], "-hflip")) xformop=TJXFORM_HFLIP;
-			if(!stricmp(argv[i], "-vflip")) xformop=TJXFORM_VFLIP;
-			if(!stricmp(argv[i], "-transpose")) xformop=TJXFORM_TRANSPOSE;
-			if(!stricmp(argv[i], "-transverse")) xformop=TJXFORM_TRANSVERSE;
-			if(!stricmp(argv[i], "-rot90")) xformop=TJXFORM_ROT90;
-			if(!stricmp(argv[i], "-rot180")) xformop=TJXFORM_ROT180;
-			if(!stricmp(argv[i], "-rot270")) xformop=TJXFORM_ROT270;
-			if(!stricmp(argv[i], "-grayscale")) xformopt|=TJXFORM_GRAY;
+			if(!stricmp(argv[i], "-hflip")) xformop=TJXOP_HFLIP;
+			if(!stricmp(argv[i], "-vflip")) xformop=TJXOP_VFLIP;
+			if(!stricmp(argv[i], "-transpose")) xformop=TJXOP_TRANSPOSE;
+			if(!stricmp(argv[i], "-transverse")) xformop=TJXOP_TRANSVERSE;
+			if(!stricmp(argv[i], "-rot90")) xformop=TJXOP_ROT90;
+			if(!stricmp(argv[i], "-rot180")) xformop=TJXOP_ROT180;
+			if(!stricmp(argv[i], "-rot270")) xformop=TJXOP_ROT270;
+			if(!stricmp(argv[i], "-grayscale")) xformopt|=TJXOPT_GRAY;
 			if(!stricmp(argv[i], "-benchtime") && i<argc-1)
 			{
 				double temp=atof(argv[++i]);
diff --git a/turbojpeg-jni.c b/turbojpeg-jni.c
index e851dcf..1e87fc2 100644
--- a/turbojpeg-jni.c
+++ b/turbojpeg-jni.c
@@ -116,7 +116,7 @@
 	bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));
 
 	if(tjCompress2(handle, srcBuf, width, pitch, height, pf, &jpegBuf,
-		&jpegSize, jpegSubsamp, jpegQual, flags|TJ_NOREALLOC)==-1)
+		&jpegSize, jpegSubsamp, jpegQual, flags|TJFLAG_NOREALLOC)==-1)
 	{
 		(*env)->ReleasePrimitiveArrayCritical(env, dst, jpegBuf, 0);
 		(*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0);
@@ -160,7 +160,7 @@
 	bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));
 
 	if(tjCompress2(handle, srcBuf, width, pitch*sizeof(jint), height, pf,
-		&jpegBuf, &jpegSize, jpegSubsamp, jpegQual, flags|TJ_NOREALLOC)==-1)
+		&jpegBuf, &jpegSize, jpegSubsamp, jpegQual, flags|TJFLAG_NOREALLOC)==-1)
 	{
 		(*env)->ReleasePrimitiveArrayCritical(env, dst, jpegBuf, 0);
 		(*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0);
diff --git a/turbojpeg.h b/turbojpeg.h
index c7463bf..37e492c 100644
--- a/turbojpeg.h
+++ b/turbojpeg.h
@@ -50,7 +50,6 @@
 
 /**
  * Chrominance subsampling options.
- * @anchor subsamp
  * When an image is converted from the RGB to the YCbCr colorspace as part of
  * the JPEG compression process, some of the Cb and Cr (chrominance) components
  * can be discarded or averaged together to produce a smaller image with little
@@ -58,33 +57,33 @@
  * changes in brightness than small changes in color.)  This is called
  * "chrominance subsampling".
  */
-enum
+enum TJSAMP
 {
   /**
    * 4:4:4 chrominance subsampling (no chrominance subsampling).  The JPEG or
    * YUV image will contain one chrominance component for every pixel in the
    * source image.
    */
-  TJ_444=0,
+  TJSAMP_444=0,
   /**
    * 4:2:2 chrominance subsampling.  The JPEG or YUV image will contain one
    * chrominance component for every 2x1 block of pixels in the source image.
    */
-  TJ_422,
+  TJSAMP_422,
   /**
    * 4:2:0 chrominance subsampling.  The JPEG or YUV image will contain one
    * chrominance component for every 2x2 block of pixels in the source image.
    */
-  TJ_420,
+  TJSAMP_420,
   /**
    * Grayscale.  The JPEG or YUV image will contain no chrominance components.
    */
-  TJ_GRAYSCALE,
+  TJSAMP_GRAY,
   /**
    * 4:4:0 chrominance subsampling.  The JPEG or YUV image will contain one
    * chrominance component for every 1x2 block of pixels in the source image.
    */
-  TJ_440
+  TJSAMP_440
 };
 
 /**
@@ -115,51 +114,50 @@
 
 /**
  * Pixel formats
- * @anchor pixelformats
  */
-enum
+enum TJPF
 {
   /**
    * RGB pixel format.  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.
    */
-  TJ_RGB=0,
+  TJPF_RGB=0,
   /**
    * BGR pixel format.  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.
    */
-  TJ_BGR,
+  TJPF_BGR,
   /**
    * RGBX pixel format.  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.
    */
-  TJ_RGBX,
+  TJPF_RGBX,
   /**
    * BGRX pixel format.  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.
    */
-  TJ_BGRX,
+  TJPF_BGRX,
   /**
    * XBGR pixel format.  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.
    */
-  TJ_XBGR,
+  TJPF_XBGR,
   /**
    * XRGB pixel format.  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.
    */
-  TJ_XRGB,
+  TJPF_XRGB,
   /**
    * Grayscale pixel format.  Each 1-byte pixel represents a luminance
    * (brightness) level from 0 to 255.
    */
-  TJ_GRAY
+  TJPF_GRAY
 };
 
 /**
@@ -192,105 +190,102 @@
 
 
 /**
- * Bottom-up flag.
- * @anchor flags
  * The uncompressed source/destination image is stored in bottom-up (Windows,
  * OpenGL) order, not top-down (X11) order.
  */
-#define TJ_BOTTOMUP        2
+#define TJFLAG_BOTTOMUP        2
 /**
- * Force MMX flag.  Turn off CPU auto-detection and force TurboJPEG to use MMX
- * code (IPP and 32-bit libjpeg-turbo versions only.)
+ * Turn off CPU auto-detection and force TurboJPEG to use MMX code (IPP and
+ * 32-bit libjpeg-turbo versions only.)
  */
-#define TJ_FORCEMMX        8
+#define TJFLAG_FORCEMMX        8
 /**
- * Force SSE flag.  Turn off CPU auto-detection and force TurboJPEG to use SSE
- * code (32-bit IPP and 32-bit libjpeg-turbo versions only)
+ * Turn off CPU auto-detection and force TurboJPEG to use SSE code (32-bit IPP
+ * and 32-bit libjpeg-turbo versions only)
  */
-#define TJ_FORCESSE       16
+#define TJFLAG_FORCESSE       16
 /**
- * Force SSE2 flag.  Turn off CPU auto-detection and force TurboJPEG to use
- * SSE2 code (32-bit IPP and 32-bit libjpeg-turbo versions only)
+ * Turn off CPU auto-detection and force TurboJPEG to use SSE2 code (32-bit IPP
+ * and 32-bit libjpeg-turbo versions only)
  */
-#define TJ_FORCESSE2      32
+#define TJFLAG_FORCESSE2      32
 /**
- * Force SSE3 flag.  Turn off CPU auto-detection and force TurboJPEG to use
- * SSE3 code (64-bit IPP version only)
+ * Turn off CPU auto-detection and force TurboJPEG to use SSE3 code (64-bit IPP
+ * version only)
  */
-#define TJ_FORCESSE3     128
+#define TJFLAG_FORCESSE3     128
 /**
- * Fast upsampling flag.  Use fast, inaccurate chrominance upsampling routines
- * in the JPEG decompressor (libjpeg and libjpeg-turbo versions only)
+ * Use fast, inaccurate chrominance upsampling routines in the JPEG
+ * decompressor (libjpeg and libjpeg-turbo versions only)
  */
-#define TJ_FASTUPSAMPLE  256
+#define TJFLAG_FASTUPSAMPLE  256
 /**
- * No reallocation flag.  If passed to #tjCompress2() or #tjTransform(), 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.
+ * Disable buffer (re)allocation.  If passed to #tjCompress2() or
+ * #tjTransform(), 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.
  */
-#define TJ_NOREALLOC     1024
+#define TJFLAG_NOREALLOC     1024
 
 
 /**
  * Number of transform operations
  */
-#define NUMXFORMOPT 8
+#define TJ_NUMXOP 8
 
 /**
- * Transform operations for #tjTransform
- * @anchor xformop
+ * Transform operations for #tjTransform()
  */
-enum
+enum TJXOP
 {
   /**
    * Do not transform the position of the image pixels
    */
-  TJXFORM_NONE=0,
+  TJXOP_NONE=0,
   /**
    * Flip (mirror) image horizontally.  This transform is imperfect if there
-   * are any partial MCU blocks on the right edge (see #TJXFORM_PERFECT.)
+   * are any partial MCU blocks on the right edge (see #TJXOPT_PERFECT.)
    */
-  TJXFORM_HFLIP,
+  TJXOP_HFLIP,
   /**
    * Flip (mirror) image vertically.  This transform is imperfect if there are
-   * any partial MCU blocks on the bottom edge (see #TJXFORM_PERFECT.)
+   * any partial MCU blocks on the bottom edge (see #TJXOPT_PERFECT.)
    */
-  TJXFORM_VFLIP,
+  TJXOP_VFLIP,
   /**
    * Transpose image (flip/mirror along upper left to lower right axis.)  This
    * transform is always perfect.
    */
-  TJXFORM_TRANSPOSE,
+  TJXOP_TRANSPOSE,
   /**
    * 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 #TJXFORM_PERFECT.)
+   * the image (see #TJXOPT_PERFECT.)
    */
-  TJXFORM_TRANSVERSE,
+  TJXOP_TRANSVERSE,
   /**
    * Rotate image clockwise by 90 degrees.  This transform is imperfect if
    * there are any partial MCU blocks on the bottom edge (see
-   * #TJXFORM_PERFECT.)
+   * #TJXOPT_PERFECT.)
    */
-  TJXFORM_ROT90,
+  TJXOP_ROT90,
   /**
    * Rotate image 180 degrees.  This transform is imperfect if there are any
-   * partial MCU blocks in the image (see #TJXFORM_PERFECT.)
+   * partial MCU blocks in the image (see #TJXOPT_PERFECT.)
    */
-  TJXFORM_ROT180,
+  TJXOP_ROT180,
   /**
    * Rotate image counter-clockwise by 90 degrees.  This transform is imperfect
    * if there are any partial MCU blocks on the right edge (see
-   * #TJXFORM_PERFECT.)
+   * #TJXOPT_PERFECT.)
    */
-  TJXFORM_ROT270
+  TJXOP_ROT270
 };
 
 
 /**
- * This option will cause #tjTransform to return an error if the transform is
+ * This option will cause #tjTransform() to return an error if the transform is
  * not perfect.  Lossless transforms operate on MCU blocks, whose size depends
  * on the level of chrominance subsampling used (see #tjMCUWidth
  * and #tjMCUHeight.)  If the image's width or height is not evenly divisible
@@ -301,23 +296,22 @@
  * that cannot be transformed will be left in place, which will create
  * odd-looking strips on the right or bottom edge of the image.
  */
-#define TJXFORM_PERFECT  1
+#define TJXOPT_PERFECT  1
 /**
- * This option will cause #tjTransform to discard any partial MCU blocks that
+ * This option will cause #tjTransform() to discard any partial MCU blocks that
  * cannot be transformed.
  */
-#define TJXFORM_TRIM     2
+#define TJXOPT_TRIM     2
 /**
- * This option will enable lossless cropping.  See #tjTransform for more
+ * This option will enable lossless cropping.  See #tjTransform() for more
  * information.
  */
-#define TJXFORM_CROP     4
+#define TJXOPT_CROP     4
 /**
  * This option will discard the color data in the input image and produce
  * a grayscale output image.
- * @anchor xformopt
  */
-#define TJXFORM_GRAY     8
+#define TJXOPT_GRAY     8
 
 
 /**
@@ -372,12 +366,11 @@
    */
   tjregion r;
   /**
-   * One of the transform operations (see @ref xformop "Transform operations".)
+   * One of the @ref TJXOP "transform operations"
    */
   int op;
   /**
-   * The bitwise OR of one of more of the transform options (see @ref xformopt
-   * "Transform options".)
+   * The bitwise OR of one of more of the @ref TJXOPT_CROP "transform options"
    */
   int options;
 } tjtransform;
@@ -394,8 +387,8 @@
 #define TJPAD(width) (((width)+3)&(~3))
 
 /**
- * Compute the scaled value of dimension using the given scaling factor.  This
- * macro performs the integer equivalent of <tt>ceil(dimension *
+ * Compute the scaled value of <tt>dimension</tt> using the given scaling
+ * factor.  This macro performs the integer equivalent of <tt>ceil(dimension *
  * scalingFactor)</tt>. 
  */
 #define TJSCALED(dimension, scalingFactor) ((dimension * scalingFactor.num \
@@ -431,7 +424,7 @@
  *        to skip lines, etc.  Setting this parameter to 0 is the equivalent of
  *        setting it to <tt>width * #tjPixelSize[pixelFormat]</tt>.
  * @param height height (in pixels) of the source image
- * @param pixelFormat pixel format of the source image (see @ref pixelformats
+ * @param pixelFormat pixel format of the source image (see @ref TJPF
  *        "Pixel formats".)
  * @param jpegBuf address of a pointer to an image buffer that will receive the
  *        JPEG image.  TurboJPEG has the ability to reallocate the JPEG buffer
@@ -442,24 +435,24 @@
  *        buffer for you, or
  *        -# pre-allocate the buffer to a "worst case" size determined by
  *        calling #TJBUFSIZE().  This should ensure that the buffer never has
- *        to be re-allocated (setting the #TJ_NOREALLOC flag guarantees this.)
+ *        to be re-allocated (setting #TJFLAG_NOREALLOC guarantees this.)
  *        .
  *        If you choose option 1 or 3, <tt>*jpegSize</tt> should be set to the
  *        size of your pre-allocated buffer.  In any case, unless you have
- *        set the #TJ_NOREALLOC flag, you should always check
- *        <tt>*jpegBuf</tt> upon return from this function, as it may have
- *        changed.
+ *        set #TJFLAG_NOREALLOC, you should always check <tt>*jpegBuf</tt> upon
+ *        return from this function, as it may have changed.
  * @param jpegSize pointer to an unsigned long variable which holds the size of
  *        the JPEG image buffer.  If <tt>*jpegBuf</tt> points to a
  *        pre-allocated buffer, then <tt>*jpegSize</tt> should be set to the
  *        size of the buffer.  Upon return, <tt>*jpegSize</tt> will contain the
  *        size of the JPEG image (in bytes.)
  * @param jpegSubsamp the level of chrominance subsampling to be used when
- *        generating the JPEG image (see @ref subsamp
+ *        generating the JPEG image (see @ref TJSAMP
  *        "Chrominance subsampling options".)
  * @param jpegQual the image quality of the generated JPEG image (1 = worst,
           100 = best)
- * @param flags the bitwise OR of one or more of the @ref flags.
+ * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
+ *        "flags".
  *
  * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
 */
@@ -488,7 +481,7 @@
  * @param width width of the image (in pixels)
  * @param height height of the image (in pixels)
  * @param jpegSubsamp level of chrominance subsampling in the image (see
- *        @ref subsamp "Chrominance subsampling options".)
+ *        @ref TJSAMP "Chrominance subsampling options".)
  *
  * @return the size of the buffer (in bytes) required to hold the image, or
  * -1 if the arguments are out of bounds.
@@ -522,16 +515,17 @@
  *        to skip lines, etc.  Setting this parameter to 0 is the equivalent of
  *        setting it to <tt>width * #tjPixelSize[pixelFormat]</tt>.
  * @param height height (in pixels) of the source image
- * @param pixelFormat pixel format of the source image (see @ref pixelformats
+ * @param pixelFormat pixel format of the source image (see @ref TJPF
  *        "Pixel formats".)
  * @param dstBuf pointer to an image buffer which will receive the YUV image.
  *        Use #TJBUFSIZEYUV() to determine the appropriate size for this buffer
  *        based on the image width, height, and level of chrominance
  *        subsampling.
  * @param subsamp the level of chrominance subsampling to be used when
- *        generating the YUV image (see @ref subsamp
+ *        generating the YUV image (see @ref TJSAMP
  *        "Chrominance subsampling options".)
- * @param flags the bitwise OR of one or more of the @ref flags.
+ * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
+ *        "flags".
  *
  * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
 */
@@ -561,7 +555,7 @@
  *        (in pixels) of the JPEG image
  * @param jpegSubsamp pointer to an integer variable which will receive the
  *        level of chrominance subsampling used when compressing the JPEG image
- *        (see @ref subsamp "Chrominance subsampling options".)
+ *        (see @ref TJSAMP "Chrominance subsampling options".)
  *
  * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
 */
@@ -619,8 +613,9 @@
  *        height is set to 0, then only the width will be considered when
  *        determining the scaled image size.
  * @param pixelFormat pixel format of the destination image (see @ref
- *        pixelformats "Pixel formats".)
- * @param flags the bitwise OR of one or more of the @ref flags.
+ *        TJPF "Pixel formats".)
+ * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
+ *        "flags".
  *
  * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
  */
@@ -644,7 +639,8 @@
  * @param dstBuf pointer to an image buffer which will receive the YUV image.
  *        Use #TJBUFSIZEYUV to determine the appropriate size for this buffer
  *        based on the image width, height, and level of subsampling.
- * @param flags the bitwise OR of one or more of the @ref flags.
+ * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
+ *        "flags".
  *
  * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
  */
@@ -690,14 +686,13 @@
  *        buffer for you, or
  *        -# pre-allocate the buffer to a "worst case" size determined by
  *        calling #TJBUFSIZE() with the cropped width and height.  This should
- *        ensure that the buffer never has to be re-allocated (setting the
- *        #TJ_NOREALLOC flag guarantees this.)
+ *        ensure that the buffer never has to be re-allocated (setting
+ *        #TJFLAG_NOREALLOC guarantees this.)
  *        .
  *        If you choose option 1 or 3, <tt>dstSizes[i]</tt> should be set to
  *        the size of your pre-allocated buffer.  In any case, unless you have
- *        set the #TJ_NOREALLOC flag, you should always check
- *        <tt>dstBufs[i]</tt> upon return from this function, as it may have
- *        changed.
+ *        set #TJFLAG_NOREALLOC, you should always check <tt>dstBufs[i]</tt>
+ *        upon return from this function, as it may have changed.
  * @param dstSizes pointer to an array of n unsigned long variables which will
  *        receive the actual sizes (in bytes) of each transformed JPEG image.
  *        If <tt>dstBufs[i]</tt> points to a pre-allocated buffer, then
@@ -707,7 +702,8 @@
  * @param transforms pointer to an array of n tjtransform structures, each of
  *        which specifies the transform parameters and/or cropping region for
  *        the corresponding transformed output image.
- * @param flags the bitwise OR of one or more of the @ref flags.
+ * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
+ *        "flags".
  *
  * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
  */
@@ -737,9 +733,20 @@
 
 /* Backward compatibility functions and macros (nothing to see here) */
 #define NUMSUBOPT TJ_NUMSAMP
-#define TJ_411 TJ_420
+#define TJ_444 TJSAMP_444
+#define TJ_422 TJSAMP_422
+#define TJ_420 TJSAMP_420
+#define TJ_411 TJSAMP_420
+#define TJ_GRAYSCALE TJSAMP_GRAY
 
+#define TJ_BGR 1
+#define TJ_BOTTOMUP TJFLAG_BOTTOMUP
+#define TJ_FORCEMMX TJFLAG_FORCEMMX
+#define TJ_FORCESSE TJFLAG_FORCESSE
+#define TJ_FORCESSE2 TJFLAG_FORCESSE2
 #define TJ_ALPHAFIRST 64
+#define TJ_FORCESSE3 TJFLAG_FORCESSE3
+#define TJ_FASTUPSAMPLE TJFLAG_FASTUPSAMPLE
 #define TJ_YUV 512
 
 DLLEXPORT int DLLCALL tjCompress(tjhandle handle, unsigned char *srcBuf,
diff --git a/turbojpegl.c b/turbojpegl.c
index 4db335d..64cda17 100644
--- a/turbojpegl.c
+++ b/turbojpegl.c
@@ -90,7 +90,7 @@
 
 static const int pixelsize[NUMSUBOPT]={3, 3, 3, 1, 3};
 
-static const JXFORM_CODE xformtypes[NUMXFORMOPT]={
+static const JXFORM_CODE xformtypes[TJ_NUMXOP]={
 	JXFORM_NONE, JXFORM_FLIP_H, JXFORM_FLIP_V, JXFORM_TRANSPOSE,
 	JXFORM_TRANSVERSE, JXFORM_ROT_90, JXFORM_ROT_180, JXFORM_ROT_270
 };
@@ -113,23 +113,23 @@
 
 static int getPixelFormat(int pixelSize, int flags)
 {
-	if(pixelSize==1) return TJ_GRAY;
+	if(pixelSize==1) return TJPF_GRAY;
 	if(pixelSize==3)
 	{
-		if(flags&TJ_BGR) return TJ_BGR;
-		else return TJ_RGB;
+		if(flags&TJ_BGR) return TJPF_BGR;
+		else return TJPF_RGB;
 	}
 	if(pixelSize==4)
 	{
 		if(flags&TJ_ALPHAFIRST)
 		{
-			if(flags&TJ_BGR) return TJ_XBGR;
-			else return TJ_XRGB;
+			if(flags&TJ_BGR) return TJPF_XBGR;
+			else return TJPF_XRGB;
 		}
 		else
 		{
-			if(flags&TJ_BGR) return TJ_BGRX;
-			else return TJ_RGBX;
+			if(flags&TJ_BGR) return TJPF_BGRX;
+			else return TJPF_RGBX;
 		}
 	}
 	return -1;
@@ -140,23 +140,23 @@
 {
 	switch(pixelFormat)
 	{
-		case TJ_GRAY:
+		case TJPF_GRAY:
 			cinfo->in_color_space=JCS_GRAYSCALE;  break;
 		#if JCS_EXTENSIONS==1
-		case TJ_RGB:
+		case TJPF_RGB:
 			cinfo->in_color_space=JCS_EXT_RGB;  break;
-		case TJ_BGR:
+		case TJPF_BGR:
 			cinfo->in_color_space=JCS_EXT_BGR;  break;
-		case TJ_RGBX:
+		case TJPF_RGBX:
 			cinfo->in_color_space=JCS_EXT_RGBX;  break;
-		case TJ_BGRX:
+		case TJPF_BGRX:
 			cinfo->in_color_space=JCS_EXT_BGRX;  break;
-		case TJ_XRGB:
+		case TJPF_XRGB:
 			cinfo->in_color_space=JCS_EXT_XRGB;  break;
-		case TJ_XBGR:
+		case TJPF_XBGR:
 			cinfo->in_color_space=JCS_EXT_XBGR;  break;
 		#else
-		case TJ_RGB:
+		case TJPF_RGB:
 			if(RGB_RED==0 && RGB_GREEN==1 && RGB_BLUE==2 && RGB_PIXELSIZE==3)
 			{
 				cinfo->in_color_space=JCS_RGB;  break;
@@ -174,7 +174,7 @@
 		if(jpegQual>=96) cinfo->dct_method=JDCT_ISLOW;
 		else cinfo->dct_method=JDCT_FASTEST;
 	}
-	if(subsamp==TJ_GRAYSCALE)
+	if(subsamp==TJSAMP_GRAY)
 		jpeg_set_colorspace(cinfo, JCS_GRAYSCALE);
 	else
 		jpeg_set_colorspace(cinfo, JCS_YCbCr);
@@ -192,23 +192,23 @@
 {
 	switch(pixelFormat)
 	{
-		case TJ_GRAY:
+		case TJPF_GRAY:
 			dinfo->out_color_space=JCS_GRAYSCALE;  break;
 		#if JCS_EXTENSIONS==1
-		case TJ_RGB:
+		case TJPF_RGB:
 			dinfo->out_color_space=JCS_EXT_RGB;  break;
-		case TJ_BGR:
+		case TJPF_BGR:
 			dinfo->out_color_space=JCS_EXT_BGR;  break;
-		case TJ_RGBX:
+		case TJPF_RGBX:
 			dinfo->out_color_space=JCS_EXT_RGBX;  break;
-		case TJ_BGRX:
+		case TJPF_BGRX:
 			dinfo->out_color_space=JCS_EXT_BGRX;  break;
-		case TJ_XRGB:
+		case TJPF_XRGB:
 			dinfo->out_color_space=JCS_EXT_XRGB;  break;
-		case TJ_XBGR:
+		case TJPF_XBGR:
 			dinfo->out_color_space=JCS_EXT_XBGR;  break;
 		#else
-		case TJ_RGB:
+		case TJPF_RGB:
 			if(RGB_RED==0 && RGB_GREEN==1 && RGB_BLUE==2 && RGB_PIXELSIZE==3)
 			{
 				dinfo->out_color_space=JCS_RGB;  break;
@@ -303,7 +303,7 @@
 	pw=PAD(width, tjMCUWidth[subsamp]/8);
 	ph=PAD(height, tjMCUHeight[subsamp]/8);
 	cw=pw*8/tjMCUWidth[subsamp];  ch=ph*8/tjMCUHeight[subsamp];
-	retval=PAD(pw, 4)*ph + (subsamp==TJ_GRAYSCALE? 0:PAD(cw, 4)*ch*2);
+	retval=PAD(pw, 4)*ph + (subsamp==TJSAMP_GRAY? 0:PAD(cw, 4)*ch*2);
 
 	bailout:
 	return retval;
@@ -337,11 +337,11 @@
 	cinfo->image_width=width;
 	cinfo->image_height=height;
 
-	if(flags&TJ_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
-	else if(flags&TJ_FORCESSE) putenv("JSIMD_FORCESSE=1");
-	else if(flags&TJ_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
+	if(flags&TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
+	else if(flags&TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1");
+	else if(flags&TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
 
-	jpeg_mem_dest_tj(cinfo, jpegBuf, jpegSize, (flags&TJ_NOREALLOC)==0);
+	jpeg_mem_dest_tj(cinfo, jpegBuf, jpegSize, (flags&TJFLAG_NOREALLOC)==0);
 	setCompDefaults(cinfo, pixelFormat, jpegSubsamp, jpegQual);
 
 	jpeg_start_compress(cinfo, TRUE);
@@ -349,7 +349,7 @@
 		_throw("Memory allocation failed in tjCompress()");
 	for(i=0; i<height; i++)
 	{
-		if(flags&TJ_BOTTOMUP) row_pointer[i]=&srcBuf[(height-i-1)*pitch];
+		if(flags&TJFLAG_BOTTOMUP) row_pointer[i]=&srcBuf[(height-i-1)*pitch];
 		else row_pointer[i]=&srcBuf[i*pitch];
 	}
 	while(cinfo->next_scanline<cinfo->image_height)
@@ -381,7 +381,7 @@
 		size=TJBUFSIZE(width, height);
 		retval=tjCompress2(handle, srcBuf, width, pitch, height,
 			getPixelFormat(pixelSize, flags), &jpegBuf, &size, jpegSubsamp, jpegQual,
-			flags|TJ_NOREALLOC);
+			flags|TJFLAG_NOREALLOC);
 	}
 	*jpegSize=size;
 	return retval;
@@ -428,9 +428,9 @@
 	cinfo->image_width=width;
 	cinfo->image_height=height;
 
-	if(flags&TJ_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
-	else if(flags&TJ_FORCESSE) putenv("JSIMD_FORCESSE=1");
-	else if(flags&TJ_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
+	if(flags&TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
+	else if(flags&TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1");
+	else if(flags&TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
 
 	yuvsize=TJBUFSIZEYUV(width, height, subsamp);
 	jpeg_mem_dest_tj(cinfo, &dstBuf, &yuvsize, 0);
@@ -444,7 +444,7 @@
 		_throw("Memory allocation failed in tjCompress()");
 	for(i=0; i<height; i++)
 	{
-		if(flags&TJ_BOTTOMUP) row_pointer[i]=&srcBuf[(height-i-1)*pitch];
+		if(flags&TJFLAG_BOTTOMUP) row_pointer[i]=&srcBuf[(height-i-1)*pitch];
 		else row_pointer[i]=&srcBuf[i*pitch];
 	}
 	if(height<ph)
@@ -662,9 +662,9 @@
 		|| height<0 || pixelFormat<0 || pixelFormat>=TJ_NUMPF)
 		_throw("tjDecompress2(): Invalid argument");
 
-	if(flags&TJ_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
-	else if(flags&TJ_FORCESSE) putenv("JSIMD_FORCESSE=1");
-	else if(flags&TJ_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
+	if(flags&TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
+	else if(flags&TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1");
+	else if(flags&TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
 
 	if(setjmp(this->jerr.setjmp_buffer))
 	{
@@ -677,8 +677,7 @@
 	jpeg_read_header(dinfo, TRUE);
 	setDecompDefaults(dinfo, pixelFormat);
 
-	if(flags&TJ_FASTUPSAMPLE) dinfo->do_fancy_upsampling=FALSE;
-	if(flags&TJ_YUV) dinfo->raw_data_out=TRUE;
+	if(flags&TJFLAG_FASTUPSAMPLE) dinfo->do_fancy_upsampling=FALSE;
 
 	jpegwidth=dinfo->image_width;  jpegheight=dinfo->image_height;
 	if(width==0) width=jpegwidth;
@@ -703,7 +702,7 @@
 		_throw("Memory allocation failed in tjInitDecompress()");
 	for(i=0; i<(int)dinfo->output_height; i++)
 	{
-		if(flags&TJ_BOTTOMUP)
+		if(flags&TJFLAG_BOTTOMUP)
 			row_pointer[i]=&dstBuf[(dinfo->output_height-i-1)*pitch];
 		else row_pointer[i]=&dstBuf[i*pitch];
 	}
@@ -753,9 +752,9 @@
 	if(jpegBuf==NULL || jpegSize<=0 || dstBuf==NULL)
 		_throw("tjDecompressToYUV(): Invalid argument");
 
-	if(flags&TJ_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
-	else if(flags&TJ_FORCESSE) putenv("JSIMD_FORCESSE=1");
-	else if(flags&TJ_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
+	if(flags&TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
+	else if(flags&TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1");
+	else if(flags&TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
 
 	if(setjmp(this->jerr.setjmp_buffer))
 	{
@@ -805,7 +804,7 @@
 		}
 	}
 
-	if(flags&TJ_FASTUPSAMPLE) dinfo->do_fancy_upsampling=FALSE;
+	if(flags&TJFLAG_FASTUPSAMPLE) dinfo->do_fancy_upsampling=FALSE;
 	dinfo->raw_data_out=TRUE;
 
 	jpeg_start_decompress(dinfo);
@@ -882,9 +881,9 @@
 		|| t==NULL || flags<0)
 		_throw("tjTransform(): Invalid argument");
 
-	if(flags&TJ_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
-	else if(flags&TJ_FORCESSE) putenv("JSIMD_FORCESSE=1");
-	else if(flags&TJ_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
+	if(flags&TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
+	else if(flags&TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1");
+	else if(flags&TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
 
 	if(setjmp(this->jerr.setjmp_buffer))
 	{
@@ -903,11 +902,11 @@
 	for(i=0; i<n; i++)
 	{
 		xinfo[i].transform=xformtypes[t[i].op];
-		xinfo[i].perfect=(t[i].options&TJXFORM_PERFECT)? 1:0;
-		xinfo[i].trim=(t[i].options&TJXFORM_TRIM)? 1:0;
-		xinfo[i].force_grayscale=(t[i].options&TJXFORM_GRAY)? 1:0;
-		xinfo[i].crop=(t[i].options&TJXFORM_CROP)? 1:0;
-		if(n!=1 && t[i].op==TJXFORM_HFLIP) xinfo[i].slow_hflip=1;
+		xinfo[i].perfect=(t[i].options&TJXOPT_PERFECT)? 1:0;
+		xinfo[i].trim=(t[i].options&TJXOPT_TRIM)? 1:0;
+		xinfo[i].force_grayscale=(t[i].options&TJXOPT_GRAY)? 1:0;
+		xinfo[i].crop=(t[i].options&TJXOPT_CROP)? 1:0;
+		if(n!=1 && t[i].op==TJXOP_HFLIP) xinfo[i].slow_hflip=1;
 		else xinfo[i].slow_hflip=0;
 
 		if(xinfo[i].crop)
@@ -955,7 +954,7 @@
 	{
 		int w, h;
 		jpeg_mem_dest_tj(cinfo, &dstBufs[i], &dstSizes[i],
-			(flags&TJ_NOREALLOC)==0);
+			(flags&TJFLAG_NOREALLOC)==0);
 		if(!xinfo[i].crop)
 		{
 			w=dinfo->image_width;  h=dinfo->image_height;