diff mbox series

[FFmpeg-devel,1/2] swscale/swscale_internal: interpret RGB paletted pixel formats as RGB

Message ID 20201006230317.15516-1-jeebjp@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/2] swscale/swscale_internal: interpret RGB paletted pixel formats as RGB | expand

Checks

Context Check Description
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Jan Ekström Oct. 6, 2020, 11:03 p.m. UTC
This makes isAnyRGB return true for AV_PIX_FMT_PAL8 which is currently
the only pixel format with this flag.

This lets us have a single query for formats where we need to force
range as only full range content is supported.
---
 libswscale/swscale_internal.h    | 2 +-
 tests/ref/fate/sws-pixdesc-query | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer Oct. 7, 2020, 5:34 p.m. UTC | #1
On Wed, Oct 07, 2020 at 02:03:16AM +0300, Jan Ekström wrote:
> This makes isAnyRGB return true for AV_PIX_FMT_PAL8 which is currently
> the only pixel format with this flag.
> 
> This lets us have a single query for formats where we need to force
> range as only full range content is supported.
> ---
>  libswscale/swscale_internal.h    | 2 +-
>  tests/ref/fate/sws-pixdesc-query | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)

This breaks:

./ffmpeg -i ~/tickets/3464/DEMO.HNM -vframes 5 out.avi
The output looks like the chroma plane is significantly shifted horizontally

file should be here:
https://trac.ffmpeg.org/raw-attachment/ticket/3464/DEMO.HNM

thx

[...]
Jan Ekström Oct. 7, 2020, 5:45 p.m. UTC | #2
On Wed, Oct 7, 2020 at 8:34 PM Michael Niedermayer
<michael@niedermayer.cc> wrote:
>
> On Wed, Oct 07, 2020 at 02:03:16AM +0300, Jan Ekström wrote:
> > This makes isAnyRGB return true for AV_PIX_FMT_PAL8 which is currently
> > the only pixel format with this flag.
> >
> > This lets us have a single query for formats where we need to force
> > range as only full range content is supported.
> > ---
> >  libswscale/swscale_internal.h    | 2 +-
> >  tests/ref/fate/sws-pixdesc-query | 1 +
> >  2 files changed, 2 insertions(+), 1 deletion(-)
>
> This breaks:
>
> ./ffmpeg -i ~/tickets/3464/DEMO.HNM -vframes 5 out.avi
> The output looks like the chroma plane is significantly shifted horizontally
>
> file should be here:
> https://trac.ffmpeg.org/raw-attachment/ticket/3464/DEMO.HNM
>
> thx

OK, thank you.

I will move back to !isYUV() && !isGray() instead of isAnyRGB() then
because while latter is IMHO easier to read, this was not noticed in
FATE and swscale is not what I am trying to work on more than
absolutely necessary right now.

Jan
diff mbox series

Patch

diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index d207d3beff..013ad51299 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -775,7 +775,7 @@  static av_always_inline int isAnyRGB(enum AVPixelFormat pix_fmt)
 {
     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
     av_assert0(desc);
-    return (desc->flags & AV_PIX_FMT_FLAG_RGB) ||
+    return (desc->flags & (AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PAL)) ||
             pix_fmt == AV_PIX_FMT_MONOBLACK || pix_fmt == AV_PIX_FMT_MONOWHITE;
 }
 
diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query
index c3cccfa492..42e82389af 100644
--- a/tests/ref/fate/sws-pixdesc-query
+++ b/tests/ref/fate/sws-pixdesc-query
@@ -570,6 +570,7 @@  AnyRGB:
   gbrpf32le
   monob
   monow
+  pal8
   rgb0
   rgb24
   rgb32