Extend the TurboJPEG Java API to support generating YUV images with arbitrary padding and to support image scaling when decompressing to YUV

git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@975 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
DRC
2013-04-28 01:32:52 +00:00
parent 2d25f449a5
commit 084c4c039a
31 changed files with 513 additions and 152 deletions

View File

@@ -314,8 +314,10 @@ set(MD5_JPEG_CROP b4197f377e621c4e9b1d20471432610d)
if(WITH_JAVA)
add_test(TJUnitTest ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest)
add_test(TJUnitTest-yuv ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -yuv)
add_test(TJUnitTest-yuv-nopad ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -yuv -noyuvpad)
add_test(TJUnitTest-bi ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -bi)
add_test(TJUnitTest-bi-yuv ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -bi -yuv)
add_test(TJUnitTest-bi-yuv-nopad ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -bi -yuv -noyuvpad)
endif()
add_test(tjunittest tjunittest)
add_test(tjunittest-alloc tjunittest -alloc)

View File

@@ -200,7 +200,9 @@ if WITH_JAVA
$(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest
$(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -bi
$(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -yuv
$(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -yuv -noyuvpad
$(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -yuv -bi
$(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -yuv -bi -noyuvpad
endif
./tjunittest
./tjunittest -alloc

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C)2011-2012 D. R. Commander. All Rights Reserved.
* Copyright (C)2011-2013 D. R. Commander. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -46,6 +46,8 @@ public class TJUnitTest {
System.out.println("\nUSAGE: java " + classname + " [options]\n");
System.out.println("Options:\n");
System.out.println("-yuv = test YUV encoding/decoding support\n");
System.out.println("-noyuvpad = do not pad each line of each Y, U, and V plane to the nearest\n");
System.out.println(" 4-byte boundary\n");
System.out.println("-bi = test BufferedImage support\n");
System.exit(1);
}
@@ -93,6 +95,7 @@ public class TJUnitTest {
private static final int YUVENCODE = 1;
private static final int YUVDECODE = 2;
private static int yuv = 0;
private static int pad = 4;
private static boolean bi = false;
private static int exitStatus = 0;
@@ -472,16 +475,18 @@ public class TJUnitTest {
}
private static int checkBufYUV(byte[] buf, int size, int w, int h,
int subsamp) throws Exception {
int subsamp, TJScalingFactor sf)
throws Exception {
int row, col;
int hsf = TJ.getMCUWidth(subsamp) / 8, vsf = TJ.getMCUHeight(subsamp) / 8;
int pw = PAD(w, hsf), ph = PAD(h, vsf);
int cw = pw / hsf, ch = ph / vsf;
int ypitch = PAD(pw, 4), uvpitch = PAD(cw, 4);
int ypitch = PAD(pw, pad), uvpitch = PAD(cw, pad);
int retval = 1;
int correctsize = ypitch * ph +
(subsamp == TJ.SAMP_GRAY ? 0 : uvpitch * ch * 2);
int halfway = 16;
int halfway = 16 * sf.getNum() / sf.getDenom();
int blockSize = 8 * sf.getNum() / sf.getDenom();
try {
if (size != correctsize)
@@ -491,7 +496,7 @@ public class TJUnitTest {
for (row = 0; row < ph; row++) {
for (col = 0; col < pw; col++) {
byte y = buf[ypitch * row + col];
if (((row / 8) + (col / 8)) % 2 == 0) {
if (((row / blockSize) + (col / blockSize)) % 2 == 0) {
if (row < halfway)
checkVal255(row, col, y, "Y");
else
@@ -505,12 +510,12 @@ public class TJUnitTest {
}
}
if (subsamp != TJ.SAMP_GRAY) {
halfway = 16 / vsf;
halfway = 16 / vsf * sf.getNum() / sf.getDenom();
for (row = 0; row < ch; row++) {
for (col = 0; col < cw; col++) {
byte u = buf[ypitch * ph + (uvpitch * row + col)],
v = buf[ypitch * ph + uvpitch * ch + (uvpitch * row + col)];
if (((row * vsf / 8) + (col * hsf / 8)) % 2 == 0) {
if (((row * vsf / blockSize) + (col * hsf / blockSize)) % 2 == 0) {
checkVal(row, col, u, "U", 128);
checkVal(row, col, v, "V", 128);
} else {
@@ -618,6 +623,7 @@ public class TJUnitTest {
t = getTime();
tjc.setSubsamp(subsamp);
tjc.setJPEGQuality(jpegQual);
tjc.setYUVPad(pad);
if (bi) {
if (yuv == YUVENCODE)
tjc.encodeYUV(img, dstBuf, flags);
@@ -644,7 +650,8 @@ public class TJUnitTest {
writeJPEG(dstBuf, size, tempstr);
if (yuv == YUVENCODE) {
if (checkBufYUV(dstBuf, size, w, h, subsamp) == 1)
if (checkBufYUV(dstBuf, size, w, h, subsamp,
new TJScalingFactor(1, 1)) == 1)
System.out.print("Passed.");
else {
System.out.print("FAILED!");
@@ -680,7 +687,7 @@ public class TJUnitTest {
System.out.print("JPEG -> ");
if (yuv == YUVDECODE)
System.out.print("YUV " + subName[subsamp] + " ... ");
System.out.print("YUV " + subNameLong[subsamp] + " ");
else {
System.out.print(pfStr + " ");
if (bi)
@@ -689,11 +696,11 @@ public class TJUnitTest {
System.out.print("Bottom-Up ");
else
System.out.print("Top-Down ");
if (!sf.isOne())
System.out.print(sf.getNum() + "/" + sf.getDenom() + " ... ");
else
System.out.print("... ");
}
if (!sf.isOne())
System.out.print(sf.getNum() + "/" + sf.getDenom() + " ... ");
else
System.out.print("... ");
t = getTime();
tjd.setJPEGImage(jpegBuf, jpegSize);
@@ -709,7 +716,7 @@ public class TJUnitTest {
throw new Exception("Scaled size mismatch");
if (yuv == YUVDECODE)
dstBuf = tjd.decompressToYUV(flags);
dstBuf = tjd.decompressToYUV(scaledWidth, pad, scaledHeight, flags);
else {
if (bi)
img = tjd.decompress(scaledWidth, scaledHeight, imgType, flags);
@@ -728,7 +735,8 @@ public class TJUnitTest {
}
if (yuv == YUVDECODE) {
if (checkBufYUV(dstBuf, dstBuf.length, w, h, subsamp) == 1)
if (checkBufYUV(dstBuf, dstBuf.length, scaledWidth, scaledHeight,
subsamp, sf) == 1)
System.out.print("Passed.");
else {
System.out.print("FAILED!"); exitStatus = -1;
@@ -752,7 +760,7 @@ public class TJUnitTest {
String baseName, int subsamp,
int flags) throws Exception {
int i;
if ((subsamp == TJ.SAMP_444 || subsamp == TJ.SAMP_GRAY) && yuv == 0) {
if (subsamp == TJ.SAMP_444 || subsamp == TJ.SAMP_GRAY) {
TJScalingFactor[] sf = TJ.getScalingFactors();
for (i = 0; i < sf.length; i++)
decompTest(tjd, jpegBuf, jpegSize, w, h, pf, baseName, subsamp,
@@ -771,7 +779,7 @@ public class TJUnitTest {
byte[] dstBuf;
if (yuv == YUVENCODE)
dstBuf = new byte[TJ.bufSizeYUV(w, h, subsamp)];
dstBuf = new byte[TJ.bufSizeYUV(w, pad, h, subsamp)];
else
dstBuf = new byte[TJ.bufSize(w, h, subsamp)];
@@ -860,6 +868,8 @@ public class TJUnitTest {
for (int i = 0; i < argv.length; i++) {
if (argv[i].equalsIgnoreCase("-yuv"))
doyuv = true;
if (argv[i].equalsIgnoreCase("-noyuvpad"))
pad = 1;
if (argv[i].substring(0, 1).equalsIgnoreCase("-h") ||
argv[i].equalsIgnoreCase("-?"))
usage();

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_43) on Fri Apr 26 20:05:34 CDT 2013 -->
<!-- Generated by javadoc (build 1.6.0_43) on Sat Apr 27 20:13:12 CDT 2013 -->
<TITLE>
All Classes
</TITLE>
<META NAME="date" CONTENT="2013-04-26">
<META NAME="date" CONTENT="2013-04-27">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_43) on Fri Apr 26 20:05:34 CDT 2013 -->
<!-- Generated by javadoc (build 1.6.0_43) on Sat Apr 27 20:13:12 CDT 2013 -->
<TITLE>
All Classes
</TITLE>
<META NAME="date" CONTENT="2013-04-26">
<META NAME="date" CONTENT="2013-04-27">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_43) on Fri Apr 26 20:05:34 CDT 2013 -->
<!-- Generated by javadoc (build 1.6.0_43) on Sat Apr 27 20:13:12 CDT 2013 -->
<TITLE>
Constant Field Values
</TITLE>
<META NAME="date" CONTENT="2013-04-26">
<META NAME="date" CONTENT="2013-04-27">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_43) on Fri Apr 26 20:05:34 CDT 2013 -->
<!-- Generated by javadoc (build 1.6.0_43) on Sat Apr 27 20:13:12 CDT 2013 -->
<TITLE>
Deprecated List
</TITLE>
<META NAME="date" CONTENT="2013-04-26">
<META NAME="date" CONTENT="2013-04-27">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
@@ -93,12 +93,28 @@ function windowTitle()
<B>Deprecated Methods</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int)">org.libjpegturbo.turbojpeg.TJ.bufSizeYUV(int, int, int)</A>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<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>&nbsp;</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>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I>Use
<A HREF="org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int, int, int)"><CODE>TJDecompressor.decompress(byte[], int, int, int, int, int, int, int)</CODE></A> instead.</I>&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int)">org.libjpegturbo.turbojpeg.TJDecompressor.decompressToYUV(byte[], int)</A>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I>Use <A HREF="org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int, int, int, int)"><CODE>TJDecompressor.decompressToYUV(byte[], int, int, int, int)</CODE></A>
instead.</I>&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int)">org.libjpegturbo.turbojpeg.TJDecompressor.decompressToYUV(int)</A>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<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>&nbsp;</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>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I>Use

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_43) on Fri Apr 26 20:05:35 CDT 2013 -->
<!-- Generated by javadoc (build 1.6.0_43) on Sat Apr 27 20:13:12 CDT 2013 -->
<TITLE>
API Help
</TITLE>
<META NAME="date" CONTENT="2013-04-26">
<META NAME="date" CONTENT="2013-04-27">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_43) on Fri Apr 26 20:05:34 CDT 2013 -->
<!-- Generated by javadoc (build 1.6.0_43) on Sat Apr 27 20:13:12 CDT 2013 -->
<TITLE>
Index
</TITLE>
<META NAME="date" CONTENT="2013-04-26">
<META NAME="date" CONTENT="2013-04-27">
<LINK REL ="stylesheet" TYPE="text/css" HREF="./stylesheet.css" TITLE="Style">
@@ -84,10 +84,13 @@ function windowTitle()
Static method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
<DD>Returns the maximum size of the buffer (in bytes) required to hold a JPEG
image with the given width, height, and level of chrominance subsampling.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int)"><B>bufSizeYUV(int, int, int)</B></A> -
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int, int)"><B>bufSizeYUV(int, int, int, int)</B></A> -
Static method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
<DD>Returns the size of the buffer (in bytes) required to hold a YUV planar
image with the given width, height, and level of chrominance subsampling.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int)"><B>bufSizeYUV(int, int, int)</B></A> -
Static method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
<DD><B>Deprecated.</B>&nbsp;<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>
</DL>
<HR>
<A NAME="_C_"><!-- --></A><H2>
@@ -154,14 +157,21 @@ Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg
<DD>Decompress the JPEG source image associated with this decompressor
instance and return a <code>BufferedImage</code> instance containing the
decompressed image.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int)"><B>decompressToYUV(byte[], int)</B></A> -
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int, int, int, int)"><B>decompressToYUV(byte[], int, int, int, int)</B></A> -
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
<DD>Decompress the JPEG source image associated with this decompressor
instance and output a YUV planar image to the given destination buffer.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int)"><B>decompressToYUV(int)</B></A> -
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int)"><B>decompressToYUV(byte[], int)</B></A> -
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
<DD><B>Deprecated.</B>&nbsp;<I>Use <A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int, int, int, int)"><CODE>TJDecompressor.decompressToYUV(byte[], int, int, int, int)</CODE></A>
instead.</I>
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int, int, int, int)"><B>decompressToYUV(int, int, int, int)</B></A> -
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
<DD>Decompress the JPEG source image associated with this decompressor
instance and return a buffer containing a YUV planar image.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int)"><B>decompressToYUV(int)</B></A> -
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
<DD><B>Deprecated.</B>&nbsp;<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>
</DL>
<HR>
<A NAME="_E_"><!-- --></A><H2>
@@ -490,6 +500,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>
<DD>Set the level of chrominance subsampling for subsequent compress/encode
operations.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#setYUVPad(int)"><B>setYUVPad(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 plane padding for subsequent YUV encode operations.
</DL>
<HR>
<A NAME="_T_"><!-- --></A><H2>

View File

@@ -2,7 +2,7 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Fri Apr 26 20:05:34 CDT 2013-->
<!-- Generated by javadoc on Sat Apr 27 20:13:12 CDT 2013-->
<TITLE>
Generated Documentation (Untitled)
</TITLE>

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_43) on Fri Apr 26 20:05:33 CDT 2013 -->
<!-- Generated by javadoc (build 1.6.0_43) on Sat Apr 27 20:13:11 CDT 2013 -->
<TITLE>
TJ
</TITLE>
<META NAME="date" CONTENT="2013-04-26">
<META NAME="date" CONTENT="2013-04-27">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
@@ -374,6 +374,17 @@ TurboJPEG utility class (cannot be instantiated)
int&nbsp;height,
int&nbsp;subsamp)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>Use <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int, int)"><CODE>bufSizeYUV(int, int, int, int)</CODE></A> instead.</I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int, int)">bufSizeYUV</A></B>(int&nbsp;width,
int&nbsp;pad,
int&nbsp;height,
int&nbsp;subsamp)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the size of the buffer (in bytes) required to hold a YUV planar
image with the given width, height, and level of chrominance subsampling.</TD>
@@ -992,10 +1003,11 @@ public static int <B>bufSize</B>(int&nbsp;width,
</DL>
<HR>
<A NAME="bufSizeYUV(int, int, int)"><!-- --></A><H3>
<A NAME="bufSizeYUV(int, int, int, int)"><!-- --></A><H3>
bufSizeYUV</H3>
<PRE>
public static int <B>bufSizeYUV</B>(int&nbsp;width,
int&nbsp;pad,
int&nbsp;height,
int&nbsp;subsamp)
throws java.lang.Exception</PRE>
@@ -1004,7 +1016,9 @@ public static int <B>bufSizeYUV</B>(int&nbsp;width,
image with the given width, height, and level of chrominance subsampling.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>width</CODE> - the width (in pixels) of the YUV image<DD><CODE>height</CODE> - the height (in pixels) of the YUV image<DD><CODE>subsamp</CODE> - the level of chrominance subsampling used in the YUV
<DT><B>Parameters:</B><DD><CODE>width</CODE> - the width (in pixels) of the YUV image<DD><CODE>pad</CODE> - the width of each line in each plane of the image is padded to
the nearest multiple of this number of bytes (must be a power of
2.)<DD><CODE>height</CODE> - the height (in pixels) of the YUV image<DD><CODE>subsamp</CODE> - the level of chrominance subsampling used in the YUV
image (one of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.SAMP_*</CODE></A>)
<DT><B>Returns:</B><DD>the size of the buffer (in bytes) required to hold a YUV planar
image with the given width, height, and level of chrominance subsampling
@@ -1014,6 +1028,25 @@ public static int <B>bufSizeYUV</B>(int&nbsp;width,
</DL>
<HR>
<A NAME="bufSizeYUV(int, int, int)"><!-- --></A><H3>
bufSizeYUV</H3>
<PRE>
<FONT SIZE="-1">@Deprecated
</FONT>public static int <B>bufSizeYUV</B>(int&nbsp;width,
int&nbsp;height,
int&nbsp;subsamp)
throws java.lang.Exception</PRE>
<DL>
<DD><B>Deprecated.</B>&nbsp;<I>Use <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int, int)"><CODE>bufSizeYUV(int, int, int, int)</CODE></A> instead.</I>
<P>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="getScalingFactors()"><!-- --></A><H3>
getScalingFactors</H3>
<PRE>

View File

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

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_43) on Fri Apr 26 20:05:34 CDT 2013 -->
<!-- Generated by javadoc (build 1.6.0_43) on Sat Apr 27 20:13:12 CDT 2013 -->
<TITLE>
TJCustomFilter
</TITLE>
<META NAME="date" CONTENT="2013-04-26">
<META NAME="date" CONTENT="2013-04-27">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_43) on Fri Apr 26 20:05:34 CDT 2013 -->
<!-- Generated by javadoc (build 1.6.0_43) on Sat Apr 27 20:13:12 CDT 2013 -->
<TITLE>
TJDecompressor
</TITLE>
<META NAME="date" CONTENT="2013-04-26">
<META NAME="date" CONTENT="2013-04-27">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
@@ -304,6 +304,19 @@ TurboJPEG decompressor
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int)">decompressToYUV</A></B>(byte[]&nbsp;dstBuf,
int&nbsp;flags)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>Use <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int, int, int, int)"><CODE>decompressToYUV(byte[], int, int, int, int)</CODE></A>
instead.</I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int, int, int, int)">decompressToYUV</A></B>(byte[]&nbsp;dstBuf,
int&nbsp;desiredWidth,
int&nbsp;pad,
int&nbsp;desiredHeight,
int&nbsp;flags)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Decompress the JPEG source image associated with this decompressor
instance and output a YUV planar image to the given destination buffer.</TD>
@@ -313,6 +326,17 @@ TurboJPEG decompressor
<CODE>&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int)">decompressToYUV</A></B>(int&nbsp;flags)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>Use <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int, int, int, int)"><CODE>decompressToYUV(int, int, int, int)</CODE></A> instead.</I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int, int, int, int)">decompressToYUV</A></B>(int&nbsp;desiredWidth,
int&nbsp;pad,
int&nbsp;desiredHeight,
int&nbsp;flags)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Decompress the JPEG source image associated with this decompressor
instance and return a buffer containing a YUV planar image.</TD>
@@ -779,12 +803,13 @@ public void <B>decompress</B>(byte[]&nbsp;dstBuf,
<A NAME="decompress(byte[], int, int, int, int, int)"><!-- --></A><H3>
decompress</H3>
<PRE>
public void <B>decompress</B>(byte[]&nbsp;dstBuf,
int&nbsp;desiredWidth,
int&nbsp;pitch,
int&nbsp;desiredHeight,
int&nbsp;pixelFormat,
int&nbsp;flags)
<FONT SIZE="-1">@Deprecated
</FONT>public void <B>decompress</B>(byte[]&nbsp;dstBuf,
int&nbsp;desiredWidth,
int&nbsp;pitch,
int&nbsp;desiredHeight,
int&nbsp;pixelFormat,
int&nbsp;flags)
throws java.lang.Exception</PRE>
<DL>
<DD><B>Deprecated.</B>&nbsp;<I>Use
@@ -827,10 +852,13 @@ public byte[] <B>decompress</B>(int&nbsp;desiredWidth,
</DL>
<HR>
<A NAME="decompressToYUV(byte[], int)"><!-- --></A><H3>
<A NAME="decompressToYUV(byte[], int, int, int, int)"><!-- --></A><H3>
decompressToYUV</H3>
<PRE>
public void <B>decompressToYUV</B>(byte[]&nbsp;dstBuf,
int&nbsp;desiredWidth,
int&nbsp;pad,
int&nbsp;desiredHeight,
int&nbsp;flags)
throws java.lang.Exception</PRE>
<DL>
@@ -846,8 +874,64 @@ public void <B>decompressToYUV</B>(byte[]&nbsp;dstBuf,
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>dstBuf</CODE> - buffer that will receive the YUV planar image. Use
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int)"><CODE>TJ.bufSizeYUV(int, int, int)</CODE></A> to determine the appropriate size for this buffer
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>
<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>desiredWidth</CODE> - desired width (in pixels) of the YUV image. If the
desired image dimensions are different than the dimensions of the JPEG
image being decompressed, then TurboJPEG will use scaling in the JPEG
decompressor to generate the largest possible image that will fit within
the desired dimensions. Setting this to 0 is the same as setting it to
the width of the JPEG image (in other words, the width will not be
considered when determining the scaled image size.)<DD><CODE>pad</CODE> - the width of each line in each plane of the YUV image will be
padded to the nearest multiple of this number of bytes (must be a power of
2.)<DD><CODE>desiredHeight</CODE> - desired height (in pixels) of the YUV image. If the
desired image dimensions are different than the dimensions of the JPEG
image being decompressed, then TurboJPEG will use scaling in the JPEG
decompressor to generate the largest possible image that will fit within
the desired dimensions. Setting this to 0 is the same as setting it to
the height of the JPEG image (in other words, the height will not be
considered when determining the scaled image size.)<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="decompressToYUV(byte[], int)"><!-- --></A><H3>
decompressToYUV</H3>
<PRE>
<FONT SIZE="-1">@Deprecated
</FONT>public void <B>decompressToYUV</B>(byte[]&nbsp;dstBuf,
int&nbsp;flags)
throws java.lang.Exception</PRE>
<DL>
<DD><B>Deprecated.</B>&nbsp;<I>Use <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int, int, int, int)"><CODE>decompressToYUV(byte[], int, int, int, int)</CODE></A>
instead.</I>
<P>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="decompressToYUV(int, int, int, int)"><!-- --></A><H3>
decompressToYUV</H3>
<PRE>
public byte[] <B>decompressToYUV</B>(int&nbsp;desiredWidth,
int&nbsp;pad,
int&nbsp;desiredHeight,
int&nbsp;flags)
throws java.lang.Exception</PRE>
<DL>
<DD>Decompress the JPEG source image associated with this decompressor
instance and return a buffer containing a YUV planar image. See <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int, int, int, int)"><CODE>decompressToYUV(byte[], int, int, int, int)</CODE></A> for more detail.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>desiredWidth</CODE> - see
<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int, int, int, int)"><CODE>decompressToYUV(byte[], int, int, int, int)</CODE></A> for description<DD><CODE>pad</CODE> - see <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int, int, int, int)"><CODE>decompressToYUV(byte[], int, int, int, int)</CODE></A> for
description<DD><CODE>desiredHeight</CODE> - see <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int, int, int, int)"><CODE>decompressToYUV(byte[], int, int, int, int)</CODE></A> for description<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>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
@@ -857,15 +941,14 @@ public void <B>decompressToYUV</B>(byte[]&nbsp;dstBuf,
<A NAME="decompressToYUV(int)"><!-- --></A><H3>
decompressToYUV</H3>
<PRE>
public byte[] <B>decompressToYUV</B>(int&nbsp;flags)
<FONT SIZE="-1">@Deprecated
</FONT>public byte[] <B>decompressToYUV</B>(int&nbsp;flags)
throws java.lang.Exception</PRE>
<DL>
<DD>Decompress the JPEG source image associated with this decompressor
instance and return a buffer containing a YUV planar image. See <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int)"><CODE>decompressToYUV(byte[], int)</CODE></A> for more detail.
<DD><B>Deprecated.</B>&nbsp;<I>Use <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int, int, int, int)"><CODE>decompressToYUV(int, int, int, int)</CODE></A> instead.</I>
<P>
<DD><DL>
<DT><B>Parameters:</B><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>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_43) on Fri Apr 26 20:05:34 CDT 2013 -->
<!-- Generated by javadoc (build 1.6.0_43) on Sat Apr 27 20:13:12 CDT 2013 -->
<TITLE>
TJScalingFactor
</TITLE>
<META NAME="date" CONTENT="2013-04-26">
<META NAME="date" CONTENT="2013-04-27">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_43) on Fri Apr 26 20:05:34 CDT 2013 -->
<!-- Generated by javadoc (build 1.6.0_43) on Sat Apr 27 20:13:12 CDT 2013 -->
<TITLE>
TJTransform
</TITLE>
<META NAME="date" CONTENT="2013-04-26">
<META NAME="date" CONTENT="2013-04-27">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_43) on Fri Apr 26 20:05:34 CDT 2013 -->
<!-- Generated by javadoc (build 1.6.0_43) on Sat Apr 27 20:13:12 CDT 2013 -->
<TITLE>
TJTransformer
</TITLE>
<META NAME="date" CONTENT="2013-04-26">
<META NAME="date" CONTENT="2013-04-27">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
@@ -205,7 +205,7 @@ TurboJPEG lossless transformer
<TH ALIGN="left"><B>Methods inherited from class org.libjpegturbo.turbojpeg.<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#close()">close</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(java.awt.image.BufferedImage, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int, int, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int[], int, int, int, int, int, int, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int, int, int, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int, int, int, int, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int)">decompressToYUV</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int)">decompressToYUV</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#finalize()">finalize</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getHeight()">getHeight</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGBuf()">getJPEGBuf</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGSize()">getJPEGSize</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int, int)">getScaledHeight</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int, int)">getScaledWidth</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSubsamp()">getSubsamp</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getWidth()">getWidth</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGImage(byte[], int)">setJPEGImage</A></CODE></TD>
<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>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_43) on Fri Apr 26 20:05:34 CDT 2013 -->
<!-- Generated by javadoc (build 1.6.0_43) on Sat Apr 27 20:13:12 CDT 2013 -->
<TITLE>
org.libjpegturbo.turbojpeg
</TITLE>
<META NAME="date" CONTENT="2013-04-26">
<META NAME="date" CONTENT="2013-04-27">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_43) on Fri Apr 26 20:05:34 CDT 2013 -->
<!-- Generated by javadoc (build 1.6.0_43) on Sat Apr 27 20:13:12 CDT 2013 -->
<TITLE>
org.libjpegturbo.turbojpeg
</TITLE>
<META NAME="date" CONTENT="2013-04-26">
<META NAME="date" CONTENT="2013-04-27">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_43) on Fri Apr 26 20:05:34 CDT 2013 -->
<!-- Generated by javadoc (build 1.6.0_43) on Sat Apr 27 20:13:12 CDT 2013 -->
<TITLE>
org.libjpegturbo.turbojpeg Class Hierarchy
</TITLE>
<META NAME="date" CONTENT="2013-04-26">
<META NAME="date" CONTENT="2013-04-27">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_43) on Fri Apr 26 20:05:34 CDT 2013 -->
<!-- Generated by javadoc (build 1.6.0_43) on Sat Apr 27 20:13:12 CDT 2013 -->
<TITLE>
Class Hierarchy
</TITLE>
<META NAME="date" CONTENT="2013-04-26">
<META NAME="date" CONTENT="2013-04-27">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

