More Java API cleanup

git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@519 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
DRC
2011-03-16 00:02:53 +00:00
parent 92549de2c2
commit 2c74e5124d
13 changed files with 391 additions and 379 deletions

View File

@@ -282,7 +282,7 @@ public class TJExample {
if(img != null) if(img != null)
jpegBuf = tjc.compress(img, 0); jpegBuf = tjc.compress(img, 0);
else { else {
tjc.setBitmapBuffer(bmpBuf, width, 0, height, TJ.PF_BGRX); tjc.setSourceImage(bmpBuf, width, 0, height, TJ.PF_BGRX);
jpegBuf = tjc.compress(0); jpegBuf = tjc.compress(0);
} }
jpegSize = tjc.getCompressedSize(); jpegSize = tjc.getCompressedSize();

View File

@@ -108,9 +108,9 @@ public class TJUnitTest {
private static void initBuf(byte[] buf, int w, int pitch, int h, int pf, private static void initBuf(byte[] buf, int w, int pitch, int h, int pf,
int flags) throws Exception { int flags) throws Exception {
int roffset = TJ.getRedShift(pf) / 8; int roffset = TJ.getRedOffset(pf);
int goffset = TJ.getGreenShift(pf) / 8; int goffset = TJ.getGreenOffset(pf);
int boffset = TJ.getBlueShift(pf) / 8; int boffset = TJ.getBlueOffset(pf);
int ps = TJ.getPixelSize(pf); int ps = TJ.getPixelSize(pf);
int i, _i, j; 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, private static void initIntBuf(int[] buf, int w, int pitch, int h, int pf,
int flags) throws Exception { int flags) throws Exception {
int rshift = TJ.getRedShift(pf); int rshift = TJ.getRedOffset(pf) * 8;
int gshift = TJ.getGreenShift(pf); int gshift = TJ.getGreenOffset(pf) * 8;
int bshift = TJ.getBlueShift(pf); int bshift = TJ.getBlueOffset(pf) * 8;
int i, _i, j; int i, _i, j;
Arrays.fill(buf, 0); 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, 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 subsamp, int scaleNum, int scaleDenom, int flags) throws Exception {
int roffset = TJ.getRedShift(pf) / 8; int roffset = TJ.getRedOffset(pf);
int goffset = TJ.getGreenShift(pf) / 8; int goffset = TJ.getGreenOffset(pf);
int boffset = TJ.getBlueShift(pf) / 8; int boffset = TJ.getBlueOffset(pf);
int ps = TJ.getPixelSize(pf); int ps = TJ.getPixelSize(pf);
int i, _i, j, retval = 1; int i, _i, j, retval = 1;
int halfway = 16 * scaleNum / scaleDenom; 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, 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 subsamp, int scaleNum, int scaleDenom, int flags) throws Exception {
int rshift = TJ.getRedShift(pf); int rshift = TJ.getRedOffset(pf) * 8;
int gshift = TJ.getGreenShift(pf); int gshift = TJ.getGreenOffset(pf) * 8;
int bshift = TJ.getBlueShift(pf); int bshift = TJ.getBlueOffset(pf) * 8;
int i, _i, j, retval = 1; int i, _i, j, retval = 1;
int halfway = 16 * scaleNum / scaleDenom; int halfway = 16 * scaleNum / scaleDenom;
int blockSize = 8 * scaleNum / scaleDenom; int blockSize = 8 * scaleNum / scaleDenom;
@@ -577,7 +577,7 @@ public class TJUnitTest {
else tjc.compress(img, jpegBuf, flags); else tjc.compress(img, jpegBuf, flags);
} }
else { else {
tjc.setBitmapBuffer(bmpBuf, w, 0, h, pf); tjc.setSourceImage(bmpBuf, w, 0, h, pf);
if(yuv == YUVENCODE) tjc.encodeYUV(jpegBuf, flags); if(yuv == YUVENCODE) tjc.encodeYUV(jpegBuf, flags);
else tjc.compress(jpegBuf, flags); else tjc.compress(jpegBuf, flags);
} }
@@ -635,7 +635,7 @@ public class TJUnitTest {
} }
t = getTime(); t = getTime();
tjd.setJPEGBuffer(jpegBuf, jpegsize); tjd.setJPEGImage(jpegBuf, jpegsize);
if(tjd.getWidth() != w || tjd.getHeight() != h if(tjd.getWidth() != w || tjd.getHeight() != h
|| tjd.getSubsamp() != subsamp) || tjd.getSubsamp() != subsamp)
throw new Exception("Incorrect JPEG header"); throw new Exception("Incorrect JPEG header");
@@ -761,7 +761,7 @@ public class TJUnitTest {
bmpBuf[i2 * 4 + 1] = pixels[i2 % 9][1]; bmpBuf[i2 * 4 + 1] = pixels[i2 % 9][1];
bmpBuf[i2 * 4 + 2] = pixels[i2 % 9][0]; 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.setSubsamp(TJ.SAMP_444);
tjc.setJPEGQuality(100); tjc.setJPEGQuality(100);
tjc.compress(jpegBuf, 0); tjc.compress(jpegBuf, 0);
@@ -773,7 +773,7 @@ public class TJUnitTest {
bmpBuf[i2 * 4 + 1] = bmpBuf[i2 * 4 + 2] = (byte)0xFF; bmpBuf[i2 * 4 + 1] = bmpBuf[i2 * 4 + 2] = (byte)0xFF;
else bmpBuf[i2 * 4] = bmpBuf[i2 * 4 + 1] = bmpBuf[i2 * 4 + 2] = 0; 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); tjc.compress(jpegBuf, 0);
} }
} }

View File

@@ -2,7 +2,7 @@
<!--NewPage--> <!--NewPage-->
<HTML> <HTML>
<HEAD> <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> <TITLE>
Index Index
</TITLE> </TITLE>
@@ -86,8 +86,8 @@ Static method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/tu
image with the given width and height. 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> - <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> 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 <DD>Returns the size of the buffer (in bytes) required to hold a YUV planar
the given width, height, and level of chrominance subsampling. image with the given width, height, and level of chrominance subsampling.
</DL> </DL>
<HR> <HR>
<A NAME="_C_"><!-- --></A><H2> <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> <A NAME="_G_"><!-- --></A><H2>
<B>G</B></H2> <B>G</B></H2>
<DL> <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> 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> - <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> 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 <DD>Returns the size of the image (in bytes) generated by the most recent
compress/encode operation. 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> 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> - <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> 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 <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. subsampling.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#getPixelSize(int)"><B>getPixelSize(int)</B></A> - <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> 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. <DD>Returns the pixel size (in bytes) of the given pixel format.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#getRedShift(int)"><B>getRedShift(int)</B></A> - <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> 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> - <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> 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 <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> - <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> Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
<DD>Grayscale. <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> - <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/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> -
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</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> - <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> 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. <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> - <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> 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 <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> - <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> 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 <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> - <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> 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. <DD>Create a TurboJPEG decompresssor instance.

View File

