[vlc-devel] [RFC] avcodec: copy frame-based palette

Jean-Baptiste Kempf jb at videolan.org
Sat Jun 14 15:25:16 CEST 2014


On 13 May, Daniel Verkamp wrote :
> > diff --git a/modules/video_chroma/swscale.c b/modules/video_chroma/swscale.c
> > index 2763e43..3b2981d 100644
> > --- a/modules/video_chroma/swscale.c
> > +++ b/modules/video_chroma/swscale.c
> > @@ -584,6 +584,8 @@ static void Convert( filter_t *p_filter, struct SwsContext *ctx,
> >      if( p_filter->fmt_in.video.i_chroma == VLC_CODEC_RGBP )
> >      {
> >          memset( palette, 0, sizeof(palette) );
> > +        if( p_src->format.p_palette )
> > +            p_filter->fmt_in.video.p_palette = p_src->format.p_palette;
> >          if( p_filter->fmt_in.video.p_palette )
> >              memcpy( palette, p_filter->fmt_in.video.p_palette->palette,
> >                      __MIN( sizeof(video_palette_t), AVPALETTE_SIZE ) );
> 
> Later frames don't have the palette, so I copy the video_palette_t
> pointer into the filter input format in swscale.  This seems a little
> ugly to me; perhaps there is a better place to store the palette
> between palette changes.
> 
> I am also not sure where the palette is actually freed, so the palette
> pointer may not be safe to copy into the filter.

It should be potentially freed when the p_src picture_t is released, so,
it could be just after the Filter() is called.

So, from my understanding either you set the p_palette to NULL in the
swscale, or you need to cpy it.

With my kindest regards,

-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device



More information about the vlc-devel mailing list