Oops. Forgot to implement access method for the colorspace & extend TJBench
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1022 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
@@ -52,6 +52,10 @@ class TJBench {
|
|||||||
"444", "422", "420", "GRAY", "440", "411"
|
"444", "422", "420", "GRAY", "440", "411"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static final String[] csName = {
|
||||||
|
"RGB", "YCbCr", "GRAY", "CMYK", "YCCK"
|
||||||
|
};
|
||||||
|
|
||||||
static TJScalingFactor sf;
|
static TJScalingFactor sf;
|
||||||
static int xformOp = TJTransform.OP_NONE, xformOpt = 0;
|
static int xformOp = TJTransform.OP_NONE, xformOpt = 0;
|
||||||
static double benchTime = 5.0;
|
static double benchTime = 5.0;
|
||||||
@@ -62,6 +66,16 @@ class TJBench {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static String formatName(int subsamp, int cs) {
|
||||||
|
if (cs == TJ.CS_YCbCr)
|
||||||
|
return subNameLong[subsamp];
|
||||||
|
else if (cs == TJ.CS_YCCK)
|
||||||
|
return csName[cs] + " " + subNameLong[subsamp];
|
||||||
|
else
|
||||||
|
return csName[cs];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static String sigFig(double val, int figs) {
|
static String sigFig(double val, int figs) {
|
||||||
String format;
|
String format;
|
||||||
int digitsAfterDecimal = figs - (int)Math.ceil(Math.log10(Math.abs(val)));
|
int digitsAfterDecimal = figs - (int)Math.ceil(Math.log10(Math.abs(val)));
|
||||||
@@ -417,7 +431,7 @@ class TJBench {
|
|||||||
byte[] srcBuf;
|
byte[] srcBuf;
|
||||||
int[] jpegSize;
|
int[] jpegSize;
|
||||||
int totalJpegSize;
|
int totalJpegSize;
|
||||||
int w = 0, h = 0, subsamp = -1, _w, _h, _tilew, _tileh,
|
int w = 0, h = 0, subsamp = -1, cs = -1, _w, _h, _tilew, _tileh,
|
||||||
_ntilesw, _ntilesh, _subsamp, x, y;
|
_ntilesw, _ntilesh, _subsamp, x, y;
|
||||||
int ntilesw = 1, ntilesh = 1;
|
int ntilesw = 1, ntilesh = 1;
|
||||||
double start, elapsed;
|
double start, elapsed;
|
||||||
@@ -439,17 +453,22 @@ class TJBench {
|
|||||||
w = tjt.getWidth();
|
w = tjt.getWidth();
|
||||||
h = tjt.getHeight();
|
h = tjt.getHeight();
|
||||||
subsamp = tjt.getSubsamp();
|
subsamp = tjt.getSubsamp();
|
||||||
|
cs = tjt.getColorspace();
|
||||||
|
|
||||||
if (quiet == 1) {
|
if (quiet == 1) {
|
||||||
System.out.println("All performance values in Mpixels/sec\n");
|
System.out.println("All performance values in Mpixels/sec\n");
|
||||||
System.out.format("Bitmap\tBitmap\tJPEG\t%s %s \tXform\tComp\tDecomp\n",
|
System.out.format("Bitmap\tBitmap\tJPEG\tJPEG\t%s %s \tXform\tComp\tDecomp\n",
|
||||||
(doTile ? "Tile " : "Image"),
|
(doTile ? "Tile " : "Image"),
|
||||||
(doTile ? "Tile " : "Image"));
|
(doTile ? "Tile " : "Image"));
|
||||||
System.out.println("Format\tOrder\tSubsamp\tWidth Height\tPerf \tRatio\tPerf\n");
|
System.out.println("Format\tOrder\tCS\tSubsamp\tWidth Height\tPerf \tRatio\tPerf\n");
|
||||||
} else if (quiet == 0) {
|
} else if (quiet == 0) {
|
||||||
System.out.format(">>>>> JPEG %s --> %s (%s) <<<<<",
|
if (yuv == YUVDECODE)
|
||||||
subNameLong[subsamp], pixFormatStr[pf],
|
System.out.format(">>>>> JPEG %s --> YUV <<<<<",
|
||||||
(flags & TJ.FLAG_BOTTOMUP) != 0 ? "Bottom-up" : "Top-down");
|
formatName(subsamp, cs));
|
||||||
|
else
|
||||||
|
System.out.format(">>>>> JPEG %s --> %s (%s) <<<<<",
|
||||||
|
formatName(subsamp, cs), pixFormatStr[pf],
|
||||||
|
(flags & TJ.FLAG_BOTTOMUP) != 0 ? "Bottom-up" : "Top-down");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int tilew = doTile ? 16 : w, tileh = doTile ? 16 : h; ;
|
for (int tilew = doTile ? 16 : w, tileh = doTile ? 16 : h; ;
|
||||||
@@ -470,9 +489,9 @@ class TJBench {
|
|||||||
sf.getScaled(_h));
|
sf.getScaled(_h));
|
||||||
System.out.println("");
|
System.out.println("");
|
||||||
} else if (quiet == 1) {
|
} else if (quiet == 1) {
|
||||||
System.out.format("%s\t%s\t%s\t", pixFormatStr[pf],
|
System.out.format("%s\t%s\t%s\t%s\t", pixFormatStr[pf],
|
||||||
(flags & TJ.FLAG_BOTTOMUP) != 0 ? "BU" : "TD",
|
(flags & TJ.FLAG_BOTTOMUP) != 0 ? "BU" : "TD",
|
||||||
subNameLong[subsamp]);
|
csName[cs], subNameLong[subsamp]);
|
||||||
System.out.format("%-4d %-4d\t", tilew, tileh);
|
System.out.format("%-4d %-4d\t", tilew, tileh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -262,6 +262,10 @@ Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/
|
|||||||
Static method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
|
Static method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
|
||||||
<DD>For the given pixel format, returns the number of bytes that the blue
|
<DD>For the given pixel format, returns the number of bytes that the blue
|
||||||
component is offset from the start of the pixel.
|
component is offset from the start of the pixel.
|
||||||
|
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getColorspace()"><B>getColorspace()</B></A> -
|
||||||
|
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
|
||||||
|
<DD>Returns the colorspace used in the JPEG image associated with this
|
||||||
|
decompressor instance.
|
||||||
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#getCompressedSize()"><B>getCompressedSize()</B></A> -
|
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#getCompressedSize()"><B>getCompressedSize()</B></A> -
|
||||||
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
|
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
|
||||||
<DD>Returns the size of the image (in bytes) generated by the most recent
|
<DD>Returns the size of the image (in bytes) generated by the most recent
|
||||||
|
|||||||
@@ -358,6 +358,15 @@ TurboJPEG decompressor
|
|||||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||||
<CODE> int</CODE></FONT></TD>
|
<CODE> int</CODE></FONT></TD>
|
||||||
|
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getColorspace()">getColorspace</A></B>()</CODE>
|
||||||
|
|
||||||
|
<BR>
|
||||||
|
Returns the colorspace used in the JPEG image associated with this
|
||||||
|
decompressor instance.</TD>
|
||||||
|
</TR>
|
||||||
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||||
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||||
|
<CODE> int</CODE></FONT></TD>
|
||||||
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getHeight()">getHeight</A></B>()</CODE>
|
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getHeight()">getHeight</A></B>()</CODE>
|
||||||
|
|
||||||
<BR>
|
<BR>
|
||||||
@@ -656,7 +665,7 @@ public int <B>getSubsamp</B>()
|
|||||||
throws java.lang.Exception</PRE>
|
throws java.lang.Exception</PRE>
|
||||||
<DL>
|
<DL>
|
||||||
<DD>Returns the level of chrominance subsampling used in the JPEG image
|
<DD>Returns the level of chrominance subsampling used in the JPEG image
|
||||||
associated with this decompressor instance.
|
associated with this decompressor instance. See <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.SAMP_*</CODE></A>.
|
||||||
<P>
|
<P>
|
||||||
<DD><DL>
|
<DD><DL>
|
||||||
|
|
||||||
@@ -668,6 +677,25 @@ public int <B>getSubsamp</B>()
|
|||||||
</DL>
|
</DL>
|
||||||
<HR>
|
<HR>
|
||||||
|
|
||||||
|
<A NAME="getColorspace()"><!-- --></A><H3>
|
||||||
|
getColorspace</H3>
|
||||||
|
<PRE>
|
||||||
|
public int <B>getColorspace</B>()
|
||||||
|
throws java.lang.Exception</PRE>
|
||||||
|
<DL>
|
||||||
|
<DD>Returns the colorspace used in the JPEG image associated with this
|
||||||
|
decompressor instance. See <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.CS_*</CODE></A>.
|
||||||
|
<P>
|
||||||
|
<DD><DL>
|
||||||
|
|
||||||
|
<DT><B>Returns:</B><DD>the colorspace used in the JPEG image associated with this
|
||||||
|
decompressor instance
|
||||||
|
<DT><B>Throws:</B>
|
||||||
|
<DD><CODE>java.lang.Exception</CODE></DL>
|
||||||
|
</DD>
|
||||||
|
</DL>
|
||||||
|
<HR>
|
||||||
|
|
||||||
<A NAME="getJPEGBuf()"><!-- --></A><H3>
|
<A NAME="getJPEGBuf()"><!-- --></A><H3>
|
||||||
getJPEGBuf</H3>
|
getJPEGBuf</H3>
|
||||||
<PRE>
|
<PRE>
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ TurboJPEG lossless transformer
|
|||||||
<TH ALIGN="left"><B>Methods inherited from class org.libjpegturbo.turbojpeg.<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A></B></TH>
|
<TH ALIGN="left"><B>Methods inherited from class org.libjpegturbo.turbojpeg.<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A></B></TH>
|
||||||
</TR>
|
</TR>
|
||||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||||
<TD><CODE><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#close()">close</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(java.awt.image.BufferedImage, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(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(byte[], int, int, int, int)">decompressToYUV</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int)">decompressToYUV</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int, int, int, 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(byte[], int, int, int, int)">decompressToYUV</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int)">decompressToYUV</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int, int, int, int)">decompressToYUV</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#finalize()">finalize</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getColorspace()">getColorspace</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getHeight()">getHeight</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGBuf()">getJPEGBuf</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGSize()">getJPEGSize</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int, int)">getScaledHeight</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int, int)">getScaledWidth</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSubsamp()">getSubsamp</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getWidth()">getWidth</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGImage(byte[], int)">setJPEGImage</A></CODE></TD>
|
||||||
</TR>
|
</TR>
|
||||||
</TABLE>
|
</TABLE>
|
||||||
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
|
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public class TJDecompressor {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the level of chrominance subsampling used in the JPEG image
|
* Returns the level of chrominance subsampling used in the JPEG image
|
||||||
* associated with this decompressor instance.
|
* associated with this decompressor instance. See {@link TJ TJ.SAMP_*}.
|
||||||
*
|
*
|
||||||
* @return the level of chrominance subsampling used in the JPEG image
|
* @return the level of chrominance subsampling used in the JPEG image
|
||||||
* associated with this decompressor instance
|
* associated with this decompressor instance
|
||||||
@@ -130,6 +130,21 @@ public class TJDecompressor {
|
|||||||
return jpegSubsamp;
|
return jpegSubsamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the colorspace used in the JPEG image associated with this
|
||||||
|
* decompressor instance. See {@link TJ TJ.CS_*}.
|
||||||
|
*
|
||||||
|
* @return the colorspace used in the JPEG image associated with this
|
||||||
|
* decompressor instance
|
||||||
|
*/
|
||||||
|
public int getColorspace() throws Exception {
|
||||||
|
if (jpegColorspace < 0)
|
||||||
|
throw new Exception(NO_ASSOC_ERROR);
|
||||||
|
if (jpegColorspace >= TJ.NUMCS)
|
||||||
|
throw new Exception("JPEG header information is invalid");
|
||||||
|
return jpegColorspace;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the JPEG image buffer associated with this decompressor instance.
|
* Returns the JPEG image buffer associated with this decompressor instance.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user