[MPlayer-dev-eng] Re: [PATCH] New video filter: deblendlogo

Martin Atkins mart at degeneration.co.uk
Tue Feb 22 13:57:07 CET 2005


Martin Atkins wrote:

> Hi folks,
> 
> The attached C source file implements a new video filter which attempts 
> to remove alpha-blended logos by reversing the alpha blend to recover 
> the original colour. To use it, the user must create a template in the 
> form of a PNG image with an alpha channel which gives the filter the 
> alpha value and colour used at each point in the logo. Since it uses 
> libpng to decode the template, the filter is only included if libpng is 
> present.
> 
[snip]
> 
> The filter currently only operates on RGB-type images, which means it's 
> not really useable from mplayer since the accelerated vo devices usually 
> want YUV images. 
[snip]

As an experiment, I added rudimentary support for YV12 using the 
SwScaler to convert back and forth between it and BGRA. Not a brilliant 
solution, but it still manages acceptable realtime performance on my 
Pentium 3 computer here, so I think it's acceptable.

The format filter could perhaps have handled the conversion, but it's 
only a few extra lines of code and it makes the filter easier to use 
with YUV sources and YUV output devices.

This new version also fixes a bug where the filter would crash (divide 
by zero) if there was a completely opaque pixel in the template.

There seems to be a strange bug with the YV12->BGRA->YV12 path where a 
green line is introduced with some video sources at the bottom of the 
image. I can't figure out what's causing it, but some discussion on the 
#mplayerdev IRC channel led to the conclusion that it was a bug in the 
scaler. Still, if anyone can see that I'm calling it wrong or something, 
please let me know.

The attached file is the new filter implementation. The patch included 
in my last message will still work to add the filter to mplayer when built.

All the best,
Martin Atkins

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: vf_deblendlogo.c
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20050222/2036ce42/attachment.txt>


More information about the MPlayer-dev-eng mailing list