diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2013-03-24 00:21:36 +0100 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2013-03-24 00:21:36 +0100 |
commit | b1950b6409437ee69e77c8a6717affd9ce5a7041 (patch) | |
tree | e841a00c24f6a9d02770e40cd8ed21ea07563fe3 /gst | |
parent | adc9694ed70870549fc8f4a6257f3b132ea31733 (diff) |
Revert "videoconvert: prevent bad interlaced conversions"
This reverts commit adc9694ed70870549fc8f4a6257f3b132ea31733.
No need to restrict the conversion, we can handle interlace correctly. We
basically unpack each field, then convert each field to the target colorspace
and pack and interleave each field to the target format. We also disable any
fast path that can't deal with interlaced formats.
Diffstat (limited to 'gst')
-rw-r--r-- | gst/videoconvert/gstvideoconvert.c | 116 |
1 files changed, 3 insertions, 113 deletions
diff --git a/gst/videoconvert/gstvideoconvert.c b/gst/videoconvert/gstvideoconvert.c index 565d6ce11..67102d01a 100644 --- a/gst/videoconvert/gstvideoconvert.c +++ b/gst/videoconvert/gstvideoconvert.c @@ -107,68 +107,6 @@ dither_method_get_type (void) return gtype; } -static const GValue * -get_vertsubs1_list (void) -{ - static gsize init = 0; - - if (g_once_init_enter (&init)) { - int i; - static GValue value = G_VALUE_INIT; - - g_value_init (&value, GST_TYPE_LIST); - - for (i = GST_VIDEO_FORMAT_I420; i <= GST_VIDEO_FORMAT_GBR_10LE; i++) { - const GstVideoFormatInfo *format_info; - - format_info = gst_video_format_get_info (i); - if (format_info->n_components >= 3 && format_info->h_sub[1] == 0) { - GValue val = G_VALUE_INIT; - - g_value_init (&val, G_TYPE_STRING); - g_value_set_string (&val, format_info->name); - gst_value_list_append_value (&value, &val); - g_value_unset (&val); - } - } - - g_once_init_leave (&init, GPOINTER_TO_SIZE (&value)); - } - - return (GValue *) GSIZE_TO_POINTER (init); -} - -static const GValue * -get_vertsubs2_list (void) -{ - static gsize init = 0; - - if (g_once_init_enter (&init)) { - int i; - static GValue value = G_VALUE_INIT; - - g_value_init (&value, GST_TYPE_LIST); - - for (i = GST_VIDEO_FORMAT_I420; i <= GST_VIDEO_FORMAT_GBR_10LE; i++) { - const GstVideoFormatInfo *format_info; - - format_info = gst_video_format_get_info (i); - if (format_info->n_components >= 3 && format_info->h_sub[1] == 1) { - GValue val = G_VALUE_INIT; - - g_value_init (&val, G_TYPE_STRING); - g_value_set_string (&val, format_info->name); - gst_value_list_append_value (&value, &val); - g_value_unset (&val); - } - } - - g_once_init_leave (&init, GPOINTER_TO_SIZE (&value)); - } - - return (GValue *) GSIZE_TO_POINTER (init); -} - /* copies the given caps */ static GstCaps * gst_video_convert_caps_remove_format_info (GstCaps * caps) @@ -181,8 +119,6 @@ gst_video_convert_caps_remove_format_info (GstCaps * caps) n = gst_caps_get_size (caps); for (i = 0; i < n; i++) { - const char *im; - st = gst_caps_get_structure (caps, i); /* If this is already expressed by the existing caps @@ -191,47 +127,10 @@ gst_video_convert_caps_remove_format_info (GstCaps * caps) continue; st = gst_structure_copy (st); - gst_structure_remove_fields (st, "colorimetry", "chroma-site", NULL); - im = gst_structure_get_string (st, "interlace-mode"); - if (im && strcmp (im, "progressive") != 0) { - const GValue *formats; - GValue tmpval = G_VALUE_INIT; - GValue out = G_VALUE_INIT; - gboolean has_sub1; - gboolean has_sub2; - - formats = gst_structure_get_value (st, "format"); - - has_sub1 = gst_value_intersect (&tmpval, get_vertsubs1_list (), formats); - if (G_VALUE_TYPE (&tmpval) != 0) - g_value_unset (&tmpval); - has_sub2 = gst_value_intersect (&tmpval, get_vertsubs2_list (), formats); - if (G_VALUE_TYPE (&tmpval) != 0) - g_value_unset (&tmpval); - - if (has_sub1 && has_sub2) { - gst_value_list_concat (&out, get_vertsubs1_list (), - get_vertsubs2_list ()); - } else if (has_sub1) { - g_value_init (&out, GST_TYPE_LIST); - g_value_copy (get_vertsubs1_list (), &out); - } else if (has_sub2) { - g_value_init (&out, GST_TYPE_LIST); - g_value_copy (get_vertsubs2_list (), &out); - } else { - /* fall through */ - } - - if (G_VALUE_TYPE (&out) != 0) { - gst_structure_set_value (st, "format", &out); - gst_caps_append_structure (res, st); - g_value_unset (&out); - } - } else { - gst_structure_remove_field (st, "format"); - gst_caps_append_structure (res, st); - } + gst_structure_remove_fields (st, "format", + "colorimetry", "chroma-site", NULL); + gst_caps_append_structure (res, st); } return res; @@ -323,7 +222,6 @@ gst_video_convert_set_info (GstVideoFilter * filter, if (space->convert) { videoconvert_convert_free (space->convert); - space->convert = NULL; } /* these must match */ @@ -339,13 +237,6 @@ gst_video_convert_set_info (GstVideoFilter * filter, if (in_info->interlace_mode != out_info->interlace_mode) goto format_mismatch; - /* if interlaced, we can't change vertical subsampling */ - if (GST_VIDEO_INFO_IS_INTERLACED (in_info) && - GST_VIDEO_FORMAT_INFO_H_SUB (in_info->finfo, 1) != - GST_VIDEO_FORMAT_INFO_H_SUB (out_info->finfo, 1)) { - goto format_mismatch; - } - space->convert = videoconvert_convert_new (in_info, out_info); if (space->convert == NULL) goto no_convert; @@ -375,7 +266,6 @@ gst_video_convert_finalize (GObject * obj) if (space->convert) { videoconvert_convert_free (space->convert); - space->convert = NULL; } G_OBJECT_CLASS (parent_class)->finalize (obj); |