[FFmpeg-devel] [PATCH] Add scale filter

Michael Niedermayer michaelni
Sun Nov 8 03:55:15 CET 2009


On Sun, Nov 08, 2009 at 01:45:10AM +0100, Stefano Sabatini wrote:
> On date Saturday 2009-11-07 01:05:58 +0100, Stefano Sabatini encoded:
> > On date Saturday 2009-10-31 00:46:31 +0100, Michael Niedermayer encoded:
> > > On Fri, Oct 30, 2009 at 11:44:13AM +0100, Stefano Sabatini wrote:
> > [...]
> > > > +static av_cold void uninit(AVFilterContext *ctx)
> > > > +{
> > > > +    ScaleContext *scale = ctx->priv;
> > > > +    if (scale->sws)
> > > > +        sws_freeContext(scale->sws);
> > > 
> > > sws should be set to NULL to avoid double frees
> > > and the check should not be needed sws_freeContext should have a check
> > > added if it needs one
> > 
> > Fixed.
> >  
> > > > +static void draw_slice(AVFilterLink *link, int y, int h)
> > > > +{
> > > > +    ScaleContext *scale = link->dst->priv;
> > > > +    int out_h;
> > > > +    AVFilterPicRef *cur_pic = link->cur_pic;
> > > > +    uint8_t *data[4];
> > > > +
> > > > +    if (!scale->slice_dir) {
> > > > +        if (y != 0 && y + h != link->h) {
> > > > +            av_log(scale, AV_LOG_ERROR, "Slices start in the middle!\n");
> > > > +            return;
> > > > +        }
> > > > +        scale->slice_dir = y ?                       -1 : 1;
> > > > +        scale->slice_y   = y ? link->dst->outputs[0]->h : y;
> > > > +    }
> > > > +
> > > > +    data[0] = cur_pic->data[0] +  y               * cur_pic->linesize[0];
> > > 
> > > > +    data[1] = link->format == PIX_FMT_PAL8 ?
> > > > +              cur_pic->data[1] :
> > > > +              cur_pic->data[1] + (y>>scale->vsub) * cur_pic->linesize[1];
> > > 
> > > the PAL8 check is insufficient, other 8bit formats can also have a fixed
> > > palette in there
> > 
> > I'm using our shiny pixdescs for that, so we need first to enable
> > them.
> 
> Implemented withouth using pixdesc, which are not still available and
> won't be for some time.
> 
> Regards.
> -- 
> FFmpeg = Furious & Freak Mere Powered Empowered Genius

>  doc/libavfilter.texi     |   25 +++++
>  libavfilter/Makefile     |    1 
>  libavfilter/allfilters.c |    1 
>  libavfilter/vf_scale.c   |  203 +++++++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 230 insertions(+)
> 52fe47370a211f1b3e4f17573d8bc5139af5d371  add-scale-filter.patch

ok if extensively tested and it passes all tests

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

Democracy is the form of government in which you can choose your dictator
-------------- 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/20091108/9939f4c9/attachment.pgp>



More information about the ffmpeg-devel mailing list