Streamline the BufferedImage functionality in the compressor so that it works the same way as compressing a "normal" image, and deprecate the old BufferedImage methods and other redundant methods. Eliminate the use of deprecated features in the test programs.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1168 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
@@ -165,7 +165,7 @@ class TJBench {
|
|||||||
if (yuv == YUVDECODE)
|
if (yuv == YUVDECODE)
|
||||||
tjd.decompressToYUV(dstBuf, scaledw, yuvpad, scaledh, flags);
|
tjd.decompressToYUV(dstBuf, scaledw, yuvpad, scaledh, flags);
|
||||||
else
|
else
|
||||||
tjd.decompress(dstBuf, scaledw, pitch, scaledh, pf, flags);
|
tjd.decompress(dstBuf, 0, 0, scaledw, pitch, scaledh, pf, flags);
|
||||||
|
|
||||||
/* Benchmark */
|
/* Benchmark */
|
||||||
for (i = 0, start = getTime(); (elapsed = getTime() - start) < benchTime;
|
for (i = 0, start = getTime(); (elapsed = getTime() - start) < benchTime;
|
||||||
@@ -259,7 +259,7 @@ class TJBench {
|
|||||||
int ps = TJ.getPixelSize(pf), i;
|
int ps = TJ.getPixelSize(pf), i;
|
||||||
int yuvSize = 0;
|
int yuvSize = 0;
|
||||||
|
|
||||||
yuvSize = TJ.bufSizeYUV(w, h, subsamp);
|
yuvSize = TJ.bufSizeYUV(w, yuvpad, h, subsamp);
|
||||||
dstBuf = new byte[yuvSize];
|
dstBuf = new byte[yuvSize];
|
||||||
|
|
||||||
if (quiet == 0)
|
if (quiet == 0)
|
||||||
@@ -273,7 +273,7 @@ class TJBench {
|
|||||||
(flags & TJ.FLAG_BOTTOMUP) != 0 ? "BU" : "TD",
|
(flags & TJ.FLAG_BOTTOMUP) != 0 ? "BU" : "TD",
|
||||||
subNameLong[subsamp]);
|
subNameLong[subsamp]);
|
||||||
|
|
||||||
tjc = new TJCompressor(srcBuf, w, 0, h, pf);
|
tjc = new TJCompressor(srcBuf, 0, 0, w, 0, h, pf);
|
||||||
tjc.setSubsamp(subsamp);
|
tjc.setSubsamp(subsamp);
|
||||||
|
|
||||||
/* Execute once to preload cache */
|
/* Execute once to preload cache */
|
||||||
@@ -362,7 +362,7 @@ class TJBench {
|
|||||||
if (yuv == YUVCOMPRESS)
|
if (yuv == YUVCOMPRESS)
|
||||||
tjc.setSourceImageYUV(srcBuf, tilew, yuvpad, tileh);
|
tjc.setSourceImageYUV(srcBuf, tilew, yuvpad, tileh);
|
||||||
else
|
else
|
||||||
tjc.setSourceImage(srcBuf, tilew, pitch, tileh, pf);
|
tjc.setSourceImage(srcBuf, 0, 0, tilew, pitch, tileh, pf);
|
||||||
tjc.setJPEGQuality(jpegQual);
|
tjc.setJPEGQuality(jpegQual);
|
||||||
tjc.setSubsamp(subsamp);
|
tjc.setSubsamp(subsamp);
|
||||||
|
|
||||||
@@ -618,8 +618,6 @@ class TJBench {
|
|||||||
System.out.println("-bottomup = Test bottom-up compression/decompression");
|
System.out.println("-bottomup = Test bottom-up compression/decompression");
|
||||||
System.out.println("-tile = Test performance of the codec when the image is encoded as separate");
|
System.out.println("-tile = Test performance of the codec when the image is encoded as separate");
|
||||||
System.out.println(" tiles of varying sizes.");
|
System.out.println(" tiles of varying sizes.");
|
||||||
System.out.println("-forcemmx, -forcesse, -forcesse2, -forcesse3 =");
|
|
||||||
System.out.println(" Force MMX, SSE, SSE2, or SSE3 code paths in the underlying codec");
|
|
||||||
System.out.println("-rgb, -bgr, -rgbx, -bgrx, -xbgr, -xrgb =");
|
System.out.println("-rgb, -bgr, -rgbx, -bgrx, -xbgr, -xrgb =");
|
||||||
System.out.println(" Test the specified color conversion path in the codec (default: BGR)");
|
System.out.println(" Test the specified color conversion path in the codec (default: BGR)");
|
||||||
System.out.println("-fastupsample = Use the fastest chrominance upsampling algorithm available in");
|
System.out.println("-fastupsample = Use the fastest chrominance upsampling algorithm available in");
|
||||||
@@ -729,22 +727,6 @@ class TJBench {
|
|||||||
if (argv[i].equalsIgnoreCase("-tile")) {
|
if (argv[i].equalsIgnoreCase("-tile")) {
|
||||||
doTile = true; xformOpt |= TJTransform.OPT_CROP;
|
doTile = true; xformOpt |= TJTransform.OPT_CROP;
|
||||||
}
|
}
|
||||||
if (argv[i].equalsIgnoreCase("-forcesse3")) {
|
|
||||||
System.out.println("Forcing SSE3 code\n");
|
|
||||||
flags |= TJ.FLAG_FORCESSE3;
|
|
||||||
}
|
|
||||||
if (argv[i].equalsIgnoreCase("-forcesse2")) {
|
|
||||||
System.out.println("Forcing SSE2 code\n");
|
|
||||||
flags |= TJ.FLAG_FORCESSE2;
|
|
||||||
}
|
|
||||||
if (argv[i].equalsIgnoreCase("-forcesse")) {
|
|
||||||
System.out.println("Forcing SSE code\n");
|
|
||||||
flags |= TJ.FLAG_FORCESSE;
|
|
||||||
}
|
|
||||||
if (argv[i].equalsIgnoreCase("-forcemmx")) {
|
|
||||||
System.out.println("Forcing MMX code\n");
|
|
||||||
flags |= TJ.FLAG_FORCEMMX;
|
|
||||||
}
|
|
||||||
if (argv[i].equalsIgnoreCase("-fastupsample")) {
|
if (argv[i].equalsIgnoreCase("-fastupsample")) {
|
||||||
System.out.println("Using fast upsampling code\n");
|
System.out.println("Using fast upsampling code\n");
|
||||||
flags |= TJ.FLAG_FASTUPSAMPLE;
|
flags |= TJ.FLAG_FASTUPSAMPLE;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C)2011-2012 D. R. Commander. All Rights Reserved.
|
* Copyright (C)2011-2012, 2014 D. R. Commander. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@@ -324,11 +324,11 @@ public class TJExample implements TJCustomFilter {
|
|||||||
tjc.setSubsamp(outSubsamp);
|
tjc.setSubsamp(outSubsamp);
|
||||||
tjc.setJPEGQuality(outQual);
|
tjc.setJPEGQuality(outQual);
|
||||||
if (img != null)
|
if (img != null)
|
||||||
jpegBuf = tjc.compress(img, flags);
|
tjc.setSourceImage(img, 0, 0, 0, 0);
|
||||||
else {
|
else {
|
||||||
tjc.setSourceImage(bmpBuf, width, 0, height, TJ.PF_BGRX);
|
tjc.setSourceImage(bmpBuf, 0, 0, width, 0, height, TJ.PF_BGRX);
|
||||||
jpegBuf = tjc.compress(flags);
|
|
||||||
}
|
}
|
||||||
|
jpegBuf = tjc.compress(flags);
|
||||||
jpegSize = tjc.getCompressedSize();
|
jpegSize = tjc.getCompressedSize();
|
||||||
tjc.close();
|
tjc.close();
|
||||||
|
|
||||||
|
|||||||
@@ -736,21 +736,16 @@ public class TJUnitTest {
|
|||||||
tjc.setSubsamp(subsamp);
|
tjc.setSubsamp(subsamp);
|
||||||
tjc.setJPEGQuality(jpegQual);
|
tjc.setJPEGQuality(jpegQual);
|
||||||
tjc.setYUVPad(pad);
|
tjc.setYUVPad(pad);
|
||||||
if (bi) {
|
if (yuv == YUVDECODE)
|
||||||
if (yuv == YUVENCODE)
|
tjc.setSourceImageYUV(srcBuf, w, pad, h);
|
||||||
tjc.encodeYUV(img, dstBuf, flags);
|
else if (bi)
|
||||||
else
|
tjc.setSourceImage(img, 0, 0, 0, 0);
|
||||||
tjc.compress(img, dstBuf, flags);
|
else
|
||||||
} else {
|
tjc.setSourceImage(srcBuf, 0, 0, w, 0, h, pf);
|
||||||
if (yuv == YUVDECODE)
|
if (yuv == YUVENCODE)
|
||||||
tjc.setSourceImageYUV(srcBuf, w, pad, h);
|
tjc.encodeYUV(dstBuf, flags);
|
||||||
else
|
else
|
||||||
tjc.setSourceImage(srcBuf, w, 0, h, pf);
|
tjc.compress(dstBuf, flags);
|
||||||
if (yuv == YUVENCODE)
|
|
||||||
tjc.encodeYUV(dstBuf, flags);
|
|
||||||
else
|
|
||||||
tjc.compress(dstBuf, flags);
|
|
||||||
}
|
|
||||||
size = tjc.getCompressedSize();
|
size = tjc.getCompressedSize();
|
||||||
|
|
||||||
if (yuv == YUVENCODE)
|
if (yuv == YUVENCODE)
|
||||||
@@ -955,7 +950,7 @@ public class TJUnitTest {
|
|||||||
for (i = 0; i < w * h * 4; i++) {
|
for (i = 0; i < w * h * 4; i++) {
|
||||||
srcBuf[i] = (byte)(r.nextInt(2) * 255);
|
srcBuf[i] = (byte)(r.nextInt(2) * 255);
|
||||||
}
|
}
|
||||||
tjc.setSourceImage(srcBuf, w, 0, h, TJ.PF_BGRX);
|
tjc.setSourceImage(srcBuf, 0, 0, w, 0, h, TJ.PF_BGRX);
|
||||||
tjc.setSubsamp(subsamp);
|
tjc.setSubsamp(subsamp);
|
||||||
tjc.setJPEGQuality(100);
|
tjc.setJPEGQuality(100);
|
||||||
tjc.setYUVPad(pad);
|
tjc.setYUVPad(pad);
|
||||||
@@ -972,7 +967,7 @@ public class TJUnitTest {
|
|||||||
for (i = 0; i < h * w * 4; i++) {
|
for (i = 0; i < h * w * 4; i++) {
|
||||||
srcBuf[i] = (byte)(r.nextInt(2) * 255);
|
srcBuf[i] = (byte)(r.nextInt(2) * 255);
|
||||||
}
|
}
|
||||||
tjc.setSourceImage(srcBuf, h, 0, w, TJ.PF_BGRX);
|
tjc.setSourceImage(srcBuf, 0, 0, h, 0, w, TJ.PF_BGRX);
|
||||||
if (yuv == YUVENCODE)
|
if (yuv == YUVENCODE)
|
||||||
tjc.encodeYUV(dstBuf, 0);
|
tjc.encodeYUV(dstBuf, 0);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ function windowTitle()
|
|||||||
<B>Contents</B><UL>
|
<B>Contents</B><UL>
|
||||||
<LI><A HREF="#field">Deprecated Fields</A>
|
<LI><A HREF="#field">Deprecated Fields</A>
|
||||||
<LI><A HREF="#method">Deprecated Methods</A>
|
<LI><A HREF="#method">Deprecated Methods</A>
|
||||||
|
<LI><A HREF="#constructor">Deprecated Constructors</A>
|
||||||
</UL>
|
</UL>
|
||||||
|
|
||||||
<A NAME="field"><!-- --></A>
|
<A NAME="field"><!-- --></A>
|
||||||
@@ -126,6 +127,20 @@ function windowTitle()
|
|||||||
<I>Use <A HREF="org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int, int)"><CODE>TJ.bufSizeYUV(int, int, int, int)</CODE></A> instead.</I> </TD>
|
<I>Use <A HREF="org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int, int)"><CODE>TJ.bufSizeYUV(int, int, int, int)</CODE></A> instead.</I> </TD>
|
||||||
</TR>
|
</TR>
|
||||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||||
|
<TD><A HREF="org/libjpegturbo/turbojpeg/TJCompressor.html#compress(java.awt.image.BufferedImage, byte[], int)">org.libjpegturbo.turbojpeg.TJCompressor.compress(BufferedImage, byte[], int)</A>
|
||||||
|
<BR>
|
||||||
|
<I>Use
|
||||||
|
<A HREF="org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><CODE>TJCompressor.setSourceImage(BufferedImage, int, int, int, int)</CODE></A> and
|
||||||
|
<A HREF="org/libjpegturbo/turbojpeg/TJCompressor.html#compress(byte[], int)"><CODE>TJCompressor.compress(byte[], int)</CODE></A> instead.</I> </TD>
|
||||||
|
</TR>
|
||||||
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||||
|
<TD><A HREF="org/libjpegturbo/turbojpeg/TJCompressor.html#compress(java.awt.image.BufferedImage, int)">org.libjpegturbo.turbojpeg.TJCompressor.compress(BufferedImage, int)</A>
|
||||||
|
<BR>
|
||||||
|
<I>Use
|
||||||
|
<A HREF="org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><CODE>TJCompressor.setSourceImage(BufferedImage, int, int, int, int)</CODE></A> and
|
||||||
|
<A HREF="org/libjpegturbo/turbojpeg/TJCompressor.html#compress(int)"><CODE>TJCompressor.compress(int)</CODE></A> instead.</I> </TD>
|
||||||
|
</TR>
|
||||||
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||||
<TD><A HREF="org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)">org.libjpegturbo.turbojpeg.TJDecompressor.decompress(byte[], int, int, int, int, int)</A>
|
<TD><A HREF="org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)">org.libjpegturbo.turbojpeg.TJDecompressor.decompress(byte[], int, int, int, int, int)</A>
|
||||||
<BR>
|
<BR>
|
||||||
<I>Use
|
<I>Use
|
||||||
@@ -143,6 +158,20 @@ function windowTitle()
|
|||||||
<I>Use <A HREF="org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int, int, int, int)"><CODE>TJDecompressor.decompressToYUV(int, int, int, int)</CODE></A> instead.</I> </TD>
|
<I>Use <A HREF="org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int, int, int, int)"><CODE>TJDecompressor.decompressToYUV(int, int, int, int)</CODE></A> instead.</I> </TD>
|
||||||
</TR>
|
</TR>
|
||||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||||
|
<TD><A HREF="org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(java.awt.image.BufferedImage, byte[], int)">org.libjpegturbo.turbojpeg.TJCompressor.encodeYUV(BufferedImage, byte[], int)</A>
|
||||||
|
<BR>
|
||||||
|
<I>Use
|
||||||
|
<A HREF="org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><CODE>TJCompressor.setSourceImage(BufferedImage, int, int, int, int)</CODE></A> and
|
||||||
|
<A HREF="org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[], int)"><CODE>TJCompressor.encodeYUV(byte[], int)</CODE></A> instead.</I> </TD>
|
||||||
|
</TR>
|
||||||
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||||
|
<TD><A HREF="org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(java.awt.image.BufferedImage, int)">org.libjpegturbo.turbojpeg.TJCompressor.encodeYUV(BufferedImage, int)</A>
|
||||||
|
<BR>
|
||||||
|
<I>Use
|
||||||
|
<A HREF="org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><CODE>TJCompressor.setSourceImage(BufferedImage, int, int, int, int)</CODE></A> and
|
||||||
|
<A HREF="org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int)"><CODE>TJCompressor.encodeYUV(int)</CODE></A> instead.</I> </TD>
|
||||||
|
</TR>
|
||||||
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||||
<TD><A HREF="org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int)">org.libjpegturbo.turbojpeg.TJCompressor.setSourceImage(byte[], int, int, int, int)</A>
|
<TD><A HREF="org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int)">org.libjpegturbo.turbojpeg.TJCompressor.setSourceImage(byte[], int, int, int, int)</A>
|
||||||
<BR>
|
<BR>
|
||||||
<I>Use
|
<I>Use
|
||||||
@@ -151,6 +180,21 @@ function windowTitle()
|
|||||||
</TABLE>
|
</TABLE>
|
||||||
|
|
||||||
<P>
|
<P>
|
||||||
|
<A NAME="constructor"><!-- --></A>
|
||||||
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
||||||
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
||||||
|
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
||||||
|
<B>Deprecated Constructors</B></FONT></TH>
|
||||||
|
</TR>
|
||||||
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||||
|
<TD><A HREF="org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[], int, int, int, int)">org.libjpegturbo.turbojpeg.TJCompressor(byte[], int, int, int, int)</A>
|
||||||
|
<BR>
|
||||||
|
<I>Use
|
||||||
|
<A HREF="org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[], int, int, int, int, int, int)"><CODE>TJCompressor.TJCompressor(byte[], int, int, int, int, int, int)</CODE></A> instead.</I> </TD>
|
||||||
|
</TR>
|
||||||
|
</TABLE>
|
||||||
|
|
||||||
|
<P>
|
||||||
<HR>
|
<HR>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -113,12 +113,14 @@ Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg
|
|||||||
instance and return a buffer containing a JPEG image.
|
instance and return a buffer containing a JPEG image.
|
||||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#compress(java.awt.image.BufferedImage, byte[], int)"><B>compress(BufferedImage, byte[], int)</B></A> -
|
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#compress(java.awt.image.BufferedImage, byte[], int)"><B>compress(BufferedImage, 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>
|
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
|
||||||
<DD>Compress the uncompressed source image stored in <code>srcImage</code>
|
<DD><B>Deprecated.</B> <I>Use
|
||||||
and output a JPEG image to the given destination buffer.
|
<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><CODE>TJCompressor.setSourceImage(BufferedImage, int, int, int, int)</CODE></A> and
|
||||||
|
<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#compress(byte[], int)"><CODE>TJCompressor.compress(byte[], int)</CODE></A> instead.</I>
|
||||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#compress(java.awt.image.BufferedImage, int)"><B>compress(BufferedImage, int)</B></A> -
|
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#compress(java.awt.image.BufferedImage, int)"><B>compress(BufferedImage, 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>Compress the uncompressed source image stored in <code>srcImage</code>
|
<DD><B>Deprecated.</B> <I>Use
|
||||||
and return a buffer containing a JPEG image.
|
<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><CODE>TJCompressor.setSourceImage(BufferedImage, int, int, int, int)</CODE></A> and
|
||||||
|
<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#compress(int)"><CODE>TJCompressor.compress(int)</CODE></A> instead.</I>
|
||||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#CS_CMYK"><B>CS_CMYK</B></A> -
|
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#CS_CMYK"><B>CS_CMYK</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>CMYK colorspace.
|
<DD>CMYK colorspace.
|
||||||
@@ -200,12 +202,14 @@ Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg
|
|||||||
instance and return a buffer containing a YUV planar image.
|
instance and return a buffer containing a YUV planar image.
|
||||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(java.awt.image.BufferedImage, byte[], int)"><B>encodeYUV(BufferedImage, byte[], int)</B></A> -
|
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(java.awt.image.BufferedImage, byte[], int)"><B>encodeYUV(BufferedImage, 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>
|
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
|
||||||
<DD>Encode the uncompressed source image stored in <code>srcImage</code>
|
<DD><B>Deprecated.</B> <I>Use
|
||||||
and output a YUV planar image to the given destination buffer.
|
<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><CODE>TJCompressor.setSourceImage(BufferedImage, int, int, int, int)</CODE></A> and
|
||||||
|
<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[], int)"><CODE>TJCompressor.encodeYUV(byte[], int)</CODE></A> instead.</I>
|
||||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(java.awt.image.BufferedImage, int)"><B>encodeYUV(BufferedImage, int)</B></A> -
|
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(java.awt.image.BufferedImage, int)"><B>encodeYUV(BufferedImage, 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>Encode the uncompressed source image stored in <code>srcImage</code>
|
<DD><B>Deprecated.</B> <I>Use
|
||||||
and return a buffer containing a YUV planar image.
|
<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><CODE>TJCompressor.setSourceImage(BufferedImage, int, int, int, int)</CODE></A> and
|
||||||
|
<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int)"><CODE>TJCompressor.encodeYUV(int)</CODE></A> instead.</I>
|
||||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJScalingFactor.html#equals(org.libjpegturbo.turbojpeg.TJScalingFactor)"><B>equals(TJScalingFactor)</B></A> -
|
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJScalingFactor.html#equals(org.libjpegturbo.turbojpeg.TJScalingFactor)"><B>equals(TJScalingFactor)</B></A> -
|
||||||
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</A>
|
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</A>
|
||||||
<DD>Returns true or false, depending on whether this instance and
|
<DD>Returns true or false, depending on whether this instance and
|
||||||
@@ -521,6 +525,9 @@ 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>
|
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
|
<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>
|
<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#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><B>setSourceImage(BufferedImage, 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#setSourceImageYUV(byte[], int, int, int)"><B>setSourceImageYUV(byte[], int, int, int)</B></A> -
|
<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>
|
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
|
<DD>Associate an uncompressed YUV planar source image with this compressor
|
||||||
@@ -545,10 +552,14 @@ Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/tur
|
|||||||
<DD>Create a TurboJPEG compressor instance.
|
<DD>Create a TurboJPEG compressor instance.
|
||||||
<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><B>Deprecated.</B> <I>Use
|
||||||
|
<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[], int, int, int, int, int, int)"><CODE>TJCompressor.TJCompressor(byte[], int, int, int, int, int, int)</CODE></A> instead.</I>
|
||||||
|
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[], int, int, int, int, int, int)"><B>TJCompressor(byte[], int, int, int, int, int, int)</B></A> -
|
||||||
|
Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
|
||||||
<DD>Create a TurboJPEG compressor instance and associate the uncompressed
|
<DD>Create a TurboJPEG compressor instance and associate the uncompressed
|
||||||
source image stored in <code>srcImage</code> with the newly-created
|
source image stored in <code>srcImage</code> with the newly-created
|
||||||
instance.
|
instance.
|
||||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[], int, int, int, int, int, int)"><B>TJCompressor(byte[], int, int, int, int, int, int)</B></A> -
|
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(java.awt.image.BufferedImage, int, int, int, int)"><B>TJCompressor(BufferedImage, 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>srcImage</code> with the newly-created
|
source image stored in <code>srcImage</code> with the newly-created
|
||||||
|
|||||||
@@ -120,6 +120,18 @@ TurboJPEG compressor
|
|||||||
Create a TurboJPEG compressor instance.</TD>
|
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(java.awt.image.BufferedImage, int, int, int, int)">TJCompressor</A></B>(java.awt.image.BufferedImage srcImage,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int width,
|
||||||
|
int height)</CODE>
|
||||||
|
|
||||||
|
<BR>
|
||||||
|
Create a TurboJPEG compressor instance and associate the uncompressed
|
||||||
|
source image stored in <code>srcImage</code> with the newly-created
|
||||||
|
instance.</TD>
|
||||||
|
</TR>
|
||||||
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||||
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[], int, int, int, int)">TJCompressor</A></B>(byte[] srcImage,
|
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[], int, int, int, int)">TJCompressor</A></B>(byte[] srcImage,
|
||||||
int width,
|
int width,
|
||||||
int pitch,
|
int pitch,
|
||||||
@@ -127,9 +139,8 @@ TurboJPEG compressor
|
|||||||
int pixelFormat)</CODE>
|
int pixelFormat)</CODE>
|
||||||
|
|
||||||
<BR>
|
<BR>
|
||||||
Create a TurboJPEG compressor instance and associate the uncompressed
|
<B>Deprecated.</B> <I>Use
|
||||||
source image stored in <code>srcImage</code> with the newly-created
|
<A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[], int, int, int, int, int, int)"><CODE>TJCompressor(byte[], int, int, int, int, int, int)</CODE></A> instead.</I></TD>
|
||||||
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, int, int)">TJCompressor</A></B>(byte[] srcImage,
|
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[], int, int, int, int, int, int)">TJCompressor</A></B>(byte[] srcImage,
|
||||||
@@ -171,8 +182,9 @@ TurboJPEG compressor
|
|||||||
int flags)</CODE>
|
int flags)</CODE>
|
||||||
|
|
||||||
<BR>
|
<BR>
|
||||||
Compress the uncompressed source image stored in <code>srcImage</code>
|
<B>Deprecated.</B> <I>Use
|
||||||
and output a JPEG image to the given destination buffer.</TD>
|
<A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><CODE>setSourceImage(BufferedImage, int, int, int, int)</CODE></A> and
|
||||||
|
<A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(byte[], int)"><CODE>compress(byte[], int)</CODE></A> instead.</I></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">
|
||||||
@@ -181,8 +193,9 @@ TurboJPEG compressor
|
|||||||
int flags)</CODE>
|
int flags)</CODE>
|
||||||
|
|
||||||
<BR>
|
<BR>
|
||||||
Compress the uncompressed source image stored in <code>srcImage</code>
|
<B>Deprecated.</B> <I>Use
|
||||||
and return a buffer containing a JPEG image.</TD>
|
<A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><CODE>setSourceImage(BufferedImage, int, int, int, int)</CODE></A> and
|
||||||
|
<A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(int)"><CODE>compress(int)</CODE></A> instead.</I></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">
|
||||||
@@ -211,8 +224,9 @@ TurboJPEG compressor
|
|||||||
int flags)</CODE>
|
int flags)</CODE>
|
||||||
|
|
||||||
<BR>
|
<BR>
|
||||||
Encode the uncompressed source image stored in <code>srcImage</code>
|
<B>Deprecated.</B> <I>Use
|
||||||
and output a YUV planar image to the given destination buffer.</TD>
|
<A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><CODE>setSourceImage(BufferedImage, int, int, int, int)</CODE></A> and
|
||||||
|
<A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[], int)"><CODE>encodeYUV(byte[], int)</CODE></A> instead.</I></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">
|
||||||
@@ -221,8 +235,9 @@ TurboJPEG compressor
|
|||||||
int flags)</CODE>
|
int flags)</CODE>
|
||||||
|
|
||||||
<BR>
|
<BR>
|
||||||
Encode the uncompressed source image stored in <code>srcImage</code>
|
<B>Deprecated.</B> <I>Use
|
||||||
and return a buffer containing a YUV planar image.</TD>
|
<A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><CODE>setSourceImage(BufferedImage, int, int, int, int)</CODE></A> and
|
||||||
|
<A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int)"><CODE>encodeYUV(int)</CODE></A> instead.</I></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">
|
||||||
@@ -271,6 +286,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> void</CODE></FONT></TD>
|
<CODE> void</CODE></FONT></TD>
|
||||||
|
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)">setSourceImage</A></B>(java.awt.image.BufferedImage srcImage,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int width,
|
||||||
|
int height)</CODE>
|
||||||
|
|
||||||
|
<BR>
|
||||||
|
Associate an uncompressed source image with this compressor instance.</TD>
|
||||||
|
</TR>
|
||||||
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||||
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||||
|
<CODE> void</CODE></FONT></TD>
|
||||||
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int)">setSourceImage</A></B>(byte[] srcImage,
|
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int)">setSourceImage</A></B>(byte[] srcImage,
|
||||||
int width,
|
int width,
|
||||||
int pitch,
|
int pitch,
|
||||||
@@ -365,20 +392,19 @@ 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[] srcImage,
|
<FONT SIZE="-1">@Deprecated
|
||||||
int width,
|
</FONT>public <B>TJCompressor</B>(byte[] srcImage,
|
||||||
int pitch,
|
int width,
|
||||||
int height,
|
int pitch,
|
||||||
int pixelFormat)
|
int height,
|
||||||
|
int pixelFormat)
|
||||||
throws java.lang.Exception</PRE>
|
throws java.lang.Exception</PRE>
|
||||||
<DL>
|
<DL>
|
||||||
<DD>Create a TurboJPEG compressor instance and associate the uncompressed
|
<DD><B>Deprecated.</B> <I>Use
|
||||||
source image stored in <code>srcImage</code> with the newly-created
|
<A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[], int, int, int, int, int, int)"><CODE>TJCompressor(byte[], int, int, int, int, int, int)</CODE></A> instead.</I>
|
||||||
instance.
|
|
||||||
<P>
|
<P>
|
||||||
<DL>
|
<DL>
|
||||||
<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - see <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int, int, int)"><CODE>setSourceImage(byte[], int, int, 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, int, int)"><CODE>setSourceImage(byte[], int, int, 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, int, int)"><CODE>setSourceImage(byte[], int, int, 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, int, int)"><CODE>setSourceImage(byte[], int, int, int, int, int, int)</CODE></A> for description<DD><CODE>pixelFormat</CODE> - pixel format of the source image (one of
|
|
||||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.PF_*</CODE></A>)
|
|
||||||
<DT><B>Throws:</B>
|
<DT><B>Throws:</B>
|
||||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||||
</DL>
|
</DL>
|
||||||
@@ -406,6 +432,32 @@ public <B>TJCompressor</B>(byte[] srcImage,
|
|||||||
<DT><B>Throws:</B>
|
<DT><B>Throws:</B>
|
||||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||||
</DL>
|
</DL>
|
||||||
|
<HR>
|
||||||
|
|
||||||
|
<A NAME="TJCompressor(java.awt.image.BufferedImage, int, int, int, int)"><!-- --></A><H3>
|
||||||
|
TJCompressor</H3>
|
||||||
|
<PRE>
|
||||||
|
public <B>TJCompressor</B>(java.awt.image.BufferedImage srcImage,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int width,
|
||||||
|
int height)
|
||||||
|
throws java.lang.Exception</PRE>
|
||||||
|
<DL>
|
||||||
|
<DD>Create a TurboJPEG compressor instance and associate the uncompressed
|
||||||
|
source image stored in <code>srcImage</code> with the newly-created
|
||||||
|
instance.
|
||||||
|
<P>
|
||||||
|
<DL>
|
||||||
|
<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - see
|
||||||
|
<A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><CODE>setSourceImage(BufferedImage, int, int, int, int)</CODE></A> for description<DD><CODE>x</CODE> - see
|
||||||
|
<A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><CODE>setSourceImage(BufferedImage, int, int, int, int)</CODE></A> for description<DD><CODE>y</CODE> - see
|
||||||
|
<A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><CODE>setSourceImage(BufferedImage, int, int, int, int)</CODE></A> for description<DD><CODE>width</CODE> - see
|
||||||
|
<A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><CODE>setSourceImage(BufferedImage, int, int, int, int)</CODE></A> for description<DD><CODE>height</CODE> - see
|
||||||
|
<A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><CODE>setSourceImage(BufferedImage, int, int, int, int)</CODE></A> for description
|
||||||
|
<DT><B>Throws:</B>
|
||||||
|
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||||
|
</DL>
|
||||||
|
|
||||||
<!-- ============ METHOD DETAIL ========== -->
|
<!-- ============ METHOD DETAIL ========== -->
|
||||||
|
|
||||||
@@ -474,6 +526,31 @@ setSourceImage</H3>
|
|||||||
</DL>
|
</DL>
|
||||||
<HR>
|
<HR>
|
||||||
|
|
||||||
|
<A NAME="setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><!-- --></A><H3>
|
||||||
|
setSourceImage</H3>
|
||||||
|
<PRE>
|
||||||
|
public void <B>setSourceImage</B>(java.awt.image.BufferedImage srcImage,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int width,
|
||||||
|
int height)
|
||||||
|
throws java.lang.Exception</PRE>
|
||||||
|
<DL>
|
||||||
|
<DD>Associate an uncompressed source image with this compressor instance.
|
||||||
|
<P>
|
||||||
|
<DD><DL>
|
||||||
|
<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - a <code>BufferedImage</code> instance containing RGB or
|
||||||
|
grayscale pixels to be compressed<DD><CODE>x</CODE> - x offset (in pixels) of the region in the source image from which
|
||||||
|
the JPEG image should be compressed<DD><CODE>y</CODE> - y offset (in pixels) of the region in the source image from which
|
||||||
|
the JPEG image should be compressed<DD><CODE>width</CODE> - width (in pixels) of the region in the source image from
|
||||||
|
which the JPEG image should be compressed (0 = compress the whole image)<DD><CODE>height</CODE> - height (in pixels) of the region in the source image from
|
||||||
|
which the JPEG image should be compressed (0 = compress the whole image)
|
||||||
|
<DT><B>Throws:</B>
|
||||||
|
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||||
|
</DD>
|
||||||
|
</DL>
|
||||||
|
<HR>
|
||||||
|
|
||||||
<A NAME="setSourceImageYUV(byte[], int, int, int)"><!-- --></A><H3>
|
<A NAME="setSourceImageYUV(byte[], int, int, int)"><!-- --></A><H3>
|
||||||
setSourceImageYUV</H3>
|
setSourceImageYUV</H3>
|
||||||
<PRE>
|
<PRE>
|
||||||
@@ -593,19 +670,18 @@ public byte[] <B>compress</B>(int flags)
|
|||||||
<A NAME="compress(java.awt.image.BufferedImage, byte[], int)"><!-- --></A><H3>
|
<A NAME="compress(java.awt.image.BufferedImage, byte[], int)"><!-- --></A><H3>
|
||||||
compress</H3>
|
compress</H3>
|
||||||
<PRE>
|
<PRE>
|
||||||
public void <B>compress</B>(java.awt.image.BufferedImage srcImage,
|
<FONT SIZE="-1">@Deprecated
|
||||||
byte[] dstBuf,
|
</FONT>public void <B>compress</B>(java.awt.image.BufferedImage srcImage,
|
||||||
int flags)
|
byte[] dstBuf,
|
||||||
|
int flags)
|
||||||
throws java.lang.Exception</PRE>
|
throws java.lang.Exception</PRE>
|
||||||
<DL>
|
<DL>
|
||||||
<DD>Compress the uncompressed source image stored in <code>srcImage</code>
|
<DD><B>Deprecated.</B> <I>Use
|
||||||
and output a JPEG image to the given destination buffer.
|
<A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><CODE>setSourceImage(BufferedImage, int, int, int, int)</CODE></A> and
|
||||||
|
<A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(byte[], int)"><CODE>compress(byte[], int)</CODE></A> instead.</I>
|
||||||
<P>
|
<P>
|
||||||
<DD><DL>
|
<DD><DL>
|
||||||
<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - a <code>BufferedImage</code> instance containing RGB or
|
|
||||||
grayscale pixels to be compressed<DD><CODE>dstBuf</CODE> - buffer that will receive the JPEG image. Use
|
|
||||||
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSize(int, int, int)"><CODE>TJ.bufSize(int, int, int)</CODE></A> to determine the maximum 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>
|
<DT><B>Throws:</B>
|
||||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||||
</DD>
|
</DD>
|
||||||
@@ -615,18 +691,17 @@ public void <B>compress</B>(java.awt.image.BufferedImage srcImage,
|
|||||||
<A NAME="compress(java.awt.image.BufferedImage, int)"><!-- --></A><H3>
|
<A NAME="compress(java.awt.image.BufferedImage, int)"><!-- --></A><H3>
|
||||||
compress</H3>
|
compress</H3>
|
||||||
<PRE>
|
<PRE>
|
||||||
public byte[] <B>compress</B>(java.awt.image.BufferedImage srcImage,
|
<FONT SIZE="-1">@Deprecated
|
||||||
int flags)
|
</FONT>public byte[] <B>compress</B>(java.awt.image.BufferedImage srcImage,
|
||||||
|
int flags)
|
||||||
throws java.lang.Exception</PRE>
|
throws java.lang.Exception</PRE>
|
||||||
<DL>
|
<DL>
|
||||||
<DD>Compress the uncompressed source image stored in <code>srcImage</code>
|
<DD><B>Deprecated.</B> <I>Use
|
||||||
and return a buffer containing a JPEG image.
|
<A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><CODE>setSourceImage(BufferedImage, int, int, int, int)</CODE></A> and
|
||||||
|
<A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(int)"><CODE>compress(int)</CODE></A> instead.</I>
|
||||||
<P>
|
<P>
|
||||||
<DD><DL>
|
<DD><DL>
|
||||||
<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - a <code>BufferedImage</code> instance containing RGB or
|
|
||||||
grayscale pixels to be compressed<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
|
|
||||||
<DT><B>Returns:</B><DD>a buffer containing a JPEG image. The length of this buffer will
|
|
||||||
not be equal to the size of the JPEG image. Use <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#getCompressedSize()"><CODE>getCompressedSize()</CODE></A> to obtain the size of the JPEG image.
|
|
||||||
<DT><B>Throws:</B>
|
<DT><B>Throws:</B>
|
||||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||||
</DD>
|
</DD>
|
||||||
@@ -708,20 +783,18 @@ public byte[] <B>encodeYUV</B>(int flags)
|
|||||||
<A NAME="encodeYUV(java.awt.image.BufferedImage, byte[], int)"><!-- --></A><H3>
|
<A NAME="encodeYUV(java.awt.image.BufferedImage, byte[], int)"><!-- --></A><H3>
|
||||||
encodeYUV</H3>
|
encodeYUV</H3>
|
||||||
<PRE>
|
<PRE>
|
||||||
public void <B>encodeYUV</B>(java.awt.image.BufferedImage srcImage,
|
<FONT SIZE="-1">@Deprecated
|
||||||
byte[] dstBuf,
|
</FONT>public void <B>encodeYUV</B>(java.awt.image.BufferedImage srcImage,
|
||||||
int flags)
|
byte[] dstBuf,
|
||||||
|
int flags)
|
||||||
throws java.lang.Exception</PRE>
|
throws java.lang.Exception</PRE>
|
||||||
<DL>
|
<DL>
|
||||||
<DD>Encode the uncompressed source image stored in <code>srcImage</code>
|
<DD><B>Deprecated.</B> <I>Use
|
||||||
and output a YUV planar image to the given destination buffer. See
|
<A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><CODE>setSourceImage(BufferedImage, int, int, int, int)</CODE></A> and
|
||||||
<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> instead.</I>
|
||||||
<P>
|
<P>
|
||||||
<DD><DL>
|
<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, 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>
|
<DT><B>Throws:</B>
|
||||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||||
</DD>
|
</DD>
|
||||||
@@ -731,18 +804,17 @@ public void <B>encodeYUV</B>(java.awt.image.BufferedImage srcImage,
|
|||||||
<A NAME="encodeYUV(java.awt.image.BufferedImage, int)"><!-- --></A><H3>
|
<A NAME="encodeYUV(java.awt.image.BufferedImage, int)"><!-- --></A><H3>
|
||||||
encodeYUV</H3>
|
encodeYUV</H3>
|
||||||
<PRE>
|
<PRE>
|
||||||
public byte[] <B>encodeYUV</B>(java.awt.image.BufferedImage srcImage,
|
<FONT SIZE="-1">@Deprecated
|
||||||
int flags)
|
</FONT>public byte[] <B>encodeYUV</B>(java.awt.image.BufferedImage srcImage,
|
||||||
|
int flags)
|
||||||
throws java.lang.Exception</PRE>
|
throws java.lang.Exception</PRE>
|
||||||
<DL>
|
<DL>
|
||||||
<DD>Encode the uncompressed source image stored in <code>srcImage</code>
|
<DD><B>Deprecated.</B> <I>Use
|
||||||
and return a buffer containing a YUV planar image. See
|
<A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage, int, int, int, int)"><CODE>setSourceImage(BufferedImage, int, int, int, int)</CODE></A> and
|
||||||
<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(int)"><CODE>encodeYUV(int)</CODE></A> instead.</I>
|
||||||
<P>
|
<P>
|
||||||
<DD><DL>
|
<DD><DL>
|
||||||
<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - a <code>BufferedImage</code> instance containing RGB or
|
|
||||||
grayscale pixels to be encoded<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
|
|
||||||
<DT><B>Returns:</B><DD>a buffer containing a YUV planar image
|
|
||||||
<DT><B>Throws:</B>
|
<DT><B>Throws:</B>
|
||||||
<DD><CODE>java.lang.Exception</CODE></DL>
|
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||||
</DD>
|
</DD>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C)2011-2013 D. R. Commander. All Rights Reserved.
|
* Copyright (C)2011-2014 D. R. Commander. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@@ -47,21 +47,10 @@ public class TJCompressor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a TurboJPEG compressor instance and associate the uncompressed
|
* @deprecated Use
|
||||||
* source image stored in <code>srcImage</code> with the newly-created
|
* {@link #TJCompressor(byte[], int, int, int, int, int, int)} instead.
|
||||||
* instance.
|
|
||||||
*
|
|
||||||
* @param srcImage see {@link #setSourceImage} for description
|
|
||||||
*
|
|
||||||
* @param width see {@link #setSourceImage} for description
|
|
||||||
*
|
|
||||||
* @param pitch see {@link #setSourceImage} for description
|
|
||||||
*
|
|
||||||
* @param height see {@link #setSourceImage} for description
|
|
||||||
*
|
|
||||||
* @param pixelFormat pixel format of the source image (one of
|
|
||||||
* {@link TJ TJ.PF_*})
|
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public TJCompressor(byte[] srcImage, int width, int pitch, int height,
|
public TJCompressor(byte[] srcImage, int width, int pitch, int height,
|
||||||
int pixelFormat) throws Exception {
|
int pixelFormat) throws Exception {
|
||||||
setSourceImage(srcImage, width, pitch, height, pixelFormat);
|
setSourceImage(srcImage, width, pitch, height, pixelFormat);
|
||||||
@@ -92,6 +81,31 @@ public class TJCompressor {
|
|||||||
setSourceImage(srcImage, x, y, width, pitch, height, pixelFormat);
|
setSourceImage(srcImage, x, y, width, pitch, height, pixelFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a TurboJPEG compressor instance and associate the uncompressed
|
||||||
|
* source image stored in <code>srcImage</code> with the newly-created
|
||||||
|
* instance.
|
||||||
|
*
|
||||||
|
* @param srcImage see
|
||||||
|
* {@link #setSourceImage(BufferedImage, int, int, int, int)} for description
|
||||||
|
*
|
||||||
|
* @param x see
|
||||||
|
* {@link #setSourceImage(BufferedImage, int, int, int, int)} for description
|
||||||
|
*
|
||||||
|
* @param y see
|
||||||
|
* {@link #setSourceImage(BufferedImage, int, int, int, int)} for description
|
||||||
|
*
|
||||||
|
* @param width see
|
||||||
|
* {@link #setSourceImage(BufferedImage, int, int, int, int)} for description
|
||||||
|
*
|
||||||
|
* @param height see
|
||||||
|
* {@link #setSourceImage(BufferedImage, int, int, int, int)} for description
|
||||||
|
*/
|
||||||
|
public TJCompressor(BufferedImage srcImage, int x, int y, int width,
|
||||||
|
int height) throws Exception {
|
||||||
|
setSourceImage(srcImage, x, y, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Associate an uncompressed source image with this compressor instance.
|
* Associate an uncompressed source image with this compressor instance.
|
||||||
*
|
*
|
||||||
@@ -139,6 +153,7 @@ public class TJCompressor {
|
|||||||
srcPixelFormat = pixelFormat;
|
srcPixelFormat = pixelFormat;
|
||||||
srcX = x;
|
srcX = x;
|
||||||
srcY = y;
|
srcY = y;
|
||||||
|
srcBufInt = null;
|
||||||
srcIsYUV = false;
|
srcIsYUV = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,6 +168,88 @@ public class TJCompressor {
|
|||||||
srcX = srcY = -1;
|
srcX = srcY = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Associate an uncompressed source image with this compressor instance.
|
||||||
|
*
|
||||||
|
* @param srcImage a <code>BufferedImage</code> instance containing RGB or
|
||||||
|
* grayscale pixels to be compressed
|
||||||
|
*
|
||||||
|
* @param x x offset (in pixels) of the region in the source image from which
|
||||||
|
* the JPEG image should be compressed
|
||||||
|
*
|
||||||
|
* @param y y offset (in pixels) of the region in the source image from which
|
||||||
|
* the JPEG image should be compressed
|
||||||
|
*
|
||||||
|
* @param width width (in pixels) of the region in the source image from
|
||||||
|
* which the JPEG image should be compressed (0 = compress the whole image)
|
||||||
|
*
|
||||||
|
* @param height height (in pixels) of the region in the source image from
|
||||||
|
* which the JPEG image should be compressed (0 = compress the whole image)
|
||||||
|
*/
|
||||||
|
public void setSourceImage(BufferedImage srcImage, int x, int y, int width,
|
||||||
|
int height) throws Exception {
|
||||||
|
if (handle == 0) init();
|
||||||
|
if (srcImage == null || x < 0 || y < 0 || width < 0 || height < 0)
|
||||||
|
throw new Exception("Invalid argument in setSourceImage()");
|
||||||
|
srcX = x;
|
||||||
|
srcY = y;
|
||||||
|
srcWidth = (width == 0) ? srcImage.getWidth(): width;
|
||||||
|
srcHeight = (height == 0) ? srcImage.getHeight() : height;
|
||||||
|
if (x + width > srcImage.getWidth() || y + height > srcImage.getHeight())
|
||||||
|
throw new Exception("Compression region exceeds the bounds of the source image");
|
||||||
|
|
||||||
|
int pixelFormat;
|
||||||
|
boolean intPixels = false;
|
||||||
|
if (byteOrder == null)
|
||||||
|
byteOrder = ByteOrder.nativeOrder();
|
||||||
|
switch(srcImage.getType()) {
|
||||||
|
case BufferedImage.TYPE_3BYTE_BGR:
|
||||||
|
pixelFormat = TJ.PF_BGR; break;
|
||||||
|
case BufferedImage.TYPE_4BYTE_ABGR:
|
||||||
|
case BufferedImage.TYPE_4BYTE_ABGR_PRE:
|
||||||
|
pixelFormat = TJ.PF_XBGR; break;
|
||||||
|
case BufferedImage.TYPE_BYTE_GRAY:
|
||||||
|
pixelFormat = TJ.PF_GRAY; break;
|
||||||
|
case BufferedImage.TYPE_INT_BGR:
|
||||||
|
if (byteOrder == ByteOrder.BIG_ENDIAN)
|
||||||
|
pixelFormat = TJ.PF_XBGR;
|
||||||
|
else
|
||||||
|
pixelFormat = TJ.PF_RGBX;
|
||||||
|
intPixels = true; break;
|
||||||
|
case BufferedImage.TYPE_INT_RGB:
|
||||||
|
case BufferedImage.TYPE_INT_ARGB:
|
||||||
|
case BufferedImage.TYPE_INT_ARGB_PRE:
|
||||||
|
if (byteOrder == ByteOrder.BIG_ENDIAN)
|
||||||
|
pixelFormat = TJ.PF_XRGB;
|
||||||
|
else
|
||||||
|
pixelFormat = TJ.PF_BGRX;
|
||||||
|
intPixels = true; break;
|
||||||
|
default:
|
||||||
|
throw new Exception("Unsupported BufferedImage format");
|
||||||
|
}
|
||||||
|
srcPixelFormat = pixelFormat;
|
||||||
|
|
||||||
|
WritableRaster wr = srcImage.getRaster();
|
||||||
|
if (intPixels) {
|
||||||
|
SinglePixelPackedSampleModel sm =
|
||||||
|
(SinglePixelPackedSampleModel)srcImage.getSampleModel();
|
||||||
|
srcStride = sm.getScanlineStride();
|
||||||
|
DataBufferInt db = (DataBufferInt)wr.getDataBuffer();
|
||||||
|
srcBufInt = db.getData();
|
||||||
|
srcBuf = null;
|
||||||
|
} else {
|
||||||
|
ComponentSampleModel sm =
|
||||||
|
(ComponentSampleModel)srcImage.getSampleModel();
|
||||||
|
int pixelSize = sm.getPixelStride();
|
||||||
|
if (pixelSize != TJ.getPixelSize(pixelFormat))
|
||||||
|
throw new Exception("Inconsistency between pixel format and pixel size in BufferedImage");
|
||||||
|
srcPitch = sm.getScanlineStride();
|
||||||
|
DataBufferByte db = (DataBufferByte)wr.getDataBuffer();
|
||||||
|
srcBuf = db.getData();
|
||||||
|
srcBufInt = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Associate an uncompressed YUV planar source image with this compressor
|
* Associate an uncompressed YUV planar source image with this compressor
|
||||||
* instance.
|
* instance.
|
||||||
@@ -237,16 +334,17 @@ public class TJCompressor {
|
|||||||
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 (srcBuf == null)
|
if (srcBuf == null && (srcBufInt == null || srcIsYUV))
|
||||||
throw new Exception(NO_ASSOC_ERROR);
|
throw new Exception(NO_ASSOC_ERROR);
|
||||||
if (jpegQuality < 0)
|
if (jpegQuality < 0)
|
||||||
throw new Exception("JPEG Quality not set");
|
throw new Exception("JPEG Quality not set");
|
||||||
if (subsamp < 0)
|
if (subsamp < 0)
|
||||||
throw new Exception("Subsampling level not set");
|
throw new Exception("Subsampling level not set");
|
||||||
|
|
||||||
if (srcIsYUV)
|
if (srcIsYUV)
|
||||||
compressedSize = compressFromYUV(srcBuf, srcWidth, srcYUVPad, srcHeight,
|
compressedSize = compressFromYUV(srcBuf, srcWidth, srcYUVPad, srcHeight,
|
||||||
subsamp, dstBuf, jpegQuality, flags);
|
subsamp, dstBuf, jpegQuality, flags);
|
||||||
else {
|
else if (srcBuf != null) {
|
||||||
if (srcX >= 0 && srcY >= 0)
|
if (srcX >= 0 && srcY >= 0)
|
||||||
compressedSize = compress(srcBuf, srcX, srcY, srcWidth, srcPitch,
|
compressedSize = compress(srcBuf, srcX, srcY, srcWidth, srcPitch,
|
||||||
srcHeight, srcPixelFormat, dstBuf, subsamp,
|
srcHeight, srcPixelFormat, dstBuf, subsamp,
|
||||||
@@ -255,6 +353,15 @@ public class TJCompressor {
|
|||||||
compressedSize = compress(srcBuf, srcWidth, srcPitch, srcHeight,
|
compressedSize = compress(srcBuf, srcWidth, srcPitch, srcHeight,
|
||||||
srcPixelFormat, dstBuf, subsamp, jpegQuality,
|
srcPixelFormat, dstBuf, subsamp, jpegQuality,
|
||||||
flags);
|
flags);
|
||||||
|
} else if (srcBufInt != null) {
|
||||||
|
if (srcX >= 0 && srcY >= 0)
|
||||||
|
compressedSize = compress(srcBufInt, srcX, srcY, srcWidth, srcStride,
|
||||||
|
srcHeight, srcPixelFormat, dstBuf, subsamp,
|
||||||
|
jpegQuality, flags);
|
||||||
|
else
|
||||||
|
compressedSize = compress(srcBufInt, srcWidth, srcStride, srcHeight,
|
||||||
|
srcPixelFormat, dstBuf, subsamp, jpegQuality,
|
||||||
|
flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,109 +384,26 @@ public class TJCompressor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compress the uncompressed source image stored in <code>srcImage</code>
|
* @deprecated Use
|
||||||
* and output a JPEG image to the given destination buffer.
|
* {@link #setSourceImage(BufferedImage, int, int, int, int)} and
|
||||||
*
|
* {@link #compress(byte[], int)} instead.
|
||||||
* @param srcImage a <code>BufferedImage</code> instance containing RGB or
|
|
||||||
* grayscale pixels to be compressed
|
|
||||||
*
|
|
||||||
* @param dstBuf buffer that will receive the JPEG image. Use
|
|
||||||
* {@link TJ#bufSize} to determine the maximum size for this buffer based on
|
|
||||||
* the image width, height, and level of chrominance subsampling.
|
|
||||||
*
|
|
||||||
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
|
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public void compress(BufferedImage srcImage, byte[] dstBuf, int flags)
|
public void compress(BufferedImage srcImage, byte[] dstBuf, int flags)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
if (srcImage == null || dstBuf == null || flags < 0)
|
setSourceImage(srcImage, 0, 0, 0, 0);
|
||||||
throw new Exception("Invalid argument in compress()");
|
compress(dstBuf, flags);
|
||||||
int width = srcImage.getWidth();
|
|
||||||
int height = srcImage.getHeight();
|
|
||||||
int pixelFormat;
|
|
||||||
boolean intPixels = false;
|
|
||||||
if (byteOrder == null)
|
|
||||||
byteOrder = ByteOrder.nativeOrder();
|
|
||||||
switch(srcImage.getType()) {
|
|
||||||
case BufferedImage.TYPE_3BYTE_BGR:
|
|
||||||
pixelFormat = TJ.PF_BGR; break;
|
|
||||||
case BufferedImage.TYPE_4BYTE_ABGR:
|
|
||||||
case BufferedImage.TYPE_4BYTE_ABGR_PRE:
|
|
||||||
pixelFormat = TJ.PF_XBGR; break;
|
|
||||||
case BufferedImage.TYPE_BYTE_GRAY:
|
|
||||||
pixelFormat = TJ.PF_GRAY; break;
|
|
||||||
case BufferedImage.TYPE_INT_BGR:
|
|
||||||
if (byteOrder == ByteOrder.BIG_ENDIAN)
|
|
||||||
pixelFormat = TJ.PF_XBGR;
|
|
||||||
else
|
|
||||||
pixelFormat = TJ.PF_RGBX;
|
|
||||||
intPixels = true; break;
|
|
||||||
case BufferedImage.TYPE_INT_RGB:
|
|
||||||
case BufferedImage.TYPE_INT_ARGB:
|
|
||||||
case BufferedImage.TYPE_INT_ARGB_PRE:
|
|
||||||
if (byteOrder == ByteOrder.BIG_ENDIAN)
|
|
||||||
pixelFormat = TJ.PF_XRGB;
|
|
||||||
else
|
|
||||||
pixelFormat = TJ.PF_BGRX;
|
|
||||||
intPixels = true; break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Unsupported BufferedImage format");
|
|
||||||
}
|
|
||||||
WritableRaster wr = srcImage.getRaster();
|
|
||||||
if (jpegQuality < 0)
|
|
||||||
throw new Exception("JPEG Quality not set");
|
|
||||||
if (subsamp < 0)
|
|
||||||
throw new Exception("Subsampling level not set");
|
|
||||||
if (intPixels) {
|
|
||||||
SinglePixelPackedSampleModel sm =
|
|
||||||
(SinglePixelPackedSampleModel)srcImage.getSampleModel();
|
|
||||||
int stride = sm.getScanlineStride();
|
|
||||||
DataBufferInt db = (DataBufferInt)wr.getDataBuffer();
|
|
||||||
int[] buf = db.getData();
|
|
||||||
if (srcX >= 0 && srcY >= 0)
|
|
||||||
compressedSize = compress(buf, srcX, srcY, width, stride, height,
|
|
||||||
pixelFormat, dstBuf, subsamp, jpegQuality,
|
|
||||||
flags);
|
|
||||||
else
|
|
||||||
compressedSize = compress(buf, width, stride, height, pixelFormat,
|
|
||||||
dstBuf, subsamp, jpegQuality, flags);
|
|
||||||
} else {
|
|
||||||
ComponentSampleModel sm =
|
|
||||||
(ComponentSampleModel)srcImage.getSampleModel();
|
|
||||||
int pixelSize = sm.getPixelStride();
|
|
||||||
if (pixelSize != TJ.getPixelSize(pixelFormat))
|
|
||||||
throw new Exception("Inconsistency between pixel format and pixel size in BufferedImage");
|
|
||||||
int pitch = sm.getScanlineStride();
|
|
||||||
DataBufferByte db = (DataBufferByte)wr.getDataBuffer();
|
|
||||||
byte[] buf = db.getData();
|
|
||||||
if (srcX >= 0 && srcY >= 0)
|
|
||||||
compressedSize = compress(buf, srcX, srcY, width, pitch, height,
|
|
||||||
pixelFormat, dstBuf, subsamp, jpegQuality,
|
|
||||||
flags);
|
|
||||||
else
|
|
||||||
compressedSize = compress(buf, width, pitch, height, pixelFormat,
|
|
||||||
dstBuf, subsamp, jpegQuality, flags);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compress the uncompressed source image stored in <code>srcImage</code>
|
* @deprecated Use
|
||||||
* and return a buffer containing a JPEG image.
|
* {@link #setSourceImage(BufferedImage, int, int, int, int)} and
|
||||||
*
|
* {@link #compress(int)} instead.
|
||||||
* @param srcImage a <code>BufferedImage</code> instance containing RGB or
|
|
||||||
* grayscale pixels to be compressed
|
|
||||||
*
|
|
||||||
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
|
|
||||||
*
|
|
||||||
* @return a buffer containing a JPEG image. The length of this buffer will
|
|
||||||
* not be equal to the size of the JPEG image. Use {@link
|
|
||||||
* #getCompressedSize} to obtain the size of the JPEG image.
|
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public byte[] compress(BufferedImage srcImage, int flags) throws Exception {
|
public byte[] compress(BufferedImage srcImage, int flags) throws Exception {
|
||||||
int width = srcImage.getWidth();
|
setSourceImage(srcImage, 0, 0, 0, 0);
|
||||||
int height = srcImage.getHeight();
|
return compress(flags);
|
||||||
byte[] buf = new byte[TJ.bufSize(width, height, subsamp)];
|
|
||||||
compress(srcImage, buf, flags);
|
|
||||||
return buf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -424,12 +448,20 @@ public class TJCompressor {
|
|||||||
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 (srcBuf == null)
|
if (srcBuf == null && srcBufInt == null)
|
||||||
throw new Exception(NO_ASSOC_ERROR);
|
throw new Exception(NO_ASSOC_ERROR);
|
||||||
|
if (srcIsYUV)
|
||||||
|
throw new Exception("Source image is not correct type");
|
||||||
if (subsamp < 0)
|
if (subsamp < 0)
|
||||||
throw new Exception("Subsampling level not set");
|
throw new Exception("Subsampling level not set");
|
||||||
encodeYUV(srcBuf, srcWidth, srcPitch, srcHeight, srcPixelFormat, dstBuf,
|
|
||||||
yuvPad, subsamp, flags);
|
if (srcBufInt != null) {
|
||||||
|
encodeYUV(srcBufInt, srcWidth, srcStride, srcHeight, srcPixelFormat,
|
||||||
|
dstBuf, yuvPad, subsamp, flags);
|
||||||
|
} else {
|
||||||
|
encodeYUV(srcBuf, srcWidth, srcPitch, srcHeight, srcPixelFormat, dstBuf,
|
||||||
|
yuvPad, subsamp, flags);
|
||||||
|
}
|
||||||
compressedSize = TJ.bufSizeYUV(srcWidth, yuvPad, srcHeight, subsamp);
|
compressedSize = TJ.bufSizeYUV(srcWidth, yuvPad, srcHeight, subsamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -453,98 +485,26 @@ public class TJCompressor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encode the uncompressed source image stored in <code>srcImage</code>
|
* @deprecated Use
|
||||||
* and output a YUV planar image to the given destination buffer. See
|
* {@link #setSourceImage(BufferedImage, int, int, int, int)} and
|
||||||
* {@link #encodeYUV(byte[], int)} for more detail.
|
* {@link #encodeYUV(byte[], int)} instead.
|
||||||
*
|
|
||||||
* @param srcImage a <code>BufferedImage</code> instance containing RGB or
|
|
||||||
* grayscale pixels to be encoded
|
|
||||||
*
|
|
||||||
* @param dstBuf buffer that will receive the YUV planar image. Use
|
|
||||||
* {@link TJ#bufSizeYUV} to determine the appropriate size for this buffer
|
|
||||||
* based on the image width, height, and level of chrominance subsampling.
|
|
||||||
*
|
|
||||||
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
|
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public void encodeYUV(BufferedImage srcImage, byte[] dstBuf, int flags)
|
public void encodeYUV(BufferedImage srcImage, byte[] dstBuf, int flags)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
if (srcImage == null || dstBuf == null || flags < 0)
|
setSourceImage(srcImage, 0, 0, 0, 0);
|
||||||
throw new Exception("Invalid argument in encodeYUV()");
|
encodeYUV(dstBuf, flags);
|
||||||
int width = srcImage.getWidth();
|
|
||||||
int height = srcImage.getHeight();
|
|
||||||
int pixelFormat; boolean intPixels = false;
|
|
||||||
if (byteOrder == null)
|
|
||||||
byteOrder = ByteOrder.nativeOrder();
|
|
||||||
switch(srcImage.getType()) {
|
|
||||||
case BufferedImage.TYPE_3BYTE_BGR:
|
|
||||||
pixelFormat = TJ.PF_BGR; break;
|
|
||||||
case BufferedImage.TYPE_4BYTE_ABGR:
|
|
||||||
case BufferedImage.TYPE_4BYTE_ABGR_PRE:
|
|
||||||
pixelFormat = TJ.PF_XBGR; break;
|
|
||||||
case BufferedImage.TYPE_BYTE_GRAY:
|
|
||||||
pixelFormat = TJ.PF_GRAY; break;
|
|
||||||
case BufferedImage.TYPE_INT_BGR:
|
|
||||||
if (byteOrder == ByteOrder.BIG_ENDIAN)
|
|
||||||
pixelFormat = TJ.PF_XBGR;
|
|
||||||
else
|
|
||||||
pixelFormat = TJ.PF_RGBX;
|
|
||||||
intPixels = true; break;
|
|
||||||
case BufferedImage.TYPE_INT_RGB:
|
|
||||||
case BufferedImage.TYPE_INT_ARGB:
|
|
||||||
case BufferedImage.TYPE_INT_ARGB_PRE:
|
|
||||||
if (byteOrder == ByteOrder.BIG_ENDIAN)
|
|
||||||
pixelFormat = TJ.PF_XRGB;
|
|
||||||
else
|
|
||||||
pixelFormat = TJ.PF_BGRX;
|
|
||||||
intPixels = true; break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Unsupported BufferedImage format");
|
|
||||||
}
|
|
||||||
WritableRaster wr = srcImage.getRaster();
|
|
||||||
if (subsamp < 0) throw new Exception("Subsampling level not set");
|
|
||||||
if (intPixels) {
|
|
||||||
SinglePixelPackedSampleModel sm =
|
|
||||||
(SinglePixelPackedSampleModel)srcImage.getSampleModel();
|
|
||||||
int stride = sm.getScanlineStride();
|
|
||||||
DataBufferInt db = (DataBufferInt)wr.getDataBuffer();
|
|
||||||
int[] buf = db.getData();
|
|
||||||
encodeYUV(buf, width, stride, height, pixelFormat, dstBuf, yuvPad,
|
|
||||||
subsamp, flags);
|
|
||||||
} else {
|
|
||||||
ComponentSampleModel sm =
|
|
||||||
(ComponentSampleModel)srcImage.getSampleModel();
|
|
||||||
int pixelSize = sm.getPixelStride();
|
|
||||||
if (pixelSize != TJ.getPixelSize(pixelFormat))
|
|
||||||
throw new Exception("Inconsistency between pixel format and pixel size in BufferedImage");
|
|
||||||
int pitch = sm.getScanlineStride();
|
|
||||||
DataBufferByte db = (DataBufferByte)wr.getDataBuffer();
|
|
||||||
byte[] buf = db.getData();
|
|
||||||
encodeYUV(buf, width, pitch, height, pixelFormat, dstBuf, yuvPad,
|
|
||||||
subsamp, flags);
|
|
||||||
}
|
|
||||||
compressedSize = TJ.bufSizeYUV(width, yuvPad, height, subsamp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encode the uncompressed source image stored in <code>srcImage</code>
|
* @deprecated Use
|
||||||
* and return a buffer containing a YUV planar image. See
|
* {@link #setSourceImage(BufferedImage, int, int, int, int)} and
|
||||||
* {@link #encodeYUV(byte[], int)} for more detail.
|
* {@link #encodeYUV(int)} instead.
|
||||||
*
|
|
||||||
* @param srcImage a <code>BufferedImage</code> instance containing RGB or
|
|
||||||
* grayscale pixels to be encoded
|
|
||||||
*
|
|
||||||
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
|
|
||||||
*
|
|
||||||
* @return a buffer containing a YUV planar image
|
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public byte[] encodeYUV(BufferedImage srcImage, int flags) throws Exception {
|
public byte[] encodeYUV(BufferedImage srcImage, int flags) throws Exception {
|
||||||
if (subsamp < 0)
|
setSourceImage(srcImage, 0, 0, 0, 0);
|
||||||
throw new Exception("Subsampling level not set");
|
return encodeYUV(flags);
|
||||||
int width = srcImage.getWidth();
|
|
||||||
int height = srcImage.getHeight();
|
|
||||||
byte[] buf = new byte[TJ.bufSizeYUV(width, yuvPad, height, subsamp)];
|
|
||||||
encodeYUV(srcImage, buf, flags);
|
|
||||||
return buf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -621,11 +581,13 @@ public class TJCompressor {
|
|||||||
|
|
||||||
private long handle = 0;
|
private long handle = 0;
|
||||||
private byte[] srcBuf = null;
|
private byte[] srcBuf = null;
|
||||||
|
private int[] srcBufInt = null;
|
||||||
private int srcWidth = 0;
|
private int srcWidth = 0;
|
||||||
private int srcHeight = 0;
|
private int srcHeight = 0;
|
||||||
private int srcX = -1;
|
private int srcX = -1;
|
||||||
private int srcY = -1;
|
private int srcY = -1;
|
||||||
private int srcPitch = 0;
|
private int srcPitch = 0;
|
||||||
|
private int srcStride = 0;
|
||||||
private int srcPixelFormat = -1;
|
private int srcPixelFormat = -1;
|
||||||
private int srcYUVPad = -1;
|
private int srcYUVPad = -1;
|
||||||
private boolean srcIsYUV;
|
private boolean srcIsYUV;
|
||||||
|
|||||||
Reference in New Issue
Block a user