Class TIFFYCbCrDecompressor

java.lang.Object
com.github.jaiimageio.plugins.tiff.TIFFDecompressor
com.github.jaiimageio.impl.plugins.tiff.TIFFYCbCrDecompressor

public class TIFFYCbCrDecompressor extends TIFFDecompressor
  • Field Details

    • debug

      private static final boolean debug
      See Also:
    • FRAC_BITS

      private static final int FRAC_BITS
      See Also:
    • FRAC_SCALE

      private static final float FRAC_SCALE
      See Also:
    • LumaRed

      private float LumaRed
    • LumaGreen

      private float LumaGreen
    • LumaBlue

      private float LumaBlue
    • referenceBlackY

      private float referenceBlackY
    • referenceWhiteY

      private float referenceWhiteY
    • referenceBlackCb

      private float referenceBlackCb
    • referenceWhiteCb

      private float referenceWhiteCb
    • referenceBlackCr

      private float referenceBlackCr
    • referenceWhiteCr

      private float referenceWhiteCr
    • codingRangeY

      private float codingRangeY
    • iYTab

      private int[] iYTab
    • iCbTab

      private int[] iCbTab
    • iCrTab

      private int[] iCrTab
    • iGYTab

      private int[] iGYTab
    • iGCbTab

      private int[] iGCbTab
    • iGCrTab

      private int[] iGCrTab
    • chromaSubsampleH

      private int chromaSubsampleH
    • chromaSubsampleV

      private int chromaSubsampleV
    • colorConvert

      private boolean colorConvert
    • decompressor

      private TIFFDecompressor decompressor
    • tmpImage

      private BufferedImage tmpImage
  • Constructor Details

    • TIFFYCbCrDecompressor

      public TIFFYCbCrDecompressor(TIFFDecompressor decompressor, boolean colorConvert)
  • Method Details

    • warning

      private void warning(String message)
    • setReader

      public void setReader(ImageReader reader)
      Description copied from class: TIFFDecompressor
      Sets the value of the reader field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setReader in class TIFFDecompressor
      Parameters:
      reader - the current ImageReader.
    • setMetadata

      public void setMetadata(IIOMetadata metadata)
      Description copied from class: TIFFDecompressor
      Sets the value of the metadata field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setMetadata in class TIFFDecompressor
      Parameters:
      metadata - the IIOMetadata object for the image being read.
    • setPhotometricInterpretation

      public void setPhotometricInterpretation(int photometricInterpretation)
      Description copied from class: TIFFDecompressor
      Sets the value of the photometricInterpretation field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setPhotometricInterpretation in class TIFFDecompressor
      Parameters:
      photometricInterpretation - the photometric interpretation value.
    • setCompression

      public void setCompression(int compression)
      Description copied from class: TIFFDecompressor
      Sets the value of the compression field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setCompression in class TIFFDecompressor
      Parameters:
      compression - the compression type.
    • setPlanar

      public void setPlanar(boolean planar)
      Description copied from class: TIFFDecompressor
      Sets the value of the planar field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setPlanar in class TIFFDecompressor
      Parameters:
      planar - true if the image to be decoded is stored in planar format.
    • setSamplesPerPixel

      public void setSamplesPerPixel(int samplesPerPixel)
      Description copied from class: TIFFDecompressor
      Sets the value of the samplesPerPixel field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setSamplesPerPixel in class TIFFDecompressor
      Parameters:
      samplesPerPixel - the number of samples in each source pixel.
    • setBitsPerSample

      public void setBitsPerSample(int[] bitsPerSample)
      Description copied from class: TIFFDecompressor
      Sets the value of the bitsPerSample field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setBitsPerSample in class TIFFDecompressor
      Parameters:
      bitsPerSample - the number of bits for each source image sample.
    • setSampleFormat

      public void setSampleFormat(int[] sampleFormat)
      Description copied from class: TIFFDecompressor
      Sets the value of the sampleFormat field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setSampleFormat in class TIFFDecompressor
      Parameters:
      sampleFormat - the format of the source image data, for example unsigned integer or floating-point.
    • setExtraSamples

      public void setExtraSamples(int[] extraSamples)
      Description copied from class: TIFFDecompressor
      Sets the value of the extraSamples field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setExtraSamples in class TIFFDecompressor
      Parameters:
      extraSamples - the interpretation of any samples in the source file beyond those used for basic color or grayscale information.
    • setColorMap

      public void setColorMap(char[] colorMap)
      Description copied from class: TIFFDecompressor
      Sets the value of the colorMap field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setColorMap in class TIFFDecompressor
      Parameters:
      colorMap - the color map to apply to the source data, as an array of chars.
    • setStream

      public void setStream(ImageInputStream stream)
      Description copied from class: TIFFDecompressor
      Sets the value of the stream field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setStream in class TIFFDecompressor
      Parameters:
      stream - the ImageInputStream to be read.
    • setOffset

      public void setOffset(long offset)
      Description copied from class: TIFFDecompressor
      Sets the value of the offset field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setOffset in class TIFFDecompressor
      Parameters:
      offset - the offset of the beginning of the compressed data.
    • setByteCount

      public void setByteCount(int byteCount)
      Description copied from class: TIFFDecompressor
      Sets the value of the byteCount field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setByteCount in class TIFFDecompressor
      Parameters:
      byteCount - the number of bytes of compressed data.
    • setSrcMinX

      public void setSrcMinX(int srcMinX)
      Description copied from class: TIFFDecompressor
      Sets the value of the srcMinX field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setSrcMinX in class TIFFDecompressor
      Parameters:
      srcMinX - the minimum X coordinate of the source region being decoded, irrespective of how it will be copied into the destination.
    • setSrcMinY

      public void setSrcMinY(int srcMinY)
      Description copied from class: TIFFDecompressor
      Sets the value of the srcMinY field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setSrcMinY in class TIFFDecompressor
      Parameters:
      srcMinY - the minimum Y coordinate of the source region being decoded, irrespective of how it will be copied into the destination.
    • setSrcWidth

      public void setSrcWidth(int srcWidth)
      Description copied from class: TIFFDecompressor
      Sets the value of the srcWidth field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setSrcWidth in class TIFFDecompressor
      Parameters:
      srcWidth - the width of the source region being decoded, irrespective of how it will be copied into the destination.
    • setSrcHeight

      public void setSrcHeight(int srcHeight)
      Description copied from class: TIFFDecompressor
      Sets the value of the srcHeight field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setSrcHeight in class TIFFDecompressor
      Parameters:
      srcHeight - the height of the source region being decoded, irrespective of how it will be copied into the destination.
    • setSourceXOffset

      public void setSourceXOffset(int sourceXOffset)
      Description copied from class: TIFFDecompressor
      Sets the value of the sourceXOffset field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setSourceXOffset in class TIFFDecompressor
      Parameters:
      sourceXOffset - the horizontal source offset to be used when mapping between source and destination coordinates.
    • setDstXOffset

      public void setDstXOffset(int dstXOffset)
      Description copied from class: TIFFDecompressor
      Sets the value of the dstXOffset field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setDstXOffset in class TIFFDecompressor
      Parameters:
      dstXOffset - the horizontal destination offset to be used when mapping between source and destination coordinates.
    • setSourceYOffset

      public void setSourceYOffset(int sourceYOffset)
      Description copied from class: TIFFDecompressor
      Sets the value of the sourceYOffset.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setSourceYOffset in class TIFFDecompressor
      Parameters:
      sourceYOffset - the vertical source offset to be used when mapping between source and destination coordinates.
    • setDstYOffset

      public void setDstYOffset(int dstYOffset)
      Description copied from class: TIFFDecompressor
      Sets the value of the dstYOffset field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setDstYOffset in class TIFFDecompressor
      Parameters:
      dstYOffset - the vertical destination offset to be used when mapping between source and destination coordinates.
    • setSourceBands

      public void setSourceBands(int[] sourceBands)
      Description copied from class: TIFFDecompressor
      Sets the value of the sourceBands field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setSourceBands in class TIFFDecompressor
      Parameters:
      sourceBands - an array of ints specifying the source bands to be read.
    • setDestinationBands

      public void setDestinationBands(int[] destinationBands)
      Description copied from class: TIFFDecompressor
      Sets the value of the destinationBands field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setDestinationBands in class TIFFDecompressor
      Parameters:
      destinationBands - an array of ints specifying the destination bands to be written.
    • setImage

      public void setImage(BufferedImage image)
      Description copied from class: TIFFDecompressor
      Sets the value of the image field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setImage in class TIFFDecompressor
      Parameters:
      image - the destination BufferedImage.
    • setDstMinX

      public void setDstMinX(int dstMinX)
      Description copied from class: TIFFDecompressor
      Sets the value of the dstMinX field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setDstMinX in class TIFFDecompressor
      Parameters:
      dstMinX - the minimum X coordinate of the destination region.
    • setDstMinY

      public void setDstMinY(int dstMinY)
      Description copied from class: TIFFDecompressor
      Sets the value of the dstMinY field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setDstMinY in class TIFFDecompressor
      Parameters:
      dstMinY - the minimum Y coordinate of the destination region.
    • setDstWidth

      public void setDstWidth(int dstWidth)
      Description copied from class: TIFFDecompressor
      Sets the value of the dstWidth field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setDstWidth in class TIFFDecompressor
      Parameters:
      dstWidth - the width of the destination region.
    • setDstHeight

      public void setDstHeight(int dstHeight)
      Description copied from class: TIFFDecompressor
      Sets the value of the dstHeight field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setDstHeight in class TIFFDecompressor
      Parameters:
      dstHeight - the height of the destination region.
    • setActiveSrcMinX

      public void setActiveSrcMinX(int activeSrcMinX)
      Description copied from class: TIFFDecompressor
      Sets the value of the activeSrcMinX field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setActiveSrcMinX in class TIFFDecompressor
      Parameters:
      activeSrcMinX - the minimum X coordinate of the active source region.
    • setActiveSrcMinY

      public void setActiveSrcMinY(int activeSrcMinY)
      Description copied from class: TIFFDecompressor
      Sets the value of the activeSrcMinY field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setActiveSrcMinY in class TIFFDecompressor
      Parameters:
      activeSrcMinY - the minimum Y coordinate of the active source region.
    • setActiveSrcWidth

      public void setActiveSrcWidth(int activeSrcWidth)
      Description copied from class: TIFFDecompressor
      Sets the value of the activeSrcWidth field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setActiveSrcWidth in class TIFFDecompressor
      Parameters:
      activeSrcWidth - the width of the active source region.
    • setActiveSrcHeight

      public void setActiveSrcHeight(int activeSrcHeight)
      Description copied from class: TIFFDecompressor
      Sets the value of the activeSrcHeight field.

      If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.

      Overrides:
      setActiveSrcHeight in class TIFFDecompressor
      Parameters:
      activeSrcHeight - the height of the active source region.
    • clamp

      private byte clamp(int f)
    • beginDecoding

      public void beginDecoding()
      Description copied from class: TIFFDecompressor
      This routine is called prior to a sequence of calls to the decode method, in order to allow any necessary tables or other structures to be initialized based on metadata values. This routine is guaranteed to be called any time the metadata values have changed.

      The default implementation computes tables used by the decode method to rescale components to different bit depths. Thus, if this method is overridden, it is important for the subclass method to call super(), unless it overrides decode as well.

      Overrides:
      beginDecoding in class TIFFDecompressor
    • decodeRaw

      public void decodeRaw(byte[] buf, int dstOffset, int bitsPerPixel, int scanlineStride) throws IOException
      Description copied from class: TIFFDecompressor
      Decodes the source data into the provided byte array b, starting at the offset given by dstOffset. Each pixel occupies bitsPerPixel bits, with no padding between pixels. Scanlines are separated by scanlineStride bytes.
      Specified by:
      decodeRaw in class TIFFDecompressor
      Parameters:
      buf - a byte array to be written.
      dstOffset - the starting offset in b to be written.
      bitsPerPixel - the number of bits for each pixel.
      scanlineStride - the number of bytes to advance between that starting pixels of each scanline.
      Throws:
      IOException - if an error occurs reading from the source ImageInputStream.