More Java API cleanup
This commit is contained in:
@@ -282,7 +282,7 @@ public class TJExample {
|
||||
if(img != null)
|
||||
jpegBuf = tjc.compress(img, 0);
|
||||
else {
|
||||
tjc.setBitmapBuffer(bmpBuf, width, 0, height, TJ.PF_BGRX);
|
||||
tjc.setSourceImage(bmpBuf, width, 0, height, TJ.PF_BGRX);
|
||||
jpegBuf = tjc.compress(0);
|
||||
}
|
||||
jpegSize = tjc.getCompressedSize();
|
||||
|
||||
@@ -108,9 +108,9 @@ public class TJUnitTest {
|
||||
|
||||
private static void initBuf(byte[] buf, int w, int pitch, int h, int pf,
|
||||
int flags) throws Exception {
|
||||
int roffset = TJ.getRedShift(pf) / 8;
|
||||
int goffset = TJ.getGreenShift(pf) / 8;
|
||||
int boffset = TJ.getBlueShift(pf) / 8;
|
||||
int roffset = TJ.getRedOffset(pf);
|
||||
int goffset = TJ.getGreenOffset(pf);
|
||||
int boffset = TJ.getBlueOffset(pf);
|
||||
int ps = TJ.getPixelSize(pf);
|
||||
int i, _i, j;
|
||||
|
||||
@@ -159,9 +159,9 @@ public class TJUnitTest {
|
||||
|
||||
private static void initIntBuf(int[] buf, int w, int pitch, int h, int pf,
|
||||
int flags) throws Exception {
|
||||
int rshift = TJ.getRedShift(pf);
|
||||
int gshift = TJ.getGreenShift(pf);
|
||||
int bshift = TJ.getBlueShift(pf);
|
||||
int rshift = TJ.getRedOffset(pf) * 8;
|
||||
int gshift = TJ.getGreenOffset(pf) * 8;
|
||||
int bshift = TJ.getBlueOffset(pf) * 8;
|
||||
int i, _i, j;
|
||||
|
||||
Arrays.fill(buf, 0);
|
||||
@@ -239,9 +239,9 @@ public class TJUnitTest {
|
||||
|
||||
private static int checkBuf(byte[] buf, int w, int pitch, int h, int pf,
|
||||
int subsamp, int scaleNum, int scaleDenom, int flags) throws Exception {
|
||||
int roffset = TJ.getRedShift(pf) / 8;
|
||||
int goffset = TJ.getGreenShift(pf) / 8;
|
||||
int boffset = TJ.getBlueShift(pf) / 8;
|
||||
int roffset = TJ.getRedOffset(pf);
|
||||
int goffset = TJ.getGreenOffset(pf);
|
||||
int boffset = TJ.getBlueOffset(pf);
|
||||
int ps = TJ.getPixelSize(pf);
|
||||
int i, _i, j, retval = 1;
|
||||
int halfway = 16 * scaleNum / scaleDenom;
|
||||
@@ -323,9 +323,9 @@ public class TJUnitTest {
|
||||
|
||||
private static int checkIntBuf(int[] buf, int w, int pitch, int h, int pf,
|
||||
int subsamp, int scaleNum, int scaleDenom, int flags) throws Exception {
|
||||
int rshift = TJ.getRedShift(pf);
|
||||
int gshift = TJ.getGreenShift(pf);
|
||||
int bshift = TJ.getBlueShift(pf);
|
||||
int rshift = TJ.getRedOffset(pf) * 8;
|
||||
int gshift = TJ.getGreenOffset(pf) * 8;
|
||||
int bshift = TJ.getBlueOffset(pf) * 8;
|
||||
int i, _i, j, retval = 1;
|
||||
int halfway = 16 * scaleNum / scaleDenom;
|
||||
int blockSize = 8 * scaleNum / scaleDenom;
|
||||
@@ -577,7 +577,7 @@ public class TJUnitTest {
|
||||
else tjc.compress(img, jpegBuf, flags);
|
||||
}
|
||||
else {
|
||||
tjc.setBitmapBuffer(bmpBuf, w, 0, h, pf);
|
||||
tjc.setSourceImage(bmpBuf, w, 0, h, pf);
|
||||
if(yuv == YUVENCODE) tjc.encodeYUV(jpegBuf, flags);
|
||||
else tjc.compress(jpegBuf, flags);
|
||||
}
|
||||
@@ -635,7 +635,7 @@ public class TJUnitTest {
|
||||
}
|
||||
|
||||
t = getTime();
|
||||
tjd.setJPEGBuffer(jpegBuf, jpegsize);
|
||||
tjd.setJPEGImage(jpegBuf, jpegsize);
|
||||
if(tjd.getWidth() != w || tjd.getHeight() != h
|
||||
|| tjd.getSubsamp() != subsamp)
|
||||
throw new Exception("Incorrect JPEG header");
|
||||
@@ -761,7 +761,7 @@ public class TJUnitTest {
|
||||
bmpBuf[i2 * 4 + 1] = pixels[i2 % 9][1];
|
||||
bmpBuf[i2 * 4 + 2] = pixels[i2 % 9][0];
|
||||
}
|
||||
tjc.setBitmapBuffer(bmpBuf, i, 0, j, TJ.PF_BGRX);
|
||||
tjc.setSourceImage(bmpBuf, i, 0, j, TJ.PF_BGRX);
|
||||
tjc.setSubsamp(TJ.SAMP_444);
|
||||
tjc.setJPEGQuality(100);
|
||||
tjc.compress(jpegBuf, 0);
|
||||
@@ -773,7 +773,7 @@ public class TJUnitTest {
|
||||
bmpBuf[i2 * 4 + 1] = bmpBuf[i2 * 4 + 2] = (byte)0xFF;
|
||||
else bmpBuf[i2 * 4] = bmpBuf[i2 * 4 + 1] = bmpBuf[i2 * 4 + 2] = 0;
|
||||
}
|
||||
tjc.setBitmapBuffer(bmpBuf, j, 0, i, TJ.PF_BGRX);
|
||||
tjc.setSourceImage(bmpBuf, j, 0, i, TJ.PF_BGRX);
|
||||
tjc.compress(jpegBuf, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc (build 1.6.0_22) on Tue Mar 15 15:50:55 CDT 2011 -->
|
||||
<!-- Generated by javadoc (build 1.6.0_22) on Tue Mar 15 18:44:49 CDT 2011 -->
|
||||
<TITLE>
|
||||
Index
|
||||
</TITLE>
|
||||
@@ -86,8 +86,8 @@ Static method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/tu
|
||||
image with the given width and height.
|
||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int)"><B>bufSizeYUV(int, int, int)</B></A> -
|
||||
Static method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
|
||||
<DD>Returns the size of the buffer required to hold a YUV planar image with
|
||||
the given width, height, and level of chrominance subsampling.
|
||||
<DD>Returns the size of the buffer (in bytes) required to hold a YUV planar
|
||||
image with the given width, height, and level of chrominance subsampling.
|
||||
</DL>
|
||||
<HR>
|
||||
<A NAME="_C_"><!-- --></A><H2>
|
||||
@@ -210,16 +210,18 @@ Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/
|
||||
<A NAME="_G_"><!-- --></A><H2>
|
||||
<B>G</B></H2>
|
||||
<DL>
|
||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#getBlueShift(int)"><B>getBlueShift(int)</B></A> -
|
||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#getBlueOffset(int)"><B>getBlueOffset(int)</B></A> -
|
||||
Static method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
|
||||
<DD>Returns the blue shift for the given pixel format.
|
||||
<DD>For the given pixel format, returns the number of bytes that the blue
|
||||
component is offset from the start of the pixel.
|
||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#getCompressedSize()"><B>getCompressedSize()</B></A> -
|
||||
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
|
||||
<DD>Returns the size of the image (in bytes) generated by the most recent
|
||||
compress/encode operation.
|
||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#getGreenShift(int)"><B>getGreenShift(int)</B></A> -
|
||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#getGreenOffset(int)"><B>getGreenOffset(int)</B></A> -
|
||||
Static method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
|
||||
<DD>Returns the green shift for the given pixel format.
|
||||
<DD>For the given pixel format, returns the number of bytes that the green
|
||||
component is offset from the start of the pixel.
|
||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getHeight()"><B>getHeight()</B></A> -
|
||||
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
|
||||
<DD>Returns the height of the JPEG image associated with this decompressor
|
||||
@@ -241,10 +243,11 @@ Static method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/tu
|
||||
subsampling.
|
||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#getPixelSize(int)"><B>getPixelSize(int)</B></A> -
|
||||
Static method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
|
||||
<DD>Returns the pixel size (in bytes) for the given pixel format.
|
||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#getRedShift(int)"><B>getRedShift(int)</B></A> -
|
||||
<DD>Returns the pixel size (in bytes) of the given pixel format.
|
||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#getRedOffset(int)"><B>getRedOffset(int)</B></A> -
|
||||
Static method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
|
||||
<DD>Returns the red shift for the given pixel format.
|
||||
<DD>For the given pixel format, returns the number of bytes that the red
|
||||
component is offset from the start of the pixel.
|
||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int, int)"><B>getScaledHeight(int, int)</B></A> -
|
||||
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
|
||||
<DD>Returns the height of the largest scaled down image that the TurboJPEG
|
||||
@@ -413,15 +416,16 @@ Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/
|
||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#SAMP_GRAY"><B>SAMP_GRAY</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>Grayscale.
|
||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#setBitmapBuffer(byte[], int, int, int, int)"><B>setBitmapBuffer(byte[], int, int, int, int)</B></A> -
|
||||
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
|
||||
<DD>Associate an uncompressed source image with this compressor instance.
|
||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGBuffer(byte[], int)"><B>setJPEGBuffer(byte[], int)</B></A> -
|
||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGImage(byte[], int)"><B>setJPEGImage(byte[], int)</B></A> -
|
||||
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
|
||||
<DD>Associate a JPEG image buffer with this decompressor instance.
|
||||
<DD>Associate the JPEG image of length <code>imageSize</code> bytes stored in
|
||||
<code>jpegImage</code> with this decompressor instance.
|
||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#setJPEGQuality(int)"><B>setJPEGQuality(int)</B></A> -
|
||||
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
|
||||
<DD>Set the JPEG image quality level for subsequent compress operations.
|
||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int)"><B>setSourceImage(byte[], int, int, int, int)</B></A> -
|
||||
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
|
||||
<DD>Associate an uncompressed source image with this compressor instance.
|
||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSubsamp(int)"><B>setSubsamp(int)</B></A> -
|
||||
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
|
||||
<DD>Set the level of chrominance subsampling for subsequent compress/encode
|
||||
@@ -443,7 +447,8 @@ Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/tur
|
||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[], int, int, int, int)"><B>TJCompressor(byte[], int, int, int, int)</B></A> -
|
||||
Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
|
||||
<DD>Create a TurboJPEG compressor instance and associate the uncompressed
|
||||
source image stored in <code>buf</code> with the newly-created instance.
|
||||
source image stored in <code>srcImage</code> with the newly-created
|
||||
instance.
|
||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><B>TJDecompressor</B></A> - Class in <A HREF="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</A><DD>TurboJPEG decompressor<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor()"><B>TJDecompressor()</B></A> -
|
||||
Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
|
||||
<DD>Create a TurboJPEG decompresssor instance.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc (build 1.6.0_22) on Tue Mar 15 15:50:54 CDT 2011 -->
|
||||
<!-- Generated by javadoc (build 1.6.0_22) on Tue Mar 15 18:44:49 CDT 2011 -->
|
||||
<TITLE>
|
||||
TJ
|
||||
</TITLE>
|
||||
@@ -341,24 +341,26 @@ TurboJPEG utility class (cannot be instantiated)
|
||||
int subsamp)</CODE>
|
||||
|
||||
<BR>
|
||||
Returns the size of the buffer required to hold a YUV planar image with
|
||||
the given width, height, and level of chrominance subsampling.</TD>
|
||||
Returns the size of the buffer (in bytes) required to hold a YUV planar
|
||||
image with the given width, height, and level of chrominance subsampling.</TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||
<CODE>static int</CODE></FONT></TD>
|
||||
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getBlueShift(int)">getBlueShift</A></B>(int pixelFormat)</CODE>
|
||||
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getBlueOffset(int)">getBlueOffset</A></B>(int pixelFormat)</CODE>
|
||||
|
||||
<BR>
|
||||
Returns the blue shift for the given pixel format.</TD>
|
||||
For the given pixel format, returns the number of bytes that the blue
|
||||
component is offset from the start of the pixel.</TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||
<CODE>static int</CODE></FONT></TD>
|
||||
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getGreenShift(int)">getGreenShift</A></B>(int pixelFormat)</CODE>
|
||||
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getGreenOffset(int)">getGreenOffset</A></B>(int pixelFormat)</CODE>
|
||||
|
||||
<BR>
|
||||
Returns the green shift for the given pixel format.</TD>
|
||||
For the given pixel format, returns the number of bytes that the green
|
||||
component is offset from the start of the pixel.</TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||
@@ -384,15 +386,16 @@ TurboJPEG utility class (cannot be instantiated)
|
||||
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getPixelSize(int)">getPixelSize</A></B>(int pixelFormat)</CODE>
|
||||
|
||||
<BR>
|
||||
Returns the pixel size (in bytes) for the given pixel format.</TD>
|
||||
Returns the pixel size (in bytes) of the given pixel format.</TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||
<CODE>static int</CODE></FONT></TD>
|
||||
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getRedShift(int)">getRedShift</A></B>(int pixelFormat)</CODE>
|
||||
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getRedOffset(int)">getRedOffset</A></B>(int pixelFormat)</CODE>
|
||||
|
||||
<BR>
|
||||
Returns the red shift for the given pixel format.</TD>
|
||||
For the given pixel format, returns the number of bytes that the red
|
||||
component is offset from the start of the pixel.</TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||
@@ -726,7 +729,8 @@ public static int <B>getMCUWidth</B>(int subsamp)
|
||||
subsampling.
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>subsamp</CODE> - the level of chrominance subsampling
|
||||
<DT><B>Parameters:</B><DD><CODE>subsamp</CODE> - the level of chrominance subsampling (one of
|
||||
<code>SAMP_*</code>)
|
||||
<DT><B>Returns:</B><DD>the MCU block width for the given level of chrominance subsampling
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
@@ -744,7 +748,8 @@ public static int <B>getMCUHeight</B>(int subsamp)
|
||||
subsampling.
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>subsamp</CODE> - the level of chrominance subsampling
|
||||
<DT><B>Parameters:</B><DD><CODE>subsamp</CODE> - the level of chrominance subsampling (one of
|
||||
<code>SAMP_*</code>)
|
||||
<DT><B>Returns:</B><DD>the MCU block height for the given level of chrominance
|
||||
subsampling
|
||||
<DT><B>Throws:</B>
|
||||
@@ -759,10 +764,10 @@ getPixelSize</H3>
|
||||
public static int <B>getPixelSize</B>(int pixelFormat)
|
||||
throws java.lang.Exception</PRE>
|
||||
<DL>
|
||||
<DD>Returns the pixel size (in bytes) for the given pixel format.
|
||||
<DD>Returns the pixel size (in bytes) of the given pixel format.
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>pixelFormat</CODE> - the pixel format
|
||||
<DT><B>Parameters:</B><DD><CODE>pixelFormat</CODE> - the pixel format (one of <code>PF_*</code>)
|
||||
<DT><B>Returns:</B><DD>the pixel size (in bytes) of the given pixel format
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
@@ -770,60 +775,63 @@ public static int <B>getPixelSize</B>(int pixelFormat)
|
||||
</DL>
|
||||
<HR>
|
||||
|
||||
<A NAME="getRedShift(int)"><!-- --></A><H3>
|
||||
getRedShift</H3>
|
||||
<A NAME="getRedOffset(int)"><!-- --></A><H3>
|
||||
getRedOffset</H3>
|
||||
<PRE>
|
||||
public static int <B>getRedShift</B>(int pixelFormat)
|
||||
throws java.lang.Exception</PRE>
|
||||
<DL>
|
||||
<DD>Returns the red shift for the given pixel format. For instance, if a
|
||||
pixel of format <code>TJ.PF_BGRX</code> is stored as an int, then the red
|
||||
component will be
|
||||
<code>(pixel >> TJ.getRedShift(TJ.PF_BGRX)) & 0xFF</code>.
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>pixelFormat</CODE> - the pixel format
|
||||
<DT><B>Returns:</B><DD>the red shift for the given pixel format
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
</DD>
|
||||
</DL>
|
||||
<HR>
|
||||
|
||||
<A NAME="getGreenShift(int)"><!-- --></A><H3>
|
||||
getGreenShift</H3>
|
||||
<PRE>
|
||||
public static int <B>getGreenShift</B>(int pixelFormat)
|
||||
throws java.lang.Exception</PRE>
|
||||
<DL>
|
||||
<DD>Returns the green shift for the given pixel format. For instance, if a
|
||||
pixel of format <code>TJ.PF_BGRX</code> is stored as an int, then the
|
||||
green component will be
|
||||
<code>(pixel >> TJ.getGreenShift(TJ.PF_BGRX)) & 0xFF</code>.
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>pixelFormat</CODE> - the pixel format
|
||||
<DT><B>Returns:</B><DD>the green shift for the given pixel format
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
</DD>
|
||||
</DL>
|
||||
<HR>
|
||||
|
||||
<A NAME="getBlueShift(int)"><!-- --></A><H3>
|
||||
getBlueShift</H3>
|
||||
<PRE>
|
||||
public static int <B>getBlueShift</B>(int pixelFormat)
|
||||
public static int <B>getRedOffset</B>(int pixelFormat)
|
||||
throws java.lang.Exception</PRE>
|
||||
<DL>
|
||||
<DD>Returns the blue shift for the given pixel format. For instance, if a
|
||||
pixel of format <code>TJ.PF_BGRX</code> is stored as an int, then the blue
|
||||
component will be
|
||||
<code>(pixel >> TJ.getBlueShift(TJ.PF_BGRX)) & 0xFF</code>.
|
||||
<DD>For the given pixel format, returns the number of bytes that the red
|
||||
component is offset from the start of the pixel. For instance, if a pixel
|
||||
of format <code>TJ.PF_BGRX</code> is stored in <code>char pixel[]</code>,
|
||||
then the red component will be
|
||||
<code>pixel[TJ.getRedOffset(TJ.PF_BGRX)]</code>.
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>pixelFormat</CODE> - the pixel format
|
||||
<DT><B>Returns:</B><DD>the blue shift for the given pixel format
|
||||
<DT><B>Parameters:</B><DD><CODE>pixelFormat</CODE> - the pixel format (one of <code>PF_*</code>)
|
||||
<DT><B>Returns:</B><DD>the red offset for the given pixel format
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
</DD>
|
||||
</DL>
|
||||
<HR>
|
||||
|
||||
<A NAME="getGreenOffset(int)"><!-- --></A><H3>
|
||||
getGreenOffset</H3>
|
||||
<PRE>
|
||||
public static int <B>getGreenOffset</B>(int pixelFormat)
|
||||
throws java.lang.Exception</PRE>
|
||||
<DL>
|
||||
<DD>For the given pixel format, returns the number of bytes that the green
|
||||
component is offset from the start of the pixel. For instance, if a pixel
|
||||
of format <code>TJ.PF_BGRX</code> is stored in <code>char pixel[]</code>,
|
||||
then the green component will be
|
||||
<code>pixel[TJ.getGreenOffset(TJ.PF_BGRX)]</code>.
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>pixelFormat</CODE> - the pixel format (one of <code>PF_*</code>)
|
||||
<DT><B>Returns:</B><DD>the green offset for the given pixel format
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
</DD>
|
||||
</DL>
|
||||
<HR>
|
||||
|
||||
<A NAME="getBlueOffset(int)"><!-- --></A><H3>
|
||||
getBlueOffset</H3>
|
||||
<PRE>
|
||||
public static int <B>getBlueOffset</B>(int pixelFormat)
|
||||
throws java.lang.Exception</PRE>
|
||||
<DL>
|
||||
<DD>For the given pixel format, returns the number of bytes that the blue
|
||||
component is offset from the start of the pixel. For instance, if a pixel
|
||||
of format <code>TJ.PF_BGRX</code> is stored in <code>char pixel[]</code>,
|
||||
then the blue component will be
|
||||
<code>pixel[TJ.getBlueOffset(TJ.PF_BGRX)]</code>.
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>pixelFormat</CODE> - the pixel format (one of <code>PF_*</code>)
|
||||
<DT><B>Returns:</B><DD>the blue offset for the given pixel format
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
</DD>
|
||||
@@ -858,14 +866,14 @@ public static int <B>bufSizeYUV</B>(int width,
|
||||
int subsamp)
|
||||
throws java.lang.Exception</PRE>
|
||||
<DL>
|
||||
<DD>Returns the size of the buffer required to hold a YUV planar image with
|
||||
the given width, height, and level of chrominance subsampling.
|
||||
<DD>Returns the size of the buffer (in bytes) required to hold a YUV planar
|
||||
image with the given width, height, and level of chrominance subsampling.
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>width</CODE> - the width (in pixels) of the YUV image<DD><CODE>height</CODE> - the height (in pixels) of the YUV image<DD><CODE>subsamp</CODE> - the level of chrominance subsampling used in the YUV
|
||||
image
|
||||
<DT><B>Returns:</B><DD>the size of the buffer required to hold a YUV planar image with
|
||||
the given width, height, and level of chrominance subsampling
|
||||
<DT><B>Returns:</B><DD>the size of the buffer (in bytes) required to hold a YUV planar
|
||||
image with the given width, height, and level of chrominance subsampling
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
</DD>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc (build 1.6.0_22) on Tue Mar 15 15:50:54 CDT 2011 -->
|
||||
<!-- Generated by javadoc (build 1.6.0_22) on Tue Mar 15 18:44:49 CDT 2011 -->
|
||||
<TITLE>
|
||||
TJCompressor
|
||||
</TITLE>
|
||||
@@ -122,7 +122,7 @@ TurboJPEG compressor
|
||||
Create a TurboJPEG compressor instance.</TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[], int, int, int, int)">TJCompressor</A></B>(byte[] buf,
|
||||
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[], int, int, int, int)">TJCompressor</A></B>(byte[] srcImage,
|
||||
int width,
|
||||
int pitch,
|
||||
int height,
|
||||
@@ -130,7 +130,8 @@ TurboJPEG compressor
|
||||
|
||||
<BR>
|
||||
Create a TurboJPEG compressor instance and associate the uncompressed
|
||||
source image stored in <code>buf</code> with the newly-created instance.</TD>
|
||||
source image stored in <code>srcImage</code> with the newly-created
|
||||
instance.</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
@@ -250,18 +251,6 @@ TurboJPEG compressor
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||
<CODE> void</CODE></FONT></TD>
|
||||
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setBitmapBuffer(byte[], int, int, int, int)">setBitmapBuffer</A></B>(byte[] buf,
|
||||
int width,
|
||||
int pitch,
|
||||
int height,
|
||||
int pixelFormat)</CODE>
|
||||
|
||||
<BR>
|
||||
Associate an uncompressed source image with this compressor instance.</TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||
<CODE> void</CODE></FONT></TD>
|
||||
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setJPEGQuality(int)">setJPEGQuality</A></B>(int quality)</CODE>
|
||||
|
||||
<BR>
|
||||
@@ -270,6 +259,18 @@ TurboJPEG compressor
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||
<CODE> void</CODE></FONT></TD>
|
||||
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int)">setSourceImage</A></B>(byte[] srcImage,
|
||||
int width,
|
||||
int pitch,
|
||||
int height,
|
||||
int pixelFormat)</CODE>
|
||||
|
||||
<BR>
|
||||
Associate an uncompressed source image with this compressor instance.</TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||
<CODE> void</CODE></FONT></TD>
|
||||
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSubsamp(int)">setSubsamp</A></B>(int newSubsamp)</CODE>
|
||||
|
||||
<BR>
|
||||
@@ -317,7 +318,7 @@ public <B>TJCompressor</B>()
|
||||
<A NAME="TJCompressor(byte[], int, int, int, int)"><!-- --></A><H3>
|
||||
TJCompressor</H3>
|
||||
<PRE>
|
||||
public <B>TJCompressor</B>(byte[] buf,
|
||||
public <B>TJCompressor</B>(byte[] srcImage,
|
||||
int width,
|
||||
int pitch,
|
||||
int height,
|
||||
@@ -325,10 +326,11 @@ public <B>TJCompressor</B>(byte[] buf,
|
||||
throws java.lang.Exception</PRE>
|
||||
<DL>
|
||||
<DD>Create a TurboJPEG compressor instance and associate the uncompressed
|
||||
source image stored in <code>buf</code> with the newly-created instance.
|
||||
source image stored in <code>srcImage</code> with the newly-created
|
||||
instance.
|
||||
<P>
|
||||
<DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>buf</CODE> - see <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setBitmapBuffer(byte[], int, int, int, int)"><CODE>setBitmapBuffer(byte[], int, int, int, int)</CODE></A> for description<DD><CODE>width</CODE> - see <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setBitmapBuffer(byte[], int, int, int, int)"><CODE>setBitmapBuffer(byte[], int, int, int, int)</CODE></A> for description<DD><CODE>pitch</CODE> - see <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setBitmapBuffer(byte[], int, int, int, int)"><CODE>setBitmapBuffer(byte[], int, int, int, int)</CODE></A> for description<DD><CODE>height</CODE> - see <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setBitmapBuffer(byte[], int, int, int, int)"><CODE>setBitmapBuffer(byte[], int, int, int, int)</CODE></A> for description<DD><CODE>pixelFormat</CODE> - see <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setBitmapBuffer(byte[], int, int, int, int)"><CODE>setBitmapBuffer(byte[], int, int, int, int)</CODE></A> for description
|
||||
<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - see <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int)"><CODE>setSourceImage(byte[], int, int, int, int)</CODE></A> for description<DD><CODE>width</CODE> - see <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int)"><CODE>setSourceImage(byte[], int, int, int, int)</CODE></A> for description<DD><CODE>pitch</CODE> - see <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int)"><CODE>setSourceImage(byte[], int, int, int, int)</CODE></A> for description<DD><CODE>height</CODE> - see <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int)"><CODE>setSourceImage(byte[], int, int, int, int)</CODE></A> for description<DD><CODE>pixelFormat</CODE> - see <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int)"><CODE>setSourceImage(byte[], int, int, int, int)</CODE></A> for description
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
</DL>
|
||||
@@ -343,20 +345,20 @@ public <B>TJCompressor</B>(byte[] buf,
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<A NAME="setBitmapBuffer(byte[], int, int, int, int)"><!-- --></A><H3>
|
||||
setBitmapBuffer</H3>
|
||||
<A NAME="setSourceImage(byte[], int, int, int, int)"><!-- --></A><H3>
|
||||
setSourceImage</H3>
|
||||
<PRE>
|
||||
public void <B>setBitmapBuffer</B>(byte[] buf,
|
||||
int width,
|
||||
int pitch,
|
||||
int height,
|
||||
int pixelFormat)
|
||||
throws java.lang.Exception</PRE>
|
||||
public void <B>setSourceImage</B>(byte[] srcImage,
|
||||
int width,
|
||||
int pitch,
|
||||
int height,
|
||||
int pixelFormat)
|
||||
throws java.lang.Exception</PRE>
|
||||
<DL>
|
||||
<DD>Associate an uncompressed source image with this compressor instance.
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>buf</CODE> - image buffer containing RGB or grayscale pixels to be
|
||||
<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - image buffer containing RGB or grayscale pixels to be
|
||||
compressed<DD><CODE>width</CODE> - width (in pixels) of the source image<DD><CODE>pitch</CODE> - bytes per line of the source image. Normally, this should be
|
||||
<code>width * TJ.pixelSize(pixelFormat)</code> if the source image is
|
||||
unpadded, but you can use this parameter to, for instance, specify that
|
||||
@@ -364,8 +366,8 @@ public void <B>setBitmapBuffer</B>(byte[] buf,
|
||||
the case for Windows bitmaps. You can also be clever and use this
|
||||
parameter to skip lines, etc. Setting this parameter to 0 is the
|
||||
equivalent of setting it to <code>width *
|
||||
TJ.pixelSize(pixelFormat)</code>.<DD><CODE>height</CODE> - height (in pixels) of the source image<DD><CODE>pixelFormat</CODE> - pixel format of the source image (see
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>)
|
||||
TJ.pixelSize(pixelFormat)</code>.<DD><CODE>height</CODE> - height (in pixels) of the source image<DD><CODE>pixelFormat</CODE> - pixel format of the source image (one of
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.PF_*</CODE></A>)
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
</DD>
|
||||
@@ -382,8 +384,8 @@ public void <B>setSubsamp</B>(int newSubsamp)
|
||||
operations.
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>newSubsamp</CODE> - the new level of chrominance subsampling (see
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>)
|
||||
<DT><B>Parameters:</B><DD><CODE>newSubsamp</CODE> - the new level of chrominance subsampling (one of
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.SAMP_*</CODE></A>)
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
</DD>
|
||||
@@ -420,8 +422,7 @@ public void <B>compress</B>(byte[] dstBuf,
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>dstBuf</CODE> - buffer which will receive the JPEG image. Use
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSize(int, int)"><CODE>TJ.bufSize(int, int)</CODE></A> to determine the maximum size for this buffer based on
|
||||
the image width and height.<DD><CODE>flags</CODE> - the bitwise OR of one or more of the flags described in
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
|
||||
the image width and height.<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
</DD>
|
||||
@@ -438,8 +439,7 @@ public byte[] <B>compress</B>(int flags)
|
||||
instance and return a buffer containing a JPEG image.
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>flags</CODE> - the bitwise OR of one or more of the flags described in
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
|
||||
<DT><B>Parameters:</B><DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
|
||||
<DT><B>Returns:</B><DD>a buffer containing a JPEG image. The length of this buffer will
|
||||
not be equal to the size of the JPEG image. Use <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#getCompressedSize()"><CODE>getCompressedSize()</CODE></A> to obtain the size of the JPEG image.
|
||||
<DT><B>Throws:</B>
|
||||
@@ -463,8 +463,7 @@ public void <B>compress</B>(java.awt.image.BufferedImage srcImage,
|
||||
<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - a <code>BufferedImage</code> instance containing RGB or
|
||||
grayscale pixels to be compressed<DD><CODE>dstBuf</CODE> - buffer which will receive the JPEG image. Use
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSize(int, int)"><CODE>TJ.bufSize(int, int)</CODE></A> to determine the maximum size for this buffer based on
|
||||
the image width and height.<DD><CODE>flags</CODE> - the bitwise OR of one or more of the flags described in
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
|
||||
the image width and height.<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
</DD>
|
||||
@@ -483,8 +482,7 @@ public byte[] <B>compress</B>(java.awt.image.BufferedImage srcImage,
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - a <code>BufferedImage</code> instance containing RGB or
|
||||
grayscale pixels to be compressed<DD><CODE>flags</CODE> - the bitwise OR of one or more of the flags described in
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
|
||||
grayscale pixels to be compressed<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
|
||||
<DT><B>Returns:</B><DD>a buffer containing a JPEG image. The length of this buffer will
|
||||
not be equal to the size of the JPEG image. Use <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#getCompressedSize()"><CODE>getCompressedSize()</CODE></A> to obtain the size of the JPEG image.
|
||||
<DT><B>Throws:</B>
|
||||
@@ -502,7 +500,7 @@ public void <B>encodeYUV</B>(byte[] dstBuf,
|
||||
<DL>
|
||||
<DD>Encode the uncompressed source image associated with this compressor
|
||||
instance and output a YUV planar image to the given destination buffer.
|
||||
This function uses the accelerated color conversion routines in
|
||||
This method uses the accelerated color conversion routines in
|
||||
TurboJPEG's underlying codec to produce a planar YUV image that is
|
||||
suitable for direct video display. Specifically, if the chrominance
|
||||
components are subsampled along the horizontal dimension, then the width
|
||||
@@ -517,8 +515,7 @@ public void <B>encodeYUV</B>(byte[] dstBuf,
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>dstBuf</CODE> - buffer which will receive the YUV planar image. Use
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int)"><CODE>TJ.bufSizeYUV(int, int, int)</CODE></A> to determine the appropriate size for this buffer
|
||||
based on the image width, height, and level of chrominance subsampling.<DD><CODE>flags</CODE> - the bitwise OR of one or more of the flags described in
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
|
||||
based on the image width, height, and level of chrominance subsampling.<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
</DD>
|
||||
@@ -536,8 +533,7 @@ public byte[] <B>encodeYUV</B>(int flags)
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[], int)"><CODE>encodeYUV(byte[], int)</CODE></A> for more detail.
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>flags</CODE> - the bitwise OR of one or more of the flags described in
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
|
||||
<DT><B>Parameters:</B><DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
|
||||
<DT><B>Returns:</B><DD>a buffer containing a YUV planar image
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
@@ -561,8 +557,7 @@ public void <B>encodeYUV</B>(java.awt.image.BufferedImage srcImage,
|
||||
<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - a <code>BufferedImage</code> instance containing RGB or
|
||||
grayscale pixels to be encoded<DD><CODE>dstBuf</CODE> - buffer which will receive the YUV planar image. Use
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int)"><CODE>TJ.bufSizeYUV(int, int, int)</CODE></A> to determine the appropriate size for this buffer
|
||||
based on the image width, height, and level of chrominance subsampling.<DD><CODE>flags</CODE> - the bitwise OR of one or more of the flags described in
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
|
||||
based on the image width, height, and level of chrominance subsampling.<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
</DD>
|
||||
@@ -582,8 +577,7 @@ public byte[] <B>encodeYUV</B>(java.awt.image.BufferedImage srcImage,
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - a <code>BufferedImage</code> instance containing RGB or
|
||||
grayscale pixels to be encoded<DD><CODE>flags</CODE> - the bitwise OR of one or more of the flags described in
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
|
||||
grayscale pixels to be encoded<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
|
||||
<DT><B>Returns:</B><DD>a buffer containing a YUV planar image
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc (build 1.6.0_22) on Tue Mar 15 15:50:55 CDT 2011 -->
|
||||
<!-- Generated by javadoc (build 1.6.0_22) on Tue Mar 15 18:44:49 CDT 2011 -->
|
||||
<TITLE>
|
||||
TJDecompressor
|
||||
</TITLE>
|
||||
@@ -362,11 +362,12 @@ TurboJPEG decompressor
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||
<CODE> void</CODE></FONT></TD>
|
||||
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGBuffer(byte[], int)">setJPEGBuffer</A></B>(byte[] jpegImage,
|
||||
int imageSize)</CODE>
|
||||
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGImage(byte[], int)">setJPEGImage</A></B>(byte[] jpegImage,
|
||||
int imageSize)</CODE>
|
||||
|
||||
<BR>
|
||||
Associate a JPEG image buffer with this decompressor instance.</TD>
|
||||
Associate the JPEG image of length <code>imageSize</code> bytes stored in
|
||||
<code>jpegImage</code> with this decompressor instance.</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
|
||||
@@ -485,8 +486,8 @@ public <B>TJDecompressor</B>(byte[] jpegImage)
|
||||
stored in <code>jpegImage</code> with the newly-created instance.
|
||||
<P>
|
||||
<DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>jpegImage</CODE> - JPEG image buffer (size of JPEG image is assumed to be
|
||||
the length of the buffer)
|
||||
<DT><B>Parameters:</B><DD><CODE>jpegImage</CODE> - JPEG image buffer (size of the JPEG image is assumed to
|
||||
be the length of the array)
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
</DL>
|
||||
@@ -504,7 +505,7 @@ public <B>TJDecompressor</B>(byte[] jpegImage,
|
||||
with the newly-created instance.
|
||||
<P>
|
||||
<DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>jpegImage</CODE> - JPEG image buffer<DD><CODE>imageSize</CODE> - size of JPEG image (in bytes)
|
||||
<DT><B>Parameters:</B><DD><CODE>jpegImage</CODE> - JPEG image buffer<DD><CODE>imageSize</CODE> - size of the JPEG image (in bytes)
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
</DL>
|
||||
@@ -519,19 +520,19 @@ public <B>TJDecompressor</B>(byte[] jpegImage,
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<A NAME="setJPEGBuffer(byte[], int)"><!-- --></A><H3>
|
||||
setJPEGBuffer</H3>
|
||||
<A NAME="setJPEGImage(byte[], int)"><!-- --></A><H3>
|
||||
setJPEGImage</H3>
|
||||
<PRE>
|
||||
public void <B>setJPEGBuffer</B>(byte[] jpegImage,
|
||||
int imageSize)
|
||||
throws java.lang.Exception</PRE>
|
||||
public void <B>setJPEGImage</B>(byte[] jpegImage,
|
||||
int imageSize)
|
||||
throws java.lang.Exception</PRE>
|
||||
<DL>
|
||||
<DD>Associate a JPEG image buffer with this decompressor instance. This
|
||||
buffer will be used as the source buffer for subsequent decompress
|
||||
operations.
|
||||
<DD>Associate the JPEG image of length <code>imageSize</code> bytes stored in
|
||||
<code>jpegImage</code> with this decompressor instance. This image will
|
||||
be used as the source image for subsequent decompress operations.
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>jpegImage</CODE> - JPEG image buffer<DD><CODE>imageSize</CODE> - size of JPEG image (in bytes)
|
||||
<DT><B>Parameters:</B><DD><CODE>jpegImage</CODE> - JPEG image buffer<DD><CODE>imageSize</CODE> - size of the JPEG image (in bytes)
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
</DD>
|
||||
@@ -644,10 +645,12 @@ public int <B>getScaledWidth</B>(int desiredWidth,
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>desiredWidth</CODE> - desired width (in pixels) of the decompressed image.
|
||||
If this is set to 0, then only the height will be considered when
|
||||
determining the scaled image size.<DD><CODE>desiredHeight</CODE> - desired height (in pixels) of the decompressed image.
|
||||
If this is set to 0, then only the width will be considered when
|
||||
determining the scaled image size.
|
||||
Setting this to 0 is the same as setting it to the width of the JPEG image
|
||||
(in other words, the width will not be considered when determining the
|
||||
scaled image size.)<DD><CODE>desiredHeight</CODE> - desired height (in pixels) of the decompressed image.
|
||||
Setting this to 0 is the same as setting it to the height of the JPEG
|
||||
image (in other words, the height will not be considered when determining
|
||||
the scaled image size.)
|
||||
<DT><B>Returns:</B><DD>the width of the largest scaled down image that the TurboJPEG
|
||||
decompressor can generate without exceeding the desired image width and
|
||||
height
|
||||
@@ -670,10 +673,12 @@ public int <B>getScaledHeight</B>(int desiredWidth,
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>desiredWidth</CODE> - desired width (in pixels) of the decompressed image.
|
||||
If this is set to 0, then only the height will be considered when
|
||||
determining the scaled image size.<DD><CODE>desiredHeight</CODE> - desired height (in pixels) of the decompressed image.
|
||||
If this is set to 0, then only the width will be considered when
|
||||
determining the scaled image size.
|
||||
Setting this to 0 is the same as setting it to the width of the JPEG image
|
||||
(in other words, the width will not be considered when determining the
|
||||
scaled image size.)<DD><CODE>desiredHeight</CODE> - desired height (in pixels) of the decompressed image.
|
||||
Setting this to 0 is the same as setting it to the height of the JPEG
|
||||
image (in other words, the height will not be considered when determining
|
||||
the scaled image size.)
|
||||
<DT><B>Returns:</B><DD>the height of the largest scaled down image that the TurboJPEG
|
||||
decompressor can generate without exceeding the desired image width and
|
||||
height
|
||||
@@ -705,21 +710,22 @@ public void <B>decompress</B>(byte[] dstBuf,
|
||||
If the desired image dimensions are smaller than the dimensions of the
|
||||
JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG
|
||||
decompressor to generate the largest possible image that will fit within
|
||||
the desired dimensions. If desiredWidth is set to 0, then only the height
|
||||
will be considered when determining the scaled image size.<DD><CODE>pitch</CODE> - bytes per line of the destination image. Normally, this
|
||||
the desired dimensions. Setting this to 0 is the same as setting it to
|
||||
the width of the JPEG image (in other words, the width will not be
|
||||
considered when determining the scaled image size.)<DD><CODE>pitch</CODE> - bytes per line of the destination image. Normally, this
|
||||
should be set to <code>scaledWidth * TJ.pixelSize(pixelFormat)</code> if
|
||||
the decompressed image is unpadded, but you can use this to, for instance,
|
||||
pad each line of the decompressed image to a 4-byte boundary. NOTE:
|
||||
<code>scaledWidth = ceil(jpegWidth * scalingFactor)</code>. Setting this
|
||||
parameter to 0 is the equivalent of setting it to
|
||||
<code>scaledWidth * pixelSize</code>.<DD><CODE>desiredHeight</CODE> - desired height (in pixels) of the decompressed image.
|
||||
<code>scaledWidth * TJ.pixelSize(pixelFormat)</code>.<DD><CODE>desiredHeight</CODE> - desired height (in pixels) of the decompressed image.
|
||||
If the desired image dimensions are smaller than the dimensions of the
|
||||
JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG
|
||||
decompressor to generate the largest possible image that will fit within
|
||||
the desired dimensions. If desiredHeight is set to 0, then only the
|
||||
width will be considered when determining the scaled image size.<DD><CODE>pixelFormat</CODE> - Pixel format of the decompressed image (see
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>)<DD><CODE>flags</CODE> - the bitwise OR of one or more of the flags described in
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
|
||||
the desired dimensions. Setting this to 0 is the same as setting it to
|
||||
the height of the JPEG image (in other words, the height will not be
|
||||
considered when determining the scaled image size.)<DD><CODE>pixelFormat</CODE> - pixel format of the decompressed image (one of
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.PF_*</CODE></A>)<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
</DD>
|
||||
@@ -743,9 +749,8 @@ public byte[] <B>decompress</B>(int desiredWidth,
|
||||
<DT><B>Parameters:</B><DD><CODE>desiredWidth</CODE> - see
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)"><CODE>decompress(byte[], int, int, int, int, int)</CODE></A> for description<DD><CODE>pitch</CODE> - see
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)"><CODE>decompress(byte[], int, int, int, int, int)</CODE></A> for description<DD><CODE>desiredHeight</CODE> - see
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)"><CODE>decompress(byte[], int, int, int, int, int)</CODE></A> for description<DD><CODE>pixelFormat</CODE> - Pixel format of the decompressed image (see
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>)<DD><CODE>flags</CODE> - the bitwise OR of one or more of the flags described in
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)"><CODE>decompress(byte[], int, int, int, int, int)</CODE></A> for description<DD><CODE>pixelFormat</CODE> - pixel format of the decompressed image (one of
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.PF_*</CODE></A>)<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
|
||||
<DT><B>Returns:</B><DD>a buffer containing the decompressed image
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
@@ -773,8 +778,7 @@ public void <B>decompressToYUV</B>(byte[] dstBuf,
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>dstBuf</CODE> - buffer which will receive the YUV planar image. Use
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int)"><CODE>TJ.bufSizeYUV(int, int, int)</CODE></A> to determine the appropriate size for this buffer
|
||||
based on the image width, height, and level of chrominance subsampling.<DD><CODE>flags</CODE> - the bitwise OR of one or more of the flags described in
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
|
||||
based on the image width, height, and level of chrominance subsampling.<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
</DD>
|
||||
@@ -791,8 +795,7 @@ public byte[] <B>decompressToYUV</B>(int flags)
|
||||
instance and return a buffer containing a YUV planar image. See <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int)"><CODE>decompressToYUV(byte[], int)</CODE></A> for more detail.
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>flags</CODE> - the bitwise OR of one or more of the flags described in
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
|
||||
<DT><B>Parameters:</B><DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
|
||||
<DT><B>Returns:</B><DD>a buffer containing a YUV planar image
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
@@ -813,8 +816,7 @@ public void <B>decompress</B>(java.awt.image.BufferedImage dstImage,
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>dstImage</CODE> - a <code>BufferedImage</code> instance which will receive
|
||||
the decompressed image<DD><CODE>flags</CODE> - the bitwise OR of one or more of the flags described in
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
|
||||
the decompressed image<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
</DD>
|
||||
@@ -837,9 +839,9 @@ public java.awt.image.BufferedImage <B>decompress</B>(int desiredWidth,
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>desiredWidth</CODE> - see
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)"><CODE>decompress(byte[], int, int, int, int, int)</CODE></A> for description<DD><CODE>desiredHeight</CODE> - see
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)"><CODE>decompress(byte[], int, int, int, int, int)</CODE></A> for description<DD><CODE>bufferedImageType</CODE> - the image type of the <code>BufferedImage</code>
|
||||
instance to create (for instance, <code>BufferedImage.TYPE_INT_RGB</code>)<DD><CODE>flags</CODE> - the bitwise OR of one or more of the flags described in
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)"><CODE>decompress(byte[], int, int, int, int, int)</CODE></A> for description<DD><CODE>bufferedImageType</CODE> - the image type of the newly-created
|
||||
<code>BufferedImage</code> instance (for instance,
|
||||
<code>BufferedImage.TYPE_INT_RGB</code>)<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
|
||||
<DT><B>Returns:</B><DD>a <code>BufferedImage</code> instance containing the
|
||||
decompressed image
|
||||
<DT><B>Throws:</B>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc (build 1.6.0_22) on Tue Mar 15 15:50:55 CDT 2011 -->
|
||||
<!-- Generated by javadoc (build 1.6.0_22) on Tue Mar 15 18:44:49 CDT 2011 -->
|
||||
<TITLE>
|
||||
TJTransform
|
||||
</TITLE>
|
||||
@@ -649,8 +649,8 @@ public <B>TJTransform</B>(java.awt.Rectangle r,
|
||||
<P>
|
||||
<DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>r</CODE> - a <code>Rectangle</code> instance which specifies the cropping
|
||||
region. See <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#TJTransform(int, int, int, int, int, int)"><CODE>TJTransform(int, int, int, int, int, int)</CODE></A> for a
|
||||
description of the cropping region.<DD><CODE>op</CODE> - one of the transform operations (<code>OP_*</code>)<DD><CODE>options</CODE> - the bitwise OR of one or more of the transform options
|
||||
region. See <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#TJTransform(int, int, int, int, int, int)"><CODE>TJTransform(int, int, int, int, int, int)</CODE></A> for more
|
||||
detail.<DD><CODE>op</CODE> - one of the transform operations (<code>OP_*</code>)<DD><CODE>options</CODE> - the bitwise OR of one or more of the transform options
|
||||
(<code>OPT_*</code>)
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc (build 1.6.0_22) on Tue Mar 15 15:50:55 CDT 2011 -->
|
||||
<!-- Generated by javadoc (build 1.6.0_22) on Tue Mar 15 18:44:49 CDT 2011 -->
|
||||
<TITLE>
|
||||
TJTransformer
|
||||
</TITLE>
|
||||
@@ -205,7 +205,7 @@ TurboJPEG lossless transformer
|
||||
<TH ALIGN="left"><B>Methods inherited from class org.libjpegturbo.turbojpeg.<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A></B></TH>
|
||||
</TR>
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD><CODE><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#close()">close</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(java.awt.image.BufferedImage, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int, int, int, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int, int, int, int, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int)">decompressToYUV</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int)">decompressToYUV</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#finalize()">finalize</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getHeight()">getHeight</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGBuf()">getJPEGBuf</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGSize()">getJPEGSize</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int, int)">getScaledHeight</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int, int)">getScaledWidth</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSubsamp()">getSubsamp</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getWidth()">getWidth</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGBuffer(byte[], int)">setJPEGBuffer</A></CODE></TD>
|
||||
<TD><CODE><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#close()">close</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(java.awt.image.BufferedImage, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int, int, int, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int, int, int, int, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int)">decompressToYUV</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int)">decompressToYUV</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#finalize()">finalize</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getHeight()">getHeight</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGBuf()">getJPEGBuf</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGSize()">getJPEGSize</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int, int)">getScaledHeight</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int, int)">getScaledWidth</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSubsamp()">getSubsamp</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getWidth()">getWidth</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGImage(byte[], int)">setJPEGImage</A></CODE></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
|
||||
@@ -255,8 +255,8 @@ public <B>TJTransformer</B>(byte[] jpegImage)
|
||||
image stored in <code>jpegImage</code> with the newly-created instance.
|
||||
<P>
|
||||
<DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>jpegImage</CODE> - JPEG image buffer (size of JPEG image is assumed to be
|
||||
the length of the buffer)
|
||||
<DT><B>Parameters:</B><DD><CODE>jpegImage</CODE> - JPEG image buffer (size of the JPEG image is assumed to
|
||||
be the length of the array)
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
</DL>
|
||||
@@ -274,7 +274,7 @@ public <B>TJTransformer</B>(byte[] jpegImage,
|
||||
<code>jpegImage</code> with the newly-created instance.
|
||||
<P>
|
||||
<DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>jpegImage</CODE> - JPEG image buffer<DD><CODE>imageSize</CODE> - size of JPEG image (in bytes)
|
||||
<DT><B>Parameters:</B><DD><CODE>jpegImage</CODE> - JPEG image buffer<DD><CODE>imageSize</CODE> - size of the JPEG image (in bytes)
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
</DL>
|
||||
@@ -305,19 +305,18 @@ public void <B>transform</B>(byte[][] dstBufs,
|
||||
image, transforming it, and re-compressing it, lossless transforms are not
|
||||
free. Each lossless transform requires reading and Huffman decoding all
|
||||
of the coefficients in the source image, regardless of the size of the
|
||||
destination image. Thus, this function provides a means of generating
|
||||
destination image. Thus, this method provides a means of generating
|
||||
multiple transformed images from the same source or of applying multiple
|
||||
transformations simultaneously, in order to eliminate the need to read the
|
||||
source coefficients multiple times.
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>dstBufs</CODE> - an array of n image buffers. <code>dstbufs[i]</code> will
|
||||
<DT><B>Parameters:</B><DD><CODE>dstBufs</CODE> - an array of image buffers. <code>dstbufs[i]</code> will
|
||||
receive a JPEG image that has been transformed using the parameters in
|
||||
<code>transforms[i]</code>. Use <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int)"><CODE>TJ.bufSizeYUV(int, int, int)</CODE></A> to determine the
|
||||
maximum size for each buffer based on the cropped width and height.<DD><CODE>transforms</CODE> - an array of n <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJTransform</CODE></A> instances, each of
|
||||
<code>transforms[i]</code>. Use <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSize(int, int)"><CODE>TJ.bufSize(int, int)</CODE></A> to determine the
|
||||
maximum size for each buffer based on the cropped width and height.<DD><CODE>transforms</CODE> - an array of <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJTransform</CODE></A> instances, each of
|
||||
which specifies the transform parameters and/or cropping region for the
|
||||
corresponding transformed output image<DD><CODE>flags</CODE> - the bitwise OR of one or more of the flags described in
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
|
||||
corresponding transformed output image<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
</DD>
|
||||
@@ -336,10 +335,9 @@ public <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="
|
||||
which has a transformed JPEG image associated with it.
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>transforms</CODE> - an array of n <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJTransform</CODE></A> instances, each of
|
||||
<DT><B>Parameters:</B><DD><CODE>transforms</CODE> - an array of <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJTransform</CODE></A> instances, each of
|
||||
which specifies the transform parameters and/or cropping region for the
|
||||
corresponding transformed output image<DD><CODE>flags</CODE> - the bitwise OR of one or more of the flags described in
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
|
||||
corresponding transformed output image<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
|
||||
<DT><B>Returns:</B><DD>an array of <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJDecompressor</CODE></A> instances, each of
|
||||
which has a transformed JPEG image associated with it
|
||||
<DT><B>Throws:</B>
|
||||
|
||||
@@ -84,7 +84,8 @@ final public class TJ {
|
||||
* Returns the MCU block width for the given level of chrominance
|
||||
* subsampling.
|
||||
*
|
||||
* @param subsamp the level of chrominance subsampling
|
||||
* @param subsamp the level of chrominance subsampling (one of
|
||||
* <code>SAMP_*</code>)
|
||||
*
|
||||
* @return the MCU block width for the given level of chrominance subsampling
|
||||
*/
|
||||
@@ -103,7 +104,8 @@ final public class TJ {
|
||||
* Returns the MCU block height for the given level of chrominance
|
||||
* subsampling.
|
||||
*
|
||||
* @param subsamp the level of chrominance subsampling
|
||||
* @param subsamp the level of chrominance subsampling (one of
|
||||
* <code>SAMP_*</code>)
|
||||
*
|
||||
* @return the MCU block height for the given level of chrominance
|
||||
* subsampling
|
||||
@@ -167,8 +169,10 @@ final public class TJ {
|
||||
|
||||
|
||||
/**
|
||||
* Returns the pixel size (in bytes) for the given pixel format.
|
||||
* @param pixelFormat the pixel format
|
||||
* Returns the pixel size (in bytes) of the given pixel format.
|
||||
*
|
||||
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
||||
*
|
||||
* @return the pixel size (in bytes) of the given pixel format
|
||||
*/
|
||||
public static int getPixelSize(int pixelFormat) throws Exception {
|
||||
@@ -183,65 +187,68 @@ final public class TJ {
|
||||
|
||||
|
||||
/**
|
||||
* Returns the red shift for the given pixel format. For instance, if a
|
||||
* pixel of format <code>TJ.PF_BGRX</code> is stored as an int, then the red
|
||||
* component will be
|
||||
* <code>(pixel >> TJ.getRedShift(TJ.PF_BGRX)) & 0xFF</code>.
|
||||
* For the given pixel format, returns the number of bytes that the red
|
||||
* component is offset from the start of the pixel. For instance, if a pixel
|
||||
* of format <code>TJ.PF_BGRX</code> is stored in <code>char pixel[]</code>,
|
||||
* then the red component will be
|
||||
* <code>pixel[TJ.getRedOffset(TJ.PF_BGRX)]</code>.
|
||||
*
|
||||
* @param pixelFormat the pixel format
|
||||
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
||||
*
|
||||
* @return the red shift for the given pixel format
|
||||
* @return the red offset for the given pixel format
|
||||
*/
|
||||
public static int getRedShift(int pixelFormat) throws Exception {
|
||||
public static int getRedOffset(int pixelFormat) throws Exception {
|
||||
if(pixelFormat < 0 || pixelFormat >= NUMPF)
|
||||
throw new Exception("Invalid pixel format");
|
||||
return redShift[pixelFormat];
|
||||
return redOffset[pixelFormat];
|
||||
}
|
||||
|
||||
final private static int redShift[] = {
|
||||
0, 16, 0, 16, 24, 8, 0
|
||||
final private static int redOffset[] = {
|
||||
0, 2, 0, 2, 3, 1, 0
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns the green shift for the given pixel format. For instance, if a
|
||||
* pixel of format <code>TJ.PF_BGRX</code> is stored as an int, then the
|
||||
* green component will be
|
||||
* <code>(pixel >> TJ.getGreenShift(TJ.PF_BGRX)) & 0xFF</code>.
|
||||
* For the given pixel format, returns the number of bytes that the green
|
||||
* component is offset from the start of the pixel. For instance, if a pixel
|
||||
* of format <code>TJ.PF_BGRX</code> is stored in <code>char pixel[]</code>,
|
||||
* then the green component will be
|
||||
* <code>pixel[TJ.getGreenOffset(TJ.PF_BGRX)]</code>.
|
||||
*
|
||||
* @param pixelFormat the pixel format
|
||||
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
||||
*
|
||||
* @return the green shift for the given pixel format
|
||||
* @return the green offset for the given pixel format
|
||||
*/
|
||||
public static int getGreenShift(int pixelFormat) throws Exception {
|
||||
public static int getGreenOffset(int pixelFormat) throws Exception {
|
||||
if(pixelFormat < 0 || pixelFormat >= NUMPF)
|
||||
throw new Exception("Invalid pixel format");
|
||||
return greenShift[pixelFormat];
|
||||
return greenOffset[pixelFormat];
|
||||
}
|
||||
|
||||
final private static int greenShift[] = {
|
||||
8, 8, 8, 8, 16, 16, 0
|
||||
final private static int greenOffset[] = {
|
||||
1, 1, 1, 1, 2, 2, 0
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns the blue shift for the given pixel format. For instance, if a
|
||||
* pixel of format <code>TJ.PF_BGRX</code> is stored as an int, then the blue
|
||||
* component will be
|
||||
* <code>(pixel >> TJ.getBlueShift(TJ.PF_BGRX)) & 0xFF</code>.
|
||||
* For the given pixel format, returns the number of bytes that the blue
|
||||
* component is offset from the start of the pixel. For instance, if a pixel
|
||||
* of format <code>TJ.PF_BGRX</code> is stored in <code>char pixel[]</code>,
|
||||
* then the blue component will be
|
||||
* <code>pixel[TJ.getBlueOffset(TJ.PF_BGRX)]</code>.
|
||||
*
|
||||
* @param pixelFormat the pixel format
|
||||
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
||||
*
|
||||
* @return the blue shift for the given pixel format
|
||||
* @return the blue offset for the given pixel format
|
||||
*/
|
||||
public static int getBlueShift(int pixelFormat) throws Exception {
|
||||
public static int getBlueOffset(int pixelFormat) throws Exception {
|
||||
if(pixelFormat < 0 || pixelFormat >= NUMPF)
|
||||
throw new Exception("Invalid pixel format");
|
||||
return blueShift[pixelFormat];
|
||||
return blueOffset[pixelFormat];
|
||||
}
|
||||
|
||||
final private static int blueShift[] = {
|
||||
16, 0, 16, 0, 8, 24, 0
|
||||
final private static int blueOffset[] = {
|
||||
2, 0, 2, 0, 1, 3, 0
|
||||
};
|
||||
|
||||
|
||||
@@ -292,8 +299,8 @@ final public class TJ {
|
||||
throws Exception;
|
||||
|
||||
/**
|
||||
* Returns the size of the buffer required to hold a YUV planar image with
|
||||
* the given width, height, and level of chrominance subsampling.
|
||||
* Returns the size of the buffer (in bytes) required to hold a YUV planar
|
||||
* image with the given width, height, and level of chrominance subsampling.
|
||||
*
|
||||
* @param width the width (in pixels) of the YUV image
|
||||
*
|
||||
@@ -302,8 +309,8 @@ final public class TJ {
|
||||
* @param subsamp the level of chrominance subsampling used in the YUV
|
||||
* image
|
||||
*
|
||||
* @return the size of the buffer required to hold a YUV planar image with
|
||||
* the given width, height, and level of chrominance subsampling
|
||||
* @return the size of the buffer (in bytes) required to hold a YUV planar
|
||||
* image with the given width, height, and level of chrominance subsampling
|
||||
*/
|
||||
public native static int bufSizeYUV(int width, int height,
|
||||
int subsamp)
|
||||
|
||||
@@ -35,6 +35,9 @@ import java.awt.image.*;
|
||||
*/
|
||||
public class TJCompressor {
|
||||
|
||||
private final static String NO_ASSOC_ERROR =
|
||||
"No source image is associated with this instance";
|
||||
|
||||
/**
|
||||
* Create a TurboJPEG compressor instance.
|
||||
*/
|
||||
@@ -44,27 +47,28 @@ public class TJCompressor {
|
||||
|
||||
/**
|
||||
* Create a TurboJPEG compressor instance and associate the uncompressed
|
||||
* source image stored in <code>buf</code> with the newly-created instance.
|
||||
* source image stored in <code>srcImage</code> with the newly-created
|
||||
* instance.
|
||||
*
|
||||
* @param buf see {@link #setBitmapBuffer} for description
|
||||
* @param srcImage see {@link #setSourceImage} for description
|
||||
*
|
||||
* @param width see {@link #setBitmapBuffer} for description
|
||||
* @param width see {@link #setSourceImage} for description
|
||||
*
|
||||
* @param pitch see {@link #setBitmapBuffer} for description
|
||||
* @param pitch see {@link #setSourceImage} for description
|
||||
*
|
||||
* @param height see {@link #setBitmapBuffer} for description
|
||||
* @param height see {@link #setSourceImage} for description
|
||||
*
|
||||
* @param pixelFormat see {@link #setBitmapBuffer} for description
|
||||
* @param pixelFormat see {@link #setSourceImage} for description
|
||||
*/
|
||||
public TJCompressor(byte[] buf, int width, int pitch, int height,
|
||||
public TJCompressor(byte[] srcImage, int width, int pitch, int height,
|
||||
int pixelFormat) throws Exception {
|
||||
setBitmapBuffer(buf, width, pitch, height, pixelFormat);
|
||||
setSourceImage(srcImage, width, pitch, height, pixelFormat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate an uncompressed source image with this compressor instance.
|
||||
*
|
||||
* @param buf image buffer containing RGB or grayscale pixels to be
|
||||
* @param srcImage image buffer containing RGB or grayscale pixels to be
|
||||
* compressed
|
||||
*
|
||||
* @param width width (in pixels) of the source image
|
||||
@@ -80,32 +84,32 @@ public class TJCompressor {
|
||||
*
|
||||
* @param height height (in pixels) of the source image
|
||||
*
|
||||
* @param pixelFormat pixel format of the source image (see
|
||||
* {@link TJ})
|
||||
* @param pixelFormat pixel format of the source image (one of
|
||||
* {@link TJ TJ.PF_*})
|
||||
*/
|
||||
public void setBitmapBuffer(byte[] buf, int width, int pitch, int height,
|
||||
int pixelFormat) throws Exception {
|
||||
public void setSourceImage(byte[] srcImage, int width, int pitch,
|
||||
int height, int pixelFormat) throws Exception {
|
||||
if(handle == 0) init();
|
||||
if(buf == null || width < 1 || height < 1 || pitch < 0 || pixelFormat < 0
|
||||
|| pixelFormat >= TJ.NUMPFOPT)
|
||||
throw new Exception("Invalid argument in setBitmapBuffer()");
|
||||
bitmapBuf = buf;
|
||||
bitmapWidth = width;
|
||||
if(pitch == 0) bitmapPitch = width * TJ.getPixelSize(pixelFormat);
|
||||
else bitmapPitch = pitch;
|
||||
bitmapHeight = height;
|
||||
bitmapPixelFormat = pixelFormat;
|
||||
if(srcImage == null || width < 1 || height < 1 || pitch < 0
|
||||
|| pixelFormat < 0 || pixelFormat >= TJ.NUMPF)
|
||||
throw new Exception("Invalid argument in setSourceImage()");
|
||||
srcBuf = srcImage;
|
||||
srcWidth = width;
|
||||
if(pitch == 0) srcPitch = width * TJ.getPixelSize(pixelFormat);
|
||||
else srcPitch = pitch;
|
||||
srcHeight = height;
|
||||
srcPixelFormat = pixelFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the level of chrominance subsampling for subsequent compress/encode
|
||||
* operations.
|
||||
*
|
||||
* @param newSubsamp the new level of chrominance subsampling (see
|
||||
* {@link TJ})
|
||||
* @param newSubsamp the new level of chrominance subsampling (one of
|
||||
* {@link TJ TJ.SAMP_*})
|
||||
*/
|
||||
public void setSubsamp(int newSubsamp) throws Exception {
|
||||
if(newSubsamp < 0 || newSubsamp >= TJ.NUMSAMPOPT)
|
||||
if(newSubsamp < 0 || newSubsamp >= TJ.NUMSAMP)
|
||||
throw new Exception("Invalid argument in setSubsamp()");
|
||||
subsamp = newSubsamp;
|
||||
}
|
||||
@@ -130,34 +134,32 @@ public class TJCompressor {
|
||||
* {@link TJ#bufSize} to determine the maximum size for this buffer based on
|
||||
* the image width and height.
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of the flags described in
|
||||
* {@link TJ}
|
||||
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
|
||||
*/
|
||||
public void compress(byte[] dstBuf, int flags) throws Exception {
|
||||
if(dstBuf == null || flags < 0)
|
||||
throw new Exception("Invalid argument in compress()");
|
||||
if(bitmapBuf == null) throw new Exception("Bitmap buffer not initialized");
|
||||
if(srcBuf == null) throw new Exception(NO_ASSOC_ERROR);
|
||||
if(jpegQuality < 0) throw new Exception("JPEG Quality not set");
|
||||
if(subsamp < 0) throw new Exception("Subsampling level not set");
|
||||
compressedSize = compress(bitmapBuf, bitmapWidth, bitmapPitch,
|
||||
bitmapHeight, bitmapPixelFormat, dstBuf, subsamp, jpegQuality, flags);
|
||||
compressedSize = compress(srcBuf, srcWidth, srcPitch,
|
||||
srcHeight, srcPixelFormat, dstBuf, subsamp, jpegQuality, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compress the uncompressed source image associated with this compressor
|
||||
* instance and return a buffer containing a JPEG image.
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of the flags described in
|
||||
* {@link TJ}
|
||||
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
|
||||
*
|
||||
* @return a buffer containing a JPEG image. The length of this buffer will
|
||||
* not be equal to the size of the JPEG image. Use {@link
|
||||
* #getCompressedSize} to obtain the size of the JPEG image.
|
||||
*/
|
||||
public byte[] compress(int flags) throws Exception {
|
||||
if(bitmapWidth < 1 || bitmapHeight < 1)
|
||||
throw new Exception("Bitmap buffer not initialized");
|
||||
byte[] buf = new byte[TJ.bufSize(bitmapWidth, bitmapHeight)];
|
||||
if(srcWidth < 1 || srcHeight < 1)
|
||||
throw new Exception(NO_ASSOC_ERROR);
|
||||
byte[] buf = new byte[TJ.bufSize(srcWidth, srcHeight)];
|
||||
compress(buf, flags);
|
||||
return buf;
|
||||
}
|
||||
@@ -173,8 +175,7 @@ public class TJCompressor {
|
||||
* {@link TJ#bufSize} to determine the maximum size for this buffer based on
|
||||
* the image width and height.
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of the flags described in
|
||||
* {@link TJ}
|
||||
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
|
||||
*/
|
||||
public void compress(BufferedImage srcImage, byte[] dstBuf, int flags)
|
||||
throws Exception {
|
||||
@@ -228,8 +229,7 @@ public class TJCompressor {
|
||||
* @param srcImage a <code>BufferedImage</code> instance containing RGB or
|
||||
* grayscale pixels to be compressed
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of the flags described in
|
||||
* {@link TJ}
|
||||
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
|
||||
*
|
||||
* @return a buffer containing a JPEG image. The length of this buffer will
|
||||
* not be equal to the size of the JPEG image. Use {@link
|
||||
@@ -246,7 +246,7 @@ public class TJCompressor {
|
||||
/**
|
||||
* Encode the uncompressed source image associated with this compressor
|
||||
* instance and output a YUV planar image to the given destination buffer.
|
||||
* This function uses the accelerated color conversion routines in
|
||||
* This method uses the accelerated color conversion routines in
|
||||
* TurboJPEG's underlying codec to produce a planar YUV image that is
|
||||
* suitable for direct video display. Specifically, if the chrominance
|
||||
* components are subsampled along the horizontal dimension, then the width
|
||||
@@ -262,17 +262,16 @@ public class TJCompressor {
|
||||
* {@link TJ#bufSizeYUV} to determine the appropriate size for this buffer
|
||||
* based on the image width, height, and level of chrominance subsampling.
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of the flags described in
|
||||
* {@link TJ}
|
||||
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
|
||||
*/
|
||||
public void encodeYUV(byte[] dstBuf, int flags) throws Exception {
|
||||
if(dstBuf == null || flags < 0)
|
||||
throw new Exception("Invalid argument in compress()");
|
||||
if(bitmapBuf == null) throw new Exception("Bitmap buffer not initialized");
|
||||
if(srcBuf == null) throw new Exception(NO_ASSOC_ERROR);
|
||||
if(subsamp < 0) throw new Exception("Subsampling level not set");
|
||||
encodeYUV(bitmapBuf, bitmapWidth, bitmapPitch, bitmapHeight,
|
||||
bitmapPixelFormat, dstBuf, subsamp, flags);
|
||||
compressedSize = TJ.bufSizeYUV(bitmapWidth, bitmapHeight, subsamp);
|
||||
encodeYUV(srcBuf, srcWidth, srcPitch, srcHeight,
|
||||
srcPixelFormat, dstBuf, subsamp, flags);
|
||||
compressedSize = TJ.bufSizeYUV(srcWidth, srcHeight, subsamp);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -280,16 +279,15 @@ public class TJCompressor {
|
||||
* instance and return a buffer containing a YUV planar image. See
|
||||
* {@link #encodeYUV(byte[], int)} for more detail.
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of the flags described in
|
||||
* {@link TJ}
|
||||
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
|
||||
*
|
||||
* @return a buffer containing a YUV planar image
|
||||
*/
|
||||
public byte[] encodeYUV(int flags) throws Exception {
|
||||
if(bitmapWidth < 1 || bitmapHeight < 1)
|
||||
throw new Exception("Bitmap buffer not initialized");
|
||||
if(srcWidth < 1 || srcHeight < 1)
|
||||
throw new Exception(NO_ASSOC_ERROR);
|
||||
if(subsamp < 0) throw new Exception("Subsampling level not set");
|
||||
byte[] buf = new byte[TJ.bufSizeYUV(bitmapWidth, bitmapHeight, subsamp)];
|
||||
byte[] buf = new byte[TJ.bufSizeYUV(srcWidth, srcHeight, subsamp)];
|
||||
encodeYUV(buf, flags);
|
||||
return buf;
|
||||
}
|
||||
@@ -306,8 +304,7 @@ public class TJCompressor {
|
||||
* {@link TJ#bufSizeYUV} to determine the appropriate size for this buffer
|
||||
* based on the image width, height, and level of chrominance subsampling.
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of the flags described in
|
||||
* {@link TJ}
|
||||
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
|
||||
*/
|
||||
public void encodeYUV(BufferedImage srcImage, byte[] dstBuf, int flags)
|
||||
throws Exception {
|
||||
@@ -362,8 +359,7 @@ public class TJCompressor {
|
||||
* @param srcImage a <code>BufferedImage</code> instance containing RGB or
|
||||
* grayscale pixels to be encoded
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of the flags described in
|
||||
* {@link TJ}
|
||||
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
|
||||
*
|
||||
* @return a buffer containing a YUV planar image
|
||||
*/
|
||||
@@ -431,11 +427,11 @@ public class TJCompressor {
|
||||
}
|
||||
|
||||
private long handle = 0;
|
||||
private byte[] bitmapBuf = null;
|
||||
private int bitmapWidth = 0;
|
||||
private int bitmapHeight = 0;
|
||||
private int bitmapPitch = 0;
|
||||
private int bitmapPixelFormat = -1;
|
||||
private byte[] srcBuf = null;
|
||||
private int srcWidth = 0;
|
||||
private int srcHeight = 0;
|
||||
private int srcPitch = 0;
|
||||
private int srcPixelFormat = -1;
|
||||
private int subsamp = -1;
|
||||
private int jpegQuality = -1;
|
||||
private int compressedSize = 0;
|
||||
|
||||
@@ -35,6 +35,9 @@ import java.awt.image.*;
|
||||
*/
|
||||
public class TJDecompressor {
|
||||
|
||||
private final static String NO_ASSOC_ERROR =
|
||||
"No JPEG image is associated with this instance";
|
||||
|
||||
/**
|
||||
* Create a TurboJPEG decompresssor instance.
|
||||
*/
|
||||
@@ -46,12 +49,12 @@ public class TJDecompressor {
|
||||
* Create a TurboJPEG decompressor instance and associate the JPEG image
|
||||
* stored in <code>jpegImage</code> with the newly-created instance.
|
||||
*
|
||||
* @param jpegImage JPEG image buffer (size of JPEG image is assumed to be
|
||||
* the length of the buffer)
|
||||
* @param jpegImage JPEG image buffer (size of the JPEG image is assumed to
|
||||
* be the length of the array)
|
||||
*/
|
||||
public TJDecompressor(byte[] jpegImage) throws Exception {
|
||||
init();
|
||||
setJPEGBuffer(jpegImage, jpegImage.length);
|
||||
setJPEGImage(jpegImage, jpegImage.length);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,25 +64,25 @@ public class TJDecompressor {
|
||||
*
|
||||
* @param jpegImage JPEG image buffer
|
||||
*
|
||||
* @param imageSize size of JPEG image (in bytes)
|
||||
* @param imageSize size of the JPEG image (in bytes)
|
||||
*/
|
||||
public TJDecompressor(byte[] jpegImage, int imageSize) throws Exception {
|
||||
init();
|
||||
setJPEGBuffer(jpegImage, imageSize);
|
||||
setJPEGImage(jpegImage, imageSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate a JPEG image buffer with this decompressor instance. This
|
||||
* buffer will be used as the source buffer for subsequent decompress
|
||||
* operations.
|
||||
* Associate the JPEG image of length <code>imageSize</code> bytes stored in
|
||||
* <code>jpegImage</code> with this decompressor instance. This image will
|
||||
* be used as the source image for subsequent decompress operations.
|
||||
*
|
||||
* @param jpegImage JPEG image buffer
|
||||
*
|
||||
* @param imageSize size of JPEG image (in bytes)
|
||||
* @param imageSize size of the JPEG image (in bytes)
|
||||
*/
|
||||
public void setJPEGBuffer(byte[] jpegImage, int imageSize) throws Exception {
|
||||
public void setJPEGImage(byte[] jpegImage, int imageSize) throws Exception {
|
||||
if(jpegImage == null || imageSize < 1)
|
||||
throw new Exception("Invalid argument in setJPEGBuffer()");
|
||||
throw new Exception("Invalid argument in setJPEGImage()");
|
||||
jpegBuf = jpegImage;
|
||||
jpegBufSize = imageSize;
|
||||
decompressHeader(jpegBuf, jpegBufSize);
|
||||
@@ -93,7 +96,7 @@ public class TJDecompressor {
|
||||
* instance
|
||||
*/
|
||||
public int getWidth() throws Exception {
|
||||
if(jpegWidth < 1) throw new Exception("JPEG buffer not initialized");
|
||||
if(jpegWidth < 1) throw new Exception(NO_ASSOC_ERROR);
|
||||
return jpegWidth;
|
||||
}
|
||||
|
||||
@@ -105,7 +108,7 @@ public class TJDecompressor {
|
||||
* instance
|
||||
*/
|
||||
public int getHeight() throws Exception {
|
||||
if(jpegHeight < 1) throw new Exception("JPEG buffer not initialized");
|
||||
if(jpegHeight < 1) throw new Exception(NO_ASSOC_ERROR);
|
||||
return jpegHeight;
|
||||
}
|
||||
|
||||
@@ -117,8 +120,8 @@ public class TJDecompressor {
|
||||
* associated with this decompressor instance
|
||||
*/
|
||||
public int getSubsamp() throws Exception {
|
||||
if(jpegSubsamp < 0) throw new Exception("JPEG buffer not initialized");
|
||||
if(jpegSubsamp >= TJ.NUMSAMPOPT)
|
||||
if(jpegSubsamp < 0) throw new Exception(NO_ASSOC_ERROR);
|
||||
if(jpegSubsamp >= TJ.NUMSAMP)
|
||||
throw new Exception("JPEG header information is invalid");
|
||||
return jpegSubsamp;
|
||||
}
|
||||
@@ -129,7 +132,7 @@ public class TJDecompressor {
|
||||
* @return the JPEG image buffer associated with this decompressor instance
|
||||
*/
|
||||
public byte[] getJPEGBuf() throws Exception {
|
||||
if(jpegBuf == null) throw new Exception("JPEG buffer not initialized");
|
||||
if(jpegBuf == null) throw new Exception(NO_ASSOC_ERROR);
|
||||
return jpegBuf;
|
||||
}
|
||||
|
||||
@@ -141,7 +144,7 @@ public class TJDecompressor {
|
||||
* decompressor instance
|
||||
*/
|
||||
public int getJPEGSize() throws Exception {
|
||||
if(jpegBufSize < 1) throw new Exception("JPEG buffer not initialized");
|
||||
if(jpegBufSize < 1) throw new Exception(NO_ASSOC_ERROR);
|
||||
return jpegBufSize;
|
||||
}
|
||||
|
||||
@@ -152,12 +155,14 @@ public class TJDecompressor {
|
||||
* height.
|
||||
*
|
||||
* @param desiredWidth desired width (in pixels) of the decompressed image.
|
||||
* If this is set to 0, then only the height will be considered when
|
||||
* determining the scaled image size.
|
||||
* Setting this to 0 is the same as setting it to the width of the JPEG image
|
||||
* (in other words, the width will not be considered when determining the
|
||||
* scaled image size.)
|
||||
*
|
||||
* @param desiredHeight desired height (in pixels) of the decompressed image.
|
||||
* If this is set to 0, then only the width will be considered when
|
||||
* determining the scaled image size.
|
||||
* Setting this to 0 is the same as setting it to the height of the JPEG
|
||||
* image (in other words, the height will not be considered when determining
|
||||
* the scaled image size.)
|
||||
*
|
||||
* @return the width of the largest scaled down image that the TurboJPEG
|
||||
* decompressor can generate without exceeding the desired image width and
|
||||
@@ -166,7 +171,7 @@ public class TJDecompressor {
|
||||
public int getScaledWidth(int desiredWidth, int desiredHeight)
|
||||
throws Exception {
|
||||
if(jpegWidth < 1 || jpegHeight < 1)
|
||||
throw new Exception("JPEG buffer not initialized");
|
||||
throw new Exception(NO_ASSOC_ERROR);
|
||||
if(desiredWidth < 0 || desiredHeight < 0)
|
||||
throw new Exception("Invalid argument in getScaledWidth()");
|
||||
TJ.ScalingFactor sf[] = TJ.getScalingFactors();
|
||||
@@ -190,12 +195,14 @@ public class TJDecompressor {
|
||||
* height.
|
||||
*
|
||||
* @param desiredWidth desired width (in pixels) of the decompressed image.
|
||||
* If this is set to 0, then only the height will be considered when
|
||||
* determining the scaled image size.
|
||||
* Setting this to 0 is the same as setting it to the width of the JPEG image
|
||||
* (in other words, the width will not be considered when determining the
|
||||
* scaled image size.)
|
||||
*
|
||||
* @param desiredHeight desired height (in pixels) of the decompressed image.
|
||||
* If this is set to 0, then only the width will be considered when
|
||||
* determining the scaled image size.
|
||||
* Setting this to 0 is the same as setting it to the height of the JPEG
|
||||
* image (in other words, the height will not be considered when determining
|
||||
* the scaled image size.)
|
||||
*
|
||||
* @return the height of the largest scaled down image that the TurboJPEG
|
||||
* decompressor can generate without exceeding the desired image width and
|
||||
@@ -204,7 +211,7 @@ public class TJDecompressor {
|
||||
public int getScaledHeight(int desiredWidth, int desiredHeight)
|
||||
throws Exception {
|
||||
if(jpegWidth < 1 || jpegHeight < 1)
|
||||
throw new Exception("JPEG buffer not initialized");
|
||||
throw new Exception(NO_ASSOC_ERROR);
|
||||
if(desiredWidth < 0 || desiredHeight < 0)
|
||||
throw new Exception("Invalid argument in getScaledHeight()");
|
||||
TJ.ScalingFactor sf[] = TJ.getScalingFactors();
|
||||
@@ -236,8 +243,9 @@ public class TJDecompressor {
|
||||
* If the desired image dimensions are smaller than the dimensions of the
|
||||
* JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG
|
||||
* decompressor to generate the largest possible image that will fit within
|
||||
* the desired dimensions. If desiredWidth is set to 0, then only the height
|
||||
* will be considered when determining the scaled image size.
|
||||
* the desired dimensions. Setting this to 0 is the same as setting it to
|
||||
* the width of the JPEG image (in other words, the width will not be
|
||||
* considered when determining the scaled image size.)
|
||||
*
|
||||
* @param pitch bytes per line of the destination image. Normally, this
|
||||
* should be set to <code>scaledWidth * TJ.pixelSize(pixelFormat)</code> if
|
||||
@@ -245,26 +253,26 @@ public class TJDecompressor {
|
||||
* pad each line of the decompressed image to a 4-byte boundary. NOTE:
|
||||
* <code>scaledWidth = ceil(jpegWidth * scalingFactor)</code>. Setting this
|
||||
* parameter to 0 is the equivalent of setting it to
|
||||
* <code>scaledWidth * pixelSize</code>.
|
||||
* <code>scaledWidth * TJ.pixelSize(pixelFormat)</code>.
|
||||
*
|
||||
* @param desiredHeight desired height (in pixels) of the decompressed image.
|
||||
* If the desired image dimensions are smaller than the dimensions of the
|
||||
* JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG
|
||||
* decompressor to generate the largest possible image that will fit within
|
||||
* the desired dimensions. If desiredHeight is set to 0, then only the
|
||||
* width will be considered when determining the scaled image size.
|
||||
* the desired dimensions. Setting this to 0 is the same as setting it to
|
||||
* the height of the JPEG image (in other words, the height will not be
|
||||
* considered when determining the scaled image size.)
|
||||
*
|
||||
* @param pixelFormat Pixel format of the decompressed image (see
|
||||
* {@link TJ})
|
||||
* @param pixelFormat pixel format of the decompressed image (one of
|
||||
* {@link TJ TJ.PF_*})
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of the flags described in
|
||||
* {@link TJ}
|
||||
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
|
||||
*/
|
||||
public void decompress(byte[] dstBuf, int desiredWidth, int pitch,
|
||||
int desiredHeight, int pixelFormat, int flags) throws Exception {
|
||||
if(jpegBuf == null) throw new Exception("JPEG buffer not initialized");
|
||||
if(jpegBuf == null) throw new Exception(NO_ASSOC_ERROR);
|
||||
if(dstBuf == null || desiredWidth < 0 || pitch < 0 || desiredHeight < 0
|
||||
|| pixelFormat < 0 || pixelFormat >= TJ.NUMPFOPT || flags < 0)
|
||||
|| pixelFormat < 0 || pixelFormat >= TJ.NUMPF || flags < 0)
|
||||
throw new Exception("Invalid argument in decompress()");
|
||||
decompress(jpegBuf, jpegBufSize, dstBuf, desiredWidth, pitch,
|
||||
desiredHeight, pixelFormat, flags);
|
||||
@@ -283,18 +291,17 @@ public class TJDecompressor {
|
||||
* @param desiredHeight see
|
||||
* {@link #decompress(byte[], int, int, int, int, int)} for description
|
||||
*
|
||||
* @param pixelFormat Pixel format of the decompressed image (see
|
||||
* {@link TJ})
|
||||
* @param pixelFormat pixel format of the decompressed image (one of
|
||||
* {@link TJ TJ.PF_*})
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of the flags described in
|
||||
* {@link TJ}
|
||||
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
|
||||
*
|
||||
* @return a buffer containing the decompressed image
|
||||
*/
|
||||
public byte[] decompress(int desiredWidth, int pitch, int desiredHeight,
|
||||
int pixelFormat, int flags) throws Exception {
|
||||
if(desiredWidth < 0 || pitch < 0 || desiredHeight < 0
|
||||
|| pixelFormat < 0 || pixelFormat >= TJ.NUMPFOPT || flags < 0)
|
||||
|| pixelFormat < 0 || pixelFormat >= TJ.NUMPF || flags < 0)
|
||||
throw new Exception("Invalid argument in decompress()");
|
||||
int pixelSize = TJ.getPixelSize(pixelFormat);
|
||||
int scaledWidth = getScaledWidth(desiredWidth, desiredHeight);
|
||||
@@ -320,11 +327,10 @@ public class TJDecompressor {
|
||||
* {@link TJ#bufSizeYUV} to determine the appropriate size for this buffer
|
||||
* based on the image width, height, and level of chrominance subsampling.
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of the flags described in
|
||||
* {@link TJ}
|
||||
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
|
||||
*/
|
||||
public void decompressToYUV(byte[] dstBuf, int flags) throws Exception {
|
||||
if(jpegBuf == null) throw new Exception("JPEG buffer not initialized");
|
||||
if(jpegBuf == null) throw new Exception(NO_ASSOC_ERROR);
|
||||
if(dstBuf == null || flags < 0)
|
||||
throw new Exception("Invalid argument in decompressToYUV()");
|
||||
decompressToYUV(jpegBuf, jpegBufSize, dstBuf, flags);
|
||||
@@ -336,8 +342,7 @@ public class TJDecompressor {
|
||||
* instance and return a buffer containing a YUV planar image. See {@link
|
||||
* #decompressToYUV(byte[], int)} for more detail.
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of the flags described in
|
||||
* {@link TJ}
|
||||
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
|
||||
*
|
||||
* @return a buffer containing a YUV planar image
|
||||
*/
|
||||
@@ -345,8 +350,8 @@ public class TJDecompressor {
|
||||
if(flags < 0)
|
||||
throw new Exception("Invalid argument in decompressToYUV()");
|
||||
if(jpegWidth < 1 || jpegHeight < 1 || jpegSubsamp < 0)
|
||||
throw new Exception("JPEG buffer not initialized");
|
||||
if(jpegSubsamp >= TJ.NUMSAMPOPT)
|
||||
throw new Exception(NO_ASSOC_ERROR);
|
||||
if(jpegSubsamp >= TJ.NUMSAMP)
|
||||
throw new Exception("JPEG header information is invalid");
|
||||
byte[] buf = new byte[TJ.bufSizeYUV(jpegWidth, jpegHeight, jpegSubsamp)];
|
||||
decompressToYUV(buf, flags);
|
||||
@@ -361,8 +366,7 @@ public class TJDecompressor {
|
||||
* @param dstImage a <code>BufferedImage</code> instance which will receive
|
||||
* the decompressed image
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of the flags described in
|
||||
* {@link TJ}
|
||||
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
|
||||
*/
|
||||
public void decompress(BufferedImage dstImage, int flags) throws Exception {
|
||||
if(dstImage == null || flags < 0)
|
||||
@@ -393,7 +397,7 @@ public class TJDecompressor {
|
||||
int pitch = sm.getScanlineStride();
|
||||
DataBufferInt db = (DataBufferInt)wr.getDataBuffer();
|
||||
int[] buf = db.getData();
|
||||
if(jpegBuf == null) throw new Exception("JPEG buffer not initialized");
|
||||
if(jpegBuf == null) throw new Exception(NO_ASSOC_ERROR);
|
||||
decompress(jpegBuf, jpegBufSize, buf, scaledWidth, pitch, scaledHeight,
|
||||
pixelFormat, flags);
|
||||
}
|
||||
@@ -421,11 +425,11 @@ public class TJDecompressor {
|
||||
* @param desiredHeight see
|
||||
* {@link #decompress(byte[], int, int, int, int, int)} for description
|
||||
*
|
||||
* @param bufferedImageType the image type of the <code>BufferedImage</code>
|
||||
* instance to create (for instance, <code>BufferedImage.TYPE_INT_RGB</code>)
|
||||
* @param bufferedImageType the image type of the newly-created
|
||||
* <code>BufferedImage</code> instance (for instance,
|
||||
* <code>BufferedImage.TYPE_INT_RGB</code>)
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of the flags described in
|
||||
* {@link TJ}
|
||||
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
|
||||
*
|
||||
* @return a <code>BufferedImage</code> instance containing the
|
||||
* decompressed image
|
||||
|
||||
@@ -155,8 +155,8 @@ public class TJTransform extends Rectangle {
|
||||
* Create a new lossless transform instance with the given parameters.
|
||||
*
|
||||
* @param r a <code>Rectangle</code> instance which specifies the cropping
|
||||
* region. See {@link #TJTransform(int, int, int, int, int, int)} for a
|
||||
* description of the cropping region.
|
||||
* region. See {@link #TJTransform(int, int, int, int, int, int)} for more
|
||||
* detail.
|
||||
*
|
||||
* @param op one of the transform operations (<code>OP_*</code>)
|
||||
*
|
||||
|
||||
@@ -44,12 +44,12 @@ public class TJTransformer extends TJDecompressor {
|
||||
* Create a TurboJPEG lossless transformer instance and associate the JPEG
|
||||
* image stored in <code>jpegImage</code> with the newly-created instance.
|
||||
*
|
||||
* @param jpegImage JPEG image buffer (size of JPEG image is assumed to be
|
||||
* the length of the buffer)
|
||||
* @param jpegImage JPEG image buffer (size of the JPEG image is assumed to
|
||||
* be the length of the array)
|
||||
*/
|
||||
public TJTransformer(byte[] jpegImage) throws Exception {
|
||||
init();
|
||||
setJPEGBuffer(jpegImage, jpegImage.length);
|
||||
setJPEGImage(jpegImage, jpegImage.length);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,11 +59,11 @@ public class TJTransformer extends TJDecompressor {
|
||||
*
|
||||
* @param jpegImage JPEG image buffer
|
||||
*
|
||||
* @param imageSize size of JPEG image (in bytes)
|
||||
* @param imageSize size of the JPEG image (in bytes)
|
||||
*/
|
||||
public TJTransformer(byte[] jpegImage, int imageSize) throws Exception {
|
||||
init();
|
||||
setJPEGBuffer(jpegImage, imageSize);
|
||||
setJPEGImage(jpegImage, imageSize);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,22 +75,21 @@ public class TJTransformer extends TJDecompressor {
|
||||
* image, transforming it, and re-compressing it, lossless transforms are not
|
||||
* free. Each lossless transform requires reading and Huffman decoding all
|
||||
* of the coefficients in the source image, regardless of the size of the
|
||||
* destination image. Thus, this function provides a means of generating
|
||||
* destination image. Thus, this method provides a means of generating
|
||||
* multiple transformed images from the same source or of applying multiple
|
||||
* transformations simultaneously, in order to eliminate the need to read the
|
||||
* source coefficients multiple times.
|
||||
*
|
||||
* @param dstBufs an array of n image buffers. <code>dstbufs[i]</code> will
|
||||
* @param dstBufs an array of image buffers. <code>dstbufs[i]</code> will
|
||||
* receive a JPEG image that has been transformed using the parameters in
|
||||
* <code>transforms[i]</code>. Use {@link TJ#bufSizeYUV} to determine the
|
||||
* <code>transforms[i]</code>. Use {@link TJ#bufSize} to determine the
|
||||
* maximum size for each buffer based on the cropped width and height.
|
||||
*
|
||||
* @param transforms an array of n {@link TJTransform} instances, each of
|
||||
* @param transforms an array of {@link TJTransform} instances, each of
|
||||
* which specifies the transform parameters and/or cropping region for the
|
||||
* corresponding transformed output image
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of the flags described in
|
||||
* {@link TJ}
|
||||
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
|
||||
*/
|
||||
public void transform(byte[][] dstBufs, TJTransform[] transforms,
|
||||
int flags) throws Exception {
|
||||
@@ -104,15 +103,14 @@ public class TJTransformer extends TJDecompressor {
|
||||
* instance and return an array of {@link TJDecompressor} instances, each of
|
||||
* which has a transformed JPEG image associated with it.
|
||||
*
|
||||
* @param transforms an array of n {@link TJTransform} instances, each of
|
||||
* @param transforms an array of {@link TJTransform} instances, each of
|
||||
* which specifies the transform parameters and/or cropping region for the
|
||||
* corresponding transformed output image
|
||||
*
|
||||
* @return an array of {@link TJDecompressor} instances, each of
|
||||
* which has a transformed JPEG image associated with it
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of the flags described in
|
||||
* {@link TJ}
|
||||
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
|
||||
*/
|
||||
public TJDecompressor[] transform(TJTransform[] transforms, int flags)
|
||||
throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user