[FFmpeg-devel] [PATCH] Add pad filter

Stefano Sabatini stefano.sabatini-lala
Sun Dec 6 17:49:37 CET 2009


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
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-pad-filter.patch
Type: text/x-diff
Size: 13811 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091206/9f537e1b/attachment.patch>



More information about the ffmpeg-devel mailing list