Exemple #1
0
/**
 *****************************************************************************
 *  Function: dal_transform_wide_gamut_set_gamut_remap
 *
 *  @param [in] const struct xfm_grph_csc_adjustment *adjust
 *
 *  @return
 *     void
 *
 *  @note calculate and apply color temperature adjustment to in Rgb color space
 *
 *  @see
 *
 *****************************************************************************
 */
static void dce_transform_set_gamut_remap(
	struct transform *xfm,
	const struct xfm_grph_csc_adjustment *adjust)
{
	struct dce_transform *xfm_dce = TO_DCE_TRANSFORM(xfm);
	int i = 0;

	if (adjust->gamut_adjust_type != GRAPHICS_GAMUT_ADJUST_TYPE_SW)
		/* Bypass if type is bypass or hw */
		program_gamut_remap(xfm_dce, NULL);
	else {
		struct fixed31_32 arr_matrix[GAMUT_MATRIX_SIZE];
		uint16_t arr_reg_val[GAMUT_MATRIX_SIZE];

		for (i = 0; i < GAMUT_MATRIX_SIZE; i++)
			arr_matrix[i] = adjust->temperature_matrix[i];

		convert_float_matrix(
			arr_reg_val, arr_matrix, GAMUT_MATRIX_SIZE);

		program_gamut_remap(xfm_dce, arr_reg_val);
	}
}
/**
 *****************************************************************************
 *  Function: dal_transform_wide_gamut_set_gamut_remap
 *
 *  @param [in] const struct xfm_grph_csc_adjustment *adjust
 *
 *  @return
 *     void
 *
 *  @note calculate and apply color temperature adjustment to in Rgb color space
 *
 *  @see
 *
 *****************************************************************************
 */
void dce80_transform_set_gamut_remap(
	struct transform *xfm,
	const struct xfm_grph_csc_adjustment *adjust)
{
	struct dce80_transform *xfm80 = TO_DCE80_TRANSFORM(xfm);

	if (adjust->gamut_adjust_type != GRAPHICS_GAMUT_ADJUST_TYPE_SW ||
		adjust->temperature_divider == 0)
		program_gamut_remap(xfm80, NULL);
	else {
		struct fixed31_32 arr_matrix[GAMUT_MATRIX_SIZE];
		uint16_t arr_reg_val[GAMUT_MATRIX_SIZE];

		arr_matrix[0] =
			dal_fixed31_32_from_fraction(
				adjust->temperature_matrix[0],
				adjust->temperature_divider);
		arr_matrix[1] =
			dal_fixed31_32_from_fraction(
				adjust->temperature_matrix[1],
				adjust->temperature_divider);
		arr_matrix[2] =
			dal_fixed31_32_from_fraction(
				adjust->temperature_matrix[2],
				adjust->temperature_divider);
		arr_matrix[3] = dal_fixed31_32_zero;

		arr_matrix[4] =
			dal_fixed31_32_from_fraction(
				adjust->temperature_matrix[3],
				adjust->temperature_divider);
		arr_matrix[5] =
			dal_fixed31_32_from_fraction(
				adjust->temperature_matrix[4],
				adjust->temperature_divider);
		arr_matrix[6] =
			dal_fixed31_32_from_fraction(
				adjust->temperature_matrix[5],
				adjust->temperature_divider);
		arr_matrix[7] = dal_fixed31_32_zero;

		arr_matrix[8] =
			dal_fixed31_32_from_fraction(
				adjust->temperature_matrix[6],
				adjust->temperature_divider);
		arr_matrix[9] =
			dal_fixed31_32_from_fraction(
				adjust->temperature_matrix[7],
				adjust->temperature_divider);
		arr_matrix[10] =
			dal_fixed31_32_from_fraction(
				adjust->temperature_matrix[8],
				adjust->temperature_divider);
		arr_matrix[11] = dal_fixed31_32_zero;

		convert_float_matrix(
			arr_reg_val, arr_matrix, GAMUT_MATRIX_SIZE);

		program_gamut_remap(xfm80, arr_reg_val);
	}
}