C.7.9.2 Segmented Palette Color Lookup Table Data

The Segmented Palette Color Lookup Table Data (0028,1221-1223) is stored as a series of segments, see Table C.7-23. When the segments are expanded into the actual lookup table data, it shall have the number of table entries specified by the first value of the Palette Color Lookup Table Descriptors (0028,1101-1103), Number of Table Entries.

These lookup tables shall be used only when segmented lookup table data use is desriable and there is a single sample per pixel (single image plane) in the image.

Table C.7-23COMPRESSED PALETTE COLOR LOOKUP TABLE DATA

Segment 0
Segment 1
...
Segment n

There are currently three types of segments: discrete, linear, and indirect. The segments type is identified by the opcodes in Table C.7-24:

Table C.7-24SEGMENT TYPES

Opcode Segment type
0 Discrete
1 Linear
2 Indirect
3 & above reserved

C.7.9.2.1 Discrete Segment Type

The discrete segment is used to represent a series of palette components which are not monotonic with respect to their predecessors or successors. The SegmentLength indicates the number of lookup table entries.

The format of the Discrete Segment Type shall be as in Table C.7-25:

Table C.7-25DISCRETE SEGMENT TYPE

Segment Opcode = 0
Segment Length
Segment Length number of lookup table entries

C.7.9.2.2 Linear Segment Type

The linear segment represents a series of palette components whose values may be represented by a straight line.

X = palette address, Y = Value contained in the palette.

(Xo, Yo) = end of the previous segment

(Xo + SegmentLength, Y1) = end of this linear segment

Where: Y1 is contained in the data portion of this segment.

During expansion, the application should “connect” the previous segment’s endpoint, (Xo, Yo), with this segment’s endpoint, (Xo + SegmentLength, Y1) using a straight line, by computing the values for each point between the endpoints.

Note: Because the linear segment uses the end point from the previous segment, a linear segment can not be the first segment.

The linear segment’s format shall be as as in Table C.7-26:

Table C.7-26LINEAR SEGMENT TYPE

Segment Opcode = 1
SegmentLength
Y1

C.7.9.2.3 Indirect Segment Type

The indirect segment allows the re-use of repetitive regions within lookup table without respecifying the segment. The opcode is followed by the number of segments to copy and one offset pointer to the first segment to copy. The byte offset is relative to the beginning of the lookup table. For example, if an indirect segment wants to point to the first segment, then the offset will be zero. The offset is a 32 bit value but is stored in the segment as a least significant 16 bit value followed by a most significant 16 bit value. An indirect segment shall not point to or copy another indirect segment. This avoids the need for recursion and also avoids the possibility of infinite loops.

The indirect segment’s format shall be as follows:

Table C.7-27INDIRECT SEGMENT TYPE

Segment Opcode = 2
Number of segments to copy
Least significant 16 bits of byte offset to first segment to copy
Most significant 16 bits of byte offset to first segment to copy