[FFmpeg-devel] [PATCH] Add scale filter

Stefano Sabatini stefano.sabatini-lala
Sat Nov 7 01:05:58 CET 2009


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.

[...]

Regards.
-- 
FFmpeg = Frenzy and Faboulous Maxi Programmable Elastic God
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-scale-filter.patch
Type: text/x-diff
Size: 9298 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091107/a7b12f1d/attachment.patch>



More information about the ffmpeg-devel mailing list