Extend the TurboJPEG Java API to support generating YUV images with arbitrary padding and to support image scaling when decompressing to YUV
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@975 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
@@ -2,12 +2,12 @@
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc (build 1.6.0_43) on Fri Apr 26 20:05:34 CDT 2013 -->
|
||||
<!-- Generated by javadoc (build 1.6.0_43) on Sat Apr 27 20:13:12 CDT 2013 -->
|
||||
<TITLE>
|
||||
TJCompressor
|
||||
</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2013-04-26">
|
||||
<META NAME="date" CONTENT="2013-04-27">
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
|
||||
|
||||
@@ -306,6 +306,14 @@ TurboJPEG compressor
|
||||
Set the level of chrominance subsampling for subsequent compress/encode
|
||||
operations.</TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||
<CODE> void</CODE></FONT></TD>
|
||||
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setYUVPad(int)">setYUVPad</A></B>(int pad)</CODE>
|
||||
|
||||
<BR>
|
||||
Set the plane padding for subsequent YUV encode operations.</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
|
||||
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
||||
@@ -437,11 +445,12 @@ public void <B>setSourceImage</B>(byte[] srcImage,
|
||||
<A NAME="setSourceImage(byte[], int, int, int, int)"><!-- --></A><H3>
|
||||
setSourceImage</H3>
|
||||
<PRE>
|
||||
public void <B>setSourceImage</B>(byte[] srcImage,
|
||||
int width,
|
||||
int pitch,
|
||||
int height,
|
||||
int pixelFormat)
|
||||
<FONT SIZE="-1">@Deprecated
|
||||
</FONT>public void <B>setSourceImage</B>(byte[] srcImage,
|
||||
int width,
|
||||
int pitch,
|
||||
int height,
|
||||
int pixelFormat)
|
||||
throws java.lang.Exception</PRE>
|
||||
<DL>
|
||||
<DD><B>Deprecated.</B> <I>Use
|
||||
@@ -572,6 +581,25 @@ public byte[] <B>compress</B>(java.awt.image.BufferedImage srcImage,
|
||||
</DL>
|
||||
<HR>
|
||||
|
||||
<A NAME="setYUVPad(int)"><!-- --></A><H3>
|
||||
setYUVPad</H3>
|
||||
<PRE>
|
||||
public void <B>setYUVPad</B>(int pad)
|
||||
throws java.lang.Exception</PRE>
|
||||
<DL>
|
||||
<DD>Set the plane padding for subsequent YUV encode operations.
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>pad</CODE> - the width of each line in each plane of the YUV image will be
|
||||
padded to the nearest multiple of this number of bytes (must be a
|
||||
power of 2.) The default padding is 4 bytes, which generates
|
||||
images suitable for direct video display.
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
</DD>
|
||||
</DL>
|
||||
<HR>
|
||||
|
||||
<A NAME="encodeYUV(byte[], int)"><!-- --></A><H3>
|
||||
encodeYUV</H3>
|
||||
<PRE>
|
||||
@@ -581,21 +609,20 @@ public void <B>encodeYUV</B>(byte[] dstBuf,
|
||||
<DL>
|
||||
<DD>Encode the uncompressed source image associated with this compressor
|
||||
instance and output a YUV planar image to the given destination buffer.
|
||||
This method uses the accelerated color conversion routines in
|
||||
TurboJPEG's underlying codec to produce a planar YUV image that is
|
||||
suitable for direct video display. Specifically, if the chrominance
|
||||
components are subsampled along the horizontal dimension, then the width
|
||||
of the luminance plane is padded to the nearest multiple of 2 in the
|
||||
output image (same goes for the height of the luminance plane, if the
|
||||
chrominance components are subsampled along the vertical dimension.)
|
||||
Also, each line of each plane in the output image is padded to 4 bytes.
|
||||
Although this will work with any subsampling option, it is really only
|
||||
useful in combination with <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_420"><CODE>TJ.SAMP_420</CODE></A>, which produces an image
|
||||
compatible with the I420 (AKA "YUV420P") format.
|
||||
This method uses the accelerated color conversion routines in TurboJPEG's
|
||||
underlying codec but does not execute any of the other steps in the JPEG
|
||||
compression process. The Y, U, and V image planes are stored sequentially
|
||||
into the destination buffer, and the size of each plane is determined by
|
||||
the width and height of the source image, as well as the specified padding
|
||||
and level of chrominance subsampling. If the chrominance components are
|
||||
subsampled along the horizontal dimension, then the width of the luminance
|
||||
plane is padded to the nearest multiple of 2 in the output image (same
|
||||
goes for the height of the luminance plane, if the chrominance components
|
||||
are subsampled along the vertical dimension.)
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>dstBuf</CODE> - buffer that 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, int)"><CODE>TJ.bufSizeYUV(int, 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 <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>
|
||||
@@ -637,7 +664,7 @@ public void <B>encodeYUV</B>(java.awt.image.BufferedImage srcImage,
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - a <code>BufferedImage</code> instance containing RGB or
|
||||
grayscale pixels to be encoded<DD><CODE>dstBuf</CODE> - buffer that 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, int)"><CODE>TJ.bufSizeYUV(int, 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 <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>
|
||||
|
||||
Reference in New Issue
Block a user