[FFmpeg-devel] [PATCH 3/3] swscale/utils: don't early return in yuv alpha blendaway

Niklas Haas ffmpeg at haasn.xyz
Mon Nov 13 17:32:34 EET 2023


From: Niklas Haas <git at haasn.dev>

If changing YUV range after init results in the special converter no
longer being picked, then we need the rest of the init function to have
been hit.

Fixes: cedf589c09c567b72bf4c1a58db53d94622567e1
---
 libswscale/utils.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libswscale/utils.c b/libswscale/utils.c
index 7ce86f83ea..294b0b5ace 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -1721,7 +1721,9 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter,
             av_log(c, AV_LOG_INFO,
                     "alpha blendaway %s -> %s special converter is available\n",
                     av_get_pix_fmt_name(srcFormat), av_get_pix_fmt_name(dstFormat));
-        return 0;
+
+        if (isAnyRGB(dstFormat))
+            return 0;
     }
 
     /* unscaled special cases */
-- 
2.42.0



More information about the ffmpeg-devel mailing list