TJDecompressor

Package org.libjpegturbo.turbojpeg

## Class TJDecompressor

- java.lang.Object
- - org.libjpegturbo.turbojpeg.TJDecompressor

- All Implemented Interfaces:
    `java.io.Closeable`, `java.lang.AutoCloseable`
  Direct Known Subclasses:
    `TJTransformer`

      public class TJDecompressor
      extends java.lang.Object
      implements java.io.Closeable

  TurboJPEG decompressor

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `TJDecompressor()` | Create a TurboJPEG decompresssor instance.
    `TJDecompressor​(byte[] jpegImage)` | Create a TurboJPEG decompressor instance and associate the JPEG source image or "abbreviated table specification" (AKA "tables-only") datastream stored in `jpegImage` with the newly created instance.
    `TJDecompressor​(byte[] jpegImage, int imageSize)` | Create a TurboJPEG decompressor instance and associate the JPEG source image or "abbreviated table specification" (AKA "tables-only") datastream of length `imageSize` bytes stored in `jpegImage` with the newly created instance.
    `TJDecompressor​(YUVImage yuvImage)` | Create a TurboJPEG decompressor instance and associate the 8-bit-per-sample planar YUV source image stored in `yuvImage` with the newly created instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `close()` | Free the native structures associated with this decompressor instance.
    `void` | `decompress​(byte[] dstBuf, int x, int y, int desiredWidth, int pitch, int desiredHeight, int pixelFormat, int flags)` | Deprecated. Use `set()`, `setScalingFactor()`, and `decompress8(byte[], int, int, int, int)` instead.
    `void` | `decompress​(int[] dstBuf, int x, int y, int desiredWidth, int stride, int desiredHeight, int pixelFormat, int flags)` | Deprecated. Use `set()`, `setScalingFactor()`, and `decompress8(int[], int, int, int, int)` instead.
    `java.awt.image.BufferedImage` | `decompress​(int desiredWidth, int desiredHeight, int bufferedImageType, int flags)` | Deprecated. Use `set()`, `setScalingFactor()`, and `decompress8(int)` instead.
    `byte[]` | `decompress​(int desiredWidth, int pitch, int desiredHeight, int pixelFormat, int flags)` | Deprecated. Use `set()`, `setScalingFactor()`, and `decompress8(int, int)` instead.
    `void` | `decompress​(java.awt.image.BufferedImage dstImage, int flags)` | Deprecated. Use `set()`, `setScalingFactor()`, and `decompress8(BufferedImage)` instead.
    `short[]` | `decompress12​(int pitch, int pixelFormat)` | Decompress the 12-bit-per-sample JPEG source image associated with this decompressor instance and return a buffer containing a 12-bit-per-sample packed-pixel decompressed image.
    `void` | `decompress12​(short[] dstBuf, int x, int y, int pitch, int pixelFormat)` | Decompress the 12-bit-per-sample JPEG source image associated with this decompressor instance and output a 12-bit-per-sample packed-pixel grayscale, RGB, or CMYK image to the given destination buffer.
    `short[]` | `decompress16​(int pitch, int pixelFormat)` | Decompress the 16-bit-per-sample JPEG source image associated with this decompressor instance and return a buffer containing a 16-bit-per-sample packed-pixel decompressed image.
    `void` | `decompress16​(short[] dstBuf, int x, int y, int pitch, int pixelFormat)` | Decompress the 16-bit-per-sample lossless JPEG source image associated with this decompressor instance and output a 16-bit-per-sample packed-pixel grayscale, RGB, or CMYK image to the given destination buffer.
    `void` | `decompress8​(byte[] dstBuf, int x, int y, int pitch, int pixelFormat)` | Decompress the 8-bit-per-sample JPEG source image or decode the planar YUV source image associated with this decompressor instance and output an 8-bit-per-sample packed-pixel grayscale, RGB, or CMYK image to the given destination buffer.
    `java.awt.image.BufferedImage` | `decompress8​(int bufferedImageType)` | Decompress the 8-bit-per-sample JPEG source image or decode the planar YUV source image associated with this decompressor instance and return a `BufferedImage` instance containing the 8-bit-per-sample packed-pixel decompressed/decoded image.
    `void` | `decompress8​(int[] dstBuf, int x, int y, int stride, int pixelFormat)` | Decompress the 8-bit-per-sample JPEG source image or decode the planar YUV source image associated with this decompressor instance and output an 8-bit-per-sample packed-pixel grayscale, RGB, or CMYK image to the given destination buffer.
    `byte[]` | `decompress8​(int pitch, int pixelFormat)` | Decompress the 8-bit-per-sample JPEG source image or decode the planar YUV source image associated with this decompressor instance and return a buffer containing an 8-bit-per-sample packed-pixel decompressed image.
    `void` | `decompress8​(java.awt.image.BufferedImage dstImage)` | Decompress the 8-bit-per-sample JPEG source image or decode the planar YUV source image associated with this decompressor instance and output an 8-bit-per-sample packed-pixel decompressed/decoded image to the given `BufferedImage` instance.
    `YUVImage` | `decompressToYUV​(int align)` | Decompress the 8-bit-per-sample JPEG source image associated with this decompressor instance into an 8-bit-per-sample unified planar YUV image and return a `YUVImage` instance containing the decompressed image.
    `YUVImage` | `decompressToYUV​(int[] strides)` | Decompress the 8-bit-per-sample JPEG source image associated with this decompressor instance into a set of 8-bit-per-sample Y, U (Cb), and V (Cr) image planes and return a `YUVImage` instance containing the decompressed image planes.
    `YUVImage` | `decompressToYUV​(int desiredWidth, int[] strides, int desiredHeight, int flags)` | Deprecated. Use `set()`, `setScalingFactor()`, and `decompressToYUV(int[])` instead.
    `YUVImage` | `decompressToYUV​(int desiredWidth, int align, int desiredHeight, int flags)` | Deprecated. Use `set()`, `setScalingFactor()`, and `decompressToYUV(int)` instead.
    `void` | `decompressToYUV​(YUVImage dstImage)` | Decompress the 8-bit-per-sample JPEG source image associated with this decompressor instance into an 8-bit-per-sample planar YUV image and store it in the given `YUVImage` instance.
    `void` | `decompressToYUV​(YUVImage dstImage, int flags)` | Deprecated. Use `set()`, `setScalingFactor()`, and `decompressToYUV(YUVImage)` instead.
    `protected void` | `finalize()` |
    `int` | `get​(int param)` | Get the value of a decompression parameter.
    `int` | `getColorspace()` | Deprecated. Use ``get`(`TJ.PARAM_COLORSPACE`)` instead.
    `int` | `getHeight()` | Returns the height of the source image (JPEG or YUV) associated with this decompressor instance.
    `byte[]` | `getJPEGBuf()` | Returns the JPEG 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)` | Deprecated. Use `setScalingFactor()` and `TJScalingFactor.getScaled()` instead.
    `int` | `getScaledWidth​(int desiredWidth, int desiredHeight)` | Deprecated. Use `setScalingFactor()` and `TJScalingFactor.getScaled()` instead.
    `int` | `getSubsamp()` | Deprecated. Use ``get`(`TJ.PARAM_SUBSAMP`)` instead.
    `int` | `getWidth()` | Returns the width of the source image (JPEG or YUV) associated with this decompressor instance.
    `void` | `set​(int param, int value)` | Set the value of a decompression parameter.
    `void` | `setCroppingRegion​(java.awt.Rectangle croppingRegion)` | Set the cropping region for partially decompressing a lossy JPEG image into a packed-pixel image.
    `void` | `setScalingFactor​(TJScalingFactor scalingFactor)` | Set the scaling factor for subsequent lossy decompression operations.
    `void` | `setSourceImage​(byte[] jpegImage, int imageSize)` | Associate the JPEG image or "abbreviated table specification" (AKA "tables-only") datastream of length `imageSize` bytes stored in `jpegImage` with this decompressor instance.
    `void` | `setSourceImage​(YUVImage srcImage)` | Associate the specified planar YUV source image with this decompressor instance.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TJDecompressor

          public TJDecompressor()
                         throws TJException

      Create a TurboJPEG decompresssor instance.
      Throws:
        `TJException`

    - #### TJDecompressor

          public TJDecompressor​(byte[] jpegImage)
                         throws TJException

      Create a TurboJPEG decompressor instance and associate the JPEG source image or "abbreviated table specification" (AKA "tables-only") datastream stored in `jpegImage` with the newly created instance. Refer to `setSourceImage(byte[], int)` for more details.
      Parameters:
        `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.
      Throws:
        `TJException`

    - #### TJDecompressor

          public TJDecompressor​(byte[] jpegImage,
                                int imageSize)
                         throws TJException

      Create a TurboJPEG decompressor instance and associate the JPEG source image or "abbreviated table specification" (AKA "tables-only") datastream of length `imageSize` bytes stored in `jpegImage` with the newly created instance. Refer to `setSourceImage(byte[], int)` for more details.
      Parameters:
        `jpegImage` - buffer containing a JPEG source image or tables-only datastream. This buffer is not modified.
        `imageSize` - size of the JPEG source image or tables-only datastream (in bytes)
      Throws:
        `TJException`

    - #### TJDecompressor

          public TJDecompressor​(YUVImage yuvImage)
                         throws TJException

      Create a TurboJPEG decompressor instance and associate the 8-bit-per-sample planar YUV source image stored in `yuvImage` with the newly created instance. Refer to `setSourceImage(YUVImage)` for more details.
      Parameters:
        `yuvImage` - `YUVImage` instance containing a planar YUV source image to be decoded. This image is not modified.
      Throws:
        `TJException`

  - ### Method Detail

    - #### setSourceImage

          public void setSourceImage​(byte[] jpegImage,
                                     int imageSize)
                              throws TJException

      Associate the JPEG image or "abbreviated table specification" (AKA "tables-only") datastream of length `imageSize` bytes stored in `jpegImage` with this decompressor instance. If `jpegImage` contains a JPEG image, then this image will be used as the source image for subsequent decompression operations. Passing a tables-only datastream to this method primes the decompressor with quantization and Huffman tables that can be used when decompressing subsequent "abbreviated image" datastreams. This is useful, for instance, when decompressing video streams in which all frames share the same quantization and Huffman tables. If a JPEG image is passed to this method, then the `parameters` that describe the JPEG image will be set when the method returns.
      Parameters:
        `jpegImage` - buffer containing a JPEG source image or tables-only datastream. This buffer is not modified.
        `imageSize` - size of the JPEG source image or tables-only datastream (in bytes)
      Throws:
        `TJException`

    - #### setSourceImage

          public void setSourceImage​(YUVImage srcImage)

      Associate the specified planar YUV source image with this decompressor instance. Subsequent decompression operations will decode this image into a packed-pixel RGB or grayscale destination image. This method sets `TJ.PARAM_SUBSAMP` to the chrominance subsampling level of the source image.
      Parameters:
        `srcImage` - `YUVImage` instance containing a planar YUV source image to be decoded. This image is not modified.

    - #### getWidth

          public int getWidth()

      Returns the width of the source image (JPEG or YUV) associated with this decompressor instance.
      Returns:
        the width of the source image (JPEG or YUV) associated with this decompressor instance.

    - #### getHeight

          public int getHeight()

      Returns the height of the source image (JPEG or YUV) associated with this decompressor instance.
      Returns:
        the height of the source image (JPEG or YUV) associated with this decompressor instance.

    - #### set

          public void set​(int param,
                          int value)

      Set the value of a decompression parameter.
      Parameters:
        `param` - one of `TJ.PARAM_*`
        `value` - value of the decompression parameter (refer to `parameter documentation`)

    - #### get

          public int get​(int param)

      Get the value of a decompression parameter.
      Parameters:
        `param` - one of `TJ.PARAM_*`
      Returns:
        the value of the specified decompression parameter, or -1 if the value is unknown.

    - #### setScalingFactor

          public void setScalingFactor​(TJScalingFactor scalingFactor)

      Set the scaling factor for subsequent lossy decompression operations.
      Parameters:
        `scalingFactor` - `TJScalingFactor` instance that specifies a fractional scaling factor that the decompressor supports (see `TJ.getScalingFactors()`), or `TJ.UNSCALED` for no scaling. Decompression scaling is a function of the IDCT algorithm, so scaling factors are generally limited to multiples of 1/8. If the entire JPEG image will be decompressed, then the width and height of the scaled destination image can be determined by calling `scalingFactor.` `getScaled()` with the JPEG image width and height (see `getWidth()` and `getHeight()`.) When decompressing into a planar YUV image, an intermediate buffer copy will be performed if the width or height of the scaled destination image is not an even multiple of the MCU block size (see `TJ.getMCUWidth()` and `TJ.getMCUHeight()`.) Note that decompression scaling is not available (and the specified scaling factor is ignored) when decompressing lossless JPEG images (see `TJ.PARAM_LOSSLESS`), since the IDCT algorithm is not used with those images. Note also that `TJ.PARAM_FASTDCT` is ignored when decompression scaling is enabled.

    - #### setCroppingRegion

          public void setCroppingRegion​(java.awt.Rectangle croppingRegion)
                                 throws TJException

      Set the cropping region for partially decompressing a lossy JPEG image into a packed-pixel image.
      Parameters:
        `croppingRegion` - `java.awt.Rectangle` instance that specifies a subregion of the JPEG image to decompress, or `TJ.UNCROPPED` for no cropping. The left boundary of the cropping region must be evenly divisible by the scaled MCU block width, which can be determined by calling `TJScalingFactor.getScaled()` with the specified scaling factor (see `setScalingFactor()`) and the MCU block width (see `TJ.getMCUWidth()`) for the level of chrominance subsampling in the JPEG image (see `TJ.PARAM_SUBSAMP`.) The cropping region should be specified relative to the scaled image dimensions. Unless `croppingRegion` is `TJ.UNCROPPED`, the JPEG header must be read (see `setSourceImage(byte[], int)` prior to calling this method.
      Throws:
        `TJException`

    - #### getSubsamp

          @Deprecated
          public int getSubsamp()

      Deprecated.
      Use ``get`(`TJ.PARAM_SUBSAMP`)` instead.

    - #### getColorspace

          @Deprecated
          public int getColorspace()

      Deprecated.
      Use ``get`(`TJ.PARAM_COLORSPACE`)` instead.

    - #### getJPEGBuf

          public byte[] getJPEGBuf()

      Returns the JPEG buffer associated with this decompressor instance.
      Returns:
        the JPEG buffer associated with this decompressor instance.

    - #### getJPEGSize

          public int getJPEGSize()

      Returns the size of the JPEG image (in bytes) associated with this decompressor instance.
      Returns:
        the size of the JPEG image (in bytes) associated with this decompressor instance.

    - #### getScaledWidth

          @Deprecated
          public int getScaledWidth​(int desiredWidth,
                                    int desiredHeight)

      Deprecated.
      Use `setScalingFactor()` and `TJScalingFactor.getScaled()` instead.

    - #### getScaledHeight

          @Deprecated
          public int getScaledHeight​(int desiredWidth,
                                     int desiredHeight)

      Deprecated.
      Use `setScalingFactor()` and `TJScalingFactor.getScaled()` instead.

    - #### decompress8

          public void decompress8​(byte[] dstBuf,
                                  int x,
                                  int y,
                                  int pitch,
                                  int pixelFormat)
                           throws TJException

      Decompress the 8-bit-per-sample JPEG source image or decode the planar YUV source image associated with this decompressor instance and output an 8-bit-per-sample packed-pixel grayscale, RGB, or CMYK image to the given destination buffer.

      NOTE: The destination image is fully recoverable if this method throws a non-fatal `TJException` (unless `TJ.PARAM_STOPONWARNING` is set.)

      Parameters:
        `dstBuf` - buffer that will receive the packed-pixel decompressed/decoded image. This buffer should normally be `pitch * destinationHeight` bytes in size. However, the buffer may also be larger, in which case the `x`, `y`, and `pitch` parameters can be used to specify the region into which the source image should be decompressed/decoded. NOTE: If the source image is a lossy JPEG image, then `destinationHeight` is either the scaled JPEG height (see `setScalingFactor()`, `TJScalingFactor.getScaled()`, and `getHeight()`) or the height of the cropping region (see `setCroppingRegion()`.) If the source image is a YUV image or a lossless JPEG image, then `destinationHeight` is the height of the source image.
        `x` - x offset (in pixels) of the region in the destination image into which the source image should be decompressed/decoded
        `y` - y offset (in pixels) of the region in the destination image into which the source image should be decompressed/decoded
        `pitch` - bytes per row in the destination image. Normally this should be set to `destinationWidth * `TJ.getPixelSize`(pixelFormat)`, if the destination image will be unpadded. (Setting this parameter to 0 is the equivalent of setting it to `destinationWidth * `TJ.getPixelSize`(pixelFormat)`.) However, you can also use this parameter to specify the row alignment/padding of the destination image, to skip rows, or to decompress/decode into a specific region of a larger image. NOTE: if the source image is a lossy JPEG image, then `destinationWidth` is either the scaled JPEG width (see `setScalingFactor()`, `TJScalingFactor.getScaled()`, and `getWidth()`) or the width of the cropping region (see `setCroppingRegion()`.) If the source image is a YUV image or a lossless JPEG image, then `destinationWidth` is the width of the source image.
        `pixelFormat` - pixel format of the decompressed/decoded image (one of `TJ.PF_*`)
      Throws:
        `TJException`

    - #### decompress

          @Deprecated
          public void decompress​(byte[] dstBuf,
                                 int x,
                                 int y,
                                 int desiredWidth,
                                 int pitch,
                                 int desiredHeight,
                                 int pixelFormat,
                                 int flags)
                          throws TJException

      Deprecated.
      Use `set()`, `setScalingFactor()`, and `decompress8(byte[], int, int, int, int)` instead.
      Throws:
        `TJException`

    - #### decompress8

          public byte[] decompress8​(int pitch,
                                    int pixelFormat)
                             throws TJException

      Decompress the 8-bit-per-sample JPEG source image or decode the planar YUV source image associated with this decompressor instance and return a buffer containing an 8-bit-per-sample packed-pixel decompressed image.
      Parameters:
        `pitch` - see `decompress8(byte[], int, int, int, int)` for description
        `pixelFormat` - pixel format of the decompressed image (one of `TJ.PF_*`)
      Returns:
        a buffer containing an 8-bit-per-sample packed-pixel decompressed image.
      Throws:
        `TJException`

    - #### decompress

          @Deprecated
          public byte[] decompress​(int desiredWidth,
                                   int pitch,
                                   int desiredHeight,
                                   int pixelFormat,
                                   int flags)
                            throws TJException

      Deprecated.
      Use `set()`, `setScalingFactor()`, and `decompress8(int, int)` instead.
      Throws:
        `TJException`

    - #### decompress12

          public void decompress12​(short[] dstBuf,
                                   int x,
                                   int y,
                                   int pitch,
                                   int pixelFormat)
                            throws TJException

      Decompress the 12-bit-per-sample JPEG source image associated with this decompressor instance and output a 12-bit-per-sample packed-pixel grayscale, RGB, or CMYK image to the given destination buffer.

      NOTE: The destination image is fully recoverable if this method throws a non-fatal `TJException` (unless `TJ.PARAM_STOPONWARNING` is set.)

      Parameters:
        `dstBuf` - buffer that will receive the packed-pixel decompressed image. This buffer should normally be `pitch * destinationHeight` samples in size. However, the buffer may also be larger, in which case the `x`, `y`, and `pitch` parameters can be used to specify the region into which the source image should be decompressed. NOTE: If the source image is a lossy JPEG image, then `destinationHeight` is either the scaled JPEG height (see `setScalingFactor()`, `TJScalingFactor.getScaled()`, and `getHeight()`) or the height of the cropping region (see `setCroppingRegion()`.) If the source image is a lossless JPEG image, then `destinationHeight` is the height of the source image.
        `x` - x offset (in pixels) of the region in the destination image into which the source image should be decompressed
        `y` - y offset (in pixels) of the region in the destination image into which the source image should be decompressed
        `pitch` - samples per row in the destination image. Normally this should be set to `destinationWidth * `TJ.getPixelSize`(pixelFormat)`, if the destination image will be unpadded. (Setting this parameter to 0 is the equivalent of setting it to `destinationWidth * `TJ.getPixelSize`(pixelFormat)`.) However, you can also use this parameter to specify the row alignment/padding of the destination image, to skip rows, or to decompress into a specific region of a larger image. NOTE: if the source image is a lossy JPEG image, then `destinationWidth` is either the scaled JPEG width (see `setScalingFactor()`, `TJScalingFactor.getScaled()`, and `getWidth()`) or the width of the cropping region (see `setCroppingRegion()`.) If the source image is a YUV image or a lossless JPEG image, then `destinationWidth` is the width of the source image.
        `pixelFormat` - pixel format of the decompressed image (one of `TJ.PF_*`)
      Throws:
        `TJException`

    - #### decompress12

          public short[] decompress12​(int pitch,
                                      int pixelFormat)
                               throws TJException

      Decompress the 12-bit-per-sample JPEG source image associated with this decompressor instance and return a buffer containing a 12-bit-per-sample packed-pixel decompressed image.
      Parameters:
        `pitch` - see `decompress12(short[], int, int, int, int)` for description
        `pixelFormat` - pixel format of the decompressed image (one of `TJ.PF_*`)
      Returns:
        a buffer containing an 8-bit-per-sample packed-pixel decompressed image.
      Throws:
        `TJException`

    - #### decompress16

          public void decompress16​(short[] dstBuf,
                                   int x,
                                   int y,
                                   int pitch,
                                   int pixelFormat)
                            throws TJException

      Decompress the 16-bit-per-sample lossless JPEG source image associated with this decompressor instance and output a 16-bit-per-sample packed-pixel grayscale, RGB, or CMYK image to the given destination buffer.

      NOTE: The destination image is fully recoverable if this method throws a non-fatal `TJException` (unless `TJ.PARAM_STOPONWARNING` is set.)

      Parameters:
        `dstBuf` - buffer that will receive the packed-pixel decompressed image. This buffer should normally be `pitch * jpegHeight` samples in size. However, the buffer may also be larger, in which case the `x`, `y`, and `pitch` parameters can be used to specify the region into which the source image should be decompressed.
        `x` - x offset (in pixels) of the region in the destination image into which the source image should be decompressed
        `y` - y offset (in pixels) of the region in the destination image into which the source image should be decompressed
        `pitch` - samples per row in the destination image. Normally this should be set to `jpegWidth * `TJ.getPixelSize`(pixelFormat)`, if the destination image will be unpadded. (Setting this parameter to 0 is the equivalent of setting it to `jpegWidth * `TJ.getPixelSize`(pixelFormat)`.) However, you can also use this parameter to specify the row alignment/padding of the destination image, to skip rows, or to decompress into a specific region of a larger image.
        `pixelFormat` - pixel format of the decompressed image (one of `TJ.PF_*`)
      Throws:
        `TJException`

    - #### decompress16

          public short[] decompress16​(int pitch,
                                      int pixelFormat)
                               throws TJException

      Decompress the 16-bit-per-sample JPEG source image associated with this decompressor instance and return a buffer containing a 16-bit-per-sample packed-pixel decompressed image.
      Parameters:
        `pitch` - see `decompress16(short[], int, int, int, int)` for description
        `pixelFormat` - pixel format of the decompressed image (one of `TJ.PF_*`)
      Returns:
        a buffer containing an 8-bit-per-sample packed-pixel decompressed image.
      Throws:
        `TJException`

    - #### decompressToYUV

          public void decompressToYUV​(YUVImage dstImage)
                               throws TJException

      Decompress the 8-bit-per-sample JPEG source image associated with this decompressor instance into an 8-bit-per-sample planar YUV image and store it in the given `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.

      NOTE: The planar YUV destination image is fully recoverable if this method throws a non-fatal `TJException` (unless `TJ.PARAM_STOPONWARNING` is set.)

      Parameters:
        `dstImage` - `YUVImage` instance that will receive the planar YUV decompressed image. The level of subsampling specified in this `YUVImage` instance must match that of the JPEG image, and the width and height specified in the `YUVImage` instance must match the scaled JPEG width and height (see `setScalingFactor()`, `TJScalingFactor.getScaled()`, `getWidth()`, and `getHeight()`.)
      Throws:
        `TJException`

    - #### decompressToYUV

          @Deprecated
          public void decompressToYUV​(YUVImage dstImage,
                                      int flags)
                               throws TJException

      Deprecated.
      Use `set()`, `setScalingFactor()`, and `decompressToYUV(YUVImage)` instead.
      Throws:
        `TJException`

    - #### decompressToYUV

          public YUVImage decompressToYUV​(int[] strides)
                                   throws TJException

      Decompress the 8-bit-per-sample JPEG source image associated with this decompressor instance into a set of 8-bit-per-sample Y, U (Cb), and V (Cr) image planes and return a `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.
      Parameters:
        `strides` - an array of integers, each specifying the number of bytes 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 `YUVImage`.) If `strides` 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.
      Returns:
        a `YUVImage` instance containing the decompressed image planes
      Throws:
        `TJException`

    - #### decompressToYUV

          @Deprecated
          public YUVImage decompressToYUV​(int desiredWidth,
                                          int[] strides,
                                          int desiredHeight,
                                          int flags)
                                   throws TJException

      Deprecated.
      Use `set()`, `setScalingFactor()`, and `decompressToYUV(int[])` instead.
      Throws:
        `TJException`

    - #### decompressToYUV

          public YUVImage decompressToYUV​(int align)
                                   throws TJException

      Decompress the 8-bit-per-sample JPEG source image associated with this decompressor instance into an 8-bit-per-sample unified planar YUV image and return a `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.
      Parameters:
        `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.)
      Returns:
        a `YUVImage` instance containing the unified planar YUV decompressed image
      Throws:
        `TJException`

    - #### decompressToYUV

          @Deprecated
          public YUVImage decompressToYUV​(int desiredWidth,
                                          int align,
                                          int desiredHeight,
                                          int flags)
                                   throws TJException

      Deprecated.
      Use `set()`, `setScalingFactor()`, and `decompressToYUV(int)` instead.
      Throws:
        `TJException`

    - #### decompress8

          public void decompress8​(int[] dstBuf,
                                  int x,
                                  int y,
                                  int stride,
                                  int pixelFormat)
                           throws TJException

      Decompress the 8-bit-per-sample JPEG source image or decode the planar YUV source image associated with this decompressor instance and output an 8-bit-per-sample packed-pixel grayscale, RGB, or CMYK image to the given destination buffer.

      NOTE: The destination image is fully recoverable if this method throws a non-fatal `TJException` (unless `TJ.PARAM_STOPONWARNING` is set.)

      Parameters:
        `dstBuf` - buffer that will receive the packed-pixel decompressed/decoded image. This buffer should normally be `stride * destinationHeight` pixels in size. However, the buffer may also be larger, in which case the `x`, `y`, and `pitch` parameters can be used to specify the region into which the source image should be decompressed/decoded. NOTE: If the source image is a lossy JPEG image, then `destinationHeight` is either the scaled JPEG height (see `setScalingFactor()`, `TJScalingFactor.getScaled()`, and `getHeight()`) or the height of the cropping region (see `setCroppingRegion()`.) If the source image is a YUV image or a lossless JPEG image, then `destinationHeight` is the height of the source image.
        `x` - x offset (in pixels) of the region in the destination image into which the source image should be decompressed/decoded
        `y` - y offset (in pixels) of the region in the destination image into which the source image should be decompressed/decoded
        `stride` - pixels per row in the destination image. Normally this should be set to `destinationWidth`. (Setting this parameter to 0 is the equivalent of setting it to `destinationWidth`.) However, you can also use this parameter to skip rows or to decompress/decode into a specific region of a larger image. NOTE: if the source image is a lossy JPEG image, then `destinationWidth` is either the scaled JPEG width (see `setScalingFactor()`, `TJScalingFactor.getScaled()`, and `getWidth()`) or the width of the cropping region (see `setCroppingRegion()`.) If the source image is a YUV image or a lossless JPEG image, then `destinationWidth` is the width of the source image.
        `pixelFormat` - pixel format of the decompressed/decoded image (one of `TJ.PF_*`)
      Throws:
        `TJException`

    - #### decompress

          @Deprecated
          public void decompress​(int[] dstBuf,
                                 int x,
                                 int y,
                                 int desiredWidth,
                                 int stride,
                                 int desiredHeight,
                                 int pixelFormat,
                                 int flags)
                          throws TJException

      Deprecated.
      Use `set()`, `setScalingFactor()`, and `decompress8(int[], int, int, int, int)` instead.
      Throws:
        `TJException`

    - #### decompress8

          public void decompress8​(java.awt.image.BufferedImage dstImage)
                           throws TJException

      Decompress the 8-bit-per-sample JPEG source image or decode the planar YUV source image associated with this decompressor instance and output an 8-bit-per-sample packed-pixel decompressed/decoded image to the given `BufferedImage` instance.

      NOTE: The destination image is fully recoverable if this method throws a non-fatal `TJException` (unless `TJ.PARAM_STOPONWARNING` is set.)

      Parameters:
        `dstImage` - a `BufferedImage` instance that will receive the packed-pixel decompressed/decoded image. If the source image is a lossy JPEG image, then the width and height of the `BufferedImage` instance must match the scaled JPEG width and height (see `setScalingFactor()`, `TJScalingFactor.getScaled()`, `getWidth()`, and `getHeight()`) or the width and height of the cropping region (see `setCroppingRegion()`.) If the source image is a YUV image or a lossless JPEG image, then the width and height of the `BufferedImage` instance must match the width and height of the source image.
      Throws:
        `TJException`

    - #### decompress

          @Deprecated
          public void decompress​(java.awt.image.BufferedImage dstImage,
                                 int flags)
                          throws TJException

      Deprecated.
      Use `set()`, `setScalingFactor()`, and `decompress8(BufferedImage)` instead.
      Throws:
        `TJException`

    - #### decompress8

          public java.awt.image.BufferedImage decompress8​(int bufferedImageType)
                                                   throws TJException

      Decompress the 8-bit-per-sample JPEG source image or decode the planar YUV source image associated with this decompressor instance and return a `BufferedImage` instance containing the 8-bit-per-sample packed-pixel decompressed/decoded image.
      Parameters:
        `bufferedImageType` - the image type of the `BufferedImage` instance that will be created (for instance, `BufferedImage.TYPE_INT_RGB`)
      Returns:
        a `BufferedImage` instance containing the 8-bit-per-sample packed-pixel decompressed/decoded image.
      Throws:
        `TJException`

    - #### decompress

          @Deprecated
          public java.awt.image.BufferedImage decompress​(int desiredWidth,
                                                         int desiredHeight,
                                                         int bufferedImageType,
                                                         int flags)
                                                  throws TJException

      Deprecated.
      Use `set()`, `setScalingFactor()`, and `decompress8(int)` instead.
      Throws:
        `TJException`

    - #### close

          public void close()
                     throws TJException

      Free the native structures associated with this decompressor instance.
      Specified by:
        `close` in interface `java.lang.AutoCloseable`
      Specified by:
        `close` in interface `java.io.Closeable`
      Throws:
        `TJException`

    - #### finalize

          protected void finalize()
                           throws java.lang.Throwable

      Overrides:
        `finalize` in class `java.lang.Object`
      Throws:
        `java.lang.Throwable`