public final class TJ
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
CS_CMYK
CMYK colorspace.
|
static int |
CS_GRAY
Grayscale colorspace.
|
static int |
CS_RGB
RGB colorspace.
|
static int |
CS_YCbCr
YCbCr colorspace.
|
static int |
CS_YCCK
YCCK colorspace.
|
static int |
ERR_FATAL
The error was fatal and non-recoverable.
|
static int |
ERR_WARNING
The error was non-fatal and recoverable, but the image may still be
corrupt.
|
static int |
FLAG_ACCURATEDCT
Use the most accurate DCT/IDCT algorithm available in the underlying
codec.
|
static int |
FLAG_BOTTOMUP
The uncompressed source/destination image is stored in bottom-up (Windows,
OpenGL) order, not top-down (X11) order.
|
static int |
FLAG_FASTDCT
Use the fastest DCT/IDCT algorithm available in the underlying codec.
|
static int |
FLAG_FASTUPSAMPLE
When decompressing an image that was compressed using chrominance
subsampling, use the fastest chrominance upsampling algorithm available in
the underlying codec.
|
static int |
FLAG_FORCEMMX
Deprecated.
|
static int |
FLAG_FORCESSE
Deprecated.
|
static int |
FLAG_FORCESSE2
Deprecated.
|
static int |
FLAG_FORCESSE3
Deprecated.
|
static int |
FLAG_PROGRESSIVE
Use progressive entropy coding in JPEG images generated by compression and
transform operations.
|
static int |
FLAG_STOPONWARNING
Immediately discontinue the current compression/decompression/transform
operation if the underlying codec throws a warning (non-fatal error).
|
static int |
NUMCS
The number of JPEG colorspaces
|
static int |
NUMERR
The number of error codes
|
static int |
NUMPF
The number of pixel formats
|
static int |
NUMSAMP
The number of chrominance subsampling options
|
static int |
PF_ABGR
ABGR pixel format.
|
static int |
PF_ARGB
ARGB pixel format.
|
static int |
PF_BGR
BGR pixel format.
|
static int |
PF_BGRA
BGRA pixel format.
|
static int |
PF_BGRX
BGRX pixel format.
|
static int |
PF_CMYK
CMYK pixel format.
|
static int |
PF_GRAY
Grayscale pixel format.
|
static int |
PF_RGB
RGB pixel format.
|
static int |
PF_RGBA
RGBA pixel format.
|
static int |
PF_RGBX
RGBX pixel format.
|
static int |
PF_XBGR
XBGR pixel format.
|
static int |
PF_XRGB
XRGB pixel format.
|
static int |
SAMP_411
4:1:1 chrominance subsampling.
|
static int |
SAMP_420
4:2:0 chrominance subsampling.
|
static int |
SAMP_422
4:2:2 chrominance subsampling.
|
static int |
SAMP_440
4:4:0 chrominance subsampling.
|
static int |
SAMP_444
4:4:4 chrominance subsampling (no chrominance subsampling).
|
static int |
SAMP_GRAY
Grayscale.
|
Modifier and Type | Method and Description |
---|---|
static int |
bufSize(int width,
int height,
int jpegSubsamp)
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.
|
static int |
bufSizeYUV(int width,
int height,
int subsamp)
Deprecated.
Use
bufSizeYUV(int, int, int, int) instead. |
static int |
bufSizeYUV(int width,
int pad,
int height,
int subsamp)
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.
|
static int |
getAlphaOffset(int pixelFormat)
For the given pixel format, returns the number of bytes that the alpha
component is offset from the start of the pixel.
|
static int |
getBlueOffset(int pixelFormat)
For the given pixel format, returns the number of bytes that the blue
component is offset from the start of the pixel.
|
static int |
getGreenOffset(int pixelFormat)
For the given pixel format, returns the number of bytes that the green
component is offset from the start of the pixel.
|
static int |
getMCUHeight(int subsamp)
Returns the MCU block height for the given level of chrominance
subsampling.
|
static int |
getMCUWidth(int subsamp)
Returns the MCU block width for the given level of chrominance
subsampling.
|
static int |
getPixelSize(int pixelFormat)
Returns the pixel size (in bytes) for the given pixel format.
|
static int |
getRedOffset(int pixelFormat)
For the given pixel format, returns the number of bytes that the red
component is offset from the start of the pixel.
|
static TJScalingFactor[] |
getScalingFactors()
Returns a list of fractional scaling factors that the JPEG decompressor in
this implementation of TurboJPEG supports.
|
static int |
planeHeight(int componentID,
int height,
int subsamp)
Returns the plane height of a YUV image plane with the given parameters.
|
static int |
planeSizeYUV(int componentID,
int width,
int stride,
int height,
int subsamp)
Returns the size of the buffer (in bytes) required to hold a YUV image
plane with the given parameters.
|
static int |
planeWidth(int componentID,
int width,
int subsamp)
Returns the plane width of a YUV image plane with the given parameters.
|
public static final int NUMSAMP
public static final int SAMP_444
public static final int SAMP_422
public static final int SAMP_420
public static final int SAMP_GRAY
public static final int SAMP_440
public static final int SAMP_411
public static final int NUMPF
public static final int PF_RGB
public static final int PF_BGR
public static final int PF_RGBX
public static final int PF_BGRX
public static final int PF_XBGR
public static final int PF_XRGB
public static final int PF_GRAY
public static final int PF_RGBA
PF_RGBX
, except that when
decompressing, the X byte is guaranteed to be 0xFF, which can be
interpreted as an opaque alpha channel.public static final int PF_BGRA
PF_BGRX
, except that when
decompressing, the X byte is guaranteed to be 0xFF, which can be
interpreted as an opaque alpha channel.public static final int PF_ABGR
PF_XBGR
, except that when
decompressing, the X byte is guaranteed to be 0xFF, which can be
interpreted as an opaque alpha channel.public static final int PF_ARGB
PF_XRGB
, except that when
decompressing, the X byte is guaranteed to be 0xFF, which can be
interpreted as an opaque alpha channel.public static final int PF_CMYK
CS_YCCK
) and
decompressing YCCK JPEG images into CMYK pixels.public static final int NUMCS
public static final int CS_RGB
public static final int CS_YCbCr
public static final int CS_GRAY
public static final int CS_CMYK
public static final int CS_YCCK
public static final int FLAG_BOTTOMUP
@Deprecated public static final int FLAG_FORCEMMX
@Deprecated public static final int FLAG_FORCESSE
@Deprecated public static final int FLAG_FORCESSE2
@Deprecated public static final int FLAG_FORCESSE3
public static final int FLAG_FASTUPSAMPLE
public static final int FLAG_FASTDCT
public static final int FLAG_ACCURATEDCT
public static final int FLAG_STOPONWARNING
NOTE: due to the design of the TurboJPEG Java API, only certain methods
(specifically, 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.
public static final int FLAG_PROGRESSIVE
public static final int NUMERR
public static final int ERR_WARNING
NOTE: due to the design of the TurboJPEG Java API, only certain methods
(specifically, 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.
public static final int ERR_FATAL
public static int getMCUWidth(int subsamp)
subsamp
- the level of chrominance subsampling (one of
SAMP_*
)public static int getMCUHeight(int subsamp)
subsamp
- the level of chrominance subsampling (one of
SAMP_*
)public static int getPixelSize(int pixelFormat)
pixelFormat
- the pixel format (one of PF_*
)public static int getRedOffset(int pixelFormat)
TJ.PF_BGRX
is stored in char pixel[]
,
then the red component will be
pixel[TJ.getRedOffset(TJ.PF_BGRX)]
.pixelFormat
- the pixel format (one of PF_*
)public static int getGreenOffset(int pixelFormat)
TJ.PF_BGRX
is stored in char pixel[]
,
then the green component will be
pixel[TJ.getGreenOffset(TJ.PF_BGRX)]
.pixelFormat
- the pixel format (one of PF_*
)public static int getBlueOffset(int pixelFormat)
TJ.PF_BGRX
is stored in char pixel[]
,
then the blue component will be
pixel[TJ.getBlueOffset(TJ.PF_BGRX)]
.pixelFormat
- the pixel format (one of PF_*
)public static int getAlphaOffset(int pixelFormat)
TJ.PF_BGRA
is stored in char pixel[]
,
then the alpha component will be
pixel[TJ.getAlphaOffset(TJ.PF_BGRA)]
.pixelFormat
- the pixel format (one of PF_*
)public static int bufSize(int width, int height, int jpegSubsamp)
width
- the width (in pixels) of the JPEG imageheight
- the height (in pixels) of the JPEG imagejpegSubsamp
- the level of chrominance subsampling to be used when
generating the JPEG image (one of TJ.SAMP_*
)public static int bufSizeYUV(int width, int pad, int height, int subsamp)
width
- the width (in pixels) of the YUV imagepad
- 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.)height
- the height (in pixels) of the YUV imagesubsamp
- the level of chrominance subsampling used in the YUV
image (one of TJ.SAMP_*
)@Deprecated public static int bufSizeYUV(int width, int height, int subsamp)
bufSizeYUV(int, int, int, int)
instead.public static int planeSizeYUV(int componentID, int width, int stride, int height, int subsamp)
componentID
- ID number of the image plane (0 = Y, 1 = U/Cb,
2 = V/Cr)width
- width (in pixels) of the YUV image. NOTE: this is the width
of the whole image, not the plane width.stride
- bytes per line in the image plane.height
- height (in pixels) of the YUV image. NOTE: this is the
height of the whole image, not the plane height.subsamp
- the level of chrominance subsampling used in the YUV
image (one of TJ.SAMP_*
)public static int planeWidth(int componentID, int width, int subsamp)
YUVImage
for a description of plane width.componentID
- ID number of the image plane (0 = Y, 1 = U/Cb,
2 = V/Cr)width
- width (in pixels) of the YUV imagesubsamp
- the level of chrominance subsampling used in the YUV image
(one of TJ.SAMP_*
)public static int planeHeight(int componentID, int height, int subsamp)
YUVImage
for a description of plane height.componentID
- ID number of the image plane (0 = Y, 1 = U/Cb,
2 = V/Cr)height
- height (in pixels) of the YUV imagesubsamp
- the level of chrominance subsampling used in the YUV image
(one of TJ.SAMP_*
)public static TJScalingFactor[] getScalingFactors()