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)
This commit is contained in:
Edward Hervey 2010-05-07 17:16:28 +02:00
parent 20d643ccda
commit 0d451ad9cb

View 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;