Add flags to the TurboJPEG API that allow the caller to force the use of either the fast or the accurate DCT/IDCT algorithms in the underlying codec.

This commit is contained in:
DRC
2012-06-29 23:46:38 +00:00
parent 7b8366223a
commit 019d51d4f1
38 changed files with 426 additions and 185 deletions

View File

@@ -59,6 +59,9 @@ divisible by 16 bytes.
4.3 on OS X platforms would cause NASM to return numerous errors of the form
"'%define' expects a macro identifier".
[9] Added flags to the TurboJPEG API that allow the caller to force the use of
either the fast or the accurate DCT/IDCT algorithms in the underlying codec.
1.2.0
=====

View File

@@ -19,7 +19,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">TurboJPEG&#160;<span id="projectnumber">1.2</span></div>
<div id="projectname">TurboJPEG&#160;<span id="projectnumber">1.2.1</span></div>
</td>
</tr>
</tbody>
@@ -81,7 +81,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
</iframe>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Sun Dec 18 2011 20:09:47 for TurboJPEG by&#160;
<hr class="footer"/><address class="footer"><small>Generated on Fri Jun 29 2012 18:34:09 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>

View File

@@ -19,7 +19,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">TurboJPEG&#160;<span id="projectnumber">1.2</span></div>
<div id="projectname">TurboJPEG&#160;<span id="projectnumber">1.2.1</span></div>
</td>
</tr>
</tbody>
@@ -80,7 +80,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
</iframe>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Sun Dec 18 2011 20:09:47 for TurboJPEG by&#160;
<hr class="footer"/><address class="footer"><small>Generated on Fri Jun 29 2012 18:34:09 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>

View File

@@ -19,7 +19,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">TurboJPEG&#160;<span id="projectnumber">1.2</span></div>
<div id="projectname">TurboJPEG&#160;<span id="projectnumber">1.2.1</span></div>
</td>
</tr>
</tbody>
@@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
</iframe>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Sun Dec 18 2011 20:09:47 for TurboJPEG by&#160;
<hr class="footer"/><address class="footer"><small>Generated on Fri Jun 29 2012 18:34:09 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>

View File

@@ -19,7 +19,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">TurboJPEG&#160;<span id="projectnumber">1.2</span></div>
<div id="projectname">TurboJPEG&#160;<span id="projectnumber">1.2.1</span></div>
</td>
</tr>
</tbody>
@@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
</iframe>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Sun Dec 18 2011 20:09:47 for TurboJPEG by&#160;
<hr class="footer"/><address class="footer"><small>Generated on Fri Jun 29 2012 18:34:09 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>

View File

@@ -19,7 +19,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">TurboJPEG&#160;<span id="projectnumber">1.2</span></div>
<div id="projectname">TurboJPEG&#160;<span id="projectnumber">1.2.1</span></div>
</td>
</tr>
</tbody>
@@ -82,17 +82,21 @@ Defines</h2></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="mdescLeft">&#160;</td><td class="mdescRight">Turn off CPU auto-detection and force TurboJPEG to use MMX code (if the underlying codec supports it.) <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="mdescLeft">&#160;</td><td class="mdescRight">Turn off CPU auto-detection and force TurboJPEG to use SSE code (if the underlying codec supports it.) <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="mdescLeft">&#160;</td><td class="mdescRight">Turn off CPU auto-detection and force TurboJPEG to use SSE2 code (if the underlying codec supports it.) <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="mdescLeft">&#160;</td><td class="mdescRight">Turn off CPU auto-detection and force TurboJPEG to use SSE3 code (if the underlying codec supports it.) <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="mdescLeft">&#160;</td><td class="mdescRight">When decompressing, use the fastest chrominance upsampling algorithm available in the underlying codec. <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#gaabce235db80d3f698b27f36cbd453da2">TJFLAG_FASTDCT</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Use the fastest DCT/IDCT algorithm available in the underlying codec. <a href="#gaabce235db80d3f698b27f36cbd453da2"></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#gacb233cfd722d66d1ccbf48a7de81f0e0">TJFLAG_ACCURATEDCT</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Use the most accurate DCT/IDCT algorithm available in the underlying codec. <a href="#gacb233cfd722d66d1ccbf48a7de81f0e0"></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>
@@ -253,6 +257,22 @@ Variables</h2></td></tr>
<p>Number of transform operations. </p>
</div>
</div>
<a class="anchor" id="gacb233cfd722d66d1ccbf48a7de81f0e0"></a><!-- doxytag: member="turbojpeg.h::TJFLAG_ACCURATEDCT" ref="gacb233cfd722d66d1ccbf48a7de81f0e0" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define TJFLAG_ACCURATEDCT</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Use the most accurate DCT/IDCT algorithm available in the underlying codec. </p>
<p>The default if this flag is not specified is implementation-specific. The libjpeg implementation, for example, uses the fast algorithm by default when compressing, because this has been shown to have only a very slight effect on accuracy, but it uses the accurate algorithm when decompressing, because this has been shown to have a larger effect. </p>
</div>
</div>
<a class="anchor" id="ga72ecf4ebe6eb702d3c6f5ca27455e1ec"></a><!-- doxytag: member="turbojpeg.h::TJFLAG_BOTTOMUP" ref="ga72ecf4ebe6eb702d3c6f5ca27455e1ec" args="" -->
@@ -268,6 +288,22 @@ Variables</h2></td></tr>
<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="gaabce235db80d3f698b27f36cbd453da2"></a><!-- doxytag: member="turbojpeg.h::TJFLAG_FASTDCT" ref="gaabce235db80d3f698b27f36cbd453da2" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define TJFLAG_FASTDCT</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Use the fastest DCT/IDCT algorithm available in the underlying codec. </p>
<p>The default if this flag is not specified is implementation-specific. The libjpeg implementation, for example, uses the fast algorithm by default when compressing, because this has been shown to have only a very slight effect on accuracy, but it uses the accurate algorithm when decompressing, because this has been shown to have a larger effect. </p>
</div>
</div>
<a class="anchor" id="ga4ee4506c81177a06f77e2504a22efd2d"></a><!-- doxytag: member="turbojpeg.h::TJFLAG_FASTUPSAMPLE" ref="ga4ee4506c81177a06f77e2504a22efd2d" args="" -->
@@ -281,7 +317,8 @@ Variables</h2></td></tr>
</div>
<div class="memdoc">
<p>Use fast, inaccurate chrominance upsampling routines in the JPEG decompressor (libjpeg and libjpeg-turbo versions only) </p>
<p>When decompressing, use the fastest chrominance upsampling algorithm available in the underlying codec. </p>
<p>The default is to use smooth upsampling, which creates a smooth transition between neighboring chrominance components in order to reduce upsampling artifacts in the decompressed image. </p>
</div>
</div>
@@ -296,7 +333,7 @@ Variables</h2></td></tr>
</div>
<div class="memdoc">
<p>Turn off CPU auto-detection and force TurboJPEG to use MMX code (IPP and 32-bit libjpeg-turbo versions only.) </p>
<p>Turn off CPU auto-detection and force TurboJPEG to use MMX code (if the underlying codec supports it.) </p>
</div>
</div>
@@ -311,7 +348,7 @@ Variables</h2></td></tr>
</div>
<div class="memdoc">
<p>Turn off CPU auto-detection and force TurboJPEG to use SSE code (32-bit IPP and 32-bit libjpeg-turbo versions only) </p>
<p>Turn off CPU auto-detection and force TurboJPEG to use SSE code (if the underlying codec supports it.) </p>
</div>
</div>
@@ -326,7 +363,7 @@ Variables</h2></td></tr>
</div>
<div class="memdoc">
<p>Turn off CPU auto-detection and force TurboJPEG to use SSE2 code (32-bit IPP and 32-bit libjpeg-turbo versions only) </p>
<p>Turn off CPU auto-detection and force TurboJPEG to use SSE2 code (if the underlying codec supports it.) </p>
</div>
</div>
@@ -341,7 +378,7 @@ Variables</h2></td></tr>
</div>
<div class="memdoc">
<p>Turn off CPU auto-detection and force TurboJPEG to use SSE3 code (64-bit IPP version only) </p>
<p>Turn off CPU auto-detection and force TurboJPEG to use SSE3 code (if the underlying codec supports it.) </p>
</div>
</div>
@@ -1557,7 +1594,7 @@ If you choose option 1, <code>dstSizes[i]</code> should be set to the size of yo
</iframe>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Sun Dec 18 2011 20:09:47 for TurboJPEG by&#160;
<hr class="footer"/><address class="footer"><small>Generated on Fri Jun 29 2012 18:34:09 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>

