This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 8579e070cbd0008cdd7e57c2fe4e8d8c9d2c4e02
Author:     Niklas Haas <[email protected]>
AuthorDate: Wed Aug 5 21:43:10 2026 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Tue Oct 20 21:33:01 2026 +0000

    swscale/format: simplify ff_sws_op_list_generate() error handling
    
    Using the RET() macro and lifting out the memory management.
    
    Signed-off-by: Niklas Haas <[email protected]>
---
 libswscale/format.c | 34 +++++++++++++++-------------------
 1 file changed, 15 insertions(+), 19 deletions(-)

diff --git a/libswscale/format.c b/libswscale/format.c
index 59b0ec1afd..b722f979d4 100644
--- a/libswscale/format.c
+++ b/libswscale/format.c
@@ -1829,6 +1829,20 @@ int ff_sws_apply_lut3d(SwsContext *ctx, SwsPixelType 
type, SwsOpList *ops,
     return 0;
 }
 
+static int fmt_convert(SwsContext *ctx, const SwsFormat *src, const SwsFormat 
*dst,
+                       const SwsLut3D *lut3d, SwsOpList *ops, bool *incomplete)
+{
+    const SwsPixelType type = SWS_PIXEL_F32;
+    RET(ff_sws_decode_pixfmt(ops, src));
+    RET(ff_sws_decode_colors(ctx, type, ops, src, incomplete));
+    RET(ff_sws_add_filters(ctx, type, ops, src, dst));
+    if (lut3d)
+        RET(ff_sws_apply_lut3d(ctx, type, ops, lut3d));
+    RET(ff_sws_encode_colors(ctx, type, ops, src, dst, incomplete));
+    RET(ff_sws_encode_pixfmt(ops, dst));
+    return 0;
+}
+
 int ff_sws_op_list_generate(SwsContext *ctx, const SwsFormat *src,
                             const SwsFormat *dst, const SwsLut3D *lut3d,
                             SwsOpList **out_ops, bool *incomplete)
@@ -1849,25 +1863,7 @@ int ff_sws_op_list_generate(SwsContext *ctx, const 
SwsFormat *src,
     ops->src = *src;
     ops->dst = *dst;
 
-    const SwsPixelType type = SWS_PIXEL_F32;
-    int ret = ff_sws_decode_pixfmt(ops, src);
-    if (ret < 0)
-        goto fail;
-    ret = ff_sws_decode_colors(ctx, type, ops, src, incomplete);
-    if (ret < 0)
-        goto fail;
-    ret = ff_sws_add_filters(ctx, type, ops, src, dst);
-    if (ret < 0)
-        goto fail;
-    if (lut3d) {
-        ret = ff_sws_apply_lut3d(ctx, type, ops, lut3d);
-        if (ret < 0)
-            goto fail;
-    }
-    ret = ff_sws_encode_colors(ctx, type, ops, src, dst, incomplete);
-    if (ret < 0)
-        goto fail;
-    ret = ff_sws_encode_pixfmt(ops, dst);
+    int ret = fmt_convert(ctx, src, dst, lut3d, ops, incomplete);
     if (ret < 0)
         goto fail;
 

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to