public class TIFFYCbCrDecompressor extends TIFFDecompressor
| Modifier and Type | Field and Description |
|---|---|
private int |
chromaSubsampleH |
private int |
chromaSubsampleV |
private float |
codingRangeY |
private boolean |
colorConvert |
private static boolean |
debug |
private TIFFDecompressor |
decompressor |
private static int |
FRAC_BITS |
private static float |
FRAC_SCALE |
private int[] |
iCbTab |
private int[] |
iCrTab |
private int[] |
iGCbTab |
private int[] |
iGCrTab |
private int[] |
iGYTab |
private int[] |
iYTab |
private float |
LumaBlue |
private float |
LumaGreen |
private float |
LumaRed |
private float |
referenceBlackCb |
private float |
referenceBlackCr |
private float |
referenceBlackY |
private float |
referenceWhiteCb |
private float |
referenceWhiteCr |
private float |
referenceWhiteY |
private BufferedImage |
tmpImage |
activeSrcHeight, activeSrcMinX, activeSrcMinY, activeSrcWidth, bitsPerSample, byteCount, colorConverter, colorMap, compression, destinationBands, dstHeight, dstMinX, dstMinY, dstWidth, dstXOffset, dstYOffset, extraSamples, image, metadata, offset, photometricInterpretation, planar, rawImage, reader, sampleFormat, samplesPerPixel, sourceBands, sourceXOffset, sourceYOffset, srcHeight, srcMinX, srcMinY, srcWidth, stream, subsampleX, subsampleY| Constructor and Description |
|---|
TIFFYCbCrDecompressor(TIFFDecompressor decompressor,
boolean colorConvert) |
| Modifier and Type | Method and Description |
|---|---|
void |
beginDecoding()
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. |
private byte |
clamp(int f) |
void |
decodeRaw(byte[] buf,
int dstOffset,
int bitsPerPixel,
int scanlineStride)
Decodes the source data into the provided
byte
array b, starting at the offset given by
dstOffset. |
void |
setActiveSrcHeight(int activeSrcHeight)
Sets the value of the
activeSrcHeight field. |
void |
setActiveSrcMinX(int activeSrcMinX)
Sets the value of the
activeSrcMinX field. |
void |
setActiveSrcMinY(int activeSrcMinY)
Sets the value of the
activeSrcMinY field. |
void |
setActiveSrcWidth(int activeSrcWidth)
Sets the value of the
activeSrcWidth field. |
void |
setBitsPerSample(int[] bitsPerSample)
Sets the value of the
bitsPerSample field. |
void |
setByteCount(int byteCount)
Sets the value of the
byteCount field. |
void |
setColorMap(char[] colorMap)
Sets the value of the
colorMap field. |
void |
setCompression(int compression)
Sets the value of the
compression field. |
void |
setDestinationBands(int[] destinationBands)
Sets the value of the
destinationBands field. |
void |
setDstHeight(int dstHeight)
Sets the value of the
dstHeight field. |
void |
setDstMinX(int dstMinX)
Sets the value of the
dstMinX field. |
void |
setDstMinY(int dstMinY)
Sets the value of the
dstMinY field. |
void |
setDstWidth(int dstWidth)
Sets the value of the
dstWidth field. |
void |
setDstXOffset(int dstXOffset)
Sets the value of the
dstXOffset field. |
void |
setDstYOffset(int dstYOffset)
Sets the value of the
dstYOffset field. |
void |
setExtraSamples(int[] extraSamples)
Sets the value of the
extraSamples field. |
void |
setImage(BufferedImage image)
Sets the value of the
image field. |
void |
setMetadata(IIOMetadata metadata)
Sets the value of the
metadata field. |
void |
setOffset(long offset)
Sets the value of the
offset field. |
void |
setPhotometricInterpretation(int photometricInterpretation)
Sets the value of the
photometricInterpretation
field. |
void |
setPlanar(boolean planar)
Sets the value of the
planar field. |
void |
setReader(ImageReader reader)
Sets the value of the
reader field. |
void |
setSampleFormat(int[] sampleFormat)
Sets the value of the
sampleFormat field. |
void |
setSamplesPerPixel(int samplesPerPixel)
Sets the value of the
samplesPerPixel field. |
void |
setSourceBands(int[] sourceBands)
Sets the value of the
sourceBands field. |
void |
setSourceXOffset(int sourceXOffset)
Sets the value of the
sourceXOffset field. |
void |
setSourceYOffset(int sourceYOffset)
Sets the value of the
sourceYOffset. |
void |
setSrcHeight(int srcHeight)
Sets the value of the
srcHeight field. |
void |
setSrcMinX(int srcMinX)
Sets the value of the
srcMinX field. |
void |
setSrcMinY(int srcMinY)
Sets the value of the
srcMinY field. |
void |
setSrcWidth(int srcWidth)
Sets the value of the
srcWidth field. |
void |
setStream(ImageInputStream stream)
Sets the value of the
stream field. |
private void |
warning(String message) |
createRawImage, decode, decodeRaw, decodeRaw, decodeRaw, getRawImageType, getRawImageTypeSpecifier, setColorConverter, setSubsampleX, setSubsampleYprivate static final boolean debug
private static final int FRAC_BITS
private static final float FRAC_SCALE
private float LumaRed
private float LumaGreen
private float LumaBlue
private float referenceBlackY
private float referenceWhiteY
private float referenceBlackCb
private float referenceWhiteCb
private float referenceBlackCr
private float referenceWhiteCr
private float codingRangeY
private int[] iYTab
private int[] iCbTab
private int[] iCrTab
private int[] iGYTab
private int[] iGCbTab
private int[] iGCrTab
private int chromaSubsampleH
private int chromaSubsampleV
private boolean colorConvert
private TIFFDecompressor decompressor
private BufferedImage tmpImage
public TIFFYCbCrDecompressor(TIFFDecompressor decompressor, boolean colorConvert)
private void warning(String message)
public void setReader(ImageReader reader)
TIFFDecompressorreader field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setReader in class TIFFDecompressorreader - the current ImageReader.public void setMetadata(IIOMetadata metadata)
TIFFDecompressormetadata field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setMetadata in class TIFFDecompressormetadata - the IIOMetadata object for the
image being read.public void setPhotometricInterpretation(int photometricInterpretation)
TIFFDecompressorphotometricInterpretation
field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setPhotometricInterpretation in class TIFFDecompressorphotometricInterpretation - the photometric interpretation
value.public void setCompression(int compression)
TIFFDecompressorcompression field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setCompression in class TIFFDecompressorcompression - the compression type.public void setPlanar(boolean planar)
TIFFDecompressorplanar field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setPlanar in class TIFFDecompressorplanar - true if the image to be decoded is
stored in planar format.public void setSamplesPerPixel(int samplesPerPixel)
TIFFDecompressorsamplesPerPixel field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setSamplesPerPixel in class TIFFDecompressorsamplesPerPixel - the number of samples in each source
pixel.public void setBitsPerSample(int[] bitsPerSample)
TIFFDecompressorbitsPerSample field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setBitsPerSample in class TIFFDecompressorbitsPerSample - the number of bits for each source image
sample.public void setSampleFormat(int[] sampleFormat)
TIFFDecompressorsampleFormat field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setSampleFormat in class TIFFDecompressorsampleFormat - the format of the source image data,
for example unsigned integer or floating-point.public void setExtraSamples(int[] extraSamples)
TIFFDecompressorextraSamples field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setExtraSamples in class TIFFDecompressorextraSamples - the interpretation of any samples in the
source file beyond those used for basic color or grayscale
information.public void setColorMap(char[] colorMap)
TIFFDecompressorcolorMap field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setColorMap in class TIFFDecompressorcolorMap - the color map to apply to the source data,
as an array of chars.public void setStream(ImageInputStream stream)
TIFFDecompressorstream field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setStream in class TIFFDecompressorstream - the ImageInputStream to be read.public void setOffset(long offset)
TIFFDecompressoroffset field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setOffset in class TIFFDecompressoroffset - the offset of the beginning of the compressed
data.public void setByteCount(int byteCount)
TIFFDecompressorbyteCount field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setByteCount in class TIFFDecompressorbyteCount - the number of bytes of compressed data.public void setSrcMinX(int srcMinX)
TIFFDecompressorsrcMinX field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setSrcMinX in class TIFFDecompressorsrcMinX - the minimum X coordinate of the source region
being decoded, irrespective of how it will be copied into the
destination.public void setSrcMinY(int srcMinY)
TIFFDecompressorsrcMinY field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setSrcMinY in class TIFFDecompressorsrcMinY - the minimum Y coordinate of the source region
being decoded, irrespective of how it will be copied into the
destination.public void setSrcWidth(int srcWidth)
TIFFDecompressorsrcWidth field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setSrcWidth in class TIFFDecompressorsrcWidth - the width of the source region being decoded,
irrespective of how it will be copied into the destination.public void setSrcHeight(int srcHeight)
TIFFDecompressorsrcHeight field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setSrcHeight in class TIFFDecompressorsrcHeight - the height of the source region being decoded,
irrespective of how it will be copied into the destination.public void setSourceXOffset(int sourceXOffset)
TIFFDecompressorsourceXOffset field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setSourceXOffset in class TIFFDecompressorsourceXOffset - the horizontal source offset to be used when
mapping between source and destination coordinates.public void setDstXOffset(int dstXOffset)
TIFFDecompressordstXOffset field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setDstXOffset in class TIFFDecompressordstXOffset - the horizontal destination offset to be
used when mapping between source and destination coordinates.public void setSourceYOffset(int sourceYOffset)
TIFFDecompressorsourceYOffset.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setSourceYOffset in class TIFFDecompressorsourceYOffset - the vertical source offset to be used when
mapping between source and destination coordinates.public void setDstYOffset(int dstYOffset)
TIFFDecompressordstYOffset field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setDstYOffset in class TIFFDecompressordstYOffset - the vertical destination offset to be
used when mapping between source and destination coordinates.public void setSourceBands(int[] sourceBands)
TIFFDecompressorsourceBands field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setSourceBands in class TIFFDecompressorsourceBands - an array of ints
specifying the source bands to be read.public void setDestinationBands(int[] destinationBands)
TIFFDecompressordestinationBands field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setDestinationBands in class TIFFDecompressordestinationBands - an array of ints
specifying the destination bands to be written.public void setImage(BufferedImage image)
TIFFDecompressorimage field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setImage in class TIFFDecompressorimage - the destination BufferedImage.public void setDstMinX(int dstMinX)
TIFFDecompressordstMinX field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setDstMinX in class TIFFDecompressordstMinX - the minimum X coordinate of the destination
region.public void setDstMinY(int dstMinY)
TIFFDecompressordstMinY field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setDstMinY in class TIFFDecompressordstMinY - the minimum Y coordinate of the destination
region.public void setDstWidth(int dstWidth)
TIFFDecompressordstWidth field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setDstWidth in class TIFFDecompressordstWidth - the width of the destination region.public void setDstHeight(int dstHeight)
TIFFDecompressordstHeight field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setDstHeight in class TIFFDecompressordstHeight - the height of the destination region.public void setActiveSrcMinX(int activeSrcMinX)
TIFFDecompressoractiveSrcMinX field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setActiveSrcMinX in class TIFFDecompressoractiveSrcMinX - the minimum X coordinate of the active
source region.public void setActiveSrcMinY(int activeSrcMinY)
TIFFDecompressoractiveSrcMinY field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setActiveSrcMinY in class TIFFDecompressoractiveSrcMinY - the minimum Y coordinate of the active
source region.public void setActiveSrcWidth(int activeSrcWidth)
TIFFDecompressoractiveSrcWidth field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setActiveSrcWidth in class TIFFDecompressoractiveSrcWidth - the width of the active source region.public void setActiveSrcHeight(int activeSrcHeight)
TIFFDecompressoractiveSrcHeight field.
If this method is called, the beginDecoding
method must be called prior to calling any of the decode
methods.
setActiveSrcHeight in class TIFFDecompressoractiveSrcHeight - the height of the active source region.private byte clamp(int f)
public void beginDecoding()
TIFFDecompressordecode 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.
beginDecoding in class TIFFDecompressorpublic void decodeRaw(byte[] buf,
int dstOffset,
int bitsPerPixel,
int scanlineStride)
throws IOException
TIFFDecompressorbyte
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.decodeRaw in class TIFFDecompressorbuf - 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.IOException - if an error occurs reading from the source
ImageInputStream.Copyright © 2015 Open Microscopy Environment