View File

@@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_43) on Fri Apr 26 20:05:34 CDT 2013 -->
<!-- Generated by javadoc (build 1.6.0_43) on Sat Apr 27 20:13:12 CDT 2013 -->
<TITLE>
Serialized Form
</TITLE>
<META NAME="date" CONTENT="2013-04-26">
<META NAME="date" CONTENT="2013-04-27">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

View File

@@ -342,6 +342,10 @@ public final class TJ {
*
* @param width the width (in pixels) of the YUV image
*
* @param pad the width of each line in each plane of the image is padded to
* the nearest multiple of this number of bytes (must be a power of
* 2.)
*
* @param height the height (in pixels) of the YUV image
*
* @param subsamp the level of chrominance subsampling used in the YUV
@@ -350,6 +354,14 @@ public final class TJ {
* @return the size of the buffer (in bytes) required to hold a YUV planar
* image with the given width, height, and level of chrominance subsampling
*/
public static native int bufSizeYUV(int width, int pad, int height,
int subsamp)
throws Exception;
/**
* @deprecated Use {@link #bufSizeYUV(int, int, int, int)} instead.
*/
@Deprecated
public static native int bufSizeYUV(int width, int height, int subsamp)
throws Exception;

View File

@@ -145,6 +145,7 @@ public class TJCompressor {
* @deprecated Use
* {@link #setSourceImage(byte[], int, int, int, int, int, int)} instead.
*/
@Deprecated
public void setSourceImage(byte[] srcImage, int width, int pitch,
int height, int pixelFormat) throws Exception {
setSourceImage(srcImage, 0, 0, width, pitch, height, pixelFormat);
@@ -330,20 +331,34 @@ public class TJCompressor {
return buf;
}
/**
* Set the plane padding for subsequent YUV encode operations.
*
* @param pad the width of each line in each plane of the YUV image will be
* padded to the nearest multiple of this number of bytes (must be a
* power of 2.) The default padding is 4 bytes, which generates
* images suitable for direct video display.
*/
public void setYUVPad(int pad) throws Exception {
if(pad < 1 || ((pad & (pad - 1)) != 0))
throw new Exception("Invalid argument in setYUVPad()");
yuvPad = pad;
}
/**
* Encode the uncompressed source image associated with this compressor
* instance and output a YUV planar image to the given destination buffer.
* This method uses the accelerated color conversion routines in
* TurboJPEG's underlying codec to produce a planar YUV image that is
* suitable for direct video display. Specifically, if the chrominance
* components are subsampled along the horizontal dimension, then the width
* of the luminance plane is padded to the nearest multiple of 2 in the
* output image (same goes for the height of the luminance plane, if the
* chrominance components are subsampled along the vertical dimension.)
* Also, each line of each plane in the output image is padded to 4 bytes.
* Although this will work with any subsampling option, it is really only
* useful in combination with {@link TJ#SAMP_420}, which produces an image
* compatible with the I420 (AKA "YUV420P") format.
* This method uses the accelerated color conversion routines in TurboJPEG's
* underlying codec but does not execute any of the other steps in the JPEG
* compression process. The Y, U, and V image planes are stored sequentially
* into the destination buffer, and the size of each plane is determined by
* the width and height of the source image, as well as the specified padding
* and level of chrominance subsampling. If the chrominance components are
* subsampled along the horizontal dimension, then the width of the luminance
* plane is padded to the nearest multiple of 2 in the output image (same
* goes for the height of the luminance plane, if the chrominance components
* are subsampled along the vertical dimension.)
*
* @param dstBuf buffer that will receive the YUV planar image. Use
* {@link TJ#bufSizeYUV} to determine the appropriate size for this buffer
@@ -358,9 +373,9 @@ public class TJCompressor {
throw new Exception(NO_ASSOC_ERROR);
if (subsamp < 0)
throw new Exception("Subsampling level not set");
encodeYUV(srcBuf, srcWidth, srcPitch, srcHeight,
srcPixelFormat, dstBuf, subsamp, flags);
compressedSize = TJ.bufSizeYUV(srcWidth, srcHeight, subsamp);
encodeYUV(srcBuf, srcWidth, srcPitch, srcHeight, srcPixelFormat, dstBuf,
yuvPad, subsamp, flags);
compressedSize = TJ.bufSizeYUV(srcWidth, yuvPad, srcHeight, subsamp);
}
/**
@@ -377,7 +392,7 @@ public class TJCompressor {
throw new Exception(NO_ASSOC_ERROR);
if (subsamp < 0)
throw new Exception("Subsampling level not set");
byte[] buf = new byte[TJ.bufSizeYUV(srcWidth, srcHeight, subsamp)];
byte[] buf = new byte[TJ.bufSizeYUV(srcWidth, yuvPad, srcHeight, subsamp)];
encodeYUV(buf, flags);
return buf;
}
@@ -438,8 +453,8 @@ public class TJCompressor {
int stride = sm.getScanlineStride();
DataBufferInt db = (DataBufferInt)wr.getDataBuffer();
int[] buf = db.getData();
encodeYUV(buf, width, stride, height, pixelFormat, dstBuf, subsamp,
flags);
encodeYUV(buf, width, stride, height, pixelFormat, dstBuf, yuvPad,
subsamp, flags);
} else {
ComponentSampleModel sm =
(ComponentSampleModel)srcImage.getSampleModel();
@@ -449,10 +464,10 @@ public class TJCompressor {
int pitch = sm.getScanlineStride();
DataBufferByte db = (DataBufferByte)wr.getDataBuffer();
byte[] buf = db.getData();
encodeYUV(buf, width, pitch, height, pixelFormat, dstBuf, subsamp,
flags);
encodeYUV(buf, width, pitch, height, pixelFormat, dstBuf, yuvPad,
subsamp, flags);
}
compressedSize = TJ.bufSizeYUV(width, height, subsamp);
compressedSize = TJ.bufSizeYUV(width, yuvPad, height, subsamp);
}
/**
@@ -472,7 +487,7 @@ public class TJCompressor {
throw new Exception("Subsampling level not set");
int width = srcImage.getWidth();
int height = srcImage.getHeight();
byte[] buf = new byte[TJ.bufSizeYUV(width, height, subsamp)];
byte[] buf = new byte[TJ.bufSizeYUV(width, yuvPad, height, subsamp)];
encodeYUV(srcImage, buf, flags);
return buf;
}
@@ -527,11 +542,19 @@ public class TJCompressor {
private native void encodeYUV(byte[] srcBuf, int width, int pitch,
int height, int pixelFormat, byte[] dstBuf, int subsamp, int flags)
throws Exception;
throws Exception; // deprecated
private native void encodeYUV(byte[] srcBuf, int width, int pitch,
int height, int pixelFormat, byte[] dstBuf, int pad, int subsamp,
int flags) throws Exception;
private native void encodeYUV(int[] srcBuf, int width, int stride,
int height, int pixelFormat, byte[] dstBuf, int subsamp, int flags)
throws Exception;
throws Exception; // deprecated
private native void encodeYUV(int[] srcBuf, int width, int pitch,
int height, int pixelFormat, byte[] dstBuf, int pad, int subsamp,
int flags) throws Exception;
static {
TJLoader.load();
@@ -548,5 +571,6 @@ public class TJCompressor {
private int subsamp = -1;
private int jpegQuality = -1;
private int compressedSize = 0;
private int yuvPad = 4;
private ByteOrder byteOrder = null;
};

View File

@@ -313,6 +313,7 @@ public class TJDecompressor {
* @deprecated Use
* {@link #decompress(byte[], int, int, int, int, int, int, int)} instead.
*/
@Deprecated
public void decompress(byte[] dstBuf, int desiredWidth, int pitch,
int desiredHeight, int pixelFormat, int flags)
throws Exception {
@@ -373,38 +374,90 @@ public class TJDecompressor {
* {@link TJ#bufSizeYUV} to determine the appropriate size for this buffer
* based on the image width, height, and level of chrominance subsampling.
*
* @param desiredWidth desired width (in pixels) of the YUV image. If the
* desired image dimensions are different than the dimensions of the JPEG
* image being decompressed, then TurboJPEG will use scaling in the JPEG
* decompressor to generate the largest possible image that will fit within
* the desired dimensions. Setting this to 0 is the same as setting it to
* the width of the JPEG image (in other words, the width will not be
* considered when determining the scaled image size.)
*
* @param pad the width of each line in each plane of the YUV image will be
* padded to the nearest multiple of this number of bytes (must be a power of
* 2.)
*
* @param desiredHeight desired height (in pixels) of the YUV image. If the
* desired image dimensions are different than the dimensions of the JPEG
* image being decompressed, then TurboJPEG will use scaling in the JPEG
* decompressor to generate the largest possible image that will fit within
* the desired dimensions. Setting this to 0 is the same as setting it to
* the height of the JPEG image (in other words, the height will not be
* considered when determining the scaled image size.)
*
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
*/
public void decompressToYUV(byte[] dstBuf, int flags) throws Exception {
public void decompressToYUV(byte[] dstBuf, int desiredWidth, int pad,
int desiredHeight, int flags) throws Exception {
if (jpegBuf == null)
throw new Exception(NO_ASSOC_ERROR);
if (dstBuf == null || flags < 0)
if (dstBuf == null || desiredWidth < 0 || pad < 1 ||
((pad & (pad - 1)) != 0) || desiredHeight < 0 || flags < 0)
throw new Exception("Invalid argument in decompressToYUV()");
decompressToYUV(jpegBuf, jpegBufSize, dstBuf, flags);
decompressToYUV(jpegBuf, jpegBufSize, dstBuf, desiredWidth, pad,
desiredHeight, flags);
}
/**
* @deprecated Use {@link #decompressToYUV(byte[], int, int, int, int)}
* instead.
*/
@Deprecated
public void decompressToYUV(byte[] dstBuf, int flags) throws Exception {
decompressToYUV(dstBuf, 0, 4, 0, flags);
}
/**
* Decompress the JPEG source image associated with this decompressor
* instance and return a buffer containing a YUV planar image. See {@link
* #decompressToYUV(byte[], int)} for more detail.
* #decompressToYUV(byte[], int, int, int, int)} for more detail.
*
* @param desiredWidth see
* {@link #decompressToYUV(byte[], int, int, int, int)} for description
*
* @param pad see {@link #decompressToYUV(byte[], int, int, int, int)} for
* description
*
* @param desiredHeight see {@link
* #decompressToYUV(byte[], int, int, int, int)} for description
*
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
*
* @return a buffer containing a YUV planar image
*/
public byte[] decompressToYUV(int flags) throws Exception {
public byte[] decompressToYUV(int desiredWidth, int pad, int desiredHeight,
int flags) throws Exception {
if (flags < 0)
throw new Exception("Invalid argument in decompressToYUV()");
if (jpegWidth < 1 || jpegHeight < 1 || jpegSubsamp < 0)
throw new Exception(NO_ASSOC_ERROR);
if (jpegSubsamp >= TJ.NUMSAMP)
throw new Exception("JPEG header information is invalid");
byte[] buf = new byte[TJ.bufSizeYUV(jpegWidth, jpegHeight, jpegSubsamp)];
decompressToYUV(buf, flags);
int scaledWidth = getScaledWidth(desiredWidth, desiredHeight);
int scaledHeight = getScaledHeight(desiredWidth, desiredHeight);
byte[] buf = new byte[TJ.bufSizeYUV(scaledWidth, pad, scaledHeight,
jpegSubsamp)];
decompressToYUV(buf, desiredWidth, pad, desiredHeight, flags);
return buf;
}
/**
* @deprecated Use {@link #decompressToYUV(int, int, int, int)} instead.
*/
@Deprecated
public byte[] decompressToYUV(int flags) throws Exception {
return decompressToYUV(0, 4, 0, flags);
}
/**
* Decompress the JPEG source image associated with this decompressor
* instance and output a decompressed image to the given destination buffer.
@@ -619,7 +672,10 @@ public class TJDecompressor {
int flags) throws Exception;
private native void decompressToYUV(byte[] srcBuf, int size, byte[] dstBuf,
int flags) throws Exception;
int flags) throws Exception; // deprecated
private native void decompressToYUV(byte[] srcBuf, int size, byte[] dstBuf,
int desiredWidth, int pad, int desiredheight, int flags) throws Exception;
static {
TJLoader.load();

View File

@@ -67,12 +67,20 @@ extern "C" {
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSize
(JNIEnv *, jclass, jint, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJ
* Method: bufSizeYUV
* Signature: (IIII)I
*/
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV__IIII
(JNIEnv *, jclass, jint, jint, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJ
* Method: bufSizeYUV
* Signature: (III)I
*/
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV__III
(JNIEnv *, jclass, jint, jint, jint);
/*

View File

@@ -63,6 +63,14 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIII_3BII
(JNIEnv *, jobject, jbyteArray, jint, jint, jint, jint, jbyteArray, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJCompressor
* Method: encodeYUV
* Signature: ([BIIII[BIII)V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIII_3BIII
(JNIEnv *, jobject, jbyteArray, jint, jint, jint, jint, jbyteArray, jint, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJCompressor
* Method: encodeYUV
@@ -71,6 +79,14 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIII_3BII
(JNIEnv *, jobject, jintArray, jint, jint, jint, jint, jbyteArray, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJCompressor
* Method: encodeYUV
* Signature: ([IIIII[BIII)V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIII_3BIII
(JNIEnv *, jobject, jintArray, jint, jint, jint, jint, jbyteArray, jint, jint, jint);
#ifdef __cplusplus
}
#endif

View File

@@ -68,9 +68,17 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress
* Method: decompressToYUV
* Signature: ([BI[BI)V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3BI
(JNIEnv *, jobject, jbyteArray, jint, jbyteArray, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJDecompressor
* Method: decompressToYUV
* Signature: ([BI[BIIII)V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3BIIII
(JNIEnv *, jobject, jbyteArray, jint, jbyteArray, jint, jint, jint, jint);
#ifdef __cplusplus
}
#endif

View File

@@ -48,7 +48,7 @@ void usage(char *progName)
printf("Options:\n");
printf("-yuv = test YUV encoding/decoding support\n");
printf("-noyuvpad = do not pad each line of each Y, U, and V plane to the nearest\n");
printf(" 4-byte boundary.\n");
printf(" 4-byte boundary\n");
printf("-alloc = test automatic buffer allocation\n");
exit(1);
}

View File

@@ -67,16 +67,23 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSize
return retval;
}
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV
(JNIEnv *env, jclass cls, jint width, jint height, jint subsamp)
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV__IIII
(JNIEnv *env, jclass cls, jint width, jint pad, jint height, jint subsamp)
{
jint retval=(jint)tjBufSizeYUV(width, height, subsamp);
jint retval=(jint)tjBufSizeYUV2(width, pad, height, subsamp);
if(retval==-1) _throw(tjGetErrorStr());
bailout:
return retval;
}
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV__III
(JNIEnv *env, jclass cls, jint width, jint height, jint subsamp)
{
return Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV__IIII(env, cls, width,
4, height, subsamp);
}
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_init
(JNIEnv *env, jobject obj)
{
@@ -207,12 +214,12 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3
flags);
}
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIII_3BII
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIII_3BIII
(JNIEnv *env, jobject obj, jbyteArray src, jint width, jint pitch,
jint height, jint pf, jbyteArray dst, jint subsamp, jint flags)
jint height, jint pf, jbyteArray dst, jint pad, jint subsamp, jint flags)
{
tjhandle handle=0;
jsize arraySize=0;
jsize arraySize=0, yuvSize;
unsigned char *srcBuf=NULL, *dstBuf=NULL;
gethandle();
@@ -226,15 +233,17 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___
arraySize=(pitch==0)? width*tjPixelSize[pf]*height:pitch*height;
if((*env)->GetArrayLength(env, src)<arraySize)
_throw("Source buffer is not large enough");
if((*env)->GetArrayLength(env, dst)
<(jsize)tjBufSizeYUV(width, height, subsamp))
yuvSize=(jsize)tjBufSizeYUV2(width, pad, height, subsamp);
if(yuvSize==(unsigned long)-1)
_throw(tjGetErrorStr());
if((*env)->GetArrayLength(env, dst)<yuvSize)
_throw("Destination buffer is not large enough");
bailif0(srcBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));
bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));
if(tjEncodeYUV2(handle, srcBuf, width, pitch, height, pf, dstBuf, subsamp,
flags)==-1)
if(tjEncodeYUV3(handle, srcBuf, width, pitch, height, pf, dstBuf, pad,
subsamp, flags)==-1)
{
(*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
(*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0);
@@ -248,12 +257,20 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___
return;
}
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIII_3BII
(JNIEnv *env, jobject obj, jintArray src, jint width, jint stride,
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIII_3BII
(JNIEnv *env, jobject obj, jbyteArray src, jint width, jint pitch,
jint height, jint pf, jbyteArray dst, jint subsamp, jint flags)
{
Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIII_3BIII(
env, obj, src, width, pitch, height, pf, dst, 4, subsamp, flags);
}
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIII_3BIII
(JNIEnv *env, jobject obj, jintArray src, jint width, jint stride,
jint height, jint pf, jbyteArray dst, jint pad, jint subsamp, jint flags)
{
tjhandle handle=0;
jsize arraySize=0;
jsize arraySize=0, yuvSize;
unsigned char *srcBuf=NULL, *dstBuf=NULL;
gethandle();
@@ -269,15 +286,17 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___
arraySize=(stride==0)? width*height:stride*height;
if((*env)->GetArrayLength(env, src)<arraySize)
_throw("Source buffer is not large enough");
if((*env)->GetArrayLength(env, dst)
<(jsize)tjBufSizeYUV(width, height, subsamp))
yuvSize=(jsize)tjBufSizeYUV2(width, pad, height, subsamp);
if(yuvSize==(unsigned long)-1)
_throw(tjGetErrorStr());
if((*env)->GetArrayLength(env, dst)<yuvSize)
_throw("Destination buffer is not large enough");
bailif0(srcBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));
bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));
if(tjEncodeYUV2(handle, srcBuf, width, stride*sizeof(jint), height, pf,
dstBuf, subsamp, flags)==-1)
if(tjEncodeYUV3(handle, srcBuf, width, stride*sizeof(jint), height, pf,
dstBuf, pad, subsamp, flags)==-1)
{
(*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
(*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0);
@@ -291,6 +310,14 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___
return;
}
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIII_3BII
(JNIEnv *env, jobject obj, jintArray src, jint width, jint pitch,
jint height, jint pf, jbyteArray dst, jint subsamp, jint flags)
{
Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIII_3BIII(
env, obj, src, width, pitch, height, pf, dst, 4, subsamp, flags);
}
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_destroy
(JNIEnv *env, jobject obj)
{
@@ -484,13 +511,14 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress
}
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3BIIII
(JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jbyteArray dst,
jint flags)
jint desiredWidth, jint pad, jint desiredHeight, jint flags)
{
tjhandle handle=0;
unsigned char *jpegBuf=NULL, *dstBuf=NULL;
int jpegSubsamp=-1, jpegWidth=0, jpegHeight=0;
jsize yuvSize;
gethandle();
@@ -502,15 +530,18 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress
jpegWidth=(int)(*env)->GetIntField(env, obj, _fid);
bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegHeight", "I"));
jpegHeight=(int)(*env)->GetIntField(env, obj, _fid);
if((*env)->GetArrayLength(env, dst)
<(jsize)tjBufSizeYUV(jpegWidth, jpegHeight, jpegSubsamp))
_throw("Destination buffer is not large enough");
yuvSize=(jsize)tjBufSizeYUV2(desiredWidth==0? jpegWidth:desiredWidth,
pad, desiredHeight==0? jpegHeight:desiredHeight, jpegSubsamp);
if(yuvSize==(unsigned long)-1)
_throw(tjGetErrorStr());
if((*env)->GetArrayLength(env, dst)<yuvSize)
_throw("Destination buffer is not large enough");
bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));
bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));
if(tjDecompressToYUV(handle, jpegBuf, (unsigned long)jpegSize, dstBuf,
flags)==-1)
if(tjDecompressToYUV2(handle, jpegBuf, (unsigned long)jpegSize, dstBuf,
desiredWidth, pad, desiredHeight, flags)==-1)
{
(*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
(*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0);
@@ -524,6 +555,14 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress
return;
}
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3BI
(JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jbyteArray dst,
jint flags)
{
Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3BIIII(
env, obj, src, jpegSize, dst, 0, 4, 0, flags);
}
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJTransformer_init
(JNIEnv *env, jobject obj)
{

View File

@@ -36,7 +36,7 @@ TURBOJPEG_1.2
tjInitTransform;
tjTransform;
Java_org_libjpegturbo_turbojpeg_TJ_bufSize;
Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV;
Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV__III;
Java_org_libjpegturbo_turbojpeg_TJ_getScalingFactors;
Java_org_libjpegturbo_turbojpeg_TJCompressor_init;
Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3BIIII_3BIII;
@@ -48,7 +48,7 @@ TURBOJPEG_1.2
Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressHeader;
Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3BIIIII;
Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3IIIIII;
Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV;
Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3BI;
Java_org_libjpegturbo_turbojpeg_TJDecompressor_destroy;
Java_org_libjpegturbo_turbojpeg_TJTransformer_init;
Java_org_libjpegturbo_turbojpeg_TJTransformer_transform;
@@ -62,3 +62,15 @@ TURBOJPEG_1.3
Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3BIIIIIII;
Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3IIIIIIII;
} TURBOJPEG_1.2;
TURBOJPEG_1.4
{
global:
tjBufSizeYUV2;
tjDecompressToYUV2;
tjEncodeYUV3;
Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV__IIII;
Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIII_3BIII;
Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIII_3BIII;
Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3BIIII;
} TURBOJPEG_1.3;