@@ -2,7 +2,7 @@
<!--NewPage--> <!--NewPage-->
<HTML> <HTML>
<HEAD> <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> <TITLE>
TJ TJ
</TITLE> </TITLE>
@@ -341,24 +341,26 @@ TurboJPEG utility class (cannot be instantiated)
int&nbsp;subsamp)</CODE> int&nbsp;subsamp)</CODE>
<BR> <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the size of the buffer required to hold a YUV planar image with &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the size of the buffer (in bytes) required to hold a YUV planar
the given width, height, and level of chrominance subsampling.</TD> image with the given width, height, and level of chrominance subsampling.</TD>
</TR> </TR>
<TR BGCOLOR="white" CLASS="TableRowColor"> <TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD> <CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getBlueShift(int)">getBlueShift</A></B>(int&nbsp;pixelFormat)</CODE> <TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getBlueOffset(int)">getBlueOffset</A></B>(int&nbsp;pixelFormat)</CODE>
<BR> <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the blue shift for the given pixel format.</TD> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>
<TR BGCOLOR="white" CLASS="TableRowColor"> <TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD> <CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getGreenShift(int)">getGreenShift</A></B>(int&nbsp;pixelFormat)</CODE> <TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getGreenOffset(int)">getGreenOffset</A></B>(int&nbsp;pixelFormat)</CODE>
<BR> <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the green shift for the given pixel format.</TD> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>
<TR BGCOLOR="white" CLASS="TableRowColor"> <TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <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&nbsp;pixelFormat)</CODE> <TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getPixelSize(int)">getPixelSize</A></B>(int&nbsp;pixelFormat)</CODE>
<BR> <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the pixel size (in bytes) for the given pixel format.</TD> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the pixel size (in bytes) of the given pixel format.</TD>
</TR> </TR>
<TR BGCOLOR="white" CLASS="TableRowColor"> <TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD> <CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getRedShift(int)">getRedShift</A></B>(int&nbsp;pixelFormat)</CODE> <TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getRedOffset(int)">getRedOffset</A></B>(int&nbsp;pixelFormat)</CODE>
<BR> <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the red shift for the given pixel format.</TD> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>
<TR BGCOLOR="white" CLASS="TableRowColor"> <TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
@@ -726,7 +729,8 @@ public static int <B>getMCUWidth</B>(int&nbsp;subsamp)
subsampling. subsampling.
<P> <P>
<DD><DL> <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>Returns:</B><DD>the MCU block width for the given level of chrominance subsampling
<DT><B>Throws:</B> <DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL> <DD><CODE>java.lang.Exception</CODE></DL>
@@ -744,7 +748,8 @@ public static int <B>getMCUHeight</B>(int&nbsp;subsamp)
subsampling. subsampling.
<P> <P>
<DD><DL> <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 <DT><B>Returns:</B><DD>the MCU block height for the given level of chrominance
subsampling subsampling
<DT><B>Throws:</B> <DT><B>Throws:</B>
@@ -759,10 +764,10 @@ getPixelSize</H3>
public static int <B>getPixelSize</B>(int&nbsp;pixelFormat) public static int <B>getPixelSize</B>(int&nbsp;pixelFormat)
throws java.lang.Exception</PRE> throws java.lang.Exception</PRE>
<DL> <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> <P>
<DD><DL> <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>Returns:</B><DD>the pixel size (in bytes) of the given pixel format
<DT><B>Throws:</B> <DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL> <DD><CODE>java.lang.Exception</CODE></DL>
@@ -770,60 +775,63 @@ public static int <B>getPixelSize</B>(int&nbsp;pixelFormat)
</DL> </DL>
<HR> <HR>
<A NAME="getRedShift(int)"><!-- --></A><H3> <A NAME="getRedOffset(int)"><!-- --></A><H3>
getRedShift</H3> getRedOffset</H3>
<PRE> <PRE>
public static int <B>getRedShift</B>(int&nbsp;pixelFormat) public static int <B>getRedOffset</B>(int&nbsp;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&nbsp;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&nbsp;pixelFormat)
throws java.lang.Exception</PRE> throws java.lang.Exception</PRE>
<DL> <DL>
<DD>Returns the blue shift for the given pixel format. For instance, if a <DD>For the given pixel format, returns the number of bytes that the red
pixel of format <code>TJ.PF_BGRX</code> is stored as an int, then the blue component is offset from the start of the pixel. For instance, if a pixel
component will be of format <code>TJ.PF_BGRX</code> is stored in <code>char pixel[]</code>,
<code>(pixel >> TJ.getBlueShift(TJ.PF_BGRX)) & 0xFF</code>. then the red component will be
<code>pixel[TJ.getRedOffset(TJ.PF_BGRX)]</code>.
<P> <P>
<DD><DL> <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 blue shift for the given pixel format <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&nbsp;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&nbsp;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> <DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL> <DD><CODE>java.lang.Exception</CODE></DL>
</DD> </DD>
@@ -858,14 +866,14 @@ public static int <B>bufSizeYUV</B>(int&nbsp;width,
int&nbsp;subsamp) int&nbsp;subsamp)
throws java.lang.Exception</PRE> throws java.lang.Exception</PRE>
<DL> <DL>
<DD>Returns the size of the buffer required to hold a YUV planar image with <DD>Returns the size of the buffer (in bytes) required to hold a YUV planar
the given width, height, and level of chrominance subsampling. image with the given width, height, and level of chrominance subsampling.
<P> <P>
<DD><DL> <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 <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 image
<DT><B>Returns:</B><DD>the size of the buffer required to hold a YUV planar image with <DT><B>Returns:</B><DD>the size of the buffer (in bytes) required to hold a YUV planar
the given width, height, and level of chrominance subsampling image with the given width, height, and level of chrominance subsampling
<DT><B>Throws:</B> <DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL> <DD><CODE>java.lang.Exception</CODE></DL>
</DD> </DD>

View File

