Extend the YUV decode functionality to the TurboJPEG Java API, and port the TJUnitTest modifications that treat YUV encoding/decoding as an intermediate step of the JPEG compression/decompression pipeline rather than a separate test case; Add the ability to encode YUV images from an arbitrary position in a large image buffer; Significantly refactor the handling of YUV images; numerous doc tweaks; other Java API cleanup and usability improvements

This commit is contained in:
DRC
2014-03-16 22:56:26 +00:00
parent 960ea8fb66
commit 9e9df11625
24 changed files with 1795 additions and 1090 deletions

View File

@@ -1,30 +1,31 @@
1.4 pre-beta
============
[1] The TurboJPEG API can now be used to generate YUV images with an arbitrary
line padding (previously, it only supported 4-byte padding, which was
compatible with X Video.) Also, the decompress-to-YUV function has been
extended to support image scaling.
[1] New features in the TurboJPEG API:
-- YUV planar images can now be generated with an arbitrary line padding
(previously only 4-byte padding, which was compatible with X Video, was
supported.)
-- The decompress-to-YUV function has been extended to support image scaling.
-- JPEG images can now be compressed from YUV planar source images.
-- YUV planar images can now be decoded into RGB or grayscale images.
-- 4:1:1 subsampling is now supported. This is mainly included for
compatibility, since 4:1:1 is not fully accelerated in libjpeg-turbo and has no
significant advantages relative to 4:2:0.
-- CMYK images are now supported. This feature allows CMYK source images to be
compressed to YCCK JPEGs and YCCK or CMYK JPEGs to be decompressed to CMYK
destination images. Conversion between CMYK and RGB or YUV images is not
supported. Such conversion requires a color management system and is out of
scope for a codec library.
-- The handling of YUV images in the Java API has been significantly refactored
and should now be much more intuitive.
-- The Java API now supports encoding a YUV image from an arbitrary position in
a large image buffer.
[2] Added SIMD acceleration for DSPr2-capable MIPS platforms. This speeds up
the compression of full-color JPEGs by 70-80% on such platforms and
decompression by 25-35%.
[3] Added support for 4:1:1 subsampling to the TurboJPEG API. This is mainly
included for compatibility, since 4:1:1 is not fully accelerated in
libjpeg-turbo and has no significant advantages relative to 4:2:0.
[4] Added support for CMYK images to the TurboJPEG API. This feature allows
CMYK source images to be compressed to YCCK JPEGs and YCCK or CMYK JPEGs to be
decompressed to CMYK destination images. Conversion between CMYK and RGB
images is not supported. Such conversion requires a color management system
and is out of scope for a codec library.
[5] The TurboJPEG API can now be used to compress JPEG images from YUV planar
source images and to decode YUV planar images into RGB, grayscale, or extended
RGB images.
[6] If an application attempts to decompress a Huffman-coded JPEG image whose
[3] If an application attempts to decompress a Huffman-coded JPEG image whose
header does not contain Huffman tables, libjpeg-turbo will now insert the
default Huffman tables. In order to save space, many motion JPEG video frames
are encoded without the default Huffman tables, so these frames can now be

View File

@@ -13,6 +13,7 @@ JAVASOURCES = org/libjpegturbo/turbojpeg/TJ.java \
org/libjpegturbo/turbojpeg/TJScalingFactor.java \
org/libjpegturbo/turbojpeg/TJTransform.java \
org/libjpegturbo/turbojpeg/TJTransformer.java \
org/libjpegturbo/turbojpeg/YUVImage.java \
TJExample.java \
TJUnitTest.java \
TJBench.java
@@ -34,6 +35,7 @@ JAVA_CLASSES = org/libjpegturbo/turbojpeg/TJ.class \
org/libjpegturbo/turbojpeg/TJScalingFactor.class \
org/libjpegturbo/turbojpeg/TJTransform.class \
org/libjpegturbo/turbojpeg/TJTransformer.class \
org/libjpegturbo/turbojpeg/YUVImage.class \
TJExample.class \
TJUnitTest.class \
TJBench.class

View File

