javax.media.jai.tilecodec
Class JPEGTileCodecDescriptor

java.lang.Object
  |
  +--javax.media.jai.tilecodec.TileCodecDescriptorImpl
        |
        +--javax.media.jai.tilecodec.JPEGTileCodecDescriptor
All Implemented Interfaces:
RegistryElementDescriptor, TileCodecDescriptor

public class JPEGTileCodecDescriptor
extends TileCodecDescriptorImpl

This class is the descriptor for the "JPEG" tile codec. "jpeg" is a lossy tile codec, which involves compressing the tile data using the jpeg standard. The format name for the jpeg tile codec is "jpeg". The encoded stream contains the SampleModel and the tile's upper left corner position, thus the includesSampleModelInfo() and includesLocationInfo() methods in this descriptor return true.

This JPEG tile codec works well only on byte type images with 1, 3 or 4 bands.

While both the "tileDecoder" and "tileEncoder" registry modes for the "jpeg" tile codec scheme have the same set of parameters, the parameters for the "tileDecoder" mode are read-only and will be ignored if values are set for them in the TileCodecParameterList passed to the TileDecoder. The reason for this is that the parameter values needed to control the decoding process are included in the encoded stream, therefore parameter values specified externally are ignored. Once the decoding is completed, the parameter values in the TileCodecParameterList are updated to reflect the values specified in the encoded stream.

Resource List
Name Value
Vendor com.sun.media.jai
Description A descriptor to describe the lossy "jpeg" codec scheme.
DocURL http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/tilecodec/JPEGTileCodecDescriptor.html
Version 1.2
quality

A factor that relates to the desired tradeoff between image quality and the image data compression ratio. The range of this parameter is from 0.0 to 1.0. A setting of 1.0 produces the highest quality image at a lower compression rate. A setting of 0.0 produces the highest compression ratio, with a sacrifice to image quality. The default value is 0.75.

In JPEG, compression, there are two ways to control the quantization quality: one is define quantization table for each image component; the other is define the quality. The later overrides the former. If neither the quality nor quantization tables are set, the default setting is used.

When the quality is set, a group of quantization tables are generated by rescaling the default quantization tables. For more infomation, please refer to the links below.

qualitySet A boolean used to indicate that the parameter quality is set or not.
horizontalSubsampling The subsampling rate in the horizontal direction applied to each image component to reduce their resolution prior to encoding.
verticalSubsampling The subsampling rate in the vertical direction applied to each image component to reduce their resolution prior to encoding.
quantizationTableMapping In JPEG compression, several image components may share one quantization table. This is the mapping between the image component and the quantization tables.
quantizationTable0 A quantization table for JPEG codec is an array of 64 (8x8) expressed in zig-zag order (see the JPEG spec section K.1). Since this descriptor defines a JPEG scheme where the tile has at most 4 components, so at most 4 quantization tables will be used. This parameter is the first quantization table.
quantizationTable1 The second quantization table.
quantizationTable2 The third quantization table.
quantizationTable3 The fourth quantization table.
restartInterval JPEG images use restart markers to define multiple strips or tiles. The restart markers are inserted periodically into the image data to delineate image segments known as restart intervals. To limit the effect of bitstream errors to a single restart interval, JAI provides methods to set the restart interval in JPEG Minimum Coded Units (MCUs). The default is zero (no restart interval markers).
writeImageInfo A boolean instructs the encoder to write the image data to the output stream.
writeTableInfo A boolean instructs the encoder to write the table data to the output stream.
writeJFIFHeader The JPEG File Interchange Format (JFIF) is a minimal file format that enables JPEG bitstreams to be exchanged between a wide variety of platforms and applications. The parameter instructs the encoder to write the output stream in the JFIF format.

Parameter List
Name Class Type Default Value
quality java.lang.Float 0.75
qualitySet java.lang.Boolean true
horizontalSubsampling integer array {1,1,1}
verticalSubsampling integer array {1,1,1}
quantizationTableMapping integer array {0,1,1}
quantizationTable0 integer array The default Luminance table as defined in section K.1 of the JPEG specification.
quantizationTable1 integer array The default Chrominance table as defined in section K.1 of the JPEG specification.
quantizationTable2 integer array The default Chrominance table as defined in section K.1 of the JPEG specification.
quantizationTable3 integer array The default Chrominance table as defined in section K.1 of the JPEG specification.
restartInterval java.lang.Integer 0
writeImageInfo java.lang.Boolean true
writeTableInfo java.lang.Boolean true
writeJFIFHeader java.lang.Boolean false

Since:
JAI 1.1
See Also:
com.sun.image.codec.jpeg.JPEGQTable, com.sun.image.codec.jpeg.JPEGDecodeParam, com.sun.image.codec.jpeg.JPEGEncodeParam

Constructor Summary
JPEGTileCodecDescriptor()
          Creates a JPEGTileCodecDescriptor
 
Method Summary
 TileCodecParameterList getCompatibleParameters(String modeName, TileCodecParameterList otherParamList)
          Returns a TileCodecParameterList valid for the specified modeName and compatible with the supplied TileCodecParameterList.
 TileCodecParameterList getDefaultParameters(String modeName)
          Returns the default parameters for the specified modeName as an instance of the TileCodecParameterList.
 TileCodecParameterList getDefaultParameters(String modeName, SampleModel sm)
          Returns the default parameters for the specified modeName as an instance of the TileCodecParameterList, adding a "sampleModel" parameter with the specified value to the parameter list.
 ParameterListDescriptor getParameterListDescriptor(String modeName)
          Returns the ParameterListDescriptor that describes the associated parameters (NOT sources).
 
Methods inherited from class javax.media.jai.tilecodec.TileCodecDescriptorImpl
arePropertiesSupported, getName, getPropertyGenerators, getSupportedModes, includesLocationInfo, includesSampleModelInfo, isModeSupported
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JPEGTileCodecDescriptor

public JPEGTileCodecDescriptor()
Creates a JPEGTileCodecDescriptor
Method Detail

getCompatibleParameters

public TileCodecParameterList getCompatibleParameters(String modeName,
                                                      TileCodecParameterList otherParamList)
Returns a TileCodecParameterList valid for the specified modeName and compatible with the supplied TileCodecParameterList. For example, given a TileCodecParameterList used to encode a tile with the modeName being specified as "tileDecoder", this method will return a TileCodecParameterList sufficient to decode that same tile.

If the supplied modeName is one of the valid mode names as ascertained from the getSupportedNames() method, this method returns a TileCodecParameterList that contains values that are compatible for the supplied mode name.

Parameters:
modeName - The registry mode to return a valid parameter list for.
otherParamList - The parameter list for which a compatible parameter list for the complementary modeName is to be found.
Throws:
IllegalArgumentException - if modeName is null.
IllegalArgumentException - if modeName is not one of the modes valid for this descriptor, i.e those returned from the getSupportedNames() method.
IllegalArgumentException - if otherParamList is null.

getDefaultParameters

public TileCodecParameterList getDefaultParameters(String modeName)
Returns the default parameters for the specified modeName as an instance of the TileCodecParameterList. If the supplied modeName is one of the valid mode names as ascertained from the getSupportedNames() method, this method returns the default parameters for that mode.
Parameters:
modeName - The mode to return the default parameters for.
Throws:
IllegalArgumentException - if modeName is null.
IllegalArgumentException - if modeName is not one of the modes valid for this descriptor, i.e those returned from the getSupportedNames() method.

getDefaultParameters

public TileCodecParameterList getDefaultParameters(String modeName,
                                                   SampleModel sm)
Returns the default parameters for the specified modeName as an instance of the TileCodecParameterList, adding a "sampleModel" parameter with the specified value to the parameter list. If the supplied modeName is one of the valid mode names as ascertained from the getSupportedNames() method, this method returns the default parameters for that mode.

This method should be used when includesSampleModelInfo() returns false. If includesSampleModelInfo() returns true, the supplied SampleModel is ignored.

For the JPEG codec, includesSampleModelInfo() returns true, so the supplied SampleModel is ignored.

Parameters:
modeName - The mode to return the default parameters for.
sm - The SampleModel used to create the default decoding parameter list.
Throws:
IllegalArgumentException - if modeName is null.
IllegalArgumentException - if modeName is not one of the modes valid for this descriptor, i.e those returned from the getSupportedNames() method.

getParameterListDescriptor

public ParameterListDescriptor getParameterListDescriptor(String modeName)
Returns the ParameterListDescriptor that describes the associated parameters (NOT sources). If the supplied modeName is one of the valid mode names as ascertained from the getSupportedNames() method, this method returns a non-null ParameterListDescriptor with the appropriate parameters.
Parameters:
modeName - The mode to return the ParameterListDescriptor for.
Throws:
IllegalArgumentException - if modeName is null.
IllegalArgumentException - if modeName is not one of the modes valid for this descriptor, i.e those returned from the getSupportedNames() method.