caps: Merge structures when intersecting instead of appending them
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Thu, 5 May 2011 09:28:38 +0000 (11:28 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Sat, 14 May 2011 09:39:34 +0000 (11:39 +0200)
commit6e57ce32e5b2a27bae464c85f7414efbe44632a4
tree44773736f353bc4fb540823b1363b1c77ebfee60
parentf56c6e12255b37d75b1eb949e434fa8e3bb33f51
caps: Merge structures when intersecting instead of appending them

This prevents adding duplicates over and over again to the resulting
caps if they already describe the new intersection result.

While this changes intersection from O(n*m) to O(n^2*m), it results in
smaller caps, which in the end will decrease further processing times.

For example in an audioconvert ! audioconvert ! audioconvert pipeline,
when forwarding the downstream caps preference in basetransform
(see e26da72de25a91c3eaad9f7c8b2f53ba888a0394) this results in
16 instead of 191 caps structures.
gst/gstcaps.c
tests/check/gst/gstcaps.c