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

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected long` | `handle`
    `protected byte[]` | `jpegBuf`
    `protected int` | `jpegBufSize`
    `protected int` | `jpegColorspace`
    `protected int` | `jpegHeight`
    `protected int` | `jpegSubsamp`
    `protected int` | `jpegWidth`
    `protected YUVImage` | `yuvImage`

  - ### Constructor Summary

    Constructors
    Constructor and 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 planar YUV source image stored in `yuvImage` with the newly created instance.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `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 or decode the planar YUV source image associated with this decompressor instance and output a packed-pixel decompressed/decoded image to the given `BufferedImage` instance.
    `void` | `decompress(byte[] dstBuf, int desiredWidth, int pitch, int desiredHeight, int pixelFormat, int flags)` Deprecated. Use `decompress(byte[], int, int, int, int, int, int, int)` instead.
    `void` | `decompress(byte[] dstBuf, int x, int y, int desiredWidth, int pitch, int desiredHeight, int pixelFormat, int flags)` 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.
    `void` | `decompress(int[] dstBuf, int x, int y, int desiredWidth, int stride, int desiredHeight, int pixelFormat, int flags)` 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.
    `java.awt.image.BufferedImage` | `decompress(int desiredWidth, int desiredHeight, int bufferedImageType, int flags)` Decompress the JPEG source image or decode the planar YUV source image associated with this decompressor instance and return a `BufferedImage` instance containing the packed-pixel decompressed/decoded image.
    `byte[]` | `decompress(int desiredWidth, int pitch, int desiredHeight, int pixelFormat, int flags)` 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.
    `void` | `decompressToYUV(byte[] dstBuf, int flags)` Deprecated. Use `decompressToYUV(YUVImage, int)` instead.
    `byte[]` | `decompressToYUV(int flags)` Deprecated. Use `decompressToYUV(int, int, int, int)` instead.
    `YUVImage` | `decompressToYUV(int desiredWidth, int[] strides, int desiredHeight, int flags)` 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 `YUVImage` instance containing the decompressed image planes.
    `YUVImage` | `decompressToYUV(int desiredWidth, int align, int desiredHeight, int flags)` Decompress the JPEG source image associated with this decompressor instance into a unified planar YUV image and return a `YUVImage` instance containing the decompressed image.
    `void` | `decompressToYUV(YUVImage dstImage, int flags)` Decompress the JPEG source image associated with this decompressor instance into a planar YUV image and store it in the given `YUVImage` instance.
    `protected void` | `finalize()`
    `int` | `getColorspace()` Returns the colorspace used in the source image (JPEG or YUV) associated with this decompressor instance.
    `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)` 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 source image (JPEG or YUV) associated with this decompressor instance.
    `int` | `getWidth()` Returns the width of the source image (JPEG or YUV) associated with this decompressor instance.
    `void` | `setJPEGImage(byte[] jpegImage, int imageSize)` Deprecated. Use `setSourceImage(byte[], int)` instead.
    `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`

