This source file includes following definitions.
- komeda_select_yuv2rgb_coeffs
1
2
3
4
5
6
7
8 #include "komeda_color_mgmt.h"
9
10
11 static const s32 yuv2rgb_bt601_narrow[KOMEDA_N_YUV2RGB_COEFFS] = {
12 1192, 0, 1634,
13 1192, -401, -832,
14 1192, 2066, 0,
15 64, 512, 512
16 };
17
18 static const s32 yuv2rgb_bt601_wide[KOMEDA_N_YUV2RGB_COEFFS] = {
19 1024, 0, 1436,
20 1024, -352, -731,
21 1024, 1815, 0,
22 0, 512, 512
23 };
24
25 static const s32 yuv2rgb_bt709_narrow[KOMEDA_N_YUV2RGB_COEFFS] = {
26 1192, 0, 1836,
27 1192, -218, -546,
28 1192, 2163, 0,
29 64, 512, 512
30 };
31
32 static const s32 yuv2rgb_bt709_wide[KOMEDA_N_YUV2RGB_COEFFS] = {
33 1024, 0, 1613,
34 1024, -192, -479,
35 1024, 1900, 0,
36 0, 512, 512
37 };
38
39 static const s32 yuv2rgb_bt2020[KOMEDA_N_YUV2RGB_COEFFS] = {
40 1024, 0, 1476,
41 1024, -165, -572,
42 1024, 1884, 0,
43 0, 512, 512
44 };
45
46 const s32 *komeda_select_yuv2rgb_coeffs(u32 color_encoding, u32 color_range)
47 {
48 bool narrow = color_range == DRM_COLOR_YCBCR_LIMITED_RANGE;
49 const s32 *coeffs;
50
51 switch (color_encoding) {
52 case DRM_COLOR_YCBCR_BT709:
53 coeffs = narrow ? yuv2rgb_bt709_narrow : yuv2rgb_bt709_wide;
54 break;
55 case DRM_COLOR_YCBCR_BT601:
56 coeffs = narrow ? yuv2rgb_bt601_narrow : yuv2rgb_bt601_wide;
57 break;
58 case DRM_COLOR_YCBCR_BT2020:
59 coeffs = yuv2rgb_bt2020;
60 break;
61 default:
62 coeffs = NULL;
63 break;
64 }
65
66 return coeffs;
67 }