[FFmpeg-devel] [PATCH] Port MPlayer blackframe filter.
Michael Niedermayer
michaelni
Sun Sep 26 14:25:20 CEST 2010
On Sun, Sep 26, 2010 at 10:36:02AM +0200, Stefano Sabatini wrote:
> On date Sunday 2010-09-26 02:42:15 +0200, Michael Niedermayer encoded:
> > 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
>
> 10+lines of code, also should be more accurate.
>
> Regards.
> --
> FFmpeg = Faithless and Fantastic Murdering Ponderous Extroverse Glue
> configure | 1
> doc/filters.texi | 21 +++++++
> libavfilter/Makefile | 1
> libavfilter/allfilters.c | 1
> libavfilter/vf_blackframe.c | 129 ++++++++++++++++++++++++++++++++++++++++++++
> 5 files changed, 153 insertions(+)
> 2253b84bd12bd308639c5738826b0bef27baeb1e 0001-Port-MPlayer-blackframe-filter.patch
> From fb8b2c52b4ceb81db8a9168a8927010703f56eed Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> Date: Sun, 26 Sep 2010 00:17:09 +0200
> Subject: [PATCH] Port MPlayer blackframe filter.
looks good if tested
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus
-------------- 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/019645d4/attachment.pgp>
More information about the ffmpeg-devel
mailing list