[FFmpeg-devel] [PATCH] Add pad filter

Michael Niedermayer michaelni
Mon Dec 7 13:49:32 CET 2009


On Sun, Dec 06, 2009 at 05:49:37PM +0100, Stefano Sabatini wrote:
> On date Sunday 2009-12-06 14:30:20 +0100, Michael Niedermayer encoded:
> > On Sat, Dec 05, 2009 at 12:07:11PM +0100, Stefano Sabatini wrote:
> > > On date Monday 2009-11-30 23:53:54 +0100, Stefano Sabatini encoded:
> > > > On date Monday 2009-11-30 20:18:35 +0100, Michael Niedermayer encoded:
> > > > > On Mon, Nov 30, 2009 at 09:17:18AM +0100, Stefano Sabatini wrote:
> > > > > > On date Monday 2009-11-30 01:28:41 +0100, Michael Niedermayer encoded:
> > > > [...]
> > > > > > > i think the code is too complex and messy now for what it does.
> > > > > > > Also it now partly duplicates slicify 
> > > > > > 
> > > > > > What about to issue just a single slice for the top and bottom bars?
> > > > > 
> > > > > ok
> > > > 
> > > > Simplified.
> > > 
> > > Updated.
> > [...]
> > > +    case PIX_FMT_BGRA:
> > > +        rgba_map[BLUE] = 0; rgba_map[GREEN] = 1; rgba_map[RED] = 2; rgba_map[ALPHA] = 3;
> > > +        break;
> > [...]
> > > +    case PIX_FMT_BGR24:
> > > +        rgba_map[BLUE] = 0; rgba_map[GREEN] = 1; rgba_map[RED] = 2; rgba_map[ALPHA] = 3;
> > > +        break;
> > 
> > code duplication
> 
> Fixed.
> 
> > and why dont you extract that information out of pix_desc ?
> 
> pixdescs are not meant to contain the information required to
> associate to each component the corresponding color, and indeed this

of course .... iam silly


> may change, so I prefer to hardcode the map in the filter code.
>  
> > [...]
> > > +    if (!(pad->w))
> > 
> > superflous ()
> 
> Fixed.
> 
> > [...]
> > > +#define DRAW_TOP_BAR()                                                                       \
> > > +    draw_rectangle(outpic, pad->line, pad->line_step, pad->hsub, pad->vsub,                  \
> > > +                   0, 0, pad->w, pad->y);                                                    \
> > > +    avfilter_draw_slice(link->dst->outputs[0], 0, pad->y, slice_dir)
> > > +
> > > +#define DRAW_BOTTOM_BAR()                                                                    \
> > > +    draw_rectangle(outpic, pad->line, pad->line_step, pad->hsub, pad->vsub,                  \
> > > +                   0, pad->y + link->h, pad->w, pad->h - link->h - pad->y);                  \
> > > +    avfilter_draw_slice(link->dst->outputs[0], pad->y + link->h, pad->h - link->h - pad->y, slice_dir)
> > 
> > iam against the use of macros for this.
> > please write clean code, code stays duplicated in the object file by using
> > macros
> 
> Slightly slower but duplication avoided, check if you like it.
> 
> Regards.
> -- 
> FFmpeg = Fundamental and Frightening Meaningful Powerful Enigmatic Guru

>  doc/libavfilter.texi     |   34 +++++
>  libavfilter/Makefile     |    1 
>  libavfilter/allfilters.c |    1 
>  libavfilter/vf_pad.c     |  315 +++++++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 351 insertions(+)
> bb922d6806e2dfef168f297389ead0ec50e243b7  add-pad-filter.patch

ok (if tested & works)

as a note for future work, we could keep track of what last wrote to a
picture and when and by that skip drawing the border if the pad filter
was what last drawed into the specific buffer.


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

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato 
-------------- 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/20091207/02a01ddf/attachment.pgp>



More information about the ffmpeg-devel mailing list