From 0d451ad9cb605942068f12e0393a2127ac8703c1 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Fri, 7 May 2010 17:16:28 +0200 Subject: [PATCH] ffmpegcolorspace: speedup caps transformation * don't re-create our possible caps every single time, just use the template caps. * don't intersect the caps against the template, basetransform has already done that for us. 62% speedup of _transform_caps() (instruction calls, measured with callgrind) --- gst/ffmpegcolorspace/gstffmpegcolorspace.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gst/ffmpegcolorspace/gstffmpegcolorspace.c b/gst/ffmpegcolorspace/gstffmpegcolorspace.c index 0ee2dac46d..c4c141a435 100644 --- a/gst/ffmpegcolorspace/gstffmpegcolorspace.c +++ b/gst/ffmpegcolorspace/gstffmpegcolorspace.c @@ -142,13 +142,12 @@ gst_ffmpegcsp_transform_caps (GstBaseTransform * btrans, s = gst_caps_get_structure (caps, 0); is_alpha = gst_ffmpegcsp_structure_is_alpha (s); - template = gst_ffmpegcsp_codectype_to_caps (CODEC_TYPE_VIDEO, NULL); - result = gst_caps_intersect (caps, template); + template = gst_pad_template_get_caps (srctempl); + result = gst_caps_copy (caps); /* Get all possible caps that we can transform to */ tmp = gst_ffmpegcsp_caps_remove_format_info (caps); tmp2 = gst_caps_intersect (tmp, template); - gst_caps_unref (template); gst_caps_unref (tmp); tmp = tmp2;