[FFmpeg-devel] [PATCH] libavfilter-soc: extend vf_scale.c to make it support colorspace details setting

Stefano Sabatini stefano.sabatini-lala
Mon Oct 5 01:11:03 CEST 2009


On date Friday 2009-05-22 03:00:13 +0200, Michael Niedermayer encoded:
> On Fri, May 22, 2009 at 12:24:25AM +0200, Stefano Sabatini wrote:
[...]
> that is again a list of options, look
> we have a user alice and we have sws and you are vf_scale ;)
> alice gives you a bunch of zero terminated char* pairs and your only job
> is to pass these strings to sws.
> 
> the moment you compare one of the strings against anything you already
> have a problem.
> 
> Its like if i tell you to pass a name from alice to bob, at no point
> in that do you need to look at the name.
> You (vf_scale) cant know all names of all current and future people,
> similarly vf_scale cannot know which options the swscale with which it is
> linked contains.
> 
> As ive said a few times, we might need changes in swscale for this to work.

I re-read carefully thre thread, from my point of view the current
behavior of the scale filter is already partly doing what you said,
that is:

it takes an opaque string named and sets it in the swscale context,
without to compare the content of that string (sws_flags_string) to
anything in the filter.

But then if I'm understanding what you mean, you would rather prefer
something like this:

scale="blahblahblah"

What the scale filter should do then would be to use that string to
initialize the scale filter context (maybe using
av_set_options_string()?).

In this case it would be:

    if (args && av_set_options_string(sws_ctx, args, "=", ":") < 0)
       return -1;

I don't see how this would be possible now, indeed what we do now for
initializing a sws context is:

create the context with: 
sws_getContext()

then change the params with:
sws_setColorspaceDetails()

or with:
av_set_string()

this is only possible for the few values with are settable through
the options defined in libswscale/options.c.

So, if I understand what you meant then it would be necessary to
change the libswscale API so to make possible for example to set
through AVOptions:

srcW, srcH, srcFormat, 
dstW, dstH, dstFormat, 
blur/chroma filter

and all the other params which are usually set through
sws_getContext(), and:

int brightness, int contrast, int saturation

which now can only be set with sws_setColorspaceDetails().

This way the scale filter would simply pass to the sws context an
opaque string, and the libswscale code would parse and internally
interpret this string, with no parsing involved on the part of the
vf_scale filter.

Is this what you meant?

Also is this a requirement for getting the scale filter in SVN?, such
API changes in lsws don't look trivial.

Regards.
-- 
FFmpeg = Faboulous and Faithful Most Picky Erroneous Gymnast



More information about the ffmpeg-devel mailing list