diff mbox

[FFmpeg-devel] avcodec/decode: fix warning when decoding pseudo paletted formats

Message ID 20180404160720.27763-1-nfxjfg@googlemail.com
State Accepted
Commit 709e0291d659d089527ec7c048f9b2608183df64
Headers show

Commit Message

wm4 April 4, 2018, 4:07 p.m. UTC
The pseudo palette allocation is optional now. But if it's still
allocated (like the internal get_buffer2 implementation does, for
compatibility), it shouldn't print a warning.
---
 libavcodec/decode.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Michael Niedermayer April 4, 2018, 7:42 p.m. UTC | #1
On Wed, Apr 04, 2018 at 06:07:20PM +0200, wm4 wrote:
> The pseudo palette allocation is optional now. But if it's still
> allocated (like the internal get_buffer2 implementation does, for
> compatibility), it shouldn't print a warning.
> ---
>  libavcodec/decode.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> index d883a5f9fc..421a8f1a35 100644
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -1779,6 +1779,8 @@ static void validate_avframe_allocation(AVCodecContext *avctx, AVFrame *frame)
>          int flags = desc ? desc->flags : 0;
>          if (num_planes == 1 && (flags & AV_PIX_FMT_FLAG_PAL))
>              num_planes = 2;
> +        if ((flags & FF_PSEUDOPAL) && frame->data[1])
> +            num_planes = 2;
>          for (i = 0; i < num_planes; i++) {
>              av_assert0(frame->data[i]);
>          }

LGTM

thx


[...]
wm4 April 5, 2018, 3:03 p.m. UTC | #2
On Wed, 4 Apr 2018 21:42:31 +0200
Michael Niedermayer <michael@niedermayer.cc> wrote:

> On Wed, Apr 04, 2018 at 06:07:20PM +0200, wm4 wrote:
> > The pseudo palette allocation is optional now. But if it's still
> > allocated (like the internal get_buffer2 implementation does, for
> > compatibility), it shouldn't print a warning.
> > ---
> >  libavcodec/decode.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> > index d883a5f9fc..421a8f1a35 100644
> > --- a/libavcodec/decode.c
> > +++ b/libavcodec/decode.c
> > @@ -1779,6 +1779,8 @@ static void validate_avframe_allocation(AVCodecContext *avctx, AVFrame *frame)
> >          int flags = desc ? desc->flags : 0;
> >          if (num_planes == 1 && (flags & AV_PIX_FMT_FLAG_PAL))
> >              num_planes = 2;
> > +        if ((flags & FF_PSEUDOPAL) && frame->data[1])
> > +            num_planes = 2;
> >          for (i = 0; i < num_planes; i++) {
> >              av_assert0(frame->data[i]);
> >          }  
> 
> LGTM
> 
> thx
> 
> 
> [...]

Pushed.
diff mbox

Patch

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index d883a5f9fc..421a8f1a35 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1779,6 +1779,8 @@  static void validate_avframe_allocation(AVCodecContext *avctx, AVFrame *frame)
         int flags = desc ? desc->flags : 0;
         if (num_planes == 1 && (flags & AV_PIX_FMT_FLAG_PAL))
             num_planes = 2;
+        if ((flags & FF_PSEUDOPAL) && frame->data[1])
+            num_planes = 2;
         for (i = 0; i < num_planes; i++) {
             av_assert0(frame->data[i]);
         }