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

[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
...@@ -61,6 +61,8 @@ enum tpg_color { ...@@ -61,6 +61,8 @@ enum tpg_color {
extern const struct color tpg_colors[TPG_COLOR_MAX]; 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_rec709_to_linear[255 * 16 + 1];
extern const unsigned short tpg_linear_to_rec709[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 #endif
...@@ -706,9 +706,9 @@ static void precalculate_color(struct tpg_data *tpg, int k) ...@@ -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) { if (tpg->pattern == TPG_PAT_CSC_COLORBAR && col <= TPG_COLOR_CSC_BLACK) {
r = tpg_csc_colors[tpg->colorspace][col].r; r = tpg_csc_colors[tpg->colorspace][tpg->real_xfer_func][col].r;
g = tpg_csc_colors[tpg->colorspace][col].g; g = tpg_csc_colors[tpg->colorspace][tpg->real_xfer_func][col].g;
b = tpg_csc_colors[tpg->colorspace][col].b; b = tpg_csc_colors[tpg->colorspace][tpg->real_xfer_func][col].b;
} else { } else {
r <<= 4; r <<= 4;
g <<= 4; g <<= 4;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment