summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2010-03-20 10:18:04 +0100
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2010-03-20 10:18:04 +0100
commiteb7a146b51dd8bcb74242c1ffba0d0e2d21d3288 (patch)
tree335aea6bffd2f862c856150199cd1c89b066ac1d
parentb64619dc4efc41e5927e43d768c38db778b1da14 (diff)
alpha: Use correct matrixes to convert chroma keying color to YUV
-rw-r--r--gst/alpha/gstalpha.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/gst/alpha/gstalpha.c b/gst/alpha/gstalpha.c
index 7185336bf..a57b76f6e 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) +