@@ -146,6 +146,7 @@ class TJBench {
int scaledh = sf.getScaled(h);
int yuvSize = TJ.bufSizeYUV(scaledw, yuvpad, scaledh, subsamp), bufsize;
int pitch = scaledw * ps;
YUVImage yuvImage = null;
if (jpegQual > 0)
qualStr = new String("_Q" + jpegQual);
@@ -161,9 +162,11 @@ class TJBench {
Arrays.fill(dstBuf, (byte)127);
/* Execute once to preload cache */
tjd.setJPEGImage(jpegBuf[0], jpegSize[0]);
if (yuv == YUVDECODE)
tjd.decompressToYUV(dstBuf, scaledw, yuvpad, scaledh, flags);
tjd.setSourceImage(jpegBuf[0], jpegSize[0]);
if (yuv == YUVDECODE) {
yuvImage = new YUVImage(dstBuf, scaledw, yuvpad, scaledh, subsamp);
tjd.decompressToYUV(yuvImage, flags);
}
else
tjd.decompress(dstBuf, 0, 0, scaledw, pitch, scaledh, pf, flags);
@@ -172,13 +175,13 @@ class TJBench {
i++) {
int tile = 0;
if (yuv == YUVDECODE)
tjd.decompressToYUV(dstBuf, scaledw, yuvpad, scaledh, flags);
tjd.decompressToYUV(yuvImage, flags);
else {
for (int y = 0; y < h; y += tileh) {
for (int x = 0; x < w; x += tilew, tile++) {
int width = doTile ? Math.min(tilew, w - x) : scaledw;
int height = doTile ? Math.min(tileh, h - y) : scaledh;
tjd.setJPEGImage(jpegBuf[tile], jpegSize[tile]);
tjd.setSourceImage(jpegBuf[tile], jpegSize[tile]);
tjd.decompress(dstBuf, x, y, width, pitch, height, pf, flags);
}
}
@@ -258,6 +261,7 @@ class TJBench {
double start, elapsed;
int ps = TJ.getPixelSize(pf), i;
int yuvSize = 0;
YUVImage yuvImage;
yuvSize = TJ.bufSizeYUV(w, yuvpad, h, subsamp);
dstBuf = new byte[yuvSize];
@@ -277,12 +281,13 @@ class TJBench {
tjc.setSubsamp(subsamp);
/* Execute once to preload cache */
tjc.encodeYUV(dstBuf, flags);
yuvImage = new YUVImage(dstBuf, w, yuvpad, h, subsamp);
tjc.encodeYUV(yuvImage, flags);
/* Benchmark */
for (i = 0, start = getTime();
(elapsed = getTime() - start) < benchTime; i++)
tjc.encodeYUV(dstBuf, flags);
tjc.encodeYUV(yuvImage, flags);
if (quiet == 1)
System.out.format("%-4d %-4d\t", w, h);
@@ -360,7 +365,8 @@ class TJBench {
for (i = 0; i < h; i++)
System.arraycopy(srcBuf, w * ps * i, tmpBuf, pitch * i, w * ps);
if (yuv == YUVCOMPRESS)
tjc.setSourceImageYUV(srcBuf, tilew, yuvpad, tileh);
tjc.setSourceImage(new YUVImage(srcBuf, tilew, yuvpad, tileh,
subsamp));
else
tjc.setSourceImage(srcBuf, 0, 0, tilew, pitch, tileh, pf);
tjc.setJPEGQuality(jpegQual);
@@ -458,7 +464,7 @@ class TJBench {
tjt = new TJTransformer();
tjt.setJPEGImage(srcBuf, srcSize);
tjt.setSourceImage(srcBuf, srcSize);
w = tjt.getWidth();
h = tjt.getHeight();
subsamp = tjt.getSubsamp();

View File

@@ -277,7 +277,7 @@ public class TJExample implements TJCustomFilter {
scaleFactor.isOne()) {
file = new File(argv[1]);
FileOutputStream fos = new FileOutputStream(file);
fos.write(tjd.getJPEGBuf(), 0, tjd.getJPEGSize());
fos.write(tjd.getSourceBuf(), 0, tjd.getSourceSize());
fos.close();
System.exit(0);
}

View File

@@ -92,9 +92,7 @@ public class TJUnitTest {
TJ.PF_RGB
};
private static final int YUVENCODE = 1;
private static final int YUVDECODE = 2;
private static int yuv = 0;
private static boolean doYUV = false;
private static int pad = 4;
private static boolean bi = false;
@@ -534,54 +532,6 @@ public class TJUnitTest {
return ((v + (p) - 1) & (~((p) - 1)));
}
private static void initBufYUV(byte[] buf, int w, int pad, int h,
int subsamp) 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, pad), uvpitch = PAD(cw, pad);
int halfway = 16, blockSize = 8;
Arrays.fill(buf, (byte)0);
for (row = 0; row < ph; row++) {
for (col = 0; col < pw; col++) {
int index = ypitch * row + col;
if (((row / blockSize) + (col / blockSize)) % 2 == 0) {
if (row < halfway)
buf[index] = (byte)255;
else
buf[index] = 0;
} else {
if (row < halfway)
buf[index] = 76;
else
buf[index] = (byte)226;
}
}
}
if (subsamp != TJ.SAMP_GRAY) {
halfway = 16 / vsf;
for (row = 0; row < ch; row++) {
for (col = 0; col < cw; col++) {
int uindex = ypitch * ph + (uvpitch * row + col),
vindex = ypitch * ph + uvpitch * ch + (uvpitch * row + col);
if (((row * vsf / blockSize) + (col * hsf / blockSize)) % 2 == 0) {
buf[uindex] = buf[vindex] = (byte)128;
} else {
if (row < halfway) {
buf[uindex] = 85;
buf[vindex] = (byte)255;
} else {
buf[uindex] = 0;
buf[vindex] = (byte)149;
}
}
}
}
}
}
private static int checkBufYUV(byte[] buf, int size, int w, int h,
int subsamp, TJScalingFactor sf)
throws Exception {
@@ -686,87 +636,68 @@ public class TJUnitTest {
private static int compTest(TJCompressor tjc, byte[] dstBuf, int w,
int h, int pf, String baseName, int subsamp,
int jpegQual, int flags) throws Exception {
String tempstr;
String tempStr;
byte[] srcBuf = null;
BufferedImage img = null;
String pfStr;
String pfStr, pfStrLong;
String buStr = (flags & TJ.FLAG_BOTTOMUP) != 0 ? "BU" : "TD";
String buStrLong = (flags & TJ.FLAG_BOTTOMUP) != 0 ?
"Bottom-Up" : "Top-Down ";
String buStr = (flags & TJ.FLAG_BOTTOMUP) != 0 ? "BU" : "TD";
int size = 0, ps, imgType = pf;
if (yuv == YUVDECODE) {
System.out.format("YUV %s %s --> JPEG Q%d ... ", subNameLong[subsamp],
buStrLong, jpegQual);
srcBuf = new byte[TJ.bufSizeYUV(w, pad, h, subsamp)];
initBufYUV(srcBuf, w, pad, h, subsamp);
pfStr = "YUV";
if (bi) {
pf = biTypePF(imgType);
pfStr = biTypeStr(imgType);
pfStrLong = pfStr + " (" + pixFormatStr[pf] + ")";
} else {
if (bi) {
pf = biTypePF(imgType);
pfStr = biTypeStr(imgType);
} else
pfStr = pixFormatStr[pf];
ps = TJ.getPixelSize(pf);
pfStr = pixFormatStr[pf];
pfStrLong = pfStr;
}
ps = TJ.getPixelSize(pf);
System.out.print(pfStr + " ");
if (bi)
System.out.print("(" + pixFormatStr[pf] + ") ");
if (yuv == YUVENCODE)
System.out.format("%s -> %s YUV ... ", buStrLong,
subNameLong[subsamp]);
else
System.out.format("%s -> %s Q%d ... ", buStrLong, subNameLong[subsamp],
jpegQual);
if (bi) {
img = new BufferedImage(w, h, imgType);
initImg(img, pf, flags);
tempstr = baseName + "_enc_" + pfStr + "_" + buStr + "_" +
subName[subsamp] + "_Q" + jpegQual + ".png";
File file = new File(tempstr);
ImageIO.write(img, "png", file);
} else {
srcBuf = new byte[w * h * ps + 1];
initBuf(srcBuf, w, w * ps, h, pf, flags);
}
if (bi) {
img = new BufferedImage(w, h, imgType);
initImg(img, pf, flags);
tempStr = baseName + "_enc_" + pfStr + "_" + buStr + "_" +
subName[subsamp] + "_Q" + jpegQual + ".png";
File file = new File(tempStr);
ImageIO.write(img, "png", file);
tjc.setSourceImage(img, 0, 0, 0, 0);
} else {
srcBuf = new byte[w * h * ps + 1];
initBuf(srcBuf, w, w * ps, h, pf, flags);
tjc.setSourceImage(srcBuf, 0, 0, w, 0, h, pf);
}
Arrays.fill(dstBuf, (byte)0);
tjc.setSubsamp(subsamp);
tjc.setJPEGQuality(jpegQual);
tjc.setYUVPad(pad);
if (yuv == YUVDECODE)
tjc.setSourceImageYUV(srcBuf, w, pad, h);
else if (bi)
tjc.setSourceImage(img, 0, 0, 0, 0);
else
tjc.setSourceImage(srcBuf, 0, 0, w, 0, h, pf);
if (yuv == YUVENCODE)
tjc.encodeYUV(dstBuf, flags);
else
tjc.compress(dstBuf, flags);
size = tjc.getCompressedSize();
if (yuv == YUVENCODE)
tempstr = baseName + "_enc_" + pfStr + "_" + buStr + "_" +
subName[subsamp] + ".yuv";
else
tempstr = baseName + "_enc_" + pfStr + "_" + buStr + "_" +
subName[subsamp] + "_Q" + jpegQual + ".jpg";
writeJPEG(dstBuf, size, tempstr);
if (yuv == YUVENCODE) {
if (checkBufYUV(dstBuf, size, w, h, subsamp,
new TJScalingFactor(1, 1)) == 1)
System.out.print("Passed.");
if (doYUV) {
System.out.format("%s %s -> YUV %s ... ", pfStrLong, buStrLong,
subNameLong[subsamp]);
YUVImage yuvImage = tjc.encodeYUV(pad, flags);
if (checkBufYUV(yuvImage.getBuf(), yuvImage.getSize(), w, h, subsamp,
new TJScalingFactor(1, 1)) == 1)
System.out.print("Passed.\n");
else {
System.out.print("FAILED!");
System.out.print("FAILED!\n");
exitStatus = -1;
}
} else
System.out.print("Done.");
System.out.println("\n Result in " + tempstr);
System.out.format("YUV %s %s -> JPEG Q%d ... ", subNameLong[subsamp],
buStrLong, jpegQual);
tjc.setSourceImage(yuvImage);
} else {
System.out.format("%s %s -> %s Q%d ... ", pfStrLong, buStrLong,
subNameLong[subsamp], jpegQual);
}
tjc.compress(dstBuf, flags);
size = tjc.getCompressedSize();
tempStr = baseName + "_enc_" + pfStr + "_" + buStr + "_" +
subName[subsamp] + "_Q" + jpegQual + ".jpg";
writeJPEG(dstBuf, size, tempStr);
System.out.println("Done.\n Result in " + tempStr);
return size;
}
@@ -775,39 +706,25 @@ public class TJUnitTest {
int jpegSize, int w, int h, int pf,
String baseName, int subsamp, int flags,
TJScalingFactor sf) throws Exception {
String pfStr, tempstr;
String pfStr, pfStrLong, tempStr;
String buStrLong = (flags & TJ.FLAG_BOTTOMUP) != 0 ?
"Bottom-Up" : "Top-Down ";
int scaledWidth = sf.getScaled(w);
int scaledHeight = sf.getScaled(h);
int temp1, temp2, imgType = pf;
BufferedImage img = null;
byte[] dstBuf = null;
if (yuv == YUVENCODE) return;
if (bi) {
pf = biTypePF(imgType);
pfStr = biTypeStr(imgType);
} else
pfStrLong = pfStr + " (" + pixFormatStr[pf] + ")";
} else {
pfStr = pixFormatStr[pf];
System.out.print("JPEG -> ");
if (yuv == YUVDECODE)
System.out.print("YUV " + subNameLong[subsamp] + " ");
else {
System.out.print(pfStr + " ");
if (bi)
System.out.print("(" + pixFormatStr[pf] + ") ");
if ((flags & TJ.FLAG_BOTTOMUP) != 0)
System.out.print("Bottom-Up ");
else
System.out.print("Top-Down ");
pfStrLong = pfStr;
}
if (!sf.isOne())
System.out.print(sf.getNum() + "/" + sf.getDenom() + " ... ");
else
System.out.print("... ");
tjd.setJPEGImage(jpegBuf, jpegSize);
tjd.setSourceImage(jpegBuf, jpegSize);
if (tjd.getWidth() != w || tjd.getHeight() != h ||
tjd.getSubsamp() != subsamp)
throw new Exception("Incorrect JPEG header");
@@ -819,43 +736,52 @@ public class TJUnitTest {
if (temp1 != scaledWidth || temp2 != scaledHeight)
throw new Exception("Scaled size mismatch");
if (yuv == YUVDECODE)
dstBuf = tjd.decompressToYUV(scaledWidth, pad, scaledHeight, flags);
else {
if (bi)
img = tjd.decompress(scaledWidth, scaledHeight, imgType, flags);
else
dstBuf = tjd.decompress(scaledWidth, 0, scaledHeight, pf, flags);
if (doYUV) {
System.out.format("JPEG -> YUV %s ", subNameLong[subsamp]);
if(!sf.isOne())
System.out.format("%d/%d ... ", sf.getNum(), sf.getDenom());
else System.out.print("... ");
YUVImage yuvImage = tjd.decompressToYUV(scaledWidth, pad, scaledHeight,
flags);
if (checkBufYUV(yuvImage.getBuf(), yuvImage.getSize(), scaledWidth,
scaledHeight, subsamp, sf) == 1)
System.out.print("Passed.\n");
else {
System.out.print("FAILED!\n"); exitStatus = -1;
}
System.out.format("YUV %s -> %s %s ... ", subNameLong[subsamp],
pfStrLong, buStrLong);
tjd.setSourceImage(yuvImage);
} else {
System.out.format("JPEG -> %s %s ", pfStrLong, buStrLong);
if(!sf.isOne())
System.out.format("%d/%d ... ", sf.getNum(), sf.getDenom());
else System.out.print("... ");
}
if (bi)
img = tjd.decompress(scaledWidth, scaledHeight, imgType, flags);
else
dstBuf = tjd.decompress(scaledWidth, 0, scaledHeight, pf, flags);
if (bi) {
tempstr = baseName + "_dec_" + pfStr + "_" +
tempStr = baseName + "_dec_" + pfStr + "_" +
(((flags & TJ.FLAG_BOTTOMUP) != 0) ? "BU" : "TD") + "_" +
subName[subsamp] + "_" +
(double)sf.getNum() / (double)sf.getDenom() + "x" + ".png";
File file = new File(tempstr);
File file = new File(tempStr);
ImageIO.write(img, "png", file);
}
if (yuv == YUVDECODE) {
if (checkBufYUV(dstBuf, dstBuf.length, scaledWidth, scaledHeight,
subsamp, sf) == 1)
System.out.print("Passed.");
else {
System.out.print("FAILED!"); exitStatus = -1;
}
} else {
if ((bi && checkImg(img, pf, subsamp, sf, flags) == 1) ||
(!bi && checkBuf(dstBuf, scaledWidth,
scaledWidth * TJ.getPixelSize(pf), scaledHeight, pf,
subsamp, sf, flags) == 1))
System.out.print("Passed.");
else {
System.out.print("FAILED!");
exitStatus = -1;
}
if ((bi && checkImg(img, pf, subsamp, sf, flags) == 1) ||
(!bi && checkBuf(dstBuf, scaledWidth,
scaledWidth * TJ.getPixelSize(pf), scaledHeight, pf,
subsamp, sf, flags) == 1))
System.out.print("Passed.\n");
else {
System.out.print("FAILED!\n");
exitStatus = -1;
}
System.out.print("\n");
}
private static void decompTest(TJDecompressor tjd, byte[] jpegBuf,
@@ -884,10 +810,7 @@ public class TJUnitTest {
int size;
byte[] dstBuf;
if (yuv == YUVENCODE)
dstBuf = new byte[TJ.bufSizeYUV(w, pad, h, subsamp)];
else
dstBuf = new byte[TJ.bufSize(w, h, subsamp)];
dstBuf = new byte[TJ.bufSize(w, h, subsamp)];
try {
tjc = new TJCompressor();
@@ -900,20 +823,16 @@ public class TJUnitTest {
if (subsamp == TJ.SAMP_422 || subsamp == TJ.SAMP_420 ||
subsamp == TJ.SAMP_440 || subsamp == TJ.SAMP_411)
flags |= TJ.FLAG_FASTUPSAMPLE;
if (i == 1) {
if (yuv == YUVDECODE) {
tjc.close();
tjd.close();
return;
} else
flags |= TJ.FLAG_BOTTOMUP;
}
if (i == 1)
flags |= TJ.FLAG_BOTTOMUP;
size = compTest(tjc, dstBuf, w, h, pf, baseName, subsamp, 100,
flags);
decompTest(tjd, dstBuf, size, w, h, pf, baseName, subsamp, flags);
if (pf >= TJ.PF_RGBX && pf <= TJ.PF_XRGB && !bi)
if (pf >= TJ.PF_RGBX && pf <= TJ.PF_XRGB && !bi) {
System.out.print("\n");
decompTest(tjd, dstBuf, size, w, h, pf + (TJ.PF_RGBA - TJ.PF_RGBX),
baseName, subsamp, flags);
}
System.out.print("\n");
}
}
@@ -929,7 +848,8 @@ public class TJUnitTest {
private static void bufSizeTest() throws Exception {
int w, h, i, subsamp;
byte[] srcBuf, dstBuf;
byte[] srcBuf, dstBuf = null;
YUVImage dstImage = null;
TJCompressor tjc = null;
Random r = new Random();
@@ -943,8 +863,8 @@ public class TJUnitTest {
if (h % 100 == 0)
System.out.format("%04d x %04d\b\b\b\b\b\b\b\b\b\b\b", w, h);
srcBuf = new byte[w * h * 4];
if (yuv == YUVENCODE)
dstBuf = new byte[TJ.bufSizeYUV(w, pad, h, subsamp)];
if (doYUV)
dstImage = new YUVImage(w, pad, h, subsamp);
else
dstBuf = new byte[TJ.bufSize(w, h, subsamp)];
for (i = 0; i < w * h * 4; i++) {
@@ -953,23 +873,22 @@ public class TJUnitTest {
tjc.setSourceImage(srcBuf, 0, 0, w, 0, h, TJ.PF_BGRX);
tjc.setSubsamp(subsamp);
tjc.setJPEGQuality(100);
tjc.setYUVPad(pad);
if (yuv == YUVENCODE)
tjc.encodeYUV(dstBuf, 0);
if (doYUV)
tjc.encodeYUV(dstImage, 0);
else
tjc.compress(dstBuf, 0);
srcBuf = new byte[h * w * 4];
if (yuv == YUVENCODE)
dstBuf = new byte[TJ.bufSizeYUV(h, pad, w, subsamp)];
if (doYUV)
dstImage = new YUVImage(h, pad, w, subsamp);
else
dstBuf = new byte[TJ.bufSize(h, w, subsamp)];
for (i = 0; i < h * w * 4; i++) {
srcBuf[i] = (byte)(r.nextInt(2) * 255);
}
tjc.setSourceImage(srcBuf, 0, 0, h, 0, w, TJ.PF_BGRX);
if (yuv == YUVENCODE)
tjc.encodeYUV(dstBuf, 0);
if (doYUV)
tjc.encodeYUV(dstImage, 0);
else
tjc.compress(dstBuf, 0);
}
@@ -986,10 +905,9 @@ public class TJUnitTest {
public static void main(String[] argv) {
try {
String testName = "javatest";
boolean doyuv = false;
for (int i = 0; i < argv.length; i++) {
if (argv[i].equalsIgnoreCase("-yuv"))
doyuv = true;
doYUV = true;
if (argv[i].equalsIgnoreCase("-noyuvpad"))
pad = 1;
if (argv[i].substring(0, 1).equalsIgnoreCase("-h") ||
@@ -1000,10 +918,8 @@ public class TJUnitTest {
testName = "javabitest";
}
}
if (doyuv) {
yuv = YUVENCODE;
if (doYUV)
_4byteFormats[4] = -1;
}
doTest(35, 39, bi ? _3byteFormatsBI : _3byteFormats, TJ.SAMP_444,
testName);
doTest(39, 41, bi ? _4byteFormatsBI : _4byteFormats, TJ.SAMP_444,
@@ -1032,23 +948,15 @@ public class TJUnitTest {
testName);
if (!bi)
bufSizeTest();
if (doyuv && !bi) {
if (doYUV && !bi) {
System.out.print("\n--------------------\n\n");
yuv = YUVDECODE;
doTest(48, 48, onlyRGB, TJ.SAMP_444, "javatest_yuv0");
doTest(35, 39, onlyRGB, TJ.SAMP_444, "javatest_yuv1");
doTest(48, 48, onlyRGB, TJ.SAMP_422, "javatest_yuv0");
doTest(39, 41, onlyRGB, TJ.SAMP_422, "javatest_yuv1");
doTest(48, 48, onlyRGB, TJ.SAMP_420, "javatest_yuv0");
doTest(41, 35, onlyRGB, TJ.SAMP_420, "javatest_yuv1");
doTest(48, 48, onlyRGB, TJ.SAMP_440, "javatest_yuv0");
doTest(35, 39, onlyRGB, TJ.SAMP_440, "javatest_yuv1");
doTest(48, 48, onlyRGB, TJ.SAMP_411, "javatest_yuv0");
doTest(39, 41, onlyRGB, TJ.SAMP_411, "javatest_yuv1");
doTest(48, 48, onlyRGB, TJ.SAMP_GRAY, "javatest_yuv0");
doTest(41, 35, onlyRGB, TJ.SAMP_GRAY, "javatest_yuv1");
doTest(48, 48, onlyGray, TJ.SAMP_GRAY, "javatest_yuv0");
doTest(35, 39, onlyGray, TJ.SAMP_GRAY, "javatest_yuv1");
}
} catch(Exception e) {
e.printStackTrace();

View File

@@ -33,6 +33,8 @@ All Classes
<BR>
<A HREF="org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg" target="classFrame">TJTransformer</A>
<BR>
<A HREF="org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg" target="classFrame">YUVImage</A>
<BR>
</FONT></TD>
</TR>
</TABLE>

View File

@@ -33,6 +33,8 @@ All Classes
<BR>
<A HREF="org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</A>
<BR>
<A HREF="org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A>
<BR>
</FONT></TD>
</TR>
</TABLE>

View File

@@ -149,8 +149,7 @@ function windowTitle()
<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>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I>Use <A HREF="org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage, int)"><CODE>TJDecompressor.decompressToYUV(YUVImage, 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>
@@ -172,6 +171,31 @@ function windowTitle()
<A HREF="org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int)"><CODE>TJCompressor.encodeYUV(int)</CODE></A> instead.</I>&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[], int)">org.libjpegturbo.turbojpeg.TJCompressor.encodeYUV(byte[], int)</A>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I>Use <A HREF="org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(org.libjpegturbo.turbojpeg.YUVImage, int)"><CODE>TJCompressor.encodeYUV(YUVImage, int)</CODE></A> instead.</I>&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int)">org.libjpegturbo.turbojpeg.TJCompressor.encodeYUV(int)</A>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I>Use <A HREF="org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int, int)"><CODE>TJCompressor.encodeYUV(int, int)</CODE></A> instead.</I>&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGBuf()">org.libjpegturbo.turbojpeg.TJDecompressor.getJPEGBuf()</A>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I>Use <A HREF="org/libjpegturbo/turbojpeg/TJDecompressor.html#getSourceBuf()"><CODE>TJDecompressor.getSourceBuf()</CODE></A> instead.</I>&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGSize()">org.libjpegturbo.turbojpeg.TJDecompressor.getJPEGSize()</A>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I>Use <A HREF="org/libjpegturbo/turbojpeg/TJDecompressor.html#getSourceSize()"><CODE>TJDecompressor.getSourceSize()</CODE></A> instead.</I>&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGImage(byte[], int)">org.libjpegturbo.turbojpeg.TJDecompressor.setJPEGImage(byte[], int)</A>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I>Use <A HREF="org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte[], int)"><CODE>TJDecompressor.setSourceImage(byte[], 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

@@ -74,7 +74,7 @@ function windowTitle()
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<A HREF="#_B_">B</A> <A HREF="#_C_">C</A> <A HREF="#_D_">D</A> <A HREF="#_E_">E</A> <A HREF="#_F_">F</A> <A HREF="#_G_">G</A> <A HREF="#_H_">H</A> <A HREF="#_I_">I</A> <A HREF="#_J_">J</A> <A HREF="#_N_">N</A> <A HREF="#_O_">O</A> <A HREF="#_P_">P</A> <A HREF="#_S_">S</A> <A HREF="#_T_">T</A> <HR>
<A HREF="#_B_">B</A> <A HREF="#_C_">C</A> <A HREF="#_D_">D</A> <A HREF="#_E_">E</A> <A HREF="#_F_">F</A> <A HREF="#_G_">G</A> <A HREF="#_H_">H</A> <A HREF="#_I_">I</A> <A HREF="#_J_">J</A> <A HREF="#_N_">N</A> <A HREF="#_O_">O</A> <A HREF="#_P_">P</A> <A HREF="#_S_">S</A> <A HREF="#_T_">T</A> <A HREF="#_Y_">Y</A> <HR>
<A NAME="_B_"><!-- --></A><H2>
<B>B</B></H2>
<DL>
@@ -148,8 +148,9 @@ Method in interface org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbo
<DL>
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int, int, int)"><B>decompress(byte[], int, int, int, 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 decompressed image to the given destination buffer.
<DD>Decompress the JPEG source image or decode the YUV source image associated
with this decompressor instance and output a grayscale, RGB, or CMYK image
to the given destination buffer.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)"><B>decompress(byte[], int, 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><B>Deprecated.</B>&nbsp;<I>Use
@@ -160,30 +161,32 @@ Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg
instance and return a buffer containing the decompressed image.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int[], int, int, int, int, int, int, int)"><B>decompress(int[], int, int, int, 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 decompressed image to the given destination buffer.
<DD>Decompress the JPEG source image or decode the YUV source image associated
with this decompressor instance and output a grayscale, RGB, or CMYK image
to the given destination buffer.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(java.awt.image.BufferedImage, int)"><B>decompress(BufferedImage, 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 decompressed image to the given
<code>BufferedImage</code> instance.
<DD>Decompress the JPEG source image or decode the YUV source image associated
with this decompressor instance and output a decompressed/decoded image to
the given <code>BufferedImage</code> instance.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int, int, int, int)"><B>decompress(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 <code>BufferedImage</code> instance containing the
decompressed image.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int, int, int, int)"><B>decompressToYUV(byte[], int, int, int, int)</B></A> -
<DD>Decompress the JPEG source image or decode the YUV source image associated
with this decompressor instance and return a <code>BufferedImage</code>
instance containing the decompressed/decoded image.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage, int)"><B>decompressToYUV(YUVImage, 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.
instance into a YUV planar image and store it in the given
<code>YUVImage</code> instance.
<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>
<DD><B>Deprecated.</B>&nbsp;<I>Use <A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage, int)"><CODE>TJDecompressor.decompressToYUV(YUVImage, 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.
instance into a YUV planar image and return a <code>YUVImage</code>
instance containing the decompressed 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>
@@ -192,14 +195,22 @@ Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg
<A NAME="_E_"><!-- --></A><H2>
<B>E</B></H2>
<DL>
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(org.libjpegturbo.turbojpeg.YUVImage, int)"><B>encodeYUV(YUVImage, 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>Encode the uncompressed source image associated with this compressor
instance into a YUV planar image and store it in the given
<code>YUVImage</code> instance.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[], int)"><B>encodeYUV(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>
<DD>Encode the uncompressed source image associated with this compressor
instance and output a YUV planar image to the given destination buffer.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int)"><B>encodeYUV(int)</B></A> -
<DD><B>Deprecated.</B>&nbsp;<I>Use <A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(org.libjpegturbo.turbojpeg.YUVImage, int)"><CODE>TJCompressor.encodeYUV(YUVImage, int)</CODE></A> instead.</I>
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int, int)"><B>encodeYUV(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>Encode the uncompressed source image associated with this compressor
instance and return a buffer containing a YUV planar image.
instance into a YUV planar image and return a <code>YUVImage</code>
instance containing the encoded image.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int)"><B>encodeYUV(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><B>Deprecated.</B>&nbsp;<I>Use <A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int, int)"><CODE>TJCompressor.encodeYUV(int, int)</CODE></A> instead.</I>
<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>
<DD><B>Deprecated.</B>&nbsp;<I>Use
@@ -262,10 +273,13 @@ 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>
<DD>For the given pixel format, returns the number of bytes that the blue
component is offset from the start of the pixel.
<DT><A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html#getBuf()"><B>getBuf()</B></A> -
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A>
<DD>Returns the YUV image buffer
<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.
<DD>Returns the colorspace used in the source image (JPEG or YUV) associated
with this decompressor instance.
<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>
<DD>Returns the size of the image (in bytes) generated by the most recent
@@ -279,15 +293,17 @@ Static method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/tu
component is offset from the start of the pixel.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getHeight()"><B>getHeight()</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 height of the JPEG image associated with this decompressor
instance.
<DD>Returns the height of the source image (JPEG or YUV) associated with this
decompressor instance.
<DT><A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html#getHeight()"><B>getHeight()</B></A> -
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A>
<DD>Returns the height of the YUV image.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGBuf()"><B>getJPEGBuf()</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 JPEG image buffer associated with this decompressor instance.
<DD><B>Deprecated.</B>&nbsp;<I>Use <A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getSourceBuf()"><CODE>TJDecompressor.getSourceBuf()</CODE></A> instead.</I>
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGSize()"><B>getJPEGSize()</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 size of the JPEG image (in bytes) associated with this
decompressor instance.
<DD><B>Deprecated.</B>&nbsp;<I>Use <A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getSourceSize()"><CODE>TJDecompressor.getSourceSize()</CODE></A> instead.</I>
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#getMCUHeight(int)"><B>getMCUHeight(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 MCU block height for the given level of chrominance
@@ -299,6 +315,9 @@ Static method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/tu
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJScalingFactor.html#getNum()"><B>getNum()</B></A> -
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</A>
<DD>Returns numerator
<DT><A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html#getPad()"><B>getPad()</B></A> -
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A>
<DD>Returns the line padding used in the YUV image buffer.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#getPixelSize(int)"><B>getPixelSize(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 pixel size (in bytes) for the given pixel format.
@@ -323,18 +342,35 @@ Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg
Static method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
<DD>Returns a list of fractional scaling factors that the JPEG decompressor in
this implementation of TurboJPEG supports.
<DT><A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html#getSize()"><B>getSize()</B></A> -
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A>
<DD>Returns the size (in bytes) of the YUV image buffer
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getSourceBuf()"><B>getSourceBuf()</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 source image buffer associated with this decompressor
instance.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getSourceSize()"><B>getSourceSize()</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 size of the source image (in bytes) associated with this
decompressor instance.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getSubsamp()"><B>getSubsamp()</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 level of chrominance subsampling used in the JPEG image
associated with this decompressor instance.
<DD>Returns the level of chrominance subsampling used in the source image
(JPEG or YUV) associated with this decompressor instance.
<DT><A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html#getSubsamp()"><B>getSubsamp()</B></A> -
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A>
<DD>Returns the level of chrominance subsampling used in the YUV image.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransformer.html#getTransformedSizes()"><B>getTransformedSizes()</B></A> -
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</A>
<DD>Returns an array containing the sizes of the transformed JPEG images from
the most recent call to <A HREF="./org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)"><CODE>transform()</CODE></A>.
<DD>Returns an array containing the sizes of the transformed JPEG images
generated by the most recent transform operation.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getWidth()"><B>getWidth()</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 width of the JPEG image associated with this decompressor
instance.
<DD>Returns the width of the source image (JPEG or YUV) associated with this
decompressor instance.
<DT><A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html#getWidth()"><B>getWidth()</B></A> -
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A>
<DD>Returns the width of the YUV image.
</DL>
<HR>
<A NAME="_H_"><!-- --></A><H2>
@@ -343,6 +379,9 @@ Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#handle"><B>handle</B></A> -
Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
<DD>&nbsp;
<DT><A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html#handle"><B>handle</B></A> -
Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A>
<DD>&nbsp;
</DL>
<HR>
<A NAME="_I_"><!-- --></A><H2>
@@ -363,18 +402,6 @@ Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojp
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegBufSize"><B>jpegBufSize</B></A> -
Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
<DD>&nbsp;
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegColorspace"><B>jpegColorspace</B></A> -
Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
<DD>&nbsp;
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegHeight"><B>jpegHeight</B></A> -
Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
<DD>&nbsp;
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegSubsamp"><B>jpegSubsamp</B></A> -
Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
<DD>&nbsp;
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegWidth"><B>jpegWidth</B></A> -
Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
<DD>&nbsp;
</DL>
<HR>
<A NAME="_N_"><!-- --></A><H2>
@@ -513,32 +540,50 @@ Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/
<DD>Grayscale.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGImage(byte[], int)"><B>setJPEGImage(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>Associate the JPEG image of length <code>imageSize</code> bytes stored in
<code>jpegImage</code> with this decompressor instance.
<DD><B>Deprecated.</B>&nbsp;<I>Use <A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte[], int)"><CODE>TJDecompressor.setSourceImage(byte[], int)</CODE></A> instead.</I>
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#setJPEGQuality(int)"><B>setJPEGQuality(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 JPEG image quality level for subsequent compress operations.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int, int, int)"><B>setSourceImage(byte[], int, int, 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.
<DD>Associate an uncompressed RGB, grayscale, or CMYK source image with this
compressor instance.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int)"><B>setSourceImage(byte[], 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><B>Deprecated.</B>&nbsp;<I>Use
<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int, int, int)"><CODE>TJCompressor.setSourceImage(byte[], int, int, int, int, int, int)</CODE></A> instead.</I>
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#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> -
<DD>Associate an uncompressed RGB or grayscale source image with this
compressor instance.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)"><B>setSourceImage(YUVImage)</B></A> -
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
<DD>Associate an uncompressed YUV planar source image with this compressor
instance.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte[], int)"><B>setSourceImage(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>Associate the JPEG image of length <code>imageSize</code> bytes stored in
<code>srcImage</code> with this decompressor instance.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)"><B>setSourceImage(YUVImage)</B></A> -
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
<DD>Associate the specified YUV planar source image with this decompressor
instance.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSubsamp(int)"><B>setSubsamp(int)</B></A> -
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
<DD>Set the level of chrominance subsampling for subsequent compress/encode
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.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#srcColorspace"><B>srcColorspace</B></A> -
Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
<DD>&nbsp;
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#srcHeight"><B>srcHeight</B></A> -
Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
<DD>&nbsp;
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#srcSubsamp"><B>srcSubsamp</B></A> -
Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
<DD>&nbsp;
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#srcWidth"><B>srcWidth</B></A> -
Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
<DD>&nbsp;
</DL>
<HR>
<A NAME="_T_"><!-- --></A><H2>
@@ -550,32 +595,37 @@ Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/tur
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg"><B>TJCompressor</B></A> - Class in <A HREF="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</A><DD>TurboJPEG compressor<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor()"><B>TJCompressor()</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.
<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
source image stored in <code>srcImage</code> with the newly created
instance.
<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>
<DD><B>Deprecated.</B>&nbsp;<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
source image stored in <code>srcImage</code> with the newly-created
instance.
<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>
<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.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg"><B>TJCustomFilter</B></A> - Interface in <A HREF="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</A><DD>Custom filter callback interface<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><B>TJDecompressor</B></A> - Class in <A HREF="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</A><DD>TurboJPEG decompressor<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor()"><B>TJDecompressor()</B></A> -
Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
<DD>Create a TurboJPEG decompresssor instance.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(byte[])"><B>TJDecompressor(byte[])</B></A> -
Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
<DD>Create a TurboJPEG decompressor instance and associate the JPEG image
stored in <code>jpegImage</code> with the newly-created instance.
<DD>Create a TurboJPEG decompressor instance and associate the JPEG source
image stored in <code>jpegImage</code> with the newly created instance.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(byte[], int)"><B>TJDecompressor(byte[], int)</B></A> -
Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
<DD>Create a TurboJPEG decompressor instance and associate the JPEG image
of length <code>imageSize</code> bytes stored in <code>jpegImage</code>
with the newly-created instance.
<DD>Create a TurboJPEG decompressor instance and associate the JPEG source
image of length <code>imageSize</code> bytes stored in
<code>jpegImage</code> with the newly created instance.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(org.libjpegturbo.turbojpeg.YUVImage)"><B>TJDecompressor(YUVImage)</B></A> -
Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
<DD>Create a TurboJPEG decompressor instance and associate the YUV planar
source image stored in <code>yuvImage</code> with the newly created
instance.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg"><B>TJScalingFactor</B></A> - Class in <A HREF="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</A><DD>Fractional scaling factor<DT><A HREF="./org/libjpegturbo/turbojpeg/TJScalingFactor.html#TJScalingFactor(int, int)"><B>TJScalingFactor(int, int)</B></A> -
Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</A>
<DD>&nbsp;
@@ -594,12 +644,12 @@ Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/tur
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransformer.html#TJTransformer(byte[])"><B>TJTransformer(byte[])</B></A> -
Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</A>
<DD>Create a TurboJPEG lossless transformer instance and associate the JPEG
image stored in <code>jpegImage</code> with the newly-created instance.
image stored in <code>jpegImage</code> with the newly created instance.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransformer.html#TJTransformer(byte[], int)"><B>TJTransformer(byte[], int)</B></A> -
Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</A>
<DD>Create a TurboJPEG lossless transformer instance and associate the JPEG
image of length <code>imageSize</code> bytes stored in
<code>jpegImage</code> with the newly-created instance.
<code>jpegImage</code> with the newly created instance.
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)"><B>transform(byte[][], TJTransform[], int)</B></A> -
Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</A>
<DD>Losslessly transform the JPEG image associated with this transformer
@@ -612,7 +662,38 @@ Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg
which has a transformed JPEG image associated with it.
</DL>
<HR>
<A HREF="#_B_">B</A> <A HREF="#_C_">C</A> <A HREF="#_D_">D</A> <A HREF="#_E_">E</A> <A HREF="#_F_">F</A> <A HREF="#_G_">G</A> <A HREF="#_H_">H</A> <A HREF="#_I_">I</A> <A HREF="#_J_">J</A> <A HREF="#_N_">N</A> <A HREF="#_O_">O</A> <A HREF="#_P_">P</A> <A HREF="#_S_">S</A> <A HREF="#_T_">T</A>
<A NAME="_Y_"><!-- --></A><H2>
<B>Y</B></H2>
<DL>
<DT><A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html#yuvBuf"><B>yuvBuf</B></A> -
Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A>
<DD>&nbsp;
<DT><A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html#yuvHeight"><B>yuvHeight</B></A> -
Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A>
<DD>&nbsp;
<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#yuvImage"><B>yuvImage</B></A> -
Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
<DD>&nbsp;
<DT><A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><B>YUVImage</B></A> - Class in <A HREF="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</A><DD>This class encapsulates a YUV planar image buffer and the metadata
associated with it.<DT><A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(int, int, int, int)"><B>YUVImage(int, int, int, int)</B></A> -
Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A>
<DD>Create a <code>YUVImage</code> instance with a new image buffer.
<DT><A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(byte[], int, int, int, int)"><B>YUVImage(byte[], int, int, int, int)</B></A> -
Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A>
<DD>Create a <code>YUVImage</code> instance from an existing YUV planar image
buffer.
<DT><A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html#yuvPad"><B>yuvPad</B></A> -
Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A>
<DD>&nbsp;
<DT><A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html#yuvSubsamp"><B>yuvSubsamp</B></A> -
Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A>
<DD>&nbsp;
<DT><A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html#yuvWidth"><B>yuvWidth</B></A> -
Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A>
<DD>&nbsp;
</DL>
<HR>
<A HREF="#_B_">B</A> <A HREF="#_C_">C</A> <A HREF="#_D_">D</A> <A HREF="#_E_">E</A> <A HREF="#_F_">F</A> <A HREF="#_G_">G</A> <A HREF="#_H_">H</A> <A HREF="#_I_">I</A> <A HREF="#_J_">J</A> <A HREF="#_N_">N</A> <A HREF="#_O_">O</A> <A HREF="#_P_">P</A> <A HREF="#_S_">S</A> <A HREF="#_T_">T</A> <A HREF="#_Y_">Y</A>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>

View File

@@ -128,7 +128,7 @@ TurboJPEG compressor
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
@@ -153,7 +153,7 @@ TurboJPEG compressor
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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.</TD>
</TR>
</TABLE>
@@ -246,17 +246,37 @@ TurboJPEG compressor
int&nbsp;flags)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Encode the uncompressed source image associated with this compressor
instance and output a YUV planar image to the given destination buffer.</TD>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>Use <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(org.libjpegturbo.turbojpeg.YUVImage, int)"><CODE>encodeYUV(YUVImage, 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/TJCompressor.html#encodeYUV(int)">encodeYUV</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/TJCompressor.html#encodeYUV(int, int)"><CODE>encodeYUV(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;<A HREF="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int, int)">encodeYUV</A></B>(int&nbsp;pad,
int&nbsp;flags)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Encode the uncompressed source image associated with this compressor
instance and return a buffer containing a YUV planar image.</TD>
instance into a YUV planar image and return a <code>YUVImage</code>
instance containing the encoded image.</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#encodeYUV(org.libjpegturbo.turbojpeg.YUVImage, int)">encodeYUV</A></B>(<A HREF="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A>&nbsp;dstImage,
int&nbsp;flags)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Encode the uncompressed source image associated with this compressor
instance into a YUV planar image and store it in the given
<code>YUVImage</code> instance.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
@@ -293,7 +313,8 @@ TurboJPEG compressor
int&nbsp;height)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Associate an uncompressed source image with this compressor instance.</TD>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Associate an uncompressed RGB or grayscale source image with this
compressor instance.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
@@ -320,15 +341,13 @@ TurboJPEG compressor
int&nbsp;pixelFormat)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Associate an uncompressed source image with this compressor instance.</TD>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Associate an uncompressed RGB, grayscale, or CMYK source image with this
compressor instance.</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#setSourceImageYUV(byte[], int, int, int)">setSourceImageYUV</A></B>(byte[]&nbsp;srcImage,
int&nbsp;width,
int&nbsp;pad,
int&nbsp;height)</CODE>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)">setSourceImage</A></B>(<A HREF="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A>&nbsp;srcImage)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Associate an uncompressed YUV planar source image with this compressor
@@ -343,14 +362,6 @@ 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="">
@@ -389,6 +400,30 @@ public <B>TJCompressor</B>()
</DL>
<HR>
<A NAME="TJCompressor(byte[], int, int, int, int, int, int)"><!-- --></A><H3>
TJCompressor</H3>
<PRE>
public <B>TJCompressor</B>(byte[]&nbsp;srcImage,
int&nbsp;x,
int&nbsp;y,
int&nbsp;width,
int&nbsp;pitch,
int&nbsp;height,
int&nbsp;pixelFormat)
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(byte[], int, int, int, int, int, int)"><CODE>setSourceImage(byte[], int, int, int, int, int, int)</CODE></A> for description<DD><CODE>x</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>y</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#PF_RGB"><CODE>TJ.PF_*</CODE></A>)
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DL>
<HR>
<A NAME="TJCompressor(byte[], int, int, int, int)"><!-- --></A><H3>
TJCompressor</H3>
<PRE>
@@ -410,30 +445,6 @@ TJCompressor</H3>
</DL>
<HR>
<A NAME="TJCompressor(byte[], int, int, int, int, int, int)"><!-- --></A><H3>
TJCompressor</H3>
<PRE>
public <B>TJCompressor</B>(byte[]&nbsp;srcImage,
int&nbsp;x,
int&nbsp;y,
int&nbsp;width,
int&nbsp;pitch,
int&nbsp;height,
int&nbsp;pixelFormat)
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(byte[], int, int, int, int, int, int)"><CODE>setSourceImage(byte[], int, int, int, int, int, int)</CODE></A> for description<DD><CODE>x</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>y</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>
<DD><CODE>java.lang.Exception</CODE></DL>
</DL>
<HR>
<A NAME="TJCompressor(java.awt.image.BufferedImage, int, int, int, int)"><!-- --></A><H3>
TJCompressor</H3>
<PRE>
@@ -445,7 +456,7 @@ public <B>TJCompressor</B>(java.awt.image.BufferedImage&nbsp;srcImage,
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
source image stored in <code>srcImage</code> with the newly created
instance.
<P>
<DL>
@@ -481,23 +492,24 @@ public void <B>setSourceImage</B>(byte[]&nbsp;srcImage,
int&nbsp;pixelFormat)
throws java.lang.Exception</PRE>
<DL>
<DD>Associate an uncompressed source image with this compressor instance.
<DD>Associate an uncompressed RGB, grayscale, or CMYK source image with this
compressor instance.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - image buffer containing RGB, grayscale, or CMYK pixels to
be compressed<DD><CODE>x</CODE> - x offset (in pixels) of the region from which the JPEG image
should be compressed, relative to the start of <code>srcImage</code>.<DD><CODE>y</CODE> - y offset (in pixels) of the region from which the JPEG image
should be compressed, relative to the start of <code>srcImage</code>.<DD><CODE>width</CODE> - width (in pixels) of the region in the source image from
which the JPEG image should be compressed.<DD><CODE>pitch</CODE> - bytes per line of the source image. Normally, this should be
be compressed or encoded<DD><CODE>x</CODE> - x offset (in pixels) of the region in the source image from which
the JPEG or YUV image should be compressed/encoded<DD><CODE>y</CODE> - y offset (in pixels) of the region in the source image from which
the JPEG or YUV image should be compressed/encoded<DD><CODE>width</CODE> - width (in pixels) of the region in the source image from
which the JPEG or YUV image should be compressed/encoded<DD><CODE>pitch</CODE> - bytes per line of the source image. Normally, this should be
<code>width * TJ.pixelSize(pixelFormat)</code> if the source image is
unpadded, but you can use this parameter to, for instance, specify that
the scanlines in the source image are padded to a 4-byte boundary or to
compress a JPEG image from a region of a larger source image. You can
also be clever and use this parameter to skip lines, etc. Setting this
parameter to 0 is the equivalent of setting it to <code>width *
TJ.pixelSize(pixelFormat)</code>.<DD><CODE>height</CODE> - height (in pixels) of the region in the source image from
which the JPEG image should be compressed.<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>)
compress/encode a JPEG or YUV image from a region of a larger source
image. You can also be clever and use this parameter to skip lines, etc.
Setting this parameter to 0 is the equivalent of setting it to
<code>width * TJ.pixelSize(pixelFormat)</code>.<DD><CODE>height</CODE> - height (in pixels) of the region in the source image from
which the JPEG or YUV image should be compressed/encoded<DD><CODE>pixelFormat</CODE> - pixel format of the source image (one of
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB"><CODE>TJ.PF_*</CODE></A>)
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
@@ -536,47 +548,35 @@ public void <B>setSourceImage</B>(java.awt.image.BufferedImage&nbsp;srcImage,
int&nbsp;height)
throws java.lang.Exception</PRE>
<DL>
<DD>Associate an uncompressed source image with this compressor instance.
<DD>Associate an uncompressed RGB or grayscale 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)
grayscale pixels to be compressed or encoded<DD><CODE>x</CODE> - x offset (in pixels) of the region in the source image from which
the JPEG or YUV image should be compressed/encoded<DD><CODE>y</CODE> - y offset (in pixels) of the region in the source image from which
the JPEG or YUV image should be compressed/encoded<DD><CODE>width</CODE> - width (in pixels) of the region in the source image from
which the JPEG or YUV image should be compressed/encoded (0 = use the
width of the source image)<DD><CODE>height</CODE> - height (in pixels) of the region in the source image from
which the JPEG or YUV image should be compressed/encoded (0 = use the
height of the source image)
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="setSourceImageYUV(byte[], int, int, int)"><!-- --></A><H3>
setSourceImageYUV</H3>
<A NAME="setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)"><!-- --></A><H3>
setSourceImage</H3>
<PRE>
public void <B>setSourceImageYUV</B>(byte[]&nbsp;srcImage,
int&nbsp;width,
int&nbsp;pad,
int&nbsp;height)
throws java.lang.Exception</PRE>
public void <B>setSourceImage</B>(<A HREF="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A>&nbsp;srcImage)
throws java.lang.Exception</PRE>
<DL>
<DD>Associate an uncompressed YUV planar source image with this compressor
instance.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - image buffer containing a YUV planar image to be
compressed. The Y, U (Cb), and V (Cr) image planes should be stored
sequentially in the buffer, and the size of each plane is determined by
the specified width, height, and padding, as well as the level of
chrominance subsampling (specified using <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSubsamp(int)"><CODE>setSubsamp(int)</CODE></A>.) If the
chrominance components are subsampled along the horizontal dimension, then
the width of the luminance plane should be padded to the nearest multiple
of 2 (same goes for the height of the luminance plane, if the chrominance
components are subsampled along the vertical dimension.) This is
irrespective of any additional padding specified in the <code>pad</code>
parameter.<DD><CODE>width</CODE> - width (in pixels) of the source image<DD><CODE>pad</CODE> - the line padding used in the source image. For instance, if
each line in each plane of the YUV image is padded to the nearest multiple
of 4 bytes, then <code>pad</code> should be set to 4.<DD><CODE>height</CODE> - height (in pixels) of the source image
<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - YUV planar image to be compressed
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
@@ -598,13 +598,17 @@ public void <B>setSubsamp</B>(int&nbsp;newSubsamp)
sensitive to small changes in brightness than to small changes in color.)
This is called "chrominance subsampling".
<p>
NOTE: When compressing a YUV planar image into a JPEG image, this method
also specifies the level of chrominance subsampling used in the source
image.
NOTE: This method has no effect when compressing a JPEG image from a YUV
planar source. In that case, the level of chrominance subsampling in
the JPEG image is determined by the source. Further, this method has no
effect when encoding to a pre-allocated <A HREF="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><CODE>YUVImage</CODE></A> instance. In
that case, the level of chrominance subsampling is determined by the
destination.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>newSubsamp</CODE> - the new level of chrominance subsampling (one of
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.SAMP_*</CODE></A>)
<DT><B>Parameters:</B><DD><CODE>newSubsamp</CODE> - the level of chrominance subsampling to use in
subsequent compress/encode oeprations (one of
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><CODE>TJ.SAMP_*</CODE></A>)
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
@@ -641,7 +645,9 @@ public void <B>compress</B>(byte[]&nbsp;dstBuf,
<DD><DL>
<DT><B>Parameters:</B><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>
the source image's width and height and the desired level of chrominance
subsampling.<DD><CODE>flags</CODE> - the bitwise OR of one or more of
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><CODE>TJ.FLAG_*</CODE></A>
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
@@ -658,7 +664,8 @@ public byte[] <B>compress</B>(int&nbsp;flags)
instance and return a buffer containing a JPEG image.
<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>Parameters:</B><DD><CODE>flags</CODE> - the bitwise OR of one or more of
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><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>
@@ -708,19 +715,24 @@ compress</H3>
</DL>
<HR>
<A NAME="setYUVPad(int)"><!-- --></A><H3>
setYUVPad</H3>
<A NAME="encodeYUV(org.libjpegturbo.turbojpeg.YUVImage, int)"><!-- --></A><H3>
encodeYUV</H3>
<PRE>
public void <B>setYUVPad</B>(int&nbsp;pad)
public void <B>encodeYUV</B>(<A HREF="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A>&nbsp;dstImage,
int&nbsp;flags)
throws java.lang.Exception</PRE>
<DL>
<DD>Set the plane padding for subsequent YUV encode operations.
<DD>Encode the uncompressed source image associated with this compressor
instance into a YUV planar image and store it in the given
<code>YUVImage</code> instance. 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. Encoding
CMYK source images to YUV is not supported.
<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>Parameters:</B><DD><CODE>dstImage</CODE> - <A HREF="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><CODE>YUVImage</CODE></A> instance that will receive the YUV planar
image<DD><CODE>flags</CODE> - the bitwise OR of one or more of
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><CODE>TJ.FLAG_*</CODE></A>
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
@@ -730,31 +742,41 @@ public void <B>setYUVPad</B>(int&nbsp;pad)
<A NAME="encodeYUV(byte[], int)"><!-- --></A><H3>
encodeYUV</H3>
<PRE>
public void <B>encodeYUV</B>(byte[]&nbsp;dstBuf,
int&nbsp;flags)
<FONT SIZE="-1">@Deprecated
</FONT>public void <B>encodeYUV</B>(byte[]&nbsp;dstBuf,
int&nbsp;flags)
throws java.lang.Exception</PRE>
<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 but does not execute any of the other steps in the JPEG
compression process. The Y, U (Cb), and V (Cr) 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>
NOTE: Technically, the JPEG format uses the YCbCr colorspace, but per the
convention of the digital video community, the TurboJPEG API uses "YUV" to
refer to an image format consisting of Y, Cb, and Cr image planes.
<DD><B>Deprecated.</B>&nbsp;<I>Use <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(org.libjpegturbo.turbojpeg.YUVImage, int)"><CODE>encodeYUV(YUVImage, int)</CODE></A> instead.</I>
<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, 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>
</DD>
</DL>
<HR>
<A NAME="encodeYUV(int, int)"><!-- --></A><H3>
encodeYUV</H3>
<PRE>
public <A HREF="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A> <B>encodeYUV</B>(int&nbsp;pad,
int&nbsp;flags)
throws java.lang.Exception</PRE>
<DL>
<DD>Encode the uncompressed source image associated with this compressor
instance into a YUV planar image and return a <code>YUVImage</code>
instance containing the encoded image. 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. Encoding
CMYK source images to YUV is not supported.
<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.)<DD><CODE>flags</CODE> - the bitwise OR of one or more of
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><CODE>TJ.FLAG_*</CODE></A>
<DT><B>Returns:</B><DD>a YUV planar image
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
@@ -764,16 +786,14 @@ public void <B>encodeYUV</B>(byte[]&nbsp;dstBuf,
<A NAME="encodeYUV(int)"><!-- --></A><H3>
encodeYUV</H3>
<PRE>
public byte[] <B>encodeYUV</B>(int&nbsp;flags)
<FONT SIZE="-1">@Deprecated
</FONT>public byte[] <B>encodeYUV</B>(int&nbsp;flags)
throws java.lang.Exception</PRE>
<DL>
<DD>Encode the uncompressed source image associated with this compressor
instance and return a buffer containing a YUV planar image. See
<A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[], int)"><CODE>encodeYUV(byte[], int)</CODE></A> for more detail.
<DD><B>Deprecated.</B>&nbsp;<I>Use <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int, int)"><CODE>encodeYUV(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

