Add x, y parameters to TJDecompressor so that it can be used to decompress to an arbitrary position in the destination image (TurboVNC needs this.)
This commit is contained in:
@@ -34,6 +34,9 @@ calling conventions.
|
||||
images (specifically, images in which the component count was erroneously set
|
||||
to a large value) would cause libjpeg-turbo to segfault.
|
||||
|
||||
[8] Extended the TurboJPEG Java API so that it can be used to decompress a
|
||||
JPEG image into an arbitrary position in a large output buffer.
|
||||
|
||||
|
||||
1.2.0
|
||||
=====
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
|
||||
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
|
||||
<TITLE>
|
||||
All Classes
|
||||
</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2011-12-18">
|
||||
<META NAME="date" CONTENT="2012-06-06">
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
|
||||
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
|
||||
<TITLE>
|
||||
All Classes
|
||||
</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2011-12-18">
|
||||
<META NAME="date" CONTENT="2012-06-06">
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
|
||||
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
|
||||
<TITLE>
|
||||
Constant Field Values
|
||||
</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2011-12-18">
|
||||
<META NAME="date" CONTENT="2012-06-06">
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
|
||||
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
|
||||
<TITLE>
|
||||
Deprecated List
|
||||
</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2011-12-18">
|
||||
<META NAME="date" CONTENT="2012-06-06">
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
|
||||
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
|
||||
<TITLE>
|
||||
API Help
|
||||
</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2011-12-18">
|
||||
<META NAME="date" CONTENT="2012-06-06">
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
|
||||
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
|
||||
<TITLE>
|
||||
Index
|
||||
</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2011-12-18">
|
||||
<META NAME="date" CONTENT="2012-06-06">
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="./stylesheet.css" TITLE="Style">
|
||||
|
||||
@@ -129,6 +129,10 @@ Method in interface org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbo
|
||||
<A NAME="_D_"><!-- --></A><H2>
|
||||
<B>D</B></H2>
|
||||
<DL>
|
||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int, int, int)"><B>decompress(byte[], int, int, int, int, int, int, int)</B></A> -
|
||||
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
|
||||
<DD>Decompress the JPEG source image associated with this decompressor
|
||||
instance and output a decompressed image to the given destination buffer.
|
||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)"><B>decompress(byte[], int, int, int, int, int)</B></A> -
|
||||
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
|
||||
<DD>Decompress the JPEG source image associated with this decompressor
|
||||
@@ -137,6 +141,10 @@ Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg
|
||||
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
|
||||
<DD>Decompress the JPEG source image associated with this decompressor
|
||||
instance and return a buffer containing the decompressed image.
|
||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int[], int, int, int, int, int, int, int)"><B>decompress(int[], int, int, int, int, int, int, int)</B></A> -
|
||||
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
|
||||
<DD>Decompress the JPEG source image associated with this decompressor
|
||||
instance and output a decompressed image to the given destination buffer.
|
||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(java.awt.image.BufferedImage, int)"><B>decompress(BufferedImage, int)</B></A> -
|
||||
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
|
||||
<DD>Decompress the JPEG source image associated with this decompressor
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc on Sun Dec 18 20:09:44 CST 2011-->
|
||||
<!-- Generated by javadoc on Wed Jun 06 03:10:33 CDT 2012-->
|
||||
<TITLE>
|
||||
Generated Documentation (Untitled)
|
||||
</TITLE>
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
|
||||
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
|
||||
<TITLE>
|
||||
TJ
|
||||
</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2011-12-18">
|
||||
<META NAME="date" CONTENT="2012-06-06">
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
|
||||
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
|
||||
<TITLE>
|
||||
TJCompressor
|
||||
</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2011-12-18">
|
||||
<META NAME="date" CONTENT="2012-06-06">
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
|
||||
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
|
||||
<TITLE>
|
||||
TJCustomFilter
|
||||
</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2011-12-18">
|
||||
<META NAME="date" CONTENT="2012-06-06">
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
|
||||
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
|
||||
<TITLE>
|
||||
TJDecompressor
|
||||
</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2011-12-18">
|
||||
<META NAME="date" CONTENT="2012-06-06">
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
|
||||
|
||||
@@ -236,6 +236,38 @@ TurboJPEG decompressor
|
||||
int pixelFormat,
|
||||
int flags)</CODE>
|
||||
|
||||
<BR>
|
||||
Decompress the JPEG source image associated with this decompressor
|
||||
instance and output a decompressed image to the given destination buffer.</TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||
<CODE> void</CODE></FONT></TD>
|
||||
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int, int, int)">decompress</A></B>(byte[] dstBuf,
|
||||
int x,
|
||||
int y,
|
||||
int desiredWidth,
|
||||
int pitch,
|
||||
int desiredHeight,
|
||||
int pixelFormat,
|
||||
int flags)</CODE>
|
||||
|
||||
<BR>
|
||||
Decompress the JPEG source image associated with this decompressor
|
||||
instance and output a decompressed image to the given destination buffer.</TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||
<CODE> void</CODE></FONT></TD>
|
||||
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int[], int, int, int, int, int, int, int)">decompress</A></B>(int[] dstBuf,
|
||||
int x,
|
||||
int y,
|
||||
int desiredWidth,
|
||||
int stride,
|
||||
int desiredHeight,
|
||||
int pixelFormat,
|
||||
int flags)</CODE>
|
||||
|
||||
<BR>
|
||||
Decompress the JPEG source image associated with this decompressor
|
||||
instance and output a decompressed image to the given destination buffer.</TD>
|
||||
@@ -688,10 +720,12 @@ public int <B>getScaledHeight</B>(int desiredWidth,
|
||||
</DL>
|
||||
<HR>
|
||||
|
||||
<A NAME="decompress(byte[], int, int, int, int, int)"><!-- --></A><H3>
|
||||
<A NAME="decompress(byte[], int, int, int, int, int, int, int)"><!-- --></A><H3>
|
||||
decompress</H3>
|
||||
<PRE>
|
||||
public void <B>decompress</B>(byte[] dstBuf,
|
||||
int x,
|
||||
int y,
|
||||
int desiredWidth,
|
||||
int pitch,
|
||||
int desiredHeight,
|
||||
@@ -707,7 +741,13 @@ public void <B>decompress</B>(byte[] dstBuf,
|
||||
buffer should normally be <code>pitch * scaledHeight</code> bytes in size,
|
||||
where <code>scaledHeight</code> can be determined by calling <code>
|
||||
scalingFactor.<A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><CODE>getScaled</CODE></A>(jpegHeight)
|
||||
</code> with one of the scaling factors returned from <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()"><CODE>TJ.getScalingFactors()</CODE></A> or by calling <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int, int)"><CODE>getScaledHeight(int, int)</CODE></A>.<DD><CODE>desiredWidth</CODE> - desired width (in pixels) of the decompressed image.
|
||||
</code> with one of the scaling factors returned from <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()"><CODE>TJ.getScalingFactors()</CODE></A> or by calling <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int, int)"><CODE>getScaledHeight(int, int)</CODE></A>. However,
|
||||
the buffer may also be larger than the dimensions of the JPEG image, in
|
||||
which case the <code>x</code>, <code>y</code>, and <code>pitch</code>
|
||||
parameters can be used to specify the region into which the JPEG image
|
||||
should be decompressed.<DD><CODE>x</CODE> - x offset (in pixels) of the region into which the JPEG image
|
||||
should be decompressed, relative to the start of <code>dstBuf</code>.<DD><CODE>y</CODE> - y offset (in pixels) of the region into which the JPEG image
|
||||
should be decompressed, relative to the start of <code>dstBuf</code>.<DD><CODE>desiredWidth</CODE> - desired width (in pixels) of the decompressed image.
|
||||
If the desired image dimensions are smaller than the dimensions of the
|
||||
JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG
|
||||
decompressor to generate the largest possible image that will fit within
|
||||
@@ -716,7 +756,8 @@ public void <B>decompress</B>(byte[] dstBuf,
|
||||
considered when determining the scaled image size.)<DD><CODE>pitch</CODE> - bytes per line of the destination image. Normally, this
|
||||
should be set to <code>scaledWidth * TJ.pixelSize(pixelFormat)</code> if
|
||||
the decompressed image is unpadded, but you can use this to, for instance,
|
||||
pad each line of the decompressed image to a 4-byte boundary. NOTE:
|
||||
pad each line of the decompressed image to a 4-byte boundary or to
|
||||
decompress the JPEG image into a region of a larger image. NOTE:
|
||||
<code>scaledWidth</code> can be determined by calling <code>
|
||||
scalingFactor.<A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><CODE>getScaled</CODE></A>(jpegWidth)
|
||||
</code> or by calling <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int, int)"><CODE>getScaledWidth(int, int)</CODE></A>. Setting this parameter to
|
||||
@@ -735,6 +776,37 @@ public void <B>decompress</B>(byte[] dstBuf,
|
||||
</DL>
|
||||
<HR>
|
||||
|
||||
<A NAME="decompress(byte[], int, int, int, int, int)"><!-- --></A><H3>
|
||||
decompress</H3>
|
||||
<PRE>
|
||||
public void <B>decompress</B>(byte[] dstBuf,
|
||||
int desiredWidth,
|
||||
int pitch,
|
||||
int desiredHeight,
|
||||
int pixelFormat,
|
||||
int flags)
|
||||
throws java.lang.Exception</PRE>
|
||||
<DL>
|
||||
<DD>Decompress the JPEG source image associated with this decompressor
|
||||
instance and output a decompressed image to the given destination buffer.
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>dstBuf</CODE> - see
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int, int, int)"><CODE>decompress(byte[], int, int, int, int, int, int, int)</CODE></A>
|
||||
for description<DD><CODE>desiredWidth</CODE> - see
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int, int, int)"><CODE>decompress(byte[], int, int, 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, int, int)"><CODE>decompress(byte[], int, int, 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, int, int)"><CODE>decompress(byte[], int, int, int, int, int, int, int)</CODE></A>
|
||||
for description<DD><CODE>pixelFormat</CODE> - pixel format of the decompressed image (one of
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.PF_*</CODE></A>)<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
</DD>
|
||||
</DL>
|
||||
<HR>
|
||||
|
||||
<A NAME="decompress(int, int, int, int, int)"><!-- --></A><H3>
|
||||
decompress</H3>
|
||||
<PRE>
|
||||
@@ -750,9 +822,12 @@ public byte[] <B>decompress</B>(int desiredWidth,
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>desiredWidth</CODE> - see
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)"><CODE>decompress(byte[], int, int, int, int, int)</CODE></A> for description<DD><CODE>pitch</CODE> - see
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)"><CODE>decompress(byte[], int, int, int, int, int)</CODE></A> for description<DD><CODE>desiredHeight</CODE> - see
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)"><CODE>decompress(byte[], int, int, int, int, int)</CODE></A> for description<DD><CODE>pixelFormat</CODE> - pixel format of the decompressed image (one of
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int, int, int)"><CODE>decompress(byte[], int, int, 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, int, int)"><CODE>decompress(byte[], int, int, 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, int, int)"><CODE>decompress(byte[], int, int, int, int, int, int, int)</CODE></A>
|
||||
for description<DD><CODE>pixelFormat</CODE> - pixel format of the decompressed image (one of
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.PF_*</CODE></A>)<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
|
||||
<DT><B>Returns:</B><DD>a buffer containing the decompressed image
|
||||
<DT><B>Throws:</B>
|
||||
@@ -806,6 +881,59 @@ public byte[] <B>decompressToYUV</B>(int flags)
|
||||
</DL>
|
||||
<HR>
|
||||
|
||||
<A NAME="decompress(int[], int, int, int, int, int, int, int)"><!-- --></A><H3>
|
||||
decompress</H3>
|
||||
<PRE>
|
||||
public void <B>decompress</B>(int[] dstBuf,
|
||||
int x,
|
||||
int y,
|
||||
int desiredWidth,
|
||||
int stride,
|
||||
int desiredHeight,
|
||||
int pixelFormat,
|
||||
int flags)
|
||||
throws java.lang.Exception</PRE>
|
||||
<DL>
|
||||
<DD>Decompress the JPEG source image associated with this decompressor
|
||||
instance and output a decompressed image to the given destination buffer.
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>dstBuf</CODE> - buffer that will receive the decompressed image. This
|
||||
buffer should normally be <code>stride * scaledHeight</code> pixels in
|
||||
size, where <code>scaledHeight</code> can be determined by calling <code>
|
||||
scalingFactor.<A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><CODE>getScaled</CODE></A>(jpegHeight)
|
||||
</code> with one of the scaling factors returned from <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()"><CODE>TJ.getScalingFactors()</CODE></A> or by calling <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int, int)"><CODE>getScaledHeight(int, int)</CODE></A>. However,
|
||||
the buffer may also be larger than the dimensions of the JPEG image, in
|
||||
which case the <code>x</code>, <code>y</code>, and <code>stride</code>
|
||||
parameters can be used to specify the region into which the JPEG image
|
||||
should be decompressed.<DD><CODE>x</CODE> - x offset (in pixels) of the region into which the JPEG image
|
||||
should be decompressed, relative to the start of <code>dstBuf</code>.<DD><CODE>y</CODE> - y offset (in pixels) of the region into which the JPEG image
|
||||
should be decompressed, relative to the start of <code>dstBuf</code>.<DD><CODE>desiredWidth</CODE> - desired width (in pixels) of the decompressed image.
|
||||
If the desired image dimensions are smaller than the dimensions of the
|
||||
JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG
|
||||
decompressor to generate the largest possible image that will fit within
|
||||
the desired dimensions. Setting this to 0 is the same as setting it to
|
||||
the width of the JPEG image (in other words, the width will not be
|
||||
considered when determining the scaled image size.)<DD><CODE>stride</CODE> - pixels per line of the destination image. Normally, this
|
||||
should be set to <code>scaledWidth</code>, but you can use this to, for
|
||||
instance, decompress the JPEG image into a region of a larger image.
|
||||
NOTE: <code>scaledWidth</code> can be determined by calling <code>
|
||||
scalingFactor.<A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><CODE>getScaled</CODE></A>(jpegWidth)
|
||||
</code> or by calling <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int, int)"><CODE>getScaledWidth(int, int)</CODE></A>. Setting this parameter to
|
||||
0 is the equivalent of setting it to <code>scaledWidth</code>.<DD><CODE>desiredHeight</CODE> - desired height (in pixels) of the decompressed image.
|
||||
If the desired image dimensions are smaller than the dimensions of the
|
||||
JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG
|
||||
decompressor to generate the largest possible image that will fit within
|
||||
the desired dimensions. Setting this to 0 is the same as setting it to
|
||||
the height of the JPEG image (in other words, the height will not be
|
||||
considered when determining the scaled image size.)<DD><CODE>pixelFormat</CODE> - pixel format of the decompressed image (one of
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.PF_*</CODE></A>)<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
</DD>
|
||||
</DL>
|
||||
<HR>
|
||||
|
||||
<A NAME="decompress(java.awt.image.BufferedImage, int)"><!-- --></A><H3>
|
||||
decompress</H3>
|
||||
<PRE>
|
||||
@@ -841,8 +969,10 @@ public java.awt.image.BufferedImage <B>decompress</B>(int desiredWidth,
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>desiredWidth</CODE> - see
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)"><CODE>decompress(byte[], int, int, int, int, int)</CODE></A> for description<DD><CODE>desiredHeight</CODE> - see
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)"><CODE>decompress(byte[], int, int, int, int, int)</CODE></A> for description<DD><CODE>bufferedImageType</CODE> - the image type of the newly-created
|
||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int, int, int)"><CODE>decompress(byte[], int, int, 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, int, int)"><CODE>decompress(byte[], int, int, int, int, int, int, int)</CODE></A> for
|
||||
description<DD><CODE>bufferedImageType</CODE> - the image type of the newly-created
|
||||
<code>BufferedImage</code> instance (for instance,
|
||||
<code>BufferedImage.TYPE_INT_RGB</code>)<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
|
||||
<DT><B>Returns:</B><DD>a <code>BufferedImage</code> instance containing the
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
|
||||
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
|
||||
<TITLE>
|
||||
TJScalingFactor
|
||||
</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2011-12-18">
|
||||
<META NAME="date" CONTENT="2012-06-06">
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
|
||||
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
|
||||
<TITLE>
|
||||
TJTransform
|
||||
</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2011-12-18">
|
||||
<META NAME="date" CONTENT="2012-06-06">
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
|
||||
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
|
||||
<TITLE>
|
||||
TJTransformer
|
||||
</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2011-12-18">
|
||||
<META NAME="date" CONTENT="2012-06-06">
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
|
||||
|
||||
@@ -205,7 +205,7 @@ TurboJPEG lossless transformer
|
||||
<TH ALIGN="left"><B>Methods inherited from class org.libjpegturbo.turbojpeg.<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A></B></TH>
|
||||
</TR>
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD><CODE><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#close()">close</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(java.awt.image.BufferedImage, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int, int, int, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int, int, int, int, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int)">decompressToYUV</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int)">decompressToYUV</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#finalize()">finalize</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getHeight()">getHeight</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGBuf()">getJPEGBuf</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGSize()">getJPEGSize</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int, int)">getScaledHeight</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int, int)">getScaledWidth</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSubsamp()">getSubsamp</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getWidth()">getWidth</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGImage(byte[], int)">setJPEGImage</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(byte[], int, int, int, int, int, int, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int[], int, int, int, int, int, int, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int, int, int, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int, int, int, int, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int)">decompressToYUV</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int)">decompressToYUV</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#finalize()">finalize</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getHeight()">getHeight</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGBuf()">getJPEGBuf</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGSize()">getJPEGSize</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int, int)">getScaledHeight</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int, int)">getScaledWidth</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSubsamp()">getSubsamp</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getWidth()">getWidth</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGImage(byte[], int)">setJPEGImage</A></CODE></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
|
||||
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
|
||||
<TITLE>
|
||||
org.libjpegturbo.turbojpeg
|
||||
</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2011-12-18">
|
||||
<META NAME="date" CONTENT="2012-06-06">
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
|
||||
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
|
||||
<TITLE>
|
||||
org.libjpegturbo.turbojpeg
|
||||
</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2011-12-18">
|
||||
<META NAME="date" CONTENT="2012-06-06">
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
|
||||
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
|
||||
<TITLE>
|
||||
org.libjpegturbo.turbojpeg Class Hierarchy
|
||||
</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2011-12-18">
|
||||
<META NAME="date" CONTENT="2012-06-06">
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
|
||||
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
|
||||
<TITLE>
|
||||
Class Hierarchy
|
||||
</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2011-12-18">
|
||||
<META NAME="date" CONTENT="2012-06-06">
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 18 20:09:44 CST 2011 -->
|
||||
<!-- Generated by javadoc (build 1.6.0_31) on Wed Jun 06 03:10:33 CDT 2012 -->
|
||||
<TITLE>
|
||||
Serialized Form
|
||||
</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2011-12-18">
|
||||
<META NAME="date" CONTENT="2012-06-06">
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2011 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2011-2012 D. R. Commander. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -239,7 +239,17 @@ public class TJDecompressor {
|
||||
* where <code>scaledHeight</code> can be determined by calling <code>
|
||||
* scalingFactor.{@link TJScalingFactor#getScaled getScaled}(jpegHeight)
|
||||
* </code> with one of the scaling factors returned from {@link
|
||||
* TJ#getScalingFactors} or by calling {@link #getScaledHeight}.
|
||||
* TJ#getScalingFactors} or by calling {@link #getScaledHeight}. However,
|
||||
* the buffer may also be larger than the dimensions of the JPEG image, in
|
||||
* which case the <code>x</code>, <code>y</code>, and <code>pitch</code>
|
||||
* parameters can be used to specify the region into which the JPEG image
|
||||
* should be decompressed.
|
||||
*
|
||||
* @param x x offset (in pixels) of the region into which the JPEG image
|
||||
* should be decompressed, relative to the start of <code>dstBuf</code>.
|
||||
*
|
||||
* @param y y offset (in pixels) of the region into which the JPEG image
|
||||
* should be decompressed, relative to the start of <code>dstBuf</code>.
|
||||
*
|
||||
* @param desiredWidth desired width (in pixels) of the decompressed image.
|
||||
* If the desired image dimensions are smaller than the dimensions of the
|
||||
@@ -252,7 +262,8 @@ public class TJDecompressor {
|
||||
* @param pitch bytes per line of the destination image. Normally, this
|
||||
* should be set to <code>scaledWidth * TJ.pixelSize(pixelFormat)</code> if
|
||||
* the decompressed image is unpadded, but you can use this to, for instance,
|
||||
* pad each line of the decompressed image to a 4-byte boundary. NOTE:
|
||||
* pad each line of the decompressed image to a 4-byte boundary or to
|
||||
* decompress the JPEG image into a region of a larger image. NOTE:
|
||||
* <code>scaledWidth</code> can be determined by calling <code>
|
||||
* scalingFactor.{@link TJScalingFactor#getScaled getScaled}(jpegWidth)
|
||||
* </code> or by calling {@link #getScaledWidth}. Setting this parameter to
|
||||
@@ -272,28 +283,65 @@ public class TJDecompressor {
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
|
||||
*/
|
||||
public void decompress(byte[] dstBuf, int desiredWidth, int pitch,
|
||||
int desiredHeight, int pixelFormat, int flags) throws Exception {
|
||||
public void decompress(byte[] dstBuf, int x, int y, int desiredWidth,
|
||||
int pitch, int desiredHeight, int pixelFormat, int flags)
|
||||
throws Exception {
|
||||
if(jpegBuf == null) throw new Exception(NO_ASSOC_ERROR);
|
||||
if(dstBuf == null || desiredWidth < 0 || pitch < 0 || desiredHeight < 0
|
||||
|| pixelFormat < 0 || pixelFormat >= TJ.NUMPF || flags < 0)
|
||||
if(dstBuf == null || x < 0 || y < 0 || desiredWidth < 0 || pitch < 0
|
||||
|| desiredHeight < 0 || pixelFormat < 0 || pixelFormat >= TJ.NUMPF
|
||||
|| flags < 0)
|
||||
throw new Exception("Invalid argument in decompress()");
|
||||
decompress(jpegBuf, jpegBufSize, dstBuf, desiredWidth, pitch,
|
||||
decompress(jpegBuf, jpegBufSize, dstBuf, x, y, desiredWidth, pitch,
|
||||
desiredHeight, pixelFormat, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decompress the JPEG source image associated with this decompressor
|
||||
* instance and output a decompressed image to the given destination buffer.
|
||||
*
|
||||
* @param dstBuf see
|
||||
* {@link #decompress(byte[], int, int, int, int, int, int, int)}
|
||||
* for description
|
||||
*
|
||||
* @param desiredWidth see
|
||||
* {@link #decompress(byte[], int, int, int, int, int, int, int)}
|
||||
* for description
|
||||
*
|
||||
* @param pitch see
|
||||
* {@link #decompress(byte[], int, int, int, int, int, int, int)}
|
||||
* for description
|
||||
*
|
||||
* @param desiredHeight see
|
||||
* {@link #decompress(byte[], int, int, int, int, int, int, int)}
|
||||
* for description
|
||||
*
|
||||
* @param pixelFormat pixel format of the decompressed image (one of
|
||||
* {@link TJ TJ.PF_*})
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
|
||||
*/
|
||||
public void decompress(byte[] dstBuf, int desiredWidth, int pitch,
|
||||
int desiredHeight, int pixelFormat, int flags)
|
||||
throws Exception {
|
||||
decompress(dstBuf, 0, 0, desiredWidth, pitch, desiredHeight, pixelFormat,
|
||||
flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decompress the JPEG source image associated with this decompressor
|
||||
* instance and return a buffer containing the decompressed image.
|
||||
*
|
||||
* @param desiredWidth see
|
||||
* {@link #decompress(byte[], int, int, int, int, int)} for description
|
||||
* {@link #decompress(byte[], int, int, int, int, int, int, int)}
|
||||
* for description
|
||||
*
|
||||
* @param pitch see
|
||||
* {@link #decompress(byte[], int, int, int, int, int)} for description
|
||||
* {@link #decompress(byte[], int, int, int, int, int, int, int)}
|
||||
* for description
|
||||
*
|
||||
* @param desiredHeight see
|
||||
* {@link #decompress(byte[], int, int, int, int, int)} for description
|
||||
* {@link #decompress(byte[], int, int, int, int, int, int, int)}
|
||||
* for description
|
||||
*
|
||||
* @param pixelFormat pixel format of the decompressed image (one of
|
||||
* {@link TJ TJ.PF_*})
|
||||
@@ -362,6 +410,68 @@ public class TJDecompressor {
|
||||
return buf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decompress the JPEG source image associated with this decompressor
|
||||
* instance and output a decompressed image to the given destination buffer.
|
||||
*
|
||||
* @param dstBuf buffer that will receive the decompressed image. This
|
||||
* buffer should normally be <code>stride * scaledHeight</code> pixels in
|
||||
* size, where <code>scaledHeight</code> can be determined by calling <code>
|
||||
* scalingFactor.{@link TJScalingFactor#getScaled getScaled}(jpegHeight)
|
||||
* </code> with one of the scaling factors returned from {@link
|
||||
* TJ#getScalingFactors} or by calling {@link #getScaledHeight}. However,
|
||||
* the buffer may also be larger than the dimensions of the JPEG image, in
|
||||
* which case the <code>x</code>, <code>y</code>, and <code>stride</code>
|
||||
* parameters can be used to specify the region into which the JPEG image
|
||||
* should be decompressed.
|
||||
*
|
||||
* @param x x offset (in pixels) of the region into which the JPEG image
|
||||
* should be decompressed, relative to the start of <code>dstBuf</code>.
|
||||
*
|
||||
* @param y y offset (in pixels) of the region into which the JPEG image
|
||||
* should be decompressed, relative to the start of <code>dstBuf</code>.
|
||||
*
|
||||
* @param desiredWidth desired width (in pixels) of the decompressed image.
|
||||
* If the desired image dimensions are smaller than the dimensions of the
|
||||
* JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG
|
||||
* decompressor to generate the largest possible image that will fit within
|
||||
* the desired dimensions. Setting this to 0 is the same as setting it to
|
||||
* the width of the JPEG image (in other words, the width will not be
|
||||
* considered when determining the scaled image size.)
|
||||
*
|
||||
* @param stride pixels per line of the destination image. Normally, this
|
||||
* should be set to <code>scaledWidth</code>, but you can use this to, for
|
||||
* instance, decompress the JPEG image into a region of a larger image.
|
||||
* NOTE: <code>scaledWidth</code> can be determined by calling <code>
|
||||
* scalingFactor.{@link TJScalingFactor#getScaled getScaled}(jpegWidth)
|
||||
* </code> or by calling {@link #getScaledWidth}. Setting this parameter to
|
||||
* 0 is the equivalent of setting it to <code>scaledWidth</code>.
|
||||
*
|
||||
* @param desiredHeight desired height (in pixels) of the decompressed image.
|
||||
* If the desired image dimensions are smaller than the dimensions of the
|
||||
* JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG
|
||||
* decompressor to generate the largest possible image that will fit within
|
||||
* the desired dimensions. Setting this to 0 is the same as setting it to
|
||||
* the height of the JPEG image (in other words, the height will not be
|
||||
* considered when determining the scaled image size.)
|
||||
*
|
||||
* @param pixelFormat pixel format of the decompressed image (one of
|
||||
* {@link TJ TJ.PF_*})
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
|
||||
*/
|
||||
public void decompress(int[] dstBuf, int x, int y, int desiredWidth,
|
||||
int stride, int desiredHeight, int pixelFormat, int flags)
|
||||
throws Exception {
|
||||
if(jpegBuf == null) throw new Exception(NO_ASSOC_ERROR);
|
||||
if(dstBuf == null || x < 0 || y < 0 || desiredWidth < 0 || stride < 0
|
||||
|| desiredHeight < 0 || pixelFormat < 0 || pixelFormat >= TJ.NUMPF
|
||||
|| flags < 0)
|
||||
throw new Exception("Invalid argument in decompress()");
|
||||
decompress(jpegBuf, jpegBufSize, dstBuf, x, y, desiredWidth, stride,
|
||||
desiredHeight, pixelFormat, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decompress the JPEG source image associated with this decompressor
|
||||
* instance and output a decompressed image to the given
|
||||
@@ -444,10 +554,12 @@ public class TJDecompressor {
|
||||
* decompressed image.
|
||||
*
|
||||
* @param desiredWidth see
|
||||
* {@link #decompress(byte[], int, int, int, int, int)} for description
|
||||
* {@link #decompress(byte[], int, int, int, int, int, int, int)} for
|
||||
* description
|
||||
*
|
||||
* @param desiredHeight see
|
||||
* {@link #decompress(byte[], int, int, int, int, int)} for description
|
||||
* {@link #decompress(byte[], int, int, int, int, int, int, int)} for
|
||||
* description
|
||||
*
|
||||
* @param bufferedImageType the image type of the newly-created
|
||||
* <code>BufferedImage</code> instance (for instance,
|
||||
@@ -498,8 +610,18 @@ public class TJDecompressor {
|
||||
int desiredWidth, int pitch, int desiredHeight, int pixelFormat, int flags)
|
||||
throws Exception;
|
||||
|
||||
private native void decompress(byte[] srcBuf, int size, byte[] dstBuf, int x,
|
||||
int y, int desiredWidth, int pitch, int desiredHeight, int pixelFormat,
|
||||
int flags)
|
||||
throws Exception;
|
||||
|
||||
private native void decompress(byte[] srcBuf, int size, int[] dstBuf,
|
||||
int desiredWidth, int pitch, int desiredHeight, int pixelFormat, int flags)
|
||||
int desiredWidth, int stride, int desiredHeight, int pixelFormat, int flags)
|
||||
throws Exception;
|
||||
|
||||
private native void decompress(byte[] srcBuf, int size, int[] dstBuf, int x,
|
||||
int y, int desiredWidth, int stride, int desiredHeight, int pixelFormat,
|
||||
int flags)
|
||||
throws Exception;
|
||||
|
||||
private native void decompressToYUV(byte[] srcBuf, int size, byte[] dstBuf,
|
||||
|
||||
@@ -39,6 +39,14 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress
|
||||
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3BIIIII
|
||||
(JNIEnv *, jobject, jbyteArray, jint, jbyteArray, jint, jint, jint, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: org_libjpegturbo_turbojpeg_TJDecompressor
|
||||
* Method: decompress
|
||||
* Signature: ([BI[BIIIIIII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3BIIIIIII
|
||||
(JNIEnv *, jobject, jbyteArray, jint, jbyteArray, jint, jint, jint, jint, jint, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: org_libjpegturbo_turbojpeg_TJDecompressor
|
||||
* Method: decompress
|
||||
@@ -47,6 +55,14 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress
|
||||
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3IIIIII
|
||||
(JNIEnv *, jobject, jbyteArray, jint, jintArray, jint, jint, jint, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: org_libjpegturbo_turbojpeg_TJDecompressor
|
||||
* Method: decompress
|
||||
* Signature: ([BI[IIIIIIII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3IIIIIIII
|
||||
(JNIEnv *, jobject, jbyteArray, jint, jintArray, jint, jint, jint, jint, jint, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: org_libjpegturbo_turbojpeg_TJDecompressor
|
||||
* Method: decompressToYUV
|
||||
|
||||
105
turbojpeg-jni.c
105
turbojpeg-jni.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2011 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2011-2012 D. R. Commander. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -350,12 +350,12 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress
|
||||
return;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3BIIIII
|
||||
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3BIIIIIII
|
||||
(JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jbyteArray dst,
|
||||
jint width, jint pitch, jint height, jint pf, jint flags)
|
||||
jint x, jint y, jint width, jint pitch, jint height, jint pf, jint flags)
|
||||
{
|
||||
tjhandle handle=0;
|
||||
jsize arraySize=0;
|
||||
jsize arraySize=0, actualPitch;
|
||||
unsigned char *jpegBuf=NULL, *dstBuf=NULL;
|
||||
|
||||
gethandle();
|
||||
@@ -367,15 +367,68 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress
|
||||
|
||||
if((*env)->GetArrayLength(env, src)<jpegSize)
|
||||
_throw("Source buffer is not large enough");
|
||||
arraySize=(pitch==0)? width*tjPixelSize[pf]*height:pitch*height;
|
||||
actualPitch=(pitch==0)? width*tjPixelSize[pf]:pitch;
|
||||
arraySize=(y+height)*actualPitch + x*tjPixelSize[pf];
|
||||
if((*env)->GetArrayLength(env, dst)<arraySize)
|
||||
_throw("Destination buffer is not large enough");
|
||||
|
||||
bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));
|
||||
bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));
|
||||
|
||||
if(tjDecompress2(handle, jpegBuf, (unsigned long)jpegSize, dstBuf, width,
|
||||
pitch, height, pf, flags)==-1)
|
||||
if(tjDecompress2(handle, jpegBuf, (unsigned long)jpegSize,
|
||||
&dstBuf[y*actualPitch + x*tjPixelSize[pf]], width, pitch, height, pf,
|
||||
flags)==-1)
|
||||
{
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0);
|
||||
dstBuf=jpegBuf=NULL;
|
||||
_throw(tjGetErrorStr());
|
||||
}
|
||||
|
||||
bailout:
|
||||
if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
|
||||
if(jpegBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3BIIIII
|
||||
(JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jbyteArray dst,
|
||||
jint width, jint pitch, jint height, jint pf, jint flags)
|
||||
{
|
||||
Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3BIIIIIII
|
||||
(env, obj, src, jpegSize, dst, 0, 0, width, pitch, height, pf, flags);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3IIIIIIII
|
||||
(JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jintArray dst,
|
||||
jint x, jint y, jint width, jint stride, jint height, jint pf, jint flags)
|
||||
{
|
||||
tjhandle handle=0;
|
||||
jsize arraySize=0, actualStride;
|
||||
unsigned char *jpegBuf=NULL, *dstBuf=NULL;
|
||||
|
||||
gethandle();
|
||||
|
||||
if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF)
|
||||
_throw("Invalid argument in decompress()");
|
||||
if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF)
|
||||
_throw("Mismatch between Java and C API");
|
||||
if(tjPixelSize[pf]!=sizeof(jint))
|
||||
_throw("Pixel format must be 32-bit when decompressing to an integer buffer.");
|
||||
|
||||
if((*env)->GetArrayLength(env, src)<jpegSize)
|
||||
_throw("Source buffer is not large enough");
|
||||
actualStride=(stride==0)? width:stride;
|
||||
arraySize=(y+height)*actualStride + x;
|
||||
if((*env)->GetArrayLength(env, dst)<arraySize)
|
||||
_throw("Destination buffer is not large enough");
|
||||
|
||||
bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));
|
||||
bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));
|
||||
|
||||
if(tjDecompress2(handle, jpegBuf, (unsigned long)jpegSize,
|
||||
&dstBuf[(y*actualStride + x)*sizeof(int)], width, stride*sizeof(jint),
|
||||
height, pf, flags)==-1)
|
||||
{
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0);
|
||||
@@ -391,43 +444,11 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3IIIIII
|
||||
(JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jintArray dst,
|
||||
jint width, jint pitch, jint height, jint pf, jint flags)
|
||||
jint width, jint stride, jint height, jint pf, jint flags)
|
||||
{
|
||||
tjhandle handle=0;
|
||||
jsize arraySize=0;
|
||||
unsigned char *jpegBuf=NULL, *dstBuf=NULL;
|
||||
Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3IIIIIIII
|
||||
(env, obj, src, jpegSize, dst, 0, 0, width, stride, height, pf, flags);
|
||||
|
||||
gethandle();
|
||||
|
||||
if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF)
|
||||
_throw("Invalid argument in decompress()");
|
||||
if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF)
|
||||
_throw("Mismatch between Java and C API");
|
||||
if(tjPixelSize[pf]!=sizeof(jint))
|
||||
_throw("Pixel format must be 32-bit when decompressing to an integer buffer.");
|
||||
|
||||
if((*env)->GetArrayLength(env, src)<jpegSize)
|
||||
_throw("Source buffer is not large enough");
|
||||
arraySize=(pitch==0)? width*height:pitch*height;
|
||||
if((*env)->GetArrayLength(env, dst)<arraySize)
|
||||
_throw("Destination buffer is not large enough");
|
||||
|
||||
bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));
|
||||
bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));
|
||||
|
||||
if(tjDecompress2(handle, jpegBuf, (unsigned long)jpegSize, dstBuf, width,
|
||||
pitch*sizeof(jint), height, pf, flags)==-1)
|
||||
{
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0);
|
||||
dstBuf=jpegBuf=NULL;
|
||||
_throw(tjGetErrorStr());
|
||||
}
|
||||
|
||||
bailout:
|
||||
if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
|
||||
if(jpegBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV
|
||||
|
||||
Reference in New Issue
Block a user