View File

@@ -19,7 +19,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">TurboJPEG&#160;<span id="projectnumber">1.2</span></div>
<div id="projectname">TurboJPEG&#160;<span id="projectnumber">1.2.1</span></div>
</td>
</tr>
</tbody>
@@ -69,7 +69,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
</iframe>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Sun Dec 18 2011 20:09:47 for TurboJPEG by&#160;
<hr class="footer"/><address class="footer"><small>Generated on Fri Jun 29 2012 18:34:09 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>

View File

@@ -19,7 +19,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">TurboJPEG&#160;<span id="projectnumber">1.2</span></div>
<div id="projectname">TurboJPEG&#160;<span id="projectnumber">1.2.1</span></div>
</td>
</tr>
</tbody>
@@ -72,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
</iframe>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Sun Dec 18 2011 20:09:47 for TurboJPEG by&#160;
<hr class="footer"/><address class="footer"><small>Generated on Fri Jun 29 2012 18:34:09 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>

View File

@@ -19,7 +19,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">TurboJPEG&#160;<span id="projectnumber">1.2</span></div>
<div id="projectname">TurboJPEG&#160;<span id="projectnumber">1.2.1</span></div>
</td>
</tr>
</tbody>
@@ -165,7 +165,7 @@ Data Fields</h2></td></tr>
</iframe>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Sun Dec 18 2011 20:09:47 for TurboJPEG by&#160;
<hr class="footer"/><address class="footer"><small>Generated on Fri Jun 29 2012 18:34:09 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>

View File

@@ -19,7 +19,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">TurboJPEG&#160;<span id="projectnumber">1.2</span></div>
<div id="projectname">TurboJPEG&#160;<span id="projectnumber">1.2.1</span></div>
</td>
</tr>
</tbody>
@@ -127,7 +127,7 @@ Data Fields</h2></td></tr>
</iframe>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Sun Dec 18 2011 20:09:47 for TurboJPEG by&#160;
<hr class="footer"/><address class="footer"><small>Generated on Fri Jun 29 2012 18:34:09 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>

View File

@@ -19,7 +19,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">TurboJPEG&#160;<span id="projectnumber">1.2</span></div>
<div id="projectname">TurboJPEG&#160;<span id="projectnumber">1.2.1</span></div>
</td>
</tr>
</tbody>
@@ -191,7 +191,7 @@ Data Fields</h2></td></tr>
</iframe>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Sun Dec 18 2011 20:09:47 for TurboJPEG by&#160;
<hr class="footer"/><address class="footer"><small>Generated on Fri Jun 29 2012 18:34:09 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>

View File

