[FFmpeg-devel] [PATCH] Add scale filter

Michael Niedermayer michaelni
Mon Nov 2 12:44:12 CET 2009


On Mon, Nov 02, 2009 at 01:23:01AM +0100, Stefano Sabatini wrote:
> On date Saturday 2009-10-31 00:46:31 +0100, Michael Niedermayer encoded:
> > On Fri, Oct 30, 2009 at 11:44:13AM +0100, Stefano Sabatini wrote:
> [...]
> > > +static void draw_slice(AVFilterLink *link, int y, int h)
> > > +{
> > > +    ScaleContext *scale = link->dst->priv;
> > > +    int out_h;
> > > +    AVFilterPicRef *cur_pic = link->cur_pic;
> > > +    uint8_t *data[4];
> > > +
> > > +    if (!scale->slice_dir) {
> > > +        if (y != 0 && y + h != link->h) {
> > > +            av_log(scale, AV_LOG_ERROR, "Slices start in the middle!\n");
> > > +            return;
> > > +        }
> > > +        scale->slice_dir = y ?                       -1 : 1;
> > > +        scale->slice_y   = y ? link->dst->outputs[0]->h : y;
> > > +    }
> > > +
> > > +    data[0] = cur_pic->data[0] +  y               * cur_pic->linesize[0];
> > 
> > > +    data[1] = link->format == PIX_FMT_PAL8 ?
> > > +              cur_pic->data[1] :
> > > +              cur_pic->data[1] + (y>>scale->vsub) * cur_pic->linesize[1];
> > 
> > the PAL8 check is insufficient, other 8bit formats can also have a fixed
> > palette in there
> 
> swscale.c has this macro:
> 
> #define usePal(x)           (       \
>            (x)==PIX_FMT_PAL8        \
>         || (x)==PIX_FMT_BGR4_BYTE   \
>         || (x)==PIX_FMT_RGB4_BYTE   \
>         || (x)==PIX_FMT_BGR8        \
>         || (x)==PIX_FMT_RGB8        \
>      )
> 
> And in pixfmt.h there is:
> 
>  * For all the 8bit per pixel formats, an RGB32 palette is in data[1] like
>  * for pal8. This palette is filled in automatically by the function
>  * allocating the picture.
> 

> BTW, why RGB4/BGR4 is not amongst them? It's not an 8bit format,
> nonetheless looks like it would make sense to expect a palette for it
> too.

until there is code that would benefit from it, it makes no sense


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

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides
-------------- 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/20091102/5bab52bf/attachment.pgp>



More information about the ffmpeg-devel mailing list