GNOME Bugzilla – Bug 577017
Videomixer blend bgra and ayuv
Last modified: 2009-05-28 11:59:35 UTC
I have modified videomixer plugin, so that it can also accept BGRA frames (they all must be AYUV or BGRA). I think it can easily be extended to support other raw formats.
Created attachment 131522 [details] [review] Modifications to support bgra buffer This is a summary of what I have done: *I have removed the following functions: gst_videomixer_fill_checker gst_videomixer_fill_color gst_videomixer_blend_ayuv_ayuv and replace them by three functors: (*blend) (*fill_checker) (*fill_color) These functionalities are implemented in two files, one for AYUV (blend_ayuv.c) and one for BGRA (blend_bgra.c) *The plugin's pads now negotitate their format so that tey all have the same format (size may be different), more or less in the sameway as audio "adder" does. Depending on the format AYUV or BGRA functions are set to the functors. I think it would be easy to add the functionality requested in this "bug", by simply providing a blend_i420.c file. PS: I think my code does not follow the style guides (at least git complains about that) :\ sorry. I will try to fix it
Created attachment 131531 [details] [review] New version with support for i420 I have modified the code so that it cn also blend i420 buffers
Could you split this patch into three? One for the refactoring to function pointers, one for adding bgra support on top of this and one for adding i420 support? Also, the cairo dependency must be conditional, i.e. you need some Makefile.am and #ifdef magic :) Other than that this is a great patch :) To conform to the coding style guidelines just run gst-indent (from gstreamer/tools) on the C files.
videomixer should not have any cairo dependency at all imho, even if it's optional.
Cairo is only used to do the blending of the buffers, so I will try to replace this with a specific internal function as it is done in AYUV and i420(I don't think that it should be colex). I will also do the tree patches (at least try to, I am newy to git and patches in general :).
Ok, I'll work on this now :)
commit a5c30ae5028d054c5a3c4014d0eda1ea92d05b1f Author: Sebastian Dröge <sebastian.droege@collabora.co.uk> Date: Thu May 28 13:56:15 2009 +0200 videomixer: Fix background blitting when a color mode is selected with BGRA commit 83fc39ccff50b2d6071650e4300f1239ef23f0c0 Author: Sebastian Dröge <sebastian.droege@collabora.co.uk> Date: Thu May 28 13:54:14 2009 +0200 videomixer: Some cleanup and fix the calculation of the frame size in bytes commit 699b696db8dfa17db3f3fe34b19ea1722420e024 Author: Sebastian Dröge <sebastian.droege@collabora.co.uk> Date: Thu May 28 13:35:52 2009 +0200 videomixer: Fix I420 blending to actually do something For this we a) implement the checkers filling and b) actually blend the src/dest by using the src alpha value from the pad. commit ad1f79fd817c0a8d7f40258c8e0ff94d20c1ef89 Author: Sebastian Dröge <sebastian.droege@collabora.co.uk> Date: Thu May 28 13:14:13 2009 +0200 videomixer: Fix ARGB blending to actually work commit f66906e89109f83bc29b23e201f9259375933fd2 Author: Sebastian Dröge <sebastian.droege@collabora.co.uk> Date: Thu May 28 13:04:51 2009 +0200 videomixer: Blend BGRA ourselves instead of using Cairo commit 82abbeaf4f69f22191a28c72a99c0093835edb11 Author: Alex Ugarte <alexugarte@gmail.com> Date: Thu May 28 12:55:16 2009 +0200 videomixer: Add support for blending BGRA and AYUV Fixes bug #577017.