@@ -142,7 +142,7 @@ TurboJPEG decompressor
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegColorspace">jpegColorspace</A></B></CODE>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#srcColorspace">srcColorspace</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
@@ -150,7 +150,7 @@ TurboJPEG decompressor
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegHeight">jpegHeight</A></B></CODE>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#srcHeight">srcHeight</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
@@ -158,7 +158,7 @@ TurboJPEG decompressor
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegSubsamp">jpegSubsamp</A></B></CODE>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#srcSubsamp">srcSubsamp</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
@@ -166,7 +166,15 @@ TurboJPEG decompressor
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegWidth">jpegWidth</A></B></CODE>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#srcWidth">srcWidth</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;<A HREF="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#yuvImage">yuvImage</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
@@ -191,17 +199,25 @@ TurboJPEG decompressor
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(byte[])">TJDecompressor</A></B>(byte[]&nbsp;jpegImage)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a TurboJPEG decompressor instance and associate the JPEG image
stored in <code>jpegImage</code> with the newly-created instance.</TD>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a TurboJPEG decompressor instance and associate the JPEG source
image stored in <code>jpegImage</code> with the newly created instance.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(byte[], int)">TJDecompressor</A></B>(byte[]&nbsp;jpegImage,
int&nbsp;imageSize)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a TurboJPEG decompressor instance and associate the JPEG image
of length <code>imageSize</code> bytes stored in <code>jpegImage</code>
with the newly-created instance.</TD>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a TurboJPEG decompressor instance and associate the JPEG source
image of length <code>imageSize</code> bytes stored in
<code>jpegImage</code> with the newly created instance.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(org.libjpegturbo.turbojpeg.YUVImage)">TJDecompressor</A></B>(<A HREF="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A>&nbsp;yuvImage)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a TurboJPEG decompressor instance and associate the YUV planar
source image stored in <code>yuvImage</code> with the newly created
instance.</TD>
</TR>
</TABLE>
&nbsp;
@@ -228,9 +244,9 @@ TurboJPEG decompressor
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 decompressed image to the given
<code>BufferedImage</code> instance.</TD>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Decompress the JPEG source image or decode the YUV source image associated
with this decompressor instance and output a decompressed/decoded image to
the given <code>BufferedImage</code> instance.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
@@ -259,8 +275,9 @@ TurboJPEG decompressor
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 decompressed image to the given destination buffer.</TD>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Decompress the JPEG source image or decode the YUV source image associated
with this decompressor instance and output a grayscale, RGB, or CMYK image
to the given destination buffer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
@@ -275,8 +292,9 @@ TurboJPEG decompressor
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 decompressed image to the given destination buffer.</TD>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Decompress the JPEG source image or decode the YUV source image associated
with this decompressor instance and output a grayscale, RGB, or CMYK image
to the given destination buffer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
@@ -287,9 +305,9 @@ TurboJPEG decompressor
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 <code>BufferedImage</code> instance containing the
decompressed image.</TD>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Decompress the JPEG source image or decode the YUV source image associated
with this decompressor instance and return a <code>BufferedImage</code>
instance containing the decompressed/decoded image.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
@@ -311,21 +329,7 @@ TurboJPEG decompressor
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>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>Use <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage, int)"><CODE>decompressToYUV(YUVImage, int)</CODE></A> instead.</I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
@@ -337,7 +341,7 @@ TurboJPEG decompressor
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;byte[]</CODE></FONT></TD>
<CODE>&nbsp;<A HREF="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A></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,
@@ -345,7 +349,19 @@ TurboJPEG decompressor
<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>
instance into a YUV planar image and return a <code>YUVImage</code>
instance containing the decompressed image.</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(org.libjpegturbo.turbojpeg.YUVImage, int)">decompressToYUV</A></B>(<A HREF="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A>&nbsp;dstImage,
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 into a YUV planar image and store it in the given
<code>YUVImage</code> instance.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
@@ -361,8 +377,8 @@ TurboJPEG decompressor
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getColorspace()">getColorspace</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the colorspace used in the JPEG image associated with this
decompressor instance.</TD>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the colorspace used in the source image (JPEG or YUV) associated
with this decompressor instance.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
@@ -370,8 +386,8 @@ TurboJPEG decompressor
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getHeight()">getHeight</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the height of the JPEG image associated with this decompressor
instance.</TD>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the height of the source image (JPEG or YUV) associated with this
decompressor instance.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
@@ -379,7 +395,7 @@ TurboJPEG decompressor
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGBuf()">getJPEGBuf</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the JPEG image buffer associated with this decompressor instance.</TD>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>Use <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSourceBuf()"><CODE>getSourceBuf()</CODE></A> instead.</I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
@@ -387,8 +403,7 @@ TurboJPEG decompressor
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGSize()">getJPEGSize</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the size of the JPEG image (in bytes) associated with this
decompressor instance.</TD>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>Use <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSourceSize()"><CODE>getSourceSize()</CODE></A> instead.</I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
@@ -414,12 +429,30 @@ TurboJPEG decompressor
</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#getSourceBuf()">getSourceBuf</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the source image buffer associated with this decompressor
instance.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSourceSize()">getSourceSize</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the size of the source image (in bytes) associated with this
decompressor instance.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSubsamp()">getSubsamp</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the level of chrominance subsampling used in the JPEG image
associated with this decompressor instance.</TD>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the level of chrominance subsampling used in the source image
(JPEG or YUV) associated with this decompressor instance.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
@@ -427,8 +460,8 @@ TurboJPEG decompressor
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getWidth()">getWidth</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the width of the JPEG image associated with this decompressor
instance.</TD>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the width of the source image (JPEG or YUV) associated with this
decompressor instance.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
@@ -436,9 +469,27 @@ TurboJPEG decompressor
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGImage(byte[], int)">setJPEGImage</A></B>(byte[]&nbsp;jpegImage,
int&nbsp;imageSize)</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#setSourceImage(byte[], int)"><CODE>setSourceImage(byte[], 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#setSourceImage(byte[], int)">setSourceImage</A></B>(byte[]&nbsp;srcImage,
int&nbsp;imageSize)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Associate the JPEG image of length <code>imageSize</code> bytes stored in
<code>jpegImage</code> with this decompressor instance.</TD>
<code>srcImage</code> with this decompressor instance.</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#setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)">setSourceImage</A></B>(<A HREF="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A>&nbsp;srcImage)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Associate the specified YUV planar source image with this decompressor
instance.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
@@ -493,40 +544,50 @@ protected int <B>jpegBufSize</B></PRE>
</DL>
<HR>
<A NAME="jpegWidth"><!-- --></A><H3>
jpegWidth</H3>
<A NAME="yuvImage"><!-- --></A><H3>
yuvImage</H3>
<PRE>
protected int <B>jpegWidth</B></PRE>
protected <A HREF="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A> <B>yuvImage</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="jpegHeight"><!-- --></A><H3>
jpegHeight</H3>
<A NAME="srcWidth"><!-- --></A><H3>
srcWidth</H3>
<PRE>
protected int <B>jpegHeight</B></PRE>
protected int <B>srcWidth</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="jpegSubsamp"><!-- --></A><H3>
jpegSubsamp</H3>
<A NAME="srcHeight"><!-- --></A><H3>
srcHeight</H3>
<PRE>
protected int <B>jpegSubsamp</B></PRE>
protected int <B>srcHeight</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="jpegColorspace"><!-- --></A><H3>
jpegColorspace</H3>
<A NAME="srcSubsamp"><!-- --></A><H3>
srcSubsamp</H3>
<PRE>
protected int <B>jpegColorspace</B></PRE>
protected int <B>srcSubsamp</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="srcColorspace"><!-- --></A><H3>
srcColorspace</H3>
<PRE>
protected int <B>srcColorspace</B></PRE>
<DL>
<DL>
</DL>
@@ -563,8 +624,8 @@ TJDecompressor</H3>
public <B>TJDecompressor</B>(byte[]&nbsp;jpegImage)
throws java.lang.Exception</PRE>
<DL>
<DD>Create a TurboJPEG decompressor instance and associate the JPEG image
stored in <code>jpegImage</code> with the newly-created instance.
<DD>Create a TurboJPEG decompressor instance and associate the JPEG source
image stored in <code>jpegImage</code> with the newly created instance.
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>jpegImage</CODE> - JPEG image buffer (size of the JPEG image is assumed to
@@ -581,15 +642,33 @@ public <B>TJDecompressor</B>(byte[]&nbsp;jpegImage,
int&nbsp;imageSize)
throws java.lang.Exception</PRE>
<DL>
<DD>Create a TurboJPEG decompressor instance and associate the JPEG image
of length <code>imageSize</code> bytes stored in <code>jpegImage</code>
with the newly-created instance.
<DD>Create a TurboJPEG decompressor instance and associate the JPEG source
image of length <code>imageSize</code> bytes stored in
<code>jpegImage</code> with the newly created instance.
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>jpegImage</CODE> - JPEG image buffer<DD><CODE>imageSize</CODE> - size of the JPEG image (in bytes)
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DL>
<HR>
<A NAME="TJDecompressor(org.libjpegturbo.turbojpeg.YUVImage)"><!-- --></A><H3>
TJDecompressor</H3>
<PRE>
public <B>TJDecompressor</B>(<A HREF="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A>&nbsp;yuvImage)
throws java.lang.Exception</PRE>
<DL>
<DD>Create a TurboJPEG decompressor instance and associate the YUV planar
source image stored in <code>yuvImage</code> with the newly created
instance.
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>yuvImage</CODE> - <A HREF="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><CODE>YUVImage</CODE></A> instance containing a YUV planar
image to be decoded
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
@@ -601,19 +680,56 @@ public <B>TJDecompressor</B>(byte[]&nbsp;jpegImage,
</TR>
</TABLE>
<A NAME="setJPEGImage(byte[], int)"><!-- --></A><H3>
setJPEGImage</H3>
<A NAME="setSourceImage(byte[], int)"><!-- --></A><H3>
setSourceImage</H3>
<PRE>
public void <B>setJPEGImage</B>(byte[]&nbsp;jpegImage,
int&nbsp;imageSize)
throws java.lang.Exception</PRE>
public void <B>setSourceImage</B>(byte[]&nbsp;srcImage,
int&nbsp;imageSize)
throws java.lang.Exception</PRE>
<DL>
<DD>Associate the JPEG image of length <code>imageSize</code> bytes stored in
<code>jpegImage</code> with this decompressor instance. This image will
<code>srcImage</code> with this decompressor instance. This image will
be used as the source image for subsequent decompress operations.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>jpegImage</CODE> - JPEG image buffer<DD><CODE>imageSize</CODE> - size of the JPEG image (in bytes)
<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - JPEG image buffer<DD><CODE>imageSize</CODE> - size of the JPEG image (in bytes)
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="setJPEGImage(byte[], int)"><!-- --></A><H3>
setJPEGImage</H3>
<PRE>
<FONT SIZE="-1">@Deprecated
</FONT>public void <B>setJPEGImage</B>(byte[]&nbsp;jpegImage,
int&nbsp;imageSize)
throws java.lang.Exception</PRE>
<DL>
<DD><B>Deprecated.</B>&nbsp;<I>Use <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte[], int)"><CODE>setSourceImage(byte[], int)</CODE></A> instead.</I>
<P>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)"><!-- --></A><H3>
setSourceImage</H3>
<PRE>
public void <B>setSourceImage</B>(<A HREF="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A>&nbsp;srcImage)
throws java.lang.Exception</PRE>
<DL>
<DD>Associate the specified YUV planar source image with this decompressor
instance. Subsequent decompress operations will decode this image into an
RGB or grayscale destination image.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - <A HREF="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><CODE>YUVImage</CODE></A> instance containing a YUV planar image to
be decoded
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
@@ -626,13 +742,13 @@ getWidth</H3>
public int <B>getWidth</B>()
throws java.lang.Exception</PRE>
<DL>
<DD>Returns the width of the JPEG image associated with this decompressor
instance.
<DD>Returns the width of the source image (JPEG or YUV) associated with this
decompressor instance.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the width of the JPEG image associated with this decompressor
instance
<DT><B>Returns:</B><DD>the width of the source image (JPEG or YUV) associated with this
decompressor instance
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
@@ -645,13 +761,13 @@ getHeight</H3>
public int <B>getHeight</B>()
throws java.lang.Exception</PRE>
<DL>
<DD>Returns the height of the JPEG image associated with this decompressor
instance.
<DD>Returns the height of the source image (JPEG or YUV) associated with this
decompressor instance.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the height of the JPEG image associated with this decompressor
instance
<DT><B>Returns:</B><DD>the height of the source image (JPEG or YUV) associated with this
decompressor instance
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
@@ -664,13 +780,14 @@ getSubsamp</H3>
public int <B>getSubsamp</B>()
throws java.lang.Exception</PRE>
<DL>
<DD>Returns the level of chrominance subsampling 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.SAMP_*</CODE></A>.
<DD>Returns the level of chrominance subsampling used in the source image
(JPEG or YUV) associated with this decompressor instance. See
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><CODE>TJ.SAMP_*</CODE></A>.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the level of chrominance subsampling used in the JPEG image
associated with this decompressor instance
<DT><B>Returns:</B><DD>the level of chrominance subsampling used in the source image
(JPEG or YUV) associated with this decompressor instance
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
@@ -683,13 +800,32 @@ getColorspace</H3>
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>.
<DD>Returns the colorspace used in the source image (JPEG or YUV) associated
with this decompressor instance. See <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#CS_RGB"><CODE>TJ.CS_*</CODE></A>. If the
source image is YUV, then this always returns <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#CS_YCbCr"><CODE>TJ.CS_YCbCr</CODE></A>.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the colorspace used in the JPEG image associated with this
decompressor instance
<DT><B>Returns:</B><DD>the colorspace used in the source image (JPEG or YUV) associated
with this decompressor instance
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="getSourceBuf()"><!-- --></A><H3>
getSourceBuf</H3>
<PRE>
public byte[] <B>getSourceBuf</B>()
throws java.lang.Exception</PRE>
<DL>
<DD>Returns the source image buffer associated with this decompressor
instance.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the source image buffer associated with this decompressor instance
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
@@ -699,14 +835,33 @@ public int <B>getColorspace</B>()
<A NAME="getJPEGBuf()"><!-- --></A><H3>
getJPEGBuf</H3>
<PRE>
public byte[] <B>getJPEGBuf</B>()
<FONT SIZE="-1">@Deprecated
</FONT>public byte[] <B>getJPEGBuf</B>()
throws java.lang.Exception</PRE>
<DL>
<DD>Returns the JPEG image buffer associated with this decompressor instance.
<DD><B>Deprecated.</B>&nbsp;<I>Use <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSourceBuf()"><CODE>getSourceBuf()</CODE></A> instead.</I>
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the JPEG image buffer associated with this decompressor instance
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="getSourceSize()"><!-- --></A><H3>
getSourceSize</H3>
<PRE>
public int <B>getSourceSize</B>()
throws java.lang.Exception</PRE>
<DL>
<DD>Returns the size of the source image (in bytes) associated with this
decompressor instance.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the size of the source image (in bytes) associated with this
decompressor instance
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
@@ -716,16 +871,14 @@ public byte[] <B>getJPEGBuf</B>()
<A NAME="getJPEGSize()"><!-- --></A><H3>
getJPEGSize</H3>
<PRE>
public int <B>getJPEGSize</B>()
<FONT SIZE="-1">@Deprecated
</FONT>public int <B>getJPEGSize</B>()
throws java.lang.Exception</PRE>
<DL>
<DD>Returns the size of the JPEG image (in bytes) associated with this
decompressor instance.
<DD><B>Deprecated.</B>&nbsp;<I>Use <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSourceSize()"><CODE>getSourceSize()</CODE></A> instead.</I>
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the size of the JPEG image (in bytes) associated with this
decompressor instance
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
@@ -801,43 +954,54 @@ public void <B>decompress</B>(byte[]&nbsp;dstBuf,
int&nbsp;flags)
throws java.lang.Exception</PRE>
<DL>
<DD>Decompress the JPEG source image associated with this decompressor
instance and output a decompressed image to the given destination buffer.
<DD>Decompress the JPEG source image or decode the YUV source image associated
with this decompressor instance and output a grayscale, RGB, or CMYK image
to the given destination buffer.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>dstBuf</CODE> - buffer that will receive the decompressed image. This
buffer should normally be <code>pitch * scaledHeight</code> bytes in size,
where <code>scaledHeight</code> can be determined by calling <code>
<DT><B>Parameters:</B><DD><CODE>dstBuf</CODE> - buffer that will receive the decompressed/decoded image.
If the source image is a JPEG image, then this buffer should normally be
<code>pitch * scaledHeight</code> bytes in size, where
<code>scaledHeight</code> can be determined by calling <code>
scalingFactor.<A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><CODE>getScaled</CODE></A>(jpegHeight)
</code> with one of the scaling factors returned from <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()"><CODE>TJ.getScalingFactors()</CODE></A> or by calling <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int, int)"><CODE>getScaledHeight(int, int)</CODE></A>. However,
the buffer may also be larger than the dimensions of the JPEG image, in
which case the <code>x</code>, <code>y</code>, and <code>pitch</code>
parameters can be used to specify the region into which the JPEG image
should be decompressed.<DD><CODE>x</CODE> - x offset (in pixels) of the region into which the JPEG image
should be decompressed, relative to the start of <code>dstBuf</code>.<DD><CODE>y</CODE> - y offset (in pixels) of the region into which the JPEG image
should be decompressed, relative to the start of <code>dstBuf</code>.<DD><CODE>desiredWidth</CODE> - desired width (in pixels) of the decompressed image
(or image region.) 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>pitch</CODE> - bytes per line of the destination image. Normally, this
</code> with one of the scaling factors returned from <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()"><CODE>TJ.getScalingFactors()</CODE></A> or by calling <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int, int)"><CODE>getScaledHeight(int, int)</CODE></A>. If the
source image is a YUV image, then this buffer should normally be
<code>pitch * height</code> bytes in size, where <code>height</code> is
the height of the YUV image. However, the buffer may also be larger than
the dimensions of the source image, in which case the <code>x</code>,
<code>y</code>, and <code>pitch</code> parameters can be used to specify
the region into which the source image should be decompressed/decoded.<DD><CODE>x</CODE> - x offset (in pixels) of the region in the destination image into
which the source image should be decompressed/decoded<DD><CODE>y</CODE> - y offset (in pixels) of the region in the destination image into
which the source image should be decompressed/decoded<DD><CODE>desiredWidth</CODE> - If the source image is a JPEG image, then this
specifies the desired width (in pixels) of the decompressed image (or
image region.) If the desired destination image dimensions are different
than the source image dimensions, 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.) This parameter is
ignored if the source image is a YUV image.<DD><CODE>pitch</CODE> - bytes per line of the destination image. Normally, this
should be set to <code>scaledWidth * TJ.pixelSize(pixelFormat)</code> if
the decompressed image is unpadded, but you can use this to, for instance,
pad each line of the decompressed image to a 4-byte boundary or to
decompress the JPEG image into a region of a larger image. NOTE:
<code>scaledWidth</code> can be determined by calling <code>
the destination image is unpadded, but you can use this to, for instance,
pad each line of the destination image to a 4-byte boundary or to
decompress/decode the source image into a region of a larger image. NOTE:
if the source image is a JPEG image, then <code>scaledWidth</code> can be
determined by calling <code>
scalingFactor.<A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><CODE>getScaled</CODE></A>(jpegWidth)
</code> or by calling <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int, int)"><CODE>getScaledWidth(int, int)</CODE></A>. Setting this parameter to
0 is the equivalent of setting it to <code>scaledWidth *
TJ.pixelSize(pixelFormat)</code>.<DD><CODE>desiredHeight</CODE> - desired height (in pixels) of the decompressed image
(or image region.) 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>pixelFormat</CODE> - pixel format of the decompressed image (one of
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.PF_*</CODE></A>)<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>
</code> or by calling <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int, int)"><CODE>getScaledWidth(int, int)</CODE></A>. If the source image is a
YUV image, then <code>scaledWidth</code> is the width of the YUV image.
Setting this parameter to 0 is the equivalent of setting it to
<code>scaledWidth * TJ.pixelSize(pixelFormat)</code>.<DD><CODE>desiredHeight</CODE> - If the source image is a JPEG image, then this
specifies the desired height (in pixels) of the decompressed image (or
image region.) If the desired destination image dimensions are different
than the source image dimensions, 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.) This parameter is
ignored if the source image is a YUV image.<DD><CODE>pixelFormat</CODE> - pixel format of the decompressed/decoded image (one of
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB"><CODE>TJ.PF_*</CODE></A>)<DD><CODE>flags</CODE> - the bitwise OR of one or more of
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><CODE>TJ.FLAG_*</CODE></A>
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
@@ -888,7 +1052,8 @@ public byte[] <B>decompress</B>(int&nbsp;desiredWidth,
for description<DD><CODE>desiredHeight</CODE> - see
<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int, int, int)"><CODE>decompress(byte[], int, int, int, int, int, int, int)</CODE></A>
for description<DD><CODE>pixelFormat</CODE> - pixel format of the decompressed image (one of
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.PF_*</CODE></A>)<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#PF_RGB"><CODE>TJ.PF_*</CODE></A>)<DD><CODE>flags</CODE> - the bitwise OR of one or more of
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><CODE>TJ.FLAG_*</CODE></A>
<DT><B>Returns:</B><DD>a buffer containing the decompressed image
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
@@ -896,48 +1061,28 @@ public byte[] <B>decompress</B>(int&nbsp;desiredWidth,
</DL>
<HR>
<A NAME="decompressToYUV(byte[], int, int, int, int)"><!-- --></A><H3>
<A NAME="decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage, int)"><!-- --></A><H3>
decompressToYUV</H3>
<PRE>
public void <B>decompressToYUV</B>(byte[]&nbsp;dstBuf,
int&nbsp;desiredWidth,
int&nbsp;pad,
int&nbsp;desiredHeight,
public void <B>decompressToYUV</B>(<A HREF="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A>&nbsp;dstImage,
int&nbsp;flags)
throws java.lang.Exception</PRE>
<DL>
<DD>Decompress the JPEG source image associated with this decompressor
instance and output a YUV planar image to the given destination buffer.
This method performs JPEG decompression but leaves out the color
conversion step, so a planar YUV image is generated instead of an RGB
image. The padding of the planes in this image is the same as in the
images generated by <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[], int)"><CODE>TJCompressor.encodeYUV(byte[], int)</CODE></A>. Note
that, if the width or height of the image is not an even multiple of the
MCU block size (see <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getMCUWidth(int)"><CODE>TJ.getMCUWidth(int)</CODE></A> and <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getMCUHeight(int)"><CODE>TJ.getMCUHeight(int)</CODE></A>),
then an intermediate buffer copy will be performed within TurboJPEG.
<p>
NOTE: Technically, the JPEG format uses the YCbCr colorspace, but per the
convention of the digital video community, the TurboJPEG API uses "YUV" to
refer to an image format consisting of Y, Cb, and Cr image planes.
instance into a YUV planar image and store it in the given
<code>YUVImage</code> instance. This method performs JPEG decompression
but leaves out the color conversion step, so a planar YUV image is
generated instead of an RGB or grayscale image. This method cannot be
used to decompress JPEG source images with the CMYK or YCCK colorspace.
<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, 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>Parameters:</B><DD><CODE>dstImage</CODE> - <A HREF="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><CODE>YUVImage</CODE></A> instance that will receive the YUV planar
image. The level of subsampling specified in this <code>YUVImage</code>
instance must match that of the JPEG image, and the width and height
specified in the <code>YUVImage</code> instance must match one of the
scaled image sizes that TurboJPEG is capable of generating from the JPEG
source image.<DD><CODE>flags</CODE> - the bitwise OR of one or more of
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><CODE>TJ.FLAG_*</CODE></A>
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
@@ -952,8 +1097,7 @@ decompressToYUV</H3>
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>
<DD><B>Deprecated.</B>&nbsp;<I>Use <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage, int)"><CODE>decompressToYUV(YUVImage, int)</CODE></A> instead.</I>
<P>
<DD><DL>
@@ -966,20 +1110,38 @@ decompressToYUV</H3>
<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>
public <A HREF="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A> <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.
instance into a YUV planar image and return a <code>YUVImage</code>
instance containing the decompressed image. This method performs JPEG
decompression but leaves out the color conversion step, so a planar YUV
image is generated instead of an RGB or grayscale image. This method
cannot be used to decompress JPEG source images with the CMYK or YCCK
colorspace.
<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>Parameters:</B><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#FLAG_BOTTOMUP"><CODE>TJ.FLAG_*</CODE></A>
<DT><B>Returns:</B><DD>a YUV planar image
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
@@ -1016,40 +1178,52 @@ public void <B>decompress</B>(int[]&nbsp;dstBuf,
int&nbsp;flags)
throws java.lang.Exception</PRE>
<DL>
<DD>Decompress the JPEG source image associated with this decompressor
instance and output a decompressed image to the given destination buffer.
<DD>Decompress the JPEG source image or decode the YUV source image associated
with this decompressor instance and output a grayscale, RGB, or CMYK image
to the given destination buffer.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>dstBuf</CODE> - buffer that will receive the decompressed image. This
buffer should normally be <code>stride * scaledHeight</code> pixels in
size, where <code>scaledHeight</code> can be determined by calling <code>
<DT><B>Parameters:</B><DD><CODE>dstBuf</CODE> - buffer that will receive the decompressed/decoded image.
If the source image is a JPEG image, then this buffer should normally be
<code>stride * scaledHeight</code> pixels in size, where
<code>scaledHeight</code> can be determined by calling <code>
scalingFactor.<A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><CODE>getScaled</CODE></A>(jpegHeight)
</code> with one of the scaling factors returned from <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()"><CODE>TJ.getScalingFactors()</CODE></A> or by calling <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int, int)"><CODE>getScaledHeight(int, int)</CODE></A>. However,
the buffer may also be larger than the dimensions of the JPEG image, in
which case the <code>x</code>, <code>y</code>, and <code>stride</code>
parameters can be used to specify the region into which the JPEG image
should be decompressed.<DD><CODE>x</CODE> - x offset (in pixels) of the region into which the JPEG image
should be decompressed, relative to the start of <code>dstBuf</code>.<DD><CODE>y</CODE> - y offset (in pixels) of the region into which the JPEG image
should be decompressed, relative to the start of <code>dstBuf</code>.<DD><CODE>desiredWidth</CODE> - desired width (in pixels) of the decompressed image
(or image region.) 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>stride</CODE> - pixels per line of the destination image. Normally, this
</code> with one of the scaling factors returned from <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()"><CODE>TJ.getScalingFactors()</CODE></A> or by calling <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int, int)"><CODE>getScaledHeight(int, int)</CODE></A>. If the
source image is a YUV image, then this buffer should normally be
<code>stride * height</code> pixels in size, where <code>height</code> is
the height of the YUV image. However, the buffer may also be larger than
the dimensions of the JPEG image, in which case the <code>x</code>,
<code>y</code>, and <code>stride</code> parameters can be used to specify
the region into which the source image should be decompressed.<DD><CODE>x</CODE> - x offset (in pixels) of the region in the destination image into
which the source image should be decompressed/decoded<DD><CODE>y</CODE> - y offset (in pixels) of the region in the destination image into
which the source image should be decompressed/decoded<DD><CODE>desiredWidth</CODE> - If the source image is a JPEG image, then this
specifies the desired width (in pixels) of the decompressed image (or
image region.) If the desired destination image dimensions are different
than the source image dimensions, 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.) This parameter is
ignored if the source image is a YUV image.<DD><CODE>stride</CODE> - pixels per line of the destination image. Normally, this
should be set to <code>scaledWidth</code>, but you can use this to, for
instance, decompress the JPEG image into a region of a larger image.
NOTE: <code>scaledWidth</code> can be determined by calling <code>
NOTE: if the source image is a JPEG image, then <code>scaledWidth</code>
can be determined by calling <code>
scalingFactor.<A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><CODE>getScaled</CODE></A>(jpegWidth)
</code> or by calling <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int, int)"><CODE>getScaledWidth(int, int)</CODE></A>. Setting this parameter to
0 is the equivalent of setting it to <code>scaledWidth</code>.<DD><CODE>desiredHeight</CODE> - desired height (in pixels) of the decompressed image
(or image region.) 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>pixelFormat</CODE> - pixel format of the decompressed image (one of
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.PF_*</CODE></A>)<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>
</code> or by calling <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int, int)"><CODE>getScaledWidth(int, int)</CODE></A>. If the source image is a
YUV image, then <code>scaledWidth</code> is the width of the YUV image.
Setting this parameter to 0 is the equivalent of setting it to
<code>scaledWidth</code>.<DD><CODE>desiredHeight</CODE> - If the source image is a JPEG image, then this
specifies the desired height (in pixels) of the decompressed image (or
image region.) If the desired destination image dimensions are different
than the source image dimensions, 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.) This parameter is
ignored if the source image is a YUV image.<DD><CODE>pixelFormat</CODE> - pixel format of the decompressed image (one of
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB"><CODE>TJ.PF_*</CODE></A>)<DD><CODE>flags</CODE> - the bitwise OR of one or more of
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><CODE>TJ.FLAG_*</CODE></A>
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
@@ -1063,13 +1237,19 @@ public void <B>decompress</B>(java.awt.image.BufferedImage&nbsp;dstImage,
int&nbsp;flags)
throws java.lang.Exception</PRE>
<DL>
<DD>Decompress the JPEG source image associated with this decompressor
instance and output a decompressed image to the given
<code>BufferedImage</code> instance.
<DD>Decompress the JPEG source image or decode the YUV source image associated
with this decompressor instance and output a decompressed/decoded image to
the given <code>BufferedImage</code> instance.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>dstImage</CODE> - a <code>BufferedImage</code> instance that will receive
the decompressed image<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>
the decompressed/decoded image. If the source image is a JPEG image, then
the width and height of the <code>BufferedImage</code> instance must match
one of the scaled image sizes that TurboJPEG is capable of generating from
the JPEG image. If the source image is a YUV image, then the width and
height of the <code>BufferedImage</code> instance must match the width and
height of the YUV image.<DD><CODE>flags</CODE> - the bitwise OR of one or more of
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><CODE>TJ.FLAG_*</CODE></A>
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
@@ -1085,20 +1265,21 @@ public java.awt.image.BufferedImage <B>decompress</B>(int&nbsp;desiredWidth,
int&nbsp;flags)
throws java.lang.Exception</PRE>
<DL>
<DD>Decompress the JPEG source image associated with this decompressor
instance and return a <code>BufferedImage</code> instance containing the
decompressed image.
<DD>Decompress the JPEG source image or decode the YUV source image associated
with this decompressor instance and return a <code>BufferedImage</code>
instance containing the decompressed/decoded image.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>desiredWidth</CODE> - see
<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int, int, int)"><CODE>decompress(byte[], int, int, int, int, int, int, int)</CODE></A> for
description<DD><CODE>desiredHeight</CODE> - see
<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int, int, int)"><CODE>decompress(byte[], int, int, int, int, int, int, int)</CODE></A> for
description<DD><CODE>bufferedImageType</CODE> - the image type of the newly-created
<code>BufferedImage</code> instance (for instance,
<code>BufferedImage.TYPE_INT_RGB</code>)<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>
description<DD><CODE>bufferedImageType</CODE> - the image type of the <code>BufferedImage</code>
instance that will be created (for instance,
<code>BufferedImage.TYPE_INT_RGB</code>)<DD><CODE>flags</CODE> - the bitwise OR of one or more of
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><CODE>TJ.FLAG_*</CODE></A>
<DT><B>Returns:</B><DD>a <code>BufferedImage</code> instance containing the
decompressed image
decompressed/decoded image
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>

