[FFmpeg-devel] [PATCH] swscale/utils: fix sws_getCachedContext check

Niklas Haas ffmpeg at haasn.xyz
Mon Dec 16 13:26:49 EET 2024


From: Niklas Haas <git at haasn.dev>

This logic was inverted, but || was not replaced by &&.

Fixes: ed5dd675624c83d9c69b406ce30e4e09f29970e3
Fixes: ticket #11353
---
 libswscale/utils.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libswscale/utils.c b/libswscale/utils.c
index 32f90e366e..4dedbfc394 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -2548,14 +2548,14 @@ SwsContext *sws_getCachedContext(SwsContext *prev, int srcW,
     if (!param)
         param = default_param;
 
-    if (prev && (prev->src_w            == srcW      ||
-                 prev->src_h            == srcH      ||
-                 prev->src_format       == srcFormat ||
-                 prev->dst_w            == dstW      ||
-                 prev->dst_h            == dstH      ||
-                 prev->dst_format       == dstFormat ||
-                 prev->flags            == flags     ||
-                 prev->scaler_params[0] == param[0]  ||
+    if (prev && (prev->src_w            == srcW      &&
+                 prev->src_h            == srcH      &&
+                 prev->src_format       == srcFormat &&
+                 prev->dst_w            == dstW      &&
+                 prev->dst_h            == dstH      &&
+                 prev->dst_format       == dstFormat &&
+                 prev->flags            == flags     &&
+                 prev->scaler_params[0] == param[0]  &&
                  prev->scaler_params[1] == param[1])) {
         return prev;
     }
-- 
2.47.0



More information about the ffmpeg-devel mailing list