|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.libjpegturbo.turbojpeg.TJDecompressor
public class TJDecompressor
TurboJPEG decompressor
Field Summary | |
---|---|
protected long |
handle
|
protected byte[] |
jpegBuf
|
protected int |
jpegBufSize
|
protected int |
jpegHeight
|
protected int |
jpegSubsamp
|
protected int |
jpegWidth
|
Constructor Summary | |
---|---|
TJDecompressor()
Create a TurboJPEG decompresssor instance. |
|
TJDecompressor(byte[] jpegImage)
Create a TurboJPEG decompressor instance and associate the JPEG image stored in jpegImage with the newly-created instance. |
|
TJDecompressor(byte[] jpegImage,
int imageSize)
Create a TurboJPEG decompressor instance and associate the JPEG image of length imageSize bytes stored in jpegImage
with the newly-created instance. |
Method Summary | |
---|---|
void |
close()
Free the native structures associated with this decompressor instance. |
void |
decompress(java.awt.image.BufferedImage dstImage,
int flags)
Decompress the JPEG source image associated with this decompressor instance and output a decompressed image to the given BufferedImage instance. |
void |
decompress(byte[] dstBuf,
int desiredWidth,
int pitch,
int desiredHeight,
int pixelFormat,
int flags)
Decompress the JPEG source image associated with this decompressor instance and output a decompressed image to the given destination buffer. |
java.awt.image.BufferedImage |
decompress(int desiredWidth,
int desiredHeight,
int bufferedImageType,
int flags)
Decompress the JPEG source image associated with this decompressor instance and return a BufferedImage instance containing the
decompressed image. |
byte[] |
decompress(int desiredWidth,
int pitch,
int desiredHeight,
int pixelFormat,
int flags)
Decompress the JPEG source image associated with this decompressor instance and return a buffer containing the decompressed image. |
void |
decompressToYUV(byte[] dstBuf,
int flags)
Decompress the JPEG source image associated with this decompressor instance and output a YUV planar image to the given destination buffer. |
byte[] |
decompressToYUV(int flags)
Decompress the JPEG source image associated with this decompressor instance and return a buffer containing a YUV planar image. |
protected void |
finalize()
|
int |
getHeight()
Returns the height of the JPEG image associated with this decompressor instance. |
byte[] |
getJPEGBuf()
Returns the JPEG image buffer associated with this decompressor instance. |
int |
getJPEGSize()
Returns the size of the JPEG image (in bytes) associated with this decompressor instance. |
int |
getScaledHeight(int desiredWidth,
int desiredHeight)
Returns the height of the largest scaled down image that the TurboJPEG decompressor can generate without exceeding the desired image width and height. |
int |
getScaledWidth(int desiredWidth,
int desiredHeight)
Returns the width of the largest scaled down image that the TurboJPEG decompressor can generate without exceeding the desired image width and height. |
int |
getSubsamp()
Returns the level of chrominance subsampling used in the JPEG image associated with this decompressor instance. |
int |
getWidth()
Returns the width of the JPEG image associated with this decompressor instance. |
void |
setJPEGImage(byte[] jpegImage,
int imageSize)
Associate the JPEG image of length imageSize bytes stored in
jpegImage with this decompressor instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected long handle
protected byte[] jpegBuf
protected int jpegBufSize
protected int jpegWidth
protected int jpegHeight
protected int jpegSubsamp
Constructor Detail |
---|
public TJDecompressor() throws java.lang.Exception
java.lang.Exception
public TJDecompressor(byte[] jpegImage) throws java.lang.Exception
jpegImage
with the newly-created instance.
jpegImage
- JPEG image buffer (size of the JPEG image is assumed to
be the length of the array)
java.lang.Exception
public TJDecompressor(byte[] jpegImage, int imageSize) throws java.lang.Exception
imageSize
bytes stored in jpegImage
with the newly-created instance.
jpegImage
- JPEG image bufferimageSize
- size of the JPEG image (in bytes)
java.lang.Exception
Method Detail |
---|
public void setJPEGImage(byte[] jpegImage, int imageSize) throws java.lang.Exception
imageSize
bytes stored in
jpegImage
with this decompressor instance. This image will
be used as the source image for subsequent decompress operations.
jpegImage
- JPEG image bufferimageSize
- size of the JPEG image (in bytes)
java.lang.Exception
public int getWidth() throws java.lang.Exception
java.lang.Exception
public int getHeight() throws java.lang.Exception
java.lang.Exception
public int getSubsamp() throws java.lang.Exception
java.lang.Exception
public byte[] getJPEGBuf() throws java.lang.Exception
java.lang.Exception
public int getJPEGSize() throws java.lang.Exception
java.lang.Exception
public int getScaledWidth(int desiredWidth, int desiredHeight) throws java.lang.Exception
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.)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.)
java.lang.Exception
public int getScaledHeight(int desiredWidth, int desiredHeight) throws java.lang.Exception
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.)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.)
java.lang.Exception
public void decompress(byte[] dstBuf, int desiredWidth, int pitch, int desiredHeight, int pixelFormat, int flags) throws java.lang.Exception
dstBuf
- buffer that will receive the decompressed image. This
buffer should normally be pitch * scaledHeight
bytes in size,
where scaledHeight
can be determined by calling
scalingFactor.getScaled
(jpegHeight)
with one of the scaling factors returned from TJ.getScalingFactors()
or by calling getScaledHeight(int, int)
.desiredWidth
- desired width (in pixels) of the decompressed image.
If the desired image dimensions are smaller 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.)pitch
- bytes per line of the destination image. Normally, this
should be set to scaledWidth * TJ.pixelSize(pixelFormat)
if
the decompressed image is unpadded, but you can use this to, for instance,
pad each line of the decompressed image to a 4-byte boundary. NOTE:
scaledWidth
can be determined by calling
scalingFactor.getScaled
(jpegWidth)
or by calling getScaledWidth(int, int)
. Setting this parameter to
0 is the equivalent of setting it to scaledWidth *
TJ.pixelSize(pixelFormat)
.desiredHeight
- desired height (in pixels) of the decompressed image.
If the desired image dimensions are smaller than the dimensions of the
JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG
decompressor to generate the largest possible image that will fit within
the desired dimensions. Setting this to 0 is the same as setting it to
the height of the JPEG image (in other words, the height will not be
considered when determining the scaled image size.)pixelFormat
- pixel format of the decompressed image (one of
TJ.PF_*
)flags
- the bitwise OR of one or more of TJ.FLAG_*
java.lang.Exception
public byte[] decompress(int desiredWidth, int pitch, int desiredHeight, int pixelFormat, int flags) throws java.lang.Exception
desiredWidth
- see
decompress(byte[], int, int, int, int, int)
for descriptionpitch
- see
decompress(byte[], int, int, int, int, int)
for descriptiondesiredHeight
- see
decompress(byte[], int, int, int, int, int)
for descriptionpixelFormat
- pixel format of the decompressed image (one of
TJ.PF_*
)flags
- the bitwise OR of one or more of TJ.FLAG_*
java.lang.Exception
public void decompressToYUV(byte[] dstBuf, int flags) throws java.lang.Exception
TJCompressor.encodeYUV(byte[], int)
. Note that, if
the width or height of the image is not an even multiple of the MCU block
size (see TJ.getMCUWidth(int)
and TJ.getMCUHeight(int)
), then an
intermediate buffer copy will be performed within TurboJPEG.
dstBuf
- buffer that will receive the YUV planar image. Use
TJ.bufSizeYUV(int, int, int)
to determine the appropriate size for this buffer
based on the image width, height, and level of chrominance subsampling.flags
- the bitwise OR of one or more of TJ.FLAG_*
java.lang.Exception
public byte[] decompressToYUV(int flags) throws java.lang.Exception
decompressToYUV(byte[], int)
for more detail.
flags
- the bitwise OR of one or more of TJ.FLAG_*
java.lang.Exception
public void decompress(java.awt.image.BufferedImage dstImage, int flags) throws java.lang.Exception
BufferedImage
instance.
dstImage
- a BufferedImage
instance that will receive
the decompressed imageflags
- the bitwise OR of one or more of TJ.FLAG_*
java.lang.Exception
public java.awt.image.BufferedImage decompress(int desiredWidth, int desiredHeight, int bufferedImageType, int flags) throws java.lang.Exception
BufferedImage
instance containing the
decompressed image.
desiredWidth
- see
decompress(byte[], int, int, int, int, int)
for descriptiondesiredHeight
- see
decompress(byte[], int, int, int, int, int)
for descriptionbufferedImageType
- the image type of the newly-created
BufferedImage
instance (for instance,
BufferedImage.TYPE_INT_RGB
)flags
- the bitwise OR of one or more of TJ.FLAG_*
BufferedImage
instance containing the
decompressed image
java.lang.Exception
public void close() throws java.lang.Exception
java.lang.Exception
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |