Component video colour coding for HD

Component video colour coding for HD

Component video colour coding for HD Before BT.709 was established, SMPTE 240M-1988 for 1035i30 HD standardized luma coefficients based upon the SMPT...

114KB Sizes 0 Downloads 96 Views

Component video colour coding for HD

Before BT.709 was established, SMPTE 240M-1988 for 1035i30 HD standardized luma coefficients based upon the SMPTE RP 145 primaries. Equipment deployed between about 1988 and 1997 used the 240M parameters, but SMPTE 240M is now obsolete. For details, see the first edition of this book.

30

In the previous chapter, Component video colour coding for SD, I detailed various component colour coding systems that use the luma coefficients specified in BT.601. Unfortunately, for no good technical reason, BT.709 for HD standardized different luma coefficients. Deployment of HD requires upconversion and downconversion capabilities both at the studio and at consumers’ premises; this situation will persist for a few decades. Owing to this aspect of conversion between HD and SD, if you want to be an HD expert, you have to be an SD expert as well! Today’s computer imaging systems – for still frames, desktop video, and other applications – typically use the BT.601 parameters, independent of the image’s pixel count (“resolution independence”). In computer systems that perform HD editing, it is highly desirable that all of the content on the same timeline uses the same colour coding, but there’s no simple answer whether BT.601 or BT.709 coding should be used. Generally, it is sensible to retain the BT.601 coefficients. In this chapter, I assume that you’re familiar with the concepts of Luma and colour differences, described on page 335. I will detail these component sets: • B’-Y’, R’-Y’ components, the basis for PBPR and CBCR • PBPR components, used for analog interfaces • CBCR components, used for digital interfaces B’-Y’, R’-Y’ components for BT.709 HD The B’-Y’ component reaches its positive maximum at blue (R’ = 0, G’ = 0, B’ = 1). With BT.709 luma coefficients, the maximum of B’-Y’ = +0.9278 occurs at

369

+1

R’-Y’ axis

R

+0.7874 Mg +0.9278

Yl -1

B +1 B’-Y’ axis

0

G G

Figure 30.1 B’-Y’, R’-Y’ components for BT.709 HD

Cy -1

Y’ = 0.0722. The B’-Y’ component reaches its negative maximum at yellow (B’-Y’ = -0.9278). Analogously, the extrema of R’-Y’ occur at red and cyan at values ±0.7874 (see Figure 30.1 above). These are inconvenient values for both digital and analog systems. The 709Y’P P and 709Y’C C systems to be described both B R B R employ versions of [Y’, B’-Y’, R’-Y’] that are scaled to place the extrema of the component values at more convenient values. To obtain [Y’, B’-Y’, R’-Y’], from R’G’B’, for BT.709 luma coefficients, use this matrix equation:  709Y '    B'−709Y ' =   R'−709Y '  

 0.2126 0.7152 0.0722 R'      − 0.2126 − 0.7152 0.9278 • G'  0.7874 − 0.7152 − 0.0722 B'     

Eq 30.1

PBPR components for BT.709 HD If two colour difference components are to be formed having excursions identical to luma, then PB and PR colour difference components are used. For BT.709 luma, the equations are these: 0.5 1   B'−709Y ' = B'−709Y '    1 − 0.0722 1.8556  0 . 5 1 709  R'−709Y ' =  R'−709Y ' PR =   1 − 0.2126  1.5748  709

Eq 30.2

370

PB =

≈ 0.5389  B'−709Y' ≈ 0.6350  R'−709Y'

DIGITAL VIDEO AND HD ALGORITHMS AND INTERFACES

+0.5 PR axis R

Mg

Yl -0.5

Figure 30.2 PBPR components for BT.709 HD

B +0.5 PB axis

0

G

Cy -0.5

These scale factors limit the excursion of each colour difference component to the range ±0.5 with respect to unity luma excursion: 0.0722 in the first expression above is the luma coefficient of blue, and 0.2126 in the second is for red. At an HD analog interface, luma ranges from 0 mV (black) to 700 mV (white), and PB and PR analog components range ±350 mV. Figure 30.2 above shows a plot of the [PB , PR] plane. Expressed in matrix form, the B’-Y’ and R’-Y’ rows of Equation 30.1 are scaled by 0.5⁄ 0.9278 and 0.5⁄ 0.7874. To encode from R’G’B’ where reference black is zero and reference white is unity:

Eq 30.3

 709Y '    PB  =    PR 

 0.2126 0.7152 0.0722  R'      0.5  • G' − 0.114572 − 0.385428  B'   0.5 − − 0 . 454153 0 . 045847    

The inverse, decoding matrix is this: R'    G' = B'   

1  1 1 

0 1.5748   709Y '    − 0.187324 − 0.468124  •  PB    P  1.8556 0   R 

Eq 30.4

CBCR components for BT.709 HD 709Y’C C B R

coding is used in component digital HD equipment. In 8-bit systems, luma has an excursion of 219. Colour differences CB and CR are coded in 8-bit

CHAPTER 30

COMPONENT VIDEO COLOUR CODING FOR HD

371

Figure 30.3 CBCR components for BT.709 HD are shown referenced to 8-bit processing levels. At an 8-bit interface, an offset of +128 is added to each component.

+112 CR axis R

Mg

Yl -112

B +112 CB axis

0

G

Cy -112

offset binary form, with excursions of ±112. The [CB , CR ] plane of HD is plotted in Figure 30.3. In 8-bit systems, a luma offset of +16 is added at the interface, placing black at code 16 and white at code 235; an offset of +128 is added to CB and CR , yielding a range of 16 through 240 inclusive. (Following the convention of the previous chapter, in the equations to follow I write the offset terms in colour.) HD standards provide for 10-bit components, and 10-bit studio video equipment is commonplace. In a 10-bit interface, the 8-bit interface levels and prohibited codes are maintained; the extra two bits are appended as least-significant bits to provide increased precision. To form 709Y’CBCR from [Y’, B’-Y’, R’-Y’] components in the range [0…+1], use these equations: Eq 30.5

709 219Y’ = 16 +

(219 ⋅

709

Y’

( (

)

112 B’ 709Y’ 0.9278 112 CR = 128 + R’ 709Y’ 0.7874 CB = 128 +

) )

To obtain 709Y’CBCR from R’G’B’ ranging 0 to 1, scale the rows of the matrix in Equation 30.3 by the factors

372

DIGITAL VIDEO AND HD ALGORITHMS AND INTERFACES

[219, 224, 224], corresponding to the excursions of each of the components:

Eq 30.6

 709Y’  16   46.559  219      CB  = 128  +  25.664  C  128   112    R  

156.629 15.812  R’     86.336 112  · G’  101.730 10.270  B’ 

Summing the first row of the matrix yields 219, the luma excursion from black to white. The two entries of 112 reflect the positive CBCR extrema at blue and red. To recover R’G’B’ in the range [0…+1] from 709Y’C C , use the inverse of Equation 30.6: B R 219R’

Eq 30.7

219G’ 219B’

256 1 256 256 256

0 46.885 464.430

394.150 117.165 0

709 219Y’

CB CR

16 128 128

The 709Y’CBCR components are integers in 8 bits; reconstructed R’G’B’ is scaled to the range [0…+1]. Figure 28.2 (on page 339) illustrated that when R’G’B’ components are transformed to luma and colour differences, the unit R’G’B’ cube occupies only a small fraction of the volume of the enclosing cube. In digital video, only about 1⁄ 4 of Y’CBCR codewords correspond to R’G’B’ values between zero and unity. Certain signalprocessing operations (such as filtering) may produce Y’CBCR codewords that lie outside the RGB-legal cube. These codewords cause no difficulty in the Y’CBCR domain, but potentially present a problem when decoded to R’G’B’. Generally, R’G’B’ values are clipped between 0 and 1. CBCR components for xvYCC xvYCC refers to an IEC standard. x.v.Color and x.v.Colour are Sony’s trademarks for the scheme.

Concerning Pointer, see the marginal note on page 312.

CHAPTER 30

One method of extending the colour gamut of an R’G’B’ system is to allow components to excurse below zero and above unity. In Wide-gamut reproduction, on page 312, I explained one approach. The xvYCC scheme is based upon BT.709 primaries, but enables the RGB tristimulus components to excurse from -1⁄ 4 to +4⁄ 3 . When transformed to BT.709 Y’CBCR , all of the real surface colours documented by Pointer – that is, all the colours in Pointer’s gamut – produce values that are Y’CBCR -valid. Though BT.1361 was needed to specify the R’G’B’ representation of wide-gamut colours, no

COMPONENT VIDEO COLOUR CODING FOR HD

373

There is an SD version of xvYCC, using the BT.601 luma coefficients. That scheme will almost certainly never see any deployment.

special provisions are necessary to carry those colours across a 709Y’CBCR interface. The notation “xvYCC Y’CBCR,” or xvYCCY’CBCR , makes it explicit that codewords outside the unit R’G’B’ cube are to be interpreted as wide-gamut colours, instead of being treated as RGB-illegal. Studio equipment conforming to BT.1361 is not yet deployed, and is not anticipated for several years. Wide-gamut acquisition and production equipment will begin to replace film over the next decade or so; however, wide-gamut consumer displays are not expected in that time frame. When these begin to be deployed, it is unlikely that they will all have the same gamut; electronics associated with each display will have to process the colour signals according to the properties of each display. In the long term, gamut mapping strategies comparable to those in the desktop colour management community will have to be deployed. Y’CBCR from studio RGB In studio equipment, 8-bit R’G’B’ components usually use the same 219 excursion as the luma component of Y’CBCR. To encode Y’CBCR from R’G’B’ in the range [0…219] using 8-bit binary arithmetic, scale the encoding matrix of Equation 30.6 by 256⁄219:

Eq 30.8

 709Y’   16   54.426  219   1    CB  = 128  +  30.000  C  128  256  130.922    R  

183.091 18.483  219 R’    100.922 130.922 ·  219 G’ 118.918 12.005  219 B’ 

To decode to R’G’B’ in the range [0…219] from BT.709 Y’CBCR using 8-bit binary arithmetic: 219R’

Eq 30.9

219G’ 219B’

256 1 256 256 256

0 46.885 464.430

394.150 117.165 0

709 219Y’

CB CR

16 128 128

Y’CBCR from computer RGB In computing it is conventional to use 8-bit R’G’B’ components, with no headroom or footroom: Black is at code 0 and white is at 255. To encode Y’CBCR from

374

DIGITAL VIDEO AND HD ALGORITHMS AND INTERFACES

R’G’B’ in the range [0…255] using 8-bit binary arithmetic, the matrix of Equation 30.6 is scaled by 256⁄255:

Eq 30.10

 709 Y’  16   46.742  219   1    CB  = 128  +  25.765  C  128  256  112.439    R  

157.243 15.874  255 R’    86.674 112.439 ·  255 G’ 102.129 10.310  255 B’ 

To decode R’G’B’ in the range [0…255] from BT.709 Y’CBCR using 8-bit binary arithmetic:

Eq 30.11

0 298.082  255 R’ 1    = . .592 G’ 298 082 54  255  256  298.082 540.775  255 B’ 

 458.942   709 219Y’   136.425 ·   CB     C  0   R 

 16   128 128 

Conversions between HD and SD The differences among the EBU, SMPTE, and BT.709 primaries are negligible for practical purposes. New equipment should be designed to BT.709. Also, SD and HD have effectively converged to the transfer function specified in BT.709. Consequently, R’G’B’ coding uses essentially identical parameters worldwide, for SD and HD. (The sRGB standard for desktop computing uses the primaries of BT.709, but uses a different transfer function.) Unfortunately, as I have mentioned, the luma coefficients differ dramatically between SD and HD. This wouldn’t matter if HD systems were isolated! However, in practice, SD is upconverted and HD is downconverted, both at the studio and at consumers’ premises. Serious colour reproduction errors arise if differences among luma coefficients are not taken into account in conversions. In principle, downconversion can be accomplished by decoding 709Y’CBCR to R’G’B’ using a suitable 3×3 matrix (such as that in Equation 30.7, on page 373), then encoding R’G’B’ to 601Y’CBCR using another 3×3 matrix (such as that in Equation 29.6, on page 364).

CHAPTER 30

COMPONENT VIDEO COLOUR CODING FOR HD

375

The two 3×3 matrices can be combined so that the conversion can take place in one step:

Eq 30.12

Equations 30.12 and 30.13 are written without interface offsets of +16 for luma and +128 for CB and CB : If the offsets are present, remove them, transform, then reapply them.

Eq 30.13

 601Y '  219   CB  =    CR 

1  0 0 

 0.099312 0.191700  709 219Y '   0.989854 − 0.110653 •  CB    − 0.072453 0.983398  CR   

In the first row of the matrix, the coefficient 0.099312 adds about one-tenth of BT.709’s CB into BT.601’s luma. This is a consequence of BT.709’s blue luma coefficient being just 0.0722, compared to 0.114 for BT.601. The coefficient 0.1917 adds about one-fifth of BT.709’s CR into BT.601’s luma; this is a consequence of BT.709’s red luma coefficient being 0.2126, compared to 0.299 for BT.601. Clearly, failure to perform this colour transform produces large colour errors. To convert from SD to HD, the matrix of Equation 30.12 is inverted:  709Y'  219   CB  =    CR 

1  0 0 

601  − 0.115550 − 0.207938  219 Y'    1.018640 0.114618 •  CB    0.075049 1.025327  CR   

Unfortunately, to upconvert or downconvert a subsampled representation such as 4:2:2 or 4:2:0 requires chroma interpolation, colour transformation, then chroma subsampling. This is computationally intensive. Colour coding standards ITU-R Rec. BT.709 defines Y’PBPR for component analog HD and Y’CBCR for component digital HD. The parameters of Y’PBPR and Y’CBCR for the 1280×720 and 1920×1080 systems are defined by the SMPTE standards cited below. ITU-R Rec. BT.709, Basic parameter values for the HDTV standard for the studio and for international programme exchange. SMPTE ST 274, 1920 × 1080 Scanning and Analog and Parallel Digital Interfaces for Multiple Picture Rates. SMPTE ST 296, 1280 × 720 Progressive Image Sample Structure – Analog and Digital Representation and Analog Interface.

376

DIGITAL VIDEO AND HD ALGORITHMS AND INTERFACES