View File

@@ -52,7 +52,7 @@ function windowTitle()
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><B>PREV CLASS</B></A>&nbsp;
&nbsp;NEXT CLASS</FONT></TD>
&nbsp;<A HREF="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?org/libjpegturbo/turbojpeg/TJTransformer.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="TJTransformer.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
@@ -120,7 +120,7 @@ TurboJPEG lossless transformer
<TH ALIGN="left"><B>Fields 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#handle">handle</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegBuf">jpegBuf</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegBufSize">jpegBufSize</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegColorspace">jpegColorspace</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegHeight">jpegHeight</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegSubsamp">jpegSubsamp</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegWidth">jpegWidth</A></CODE></TD>
<TD><CODE><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#handle">handle</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegBuf">jpegBuf</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegBufSize">jpegBufSize</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#srcColorspace">srcColorspace</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#srcHeight">srcHeight</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#srcSubsamp">srcSubsamp</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#srcWidth">srcWidth</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#yuvImage">yuvImage</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
@@ -143,7 +143,7 @@ TurboJPEG lossless transformer
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a TurboJPEG lossless transformer instance and associate the JPEG
image stored in <code>jpegImage</code> with the newly-created instance.</TD>
image stored in <code>jpegImage</code> with the newly created instance.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#TJTransformer(byte[], int)">TJTransformer</A></B>(byte[]&nbsp;jpegImage,
@@ -152,7 +152,7 @@ TurboJPEG lossless transformer
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a TurboJPEG lossless transformer instance and associate the JPEG
image of length <code>imageSize</code> bytes stored in
<code>jpegImage</code> with the newly-created instance.</TD>
<code>jpegImage</code> with the newly created instance.</TD>
</TR>
</TABLE>
&nbsp;
@@ -170,8 +170,8 @@ TurboJPEG lossless transformer
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#getTransformedSizes()">getTransformedSizes</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an array containing the sizes of the transformed JPEG images from
the most recent call to <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)"><CODE>transform()</CODE></A>.</TD>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an array containing the sizes of the transformed JPEG images
generated by the most recent transform operation.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
@@ -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>
</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(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>
<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#decompressToYUV(int, int, int, int)">decompressToYUV</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage, 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#getSourceBuf()">getSourceBuf</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSourceSize()">getSourceSize</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>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte[], int)">setSourceImage</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)">setSourceImage</A></CODE></TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
@@ -250,7 +250,7 @@ public <B>TJTransformer</B>(byte[]&nbsp;jpegImage)
throws java.lang.Exception</PRE>
<DL>
<DD>Create a TurboJPEG lossless transformer instance and associate the JPEG
image stored in <code>jpegImage</code> with the newly-created instance.
image stored in <code>jpegImage</code> with the newly created instance.
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>jpegImage</CODE> - JPEG image buffer (size of the JPEG image is assumed to
@@ -269,7 +269,7 @@ public <B>TJTransformer</B>(byte[]&nbsp;jpegImage,
<DL>
<DD>Create a TurboJPEG lossless transformer instance and associate the JPEG
image of length <code>imageSize</code> bytes stored in
<code>jpegImage</code> with the newly-created instance.
<code>jpegImage</code> with the newly created instance.
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>jpegImage</CODE> - JPEG image buffer<DD><CODE>imageSize</CODE> - size of the JPEG image (in bytes)
@@ -313,9 +313,10 @@ public void <B>transform</B>(byte[][]&nbsp;dstBufs,
receive a JPEG image that has been transformed using the parameters in
<code>transforms[i]</code>. 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 each buffer based on the transformed or cropped width and
height.<DD><CODE>transforms</CODE> - an array of <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJTransform</CODE></A> instances, each of
height and the level of subsampling used in the source image.<DD><CODE>transforms</CODE> - an array of <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJTransform</CODE></A> instances, each of
which specifies the transform parameters and/or cropping region for the
corresponding transformed output image<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>
corresponding transformed output image<DD><CODE>flags</CODE> - the bitwise OR of one or more of
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><CODE>TJ.FLAG_*</CODE></A>
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
@@ -336,7 +337,8 @@ public <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>transforms</CODE> - an array of <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJTransform</CODE></A> instances, each of
which specifies the transform parameters and/or cropping region for the
corresponding transformed output image<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>
corresponding transformed output image<DD><CODE>flags</CODE> - the bitwise OR of one or more of
<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><CODE>TJ.FLAG_*</CODE></A>
<DT><B>Returns:</B><DD>an array of <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJDecompressor</CODE></A> instances, each of
which has a transformed JPEG image associated with it
<DT><B>Throws:</B>
@@ -351,13 +353,13 @@ getTransformedSizes</H3>
public int[] <B>getTransformedSizes</B>()
throws java.lang.Exception</PRE>
<DL>
<DD>Returns an array containing the sizes of the transformed JPEG images from
the most recent call to <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)"><CODE>transform()</CODE></A>.
<DD>Returns an array containing the sizes of the transformed JPEG images
generated by the most recent transform operation.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>an array containing the sizes of the transformed JPEG images from
the most recent call to <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)"><CODE>transform()</CODE></A>
<DT><B>Returns:</B><DD>an array containing the sizes of the transformed JPEG images
generated by the most recent transform operation
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
@@ -392,7 +394,7 @@ public int[] <B>getTransformedSizes</B>()
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><B>PREV CLASS</B></A>&nbsp;
&nbsp;NEXT CLASS</FONT></TD>
&nbsp;<A HREF="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?org/libjpegturbo/turbojpeg/TJTransformer.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="TJTransformer.html" target="_top"><B>NO FRAMES</B></A> &nbsp;

View File

@@ -42,7 +42,9 @@ Classes</FONT>&nbsp;
<BR>
<A HREF="TJTransform.html" title="class in org.libjpegturbo.turbojpeg" target="classFrame">TJTransform</A>
<BR>
<A HREF="TJTransformer.html" title="class in org.libjpegturbo.turbojpeg" target="classFrame">TJTransformer</A></FONT></TD>
<A HREF="TJTransformer.html" title="class in org.libjpegturbo.turbojpeg" target="classFrame">TJTransformer</A>
<BR>
<A HREF="YUVImage.html" title="class in org.libjpegturbo.turbojpeg" target="classFrame">YUVImage</A></FONT></TD>
</TR>
</TABLE>

View File

@@ -122,6 +122,11 @@ Package org.libjpegturbo.turbojpeg
<TD WIDTH="15%"><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</A></B></TD>
<TD>TurboJPEG lossless transformer</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</A></B></TD>
<TD>This class encapsulates a YUV planar image buffer and the metadata
associated with it.</TD>
</TR>
</TABLE>
&nbsp;

View File

@@ -95,7 +95,7 @@ Class Hierarchy
</UL>
<LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><B>TJ</B></A><LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg"><B>TJCompressor</B></A><LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><B>TJDecompressor</B></A><UL>
<LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="../../../org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg"><B>TJTransformer</B></A></UL>
<LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg"><B>TJScalingFactor</B></A></UL>
<LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg"><B>TJScalingFactor</B></A><LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><B>YUVImage</B></A></UL>
</UL>
<H2>
Interface Hierarchy

View File

@@ -97,7 +97,7 @@ Class Hierarchy
</UL>
<LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><B>TJ</B></A><LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg"><B>TJCompressor</B></A><LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><B>TJDecompressor</B></A><UL>
<LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg"><B>TJTransformer</B></A></UL>
<LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg"><B>TJScalingFactor</B></A></UL>
<LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg"><B>TJScalingFactor</B></A><LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><B>YUVImage</B></A></UL>
</UL>
<H2>
Interface Hierarchy

View File

@@ -46,19 +46,9 @@ public class TJCompressor {
init();
}
/**
* @deprecated Use
* {@link #TJCompressor(byte[], int, int, int, int, int, int)} instead.
*/
@Deprecated
public TJCompressor(byte[] srcImage, int width, int pitch, int height,
int pixelFormat) throws Exception {
setSourceImage(srcImage, width, pitch, height, pixelFormat);
}
/**
* 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.
*
* @param srcImage see {@link #setSourceImage} for description
@@ -74,16 +64,26 @@ public class TJCompressor {
* @param height see {@link #setSourceImage} for description
*
* @param pixelFormat pixel format of the source image (one of
* {@link TJ TJ.PF_*})
* {@link TJ#PF_RGB TJ.PF_*})
*/
public TJCompressor(byte[] srcImage, int x, int y, int width, int pitch,
int height, int pixelFormat) throws Exception {
setSourceImage(srcImage, x, y, width, pitch, height, pixelFormat);
}
/**
* @deprecated Use
* {@link #TJCompressor(byte[], int, int, int, int, int, int)} instead.
*/
@Deprecated
public TJCompressor(byte[] srcImage, int width, int pitch, int height,
int pixelFormat) throws Exception {
setSourceImage(srcImage, width, pitch, height, pixelFormat);
}
/**
* 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.
*
* @param srcImage see
@@ -107,34 +107,35 @@ public class TJCompressor {
}
/**
* Associate an uncompressed source image with this compressor instance.
* Associate an uncompressed RGB, grayscale, or CMYK source image with this
* compressor instance.
*
* @param srcImage image buffer containing RGB, grayscale, or CMYK pixels to
* be compressed
* be compressed or encoded
*
* @param x x offset (in pixels) of the region from which the JPEG image
* should be compressed, relative to the start of <code>srcImage</code>.
* @param x x offset (in pixels) of the region in the source image from which
* the JPEG or YUV image should be compressed/encoded
*
* @param y y offset (in pixels) of the region from which the JPEG image
* should be compressed, relative to the start of <code>srcImage</code>.
* @param y y offset (in pixels) of the region in the source image from which
* the JPEG or YUV image should be compressed/encoded
*
* @param width width (in pixels) of the region in the source image from
* which the JPEG image should be compressed.
* which the JPEG or YUV image should be compressed/encoded
*
* @param pitch bytes per line of the source image. Normally, this should be
* <code>width * TJ.pixelSize(pixelFormat)</code> if the source image is
* unpadded, but you can use this parameter to, for instance, specify that
* the scanlines in the source image are padded to a 4-byte boundary or to
* compress a JPEG image from a region of a larger source image. You can
* also be clever and use this parameter to skip lines, etc. Setting this
* parameter to 0 is the equivalent of setting it to <code>width *
* TJ.pixelSize(pixelFormat)</code>.
* compress/encode a JPEG or YUV image from a region of a larger source
* image. You can also be clever and use this parameter to skip lines, etc.
* Setting this parameter to 0 is the equivalent of setting it to
* <code>width * TJ.pixelSize(pixelFormat)</code>.
*
* @param height height (in pixels) of the region in the source image from
* which the JPEG image should be compressed.
* which the JPEG or YUV image should be compressed/encoded
*
* @param pixelFormat pixel format of the source image (one of
* {@link TJ TJ.PF_*})
* {@link TJ#PF_RGB TJ.PF_*})
*/
public void setSourceImage(byte[] srcImage, int x, int y, int width,
int pitch, int height, int pixelFormat)
@@ -154,7 +155,7 @@ public class TJCompressor {
srcX = x;
srcY = y;
srcBufInt = null;
srcIsYUV = false;
srcYUVImage = null;
}
/**
@@ -169,22 +170,25 @@ public class TJCompressor {
}
/**
* Associate an uncompressed source image with this compressor instance.
* Associate an uncompressed RGB or grayscale source image with this
* compressor instance.
*
* @param srcImage a <code>BufferedImage</code> instance containing RGB or
* grayscale pixels to be compressed
* grayscale pixels to be compressed or encoded
*
* @param x x offset (in pixels) of the region in the source image from which
* the JPEG image should be compressed
* the JPEG or YUV image should be compressed/encoded
*
* @param y y offset (in pixels) of the region in the source image from which
* the JPEG image should be compressed
* the JPEG or YUV image should be compressed/encoded
*
* @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)
* which the JPEG or YUV image should be compressed/encoded (0 = use the
* width of the source 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)
* which the JPEG or YUV image should be compressed/encoded (0 = use the
* height of the source image)
*/
public void setSourceImage(BufferedImage srcImage, int x, int y, int width,
int height) throws Exception {
@@ -248,42 +252,22 @@ public class TJCompressor {
srcBuf = db.getData();
srcBufInt = null;
}
srcYUVImage = null;
}
/**
* Associate an uncompressed YUV planar source image with this compressor
* instance.
*
* @param srcImage image buffer containing a YUV planar image to be
* compressed. The Y, U (Cb), and V (Cr) image planes should be stored
* sequentially in the buffer, and the size of each plane is determined by
* the specified width, height, and padding, as well as the level of
* chrominance subsampling (specified using {@link #setSubsamp}.) If the
* chrominance components are subsampled along the horizontal dimension, then
* the width of the luminance plane should be padded to the nearest multiple
* of 2 (same goes for the height of the luminance plane, if the chrominance
* components are subsampled along the vertical dimension.) This is
* irrespective of any additional padding specified in the <code>pad</code>
* parameter.
*
* @param width width (in pixels) of the source image
*
* @param pad the line padding used in the source image. For instance, if
* each line in each plane of the YUV image is padded to the nearest multiple
* of 4 bytes, then <code>pad</code> should be set to 4.
*
* @param height height (in pixels) of the source image
* @param srcImage YUV planar image to be compressed
*/
public void setSourceImageYUV(byte[] srcImage, int width, int pad,
int height) throws Exception {
public void setSourceImage(YUVImage srcImage) throws Exception {
if (handle == 0) init();
if (srcImage == null || width < 1 || pad < 1 || height < 1)
throw new Exception("Invalid argument in setSourceImageYUV()");
srcBuf = srcImage;
srcWidth = width;
srcYUVPad = pad;
srcHeight = height;
srcIsYUV = true;
if (srcImage == null)
throw new Exception("Invalid argument in setSourceImage()");
srcYUVImage = srcImage;
srcBuf = null;
srcBufInt = null;
}
/**
@@ -296,12 +280,16 @@ public class TJCompressor {
* sensitive to small changes in brightness than to small changes in color.)
* This is called "chrominance subsampling".
* <p>
* NOTE: When compressing a YUV planar image into a JPEG image, this method
* also specifies the level of chrominance subsampling used in the source
* image.
* NOTE: This method has no effect when compressing a JPEG image from a YUV
* planar source. In that case, the level of chrominance subsampling in
* the JPEG image is determined by the source. Further, this method has no
* effect when encoding to a pre-allocated {@link YUVImage} instance. In
* that case, the level of chrominance subsampling is determined by the
* destination.
*
* @param newSubsamp the new level of chrominance subsampling (one of
* {@link TJ TJ.SAMP_*})
* @param newSubsamp the level of chrominance subsampling to use in
* subsequent compress/encode oeprations (one of
* {@link TJ#SAMP_444 TJ.SAMP_*})
*/
public void setSubsamp(int newSubsamp) throws Exception {
if (newSubsamp < 0 || newSubsamp >= TJ.NUMSAMP)
@@ -327,23 +315,29 @@ public class TJCompressor {
*
* @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.
* the source image's width and height and the desired level of chrominance
* subsampling.
*
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* @param flags the bitwise OR of one or more of
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
*/
public void compress(byte[] dstBuf, int flags) throws Exception {
if (dstBuf == null || flags < 0)
throw new Exception("Invalid argument in compress()");
if (srcBuf == null && (srcBufInt == null || srcIsYUV))
if (srcBuf == null && srcBufInt == null && srcYUVImage == null)
throw new Exception(NO_ASSOC_ERROR);
if (jpegQuality < 0)
throw new Exception("JPEG Quality not set");
if (subsamp < 0)
if (subsamp < 0 && srcYUVImage == null)
throw new Exception("Subsampling level not set");
if (srcIsYUV)
compressedSize = compressFromYUV(srcBuf, srcWidth, srcYUVPad, srcHeight,
subsamp, dstBuf, jpegQuality, flags);
if (srcYUVImage != null)
compressedSize = compressFromYUV(srcYUVImage.getBuf(),
srcYUVImage.getWidth(),
srcYUVImage.getPad(),
srcYUVImage.getHeight(),
srcYUVImage.getSubsamp(),
dstBuf, jpegQuality, flags);
else if (srcBuf != null) {
if (srcX >= 0 && srcY >= 0)
compressedSize = compress(srcBuf, srcX, srcY, srcWidth, srcPitch,
@@ -369,7 +363,8 @@ public class TJCompressor {
* Compress the uncompressed source image associated with this compressor
* instance and return a buffer containing a JPEG image.
*
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* @param flags the bitwise OR of one or more of
* {@link TJ#FLAG_BOTTOMUP 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
@@ -406,82 +401,100 @@ public class TJCompressor {
return compress(flags);
}
/**
* 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 but does not execute any of the other steps in the JPEG
* compression process. The Y, U (Cb), and V (Cr) 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>
* NOTE: Technically, the JPEG format uses the YCbCr colorspace, but per the
* convention of the digital video community, the TurboJPEG API uses "YUV" to
* refer to an image format consisting of Y, Cb, and Cr image planes.
* instance into a YUV planar image and store it in the given
* <code>YUVImage</code> instance. 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. Encoding
* CMYK source images to YUV is not supported.
*
* @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 dstImage {@link YUVImage} instance that will receive the YUV planar
* image
*
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* @param flags the bitwise OR of one or more of
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
*/
public void encodeYUV(byte[] dstBuf, int flags) throws Exception {
if (dstBuf == null || flags < 0)
throw new Exception("Invalid argument in compress()");
public void encodeYUV(YUVImage dstImage, int flags) throws Exception {
if (dstImage == null || flags < 0)
throw new Exception("Invalid argument in encodeYUV()");
if (srcBuf == null && srcBufInt == null)
throw new Exception(NO_ASSOC_ERROR);
if (srcIsYUV)
if (srcYUVImage != null)
throw new Exception("Source image is not correct type");
if (subsamp < 0)
throw new Exception("Subsampling level not set");
if (srcWidth != dstImage.getWidth() || srcHeight != dstImage.getHeight())
throw new Exception("Destination image is the wrong size");
if (srcBufInt != null) {
encodeYUV(srcBufInt, srcWidth, srcStride, srcHeight, srcPixelFormat,
dstBuf, yuvPad, subsamp, flags);
encodeYUV(srcBufInt, srcX, srcY, srcWidth, srcStride, srcHeight,
srcPixelFormat, dstImage.getBuf(), dstImage.getPad(),
dstImage.getSubsamp(), flags);
} else {
encodeYUV(srcBuf, srcWidth, srcPitch, srcHeight, srcPixelFormat, dstBuf,
yuvPad, subsamp, flags);
encodeYUV(srcBuf, srcX, srcY, srcWidth, srcPitch, srcHeight,
srcPixelFormat, dstImage.getBuf(), dstImage.getPad(),
dstImage.getSubsamp(), flags);
}
compressedSize = TJ.bufSizeYUV(srcWidth, yuvPad, srcHeight, subsamp);
compressedSize = dstImage.getSize();
}
/**
* @deprecated Use {@link #encodeYUV(YUVImage, int)} instead.
*/
@Deprecated
public void encodeYUV(byte[] dstBuf, int flags) throws Exception {
if(dstBuf == null)
throw new Exception("Invalid argument in encodeYUV()");
if (srcWidth < 1 || srcHeight < 1)
throw new Exception(NO_ASSOC_ERROR);
if (subsamp < 0)
throw new Exception("Subsampling level not set");
YUVImage yuvImage = new YUVImage(dstBuf, srcWidth, 4, srcHeight, subsamp);
encodeYUV(yuvImage, flags);
}
/**
* Encode the uncompressed source image associated with this compressor
* instance and return a buffer containing a YUV planar image. See
* {@link #encodeYUV(byte[], int)} for more detail.
* instance into a YUV planar image and return a <code>YUVImage</code>
* instance containing the encoded image. 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. Encoding
* CMYK source images to YUV is not supported.
*
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* @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.)
*
* @return a buffer containing a YUV planar image
* @param flags the bitwise OR of one or more of
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
*
* @return a YUV planar image
*/
public YUVImage encodeYUV(int pad, int flags) throws Exception {
if (srcWidth < 1 || srcHeight < 1)
throw new Exception(NO_ASSOC_ERROR);
if (subsamp < 0)
throw new Exception("Subsampling level not set");
if(pad < 1 || ((pad & (pad - 1)) != 0))
throw new Exception("Invalid argument in encodeYUV()");
YUVImage yuvImage = new YUVImage(srcWidth, pad, srcHeight, subsamp);
encodeYUV(yuvImage, flags);
return yuvImage;
}
/**
* @deprecated Use {@link #encodeYUV(int, int)} instead.
*/
@Deprecated
public byte[] encodeYUV(int flags) throws Exception {
if (srcWidth < 1 || srcHeight < 1)
throw new Exception(NO_ASSOC_ERROR);
if (subsamp < 0)
throw new Exception("Subsampling level not set");
byte[] buf = new byte[TJ.bufSizeYUV(srcWidth, yuvPad, srcHeight, subsamp)];
encodeYUV(buf, flags);
return buf;
YUVImage yuvImage = new YUVImage(srcWidth, 4, srcHeight, subsamp);
encodeYUV(yuvImage, flags);
return yuvImage.getBuf();
}
/**
@@ -563,17 +576,17 @@ public class TJCompressor {
int height, int pixelFormat, byte[] dstBuf, int subsamp, int flags)
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(byte[] srcBuf, int x, int y, 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; // 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;
private native void encodeYUV(int[] srcBuf, int x, int y, int width,
int pitch, int height, int pixelFormat, byte[] dstBuf, int pad,
int subsamp, int flags) throws Exception;
static {
TJLoader.load();
@@ -589,8 +602,7 @@ public class TJCompressor {
private int srcPitch = 0;
private int srcStride = 0;
private int srcPixelFormat = -1;
private int srcYUVPad = -1;
private boolean srcIsYUV;
private YUVImage srcYUVImage = null;
private int subsamp = -1;
private int jpegQuality = -1;
private int compressedSize = 0;

View File

@@ -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
* modification, are permitted provided that the following conditions are met:
@@ -37,7 +37,7 @@ import java.nio.*;
public class TJDecompressor {
private static final String NO_ASSOC_ERROR =
"No JPEG image is associated with this instance";
"No source image is associated with this instance";
/**
* Create a TurboJPEG decompresssor instance.
@@ -47,21 +47,21 @@ public class TJDecompressor {
}
/**
* Create a TurboJPEG decompressor instance and associate the JPEG image
* stored in <code>jpegImage</code> with the newly-created instance.
* Create a TurboJPEG decompressor instance and associate the JPEG source
* image stored in <code>jpegImage</code> with the newly created instance.
*
* @param jpegImage JPEG image buffer (size of the JPEG image is assumed to
* be the length of the array)
*/
public TJDecompressor(byte[] jpegImage) throws Exception {
init();
setJPEGImage(jpegImage, jpegImage.length);
setSourceImage(jpegImage, jpegImage.length);
}
/**
* Create a TurboJPEG decompressor instance and associate the JPEG image
* of length <code>imageSize</code> bytes stored in <code>jpegImage</code>
* with the newly-created instance.
* Create a TurboJPEG decompressor instance and associate the JPEG source
* image of length <code>imageSize</code> bytes stored in
* <code>jpegImage</code> with the newly created instance.
*
* @param jpegImage JPEG image buffer
*
@@ -69,87 +69,150 @@ public class TJDecompressor {
*/
public TJDecompressor(byte[] jpegImage, int imageSize) throws Exception {
init();
setJPEGImage(jpegImage, imageSize);
setSourceImage(jpegImage, imageSize);
}
/**
* Create a TurboJPEG decompressor instance and associate the YUV planar
* source image stored in <code>yuvImage</code> with the newly created
* instance.
*
* @param yuvImage {@link YUVImage} instance containing a YUV planar
* image to be decoded
*/
public TJDecompressor(YUVImage yuvImage) throws Exception {
init();
setSourceImage(yuvImage);
}
/**
* Associate the JPEG image of length <code>imageSize</code> bytes stored in
* <code>jpegImage</code> with this decompressor instance. This image will
* <code>srcImage</code> with this decompressor instance. This image will
* be used as the source image for subsequent decompress operations.
*
* @param jpegImage JPEG image buffer
* @param srcImage JPEG image buffer
*
* @param imageSize size of the JPEG image (in bytes)
*/
public void setJPEGImage(byte[] jpegImage, int imageSize) throws Exception {
if (jpegImage == null || imageSize < 1)
throw new Exception("Invalid argument in setJPEGImage()");
jpegBuf = jpegImage;
public void setSourceImage(byte[] srcImage, int imageSize)
throws Exception {
if (srcImage == null || imageSize < 1)
throw new Exception("Invalid argument in setSourceImage()");
jpegBuf = srcImage;
jpegBufSize = imageSize;
decompressHeader(jpegBuf, jpegBufSize);
yuvImage = null;
}
/**
* Returns the width of the JPEG image associated with this decompressor
* instance.
*
* @return the width of the JPEG image associated with this decompressor
* instance
* @deprecated Use {@link #setSourceImage(byte[], int)} instead.
*/
public int getWidth() throws Exception {
if (jpegWidth < 1)
throw new Exception(NO_ASSOC_ERROR);
return jpegWidth;
@Deprecated
public void setJPEGImage(byte[] jpegImage, int imageSize) throws Exception {
setSourceImage(jpegImage, imageSize);
}
/**
* Returns the height of the JPEG image associated with this decompressor
* instance.
* Associate the specified YUV planar source image with this decompressor
* instance. Subsequent decompress operations will decode this image into an
* RGB or grayscale destination image.
*
* @return the height of the JPEG image associated with this decompressor
* instance
* @param srcImage {@link YUVImage} instance containing a YUV planar image to
* be decoded
*/
public int getHeight() throws Exception {
if (jpegHeight < 1)
throw new Exception(NO_ASSOC_ERROR);
return jpegHeight;
public void setSourceImage(YUVImage srcImage) throws Exception {
if (srcImage == null)
throw new Exception("Invalid argument in setSourceImage()");
yuvImage = srcImage;
jpegBuf = null;
jpegBufSize = 0;
}
/**
* Returns the level of chrominance subsampling used in the JPEG image
* associated with this decompressor instance. See {@link TJ TJ.SAMP_*}.
*
* @return the level of chrominance subsampling used in the JPEG image
* associated with this decompressor instance
*/
public int getSubsamp() throws Exception {
if (jpegSubsamp < 0)
throw new Exception(NO_ASSOC_ERROR);
if (jpegSubsamp >= TJ.NUMSAMP)
throw new Exception("JPEG header information is invalid");
return jpegSubsamp;
}
/**
* Returns the colorspace used in the JPEG image associated with this
* decompressor instance. See {@link TJ TJ.CS_*}.
* Returns the width of the source image (JPEG or YUV) associated with this
* decompressor instance.
*
* @return the colorspace used in the JPEG image associated with this
* @return the width of the source image (JPEG or YUV) associated with this
* decompressor instance
*/
public int getColorspace() throws Exception {
if (jpegColorspace < 0)
public int getWidth() throws Exception {
if (yuvImage != null)
return yuvImage.getWidth();
if (srcWidth < 1)
throw new Exception(NO_ASSOC_ERROR);
if (jpegColorspace >= TJ.NUMCS)
throw new Exception("JPEG header information is invalid");
return jpegColorspace;
return srcWidth;
}
/**
* Returns the JPEG image buffer associated with this decompressor instance.
* Returns the height of the source image (JPEG or YUV) associated with this
* decompressor instance.
*
* @return the JPEG image buffer associated with this decompressor instance
* @return the height of the source image (JPEG or YUV) associated with this
* decompressor instance
*/
public int getHeight() throws Exception {
if (yuvImage != null)
return yuvImage.getHeight();
if (srcHeight < 1)
throw new Exception(NO_ASSOC_ERROR);
return srcHeight;
}
/**
* Returns the level of chrominance subsampling used in the source image
* (JPEG or YUV) associated with this decompressor instance. See
* {@link TJ#SAMP_444 TJ.SAMP_*}.
*
* @return the level of chrominance subsampling used in the source image
* (JPEG or YUV) associated with this decompressor instance
*/
public int getSubsamp() throws Exception {
if (yuvImage != null)
return yuvImage.getSubsamp();
if (srcSubsamp < 0)
throw new Exception(NO_ASSOC_ERROR);
if (srcSubsamp >= TJ.NUMSAMP)
throw new Exception("JPEG header information is invalid");
return srcSubsamp;
}
/**
* Returns the colorspace used in the source image (JPEG or YUV) associated
* with this decompressor instance. See {@link TJ#CS_RGB TJ.CS_*}. If the
* source image is YUV, then this always returns {@link TJ#CS_YCbCr}.
*
* @return the colorspace used in the source image (JPEG or YUV) associated
* with this decompressor instance
*/
public int getColorspace() throws Exception {
if (yuvImage != null)
return TJ.CS_YCbCr;
if (srcColorspace < 0)
throw new Exception(NO_ASSOC_ERROR);
if (srcColorspace >= TJ.NUMCS)
throw new Exception("JPEG header information is invalid");
return srcColorspace;
}
/**
* Returns the source image buffer associated with this decompressor
* instance.
*
* @return the source image buffer associated with this decompressor instance
*/
public byte[] getSourceBuf() throws Exception {
if (yuvImage != null)
return yuvImage.getBuf();
if (jpegBuf == null)
throw new Exception(NO_ASSOC_ERROR);
return jpegBuf;
}
/**
* @deprecated Use {@link #getSourceBuf} instead.
*/
@Deprecated
public byte[] getJPEGBuf() throws Exception {
if (jpegBuf == null)
throw new Exception(NO_ASSOC_ERROR);
@@ -157,18 +220,29 @@ public class TJDecompressor {
}
/**
* Returns the size of the JPEG image (in bytes) associated with this
* Returns the size of the source image (in bytes) associated with this
* decompressor instance.
*
* @return the size of the JPEG image (in bytes) associated with this
* @return the size of the source image (in bytes) associated with this
* decompressor instance
*/
public int getJPEGSize() throws Exception {
public int getSourceSize() throws Exception {
if (yuvImage != null)
return yuvImage.getSize();
if (jpegBufSize < 1)
throw new Exception(NO_ASSOC_ERROR);
return jpegBufSize;
}
/**
* @deprecated Use {@link #getSourceSize} instead.
*/
@Deprecated
public int getJPEGSize() throws Exception {
if (jpegBufSize < 1)
throw new Exception(NO_ASSOC_ERROR);
return jpegBufSize;
}
/**
* Returns the width of the largest scaled-down image that the TurboJPEG
@@ -191,19 +265,19 @@ public class TJDecompressor {
*/
public int getScaledWidth(int desiredWidth, int desiredHeight)
throws Exception {
if (jpegWidth < 1 || jpegHeight < 1)
if (srcWidth < 1 || srcHeight < 1)
throw new Exception(NO_ASSOC_ERROR);
if (desiredWidth < 0 || desiredHeight < 0)
throw new Exception("Invalid argument in getScaledWidth()");
TJScalingFactor[] sf = TJ.getScalingFactors();
if (desiredWidth == 0)
desiredWidth = jpegWidth;
desiredWidth = srcWidth;
if (desiredHeight == 0)
desiredHeight = jpegHeight;
int scaledWidth = jpegWidth, scaledHeight = jpegHeight;
desiredHeight = srcHeight;
int scaledWidth = srcWidth, scaledHeight = srcHeight;
for (int i = 0; i < sf.length; i++) {
scaledWidth = sf[i].getScaled(jpegWidth);
scaledHeight = sf[i].getScaled(jpegHeight);
scaledWidth = sf[i].getScaled(srcWidth);
scaledHeight = sf[i].getScaled(srcHeight);
if (scaledWidth <= desiredWidth && scaledHeight <= desiredHeight)
break;
}
@@ -233,19 +307,19 @@ public class TJDecompressor {
*/
public int getScaledHeight(int desiredWidth, int desiredHeight)
throws Exception {
if (jpegWidth < 1 || jpegHeight < 1)
if (srcWidth < 1 || srcHeight < 1)
throw new Exception(NO_ASSOC_ERROR);
if (desiredWidth < 0 || desiredHeight < 0)
throw new Exception("Invalid argument in getScaledHeight()");
TJScalingFactor[] sf = TJ.getScalingFactors();
if (desiredWidth == 0)
desiredWidth = jpegWidth;
desiredWidth = srcWidth;
if (desiredHeight == 0)
desiredHeight = jpegHeight;
int scaledWidth = jpegWidth, scaledHeight = jpegHeight;
desiredHeight = srcHeight;
int scaledWidth = srcWidth, scaledHeight = srcHeight;
for (int i = 0; i < sf.length; i++) {
scaledWidth = sf[i].getScaled(jpegWidth);
scaledHeight = sf[i].getScaled(jpegHeight);
scaledWidth = sf[i].getScaled(srcWidth);
scaledHeight = sf[i].getScaled(srcHeight);
if (scaledWidth <= desiredWidth && scaledHeight <= desiredHeight)
break;
}
@@ -255,73 +329,90 @@ public class TJDecompressor {
}
/**
* Decompress the JPEG source image associated with this decompressor
* instance and output a decompressed image to the given destination buffer.
* Decompress the JPEG source image or decode the YUV source image associated
* with this decompressor instance and output a grayscale, RGB, or CMYK image
* to the given destination buffer.
*
* @param dstBuf buffer that will receive the decompressed image. This
* buffer should normally be <code>pitch * scaledHeight</code> bytes in size,
* where <code>scaledHeight</code> can be determined by calling <code>
* @param dstBuf buffer that will receive the decompressed/decoded image.
* If the source image is a JPEG image, then this buffer should normally be
* <code>pitch * scaledHeight</code> bytes in size, where
* <code>scaledHeight</code> can be determined by calling <code>
* scalingFactor.{@link TJScalingFactor#getScaled getScaled}(jpegHeight)
* </code> with one of the scaling factors returned from {@link
* TJ#getScalingFactors} or by calling {@link #getScaledHeight}. However,
* the buffer may also be larger than the dimensions of the JPEG image, in
* which case the <code>x</code>, <code>y</code>, and <code>pitch</code>
* parameters can be used to specify the region into which the JPEG image
* should be decompressed.
* TJ#getScalingFactors} or by calling {@link #getScaledHeight}. If the
* source image is a YUV image, then this buffer should normally be
* <code>pitch * height</code> bytes in size, where <code>height</code> is
* the height of the YUV image. However, the buffer may also be larger than
* the dimensions of the source image, in which case the <code>x</code>,
* <code>y</code>, and <code>pitch</code> parameters can be used to specify
* the region into which the source image should be decompressed/decoded.
*
* @param x x offset (in pixels) of the region into which the JPEG image
* should be decompressed, relative to the start of <code>dstBuf</code>.
* @param x x offset (in pixels) of the region in the destination image into
* which the source image should be decompressed/decoded
*
* @param y y offset (in pixels) of the region into which the JPEG image
* should be decompressed, relative to the start of <code>dstBuf</code>.
* @param y y offset (in pixels) of the region in the destination image into
* which the source image should be decompressed/decoded
*
* @param desiredWidth desired width (in pixels) of the decompressed image
* (or image region.) 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 desiredWidth If the source image is a JPEG image, then this
* specifies the desired width (in pixels) of the decompressed image (or
* image region.) If the desired destination image dimensions are different
* than the source image dimensions, 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.) This parameter is
* ignored if the source image is a YUV image.
*
* @param pitch bytes per line of the destination image. Normally, this
* should be set to <code>scaledWidth * TJ.pixelSize(pixelFormat)</code> if
* the decompressed image is unpadded, but you can use this to, for instance,
* pad each line of the decompressed image to a 4-byte boundary or to
* decompress the JPEG image into a region of a larger image. NOTE:
* <code>scaledWidth</code> can be determined by calling <code>
* the destination image is unpadded, but you can use this to, for instance,
* pad each line of the destination image to a 4-byte boundary or to
* decompress/decode the source image into a region of a larger image. NOTE:
* if the source image is a JPEG image, then <code>scaledWidth</code> can be
* determined by calling <code>
* scalingFactor.{@link TJScalingFactor#getScaled getScaled}(jpegWidth)
* </code> or by calling {@link #getScaledWidth}. Setting this parameter to
* 0 is the equivalent of setting it to <code>scaledWidth *
* TJ.pixelSize(pixelFormat)</code>.
* </code> or by calling {@link #getScaledWidth}. If the source image is a
* YUV image, then <code>scaledWidth</code> is the width of the YUV image.
* Setting this parameter to 0 is the equivalent of setting it to
* <code>scaledWidth * TJ.pixelSize(pixelFormat)</code>.
*
* @param desiredHeight desired height (in pixels) of the decompressed image
* (or image region.) 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 desiredHeight If the source image is a JPEG image, then this
* specifies the desired height (in pixels) of the decompressed image (or
* image region.) If the desired destination image dimensions are different
* than the source image dimensions, 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.) This parameter is
* ignored if the source image is a YUV image.
*
* @param pixelFormat pixel format of the decompressed image (one of
* {@link TJ TJ.PF_*})
* @param pixelFormat pixel format of the decompressed/decoded image (one of
* {@link TJ#PF_RGB TJ.PF_*})
*
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* @param flags the bitwise OR of one or more of
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
*/
public void decompress(byte[] dstBuf, int x, int y, int desiredWidth,
int pitch, int desiredHeight, int pixelFormat,
int flags) throws Exception {
if (jpegBuf == null)
if (jpegBuf == null && yuvImage == null)
throw new Exception(NO_ASSOC_ERROR);
if (dstBuf == null || x < 0 || y < 0 || desiredWidth < 0 || pitch < 0 ||
desiredHeight < 0 || pixelFormat < 0 || pixelFormat >= TJ.NUMPF ||
flags < 0)
if (dstBuf == null || x < 0 || y < 0 || pitch < 0 ||
(yuvImage != null && (desiredWidth < 0 || desiredHeight < 0)) ||
pixelFormat < 0 || pixelFormat >= TJ.NUMPF || flags < 0)
throw new Exception("Invalid argument in decompress()");
if (x > 0 || y > 0)
decompress(jpegBuf, jpegBufSize, dstBuf, x, y, desiredWidth, pitch,
desiredHeight, pixelFormat, flags);
else
decompress(jpegBuf, jpegBufSize, dstBuf, desiredWidth, pitch,
desiredHeight, pixelFormat, flags);
if (yuvImage != null)
decodeYUV(yuvImage.getBuf(), yuvImage.getPad(), yuvImage.getSubsamp(),
dstBuf, x, y, yuvImage.getWidth(), pitch, yuvImage.getHeight(),
pixelFormat, flags);
else {
if (x > 0 || y > 0)
decompress(jpegBuf, jpegBufSize, dstBuf, x, y, desiredWidth, pitch,
desiredHeight, pixelFormat, flags);
else
decompress(jpegBuf, jpegBufSize, dstBuf, desiredWidth, pitch,
desiredHeight, pixelFormat, flags);
}
}
/**
@@ -353,15 +444,17 @@ public class TJDecompressor {
* for description
*
* @param pixelFormat pixel format of the decompressed image (one of
* {@link TJ TJ.PF_*})
* {@link TJ#PF_RGB TJ.PF_*})
*
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* @param flags the bitwise OR of one or more of
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
*
* @return a buffer containing the decompressed image
*/
public byte[] decompress(int desiredWidth, int pitch, int desiredHeight,
int pixelFormat, int flags) throws Exception {
if (desiredWidth < 0 || pitch < 0 || desiredHeight < 0 ||
if (pitch < 0 ||
(yuvImage == null && (desiredWidth < 0 || desiredHeight < 0)) ||
pixelFormat < 0 || pixelFormat >= TJ.NUMPF || flags < 0)
throw new Exception("Invalid argument in decompress()");
int pixelSize = TJ.getPixelSize(pixelFormat);
@@ -376,22 +469,60 @@ public class TJDecompressor {
/**
* Decompress the JPEG source image associated with this decompressor
* instance and output a YUV planar image to the given destination buffer.
* This method performs JPEG decompression but leaves out the color
* conversion step, so a planar YUV image is generated instead of an RGB
* image. The padding of the planes in this image is the same as in the
* images generated by {@link TJCompressor#encodeYUV(byte[], int)}. Note
* that, if the width or height of the image is not an even multiple of the
* MCU block size (see {@link TJ#getMCUWidth} and {@link TJ#getMCUHeight}),
* then an intermediate buffer copy will be performed within TurboJPEG.
* <p>
* NOTE: Technically, the JPEG format uses the YCbCr colorspace, but per the
* convention of the digital video community, the TurboJPEG API uses "YUV" to
* refer to an image format consisting of Y, Cb, and Cr image planes.
* instance into a YUV planar image and store it in the given
* <code>YUVImage</code> instance. This method performs JPEG decompression
* but leaves out the color conversion step, so a planar YUV image is
* generated instead of an RGB or grayscale image. This method cannot be
* used to decompress JPEG source images with the CMYK or YCCK colorspace.
*
* @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 dstImage {@link YUVImage} instance that will receive the YUV planar
* image. The level of subsampling specified in this <code>YUVImage</code>
* instance must match that of the JPEG image, and the width and height
* specified in the <code>YUVImage</code> instance must match one of the
* scaled image sizes that TurboJPEG is capable of generating from the JPEG
* source image.
*
* @param flags the bitwise OR of one or more of
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
*/
public void decompressToYUV(YUVImage dstImage, int flags) throws Exception {
if (jpegBuf == null)
throw new Exception(NO_ASSOC_ERROR);
if (dstImage == null || flags < 0)
throw new Exception("Invalid argument in decompressToYUV()");
int scaledWidth = getScaledWidth(dstImage.getWidth(),
dstImage.getHeight());
int scaledHeight = getScaledHeight(dstImage.getWidth(),
dstImage.getHeight());
if (scaledWidth != dstImage.getWidth() ||
scaledHeight != dstImage.getHeight())
throw new Exception("YUVImage dimensions do not match one of the scaled image sizes that TurboJPEG is capable of generating.");
if (srcSubsamp != dstImage.getSubsamp())
throw new Exception("YUVImage subsampling level does not match that of the JPEG image");
decompressToYUV(jpegBuf, jpegBufSize, dstImage.getBuf(),
dstImage.getWidth(), dstImage.getPad(),
dstImage.getHeight(), flags);
}
/**
* @deprecated Use {@link #decompressToYUV(YUVImage, int)} instead.
*/
@Deprecated
public void decompressToYUV(byte[] dstBuf, int flags) throws Exception {
YUVImage dstImage = new YUVImage(dstBuf, srcWidth, 4, srcHeight,
srcSubsamp);
decompressToYUV(dstImage, flags);
}
/**
* Decompress the JPEG source image associated with this decompressor
* instance into a YUV planar image and return a <code>YUVImage</code>
* instance containing the decompressed image. This method performs JPEG
* decompression but leaves out the color conversion step, so a planar YUV
* image is generated instead of an RGB or grayscale image. This method
* cannot be used to decompress JPEG source images with the CMYK or YCCK
* colorspace.
*
* @param desiredWidth desired width (in pixels) of the YUV image. If the
* desired image dimensions are different than the dimensions of the JPEG
@@ -413,60 +544,28 @@ public class TJDecompressor {
* 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_*}
* @param flags the bitwise OR of one or more of
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
*
* @return a YUV planar image
*/
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 || desiredWidth < 0 || pad < 1 ||
((pad & (pad - 1)) != 0) || desiredHeight < 0 || flags < 0)
throw new Exception("Invalid argument in decompressToYUV()");
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, 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 desiredWidth, int pad, int desiredHeight,
int flags) throws Exception {
public YUVImage 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)
if (srcWidth < 1 || srcHeight < 1 || srcSubsamp < 0)
throw new Exception(NO_ASSOC_ERROR);
if (jpegSubsamp >= TJ.NUMSAMP)
if (srcSubsamp >= TJ.NUMSAMP)
throw new Exception("JPEG header information is invalid");
if (yuvImage != null)
throw new Exception("Source image is the wrong type");
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;
YUVImage yuvImage = new YUVImage(scaledWidth, pad, scaledHeight,
srcSubsamp);
decompressToYUV(yuvImage, flags);
return yuvImage;
}
/**
@@ -474,91 +573,126 @@ public class TJDecompressor {
*/
@Deprecated
public byte[] decompressToYUV(int flags) throws Exception {
return decompressToYUV(0, 4, 0, flags);
YUVImage dstImage = new YUVImage(srcWidth, 4, srcHeight, srcSubsamp);
decompressToYUV(dstImage, flags);
return dstImage.getBuf();
}
/**
* Decompress the JPEG source image associated with this decompressor
* instance and output a decompressed image to the given destination buffer.
* Decompress the JPEG source image or decode the YUV source image associated
* with this decompressor instance and output a grayscale, RGB, or CMYK image
* to the given destination buffer.
*
* @param dstBuf buffer that will receive the decompressed image. This
* buffer should normally be <code>stride * scaledHeight</code> pixels in
* size, where <code>scaledHeight</code> can be determined by calling <code>
* @param dstBuf buffer that will receive the decompressed/decoded image.
* If the source image is a JPEG image, then this buffer should normally be
* <code>stride * scaledHeight</code> pixels in size, where
* <code>scaledHeight</code> can be determined by calling <code>
* scalingFactor.{@link TJScalingFactor#getScaled getScaled}(jpegHeight)
* </code> with one of the scaling factors returned from {@link
* TJ#getScalingFactors} or by calling {@link #getScaledHeight}. However,
* the buffer may also be larger than the dimensions of the JPEG image, in
* which case the <code>x</code>, <code>y</code>, and <code>stride</code>
* parameters can be used to specify the region into which the JPEG image
* should be decompressed.
* TJ#getScalingFactors} or by calling {@link #getScaledHeight}. If the
* source image is a YUV image, then this buffer should normally be
* <code>stride * height</code> pixels in size, where <code>height</code> is
* the height of the YUV image. However, the buffer may also be larger than
* the dimensions of the JPEG image, in which case the <code>x</code>,
* <code>y</code>, and <code>stride</code> parameters can be used to specify
* the region into which the source image should be decompressed.
*
* @param x x offset (in pixels) of the region into which the JPEG image
* should be decompressed, relative to the start of <code>dstBuf</code>.
* @param x x offset (in pixels) of the region in the destination image into
* which the source image should be decompressed/decoded
*
* @param y y offset (in pixels) of the region into which the JPEG image
* should be decompressed, relative to the start of <code>dstBuf</code>.
* @param y y offset (in pixels) of the region in the destination image into
* which the source image should be decompressed/decoded
*
* @param desiredWidth desired width (in pixels) of the decompressed image
* (or image region.) 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 desiredWidth If the source image is a JPEG image, then this
* specifies the desired width (in pixels) of the decompressed image (or
* image region.) If the desired destination image dimensions are different
* than the source image dimensions, 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.) This parameter is
* ignored if the source image is a YUV image.
*
* @param stride pixels per line of the destination image. Normally, this
* should be set to <code>scaledWidth</code>, but you can use this to, for
* instance, decompress the JPEG image into a region of a larger image.
* NOTE: <code>scaledWidth</code> can be determined by calling <code>
* NOTE: if the source image is a JPEG image, then <code>scaledWidth</code>
* can be determined by calling <code>
* scalingFactor.{@link TJScalingFactor#getScaled getScaled}(jpegWidth)
* </code> or by calling {@link #getScaledWidth}. Setting this parameter to
* 0 is the equivalent of setting it to <code>scaledWidth</code>.
* </code> or by calling {@link #getScaledWidth}. If the source image is a
* YUV image, then <code>scaledWidth</code> is the width of the YUV image.
* Setting this parameter to 0 is the equivalent of setting it to
* <code>scaledWidth</code>.
*
* @param desiredHeight desired height (in pixels) of the decompressed image
* (or image region.) 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 desiredHeight If the source image is a JPEG image, then this
* specifies the desired height (in pixels) of the decompressed image (or
* image region.) If the desired destination image dimensions are different
* than the source image dimensions, 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.) This parameter is
* ignored if the source image is a YUV image.
*
* @param pixelFormat pixel format of the decompressed image (one of
* {@link TJ TJ.PF_*})
* {@link TJ#PF_RGB TJ.PF_*})
*
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* @param flags the bitwise OR of one or more of
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
*/
public void decompress(int[] dstBuf, int x, int y, int desiredWidth,
int stride, int desiredHeight, int pixelFormat,
int flags) throws Exception {
if (jpegBuf == null)
if (jpegBuf == null && yuvImage == null)
throw new Exception(NO_ASSOC_ERROR);
if (dstBuf == null || x < 0 || y < 0 || desiredWidth < 0 || stride < 0 ||
desiredHeight < 0 || pixelFormat < 0 || pixelFormat >= TJ.NUMPF ||
flags < 0)
if (dstBuf == null || x < 0 || y < 0 || stride < 0 ||
(yuvImage != null && (desiredWidth < 0 || desiredHeight < 0)) ||
pixelFormat < 0 || pixelFormat >= TJ.NUMPF || flags < 0)
throw new Exception("Invalid argument in decompress()");
decompress(jpegBuf, jpegBufSize, dstBuf, x, y, desiredWidth, stride,
desiredHeight, pixelFormat, flags);
if (yuvImage != null)
decodeYUV(yuvImage.getBuf(), yuvImage.getPad(), yuvImage.getSubsamp(),
dstBuf, x, y, yuvImage.getWidth(), stride,
yuvImage.getHeight(), pixelFormat, flags);
else
decompress(jpegBuf, jpegBufSize, dstBuf, x, y, desiredWidth, stride,
desiredHeight, pixelFormat, flags);
}
/**
* Decompress the JPEG source image associated with this decompressor
* instance and output a decompressed image to the given
* <code>BufferedImage</code> instance.
* Decompress the JPEG source image or decode the YUV source image associated
* with this decompressor instance and output a decompressed/decoded image to
* the given <code>BufferedImage</code> instance.
*
* @param dstImage a <code>BufferedImage</code> instance that will receive
* the decompressed image
* the decompressed/decoded image. If the source image is a JPEG image, then
* the width and height of the <code>BufferedImage</code> instance must match
* one of the scaled image sizes that TurboJPEG is capable of generating from
* the JPEG image. If the source image is a YUV image, then the width and
* height of the <code>BufferedImage</code> instance must match the width and
* height of the YUV image.
*
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* @param flags the bitwise OR of one or more of
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
*/
public void decompress(BufferedImage dstImage, int flags) throws Exception {
if (dstImage == null || flags < 0)
throw new Exception("Invalid argument in decompress()");
int desiredWidth = dstImage.getWidth();
int desiredHeight = dstImage.getHeight();
int scaledWidth = getScaledWidth(desiredWidth, desiredHeight);
int scaledHeight = getScaledHeight(desiredWidth, desiredHeight);
if (scaledWidth != desiredWidth || scaledHeight != desiredHeight)
throw new Exception("BufferedImage dimensions do not match a scaled image size that TurboJPEG is capable of generating.");
int scaledWidth, scaledHeight;
if (yuvImage != null) {
if (desiredWidth != yuvImage.getWidth() ||
desiredHeight != yuvImage.getHeight())
throw new Exception("BufferedImage dimensions do not match the dimensions of the source image.");
scaledWidth = yuvImage.getWidth();
scaledHeight = yuvImage.getHeight();
} else {
scaledWidth = getScaledWidth(desiredWidth, desiredHeight);
scaledHeight = getScaledHeight(desiredWidth, desiredHeight);
if (scaledWidth != desiredWidth || scaledHeight != desiredHeight)
throw new Exception("BufferedImage dimensions do not match one of the scaled image sizes that TurboJPEG is capable of generating.");
}
int pixelFormat; boolean intPixels = false;
if (byteOrder == null)
byteOrder = ByteOrder.nativeOrder();
@@ -599,10 +733,16 @@ public class TJDecompressor {
int stride = sm.getScanlineStride();
DataBufferInt db = (DataBufferInt)wr.getDataBuffer();
int[] buf = db.getData();
if (jpegBuf == null)
throw new Exception(NO_ASSOC_ERROR);
decompress(jpegBuf, jpegBufSize, buf, scaledWidth, stride, scaledHeight,
pixelFormat, flags);
if (yuvImage != null)
decodeYUV(yuvImage.getBuf(), yuvImage.getPad(), yuvImage.getSubsamp(),
buf, 0, 0, yuvImage.getWidth(), stride, yuvImage.getHeight(),
pixelFormat, flags);
else {
if (jpegBuf == null)
throw new Exception(NO_ASSOC_ERROR);
decompress(jpegBuf, jpegBufSize, buf, 0, 0, scaledWidth, stride,
scaledHeight, pixelFormat, flags);
}
} else {
ComponentSampleModel sm =
(ComponentSampleModel)dstImage.getSampleModel();
@@ -612,14 +752,15 @@ public class TJDecompressor {
int pitch = sm.getScanlineStride();
DataBufferByte db = (DataBufferByte)wr.getDataBuffer();
byte[] buf = db.getData();
decompress(buf, scaledWidth, pitch, scaledHeight, pixelFormat, flags);
decompress(buf, 0, 0, scaledWidth, pitch, scaledHeight, pixelFormat,
flags);
}
}
/**
* Decompress the JPEG source image associated with this decompressor
* instance and return a <code>BufferedImage</code> instance containing the
* decompressed image.
* Decompress the JPEG source image or decode the YUV source image associated
* with this decompressor instance and return a <code>BufferedImage</code>
* instance containing the decompressed/decoded image.
*
* @param desiredWidth see
* {@link #decompress(byte[], int, int, int, int, int, int, int)} for
@@ -629,19 +770,21 @@ public class TJDecompressor {
* {@link #decompress(byte[], int, int, int, int, int, int, int)} for
* description
*
* @param bufferedImageType the image type of the newly-created
* <code>BufferedImage</code> instance (for instance,
* @param bufferedImageType the image type of the <code>BufferedImage</code>
* instance that will be created (for instance,
* <code>BufferedImage.TYPE_INT_RGB</code>)
*
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* @param flags the bitwise OR of one or more of
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
*
* @return a <code>BufferedImage</code> instance containing the
* decompressed image
* decompressed/decoded image
*/
public BufferedImage decompress(int desiredWidth, int desiredHeight,
int bufferedImageType, int flags)
throws Exception {
if (desiredWidth < 0 || desiredHeight < 0 || flags < 0)
if ((yuvImage == null && (desiredWidth < 0 || desiredHeight < 0)) ||
flags < 0)
throw new Exception("Invalid argument in decompress()");
int scaledWidth = getScaledWidth(desiredWidth, desiredHeight);
int scaledHeight = getScaledHeight(desiredWidth, desiredHeight);
@@ -696,6 +839,14 @@ public class TJDecompressor {
private native void decompressToYUV(byte[] srcBuf, int size, byte[] dstBuf,
int desiredWidth, int pad, int desiredheight, int flags) throws Exception;
private native void decodeYUV(byte[] srcBuf, int pad, int subsamp,
byte[] dstBuf, int x, int y, int width, int pitch, int height,
int pixelFormat, int flags) throws Exception;
private native void decodeYUV(byte[] srcBuf, int pad, int subsamp,
int[] dstBuf, int x, int y, int width, int stride, int height,
int pixelFormat, int flags) throws Exception;
static {
TJLoader.load();
}
@@ -703,9 +854,10 @@ public class TJDecompressor {
protected long handle = 0;
protected byte[] jpegBuf = null;
protected int jpegBufSize = 0;
protected int jpegWidth = 0;
protected int jpegHeight = 0;
protected int jpegSubsamp = -1;
protected int jpegColorspace = -1;
protected YUVImage yuvImage = null;
protected int srcWidth = 0;
protected int srcHeight = 0;
protected int srcSubsamp = -1;
protected int srcColorspace = -1;
private ByteOrder byteOrder = null;
};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C)2011, 2013 D. R. Commander. All Rights Reserved.
* Copyright (C)2011, 2013-2014 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:
@@ -42,20 +42,20 @@ public class TJTransformer extends TJDecompressor {
/**
* Create a TurboJPEG lossless transformer instance and associate the JPEG
* image stored in <code>jpegImage</code> with the newly-created instance.
* image stored in <code>jpegImage</code> with the newly created instance.
*
* @param jpegImage JPEG image buffer (size of the JPEG image is assumed to
* be the length of the array)
*/
public TJTransformer(byte[] jpegImage) throws Exception {
init();
setJPEGImage(jpegImage, jpegImage.length);
setSourceImage(jpegImage, jpegImage.length);
}
/**
* Create a TurboJPEG lossless transformer instance and associate the JPEG
* image of length <code>imageSize</code> bytes stored in
* <code>jpegImage</code> with the newly-created instance.
* <code>jpegImage</code> with the newly created instance.
*
* @param jpegImage JPEG image buffer
*
@@ -63,7 +63,7 @@ public class TJTransformer extends TJDecompressor {
*/
public TJTransformer(byte[] jpegImage, int imageSize) throws Exception {
init();
setJPEGImage(jpegImage, imageSize);
setSourceImage(jpegImage, imageSize);
}
/**
@@ -84,13 +84,14 @@ public class TJTransformer extends TJDecompressor {
* receive a JPEG image that has been transformed using the parameters in
* <code>transforms[i]</code>. Use {@link TJ#bufSize} to determine the
* maximum size for each buffer based on the transformed or cropped width and
* height.
* height and the level of subsampling used in the source image.
*
* @param transforms an array of {@link TJTransform} instances, each of
* which specifies the transform parameters and/or cropping region for the
* corresponding transformed output image
*
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* @param flags the bitwise OR of one or more of
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
*/
public void transform(byte[][] dstBufs, TJTransform[] transforms,
int flags) throws Exception {
@@ -112,20 +113,21 @@ public class TJTransformer extends TJDecompressor {
* @return an array of {@link TJDecompressor} instances, each of
* which has a transformed JPEG image associated with it
*
* @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
* @param flags the bitwise OR of one or more of
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
*/
public TJDecompressor[] transform(TJTransform[] transforms, int flags)
throws Exception {
byte[][] dstBufs = new byte[transforms.length][];
if (jpegWidth < 1 || jpegHeight < 1)
if (srcWidth < 1 || srcHeight < 1)
throw new Exception("JPEG buffer not initialized");
for (int i = 0; i < transforms.length; i++) {
int w = jpegWidth, h = jpegHeight;
int w = srcWidth, h = srcHeight;
if ((transforms[i].options & TJTransform.OPT_CROP) != 0) {
if (transforms[i].width != 0) w = transforms[i].width;
if (transforms[i].height != 0) h = transforms[i].height;
}
dstBufs[i] = new byte[TJ.bufSize(w, h, jpegSubsamp)];
dstBufs[i] = new byte[TJ.bufSize(w, h, srcSubsamp)];
}
TJDecompressor[] tjd = new TJDecompressor[transforms.length];
transform(dstBufs, transforms, flags);
@@ -135,11 +137,11 @@ public class TJTransformer extends TJDecompressor {
}
/**
* Returns an array containing the sizes of the transformed JPEG images from
* the most recent call to {@link #transform transform()}.
* Returns an array containing the sizes of the transformed JPEG images
* generated by the most recent transform operation.
*
* @return an array containing the sizes of the transformed JPEG images from
* the most recent call to {@link #transform transform()}
* @return an array containing the sizes of the transformed JPEG images
* generated by the most recent transform operation
*/
public int[] getTransformedSizes() throws Exception {
if (transformedSizes == null)

View File

@@ -0,0 +1,193 @@
/*
* Copyright (C)2014 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:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither the name of the libjpeg-turbo Project nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.libjpegturbo.turbojpeg;
/**
* This class encapsulates a YUV planar image buffer and the metadata
* associated with it. The TurboJPEG API allows both the JPEG compression and
* decompression pipelines to be split into stages: YUV encode, compress from
* YUV, decompress to YUV, and YUV decode. A <code>YUVImage</code> instance
* serves as the destination image for YUV encode and decompress-to-YUV
* operations and as the source image for compress-from-YUV and YUV decode
* operations.
* <p>
* Technically, the JPEG format uses the YCbCr colorspace (which technically is
* not a "colorspace" but rather a "color transform"), but per the convention
* of the digital video community, the TurboJPEG API uses "YUV" to refer to an
* image format consisting of Y, Cb, and Cr image planes. In this image
* format, the Y, Cb (U), and Cr (V) planes are stored sequentially in the same
* image buffer, and the size of each plane is determined by the image width,
* height, line padding, and level of chrominance subsampling. If the
* chrominance components are subsampled along the horizontal dimension, then
* the width of the luminance plane would be padded to the nearest multiple of
* 2 (same goes for the height of the luminance plane, if the chrominance
* components are subsampled along the vertical dimension.) For instance, if
* the source image is 35 x 35 pixels and 4:2:2 subsampling is used, then the
* luminance plane would be 36 x 35 bytes, and each of the chrominance planes
* would be 18 x 35 bytes. If you specify, for instance, a line padding of 4
* bytes on top of this, then the luminance plane would be 36 x 35 bytes, and
* each of the chrominance planes would be 20 x 35 bytes.
*/
public class YUVImage {
private static final String NO_ASSOC_ERROR =
"No YUV buffer is associated with this instance";
/**
* Create a <code>YUVImage</code> instance with a new image buffer.
*
* @param width width (in pixels) of the YUV image
*
* @param pad Each line of each plane in the YUV image buffer will be padded
* to this number of bytes (must be a power of 2.)
*
* @param height height (in pixels) of the YUV image
*
* @param subsamp the level of chrominance subsampling to be used in the YUV
* image (one of {@link TJ#SAMP_444 TJ.SAMP_*})
*/
public YUVImage(int width, int pad, int height, int subsamp)
throws Exception {
setBuffer(new byte[TJ.bufSizeYUV(width, pad, height, subsamp)], width, pad,
height, subsamp);
}
/**
* Create a <code>YUVImage</code> instance from an existing YUV planar image
* buffer.
*
* @param yuvImage image buffer that contains or will contain YUV planar
* image data. See {@link YUVImage above} for a description of the image
* format. You can use {@link TJ#bufSizeYUV} to determine the appropriate
* size for this buffer.
*
* @param width width (in pixels) of the YUV image
*
* @param pad the line padding used in the YUV image buffer. For
* instance, if each line in each plane of the buffer is padded to the
* nearest multiple of 4 bytes, then <code>pad</code> should be set to 4.
*
* @param height height (in pixels) of the YUV image
*
* @param subsamp the level of chrominance subsampling used in the YUV
* image (one of {@link TJ#SAMP_444 TJ.SAMP_*})
*/
public YUVImage(byte[] yuvImage, int width, int pad, int height,
int subsamp) throws Exception {
setBuffer(yuvImage, width, pad, height, subsamp);
}
private void setBuffer(byte[] yuvImage, int width, int pad, int height,
int subsamp) throws Exception {
if (yuvImage == null || width < 1 || pad < 1 || ((pad & (pad - 1)) != 0) ||
height < 1 || subsamp < 0 || subsamp >= TJ.NUMSAMP)
throw new Exception("Invalid argument in YUVImage()");
if (yuvImage.length != TJ.bufSizeYUV(width, pad, height, subsamp))
throw new Exception("YUV image buffer is the wrong size");
yuvBuf = yuvImage;
yuvWidth = width;
yuvPad = pad;
yuvHeight = height;
yuvSubsamp = subsamp;
}
/**
* Returns the width of the YUV image.
*
* @return the width of the YUV image
*/
public int getWidth() throws Exception {
if (yuvWidth < 1)
throw new Exception(NO_ASSOC_ERROR);
return yuvWidth;
}
/**
* Returns the height of the YUV image.
*
* @return the height of the YUV image
*/
public int getHeight() throws Exception {
if (yuvHeight < 1)
throw new Exception(NO_ASSOC_ERROR);
return yuvHeight;
}
/**
* Returns the line padding used in the YUV image buffer.
*
* @return the line padding used in the YUV image buffer
*/
public int getPad() throws Exception {
if (yuvPad < 1 || ((yuvPad & (yuvPad - 1)) != 0))
throw new Exception(NO_ASSOC_ERROR);
return yuvPad;
}
/**
* Returns the level of chrominance subsampling used in the YUV image. See
* {@link TJ#SAMP_444 TJ.SAMP_*}.
*
* @return the level of chrominance subsampling used in the YUV image
*/
public int getSubsamp() throws Exception {
if (yuvSubsamp < 0 || yuvSubsamp >= TJ.NUMSAMP)
throw new Exception(NO_ASSOC_ERROR);
return yuvSubsamp;
}
/**
* Returns the YUV image buffer
*
* @return the YUV image buffer
*/
public byte[] getBuf() throws Exception {
if (yuvBuf == null)
throw new Exception(NO_ASSOC_ERROR);
return yuvBuf;
}
/**
* Returns the size (in bytes) of the YUV image buffer
*
* @return the size (in bytes) of the YUV image buffer
*/
public int getSize() throws Exception {
if (yuvBuf == null)
throw new Exception(NO_ASSOC_ERROR);
return yuvBuf.length;
}
protected long handle = 0;
protected byte[] yuvBuf = null;
protected int yuvPad = 0;
protected int yuvWidth = 0;
protected int yuvHeight = 0;
protected int yuvSubsamp = -1;
};

View File

@@ -74,10 +74,10 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___
/*
* Class: org_libjpegturbo_turbojpeg_TJCompressor
* Method: encodeYUV
* Signature: ([BIIII[BIII)V
* Signature: ([BIIIIII[BIII)V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIII_3BIII
(JNIEnv *, jobject, jbyteArray, jint, jint, jint, jint, jbyteArray, jint, jint, jint);
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIIIII_3BIII
(JNIEnv *, jobject, jbyteArray, jint, jint, jint, jint, jint, jint, jbyteArray, jint, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJCompressor
@@ -90,10 +90,10 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___
/*
* Class: org_libjpegturbo_turbojpeg_TJCompressor
* Method: encodeYUV
* Signature: ([IIIII[BIII)V
* Signature: ([IIIIIII[BIII)V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIII_3BIII
(JNIEnv *, jobject, jintArray, jint, jint, jint, jint, jbyteArray, jint, jint, jint);
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIIIII_3BIII
(JNIEnv *, jobject, jintArray, jint, jint, jint, jint, jint, jint, jbyteArray, jint, jint, jint);
#ifdef __cplusplus
}

View File

@@ -79,6 +79,22 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3BIIII
(JNIEnv *, jobject, jbyteArray, jint, jbyteArray, jint, jint, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJDecompressor
* Method: decodeYUV
* Signature: ([BII[BIIIIIII)V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3BIIIIIII
(JNIEnv *, jobject, jbyteArray, jint, jint, jbyteArray, jint, jint, jint, jint, jint, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJDecompressor
* Method: decodeYUV
* Signature: ([BII[IIIIIIII)V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3IIIIIIII
(JNIEnv *, jobject, jbyteArray, jint, jint, jintArray, jint, jint, jint, jint, jint, jint, jint);
#ifdef __cplusplus
}
#endif

View File

@@ -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
* modification, are permitted provided that the following conditions are met:
@@ -250,12 +250,13 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFrom
return (jint)jpegSize;
}
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 pad, jint subsamp, jint flags)
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIIIII_3BIII
(JNIEnv *env, jobject obj, jbyteArray src, jint x, jint y, jint width,
jint pitch, jint height, jint pf, jbyteArray dst, jint pad, jint subsamp,
jint flags)
{
tjhandle handle=0;
jsize arraySize=0, yuvSize;
jsize arraySize=0, actualPitch, yuvSize;
unsigned char *srcBuf=NULL, *dstBuf=NULL;
gethandle();
@@ -266,7 +267,8 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___
if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF)
_throw("Mismatch between Java and C API");
arraySize=(pitch==0)? width*tjPixelSize[pf]*height:pitch*height;
actualPitch=(pitch==0)? width*tjPixelSize[pf]:pitch;
arraySize=(y+height-1)*actualPitch + x+width;
if((*env)->GetArrayLength(env, src)<arraySize)
_throw("Source buffer is not large enough");
yuvSize=(jsize)tjBufSizeYUV2(width, pad, height, subsamp);
@@ -278,8 +280,8 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___
bailif0(srcBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));
bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));
if(tjEncodeYUV3(handle, srcBuf, width, pitch, height, pf, dstBuf, pad,
subsamp, flags)==-1)
if(tjEncodeYUV3(handle, &srcBuf[y*actualPitch + x*tjPixelSize[pf]], width,
pitch, height, pf, dstBuf, pad, subsamp, flags)==-1)
{
(*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
(*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0);
@@ -297,16 +299,17 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___
(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);
Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIIIII_3BIII(
env, obj, src, 0, 0, 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)
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIIIII_3BIII
(JNIEnv *env, jobject obj, jintArray src, jint x, jint y, jint width,
jint stride, jint height, jint pf, jbyteArray dst, jint pad, jint subsamp,
jint flags)
{
tjhandle handle=0;
jsize arraySize=0, yuvSize;
jsize arraySize=0, actualStride, yuvSize;
unsigned char *srcBuf=NULL, *dstBuf=NULL;
gethandle();
@@ -319,7 +322,8 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___
if(tjPixelSize[pf]!=sizeof(jint))
_throw("Pixel format must be 32-bit when encoding from an integer buffer.");
arraySize=(stride==0)? width*height:stride*height;
actualStride=(stride==0)? width:stride;
arraySize=(y+height-1)*actualStride + x+width;
if((*env)->GetArrayLength(env, src)<arraySize)
_throw("Source buffer is not large enough");
yuvSize=(jsize)tjBufSizeYUV2(width, pad, height, subsamp);
@@ -331,8 +335,8 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___
bailif0(srcBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));
bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));
if(tjEncodeYUV3(handle, srcBuf, width, stride*sizeof(jint), height, pf,
dstBuf, pad, subsamp, flags)==-1)
if(tjEncodeYUV3(handle, &srcBuf[(y*actualStride + x)*sizeof(int)], width,
stride*sizeof(jint), height, pf, dstBuf, pad, subsamp, flags)==-1)
{
(*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
(*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0);
@@ -350,8 +354,8 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___
(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);
Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIIIII_3BIII(
env, obj, src, 0, 0, width, pitch, height, pf, dst, 4, subsamp, flags);
}
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_destroy
@@ -435,13 +439,13 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress
}
(*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0); jpegBuf=NULL;
bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegSubsamp", "I"));
bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcSubsamp", "I"));
(*env)->SetIntField(env, obj, _fid, jpegSubsamp);
bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegColorspace", "I"));
bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcColorspace", "I"));
(*env)->SetIntField(env, obj, _fid, jpegColorspace);
bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegWidth", "I"));
bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcWidth", "I"));
(*env)->SetIntField(env, obj, _fid, width);
bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegHeight", "I"));
bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcHeight", "I"));
(*env)->SetIntField(env, obj, _fid, height);
bailout:
@@ -562,11 +566,11 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress
if((*env)->GetArrayLength(env, src)<jpegSize)
_throw("Source buffer is not large enough");
bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegSubsamp", "I"));
bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcSubsamp", "I"));
jpegSubsamp=(int)(*env)->GetIntField(env, obj, _fid);
bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegWidth", "I"));
bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcWidth", "I"));
jpegWidth=(int)(*env)->GetIntField(env, obj, _fid);
bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegHeight", "I"));
bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcHeight", "I"));
jpegHeight=(int)(*env)->GetIntField(env, obj, _fid);
yuvSize=(jsize)tjBufSizeYUV2(desiredWidth==0? jpegWidth:desiredWidth,
@@ -601,6 +605,94 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress
env, obj, src, jpegSize, dst, 0, 4, 0, flags);
}
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3BIIIIIII
(JNIEnv *env, jobject obj, jbyteArray src, jint pad, jint subsamp,
jbyteArray dst, jint x, jint y, jint width, jint pitch, jint height,
jint pf, jint flags)
{
tjhandle handle=0;
jsize arraySize=0, actualPitch;
unsigned char *srcBuf=NULL, *dstBuf=NULL;
gethandle();
if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF)
_throw("Invalid argument in decodeYUV()");
if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF)
_throw("Mismatch between Java and C API");
arraySize=tjBufSizeYUV2(width, pad, height, subsamp);
if((*env)->GetArrayLength(env, src)<arraySize)
_throw("Source buffer is not large enough");
actualPitch=(pitch==0)? width*tjPixelSize[pf]:pitch;
arraySize=(y+height-1)*actualPitch + (x+width)*tjPixelSize[pf];
if((*env)->GetArrayLength(env, dst)<arraySize)
_throw("Destination buffer is not large enough");
bailif0(srcBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));
bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));
if(tjDecodeYUV(handle, srcBuf, pad, subsamp,
&dstBuf[y*actualPitch + x*tjPixelSize[pf]], width, pitch, height, pf,
flags)==-1)
{
(*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
(*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0);
dstBuf=srcBuf=NULL;
_throw(tjGetErrorStr());
}
bailout:
if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
if(srcBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0);
return;
}
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3IIIIIIII
(JNIEnv *env, jobject obj, jbyteArray src, jint pad, jint subsamp,
jintArray dst, jint x, jint y, jint width, jint stride, jint height,
jint pf, jint flags)
{
tjhandle handle=0;
jsize arraySize=0, actualStride;
unsigned char *srcBuf=NULL, *dstBuf=NULL;
gethandle();
if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF)
_throw("Invalid argument in decodeYUV()");
if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF)
_throw("Mismatch between Java and C API");
if(tjPixelSize[pf]!=sizeof(jint))
_throw("Pixel format must be 32-bit when decoding to an integer buffer.");
arraySize=tjBufSizeYUV2(width, pad, height, subsamp);
if((*env)->GetArrayLength(env, src)<arraySize)
_throw("Source buffer is not large enough");
actualStride=(stride==0)? width:stride;
arraySize=(y+height-1)*actualStride + x+width;
if((*env)->GetArrayLength(env, dst)<arraySize)
_throw("Destination buffer is not large enough");
bailif0(srcBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));
bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));
if(tjDecodeYUV(handle, srcBuf, pad, subsamp,
&dstBuf[(y*actualStride + x)*sizeof(int)], width, stride*sizeof(jint),
height, pf, flags)==-1)
{
(*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
(*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0);
dstBuf=srcBuf=NULL;
_throw(tjGetErrorStr());
}
bailout:
if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
if(srcBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0);
return;
}
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJTransformer_init
(JNIEnv *env, jobject obj)
{
@@ -698,11 +790,11 @@ JNIEXPORT jintArray JNICALL Java_org_libjpegturbo_turbojpeg_TJTransformer_transf
if((*env)->GetArrayLength(env, jsrcBuf)<jpegSize)
_throw("Source buffer is not large enough");
bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegWidth", "I"));
bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcWidth", "I"));
jpegWidth=(int)(*env)->GetIntField(env, obj, _fid);
bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegHeight", "I"));
bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcHeight", "I"));
jpegHeight=(int)(*env)->GetIntField(env, obj, _fid);
bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegSubsamp", "I"));
bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcSubsamp", "I"));
jpegSubsamp=(int)(*env)->GetIntField(env, obj, _fid);
n=(*env)->GetArrayLength(env, dstobjs);

View File

@@ -74,7 +74,9 @@ TURBOJPEG_1.4
tjEncodeYUV3;
Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV__IIII;
Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFromYUV___3BIIII_3BII;
Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIII_3BIII;
Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIII_3BIII;
Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIIIII_3BIII;
Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIIIII_3BIII;
Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3BIIII;
Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3BIIIIIII;
Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3IIIIIIII;
} TURBOJPEG_1.3;