[FFmpeg-devel] [PATCH] Add vf_scale.c filter
Michael Niedermayer
michaelni
Tue Mar 3 02:45:47 CET 2009
On Tue, Mar 03, 2009 at 01:13:35AM +0100, Stefano Sabatini wrote:
> On date Friday 2009-02-27 16:44:46 +0100, Michael Niedermayer encoded:
> > On Fri, Feb 27, 2009 at 12:56:08PM +0100, Stefano Sabatini wrote:
> > > Hi all,
> > > as in subject.
> >
> > first quick question
> > does
> > crop, expand and slices work? (a single pix_fmt working is enough)
>
> crop seems to work, but it doesn't work like in mplayer, syntax is
> x:y:w:h, also default is not centered, this should be changed I
> think.
>
> slices seem to work fine after the Vitor's patch, expand is currently
> not implemented and the padding implementation in ffmpeg.c is
> currently half-broken,
> so I think we need an expand filter as well.
i agree, we need a working zero memcpy() expand to test other filters.
>
> > i mean can i take a 320x200 movie crop a 100x100 area out scale
> > that to 200x200 and add a border to make 300x200 _without_ any
> > memcpy() ?
> > just a simple test to make sure no serious bugs are in there
> >
> > second question are there any features mplayers vf_scale has that lavfi
> > does not?
>
> Yes, and it shouldn't be hard to implement them (e.g. luma/chroma
> gaussian blur, params etc.), that should be done before or after the
> integration?
before :)
>
> > also we need support for interlaced scaling though this is better done
> > through some generic wraper filter
> > that is a filter that as arguments has another filtername and its arguments
> > and that then creates 2 such filters and filters the odd and even
> > lines seperately with them
>
> OK, si there something similar in MPlayer on which to base this?
no, it should be quite trivial though ...
>
> > [...]
> >
> > > + char sws_flags[256];
> > > + int i = 0;
> > > + p = strchr(sws_opts, '=');
> > > + p++;
> > > + while (*p && *p != ':' && i < sizeof(sws_flags) - 1)
> > > + sws_flags[i++] = *p++;
> > > + sws_flags[i] = 0;
> >
> > sscanf("sws_flags=%255[^:]")
> >
> > [...]
> > > + av_reduce(&out->outpic->pixel_aspect.num, &out->outpic->pixel_aspect.den,
> > > + out->outpic->pixel_aspect.num, out->outpic->pixel_aspect.den,
> > > + FFMAX(out->outpic->pixel_aspect.num, out->outpic->pixel_aspect.den));
> >
> > you want to use av_gcd() here i think
>
> Check the attached patches (I'll apply them to soc if are OK).
>
> > > +
> > > + avfilter_start_frame(out, avfilter_ref_pic(out->outpic, ~0));
> > > +
> > > + scale->sliceY = 0;
> > > +}
> > > +
> > > +static void draw_slice(AVFilterLink *link, int y, int h)
> > > +{
> > > + ScaleContext *scale = link->dst->priv;
> > > + int outH;
> > > + int vsub, hsub;
> > > + uint8_t *data[4];
> > > +
> > > + avcodec_get_chroma_sub_sample(link->format, &hsub, &vsub);
> > > +
> > > + data[0] = link->cur_pic->data[0] + y * link->cur_pic->linesize[0];
> > > + data[3] = link->cur_pic->data[3] + y * link->cur_pic->linesize[3];
> > > +
> > > + if (link->cur_pic->data[2]) {
> > > + data[1] = link->cur_pic->data[1] + (y>>vsub)*link->cur_pic->linesize[1];
> > > + data[2] = link->cur_pic->data[2] + (y>>vsub)*link->cur_pic->linesize[2];
> > > + } else {
> > > + // Probably a paletted format
> > > + data[1] = link->cur_pic->data[1];
> > > + data[2] = link->cur_pic->data[2];
> > > + }
> >
> > looks like its missing some special case for a palette
>
> I need to know more about paletted formats...
usePal() formats (see the marco in swscale which that are)
have data[1] set to a 256 entry 4 byte per entry table
above slice code should not play with that but just pass it through
and patches for soc look IMHO
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
If you really think that XML is the answer, then you definitly missunderstood
the question -- Attila Kinali
-------------- 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/20090303/51274ce9/attachment.pgp>
More information about the ffmpeg-devel
mailing list