GNOME Bugzilla – Bug 701095
videomixer: Should implement pass-through and optimizations
Last modified: 2014-12-22 15:59:47 UTC
Currently videomixer could operate faster in certain conditions. 1) Passthrough If there is only 1 input, it could pass-through if the input has no alpha and is fullscreen 2) Passthrough If there is multiple inputs, but the top layer is fullscreen and has no alpha 3) Only fill/copy visible rectangle of each layer when a opaque color format is negotiated This would allow having a videomixer around with very low cost.
Created attachment 245426 [details] [review] [PATCH] videomixer: Operate in pass-through mode if possible Videomixer can do pass-through if the pad with highest zorder is opaque and fullscreen. https://bugzilla.gnome.org/show_bug.cgi?id=70109 --- gst/videomixer/videomixer2.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
Review of attachment 245426 [details] [review]: ::: gst/videomixer/videomixer2.c @@ +831,3 @@ + if (top_pad->alpha == 1.0 && (top_pad->xpos + top_pad->ypos == 0) + && mix->info.width == top_pad->info.width + && mix->info.height == top_pad->info.height) { This is not catching all cases. You could have a top pad that is larger than fullscreen, which could have negative x/y-pos and still fill the complete frame. Or could have negative x/y-pos and not fill the complete frame.
(In reply to comment #2) > This is not catching all cases. You could have a top pad that is larger than > fullscreen, which could have negative x/y-pos and still fill the complete > frame. Or could have negative x/y-pos and not fill the complete frame. Great ! that's why I like reviews, I'll give it a second try later. Could it be something like: (top_pad->alpha == 1.0 && (top_pad->info.width - top_pad->xpos) > mix->info->width && (top_pad->info.height - top_pad->ypos) > mix->info->height) Just throughing this, let me know if on have more cases.
What I realized is that this patch cover case 1 and 2. Also, the previous case is slightly different. If there an opaque input that is larger then full output, we can ingore underneeth layers, but we need to crop it. Finally, I found a new pass-through case, if background is fully transparent and we have a single stream fullscreen with alpha, also we don't need to blend (just crop) in the same case where the single stream is bigger (but cover all) the output surface. Update optimisation list: 1) Passthrough if top-layer is fullscreen and and opaque 2) Passthrough if there is only 1 fullscreen stream and background is transparent 3) Blit copy (crop) top layer, if top-layer is fullscreen and and opaque 4) Blit copy, if there is only 1 layer, background is transparent and covers the full surface of the output And many many more !
These all work now with videomixer or compositor?
I have no idea, but it's a new code base. If it's still important to anyone to optimze these path they should re-open or create a new bug. It's been rotting here for a year and a half. For me, all these optimization are not very useful if I can use GL for mixing.