[FFmpeg-devel] [PATCH]lavf/webpenc: Do not set alpha flag for yuv420p

Ronald S. Bultje rsbultje at gmail.com
Tue May 3 15:04:50 CEST 2016


Hi,

On Tue, May 3, 2016 at 4:18 AM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:

> On Monday 02 May 2016 08:57:31 pm wm4 wrote:
> > On Mon, 2 May 2016 08:36:16 -0400
> >
> > "Ronald S. Bultje" <rsbultje at gmail.com> wrote:
> > > Hi,
> > >
> > > On Mon, May 2, 2016 at 5:49 AM, Carl Eugen Hoyos <cehoyos at ag.or.at>
> wrote:
> > > > On Wednesday 13 April 2016 10:27:03 am you wrote:
> > > > > Maybe it should just check whether the pixel format is alpha,
> instead
> > > > > of whether it's not yuv420p. (Just a suggestion.)
> > > >
> > > > Isn't that exactly equivalent to what my patch is doing?
> > > > Or do I just misunderstand?
> > > >
> > > > I just thought that "if (pix_fmt != AV_PIX_FMT_YUV420P)" is shorter
> > > > than "if (pix_fmt == AV_PIX_FMT_RGB32 || pix_fmt ==
> > > > AV_PIX_FMT_YUVA420P)". Do you
> > > > disagree?
> > >
> > > I think he means:
> > >
> > > AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
> > > if (desc->flags & AV_PIX_FMT_FLAG_ALPHA) {
> > >     flags |= 16;
> > > }
> >
> > Pretty much - if a better way can't be found.
>
> Sorry, I just couldn't understand your original comment.
>
> New patch attached, Carl Eugen


> @@ -107,7 +108,9 @@ static int flush(AVFormatContext *s, int trailer,
int64_t pts)
>          if (w->frame_count == 1) {
>              if (!trailer) {
>                  vp8x = 1;
> -                flags |= 2 + 16;
> +                flags |= 2;
> +                if (av_pix_fmt_desc_get(st->codecpar->format)->flags &&
AV_PIX_FMT_FLAG_ALPHA)
> +                    flags |= 16; // stream may contain transparency
information

I think you want s/&&/&/?

Ronald


More information about the ffmpeg-devel mailing list