[FFmpeg-devel] [PATCH] Add scale filter

Stefano Sabatini stefano.sabatini-lala
Sun Oct 25 11:45:12 CET 2009


On date Sunday 2009-10-18 22:39:28 +0200, Michael Niedermayer encoded:
> On Sun, Oct 11, 2009 at 11:29:35PM +0200, Stefano Sabatini wrote:
[...] 
> as a bug in slices in reverse order has been found the vf_scale patch 
> is on hold until that is fixed

I'll resume the problem with the scale filter:

it assumes all the slices arrive in *sequential* order, and precisely
from the top to the bottom.

Currently it (libavfilter SOC repo filter) does:

    outH = sws_scale(scale->sws, data, link->cur_pic->linesize,
                     y, h, link->dst->outputs[0]->outpic->data,
                     link->dst->outputs[0]->outpic->linesize);
    avfilter_draw_slice(link->dst->outputs[0], scale->sliceY, outH);
    scale->sliceY += outH;

scale->sliceY is inited to 0.

In the case the slices arrive in reverse order, this doesn't work
anymore.

Also I see that the scale filter *does not support slices sent in
non-sequential order*, as the dstY is stored in the context of the
scaler, and used as the Y of the next slice, see the macro:

swscale_template.c:RENAME(swScale)

This makes me believe that this is a requirement for the filtering
system too, unless we want to change how libswscale works (BTW that
should be documented).

Alternatively we could add some mechanism of slice-sorter/fifo filter
auto-insertion for relaxing this constraint, which could be
implemented by filters which require it, but this may be done later,
especially considering that we don't have currently filters which
require non-sequential slices drawing.

...

As for the reverse order in the scale filter, I believe the only
solution to manage it nicely (without to require e.g. the insertion of
a fifo filter before the scale filter) is to use the direction flag in
the scaler context.

This requires that we should make somehow aware the filterchain of the
slice ordering, then that information could be used to fill the scaler
context in the scale filter.

Comments?
-- 
FFmpeg = Funny & Forgiving Mind-dumbing Patchable Enigmatic Gadget



More information about the ffmpeg-devel mailing list