1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 #ifndef COLOR_MOD_COLOR_GAMMA_H_
27 #define COLOR_MOD_COLOR_GAMMA_H_
28
29 struct dc_transfer_func;
30 struct dc_gamma;
31 struct dc_transfer_func_distributed_points;
32 struct dc_rgb_fixed;
33 enum dc_transfer_func_predefined;
34
35
36
37
38 union regamma_flags {
39 unsigned int raw;
40 struct {
41 unsigned int gammaRampArray :1;
42 unsigned int gammaFromEdid :1;
43 unsigned int gammaFromEdidEx :1;
44 unsigned int gammaFromUser :1;
45 unsigned int coeffFromUser :1;
46 unsigned int coeffFromEdid :1;
47 unsigned int applyDegamma :1;
48 unsigned int gammaPredefinedSRGB :1;
49 unsigned int gammaPredefinedPQ :1;
50 unsigned int gammaPredefinedPQ2084Interim :1;
51 unsigned int gammaPredefined36 :1;
52 unsigned int gammaPredefinedReset :1;
53 } bits;
54 };
55
56 struct regamma_ramp {
57 unsigned short gamma[256*3];
58 };
59
60 struct regamma_coeff {
61 int gamma[3];
62 int A0[3];
63 int A1[3];
64 int A2[3];
65 int A3[3];
66 };
67
68 struct regamma_lut {
69 union regamma_flags flags;
70 union {
71 struct regamma_ramp ramp;
72 struct regamma_coeff coeff;
73 };
74 };
75
76 struct freesync_hdr_tf_params {
77 unsigned int sdr_white_level;
78 unsigned int min_content;
79 unsigned int max_content;
80 unsigned int min_display;
81 unsigned int max_display;
82 unsigned int skip_tm;
83 };
84
85 struct translate_from_linear_space_args {
86 struct fixed31_32 arg;
87 struct fixed31_32 a0;
88 struct fixed31_32 a1;
89 struct fixed31_32 a2;
90 struct fixed31_32 a3;
91 struct fixed31_32 gamma;
92 };
93
94 void setup_x_points_distribution(void);
95 void log_x_points_distribution(struct dal_logger *logger);
96 void precompute_pq(void);
97 void precompute_de_pq(void);
98
99 bool mod_color_calculate_regamma_params(struct dc_transfer_func *output_tf,
100 const struct dc_gamma *ramp, bool mapUserRamp, bool canRomBeUsed,
101 const struct freesync_hdr_tf_params *fs_params);
102
103 bool mod_color_calculate_degamma_params(struct dc_transfer_func *output_tf,
104 const struct dc_gamma *ramp, bool mapUserRamp);
105
106 bool mod_color_calculate_curve(enum dc_transfer_func_predefined trans,
107 struct dc_transfer_func_distributed_points *points,
108 uint32_t sdr_ref_white_level);
109
110 bool mod_color_calculate_degamma_curve(enum dc_transfer_func_predefined trans,
111 struct dc_transfer_func_distributed_points *points);
112
113 bool calculate_user_regamma_coeff(struct dc_transfer_func *output_tf,
114 const struct regamma_lut *regamma);
115
116 bool calculate_user_regamma_ramp(struct dc_transfer_func *output_tf,
117 const struct regamma_lut *regamma);
118
119
120 #endif