summaryrefslogtreecommitdiff
path: root/gst/videoconvert
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2014-09-24 11:04:15 +0200
committerWim Taymans <wtaymans@redhat.com>2014-09-24 15:59:39 +0200
commit0c40b83ed49c4f6a3941b7e71d826648099033e4 (patch)
treec9822d742e3c091c701a097095ea7555f620b66c /gst/videoconvert
parent8242676dc20b0a9b5dcac9a0e8048fc672d3b314 (diff)
downloadgstreamer-plugins-base-0c40b83ed49c4f6a3941b7e71d826648099033e4.tar.gz
video-color: add gst_video_color_matrix_get_Kr_Kb()
Move the function to get the color matrix coefficients from videoconvert to the video library.
Diffstat (limited to 'gst/videoconvert')
-rw-r--r--gst/videoconvert/videoconvert.c37
1 files changed, 2 insertions, 35 deletions
diff --git a/gst/videoconvert/videoconvert.c b/gst/videoconvert/videoconvert.c
index 380822dae..a78218b56 100644
--- a/gst/videoconvert/videoconvert.c
+++ b/gst/videoconvert/videoconvert.c
@@ -183,39 +183,6 @@ videoconvert_convert_matrix16 (VideoConvert * convert, gpointer pixels)
}
static gboolean
-get_Kr_Kb (GstVideoColorMatrix matrix, gdouble * Kr, gdouble * Kb)
-{
- gboolean res = TRUE;
-
- switch (matrix) {
- /* RGB */
- default:
- case GST_VIDEO_COLOR_MATRIX_RGB:
- res = FALSE;
- break;
- /* YUV */
- case GST_VIDEO_COLOR_MATRIX_FCC:
- *Kr = 0.30;
- *Kb = 0.11;
- break;
- case GST_VIDEO_COLOR_MATRIX_BT709:
- *Kr = 0.2126;
- *Kb = 0.0722;
- break;
- case GST_VIDEO_COLOR_MATRIX_BT601:
- *Kr = 0.2990;
- *Kb = 0.1140;
- break;
- case GST_VIDEO_COLOR_MATRIX_SMPTE240M:
- *Kr = 0.212;
- *Kb = 0.087;
- break;
- }
- GST_DEBUG ("matrix: %d, Kr %f, Kb %f", matrix, *Kr, *Kb);
- return res;
-}
-
-static gboolean
videoconvert_convert_compute_matrix (VideoConvert * convert)
{
GstVideoInfo *in_info, *out_info;
@@ -283,7 +250,7 @@ videoconvert_convert_compute_matrix (VideoConvert * convert)
1 / ((float) scale[1]), 1 / ((float) scale[2]));
/* 2. bring components to R'G'B' space */
- if (get_Kr_Kb (in_info->colorimetry.matrix, &Kr, &Kb))
+ if (gst_video_color_matrix_get_Kr_Kb (in_info->colorimetry.matrix, &Kr, &Kb))
color_matrix_YCbCr_to_RGB (&dst, Kr, Kb);
/* 3. inverse transfer function. R'G'B' to linear RGB */
@@ -295,7 +262,7 @@ videoconvert_convert_compute_matrix (VideoConvert * convert)
/* 6. transfer function. linear RGB to R'G'B' */
/* 7. bring components to YCbCr space */
- if (get_Kr_Kb (out_info->colorimetry.matrix, &Kr, &Kb))
+ if (gst_video_color_matrix_get_Kr_Kb (out_info->colorimetry.matrix, &Kr, &Kb))
color_matrix_RGB_to_YCbCr (&dst, Kr, Kb);
/* 8, bring color components to nominal range */