Previous Next
TIFF 6.0 Specification Final—June 3, 1992
Control Structure
Much of the control structure developed for the sequential DCT procedures is also
used for sequential lossless coding. Either interleaved or non-interleaved data
ordering may be used.
Coding Model
The coding model developed for coding the DC coefficients of the DCT is ex-
tended to allow a number of one-dimensional and two-dimensional predictors for
the lossless coding function. Each component uses an independent predictor.
Prediction
Figure 6 shows the relationship between the neighboring values used for predic-
tion and the sample being coded.
C B
A Y
Figure 6. Relationship between sample and prediction samples
Y is the sample to be coded and A, B, and C are the samples immediately to the
left, immediately above, and diagonally to the left and above.
The allowed predictors are listed in the following table.
Selection-value Prediction
0 no prediction (differential coding)
1 A
2 B
3 C
4 A+B-C
5 A+((B-C)/2)
6 B+((A-C)/2)
7 (A+B)/2
Selection-value 0 shall only be used for differential coding in the hierarchical
mode. Selections 1, 2 and 3 are one-dimensional predictors and selections 4, 5, 6,
and 7 are two dimensional predictors. The divide by 2 in the prediction equations
is done by a arithmetic-right-shift of the integer values.
101
TIFF 6.0 Specification Final—June 3, 1992
The difference between the prediction value and the input is calculated modulo
2**16. Therefore, the prediction can also be treated as a modulo 2**16 value. In
the decoder the difference is decoded and added, modulo 2**16, to the prediction.
Huffman Coding of the Prediction Error
The Huffman coding procedures defined for coding the DC coefficients are used
to code the modulo 2**16 differences. The table for DC coding is extended to 17
entries that allows for coding of the modulo 2**16 differences.
Point Transformation Prior to Lossless Coding
For the lossless processes only, the input image data may optionally be scaled
(quantized) prior to coding by specifying a nonzero value in the point transforma-
tion parameter. Point transformation is defined to be division by a power of 2.
If the point transformation field is nonzero for a component, a point transforma-
tion of the input is performed prior to the lossless coding. The input is divided by
2**Pt, where Pt is the value of the point transform signaling field. The output of
the decoder is rescaled to the input range by multiplying by 2**Pt. Note that the
scaling of input and output can be performed by arithmetic shifts.
Overview of the JPEG Extension to TIFF
In extending the TIFF definition to include JPEG compressed data, it is necessary
to note the following:
• JPEG is effective only on continuous-tone color spaces:
Grayscale (Photometric Interpretation = 1)
RGB (Photometric Interpretation = 2)
CMYK (Photometric Interpretation = 5) (See the CMYK Images section.)
YCbCr (Photometric Interpretation = 6) (See the YCbCr images section.)
• Color conversion to YCbCr is often used as part of the compression process
because the chrominance components can be subsampled and compressed to a
greater degree without significant visual loss of quality. Fields are defined to
describe how this conversion has taken place and the degree of subsampling
employed (see the YCbCr Images section).
• New fields have been defined to specify the JPEG parameters used for com-
pression and to allow quantization tables and Huffman code tables to be incor-
porated into the TIFF file.
102
TIFF 6.0 Specification Final—June 3, 1992
• TIFF is compatible with compressed image data that conforms to the syntax of
the JPEG interchange format for compressed image data. Fields are defined
that may be utilized to facilitate conversion from TIFF to interchange format.
• The PlanarConfiguration Field is used to specify whether or not the com-
pressed data is interleaved as defined by JPEG. For any of the JPEG DCT-
based processes, the interleaved data units are coded 8x8 blocks rather than
component samples.
• Although JPEG codes consecutive image blocks in a single contiguous
bitstream, it is extremely useful to employ the concept of tiles in an image. The
TIFF Tiles section defines some new fields for tiles. These fields should be
stored in place of the older fields for strips. The concept of tiling an image in
both dimensions is important because JPEG hardware may be limited in the
size of each block that is handled.
• Note that the nomenclature used in the TIFF specification is different from the
JPEG Draft International Standardittee Draft (ISO DIS 10918-1) in some
respects. The following terms should be equated when reading this Section:
TIFF name JPEG DIS name
ImageWidth Number of Pixels
ImageLength Number of Lines
SamplesPerPixel Number of Components
JPEGQTable Quantization Table
JPEGDCTable Huffman Table for DC coefficients
JPEGACTable Huffman Table for AC coefficients
Strips and Tiles
The JPEG extension to TIFF has been designed to be consistent with the existing
TIFF strip and tile structures and to allow quick conversion to and from the
stream-oriented compressed image format defined by JPEG.
Compressed images conforming to the syntax of the JPEG interchange format can
be converted to TIFF simply by defining a single strip or tile for the entire image
and then concatenating the TIFF image description fields to the JPEG compressed
image data. The strip or tile offset field points directly to the start of the entropy
coded data (not to a JPEG marker).
Multiple strips or tiles are supported in JPEG compressed images using restart
markers. Restart markers, inserted periodically into the compressed image data,
delineate image segments known as restart intervals. At the start of each restart
interval, the coding state is reset to default values, allowing every restart interval
to be decoded independently of previously decoded data. TIFF strip and tile off-
sets shall always point to the start of a restart interval. Equivalently, each strip or
103
TIFF 6.0 Specification Final—June 3, 1992
tile contains an integral number of restart intervals. Restart markers need not be
present in a TIFF file; they are implicitly coded at the start of every strip or tile.
To maximize interchangeability of TIFF files with other formats, a restriction is
placed on tile height for files containing JPEG-compressed image data conform-
ing to the JPEG interchange format syntax. The restriction, imposed only when
the tile width is shorter than the image width and when the
JPEGInterchangeFormat Field is present and non-zero, states that the tile height
must be equal to the height of one JPEG Minimum Coded Unit (MCU). This
restriction ensures that TIFF files may be converted to JPEG interchange format
without undergoing decompression.
Extensions to Existing Fields
Compression
Tag = 259 (103.H)
Type = SHORT
N =1
This Field indicates the type of compression used. The new value is:
6 = JPEG
JPEG Fields
JPEGProc
Tag = 512 (200.H)
Type = SHORT
N =1
This Field indicates the JPEG process used to produce the compressed data. The
values for this field are defined to be consistent with the numbering convention
used in ISO DIS 10918-2. Two values are defined at this time.
1= Baseline sequential process
14= Lossless process with Huffman coding
When the lossless process with Huffman coding is selected by this Field, the
Huffman tables used to encode the image are specified by the JPEGDCTables
field, and the JPEGACTables field is not used.
Values indicating JPEG processes other than those specified above will be de-
fined in the future.
104
TIFF 6.0 Specification Final—June 3, 1992
Not all of the fields described in this section are relevant to the JPEG process
selected by this Field. The following table specifies the fields that are applicable
to each value defined by this Field.
Tag Name JPEGProc =1 JPEGProc =14
JPEGInterchangeFormat X X
JPEGInterchangeFormatLength X X
JPEGRestart Interval X X
JPEGLosslessPredictors X
JPEGPointTransforms X
JPEGQTables X
JPEGDCTables X X
JPEGACTables X
This Field is mandatory whenever the Compression Field is JPEG (no default).
JPEGInterchangeFormat
Tag = 513 (201.H)
Type = LONG
N =1
This Field indicates whether a JPEG interchange format bitstream is present in the
TIFF file. If a JPEG interchange format bitstream is present, then this Field points
to the Start of Image (SOI) marker code.
If this Field is zero or not present, a JPEG interchange format bitstream is not
present.
JPEGInterchangeFormatLength
Tag = 514 (202.H)
Type = LONG
N =1
This Field indicates the length in bytes of the JPEG interchange format bitstream.
This Field is useful for extracting the JPEG interchange format bitstream without
parsing the bitstream.
This Field is relevant only if the JPEGInterchangeFormat Field is present and is
non-zero.
JPEGRestartInterval
Tag = 515 (203.H)
Type = SHORT
N =1
105
TIFF 6.0 Specification Final—June 3, 1992
This Field indicates the length of the restart interval used in the compressed image
data. The restart interval is defined as the number of Minimum Coded Units
(MCUs) between restart markers.
Restart intervals are used in JPEG compressed images to provide support for
multiple strips or tiles. At the start of each restart interval, the coding state is reset
to default values, allowing every restart interval to be decoded independently of
previously decoded data. TIFF strip and tile offsets shall always point to the start
of a restart interval. Equivalently, each strip or tile contains an integral number of
restart intervals. Restart markers need not be present in a TIFF file; they are im-
plicitly coded at the start of every strip or tile.
See the JPEG Draft International Standard (ISO DIS 10918-1) for more informa-
tion about the restart interval and restart markers.
If this Field is zero or is not present, the compressed data does not contain restart
markers.
JPEGLosslessPredictors
Tag = 517 (205.H)
Type = SHORT
N = SamplesPerPixel
This Field points to a list of lossless predictor-selection values, one per compo-
nent.
The allowed predictors are listed in the following table.
Selection-value Prediction
1 A
2 B
3 C
4 A+B-C
5 A+((B-C)/2)
6 B+((A-C)/2)
7 (A+B)/2
A, B, and C are the samples immediately to the left, immediately above, and
diagonally to the left and above the sample to be coded, respectively.
See the JPEG Draft International Standard (ISO DIS 10918-1) for more details.
This Field is mandatory whenever the JPEGProc Field specifies one of the
lossless processes (no default).
JPEGPointTransforms
Tag = 518 (206.H)
Type = SHORT
N = SamplesPerPixel
106
TIFF 6.0 Specification Final—June 3, 1992
This Field points to a list of point transform values, one per component. This Field
is relevant only for lossless processes.
If the point transformation value is nonzero for a component, a point transforma-
tion of the input is performed prior to the lossless coding. The input is divided by
2**Pt, where Pt is the point transform value. The output of the decoder is rescaled
to the input range by multiplying by 2**Pt. Note that the scaling of input and
output can be performed by arithmetic shifts.
See the JPEG Draft International Standard (ISO DIS 10918-1) for more details.
The default value of this Field is 0 for each component (no scaling).
JPEGQTables
Tag = 519 (207.H)
Type = LONG
N = SamplesPerPixel
This Field points to a list of offsets to the quantization tables, one per component.
Each table consists of 64 BYTES (one for each DCT coefficient in the 8x8 block).
The quantization tables are stored in zigzag order.
See the JPEG Draft International Standard (ISO DIS 10918-1) for more details.
It is strongly recommended that, within the TIFF file, each component be assigned
separate tables. This Field is mandatory whenever the JPEGProc Field specifies a
DCT-based process (no default).
JPEGDCTables
Tag = 520 (208.H)
Type = LONG
N = SamplesPerPixel
This Field points to a list of offsets to the DC Huffman tables or the lossless
Huffman tables, one per component.
The format of each table is as follows:
16 BYTES of “BITS”, indicating the number of codes of lengths 1 to 16;
Up to 17 BYTES of “VALUES”, indicating the values associated with
those codes, in order of length.
See the JPEG Draft International Standard (ISO DIS 10918-1) for more details.
It is strongly recommended that, within the TIFF file, each component be assigned
separate tables. This Field is mandatory for all JPEG processes (no default).
JPEGACTables
Tag = 521 (209.H)
Type = LONG
N = SamplesPerPixel
107
TIFF 6.0 Specification Final—June 3, 1992
This Field points to a list of offsets to the Huffman AC tables, one per component.
The format of each table is as follows:
16 BYTES of “BITS”, indicating the number of codes of lengths 1 to 16;
Up to 256 BYTES of “VALUES”, indicating the values associated with
those codes, in order of length.
See the JPEG Draft International Standard (ISO DIS 10918-1) for more details.
It is strongly recommended that, within the TIFF file, each component be assigned
separate tables. This Field is mandatory whenever the JPEGProc Field specifies a
DCT-based process (no default).
108
TIFF 6.0 Specification Final—June 3, 1992
Minimum Requirements for TIFF with JPEG Compression
The table on the following page shows the minimum requirements of a TIFF file
that uses tiling and contains JPEG data compressed with the Baseline process.
Tag = NewSubFileType (254) Single image
Type = Long
Length = 1
Value = 0
Tag = ImageWidth (256)
Type = Long
Length = 1
Value = ?
Tag = ImageLength (257)
Type = Long
Length = 1
Value = ?
Tag = BitsPerSample (258) 8 : Monochrome
Type = Short 8,8,8 : RGB
Length = SamplesPerPixel 8,8,8 : YCbCr
Value = ? 8,8,8,8 : CMYK
Tag = Compression (259) 6 : JPEG compression
Type = Long
Length = 1
Value = 6
Tag = PhotometricInterpretation (262) 0,1 : Monochrome
Type = Short 2 : RGB
Length = 1 5 : CMYK
Value = ? 6 : YCbCr
Tag = SamplesPerPixel (277) 1 : Monochrome
Type = Short 3 : RGB
Length = 1 3 : YCbCr
Value = ? 4 : CMYK
Tag = XResolution (282)
Type = Rational
Length = 1
Value = ?
Tag = YResolution (283)
Type = Rational
Length = 1
Value = ?
Tag = PlanarConfiguration (284) 1 : Block Interleaved
Type = Short 2 : Not interleaved
Length = 1
Value = ?
Tag = ResolutionUnit (296)
Type = Short
Length = 1
Value = ?
Tag = TileWidth (322) Multiple of 8
Type = Short
Length = 1
Value = ?
Tag = TileLength (323) Multiple of 8
Type = Short
Length = 1
Value = ?
Tag = TileOffsets (324)
Type = Long
Length = Number of tiles
Value = ?
Tag = TileByteCounts (325)
Type = Long
Length = Number of tiles
Value = ?
Tag = JPEGProc (512) 1 : Baseline process
Type = Short
Length = 1
Value = ?
Tag = JPEGQTables (519) Offsets to tables
Type = Long
Length = SamplesPerPixel
Value = ?
Tag = JPEGDCTables (520) Offsets to tables
Type = Long
Length = SamplesPerPixel
Value = ?
Tag = JPEGACTables (521) Offsets to tables
Type = Long
Length = SamplesPerPixel
Value = ?
References
[1] Wallace, G., “Overview of the JPEG Still Picture Compression Algorithm”,
Electronic Imaging East ’90.
[2] ISO/IEC DIS 10918-1, “Digital Compression and Coding of Continuous-tone
Still Images”, Sept. 1991.
109
TIFF 6.0 Specification Final—June 3, 1992
Section 23: CIE L*a*b* Images
What is CIE L*a*b*?
CIE La*b* is a color space that is colorimetric, has separate lightness and chroma
channels, and is approximately perceptually uniform. It has excellent applicability
for device-independent manipulation of continuous tone images. These attributes
make it an excellent choice for many image editing functions.
1976 CIEL*a*b* is represented as a Euclidean space with the following three
quantities plotted along axes at right angles: L* representing lightness, a* repre-
senting the red/green axis, and b* representing the yellow/blue axis. The formulas
for 1976 CIE L*a*b* follow:
L*=116(Y/Yn)1/3-16 for Y/Yn > 0.008856
L*=903.3(Y/Yn) for Y/Yn <= 0.008856 *see note below.
a*=500[(X/Xn)1/3-(Y/Yn)1/3]
b*=200[(Y/Yn)1/3-(Z/Zn)1/3].
where Xn,Yn, and Zn are the CIE X, Y, and Z tristimulus values of an appropriate
reference white. Also, if any of the ratios X/Xn, Y/Y n, or Z/Z n is equal to or less than
0.008856, it is replaced in the formulas with
7.787F + 16/116,
where F is X/Xn, Y/Yn, or Z/Zn, as appropriate (note: these low-light conditions are
of no relevance for most document-imaging applications). Tiff is defined such
that each quantity be encoded with 8 bits. This provides 256 levels of L* lightness;
256 levels (+/- 127) of a*, and 256 levels (+/- 127) of b*. Dividing the 0-100
range of L* into 256 levels provides lightness steps that are less than half the size
of a “just noticeable difference”. This eliminates banding, even under conditions
of substantial tonal manipulation. Limiting the theoretically unbounded a* and b*
ranges to +/- 127 allows encoding in 8 bits without eliminating any but the most
saturated self-luminous colors. It is anticipated that the rare specialized applica-
tions requiring support of these extreme cases would be unlikely to use CIELAB
anyway. All object colors, in fact all colors within the theoretical MacAdam lim-
its, fall within the +/- 127 a*/b* range.
110
Previous Next