diff options
| author | Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com> | 2018-04-18 11:37:53 -0400 |
|---|---|---|
| committer | Alex Deucher <alexander.deucher@amd.com> | 2018-05-18 17:08:21 -0400 |
| commit | eb0e515464e4a1be730c7ac7a01c3ba04c98ea97 (patch) | |
| tree | b54569bf1b09cd623fef47b5ed4724508a18206d /drivers/gpu/drm/amd/display/modules | |
| parent | b79655c37b209315d3b533f6d63a3d6f5fcb6f84 (diff) | |
drm/amd/display: get rid of 32.32 unsigned fixed point
32.32 is redundant, 31.32 does everything we use 32.32 for
Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display/modules')
| -rw-r--r-- | drivers/gpu/drm/amd/display/modules/color/color_gamma.c | 446 |
1 files changed, 223 insertions, 223 deletions
diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c index 15e5b72e6e00..29d2ec82b924 100644 --- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c +++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c | |||
| @@ -43,7 +43,7 @@ static bool de_pq_initialized; /* = false; */ | |||
| 43 | /* one-time setup of X points */ | 43 | /* one-time setup of X points */ |
| 44 | void setup_x_points_distribution(void) | 44 | void setup_x_points_distribution(void) |
| 45 | { | 45 | { |
| 46 | struct fixed31_32 region_size = dal_fixed31_32_from_int(128); | 46 | struct fixed31_32 region_size = dc_fixpt_from_int(128); |
| 47 | int32_t segment; | 47 | int32_t segment; |
| 48 | uint32_t seg_offset; | 48 | uint32_t seg_offset; |
| 49 | uint32_t index; | 49 | uint32_t index; |
| @@ -53,8 +53,8 @@ void setup_x_points_distribution(void) | |||
| 53 | coordinates_x[MAX_HW_POINTS + 1].x = region_size; | 53 | coordinates_x[MAX_HW_POINTS + 1].x = region_size; |
| 54 | 54 | ||
| 55 | for (segment = 6; segment > (6 - NUM_REGIONS); segment--) { | 55 | for (segment = 6; segment > (6 - NUM_REGIONS); segment--) { |
| 56 | region_size = dal_fixed31_32_div_int(region_size, 2); | 56 | region_size = dc_fixpt_div_int(region_size, 2); |
| 57 | increment = dal_fixed31_32_div_int(region_size, | 57 | increment = dc_fixpt_div_int(region_size, |
| 58 | NUM_PTS_IN_REGION); | 58 | NUM_PTS_IN_REGION); |
| 59 | seg_offset = (segment + (NUM_REGIONS - 7)) * NUM_PTS_IN_REGION; | 59 | seg_offset = (segment + (NUM_REGIONS - 7)) * NUM_PTS_IN_REGION; |
| 60 | coordinates_x[seg_offset].x = region_size; | 60 | coordinates_x[seg_offset].x = region_size; |
| @@ -62,7 +62,7 @@ void setup_x_points_distribution(void) | |||
| 62 | for (index = seg_offset + 1; | 62 | for (index = seg_offset + 1; |
| 63 | index < seg_offset + NUM_PTS_IN_REGION; | 63 | index < seg_offset + NUM_PTS_IN_REGION; |
| 64 | index++) { | 64 | index++) { |
| 65 | coordinates_x[index].x = dal_fixed31_32_add | 65 | coordinates_x[index].x = dc_fixpt_add |
| 66 | (coordinates_x[index-1].x, increment); | 66 | (coordinates_x[index-1].x, increment); |
| 67 | } | 67 | } |
| 68 | } | 68 | } |
| @@ -72,63 +72,63 @@ static void compute_pq(struct fixed31_32 in_x, struct fixed31_32 *out_y) | |||
| 72 | { | 72 | { |
| 73 | /* consts for PQ gamma formula. */ | 73 | /* consts for PQ gamma formula. */ |
| 74 | const struct fixed31_32 m1 = | 74 | const struct fixed31_32 m1 = |
| 75 | dal_fixed31_32_from_fraction(159301758, 1000000000); | 75 | dc_fixpt_from_fraction(159301758, 1000000000); |
| 76 | const struct fixed31_32 m2 = | 76 | const struct fixed31_32 m2 = |
| 77 | dal_fixed31_32_from_fraction(7884375, 100000); | 77 | dc_fixpt_from_fraction(7884375, 100000); |
| 78 | const struct fixed31_32 c1 = | 78 | const struct fixed31_32 c1 = |
| 79 | dal_fixed31_32_from_fraction(8359375, 10000000); | 79 | dc_fixpt_from_fraction(8359375, 10000000); |
| 80 | const struct fixed31_32 c2 = | 80 | const struct fixed31_32 c2 = |
| 81 | dal_fixed31_32_from_fraction(188515625, 10000000); | 81 | dc_fixpt_from_fraction(188515625, 10000000); |
| 82 | const struct fixed31_32 c3 = | 82 | const struct fixed31_32 c3 = |
| 83 | dal_fixed31_32_from_fraction(186875, 10000); | 83 | dc_fixpt_from_fraction(186875, 10000); |
| 84 | 84 | ||
| 85 | struct fixed31_32 l_pow_m1; | 85 | struct fixed31_32 l_pow_m1; |
| 86 | struct fixed31_32 base; | 86 | struct fixed31_32 base; |
| 87 | 87 | ||
| 88 | if (dal_fixed31_32_lt(in_x, dal_fixed31_32_zero)) | 88 | if (dc_fixpt_lt(in_x, dc_fixpt_zero)) |
| 89 | in_x = dal_fixed31_32_zero; | 89 | in_x = dc_fixpt_zero; |
| 90 | 90 | ||
| 91 | l_pow_m1 = dal_fixed31_32_pow(in_x, m1); | 91 | l_pow_m1 = dc_fixpt_pow(in_x, m1); |
| 92 | base = dal_fixed31_32_div( | 92 | base = dc_fixpt_div( |
| 93 | dal_fixed31_32_add(c1, | 93 | dc_fixpt_add(c1, |
| 94 | (dal_fixed31_32_mul(c2, l_pow_m1))), | 94 | (dc_fixpt_mul(c2, l_pow_m1))), |
| 95 | dal_fixed31_32_add(dal_fixed31_32_one, | 95 | dc_fixpt_add(dc_fixpt_one, |
| 96 | (dal_fixed31_32_mul(c3, l_pow_m1)))); | 96 | (dc_fixpt_mul(c3, l_pow_m1)))); |
| 97 | *out_y = dal_fixed31_32_pow(base, m2); | 97 | *out_y = dc_fixpt_pow(base, m2); |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | static void compute_de_pq(struct fixed31_32 in_x, struct fixed31_32 *out_y) | 100 | static void compute_de_pq(struct fixed31_32 in_x, struct fixed31_32 *out_y) |
| 101 | { | 101 | { |
| 102 | /* consts for dePQ gamma formula. */ | 102 | /* consts for dePQ gamma formula. */ |
| 103 | const struct fixed31_32 m1 = | 103 | const struct fixed31_32 m1 = |
| 104 | dal_fixed31_32_from_fraction(159301758, 1000000000); | 104 | dc_fixpt_from_fraction(159301758, 1000000000); |
| 105 | const struct fixed31_32 m2 = | 105 | const struct fixed31_32 m2 = |
| 106 | dal_fixed31_32_from_fraction(7884375, 100000); | 106 | dc_fixpt_from_fraction(7884375, 100000); |
| 107 | const struct fixed31_32 c1 = | 107 | const struct fixed31_32 c1 = |
| 108 | dal_fixed31_32_from_fraction(8359375, 10000000); | 108 | dc_fixpt_from_fraction(8359375, 10000000); |
| 109 | const struct fixed31_32 c2 = | 109 | const struct fixed31_32 c2 = |
| 110 | dal_fixed31_32_from_fraction(188515625, 10000000); | 110 | dc_fixpt_from_fraction(188515625, 10000000); |
| 111 | const struct fixed31_32 c3 = | 111 | const struct fixed31_32 c3 = |
| 112 | dal_fixed31_32_from_fraction(186875, 10000); | 112 | dc_fixpt_from_fraction(186875, 10000); |
| 113 | 113 | ||
| 114 | struct fixed31_32 l_pow_m1; | 114 | struct fixed31_32 l_pow_m1; |
| 115 | struct fixed31_32 base, div; | 115 | struct fixed31_32 base, div; |
| 116 | 116 | ||
| 117 | 117 | ||
| 118 | if (dal_fixed31_32_lt(in_x, dal_fixed31_32_zero)) | 118 | if (dc_fixpt_lt(in_x, dc_fixpt_zero)) |
| 119 | in_x = dal_fixed31_32_zero; | 119 | in_x = dc_fixpt_zero; |
| 120 | 120 | ||
| 121 | l_pow_m1 = dal_fixed31_32_pow(in_x, | 121 | l_pow_m1 = dc_fixpt_pow(in_x, |
| 122 | dal_fixed31_32_div(dal_fixed31_32_one, m2)); | 122 | dc_fixpt_div(dc_fixpt_one, m2)); |
| 123 | base = dal_fixed31_32_sub(l_pow_m1, c1); | 123 | base = dc_fixpt_sub(l_pow_m1, c1); |
| 124 | 124 | ||
| 125 | if (dal_fixed31_32_lt(base, dal_fixed31_32_zero)) | 125 | if (dc_fixpt_lt(base, dc_fixpt_zero)) |
| 126 | base = dal_fixed31_32_zero; | 126 | base = dc_fixpt_zero; |
| 127 | 127 | ||
| 128 | div = dal_fixed31_32_sub(c2, dal_fixed31_32_mul(c3, l_pow_m1)); | 128 | div = dc_fixpt_sub(c2, dc_fixpt_mul(c3, l_pow_m1)); |
| 129 | 129 | ||
| 130 | *out_y = dal_fixed31_32_pow(dal_fixed31_32_div(base, div), | 130 | *out_y = dc_fixpt_pow(dc_fixpt_div(base, div), |
| 131 | dal_fixed31_32_div(dal_fixed31_32_one, m1)); | 131 | dc_fixpt_div(dc_fixpt_one, m1)); |
| 132 | 132 | ||
| 133 | } | 133 | } |
| 134 | /* one-time pre-compute PQ values - only for sdr_white_level 80 */ | 134 | /* one-time pre-compute PQ values - only for sdr_white_level 80 */ |
| @@ -138,14 +138,14 @@ void precompute_pq(void) | |||
| 138 | struct fixed31_32 x; | 138 | struct fixed31_32 x; |
| 139 | const struct hw_x_point *coord_x = coordinates_x + 32; | 139 | const struct hw_x_point *coord_x = coordinates_x + 32; |
| 140 | struct fixed31_32 scaling_factor = | 140 | struct fixed31_32 scaling_factor = |
| 141 | dal_fixed31_32_from_fraction(80, 10000); | 141 | dc_fixpt_from_fraction(80, 10000); |
| 142 | 142 | ||
| 143 | /* pow function has problems with arguments too small */ | 143 | /* pow function has problems with arguments too small */ |
| 144 | for (i = 0; i < 32; i++) | 144 | for (i = 0; i < 32; i++) |
| 145 | pq_table[i] = dal_fixed31_32_zero; | 145 | pq_table[i] = dc_fixpt_zero; |
| 146 | 146 | ||
| 147 | for (i = 32; i <= MAX_HW_POINTS; i++) { | 147 | for (i = 32; i <= MAX_HW_POINTS; i++) { |
| 148 | x = dal_fixed31_32_mul(coord_x->x, scaling_factor); | 148 | x = dc_fixpt_mul(coord_x->x, scaling_factor); |
| 149 | compute_pq(x, &pq_table[i]); | 149 | compute_pq(x, &pq_table[i]); |
| 150 | ++coord_x; | 150 | ++coord_x; |
| 151 | } | 151 | } |
| @@ -158,7 +158,7 @@ void precompute_de_pq(void) | |||
| 158 | struct fixed31_32 y; | 158 | struct fixed31_32 y; |
| 159 | uint32_t begin_index, end_index; | 159 | uint32_t begin_index, end_index; |
| 160 | 160 | ||
| 161 | struct fixed31_32 scaling_factor = dal_fixed31_32_from_int(125); | 161 | struct fixed31_32 scaling_factor = dc_fixpt_from_int(125); |
| 162 | 162 | ||
| 163 | /* X points is 2^-25 to 2^7 | 163 | /* X points is 2^-25 to 2^7 |
| 164 | * De-gamma X is 2^-12 to 2^0 – we are skipping first -12-(-25) = 13 regions | 164 | * De-gamma X is 2^-12 to 2^0 – we are skipping first -12-(-25) = 13 regions |
| @@ -167,11 +167,11 @@ void precompute_de_pq(void) | |||
| 167 | end_index = begin_index + 12 * NUM_PTS_IN_REGION; | 167 | end_index = begin_index + 12 * NUM_PTS_IN_REGION; |
| 168 | 168 | ||
| 169 | for (i = 0; i <= begin_index; i++) | 169 | for (i = 0; i <= begin_index; i++) |
| 170 | de_pq_table[i] = dal_fixed31_32_zero; | 170 | de_pq_table[i] = dc_fixpt_zero; |
| 171 | 171 | ||
| 172 | for (; i <= end_index; i++) { | 172 | for (; i <= end_index; i++) { |
| 173 | compute_de_pq(coordinates_x[i].x, &y); | 173 | compute_de_pq(coordinates_x[i].x, &y); |
| 174 | de_pq_table[i] = dal_fixed31_32_mul(y, scaling_factor); | 174 | de_pq_table[i] = dc_fixpt_mul(y, scaling_factor); |
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | for (; i <= MAX_HW_POINTS; i++) | 177 | for (; i <= MAX_HW_POINTS; i++) |
| @@ -195,15 +195,15 @@ static void build_coefficients(struct gamma_coefficients *coefficients, bool is_ | |||
| 195 | uint32_t index = is_2_4 == true ? 0:1; | 195 | uint32_t index = is_2_4 == true ? 0:1; |
| 196 | 196 | ||
| 197 | do { | 197 | do { |
| 198 | coefficients->a0[i] = dal_fixed31_32_from_fraction( | 198 | coefficients->a0[i] = dc_fixpt_from_fraction( |
| 199 | numerator01[index], 10000000); | 199 | numerator01[index], 10000000); |
| 200 | coefficients->a1[i] = dal_fixed31_32_from_fraction( | 200 | coefficients->a1[i] = dc_fixpt_from_fraction( |
| 201 | numerator02[index], 1000); | 201 | numerator02[index], 1000); |
| 202 | coefficients->a2[i] = dal_fixed31_32_from_fraction( | 202 | coefficients->a2[i] = dc_fixpt_from_fraction( |
| 203 | numerator03[index], 1000); | 203 | numerator03[index], 1000); |
| 204 | coefficients->a3[i] = dal_fixed31_32_from_fraction( | 204 | coefficients->a3[i] = dc_fixpt_from_fraction( |
| 205 | numerator04[index], 1000); | 205 | numerator04[index], 1000); |
| 206 | coefficients->user_gamma[i] = dal_fixed31_32_from_fraction( | 206 | coefficients->user_gamma[i] = dc_fixpt_from_fraction( |
| 207 | numerator05[index], 1000); | 207 | numerator05[index], 1000); |
| 208 | 208 | ||
| 209 | ++i; | 209 | ++i; |
| @@ -218,33 +218,33 @@ static struct fixed31_32 translate_from_linear_space( | |||
| 218 | struct fixed31_32 a3, | 218 | struct fixed31_32 a3, |
| 219 | struct fixed31_32 gamma) | 219 | struct fixed31_32 gamma) |
| 220 | { | 220 | { |
| 221 | const struct fixed31_32 one = dal_fixed31_32_from_int(1); | 221 | const struct fixed31_32 one = dc_fixpt_from_int(1); |
| 222 | 222 | ||
| 223 | if (dal_fixed31_32_lt(one, arg)) | 223 | if (dc_fixpt_lt(one, arg)) |
| 224 | return one; | 224 | return one; |
| 225 | 225 | ||
| 226 | if (dal_fixed31_32_le(arg, dal_fixed31_32_neg(a0))) | 226 | if (dc_fixpt_le(arg, dc_fixpt_neg(a0))) |
| 227 | return dal_fixed31_32_sub( | 227 | return dc_fixpt_sub( |
| 228 | a2, | 228 | a2, |
| 229 | dal_fixed31_32_mul( | 229 | dc_fixpt_mul( |
| 230 | dal_fixed31_32_add( | 230 | dc_fixpt_add( |
| 231 | one, | 231 | one, |
| 232 | a3), | 232 | a3), |
| 233 | dal_fixed31_32_pow( | 233 | dc_fixpt_pow( |
| 234 | dal_fixed31_32_neg(arg), | 234 | dc_fixpt_neg(arg), |
| 235 | dal_fixed31_32_recip(gamma)))); | 235 | dc_fixpt_recip(gamma)))); |
| 236 | else if (dal_fixed31_32_le(a0, arg)) | 236 | else if (dc_fixpt_le(a0, arg)) |
| 237 | return dal_fixed31_32_sub( | 237 | return dc_fixpt_sub( |
| 238 | dal_fixed31_32_mul( | 238 | dc_fixpt_mul( |
| 239 | dal_fixed31_32_add( | 239 | dc_fixpt_add( |
| 240 | one, | 240 | one, |
| 241 | a3), | 241 | a3), |
| 242 | dal_fixed31_32_pow( | 242 | dc_fixpt_pow( |
| 243 | arg, | 243 | arg, |
| 244 | dal_fixed31_32_recip(gamma))), | 244 | dc_fixpt_recip(gamma))), |
| 245 | a2); | 245 | a2); |
| 246 | else | 246 | else |
| 247 | return dal_fixed31_32_mul( | 247 | return dc_fixpt_mul( |
| 248 | arg, | 248 | arg, |
| 249 | a1); | 249 | a1); |
| 250 | } | 250 | } |
| @@ -259,25 +259,25 @@ static struct fixed31_32 translate_to_linear_space( | |||
| 259 | { | 259 | { |
| 260 | struct fixed31_32 linear; | 260 | struct fixed31_32 linear; |
| 261 | 261 | ||
| 262 | a0 = dal_fixed31_32_mul(a0, a1); | 262 | a0 = dc_fixpt_mul(a0, a1); |
| 263 | if (dal_fixed31_32_le(arg, dal_fixed31_32_neg(a0))) | 263 | if (dc_fixpt_le(arg, dc_fixpt_neg(a0))) |
| 264 | 264 | ||
| 265 | linear = dal_fixed31_32_neg( | 265 | linear = dc_fixpt_neg( |
| 266 | dal_fixed31_32_pow( | 266 | dc_fixpt_pow( |
| 267 | dal_fixed31_32_div( | 267 | dc_fixpt_div( |
| 268 | dal_fixed31_32_sub(a2, arg), | 268 | dc_fixpt_sub(a2, arg), |
| 269 | dal_fixed31_32_add( | 269 | dc_fixpt_add( |
| 270 | dal_fixed31_32_one, a3)), gamma)); | 270 | dc_fixpt_one, a3)), gamma)); |
| 271 | 271 | ||
| 272 | else if (dal_fixed31_32_le(dal_fixed31_32_neg(a0), arg) && | 272 | else if (dc_fixpt_le(dc_fixpt_neg(a0), arg) && |
| 273 | dal_fixed31_32_le(arg, a0)) | 273 | dc_fixpt_le(arg, a0)) |
| 274 | linear = dal_fixed31_32_div(arg, a1); | 274 | linear = dc_fixpt_div(arg, a1); |
| 275 | else | 275 | else |
| 276 | linear = dal_fixed31_32_pow( | 276 | linear = dc_fixpt_pow( |
| 277 | dal_fixed31_32_div( | 277 | dc_fixpt_div( |
| 278 | dal_fixed31_32_add(a2, arg), | 278 | dc_fixpt_add(a2, arg), |
| 279 | dal_fixed31_32_add( | 279 | dc_fixpt_add( |
| 280 | dal_fixed31_32_one, a3)), gamma); | 280 | dc_fixpt_one, a3)), gamma); |
| 281 | 281 | ||
| 282 | return linear; | 282 | return linear; |
| 283 | } | 283 | } |
| @@ -352,8 +352,8 @@ static bool find_software_points( | |||
| 352 | right = axis_x[max_number - 1].b; | 352 | right = axis_x[max_number - 1].b; |
| 353 | } | 353 | } |
| 354 | 354 | ||
| 355 | if (dal_fixed31_32_le(left, hw_point) && | 355 | if (dc_fixpt_le(left, hw_point) && |
| 356 | dal_fixed31_32_le(hw_point, right)) { | 356 | dc_fixpt_le(hw_point, right)) { |
| 357 | *index_to_start = i; | 357 | *index_to_start = i; |
| 358 | *index_left = i; | 358 | *index_left = i; |
| 359 | 359 | ||
| @@ -366,7 +366,7 @@ static bool find_software_points( | |||
| 366 | 366 | ||
| 367 | return true; | 367 | return true; |
| 368 | } else if ((i == *index_to_start) && | 368 | } else if ((i == *index_to_start) && |
| 369 | dal_fixed31_32_le(hw_point, left)) { | 369 | dc_fixpt_le(hw_point, left)) { |
| 370 | *index_to_start = i; | 370 | *index_to_start = i; |
| 371 | *index_left = i; | 371 | *index_left = i; |
| 372 | *index_right = i; | 372 | *index_right = i; |
| @@ -375,7 +375,7 @@ static bool find_software_points( | |||
| 375 | 375 | ||
| 376 | return true; | 376 | return true; |
| 377 | } else if ((i == max_number - 1) && | 377 | } else if ((i == max_number - 1) && |
| 378 | dal_fixed31_32_le(right, hw_point)) { | 378 | dc_fixpt_le(right, hw_point)) { |
| 379 | *index_to_start = i; | 379 | *index_to_start = i; |
| 380 | *index_left = i; | 380 | *index_left = i; |
| 381 | *index_right = i; | 381 | *index_right = i; |
| @@ -457,17 +457,17 @@ static bool build_custom_gamma_mapping_coefficients_worker( | |||
| 457 | } | 457 | } |
| 458 | 458 | ||
| 459 | if (hw_pos == HW_POINT_POSITION_MIDDLE) | 459 | if (hw_pos == HW_POINT_POSITION_MIDDLE) |
| 460 | point->coeff = dal_fixed31_32_div( | 460 | point->coeff = dc_fixpt_div( |
| 461 | dal_fixed31_32_sub( | 461 | dc_fixpt_sub( |
| 462 | coord_x, | 462 | coord_x, |
| 463 | left_pos), | 463 | left_pos), |
| 464 | dal_fixed31_32_sub( | 464 | dc_fixpt_sub( |
| 465 | right_pos, | 465 | right_pos, |
| 466 | left_pos)); | 466 | left_pos)); |
| 467 | else if (hw_pos == HW_POINT_POSITION_LEFT) | 467 | else if (hw_pos == HW_POINT_POSITION_LEFT) |
| 468 | point->coeff = dal_fixed31_32_zero; | 468 | point->coeff = dc_fixpt_zero; |
| 469 | else if (hw_pos == HW_POINT_POSITION_RIGHT) | 469 | else if (hw_pos == HW_POINT_POSITION_RIGHT) |
| 470 | point->coeff = dal_fixed31_32_from_int(2); | 470 | point->coeff = dc_fixpt_from_int(2); |
| 471 | else { | 471 | else { |
| 472 | BREAK_TO_DEBUGGER(); | 472 | BREAK_TO_DEBUGGER(); |
| 473 | return false; | 473 | return false; |
| @@ -502,45 +502,45 @@ static struct fixed31_32 calculate_mapped_value( | |||
| 502 | 502 | ||
| 503 | if ((point->left_index < 0) || (point->left_index > max_index)) { | 503 | if ((point->left_index < 0) || (point->left_index > max_index)) { |
| 504 | BREAK_TO_DEBUGGER(); | 504 | BREAK_TO_DEBUGGER(); |
| 505 | return dal_fixed31_32_zero; | 505 | return dc_fixpt_zero; |
| 506 | } | 506 | } |
| 507 | 507 | ||
| 508 | if ((point->right_index < 0) || (point->right_index > max_index)) { | 508 | if ((point->right_index < 0) || (point->right_index > max_index)) { |
| 509 | BREAK_TO_DEBUGGER(); | 509 | BREAK_TO_DEBUGGER(); |
| 510 | return dal_fixed31_32_zero; | 510 | return dc_fixpt_zero; |
| 511 | } | 511 | } |
| 512 | 512 | ||
| 513 | if (point->pos == HW_POINT_POSITION_MIDDLE) | 513 | if (point->pos == HW_POINT_POSITION_MIDDLE) |
| 514 | if (channel == CHANNEL_NAME_RED) | 514 | if (channel == CHANNEL_NAME_RED) |
| 515 | result = dal_fixed31_32_add( | 515 | result = dc_fixpt_add( |
| 516 | dal_fixed31_32_mul( | 516 | dc_fixpt_mul( |
| 517 | point->coeff, | 517 | point->coeff, |
| 518 | dal_fixed31_32_sub( | 518 | dc_fixpt_sub( |
| 519 | rgb[point->right_index].r, | 519 | rgb[point->right_index].r, |
| 520 | rgb[point->left_index].r)), | 520 | rgb[point->left_index].r)), |
| 521 | rgb[point->left_index].r); | 521 | rgb[point->left_index].r); |
| 522 | else if (channel == CHANNEL_NAME_GREEN) | 522 | else if (channel == CHANNEL_NAME_GREEN) |
| 523 | result = dal_fixed31_32_add( | 523 | result = dc_fixpt_add( |
| 524 | dal_fixed31_32_mul( | 524 | dc_fixpt_mul( |
| 525 | point->coeff, | 525 | point->coeff, |
| 526 | dal_fixed31_32_sub( | 526 | dc_fixpt_sub( |
| 527 | rgb[point->right_index].g, | 527 | rgb[point->right_index].g, |
| 528 | rgb[point->left_index].g)), | 528 | rgb[point->left_index].g)), |
| 529 | rgb[point->left_index].g); | 529 | rgb[point->left_index].g); |
| 530 | else | 530 | else |
| 531 | result = dal_fixed31_32_add( | 531 | result = dc_fixpt_add( |
| 532 | dal_fixed31_32_mul( | 532 | dc_fixpt_mul( |
| 533 | point->coeff, | 533 | point->coeff, |
| 534 | dal_fixed31_32_sub( | 534 | dc_fixpt_sub( |
| 535 | rgb[point->right_index].b, | 535 | rgb[point->right_index].b, |
| 536 | rgb[point->left_index].b)), | 536 | rgb[point->left_index].b)), |
| 537 | rgb[point->left_index].b); | 537 | rgb[point->left_index].b); |
| 538 | else if (point->pos == HW_POINT_POSITION_LEFT) { | 538 | else if (point->pos == HW_POINT_POSITION_LEFT) { |
| 539 | BREAK_TO_DEBUGGER(); | 539 | BREAK_TO_DEBUGGER(); |
| 540 | result = dal_fixed31_32_zero; | 540 | result = dc_fixpt_zero; |
| 541 | } else { | 541 | } else { |
| 542 | BREAK_TO_DEBUGGER(); | 542 | BREAK_TO_DEBUGGER(); |
| 543 | result = dal_fixed31_32_one; | 543 | result = dc_fixpt_one; |
| 544 | } | 544 | } |
| 545 | 545 | ||
| 546 | return result; | 546 | return result; |
| @@ -558,7 +558,7 @@ static void build_pq(struct pwl_float_data_ex *rgb_regamma, | |||
| 558 | struct fixed31_32 x; | 558 | struct fixed31_32 x; |
| 559 | struct fixed31_32 output; | 559 | struct fixed31_32 output; |
| 560 | struct fixed31_32 scaling_factor = | 560 | struct fixed31_32 scaling_factor = |
| 561 | dal_fixed31_32_from_fraction(sdr_white_level, 10000); | 561 | dc_fixpt_from_fraction(sdr_white_level, 10000); |
| 562 | 562 | ||
| 563 | if (!pq_initialized && sdr_white_level == 80) { | 563 | if (!pq_initialized && sdr_white_level == 80) { |
| 564 | precompute_pq(); | 564 | precompute_pq(); |
| @@ -579,15 +579,15 @@ static void build_pq(struct pwl_float_data_ex *rgb_regamma, | |||
| 579 | if (sdr_white_level == 80) { | 579 | if (sdr_white_level == 80) { |
| 580 | output = pq_table[i]; | 580 | output = pq_table[i]; |
| 581 | } else { | 581 | } else { |
| 582 | x = dal_fixed31_32_mul(coord_x->x, scaling_factor); | 582 | x = dc_fixpt_mul(coord_x->x, scaling_factor); |
| 583 | compute_pq(x, &output); | 583 | compute_pq(x, &output); |
| 584 | } | 584 | } |
| 585 | 585 | ||
| 586 | /* should really not happen? */ | 586 | /* should really not happen? */ |
| 587 | if (dal_fixed31_32_lt(output, dal_fixed31_32_zero)) | 587 | if (dc_fixpt_lt(output, dc_fixpt_zero)) |
| 588 | output = dal_fixed31_32_zero; | 588 | output = dc_fixpt_zero; |
| 589 | else if (dal_fixed31_32_lt(dal_fixed31_32_one, output)) | 589 | else if (dc_fixpt_lt(dc_fixpt_one, output)) |
| 590 | output = dal_fixed31_32_one; | 590 | output = dc_fixpt_one; |
| 591 | 591 | ||
| 592 | rgb->r = output; | 592 | rgb->r = output; |
| 593 | rgb->g = output; | 593 | rgb->g = output; |
| @@ -605,7 +605,7 @@ static void build_de_pq(struct pwl_float_data_ex *de_pq, | |||
| 605 | uint32_t i; | 605 | uint32_t i; |
| 606 | struct fixed31_32 output; | 606 | struct fixed31_32 output; |
| 607 | 607 | ||
| 608 | struct fixed31_32 scaling_factor = dal_fixed31_32_from_int(125); | 608 | struct fixed31_32 scaling_factor = dc_fixpt_from_int(125); |
| 609 | 609 | ||
| 610 | if (!de_pq_initialized) { | 610 | if (!de_pq_initialized) { |
| 611 | precompute_de_pq(); | 611 | precompute_de_pq(); |
| @@ -616,9 +616,9 @@ static void build_de_pq(struct pwl_float_data_ex *de_pq, | |||
| 616 | for (i = 0; i <= hw_points_num; i++) { | 616 | for (i = 0; i <= hw_points_num; i++) { |
| 617 | output = de_pq_table[i]; | 617 | output = de_pq_table[i]; |
| 618 | /* should really not happen? */ | 618 | /* should really not happen? */ |
| 619 | if (dal_fixed31_32_lt(output, dal_fixed31_32_zero)) | 619 | if (dc_fixpt_lt(output, dc_fixpt_zero)) |
| 620 | output = dal_fixed31_32_zero; | 620 | output = dc_fixpt_zero; |
| 621 | else if (dal_fixed31_32_lt(scaling_factor, output)) | 621 | else if (dc_fixpt_lt(scaling_factor, output)) |
| 622 | output = scaling_factor; | 622 | output = scaling_factor; |
| 623 | de_pq[i].r = output; | 623 | de_pq[i].r = output; |
| 624 | de_pq[i].g = output; | 624 | de_pq[i].g = output; |
| @@ -670,9 +670,9 @@ static void build_degamma(struct pwl_float_data_ex *curve, | |||
| 670 | end_index = begin_index + 12 * NUM_PTS_IN_REGION; | 670 | end_index = begin_index + 12 * NUM_PTS_IN_REGION; |
| 671 | 671 | ||
| 672 | while (i != begin_index) { | 672 | while (i != begin_index) { |
| 673 | curve[i].r = dal_fixed31_32_zero; | 673 | curve[i].r = dc_fixpt_zero; |
| 674 | curve[i].g = dal_fixed31_32_zero; | 674 | curve[i].g = dc_fixpt_zero; |
| 675 | curve[i].b = dal_fixed31_32_zero; | 675 | curve[i].b = dc_fixpt_zero; |
| 676 | i++; | 676 | i++; |
| 677 | } | 677 | } |
| 678 | 678 | ||
| @@ -684,9 +684,9 @@ static void build_degamma(struct pwl_float_data_ex *curve, | |||
| 684 | i++; | 684 | i++; |
| 685 | } | 685 | } |
| 686 | while (i != hw_points_num + 1) { | 686 | while (i != hw_points_num + 1) { |
| 687 | curve[i].r = dal_fixed31_32_one; | 687 | curve[i].r = dc_fixpt_one; |
| 688 | curve[i].g = dal_fixed31_32_one; | 688 | curve[i].g = dc_fixpt_one; |
| 689 | curve[i].b = dal_fixed31_32_one; | 689 | curve[i].b = dc_fixpt_one; |
| 690 | i++; | 690 | i++; |
| 691 | } | 691 | } |
| 692 | } | 692 | } |
| @@ -695,8 +695,8 @@ static void scale_gamma(struct pwl_float_data *pwl_rgb, | |||
| 695 | const struct dc_gamma *ramp, | 695 | const struct dc_gamma *ramp, |
| 696 | struct dividers dividers) | 696 | struct dividers dividers) |
| 697 | { | 697 | { |
| 698 | const struct fixed31_32 max_driver = dal_fixed31_32_from_int(0xFFFF); | 698 | const struct fixed31_32 max_driver = dc_fixpt_from_int(0xFFFF); |
| 699 | const struct fixed31_32 max_os = dal_fixed31_32_from_int(0xFF00); | 699 | const struct fixed31_32 max_os = dc_fixpt_from_int(0xFF00); |
| 700 | struct fixed31_32 scaler = max_os; | 700 | struct fixed31_32 scaler = max_os; |
| 701 | uint32_t i; | 701 | uint32_t i; |
| 702 | struct pwl_float_data *rgb = pwl_rgb; | 702 | struct pwl_float_data *rgb = pwl_rgb; |
| @@ -705,9 +705,9 @@ static void scale_gamma(struct pwl_float_data *pwl_rgb, | |||
| 705 | i = 0; | 705 | i = 0; |
| 706 | 706 | ||
| 707 | do { | 707 | do { |
| 708 | if (dal_fixed31_32_lt(max_os, ramp->entries.red[i]) || | 708 | if (dc_fixpt_lt(max_os, ramp->entries.red[i]) || |
| 709 | dal_fixed31_32_lt(max_os, ramp->entries.green[i]) || | 709 | dc_fixpt_lt(max_os, ramp->entries.green[i]) || |
| 710 | dal_fixed31_32_lt(max_os, ramp->entries.blue[i])) { | 710 | dc_fixpt_lt(max_os, ramp->entries.blue[i])) { |
| 711 | scaler = max_driver; | 711 | scaler = max_driver; |
| 712 | break; | 712 | break; |
| 713 | } | 713 | } |
| @@ -717,40 +717,40 @@ static void scale_gamma(struct pwl_float_data *pwl_rgb, | |||
| 717 | i = 0; | 717 | i = 0; |
| 718 | 718 | ||
| 719 | do { | 719 | do { |
| 720 | rgb->r = dal_fixed31_32_div( | 720 | rgb->r = dc_fixpt_div( |
| 721 | ramp->entries.red[i], scaler); | 721 | ramp->entries.red[i], scaler); |
| 722 | rgb->g = dal_fixed31_32_div( | 722 | rgb->g = dc_fixpt_div( |
| 723 | ramp->entries.green[i], scaler); | 723 | ramp->entries.green[i], scaler); |
| 724 | rgb->b = dal_fixed31_32_div( | 724 | rgb->b = dc_fixpt_div( |
| 725 | ramp->entries.blue[i], scaler); | 725 | ramp->entries.blue[i], scaler); |
| 726 | 726 | ||
| 727 | ++rgb; | 727 | ++rgb; |
| 728 | ++i; | 728 | ++i; |
| 729 | } while (i != ramp->num_entries); | 729 | } while (i != ramp->num_entries); |
| 730 | 730 | ||
| 731 | rgb->r = dal_fixed31_32_mul(rgb_last->r, | 731 | rgb->r = dc_fixpt_mul(rgb_last->r, |
| 732 | dividers.divider1); | 732 | dividers.divider1); |
| 733 | rgb->g = dal_fixed31_32_mul(rgb_last->g, | 733 | rgb->g = dc_fixpt_mul(rgb_last->g, |
| 734 | dividers.divider1); | 734 | dividers.divider1); |
| 735 | rgb->b = dal_fixed31_32_mul(rgb_last->b, | 735 | rgb->b = dc_fixpt_mul(rgb_last->b, |
| 736 | dividers.divider1); | 736 | dividers.divider1); |
| 737 | 737 | ||
| 738 | ++rgb; | 738 | ++rgb; |
| 739 | 739 | ||
| 740 | rgb->r = dal_fixed31_32_mul(rgb_last->r, | 740 | rgb->r = dc_fixpt_mul(rgb_last->r, |
| 741 | dividers.divider2); | 741 | dividers.divider2); |
| 742 | rgb->g = dal_fixed31_32_mul(rgb_last->g, | 742 | rgb->g = dc_fixpt_mul(rgb_last->g, |
| 743 | dividers.divider2); | 743 | dividers.divider2); |
| 744 | rgb->b = dal_fixed31_32_mul(rgb_last->b, | 744 | rgb->b = dc_fixpt_mul(rgb_last->b, |
| 745 | dividers.divider2); | 745 | dividers.divider2); |
| 746 | 746 | ||
| 747 | ++rgb; | 747 | ++rgb; |
| 748 | 748 | ||
| 749 | rgb->r = dal_fixed31_32_mul(rgb_last->r, | 749 | rgb->r = dc_fixpt_mul(rgb_last->r, |
| 750 | dividers.divider3); | 750 | dividers.divider3); |
| 751 | rgb->g = dal_fixed31_32_mul(rgb_last->g, | 751 | rgb->g = dc_fixpt_mul(rgb_last->g, |
| 752 | dividers.divider3); | 752 | dividers.divider3); |
| 753 | rgb->b = dal_fixed31_32_mul(rgb_last->b, | 753 | rgb->b = dc_fixpt_mul(rgb_last->b, |
| 754 | dividers.divider3); | 754 | dividers.divider3); |
| 755 | } | 755 | } |
| 756 | 756 | ||
| @@ -759,62 +759,62 @@ static void scale_gamma_dx(struct pwl_float_data *pwl_rgb, | |||
| 759 | struct dividers dividers) | 759 | struct dividers dividers) |
| 760 | { | 760 | { |
| 761 | uint32_t i; | 761 | uint32_t i; |
| 762 | struct fixed31_32 min = dal_fixed31_32_zero; | 762 | struct fixed31_32 min = dc_fixpt_zero; |
| 763 | struct fixed31_32 max = dal_fixed31_32_one; | 763 | struct fixed31_32 max = dc_fixpt_one; |
| 764 | 764 | ||
| 765 | struct fixed31_32 delta = dal_fixed31_32_zero; | 765 | struct fixed31_32 delta = dc_fixpt_zero; |
| 766 | struct fixed31_32 offset = dal_fixed31_32_zero; | 766 | struct fixed31_32 offset = dc_fixpt_zero; |
| 767 | 767 | ||
| 768 | for (i = 0 ; i < ramp->num_entries; i++) { | 768 | for (i = 0 ; i < ramp->num_entries; i++) { |
| 769 | if (dal_fixed31_32_lt(ramp->entries.red[i], min)) | 769 | if (dc_fixpt_lt(ramp->entries.red[i], min)) |
| 770 | min = ramp->entries.red[i]; | 770 | min = ramp->entries.red[i]; |
| 771 | 771 | ||
| 772 | if (dal_fixed31_32_lt(ramp->entries.green[i], min)) | 772 | if (dc_fixpt_lt(ramp->entries.green[i], min)) |
| 773 | min = ramp->entries.green[i]; | 773 | min = ramp->entries.green[i]; |
| 774 | 774 | ||
| 775 | if (dal_fixed31_32_lt(ramp->entries.blue[i], min)) | 775 | if (dc_fixpt_lt(ramp->entries.blue[i], min)) |
| 776 | min = ramp->entries.blue[i]; | 776 | min = ramp->entries.blue[i]; |
| 777 | 777 | ||
| 778 | if (dal_fixed31_32_lt(max, ramp->entries.red[i])) | 778 | if (dc_fixpt_lt(max, ramp->entries.red[i])) |
| 779 | max = ramp->entries.red[i]; | 779 | max = ramp->entries.red[i]; |
| 780 | 780 | ||
| 781 | if (dal_fixed31_32_lt(max, ramp->entries.green[i])) | 781 | if (dc_fixpt_lt(max, ramp->entries.green[i])) |
| 782 | max = ramp->entries.green[i]; | 782 | max = ramp->entries.green[i]; |
| 783 | 783 | ||
| 784 | if (dal_fixed31_32_lt(max, ramp->entries.blue[i])) | 784 | if (dc_fixpt_lt(max, ramp->entries.blue[i])) |
| 785 | max = ramp->entries.blue[i]; | 785 | max = ramp->entries.blue[i]; |
| 786 | } | 786 | } |
| 787 | 787 | ||
| 788 | if (dal_fixed31_32_lt(min, dal_fixed31_32_zero)) | 788 | if (dc_fixpt_lt(min, dc_fixpt_zero)) |
| 789 | delta = dal_fixed31_32_neg(min); | 789 | delta = dc_fixpt_neg(min); |
| 790 | 790 | ||
| 791 | offset = dal_fixed31_32_add(min, max); | 791 | offset = dc_fixpt_add(min, max); |
| 792 | 792 | ||
| 793 | for (i = 0 ; i < ramp->num_entries; i++) { | 793 | for (i = 0 ; i < ramp->num_entries; i++) { |
| 794 | pwl_rgb[i].r = dal_fixed31_32_div( | 794 | pwl_rgb[i].r = dc_fixpt_div( |
| 795 | dal_fixed31_32_add( | 795 | dc_fixpt_add( |
| 796 | ramp->entries.red[i], delta), offset); | 796 | ramp->entries.red[i], delta), offset); |
| 797 | pwl_rgb[i].g = dal_fixed31_32_div( | 797 | pwl_rgb[i].g = dc_fixpt_div( |
| 798 | dal_fixed31_32_add( | 798 | dc_fixpt_add( |
| 799 | ramp->entries.green[i], delta), offset); | 799 | ramp->entries.green[i], delta), offset); |
| 800 | pwl_rgb[i].b = dal_fixed31_32_div( | 800 | pwl_rgb[i].b = dc_fixpt_div( |
| 801 | dal_fixed31_32_add( | 801 | dc_fixpt_add( |
| 802 | ramp->entries.blue[i], delta), offset); | 802 | ramp->entries.blue[i], delta), offset); |
| 803 | 803 | ||
| 804 | } | 804 | } |
| 805 | 805 | ||
| 806 | pwl_rgb[i].r = dal_fixed31_32_sub(dal_fixed31_32_mul_int( | 806 | pwl_rgb[i].r = dc_fixpt_sub(dc_fixpt_mul_int( |
| 807 | pwl_rgb[i-1].r, 2), pwl_rgb[i-2].r); | 807 | pwl_rgb[i-1].r, 2), pwl_rgb[i-2].r); |
| 808 | pwl_rgb[i].g = dal_fixed31_32_sub(dal_fixed31_32_mul_int( | 808 | pwl_rgb[i].g = dc_fixpt_sub(dc_fixpt_mul_int( |
| 809 | pwl_rgb[i-1].g, 2), pwl_rgb[i-2].g); | 809 | pwl_rgb[i-1].g, 2), pwl_rgb[i-2].g); |
| 810 | pwl_rgb[i].b = dal_fixed31_32_sub(dal_fixed31_32_mul_int( | 810 | pwl_rgb[i].b = dc_fixpt_sub(dc_fixpt_mul_int( |
| 811 | pwl_rgb[i-1].b, 2), pwl_rgb[i-2].b); | 811 | pwl_rgb[i-1].b, 2), pwl_rgb[i-2].b); |
| 812 | ++i; | 812 | ++i; |
| 813 | pwl_rgb[i].r = dal_fixed31_32_sub(dal_fixed31_32_mul_int( | 813 | pwl_rgb[i].r = dc_fixpt_sub(dc_fixpt_mul_int( |
| 814 | pwl_rgb[i-1].r, 2), pwl_rgb[i-2].r); | 814 | pwl_rgb[i-1].r, 2), pwl_rgb[i-2].r); |
| 815 | pwl_rgb[i].g = dal_fixed31_32_sub(dal_fixed31_32_mul_int( | 815 | pwl_rgb[i].g = dc_fixpt_sub(dc_fixpt_mul_int( |
| 816 | pwl_rgb[i-1].g, 2), pwl_rgb[i-2].g); | 816 | pwl_rgb[i-1].g, 2), pwl_rgb[i-2].g); |
| 817 | pwl_rgb[i].b = dal_fixed31_32_sub(dal_fixed31_32_mul_int( | 817 | pwl_rgb[i].b = dc_fixpt_sub(dc_fixpt_mul_int( |
| 818 | pwl_rgb[i-1].b, 2), pwl_rgb[i-2].b); | 818 | pwl_rgb[i-1].b, 2), pwl_rgb[i-2].b); |
| 819 | } | 819 | } |
| 820 | 820 | ||
| @@ -846,40 +846,40 @@ static void scale_user_regamma_ramp(struct pwl_float_data *pwl_rgb, | |||
| 846 | 846 | ||
| 847 | i = 0; | 847 | i = 0; |
| 848 | do { | 848 | do { |
| 849 | rgb->r = dal_fixed31_32_from_fraction( | 849 | rgb->r = dc_fixpt_from_fraction( |
| 850 | ramp->gamma[i], scaler); | 850 | ramp->gamma[i], scaler); |
| 851 | rgb->g = dal_fixed31_32_from_fraction( | 851 | rgb->g = dc_fixpt_from_fraction( |
| 852 | ramp->gamma[i + 256], scaler); | 852 | ramp->gamma[i + 256], scaler); |
| 853 | rgb->b = dal_fixed31_32_from_fraction( | 853 | rgb->b = dc_fixpt_from_fraction( |
| 854 | ramp->gamma[i + 512], scaler); | 854 | ramp->gamma[i + 512], scaler); |
| 855 | 855 | ||
| 856 | ++rgb; | 856 | ++rgb; |
| 857 | ++i; | 857 | ++i; |
| 858 | } while (i != GAMMA_RGB_256_ENTRIES); | 858 | } while (i != GAMMA_RGB_256_ENTRIES); |
| 859 | 859 | ||
| 860 | rgb->r = dal_fixed31_32_mul(rgb_last->r, | 860 | rgb->r = dc_fixpt_mul(rgb_last->r, |
| 861 | dividers.divider1); | 861 | dividers.divider1); |
| 862 | rgb->g = dal_fixed31_32_mul(rgb_last->g, | 862 | rgb->g = dc_fixpt_mul(rgb_last->g, |
| 863 | dividers.divider1); | 863 | dividers.divider1); |
| 864 | rgb->b = dal_fixed31_32_mul(rgb_last->b, | 864 | rgb->b = dc_fixpt_mul(rgb_last->b, |
| 865 | dividers.divider1); | 865 | dividers.divider1); |
| 866 | 866 | ||
| 867 | ++rgb; | 867 | ++rgb; |
| 868 | 868 | ||
| 869 | rgb->r = dal_fixed31_32_mul(rgb_last->r, | 869 | rgb->r = dc_fixpt_mul(rgb_last->r, |
| 870 | dividers.divider2); | 870 | dividers.divider2); |
| 871 | rgb->g = dal_fixed31_32_mul(rgb_last->g, | 871 | rgb->g = dc_fixpt_mul(rgb_last->g, |
| 872 | dividers.divider2); | 872 | dividers.divider2); |
| 873 | rgb->b = dal_fixed31_32_mul(rgb_last->b, | 873 | rgb->b = dc_fixpt_mul(rgb_last->b, |
| 874 | dividers.divider2); | 874 | dividers.divider2); |
| 875 | 875 | ||
| 876 | ++rgb; | 876 | ++rgb; |
| 877 | 877 | ||
| 878 | rgb->r = dal_fixed31_32_mul(rgb_last->r, | 878 | rgb->r = dc_fixpt_mul(rgb_last->r, |
| 879 | dividers.divider3); | 879 | dividers.divider3); |
| 880 | rgb->g = dal_fixed31_32_mul(rgb_last->g, | 880 | rgb->g = dc_fixpt_mul(rgb_last->g, |
| 881 | dividers.divider3); | 881 | dividers.divider3); |
| 882 | rgb->b = dal_fixed31_32_mul(rgb_last->b, | 882 | rgb->b = dc_fixpt_mul(rgb_last->b, |
| 883 | dividers.divider3); | 883 | dividers.divider3); |
| 884 | } | 884 | } |
| 885 | 885 | ||
| @@ -913,7 +913,7 @@ static void apply_lut_1d( | |||
| 913 | struct fixed31_32 lut2; | 913 | struct fixed31_32 lut2; |
| 914 | const int max_lut_index = 4095; | 914 | const int max_lut_index = 4095; |
| 915 | const struct fixed31_32 max_lut_index_f = | 915 | const struct fixed31_32 max_lut_index_f = |
| 916 | dal_fixed31_32_from_int_nonconst(max_lut_index); | 916 | dc_fixpt_from_int_nonconst(max_lut_index); |
| 917 | int32_t index = 0, index_next = 0; | 917 | int32_t index = 0, index_next = 0; |
| 918 | struct fixed31_32 index_f; | 918 | struct fixed31_32 index_f; |
| 919 | struct fixed31_32 delta_lut; | 919 | struct fixed31_32 delta_lut; |
| @@ -931,10 +931,10 @@ static void apply_lut_1d( | |||
| 931 | else | 931 | else |
| 932 | regamma_y = &tf_pts->blue[i]; | 932 | regamma_y = &tf_pts->blue[i]; |
| 933 | 933 | ||
| 934 | norm_y = dal_fixed31_32_mul(max_lut_index_f, | 934 | norm_y = dc_fixpt_mul(max_lut_index_f, |
| 935 | *regamma_y); | 935 | *regamma_y); |
| 936 | index = dal_fixed31_32_floor(norm_y); | 936 | index = dc_fixpt_floor(norm_y); |
| 937 | index_f = dal_fixed31_32_from_int_nonconst(index); | 937 | index_f = dc_fixpt_from_int_nonconst(index); |
| 938 | 938 | ||
| 939 | if (index < 0 || index > max_lut_index) | 939 | if (index < 0 || index > max_lut_index) |
| 940 | continue; | 940 | continue; |
| @@ -953,11 +953,11 @@ static void apply_lut_1d( | |||
| 953 | } | 953 | } |
| 954 | 954 | ||
| 955 | // we have everything now, so interpolate | 955 | // we have everything now, so interpolate |
| 956 | delta_lut = dal_fixed31_32_sub(lut2, lut1); | 956 | delta_lut = dc_fixpt_sub(lut2, lut1); |
| 957 | delta_index = dal_fixed31_32_sub(norm_y, index_f); | 957 | delta_index = dc_fixpt_sub(norm_y, index_f); |
| 958 | 958 | ||
| 959 | *regamma_y = dal_fixed31_32_add(lut1, | 959 | *regamma_y = dc_fixpt_add(lut1, |
| 960 | dal_fixed31_32_mul(delta_index, delta_lut)); | 960 | dc_fixpt_mul(delta_index, delta_lut)); |
| 961 | } | 961 | } |
| 962 | } | 962 | } |
| 963 | } | 963 | } |
| @@ -973,7 +973,7 @@ static void build_evenly_distributed_points( | |||
| 973 | uint32_t i = 0; | 973 | uint32_t i = 0; |
| 974 | 974 | ||
| 975 | do { | 975 | do { |
| 976 | struct fixed31_32 value = dal_fixed31_32_from_fraction(i, | 976 | struct fixed31_32 value = dc_fixpt_from_fraction(i, |
| 977 | numberof_points - 1); | 977 | numberof_points - 1); |
| 978 | 978 | ||
| 979 | p->r = value; | 979 | p->r = value; |
| @@ -984,21 +984,21 @@ static void build_evenly_distributed_points( | |||
| 984 | ++i; | 984 | ++i; |
| 985 | } while (i != numberof_points); | 985 | } while (i != numberof_points); |
| 986 | 986 | ||
| 987 | p->r = dal_fixed31_32_div(p_last->r, dividers.divider1); | 987 | p->r = dc_fixpt_div(p_last->r, dividers.divider1); |
| 988 | p->g = dal_fixed31_32_div(p_last->g, dividers.divider1); | 988 | p->g = dc_fixpt_div(p_last->g, dividers.divider1); |
| 989 | p->b = dal_fixed31_32_div(p_last->b, dividers.divider1); | 989 | p->b = dc_fixpt_div(p_last->b, dividers.divider1); |
| 990 | 990 | ||
| 991 | ++p; | 991 | ++p; |
| 992 | 992 | ||
| 993 | p->r = dal_fixed31_32_div(p_last->r, dividers.divider2); | 993 | p->r = dc_fixpt_div(p_last->r, dividers.divider2); |
| 994 | p->g = dal_fixed31_32_div(p_last->g, dividers.divider2); | 994 | p->g = dc_fixpt_div(p_last->g, dividers.divider2); |
| 995 | p->b = dal_fixed31_32_div(p_last->b, dividers.divider2); | 995 | p->b = dc_fixpt_div(p_last->b, dividers.divider2); |
| 996 | 996 | ||
| 997 | ++p; | 997 | ++p; |
| 998 | 998 | ||
| 999 | p->r = dal_fixed31_32_div(p_last->r, dividers.divider3); | 999 | p->r = dc_fixpt_div(p_last->r, dividers.divider3); |
| 1000 | p->g = dal_fixed31_32_div(p_last->g, dividers.divider3); | 1000 | p->g = dc_fixpt_div(p_last->g, dividers.divider3); |
| 1001 | p->b = dal_fixed31_32_div(p_last->b, dividers.divider3); | 1001 | p->b = dc_fixpt_div(p_last->b, dividers.divider3); |
| 1002 | } | 1002 | } |
| 1003 | 1003 | ||
| 1004 | static inline void copy_rgb_regamma_to_coordinates_x( | 1004 | static inline void copy_rgb_regamma_to_coordinates_x( |
| @@ -1094,7 +1094,7 @@ static void interpolate_user_regamma(uint32_t hw_points_num, | |||
| 1094 | struct fixed31_32 *tf_point; | 1094 | struct fixed31_32 *tf_point; |
| 1095 | struct fixed31_32 hw_x; | 1095 | struct fixed31_32 hw_x; |
| 1096 | struct fixed31_32 norm_factor = | 1096 | struct fixed31_32 norm_factor = |
| 1097 | dal_fixed31_32_from_int_nonconst(255); | 1097 | dc_fixpt_from_int_nonconst(255); |
| 1098 | struct fixed31_32 norm_x; | 1098 | struct fixed31_32 norm_x; |
| 1099 | struct fixed31_32 index_f; | 1099 | struct fixed31_32 index_f; |
| 1100 | struct fixed31_32 lut1; | 1100 | struct fixed31_32 lut1; |
| @@ -1105,9 +1105,9 @@ static void interpolate_user_regamma(uint32_t hw_points_num, | |||
| 1105 | i = 0; | 1105 | i = 0; |
| 1106 | /* fixed_pt library has problems handling too small values */ | 1106 | /* fixed_pt library has problems handling too small values */ |
| 1107 | while (i != 32) { | 1107 | while (i != 32) { |
| 1108 | tf_pts->red[i] = dal_fixed31_32_zero; | 1108 | tf_pts->red[i] = dc_fixpt_zero; |
| 1109 | tf_pts->green[i] = dal_fixed31_32_zero; | 1109 | tf_pts->green[i] = dc_fixpt_zero; |
| 1110 | tf_pts->blue[i] = dal_fixed31_32_zero; | 1110 | tf_pts->blue[i] = dc_fixpt_zero; |
| 1111 | ++i; | 1111 | ++i; |
| 1112 | } | 1112 | } |
| 1113 | while (i <= hw_points_num + 1) { | 1113 | while (i <= hw_points_num + 1) { |
| @@ -1129,12 +1129,12 @@ static void interpolate_user_regamma(uint32_t hw_points_num, | |||
| 1129 | } else | 1129 | } else |
| 1130 | hw_x = coordinates_x[i].x; | 1130 | hw_x = coordinates_x[i].x; |
| 1131 | 1131 | ||
| 1132 | norm_x = dal_fixed31_32_mul(norm_factor, hw_x); | 1132 | norm_x = dc_fixpt_mul(norm_factor, hw_x); |
| 1133 | index = dal_fixed31_32_floor(norm_x); | 1133 | index = dc_fixpt_floor(norm_x); |
| 1134 | if (index < 0 || index > 255) | 1134 | if (index < 0 || index > 255) |
| 1135 | continue; | 1135 | continue; |
| 1136 | 1136 | ||
| 1137 | index_f = dal_fixed31_32_from_int_nonconst(index); | 1137 | index_f = dc_fixpt_from_int_nonconst(index); |
| 1138 | index_next = (index == 255) ? index : index + 1; | 1138 | index_next = (index == 255) ? index : index + 1; |
| 1139 | 1139 | ||
| 1140 | if (color == 0) { | 1140 | if (color == 0) { |
| @@ -1149,11 +1149,11 @@ static void interpolate_user_regamma(uint32_t hw_points_num, | |||
| 1149 | } | 1149 | } |
| 1150 | 1150 | ||
| 1151 | // we have everything now, so interpolate | 1151 | // we have everything now, so interpolate |
| 1152 | delta_lut = dal_fixed31_32_sub(lut2, lut1); | 1152 | delta_lut = dc_fixpt_sub(lut2, lut1); |
| 1153 | delta_index = dal_fixed31_32_sub(norm_x, index_f); | 1153 | delta_index = dc_fixpt_sub(norm_x, index_f); |
| 1154 | 1154 | ||
| 1155 | *tf_point = dal_fixed31_32_add(lut1, | 1155 | *tf_point = dc_fixpt_add(lut1, |
| 1156 | dal_fixed31_32_mul(delta_index, delta_lut)); | 1156 | dc_fixpt_mul(delta_index, delta_lut)); |
| 1157 | } | 1157 | } |
| 1158 | ++i; | 1158 | ++i; |
| 1159 | } | 1159 | } |
| @@ -1168,15 +1168,15 @@ static void build_new_custom_resulted_curve( | |||
| 1168 | i = 0; | 1168 | i = 0; |
| 1169 | 1169 | ||
| 1170 | while (i != hw_points_num + 1) { | 1170 | while (i != hw_points_num + 1) { |
| 1171 | tf_pts->red[i] = dal_fixed31_32_clamp( | 1171 | tf_pts->red[i] = dc_fixpt_clamp( |
| 1172 | tf_pts->red[i], dal_fixed31_32_zero, | 1172 | tf_pts->red[i], dc_fixpt_zero, |
| 1173 | dal_fixed31_32_one); | 1173 | dc_fixpt_one); |
| 1174 | tf_pts->green[i] = dal_fixed31_32_clamp( | 1174 | tf_pts->green[i] = dc_fixpt_clamp( |
| 1175 | tf_pts->green[i], dal_fixed31_32_zero, | 1175 | tf_pts->green[i], dc_fixpt_zero, |
| 1176 | dal_fixed31_32_one); | 1176 | dc_fixpt_one); |
| 1177 | tf_pts->blue[i] = dal_fixed31_32_clamp( | 1177 | tf_pts->blue[i] = dc_fixpt_clamp( |
| 1178 | tf_pts->blue[i], dal_fixed31_32_zero, | 1178 | tf_pts->blue[i], dc_fixpt_zero, |
| 1179 | dal_fixed31_32_one); | 1179 | dc_fixpt_one); |
| 1180 | 1180 | ||
| 1181 | ++i; | 1181 | ++i; |
| 1182 | } | 1182 | } |
| @@ -1290,9 +1290,9 @@ bool mod_color_calculate_regamma_params(struct dc_transfer_func *output_tf, | |||
| 1290 | if (!coeff) | 1290 | if (!coeff) |
| 1291 | goto coeff_alloc_fail; | 1291 | goto coeff_alloc_fail; |
| 1292 | 1292 | ||
| 1293 | dividers.divider1 = dal_fixed31_32_from_fraction(3, 2); | 1293 | dividers.divider1 = dc_fixpt_from_fraction(3, 2); |
| 1294 | dividers.divider2 = dal_fixed31_32_from_int(2); | 1294 | dividers.divider2 = dc_fixpt_from_int(2); |
| 1295 | dividers.divider3 = dal_fixed31_32_from_fraction(5, 2); | 1295 | dividers.divider3 = dc_fixpt_from_fraction(5, 2); |
| 1296 | 1296 | ||
| 1297 | tf = output_tf->tf; | 1297 | tf = output_tf->tf; |
| 1298 | 1298 | ||
| @@ -1357,15 +1357,15 @@ bool calculate_user_regamma_coeff(struct dc_transfer_func *output_tf, | |||
| 1357 | uint32_t i = 0; | 1357 | uint32_t i = 0; |
| 1358 | 1358 | ||
| 1359 | do { | 1359 | do { |
| 1360 | coeff.a0[i] = dal_fixed31_32_from_fraction( | 1360 | coeff.a0[i] = dc_fixpt_from_fraction( |
| 1361 | regamma->coeff.A0[i], 10000000); | 1361 | regamma->coeff.A0[i], 10000000); |
| 1362 | coeff.a1[i] = dal_fixed31_32_from_fraction( | 1362 | coeff.a1[i] = dc_fixpt_from_fraction( |
| 1363 | regamma->coeff.A1[i], 1000); | 1363 | regamma->coeff.A1[i], 1000); |
| 1364 | coeff.a2[i] = dal_fixed31_32_from_fraction( | 1364 | coeff.a2[i] = dc_fixpt_from_fraction( |
| 1365 | regamma->coeff.A2[i], 1000); | 1365 | regamma->coeff.A2[i], 1000); |
| 1366 | coeff.a3[i] = dal_fixed31_32_from_fraction( | 1366 | coeff.a3[i] = dc_fixpt_from_fraction( |
| 1367 | regamma->coeff.A3[i], 1000); | 1367 | regamma->coeff.A3[i], 1000); |
| 1368 | coeff.user_gamma[i] = dal_fixed31_32_from_fraction( | 1368 | coeff.user_gamma[i] = dc_fixpt_from_fraction( |
| 1369 | regamma->coeff.gamma[i], 1000); | 1369 | regamma->coeff.gamma[i], 1000); |
| 1370 | 1370 | ||
| 1371 | ++i; | 1371 | ++i; |
| @@ -1374,9 +1374,9 @@ bool calculate_user_regamma_coeff(struct dc_transfer_func *output_tf, | |||
| 1374 | i = 0; | 1374 | i = 0; |
| 1375 | /* fixed_pt library has problems handling too small values */ | 1375 | /* fixed_pt library has problems handling too small values */ |
| 1376 | while (i != 32) { | 1376 | while (i != 32) { |
| 1377 | output_tf->tf_pts.red[i] = dal_fixed31_32_zero; | 1377 | output_tf->tf_pts.red[i] = dc_fixpt_zero; |
| 1378 | output_tf->tf_pts.green[i] = dal_fixed31_32_zero; | 1378 | output_tf->tf_pts.green[i] = dc_fixpt_zero; |
| 1379 | output_tf->tf_pts.blue[i] = dal_fixed31_32_zero; | 1379 | output_tf->tf_pts.blue[i] = dc_fixpt_zero; |
| 1380 | ++coord_x; | 1380 | ++coord_x; |
| 1381 | ++i; | 1381 | ++i; |
| 1382 | } | 1382 | } |
| @@ -1423,9 +1423,9 @@ bool calculate_user_regamma_ramp(struct dc_transfer_func *output_tf, | |||
| 1423 | if (!rgb_regamma) | 1423 | if (!rgb_regamma) |
| 1424 | goto rgb_regamma_alloc_fail; | 1424 | goto rgb_regamma_alloc_fail; |
| 1425 | 1425 | ||
| 1426 | dividers.divider1 = dal_fixed31_32_from_fraction(3, 2); | 1426 | dividers.divider1 = dc_fixpt_from_fraction(3, 2); |
| 1427 | dividers.divider2 = dal_fixed31_32_from_int(2); | 1427 | dividers.divider2 = dc_fixpt_from_int(2); |
| 1428 | dividers.divider3 = dal_fixed31_32_from_fraction(5, 2); | 1428 | dividers.divider3 = dc_fixpt_from_fraction(5, 2); |
| 1429 | 1429 | ||
| 1430 | scale_user_regamma_ramp(rgb_user, ®amma->ramp, dividers); | 1430 | scale_user_regamma_ramp(rgb_user, ®amma->ramp, dividers); |
| 1431 | 1431 | ||
| @@ -1496,9 +1496,9 @@ bool mod_color_calculate_degamma_params(struct dc_transfer_func *input_tf, | |||
| 1496 | if (!coeff) | 1496 | if (!coeff) |
| 1497 | goto coeff_alloc_fail; | 1497 | goto coeff_alloc_fail; |
| 1498 | 1498 | ||
| 1499 | dividers.divider1 = dal_fixed31_32_from_fraction(3, 2); | 1499 | dividers.divider1 = dc_fixpt_from_fraction(3, 2); |
| 1500 | dividers.divider2 = dal_fixed31_32_from_int(2); | 1500 | dividers.divider2 = dc_fixpt_from_int(2); |
| 1501 | dividers.divider3 = dal_fixed31_32_from_fraction(5, 2); | 1501 | dividers.divider3 = dc_fixpt_from_fraction(5, 2); |
| 1502 | 1502 | ||
| 1503 | tf = input_tf->tf; | 1503 | tf = input_tf->tf; |
| 1504 | 1504 | ||
