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

Michael Niedermayer michaelni
Wed Apr 15 13:55:32 CEST 2009


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

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I hate to see young programmers poisoned by the kind of thinking
Ulrich Drepper puts forward since it is simply too narrow -- Roman Shaposhnik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090415/a6996d30/attachment.pgp>



More information about the ffmpeg-devel mailing list