[FFmpeg-devel] [PATCH] Port MPlayer blackframe filter.
Michael Niedermayer
michaelni
Sun Sep 26 02:42:15 CEST 2010
On Sun, Sep 26, 2010 at 01:41:50AM +0200, Stefano Sabatini wrote:
> 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).
yes 10min work and 10 lines of code, and its faster
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
There will always be a question for which you do not know the correct awnser.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100926/54513e8e/attachment.pgp>
More information about the ffmpeg-devel
mailing list