[FFmpeg-devel] [RFC] How to use sws_[gs]etColorspaceDetails()

Stefano Sabatini stefano.sabatini-lala
Wed Apr 15 22:48:35 CEST 2009


On date Wednesday 2009-04-15 13:55:32 +0200, Michael Niedermayer encoded:
> On Tue, Apr 14, 2009 at 05:42:11PM +0200, Stefano Sabatini wrote:
> > Hi all,
> > 
> > after spending many hours wandering throught the lsws code I'm still
> > at the same point, that is clueless about the correct usage of the
> > sws_[gs]etColorspaceDetails() stuff.
> > 
> > In attachment there is an attempt to provide support for
> > brigthness/contrast/saturation stuff to vf_scale.
> > 
> > Params are correctly set into the sws->scale context but no effect is
> > showed off in the filtered video, hints are very welcome.
> > 
> > And yes, the API should be documented.
> [...]
> > @@ -127,6 +151,17 @@
> >      if(w == -1) w = scale->h*link->src->inputs[0]->w/link->src->inputs[0]->h;
> >      if(h == -1) h = scale->w*link->src->inputs[0]->h/link->src->inputs[0]->w;
> >  
> > +    if (scale->sws) {
> > +        int brightness, contrast, saturation;
> > +        int *src_table, src_range, *dst_table, dst_range;
> > +
> > +        sws_getColorspaceDetails(scale->sws, &src_table, &src_range, &dst_table, &dst_range,
> > +                                 &brightness, &contrast, &saturation);
> > +
> > +        sws_setColorspaceDetails(scale->sws, src_table, src_range, dst_table, dst_range,
> > +                                 scale->brightness, scale->contrast, scale->saturation);
> > +    }
> > +
> >      scale->sws = sws_getCachedContext(scale->sws,
> >                                        link->src->inputs[0]->w,
> >                                        link->src->inputs[0]->h,
> 
> you probably want to set the stuff after allocating the context

That was one of the problem, the other was that
sws_getColorspaceDetails() was returning -1 since the destination
format wasn't supported.

Many detaills are still unclear to me, but patch is ready.

Regards.
-- 
FFmpeg = Freak and Funny Mournful Purposeless Enlightening God



More information about the ffmpeg-devel mailing list