@@ -1,5 +1,5 @@
PROJECT_NAME = TurboJPEG
PROJECT_NUMBER = 1.2
PROJECT_NUMBER = 1.2.1
OUTPUT_DIRECTORY = doc/
USE_WINDOWS_ENCODING = NO
OPTIMIZE_OUTPUT_FOR_C = YES

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C)2011 D. R. Commander. All Rights Reserved.
* Copyright (C)2011-2012 D. R. Commander. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -81,6 +81,12 @@ public class TJExample implements TJCustomFilter {
System.out.println(" for 4:2:0.)\n");
System.out.println("-display = Display output image (Output file need not be specified in this");
System.out.println(" case.)\n");
System.out.println("-fastupsample = Use the fastest chrominance upsampling algorithm available in");
System.out.println(" the underlying codec\n");
System.out.println("-fastdct = Use the fastest DCT/IDCT algorithms available in the underlying");
System.out.println(" codec\n");
System.out.println("-accuratedct = Use the most accurate DCT/IDCT algorithms available in the");
System.out.println(" underlying codec\n");
System.exit(1);
}
@@ -92,6 +98,7 @@ public class TJExample implements TJCustomFilter {
BufferedImage img = null; byte[] bmpBuf = null;
TJTransform xform = new TJTransform();
int flags = 0;
try {
@@ -187,6 +194,18 @@ public class TJExample implements TJCustomFilter {
}
if(argv[i].substring(0, 2).equalsIgnoreCase("-d"))
display = true;
if(argv[i].equalsIgnoreCase("-fastupsample")) {
System.out.println("Using fast upsampling code");
flags |= TJ.FLAG_FASTUPSAMPLE;
}
if(argv[i].equalsIgnoreCase("-fastdct")) {
System.out.println("Using fastest DCT/IDCT algorithm");
flags |= TJ.FLAG_FASTDCT;
}
if(argv[i].equalsIgnoreCase("-accuratedct")) {
System.out.println("Using most accurate DCT/IDCT algorithm");
flags |= TJ.FLAG_ACCURATEDCT;
}
}
}
String[] inFileTokens = argv[0].split("\\.");
@@ -247,8 +266,9 @@ public class TJExample implements TJCustomFilter {
height = scaleFactor.getScaled(height);
if(!outFormat.equalsIgnoreCase("jpg"))
img = tjd.decompress(width, height, BufferedImage.TYPE_INT_RGB, 0);
else bmpBuf = tjd.decompress(width, 0, height, TJ.PF_BGRX, 0);
img = tjd.decompress(width, height, BufferedImage.TYPE_INT_RGB,
flags);
else bmpBuf = tjd.decompress(width, 0, height, TJ.PF_BGRX, flags);
tjd.close();
}
else {
@@ -282,10 +302,10 @@ public class TJExample implements TJCustomFilter {
tjc.setSubsamp(outSubsamp);
tjc.setJPEGQuality(outQual);
if(img != null)
jpegBuf = tjc.compress(img, 0);
jpegBuf = tjc.compress(img, flags);
else {
tjc.setSourceImage(bmpBuf, width, 0, height, TJ.PF_BGRX);
jpegBuf = tjc.compress(0);
jpegBuf = tjc.compress(flags);
}
jpegSize = tjc.getCompressedSize();
tjc.close();

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
<!-- Generated by javadoc (build 1.6.0_33) on Fri Jun 29 18:36:27 CDT 2012 -->
<TITLE>
All Classes
</TITLE>
<META NAME="date" CONTENT="2012-06-06">
<META NAME="date" CONTENT="2012-06-29">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
<!-- Generated by javadoc (build 1.6.0_33) on Fri Jun 29 18:36:27 CDT 2012 -->
<TITLE>
All Classes
</TITLE>
<META NAME="date" CONTENT="2012-06-06">
<META NAME="date" CONTENT="2012-06-29">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
<!-- Generated by javadoc (build 1.6.0_33) on Fri Jun 29 18:36:27 CDT 2012 -->
<TITLE>
Constant Field Values
</TITLE>
<META NAME="date" CONTENT="2012-06-06">
<META NAME="date" CONTENT="2012-06-29">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
@@ -101,12 +101,24 @@ org.libjpegturbo.*</FONT></TH>
<TH ALIGN="left" COLSPAN="3">org.libjpegturbo.turbojpeg.<A HREF="org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<A NAME="org.libjpegturbo.turbojpeg.TJ.FLAG_ACCURATEDCT"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
<CODE>public&nbsp;static&nbsp;final&nbsp;int</CODE></FONT></TD>
<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#FLAG_ACCURATEDCT">FLAG_ACCURATEDCT</A></CODE></TD>
<TD ALIGN="right"><CODE>4096</CODE></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<A NAME="org.libjpegturbo.turbojpeg.TJ.FLAG_BOTTOMUP"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
<CODE>public&nbsp;static&nbsp;final&nbsp;int</CODE></FONT></TD>
<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP">FLAG_BOTTOMUP</A></CODE></TD>
<TD ALIGN="right"><CODE>2</CODE></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<A NAME="org.libjpegturbo.turbojpeg.TJ.FLAG_FASTDCT"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
<CODE>public&nbsp;static&nbsp;final&nbsp;int</CODE></FONT></TD>
<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#FLAG_FASTDCT">FLAG_FASTDCT</A></CODE></TD>
<TD ALIGN="right"><CODE>2048</CODE></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<A NAME="org.libjpegturbo.turbojpeg.TJ.FLAG_FASTUPSAMPLE"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
<CODE>public&nbsp;static&nbsp;final&nbsp;int</CODE></FONT></TD>
<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#FLAG_FASTUPSAMPLE">FLAG_FASTUPSAMPLE</A></CODE></TD>

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
<!-- Generated by javadoc (build 1.6.0_33) on Fri Jun 29 18:36:27 CDT 2012 -->
<TITLE>
Deprecated List
</TITLE>
<META NAME="date" CONTENT="2012-06-06">
<META NAME="date" CONTENT="2012-06-29">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
<!-- Generated by javadoc (build 1.6.0_33) on Fri Jun 29 18:36:27 CDT 2012 -->
<TITLE>
API Help
</TITLE>
<META NAME="date" CONTENT="2012-06-06">
<META NAME="date" CONTENT="2012-06-29">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
<!-- Generated by javadoc (build 1.6.0_33) on Fri Jun 29 18:36:27 CDT 2012 -->
<TITLE>
Index
</TITLE>
<META NAME="date" CONTENT="2012-06-06">
<META NAME="date" CONTENT="2012-06-29">
<LINK REL ="stylesheet" TYPE="text/css" HREF="./stylesheet.css" TITLE="Style">
@@ -199,30 +199,37 @@ Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#finalize()"><B>finalize()</B></A> -
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
<DD>&nbsp;
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_ACCURATEDCT"><B>FLAG_ACCURATEDCT</B></A> -
Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
<DD>Use the most accurate DCT/IDCT algorithm available in the underlying
codec.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><B>FLAG_BOTTOMUP</B></A> -
Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
<DD>The uncompressed source/destination image is stored in bottom-up (Windows,
OpenGL) order, not top-down (X11) order.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_FASTDCT"><B>FLAG_FASTDCT</B></A> -
Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
<DD>Use the fastest DCT/IDCT algorithm available in the underlying codec.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_FASTUPSAMPLE"><B>FLAG_FASTUPSAMPLE</B></A> -
Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
<DD>Use fast, inaccurate chrominance upsampling routines in the JPEG
decompressor (libjpeg and libjpeg-turbo versions only.)
<DD>When decompressing, use the fastest chrominance upsampling algorithm
available in the underlying codec.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_FORCEMMX"><B>FLAG_FORCEMMX</B></A> -
Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
<DD>Turn off CPU auto-detection and force TurboJPEG to use MMX code
(IPP and 32-bit libjpeg-turbo versions only.)
(if the underlying codec supports it.)
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_FORCESSE"><B>FLAG_FORCESSE</B></A> -
Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
<DD>Turn off CPU auto-detection and force TurboJPEG to use SSE code
(32-bit IPP and 32-bit libjpeg-turbo versions only.)
(if the underlying codec supports it.)
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_FORCESSE2"><B>FLAG_FORCESSE2</B></A> -
Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
<DD>Turn off CPU auto-detection and force TurboJPEG to use SSE2 code
(32-bit IPP and 32-bit libjpeg-turbo versions only.)
(if the underlying codec supports it.)
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_FORCESSE3"><B>FLAG_FORCESSE3</B></A> -
Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
<DD>Turn off CPU auto-detection and force TurboJPEG to use SSE3 code
(64-bit IPP version only.)
(if the underlying codec supports it.)
</DL>
<HR>
<A NAME="_G_"><!-- --></A><H2>

View File

@@ -2,7 +2,7 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Wed Jun 06 03:10:33 CDT 2012-->
<!-- Generated by javadoc on Fri Jun 29 18:36:27 CDT 2012-->
<TITLE>
Generated Documentation (Untitled)
</TITLE>

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
<!-- Generated by javadoc (build 1.6.0_33) on Fri Jun 29 18:36:27 CDT 2012 -->
<TITLE>
TJ
</TITLE>
<META NAME="date" CONTENT="2012-06-06">
<META NAME="date" CONTENT="2012-06-29">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
@@ -117,6 +117,15 @@ TurboJPEG utility class (cannot be instantiated)
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_ACCURATEDCT">FLAG_ACCURATEDCT</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Use the most accurate DCT/IDCT algorithm available in the underlying
codec.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP">FLAG_BOTTOMUP</A></B></CODE>
<BR>
@@ -126,11 +135,19 @@ TurboJPEG utility class (cannot be instantiated)
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_FASTDCT">FLAG_FASTDCT</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Use the fastest DCT/IDCT algorithm available in the underlying codec.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_FASTUPSAMPLE">FLAG_FASTUPSAMPLE</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Use fast, inaccurate chrominance upsampling routines in the JPEG
decompressor (libjpeg and libjpeg-turbo versions only.)</TD>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;When decompressing, use the fastest chrominance upsampling algorithm
available in the underlying codec.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
@@ -139,7 +156,7 @@ TurboJPEG utility class (cannot be instantiated)
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Turn off CPU auto-detection and force TurboJPEG to use MMX code
(IPP and 32-bit libjpeg-turbo versions only.)</TD>
(if the underlying codec supports it.)</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
@@ -148,7 +165,7 @@ TurboJPEG utility class (cannot be instantiated)
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Turn off CPU auto-detection and force TurboJPEG to use SSE code
(32-bit IPP and 32-bit libjpeg-turbo versions only.)</TD>
(if the underlying codec supports it.)</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
@@ -157,7 +174,7 @@ TurboJPEG utility class (cannot be instantiated)
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Turn off CPU auto-detection and force TurboJPEG to use SSE2 code
(32-bit IPP and 32-bit libjpeg-turbo versions only.)</TD>
(if the underlying codec supports it.)</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
@@ -166,7 +183,7 @@ TurboJPEG utility class (cannot be instantiated)
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Turn off CPU auto-detection and force TurboJPEG to use SSE3 code
(64-bit IPP version only.)</TD>
(if the underlying codec supports it.)</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
@@ -711,7 +728,7 @@ FLAG_FORCEMMX</H3>
public static final int <B>FLAG_FORCEMMX</B></PRE>
<DL>
<DD>Turn off CPU auto-detection and force TurboJPEG to use MMX code
(IPP and 32-bit libjpeg-turbo versions only.)
(if the underlying codec supports it.)
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_FORCEMMX">Constant Field Values</A></DL>
@@ -724,7 +741,7 @@ FLAG_FORCESSE</H3>
public static final int <B>FLAG_FORCESSE</B></PRE>
<DL>
<DD>Turn off CPU auto-detection and force TurboJPEG to use SSE code
(32-bit IPP and 32-bit libjpeg-turbo versions only.)
(if the underlying codec supports it.)
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_FORCESSE">Constant Field Values</A></DL>
@@ -737,7 +754,7 @@ FLAG_FORCESSE2</H3>
public static final int <B>FLAG_FORCESSE2</B></PRE>
<DL>
<DD>Turn off CPU auto-detection and force TurboJPEG to use SSE2 code
(32-bit IPP and 32-bit libjpeg-turbo versions only.)
(if the underlying codec supports it.)
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_FORCESSE2">Constant Field Values</A></DL>
@@ -750,7 +767,7 @@ FLAG_FORCESSE3</H3>
public static final int <B>FLAG_FORCESSE3</B></PRE>
<DL>
<DD>Turn off CPU auto-detection and force TurboJPEG to use SSE3 code
(64-bit IPP version only.)
(if the underlying codec supports it.)
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_FORCESSE3">Constant Field Values</A></DL>
@@ -762,12 +779,50 @@ FLAG_FASTUPSAMPLE</H3>
<PRE>
public static final int <B>FLAG_FASTUPSAMPLE</B></PRE>
<DL>
<DD>Use fast, inaccurate chrominance upsampling routines in the JPEG
decompressor (libjpeg and libjpeg-turbo versions only.)
<DD>When decompressing, use the fastest chrominance upsampling algorithm
available in the underlying codec. The default is to use smooth
upsampling, which creates a smooth transition between neighboring
chrominance components in order to reduce upsampling artifacts in the
decompressed image.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_FASTUPSAMPLE">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="FLAG_FASTDCT"><!-- --></A><H3>
FLAG_FASTDCT</H3>
<PRE>
public static final int <B>FLAG_FASTDCT</B></PRE>
<DL>
<DD>Use the fastest DCT/IDCT algorithm available in the underlying codec. The
default if this flag is not specified is implementation-specific. The
libjpeg implementation, for example, uses the fast algorithm by default
when compressing, because this has been shown to have only a very slight
effect on accuracy, but it uses the accurate algorithm when decompressing,
because this has been shown to have a larger effect.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_FASTDCT">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="FLAG_ACCURATEDCT"><!-- --></A><H3>
FLAG_ACCURATEDCT</H3>
<PRE>
public static final int <B>FLAG_ACCURATEDCT</B></PRE>
<DL>
<DD>Use the most accurate DCT/IDCT algorithm available in the underlying
codec. The default if this flag is not specified is
implementation-specific. The libjpeg implementation, for example, uses
the fast algorithm by default when compressing, because this has been
shown to have only a very slight effect on accuracy, but it uses the
accurate algorithm when decompressing, because this has been shown to have
a larger effect.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_ACCURATEDCT">Constant Field Values</A></DL>
</DL>
<!-- ========= CONSTRUCTOR DETAIL ======== -->

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
<!-- Generated by javadoc (build 1.6.0_33) on Fri Jun 29 18:36:27 CDT 2012 -->
<TITLE>
TJCompressor
</TITLE>
<META NAME="date" CONTENT="2012-06-06">
<META NAME="date" CONTENT="2012-06-29">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
<!-- Generated by javadoc (build 1.6.0_33) on Fri Jun 29 18:36:27 CDT 2012 -->
<TITLE>
TJCustomFilter
</TITLE>
<META NAME="date" CONTENT="2012-06-06">
<META NAME="date" CONTENT="2012-06-29">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
<!-- Generated by javadoc (build 1.6.0_33) on Fri Jun 29 18:36:27 CDT 2012 -->
<TITLE>
TJDecompressor
</TITLE>
<META NAME="date" CONTENT="2012-06-06">
<META NAME="date" CONTENT="2012-06-29">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
<!-- Generated by javadoc (build 1.6.0_33) on Fri Jun 29 18:36:27 CDT 2012 -->
<TITLE>
TJScalingFactor
</TITLE>
<META NAME="date" CONTENT="2012-06-06">
<META NAME="date" CONTENT="2012-06-29">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
<!-- Generated by javadoc (build 1.6.0_33) on Fri Jun 29 18:36:27 CDT 2012 -->
<TITLE>
TJTransform
</TITLE>
<META NAME="date" CONTENT="2012-06-06">
<META NAME="date" CONTENT="2012-06-29">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
<!-- Generated by javadoc (build 1.6.0_33) on Fri Jun 29 18:36:27 CDT 2012 -->
<TITLE>
TJTransformer
</TITLE>
<META NAME="date" CONTENT="2012-06-06">
<META NAME="date" CONTENT="2012-06-29">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
<!-- Generated by javadoc (build 1.6.0_33) on Fri Jun 29 18:36:27 CDT 2012 -->
<TITLE>
org.libjpegturbo.turbojpeg
</TITLE>
<META NAME="date" CONTENT="2012-06-06">
<META NAME="date" CONTENT="2012-06-29">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
<!-- Generated by javadoc (build 1.6.0_33) on Fri Jun 29 18:36:27 CDT 2012 -->
<TITLE>
org.libjpegturbo.turbojpeg
</TITLE>
<META NAME="date" CONTENT="2012-06-06">
<META NAME="date" CONTENT="2012-06-29">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
<!-- Generated by javadoc (build 1.6.0_33) on Fri Jun 29 18:36:27 CDT 2012 -->
<TITLE>
org.libjpegturbo.turbojpeg Class Hierarchy
</TITLE>
<META NAME="date" CONTENT="2012-06-06">
<META NAME="date" CONTENT="2012-06-29">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
<!-- Generated by javadoc (build 1.6.0_33) on Fri Jun 29 18:36:27 CDT 2012 -->
<TITLE>
Class Hierarchy
</TITLE>
<META NAME="date" CONTENT="2012-06-06">
<META NAME="date" CONTENT="2012-06-29">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
<!-- Generated by javadoc (build 1.6.0_33) on Fri Jun 29 18:36:27 CDT 2012 -->
<TITLE>
Serialized Form
</TITLE>
<META NAME="date" CONTENT="2012-06-06">
<META NAME="date" CONTENT="2012-06-29">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C)2011 D. R. Commander. All Rights Reserved.
* Copyright (C)2011-2012 D. R. Commander. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -272,29 +272,51 @@ final public class TJ {
final public static int FLAG_BOTTOMUP = 2;
/**
* Turn off CPU auto-detection and force TurboJPEG to use MMX code
* (IPP and 32-bit libjpeg-turbo versions only.)
* (if the underlying codec supports it.)
*/
final public static int FLAG_FORCEMMX = 8;
/**
* Turn off CPU auto-detection and force TurboJPEG to use SSE code
* (32-bit IPP and 32-bit libjpeg-turbo versions only.)
* (if the underlying codec supports it.)
*/
final public static int FLAG_FORCESSE = 16;
/**
* Turn off CPU auto-detection and force TurboJPEG to use SSE2 code
* (32-bit IPP and 32-bit libjpeg-turbo versions only.)
* (if the underlying codec supports it.)
*/
final public static int FLAG_FORCESSE2 = 32;
/**
* Turn off CPU auto-detection and force TurboJPEG to use SSE3 code
*(64-bit IPP version only.)
* (if the underlying codec supports it.)
*/
final public static int FLAG_FORCESSE3 = 128;
/**
* Use fast, inaccurate chrominance upsampling routines in the JPEG
* decompressor (libjpeg and libjpeg-turbo versions only.)
* When decompressing, use the fastest chrominance upsampling algorithm
* available in the underlying codec. The default is to use smooth
* upsampling, which creates a smooth transition between neighboring
* chrominance components in order to reduce upsampling artifacts in the
* decompressed image.
*/
final public static int FLAG_FASTUPSAMPLE = 256;
/**
* Use the fastest DCT/IDCT algorithm available in the underlying codec. The
* default if this flag is not specified is implementation-specific. The
* libjpeg implementation, for example, uses the fast algorithm by default
* when compressing, because this has been shown to have only a very slight
* effect on accuracy, but it uses the accurate algorithm when decompressing,
* because this has been shown to have a larger effect.
*/
final public static int FLAG_FASTDCT = 2048;
/**
* Use the most accurate DCT/IDCT algorithm available in the underlying
* codec. The default if this flag is not specified is
* implementation-specific. The libjpeg implementation, for example, uses
* the fast algorithm by default when compressing, because this has been
* shown to have only a very slight effect on accuracy, but it uses the
* accurate algorithm when decompressing, because this has been shown to have
* a larger effect.
*/
final public static int FLAG_ACCURATEDCT = 4096;
/**

View File

@@ -667,7 +667,7 @@ void usage(char *progname)
{
int i;
printf("USAGE: %s\n", progname);
printf(" <Inputfile (BMP|PPM)> <%% Quality> [options]\n\n");
printf(" <Inputfile (BMP|PPM)> <Quality> [options]\n\n");
printf(" %s\n", progname);
printf(" <Inputfile (JPG)> [options]\n\n");
printf("Options:\n\n");
@@ -680,8 +680,12 @@ void usage(char *progname)
printf(" Force MMX, SSE, SSE2, or SSE3 code paths in the underlying codec\n");
printf("-rgb, -bgr, -rgbx, -bgrx, -xbgr, -xrgb =\n");
printf(" Test the specified color conversion path in the codec (default: BGR)\n");
printf("-fastupsample = Use fast, inaccurate upsampling code to perform 4:2:2 and 4:2:0\n");
printf(" YUV decoding\n");
printf("-fastupsample = Use the fastest chrominance upsampling algorithm available in\n");
printf(" the underlying codec\n");
printf("-fastdct = Use the fastest DCT/IDCT algorithms available in the underlying\n");
printf(" codec\n");
printf("-accuratedct = Use the most accurate DCT/IDCT algorithms available in the\n");
printf(" underlying codec\n");
printf("-quiet = Output results in tabular rather than verbose format\n");
printf("-yuvencode = Encode RGB input as planar YUV rather than compressing as JPEG\n");
printf("-yuvdecode = Decode JPEG image to planar YUV rather than RGB\n");
@@ -796,6 +800,16 @@ int main(int argc, char *argv[])
printf("Using fast upsampling code\n\n");
flags|=TJFLAG_FASTUPSAMPLE;
}
if(!strcasecmp(argv[i], "-fastdct"))
{
printf("Using fastest DCT/IDCT algorithm\n\n");
flags|=TJFLAG_FASTDCT;
}
if(!strcasecmp(argv[i], "-accuratedct"))
{
printf("Using most accurate DCT/IDCT algorithm\n\n");
flags|=TJFLAG_ACCURATEDCT;
}
if(!strcasecmp(argv[i], "-rgb")) pf=TJPF_RGB;
if(!strcasecmp(argv[i], "-rgbx")) pf=TJPF_RGBX;
if(!strcasecmp(argv[i], "-bgr")) pf=TJPF_BGR;

View File

@@ -39,56 +39,73 @@ for image in $IMAGES; do
cp $IMGDIR/$image $OUTDIR
basename=`basename $image .${EXT}`
$EXEDIR/cjpeg -quality 95 -dct fast -grayscale $IMGDIR/${basename}.${EXT} >$OUTDIR/${basename}_GRAY_cjpeg.jpg
$EXEDIR/cjpeg -quality 95 -dct fast -sample 2x2 $IMGDIR/${basename}.${EXT} >$OUTDIR/${basename}_420_cjpeg.jpg
$EXEDIR/cjpeg -quality 95 -dct fast -sample 2x1 $IMGDIR/${basename}.${EXT} >$OUTDIR/${basename}_422_cjpeg.jpg
$EXEDIR/cjpeg -quality 95 -dct fast -sample 1x1 $IMGDIR/${basename}.${EXT} >$OUTDIR/${basename}_444_cjpeg.jpg
$EXEDIR/cjpeg -quality 95 -dct fast -grayscale $IMGDIR/${basename}.${EXT} >$OUTDIR/${basename}_GRAY_fast_cjpeg.jpg
$EXEDIR/cjpeg -quality 95 -dct fast -sample 2x2 $IMGDIR/${basename}.${EXT} >$OUTDIR/${basename}_420_fast_cjpeg.jpg
$EXEDIR/cjpeg -quality 95 -dct fast -sample 2x1 $IMGDIR/${basename}.${EXT} >$OUTDIR/${basename}_422_fast_cjpeg.jpg
$EXEDIR/cjpeg -quality 95 -dct fast -sample 1x1 $IMGDIR/${basename}.${EXT} >$OUTDIR/${basename}_444_fast_cjpeg.jpg
$EXEDIR/cjpeg -quality 95 -dct int -grayscale $IMGDIR/${basename}.${EXT} >$OUTDIR/${basename}_GRAY_accurate_cjpeg.jpg
$EXEDIR/cjpeg -quality 95 -dct int -sample 2x2 $IMGDIR/${basename}.${EXT} >$OUTDIR/${basename}_420_accurate_cjpeg.jpg
$EXEDIR/cjpeg -quality 95 -dct int -sample 2x1 $IMGDIR/${basename}.${EXT} >$OUTDIR/${basename}_422_accurate_cjpeg.jpg
$EXEDIR/cjpeg -quality 95 -dct int -sample 1x1 $IMGDIR/${basename}.${EXT} >$OUTDIR/${basename}_444_accurate_cjpeg.jpg
for samp in GRAY 420 422 444; do
$EXEDIR/djpeg -rgb $BMPARG $OUTDIR/${basename}_${samp}_cjpeg.jpg >$OUTDIR/${basename}_${samp}_djpeg.${EXT}
$EXEDIR/djpeg -rgb $BMPARG $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg >$OUTDIR/${basename}_${samp}_default_djpeg.${EXT}
$EXEDIR/djpeg -dct fast -rgb $BMPARG $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg >$OUTDIR/${basename}_${samp}_fast_djpeg.${EXT}
$EXEDIR/djpeg -dct int -rgb $BMPARG $OUTDIR/${basename}_${samp}_accurate_cjpeg.jpg >$OUTDIR/${basename}_${samp}_accurate_djpeg.${EXT}
done
for samp in 420 422; do
$EXEDIR/djpeg -nosmooth $BMPARG $OUTDIR/${basename}_${samp}_cjpeg.jpg >$OUTDIR/${basename}_${samp}_djpeg_nosmooth.${EXT}
$EXEDIR/djpeg -nosmooth $BMPARG $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg >$OUTDIR/${basename}_${samp}_default_nosmooth_djpeg.${EXT}
$EXEDIR/djpeg -dct fast -nosmooth $BMPARG $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg >$OUTDIR/${basename}_${samp}_fast_nosmooth_djpeg.${EXT}
$EXEDIR/djpeg -dct int -nosmooth $BMPARG $OUTDIR/${basename}_${samp}_accurate_cjpeg.jpg >$OUTDIR/${basename}_${samp}_accurate_nosmooth_djpeg.${EXT}
done
# Compression
runme $EXEDIR/tjbench $OUTDIR/$image 95 -rgb -quiet -benchtime 0.01
for s in GRAY 420 422 444; do
runme cmp $OUTDIR/${basename}_${s}_Q95.jpg $OUTDIR/${basename}_${s}_cjpeg.jpg
done
# Tiled compression & decompression
runme $EXEDIR/tjbench $OUTDIR/$image 95 -rgb -tile -quiet -benchtime 0.01
for samp in GRAY 444; do
for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \
$OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do
runme cmp $i $OUTDIR/${basename}_${samp}_djpeg.${EXT}
rm $i
done
done
runme $EXEDIR/tjbench $OUTDIR/$image 95 -rgb -tile -quiet -benchtime 0.01 -fastupsample
for samp in 420 422; do
for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \
$OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do
runme cmp $i $OUTDIR/${basename}_${samp}_djpeg_nosmooth.${EXT}
rm $i
for dct in accurate fast; do
runme $EXEDIR/tjbench $OUTDIR/$image 95 -rgb -quiet -benchtime 0.01 -${dct}dct
for samp in GRAY 420 422 444; do
runme cmp $OUTDIR/${basename}_${samp}_Q95.jpg $OUTDIR/${basename}_${samp}_${dct}_cjpeg.jpg
done
done
# Tiled decompression
for samp in GRAY 444; do
runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -tile -quiet -benchtime 0.01
for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \
$OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do
runme cmp $i $OUTDIR/${basename}_${samp}_djpeg.${EXT}
rm $i
for dct in fast accurate default; do
dctarg=-${dct}dct
if [ "${dct}" = "default" ]; then
dctarg=
fi
# Tiled compression & decompression
runme $EXEDIR/tjbench $OUTDIR/$image 95 -rgb -tile -quiet -benchtime 0.01 ${dctarg}
for samp in GRAY 444; do
for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \
$OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do
runme cmp $i $OUTDIR/${basename}_${samp}_${dct}_djpeg.${EXT}
rm $i
done
done
done
for samp in 420 422; do
runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -tile -quiet -benchtime 0.01 -fastupsample
for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \
$OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do
runme cmp $i $OUTDIR/${basename}_${samp}_djpeg_nosmooth.${EXT}
rm $i
runme $EXEDIR/tjbench $OUTDIR/$image 95 -rgb -tile -quiet -benchtime 0.01 -fastupsample ${dctarg}
for samp in 420 422; do
for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \
$OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do
runme cmp $i $OUTDIR/${basename}_${samp}_${dct}_nosmooth_djpeg.${EXT}
rm $i
done
done
# Tiled decompression
for samp in GRAY 444; do
runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -tile -quiet -benchtime 0.01 ${dctarg}
for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \
$OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do
runme cmp $i $OUTDIR/${basename}_${samp}_${dct}_djpeg.${EXT}
rm $i
done
done
for samp in 420 422; do
runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -tile -quiet -benchtime 0.01 -fastupsample ${dctarg}
for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \
$OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do
runme cmp $i $OUTDIR/${basename}_${samp}_${dct}_nosmooth_djpeg.${EXT}
rm $i
done
done
done
@@ -96,7 +113,7 @@ for image in $IMAGES; do
for scale in 2_1 15_8 7_4 13_8 3_2 11_8 5_4 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8; do
scalearg=`echo $scale | sed s@_@/@g`
for samp in GRAY 420 422 444; do
$EXEDIR/djpeg -rgb -scale ${scalearg} $BMPARG $OUTDIR/${basename}_${samp}_cjpeg.jpg >$OUTDIR/${basename}_${samp}_${scale}_djpeg.${EXT}
$EXEDIR/djpeg -rgb -scale ${scalearg} $BMPARG $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg >$OUTDIR/${basename}_${samp}_${scale}_djpeg.${EXT}
runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -scale ${scalearg} -quiet -benchtime 0.01
runme cmp $OUTDIR/${basename}_${samp}_Q95_${scale}.${EXT} $OUTDIR/${basename}_${samp}_${scale}_djpeg.${EXT}
rm $OUTDIR/${basename}_${samp}_Q95_${scale}.${EXT}

View File

@@ -36,33 +36,59 @@ for image in $IMAGES; do
cp $IMGDIR/$image $OUTDIR
basename=`basename $image .bmp`
$EXEDIR/cjpeg -quality 95 -dct fast -grayscale $IMGDIR/${basename}.bmp >$OUTDIR/${basename}_GRAY_cjpeg.jpg
$EXEDIR/cjpeg -quality 95 -dct fast -sample 2x2 $IMGDIR/${basename}.bmp >$OUTDIR/${basename}_420_cjpeg.jpg
$EXEDIR/cjpeg -quality 95 -dct fast -sample 2x1 $IMGDIR/${basename}.bmp >$OUTDIR/${basename}_422_cjpeg.jpg
$EXEDIR/cjpeg -quality 95 -dct fast -sample 1x1 $IMGDIR/${basename}.bmp >$OUTDIR/${basename}_444_cjpeg.jpg
$EXEDIR/cjpeg -quality 95 -dct fast -grayscale $IMGDIR/${basename}.bmp >$OUTDIR/${basename}_GRAY_fast_cjpeg.jpg
$EXEDIR/cjpeg -quality 95 -dct fast -sample 2x2 $IMGDIR/${basename}.bmp >$OUTDIR/${basename}_420_fast_cjpeg.jpg
$EXEDIR/cjpeg -quality 95 -dct fast -sample 2x1 $IMGDIR/${basename}.bmp >$OUTDIR/${basename}_422_fast_cjpeg.jpg
$EXEDIR/cjpeg -quality 95 -dct fast -sample 1x1 $IMGDIR/${basename}.bmp >$OUTDIR/${basename}_444_fast_cjpeg.jpg
$EXEDIR/cjpeg -quality 95 -dct int -grayscale $IMGDIR/${basename}.bmp >$OUTDIR/${basename}_GRAY_accurate_cjpeg.jpg
$EXEDIR/cjpeg -quality 95 -dct int -sample 2x2 $IMGDIR/${basename}.bmp >$OUTDIR/${basename}_420_accurate_cjpeg.jpg
$EXEDIR/cjpeg -quality 95 -dct int -sample 2x1 $IMGDIR/${basename}.bmp >$OUTDIR/${basename}_422_accurate_cjpeg.jpg
$EXEDIR/cjpeg -quality 95 -dct int -sample 1x1 $IMGDIR/${basename}.bmp >$OUTDIR/${basename}_444_accurate_cjpeg.jpg
for samp in GRAY 420 422 444; do
$EXEDIR/djpeg -rgb -bmp $OUTDIR/${basename}_${samp}_cjpeg.jpg >$OUTDIR/${basename}_${samp}_djpeg.bmp
$EXEDIR/djpeg -rgb -bmp $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg >$OUTDIR/${basename}_${samp}_default_djpeg.bmp
$EXEDIR/djpeg -dct fast -rgb -bmp $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg >$OUTDIR/${basename}_${samp}_fast_djpeg.bmp
$EXEDIR/djpeg -dct int -rgb -bmp $OUTDIR/${basename}_${samp}_accurate_cjpeg.jpg >$OUTDIR/${basename}_${samp}_accurate_djpeg.bmp
done
for samp in 420 422; do
$EXEDIR/djpeg -nosmooth -bmp $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg >$OUTDIR/${basename}_${samp}_default_nosmooth_djpeg.bmp
$EXEDIR/djpeg -dct fast -nosmooth -bmp $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg >$OUTDIR/${basename}_${samp}_fast_nosmooth_djpeg.bmp
$EXEDIR/djpeg -dct int -nosmooth -bmp $OUTDIR/${basename}_${samp}_accurate_cjpeg.jpg >$OUTDIR/${basename}_${samp}_accurate_nosmooth_djpeg.bmp
done
# Compression
for samp in GRAY 420 422 444; do
runme $JAVA TJExample $OUTDIR/$image $OUTDIR/${basename}_${samp}.jpg -q 95 -samp ${samp}
runme cmp $OUTDIR/${basename}_${samp}.jpg $OUTDIR/${basename}_${samp}_cjpeg.jpg
for dct in fast accurate; do
for samp in GRAY 420 422 444; do
runme $JAVA TJExample $OUTDIR/$image $OUTDIR/${basename}_${samp}_${dct}.jpg -q 95 -samp ${samp} -${dct}dct
runme cmp $OUTDIR/${basename}_${samp}_${dct}.jpg $OUTDIR/${basename}_${samp}_${dct}_cjpeg.jpg
done
done
# Decompression
for samp in 420 GRAY 420 422 444; do
runme $JAVA TJExample $OUTDIR/${basename}_${samp}.jpg $OUTDIR/${basename}_${samp}.bmp
runme cmp -i 54:54 $OUTDIR/${basename}_${samp}.bmp $OUTDIR/${basename}_${samp}_djpeg.bmp
rm $OUTDIR/${basename}_${samp}.bmp
for dct in fast accurate default; do
srcdct=${dct}
dctarg=-${dct}dct
if [ "${dct}" = "default" ]; then
srcdct=fast
dctarg=
fi
for samp in GRAY 420 422 444; do
runme $JAVA TJExample $OUTDIR/${basename}_${samp}_${srcdct}.jpg $OUTDIR/${basename}_${samp}_${dct}.bmp ${dctarg}
runme cmp -i 54:54 $OUTDIR/${basename}_${samp}_${dct}.bmp $OUTDIR/${basename}_${samp}_${dct}_djpeg.bmp
rm $OUTDIR/${basename}_${samp}_${dct}.bmp
done
for samp in 420 422; do
runme $JAVA TJExample $OUTDIR/${basename}_${samp}_${srcdct}.jpg $OUTDIR/${basename}_${samp}_${dct}_nosmooth.bmp -fastupsample ${dctarg}
runme cmp -i 54:54 $OUTDIR/${basename}_${samp}_${dct}_nosmooth.bmp $OUTDIR/${basename}_${samp}_${dct}_nosmooth_djpeg.bmp
rm $OUTDIR/${basename}_${samp}_${dct}_nosmooth.bmp
done
done
# Scaled decompression
for scale in 2_1 15_8 7_4 13_8 3_2 11_8 5_4 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8; do
scalearg=`echo $scale | sed s@_@/@g`
for samp in GRAY 420 422 444; do
$EXEDIR/djpeg -rgb -bmp -scale ${scalearg} $OUTDIR/${basename}_${samp}_cjpeg.jpg >$OUTDIR/${basename}_${samp}_${scale}_djpeg.bmp
runme $JAVA TJExample $OUTDIR/${basename}_${samp}.jpg $OUTDIR/${basename}_${samp}_${scale}.bmp -scale ${scalearg}
$EXEDIR/djpeg -rgb -bmp -scale ${scalearg} $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg >$OUTDIR/${basename}_${samp}_${scale}_djpeg.bmp
runme $JAVA TJExample $OUTDIR/${basename}_${samp}_fast.jpg $OUTDIR/${basename}_${samp}_${scale}.bmp -scale ${scalearg}
runme cmp -i 54:54 $OUTDIR/${basename}_${samp}_${scale}.bmp $OUTDIR/${basename}_${samp}_${scale}_djpeg.bmp
rm $OUTDIR/${basename}_${samp}_${scale}.bmp
done
@@ -70,20 +96,26 @@ for image in $IMAGES; do
# Transforms
for samp in GRAY 420 422 444; do
$EXEDIR/jpegtran -crop 70x60+16+16 -flip horizontal -trim $OUTDIR/${basename}_${samp}.jpg >$OUTDIR/${basename}_${samp}_hflip_jpegtran.jpg
$EXEDIR/jpegtran -crop 70x60+16+16 -flip vertical -trim $OUTDIR/${basename}_${samp}.jpg >$OUTDIR/${basename}_${samp}_vflip_jpegtran.jpg
$EXEDIR/jpegtran -crop 70x60+16+16 -transpose -trim $OUTDIR/${basename}_${samp}.jpg >$OUTDIR/${basename}_${samp}_transpose_jpegtran.jpg
$EXEDIR/jpegtran -crop 70x60+16+16 -transverse -trim $OUTDIR/${basename}_${samp}.jpg >$OUTDIR/${basename}_${samp}_transverse_jpegtran.jpg
$EXEDIR/jpegtran -crop 70x60+16+16 -rotate 90 -trim $OUTDIR/${basename}_${samp}.jpg >$OUTDIR/${basename}_${samp}_rot90_jpegtran.jpg
$EXEDIR/jpegtran -crop 70x60+16+16 -rotate 180 -trim $OUTDIR/${basename}_${samp}.jpg >$OUTDIR/${basename}_${samp}_rot180_jpegtran.jpg
$EXEDIR/jpegtran -crop 70x60+16+16 -rotate 270 -trim $OUTDIR/${basename}_${samp}.jpg >$OUTDIR/${basename}_${samp}_rot270_jpegtran.jpg
$EXEDIR/jpegtran -crop 70x60+16+16 -flip horizontal -trim $OUTDIR/${basename}_${samp}_fast.jpg >$OUTDIR/${basename}_${samp}_hflip_jpegtran.jpg
$EXEDIR/jpegtran -crop 70x60+16+16 -flip vertical -trim $OUTDIR/${basename}_${samp}_fast.jpg >$OUTDIR/${basename}_${samp}_vflip_jpegtran.jpg
$EXEDIR/jpegtran -crop 70x60+16+16 -transpose -trim $OUTDIR/${basename}_${samp}_fast.jpg >$OUTDIR/${basename}_${samp}_transpose_jpegtran.jpg
$EXEDIR/jpegtran -crop 70x60+16+16 -transverse -trim $OUTDIR/${basename}_${samp}_fast.jpg >$OUTDIR/${basename}_${samp}_transverse_jpegtran.jpg
$EXEDIR/jpegtran -crop 70x60+16+16 -rotate 90 -trim $OUTDIR/${basename}_${samp}_fast.jpg >$OUTDIR/${basename}_${samp}_rot90_jpegtran.jpg
$EXEDIR/jpegtran -crop 70x60+16+16 -rotate 180 -trim $OUTDIR/${basename}_${samp}_fast.jpg >$OUTDIR/${basename}_${samp}_rot180_jpegtran.jpg
$EXEDIR/jpegtran -crop 70x60+16+16 -rotate 270 -trim $OUTDIR/${basename}_${samp}_fast.jpg >$OUTDIR/${basename}_${samp}_rot270_jpegtran.jpg
done
for xform in hflip vflip transpose transverse rot90 rot180 rot270; do
for samp in GRAY 420 422 444; do
runme $JAVA TJExample $OUTDIR/${basename}_${samp}.jpg $OUTDIR/${basename}_${samp}_${xform}.jpg -$xform -crop 16,16,70x60
runme $JAVA TJExample $OUTDIR/${basename}_${samp}_fast.jpg $OUTDIR/${basename}_${samp}_${xform}.jpg -$xform -crop 16,16,70x60
runme cmp $OUTDIR/${basename}_${samp}_${xform}.jpg $OUTDIR/${basename}_${samp}_${xform}_jpegtran.jpg
$EXEDIR/djpeg -rgb -bmp $OUTDIR/${basename}_${samp}_${xform}_jpegtran.jpg >$OUTDIR/${basename}_${samp}_${xform}_jpegtran.bmp
runme $JAVA TJExample $OUTDIR/${basename}_${samp}.jpg $OUTDIR/${basename}_${samp}_${xform}.bmp -$xform -crop 16,16,70x60
runme $JAVA TJExample $OUTDIR/${basename}_${samp}_fast.jpg $OUTDIR/${basename}_${samp}_${xform}.bmp -$xform -crop 16,16,70x60
runme cmp -i 54:54 $OUTDIR/${basename}_${samp}_${xform}.bmp $OUTDIR/${basename}_${samp}_${xform}_jpegtran.bmp
rm $OUTDIR/${basename}_${samp}_${xform}.bmp
done
for samp in 420 422; do
$EXEDIR/djpeg -nosmooth -rgb -bmp $OUTDIR/${basename}_${samp}_${xform}_jpegtran.jpg >$OUTDIR/${basename}_${samp}_${xform}_jpegtran.bmp
runme $JAVA TJExample $OUTDIR/${basename}_${samp}_fast.jpg $OUTDIR/${basename}_${samp}_${xform}.bmp -$xform -crop 16,16,70x60 -fastupsample
runme cmp -i 54:54 $OUTDIR/${basename}_${samp}_${xform}.bmp $OUTDIR/${basename}_${samp}_${xform}_jpegtran.bmp
rm $OUTDIR/${basename}_${samp}_${xform}.bmp
done
@@ -92,9 +124,9 @@ for image in $IMAGES; do
# Grayscale transform
for xform in hflip vflip transpose transverse rot90 rot180 rot270; do
for samp in GRAY 444 422 420; do
runme $JAVA TJExample $OUTDIR/${basename}_${samp}.jpg $OUTDIR/${basename}_${samp}_${xform}.jpg -$xform -grayscale -crop 16,16,70x60
runme $JAVA TJExample $OUTDIR/${basename}_${samp}_fast.jpg $OUTDIR/${basename}_${samp}_${xform}.jpg -$xform -grayscale -crop 16,16,70x60
runme cmp $OUTDIR/${basename}_${samp}_${xform}.jpg $OUTDIR/${basename}_GRAY_${xform}_jpegtran.jpg
runme $JAVA TJExample $OUTDIR/${basename}_${samp}.jpg $OUTDIR/${basename}_${samp}_${xform}.bmp -$xform -grayscale -crop 16,16,70x60
runme $JAVA TJExample $OUTDIR/${basename}_${samp}_fast.jpg $OUTDIR/${basename}_${samp}_${xform}.bmp -$xform -grayscale -crop 16,16,70x60
runme cmp -i 54:54 $OUTDIR/${basename}_${samp}_${xform}.bmp $OUTDIR/${basename}_GRAY_${xform}_jpegtran.bmp
rm $OUTDIR/${basename}_${samp}_${xform}.bmp
done
@@ -106,7 +138,7 @@ for image in $IMAGES; do
for scale in 2_1 15_8 7_4 13_8 3_2 11_8 5_4 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8; do
scalearg=`echo $scale | sed s@_@/@g`
$EXEDIR/djpeg -rgb -bmp -scale ${scalearg} $OUTDIR/${basename}_${samp}_${xform}_jpegtran.jpg >$OUTDIR/${basename}_${samp}_${xform}_${scale}_jpegtran.bmp
runme $JAVA TJExample $OUTDIR/${basename}_${samp}.jpg $OUTDIR/${basename}_${samp}_${xform}_${scale}.bmp -$xform -scale ${scalearg} -crop 16,16,70x60
runme $JAVA TJExample $OUTDIR/${basename}_${samp}_fast.jpg $OUTDIR/${basename}_${samp}_${xform}_${scale}.bmp -$xform -scale ${scalearg} -crop 16,16,70x60
runme cmp -i 54:54 $OUTDIR/${basename}_${samp}_${xform}_${scale}.bmp $OUTDIR/${basename}_${samp}_${xform}_${scale}_jpegtran.bmp
rm $OUTDIR/${basename}_${samp}_${xform}_${scale}.bmp
done

View File

@@ -145,7 +145,7 @@ static int getPixelFormat(int pixelSize, int flags)
}
static int setCompDefaults(struct jpeg_compress_struct *cinfo,
int pixelFormat, int subsamp, int jpegQual)
int pixelFormat, int subsamp, int jpegQual, int flags)
{
int retval=0;
@@ -191,7 +191,7 @@ static int setCompDefaults(struct jpeg_compress_struct *cinfo,
if(jpegQual>=0)
{
jpeg_set_quality(cinfo, jpegQual, TRUE);
if(jpegQual>=96) cinfo->dct_method=JDCT_ISLOW;
if(jpegQual>=96 || flags&TJFLAG_ACCURATEDCT) cinfo->dct_method=JDCT_ISLOW;
else cinfo->dct_method=JDCT_FASTEST;
}
if(subsamp==TJSAMP_GRAY)
@@ -210,7 +210,7 @@ static int setCompDefaults(struct jpeg_compress_struct *cinfo,
}
static int setDecompDefaults(struct jpeg_decompress_struct *dinfo,
int pixelFormat)
int pixelFormat, int flags)
{
int retval=0;
@@ -258,6 +258,8 @@ static int setDecompDefaults(struct jpeg_decompress_struct *dinfo,
_throw("Unsupported pixel format");
}
if(flags&TJFLAG_FASTDCT) dinfo->dct_method=JDCT_FASTEST;
bailout:
return retval;
}
@@ -618,7 +620,7 @@ DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, unsigned char *srcBuf,
alloc=0; *jpegSize=tjBufSize(width, height, jpegSubsamp);
}
jpeg_mem_dest_tj(cinfo, jpegBuf, jpegSize, alloc);
if(setCompDefaults(cinfo, pixelFormat, jpegSubsamp, jpegQual)==-1)
if(setCompDefaults(cinfo, pixelFormat, jpegSubsamp, jpegQual, flags)==-1)
return -1;
jpeg_start_compress(cinfo, TRUE);
@@ -726,7 +728,7 @@ DLLEXPORT int DLLCALL tjEncodeYUV2(tjhandle handle, unsigned char *srcBuf,
yuvsize=tjBufSizeYUV(width, height, subsamp);
jpeg_mem_dest_tj(cinfo, &dstBuf, &yuvsize, 0);
if(setCompDefaults(cinfo, pixelFormat, subsamp, -1)==-1) return -1;
if(setCompDefaults(cinfo, pixelFormat, subsamp, -1, flags)==-1) return -1;
jpeg_start_compress(cinfo, TRUE);
pw=PAD(width, cinfo->max_h_samp_factor);
@@ -955,7 +957,7 @@ DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle, unsigned char *jpegBuf,
jpeg_mem_src_tj(dinfo, jpegBuf, jpegSize);
jpeg_read_header(dinfo, TRUE);
if(setDecompDefaults(dinfo, pixelFormat)==-1)
if(setDecompDefaults(dinfo, pixelFormat, flags)==-1)
{
retval=-1; goto bailout;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C)2009-2011 D. R. Commander. All Rights Reserved.
* Copyright (C)2009-2012 D. R. Commander. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -226,28 +226,30 @@ static const int tjPixelSize[TJ_NUMPF] = {3, 3, 4, 4, 4, 4, 1, 4, 4, 4, 4};
*/
#define TJFLAG_BOTTOMUP 2
/**
* 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 (if the
* underlying codec supports it.)
*/
#define TJFLAG_FORCEMMX 8
/**
* 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 (if the
* underlying codec supports it.)
*/
#define TJFLAG_FORCESSE 16
/**
* 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 (if the
* underlying codec supports it.)
*/
#define TJFLAG_FORCESSE2 32
/**
* 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 (if the
* underlying codec supports it.)
*/
#define TJFLAG_FORCESSE3 128
/**
* Use fast, inaccurate chrominance upsampling routines in the JPEG
* decompressor (libjpeg and libjpeg-turbo versions only)
* When decompressing, use the fastest chrominance upsampling algorithm
* available in the underlying codec. The default is to use smooth upsampling,
* which creates a smooth transition between neighboring chrominance components
* in order to reduce upsampling artifacts in the decompressed image.
*/
#define TJFLAG_FASTUPSAMPLE 256
/**
@@ -258,6 +260,24 @@ static const int tjPixelSize[TJ_NUMPF] = {3, 3, 4, 4, 4, 4, 1, 4, 4, 4, 4};
* versions of TurboJPEG.
*/
#define TJFLAG_NOREALLOC 1024
/**
* Use the fastest DCT/IDCT algorithm available in the underlying codec. The
* default if this flag is not specified is implementation-specific. The
* libjpeg implementation, for example, uses the fast algorithm by default when
* compressing, because this has been shown to have only a very slight effect
* on accuracy, but it uses the accurate algorithm when decompressing, because
* this has been shown to have a larger effect.
*/
#define TJFLAG_FASTDCT 2048
/**
* Use the most accurate DCT/IDCT algorithm available in the underlying codec.
* The default if this flag is not specified is implementation-specific. The
* libjpeg implementation, for example, uses the fast algorithm by default when
* compressing, because this has been shown to have only a very slight effect
* on accuracy, but it uses the accurate algorithm when decompressing, because
* this has been shown to have a larger effect.
*/
#define TJFLAG_ACCURATEDCT 4096
/**