|
@@ -103,124 +103,6 @@ void convert_float_matrix(
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-static void calculate_adjustments_common(
|
|
|
- const struct fixed31_32 *ideal_matrix,
|
|
|
- const struct dc_csc_adjustments *adjustments,
|
|
|
- struct fixed31_32 *matrix)
|
|
|
-{
|
|
|
- const struct fixed31_32 sin_hue =
|
|
|
- dal_fixed31_32_sin(adjustments->hue);
|
|
|
- const struct fixed31_32 cos_hue =
|
|
|
- dal_fixed31_32_cos(adjustments->hue);
|
|
|
-
|
|
|
- const struct fixed31_32 multiplier =
|
|
|
- dal_fixed31_32_mul(
|
|
|
- adjustments->contrast,
|
|
|
- adjustments->saturation);
|
|
|
-
|
|
|
- matrix[0] = dal_fixed31_32_mul(
|
|
|
- ideal_matrix[0],
|
|
|
- adjustments->contrast);
|
|
|
-
|
|
|
- matrix[1] = dal_fixed31_32_mul(
|
|
|
- ideal_matrix[1],
|
|
|
- adjustments->contrast);
|
|
|
-
|
|
|
- matrix[2] = dal_fixed31_32_mul(
|
|
|
- ideal_matrix[2],
|
|
|
- adjustments->contrast);
|
|
|
-
|
|
|
- matrix[4] = dal_fixed31_32_mul(
|
|
|
- multiplier,
|
|
|
- dal_fixed31_32_add(
|
|
|
- dal_fixed31_32_mul(
|
|
|
- ideal_matrix[8],
|
|
|
- sin_hue),
|
|
|
- dal_fixed31_32_mul(
|
|
|
- ideal_matrix[4],
|
|
|
- cos_hue)));
|
|
|
-
|
|
|
- matrix[5] = dal_fixed31_32_mul(
|
|
|
- multiplier,
|
|
|
- dal_fixed31_32_add(
|
|
|
- dal_fixed31_32_mul(
|
|
|
- ideal_matrix[9],
|
|
|
- sin_hue),
|
|
|
- dal_fixed31_32_mul(
|
|
|
- ideal_matrix[5],
|
|
|
- cos_hue)));
|
|
|
-
|
|
|
- matrix[6] = dal_fixed31_32_mul(
|
|
|
- multiplier,
|
|
|
- dal_fixed31_32_add(
|
|
|
- dal_fixed31_32_mul(
|
|
|
- ideal_matrix[10],
|
|
|
- sin_hue),
|
|
|
- dal_fixed31_32_mul(
|
|
|
- ideal_matrix[6],
|
|
|
- cos_hue)));
|
|
|
-
|
|
|
- matrix[7] = ideal_matrix[7];
|
|
|
-
|
|
|
- matrix[8] = dal_fixed31_32_mul(
|
|
|
- multiplier,
|
|
|
- dal_fixed31_32_sub(
|
|
|
- dal_fixed31_32_mul(
|
|
|
- ideal_matrix[8],
|
|
|
- cos_hue),
|
|
|
- dal_fixed31_32_mul(
|
|
|
- ideal_matrix[4],
|
|
|
- sin_hue)));
|
|
|
-
|
|
|
- matrix[9] = dal_fixed31_32_mul(
|
|
|
- multiplier,
|
|
|
- dal_fixed31_32_sub(
|
|
|
- dal_fixed31_32_mul(
|
|
|
- ideal_matrix[9],
|
|
|
- cos_hue),
|
|
|
- dal_fixed31_32_mul(
|
|
|
- ideal_matrix[5],
|
|
|
- sin_hue)));
|
|
|
-
|
|
|
- matrix[10] = dal_fixed31_32_mul(
|
|
|
- multiplier,
|
|
|
- dal_fixed31_32_sub(
|
|
|
- dal_fixed31_32_mul(
|
|
|
- ideal_matrix[10],
|
|
|
- cos_hue),
|
|
|
- dal_fixed31_32_mul(
|
|
|
- ideal_matrix[6],
|
|
|
- sin_hue)));
|
|
|
-
|
|
|
- matrix[11] = ideal_matrix[11];
|
|
|
-}
|
|
|
-
|
|
|
-void calculate_adjustments(
|
|
|
- const struct fixed31_32 *ideal_matrix,
|
|
|
- const struct dc_csc_adjustments *adjustments,
|
|
|
- struct fixed31_32 *matrix)
|
|
|
-{
|
|
|
- calculate_adjustments_common(ideal_matrix, adjustments, matrix);
|
|
|
-
|
|
|
- matrix[3] = dal_fixed31_32_add(
|
|
|
- ideal_matrix[3],
|
|
|
- dal_fixed31_32_mul(
|
|
|
- adjustments->brightness,
|
|
|
- dal_fixed31_32_from_fraction(86, 100)));
|
|
|
-}
|
|
|
-
|
|
|
-void calculate_adjustments_y_only(
|
|
|
- const struct fixed31_32 *ideal_matrix,
|
|
|
- const struct dc_csc_adjustments *adjustments,
|
|
|
- struct fixed31_32 *matrix)
|
|
|
-{
|
|
|
- calculate_adjustments_common(ideal_matrix, adjustments, matrix);
|
|
|
-
|
|
|
- matrix[3] = dal_fixed31_32_add(
|
|
|
- ideal_matrix[3],
|
|
|
- adjustments->brightness);
|
|
|
-}
|
|
|
-
|
|
|
unsigned int log_2(unsigned int num)
|
|
|
{
|
|
|
unsigned int result = 0;
|