Extend the TurboJPEG Java API to support compressing JPEG images from YUV planar images
This commit is contained in:
@@ -525,6 +525,10 @@ Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg
|
||||
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
|
||||
<DD><B>Deprecated.</B> <I>Use
|
||||
<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int, int, int)"><CODE>TJCompressor.setSourceImage(byte[], int, int, int, int, int, int)</CODE></A> instead.</I>
|
||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImageYUV(byte[], int, int, int)"><B>setSourceImageYUV(byte[], 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 YUV planar source image with this compressor
|
||||
instance.
|
||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSubsamp(int)"><B>setSubsamp(int)</B></A> -
|
||||
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
|
||||
<DD>Set the level of chrominance subsampling for subsequent compress/encode
|
||||
|
||||
@@ -9,8 +9,42 @@ Generated Documentation (Untitled)
|
||||
targetPage = "" + window.location.search;
|
||||
if (targetPage != "" && targetPage != "undefined")
|
||||
targetPage = targetPage.substring(1);
|
||||
if (targetPage.indexOf(":") != -1)
|
||||
if (targetPage.indexOf(":") != -1 || (targetPage != "" && !validURL(targetPage)))
|
||||
targetPage = "undefined";
|
||||
function validURL(url) {
|
||||
var pos = url.indexOf(".html");
|
||||
if (pos == -1 || pos != url.length - 5)
|
||||
return false;
|
||||
var allowNumber = false;
|
||||
var allowSep = false;
|
||||
var seenDot = false;
|
||||
for (var i = 0; i < url.length - 5; i++) {
|
||||
var ch = url.charAt(i);
|
||||
if ('a' <= ch && ch <= 'z' ||
|
||||
'A' <= ch && ch <= 'Z' ||
|
||||
ch == '$' ||
|
||||
ch == '_') {
|
||||
allowNumber = true;
|
||||
allowSep = true;
|
||||
} else if ('0' <= ch && ch <= '9'
|
||||
|| ch == '-') {
|
||||
if (!allowNumber)
|
||||
return false;
|
||||
} else if (ch == '/' || ch == '.') {
|
||||
if (!allowSep)
|
||||
return false;
|
||||
allowNumber = false;
|
||||
allowSep = false;
|
||||
if (ch == '.')
|
||||
seenDot = true;
|
||||
if (ch == '/' && seenDot)
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function loadFrames() {
|
||||
if (targetPage != "" && targetPage != "undefined")
|
||||
top.classFrame.location = top.targetPage;
|
||||
|
||||
@@ -298,6 +298,18 @@ TurboJPEG compressor
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||
<CODE> void</CODE></FONT></TD>
|
||||
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImageYUV(byte[], int, int, int)">setSourceImageYUV</A></B>(byte[] srcImage,
|
||||
int width,
|
||||
int pad,
|
||||
int height)</CODE>
|
||||
|
||||
<BR>
|
||||
Associate an uncompressed YUV planar source image with this compressor
|
||||
instance.</TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||
<CODE> void</CODE></FONT></TD>
|
||||
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSubsamp(int)">setSubsamp</A></B>(int newSubsamp)</CODE>
|
||||
|
||||
<BR>
|
||||
@@ -462,6 +474,38 @@ setSourceImage</H3>
|
||||
</DL>
|
||||
<HR>
|
||||
|
||||
<A NAME="setSourceImageYUV(byte[], int, int, int)"><!-- --></A><H3>
|
||||
setSourceImageYUV</H3>
|
||||
<PRE>
|
||||
public void <B>setSourceImageYUV</B>(byte[] srcImage,
|
||||
int width,
|
||||
int pad,
|
||||
int height)
|
||||
throws java.lang.Exception</PRE>
|
||||
<DL>
|
||||
<DD>Associate an uncompressed YUV planar source image with this compressor
|
||||
instance.
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - image buffer containing a YUV planar image to be
|
||||
compressed. The Y, U (Cb), and V (Cr) image planes should be stored
|
||||
sequentially in the buffer, and the size of each plane is determined by
|
||||
the specified width, height, and padding, as well as the level of
|
||||
chrominance subsampling (specified using <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSubsamp(int)"><CODE>setSubsamp(int)</CODE></A>.) If the
|
||||
chrominance components are subsampled along the horizontal dimension, then
|
||||
the width of the luminance plane should be padded to the nearest multiple
|
||||
of 2 (same goes for the height of the luminance plane, if the chrominance
|
||||
components are subsampled along the vertical dimension.) This is
|
||||
irrespective of any additional padding specified in the <code>pad</code>
|
||||
parameter.<DD><CODE>width</CODE> - width (in pixels) of the source image<DD><CODE>pad</CODE> - the line padding used in the source image. For instance, if
|
||||
each line in each plane of the YUV image is padded to the nearest multiple
|
||||
of 4 bytes, then <code>pad</code> should be set to 4.<DD><CODE>height</CODE> - height (in pixels) of the source image
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||
</DD>
|
||||
</DL>
|
||||
<HR>
|
||||
|
||||
<A NAME="setSubsamp(int)"><!-- --></A><H3>
|
||||
setSubsamp</H3>
|
||||
<PRE>
|
||||
@@ -476,6 +520,10 @@ public void <B>setSubsamp</B>(int newSubsamp)
|
||||
image with little perceptible loss of image clarity (the human eye is more
|
||||
sensitive to small changes in brightness than to small changes in color.)
|
||||
This is called "chrominance subsampling".
|
||||
<p>
|
||||
NOTE: When compressing a YUV planar image into a JPEG image, this method
|
||||
also specifies the level of chrominance subsampling used in the source
|
||||
image.
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>newSubsamp</CODE> - the new level of chrominance subsampling (one of
|
||||
|
||||
Reference in New Issue
Block a user