encounters a warning from the underlying libjpeg API (the default behavior is
to allow the operation to complete unless a fatal error is encountered.)
+5. Introduced a new flag in the TurboJPEG C and Java APIs (`TJFLAG_PROGRESSIVE`
+and `TJ.FLAG_PROGRESSIVE`, respectively) that causes the library to use
+progressive entropy coding in JPEG images generated by compression and
+transform operations.
+
1.5.2
=====
<tr class="memitem:ga519cfa4ef6c18d9e5b455fdf59306a3a"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga519cfa4ef6c18d9e5b455fdf59306a3a">TJFLAG_STOPONWARNING</a></td></tr>
<tr class="memdesc:ga519cfa4ef6c18d9e5b455fdf59306a3a"><td class="mdescLeft"> </td><td class="mdescRight">Immediately discontinue the current compression/decompression/transform operation if the underlying codec throws a warning (non-fatal error). <a href="#ga519cfa4ef6c18d9e5b455fdf59306a3a">More...</a><br/></td></tr>
<tr class="separator:ga519cfa4ef6c18d9e5b455fdf59306a3a"><td class="memSeparator" colspan="2"> </td></tr>
+<tr class="memitem:ga43b426750b46190a25d34a67ef76df1b"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga43b426750b46190a25d34a67ef76df1b">TJFLAG_PROGRESSIVE</a></td></tr>
+<tr class="memdesc:ga43b426750b46190a25d34a67ef76df1b"><td class="mdescLeft"> </td><td class="mdescRight">Use progressive entropy coding in JPEG images generated by the compression and transform functions. <a href="#ga43b426750b46190a25d34a67ef76df1b">More...</a><br/></td></tr>
+<tr class="separator:ga43b426750b46190a25d34a67ef76df1b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga79bde1b4a3e2351e00887e47781b966e"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga79bde1b4a3e2351e00887e47781b966e">TJ_NUMERR</a></td></tr>
<tr class="memdesc:ga79bde1b4a3e2351e00887e47781b966e"><td class="mdescLeft"> </td><td class="mdescRight">The number of error codes. <a href="#ga79bde1b4a3e2351e00887e47781b966e">More...</a><br/></td></tr>
<tr class="separator:ga79bde1b4a3e2351e00887e47781b966e"><td class="memSeparator" colspan="2"> </td></tr>
<p>Disable buffer (re)allocation. </p>
<p>If passed to one of the JPEG compression or transform functions, this flag will cause those functions to generate an error if the JPEG image buffer is invalid or too small rather than attempting to allocate or reallocate that buffer. This reproduces the behavior of earlier versions of TurboJPEG. </p>
+</div>
+</div>
+<a class="anchor" id="ga43b426750b46190a25d34a67ef76df1b"></a>
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">#define TJFLAG_PROGRESSIVE</td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Use progressive entropy coding in JPEG images generated by the compression and transform functions. </p>
+<p>Progressive entropy coding will generally improve compression relative to baseline entropy coding (the default), but it will reduce compression and decompression performance considerably. </p>
+
</div>
</div>
<a class="anchor" id="ga519cfa4ef6c18d9e5b455fdf59306a3a"></a>
['tjflag_5ffastdct',['TJFLAG_FASTDCT',['../group___turbo_j_p_e_g.html#gaabce235db80d3f698b27f36cbd453da2',1,'turbojpeg.h']]],
['tjflag_5ffastupsample',['TJFLAG_FASTUPSAMPLE',['../group___turbo_j_p_e_g.html#ga4ee4506c81177a06f77e2504a22efd2d',1,'turbojpeg.h']]],
['tjflag_5fnorealloc',['TJFLAG_NOREALLOC',['../group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963',1,'turbojpeg.h']]],
+ ['tjflag_5fprogressive',['TJFLAG_PROGRESSIVE',['../group___turbo_j_p_e_g.html#ga43b426750b46190a25d34a67ef76df1b',1,'turbojpeg.h']]],
['tjflag_5fstoponwarning',['TJFLAG_STOPONWARNING',['../group___turbo_j_p_e_g.html#ga519cfa4ef6c18d9e5b455fdf59306a3a',1,'turbojpeg.h']]],
['tjfree',['tjFree',['../group___turbo_j_p_e_g.html#ga8c4a1231dc06a450514c835f6471f137',1,'turbojpeg.h']]],
['tjgeterrorcode',['tjGetErrorCode',['../group___turbo_j_p_e_g.html#ga0be00a62bd1be897f170fa1fed5fb4cb',1,'turbojpeg.h']]],
['tjsamp_5fgray',['TJSAMP_GRAY',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a3f1c9504842ddc7a48d0f690754b6248',1,'turbojpeg.h']]],
['tjscaled',['TJSCALED',['../group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df',1,'turbojpeg.h']]],
['tjscalingfactor',['tjscalingfactor',['../structtjscalingfactor.html',1,'']]],
- ['tjtransform',['tjtransform',['../structtjtransform.html',1,'tjtransform'],['../group___turbo_j_p_e_g.html#gaa29f3189c41be12ec5dee7caec318a31',1,'tjtransform(): turbojpeg.h'],['../group___turbo_j_p_e_g.html#gad02cd42b69f193a0623a9c801788df3a',1,'tjTransform(tjhandle handle, const unsigned char *jpegBuf, unsigned long jpegSize, int n, unsigned char **dstBufs, unsigned long *dstSizes, tjtransform *transforms, int flags): turbojpeg.h']]],
+ ['tjtransform',['tjtransform',['../structtjtransform.html',1,'tjtransform'],['../group___turbo_j_p_e_g.html#gad02cd42b69f193a0623a9c801788df3a',1,'tjTransform(tjhandle handle, const unsigned char *jpegBuf, unsigned long jpegSize, int n, unsigned char **dstBufs, unsigned long *dstSizes, tjtransform *transforms, int flags): turbojpeg.h'],['../group___turbo_j_p_e_g.html#gaa29f3189c41be12ec5dee7caec318a31',1,'tjtransform(): turbojpeg.h']]],
['tjxop',['TJXOP',['../group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866',1,'turbojpeg.h']]],
['tjxop_5fhflip',['TJXOP_HFLIP',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aa0df69776caa30f0fa28e26332d311ce',1,'turbojpeg.h']]],
['tjxop_5fnone',['TJXOP_NONE',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aad88c0366cd3f7d0eac9d7a3fa1c2c27',1,'turbojpeg.h']]],
System.out.println(" codec");
System.out.println("-accuratedct = Use the most accurate DCT/IDCT algorithms available in the");
System.out.println(" underlying codec");
+ System.out.println("-progressive = Use progressive entropy coding in JPEG images generated by");
+ System.out.println(" compression and transform operations.");
System.out.println("-subsamp <s> = When testing JPEG compression, this option specifies the level");
System.out.println(" of chrominance subsampling to use (<s> = 444, 422, 440, 420, 411, or");
System.out.println(" GRAY). The default is to test Grayscale, 4:2:0, 4:2:2, and 4:4:4 in");
System.out.println("Using most accurate DCT/IDCT algorithm\n");
flags |= TJ.FLAG_ACCURATEDCT;
}
+ if (argv[i].equalsIgnoreCase("-progressive")) {
+ System.out.println("Using progressive entropy coding\n");
+ flags |= TJ.FLAG_PROGRESSIVE;
+ }
if (argv[i].equalsIgnoreCase("-rgb"))
pf = TJ.PF_RGB;
if (argv[i].equalsIgnoreCase("-rgbx"))
<td class="colLast"><code>128</code></td>
</tr>
<tr class="rowColor">
+<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.FLAG_PROGRESSIVE">
+<!-- -->
+</a><code>public static final int</code></td>
+<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#FLAG_PROGRESSIVE">FLAG_PROGRESSIVE</a></code></td>
+<td class="colLast"><code>16384</code></td>
+</tr>
+<tr class="altColor">
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.FLAG_STOPONWARNING">
<!-- -->
</a><code>public static final int</code></td>
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING">FLAG_STOPONWARNING</a></code></td>
<td class="colLast"><code>8192</code></td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.NUMCS">
<!-- -->
</a><code>public static final int</code></td>
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#NUMCS">NUMCS</a></code></td>
<td class="colLast"><code>5</code></td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.NUMERR">
<!-- -->
</a><code>public static final int</code></td>
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#NUMERR">NUMERR</a></code></td>
<td class="colLast"><code>2</code></td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.NUMPF">
<!-- -->
</a><code>public static final int</code></td>
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#NUMPF">NUMPF</a></code></td>
<td class="colLast"><code>12</code></td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.NUMSAMP">
<!-- -->
</a><code>public static final int</code></td>
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#NUMSAMP">NUMSAMP</a></code></td>
<td class="colLast"><code>6</code></td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_ABGR">
<!-- -->
</a><code>public static final int</code></td>
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_ABGR">PF_ABGR</a></code></td>
<td class="colLast"><code>9</code></td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_ARGB">
<!-- -->
</a><code>public static final int</code></td>
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_ARGB">PF_ARGB</a></code></td>
<td class="colLast"><code>10</code></td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_BGR">
<!-- -->
</a><code>public static final int</code></td>
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_BGR">PF_BGR</a></code></td>
<td class="colLast"><code>1</code></td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_BGRA">
<!-- -->
</a><code>public static final int</code></td>
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_BGRA">PF_BGRA</a></code></td>
<td class="colLast"><code>8</code></td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_BGRX">
<!-- -->
</a><code>public static final int</code></td>
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_BGRX">PF_BGRX</a></code></td>
<td class="colLast"><code>3</code></td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_CMYK">
<!-- -->
</a><code>public static final int</code></td>
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_CMYK">PF_CMYK</a></code></td>
<td class="colLast"><code>11</code></td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_GRAY">
<!-- -->
</a><code>public static final int</code></td>
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_GRAY">PF_GRAY</a></code></td>
<td class="colLast"><code>6</code></td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_RGB">
<!-- -->
</a><code>public static final int</code></td>
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_RGB">PF_RGB</a></code></td>
<td class="colLast"><code>0</code></td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_RGBA">
<!-- -->
</a><code>public static final int</code></td>
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_RGBA">PF_RGBA</a></code></td>
<td class="colLast"><code>7</code></td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_RGBX">
<!-- -->
</a><code>public static final int</code></td>
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_RGBX">PF_RGBX</a></code></td>
<td class="colLast"><code>2</code></td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_XBGR">
<!-- -->
</a><code>public static final int</code></td>
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_XBGR">PF_XBGR</a></code></td>
<td class="colLast"><code>4</code></td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.PF_XRGB">
<!-- -->
</a><code>public static final int</code></td>
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_XRGB">PF_XRGB</a></code></td>
<td class="colLast"><code>5</code></td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.SAMP_411">
<!-- -->
</a><code>public static final int</code></td>
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_411">SAMP_411</a></code></td>
<td class="colLast"><code>5</code></td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.SAMP_420">
<!-- -->
</a><code>public static final int</code></td>
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_420">SAMP_420</a></code></td>
<td class="colLast"><code>2</code></td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.SAMP_422">
<!-- -->
</a><code>public static final int</code></td>
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_422">SAMP_422</a></code></td>
<td class="colLast"><code>1</code></td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.SAMP_440">
<!-- -->
</a><code>public static final int</code></td>
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_440">SAMP_440</a></code></td>
<td class="colLast"><code>4</code></td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.SAMP_444">
<!-- -->
</a><code>public static final int</code></td>
<td><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_444">SAMP_444</a></code></td>
<td class="colLast"><code>0</code></td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><a name="org.libjpegturbo.turbojpeg.TJ.SAMP_GRAY">
<!-- -->
</a><code>public static final int</code></td>
<dd>
<div class="block"><span class="strong">Deprecated.</span></div>
</dd>
+<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_PROGRESSIVE">FLAG_PROGRESSIVE</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
+<dd>
+<div class="block">Use progressive entropy coding in JPEG images generated by compression and
+ transform operations.</div>
+</dd>
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING">FLAG_STOPONWARNING</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
<dd>
<div class="block">Immediately discontinue the current compression/decompression/transform
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
+<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_PROGRESSIVE">FLAG_PROGRESSIVE</a></strong></code>
+<div class="block">Use progressive entropy coding in JPEG images generated by compression and
+ transform operations.</div>
+</td>
+</tr>
+<tr class="altColor">
+<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING">FLAG_STOPONWARNING</a></strong></code>
<div class="block">Immediately discontinue the current compression/decompression/transform
operation if the underlying codec throws a warning (non-fatal error).</div>
</td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#NUMCS">NUMCS</a></strong></code>
<div class="block">The number of JPEG colorspaces</div>
</td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#NUMERR">NUMERR</a></strong></code>
<div class="block">The number of error codes</div>
</td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#NUMPF">NUMPF</a></strong></code>
<div class="block">The number of pixel formats</div>
</td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#NUMSAMP">NUMSAMP</a></strong></code>
<div class="block">The number of chrominance subsampling options</div>
</td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_ABGR">PF_ABGR</a></strong></code>
<div class="block">ABGR pixel format.</div>
</td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_ARGB">PF_ARGB</a></strong></code>
<div class="block">ARGB pixel format.</div>
</td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_BGR">PF_BGR</a></strong></code>
<div class="block">BGR pixel format.</div>
</td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_BGRA">PF_BGRA</a></strong></code>
<div class="block">BGRA pixel format.</div>
</td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_BGRX">PF_BGRX</a></strong></code>
<div class="block">BGRX pixel format.</div>
</td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_CMYK">PF_CMYK</a></strong></code>
<div class="block">CMYK pixel format.</div>
</td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_GRAY">PF_GRAY</a></strong></code>
<div class="block">Grayscale pixel format.</div>
</td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB">PF_RGB</a></strong></code>
<div class="block">RGB pixel format.</div>
</td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGBA">PF_RGBA</a></strong></code>
<div class="block">RGBA pixel format.</div>
</td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGBX">PF_RGBX</a></strong></code>
<div class="block">RGBX pixel format.</div>
</td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_XBGR">PF_XBGR</a></strong></code>
<div class="block">XBGR pixel format.</div>
</td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_XRGB">PF_XRGB</a></strong></code>
<div class="block">XRGB pixel format.</div>
</td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_411">SAMP_411</a></strong></code>
<div class="block">4:1:1 chrominance subsampling.</div>
</td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_420">SAMP_420</a></strong></code>
<div class="block">4:2:0 chrominance subsampling.</div>
</td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_422">SAMP_422</a></strong></code>
<div class="block">4:2:2 chrominance subsampling.</div>
</td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_440">SAMP_440</a></strong></code>
<div class="block">4:4:0 chrominance subsampling.</div>
</td>
</tr>
-<tr class="altColor">
+<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444">SAMP_444</a></strong></code>
<div class="block">4:4:4 chrominance subsampling (no chrominance subsampling).</div>
</td>
</tr>
-<tr class="rowColor">
+<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_GRAY">SAMP_GRAY</a></strong></code>
<div class="block">Grayscale.</div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_STOPONWARNING">Constant Field Values</a></dd></dl>
</li>
</ul>
+<a name="FLAG_PROGRESSIVE">
+<!-- -->
+</a>
+<ul class="blockList">
+<li class="blockList">
+<h4>FLAG_PROGRESSIVE</h4>
+<pre>public static final int FLAG_PROGRESSIVE</pre>
+<div class="block">Use progressive entropy coding in JPEG images generated by compression and
+ transform operations. Progressive entropy coding will generally improve
+ compression relative to baseline entropy coding (the default), but it will
+ reduce compression and decompression performance considerably.</div>
+<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_PROGRESSIVE">Constant Field Values</a></dd></dl>
+</li>
+</ul>
<a name="NUMERR">
<!-- -->
</a>
* The uncompressed source/destination image is stored in bottom-up (Windows,
* OpenGL) order, not top-down (X11) order.
*/
- public static final int FLAG_BOTTOMUP = 2;
+ public static final int FLAG_BOTTOMUP = 2;
@Deprecated
- public static final int FLAG_FORCEMMX = 8;
+ public static final int FLAG_FORCEMMX = 8;
@Deprecated
- public static final int FLAG_FORCESSE = 16;
+ public static final int FLAG_FORCESSE = 16;
@Deprecated
- public static final int FLAG_FORCESSE2 = 32;
+ public static final int FLAG_FORCESSE2 = 32;
@Deprecated
- public static final int FLAG_FORCESSE3 = 128;
+ public static final int FLAG_FORCESSE3 = 128;
/**
* When decompressing an image that was compressed using chrominance
* creates a smooth transition between neighboring chrominance components in
* order to reduce upsampling artifacts in the decompressed image.
*/
- public static final int FLAG_FASTUPSAMPLE = 256;
+ public static final 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. For
* 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.
*/
- public static final int FLAG_FASTDCT = 2048;
+ public static final 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
* but it uses the accurate algorithm when decompressing, because this has
* been shown to have a larger effect.
*/
- public static final int FLAG_ACCURATEDCT = 4096;
+ public static final int FLAG_ACCURATEDCT = 4096;
/**
* Immediately discontinue the current compression/decompression/transform
* operation if the underlying codec throws a warning (non-fatal error). The
* error is encountered.
*/
public static final int FLAG_STOPONWARNING = 8192;
+ /**
+ * Use progressive entropy coding in JPEG images generated by compression and
+ * transform operations. Progressive entropy coding will generally improve
+ * compression relative to baseline entropy coding (the default), but it will
+ * reduce compression and decompression performance considerably.
+ */
+ public static final int FLAG_PROGRESSIVE = 16384;
/**
printf(" codec\n");
printf("-accuratedct = Use the most accurate DCT/IDCT algorithms available in the\n");
printf(" underlying codec\n");
+ printf("-progressive = Use progressive entropy coding in JPEG images generated by\n");
+ printf(" compression and transform operations.\n");
printf("-subsamp <s> = When testing JPEG compression, this option specifies the level\n");
printf(" of chrominance subsampling to use (<s> = 444, 422, 440, 420, 411, or\n");
printf(" GRAY). The default is to test Grayscale, 4:2:0, 4:2:2, and 4:4:4 in\n");
printf("Using most accurate DCT/IDCT algorithm\n\n");
flags|=TJFLAG_ACCURATEDCT;
}
+ if(!strcasecmp(argv[i], "-progressive"))
+ {
+ printf("Using progressive entropy coding\n\n");
+ flags|=TJFLAG_PROGRESSIVE;
+ }
if(!strcasecmp(argv[i], "-rgb")) pf=TJPF_RGB;
if(!strcasecmp(argv[i], "-rgbx")) pf=TJPF_RGBX;
if(!strcasecmp(argv[i], "-bgr")) pf=TJPF_BGR;
jpeg_set_colorspace(cinfo, JCS_YCCK);
else jpeg_set_colorspace(cinfo, JCS_YCbCr);
+ if(flags&TJFLAG_PROGRESSIVE)
+ jpeg_simple_progression(cinfo);
#ifndef NO_GETENV
- if((env=getenv("TJ_PROGRESSIVE"))!=NULL && strlen(env)>0
+ else if((env=getenv("TJ_PROGRESSIVE"))!=NULL && strlen(env)>0
&& !strcmp(env, "1"))
jpeg_simple_progression(cinfo);
#endif
jpeg_copy_critical_parameters(dinfo, cinfo);
dstcoefs=jtransform_adjust_parameters(dinfo, cinfo, srccoefs,
&xinfo[i]);
+ if(flags&TJFLAG_PROGRESSIVE)
+ jpeg_simple_progression(cinfo);
if(!(t[i].options&TJXOPT_NOOUTPUT))
{
jpeg_write_coefficients(cinfo, dstcoefs);
* is encountered.
*/
#define TJFLAG_STOPONWARNING 8192
+/**
+ * Use progressive entropy coding in JPEG images generated by the compression
+ * and transform functions. Progressive entropy coding will generally improve
+ * compression relative to baseline entropy coding (the default), but it will
+ * reduce compression and decompression performance considerably.
+ */
+#define TJFLAG_PROGRESSIVE 16384
/**