[MPlayer-users] Video filter to slightly shift R, G and B

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Apr 27 21:14:00 CEST 2010


On Tue, Apr 27, 2010 at 05:31:48PM +0200, Yann Pomarede wrote:
> I have an LCD video-projector, and as on almost all video-projector,
> the 3 matrix are not perfectly aligned (or maybe it is related to
> optical diffraction ?) but there is a shift (less than 1 pixel)
> between red, green and blue. The resulting effect can be seen on the
> following photo:
> http://www.gemibox.net/upload/rgb_shift.jpg
> 
> I'm used to Windows, and there are 2 ways to get rid of this problem:
> either using Haali renderer that can shift cyan and magenta, or using
> Media Player Classic and a custom Pixel Shader filter that do almost
> the same (but with R, G and B) using the graphic card. An example of
> pixel shader code to do this can be seen here:
> http://pastebin.com/dMs33c99
> 
> I looked on Google but could not find any way to do this with mplayer?
> Would it be difficult to develop a new filter?

MPlayer -vo gl has customprog option allowing to write your own programs.
However the one you linked above went the lazy way and will cause rather
high CPU load (since the CPU has to convert to RGB).
As a starting point, mplayer -vo gl -v -v will print "[gl] generated fragment program:"
and after that the one it uses (will change depending on other -vo gl options)
and TOOLS/*.fp are a few more samples.
However all include YUV->RGB conversion, which makes them a bit more complex.
Shiftng cyan and magenta is relatively simple for those, the parts like
TEX yuv.g, fragment.texcoord[1], texture[1], 2D;
TEX yuv.b, fragment.texcoord[2], texture[2], 2D;
need to be changed to add an offset to fragment.texcoord first.


More information about the MPlayer-users mailing list