Color Encoding for Gamut Extension and Bit-depth Extension Huanzhao Zeng* Hewlett-Packard Company 18110 SE 34th St. Vancouver, WA ABSTRACT Monitor oriented RGB color spaces (e.g. sRGB) are widely applied for digital image representation for the simplicity in displaying images on monitor displays. However, the physical gamut limits its ability to encode colors accurately for color images that are not limited to the display RGB gamut. To extend the encoding gamut, non-physical RGB primaries may be used to define the color space, or the RGB tone ranges may be extended beyond the physical range. An out-of-gamut color has at least one of the R, G, and B channels that are smaller than 0 or higher than 100%. Instead of using wide-gamut RGB primaries for gamut expansion, we may extend the tone ranges to expand the encoding gamut. Negative tone values and tone values over 100% are allowed. Methods to efficiently and accurately encode outof-gamut colors are discussed in this paper. Interpretation bits are added to interpret the range of color values or to encode color values with a higher bit-depth. The interpretation bits of R, G, and B primaries can be packed and stored in an alpha channel in some image formats (e.g. TIFF) or stored in a data tag (e.g. in JEPG format). If a color image does not have colors that are out of a regular RGB gamut, a regular program (e.g. Photoshop) is able to manipulate the data correctly. Keywords: color encoding, color gamut, color space, color image
1. INTRODUCTION Display monitors are the most convenient media for displaying digital images. Representing color information of digital images in a display RGB color space is straightforward and simple for displaying on monitors. In most applications, 8-bit/channel physical based display RGB color spaces (e.g. sRGB) are accurate enough for digital color image representation. Since RGB color spaces of different display monitors are slightly different, the standard sRGB monitor color space has been developed and widely accepted for storing digital images so that it can be displayed in a reasonable accuracy without any color correction for individual displays1, 2. As a standard color space for typical physical CRT monitors, sRGB encodes the color gamut of the sRGB monitor, but it may not be able to encode all colors that can be display in a physical monitor. Fig. 1 shows the sRGB gamut in sRGB color space and CIE LAB color space.
Fig. 1 sRGB gamut: a) in RGB color space and b) in CIE LAB color space
6
Electronic Imaging and Multimedia Technology IV, edited by Chung-Sheng Li, Minerva M. Yeung, Proc. of SPIE Vol. 5637 (SPIE, Bellingham, WA, 2005) 0277-786X/05/$15 · doi: 10.1117/12.568467
As a standard color space, sRGB approximately encodes the gamut of typical monitors. Any colors that are out of the sRGB color space cannot be represented in sRGB color space. This is a serious problem for representing printer CMYK based color images. Fig. 2 shows sRGB gamut and a printer gamut in sRGB and CIE LAB color space. Although sRGB color space is larger than the printer gamut, it does not contain all printable colors. In other words, if sRGB values are limited to the physical range, a portion of the printer color gamut cannot be represented in the sRGB color space. Fig 2-a shows that the printer colors that are out of the sRGB gamut must be represented with negative or higher than 100% RGB physical tone values.
Fig. 2 sRGB gamut (transparent) and a printer gamut (solid color): a) in sRGB color space; and b) in L*a*b* color space.
If the color gamut of a physical device cannot be fitted into the sRGB gamut, the gamut of this device must be compressed or the out-of-gamut colors must be clipped to hold into the sRGB gamut. This causes a problem for accurate color space transformation. There are two basic approaches to modify an RGB color space to encode a larger gamut. A popular approach is to move red (R), green (G), and/or blue (B) primaries further away from the white point. Fig. 3 shows two RGB gamut sets defined by two RGB primary sets, respectively. An RGB gamut is enlarged if R, G, and/or B points are moved further off the white point (i.e. making R, G, and B phosphors purer). A non-physical additive RGB color space can be defined by this method. Examples of this kind of color spaces are Adobe RGB, CIE RGB, and ROMM RGB3. By extending the RGB encoding gamut without increasing the encoding bit-depth, the quantization error of the encoding is increased. An 8-bit/channel (or 24-bit per color) RGB color space is able to represent 28x3 = 16,777,216 different colors. With a larger gamut and the same encoding color amounts, the difference between two neighbor colors becomes larger. This may introduce visible quantization errors4. Increasing the bit-depth solves the problem. Because most existing software can only handle 8-bit/channel or 16-bit/channel color data, 16-bit/channel must be used to reduce quantization error, which doubles the memory of the image representation.
Proc. of SPIE Vol. 5637
7
An out-of-gamut color has at least one of the R, G, and B channels that are smaller than 0 or higher than 100%. To encode out-of-gamut colors, another approach is to use physical RGB primaries (e.g. sRGB primaries) and to extend the RGB tone range, i.e. to extend the tone range in the lower end to allow negative tones and to extend the higher end to allow higher than 100% tone values. Fig. 2-a shows that a CMYK printer gamut can be encoded by sRGB color space with RGB ranges extended to less than 0% and higher than 100%. An example of this kind of color spaces is the e-sRGB color space5. With this method, more than 8-bit/channel representation must be used to achieve at least the same accuracy as using the representation by the regular tone range. Because software implementation is normally based on 8-bit bytes, it usually use 16-bit/channel representation even if less than 16 bits are sufficient. Storage for images and memory usage are not efficient for handling this kind of gamut extended images.
Fig. 3 Gamut of sRGB and Adobe RGB: a) in CIE x-y coordinate system and b) in CIE LAB space (the one with smaller gamut is sRGB)
Kodak ERI software uses a limited gamut image and a residual image to represent an extended gamut image7. A gamut mapping is applied to map an image from the extended gamut to the limited gamut. In this step, sophisticated gamut mapping methods may be required, and accurate reversion to reconstruct an extended gamut image from both the limited gamut image and the residual image may be impossible. In this paper, several efficient encoding methods for gamut extension and bit-depth extension are described. Physical RGB primaries are applied to encode color information. To solve the problem that the encoding gamut is limited by physical primaries, the RGB tone ranges are extended beyond the 0 to 100% range. We developed a smart method to separate the regular [0, 100%] values and the out-of-gamut values (values lower than 0 and values higher than 100%). If a color image does not have colors that are out of the regular RGB gamut, a regular program (e.g. Photoshop) can still manipulate the data correctly. Special encoding and decoding methods are required to construct colors that are out of the regular gamut. Methods for gamut extension and bit-depth extension are described in the next section. Section 3 is the discussion. Section 4 is the conclusion remark.
2. GAMUT EXTENSION AND BIT-DEPTH EXTENSION
8
Proc. of SPIE Vol. 5637
The 8-bit/channel additive display RGB color space (e.g. sRGB) is a very popular color space for color image representation. The 8-bit/channel is mostly sufficiently accurate for representing monitor RGB colors. An advantage of using monitor RGB color spaces is the simplicity in displaying colors on a display monitor screen. A disadvantage of using a physical monitor RGB color space is the limitation of the color gamut. Fig. 2 shows that a monitor RGB color space limited in the regular tone range is not able to represent the entire printer gamut. Applying a non-physical RGB color space (e.g. Adobe RGB as shown in Fig. 3 or ROMM RGB) solves this problem. To display an image stored by a color space using non-physical RGB primaries, the RGB values in each image pixel is first converted to the linear RGB using a power functions or 1-D lookup tables (LUT), followed by the conversion from the linear RGB to CIE XYZ using a 3x3 matrix (or 3x4 matrix to include flare), followed by the conversion from CIE XYZ to the linear RGB of the physical monitor device using another 3x3 or 3x4 matrix, followed by the conversion from the linear RGB to gamma corrected RGB using another set of power functions or 1-D LUTs. This process is usually performed by a 3-D interpolation with optional 1-D transformations in the ICC color management system7 - 9. If the non-physical RGB color space represents a much larger gamut than a physical RGB color space, more than 8-bit/channel is required to achieve equivalent 8-bit precision in a physical RGB color space. 16-bit/channel is often applied in software development for simple implementation, although 9 or 10 bits per channel may be enough. To develop a more efficient method for image representation, we apply a physical monitor RGB color space and extend the RGB range. If image gamut is inside the regular RGB range, this approach is compatible with existing methods that use a physical monitor RGB color space and 8-bit/channel for the regular tone range. The RGB tone ranges are extended to represent a larger gamut. Extra bits stored in an extra channel or an extra tag is used to interpret the extended tone range. An 8-bit value (bit-depth n = 8) has 28 = 256 different components. For 8-bit/channel RGB images, each channel has 256 different gradients from 0% (black) to 100% (full saturated pure primary color). To extend the color gamut, we may allow negative tone values and higher than 100% tone values. For example, if we use 9-bit/channel, there are 29 = 512 color values. We may use following equations to encode RGB colors in the range of -128 and 383, where 383 = 511-128. R e = R + 128 Ge = G + 128 Be = B + 128 Although this looks very simple, there are difficulties for implementing a 9-bit data type in software implementation and the compatibilities with existing software is even more difficult. To solve these problems, instead of representing 9-bit data in a straight-forward way, we can use an 8-bit data type plus a one-bit interpretation. If the interpretation bit is zero, the 8-bit data is in the regular range between 0 and 255. If the interpretation bit is 1, the lower half range (0 to 128) represents the negative value and the higher half range (129 to 255) represents the value higher than 255. More details are presented in following sub-sections.
2.1. Using interpretation bits to extend tone range If we use k interpretation bits to interpret n-bit data for each of R, G, and B channels, each image pixel will have 3 ⋅ (k + n) bits. To simplify the description, we use n = 8, i.e. each color value is 8 bits. If k = 1, we have one bit to interpret the meaning of an 8-bit byte. The 8-bit/channel is still used to encode each image pixel. The interpretation bit has 21 = 2 different values. This means that the value of the 8-bit data can be interpreted in two different ways, depending on the value of the interpretation bits, allowing for up to 2 x 256 = 512 different color values. For the first value of the interpretation bits, the 8-bit value represents the color values in the normal range of 0 to 255. For the second value of the interpretation bits, if the most significant bit of the 8-bit value is 1, the color value is 256 plus the value of the remaining 7 bits of the 8-bit value. Otherwise, the color value is -1 - the remaining 7 bits. Thus the total tone range becomes [0-128, 255+128] or [-128, 383]. Fig. 4 shows the decoding flow. An extra channel (8 bits) (e.g. an α-channel in the TIFF format) can be used to hold the three interpretation bits of each pixel. Thus four bytes are used to encode one pixel. In JPEG format, extra bits can be stored in a data tag. If a color image is represented in this color space without out-of-gamut colors, the extra bits are all zero and data in the regular channels are in the 0 to 255 range. A regular software program is able to read this image correctly. If a color image is
Proc. of SPIE Vol. 5637
9
represented in this color space with some out-of-gamut colors, a regular method will not read those out-of-gamut pixels correctly.
8-bit data + 1-bit interpretation
Interpretation bit=0 Yes
Color value = the 8-bit value
No
1st significant bit of the data=0 No
Color value = 256 + the remaining 7-bit value
Yes Color value = -1 the remaining 7-bit value
Fig. 4 Gamut extension using a 9-bit color component represented by 1-bit interpretation plus 8-bit data
2.2. Using interpretation bits to increase bit-depth Instead of using interpretation bits to extend the gamut, they can be used to increase the precision. For the first value of the interpretation bits, the 8-bit value represents the color values in the integer range of 0 to 255. For the other value of the interpretation bits, the 8-bit value represents the color values of the 8-bit data plus 0.5, i.e. 0.5, 1.5, 2.5, …, 255.5. Thus, the encoding precision is increased. Fig. 4 shows the decoding flow.
8-bit data + 1-bit interpretation
Interpretation bit=0 Yes
Color value = the 8-bit value
No
Color value = 0.5 + the 8-bit value
Fig. 5 Bit-depth extension using a 9-bit color component represented by 1-bit interpretation plus 8-bit data
10
Proc. of SPIE Vol. 5637
Again, an extra channel (8 bits) or tag can be used to hold three interpretation bits. Thus four bytes are used to encode one pixel. A regular method that does not understand this kind of bit-depth extension still read image data correctly, but it loses the advantage of extra precision. 2.3 Using interpretation bits to extend tone range and to extend bit-depth simultaneously If an extra channel (8 bits) is used to represent the interpretation bits, up to 8 interpretation bits for each pixel can be used to extend the gamut and to increase the bit-depth simultaneously. If two interpretation bits are used to interpret the 8-bit data, one interpretation bit can be used to interpret tone range and the other can be used to interpret bit-depth. The value of the 8 bits can be interpreted in four different ways, depending on the value of the interpretation bits, allowing for up to 4 x 255 = 1,024 different color values. For the first two interpretation values, the 8-bit data can be used to represent values as described in section 2.1 for tone range extension (gamut extension). For the remaining two interpretation values, the 8-bit data can be used to represent the corresponding values interpreted with the first interpretation bit + 0.5. Thus, the 10-bit/channel (8-bit data + 2-bit interpretation) represents values from -128 to 255+128+0.5 at the interval of 0.5. Fig. 6 shows the decoding flow. Again, the 6 interpretation bits can be stored in an extra 8-bit channel. If 8 bits are used to store the interpretation bits for each pixel, there are still two remaining bits not being used. These two bits can be used to further interpret bit-depth or tone range for two channels, such as R and G channels.
8-bit data + 2-bit interpretation
Check interpretation bits
0
1
Color value = the 8-bit value
3
2
Color value = 0.5 + the 8-bit value
1st significant bit of the data=0 Yes
1st significant bit of the data=0 Yes
No Color value = -1 the remaining 7-bit value
Color value = 256 + the remaining 7-bit value
No Color value = -1 the remaining 7-bit value + 0.5
Color value = 256 + the remaining 7-bit value + 0.5
Fig. 6 Gamut extension and bit-depth extension using a 10-bit color component represented by 2-bit interpretation plus 8-bit data
Proc. of SPIE Vol. 5637
11
3. DISCUSSION Using physical monitor RGB primaries to define an RGB color space, the combinations of the physical color tone range of each channel from 0 to 100% represents the physical gamut of the monitor. The physical range of the color space is not able to represents colors that are out of the monitor gamut. For example, the high chromatic cyan colors printed by a color printer may be out of a monitor color space gamut, and they cannot be encoded by a physical monitor color space. We extend the color range, use extra bits to interpret the region of the color value and/or increase the bit-depth of the color value. The sum of the interpretation bits of R, G, and B channels do not exceed the bits of one channel. Thus, an extra channel (e.g. the alpha channel in TIFF image format) or an extra data tag (e.g. in JPEG image format) can be used to store the interpretation bits (the interpretation bits of all three R, G, and B channels). The extra channel can be compressed by a lossless compression method. If an image is mostly in the regular gamut and the method to increase the bit-depth is not used, this plane becomes highly compressible, thus the image size is not much increased. To display an extended gamut image on an RGB display, the negative values can be simply clipped to zero and the values higher than 255 can be clipped to 255. Thus, displaying this kind of images is very simple and efficient. More sophisticated gamut mapping methods can be applied to compress the extended gamut data to the monitor gamut for display. The RGB gamma correction curves are defined or physical modeled in the physical range of 0 to 255. Fig. 7 shows the sRGB tone curve, which is defined in the range of 0 to 255. To extend the tone range, a gamma curve for the extend range must be defined. Fig. 8 is an example gamma curve for tone extension. Basically, the curve must be smoothly extended out of the normal range. 250
400 200
Linearized tone v alue
Linearized ton e valu e
300
150
100
200
100
50
0 -150 0 0
50
100
150
200
50
150
250
3 50
-100
250
Tone value
Ton e value
Fig. 7 sRGB gamma curve
-5 0
Fig. 8 A tone curve extended beyond the physical range
4. CONCLUSIONS Using extra interpretation bits to interpret the regular color values, the color encoding range is expanded and bit-depth is increased. Both the encoding gamut and encoding precision are increased. The interpretation bits of all three channels in each pixel can be stored in an extra channel in some image format, such as TIFF. The extra bits of an image can also be stored in data tags in some other image formats, such as JPEG. If the interpretation bits are used to extend the gamut encoding and are held in a separate plane, the interpretation data are highly compressible. Displaying images encoded with extra interpretation bits is very efficient. The out of physical range values can be simply clipped to the physical range. To display out-of-gamut colors for gamut warning, we need to check only the range interpretation bits. Existing software is able to read in-gamut colors correctly. Software that understands gamut extension bit-depth extension is required for decoding out-of-gamut colors correctly and for decoding the extra bitdepth.
12
Proc. of SPIE Vol. 5637
REFERENCES 1. 2. 3.
4.
5. 6. 7. 8. 9.
M. Stokes, S. Chandrasekar, and R. Motta, “A Standard Default Color Space for the Internet –sRGB”, http://www.color.org/sRGB.html M. Nielsen and M. Stokes, “The Creation of the sRGB ICC Profile”, IS&T/SID 6th Color Imaging Conference: Color Science, Systems, and Applications, 253-257 (1998). K. Spaulding, G. Woolfe, and E. Giorgianni, “Reference Input/Output Medium Metric RGB Color Encodings (RIMM/ROMM RGB)”, IS&T PICS 2000: Image Processing, Image Quality, Image Capture, Systems Conference, 155-163 (2000). G. Braun and K. Spaulding, “Method for Evaluation the Color Gamut and Quantization Characteristics of OutputReferred Extended-Gamut Color Encodings”, IS&T/SID 10th Color Imaging Conference: Color Science, Systems, and Applications, 99-105 (2002). “Photography – Electronic still picture imaging – Extended sRGB color encoding – e-sRGB”, PIMA 7667-2001. A. McCarthy, K. Spaulding, and E. Giorgianni, “Using a Residual Image to Represent an Extended Color Gamut Digital Image”, US Patent 6,282,311, 2001. http://www.color.org H. Zeng and M. Nielsen, “Color Transformation Accuracy and Efficiency in ICC Color Management”, Proc. IS&T/SIC 9th Color Imaging Conf., 224-232 (2001). H. Zeng, “Color Accuracy in ICC Color Management System”, IS&T PICS 2002: Image Processing, Image Quality, Image Capture, Systems Conference, 175-180 (2002).
*
[email protected]
Proc. of SPIE Vol. 5637
13