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

Git pushed a commit to branch master
in repository ffmpeg.

commit eec9f712f55c090fe134be562a02d0518bbce42b
Author:     Niklas Haas <[email protected]>
AuthorDate: Wed Apr 22 16:10:45 2026 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Fri May 15 18:53:05 2026 +0200

    swscale/ops: re-use ff_sws_op_list_generate() in ff_sws_enum_op_lists()
    
    The only difference here is an extra ff_sws_add_filters() call, which is
    a no-op because src w/h = dst w/h = 16.
    
    Signed-off-by: Niklas Haas <[email protected]>
---
 libswscale/ops.c | 34 +++++++++++++---------------------
 1 file changed, 13 insertions(+), 21 deletions(-)

diff --git a/libswscale/ops.c b/libswscale/ops.c
index a030dc5e57..53baaee13a 100644
--- a/libswscale/ops.c
+++ b/libswscale/ops.c
@@ -1013,27 +1013,19 @@ static int enum_ops_fmt(SwsContext *ctx, void *opaque,
                         enum AVPixelFormat src_fmt, enum AVPixelFormat dst_fmt,
                         int (*cb)(SwsContext *ctx, void *opaque, SwsOpList 
*ops))
 {
-    int ret;
-    const SwsPixelType type = SWS_PIXEL_F32;
-    SwsOpList *ops = ff_sws_op_list_alloc();
-    if (!ops)
-        return AVERROR(ENOMEM);
-
-    ff_fmt_from_pixfmt(src_fmt, &ops->src);
-    ff_fmt_from_pixfmt(dst_fmt, &ops->dst);
-    ops->src.width  = ops->dst.width  = 16;
-    ops->src.height = ops->dst.height = 16;
-
-    bool incomplete = ff_infer_colors(&ops->src.color, &ops->dst.color);
-    if ((ret = ff_sws_decode_pixfmt(ops, src_fmt)) < 0 ||
-        (ret = ff_sws_decode_colors(ctx, type, ops, &ops->src, &incomplete)) < 
0 ||
-        (ret = ff_sws_encode_colors(ctx, type, ops, &ops->src, &ops->dst, 
&incomplete)) < 0 ||
-        (ret = ff_sws_encode_pixfmt(ops, dst_fmt)) < 0)
-    {
-        if (ret == AVERROR(ENOTSUP))
-            ret = 0; /* silently skip unsupported formats */
-        goto fail;
-    }
+    SwsFormat src, dst;
+    ff_fmt_from_pixfmt(src_fmt, &src);
+    ff_fmt_from_pixfmt(dst_fmt, &dst);
+    bool incomplete = ff_infer_colors(&src.color, &dst.color);
+    src.width  = dst.width  = 16;
+    src.height = dst.height = 16;
+
+    SwsOpList *ops;
+    int ret = ff_sws_op_list_generate(ctx, &src, &dst, &ops, &incomplete);
+    if (ret == AVERROR(ENOTSUP))
+        return 0; /* silently skip unsupported formats */
+    else if (ret < 0)
+        return ret;
 
     ret = ff_sws_op_list_optimize(ops);
     if (ret < 0)

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to