Merge branch 'main' into dev
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2009-2014, 2016-2019, 2021-2022 D. R. Commander.
|
||||
* Copyright (C)2009-2014, 2016-2019, 2021-2023 D. R. Commander.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -37,7 +37,7 @@ final class TJBench {
|
||||
|
||||
private TJBench() {}
|
||||
|
||||
private static int flags = 0, quiet = 0, pf = TJ.PF_BGR, yuvPad = 1;
|
||||
private static int flags = 0, quiet = 0, pf = TJ.PF_BGR, yuvAlign = 1;
|
||||
private static boolean compOnly, decompOnly, doTile, doYUV, write = true;
|
||||
|
||||
static final String[] PIXFORMATSTR = {
|
||||
@@ -197,7 +197,7 @@ final class TJBench {
|
||||
int width = doTile ? tilew : scaledw;
|
||||
int height = doTile ? tileh : scaledh;
|
||||
|
||||
yuvImage = new YUVImage(width, yuvPad, height, subsamp);
|
||||
yuvImage = new YUVImage(width, yuvAlign, height, subsamp);
|
||||
Arrays.fill(yuvImage.getBuf(), (byte)127);
|
||||
}
|
||||
|
||||
@@ -217,7 +217,8 @@ final class TJBench {
|
||||
tjd.setSourceImage(jpegBuf[tile], jpegSize[tile]);
|
||||
} catch (TJException e) { handleTJException(e); }
|
||||
if (doYUV) {
|
||||
yuvImage.setBuf(yuvImage.getBuf(), width, yuvPad, height, subsamp);
|
||||
yuvImage.setBuf(yuvImage.getBuf(), width, yuvAlign, height,
|
||||
subsamp);
|
||||
try {
|
||||
tjd.decompressToYUV(yuvImage, flags);
|
||||
} catch (TJException e) { handleTJException(e); }
|
||||
@@ -377,7 +378,7 @@ final class TJBench {
|
||||
tjc.setSubsamp(subsamp);
|
||||
|
||||
if (doYUV) {
|
||||
yuvImage = new YUVImage(tilew, yuvPad, tileh, subsamp);
|
||||
yuvImage = new YUVImage(tilew, yuvAlign, tileh, subsamp);
|
||||
Arrays.fill(yuvImage.getBuf(), (byte)127);
|
||||
}
|
||||
|
||||
@@ -398,7 +399,7 @@ final class TJBench {
|
||||
if (doYUV) {
|
||||
double startEncode = getTime();
|
||||
|
||||
yuvImage.setBuf(yuvImage.getBuf(), width, yuvPad, height,
|
||||
yuvImage.setBuf(yuvImage.getBuf(), width, yuvAlign, height,
|
||||
subsamp);
|
||||
tjc.encodeYUV(yuvImage, flags);
|
||||
if (iter >= 0)
|
||||
@@ -737,8 +738,8 @@ final class TJBench {
|
||||
System.out.println("-quiet = Output results in tabular rather than verbose format");
|
||||
System.out.println("-yuv = Test YUV encoding/decoding functions");
|
||||
System.out.println("-yuvpad <p> = If testing YUV encoding/decoding, this specifies the number of");
|
||||
System.out.println(" bytes to which each row of each plane in the intermediate YUV image is");
|
||||
System.out.println(" padded (default = 1)");
|
||||
System.out.println(" bytes by which each row of each plane in the intermediate YUV image is");
|
||||
System.out.println(" evenly divisible (default = 1)");
|
||||
System.out.println("-scale M/N = Scale down the width/height of the decompressed JPEG image by a");
|
||||
System.out.print(" factor of M/N (M/N = ");
|
||||
for (i = 0; i < nsf; i++) {
|
||||
@@ -926,7 +927,7 @@ final class TJBench {
|
||||
} else
|
||||
usage();
|
||||
} else if (argv[i].equalsIgnoreCase("-yuv")) {
|
||||
System.out.println("Testing YUV planar encoding/decoding\n");
|
||||
System.out.println("Testing planar YUV encoding/decoding\n");
|
||||
doYUV = true;
|
||||
} else if (argv[i].equalsIgnoreCase("-yuvpad") &&
|
||||
i < argv.length - 1) {
|
||||
@@ -936,7 +937,7 @@ final class TJBench {
|
||||
temp = Integer.parseInt(argv[++i]);
|
||||
} catch (NumberFormatException e) {}
|
||||
if (temp >= 1)
|
||||
yuvPad = temp;
|
||||
yuvAlign = temp;
|
||||
} else if (argv[i].equalsIgnoreCase("-subsamp") &&
|
||||
i < argv.length - 1) {
|
||||
i++;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2011-2018, 2022 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2011-2018, 2022-2023 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:
|
||||
@@ -50,7 +50,7 @@ final class TJUnitTest {
|
||||
System.out.println("Options:");
|
||||
System.out.println("-yuv = test YUV encoding/decoding support");
|
||||
System.out.println("-noyuvpad = do not pad each line of each Y, U, and V plane to the nearest");
|
||||
System.out.println(" 4-byte boundary");
|
||||
System.out.println(" multiple of 4 bytes");
|
||||
System.out.println("-lossless = test lossless JPEG compression/decompression");
|
||||
System.out.println("-bi = test BufferedImage support\n");
|
||||
System.exit(1);
|
||||
@@ -95,7 +95,7 @@ final class TJUnitTest {
|
||||
private static boolean doYUV = false;
|
||||
private static boolean lossless = false;
|
||||
private static int psv = 1;
|
||||
private static int pad = 4;
|
||||
private static int yuvAlign = 4;
|
||||
private static boolean bi = false;
|
||||
|
||||
private static int exitStatus = 0;
|
||||
@@ -535,7 +535,7 @@ final class TJUnitTest {
|
||||
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 ypitch = pad(pw, yuvAlign), uvpitch = pad(cw, yuvAlign);
|
||||
int retval = 1;
|
||||
int correctsize = ypitch * ph +
|
||||
(subsamp == TJ.SAMP_GRAY ? 0 : uvpitch * ch * 2);
|
||||
@@ -671,7 +671,7 @@ final class TJUnitTest {
|
||||
if (doYUV) {
|
||||
System.out.format("%s %s -> YUV %s ... ", pfStrLong, buStrLong,
|
||||
SUBNAME_LONG[subsamp]);
|
||||
YUVImage yuvImage = tjc.encodeYUV(pad, flags);
|
||||
YUVImage yuvImage = tjc.encodeYUV(yuvAlign, flags);
|
||||
if (checkBufYUV(yuvImage.getBuf(), yuvImage.getSize(), w, h, subsamp,
|
||||
new TJScalingFactor(1, 1)) == 1)
|
||||
System.out.print("Passed.\n");
|
||||
@@ -738,8 +738,8 @@ final class TJUnitTest {
|
||||
if (!sf.isOne())
|
||||
System.out.format("%d/%d ... ", sf.getNum(), sf.getDenom());
|
||||
else System.out.print("... ");
|
||||
YUVImage yuvImage = tjd.decompressToYUV(scaledWidth, pad, scaledHeight,
|
||||
flags);
|
||||
YUVImage yuvImage = tjd.decompressToYUV(scaledWidth, yuvAlign,
|
||||
scaledHeight, flags);
|
||||
if (checkBufYUV(yuvImage.getBuf(), yuvImage.getSize(), scaledWidth,
|
||||
scaledHeight, subsamp, sf) == 1)
|
||||
System.out.print("Passed.\n");
|
||||
@@ -878,7 +878,7 @@ final class TJUnitTest {
|
||||
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 (doYUV)
|
||||
dstImage = new YUVImage(w, pad, h, subsamp);
|
||||
dstImage = new YUVImage(w, yuvAlign, h, subsamp);
|
||||
else
|
||||
dstBuf = new byte[TJ.bufSize(w, h, subsamp)];
|
||||
for (i = 0; i < w * h * 4; i++) {
|
||||
@@ -894,7 +894,7 @@ final class TJUnitTest {
|
||||
|
||||
srcBuf = new byte[h * w * 4];
|
||||
if (doYUV)
|
||||
dstImage = new YUVImage(h, pad, w, subsamp);
|
||||
dstImage = new YUVImage(h, yuvAlign, w, subsamp);
|
||||
else
|
||||
dstBuf = new byte[TJ.bufSize(h, w, subsamp)];
|
||||
for (i = 0; i < h * w * 4; i++) {
|
||||
@@ -926,7 +926,7 @@ final class TJUnitTest {
|
||||
if (argv[i].equalsIgnoreCase("-yuv"))
|
||||
doYUV = true;
|
||||
else if (argv[i].equalsIgnoreCase("-noyuvpad"))
|
||||
pad = 1;
|
||||
yuvAlign = 1;
|
||||
else if (argv[i].equalsIgnoreCase("-lossless"))
|
||||
lossless = true;
|
||||
else if (argv[i].equalsIgnoreCase("-bi")) {
|
||||
|
||||
@@ -74,8 +74,9 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int,%20int,%20int,%20int)">bufSizeYUV(int, int, int, int)</a></span> - Static method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||
<dd>
|
||||
<div class="block">Returns the size of the buffer (in bytes) required to hold a YUV planar
|
||||
image with the given width, height, and level of chrominance subsampling.</div>
|
||||
<div class="block">Returns the size of the buffer (in bytes) required to hold a unified
|
||||
planar YUV image with the given width, height, and level of chrominance
|
||||
subsampling.</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<a name="_C_">
|
||||
@@ -97,13 +98,14 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#compress(byte[],%20int)">compress(byte[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Compress the uncompressed source image associated with this compressor
|
||||
instance and output a JPEG image to the given destination buffer.</div>
|
||||
<div class="block">Compress the packed-pixel or planar YUV source image associated with this
|
||||
compressor instance and output a JPEG image to the given destination
|
||||
buffer.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#compress(int)">compress(int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Compress the uncompressed source image associated with this compressor
|
||||
instance and return a buffer containing a JPEG image.</div>
|
||||
<div class="block">Compress the packed-pixel or planar YUV source image associated with this
|
||||
compressor instance and return a buffer containing a JPEG image.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#CS_CMYK">CS_CMYK</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||
<dd>
|
||||
@@ -139,50 +141,52 @@
|
||||
<dl>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)">decompress(byte[], int, int, int, int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">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.</div>
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and output a packed-pixel
|
||||
grayscale, RGB, or CMYK image to the given destination buffer.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int,%20int,%20int,%20int,%20int)">decompress(int, int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Decompress the JPEG source image associated with this decompressor
|
||||
instance and return a buffer containing the decompressed image.</div>
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and return a buffer containing
|
||||
the packed-pixel decompressed image.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)">decompress(int[], int, int, int, int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">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.</div>
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and output a packed-pixel
|
||||
grayscale, RGB, or CMYK image to the given destination buffer.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(java.awt.image.BufferedImage,%20int)">decompress(BufferedImage, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">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.</div>
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and output a packed-pixel
|
||||
decompressed/decoded image to the given <code>BufferedImage</code>
|
||||
instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int,%20int,%20int,%20int)">decompress(int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">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.</div>
|
||||
instance containing the packed-pixel decompressed/decoded image.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)">decompressToYUV(YUVImage, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">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.</div>
|
||||
instance into a planar YUV image and store it in the given
|
||||
<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int,%20int[],%20int,%20int)">decompressToYUV(int, int[], int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Decompress the JPEG source image associated with this decompressor
|
||||
instance into a set of Y, U (Cb), and V (Cr) image planes and return a
|
||||
<code>YUVImage</code> instance containing the decompressed image planes.</div>
|
||||
<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing the decompressed image planes.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int,%20int,%20int,%20int)">decompressToYUV(int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Decompress the JPEG source image associated with this decompressor
|
||||
instance into a unified YUV planar image buffer and return a
|
||||
<code>YUVImage</code> instance containing the decompressed image.</div>
|
||||
instance into a unified planar YUV image and return a <a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a>
|
||||
instance containing the decompressed image.</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<a name="_E_">
|
||||
@@ -192,21 +196,21 @@
|
||||
<dl>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)">encodeYUV(YUVImage, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">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.</div>
|
||||
<div class="block">Encode the packed-pixel source image associated with this compressor
|
||||
instance into a planar YUV image and store it in the given
|
||||
<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int,%20int)">encodeYUV(int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Encode the uncompressed source image associated with this compressor
|
||||
instance into a unified YUV planar image buffer and return a
|
||||
<code>YUVImage</code> instance containing the encoded image.</div>
|
||||
<div class="block">Encode the packed-pixel source image associated with this compressor
|
||||
instance into a unified planar YUV image and return a <a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a>
|
||||
instance containing the encoded image.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int[],%20int)">encodeYUV(int[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Encode the uncompressed source image associated with this compressor
|
||||
<div class="block">Encode the packed-pixel source image associated with this compressor
|
||||
instance into separate Y, U (Cb), and V (Cr) image planes and return a
|
||||
<code>YUVImage</code> instance containing the encoded image planes.</div>
|
||||
<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing the encoded image planes.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJScalingFactor.html#equals(org.libjpegturbo.turbojpeg.TJScalingFactor)">equals(TJScalingFactor)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</a></dt>
|
||||
<dd>
|
||||
@@ -219,8 +223,8 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#ERR_WARNING">ERR_WARNING</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||
<dd>
|
||||
<div class="block">The error was non-fatal and recoverable, but the image may still be
|
||||
corrupt.</div>
|
||||
<div class="block">The error was non-fatal and recoverable, but the destination image may
|
||||
still be corrupt.</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<a name="_F_">
|
||||
@@ -234,8 +238,7 @@
|
||||
<dd> </dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_ACCURATEDCT">FLAG_ACCURATEDCT</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||
<dd>
|
||||
<div class="block">Use the most accurate DCT/IDCT algorithm available in the underlying
|
||||
codec.</div>
|
||||
<div class="block">Use the most accurate DCT/IDCT algorithm available.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_ARITHMETIC">FLAG_ARITHMETIC</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||
<dd>
|
||||
@@ -244,18 +247,17 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP">FLAG_BOTTOMUP</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||
<dd>
|
||||
<div class="block">The uncompressed source/destination image is stored in bottom-up (Windows,
|
||||
OpenGL) order, not top-down (X11) order.</div>
|
||||
<div class="block">Rows in the packed-pixel source/destination image are stored in bottom-up
|
||||
(Windows, OpenGL) order rather than in top-down (X11) order.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_FASTDCT">FLAG_FASTDCT</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||
<dd>
|
||||
<div class="block">Use the fastest DCT/IDCT algorithm available in the underlying codec.</div>
|
||||
<div class="block">Use the fastest DCT/IDCT algorithm available.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_FASTUPSAMPLE">FLAG_FASTUPSAMPLE</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||
<dd>
|
||||
<div class="block">When decompressing an image that was compressed using chrominance
|
||||
subsampling, use the fastest chrominance upsampling algorithm available in
|
||||
the underlying codec.</div>
|
||||
subsampling, use the fastest chrominance upsampling algorithm available.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_LIMITSCANS">FLAG_LIMITSCANS</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||
<dd>
|
||||
@@ -274,7 +276,7 @@
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING">FLAG_STOPONWARNING</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||
<dd>
|
||||
<div class="block">Immediately discontinue the current compression/decompression/transform
|
||||
operation if the underlying codec throws a warning (non-fatal error).</div>
|
||||
operation if a warning (non-fatal error) occurs.</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<a name="_G_">
|
||||
@@ -294,8 +296,8 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#getBuf()">getBuf()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
<dd>
|
||||
<div class="block">Returns the YUV image buffer (if this image is stored in a unified
|
||||
buffer rather than separate image planes.)</div>
|
||||
<div class="block">Returns the YUV buffer (if this image is stored in a unified buffer rather
|
||||
than separate image planes.)</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getColorspace()">getColorspace()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
@@ -339,7 +341,7 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGBuf()">getJPEGBuf()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Returns the JPEG image buffer associated with this decompressor instance.</div>
|
||||
<div class="block">Returns the JPEG buffer associated with this decompressor instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGSize()">getJPEGSize()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
@@ -367,7 +369,7 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#getPad()">getPad()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
<dd>
|
||||
<div class="block">Returns the line padding used in the YUV image buffer (if this image is
|
||||
<div class="block">Returns the row alignment (in bytes) of the YUV buffer (if this image is
|
||||
stored in a unified buffer rather than separate image planes.)</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#getPixelSize(int)">getPixelSize(int)</a></span> - Static method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||
@@ -401,17 +403,17 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()">getScalingFactors()</a></span> - Static method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||
<dd>
|
||||
<div class="block">Returns a list of fractional scaling factors that the JPEG decompressor in
|
||||
this implementation of TurboJPEG supports.</div>
|
||||
<div class="block">Returns a list of fractional scaling factors that the JPEG decompressor
|
||||
supports.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#getSize()">getSize()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
<dd>
|
||||
<div class="block">Returns the size (in bytes) of the YUV image buffer (if this image is
|
||||
stored in a unified buffer rather than separate image planes.)</div>
|
||||
<div class="block">Returns the size (in bytes) of the YUV buffer (if this image is stored in
|
||||
a unified buffer rather than separate image planes.)</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#getStrides()">getStrides()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
<dd>
|
||||
<div class="block">Returns the number of bytes per line of each plane in the YUV image.</div>
|
||||
<div class="block">Returns the number of bytes per row of each plane in the YUV image.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getSubsamp()">getSubsamp()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
@@ -425,7 +427,7 @@
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransformer.html#getTransformedSizes()">getTransformedSizes()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</a></dt>
|
||||
<dd>
|
||||
<div class="block">Returns an array containing the sizes of the transformed JPEG images
|
||||
generated by the most recent transform operation.</div>
|
||||
(in bytes) generated by the most recent transform operation.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getWidth()">getWidth()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
@@ -511,7 +513,7 @@
|
||||
<dl>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#op">op</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
||||
<dd>
|
||||
<div class="block">Transform operation (one of <code>OP_*</code>)</div>
|
||||
<div class="block">Transform operation (one of <a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OP_NONE"><code>OP_*</code></a>)</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OP_HFLIP">OP_HFLIP</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
||||
<dd>
|
||||
@@ -548,13 +550,13 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_ARITHMETIC">OPT_ARITHMETIC</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
||||
<dd>
|
||||
<div class="block">This option will enable arithmetic entropy coding in the output image
|
||||
<div class="block">This option will enable arithmetic entropy coding in the JPEG image
|
||||
generated by this particular transform.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_COPYNONE">OPT_COPYNONE</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
||||
<dd>
|
||||
<div class="block">This option will prevent <a href="./org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)"><code>TJTransformer.transform()</code></a> from copying any extra markers (including EXIF
|
||||
and ICC profile data) from the source image to the output image.</div>
|
||||
and ICC profile data) from the source image to the destination image.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_CROP">OPT_CROP</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
||||
<dd>
|
||||
@@ -562,8 +564,8 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_GRAY">OPT_GRAY</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
||||
<dd>
|
||||
<div class="block">This option will discard the color data in the input image and produce
|
||||
a grayscale output image.</div>
|
||||
<div class="block">This option will discard the color data in the source image and produce a
|
||||
grayscale destination image.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_NOOUTPUT">OPT_NOOUTPUT</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
||||
<dd>
|
||||
@@ -577,7 +579,7 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PROGRESSIVE">OPT_PROGRESSIVE</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
||||
<dd>
|
||||
<div class="block">This option will enable progressive entropy coding in the output image
|
||||
<div class="block">This option will enable progressive entropy coding in the JPEG image
|
||||
generated by this particular transform.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_TRIM">OPT_TRIM</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
||||
@@ -587,7 +589,8 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransform.html#options">options</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a></dt>
|
||||
<dd>
|
||||
<div class="block">Transform options (bitwise OR of one or more of <code>OPT_*</code>)</div>
|
||||
<div class="block">Transform options (bitwise OR of one or more of
|
||||
<a href="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT"><code>OPT_*</code></a>)</div>
|
||||
</dd>
|
||||
<dt><a href="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</a> - package org.libjpegturbo.turbojpeg</dt>
|
||||
<dd> </dd>
|
||||
@@ -694,7 +697,7 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#setBuf(byte[],%20int,%20int,%20int,%20int)">setBuf(byte[], int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
<dd>
|
||||
<div class="block">Assign a unified image buffer to this <code>YUVImage</code> instance.</div>
|
||||
<div class="block">Assign a unified buffer to this <code>YUVImage</code> instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setJPEGQuality(int)">setJPEGQuality(int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
<dd>
|
||||
@@ -702,18 +705,17 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)">setSourceImage(byte[], int, int, int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Associate an uncompressed RGB, grayscale, or CMYK source image with this
|
||||
<div class="block">Associate a packed-pixel RGB, grayscale, or CMYK source image with this
|
||||
compressor instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)">setSourceImage(BufferedImage, int, int, int, int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Associate an uncompressed RGB or grayscale source image with this
|
||||
<div class="block">Associate a packed-pixel RGB or grayscale source image with this
|
||||
compressor instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)">setSourceImage(YUVImage)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Associate an uncompressed YUV planar source image with this compressor
|
||||
instance.</div>
|
||||
<div class="block">Associate a planar YUV source image with this compressor instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte[],%20int)">setSourceImage(byte[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
@@ -723,7 +725,7 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)">setSourceImage(YUVImage)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Associate the specified YUV planar source image with this decompressor
|
||||
<div class="block">Associate the specified planar YUV source image with this decompressor
|
||||
instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSubsamp(int)">setSubsamp(int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
@@ -751,13 +753,13 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[],%20int,%20int,%20int,%20int,%20int,%20int)">TJCompressor(byte[], int, int, int, int, int, int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Create a TurboJPEG compressor instance and associate the uncompressed
|
||||
<div class="block">Create a TurboJPEG compressor instance and associate the packed-pixel
|
||||
source image stored in <code>srcImage</code> with the newly created
|
||||
instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(java.awt.image.BufferedImage,%20int,%20int,%20int,%20int)">TJCompressor(BufferedImage, int, int, int, int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Create a TurboJPEG compressor instance and associate the uncompressed
|
||||
<div class="block">Create a TurboJPEG compressor instance and associate the packed-pixel
|
||||
source image stored in <code>srcImage</code> with the newly created
|
||||
instance.</div>
|
||||
</dd>
|
||||
@@ -776,17 +778,19 @@
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(byte[])">TJDecompressor(byte[])</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Create a TurboJPEG decompressor instance and associate the JPEG source
|
||||
image stored in <code>jpegImage</code> with the newly created instance.</div>
|
||||
image or "abbreviated table specification" (AKA "tables-only") datastream
|
||||
stored in <code>jpegImage</code> with the newly created instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(byte[],%20int)">TJDecompressor(byte[], int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">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.</div>
|
||||
image or "abbreviated table specification" (AKA "tables-only") datastream
|
||||
of length <code>imageSize</code> bytes stored in <code>jpegImage</code>
|
||||
with the newly created instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(org.libjpegturbo.turbojpeg.YUVImage)">TJDecompressor(YUVImage)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd>
|
||||
<div class="block">Create a TurboJPEG decompressor instance and associate the YUV planar
|
||||
<div class="block">Create a TurboJPEG decompressor instance and associate the planar YUV
|
||||
source image stored in <code>yuvImage</code> with the newly created
|
||||
instance.</div>
|
||||
</dd>
|
||||
@@ -837,25 +841,26 @@
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransformer.html#TJTransformer(byte[])">TJTransformer(byte[])</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</a></dt>
|
||||
<dd>
|
||||
<div class="block">Create a TurboJPEG lossless transformer instance and associate the JPEG
|
||||
image stored in <code>jpegImage</code> with the newly created instance.</div>
|
||||
source image stored in <code>jpegImage</code> with the newly created
|
||||
instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransformer.html#TJTransformer(byte[],%20int)">TJTransformer(byte[], int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</a></dt>
|
||||
<dd>
|
||||
<div class="block">Create a TurboJPEG lossless transformer instance and associate the JPEG
|
||||
image of length <code>imageSize</code> bytes stored in
|
||||
source image of length <code>imageSize</code> bytes stored in
|
||||
<code>jpegImage</code> with the newly created instance.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)">transform(byte[][], TJTransform[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</a></dt>
|
||||
<dd>
|
||||
<div class="block">Losslessly transform the JPEG image associated with this transformer
|
||||
instance into one or more JPEG images stored in the given destination
|
||||
buffers.</div>
|
||||
<div class="block">Losslessly transform the JPEG source image associated with this
|
||||
transformer instance into one or more JPEG images stored in the given
|
||||
destination buffers.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJTransformer.html#transform(org.libjpegturbo.turbojpeg.TJTransform[],%20int)">transform(TJTransform[], int)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</a></dt>
|
||||
<dd>
|
||||
<div class="block">Losslessly transform the JPEG image associated with this transformer
|
||||
instance and return 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.</div>
|
||||
<div class="block">Losslessly transform the JPEG source image associated with this
|
||||
transformer instance and return 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.</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<a name="_Y_">
|
||||
@@ -863,13 +868,15 @@
|
||||
</a>
|
||||
<h2 class="title">Y</h2>
|
||||
<dl>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#yuvAlign">yuvAlign</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#yuvHeight">yuvHeight</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html#yuvImage">yuvImage</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><span class="strong">YUVImage</span></a> - Class in <a href="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</a></dt>
|
||||
<dd>
|
||||
<div class="block">This class encapsulates a YUV planar image and the metadata
|
||||
<div class="block">This class encapsulates a planar YUV image and the metadata
|
||||
associated with it.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(int,%20int[],%20int,%20int)">YUVImage(int, int[], int, int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
@@ -879,8 +886,8 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(int,%20int,%20int,%20int)">YUVImage(int, int, int, int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
<dd>
|
||||
<div class="block">Create a new <code>YUVImage</code> instance backed by a unified image
|
||||
buffer, and allocate memory for the image buffer.</div>
|
||||
<div class="block">Create a new <code>YUVImage</code> instance backed by a unified buffer,
|
||||
and allocate memory for the buffer.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(byte[][],%20int[],%20int,%20int[],%20int,%20int)">YUVImage(byte[][], int[], int, int[], int, int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
<dd>
|
||||
@@ -889,13 +896,11 @@
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(byte[],%20int,%20int,%20int,%20int)">YUVImage(byte[], int, int, int, int)</a></span> - Constructor for class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
<dd>
|
||||
<div class="block">Create a new <code>YUVImage</code> instance from an existing unified image
|
||||
<div class="block">Create a new <code>YUVImage</code> instance from an existing unified
|
||||
buffer.</div>
|
||||
</dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#yuvOffsets">yuvOffsets</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#yuvPad">yuvPad</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#yuvPlanes">yuvPlanes</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/YUVImage.html#yuvStrides">yuvStrides</a></span> - Variable in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></dt>
|
||||
|
||||
@@ -156,15 +156,14 @@ extends java.lang.Object</pre>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#ERR_WARNING">ERR_WARNING</a></strong></code>
|
||||
<div class="block">The error was non-fatal and recoverable, but the image may still be
|
||||
corrupt.</div>
|
||||
<div class="block">The error was non-fatal and recoverable, but the destination image may
|
||||
still be corrupt.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_ACCURATEDCT">FLAG_ACCURATEDCT</a></strong></code>
|
||||
<div class="block">Use the most accurate DCT/IDCT algorithm available in the underlying
|
||||
codec.</div>
|
||||
<div class="block">Use the most accurate DCT/IDCT algorithm available.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
@@ -177,22 +176,21 @@ extends java.lang.Object</pre>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP">FLAG_BOTTOMUP</a></strong></code>
|
||||
<div class="block">The uncompressed source/destination image is stored in bottom-up (Windows,
|
||||
OpenGL) order, not top-down (X11) order.</div>
|
||||
<div class="block">Rows in the packed-pixel source/destination image are stored in bottom-up
|
||||
(Windows, OpenGL) order rather than in top-down (X11) order.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_FASTDCT">FLAG_FASTDCT</a></strong></code>
|
||||
<div class="block">Use the fastest DCT/IDCT algorithm available in the underlying codec.</div>
|
||||
<div class="block">Use the fastest DCT/IDCT algorithm available.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_FASTUPSAMPLE">FLAG_FASTUPSAMPLE</a></strong></code>
|
||||
<div class="block">When decompressing an image that was compressed using chrominance
|
||||
subsampling, use the fastest chrominance upsampling algorithm available in
|
||||
the underlying codec.</div>
|
||||
subsampling, use the fastest chrominance upsampling algorithm available.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
@@ -219,7 +217,7 @@ extends java.lang.Object</pre>
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING">FLAG_STOPONWARNING</a></strong></code>
|
||||
<div class="block">Immediately discontinue the current compression/decompression/transform
|
||||
operation if the underlying codec throws a warning (non-fatal error).</div>
|
||||
operation if a warning (non-fatal error) occurs.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
@@ -381,11 +379,12 @@ extends java.lang.Object</pre>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int,%20int,%20int,%20int)">bufSizeYUV</a></strong>(int width,
|
||||
int pad,
|
||||
int align,
|
||||
int height,
|
||||
int subsamp)</code>
|
||||
<div class="block">Returns the size of the buffer (in bytes) required to hold a YUV planar
|
||||
image with the given width, height, and level of chrominance subsampling.</div>
|
||||
<div class="block">Returns the size of the buffer (in bytes) required to hold a unified
|
||||
planar YUV image with the given width, height, and level of chrominance
|
||||
subsampling.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
@@ -439,8 +438,8 @@ extends java.lang.Object</pre>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>static <a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</a>[]</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()">getScalingFactors</a></strong>()</code>
|
||||
<div class="block">Returns a list of fractional scaling factors that the JPEG decompressor in
|
||||
this implementation of TurboJPEG supports.</div>
|
||||
<div class="block">Returns a list of fractional scaling factors that the JPEG decompressor
|
||||
supports.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
@@ -757,8 +756,8 @@ extends java.lang.Object</pre>
|
||||
vice versa, but the mapping is typically not 1:1 or reversible, nor can it
|
||||
be defined with a simple formula. Thus, such a conversion is out of scope
|
||||
for a codec library. However, the TurboJPEG API allows for compressing
|
||||
CMYK pixels into a YCCK JPEG image (see <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#CS_YCCK"><code>CS_YCCK</code></a>) and
|
||||
decompressing YCCK JPEG images into CMYK pixels.</div>
|
||||
packed-pixel CMYK images into YCCK JPEG images (see <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#CS_YCCK"><code>CS_YCCK</code></a>) and
|
||||
decompressing YCCK JPEG images into packed-pixel CMYK images.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.PF_CMYK">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -783,8 +782,9 @@ extends java.lang.Object</pre>
|
||||
<div class="block">RGB colorspace. When compressing the JPEG image, the R, G, and B
|
||||
components in the source image are reordered into image planes, but no
|
||||
colorspace conversion or subsampling is performed. RGB JPEG images can be
|
||||
decompressed to any of the extended RGB pixel formats or grayscale, but
|
||||
they cannot be decompressed to YUV images.</div>
|
||||
decompressed to packed-pixel images with any of the extended RGB or
|
||||
grayscale pixel formats, but they cannot be decompressed to planar YUV
|
||||
images.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.CS_RGB">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -805,10 +805,11 @@ extends java.lang.Object</pre>
|
||||
transformation allowed the same signal to drive both black & white and
|
||||
color televisions, but JPEG images use YCbCr primarily because it allows
|
||||
the color data to be optionally subsampled for the purposes of reducing
|
||||
bandwidth or disk space. YCbCr is the most common JPEG colorspace, and
|
||||
YCbCr JPEG images can be compressed from and decompressed to any of the
|
||||
extended RGB pixel formats or grayscale, or they can be decompressed to
|
||||
YUV planar images.</div>
|
||||
network or disk usage. YCbCr is the most common JPEG colorspace, and
|
||||
YCbCr JPEG images can be compressed from and decompressed to packed-pixel
|
||||
images with any of the extended RGB or grayscale pixel formats. YCbCr
|
||||
JPEG images can also be compressed from and decompressed to planar YUV
|
||||
images.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.CS_YCbCr">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -821,9 +822,10 @@ extends java.lang.Object</pre>
|
||||
<pre>public static final int CS_GRAY</pre>
|
||||
<div class="block">Grayscale colorspace. The JPEG image retains only the luminance data (Y
|
||||
component), and any color data from the source image is discarded.
|
||||
Grayscale JPEG images can be compressed from and decompressed to any of
|
||||
the extended RGB pixel formats or grayscale, or they can be decompressed
|
||||
to YUV planar images.</div>
|
||||
Grayscale JPEG images can be compressed from and decompressed to
|
||||
packed-pixel images with any of the extended RGB or grayscale pixel
|
||||
formats, or they can be compressed from and decompressed to planar YUV
|
||||
images.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.CS_GRAY">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -837,7 +839,7 @@ extends java.lang.Object</pre>
|
||||
<div class="block">CMYK colorspace. When compressing the JPEG image, the C, M, Y, and K
|
||||
components in the source image are reordered into image planes, but no
|
||||
colorspace conversion or subsampling is performed. CMYK JPEG images can
|
||||
only be decompressed to CMYK pixels.</div>
|
||||
only be decompressed to packed-pixel images with the CMYK pixel format.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.CS_CMYK">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -854,7 +856,7 @@ extends java.lang.Object</pre>
|
||||
reversibly transformed into YCCK, and as with YCbCr, the chrominance
|
||||
components in the YCCK pixels can be subsampled without incurring major
|
||||
perceptual loss. YCCK JPEG images can only be compressed from and
|
||||
decompressed to CMYK pixels.</div>
|
||||
decompressed to packed-pixel images with the CMYK pixel format.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.CS_YCCK">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -865,8 +867,8 @@ extends java.lang.Object</pre>
|
||||
<li class="blockList">
|
||||
<h4>FLAG_BOTTOMUP</h4>
|
||||
<pre>public static final int FLAG_BOTTOMUP</pre>
|
||||
<div class="block">The uncompressed source/destination image is stored in bottom-up (Windows,
|
||||
OpenGL) order, not top-down (X11) order.</div>
|
||||
<div class="block">Rows in the packed-pixel source/destination image are stored in bottom-up
|
||||
(Windows, OpenGL) order rather than in top-down (X11) order.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_BOTTOMUP">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -878,10 +880,10 @@ extends java.lang.Object</pre>
|
||||
<h4>FLAG_FASTUPSAMPLE</h4>
|
||||
<pre>public static final int FLAG_FASTUPSAMPLE</pre>
|
||||
<div class="block">When decompressing an image that was compressed using chrominance
|
||||
subsampling, use the fastest chrominance upsampling algorithm available in
|
||||
the underlying codec. The default is to use smooth upsampling, which
|
||||
creates a smooth transition between neighboring chrominance components in
|
||||
order to reduce upsampling artifacts in the decompressed image.</div>
|
||||
subsampling, use the fastest chrominance upsampling algorithm available.
|
||||
The default is to use smooth upsampling, which creates a smooth transition
|
||||
between neighboring chrominance components in order to reduce upsampling
|
||||
artifacts in the decompressed image.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_FASTUPSAMPLE">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -892,12 +894,12 @@ extends java.lang.Object</pre>
|
||||
<li class="blockList">
|
||||
<h4>FLAG_FASTDCT</h4>
|
||||
<pre>public static final int FLAG_FASTDCT</pre>
|
||||
<div class="block">Use the fastest DCT/IDCT algorithm available in the underlying codec. The
|
||||
default if this flag is not specified is implementation-specific. For
|
||||
example, the implementation of TurboJPEG for libjpeg[-turbo] uses the fast
|
||||
algorithm by default when compressing, because this has been shown to have
|
||||
only a very slight effect on accuracy, but it uses the accurate algorithm
|
||||
when decompressing, because this has been shown to have a larger effect.</div>
|
||||
<div class="block">Use the fastest DCT/IDCT algorithm available. The default if this flag is
|
||||
not specified is implementation-specific. For example, the implementation
|
||||
of the TurboJPEG API in libjpeg-turbo uses the fast algorithm by default
|
||||
when compressing, because this has been shown to have only a very slight
|
||||
effect on accuracy, but it uses the accurate algorithm when decompressing,
|
||||
because this has been shown to have a larger effect.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_FASTDCT">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -908,13 +910,12 @@ extends java.lang.Object</pre>
|
||||
<li class="blockList">
|
||||
<h4>FLAG_ACCURATEDCT</h4>
|
||||
<pre>public static final int FLAG_ACCURATEDCT</pre>
|
||||
<div class="block">Use the most accurate DCT/IDCT algorithm available in the underlying
|
||||
codec. The default if this flag is not specified is
|
||||
implementation-specific. For example, the implementation of TurboJPEG for
|
||||
libjpeg[-turbo] uses the fast algorithm by default when compressing,
|
||||
because this has been shown to have only a very slight effect on accuracy,
|
||||
but it uses the accurate algorithm when decompressing, because this has
|
||||
been shown to have a larger effect.</div>
|
||||
<div class="block">Use the most accurate DCT/IDCT algorithm available. The default if this
|
||||
flag is not specified is implementation-specific. For example, the
|
||||
implementation of the TurboJPEG API in libjpeg-turbo uses the fast
|
||||
algorithm by default when compressing, because this has been shown to have
|
||||
only a very slight effect on accuracy, but it uses the accurate algorithm
|
||||
when decompressing, because this has been shown to have a larger effect.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_ACCURATEDCT">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -926,14 +927,13 @@ extends java.lang.Object</pre>
|
||||
<h4>FLAG_STOPONWARNING</h4>
|
||||
<pre>public static final int FLAG_STOPONWARNING</pre>
|
||||
<div class="block">Immediately discontinue the current compression/decompression/transform
|
||||
operation if the underlying codec throws a warning (non-fatal error). The
|
||||
default behavior is to allow the operation to complete unless a fatal
|
||||
error is encountered.
|
||||
operation if a warning (non-fatal error) occurs. The default behavior is
|
||||
to allow the operation to complete unless a fatal error is encountered.
|
||||
<p>
|
||||
NOTE: due to the design of the TurboJPEG Java API, only certain methods
|
||||
(specifically, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><code>TJDecompressor.decompress*()</code></a> methods
|
||||
with a void return type) will complete and leave the output image in a
|
||||
fully recoverable state after a non-fatal error occurs.</div>
|
||||
with a void return type) will complete and leave the destination image in
|
||||
a fully recoverable state after a non-fatal error occurs.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_STOPONWARNING">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -1002,7 +1002,7 @@ extends java.lang.Object</pre>
|
||||
<li> DCT/IDCT algorithm selection
|
||||
<li> Progressive entropy coding
|
||||
<li> Arithmetic entropy coding
|
||||
<li> Compression from/decompression to YUV planar images
|
||||
<li> Compression from/decompression to planar YUV images
|
||||
<li> Decompression scaling
|
||||
<li> Lossless transformations
|
||||
</ul></div>
|
||||
@@ -1027,13 +1027,13 @@ extends java.lang.Object</pre>
|
||||
<li class="blockList">
|
||||
<h4>ERR_WARNING</h4>
|
||||
<pre>public static final int ERR_WARNING</pre>
|
||||
<div class="block">The error was non-fatal and recoverable, but the image may still be
|
||||
corrupt.
|
||||
<div class="block">The error was non-fatal and recoverable, but the destination image may
|
||||
still be corrupt.
|
||||
<p>
|
||||
NOTE: due to the design of the TurboJPEG Java API, only certain methods
|
||||
(specifically, <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><code>TJDecompressor.decompress*()</code></a> methods
|
||||
with a void return type) will complete and leave the output image in a
|
||||
fully recoverable state after a non-fatal error occurs.</div>
|
||||
with a void return type) will complete and leave the destination image in
|
||||
a fully recoverable state after a non-fatal error occurs.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.ERR_WARNING">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -1066,7 +1066,7 @@ extends java.lang.Object</pre>
|
||||
<div class="block">Returns the MCU block width for the given level of chrominance
|
||||
subsampling.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>subsamp</code> - the level of chrominance subsampling (one of
|
||||
<code>SAMP_*</code>)</dd>
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>SAMP_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the MCU block width for the given level of chrominance
|
||||
subsampling.</dd></dl>
|
||||
</li>
|
||||
@@ -1081,7 +1081,7 @@ extends java.lang.Object</pre>
|
||||
<div class="block">Returns the MCU block height for the given level of chrominance
|
||||
subsampling.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>subsamp</code> - the level of chrominance subsampling (one of
|
||||
<code>SAMP_*</code>)</dd>
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>SAMP_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the MCU block height for the given level of chrominance
|
||||
subsampling.</dd></dl>
|
||||
</li>
|
||||
@@ -1094,7 +1094,7 @@ extends java.lang.Object</pre>
|
||||
<h4>getPixelSize</h4>
|
||||
<pre>public static int getPixelSize(int pixelFormat)</pre>
|
||||
<div class="block">Returns the pixel size (in bytes) for the given pixel format.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB"><code>PF_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the pixel size (in bytes) for the given pixel format.</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -1110,7 +1110,7 @@ extends java.lang.Object</pre>
|
||||
of format <code>TJ.PF_BGRX</code> is stored in <code>char pixel[]</code>,
|
||||
then the red component will be
|
||||
<code>pixel[TJ.getRedOffset(TJ.PF_BGRX)]</code>.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB"><code>PF_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the red offset for the given pixel format, or -1 if the pixel
|
||||
format does not have a red component.</dd></dl>
|
||||
</li>
|
||||
@@ -1127,7 +1127,7 @@ extends java.lang.Object</pre>
|
||||
of format <code>TJ.PF_BGRX</code> is stored in <code>char pixel[]</code>,
|
||||
then the green component will be
|
||||
<code>pixel[TJ.getGreenOffset(TJ.PF_BGRX)]</code>.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB"><code>PF_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the green offset for the given pixel format, or -1 if the pixel
|
||||
format does not have a green component.</dd></dl>
|
||||
</li>
|
||||
@@ -1144,7 +1144,7 @@ extends java.lang.Object</pre>
|
||||
of format <code>TJ.PF_BGRX</code> is stored in <code>char pixel[]</code>,
|
||||
then the blue component will be
|
||||
<code>pixel[TJ.getBlueOffset(TJ.PF_BGRX)]</code>.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB"><code>PF_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the blue offset for the given pixel format, or -1 if the pixel
|
||||
format does not have a blue component.</dd></dl>
|
||||
</li>
|
||||
@@ -1161,7 +1161,7 @@ extends java.lang.Object</pre>
|
||||
of format <code>TJ.PF_BGRA</code> is stored in <code>char pixel[]</code>,
|
||||
then the alpha component will be
|
||||
<code>pixel[TJ.getAlphaOffset(TJ.PF_BGRA)]</code>.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB"><code>PF_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the alpha offset for the given pixel format, or -1 if the pixel
|
||||
format does not have a alpha component.</dd></dl>
|
||||
</li>
|
||||
@@ -1178,7 +1178,7 @@ extends java.lang.Object</pre>
|
||||
<div class="block">Returns the maximum size of the buffer (in bytes) required to hold a JPEG
|
||||
image with the given width, height, and level of chrominance subsampling.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>width</code> - the width (in pixels) of the JPEG image</dd><dd><code>height</code> - the height (in pixels) of the JPEG image</dd><dd><code>jpegSubsamp</code> - the level of chrominance subsampling to be used when
|
||||
generating the JPEG image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><code>TJ.SAMP_*</code></a>)</dd>
|
||||
generating the JPEG image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the maximum size of the buffer (in bytes) required to hold a JPEG
|
||||
image with the given width, height, and level of chrominance subsampling.</dd></dl>
|
||||
</li>
|
||||
@@ -1190,16 +1190,20 @@ extends java.lang.Object</pre>
|
||||
<li class="blockList">
|
||||
<h4>bufSizeYUV</h4>
|
||||
<pre>public static int bufSizeYUV(int width,
|
||||
int pad,
|
||||
int align,
|
||||
int height,
|
||||
int subsamp)</pre>
|
||||
<div class="block">Returns the size of the buffer (in bytes) required to hold a YUV planar
|
||||
image with the given width, height, and level of chrominance subsampling.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>width</code> - the width (in pixels) of the YUV image</dd><dd><code>pad</code> - the width of each line in each plane of the image is padded to
|
||||
the nearest multiple of this number of bytes (must be a power of 2.)</dd><dd><code>height</code> - the height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV
|
||||
image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><code>TJ.SAMP_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the size of the buffer (in bytes) required to hold a YUV planar
|
||||
image with the given width, height, and level of chrominance subsampling.</dd></dl>
|
||||
<div class="block">Returns the size of the buffer (in bytes) required to hold a unified
|
||||
planar YUV image with the given width, height, and level of chrominance
|
||||
subsampling.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>width</code> - the width (in pixels) of the YUV image</dd><dd><code>align</code> - row alignment (in bytes) of the YUV image (must be a power of
|
||||
2.) Setting this parameter to n specifies that each row in each plane of
|
||||
the YUV image will be padded to the nearest multiple of n bytes
|
||||
(1 = unpadded.)</dd><dd><code>height</code> - the height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV
|
||||
image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the size of the buffer (in bytes) required to hold a unified
|
||||
planar YUV image with the given width, height, and level of chrominance
|
||||
subsampling.</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="planeSizeYUV(int, int, int, int, int)">
|
||||
@@ -1217,11 +1221,11 @@ extends java.lang.Object</pre>
|
||||
plane with the given parameters.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>componentID</code> - ID number of the image plane (0 = Y, 1 = U/Cb,
|
||||
2 = V/Cr)</dd><dd><code>width</code> - width (in pixels) of the YUV image. NOTE: this is the width
|
||||
of the whole image, not the plane width.</dd><dd><code>stride</code> - bytes per line in the image plane.</dd><dd><code>height</code> - height (in pixels) of the YUV image. NOTE: this is the
|
||||
of the whole image, not the plane width.</dd><dd><code>stride</code> - bytes per row in the image plane.</dd><dd><code>height</code> - height (in pixels) of the YUV image. NOTE: this is the
|
||||
height of the whole image, not the plane height.</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV
|
||||
image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><code>TJ.SAMP_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the size of the buffer (in bytes) required to hold a YUV planar
|
||||
image with the given parameters.</dd></dl>
|
||||
image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the size of the buffer (in bytes) required to hold a YUV image
|
||||
plane with the given parameters.</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="planeWidth(int, int, int)">
|
||||
@@ -1237,7 +1241,7 @@ extends java.lang.Object</pre>
|
||||
Refer to <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> for a description of plane width.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>componentID</code> - ID number of the image plane (0 = Y, 1 = U/Cb,
|
||||
2 = V/Cr)</dd><dd><code>width</code> - width (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV image
|
||||
(one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><code>TJ.SAMP_*</code></a>)</dd>
|
||||
(one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the plane width of a YUV image plane with the given parameters.</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -1254,7 +1258,7 @@ extends java.lang.Object</pre>
|
||||
Refer to <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> for a description of plane height.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>componentID</code> - ID number of the image plane (0 = Y, 1 = U/Cb,
|
||||
2 = V/Cr)</dd><dd><code>height</code> - height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV image
|
||||
(one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><code>TJ.SAMP_*</code></a>)</dd>
|
||||
(one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the plane height of a YUV image plane with the given parameters.</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -1265,10 +1269,10 @@ extends java.lang.Object</pre>
|
||||
<li class="blockList">
|
||||
<h4>getScalingFactors</h4>
|
||||
<pre>public static <a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</a>[] getScalingFactors()</pre>
|
||||
<div class="block">Returns a list of fractional scaling factors that the JPEG decompressor in
|
||||
this implementation of TurboJPEG supports.</div>
|
||||
<dl><dt><span class="strong">Returns:</span></dt><dd>a list of fractional scaling factors that the JPEG decompressor in
|
||||
this implementation of TurboJPEG supports.</dd></dl>
|
||||
<div class="block">Returns a list of fractional scaling factors that the JPEG decompressor
|
||||
supports.</div>
|
||||
<dl><dt><span class="strong">Returns:</span></dt><dd>a list of fractional scaling factors that the JPEG decompressor
|
||||
supports.</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -132,7 +132,7 @@ implements java.io.Closeable</pre>
|
||||
int y,
|
||||
int width,
|
||||
int height)</code>
|
||||
<div class="block">Create a TurboJPEG compressor instance and associate the uncompressed
|
||||
<div class="block">Create a TurboJPEG compressor instance and associate the packed-pixel
|
||||
source image stored in <code>srcImage</code> with the newly created
|
||||
instance.</div>
|
||||
</td>
|
||||
@@ -145,7 +145,7 @@ implements java.io.Closeable</pre>
|
||||
int pitch,
|
||||
int height,
|
||||
int pixelFormat)</code>
|
||||
<div class="block">Create a TurboJPEG compressor instance and associate the uncompressed
|
||||
<div class="block">Create a TurboJPEG compressor instance and associate the packed-pixel
|
||||
source image stored in <code>srcImage</code> with the newly created
|
||||
instance.</div>
|
||||
</td>
|
||||
@@ -175,42 +175,43 @@ implements java.io.Closeable</pre>
|
||||
<td class="colFirst"><code>void</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(byte[],%20int)">compress</a></strong>(byte[] dstBuf,
|
||||
int flags)</code>
|
||||
<div class="block">Compress the uncompressed source image associated with this compressor
|
||||
instance and output a JPEG image to the given destination buffer.</div>
|
||||
<div class="block">Compress the packed-pixel or planar YUV source image associated with this
|
||||
compressor instance and output a JPEG image to the given destination
|
||||
buffer.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>byte[]</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(int)">compress</a></strong>(int flags)</code>
|
||||
<div class="block">Compress the uncompressed source image associated with this compressor
|
||||
instance and return a buffer containing a JPEG image.</div>
|
||||
<div class="block">Compress the packed-pixel or planar YUV source image associated with this
|
||||
compressor instance and return a buffer containing a JPEG image.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int[],%20int)">encodeYUV</a></strong>(int[] strides,
|
||||
int flags)</code>
|
||||
<div class="block">Encode the uncompressed source image associated with this compressor
|
||||
<div class="block">Encode the packed-pixel source image associated with this compressor
|
||||
instance into separate Y, U (Cb), and V (Cr) image planes and return a
|
||||
<code>YUVImage</code> instance containing the encoded image planes.</div>
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing the encoded image planes.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int,%20int)">encodeYUV</a></strong>(int pad,
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int,%20int)">encodeYUV</a></strong>(int align,
|
||||
int flags)</code>
|
||||
<div class="block">Encode the uncompressed source image associated with this compressor
|
||||
instance into a unified YUV planar image buffer and return a
|
||||
<code>YUVImage</code> instance containing the encoded image.</div>
|
||||
<div class="block">Encode the packed-pixel source image associated with this compressor
|
||||
instance into a unified planar YUV image and return a <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a>
|
||||
instance containing the encoded image.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>void</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)">encodeYUV</a></strong>(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> dstImage,
|
||||
int flags)</code>
|
||||
<div class="block">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.</div>
|
||||
<div class="block">Encode the packed-pixel source image associated with this compressor
|
||||
instance into a planar YUV image and store it in the given
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
@@ -237,7 +238,7 @@ implements java.io.Closeable</pre>
|
||||
int y,
|
||||
int width,
|
||||
int height)</code>
|
||||
<div class="block">Associate an uncompressed RGB or grayscale source image with this
|
||||
<div class="block">Associate a packed-pixel RGB or grayscale source image with this
|
||||
compressor instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -250,15 +251,14 @@ implements java.io.Closeable</pre>
|
||||
int pitch,
|
||||
int height,
|
||||
int pixelFormat)</code>
|
||||
<div class="block">Associate an uncompressed RGB, grayscale, or CMYK source image with this
|
||||
<div class="block">Associate a packed-pixel RGB, grayscale, or CMYK source image with this
|
||||
compressor instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>void</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)">setSourceImage</a></strong>(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> srcImage)</code>
|
||||
<div class="block">Associate an uncompressed YUV planar source image with this compressor
|
||||
instance.</div>
|
||||
<div class="block">Associate a planar YUV source image with this compressor instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
@@ -317,7 +317,7 @@ implements java.io.Closeable</pre>
|
||||
int height,
|
||||
int pixelFormat)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Create a TurboJPEG compressor instance and associate the uncompressed
|
||||
<div class="block">Create a TurboJPEG compressor instance and associate the packed-pixel
|
||||
source image stored in <code>srcImage</code> with the newly created
|
||||
instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>x</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>y</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>width</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>pitch</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>height</code> - see <a href="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[],%20int,%20int,%20int,%20int,%20int,%20int)"><code>setSourceImage(byte[], int, int, int, int, int, int)</code></a> for description</dd><dd><code>pixelFormat</code> - pixel format of the source image (one of
|
||||
@@ -338,7 +338,7 @@ implements java.io.Closeable</pre>
|
||||
int width,
|
||||
int height)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Create a TurboJPEG compressor instance and associate the uncompressed
|
||||
<div class="block">Create a TurboJPEG compressor instance and associate the packed-pixel
|
||||
source image stored in <code>srcImage</code> with the newly created
|
||||
instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - see
|
||||
@@ -373,19 +373,19 @@ implements java.io.Closeable</pre>
|
||||
int height,
|
||||
int pixelFormat)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Associate an uncompressed RGB, grayscale, or CMYK source image with this
|
||||
<div class="block">Associate a packed-pixel RGB, grayscale, or CMYK source image with this
|
||||
compressor instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - image buffer containing RGB, grayscale, or CMYK pixels to
|
||||
be compressed or encoded. This buffer is not modified.</dd><dd><code>x</code> - x offset (in pixels) of the region in the source image from which
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - buffer containing a packed-pixel RGB, grayscale, or CMYK
|
||||
source image to be compressed or encoded. This buffer is not modified.</dd><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><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><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><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/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
|
||||
which the JPEG or YUV image should be compressed/encoded</dd><dd><code>pitch</code> - bytes per row in the source image. Normally this should be
|
||||
<code>width * TJ.pixelSize(pixelFormat)</code>, if the source image is
|
||||
unpadded. However, you can use this parameter to, for instance, specify
|
||||
that the rows in the source image are padded to the nearest multiple of 4
|
||||
bytes or to 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 rows,
|
||||
etc. Setting this parameter to 0 is the equivalent of setting it to
|
||||
<code>width * TJ.pixelSize(pixelFormat)</code>.</dd><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><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>)</dd>
|
||||
@@ -405,10 +405,11 @@ implements java.io.Closeable</pre>
|
||||
int width,
|
||||
int height)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Associate an uncompressed RGB or grayscale source image with this
|
||||
<div class="block">Associate a packed-pixel RGB or grayscale source image with this
|
||||
compressor instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - a <code>BufferedImage</code> instance containing RGB or
|
||||
grayscale pixels to be compressed or encoded. This image is not modified.</dd><dd><code>x</code> - x offset (in pixels) of the region in the source image from which
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - a <code>BufferedImage</code> instance containing a
|
||||
packed-pixel RGB or grayscale source image to be compressed or encoded.
|
||||
This image is not modified.</dd><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><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><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
|
||||
@@ -427,10 +428,9 @@ implements java.io.Closeable</pre>
|
||||
<h4>setSourceImage</h4>
|
||||
<pre>public void setSourceImage(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> srcImage)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Associate an uncompressed YUV planar source image with this compressor
|
||||
instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - YUV planar image to be compressed. This image is not
|
||||
modified.</dd>
|
||||
<div class="block">Associate a planar YUV source image with this compressor instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - planar YUV source image to be compressed. This image is
|
||||
not modified.</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
</li>
|
||||
@@ -447,16 +447,16 @@ implements java.io.Closeable</pre>
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#CS_YCbCr"><code>TJ.CS_YCbCr</code></a>) or from CMYK to YCCK (see <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#CS_YCCK"><code>TJ.CS_YCCK</code></a>) as part
|
||||
of the JPEG compression process, some of the Cb and Cr (chrominance)
|
||||
components can be discarded or averaged together to produce a smaller
|
||||
image with little perceptible loss of image clarity (the human eye is more
|
||||
sensitive to small changes in brightness than to small changes in color.)
|
||||
This is called "chrominance subsampling".
|
||||
image with little perceptible loss of image clarity. (The human eye is
|
||||
more sensitive to small changes in brightness than to small changes in
|
||||
color.) This is called "chrominance subsampling".
|
||||
<p>
|
||||
NOTE: 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. Furthermore, 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.</div>
|
||||
NOTE: This method has no effect when compressing a JPEG image from a
|
||||
planar YUV source image. In that case, the level of chrominance
|
||||
subsampling in the JPEG image is determined by the source image.
|
||||
Furthermore, 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 image.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><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>)</dd></dl>
|
||||
@@ -490,8 +490,9 @@ implements java.io.Closeable</pre>
|
||||
<pre>public void compress(byte[] dstBuf,
|
||||
int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Compress the uncompressed source image associated with this compressor
|
||||
instance and output a JPEG image to the given destination buffer.</div>
|
||||
<div class="block">Compress the packed-pixel or planar YUV source image associated with this
|
||||
compressor instance and output a JPEG image to the given destination
|
||||
buffer.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstBuf</code> - buffer that will receive the JPEG image. Use
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSize(int,%20int,%20int)"><code>TJ.bufSize(int, int, int)</code></a> to determine the maximum size for this buffer based on
|
||||
the source image's width and height and the desired level of chrominance
|
||||
@@ -509,8 +510,8 @@ implements java.io.Closeable</pre>
|
||||
<h4>compress</h4>
|
||||
<pre>public byte[] compress(int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Compress the uncompressed source image associated with this compressor
|
||||
instance and return a buffer containing a JPEG image.</div>
|
||||
<div class="block">Compress the packed-pixel or planar YUV source image associated with this
|
||||
compressor instance and return a buffer containing a JPEG image.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><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></dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>a buffer containing a JPEG image. The length of this buffer will
|
||||
@@ -528,13 +529,13 @@ implements java.io.Closeable</pre>
|
||||
<pre>public void encodeYUV(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> dstImage,
|
||||
int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">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.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><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
|
||||
<div class="block">Encode the packed-pixel source image associated with this compressor
|
||||
instance into a planar YUV image and store it in the given
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance. This method performs color conversion (which
|
||||
is accelerated in the libjpeg-turbo implementation) but does not execute
|
||||
any of the other steps in the JPEG compression process. Encoding CMYK
|
||||
source images into YUV images is not supported.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><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 planar YUV
|
||||
image</dd><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></dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
@@ -547,20 +548,21 @@ implements java.io.Closeable</pre>
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>encodeYUV</h4>
|
||||
<pre>public <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> encodeYUV(int pad,
|
||||
<pre>public <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> encodeYUV(int align,
|
||||
int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Encode the uncompressed source image associated with this compressor
|
||||
instance into a unified YUV planar image buffer 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.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><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><dd><code>flags</code> - the bitwise OR of one or more of
|
||||
<div class="block">Encode the packed-pixel source image associated with this compressor
|
||||
instance into a unified planar YUV image and return a <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a>
|
||||
instance containing the encoded image. This method performs color
|
||||
conversion (which is accelerated in the libjpeg-turbo implementation) but
|
||||
does not execute any of the other steps in the JPEG compression process.
|
||||
Encoding CMYK source images into YUV images is not supported.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>align</code> - row alignment (in bytes) of the YUV image (must be a power of
|
||||
2.) Setting this parameter to n will cause each row in each plane of the
|
||||
YUV image to be padded to the nearest multiple of n bytes (1 = unpadded.)</dd><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></dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>a YUV planar image.</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>a <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing the unified planar YUV
|
||||
encoded image</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
</li>
|
||||
@@ -574,21 +576,22 @@ implements java.io.Closeable</pre>
|
||||
<pre>public <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> encodeYUV(int[] strides,
|
||||
int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Encode the uncompressed source image associated with this compressor
|
||||
<div class="block">Encode the packed-pixel source image associated with this compressor
|
||||
instance into separate Y, U (Cb), and V (Cr) image planes and return a
|
||||
<code>YUVImage</code> instance containing the encoded image planes. 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.</div>
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing the encoded image planes. This
|
||||
method performs color conversion (which is accelerated in the
|
||||
libjpeg-turbo implementation) but does not execute any of the other steps
|
||||
in the JPEG compression process. Encoding CMYK source images into YUV
|
||||
images is not supported.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>strides</code> - an array of integers, each specifying the number of bytes
|
||||
per line in the corresponding plane of the output image. Setting the
|
||||
stride for any plane to 0 is the same as setting it to the component width
|
||||
of the plane. If <code>strides</code> is null, then the strides for all
|
||||
planes will be set to their respective component widths. You can adjust
|
||||
the strides in order to add an arbitrary amount of line padding to each
|
||||
plane.</dd><dd><code>flags</code> - the bitwise OR of one or more of
|
||||
per row in the corresponding plane of the YUV source image. Setting the
|
||||
stride for any plane to 0 is the same as setting it to the plane width
|
||||
(see <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a>.) If <code>strides</code> is null, then the strides
|
||||
for all planes will be set to their respective plane widths. You can
|
||||
adjust the strides in order to add an arbitrary amount of row padding to
|
||||
each plane.</dd><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></dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>a YUV planar image.</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>a <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing the encoded image planes</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
</li>
|
||||
|
||||
@@ -163,7 +163,7 @@
|
||||
into multiple DCT coefficient buffers and call the callback function once
|
||||
for each buffer.</dd><dd><code>planeRegion</code> - rectangle containing the width and height of the
|
||||
component plane to which <code>coeffBuffer</code> belongs</dd><dd><code>componentID</code> - ID number of the component plane to which
|
||||
<code>coeffBuffer</code> belongs (Y, Cb, and Cr have, respectively, ID's
|
||||
<code>coeffBuffer</code> belongs. (Y, Cb, and Cr have, respectively, ID's
|
||||
of 0, 1, and 2 in typical JPEG images.)</dd><dd><code>transformID</code> - ID number of the transformed image to which
|
||||
<code>coeffBuffer</code> belongs. This is the same as the index of the
|
||||
transform in the <code>transforms</code> array that was passed to <a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)"><code>TJTransformer.transform()</code></a>.</dd><dd><code>transform</code> - a <a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><code>TJTransform</code></a> instance that specifies the
|
||||
|
||||
@@ -184,20 +184,22 @@ implements java.io.Closeable</pre>
|
||||
<tr class="rowColor">
|
||||
<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(byte[])">TJDecompressor</a></strong>(byte[] jpegImage)</code>
|
||||
<div class="block">Create a TurboJPEG decompressor instance and associate the JPEG source
|
||||
image stored in <code>jpegImage</code> with the newly created instance.</div>
|
||||
image or "abbreviated table specification" (AKA "tables-only") datastream
|
||||
stored in <code>jpegImage</code> with the newly created instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(byte[],%20int)">TJDecompressor</a></strong>(byte[] jpegImage,
|
||||
int imageSize)</code>
|
||||
<div class="block">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.</div>
|
||||
image or "abbreviated table specification" (AKA "tables-only") datastream
|
||||
of length <code>imageSize</code> bytes stored in <code>jpegImage</code>
|
||||
with the newly created instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(org.libjpegturbo.turbojpeg.YUVImage)">TJDecompressor</a></strong>(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> yuvImage)</code>
|
||||
<div class="block">Create a TurboJPEG decompressor instance and associate the YUV planar
|
||||
<div class="block">Create a TurboJPEG decompressor instance and associate the planar YUV
|
||||
source image stored in <code>yuvImage</code> with the newly created
|
||||
instance.</div>
|
||||
</td>
|
||||
@@ -227,9 +229,10 @@ implements java.io.Closeable</pre>
|
||||
<td class="colFirst"><code>void</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(java.awt.image.BufferedImage,%20int)">decompress</a></strong>(java.awt.image.BufferedImage dstImage,
|
||||
int flags)</code>
|
||||
<div class="block">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.</div>
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and output a packed-pixel
|
||||
decompressed/decoded image to the given <code>BufferedImage</code>
|
||||
instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
@@ -242,9 +245,9 @@ implements java.io.Closeable</pre>
|
||||
int desiredHeight,
|
||||
int pixelFormat,
|
||||
int flags)</code>
|
||||
<div class="block">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.</div>
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and output a packed-pixel
|
||||
grayscale, RGB, or CMYK image to the given destination buffer.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
@@ -257,9 +260,9 @@ implements java.io.Closeable</pre>
|
||||
int desiredHeight,
|
||||
int pixelFormat,
|
||||
int flags)</code>
|
||||
<div class="block">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.</div>
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and output a packed-pixel
|
||||
grayscale, RGB, or CMYK image to the given destination buffer.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
@@ -270,7 +273,7 @@ implements java.io.Closeable</pre>
|
||||
int flags)</code>
|
||||
<div class="block">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.</div>
|
||||
instance containing the packed-pixel decompressed/decoded image.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
@@ -280,8 +283,9 @@ implements java.io.Closeable</pre>
|
||||
int desiredHeight,
|
||||
int pixelFormat,
|
||||
int flags)</code>
|
||||
<div class="block">Decompress the JPEG source image associated with this decompressor
|
||||
instance and return a buffer containing the decompressed image.</div>
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and return a buffer containing
|
||||
the packed-pixel decompressed image.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
@@ -292,18 +296,18 @@ implements java.io.Closeable</pre>
|
||||
int flags)</code>
|
||||
<div class="block">Decompress the JPEG source image associated with this decompressor
|
||||
instance into a set of Y, U (Cb), and V (Cr) image planes and return a
|
||||
<code>YUVImage</code> instance containing the decompressed image planes.</div>
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing the decompressed image planes.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int,%20int,%20int,%20int)">decompressToYUV</a></strong>(int desiredWidth,
|
||||
int pad,
|
||||
int align,
|
||||
int desiredHeight,
|
||||
int flags)</code>
|
||||
<div class="block">Decompress the JPEG source image associated with this decompressor
|
||||
instance into a unified YUV planar image buffer and return a
|
||||
<code>YUVImage</code> instance containing the decompressed image.</div>
|
||||
instance into a unified planar YUV image and return a <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a>
|
||||
instance containing the decompressed image.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
@@ -311,8 +315,8 @@ implements java.io.Closeable</pre>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage,%20int)">decompressToYUV</a></strong>(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> dstImage,
|
||||
int flags)</code>
|
||||
<div class="block">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.</div>
|
||||
instance into a planar YUV image and store it in the given
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
@@ -345,7 +349,7 @@ implements java.io.Closeable</pre>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>byte[]</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGBuf()">getJPEGBuf</a></strong>()</code>
|
||||
<div class="block">Returns the JPEG image buffer associated with this decompressor instance.</div>
|
||||
<div class="block">Returns the JPEG buffer associated with this decompressor instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
@@ -399,7 +403,7 @@ implements java.io.Closeable</pre>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>void</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)">setSourceImage</a></strong>(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> srcImage)</code>
|
||||
<div class="block">Associate the specified YUV planar source image with this decompressor
|
||||
<div class="block">Associate the specified planar YUV source image with this decompressor
|
||||
instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -536,9 +540,11 @@ implements java.io.Closeable</pre>
|
||||
<pre>public TJDecompressor(byte[] jpegImage)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Create a TurboJPEG decompressor instance and associate the JPEG source
|
||||
image stored in <code>jpegImage</code> with the newly created instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - JPEG image buffer (size of the JPEG image is assumed to
|
||||
be the length of the array.) This buffer is not modified.</dd>
|
||||
image or "abbreviated table specification" (AKA "tables-only") datastream
|
||||
stored in <code>jpegImage</code> with the newly created instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - buffer containing a JPEG source image or tables-only
|
||||
datastream. (The size of the JPEG image or datastream is assumed to be
|
||||
the length of the array.) This buffer is not modified.</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
</li>
|
||||
@@ -553,9 +559,12 @@ implements java.io.Closeable</pre>
|
||||
int imageSize)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">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.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - JPEG image buffer. This buffer is not modified.</dd><dd><code>imageSize</code> - size of the JPEG image (in bytes)</dd>
|
||||
image or "abbreviated table specification" (AKA "tables-only") datastream
|
||||
of length <code>imageSize</code> bytes stored in <code>jpegImage</code>
|
||||
with the newly created instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - buffer containing a JPEG source image or tables-only
|
||||
datastream. This buffer is not modified.</dd><dd><code>imageSize</code> - size of the JPEG source image or tables-only datastream
|
||||
(in bytes)</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
</li>
|
||||
@@ -568,10 +577,10 @@ implements java.io.Closeable</pre>
|
||||
<h4>TJDecompressor</h4>
|
||||
<pre>public TJDecompressor(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> yuvImage)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Create a TurboJPEG decompressor instance and associate the YUV planar
|
||||
<div class="block">Create a TurboJPEG decompressor instance and associate the planar YUV
|
||||
source image stored in <code>yuvImage</code> with the newly created
|
||||
instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><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
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>yuvImage</code> - <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing a planar YUV source
|
||||
image to be decoded. This image is not modified.</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
@@ -604,9 +613,9 @@ implements java.io.Closeable</pre>
|
||||
subsequent "abbreviated image" datastreams. This is useful, for instance,
|
||||
when decompressing video streams in which all frames share the same
|
||||
quantization and Huffman tables.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - buffer containing a JPEG image or an "abbreviated table
|
||||
specification" (AKA "tables-only") datastream. This buffer is not
|
||||
modified.</dd><dd><code>imageSize</code> - size of the JPEG image (in bytes)</dd>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - buffer containing a JPEG source image or tables-only
|
||||
datastream. This buffer is not modified.</dd><dd><code>imageSize</code> - size of the JPEG source image or tables-only datastream
|
||||
(in bytes)</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
</li>
|
||||
@@ -618,11 +627,11 @@ implements java.io.Closeable</pre>
|
||||
<li class="blockList">
|
||||
<h4>setSourceImage</h4>
|
||||
<pre>public void setSourceImage(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> srcImage)</pre>
|
||||
<div class="block">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.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><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. This image is not modified.</dd></dl>
|
||||
<div class="block">Associate the specified planar YUV source image with this decompressor
|
||||
instance. Subsequent decompress operations will decode this image into a
|
||||
packed-pixel RGB or grayscale destination image.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing a planar YUV source
|
||||
image to be decoded. This image is not modified.</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="getWidth()">
|
||||
@@ -701,8 +710,8 @@ implements java.io.Closeable</pre>
|
||||
<li class="blockList">
|
||||
<h4>getJPEGBuf</h4>
|
||||
<pre>public byte[] getJPEGBuf()</pre>
|
||||
<div class="block">Returns the JPEG image buffer associated with this decompressor instance.</div>
|
||||
<dl><dt><span class="strong">Returns:</span></dt><dd>the JPEG image buffer associated with this decompressor instance.</dd></dl>
|
||||
<div class="block">Returns the JPEG buffer associated with this decompressor instance.</div>
|
||||
<dl><dt><span class="strong">Returns:</span></dt><dd>the JPEG buffer associated with this decompressor instance.</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="getJPEGSize()">
|
||||
@@ -730,12 +739,12 @@ implements java.io.Closeable</pre>
|
||||
decompressor can generate without exceeding the desired image width and
|
||||
height.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>desiredWidth</code> - desired width (in pixels) of the decompressed image.
|
||||
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><dd><code>desiredHeight</code> - desired height (in pixels) of the decompressed image.
|
||||
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><dd><code>desiredHeight</code> - desired height (in pixels) of the decompressed image.
|
||||
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>
|
||||
image. (In other words, the height will not be considered when
|
||||
determining the scaled image size.)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the width of the largest scaled-down image that the TurboJPEG
|
||||
decompressor can generate without exceeding the desired image width and
|
||||
height.</dd></dl>
|
||||
@@ -753,12 +762,12 @@ implements java.io.Closeable</pre>
|
||||
decompressor can generate without exceeding the desired image width and
|
||||
height.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>desiredWidth</code> - desired width (in pixels) of the decompressed image.
|
||||
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><dd><code>desiredHeight</code> - desired height (in pixels) of the decompressed image.
|
||||
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><dd><code>desiredHeight</code> - desired height (in pixels) of the decompressed image.
|
||||
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>
|
||||
image. (In other words, the height will not be considered when
|
||||
determining the scaled image size.)</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>the height of the largest scaled-down image that the TurboJPEG
|
||||
decompressor can generate without exceeding the desired image width and
|
||||
height.</dd></dl>
|
||||
@@ -779,25 +788,26 @@ implements java.io.Closeable</pre>
|
||||
int pixelFormat,
|
||||
int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">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.
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and output a packed-pixel
|
||||
grayscale, RGB, or CMYK image to the given destination buffer.
|
||||
<p>
|
||||
NOTE: The output image is fully recoverable if this method throws a
|
||||
NOTE: The destination image is fully recoverable if this method throws a
|
||||
non-fatal <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg"><code>TJException</code></a> (unless
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING"><code>TJ.FLAG_STOPONWARNING</code></a> is specified.)</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><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,%20int)"><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><dd><code>x</code> - x offset (in pixels) of the region in the destination image into
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstBuf</code> - buffer that will receive the packed-pixel
|
||||
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.</code><a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><code>getScaled</code></a><code>(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,%20int)"><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><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><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><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
|
||||
@@ -805,18 +815,18 @@ implements java.io.Closeable</pre>
|
||||
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
|
||||
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><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 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,%20int)"><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.
|
||||
ignored if the source image is a YUV image.</dd><dd><code>pitch</code> - bytes per row in the destination image. Normally this should
|
||||
be set to <code>scaledWidth * TJ.pixelSize(pixelFormat)</code>, if the
|
||||
destination image will be unpadded. However, you can use this to, for
|
||||
instance, pad each row of the destination image to the nearest multiple of
|
||||
4 bytes 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.</code><a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><code>getScaled</code></a><code>(jpegWidth)</code>
|
||||
or by calling <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int,%20int)"><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><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
|
||||
@@ -824,8 +834,8 @@ implements java.io.Closeable</pre>
|
||||
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
|
||||
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><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><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></dd>
|
||||
@@ -845,8 +855,9 @@ implements java.io.Closeable</pre>
|
||||
int pixelFormat,
|
||||
int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Decompress the JPEG source image associated with this decompressor
|
||||
instance and return a buffer containing the decompressed image.</div>
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and return a buffer containing
|
||||
the packed-pixel decompressed image.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>desiredWidth</code> - see
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)"><code>decompress(byte[], int, int, int, int, int, int, int)</code></a>
|
||||
for description</dd><dd><code>pitch</code> - see
|
||||
@@ -856,7 +867,7 @@ implements java.io.Closeable</pre>
|
||||
for description</dd><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><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></dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>a buffer containing the decompressed image.</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>a buffer containing the packed-pixel decompressed image.</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
</li>
|
||||
@@ -871,21 +882,21 @@ implements java.io.Closeable</pre>
|
||||
int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">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. 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.
|
||||
instance into a planar YUV image and store it in the given
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance. This method performs JPEG decompression but
|
||||
leaves out the color conversion step, so a planar YUV image is generated
|
||||
instead of a packed-pixel image. This method cannot be used to decompress
|
||||
JPEG source images with the CMYK or YCCK colorspace.
|
||||
<p>
|
||||
NOTE: The YUV planar output image is fully recoverable if this method
|
||||
NOTE: The planar YUV destination image is fully recoverable if this method
|
||||
throws a non-fatal <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg"><code>TJException</code></a> (unless
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING"><code>TJ.FLAG_STOPONWARNING</code></a> is specified.)</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><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><dd><code>flags</code> - the bitwise OR of one or more of
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><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 planar YUV
|
||||
decompressed image. The level of subsampling specified in this
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance must match that of the JPEG image, and the width
|
||||
and height specified in the <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance must match one of
|
||||
the scaled image sizes that the decompressor is capable of generating from
|
||||
the JPEG source image.</dd><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></dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
@@ -904,32 +915,33 @@ implements java.io.Closeable</pre>
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Decompress the JPEG source image associated with this decompressor
|
||||
instance into a set of Y, U (Cb), and V (Cr) image planes and return a
|
||||
<code>YUVImage</code> instance containing the decompressed image planes.
|
||||
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.</div>
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing the decompressed image planes. This
|
||||
method performs JPEG decompression but leaves out the color conversion
|
||||
step, so a planar YUV image is generated instead of a packed-pixel image.
|
||||
This method cannot be used to decompress JPEG source images with the CMYK
|
||||
or YCCK colorspace.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><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
|
||||
the width of the JPEG image. (In other words, the width will not be
|
||||
considered when determining the scaled image size.)</dd><dd><code>strides</code> - an array of integers, each specifying the number of bytes
|
||||
per line in the corresponding plane of the output image. Setting the
|
||||
stride for any plane to 0 is the same as setting it to the scaled
|
||||
component width of the plane. If <tt>strides</tt> is NULL, then the
|
||||
strides for all planes will be set to their respective scaled component
|
||||
widths. You can adjust the strides in order to add an arbitrary amount of
|
||||
line padding to each plane.</dd><dd><code>desiredHeight</code> - desired height (in pixels) of the YUV image. If the
|
||||
per row in the corresponding plane of the YUV image. Setting the stride
|
||||
for any plane to 0 is the same as setting it to the scaled plane width
|
||||
(see <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a>.) If <code>strides</code> is null, then the strides
|
||||
for all planes will be set to their respective scaled plane widths. You
|
||||
can adjust the strides in order to add an arbitrary amount of row padding
|
||||
to each plane.</dd><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
|
||||
the height of the JPEG image. (In other words, the height will not be
|
||||
considered when determining the scaled image size.)</dd><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></dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>a YUV planar image.</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>a <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing the decompressed image
|
||||
planes</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
</li>
|
||||
@@ -941,34 +953,34 @@ implements java.io.Closeable</pre>
|
||||
<li class="blockList">
|
||||
<h4>decompressToYUV</h4>
|
||||
<pre>public <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a> decompressToYUV(int desiredWidth,
|
||||
int pad,
|
||||
int align,
|
||||
int desiredHeight,
|
||||
int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Decompress the JPEG source image associated with this decompressor
|
||||
instance into a unified YUV planar image buffer 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.</div>
|
||||
instance into a unified planar YUV image and return a <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a>
|
||||
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 a packed-pixel image. This method cannot be
|
||||
used to decompress JPEG source images with the CMYK or YCCK colorspace.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><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><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><dd><code>desiredHeight</code> - desired height (in pixels) of the YUV image. If the
|
||||
the width of the JPEG image. (In other words, the width will not be
|
||||
considered when determining the scaled image size.)</dd><dd><code>align</code> - row alignment (in bytes) of the YUV image (must be a power of
|
||||
2.) Setting this parameter to n will cause each row in each plane of the
|
||||
YUV image to be padded to the nearest multiple of n bytes (1 = unpadded.)</dd><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
|
||||
the height of the JPEG image. (In other words, the height will not be
|
||||
considered when determining the scaled image size.)</dd><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></dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>a YUV planar image.</dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>a <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing the unified planar YUV
|
||||
decompressed image</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
</li>
|
||||
@@ -988,25 +1000,26 @@ implements java.io.Closeable</pre>
|
||||
int pixelFormat,
|
||||
int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">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.
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and output a packed-pixel
|
||||
grayscale, RGB, or CMYK image to the given destination buffer.
|
||||
<p>
|
||||
NOTE: The output image is fully recoverable if this method throws a
|
||||
NOTE: The destination image is fully recoverable if this method throws a
|
||||
non-fatal <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg"><code>TJException</code></a> (unless
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING"><code>TJ.FLAG_STOPONWARNING</code></a> is specified.)</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><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,%20int)"><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><dd><code>x</code> - x offset (in pixels) of the region in the destination image into
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstBuf</code> - buffer that will receive the packed-pixel
|
||||
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.</code><a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><code>getScaled</code></a><code>(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,%20int)"><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><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><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><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
|
||||
@@ -1014,16 +1027,16 @@ implements java.io.Closeable</pre>
|
||||
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
|
||||
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><dd><code>stride</code> - pixels per line of the destination image. Normally, this
|
||||
ignored if the source image is a YUV image.</dd><dd><code>stride</code> - pixels per row in 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: 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,%20int)"><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.
|
||||
can be determined by calling
|
||||
<code>scalingFactor.</code><a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><code>getScaled</code></a><code>(jpegWidth)</code>
|
||||
or by calling <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int,%20int)"><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><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
|
||||
@@ -1031,8 +1044,8 @@ implements java.io.Closeable</pre>
|
||||
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
|
||||
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><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><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></dd>
|
||||
@@ -1049,20 +1062,21 @@ implements java.io.Closeable</pre>
|
||||
<pre>public void decompress(java.awt.image.BufferedImage dstImage,
|
||||
int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">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.
|
||||
<div class="block">Decompress the JPEG source image or decode the planar YUV source image
|
||||
associated with this decompressor instance and output a packed-pixel
|
||||
decompressed/decoded image to the given <code>BufferedImage</code>
|
||||
instance.
|
||||
<p>
|
||||
NOTE: The output image is fully recoverable if this method throws a
|
||||
NOTE: The destination image is fully recoverable if this method throws a
|
||||
non-fatal <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg"><code>TJException</code></a> (unless
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_STOPONWARNING"><code>TJ.FLAG_STOPONWARNING</code></a> is specified.)</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstImage</code> - a <code>BufferedImage</code> instance that will receive
|
||||
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><dd><code>flags</code> - the bitwise OR of one or more of
|
||||
the packed-pixel 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 the decompressor 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><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></dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
@@ -1081,7 +1095,7 @@ implements java.io.Closeable</pre>
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">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.</div>
|
||||
instance containing the packed-pixel decompressed/decoded image.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>desiredWidth</code> - see
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[],%20int,%20int,%20int,%20int,%20int,%20int,%20int)"><code>decompress(byte[], int, int, int, int, int, int, int)</code></a> for
|
||||
description</dd><dd><code>desiredHeight</code> - see
|
||||
@@ -1090,7 +1104,7 @@ implements java.io.Closeable</pre>
|
||||
instance that will be created (for instance,
|
||||
<code>BufferedImage.TYPE_INT_RGB</code>)</dd><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></dd>
|
||||
<dt><span class="strong">Returns:</span></dt><dd>a <code>BufferedImage</code> instance containing the
|
||||
<dt><span class="strong">Returns:</span></dt><dd>a <code>BufferedImage</code> instance containing the packed-pixel
|
||||
decompressed/decoded image.</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
|
||||
@@ -167,7 +167,7 @@ extends java.awt.Rectangle</pre>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#op">op</a></strong></code>
|
||||
<div class="block">Transform operation (one of <code>OP_*</code>)</div>
|
||||
<div class="block">Transform operation (one of <a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OP_NONE"><code>OP_*</code></a>)</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
@@ -222,7 +222,7 @@ extends java.awt.Rectangle</pre>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_ARITHMETIC">OPT_ARITHMETIC</a></strong></code>
|
||||
<div class="block">This option will enable arithmetic entropy coding in the output image
|
||||
<div class="block">This option will enable arithmetic entropy coding in the JPEG image
|
||||
generated by this particular transform.</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -230,7 +230,7 @@ extends java.awt.Rectangle</pre>
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_COPYNONE">OPT_COPYNONE</a></strong></code>
|
||||
<div class="block">This option will prevent <a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)"><code>TJTransformer.transform()</code></a> from copying any extra markers (including EXIF
|
||||
and ICC profile data) from the source image to the output image.</div>
|
||||
and ICC profile data) from the source image to the destination image.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
@@ -242,8 +242,8 @@ extends java.awt.Rectangle</pre>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_GRAY">OPT_GRAY</a></strong></code>
|
||||
<div class="block">This option will discard the color data in the input image and produce
|
||||
a grayscale output image.</div>
|
||||
<div class="block">This option will discard the color data in the source image and produce a
|
||||
grayscale destination image.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
@@ -263,7 +263,7 @@ extends java.awt.Rectangle</pre>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>static int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PROGRESSIVE">OPT_PROGRESSIVE</a></strong></code>
|
||||
<div class="block">This option will enable progressive entropy coding in the output image
|
||||
<div class="block">This option will enable progressive entropy coding in the JPEG image
|
||||
generated by this particular transform.</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -277,7 +277,8 @@ extends java.awt.Rectangle</pre>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#options">options</a></strong></code>
|
||||
<div class="block">Transform options (bitwise OR of one or more of <code>OPT_*</code>)</div>
|
||||
<div class="block">Transform options (bitwise OR of one or more of
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT"><code>OPT_*</code></a>)</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -516,7 +517,7 @@ extends java.awt.Rectangle</pre>
|
||||
the level of chrominance subsampling used. If the image's width or height
|
||||
is not evenly divisible by 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 there will be partial MCU blocks on the
|
||||
right and/or bottom edges. It is not possible to move these partial MCU
|
||||
right and/or bottom edges. It is not possible to move these partial MCU
|
||||
blocks to the top or left of the image, so any transform that would
|
||||
require that is "imperfect." If this option is not specified, then any
|
||||
partial MCU blocks that cannot be transformed will be left in place, which
|
||||
@@ -554,8 +555,8 @@ extends java.awt.Rectangle</pre>
|
||||
<li class="blockList">
|
||||
<h4>OPT_GRAY</h4>
|
||||
<pre>public static final int OPT_GRAY</pre>
|
||||
<div class="block">This option will discard the color data in the input image and produce
|
||||
a grayscale output image.</div>
|
||||
<div class="block">This option will discard the color data in the source image and produce a
|
||||
grayscale destination image.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJTransform.OPT_GRAY">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -580,7 +581,7 @@ extends java.awt.Rectangle</pre>
|
||||
<li class="blockList">
|
||||
<h4>OPT_PROGRESSIVE</h4>
|
||||
<pre>public static final int OPT_PROGRESSIVE</pre>
|
||||
<div class="block">This option will enable progressive entropy coding in the output image
|
||||
<div class="block">This option will enable progressive entropy coding in the JPEG image
|
||||
generated by this particular transform. Progressive entropy coding will
|
||||
generally improve compression relative to baseline entropy coding (the
|
||||
default), but it will reduce compression and decompression performance
|
||||
@@ -596,7 +597,7 @@ extends java.awt.Rectangle</pre>
|
||||
<h4>OPT_COPYNONE</h4>
|
||||
<pre>public static final int OPT_COPYNONE</pre>
|
||||
<div class="block">This option will prevent <a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)"><code>TJTransformer.transform()</code></a> from copying any extra markers (including EXIF
|
||||
and ICC profile data) from the source image to the output image.</div>
|
||||
and ICC profile data) from the source image to the destination image.</div>
|
||||
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJTransform.OPT_COPYNONE">Constant Field Values</a></dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -607,7 +608,7 @@ extends java.awt.Rectangle</pre>
|
||||
<li class="blockList">
|
||||
<h4>OPT_ARITHMETIC</h4>
|
||||
<pre>public static final int OPT_ARITHMETIC</pre>
|
||||
<div class="block">This option will enable arithmetic entropy coding in the output image
|
||||
<div class="block">This option will enable arithmetic entropy coding in the JPEG image
|
||||
generated by this particular transform. Arithmetic entropy coding will
|
||||
generally improve compression relative to Huffman entropy coding (the
|
||||
default), but it will reduce compression and decompression performance
|
||||
@@ -622,7 +623,7 @@ extends java.awt.Rectangle</pre>
|
||||
<li class="blockList">
|
||||
<h4>op</h4>
|
||||
<pre>public int op</pre>
|
||||
<div class="block">Transform operation (one of <code>OP_*</code>)</div>
|
||||
<div class="block">Transform operation (one of <a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OP_NONE"><code>OP_*</code></a>)</div>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="options">
|
||||
@@ -632,7 +633,8 @@ extends java.awt.Rectangle</pre>
|
||||
<li class="blockList">
|
||||
<h4>options</h4>
|
||||
<pre>public int options</pre>
|
||||
<div class="block">Transform options (bitwise OR of one or more of <code>OPT_*</code>)</div>
|
||||
<div class="block">Transform options (bitwise OR of one or more of
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT"><code>OPT_*</code></a>)</div>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="cf">
|
||||
@@ -683,8 +685,8 @@ extends java.awt.Rectangle</pre>
|
||||
equivalent of setting it to (width of the source JPEG image -
|
||||
<code>x</code>).</dd><dd><code>h</code> - the height of the cropping region. Setting this to 0 is the
|
||||
equivalent of setting it to (height of the source JPEG image -
|
||||
<code>y</code>).</dd><dd><code>op</code> - one of the transform operations (<code>OP_*</code>)</dd><dd><code>options</code> - the bitwise OR of one or more of the transform options
|
||||
(<code>OPT_*</code>)</dd><dd><code>cf</code> - an instance of an object that implements the <a href="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg"><code>TJCustomFilter</code></a> interface, or null if no custom filter is needed</dd></dl>
|
||||
<code>y</code>).</dd><dd><code>op</code> - one of the transform operations (<a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OP_NONE"><code>OP_*</code></a>)</dd><dd><code>options</code> - the bitwise OR of one or more of the transform options
|
||||
(<a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT"><code>OPT_*</code></a>)</dd><dd><code>cf</code> - an instance of an object that implements the <a href="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg"><code>TJCustomFilter</code></a> interface, or null if no custom filter is needed</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="TJTransform(java.awt.Rectangle, int, int, org.libjpegturbo.turbojpeg.TJCustomFilter)">
|
||||
@@ -700,8 +702,8 @@ extends java.awt.Rectangle</pre>
|
||||
<div class="block">Create a new lossless transform instance with the given parameters.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>r</code> - a <code>Rectangle</code> instance that specifies the cropping
|
||||
region. See <a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#TJTransform(int,%20int,%20int,%20int,%20int,%20int,%20org.libjpegturbo.turbojpeg.TJCustomFilter)"><code>TJTransform(int, int, int, int, int, int, TJCustomFilter)</code></a> for more
|
||||
detail.</dd><dd><code>op</code> - one of the transform operations (<code>OP_*</code>)</dd><dd><code>options</code> - the bitwise OR of one or more of the transform options
|
||||
(<code>OPT_*</code>)</dd><dd><code>cf</code> - an instance of an object that implements the <a href="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg"><code>TJCustomFilter</code></a> interface, or null if no custom filter is needed</dd></dl>
|
||||
detail.</dd><dd><code>op</code> - one of the transform operations (<a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OP_NONE"><code>OP_*</code></a>)</dd><dd><code>options</code> - the bitwise OR of one or more of the transform options
|
||||
(<a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT"><code>OPT_*</code></a>)</dd><dd><code>cf</code> - an instance of an object that implements the <a href="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg"><code>TJCustomFilter</code></a> interface, or null if no custom filter is needed</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -148,14 +148,15 @@ extends <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title=
|
||||
<tr class="rowColor">
|
||||
<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#TJTransformer(byte[])">TJTransformer</a></strong>(byte[] jpegImage)</code>
|
||||
<div class="block">Create a TurboJPEG lossless transformer instance and associate the JPEG
|
||||
image stored in <code>jpegImage</code> with the newly created instance.</div>
|
||||
source image stored in <code>jpegImage</code> with the newly created
|
||||
instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#TJTransformer(byte[],%20int)">TJTransformer</a></strong>(byte[] jpegImage,
|
||||
int imageSize)</code>
|
||||
<div class="block">Create a TurboJPEG lossless transformer instance and associate the JPEG
|
||||
image of length <code>imageSize</code> bytes stored in
|
||||
source image of length <code>imageSize</code> bytes stored in
|
||||
<code>jpegImage</code> with the newly created instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -178,7 +179,7 @@ extends <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title=
|
||||
<td class="colFirst"><code>int[]</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#getTransformedSizes()">getTransformedSizes</a></strong>()</code>
|
||||
<div class="block">Returns an array containing the sizes of the transformed JPEG images
|
||||
generated by the most recent transform operation.</div>
|
||||
(in bytes) generated by the most recent transform operation.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
@@ -186,18 +187,18 @@ extends <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title=
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][],%20org.libjpegturbo.turbojpeg.TJTransform[],%20int)">transform</a></strong>(byte[][] dstBufs,
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a>[] transforms,
|
||||
int flags)</code>
|
||||
<div class="block">Losslessly transform the JPEG image associated with this transformer
|
||||
instance into one or more JPEG images stored in the given destination
|
||||
buffers.</div>
|
||||
<div class="block">Losslessly transform the JPEG source image associated with this
|
||||
transformer instance into one or more JPEG images stored in the given
|
||||
destination buffers.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code><a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a>[]</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(org.libjpegturbo.turbojpeg.TJTransform[],%20int)">transform</a></strong>(<a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a>[] transforms,
|
||||
int flags)</code>
|
||||
<div class="block">Losslessly transform the JPEG image associated with this transformer
|
||||
instance and return 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.</div>
|
||||
<div class="block">Losslessly transform the JPEG source image associated with this
|
||||
transformer instance and return 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.</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -251,9 +252,11 @@ extends <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title=
|
||||
<pre>public TJTransformer(byte[] jpegImage)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Create a TurboJPEG lossless transformer instance and associate the JPEG
|
||||
image stored in <code>jpegImage</code> with the newly created instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - JPEG image buffer (size of the JPEG image is assumed to
|
||||
be the length of the array.) This buffer is not modified.</dd>
|
||||
source image stored in <code>jpegImage</code> with the newly created
|
||||
instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - buffer containing the JPEG source image to transform.
|
||||
(The size of the JPEG image is assumed to be the length of the array.)
|
||||
This buffer is not modified.</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
</li>
|
||||
@@ -268,9 +271,10 @@ extends <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title=
|
||||
int imageSize)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Create a TurboJPEG lossless transformer instance and associate the JPEG
|
||||
image of length <code>imageSize</code> bytes stored in
|
||||
source image of length <code>imageSize</code> bytes stored in
|
||||
<code>jpegImage</code> with the newly created instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - JPEG image buffer. This buffer is not modified.</dd><dd><code>imageSize</code> - size of the JPEG image (in bytes)</dd>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - buffer containing the JPEG source image to transform.
|
||||
This buffer is not modified.</dd><dd><code>imageSize</code> - size of the JPEG source image (in bytes)</dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
</li>
|
||||
@@ -293,25 +297,26 @@ extends <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title=
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a>[] transforms,
|
||||
int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Losslessly transform the JPEG image associated with this transformer
|
||||
instance into one or more JPEG images stored in the given destination
|
||||
buffers. Lossless transforms work by moving the raw coefficients from one
|
||||
JPEG image structure to another without altering the values of the
|
||||
coefficients. While this is typically faster than decompressing the
|
||||
image, transforming it, and re-compressing it, lossless transforms are not
|
||||
free. Each lossless transform requires reading and performing Huffman
|
||||
decoding on all of the coefficients in the source image, regardless of the
|
||||
size of the destination image. Thus, this method provides a means of
|
||||
generating multiple transformed images from the same source or of applying
|
||||
multiple transformations simultaneously, in order to eliminate the need to
|
||||
read the source coefficients multiple times.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstBufs</code> - an array of image buffers. <code>dstbufs[i]</code> will
|
||||
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,%20int,%20int)"><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 and the level of subsampling used in the source image.</dd><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
|
||||
<div class="block">Losslessly transform the JPEG source image associated with this
|
||||
transformer instance into one or more JPEG images stored in the given
|
||||
destination buffers. Lossless transforms work by moving the raw
|
||||
coefficients from one JPEG image structure to another without altering the
|
||||
values of the coefficients. While this is typically faster than
|
||||
decompressing the image, transforming it, and re-compressing it, lossless
|
||||
transforms are not free. Each lossless transform requires reading and
|
||||
performing Huffman decoding on all of the coefficients in the source
|
||||
image, regardless of the size of the destination image. Thus, this method
|
||||
provides a means of generating multiple transformed images from the same
|
||||
source or of applying multiple transformations simultaneously, in order to
|
||||
eliminate the need to read the source coefficients multiple times.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dstBufs</code> - an array of JPEG destination buffers.
|
||||
<code>dstbufs[i]</code> will 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,%20int,%20int)"><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 and the level of subsampling
|
||||
used in the source image.</dd><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><dd><code>flags</code> - the bitwise OR of one or more of
|
||||
corresponding transformed JPEG image</dd><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></dd>
|
||||
<dt><span class="strong">Throws:</span></dt>
|
||||
<dd><code><a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd></dl>
|
||||
@@ -326,12 +331,12 @@ extends <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title=
|
||||
<pre>public <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a>[] transform(<a href="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a>[] transforms,
|
||||
int flags)
|
||||
throws <a href="../../../org/libjpegturbo/turbojpeg/TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
|
||||
<div class="block">Losslessly transform the JPEG image associated with this transformer
|
||||
instance and return 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.</div>
|
||||
<div class="block">Losslessly transform the JPEG source image associated with this
|
||||
transformer instance and return 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.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><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><dd><code>flags</code> - the bitwise OR of one or more of
|
||||
corresponding transformed JPEG image</dd><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></dd>
|
||||
<dt><span class="strong">Returns:</span></dt><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.</dd>
|
||||
@@ -347,9 +352,9 @@ extends <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title=
|
||||
<h4>getTransformedSizes</h4>
|
||||
<pre>public int[] getTransformedSizes()</pre>
|
||||
<div class="block">Returns an array containing the sizes of the transformed JPEG images
|
||||
generated by the most recent transform operation.</div>
|
||||
(in bytes) generated by the most recent transform operation.</div>
|
||||
<dl><dt><span class="strong">Returns:</span></dt><dd>an array containing the sizes of the transformed JPEG images
|
||||
generated by the most recent transform operation.</dd></dl>
|
||||
(in bytes) generated by the most recent transform operation.</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
<br>
|
||||
<pre>public class <span class="strong">YUVImage</span>
|
||||
extends java.lang.Object</pre>
|
||||
<div class="block">This class encapsulates a YUV planar image and the metadata
|
||||
<div class="block">This class encapsulates a planar YUV image 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
|
||||
@@ -106,30 +106,32 @@ extends java.lang.Object</pre>
|
||||
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.
|
||||
Technically, the JPEG format uses the YCbCr colorspace (which is technically
|
||||
not a colorspace but 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.
|
||||
<p>
|
||||
Each plane is simply a 2D array of bytes, each byte representing the value
|
||||
of one of the components (Y, Cb, or Cr) at a particular location in the
|
||||
image. The width and height of each plane are determined by the image
|
||||
width, height, and level of chrominance subsampling. The luminance plane
|
||||
width is the image width padded to the nearest multiple of the horizontal
|
||||
subsampling factor (2 in the case of 4:2:0 and 4:2:2, 4 in the case of
|
||||
4:1:1, 1 in the case of 4:4:4 or grayscale.) Similarly, the luminance plane
|
||||
height is the image height padded to the nearest multiple of the vertical
|
||||
subsampling factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4
|
||||
or grayscale.) The chrominance plane width is equal to the luminance plane
|
||||
width divided by the horizontal subsampling factor, and the chrominance
|
||||
plane height is equal to the luminance plane height divided by the vertical
|
||||
subsampling factor.
|
||||
subsampling factor (1 in the case of 4:4:4, grayscale, or 4:4:0; 2 in the
|
||||
case of 4:2:2 or 4:2:0; 4 in the case of 4:1:1.) Similarly, the luminance
|
||||
plane height is the image height padded to the nearest multiple of the
|
||||
vertical subsampling factor (1 in the case of 4:4:4, 4:2:2, grayscale, or
|
||||
4:1:1; 2 in the case of 4:2:0 or 4:4:0.) This is irrespective of any
|
||||
additional padding that may be specified as an argument to the various
|
||||
YUVImage methods. The chrominance plane width is equal to the luminance
|
||||
plane width divided by the horizontal subsampling factor, and the
|
||||
chrominance plane height is equal to the luminance plane height divided by
|
||||
the vertical subsampling factor.
|
||||
<p>
|
||||
For example, 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 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.</div>
|
||||
chrominance planes would be 18 x 35 bytes. If you specify a row alignment
|
||||
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.</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -154,15 +156,15 @@ extends java.lang.Object</pre>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>protected int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#yuvHeight">yuvHeight</a></strong></code> </td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#yuvAlign">yuvAlign</a></strong></code> </td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>protected int[]</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#yuvOffsets">yuvOffsets</a></strong></code> </td>
|
||||
<td class="colFirst"><code>protected int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#yuvHeight">yuvHeight</a></strong></code> </td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>protected int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#yuvPad">yuvPad</a></strong></code> </td>
|
||||
<td class="colFirst"><code>protected int[]</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#yuvOffsets">yuvOffsets</a></strong></code> </td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>protected byte[][]</code></td>
|
||||
@@ -208,10 +210,10 @@ extends java.lang.Object</pre>
|
||||
<tr class="rowColor">
|
||||
<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(byte[],%20int,%20int,%20int,%20int)">YUVImage</a></strong>(byte[] yuvImage,
|
||||
int width,
|
||||
int pad,
|
||||
int align,
|
||||
int height,
|
||||
int subsamp)</code>
|
||||
<div class="block">Create a new <code>YUVImage</code> instance from an existing unified image
|
||||
<div class="block">Create a new <code>YUVImage</code> instance from an existing unified
|
||||
buffer.</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -226,11 +228,11 @@ extends java.lang.Object</pre>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(int,%20int,%20int,%20int)">YUVImage</a></strong>(int width,
|
||||
int pad,
|
||||
int align,
|
||||
int height,
|
||||
int subsamp)</code>
|
||||
<div class="block">Create a new <code>YUVImage</code> instance backed by a unified image
|
||||
buffer, and allocate memory for the image buffer.</div>
|
||||
<div class="block">Create a new <code>YUVImage</code> instance backed by a unified buffer,
|
||||
and allocate memory for the buffer.</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -251,8 +253,8 @@ extends java.lang.Object</pre>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>byte[]</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#getBuf()">getBuf</a></strong>()</code>
|
||||
<div class="block">Returns the YUV image buffer (if this image is stored in a unified
|
||||
buffer rather than separate image planes.)</div>
|
||||
<div class="block">Returns the YUV buffer (if this image is stored in a unified buffer rather
|
||||
than separate image planes.)</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
@@ -271,7 +273,7 @@ extends java.lang.Object</pre>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#getPad()">getPad</a></strong>()</code>
|
||||
<div class="block">Returns the line padding used in the YUV image buffer (if this image is
|
||||
<div class="block">Returns the row alignment (in bytes) of the YUV buffer (if this image is
|
||||
stored in a unified buffer rather than separate image planes.)</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -284,14 +286,14 @@ extends java.lang.Object</pre>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><code>int</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#getSize()">getSize</a></strong>()</code>
|
||||
<div class="block">Returns the size (in bytes) of the YUV image buffer (if this image is
|
||||
stored in a unified buffer rather than separate image planes.)</div>
|
||||
<div class="block">Returns the size (in bytes) of the YUV buffer (if this image is stored in
|
||||
a unified buffer rather than separate image planes.)</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>int[]</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#getStrides()">getStrides</a></strong>()</code>
|
||||
<div class="block">Returns the number of bytes per line of each plane in the YUV image.</div>
|
||||
<div class="block">Returns the number of bytes per row of each plane in the YUV image.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
@@ -321,10 +323,10 @@ extends java.lang.Object</pre>
|
||||
<td class="colFirst"><code>void</code></td>
|
||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#setBuf(byte[],%20int,%20int,%20int,%20int)">setBuf</a></strong>(byte[] yuvImage,
|
||||
int width,
|
||||
int pad,
|
||||
int align,
|
||||
int height,
|
||||
int subsamp)</code>
|
||||
<div class="block">Assign a unified image buffer to this <code>YUVImage</code> instance.</div>
|
||||
<div class="block">Assign a unified buffer to this <code>YUVImage</code> instance.</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -385,13 +387,13 @@ extends java.lang.Object</pre>
|
||||
<pre>protected int[] yuvStrides</pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="yuvPad">
|
||||
<a name="yuvAlign">
|
||||
<!-- -->
|
||||
</a>
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>yuvPad</h4>
|
||||
<pre>protected int yuvPad</pre>
|
||||
<h4>yuvAlign</h4>
|
||||
<pre>protected int yuvAlign</pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="yuvWidth">
|
||||
@@ -442,7 +444,7 @@ extends java.lang.Object</pre>
|
||||
<div class="block">Create a new <code>YUVImage</code> instance backed by separate image
|
||||
planes, and allocate memory for the image planes.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>width</code> - width (in pixels) of the YUV image</dd><dd><code>strides</code> - an array of integers, each specifying the number of bytes
|
||||
per line in the corresponding plane of the YUV image. Setting the stride
|
||||
per row in the corresponding plane of the YUV image. Setting the stride
|
||||
for any plane to 0 is the same as setting it to the plane width (see
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>above</code></a>.) If <code>strides</code> is null, then the
|
||||
strides for all planes will be set to their respective plane widths. When
|
||||
@@ -458,13 +460,15 @@ extends java.lang.Object</pre>
|
||||
<li class="blockList">
|
||||
<h4>YUVImage</h4>
|
||||
<pre>public YUVImage(int width,
|
||||
int pad,
|
||||
int align,
|
||||
int height,
|
||||
int subsamp)</pre>
|
||||
<div class="block">Create a new <code>YUVImage</code> instance backed by a unified image
|
||||
buffer, and allocate memory for the image buffer.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>width</code> - width (in pixels) of the YUV image</dd><dd><code>pad</code> - Each line of each plane in the YUV image buffer will be padded
|
||||
to this number of bytes (must be a power of 2.)</dd><dd><code>height</code> - height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling to be used in the YUV
|
||||
<div class="block">Create a new <code>YUVImage</code> instance backed by a unified buffer,
|
||||
and allocate memory for the buffer.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>width</code> - width (in pixels) of the YUV image</dd><dd><code>align</code> - row alignment (in bytes) of the YUV image (must be a power of
|
||||
2.) Setting this parameter to n specifies that each row in each plane of
|
||||
the YUV image will be padded to the nearest multiple of n bytes
|
||||
(1 = unpadded.)</dd><dd><code>height</code> - height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling to be used in the YUV
|
||||
image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -485,18 +489,18 @@ extends java.lang.Object</pre>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>planes</code> - an array of buffers representing the Y, U (Cb), and V (Cr)
|
||||
image planes (or just the Y plane, if the image is grayscale.) These
|
||||
planes can be contiguous or non-contiguous in memory. Plane
|
||||
<code>i</code> should be at least <code>offsets[i] +
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeSizeYUV(int,%20int,%20int,%20int,%20int)"><code>TJ.planeSizeYUV</code></a>(i, width, strides[i], height, subsamp)</code>
|
||||
<code>i</code> should be at least <code>offsets[i] + </code>
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeSizeYUV(int,%20int,%20int,%20int,%20int)"><code>TJ.planeSizeYUV</code></a><code>(i, width, strides[i], height, subsamp)</code>
|
||||
bytes in size.</dd><dd><code>offsets</code> - If this <code>YUVImage</code> instance represents a
|
||||
subregion of a larger image, then <code>offsets[i]</code> specifies the
|
||||
offset (in bytes) of the subregion within plane <code>i</code> of the
|
||||
larger image. Setting this to null is the same as setting the offsets for
|
||||
all planes to 0.</dd><dd><code>width</code> - width (in pixels) of the new YUV image (or subregion)</dd><dd><code>strides</code> - an array of integers, each specifying the number of bytes
|
||||
per line in the corresponding plane of the YUV image. Setting the stride
|
||||
per row in the corresponding plane of the YUV image. Setting the stride
|
||||
for any plane to 0 is the same as setting it to the plane width (see
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>above</code></a>.) If <code>strides</code> is null, then the
|
||||
strides for all planes will be set to their respective plane widths. You
|
||||
can adjust the strides in order to add an arbitrary amount of line padding
|
||||
can adjust the strides in order to add an arbitrary amount of row padding
|
||||
to each plane or to specify that this <code>YUVImage</code> instance is a
|
||||
subregion of a larger image (in which case, <code>strides[i]</code> should
|
||||
be set to the plane width of plane <code>i</code> in the larger image.)</dd><dd><code>height</code> - height (in pixels) of the new YUV image (or subregion)</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV
|
||||
@@ -511,18 +515,19 @@ extends java.lang.Object</pre>
|
||||
<h4>YUVImage</h4>
|
||||
<pre>public YUVImage(byte[] yuvImage,
|
||||
int width,
|
||||
int pad,
|
||||
int align,
|
||||
int height,
|
||||
int subsamp)</pre>
|
||||
<div class="block">Create a new <code>YUVImage</code> instance from an existing unified image
|
||||
<div class="block">Create a new <code>YUVImage</code> instance from an existing unified
|
||||
buffer.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>yuvImage</code> - image buffer that contains or will contain YUV planar
|
||||
image data. Use <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int,%20int,%20int,%20int)"><code>TJ.bufSizeYUV(int, int, int, int)</code></a> to determine the minimum size for
|
||||
this buffer. The Y, U (Cb), and V (Cr) image planes are stored
|
||||
sequentially in the buffer (see <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>above</code></a> for a description
|
||||
of the image format.)</dd><dd><code>width</code> - width (in pixels) of the YUV image</dd><dd><code>pad</code> - 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.</dd><dd><code>height</code> - height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>yuvImage</code> - buffer that contains or will receive a unified planar YUV
|
||||
image. Use <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int,%20int,%20int,%20int)"><code>TJ.bufSizeYUV(int, int, int, int)</code></a> to determine the minimum size for this
|
||||
buffer. The Y, U (Cb), and V (Cr) image planes are stored sequentially in
|
||||
the buffer. (See <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>above</code></a> for a description of the image
|
||||
format.)</dd><dd><code>width</code> - width (in pixels) of the YUV image</dd><dd><code>align</code> - row alignment (in bytes) of the YUV image (must be a power of
|
||||
2.) Setting this parameter to n specifies that each row in each plane of
|
||||
the YUV image will be padded to the nearest multiple of n bytes
|
||||
(1 = unpadded.)</dd><dd><code>height</code> - height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV
|
||||
image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -550,19 +555,19 @@ extends java.lang.Object</pre>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>planes</code> - an array of buffers representing the Y, U (Cb), and V (Cr)
|
||||
image planes (or just the Y plane, if the image is grayscale.) These
|
||||
planes can be contiguous or non-contiguous in memory. Plane
|
||||
<code>i</code> should be at least <code>offsets[i] +
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeSizeYUV(int,%20int,%20int,%20int,%20int)"><code>TJ.planeSizeYUV</code></a>(i, width, strides[i], height, subsamp)</code>
|
||||
<code>i</code> should be at least <code>offsets[i] + </code>
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeSizeYUV(int,%20int,%20int,%20int,%20int)"><code>TJ.planeSizeYUV</code></a><code>(i, width, strides[i], height, subsamp)</code>
|
||||
bytes in size.</dd><dd><code>offsets</code> - If this <code>YUVImage</code> instance represents a
|
||||
subregion of a larger image, then <code>offsets[i]</code> specifies the
|
||||
offset (in bytes) of the subregion within plane <code>i</code> of the
|
||||
larger image. Setting this to null is the same as setting the offsets for
|
||||
all planes to 0.</dd><dd><code>width</code> - width (in pixels) of the YUV image (or subregion)</dd><dd><code>strides</code> - an array of integers, each specifying the number of bytes
|
||||
per line in the corresponding plane of the YUV image. Setting the stride
|
||||
per row in the corresponding plane of the YUV image. Setting the stride
|
||||
for any plane to 0 is the same as setting it to the plane width (see
|
||||
<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>above</code></a>.) If <code>strides</code> is null, then the
|
||||
strides for all planes will be set to their respective plane widths. You
|
||||
can adjust the strides in order to add an arbitrary amount of line padding
|
||||
to each plane or to specify that this <code>YUVImage</code> image is a
|
||||
can adjust the strides in order to add an arbitrary amount of row padding
|
||||
to each plane or to specify that this <code>YUVImage</code> instance is a
|
||||
subregion of a larger image (in which case, <code>strides[i]</code> should
|
||||
be set to the plane width of plane <code>i</code> in the larger image.)</dd><dd><code>height</code> - height (in pixels) of the YUV image (or subregion)</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV
|
||||
image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd></dl>
|
||||
@@ -576,17 +581,18 @@ extends java.lang.Object</pre>
|
||||
<h4>setBuf</h4>
|
||||
<pre>public void setBuf(byte[] yuvImage,
|
||||
int width,
|
||||
int pad,
|
||||
int align,
|
||||
int height,
|
||||
int subsamp)</pre>
|
||||
<div class="block">Assign a unified image buffer to this <code>YUVImage</code> instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>yuvImage</code> - image buffer that contains or will contain YUV planar
|
||||
image data. Use <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int,%20int,%20int,%20int)"><code>TJ.bufSizeYUV(int, int, int, int)</code></a> to determine the minimum size for
|
||||
this buffer. The Y, U (Cb), and V (Cr) image planes are stored
|
||||
sequentially in the buffer (see <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>above</code></a> for a description
|
||||
of the image format.)</dd><dd><code>width</code> - width (in pixels) of the YUV image</dd><dd><code>pad</code> - 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.</dd><dd><code>height</code> - height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV
|
||||
<div class="block">Assign a unified buffer to this <code>YUVImage</code> instance.</div>
|
||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>yuvImage</code> - buffer that contains or will receive a unified planar YUV
|
||||
image. Use <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int,%20int,%20int,%20int)"><code>TJ.bufSizeYUV(int, int, int, int)</code></a> to determine the minimum size for this
|
||||
buffer. The Y, U (Cb), and V (Cr) image planes are stored sequentially in
|
||||
the buffer. (See <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>above</code></a> for a description of the image
|
||||
format.)</dd><dd><code>width</code> - width (in pixels) of the YUV image</dd><dd><code>align</code> - row alignment (in bytes) of the YUV image (must be a power of
|
||||
2.) Setting this parameter to n specifies that each row in each plane of
|
||||
the YUV image will be padded to the nearest multiple of n bytes
|
||||
(1 = unpadded.)</dd><dd><code>height</code> - height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV
|
||||
image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -619,9 +625,9 @@ extends java.lang.Object</pre>
|
||||
<li class="blockList">
|
||||
<h4>getPad</h4>
|
||||
<pre>public int getPad()</pre>
|
||||
<div class="block">Returns the line padding used in the YUV image buffer (if this image is
|
||||
<div class="block">Returns the row alignment (in bytes) of the YUV buffer (if this image is
|
||||
stored in a unified buffer rather than separate image planes.)</div>
|
||||
<dl><dt><span class="strong">Returns:</span></dt><dd>the line padding used in the YUV image buffer</dd></dl>
|
||||
<dl><dt><span class="strong">Returns:</span></dt><dd>the row alignment of the YUV buffer</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="getStrides()">
|
||||
@@ -631,8 +637,8 @@ extends java.lang.Object</pre>
|
||||
<li class="blockList">
|
||||
<h4>getStrides</h4>
|
||||
<pre>public int[] getStrides()</pre>
|
||||
<div class="block">Returns the number of bytes per line of each plane in the YUV image.</div>
|
||||
<dl><dt><span class="strong">Returns:</span></dt><dd>the number of bytes per line of each plane in the YUV image</dd></dl>
|
||||
<div class="block">Returns the number of bytes per row of each plane in the YUV image.</div>
|
||||
<dl><dt><span class="strong">Returns:</span></dt><dd>the number of bytes per row of each plane in the YUV image</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="getOffsets()">
|
||||
@@ -679,9 +685,9 @@ extends java.lang.Object</pre>
|
||||
<li class="blockList">
|
||||
<h4>getBuf</h4>
|
||||
<pre>public byte[] getBuf()</pre>
|
||||
<div class="block">Returns the YUV image buffer (if this image is stored in a unified
|
||||
buffer rather than separate image planes.)</div>
|
||||
<dl><dt><span class="strong">Returns:</span></dt><dd>the YUV image buffer</dd></dl>
|
||||
<div class="block">Returns the YUV buffer (if this image is stored in a unified buffer rather
|
||||
than separate image planes.)</div>
|
||||
<dl><dt><span class="strong">Returns:</span></dt><dd>the YUV buffer</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="getSize()">
|
||||
@@ -691,9 +697,9 @@ extends java.lang.Object</pre>
|
||||
<li class="blockList">
|
||||
<h4>getSize</h4>
|
||||
<pre>public int getSize()</pre>
|
||||
<div class="block">Returns the size (in bytes) of the YUV image buffer (if this image is
|
||||
stored in a unified buffer rather than separate image planes.)</div>
|
||||
<dl><dt><span class="strong">Returns:</span></dt><dd>the size (in bytes) of the YUV image buffer</dd></dl>
|
||||
<div class="block">Returns the size (in bytes) of the YUV buffer (if this image is stored in
|
||||
a unified buffer rather than separate image planes.)</div>
|
||||
<dl><dt><span class="strong">Returns:</span></dt><dd>the size (in bytes) of the YUV buffer</dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -131,7 +131,7 @@
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a></td>
|
||||
<td class="colLast">
|
||||
<div class="block">This class encapsulates a YUV planar image and the metadata
|
||||
<div class="block">This class encapsulates a planar YUV image and the metadata
|
||||
associated with it.</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -109,12 +109,13 @@
|
||||
<li class="blockList">
|
||||
<h4>op</h4>
|
||||
<pre>int op</pre>
|
||||
<div class="block">Transform operation (one of <code>OP_*</code>)</div>
|
||||
<div class="block">Transform operation (one of <a href="org/libjpegturbo/turbojpeg/TJTransform.html#OP_NONE"><code>OP_*</code></a>)</div>
|
||||
</li>
|
||||
<li class="blockList">
|
||||
<h4>options</h4>
|
||||
<pre>int options</pre>
|
||||
<div class="block">Transform options (bitwise OR of one or more of <code>OPT_*</code>)</div>
|
||||
<div class="block">Transform options (bitwise OR of one or more of
|
||||
<a href="org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT"><code>OPT_*</code></a>)</div>
|
||||
</li>
|
||||
<li class="blockListLast">
|
||||
<h4>cf</h4>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2011-2013, 2017-2018, 2020-2022 D. R. Commander.
|
||||
* Copyright (C)2011-2013, 2017-2018, 2020-2023 D. R. Commander.
|
||||
* All Rights Reserved.
|
||||
* Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
||||
*
|
||||
@@ -85,7 +85,7 @@ public final class TJ {
|
||||
* subsampling.
|
||||
*
|
||||
* @param subsamp the level of chrominance subsampling (one of
|
||||
* <code>SAMP_*</code>)
|
||||
* {@link #SAMP_444 SAMP_*})
|
||||
*
|
||||
* @return the MCU block width for the given level of chrominance
|
||||
* subsampling.
|
||||
@@ -105,7 +105,7 @@ public final class TJ {
|
||||
* subsampling.
|
||||
*
|
||||
* @param subsamp the level of chrominance subsampling (one of
|
||||
* <code>SAMP_*</code>)
|
||||
* {@link #SAMP_444 SAMP_*})
|
||||
*
|
||||
* @return the MCU block height for the given level of chrominance
|
||||
* subsampling.
|
||||
@@ -205,8 +205,8 @@ public final class TJ {
|
||||
* vice versa, but the mapping is typically not 1:1 or reversible, nor can it
|
||||
* be defined with a simple formula. Thus, such a conversion is out of scope
|
||||
* for a codec library. However, the TurboJPEG API allows for compressing
|
||||
* CMYK pixels into a YCCK JPEG image (see {@link #CS_YCCK}) and
|
||||
* decompressing YCCK JPEG images into CMYK pixels.
|
||||
* packed-pixel CMYK images into YCCK JPEG images (see {@link #CS_YCCK}) and
|
||||
* decompressing YCCK JPEG images into packed-pixel CMYK images.
|
||||
*/
|
||||
public static final int PF_CMYK = 11;
|
||||
|
||||
@@ -214,7 +214,7 @@ public final class TJ {
|
||||
/**
|
||||
* Returns the pixel size (in bytes) for the given pixel format.
|
||||
*
|
||||
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
||||
* @param pixelFormat the pixel format (one of {@link #PF_RGB PF_*})
|
||||
*
|
||||
* @return the pixel size (in bytes) for the given pixel format.
|
||||
*/
|
||||
@@ -235,7 +235,7 @@ public final class TJ {
|
||||
* then the red component will be
|
||||
* <code>pixel[TJ.getRedOffset(TJ.PF_BGRX)]</code>.
|
||||
*
|
||||
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
||||
* @param pixelFormat the pixel format (one of {@link #PF_RGB PF_*})
|
||||
*
|
||||
* @return the red offset for the given pixel format, or -1 if the pixel
|
||||
* format does not have a red component.
|
||||
@@ -257,7 +257,7 @@ public final class TJ {
|
||||
* then the green component will be
|
||||
* <code>pixel[TJ.getGreenOffset(TJ.PF_BGRX)]</code>.
|
||||
*
|
||||
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
||||
* @param pixelFormat the pixel format (one of {@link #PF_RGB PF_*})
|
||||
*
|
||||
* @return the green offset for the given pixel format, or -1 if the pixel
|
||||
* format does not have a green component.
|
||||
@@ -279,7 +279,7 @@ public final class TJ {
|
||||
* then the blue component will be
|
||||
* <code>pixel[TJ.getBlueOffset(TJ.PF_BGRX)]</code>.
|
||||
*
|
||||
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
||||
* @param pixelFormat the pixel format (one of {@link #PF_RGB PF_*})
|
||||
*
|
||||
* @return the blue offset for the given pixel format, or -1 if the pixel
|
||||
* format does not have a blue component.
|
||||
@@ -301,7 +301,7 @@ public final class TJ {
|
||||
* then the alpha component will be
|
||||
* <code>pixel[TJ.getAlphaOffset(TJ.PF_BGRA)]</code>.
|
||||
*
|
||||
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
||||
* @param pixelFormat the pixel format (one of {@link #PF_RGB PF_*})
|
||||
*
|
||||
* @return the alpha offset for the given pixel format, or -1 if the pixel
|
||||
* format does not have a alpha component.
|
||||
@@ -324,8 +324,9 @@ public final class TJ {
|
||||
* RGB colorspace. When compressing the JPEG image, the R, G, and B
|
||||
* components in the source image are reordered into image planes, but no
|
||||
* colorspace conversion or subsampling is performed. RGB JPEG images can be
|
||||
* decompressed to any of the extended RGB pixel formats or grayscale, but
|
||||
* they cannot be decompressed to YUV images.
|
||||
* decompressed to packed-pixel images with any of the extended RGB or
|
||||
* grayscale pixel formats, but they cannot be decompressed to planar YUV
|
||||
* images.
|
||||
*/
|
||||
public static final int CS_RGB = 0;
|
||||
/**
|
||||
@@ -339,26 +340,28 @@ public final class TJ {
|
||||
* transformation allowed the same signal to drive both black & white and
|
||||
* color televisions, but JPEG images use YCbCr primarily because it allows
|
||||
* the color data to be optionally subsampled for the purposes of reducing
|
||||
* bandwidth or disk space. YCbCr is the most common JPEG colorspace, and
|
||||
* YCbCr JPEG images can be compressed from and decompressed to any of the
|
||||
* extended RGB pixel formats or grayscale, or they can be decompressed to
|
||||
* YUV planar images.
|
||||
* network or disk usage. YCbCr is the most common JPEG colorspace, and
|
||||
* YCbCr JPEG images can be compressed from and decompressed to packed-pixel
|
||||
* images with any of the extended RGB or grayscale pixel formats. YCbCr
|
||||
* JPEG images can also be compressed from and decompressed to planar YUV
|
||||
* images.
|
||||
*/
|
||||
@SuppressWarnings("checkstyle:ConstantName")
|
||||
public static final int CS_YCbCr = 1;
|
||||
/**
|
||||
* Grayscale colorspace. The JPEG image retains only the luminance data (Y
|
||||
* component), and any color data from the source image is discarded.
|
||||
* Grayscale JPEG images can be compressed from and decompressed to any of
|
||||
* the extended RGB pixel formats or grayscale, or they can be decompressed
|
||||
* to YUV planar images.
|
||||
* Grayscale JPEG images can be compressed from and decompressed to
|
||||
* packed-pixel images with any of the extended RGB or grayscale pixel
|
||||
* formats, or they can be compressed from and decompressed to planar YUV
|
||||
* images.
|
||||
*/
|
||||
public static final int CS_GRAY = 2;
|
||||
/**
|
||||
* CMYK colorspace. When compressing the JPEG image, the C, M, Y, and K
|
||||
* components in the source image are reordered into image planes, but no
|
||||
* colorspace conversion or subsampling is performed. CMYK JPEG images can
|
||||
* only be decompressed to CMYK pixels.
|
||||
* only be decompressed to packed-pixel images with the CMYK pixel format.
|
||||
*/
|
||||
public static final int CS_CMYK = 3;
|
||||
/**
|
||||
@@ -368,54 +371,52 @@ public final class TJ {
|
||||
* reversibly transformed into YCCK, and as with YCbCr, the chrominance
|
||||
* components in the YCCK pixels can be subsampled without incurring major
|
||||
* perceptual loss. YCCK JPEG images can only be compressed from and
|
||||
* decompressed to CMYK pixels.
|
||||
* decompressed to packed-pixel images with the CMYK pixel format.
|
||||
*/
|
||||
public static final int CS_YCCK = 4;
|
||||
|
||||
|
||||
/**
|
||||
* The uncompressed source/destination image is stored in bottom-up (Windows,
|
||||
* OpenGL) order, not top-down (X11) order.
|
||||
* Rows in the packed-pixel source/destination image are stored in bottom-up
|
||||
* (Windows, OpenGL) order rather than in top-down (X11) order.
|
||||
*/
|
||||
public static final int FLAG_BOTTOMUP = (1 << 1);
|
||||
|
||||
/**
|
||||
* When decompressing an image that was compressed using chrominance
|
||||
* subsampling, use the fastest chrominance upsampling algorithm available in
|
||||
* the underlying codec. The default is to use smooth upsampling, which
|
||||
* creates a smooth transition between neighboring chrominance components in
|
||||
* order to reduce upsampling artifacts in the decompressed image.
|
||||
* subsampling, use the fastest chrominance upsampling algorithm available.
|
||||
* The default is to use smooth upsampling, which creates a smooth transition
|
||||
* between neighboring chrominance components in order to reduce upsampling
|
||||
* artifacts in the decompressed image.
|
||||
*/
|
||||
public static final int FLAG_FASTUPSAMPLE = (1 << 8);
|
||||
/**
|
||||
* Use the fastest DCT/IDCT algorithm available in the underlying codec. The
|
||||
* default if this flag is not specified is implementation-specific. For
|
||||
* example, the implementation of TurboJPEG for libjpeg[-turbo] uses the fast
|
||||
* Use the fastest DCT/IDCT algorithm available. The default if this flag is
|
||||
* not specified is implementation-specific. For example, the implementation
|
||||
* of the TurboJPEG API in libjpeg-turbo uses the fast algorithm by default
|
||||
* when compressing, because this has been shown to have only a very slight
|
||||
* effect on accuracy, but it uses the accurate algorithm when decompressing,
|
||||
* because this has been shown to have a larger effect.
|
||||
*/
|
||||
public static final int FLAG_FASTDCT = (1 << 11);
|
||||
/**
|
||||
* Use the most accurate DCT/IDCT algorithm available. The default if this
|
||||
* flag is not specified is implementation-specific. For example, the
|
||||
* implementation of the TurboJPEG API in libjpeg-turbo uses the fast
|
||||
* algorithm by default when compressing, because this has been shown to have
|
||||
* only a very slight effect on accuracy, but it uses the accurate algorithm
|
||||
* when decompressing, because this has been shown to have a larger effect.
|
||||
*/
|
||||
public static final int FLAG_FASTDCT = (1 << 11);
|
||||
/**
|
||||
* Use the most accurate DCT/IDCT algorithm available in the underlying
|
||||
* codec. The default if this flag is not specified is
|
||||
* implementation-specific. For example, the implementation of TurboJPEG for
|
||||
* libjpeg[-turbo] uses the fast algorithm by default when compressing,
|
||||
* because this has been shown to have only a very slight effect on accuracy,
|
||||
* but it uses the accurate algorithm when decompressing, because this has
|
||||
* been shown to have a larger effect.
|
||||
*/
|
||||
public static final int FLAG_ACCURATEDCT = (1 << 12);
|
||||
/**
|
||||
* Immediately discontinue the current compression/decompression/transform
|
||||
* operation if the underlying codec throws a warning (non-fatal error). The
|
||||
* default behavior is to allow the operation to complete unless a fatal
|
||||
* error is encountered.
|
||||
* operation if a warning (non-fatal error) occurs. The default behavior is
|
||||
* to allow the operation to complete unless a fatal error is encountered.
|
||||
* <p>
|
||||
* NOTE: due to the design of the TurboJPEG Java API, only certain methods
|
||||
* (specifically, {@link TJDecompressor TJDecompressor.decompress*()} methods
|
||||
* with a void return type) will complete and leave the output image in a
|
||||
* fully recoverable state after a non-fatal error occurs.
|
||||
* with a void return type) will complete and leave the destination image in
|
||||
* a fully recoverable state after a non-fatal error occurs.
|
||||
*/
|
||||
public static final int FLAG_STOPONWARNING = (1 << 13);
|
||||
/**
|
||||
@@ -456,7 +457,7 @@ public final class TJ {
|
||||
* <li> DCT/IDCT algorithm selection
|
||||
* <li> Progressive entropy coding
|
||||
* <li> Arithmetic entropy coding
|
||||
* <li> Compression from/decompression to YUV planar images
|
||||
* <li> Compression from/decompression to planar YUV images
|
||||
* <li> Decompression scaling
|
||||
* <li> Lossless transformations
|
||||
* </ul>
|
||||
@@ -468,13 +469,13 @@ public final class TJ {
|
||||
*/
|
||||
public static final int NUMERR = 2;
|
||||
/**
|
||||
* The error was non-fatal and recoverable, but the image may still be
|
||||
* corrupt.
|
||||
* The error was non-fatal and recoverable, but the destination image may
|
||||
* still be corrupt.
|
||||
* <p>
|
||||
* NOTE: due to the design of the TurboJPEG Java API, only certain methods
|
||||
* (specifically, {@link TJDecompressor TJDecompressor.decompress*()} methods
|
||||
* with a void return type) will complete and leave the output image in a
|
||||
* fully recoverable state after a non-fatal error occurs.
|
||||
* with a void return type) will complete and leave the destination image in
|
||||
* a fully recoverable state after a non-fatal error occurs.
|
||||
*/
|
||||
public static final int ERR_WARNING = 0;
|
||||
/**
|
||||
@@ -492,7 +493,7 @@ public final class TJ {
|
||||
* @param height the height (in pixels) of the JPEG image
|
||||
*
|
||||
* @param jpegSubsamp the level of chrominance subsampling to be used when
|
||||
* generating the JPEG image (one of {@link TJ TJ.SAMP_*})
|
||||
* generating the JPEG image (one of {@link #SAMP_444 TJ.SAMP_*})
|
||||
*
|
||||
* @return the maximum size of the buffer (in bytes) required to hold a JPEG
|
||||
* image with the given width, height, and level of chrominance subsampling.
|
||||
@@ -500,23 +501,27 @@ public final class TJ {
|
||||
public static native int bufSize(int width, int height, int jpegSubsamp);
|
||||
|
||||
/**
|
||||
* Returns the size of the buffer (in bytes) required to hold a YUV planar
|
||||
* image with the given width, height, and level of chrominance subsampling.
|
||||
* Returns the size of the buffer (in bytes) required to hold a unified
|
||||
* planar YUV image with the given width, height, and level of chrominance
|
||||
* subsampling.
|
||||
*
|
||||
* @param width the width (in pixels) of the YUV image
|
||||
*
|
||||
* @param pad the width of each line in each plane of the image is padded to
|
||||
* the nearest multiple of this number of bytes (must be a power of 2.)
|
||||
* @param align row alignment (in bytes) of the YUV image (must be a power of
|
||||
* 2.) Setting this parameter to n specifies that each row in each plane of
|
||||
* the YUV image will be padded to the nearest multiple of n bytes
|
||||
* (1 = unpadded.)
|
||||
*
|
||||
* @param height the height (in pixels) of the YUV image
|
||||
*
|
||||
* @param subsamp the level of chrominance subsampling used in the YUV
|
||||
* image (one of {@link TJ TJ.SAMP_*})
|
||||
* image (one of {@link #SAMP_444 TJ.SAMP_*})
|
||||
*
|
||||
* @return the size of the buffer (in bytes) required to hold a YUV planar
|
||||
* image with the given width, height, and level of chrominance subsampling.
|
||||
* @return the size of the buffer (in bytes) required to hold a unified
|
||||
* planar YUV image with the given width, height, and level of chrominance
|
||||
* subsampling.
|
||||
*/
|
||||
public static native int bufSizeYUV(int width, int pad, int height,
|
||||
public static native int bufSizeYUV(int width, int align, int height,
|
||||
int subsamp);
|
||||
|
||||
/**
|
||||
@@ -529,16 +534,16 @@ public final class TJ {
|
||||
* @param width width (in pixels) of the YUV image. NOTE: this is the width
|
||||
* of the whole image, not the plane width.
|
||||
*
|
||||
* @param stride bytes per line in the image plane.
|
||||
* @param stride bytes per row in the image plane.
|
||||
*
|
||||
* @param height height (in pixels) of the YUV image. NOTE: this is the
|
||||
* height of the whole image, not the plane height.
|
||||
*
|
||||
* @param subsamp the level of chrominance subsampling used in the YUV
|
||||
* image (one of {@link TJ TJ.SAMP_*})
|
||||
* image (one of {@link #SAMP_444 TJ.SAMP_*})
|
||||
*
|
||||
* @return the size of the buffer (in bytes) required to hold a YUV planar
|
||||
* image with the given parameters.
|
||||
* @return the size of the buffer (in bytes) required to hold a YUV image
|
||||
* plane with the given parameters.
|
||||
*/
|
||||
public static native int planeSizeYUV(int componentID, int width, int stride,
|
||||
int height, int subsamp);
|
||||
@@ -553,7 +558,7 @@ public final class TJ {
|
||||
* @param width width (in pixels) of the YUV image
|
||||
*
|
||||
* @param subsamp the level of chrominance subsampling used in the YUV image
|
||||
* (one of {@link TJ TJ.SAMP_*})
|
||||
* (one of {@link #SAMP_444 TJ.SAMP_*})
|
||||
*
|
||||
* @return the plane width of a YUV image plane with the given parameters.
|
||||
*/
|
||||
@@ -569,7 +574,7 @@ public final class TJ {
|
||||
* @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 TJ.SAMP_*})
|
||||
* (one of {@link #SAMP_444 TJ.SAMP_*})
|
||||
*
|
||||
* @return the plane height of a YUV image plane with the given parameters.
|
||||
*/
|
||||
@@ -577,11 +582,11 @@ public final class TJ {
|
||||
int subsamp);
|
||||
|
||||
/**
|
||||
* Returns a list of fractional scaling factors that the JPEG decompressor in
|
||||
* this implementation of TurboJPEG supports.
|
||||
* Returns a list of fractional scaling factors that the JPEG decompressor
|
||||
* supports.
|
||||
*
|
||||
* @return a list of fractional scaling factors that the JPEG decompressor in
|
||||
* this implementation of TurboJPEG supports.
|
||||
* @return a list of fractional scaling factors that the JPEG decompressor
|
||||
* supports.
|
||||
*/
|
||||
public static native TJScalingFactor[] getScalingFactors();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2011-2015, 2018, 2020, 2022 D. R. Commander.
|
||||
* Copyright (C)2011-2015, 2018, 2020, 2022-2023 D. R. Commander.
|
||||
* All Rights Reserved.
|
||||
* Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
||||
*
|
||||
@@ -50,7 +50,7 @@ public class TJCompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a TurboJPEG compressor instance and associate the uncompressed
|
||||
* Create a TurboJPEG compressor instance and associate the packed-pixel
|
||||
* source image stored in <code>srcImage</code> with the newly created
|
||||
* instance.
|
||||
*
|
||||
@@ -75,7 +75,7 @@ public class TJCompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a TurboJPEG compressor instance and associate the uncompressed
|
||||
* Create a TurboJPEG compressor instance and associate the packed-pixel
|
||||
* source image stored in <code>srcImage</code> with the newly created
|
||||
* instance.
|
||||
*
|
||||
@@ -100,11 +100,11 @@ public class TJCompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate an uncompressed RGB, grayscale, or CMYK source image with this
|
||||
* Associate a packed-pixel RGB, grayscale, or CMYK source image with this
|
||||
* compressor instance.
|
||||
*
|
||||
* @param srcImage image buffer containing RGB, grayscale, or CMYK pixels to
|
||||
* be compressed or encoded. This buffer is not modified.
|
||||
* @param srcImage buffer containing a packed-pixel RGB, grayscale, or CMYK
|
||||
* source image to be compressed or encoded. This buffer is not modified.
|
||||
*
|
||||
* @param x x offset (in pixels) of the region in the source image from which
|
||||
* the JPEG or YUV image should be compressed/encoded
|
||||
@@ -115,13 +115,13 @@ public class TJCompressor implements Closeable {
|
||||
* @param width width (in pixels) of the region in the source image from
|
||||
* 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/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
|
||||
* @param pitch bytes per row in the source image. Normally this should be
|
||||
* <code>width * TJ.pixelSize(pixelFormat)</code>, if the source image is
|
||||
* unpadded. However, you can use this parameter to, for instance, specify
|
||||
* that the rows in the source image are padded to the nearest multiple of 4
|
||||
* bytes or to 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 rows,
|
||||
* 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
|
||||
@@ -152,11 +152,12 @@ public class TJCompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate an uncompressed RGB or grayscale source image with this
|
||||
* Associate a packed-pixel RGB or grayscale source image with this
|
||||
* compressor instance.
|
||||
*
|
||||
* @param srcImage a <code>BufferedImage</code> instance containing RGB or
|
||||
* grayscale pixels to be compressed or encoded. This image is not modified.
|
||||
* @param srcImage a <code>BufferedImage</code> instance containing a
|
||||
* packed-pixel RGB or grayscale source image to be compressed or encoded.
|
||||
* This image is not modified.
|
||||
*
|
||||
* @param x x offset (in pixels) of the region in the source image from which
|
||||
* the JPEG or YUV image should be compressed/encoded
|
||||
@@ -238,11 +239,10 @@ public class TJCompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate an uncompressed YUV planar source image with this compressor
|
||||
* instance.
|
||||
* Associate a planar YUV source image with this compressor instance.
|
||||
*
|
||||
* @param srcImage YUV planar image to be compressed. This image is not
|
||||
* modified.
|
||||
* @param srcImage planar YUV source image to be compressed. This image is
|
||||
* not modified.
|
||||
*/
|
||||
public void setSourceImage(YUVImage srcImage) throws TJException {
|
||||
if (handle == 0) init();
|
||||
@@ -259,16 +259,16 @@ public class TJCompressor implements Closeable {
|
||||
* {@link TJ#CS_YCbCr}) or from CMYK to YCCK (see {@link TJ#CS_YCCK}) as part
|
||||
* of the JPEG compression process, some of the Cb and Cr (chrominance)
|
||||
* components can be discarded or averaged together to produce a smaller
|
||||
* image with little perceptible loss of image clarity (the human eye is more
|
||||
* sensitive to small changes in brightness than to small changes in color.)
|
||||
* This is called "chrominance subsampling".
|
||||
* image with little perceptible loss of image clarity. (The human eye is
|
||||
* more sensitive to small changes in brightness than to small changes in
|
||||
* color.) This is called "chrominance subsampling".
|
||||
* <p>
|
||||
* NOTE: 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. Furthermore, 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.
|
||||
* NOTE: This method has no effect when compressing a JPEG image from a
|
||||
* planar YUV source image. In that case, the level of chrominance
|
||||
* subsampling in the JPEG image is determined by the source image.
|
||||
* Furthermore, 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 image.
|
||||
*
|
||||
* @param newSubsamp the level of chrominance subsampling to use in
|
||||
* subsequent compress/encode oeprations (one of
|
||||
@@ -300,8 +300,9 @@ public class TJCompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Compress the uncompressed source image associated with this compressor
|
||||
* instance and output a JPEG image to the given destination buffer.
|
||||
* Compress the packed-pixel or planar YUV source image associated with this
|
||||
* compressor instance and output a JPEG image to the given destination
|
||||
* buffer.
|
||||
*
|
||||
* @param dstBuf buffer that will receive the JPEG image. Use
|
||||
* {@link TJ#bufSize} to determine the maximum size for this buffer based on
|
||||
@@ -340,8 +341,8 @@ public class TJCompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Compress the uncompressed source image associated with this compressor
|
||||
* instance and return a buffer containing a JPEG image.
|
||||
* Compress the packed-pixel or planar YUV 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#FLAG_BOTTOMUP TJ.FLAG_*}
|
||||
@@ -365,14 +366,14 @@ public class TJCompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Encode the packed-pixel source image associated with this compressor
|
||||
* instance into a planar YUV image and store it in the given
|
||||
* {@link YUVImage} instance. This method performs color conversion (which
|
||||
* is accelerated in the libjpeg-turbo implementation) but does not execute
|
||||
* any of the other steps in the JPEG compression process. Encoding CMYK
|
||||
* source images into YUV images is not supported.
|
||||
*
|
||||
* @param dstImage {@link YUVImage} instance that will receive the YUV planar
|
||||
* @param dstImage {@link YUVImage} instance that will receive the planar YUV
|
||||
* image
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of
|
||||
@@ -402,52 +403,54 @@ public class TJCompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode the uncompressed source image associated with this compressor
|
||||
* instance into a unified YUV planar image buffer 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.
|
||||
* Encode the packed-pixel source image associated with this compressor
|
||||
* instance into a unified planar YUV image and return a {@link YUVImage}
|
||||
* instance containing the encoded image. This method performs color
|
||||
* conversion (which is accelerated in the libjpeg-turbo implementation) but
|
||||
* does not execute any of the other steps in the JPEG compression process.
|
||||
* Encoding CMYK source images into YUV images is not supported.
|
||||
*
|
||||
* @param pad the width of each line in each plane of the YUV image will be
|
||||
* padded to the nearest multiple of this number of bytes (must be a power of
|
||||
* 2.)
|
||||
* @param align row alignment (in bytes) of the YUV image (must be a power of
|
||||
* 2.) Setting this parameter to n will cause each row in each plane of the
|
||||
* YUV image to be padded to the nearest multiple of n bytes (1 = unpadded.)
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of
|
||||
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
|
||||
*
|
||||
* @return a YUV planar image.
|
||||
* @return a {@link YUVImage} instance containing the unified planar YUV
|
||||
* encoded image
|
||||
*/
|
||||
public YUVImage encodeYUV(int pad, int flags) throws TJException {
|
||||
public YUVImage encodeYUV(int align, int flags) throws TJException {
|
||||
checkSourceImage();
|
||||
checkSubsampling();
|
||||
if (pad < 1 || ((pad & (pad - 1)) != 0))
|
||||
if (align < 1 || ((align & (align - 1)) != 0))
|
||||
throw new IllegalStateException("Invalid argument in encodeYUV()");
|
||||
YUVImage dstYUVImage = new YUVImage(srcWidth, pad, srcHeight, subsamp);
|
||||
YUVImage dstYUVImage = new YUVImage(srcWidth, align, srcHeight, subsamp);
|
||||
encodeYUV(dstYUVImage, flags);
|
||||
return dstYUVImage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode the uncompressed source image associated with this compressor
|
||||
* Encode the packed-pixel source image associated with this compressor
|
||||
* instance into separate Y, U (Cb), and V (Cr) image planes and return a
|
||||
* <code>YUVImage</code> instance containing the encoded image planes. 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.
|
||||
* {@link YUVImage} instance containing the encoded image planes. This
|
||||
* method performs color conversion (which is accelerated in the
|
||||
* libjpeg-turbo implementation) but does not execute any of the other steps
|
||||
* in the JPEG compression process. Encoding CMYK source images into YUV
|
||||
* images is not supported.
|
||||
*
|
||||
* @param strides an array of integers, each specifying the number of bytes
|
||||
* per line in the corresponding plane of the output image. Setting the
|
||||
* stride for any plane to 0 is the same as setting it to the component width
|
||||
* of the plane. If <code>strides</code> is null, then the strides for all
|
||||
* planes will be set to their respective component widths. You can adjust
|
||||
* the strides in order to add an arbitrary amount of line padding to each
|
||||
* plane.
|
||||
* per row in the corresponding plane of the YUV source image. Setting the
|
||||
* stride for any plane to 0 is the same as setting it to the plane width
|
||||
* (see {@link YUVImage}.) If <code>strides</code> is null, then the strides
|
||||
* for all planes will be set to their respective plane widths. You can
|
||||
* adjust the strides in order to add an arbitrary amount of row padding to
|
||||
* each plane.
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of
|
||||
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
|
||||
*
|
||||
* @return a YUV planar image.
|
||||
* @return a {@link YUVImage} instance containing the encoded image planes
|
||||
*/
|
||||
public YUVImage encodeYUV(int[] strides, int flags) throws TJException {
|
||||
checkSourceImage();
|
||||
@@ -549,6 +552,5 @@ public class TJCompressor implements Closeable {
|
||||
private int subsamp = -1;
|
||||
private int jpegQuality = -1;
|
||||
private int compressedSize = 0;
|
||||
private int yuvPad = 4;
|
||||
private ByteOrder byteOrder = null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2011, 2013 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2011, 2013, 2023 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:
|
||||
@@ -58,7 +58,7 @@ public interface TJCustomFilter {
|
||||
* component plane to which <code>coeffBuffer</code> belongs
|
||||
*
|
||||
* @param componentID ID number of the component plane to which
|
||||
* <code>coeffBuffer</code> belongs (Y, Cb, and Cr have, respectively, ID's
|
||||
* <code>coeffBuffer</code> belongs. (Y, Cb, and Cr have, respectively, ID's
|
||||
* of 0, 1, and 2 in typical JPEG images.)
|
||||
*
|
||||
* @param transformID ID number of the transformed image to which
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C)2011-2015, 2018, 2022 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2011-2015, 2018, 2022-2023 D. R. Commander.
|
||||
* All Rights Reserved.
|
||||
* Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -50,10 +51,12 @@ public class TJDecompressor implements Closeable {
|
||||
|
||||
/**
|
||||
* Create a TurboJPEG decompressor instance and associate the JPEG source
|
||||
* image stored in <code>jpegImage</code> with the newly created instance.
|
||||
* image or "abbreviated table specification" (AKA "tables-only") datastream
|
||||
* 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.) This buffer is not modified.
|
||||
* @param jpegImage buffer containing a JPEG source image or tables-only
|
||||
* datastream. (The size of the JPEG image or datastream is assumed to be
|
||||
* the length of the array.) This buffer is not modified.
|
||||
*/
|
||||
public TJDecompressor(byte[] jpegImage) throws TJException {
|
||||
init();
|
||||
@@ -62,12 +65,15 @@ public class TJDecompressor implements Closeable {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* image or "abbreviated table specification" (AKA "tables-only") datastream
|
||||
* of length <code>imageSize</code> bytes stored in <code>jpegImage</code>
|
||||
* with the newly created instance.
|
||||
*
|
||||
* @param jpegImage JPEG image buffer. This buffer is not modified.
|
||||
* @param jpegImage buffer containing a JPEG source image or tables-only
|
||||
* datastream. This buffer is not modified.
|
||||
*
|
||||
* @param imageSize size of the JPEG image (in bytes)
|
||||
* @param imageSize size of the JPEG source image or tables-only datastream
|
||||
* (in bytes)
|
||||
*/
|
||||
public TJDecompressor(byte[] jpegImage, int imageSize) throws TJException {
|
||||
init();
|
||||
@@ -75,11 +81,11 @@ public class TJDecompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a TurboJPEG decompressor instance and associate the YUV planar
|
||||
* Create a TurboJPEG decompressor instance and associate the planar YUV
|
||||
* source image stored in <code>yuvImage</code> with the newly created
|
||||
* instance.
|
||||
*
|
||||
* @param yuvImage {@link YUVImage} instance containing a YUV planar
|
||||
* @param yuvImage {@link YUVImage} instance containing a planar YUV source
|
||||
* image to be decoded. This image is not modified.
|
||||
*/
|
||||
@SuppressWarnings("checkstyle:HiddenField")
|
||||
@@ -100,11 +106,11 @@ public class TJDecompressor implements Closeable {
|
||||
* when decompressing video streams in which all frames share the same
|
||||
* quantization and Huffman tables.
|
||||
*
|
||||
* @param jpegImage buffer containing a JPEG image or an "abbreviated table
|
||||
* specification" (AKA "tables-only") datastream. This buffer is not
|
||||
* modified.
|
||||
* @param jpegImage buffer containing a JPEG source image or tables-only
|
||||
* datastream. This buffer is not modified.
|
||||
*
|
||||
* @param imageSize size of the JPEG image (in bytes)
|
||||
* @param imageSize size of the JPEG source image or tables-only datastream
|
||||
* (in bytes)
|
||||
*/
|
||||
public void setSourceImage(byte[] jpegImage, int imageSize)
|
||||
throws TJException {
|
||||
@@ -117,12 +123,12 @@ public class TJDecompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Associate the specified planar YUV source image with this decompressor
|
||||
* instance. Subsequent decompress operations will decode this image into a
|
||||
* packed-pixel RGB or grayscale destination image.
|
||||
*
|
||||
* @param srcImage {@link YUVImage} instance containing a YUV planar image to
|
||||
* be decoded. This image is not modified.
|
||||
* @param srcImage {@link YUVImage} instance containing a planar YUV source
|
||||
* image to be decoded. This image is not modified.
|
||||
*/
|
||||
public void setSourceImage(YUVImage srcImage) {
|
||||
if (srcImage == null)
|
||||
@@ -215,9 +221,9 @@ public class TJDecompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the JPEG image buffer associated with this decompressor instance.
|
||||
* Returns the JPEG buffer associated with this decompressor instance.
|
||||
*
|
||||
* @return the JPEG image buffer associated with this decompressor instance.
|
||||
* @return the JPEG buffer associated with this decompressor instance.
|
||||
*/
|
||||
public byte[] getJPEGBuf() {
|
||||
if (jpegBuf == null)
|
||||
@@ -244,14 +250,14 @@ public class TJDecompressor implements Closeable {
|
||||
* height.
|
||||
*
|
||||
* @param desiredWidth desired width (in pixels) of the decompressed image.
|
||||
* 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.)
|
||||
* 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 desiredHeight desired height (in pixels) of the decompressed image.
|
||||
* 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.)
|
||||
* image. (In other words, the height will not be considered when
|
||||
* determining the scaled image size.)
|
||||
*
|
||||
* @return the width of the largest scaled-down image that the TurboJPEG
|
||||
* decompressor can generate without exceeding the desired image width and
|
||||
@@ -285,14 +291,14 @@ public class TJDecompressor implements Closeable {
|
||||
* height.
|
||||
*
|
||||
* @param desiredWidth desired width (in pixels) of the decompressed image.
|
||||
* 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.)
|
||||
* 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 desiredHeight desired height (in pixels) of the decompressed image.
|
||||
* 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.)
|
||||
* image. (In other words, the height will not be considered when
|
||||
* determining the scaled image size.)
|
||||
*
|
||||
* @return the height of the largest scaled-down image that the TurboJPEG
|
||||
* decompressor can generate without exceeding the desired image width and
|
||||
@@ -321,27 +327,27 @@ public class TJDecompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Decompress the JPEG source image or decode the planar YUV source image
|
||||
* associated with this decompressor instance and output a packed-pixel
|
||||
* grayscale, RGB, or CMYK image to the given destination buffer.
|
||||
* <p>
|
||||
* NOTE: The output image is fully recoverable if this method throws a
|
||||
* NOTE: The destination image is fully recoverable if this method throws a
|
||||
* non-fatal {@link TJException} (unless
|
||||
* {@link TJ#FLAG_STOPONWARNING TJ.FLAG_STOPONWARNING} is specified.)
|
||||
*
|
||||
* @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}. 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 dstBuf buffer that will receive the packed-pixel
|
||||
* 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.</code>{@link TJScalingFactor#getScaled getScaled}<code>(jpegHeight)</code>
|
||||
* with one of the scaling factors returned from {@link 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 in the destination image into
|
||||
* which the source image should be decompressed/decoded
|
||||
@@ -355,20 +361,20 @@ public class TJDecompressor implements Closeable {
|
||||
* 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
|
||||
* 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 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}. If the source image is a
|
||||
* YUV image, then <code>scaledWidth</code> is the width of the YUV image.
|
||||
* @param pitch bytes per row in the destination image. Normally this should
|
||||
* be set to <code>scaledWidth * TJ.pixelSize(pixelFormat)</code>, if the
|
||||
* destination image will be unpadded. However, you can use this to, for
|
||||
* instance, pad each row of the destination image to the nearest multiple of
|
||||
* 4 bytes 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.</code>{@link TJScalingFactor#getScaled getScaled}<code>(jpegWidth)</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>.
|
||||
*
|
||||
@@ -378,8 +384,8 @@ public class TJDecompressor implements Closeable {
|
||||
* 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
|
||||
* 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/decoded image (one of
|
||||
@@ -408,8 +414,9 @@ public class TJDecompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Decompress the JPEG source image associated with this decompressor
|
||||
* instance and return a buffer containing the decompressed image.
|
||||
* Decompress the JPEG source image or decode the planar YUV source image
|
||||
* associated with this decompressor instance and return a buffer containing
|
||||
* the packed-pixel decompressed image.
|
||||
*
|
||||
* @param desiredWidth see
|
||||
* {@link #decompress(byte[], int, int, int, int, int, int, int)}
|
||||
@@ -429,7 +436,7 @@ public class TJDecompressor implements Closeable {
|
||||
* @param flags the bitwise OR of one or more of
|
||||
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
|
||||
*
|
||||
* @return a buffer containing the decompressed image.
|
||||
* @return a buffer containing the packed-pixel decompressed image.
|
||||
*/
|
||||
public byte[] decompress(int desiredWidth, int pitch, int desiredHeight,
|
||||
int pixelFormat, int flags) throws TJException {
|
||||
@@ -450,22 +457,22 @@ public class TJDecompressor implements Closeable {
|
||||
|
||||
/**
|
||||
* 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. 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.
|
||||
* instance into a planar YUV image and store it in the given
|
||||
* {@link YUVImage} instance. This method performs JPEG decompression but
|
||||
* leaves out the color conversion step, so a planar YUV image is generated
|
||||
* instead of a packed-pixel image. This method cannot be used to decompress
|
||||
* JPEG source images with the CMYK or YCCK colorspace.
|
||||
* <p>
|
||||
* NOTE: The YUV planar output image is fully recoverable if this method
|
||||
* NOTE: The planar YUV destination image is fully recoverable if this method
|
||||
* throws a non-fatal {@link TJException} (unless
|
||||
* {@link TJ#FLAG_STOPONWARNING TJ.FLAG_STOPONWARNING} is specified.)
|
||||
*
|
||||
* @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 dstImage {@link YUVImage} instance that will receive the planar YUV
|
||||
* decompressed image. The level of subsampling specified in this
|
||||
* {@link YUVImage} instance must match that of the JPEG image, and the width
|
||||
* and height specified in the {@link YUVImage} instance must match one of
|
||||
* the scaled image sizes that the decompressor 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_*}
|
||||
@@ -482,7 +489,7 @@ public class TJDecompressor implements Closeable {
|
||||
dstImage.getHeight());
|
||||
if (scaledWidth != dstImage.getWidth() ||
|
||||
scaledHeight != dstImage.getHeight())
|
||||
throw new IllegalArgumentException("YUVImage dimensions do not match one of the scaled image sizes that TurboJPEG is capable of generating.");
|
||||
throw new IllegalArgumentException("YUVImage dimensions do not match one of the scaled image sizes that the decompressor is capable of generating.");
|
||||
if (jpegSubsamp != dstImage.getSubsamp())
|
||||
throw new IllegalArgumentException("YUVImage subsampling level does not match that of the JPEG image");
|
||||
|
||||
@@ -494,40 +501,41 @@ public class TJDecompressor implements Closeable {
|
||||
/**
|
||||
* Decompress the JPEG source image associated with this decompressor
|
||||
* instance into a set of Y, U (Cb), and V (Cr) image planes and return a
|
||||
* <code>YUVImage</code> instance containing the decompressed image planes.
|
||||
* 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.
|
||||
* {@link YUVImage} instance containing the decompressed image planes. This
|
||||
* method performs JPEG decompression but leaves out the color conversion
|
||||
* step, so a planar YUV image is generated instead of a packed-pixel 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
|
||||
* 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
|
||||
* the width of the JPEG image. (In other words, the width will not be
|
||||
* considered when determining the scaled image size.)
|
||||
*
|
||||
* @param strides an array of integers, each specifying the number of bytes
|
||||
* per line in the corresponding plane of the output image. Setting the
|
||||
* stride for any plane to 0 is the same as setting it to the scaled
|
||||
* component width of the plane. If <tt>strides</tt> is NULL, then the
|
||||
* strides for all planes will be set to their respective scaled component
|
||||
* widths. You can adjust the strides in order to add an arbitrary amount of
|
||||
* line padding to each plane.
|
||||
* per row in the corresponding plane of the YUV image. Setting the stride
|
||||
* for any plane to 0 is the same as setting it to the scaled plane width
|
||||
* (see {@link YUVImage}.) If <code>strides</code> is null, then the strides
|
||||
* for all planes will be set to their respective scaled plane widths. You
|
||||
* can adjust the strides in order to add an arbitrary amount of row padding
|
||||
* to each plane.
|
||||
*
|
||||
* @param desiredHeight desired height (in pixels) of the YUV image. If the
|
||||
* desired image dimensions are different than the dimensions of the JPEG
|
||||
* image being decompressed, then TurboJPEG will use scaling in the JPEG
|
||||
* decompressor to generate the largest possible image that will fit within
|
||||
* the desired dimensions. Setting this to 0 is the same as setting it to
|
||||
* the height of the JPEG image (in other words, the height will not be
|
||||
* 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#FLAG_BOTTOMUP TJ.FLAG_*}
|
||||
*
|
||||
* @return a YUV planar image.
|
||||
* @return a {@link YUVImage} instance containing the decompressed image
|
||||
* planes
|
||||
*/
|
||||
public YUVImage decompressToYUV(int desiredWidth, int[] strides,
|
||||
int desiredHeight,
|
||||
@@ -551,40 +559,41 @@ public class TJDecompressor implements Closeable {
|
||||
|
||||
/**
|
||||
* Decompress the JPEG source image associated with this decompressor
|
||||
* instance into a unified YUV planar image buffer 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.
|
||||
* instance into a unified planar YUV image and return a {@link YUVImage}
|
||||
* 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 a packed-pixel 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
|
||||
* 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
|
||||
* the width of the JPEG image. (In other words, the width will not be
|
||||
* considered when determining the scaled image size.)
|
||||
*
|
||||
* @param pad the width of each line in each plane of the YUV image will be
|
||||
* padded to the nearest multiple of this number of bytes (must be a power of
|
||||
* 2.)
|
||||
* @param align row alignment (in bytes) of the YUV image (must be a power of
|
||||
* 2.) Setting this parameter to n will cause each row in each plane of the
|
||||
* YUV image to be padded to the nearest multiple of n bytes (1 = unpadded.)
|
||||
*
|
||||
* @param desiredHeight desired height (in pixels) of the YUV image. If the
|
||||
* desired image dimensions are different than the dimensions of the JPEG
|
||||
* image being decompressed, then TurboJPEG will use scaling in the JPEG
|
||||
* decompressor to generate the largest possible image that will fit within
|
||||
* the desired dimensions. Setting this to 0 is the same as setting it to
|
||||
* the height of the JPEG image (in other words, the height will not be
|
||||
* 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#FLAG_BOTTOMUP TJ.FLAG_*}
|
||||
*
|
||||
* @return a YUV planar image.
|
||||
* @return a {@link YUVImage} instance containing the unified planar YUV
|
||||
* decompressed image
|
||||
*/
|
||||
public YUVImage decompressToYUV(int desiredWidth, int pad, int desiredHeight,
|
||||
int flags) throws TJException {
|
||||
public YUVImage decompressToYUV(int desiredWidth, int align,
|
||||
int desiredHeight, int flags)
|
||||
throws TJException {
|
||||
if (flags < 0)
|
||||
throw new IllegalArgumentException("Invalid argument in decompressToYUV()");
|
||||
if (jpegWidth < 1 || jpegHeight < 1 || jpegSubsamp < 0)
|
||||
@@ -596,34 +605,34 @@ public class TJDecompressor implements Closeable {
|
||||
|
||||
int scaledWidth = getScaledWidth(desiredWidth, desiredHeight);
|
||||
int scaledHeight = getScaledHeight(desiredWidth, desiredHeight);
|
||||
YUVImage dstYUVImage = new YUVImage(scaledWidth, pad, scaledHeight,
|
||||
YUVImage dstYUVImage = new YUVImage(scaledWidth, align, scaledHeight,
|
||||
jpegSubsamp);
|
||||
decompressToYUV(dstYUVImage, flags);
|
||||
return dstYUVImage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Decompress the JPEG source image or decode the planar YUV source image
|
||||
* associated with this decompressor instance and output a packed-pixel
|
||||
* grayscale, RGB, or CMYK image to the given destination buffer.
|
||||
* <p>
|
||||
* NOTE: The output image is fully recoverable if this method throws a
|
||||
* NOTE: The destination image is fully recoverable if this method throws a
|
||||
* non-fatal {@link TJException} (unless
|
||||
* {@link TJ#FLAG_STOPONWARNING TJ.FLAG_STOPONWARNING} is specified.)
|
||||
*
|
||||
* @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}. 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 dstBuf buffer that will receive the packed-pixel
|
||||
* 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.</code>{@link TJScalingFactor#getScaled getScaled}<code>(jpegHeight)</code>
|
||||
* with one of the scaling factors returned from {@link 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 in the destination image into
|
||||
* which the source image should be decompressed/decoded
|
||||
@@ -637,18 +646,18 @@ public class TJDecompressor implements Closeable {
|
||||
* 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
|
||||
* 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
|
||||
* @param stride pixels per row in 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: 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}. If the source image is a
|
||||
* YUV image, then <code>scaledWidth</code> is the width of the YUV image.
|
||||
* can be determined by calling
|
||||
* <code>scalingFactor.</code>{@link TJScalingFactor#getScaled getScaled}<code>(jpegWidth)</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>.
|
||||
*
|
||||
@@ -658,8 +667,8 @@ public class TJDecompressor implements Closeable {
|
||||
* 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
|
||||
* 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
|
||||
@@ -688,21 +697,22 @@ public class TJDecompressor implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Decompress the JPEG source image or decode the planar YUV source image
|
||||
* associated with this decompressor instance and output a packed-pixel
|
||||
* decompressed/decoded image to the given <code>BufferedImage</code>
|
||||
* instance.
|
||||
* <p>
|
||||
* NOTE: The output image is fully recoverable if this method throws a
|
||||
* NOTE: The destination image is fully recoverable if this method throws a
|
||||
* non-fatal {@link TJException} (unless
|
||||
* {@link TJ#FLAG_STOPONWARNING TJ.FLAG_STOPONWARNING} is specified.)
|
||||
*
|
||||
* @param dstImage a <code>BufferedImage</code> instance that will receive
|
||||
* 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.
|
||||
* the packed-pixel 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 the decompressor 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#FLAG_BOTTOMUP TJ.FLAG_*}
|
||||
@@ -725,7 +735,7 @@ public class TJDecompressor implements Closeable {
|
||||
scaledWidth = getScaledWidth(desiredWidth, desiredHeight);
|
||||
scaledHeight = getScaledHeight(desiredWidth, desiredHeight);
|
||||
if (scaledWidth != desiredWidth || scaledHeight != desiredHeight)
|
||||
throw new IllegalArgumentException("BufferedImage dimensions do not match one of the scaled image sizes that TurboJPEG is capable of generating.");
|
||||
throw new IllegalArgumentException("BufferedImage dimensions do not match one of the scaled image sizes that the decompressor is capable of generating.");
|
||||
}
|
||||
int pixelFormat; boolean intPixels = false;
|
||||
if (byteOrder == null)
|
||||
@@ -795,7 +805,7 @@ public class TJDecompressor implements Closeable {
|
||||
/**
|
||||
* 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.
|
||||
* instance containing the packed-pixel decompressed/decoded image.
|
||||
*
|
||||
* @param desiredWidth see
|
||||
* {@link #decompress(byte[], int, int, int, int, int, int, int)} for
|
||||
@@ -812,7 +822,7 @@ public class TJDecompressor implements Closeable {
|
||||
* @param flags the bitwise OR of one or more of
|
||||
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
|
||||
*
|
||||
* @return a <code>BufferedImage</code> instance containing the
|
||||
* @return a <code>BufferedImage</code> instance containing the packed-pixel
|
||||
* decompressed/decoded image.
|
||||
*/
|
||||
public BufferedImage decompress(int desiredWidth, int desiredHeight,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C)2011, 2013, 2018, 2022 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2011, 2013, 2018, 2022-2023 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:
|
||||
@@ -97,7 +98,7 @@ public class TJTransform extends Rectangle {
|
||||
* the level of chrominance subsampling used. If the image's width or height
|
||||
* is not evenly divisible by the MCU block size (see {@link TJ#getMCUWidth}
|
||||
* and {@link TJ#getMCUHeight}), then there will be partial MCU blocks on the
|
||||
* right and/or bottom edges. It is not possible to move these partial MCU
|
||||
* right and/or bottom edges. It is not possible to move these partial MCU
|
||||
* blocks to the top or left of the image, so any transform that would
|
||||
* require that is "imperfect." If this option is not specified, then any
|
||||
* partial MCU blocks that cannot be transformed will be left in place, which
|
||||
@@ -114,8 +115,8 @@ public class TJTransform extends Rectangle {
|
||||
*/
|
||||
public static final int OPT_CROP = (1 << 2);
|
||||
/**
|
||||
* This option will discard the color data in the input image and produce
|
||||
* a grayscale output image.
|
||||
* This option will discard the color data in the source image and produce a
|
||||
* grayscale destination image.
|
||||
*/
|
||||
public static final int OPT_GRAY = (1 << 3);
|
||||
/**
|
||||
@@ -127,7 +128,7 @@ public class TJTransform extends Rectangle {
|
||||
*/
|
||||
public static final int OPT_NOOUTPUT = (1 << 4);
|
||||
/**
|
||||
* This option will enable progressive entropy coding in the output image
|
||||
* This option will enable progressive entropy coding in the JPEG image
|
||||
* generated by this particular transform. Progressive entropy coding will
|
||||
* generally improve compression relative to baseline entropy coding (the
|
||||
* default), but it will reduce compression and decompression performance
|
||||
@@ -137,11 +138,11 @@ public class TJTransform extends Rectangle {
|
||||
/**
|
||||
* This option will prevent {@link TJTransformer#transform
|
||||
* TJTransformer.transform()} from copying any extra markers (including EXIF
|
||||
* and ICC profile data) from the source image to the output image.
|
||||
* and ICC profile data) from the source image to the destination image.
|
||||
*/
|
||||
public static final int OPT_COPYNONE = (1 << 6);
|
||||
/**
|
||||
* This option will enable arithmetic entropy coding in the output image
|
||||
* This option will enable arithmetic entropy coding in the JPEG image
|
||||
* generated by this particular transform. Arithmetic entropy coding will
|
||||
* generally improve compression relative to Huffman entropy coding (the
|
||||
* default), but it will reduce compression and decompression performance
|
||||
@@ -173,10 +174,10 @@ public class TJTransform extends Rectangle {
|
||||
* equivalent of setting it to (height of the source JPEG image -
|
||||
* <code>y</code>).
|
||||
*
|
||||
* @param op one of the transform operations (<code>OP_*</code>)
|
||||
* @param op one of the transform operations ({@link #OP_NONE OP_*})
|
||||
*
|
||||
* @param options the bitwise OR of one or more of the transform options
|
||||
* (<code>OPT_*</code>)
|
||||
* ({@link #OPT_PERFECT OPT_*})
|
||||
*
|
||||
* @param cf an instance of an object that implements the {@link
|
||||
* TJCustomFilter} interface, or null if no custom filter is needed
|
||||
@@ -198,10 +199,10 @@ public class TJTransform extends Rectangle {
|
||||
* #TJTransform(int, int, int, int, int, int, TJCustomFilter)} for more
|
||||
* detail.
|
||||
*
|
||||
* @param op one of the transform operations (<code>OP_*</code>)
|
||||
* @param op one of the transform operations ({@link #OP_NONE OP_*})
|
||||
*
|
||||
* @param options the bitwise OR of one or more of the transform options
|
||||
* (<code>OPT_*</code>)
|
||||
* ({@link #OPT_PERFECT OPT_*})
|
||||
*
|
||||
* @param cf an instance of an object that implements the {@link
|
||||
* TJCustomFilter} interface, or null if no custom filter is needed
|
||||
@@ -216,13 +217,14 @@ public class TJTransform extends Rectangle {
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform operation (one of <code>OP_*</code>)
|
||||
* Transform operation (one of {@link #OP_NONE OP_*})
|
||||
*/
|
||||
@SuppressWarnings("checkstyle:VisibilityModifier")
|
||||
public int op = 0;
|
||||
|
||||
/**
|
||||
* Transform options (bitwise OR of one or more of <code>OPT_*</code>)
|
||||
* Transform options (bitwise OR of one or more of
|
||||
* {@link #OPT_PERFECT OPT_*})
|
||||
*/
|
||||
@SuppressWarnings("checkstyle:VisibilityModifier")
|
||||
public int options = 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2011, 2013-2015 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2011, 2013-2015, 2023 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -43,10 +43,12 @@ 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.
|
||||
* 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.) This buffer is not modified.
|
||||
* @param jpegImage buffer containing the JPEG source image to transform.
|
||||
* (The size of the JPEG image is assumed to be the length of the array.)
|
||||
* This buffer is not modified.
|
||||
*/
|
||||
public TJTransformer(byte[] jpegImage) throws TJException {
|
||||
init();
|
||||
@@ -55,12 +57,13 @@ public class TJTransformer extends TJDecompressor {
|
||||
|
||||
/**
|
||||
* Create a TurboJPEG lossless transformer instance and associate the JPEG
|
||||
* image of length <code>imageSize</code> bytes stored in
|
||||
* source image of length <code>imageSize</code> bytes stored in
|
||||
* <code>jpegImage</code> with the newly created instance.
|
||||
*
|
||||
* @param jpegImage JPEG image buffer. This buffer is not modified.
|
||||
* @param jpegImage buffer containing the JPEG source image to transform.
|
||||
* This buffer is not modified.
|
||||
*
|
||||
* @param imageSize size of the JPEG image (in bytes)
|
||||
* @param imageSize size of the JPEG source image (in bytes)
|
||||
*/
|
||||
public TJTransformer(byte[] jpegImage, int imageSize) throws TJException {
|
||||
init();
|
||||
@@ -68,28 +71,29 @@ public class TJTransformer extends TJDecompressor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Losslessly transform the JPEG image associated with this transformer
|
||||
* instance into one or more JPEG images stored in the given destination
|
||||
* buffers. Lossless transforms work by moving the raw coefficients from one
|
||||
* JPEG image structure to another without altering the values of the
|
||||
* coefficients. While this is typically faster than decompressing the
|
||||
* image, transforming it, and re-compressing it, lossless transforms are not
|
||||
* free. Each lossless transform requires reading and performing Huffman
|
||||
* decoding on all of the coefficients in the source image, regardless of the
|
||||
* size of the destination image. Thus, this method provides a means of
|
||||
* generating multiple transformed images from the same source or of applying
|
||||
* multiple transformations simultaneously, in order to eliminate the need to
|
||||
* read the source coefficients multiple times.
|
||||
* Losslessly transform the JPEG source image associated with this
|
||||
* transformer instance into one or more JPEG images stored in the given
|
||||
* destination buffers. Lossless transforms work by moving the raw
|
||||
* coefficients from one JPEG image structure to another without altering the
|
||||
* values of the coefficients. While this is typically faster than
|
||||
* decompressing the image, transforming it, and re-compressing it, lossless
|
||||
* transforms are not free. Each lossless transform requires reading and
|
||||
* performing Huffman decoding on all of the coefficients in the source
|
||||
* image, regardless of the size of the destination image. Thus, this method
|
||||
* provides a means of generating multiple transformed images from the same
|
||||
* source or of applying multiple transformations simultaneously, in order to
|
||||
* eliminate the need to read the source coefficients multiple times.
|
||||
*
|
||||
* @param dstBufs an array of image buffers. <code>dstbufs[i]</code> will
|
||||
* 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 and the level of subsampling used in the source image.
|
||||
* @param dstBufs an array of JPEG destination buffers.
|
||||
* <code>dstbufs[i]</code> will 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 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
|
||||
* corresponding transformed JPEG image
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of
|
||||
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
|
||||
@@ -103,13 +107,13 @@ public class TJTransformer extends TJDecompressor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Losslessly transform the JPEG image associated with this transformer
|
||||
* instance and return an array of {@link TJDecompressor} instances, each of
|
||||
* which has a transformed JPEG image associated with it.
|
||||
* Losslessly transform the JPEG source image associated with this
|
||||
* transformer instance and return an array of {@link TJDecompressor}
|
||||
* instances, each of which has a transformed JPEG image associated with it.
|
||||
*
|
||||
* @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
|
||||
* corresponding transformed JPEG image
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of
|
||||
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
|
||||
@@ -139,10 +143,10 @@ public class TJTransformer extends TJDecompressor {
|
||||
|
||||
/**
|
||||
* Returns an array containing the sizes of the transformed JPEG images
|
||||
* generated by the most recent transform operation.
|
||||
* (in bytes) generated by the most recent transform operation.
|
||||
*
|
||||
* @return an array containing the sizes of the transformed JPEG images
|
||||
* generated by the most recent transform operation.
|
||||
* (in bytes) generated by the most recent transform operation.
|
||||
*/
|
||||
public int[] getTransformedSizes() {
|
||||
if (transformedSizes == null)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2014, 2017 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2014, 2017, 2023 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -30,7 +30,7 @@
|
||||
package org.libjpegturbo.turbojpeg;
|
||||
|
||||
/**
|
||||
* This class encapsulates a YUV planar image and the metadata
|
||||
* This class encapsulates a planar YUV image 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
|
||||
@@ -38,30 +38,32 @@ package org.libjpegturbo.turbojpeg;
|
||||
* 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.
|
||||
* Technically, the JPEG format uses the YCbCr colorspace (which is technically
|
||||
* not a colorspace but 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.
|
||||
* <p>
|
||||
* Each plane is simply a 2D array of bytes, each byte representing the value
|
||||
* of one of the components (Y, Cb, or Cr) at a particular location in the
|
||||
* image. The width and height of each plane are determined by the image
|
||||
* width, height, and level of chrominance subsampling. The luminance plane
|
||||
* width is the image width padded to the nearest multiple of the horizontal
|
||||
* subsampling factor (2 in the case of 4:2:0 and 4:2:2, 4 in the case of
|
||||
* 4:1:1, 1 in the case of 4:4:4 or grayscale.) Similarly, the luminance plane
|
||||
* height is the image height padded to the nearest multiple of the vertical
|
||||
* subsampling factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4
|
||||
* or grayscale.) The chrominance plane width is equal to the luminance plane
|
||||
* width divided by the horizontal subsampling factor, and the chrominance
|
||||
* plane height is equal to the luminance plane height divided by the vertical
|
||||
* subsampling factor.
|
||||
* subsampling factor (1 in the case of 4:4:4, grayscale, or 4:4:0; 2 in the
|
||||
* case of 4:2:2 or 4:2:0; 4 in the case of 4:1:1.) Similarly, the luminance
|
||||
* plane height is the image height padded to the nearest multiple of the
|
||||
* vertical subsampling factor (1 in the case of 4:4:4, 4:2:2, grayscale, or
|
||||
* 4:1:1; 2 in the case of 4:2:0 or 4:4:0.) This is irrespective of any
|
||||
* additional padding that may be specified as an argument to the various
|
||||
* YUVImage methods. The chrominance plane width is equal to the luminance
|
||||
* plane width divided by the horizontal subsampling factor, and the
|
||||
* chrominance plane height is equal to the luminance plane height divided by
|
||||
* the vertical subsampling factor.
|
||||
* <p>
|
||||
* For example, 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 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.
|
||||
* chrominance planes would be 18 x 35 bytes. If you specify a row alignment
|
||||
* 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 {
|
||||
|
||||
@@ -75,7 +77,7 @@ public class YUVImage {
|
||||
* @param width width (in pixels) of the YUV image
|
||||
*
|
||||
* @param strides an array of integers, each specifying the number of bytes
|
||||
* per line in the corresponding plane of the YUV image. Setting the stride
|
||||
* per row in the corresponding plane of the YUV image. Setting the stride
|
||||
* for any plane to 0 is the same as setting it to the plane width (see
|
||||
* {@link YUVImage above}.) If <code>strides</code> is null, then the
|
||||
* strides for all planes will be set to their respective plane widths. When
|
||||
@@ -92,22 +94,24 @@ public class YUVImage {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new <code>YUVImage</code> instance backed by a unified image
|
||||
* buffer, and allocate memory for the image buffer.
|
||||
* Create a new <code>YUVImage</code> instance backed by a unified buffer,
|
||||
* and allocate memory for the 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 align row alignment (in bytes) of the YUV image (must be a power of
|
||||
* 2.) Setting this parameter to n specifies that each row in each plane of
|
||||
* the YUV image will be padded to the nearest multiple of n bytes
|
||||
* (1 = unpadded.)
|
||||
*
|
||||
* @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) {
|
||||
setBuf(new byte[TJ.bufSizeYUV(width, pad, height, subsamp)], width, pad,
|
||||
height, subsamp);
|
||||
public YUVImage(int width, int align, int height, int subsamp) {
|
||||
setBuf(new byte[TJ.bufSizeYUV(width, align, height, subsamp)], width,
|
||||
align, height, subsamp);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -117,8 +121,8 @@ public class YUVImage {
|
||||
* @param planes an array of buffers representing the Y, U (Cb), and V (Cr)
|
||||
* image planes (or just the Y plane, if the image is grayscale.) These
|
||||
* planes can be contiguous or non-contiguous in memory. Plane
|
||||
* <code>i</code> should be at least <code>offsets[i] +
|
||||
* {@link TJ#planeSizeYUV TJ.planeSizeYUV}(i, width, strides[i], height, subsamp)</code>
|
||||
* <code>i</code> should be at least <code>offsets[i] + </code>
|
||||
* {@link TJ#planeSizeYUV TJ.planeSizeYUV}<code>(i, width, strides[i], height, subsamp)</code>
|
||||
* bytes in size.
|
||||
*
|
||||
* @param offsets If this <code>YUVImage</code> instance represents a
|
||||
@@ -130,11 +134,11 @@ public class YUVImage {
|
||||
* @param width width (in pixels) of the new YUV image (or subregion)
|
||||
*
|
||||
* @param strides an array of integers, each specifying the number of bytes
|
||||
* per line in the corresponding plane of the YUV image. Setting the stride
|
||||
* per row in the corresponding plane of the YUV image. Setting the stride
|
||||
* for any plane to 0 is the same as setting it to the plane width (see
|
||||
* {@link YUVImage above}.) If <code>strides</code> is null, then the
|
||||
* strides for all planes will be set to their respective plane widths. You
|
||||
* can adjust the strides in order to add an arbitrary amount of line padding
|
||||
* can adjust the strides in order to add an arbitrary amount of row padding
|
||||
* to each plane or to specify that this <code>YUVImage</code> instance is a
|
||||
* subregion of a larger image (in which case, <code>strides[i]</code> should
|
||||
* be set to the plane width of plane <code>i</code> in the larger image.)
|
||||
@@ -150,29 +154,30 @@ public class YUVImage {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new <code>YUVImage</code> instance from an existing unified image
|
||||
* Create a new <code>YUVImage</code> instance from an existing unified
|
||||
* buffer.
|
||||
*
|
||||
* @param yuvImage image buffer that contains or will contain YUV planar
|
||||
* image data. Use {@link TJ#bufSizeYUV} to determine the minimum size for
|
||||
* this buffer. The Y, U (Cb), and V (Cr) image planes are stored
|
||||
* sequentially in the buffer (see {@link YUVImage above} for a description
|
||||
* of the image format.)
|
||||
* @param yuvImage buffer that contains or will receive a unified planar YUV
|
||||
* image. Use {@link TJ#bufSizeYUV} to determine the minimum size for this
|
||||
* buffer. The Y, U (Cb), and V (Cr) image planes are stored sequentially in
|
||||
* the buffer. (See {@link YUVImage above} for a description of the image
|
||||
* format.)
|
||||
*
|
||||
* @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 align row alignment (in bytes) of the YUV image (must be a power of
|
||||
* 2.) Setting this parameter to n specifies that each row in each plane of
|
||||
* the YUV image will be padded to the nearest multiple of n bytes
|
||||
* (1 = unpadded.)
|
||||
*
|
||||
* @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,
|
||||
public YUVImage(byte[] yuvImage, int width, int align, int height,
|
||||
int subsamp) {
|
||||
setBuf(yuvImage, width, pad, height, subsamp);
|
||||
setBuf(yuvImage, width, align, height, subsamp);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -181,8 +186,8 @@ public class YUVImage {
|
||||
* @param planes an array of buffers representing the Y, U (Cb), and V (Cr)
|
||||
* image planes (or just the Y plane, if the image is grayscale.) These
|
||||
* planes can be contiguous or non-contiguous in memory. Plane
|
||||
* <code>i</code> should be at least <code>offsets[i] +
|
||||
* {@link TJ#planeSizeYUV TJ.planeSizeYUV}(i, width, strides[i], height, subsamp)</code>
|
||||
* <code>i</code> should be at least <code>offsets[i] + </code>
|
||||
* {@link TJ#planeSizeYUV TJ.planeSizeYUV}<code>(i, width, strides[i], height, subsamp)</code>
|
||||
* bytes in size.
|
||||
*
|
||||
* @param offsets If this <code>YUVImage</code> instance represents a
|
||||
@@ -194,12 +199,12 @@ public class YUVImage {
|
||||
* @param width width (in pixels) of the YUV image (or subregion)
|
||||
*
|
||||
* @param strides an array of integers, each specifying the number of bytes
|
||||
* per line in the corresponding plane of the YUV image. Setting the stride
|
||||
* per row in the corresponding plane of the YUV image. Setting the stride
|
||||
* for any plane to 0 is the same as setting it to the plane width (see
|
||||
* {@link YUVImage above}.) If <code>strides</code> is null, then the
|
||||
* strides for all planes will be set to their respective plane widths. You
|
||||
* can adjust the strides in order to add an arbitrary amount of line padding
|
||||
* to each plane or to specify that this <code>YUVImage</code> image is a
|
||||
* can adjust the strides in order to add an arbitrary amount of row padding
|
||||
* to each plane or to specify that this <code>YUVImage</code> instance is a
|
||||
* subregion of a larger image (in which case, <code>strides[i]</code> should
|
||||
* be set to the plane width of plane <code>i</code> in the larger image.)
|
||||
*
|
||||
@@ -263,32 +268,34 @@ public class YUVImage {
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign a unified image buffer to this <code>YUVImage</code> instance.
|
||||
* Assign a unified buffer to this <code>YUVImage</code> instance.
|
||||
*
|
||||
* @param yuvImage image buffer that contains or will contain YUV planar
|
||||
* image data. Use {@link TJ#bufSizeYUV} to determine the minimum size for
|
||||
* this buffer. The Y, U (Cb), and V (Cr) image planes are stored
|
||||
* sequentially in the buffer (see {@link YUVImage above} for a description
|
||||
* of the image format.)
|
||||
* @param yuvImage buffer that contains or will receive a unified planar YUV
|
||||
* image. Use {@link TJ#bufSizeYUV} to determine the minimum size for this
|
||||
* buffer. The Y, U (Cb), and V (Cr) image planes are stored sequentially in
|
||||
* the buffer. (See {@link YUVImage above} for a description of the image
|
||||
* format.)
|
||||
*
|
||||
* @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 align row alignment (in bytes) of the YUV image (must be a power of
|
||||
* 2.) Setting this parameter to n specifies that each row in each plane of
|
||||
* the YUV image will be padded to the nearest multiple of n bytes
|
||||
* (1 = unpadded.)
|
||||
*
|
||||
* @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 void setBuf(byte[] yuvImage, int width, int pad, int height,
|
||||
public void setBuf(byte[] yuvImage, int width, int align, int height,
|
||||
int subsamp) {
|
||||
if (yuvImage == null || width < 1 || pad < 1 || ((pad & (pad - 1)) != 0) ||
|
||||
height < 1 || subsamp < 0 || subsamp >= TJ.NUMSAMP)
|
||||
if (yuvImage == null || width < 1 || align < 1 ||
|
||||
((align & (align - 1)) != 0) || height < 1 || subsamp < 0 ||
|
||||
subsamp >= TJ.NUMSAMP)
|
||||
throw new IllegalArgumentException("Invalid argument in YUVImage::setBuf()");
|
||||
if (yuvImage.length < TJ.bufSizeYUV(width, pad, height, subsamp))
|
||||
throw new IllegalArgumentException("YUV image buffer is not large enough");
|
||||
if (yuvImage.length < TJ.bufSizeYUV(width, align, height, subsamp))
|
||||
throw new IllegalArgumentException("YUV buffer is not large enough");
|
||||
|
||||
int nc = (subsamp == TJ.SAMP_GRAY ? 1 : 3);
|
||||
byte[][] planes = new byte[nc][];
|
||||
@@ -296,9 +303,9 @@ public class YUVImage {
|
||||
int[] offsets = new int[nc];
|
||||
|
||||
planes[0] = yuvImage;
|
||||
strides[0] = pad(TJ.planeWidth(0, width, subsamp), pad);
|
||||
strides[0] = pad(TJ.planeWidth(0, width, subsamp), align);
|
||||
if (subsamp != TJ.SAMP_GRAY) {
|
||||
strides[1] = strides[2] = pad(TJ.planeWidth(1, width, subsamp), pad);
|
||||
strides[1] = strides[2] = pad(TJ.planeWidth(1, width, subsamp), align);
|
||||
planes[1] = planes[2] = yuvImage;
|
||||
offsets[1] = offsets[0] +
|
||||
strides[0] * TJ.planeHeight(0, height, subsamp);
|
||||
@@ -306,7 +313,7 @@ public class YUVImage {
|
||||
strides[1] * TJ.planeHeight(1, height, subsamp);
|
||||
}
|
||||
|
||||
yuvPad = pad;
|
||||
yuvAlign = align;
|
||||
setBuf(planes, offsets, width, strides, height, subsamp);
|
||||
}
|
||||
|
||||
@@ -333,23 +340,23 @@ public class YUVImage {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the line padding used in the YUV image buffer (if this image is
|
||||
* Returns the row alignment (in bytes) of the YUV buffer (if this image is
|
||||
* stored in a unified buffer rather than separate image planes.)
|
||||
*
|
||||
* @return the line padding used in the YUV image buffer
|
||||
* @return the row alignment of the YUV buffer
|
||||
*/
|
||||
public int getPad() {
|
||||
if (yuvPlanes == null)
|
||||
throw new IllegalStateException(NO_ASSOC_ERROR);
|
||||
if (yuvPad < 1 || ((yuvPad & (yuvPad - 1)) != 0))
|
||||
if (yuvAlign < 1 || ((yuvAlign & (yuvAlign - 1)) != 0))
|
||||
throw new IllegalStateException("Image is not stored in a unified buffer");
|
||||
return yuvPad;
|
||||
return yuvAlign;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of bytes per line of each plane in the YUV image.
|
||||
* Returns the number of bytes per row of each plane in the YUV image.
|
||||
*
|
||||
* @return the number of bytes per line of each plane in the YUV image
|
||||
* @return the number of bytes per row of each plane in the YUV image
|
||||
*/
|
||||
public int[] getStrides() {
|
||||
if (yuvStrides == null)
|
||||
@@ -395,10 +402,10 @@ public class YUVImage {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the YUV image buffer (if this image is stored in a unified
|
||||
* buffer rather than separate image planes.)
|
||||
* Returns the YUV buffer (if this image is stored in a unified buffer rather
|
||||
* than separate image planes.)
|
||||
*
|
||||
* @return the YUV image buffer
|
||||
* @return the YUV buffer
|
||||
*/
|
||||
public byte[] getBuf() {
|
||||
if (yuvPlanes == null || yuvSubsamp < 0 || yuvSubsamp >= TJ.NUMSAMP)
|
||||
@@ -412,22 +419,22 @@ public class YUVImage {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the size (in bytes) of the YUV image buffer (if this image is
|
||||
* stored in a unified buffer rather than separate image planes.)
|
||||
* Returns the size (in bytes) of the YUV buffer (if this image is stored in
|
||||
* a unified buffer rather than separate image planes.)
|
||||
*
|
||||
* @return the size (in bytes) of the YUV image buffer
|
||||
* @return the size (in bytes) of the YUV buffer
|
||||
*/
|
||||
public int getSize() {
|
||||
if (yuvPlanes == null || yuvSubsamp < 0 || yuvSubsamp >= TJ.NUMSAMP)
|
||||
throw new IllegalStateException(NO_ASSOC_ERROR);
|
||||
int nc = (yuvSubsamp == TJ.SAMP_GRAY ? 1 : 3);
|
||||
if (yuvPad < 1)
|
||||
if (yuvAlign < 1)
|
||||
throw new IllegalStateException("Image is not stored in a unified buffer");
|
||||
for (int i = 1; i < nc; i++) {
|
||||
if (yuvPlanes[i] != yuvPlanes[0])
|
||||
throw new IllegalStateException("Image is not stored in a unified buffer");
|
||||
}
|
||||
return TJ.bufSizeYUV(yuvWidth, yuvPad, yuvHeight, yuvSubsamp);
|
||||
return TJ.bufSizeYUV(yuvWidth, yuvAlign, yuvHeight, yuvSubsamp);
|
||||
}
|
||||
|
||||
private static int pad(int v, int p) {
|
||||
@@ -438,7 +445,7 @@ public class YUVImage {
|
||||
protected byte[][] yuvPlanes = null;
|
||||
protected int[] yuvOffsets = null;
|
||||
protected int[] yuvStrides = null;
|
||||
protected int yuvPad = 0;
|
||||
protected int yuvAlign = 1;
|
||||
protected int yuvWidth = 0;
|
||||
protected int yuvHeight = 0;
|
||||
protected int yuvSubsamp = -1;
|
||||
|
||||
Reference in New Issue
Block a user