[FFmpeg-devel] [PATCH] Port MPlayer blackframe filter.

Stefano Sabatini stefano.sabatini-lala
Sun Sep 26 01:41:50 CEST 2010


On date Sunday 2010-09-26 01:25:49 +0200, Michael Niedermayer encoded:
> On Sun, Sep 26, 2010 at 01:15:29AM +0200, Stefano Sabatini wrote:
[...]
> > +static void end_frame(AVFilterLink *inlink)
> > +{
> > +    AVFilterContext *ctx = inlink->dst;
> > +    BlackFrameContext *blackframe = ctx->priv;
> > +    AVFilterBufferRef *picref = inlink->cur_buf;
> > +    int x, y, nblack = 0, pblack = 0;
> > +    uint8_t *p = picref->data[0];
> > +
> > +    for (y = 1; y <= inlink->h; y++) {
> > +        for (x = 0; x < inlink->w; x++)
> > +            nblack += p[x] < blackframe->bthresh;
> > +        pblack = nblack * 100 / (inlink->w * y);
> > +        if (pblack < blackframe->bamount)
> > +            break;
> > +        p += picref->linesize[0];
> > +    }
> 
> This code belongs in draw_slice()

Yes but it would be much more complicate for little gain (need to
store pblack/nblack in the context, need to implement a start_frame
for initing them).

Regards.
-- 
FFmpeg = Frightening & Faithless Mysterious Puritan Elastic Glue



More information about the ffmpeg-devel mailing list