ffmpegcolorspace: speedup caps transformation
authorEdward Hervey <bilboed@bilboed.com>
Fri, 7 May 2010 15:16:28 +0000 (17:16 +0200)
committerEdward Hervey <bilboed@bilboed.com>
Fri, 7 May 2010 15:38:46 +0000 (17:38 +0200)
* 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

index 0ee2dac..c4c141a 100644 (file)
@@ -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;