@@ -2,7 +2,7 @@
<!--NewPage--> <!--NewPage-->
<HTML> <HTML>
<HEAD> <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> <TITLE>
TJCompressor TJCompressor
</TITLE> </TITLE>
@@ -122,7 +122,7 @@ TurboJPEG compressor
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a TurboJPEG compressor instance.</TD> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a TurboJPEG compressor instance.</TD>
</TR> </TR>
<TR BGCOLOR="white" CLASS="TableRowColor"> <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[]&nbsp;buf, <TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[], int, int, int, int)">TJCompressor</A></B>(byte[]&nbsp;srcImage,
int&nbsp;width, int&nbsp;width,
int&nbsp;pitch, int&nbsp;pitch,
int&nbsp;height, int&nbsp;height,
@@ -130,7 +130,8 @@ TurboJPEG compressor
<BR> <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a TurboJPEG compressor instance and associate the uncompressed &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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> </TR>
</TABLE> </TABLE>
&nbsp; &nbsp;
@@ -250,18 +251,6 @@ TurboJPEG compressor
<TR BGCOLOR="white" CLASS="TableRowColor"> <TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD> <CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setBitmapBuffer(byte[], int, int, int, int)">setBitmapBuffer</A></B>(byte[]&nbsp;buf,
int&nbsp;width,
int&nbsp;pitch,
int&nbsp;height,
int&nbsp;pixelFormat)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setJPEGQuality(int)">setJPEGQuality</A></B>(int&nbsp;quality)</CODE> <TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setJPEGQuality(int)">setJPEGQuality</A></B>(int&nbsp;quality)</CODE>
<BR> <BR>
@@ -270,6 +259,18 @@ TurboJPEG compressor
<TR BGCOLOR="white" CLASS="TableRowColor"> <TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD> <CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int)">setSourceImage</A></B>(byte[]&nbsp;srcImage,
int&nbsp;width,
int&nbsp;pitch,
int&nbsp;height,
int&nbsp;pixelFormat)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSubsamp(int)">setSubsamp</A></B>(int&nbsp;newSubsamp)</CODE> <TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSubsamp(int)">setSubsamp</A></B>(int&nbsp;newSubsamp)</CODE>
<BR> <BR>
@@ -317,7 +318,7 @@ public <B>TJCompressor</B>()
<A NAME="TJCompressor(byte[], int, int, int, int)"><!-- --></A><H3> <A NAME="TJCompressor(byte[], int, int, int, int)"><!-- --></A><H3>
TJCompressor</H3> TJCompressor</H3>
<PRE> <PRE>
public <B>TJCompressor</B>(byte[]&nbsp;buf, public <B>TJCompressor</B>(byte[]&nbsp;srcImage,
int&nbsp;width, int&nbsp;width,
int&nbsp;pitch, int&nbsp;pitch,
int&nbsp;height, int&nbsp;height,
@@ -325,10 +326,11 @@ public <B>TJCompressor</B>(byte[]&nbsp;buf,
throws java.lang.Exception</PRE> throws java.lang.Exception</PRE>
<DL> <DL>
<DD>Create a TurboJPEG compressor instance and associate the uncompressed <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> <P>
<DL> <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> <DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL> <DD><CODE>java.lang.Exception</CODE></DL>
</DL> </DL>
@@ -343,20 +345,20 @@ public <B>TJCompressor</B>(byte[]&nbsp;buf,
</TR> </TR>
</TABLE> </TABLE>
<A NAME="setBitmapBuffer(byte[], int, int, int, int)"><!-- --></A><H3> <A NAME="setSourceImage(byte[], int, int, int, int)"><!-- --></A><H3>
setBitmapBuffer</H3> setSourceImage</H3>
<PRE> <PRE>
public void <B>setBitmapBuffer</B>(byte[]&nbsp;buf, public void <B>setSourceImage</B>(byte[]&nbsp;srcImage,
int&nbsp;width, int&nbsp;width,
int&nbsp;pitch, int&nbsp;pitch,
int&nbsp;height, int&nbsp;height,
int&nbsp;pixelFormat) int&nbsp;pixelFormat)
throws java.lang.Exception</PRE> throws java.lang.Exception</PRE>
<DL> <DL>
<DD>Associate an uncompressed source image with this compressor instance. <DD>Associate an uncompressed source image with this compressor instance.
<P> <P>
<DD><DL> <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 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 <code>width * TJ.pixelSize(pixelFormat)</code> if the source image is
unpadded, but you can use this parameter to, for instance, specify that unpadded, but you can use this parameter to, for instance, specify that
@@ -364,8 +366,8 @@ public void <B>setBitmapBuffer</B>(byte[]&nbsp;buf,
the case for Windows bitmaps. You can also be clever and use this 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 parameter to skip lines, etc. Setting this parameter to 0 is the
equivalent of setting it to <code>width * 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 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</CODE></A>) <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.PF_*</CODE></A>)
<DT><B>Throws:</B> <DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL> <DD><CODE>java.lang.Exception</CODE></DL>
</DD> </DD>
@@ -382,8 +384,8 @@ public void <B>setSubsamp</B>(int&nbsp;newSubsamp)
operations. operations.
<P> <P>
<DD><DL> <DD><DL>
<DT><B>Parameters:</B><DD><CODE>newSubsamp</CODE> - the new level of chrominance subsampling (see <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</CODE></A>) <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.SAMP_*</CODE></A>)
<DT><B>Throws:</B> <DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL> <DD><CODE>java.lang.Exception</CODE></DL>
</DD> </DD>
@@ -420,8 +422,7 @@ public void <B>compress</B>(byte[]&nbsp;dstBuf,
<DD><DL> <DD><DL>
<DT><B>Parameters:</B><DD><CODE>dstBuf</CODE> - buffer which will receive the JPEG image. Use <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 <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 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>
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
<DT><B>Throws:</B> <DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL> <DD><CODE>java.lang.Exception</CODE></DL>
</DD> </DD>
@@ -438,8 +439,7 @@ public byte[] <B>compress</B>(int&nbsp;flags)
instance and return a buffer containing a JPEG image. instance and return a buffer containing a JPEG image.
<P> <P>
<DD><DL> <DD><DL>
<DT><B>Parameters:</B><DD><CODE>flags</CODE> - the bitwise OR of one or more of the flags described in <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>
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
<DT><B>Returns:</B><DD>a buffer containing a JPEG image. The length of this buffer will <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. 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> <DT><B>Throws:</B>
@@ -463,8 +463,7 @@ public void <B>compress</B>(java.awt.image.BufferedImage&nbsp;srcImage,
<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - a <code>BufferedImage</code> instance containing RGB or <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 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 <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 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>
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
<DT><B>Throws:</B> <DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL> <DD><CODE>java.lang.Exception</CODE></DL>
</DD> </DD>
@@ -483,8 +482,7 @@ public byte[] <B>compress</B>(java.awt.image.BufferedImage&nbsp;srcImage,
<P> <P>
<DD><DL> <DD><DL>
<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - a <code>BufferedImage</code> instance containing RGB or <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 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>
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
<DT><B>Returns:</B><DD>a buffer containing a JPEG image. The length of this buffer will <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. 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> <DT><B>Throws:</B>
@@ -502,7 +500,7 @@ public void <B>encodeYUV</B>(byte[]&nbsp;dstBuf,
<DL> <DL>
<DD>Encode the uncompressed source image associated with this compressor <DD>Encode the uncompressed source image associated with this compressor
instance and output a YUV planar image to the given destination buffer. 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 TurboJPEG's underlying codec to produce a planar YUV image that is
suitable for direct video display. Specifically, if the chrominance suitable for direct video display. Specifically, if the chrominance
components are subsampled along the horizontal dimension, then the width components are subsampled along the horizontal dimension, then the width
@@ -517,8 +515,7 @@ public void <B>encodeYUV</B>(byte[]&nbsp;dstBuf,
<DD><DL> <DD><DL>
<DT><B>Parameters:</B><DD><CODE>dstBuf</CODE> - buffer which will receive the YUV planar image. Use <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 <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 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>
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
<DT><B>Throws:</B> <DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL> <DD><CODE>java.lang.Exception</CODE></DL>
</DD> </DD>
@@ -536,8 +533,7 @@ public byte[] <B>encodeYUV</B>(int&nbsp;flags)
<A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[], int)"><CODE>encodeYUV(byte[], int)</CODE></A> for more detail. <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[], int)"><CODE>encodeYUV(byte[], int)</CODE></A> for more detail.
<P> <P>
<DD><DL> <DD><DL>
<DT><B>Parameters:</B><DD><CODE>flags</CODE> - the bitwise OR of one or more of the flags described in <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>
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
<DT><B>Returns:</B><DD>a buffer containing a YUV planar image <DT><B>Returns:</B><DD>a buffer containing a YUV planar image
<DT><B>Throws:</B> <DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL> <DD><CODE>java.lang.Exception</CODE></DL>
@@ -561,8 +557,7 @@ public void <B>encodeYUV</B>(java.awt.image.BufferedImage&nbsp;srcImage,
<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - a <code>BufferedImage</code> instance containing RGB or <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 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 <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 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>
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
<DT><B>Throws:</B> <DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL> <DD><CODE>java.lang.Exception</CODE></DL>
</DD> </DD>
@@ -582,8 +577,7 @@ public byte[] <B>encodeYUV</B>(java.awt.image.BufferedImage&nbsp;srcImage,
<P> <P>
<DD><DL> <DD><DL>
<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - a <code>BufferedImage</code> instance containing RGB or <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 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>
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
<DT><B>Returns:</B><DD>a buffer containing a YUV planar image <DT><B>Returns:</B><DD>a buffer containing a YUV planar image
<DT><B>Throws:</B> <DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL> <DD><CODE>java.lang.Exception</CODE></DL>

View File

@@ -2,7 +2,7 @@
<!--NewPage--> <!--NewPage-->
<HTML> <HTML>
<HEAD> <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> <TITLE>
TJDecompressor TJDecompressor
</TITLE> </TITLE>
@@ -362,11 +362,12 @@ TurboJPEG decompressor
<TR BGCOLOR="white" CLASS="TableRowColor"> <TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD> <CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGBuffer(byte[], int)">setJPEGBuffer</A></B>(byte[]&nbsp;jpegImage, <TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGImage(byte[], int)">setJPEGImage</A></B>(byte[]&nbsp;jpegImage,
int&nbsp;imageSize)</CODE> int&nbsp;imageSize)</CODE>
<BR> <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Associate a JPEG image buffer with this decompressor instance.</TD> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Associate the JPEG image of length <code>imageSize</code> bytes stored in
<code>jpegImage</code> with this decompressor instance.</TD>
</TR> </TR>
</TABLE> </TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
@@ -485,8 +486,8 @@ public <B>TJDecompressor</B>(byte[]&nbsp;jpegImage)
stored in <code>jpegImage</code> with the newly-created instance. stored in <code>jpegImage</code> with the newly-created instance.
<P> <P>
<DL> <DL>
<DT><B>Parameters:</B><DD><CODE>jpegImage</CODE> - JPEG image buffer (size of JPEG image is assumed to be <DT><B>Parameters:</B><DD><CODE>jpegImage</CODE> - JPEG image buffer (size of the JPEG image is assumed to
the length of the buffer) be the length of the array)
<DT><B>Throws:</B> <DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL> <DD><CODE>java.lang.Exception</CODE></DL>
</DL> </DL>
@@ -504,7 +505,7 @@ public <B>TJDecompressor</B>(byte[]&nbsp;jpegImage,
with the newly-created instance. with the newly-created instance.
<P> <P>
<DL> <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> <DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL> <DD><CODE>java.lang.Exception</CODE></DL>
</DL> </DL>
@@ -519,19 +520,19 @@ public <B>TJDecompressor</B>(byte[]&nbsp;jpegImage,
</TR> </TR>
</TABLE> </TABLE>
<A NAME="setJPEGBuffer(byte[], int)"><!-- --></A><H3> <A NAME="setJPEGImage(byte[], int)"><!-- --></A><H3>
setJPEGBuffer</H3> setJPEGImage</H3>
<PRE> <PRE>
public void <B>setJPEGBuffer</B>(byte[]&nbsp;jpegImage, public void <B>setJPEGImage</B>(byte[]&nbsp;jpegImage,
int&nbsp;imageSize) int&nbsp;imageSize)
throws java.lang.Exception</PRE> throws java.lang.Exception</PRE>
<DL> <DL>
<DD>Associate a JPEG image buffer with this decompressor instance. This <DD>Associate the JPEG image of length <code>imageSize</code> bytes stored in
buffer will be used as the source buffer for subsequent decompress <code>jpegImage</code> with this decompressor instance. This image will
operations. be used as the source image for subsequent decompress operations.
<P> <P>
<DD><DL> <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> <DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL> <DD><CODE>java.lang.Exception</CODE></DL>
</DD> </DD>
@@ -644,10 +645,12 @@ public int <B>getScaledWidth</B>(int&nbsp;desiredWidth,
<P> <P>
<DD><DL> <DD><DL>
<DT><B>Parameters:</B><DD><CODE>desiredWidth</CODE> - desired width (in pixels) of the decompressed image. <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 Setting this to 0 is the same as setting it to the width of the JPEG image
determining the scaled image size.<DD><CODE>desiredHeight</CODE> - desired height (in pixels) of the decompressed image. (in other words, the width will not be considered when determining the
If this is set to 0, then only the width will be considered when scaled image size.)<DD><CODE>desiredHeight</CODE> - desired height (in pixels) of the decompressed image.
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.)
<DT><B>Returns:</B><DD>the width of the largest scaled down image that the TurboJPEG <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 decompressor can generate without exceeding the desired image width and
height height
@@ -670,10 +673,12 @@ public int <B>getScaledHeight</B>(int&nbsp;desiredWidth,
<P> <P>
<DD><DL> <DD><DL>
<DT><B>Parameters:</B><DD><CODE>desiredWidth</CODE> - desired width (in pixels) of the decompressed image. <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 Setting this to 0 is the same as setting it to the width of the JPEG image
determining the scaled image size.<DD><CODE>desiredHeight</CODE> - desired height (in pixels) of the decompressed image. (in other words, the width will not be considered when determining the
If this is set to 0, then only the width will be considered when scaled image size.)<DD><CODE>desiredHeight</CODE> - desired height (in pixels) of the decompressed image.
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.)
<DT><B>Returns:</B><DD>the height of the largest scaled down image that the TurboJPEG <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 decompressor can generate without exceeding the desired image width and
height height
@@ -705,21 +710,22 @@ public void <B>decompress</B>(byte[]&nbsp;dstBuf,
If the desired image dimensions are smaller than the dimensions of the If the desired image dimensions are smaller than the dimensions of the
JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG
decompressor to generate the largest possible image that will fit within decompressor to generate the largest possible image that will fit within
the desired dimensions. If desiredWidth is set to 0, then only the height the desired dimensions. Setting this to 0 is the same as setting it to
will be considered when determining the scaled image size.<DD><CODE>pitch</CODE> - bytes per line of the destination image. Normally, this 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 should be set to <code>scaledWidth * TJ.pixelSize(pixelFormat)</code> if
the decompressed image is unpadded, but you can use this to, for instance, 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: pad each line of the decompressed image to a 4-byte boundary. NOTE:
<code>scaledWidth = ceil(jpegWidth * scalingFactor)</code>. Setting this <code>scaledWidth = ceil(jpegWidth * scalingFactor)</code>. Setting this
parameter to 0 is the equivalent of setting it to 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 If the desired image dimensions are smaller than the dimensions of the
JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG
decompressor to generate the largest possible image that will fit within decompressor to generate the largest possible image that will fit within
the desired dimensions. If desiredHeight is set to 0, then only the the desired dimensions. Setting this to 0 is the same as setting it to
width will be considered when determining the scaled image size.<DD><CODE>pixelFormat</CODE> - Pixel format of the decompressed image (see the height of the JPEG image (in other words, the height will not be
<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 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</CODE></A> <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> <DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL> <DD><CODE>java.lang.Exception</CODE></DL>
</DD> </DD>
@@ -743,9 +749,8 @@ public byte[] <B>decompress</B>(int&nbsp;desiredWidth,
<DT><B>Parameters:</B><DD><CODE>desiredWidth</CODE> - see <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>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>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/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</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.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>
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
<DT><B>Returns:</B><DD>a buffer containing the decompressed image <DT><B>Returns:</B><DD>a buffer containing the decompressed image
<DT><B>Throws:</B> <DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL> <DD><CODE>java.lang.Exception</CODE></DL>
@@ -773,8 +778,7 @@ public void <B>decompressToYUV</B>(byte[]&nbsp;dstBuf,
<DD><DL> <DD><DL>
<DT><B>Parameters:</B><DD><CODE>dstBuf</CODE> - buffer which will receive the YUV planar image. Use <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 <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 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>
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
<DT><B>Throws:</B> <DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL> <DD><CODE>java.lang.Exception</CODE></DL>
</DD> </DD>
@@ -791,8 +795,7 @@ public byte[] <B>decompressToYUV</B>(int&nbsp;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. 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> <P>
<DD><DL> <DD><DL>
<DT><B>Parameters:</B><DD><CODE>flags</CODE> - the bitwise OR of one or more of the flags described in <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>
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
<DT><B>Returns:</B><DD>a buffer containing a YUV planar image <DT><B>Returns:</B><DD>a buffer containing a YUV planar image
<DT><B>Throws:</B> <DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL> <DD><CODE>java.lang.Exception</CODE></DL>
@@ -813,8 +816,7 @@ public void <B>decompress</B>(java.awt.image.BufferedImage&nbsp;dstImage,
<P> <P>
<DD><DL> <DD><DL>
<DT><B>Parameters:</B><DD><CODE>dstImage</CODE> - a <code>BufferedImage</code> instance which will receive <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 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>
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
<DT><B>Throws:</B> <DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL> <DD><CODE>java.lang.Exception</CODE></DL>
</DD> </DD>
@@ -837,9 +839,9 @@ public java.awt.image.BufferedImage <B>decompress</B>(int&nbsp;desiredWidth,
<DD><DL> <DD><DL>
<DT><B>Parameters:</B><DD><CODE>desiredWidth</CODE> - see <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>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> <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
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 <code>BufferedImage</code> instance (for instance,
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A> <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 <DT><B>Returns:</B><DD>a <code>BufferedImage</code> instance containing the
decompressed image decompressed image
<DT><B>Throws:</B> <DT><B>Throws:</B>

View File

@@ -2,7 +2,7 @@
<!--NewPage--> <!--NewPage-->
<HTML> <HTML>
<HEAD> <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> <TITLE>
TJTransform TJTransform
</TITLE> </TITLE>
@@ -649,8 +649,8 @@ public <B>TJTransform</B>(java.awt.Rectangle&nbsp;r,
<P> <P>
<DL> <DL>
<DT><B>Parameters:</B><DD><CODE>r</CODE> - a <code>Rectangle</code> instance which specifies the cropping <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 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
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 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>) (<code>OPT_*</code>)
<DT><B>Throws:</B> <DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL> <DD><CODE>java.lang.Exception</CODE></DL>

View File

@@ -2,7 +2,7 @@
<!--NewPage--> <!--NewPage-->
<HTML> <HTML>
<HEAD> <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> <TITLE>
TJTransformer TJTransformer
</TITLE> </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> <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>
<TR BGCOLOR="white" CLASS="TableRowColor"> <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> </TR>
</TABLE> </TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
@@ -255,8 +255,8 @@ public <B>TJTransformer</B>(byte[]&nbsp;jpegImage)
image stored in <code>jpegImage</code> with the newly-created instance. image stored in <code>jpegImage</code> with the newly-created instance.
<P> <P>
<DL> <DL>
<DT><B>Parameters:</B><DD><CODE>jpegImage</CODE> - JPEG image buffer (size of JPEG image is assumed to be <DT><B>Parameters:</B><DD><CODE>jpegImage</CODE> - JPEG image buffer (size of the JPEG image is assumed to
the length of the buffer) be the length of the array)
<DT><B>Throws:</B> <DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL> <DD><CODE>java.lang.Exception</CODE></DL>
</DL> </DL>
@@ -274,7 +274,7 @@ public <B>TJTransformer</B>(byte[]&nbsp;jpegImage,
<code>jpegImage</code> with the newly-created instance. <code>jpegImage</code> with the newly-created instance.
<P> <P>
<DL> <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> <DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL> <DD><CODE>java.lang.Exception</CODE></DL>
</DL> </DL>
@@ -305,19 +305,18 @@ public void <B>transform</B>(byte[][]&nbsp;dstBufs,
image, transforming it, and re-compressing it, lossless transforms are not image, transforming it, and re-compressing it, lossless transforms are not
free. Each lossless transform requires reading and Huffman decoding all free. Each lossless transform requires reading and Huffman decoding all
of the coefficients in the source image, regardless of the size of the 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 multiple transformed images from the same source or of applying multiple
transformations simultaneously, in order to eliminate the need to read the transformations simultaneously, in order to eliminate the need to read the
source coefficients multiple times. source coefficients multiple times.
<P> <P>
<DD><DL> <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 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 <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 n <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJTransform</CODE></A> instances, each of 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 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 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>
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</CODE></A>
<DT><B>Throws:</B> <DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL> <DD><CODE>java.lang.Exception</CODE></DL>
</DD> </DD>
@@ -336,10 +335,9 @@ public <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="
which has a transformed JPEG image associated with it. which has a transformed JPEG image associated with it.
<P> <P>
<DD><DL> <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 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 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>
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ</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 <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 which has a transformed JPEG image associated with it
<DT><B>Throws:</B> <DT><B>Throws:</B>

View File

@@ -84,7 +84,8 @@ final public class TJ {
* Returns the MCU block width for the given level of chrominance * Returns the MCU block width for the given level of chrominance
* subsampling. * 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 * @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 * Returns the MCU block height for the given level of chrominance
* subsampling. * 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 * @return the MCU block height for the given level of chrominance
* subsampling * subsampling
@@ -167,8 +169,10 @@ final public class TJ {
/** /**
* Returns the pixel size (in bytes) for the given pixel format. * Returns the pixel size (in bytes) of the given pixel format.
* @param pixelFormat the pixel format *
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
*
* @return the pixel size (in bytes) of the given pixel format * @return the pixel size (in bytes) of the given pixel format
*/ */
public static int getPixelSize(int pixelFormat) throws Exception { 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 * For the given pixel format, returns the number of bytes that the red
* pixel of format <code>TJ.PF_BGRX</code> is stored as an int, then the red * component is offset from the start of the pixel. For instance, if a pixel
* component will be * of format <code>TJ.PF_BGRX</code> is stored in <code>char pixel[]</code>,
* <code>(pixel >> TJ.getRedShift(TJ.PF_BGRX)) & 0xFF</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) if(pixelFormat < 0 || pixelFormat >= NUMPF)
throw new Exception("Invalid pixel format"); throw new Exception("Invalid pixel format");
return redShift[pixelFormat]; return redOffset[pixelFormat];
} }
final private static int redShift[] = { final private static int redOffset[] = {
0, 16, 0, 16, 24, 8, 0 0, 2, 0, 2, 3, 1, 0
}; };
/** /**
* Returns the green shift for the given pixel format. For instance, if a * For the given pixel format, returns the number of bytes that the green
* pixel of format <code>TJ.PF_BGRX</code> is stored as an int, then the * component is offset from the start of the pixel. For instance, if a pixel
* green component will be * of format <code>TJ.PF_BGRX</code> is stored in <code>char pixel[]</code>,
* <code>(pixel >> TJ.getGreenShift(TJ.PF_BGRX)) & 0xFF</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) if(pixelFormat < 0 || pixelFormat >= NUMPF)
throw new Exception("Invalid pixel format"); throw new Exception("Invalid pixel format");
return greenShift[pixelFormat]; return greenOffset[pixelFormat];
} }
final private static int greenShift[] = { final private static int greenOffset[] = {
8, 8, 8, 8, 16, 16, 0 1, 1, 1, 1, 2, 2, 0
}; };
/** /**
* Returns the blue shift for the given pixel format. For instance, if a * For the given pixel format, returns the number of bytes that the blue
* pixel of format <code>TJ.PF_BGRX</code> is stored as an int, then the blue * component is offset from the start of the pixel. For instance, if a pixel
* component will be * of format <code>TJ.PF_BGRX</code> is stored in <code>char pixel[]</code>,
* <code>(pixel >> TJ.getBlueShift(TJ.PF_BGRX)) & 0xFF</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) if(pixelFormat < 0 || pixelFormat >= NUMPF)
throw new Exception("Invalid pixel format"); throw new Exception("Invalid pixel format");
return blueShift[pixelFormat]; return blueOffset[pixelFormat];
} }
final private static int blueShift[] = { final private static int blueOffset[] = {
16, 0, 16, 0, 8, 24, 0 2, 0, 2, 0, 1, 3, 0
}; };
@@ -292,8 +299,8 @@ final public class TJ {
throws Exception; throws Exception;
/** /**
* Returns the size of the buffer required to hold a YUV planar image with * Returns the size of the buffer (in bytes) required to hold a YUV planar
* the given width, height, and level of chrominance subsampling. * image with the given width, height, and level of chrominance subsampling.
* *
* @param width the width (in pixels) of the YUV image * @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 * @param subsamp the level of chrominance subsampling used in the YUV
* image * image
* *
* @return the size of the buffer required to hold a YUV planar image with * @return the size of the buffer (in bytes) required to hold a YUV planar
* the given width, height, and level of chrominance subsampling * image with the given width, height, and level of chrominance subsampling
*/ */
public native static int bufSizeYUV(int width, int height, public native static int bufSizeYUV(int width, int height,
int subsamp) int subsamp)

View File

@@ -35,6 +35,9 @@ import java.awt.image.*;
*/ */
public class TJCompressor { public class TJCompressor {
private final static String NO_ASSOC_ERROR =
"No source image is associated with this instance";
/** /**
* Create a TurboJPEG compressor instance. * Create a TurboJPEG compressor instance.
*/ */
@@ -44,27 +47,28 @@ public class TJCompressor {
/** /**
* Create a TurboJPEG compressor instance and associate the uncompressed * 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 { 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. * 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 * compressed
* *
* @param width width (in pixels) of the source image * @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 height height (in pixels) of the source image
* *
* @param pixelFormat pixel format of the source image (see * @param pixelFormat pixel format of the source image (one of
* {@link TJ}) * {@link TJ TJ.PF_*})
*/ */
public void setBitmapBuffer(byte[] buf, int width, int pitch, int height, public void setSourceImage(byte[] srcImage, int width, int pitch,
int pixelFormat) throws Exception { int height, int pixelFormat) throws Exception {
if(handle == 0) init(); if(handle == 0) init();
if(buf == null || width < 1 || height < 1 || pitch < 0 || pixelFormat < 0 if(srcImage == null || width < 1 || height < 1 || pitch < 0
|| pixelFormat >= TJ.NUMPFOPT) || pixelFormat < 0 || pixelFormat >= TJ.NUMPF)
throw new Exception("Invalid argument in setBitmapBuffer()"); throw new Exception("Invalid argument in setSourceImage()");
bitmapBuf = buf; srcBuf = srcImage;
bitmapWidth = width; srcWidth = width;
if(pitch == 0) bitmapPitch = width * TJ.getPixelSize(pixelFormat); if(pitch == 0) srcPitch = width * TJ.getPixelSize(pixelFormat);
else bitmapPitch = pitch; else srcPitch = pitch;
bitmapHeight = height; srcHeight = height;
bitmapPixelFormat = pixelFormat; srcPixelFormat = pixelFormat;
} }
/** /**
* Set the level of chrominance subsampling for subsequent compress/encode * Set the level of chrominance subsampling for subsequent compress/encode
* operations. * operations.
* *
* @param newSubsamp the new level of chrominance subsampling (see * @param newSubsamp the new level of chrominance subsampling (one of
* {@link TJ}) * {@link TJ TJ.SAMP_*})
*/ */
public void setSubsamp(int newSubsamp) throws Exception { 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()"); throw new Exception("Invalid argument in setSubsamp()");
subsamp = newSubsamp; subsamp = newSubsamp;
} }
@@ -130,34 +134,32 @@ public class TJCompressor {
* {@link TJ#bufSize} to determine the maximum size for this buffer based on * {@link TJ#bufSize} to determine the maximum size for this buffer based on
* the image width and height. * the image width and height.
* *
* @param flags the bitwise OR of one or more of the flags described in * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* {@link TJ}
*/ */
public void compress(byte[] dstBuf, int flags) throws Exception { public void compress(byte[] dstBuf, int flags) throws Exception {
if(dstBuf == null || flags < 0) if(dstBuf == null || flags < 0)
throw new Exception("Invalid argument in compress()"); 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(jpegQuality < 0) throw new Exception("JPEG Quality not set");
if(subsamp < 0) throw new Exception("Subsampling level not set"); if(subsamp < 0) throw new Exception("Subsampling level not set");
compressedSize = compress(bitmapBuf, bitmapWidth, bitmapPitch, compressedSize = compress(srcBuf, srcWidth, srcPitch,
bitmapHeight, bitmapPixelFormat, dstBuf, subsamp, jpegQuality, flags); srcHeight, srcPixelFormat, dstBuf, subsamp, jpegQuality, flags);
} }
/** /**
* Compress the uncompressed source image associated with this compressor * Compress the uncompressed source image associated with this compressor
* instance and return a buffer containing a JPEG image. * instance and return a buffer containing a JPEG image.
* *
* @param flags the bitwise OR of one or more of the flags described in * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* {@link TJ}
* *
* @return a buffer containing a JPEG image. The length of this buffer will * @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 * not be equal to the size of the JPEG image. Use {@link
* #getCompressedSize} to obtain the size of the JPEG image. * #getCompressedSize} to obtain the size of the JPEG image.
*/ */
public byte[] compress(int flags) throws Exception { public byte[] compress(int flags) throws Exception {
if(bitmapWidth < 1 || bitmapHeight < 1) if(srcWidth < 1 || srcHeight < 1)
throw new Exception("Bitmap buffer not initialized"); throw new Exception(NO_ASSOC_ERROR);
byte[] buf = new byte[TJ.bufSize(bitmapWidth, bitmapHeight)]; byte[] buf = new byte[TJ.bufSize(srcWidth, srcHeight)];
compress(buf, flags); compress(buf, flags);
return buf; return buf;
} }
@@ -173,8 +175,7 @@ public class TJCompressor {
* {@link TJ#bufSize} to determine the maximum size for this buffer based on * {@link TJ#bufSize} to determine the maximum size for this buffer based on
* the image width and height. * the image width and height.
* *
* @param flags the bitwise OR of one or more of the flags described in * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* {@link TJ}
*/ */
public void compress(BufferedImage srcImage, byte[] dstBuf, int flags) public void compress(BufferedImage srcImage, byte[] dstBuf, int flags)
throws Exception { throws Exception {
@@ -228,8 +229,7 @@ public class TJCompressor {
* @param srcImage a <code>BufferedImage</code> instance containing RGB or * @param srcImage a <code>BufferedImage</code> instance containing RGB or
* grayscale pixels to be compressed * grayscale pixels to be compressed
* *
* @param flags the bitwise OR of one or more of the flags described in * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* {@link TJ}
* *
* @return a buffer containing a JPEG image. The length of this buffer will * @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 * 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 * Encode the uncompressed source image associated with this compressor
* instance and output a YUV planar image to the given destination buffer. * 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 * TurboJPEG's underlying codec to produce a planar YUV image that is
* suitable for direct video display. Specifically, if the chrominance * suitable for direct video display. Specifically, if the chrominance
* components are subsampled along the horizontal dimension, then the width * 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 * {@link TJ#bufSizeYUV} to determine the appropriate size for this buffer
* based on the image width, height, and level of chrominance subsampling. * 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 * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* {@link TJ}
*/ */
public void encodeYUV(byte[] dstBuf, int flags) throws Exception { public void encodeYUV(byte[] dstBuf, int flags) throws Exception {
if(dstBuf == null || flags < 0) if(dstBuf == null || flags < 0)
throw new Exception("Invalid argument in compress()"); 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"); if(subsamp < 0) throw new Exception("Subsampling level not set");
encodeYUV(bitmapBuf, bitmapWidth, bitmapPitch, bitmapHeight, encodeYUV(srcBuf, srcWidth, srcPitch, srcHeight,
bitmapPixelFormat, dstBuf, subsamp, flags); srcPixelFormat, dstBuf, subsamp, flags);
compressedSize = TJ.bufSizeYUV(bitmapWidth, bitmapHeight, subsamp); compressedSize = TJ.bufSizeYUV(srcWidth, srcHeight, subsamp);
} }
/** /**
@@ -280,16 +279,15 @@ public class TJCompressor {
* instance and return a buffer containing a YUV planar image. See * instance and return a buffer containing a YUV planar image. See
* {@link #encodeYUV(byte[], int)} for more detail. * {@link #encodeYUV(byte[], int)} for more detail.
* *
* @param flags the bitwise OR of one or more of the flags described in * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* {@link TJ}
* *
* @return a buffer containing a YUV planar image * @return a buffer containing a YUV planar image
*/ */
public byte[] encodeYUV(int flags) throws Exception { public byte[] encodeYUV(int flags) throws Exception {
if(bitmapWidth < 1 || bitmapHeight < 1) if(srcWidth < 1 || srcHeight < 1)
throw new Exception("Bitmap buffer not initialized"); throw new Exception(NO_ASSOC_ERROR);
if(subsamp < 0) throw new Exception("Subsampling level not set"); 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); encodeYUV(buf, flags);
return buf; return buf;
} }
@@ -306,8 +304,7 @@ public class TJCompressor {
* {@link TJ#bufSizeYUV} to determine the appropriate size for this buffer * {@link TJ#bufSizeYUV} to determine the appropriate size for this buffer
* based on the image width, height, and level of chrominance subsampling. * 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 * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* {@link TJ}
*/ */
public void encodeYUV(BufferedImage srcImage, byte[] dstBuf, int flags) public void encodeYUV(BufferedImage srcImage, byte[] dstBuf, int flags)
throws Exception { throws Exception {
@@ -362,8 +359,7 @@ public class TJCompressor {
* @param srcImage a <code>BufferedImage</code> instance containing RGB or * @param srcImage a <code>BufferedImage</code> instance containing RGB or
* grayscale pixels to be encoded * grayscale pixels to be encoded
* *
* @param flags the bitwise OR of one or more of the flags described in * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* {@link TJ}
* *
* @return a buffer containing a YUV planar image * @return a buffer containing a YUV planar image
*/ */
@@ -431,11 +427,11 @@ public class TJCompressor {
} }
private long handle = 0; private long handle = 0;
private byte[] bitmapBuf = null; private byte[] srcBuf = null;
private int bitmapWidth = 0; private int srcWidth = 0;
private int bitmapHeight = 0; private int srcHeight = 0;
private int bitmapPitch = 0; private int srcPitch = 0;
private int bitmapPixelFormat = -1; private int srcPixelFormat = -1;
private int subsamp = -1; private int subsamp = -1;
private int jpegQuality = -1; private int jpegQuality = -1;
private int compressedSize = 0; private int compressedSize = 0;

View File

@@ -35,6 +35,9 @@ import java.awt.image.*;
*/ */
public class TJDecompressor { public class TJDecompressor {
private final static String NO_ASSOC_ERROR =
"No JPEG image is associated with this instance";
/** /**
* Create a TurboJPEG decompresssor instance. * Create a TurboJPEG decompresssor instance.
*/ */
@@ -46,12 +49,12 @@ public class TJDecompressor {
* Create a TurboJPEG decompressor instance and associate the JPEG image * Create a TurboJPEG decompressor instance and associate the JPEG image
* stored in <code>jpegImage</code> with the newly-created instance. * stored in <code>jpegImage</code> with the newly-created instance.
* *
* @param jpegImage JPEG image buffer (size of JPEG image is assumed to be * @param jpegImage JPEG image buffer (size of the JPEG image is assumed to
* the length of the buffer) * be the length of the array)
*/ */
public TJDecompressor(byte[] jpegImage) throws Exception { public TJDecompressor(byte[] jpegImage) throws Exception {
init(); init();
setJPEGBuffer(jpegImage, jpegImage.length); setJPEGImage(jpegImage, jpegImage.length);
} }
/** /**
@@ -61,25 +64,25 @@ public class TJDecompressor {
* *
* @param jpegImage JPEG image buffer * @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 { public TJDecompressor(byte[] jpegImage, int imageSize) throws Exception {
init(); init();
setJPEGBuffer(jpegImage, imageSize); setJPEGImage(jpegImage, imageSize);
} }
/** /**
* Associate a JPEG image buffer with this decompressor instance. This * Associate the JPEG image of length <code>imageSize</code> bytes stored in
* buffer will be used as the source buffer for subsequent decompress * <code>jpegImage</code> with this decompressor instance. This image will
* operations. * be used as the source image for subsequent decompress operations.
* *
* @param jpegImage JPEG image buffer * @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) if(jpegImage == null || imageSize < 1)
throw new Exception("Invalid argument in setJPEGBuffer()"); throw new Exception("Invalid argument in setJPEGImage()");
jpegBuf = jpegImage; jpegBuf = jpegImage;
jpegBufSize = imageSize; jpegBufSize = imageSize;
decompressHeader(jpegBuf, jpegBufSize); decompressHeader(jpegBuf, jpegBufSize);
@@ -93,7 +96,7 @@ public class TJDecompressor {
* instance * instance
*/ */
public int getWidth() throws Exception { 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; return jpegWidth;
} }
@@ -105,7 +108,7 @@ public class TJDecompressor {
* instance * instance
*/ */
public int getHeight() throws Exception { 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; return jpegHeight;
} }
@@ -117,8 +120,8 @@ public class TJDecompressor {
* associated with this decompressor instance * associated with this decompressor instance
*/ */
public int getSubsamp() throws Exception { public int getSubsamp() throws Exception {
if(jpegSubsamp < 0) throw new Exception("JPEG buffer not initialized"); if(jpegSubsamp < 0) throw new Exception(NO_ASSOC_ERROR);
if(jpegSubsamp >= TJ.NUMSAMPOPT) if(jpegSubsamp >= TJ.NUMSAMP)
throw new Exception("JPEG header information is invalid"); throw new Exception("JPEG header information is invalid");
return jpegSubsamp; return jpegSubsamp;
} }
@@ -129,7 +132,7 @@ public class TJDecompressor {
* @return the JPEG image buffer associated with this decompressor instance * @return the JPEG image buffer associated with this decompressor instance
*/ */
public byte[] getJPEGBuf() throws Exception { 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; return jpegBuf;
} }
@@ -141,7 +144,7 @@ public class TJDecompressor {
* decompressor instance * decompressor instance
*/ */
public int getJPEGSize() throws Exception { 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; return jpegBufSize;
} }
@@ -152,12 +155,14 @@ public class TJDecompressor {
* height. * height.
* *
* @param desiredWidth desired width (in pixels) of the decompressed image. * @param desiredWidth desired width (in pixels) of the decompressed image.
* If this is set to 0, then only the height will be considered when * Setting this to 0 is the same as setting it to the width of the JPEG image
* determining the scaled image size. * (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. * @param desiredHeight desired height (in pixels) of the decompressed image.
* If this is set to 0, then only the width will be considered when * Setting this to 0 is the same as setting it to the height of the JPEG
* determining the scaled image size. * 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 * @return the width of the largest scaled down image that the TurboJPEG
* decompressor can generate without exceeding the desired image width and * decompressor can generate without exceeding the desired image width and
@@ -166,7 +171,7 @@ public class TJDecompressor {
public int getScaledWidth(int desiredWidth, int desiredHeight) public int getScaledWidth(int desiredWidth, int desiredHeight)
throws Exception { throws Exception {
if(jpegWidth < 1 || jpegHeight < 1) if(jpegWidth < 1 || jpegHeight < 1)
throw new Exception("JPEG buffer not initialized"); throw new Exception(NO_ASSOC_ERROR);
if(desiredWidth < 0 || desiredHeight < 0) if(desiredWidth < 0 || desiredHeight < 0)
throw new Exception("Invalid argument in getScaledWidth()"); throw new Exception("Invalid argument in getScaledWidth()");
TJ.ScalingFactor sf[] = TJ.getScalingFactors(); TJ.ScalingFactor sf[] = TJ.getScalingFactors();
@@ -190,12 +195,14 @@ public class TJDecompressor {
* height. * height.
* *
* @param desiredWidth desired width (in pixels) of the decompressed image. * @param desiredWidth desired width (in pixels) of the decompressed image.
* If this is set to 0, then only the height will be considered when * Setting this to 0 is the same as setting it to the width of the JPEG image
* determining the scaled image size. * (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. * @param desiredHeight desired height (in pixels) of the decompressed image.
* If this is set to 0, then only the width will be considered when * Setting this to 0 is the same as setting it to the height of the JPEG
* determining the scaled image size. * 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 * @return the height of the largest scaled down image that the TurboJPEG
* decompressor can generate without exceeding the desired image width and * decompressor can generate without exceeding the desired image width and
@@ -204,7 +211,7 @@ public class TJDecompressor {
public int getScaledHeight(int desiredWidth, int desiredHeight) public int getScaledHeight(int desiredWidth, int desiredHeight)
throws Exception { throws Exception {
if(jpegWidth < 1 || jpegHeight < 1) if(jpegWidth < 1 || jpegHeight < 1)
throw new Exception("JPEG buffer not initialized"); throw new Exception(NO_ASSOC_ERROR);
if(desiredWidth < 0 || desiredHeight < 0) if(desiredWidth < 0 || desiredHeight < 0)
throw new Exception("Invalid argument in getScaledHeight()"); throw new Exception("Invalid argument in getScaledHeight()");
TJ.ScalingFactor sf[] = TJ.getScalingFactors(); TJ.ScalingFactor sf[] = TJ.getScalingFactors();
@@ -236,8 +243,9 @@ public class TJDecompressor {
* If the desired image dimensions are smaller than the dimensions of the * If the desired image dimensions are smaller than the dimensions of the
* JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG * JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG
* decompressor to generate the largest possible image that will fit within * decompressor to generate the largest possible image that will fit within
* the desired dimensions. If desiredWidth is set to 0, then only the height * the desired dimensions. Setting this to 0 is the same as setting it to
* will be considered when determining the scaled image size. * 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 * @param pitch bytes per line of the destination image. Normally, this
* should be set to <code>scaledWidth * TJ.pixelSize(pixelFormat)</code> if * 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: * pad each line of the decompressed image to a 4-byte boundary. NOTE:
* <code>scaledWidth = ceil(jpegWidth * scalingFactor)</code>. Setting this * <code>scaledWidth = ceil(jpegWidth * scalingFactor)</code>. Setting this
* parameter to 0 is the equivalent of setting it to * 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. * @param desiredHeight desired height (in pixels) of the decompressed image.
* If the desired image dimensions are smaller than the dimensions of the * If the desired image dimensions are smaller than the dimensions of the
* JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG * JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG
* decompressor to generate the largest possible image that will fit within * decompressor to generate the largest possible image that will fit within
* the desired dimensions. If desiredHeight is set to 0, then only the * the desired dimensions. Setting this to 0 is the same as setting it to
* width will be considered when determining the scaled image size. * 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 * @param pixelFormat pixel format of the decompressed image (one of
* {@link TJ}) * {@link TJ TJ.PF_*})
* *
* @param flags the bitwise OR of one or more of the flags described in * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* {@link TJ}
*/ */
public void decompress(byte[] dstBuf, int desiredWidth, int pitch, public void decompress(byte[] dstBuf, int desiredWidth, int pitch,
int desiredHeight, int pixelFormat, int flags) throws Exception { 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 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()"); throw new Exception("Invalid argument in decompress()");
decompress(jpegBuf, jpegBufSize, dstBuf, desiredWidth, pitch, decompress(jpegBuf, jpegBufSize, dstBuf, desiredWidth, pitch,
desiredHeight, pixelFormat, flags); desiredHeight, pixelFormat, flags);
@@ -283,18 +291,17 @@ public class TJDecompressor {
* @param desiredHeight see * @param desiredHeight see
* {@link #decompress(byte[], int, int, int, int, int)} for description * {@link #decompress(byte[], int, int, int, int, int)} for description
* *
* @param pixelFormat Pixel format of the decompressed image (see * @param pixelFormat pixel format of the decompressed image (one of
* {@link TJ}) * {@link TJ TJ.PF_*})
* *
* @param flags the bitwise OR of one or more of the flags described in * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* {@link TJ}
* *
* @return a buffer containing the decompressed image * @return a buffer containing the decompressed image
*/ */
public byte[] decompress(int desiredWidth, int pitch, int desiredHeight, public byte[] decompress(int desiredWidth, int pitch, int desiredHeight,
int pixelFormat, int flags) throws Exception { int pixelFormat, int flags) throws Exception {
if(desiredWidth < 0 || pitch < 0 || desiredHeight < 0 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()"); throw new Exception("Invalid argument in decompress()");
int pixelSize = TJ.getPixelSize(pixelFormat); int pixelSize = TJ.getPixelSize(pixelFormat);
int scaledWidth = getScaledWidth(desiredWidth, desiredHeight); int scaledWidth = getScaledWidth(desiredWidth, desiredHeight);
@@ -320,11 +327,10 @@ public class TJDecompressor {
* {@link TJ#bufSizeYUV} to determine the appropriate size for this buffer * {@link TJ#bufSizeYUV} to determine the appropriate size for this buffer
* based on the image width, height, and level of chrominance subsampling. * 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 * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* {@link TJ}
*/ */
public void decompressToYUV(byte[] dstBuf, int flags) throws Exception { 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) if(dstBuf == null || flags < 0)
throw new Exception("Invalid argument in decompressToYUV()"); throw new Exception("Invalid argument in decompressToYUV()");
decompressToYUV(jpegBuf, jpegBufSize, dstBuf, flags); decompressToYUV(jpegBuf, jpegBufSize, dstBuf, flags);
@@ -336,8 +342,7 @@ public class TJDecompressor {
* instance and return a buffer containing a YUV planar image. See {@link * instance and return a buffer containing a YUV planar image. See {@link
* #decompressToYUV(byte[], int)} for more detail. * #decompressToYUV(byte[], int)} for more detail.
* *
* @param flags the bitwise OR of one or more of the flags described in * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* {@link TJ}
* *
* @return a buffer containing a YUV planar image * @return a buffer containing a YUV planar image
*/ */
@@ -345,8 +350,8 @@ public class TJDecompressor {
if(flags < 0) if(flags < 0)
throw new Exception("Invalid argument in decompressToYUV()"); throw new Exception("Invalid argument in decompressToYUV()");
if(jpegWidth < 1 || jpegHeight < 1 || jpegSubsamp < 0) if(jpegWidth < 1 || jpegHeight < 1 || jpegSubsamp < 0)
throw new Exception("JPEG buffer not initialized"); throw new Exception(NO_ASSOC_ERROR);
if(jpegSubsamp >= TJ.NUMSAMPOPT) if(jpegSubsamp >= TJ.NUMSAMP)
throw new Exception("JPEG header information is invalid"); throw new Exception("JPEG header information is invalid");
byte[] buf = new byte[TJ.bufSizeYUV(jpegWidth, jpegHeight, jpegSubsamp)]; byte[] buf = new byte[TJ.bufSizeYUV(jpegWidth, jpegHeight, jpegSubsamp)];
decompressToYUV(buf, flags); decompressToYUV(buf, flags);
@@ -361,8 +366,7 @@ public class TJDecompressor {
* @param dstImage a <code>BufferedImage</code> instance which will receive * @param dstImage a <code>BufferedImage</code> instance which will receive
* the decompressed image * the decompressed image
* *
* @param flags the bitwise OR of one or more of the flags described in * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* {@link TJ}
*/ */
public void decompress(BufferedImage dstImage, int flags) throws Exception { public void decompress(BufferedImage dstImage, int flags) throws Exception {
if(dstImage == null || flags < 0) if(dstImage == null || flags < 0)
@@ -393,7 +397,7 @@ public class TJDecompressor {
int pitch = sm.getScanlineStride(); int pitch = sm.getScanlineStride();
DataBufferInt db = (DataBufferInt)wr.getDataBuffer(); DataBufferInt db = (DataBufferInt)wr.getDataBuffer();
int[] buf = db.getData(); 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, decompress(jpegBuf, jpegBufSize, buf, scaledWidth, pitch, scaledHeight,
pixelFormat, flags); pixelFormat, flags);
} }
@@ -421,11 +425,11 @@ public class TJDecompressor {
* @param desiredHeight see * @param desiredHeight see
* {@link #decompress(byte[], int, int, int, int, int)} for description * {@link #decompress(byte[], int, int, int, int, int)} for description
* *
* @param bufferedImageType the image type of the <code>BufferedImage</code> * @param bufferedImageType the image type of the newly-created
* instance to create (for instance, <code>BufferedImage.TYPE_INT_RGB</code>) * <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 * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* {@link TJ}
* *
* @return a <code>BufferedImage</code> instance containing the * @return a <code>BufferedImage</code> instance containing the
* decompressed image * decompressed image

View File

@@ -155,8 +155,8 @@ public class TJTransform extends Rectangle {
* Create a new lossless transform instance with the given parameters. * Create a new lossless transform instance with the given parameters.
* *
* @param r a <code>Rectangle</code> instance which specifies the cropping * @param r a <code>Rectangle</code> instance which specifies the cropping
* region. See {@link #TJTransform(int, int, int, int, int, int)} for a * region. See {@link #TJTransform(int, int, int, int, int, int)} for more
* description of the cropping region. * detail.
* *
* @param op one of the transform operations (<code>OP_*</code>) * @param op one of the transform operations (<code>OP_*</code>)
* *

View File

@@ -44,12 +44,12 @@ public class TJTransformer extends TJDecompressor {
* Create a TurboJPEG lossless transformer instance and associate the JPEG * Create a TurboJPEG lossless transformer instance and associate the JPEG
* image stored in <code>jpegImage</code> with the newly-created instance. * image stored in <code>jpegImage</code> with the newly-created instance.
* *
* @param jpegImage JPEG image buffer (size of JPEG image is assumed to be * @param jpegImage JPEG image buffer (size of the JPEG image is assumed to
* the length of the buffer) * be the length of the array)
*/ */
public TJTransformer(byte[] jpegImage) throws Exception { public TJTransformer(byte[] jpegImage) throws Exception {
init(); init();
setJPEGBuffer(jpegImage, jpegImage.length); setJPEGImage(jpegImage, jpegImage.length);
} }
/** /**
@@ -59,11 +59,11 @@ public class TJTransformer extends TJDecompressor {
* *
* @param jpegImage JPEG image buffer * @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 { public TJTransformer(byte[] jpegImage, int imageSize) throws Exception {
init(); 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 * image, transforming it, and re-compressing it, lossless transforms are not
* free. Each lossless transform requires reading and Huffman decoding all * free. Each lossless transform requires reading and Huffman decoding all
* of the coefficients in the source image, regardless of the size of the * 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 * multiple transformed images from the same source or of applying multiple
* transformations simultaneously, in order to eliminate the need to read the * transformations simultaneously, in order to eliminate the need to read the
* source coefficients multiple times. * 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 * 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. * 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 * which specifies the transform parameters and/or cropping region for the
* corresponding transformed output image * corresponding transformed output image
* *
* @param flags the bitwise OR of one or more of the flags described in * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* {@link TJ}
*/ */
public void transform(byte[][] dstBufs, TJTransform[] transforms, public void transform(byte[][] dstBufs, TJTransform[] transforms,
int flags) throws Exception { int flags) throws Exception {
@@ -104,15 +103,14 @@ public class TJTransformer extends TJDecompressor {
* instance and return an array of {@link TJDecompressor} instances, each of * instance and return an array of {@link TJDecompressor} instances, each of
* which has a transformed JPEG image associated with it. * 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 * which specifies the transform parameters and/or cropping region for the
* corresponding transformed output image * corresponding transformed output image
* *
* @return an array of {@link TJDecompressor} instances, each of * @return an array of {@link TJDecompressor} instances, each of
* which has a transformed JPEG image associated with it * which has a transformed JPEG image associated with it
* *
* @param flags the bitwise OR of one or more of the flags described in * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* {@link TJ}
*/ */
public TJDecompressor[] transform(TJTransform[] transforms, int flags) public TJDecompressor[] transform(TJTransform[] transforms, int flags)
throws Exception { throws Exception {