From eb7a146b51dd8bcb74242c1ffba0d0e2d21d3288 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 20 Mar 2010 10:18:04 +0100 Subject: [PATCH] alpha: Use correct matrixes to convert chroma keying color to YUV --- gst/alpha/gstalpha.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/gst/alpha/gstalpha.c b/gst/alpha/gstalpha.c index 7185336..a57b76f 100644 --- a/gst/alpha/gstalpha.c +++ b/gst/alpha/gstalpha.c @@ -944,9 +944,28 @@ gst_alpha_init_params (GstAlpha * alpha) gfloat y; const gint *matrix; - matrix = - (alpha->out_sdtv) ? cog_rgb_to_ycbcr_matrix_8bit_sdtv : - cog_rgb_to_ycbcr_matrix_8bit_hdtv; + /* RGB->RGB: convert to SDTV YUV, chroma keying, convert back + * YUV->RGB: chroma keying, convert to RGB + * RGB->YUV: convert to YUV, chroma keying + * YUV->YUV: convert matrix, chroma keying + */ + if (gst_video_format_is_rgb (alpha->in_format) + && gst_video_format_is_rgb (alpha->out_format)) + matrix = cog_rgb_to_ycbcr_matrix_8bit_sdtv; + else if (gst_video_format_is_yuv (alpha->in_format) + && gst_video_format_is_rgb (alpha->out_format)) + matrix = + (alpha->in_sdtv) ? cog_rgb_to_ycbcr_matrix_8bit_sdtv : + cog_rgb_to_ycbcr_matrix_8bit_hdtv; + else if (gst_video_format_is_rgb (alpha->in_format) + && gst_video_format_is_yuv (alpha->out_format)) + matrix = + (alpha->out_sdtv) ? cog_rgb_to_ycbcr_matrix_8bit_sdtv : + cog_rgb_to_ycbcr_matrix_8bit_hdtv; + else /* yuv -> yuv */ + matrix = + (alpha->out_sdtv) ? cog_rgb_to_ycbcr_matrix_8bit_sdtv : + cog_rgb_to_ycbcr_matrix_8bit_hdtv; y = (matrix[0] * ((gint) alpha->target_r) + matrix[1] * ((gint) alpha->target_g) + -- 2.7.4