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

Jan Ekström jeebjp at gmail.com
Wed Oct 7 02:03:16 EEST 2020


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(-)

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
-- 
2.26.2



More information about the ffmpeg-devel mailing list