From 3977bca9f4abbf3bd657bf708ffb4a34693d78bd Mon Sep 17 00:00:00 2001 From: Ramiro Polla Date: Tue, 26 May 2026 02:04:11 +0200 Subject: [PATCH] swscale/utils: improve check for float formats that will be converted to uint16_t This was triggering an assertion in x86: $ ./libswscale/tests/swscale -scaler none -backends unstable -src rgb24 -dst yaf32be Assertion c->srcBpc == 16 failed at src/libswscale/x86/swscale.c:637 Aborted Sponsored-by: Sovereign Tech Fund Signed-off-by: Ramiro Polla --- libswscale/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libswscale/utils.c b/libswscale/utils.c index 6ecba2c0b3..fa070c270a 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -1567,7 +1567,7 @@ av_cold int ff_sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter, } // float will be converted to uint16_t - if ((srcFormat == AV_PIX_FMT_GRAYF32BE || srcFormat == AV_PIX_FMT_GRAYF32LE) && + if (isFloat(srcFormat) && !isAnyRGB(srcFormat) && (!unscaled || unscaled && dstFormat != srcFormat && (srcFormat != AV_PIX_FMT_GRAYF32 || dstFormat != AV_PIX_FMT_GRAY8))){ c->srcBpc = 16;