[MPlayer-dev-eng] [PATCH] vop eq2 with gamma correction

Michael Niedermayer michaelni at gmx.at
Wed Sep 25 13:58:27 CEST 2002


Hi

On Wednesday 25 September 2002 08:16, Hampa Hug wrote:
> Milan Cutka wrote:
> > > for (j = 0; j < h; j++) {
> > >    for (i = 0; i < w; i++) {
> > >      *(dst++) = lut[*(src++)];
> > >    }
> > > }
> >
> > You could try this:
> >
> > for (j = 0; j < h; j++) {
> >    for (i = 0; i < w; i+=4,src+=4,dst+=4) {
> >      *(unsigned int*)dst=
> >        (lut[src[3]]<<24)|(lut[src[2]]<<16)|(lut[src[1]]<<8)|lut[src[0]];
> >    }
> > }
>
> The problem is that this is highly non-portable. There are at least
> three issues here (endianness, alignment and sizeof(int)).
use uint32_t & #ifdef WORDS_BIGENDIAN
normally things should be aligned by at least 8 byte anyway ...

>
> > It works faster for me in ffdshow. Of course the best would be to add
> > some MMX optimizations, but I don't know how it would be possible to use
> > MMX here. For faster but not precise MMX optimized gamma correction look
> > here: http://www.stereopsis.com/polygamma.html.
>
> The main reason for me to use a LUT is that it is possible to combine
> multiple filters in a single LUT.
yes, i allso think that a LUT would be a better choice for gamma correcture 
even though it is trivial to change the coefficients of the polynomial to 
handle brightness & contrast correcture, but imho a quadratic poly is not a 
good choice for approximating a x^const function

btw, gamma faq link, just thought someone might be interrested ...
http://www.inforamp.net/~poynton/notes/colour_and_gamma/GammaFAQ.html

[...]

Michael



More information about the MPlayer-dev-eng mailing list