Package org.libjpegturbo.turbojpeg
Class TJ
java.lang.Object
org.libjpegturbo.turbojpeg.TJ
TurboJPEG utility class (cannot be instantiated)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int[]static final intUse the most accurate DCT/IDCT algorithm available in the underlying codec.static final intThe uncompressed source/destination image is stored in bottom-up (Windows, OpenGL) order, not top-down (X11) order.static final intUse the fastest DCT/IDCT algorithm available in the underlying codec.static final intWhen decompressing, use the fastest chrominance upsampling algorithm available in the underlying codec.static final intTurn off CPU auto-detection and force TurboJPEG to use MMX code (if the underlying codec supports it.)static final intTurn off CPU auto-detection and force TurboJPEG to use SSE code (if the underlying codec supports it.)static final intTurn off CPU auto-detection and force TurboJPEG to use SSE2 code (if the underlying codec supports it.)static final intTurn off CPU auto-detection and force TurboJPEG to use SSE3 code (if the underlying codec supports it.)private static final int[]private static final int[]private static final int[]static final intThe number of pixel formatsstatic final intThe number of chrominance subsampling optionsstatic final intABGR pixel format.static final intARGB pixel format.static final intBGR pixel format.static final intBGRA pixel format.static final intBGRX pixel format.static final intGrayscale pixel format.static final intRGB pixel format.static final intRGBA pixel format.static final intRGBX pixel format.static final intXBGR pixel format.static final intXRGB pixel format.private static final int[]private static final int[]static final int4:2:0 chrominance subsampling.static final int4:2:2 chrominance subsampling.static final int4:4:0 chrominance subsampling.static final int4:4:4 chrominance subsampling (no chrominance subsampling).static final intGrayscale. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intbufSize(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 and height, and level of chrominance subsampling.static intbufSizeYUV(int width, 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 intgetBlueOffset(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 intgetGreenOffset(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 intgetMCUHeight(int subsamp) Returns the MCU block height for the given level of chrominance subsampling.static intgetMCUWidth(int subsamp) Returns the MCU block width for the given level of chrominance subsampling.static intgetPixelSize(int pixelFormat) Returns the pixel size (in bytes) of the given pixel format.static intgetRedOffset(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[]Returns a list of fractional scaling factors that the JPEG decompressor in this implementation of TurboJPEG supports.
-
Field Details
-
NUMSAMP
public static final int NUMSAMPThe number of chrominance subsampling options- See Also:
-
SAMP_444
public static final int SAMP_4444:4:4 chrominance subsampling (no chrominance subsampling). The JPEG or YUV image will contain one chrominance component for every pixel in the source image.- See Also:
-
SAMP_422
public static final int SAMP_4224:2:2 chrominance subsampling. The JPEG or YUV image will contain one chrominance component for every 2x1 block of pixels in the source image.- See Also:
-
SAMP_420
public static final int SAMP_4204:2:0 chrominance subsampling. The JPEG or YUV image will contain one chrominance component for every 2x2 block of pixels in the source image.- See Also:
-
SAMP_GRAY
public static final int SAMP_GRAYGrayscale. The JPEG or YUV image will contain no chrominance components.- See Also:
-
SAMP_440
public static final int SAMP_4404:4:0 chrominance subsampling. The JPEG or YUV image will contain one chrominance component for every 1x2 block of pixels in the source image.- See Also:
-
mcuWidth
private static final int[] mcuWidth -
mcuHeight
private static final int[] mcuHeight -
NUMPF
public static final int NUMPFThe number of pixel formats- See Also:
-
PF_RGB
public static final int PF_RGBRGB pixel format. The red, green, and blue components in the image are stored in 3-byte pixels in the order R, G, B from lowest to highest byte address within each pixel.- See Also:
-
PF_BGR
public static final int PF_BGRBGR pixel format. The red, green, and blue components in the image are stored in 3-byte pixels in the order B, G, R from lowest to highest byte address within each pixel.- See Also:
-
PF_RGBX
public static final int PF_RGBXRGBX pixel format. The red, green, and blue components in the image are stored in 4-byte pixels in the order R, G, B from lowest to highest byte address within each pixel. The X component is ignored when compressing and undefined when decompressing.- See Also:
-
PF_BGRX
public static final int PF_BGRXBGRX pixel format. The red, green, and blue components in the image are stored in 4-byte pixels in the order B, G, R from lowest to highest byte address within each pixel. The X component is ignored when compressing and undefined when decompressing.- See Also:
-
PF_XBGR
public static final int PF_XBGRXBGR pixel format. The red, green, and blue components in the image are stored in 4-byte pixels in the order R, G, B from highest to lowest byte address within each pixel. The X component is ignored when compressing and undefined when decompressing.- See Also:
-
PF_XRGB
public static final int PF_XRGBXRGB pixel format. The red, green, and blue components in the image are stored in 4-byte pixels in the order B, G, R from highest to lowest byte address within each pixel. The X component is ignored when compressing and undefined when decompressing.- See Also:
-
PF_GRAY
public static final int PF_GRAYGrayscale pixel format. Each 1-byte pixel represents a luminance (brightness) level from 0 to 255.- See Also:
-
PF_RGBA
public static final int PF_RGBARGBA pixel format. This is the same asPF_RGBX, except that when decompressing, the X byte is guaranteed to be 0xFF, which can be interpreted as an opaque alpha channel.- See Also:
-
PF_BGRA
public static final int PF_BGRABGRA pixel format. This is the same asPF_BGRX, except that when decompressing, the X byte is guaranteed to be 0xFF, which can be interpreted as an opaque alpha channel.- See Also:
-
PF_ABGR
public static final int PF_ABGRABGR pixel format. This is the same asPF_XBGR, except that when decompressing, the X byte is guaranteed to be 0xFF, which can be interpreted as an opaque alpha channel.- See Also:
-
PF_ARGB
public static final int PF_ARGBARGB pixel format. This is the same asPF_XRGB, except that when decompressing, the X byte is guaranteed to be 0xFF, which can be interpreted as an opaque alpha channel.- See Also:
-
pixelSize
private static final int[] pixelSize -
redOffset
private static final int[] redOffset -
greenOffset
private static final int[] greenOffset -
blueOffset
private static final int[] blueOffset -
FLAG_BOTTOMUP
public static final int FLAG_BOTTOMUPThe uncompressed source/destination image is stored in bottom-up (Windows, OpenGL) order, not top-down (X11) order.- See Also:
-
FLAG_FORCEMMX
public static final int FLAG_FORCEMMXTurn off CPU auto-detection and force TurboJPEG to use MMX code (if the underlying codec supports it.)- See Also:
-
FLAG_FORCESSE
public static final int FLAG_FORCESSETurn off CPU auto-detection and force TurboJPEG to use SSE code (if the underlying codec supports it.)- See Also:
-
FLAG_FORCESSE2
public static final int FLAG_FORCESSE2Turn off CPU auto-detection and force TurboJPEG to use SSE2 code (if the underlying codec supports it.)- See Also:
-
FLAG_FORCESSE3
public static final int FLAG_FORCESSE3Turn off CPU auto-detection and force TurboJPEG to use SSE3 code (if the underlying codec supports it.)- See Also:
-
FLAG_FASTUPSAMPLE
public static final int FLAG_FASTUPSAMPLEWhen decompressing, 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.- See Also:
-
FLAG_FASTDCT
public static final int FLAG_FASTDCTUse the fastest DCT/IDCT algorithm available in the underlying codec. The default if this flag is not specified is implementation-specific. The libjpeg implementation, for example, 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.- See Also:
-
FLAG_ACCURATEDCT
public static final int FLAG_ACCURATEDCTUse the most accurate DCT/IDCT algorithm available in the underlying codec. The default if this flag is not specified is implementation-specific. The libjpeg implementation, for example, 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.- See Also:
-
-
Constructor Details
-
TJ
public TJ()
-
-
Method Details
-
getMCUWidth
Returns the MCU block width for the given level of chrominance subsampling.- Parameters:
subsamp- the level of chrominance subsampling (one ofSAMP_*)- Returns:
- the MCU block width for the given level of chrominance subsampling
- Throws:
Exception
-
getMCUHeight
Returns the MCU block height for the given level of chrominance subsampling.- Parameters:
subsamp- the level of chrominance subsampling (one ofSAMP_*)- Returns:
- the MCU block height for the given level of chrominance subsampling
- Throws:
Exception
-
getPixelSize
Returns the pixel size (in bytes) of the given pixel format.- Parameters:
pixelFormat- the pixel format (one ofPF_*)- Returns:
- the pixel size (in bytes) of the given pixel format
- Throws:
Exception
-
getRedOffset
For the given pixel format, returns the number of bytes that the red component is offset from the start of the pixel. For instance, if a pixel of formatTJ.PF_BGRXis stored inchar pixel[], then the red component will bepixel[TJ.getRedOffset(TJ.PF_BGRX)].- Parameters:
pixelFormat- the pixel format (one ofPF_*)- Returns:
- the red offset for the given pixel format
- Throws:
Exception
-
getGreenOffset
For the given pixel format, returns the number of bytes that the green component is offset from the start of the pixel. For instance, if a pixel of formatTJ.PF_BGRXis stored inchar pixel[], then the green component will bepixel[TJ.getGreenOffset(TJ.PF_BGRX)].- Parameters:
pixelFormat- the pixel format (one ofPF_*)- Returns:
- the green offset for the given pixel format
- Throws:
Exception
-
getBlueOffset
For the given pixel format, returns the number of bytes that the blue component is offset from the start of the pixel. For instance, if a pixel of formatTJ.PF_BGRXis stored inchar pixel[], then the blue component will bepixel[TJ.getBlueOffset(TJ.PF_BGRX)].- Parameters:
pixelFormat- the pixel format (one ofPF_*)- Returns:
- the blue offset for the given pixel format
- Throws:
Exception
-
bufSize
Returns the maximum size of the buffer (in bytes) required to hold a JPEG image with the given width and height, and level of chrominance subsampling.- Parameters:
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 ofTJ.SAMP_*)- Returns:
- the maximum size of the buffer (in bytes) required to hold a JPEG image with the given width and height, and level of chrominance subsampling
- Throws:
Exception
-
bufSizeYUV
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.- Parameters:
width- the width (in pixels) of the YUV imageheight- the height (in pixels) of the YUV imagesubsamp- the level of chrominance subsampling used in the YUV image (one ofTJ.SAMP_*)- 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
- Throws:
Exception
-
getScalingFactors
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 in this implementation of TurboJPEG supports
- Throws:
Exception
-