[MPlayer-dev-eng] gl & distorted fisheye for dome projection

Johannes Gajdosik johannes.gajdosik at gmx.at
Fri Jun 30 22:54:18 CEST 2006


Hello,

> Specification is here:
> http://oss.sgi.com/projects/ogl-sample/registry/ARB/fragment_program.txt
> But don't worry, I can help you out there, I don't think it should be
> too much of an effort.

Thanks!

> If you want to try this approach, start with a little program that
> creates the texture (sizes must be power of two, in PPM format).
> For starting it would be simplest if you use the next power of two of
> the movie as width and height of the texture.
> Then, the red and green values would be pointers to the texture pixel to use for
> that output pixel (since they are numbers between 0 and 255, the formula
> would be 255 * (source coordinate / texture dimension)).
> And I'd use the blue value for the brightness (again, from 0 to 255, 0
> stands for black, 255 for original color).
> I can then write you (at least a basic version of) the fragment program.

I have just studied fragment and vertex programming a little and
would like to ask you some questions:

I would assume that the texture-color of a given
fragment would be obtainted by

  TEX input_color, fragment.texcoord, texture, 2D;

input_color would be a vector containing {r,g,b,a}
or in the mplayer case {y,u,v,?}.

But instead you seem to retrieve the color
from 3 different textures:

  TEX y, fragment.texcoord[0], texture[0], 2D;
  TEX u, fragment.texcoord[1], texture[1], 2D;
  TEX v, fragment.texcoord[2], texture[2], 2D;

What is the reason for that?
Is fragment.texcoord[0] different from
fragment.texcoord[1] and fragment.texcoord[2] ?

I would assume that the distortion would be performed
somewhat like that:

  # lookup trans_coor in index_texture at position fragment.texcoord 
  TEX trans_coor, fragment.texcoord, index_texture, 2D;
  # scale into range [0..1]:
  MUL trans_coor, trans_coor, {0.0039215686,0.0039215686,0.0039215686,0}
  # brightness is the blue-coordinate:
  MOV brightness, trans_coor.zzzz
  # get the color from the transformed location
  TEX input_color, trans_coor, texture, 2D;
  # convert yuv->rgb
  ..copy-paste from edgedetect.fp..
  # move brightness-adjusted res into result
  MUL result.color, brightness, res
  END
  
index_texture would be the RGB texture that you have suggested:
r,g is the position from where to take the color
b is the scaling value for the color.

I can easily supply such a ppm file. But how must mplayer be invoced,
supposing that the fragment program is called "distort.fp" and
the index texture "distortion_index.ppm" ?


By the way, I have problems with edgedetect.fp: it shows no effect on my computer.
I write
  ./mplayer -vo gl:yuv=4:customprog=edgedetect.fp some_file.avi
But I see the same as when I use just ./mplayer some_file.avi.
There is no suspicios error output, just:
==========================================================================
[gl] using extended formats. Use -vo gl:nomanyfmts if playback fails.
==========================================================================

I have NVidia FX5200 and a 2.4.31 kernel:
> cat /proc/driver/nvidia/version 
NVRM version: NVIDIA Linux x86 NVIDIA Kernel Module  1.0-6111  Tue Jul 27 07:55:38 PDT 2004
GCC version:  gcc version 3.3.1 (SuSE Linux)
> uname -a
Linux pc1 2.4.31 #12 Fri Feb 3 10:03:59 MET 2006 i686 athlon i386 GNU/Linux

Johannes



More information about the MPlayer-dev-eng mailing list