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>
Thu, 5 May 2011 13:22:14 +0000 (15:22 +0200)
commitdc63e3821952229712ec78333a480712f45dcf48
tree6e6b58c6575a5a8d7df9d743eefe510b7a04f3ae
parentaebe4a3c13d62eea6365f3b7bd5b69df7791d599
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