- - ### Field Detail

    - #### handle

          protected long handle

    - #### jpegBuf

          protected byte[] jpegBuf

    - #### jpegBufSize

          protected int jpegBufSize

    - #### yuvImage

          protected YUVImage yuvImage

    - #### jpegWidth

          protected int jpegWidth

    - #### jpegHeight

          protected int jpegHeight

    - #### jpegSubsamp

          protected int jpegSubsamp

    - #### jpegColorspace

          protected int jpegColorspace

  - ### 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.
      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.
      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 planar YUV source image stored in `yuvImage` with the newly created instance.
      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.
      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`

    - #### setJPEGImage

          @Deprecated
          public void setJPEGImage(byte[] jpegImage,
                                     int imageSize)
                            throws TJException

      Deprecated. Use `setSourceImage(byte[], int)` instead.
      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.
      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.

    - #### getSubsamp

          public int getSubsamp()

      Returns the level of chrominance subsampling used in the source image (JPEG or YUV) associated with this decompressor instance. See `TJ.SAMP_*`.
      Returns:
        the level of chrominance subsampling used in the source image (JPEG or YUV) associated with this decompressor instance.

    - #### getColorspace

          public int getColorspace()

      Returns the colorspace used in the source image (JPEG or YUV) associated with this decompressor instance. See `TJ.CS_*`. If the source image is YUV, then this always returns `TJ.CS_YCbCr`.
      Returns:
        the colorspace used in the source image (JPEG or YUV) associated with this decompressor instance.

    - #### 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

          public 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.
      Parameters:
        `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.)
      Returns:
        the width of the largest scaled-down image that the TurboJPEG decompressor can generate without exceeding the desired image width and height.

    - #### getScaledHeight

          public 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.
      Parameters:
        `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.)
      Returns:
        the height of the largest scaled-down image that the TurboJPEG decompressor can generate without exceeding the desired image width and height.

    - #### decompress

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

      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.

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

      Parameters:
        `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 `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)`. If the source image is a YUV image, then this buffer should normally be `pitch * height` bytes in size, where `height` 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 `x`, `y`, and `pitch` parameters can be used to specify the region into which the source image should be decompressed/decoded.
        `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
        `desiredWidth` - If the source image is a JPEG image, then this specifies the desired width (in pixels) of the decompressed image (or image region.) If the desired destination image dimensions are different 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 considered when determining the scaled image size.) This parameter is ignored if the source image is a YUV image.
        `pitch` - bytes per row in the destination image. Normally this should be set to `scaledWidth *` `TJ.getPixelSize``(pixelFormat)`, 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 `scaledWidth` can be determined by calling `scalingFactor.``getScaled``(jpegWidth)` or by calling `getScaledWidth(int, int)`. If the source image is a YUV image, then `scaledWidth` is the width of the YUV image. Setting this parameter to 0 is the equivalent of setting it to `scaledWidth *` `TJ.getPixelSize``(pixelFormat)`.
        `desiredHeight` - If the source image is a JPEG image, then this specifies the desired height (in pixels) of the decompressed image (or image region.) If the desired destination image dimensions are different 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 ignored if the source image is a YUV image.
        `pixelFormat` - pixel format of the decompressed/decoded image (one of `TJ.PF_*`)
        `flags` - the bitwise OR of one or more of `TJ.FLAG_*`
      Throws:
        `TJException`

    - #### decompress

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

      Deprecated. Use `decompress(byte[], int, int, int, int, int, int, int)` instead.
      Throws:
        `TJException`

    - #### decompress

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

      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.
      Parameters:
        `desiredWidth` - see `decompress(byte[], int, int, int, int, int, int, int)` for description
        `pitch` - see `decompress(byte[], int, int, int, int, int, int, int)` for description
        `desiredHeight` - see `decompress(byte[], int, int, int, int, int, int, int)` for description
        `pixelFormat` - pixel format of the decompressed image (one of `TJ.PF_*`)
        `flags` - the bitwise OR of one or more of `TJ.FLAG_*`
      Returns:
        a buffer containing the packed-pixel decompressed image.
      Throws:
        `TJException`

    - #### decompressToYUV

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

      Decompress the JPEG source image associated with this decompressor instance into a 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.FLAG_STOPONWARNING` is specified.)

      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 one of the scaled image sizes that the decompressor is capable of generating from the JPEG source image.
        `flags` - the bitwise OR of one or more of `TJ.FLAG_*`
      Throws:
        `TJException`

    - #### decompressToYUV

          @Deprecated
          public void decompressToYUV(byte[] dstBuf,
                                        int flags)
                               throws TJException

      Deprecated. Use `decompressToYUV(YUVImage, int)` instead.
      Throws:
        `TJException`

    - #### decompressToYUV

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

      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 `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:
        `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 considered when determining the scaled image size.)
        `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.
        `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 considered when determining the scaled image size.)
        `flags` - the bitwise OR of one or more of `TJ.FLAG_*`
      Returns:
        a `YUVImage` instance containing the decompressed image planes
      Throws:
        `TJException`

    - #### decompressToYUV

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

      Decompress the JPEG source image associated with this decompressor instance into a 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:
        `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 considered when determining the scaled image size.)
        `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.)
        `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 considered when determining the scaled image size.)
        `flags` - the bitwise OR of one or more of `TJ.FLAG_*`
      Returns:
        a `YUVImage` instance containing the unified planar YUV decompressed image
      Throws:
        `TJException`

    - #### decompressToYUV

          @Deprecated
          public byte[] decompressToYUV(int flags)
                                 throws TJException

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

    - #### decompress

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

      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.

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

      Parameters:
        `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 `stride * scaledHeight` pixels 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)`. If the source image is a YUV image, then this buffer should normally be `stride * height` pixels in size, where `height` 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 `x`, `y`, and `stride` 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/decoded
        `y` - y offset (in pixels) of the region in the destination image into which the source image should be decompressed/decoded
        `desiredWidth` - If the source image is a JPEG image, then this specifies the desired width (in pixels) of the decompressed image (or image region.) If the desired destination image dimensions are different 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 considered when determining the scaled image size.) This parameter is ignored if the source image is a YUV image.
        `stride` - pixels per row in the destination image. Normally this should be set to `scaledWidth`, 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 `scaledWidth` can be determined by calling `scalingFactor.``getScaled``(jpegWidth)` or by calling `getScaledWidth(int, int)`. If the source image is a YUV image, then `scaledWidth` is the width of the YUV image. Setting this parameter to 0 is the equivalent of setting it to `scaledWidth`.
        `desiredHeight` - If the source image is a JPEG image, then this specifies the desired height (in pixels) of the decompressed image (or image region.) If the desired destination image dimensions are different 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 ignored if the source image is a YUV image.
        `pixelFormat` - pixel format of the decompressed image (one of `TJ.PF_*`)
        `flags` - the bitwise OR of one or more of `TJ.FLAG_*`
      Throws:
        `TJException`

    - #### decompress

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

      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 `BufferedImage` instance.

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

      Parameters:
        `dstImage` - a `BufferedImage` instance that will receive the packed-pixel decompressed/decoded image. If the source image is a JPEG image, then the width and height of the `BufferedImage` 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 `BufferedImage` instance must match the width and height of the YUV image.
        `flags` - the bitwise OR of one or more of `TJ.FLAG_*`
      Throws:
        `TJException`

    - #### decompress

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

      Decompress the JPEG source image or decode the planar YUV source image associated with this decompressor instance and return a `BufferedImage` instance containing the packed-pixel decompressed/decoded image.
      Parameters:
        `desiredWidth` - see `decompress(byte[], int, int, int, int, int, int, int)` for description
        `desiredHeight` - see `decompress(byte[], int, int, int, int, int, int, int)` for description
        `bufferedImageType` - the image type of the `BufferedImage` instance that will be created (for instance, `BufferedImage.TYPE_INT_RGB`)
        `flags` - the bitwise OR of one or more of `TJ.FLAG_*`
      Returns:
        a `BufferedImage` instance containing the packed-pixel decompressed/decoded image.
      Throws:
        `TJException`

    - #### close

          public void close()
                     throws TJException

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

    - #### finalize

          protected void finalize()
                           throws java.lang.Throwable

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