[FFmpeg-devel] [PATCH 2/3] swscale/utils: correctly return from sws_init_single_context

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


From: Niklas Haas <git at haasn.dev>

Before cedf589, this function would return early return on RGB and float
formats, as well as when range was equal. While this commit
intentionally removed the early return for same-range YUV conversions,
it missed that RGB and float formats that have an unscaled converter
should always early return, no matter what the source range was set to.

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

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



More information about the ffmpeg-devel mailing list