Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 78aad7f8 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

[media] vivid-tpg: precalculate colorspace/xfer_func combinations



Precalculate all the colorspace/transfer function combinations in order
to easily generate the correct colors.

Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent ca5316db
Loading
Loading
Loading
Loading
+365 −113

File changed.

Preview size limit exceeded, changes collapsed.

+3 −1
Original line number Diff line number Diff line
@@ -61,6 +61,8 @@ enum tpg_color {
extern const struct color tpg_colors[TPG_COLOR_MAX];
extern const unsigned short tpg_rec709_to_linear[255 * 16 + 1];
extern const unsigned short tpg_linear_to_rec709[255 * 16 + 1];
extern const struct color16 tpg_csc_colors[V4L2_COLORSPACE_BT2020 + 1][TPG_COLOR_CSC_BLACK + 1];
extern const struct color16 tpg_csc_colors[V4L2_COLORSPACE_BT2020 + 1]
					  [V4L2_XFER_FUNC_NONE + 1]
					  [TPG_COLOR_CSC_BLACK + 1];

#endif
+3 −3
Original line number Diff line number Diff line
@@ -706,9 +706,9 @@ static void precalculate_color(struct tpg_data *tpg, int k)
	}

	if (tpg->pattern == TPG_PAT_CSC_COLORBAR && col <= TPG_COLOR_CSC_BLACK) {
		r = tpg_csc_colors[tpg->colorspace][col].r;
		g = tpg_csc_colors[tpg->colorspace][col].g;
		b = tpg_csc_colors[tpg->colorspace][col].b;
		r = tpg_csc_colors[tpg->colorspace][tpg->real_xfer_func][col].r;
		g = tpg_csc_colors[tpg->colorspace][tpg->real_xfer_func][col].g;
		b = tpg_csc_colors[tpg->colorspace][tpg->real_xfer_func][col].b;
	} else {
		r <<= 4;
		g <<= 4;