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

Johannes Gajdosik johannes.gajdosik at gmx.at
Wed Jul 5 00:08:46 CEST 2006


Hello,

> I'd recommend http://developer.nvidia.com/object/nvshaderperf_home.html.

Thanks, but the link seems to be broken.


> > I don't like that too much. I'll try to add support for 16 bit ppms and
> > textures.
> Try this with a 16 bits per component ppm (those have a maxval > 255 to
> indicate this fact).
> It is untested though (didn't even try to compile, but at least you
> should be able to get what I have in mind) :-)

I tried the patch. I had to fix glFmt2bpp in the following way,
otherwise I would get SIGFPE:

int glFmt2bpp(GLenum format, GLenum type) {
  int h = 0;
  switch (type) {
    case GL_UNSIGNED_BYTE_3_3_2:
    case GL_UNSIGNED_BYTE_2_3_3_REV:
      return 1;
    case GL_UNSIGNED_SHORT_5_5_5_1:
    case GL_UNSIGNED_SHORT_1_5_5_5_REV:
    case GL_UNSIGNED_SHORT_5_6_5:
    case GL_UNSIGNED_SHORT_5_6_5_REV:
      return 2;
    case GL_UNSIGNED_BYTE:
      h = 1;
      break;
    case GL_UNSIGNED_SHORT:
      h = 2;
      break;
  }
  switch (format) {
    case GL_LUMINANCE:
    case GL_ALPHA:
      return h;
    case GL_RGB:
    case GL_BGR:
      return 3*h;
    case GL_RGBA:
    case GL_BGRA:
      return 4*h;
  }
  return 0; // unknown
}

I also modified the fragment program:

----------distort16.fp---------
!!ARBfp1.0
# blabla...
TEMP tmp, y, u, v, pos;
# lookup the position/brightness in the index texture
TEX pos, fragment.texcoord[0], texture[3], 2D;
# now do the normal YUV -> RGB conversion for point at position pos,
# this part is derived from edgdetect.fp by Reimar Doeffinger
TEX y, pos, texture[0], 2D;
MAD tmp, y, {1.164, 1.164, 1.164, 0}, {-0.87416, 0.53133, -1.08599, 0};
TEX u, pos, texture[1], 2D;
MAD tmp, u, {0, -0.391, 2.018, 0}, tmp;
TEX v, pos, texture[2], 2D;
MAD tmp, v, {1.596, -0.813, 0, 0}, tmp;
# scale by brightness = pos.zzzz
MUL result.color, pos.zzzz, tmp;
END
----------end of distort16.fp---------

It worked, but again I got the pixelization (block) effect.
I suppose that the texture is internally represented with only
3 bytes per pixel, instead of 6 bytes per pixel.

I will send you the fragment programs and index textures.
I will not send them to the list, because they are huge.
Anybody who wants them please contact me.

I call mplayer in the following way:
mplayer -vo gl:yuv=4:customprog=distort.fp:customtex=index.ppm my_video.avi -v (works good)
mplayer -vo gl:yuv=4:customprog=distort16.fp:customtex=index16.ppm my_video.avi -v (pixelized)

my_video.avi must be 720x576.

Thanks for your help,
Johannes



More information about the MPlayer-dev-eng mailing list