1# Color Space 2 3The color space extension is used to communicate color space information and 4optionally also metadata that is needed in order to properly render a high 5dynamic range (HDR) video stream. Contact <[email protected]> for more info. 6 7**Name:** "Color space" ; "RTP Header Extension for color space" 8 9**Formal name:** <http://www.webrtc.org/experiments/rtp-hdrext/color-space> 10 11**Status:** This extension is defined here to allow for experimentation. Once experience 12has shown that it is useful, we intend to make a proposal based on it for standardization 13in the IETF. 14 15## RTP header extension format 16 17### Data layout overview 18Data layout without HDR metadata (one-byte RTP header extension) 19 1-byte header + 4 bytes of data: 20 21 0 1 2 3 22 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 23 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 24 | ID | L = 3 | primaries | transfer | matrix | 25 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 26 |range+chr.sit. | 27 +-+-+-+-+-+-+-+-+ 28 29Data layout of color space with HDR metadata (two-byte RTP header extension) 30 2-byte header + 28 bytes of data: 31 32 0 1 2 3 33 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 34 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 35 | ID | length=28 | primaries | transfer | 36 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 37 | matrix |range+chr.sit. | luminance_max | 38 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 39 | luminance_min | mastering_metadata.| 40 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 41 |primary_r.x and .y | mastering_metadata.| 42 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 43 |primary_g.x and .y | mastering_metadata.| 44 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 45 |primary_b.x and .y | mastering_metadata.| 46 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 47 |white.x and .y | max_content_light_level | 48 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 49 | max_frame_average_light_level | 50 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 51 52### Data layout details 53The data is written in the following order, 54Color space information (4 bytes): 55 * Color primaries value according to ITU-T H.273 Table 2. 56 * Transfer characteristic value according to ITU-T H.273 Table 3. 57 * Matrix coefficients value according to ITU-T H.273 Table 4. 58 * Range and chroma siting as specified at 59 https://www.webmproject.org/docs/container/#colour. Range (range), horizontal (horz) 60 and vertical (vert) siting are merged to one byte by the operation: (range << 4) + 61 (horz << 2) + vert. 62 63The extension may optionally include HDR metadata written in the following order, 64Mastering metadata (20 bytes): 65 * Luminance max, specified in nits, where 1 nit = 1 cd/m<sup>2</sup>. 66 (16-bit unsigned integer) 67 * Luminance min, scaled by a factor of 10000 and specified in the unit 1/10000 68 nits. (16-bit unsigned integer) 69 * CIE 1931 xy chromaticity coordinates of the primary red, scaled by a factor of 50000. 70 (2x 16-bit unsigned integers) 71 * CIE 1931 xy chromaticity coordinates of the primary green, scaled by a factor of 50000. 72 (2x 16-bit unsigned integers) 73 * CIE 1931 xy chromaticity coordinates of the primary blue, scaled by a factor of 50000. 74 (2x 16-bit unsigned integers) 75 * CIE 1931 xy chromaticity coordinates of the white point, scaled by a factor of 50000. 76 (2x 16-bit unsigned integers) 77 78Followed by max light levels (4 bytes): 79 * Max content light level, specified in nits. (16-bit unsigned integer) 80 * Max frame average light level, specified in nits. (16-bit unsigned integer) 81 82Note, the byte order for all integers is big endian. 83 84See the standard SMPTE ST 2086 for more information about these entities. 85 86Notes: Extension should be present only in the last packet of video frames. If attached 87to other packets it should be ignored. 88 89