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

Git pushed a commit to branch master
in repository ffmpeg.

commit 5384908e5632ff6b5c227af4462294d5dd746285
Author:     Niklas Haas <[email protected]>
AuthorDate: Fri Feb 27 15:02:00 2026 +0100
Commit:     Niklas Haas <[email protected]>
CommitDate: Thu Mar 5 23:34:56 2026 +0000

    swscale/ops: move pass compilation logic to helper function
    
    Purely cosmetic.
    
    Sponsored-by: Sovereign Tech Fund
    Signed-off-by: Niklas Haas <[email protected]>
---
 libswscale/ops.c | 75 ++++++++++++++++++++++++++++++++------------------------
 1 file changed, 43 insertions(+), 32 deletions(-)

diff --git a/libswscale/ops.c b/libswscale/ops.c
index 9f53657d8a..485f1c4c44 100644
--- a/libswscale/ops.c
+++ b/libswscale/ops.c
@@ -1145,46 +1145,20 @@ static int rw_pixel_bits(const SwsOp *op)
     return elems * size * bits;
 }
 
-int ff_sws_compile_pass(SwsGraph *graph, SwsOpList *ops, int flags,
-                        const SwsFormat *dst, SwsPass *input, SwsPass **output)
+static int compile(SwsGraph *graph, const SwsOpList *ops,
+                   const SwsFormat *dst, SwsPass *input, SwsPass **output)
 {
     SwsContext *ctx = graph->ctx;
-    SwsOpPass *p = NULL;
-    const SwsOp *read = &ops->ops[0];
-    const SwsOp *write = &ops->ops[ops->num_ops - 1];
-    SwsPass *pass;
-    int ret;
-
-    /* Check if the whole operation graph is an end-to-end no-op */
-    if (ff_sws_op_list_is_noop(ops)) {
-        *output = input;
-        return 0;
-    }
-
-    if (ops->num_ops < 2) {
-        av_log(ctx, AV_LOG_ERROR, "Need at least two operations.\n");
-        return AVERROR(EINVAL);
-    }
-
-    if (read->op != SWS_OP_READ || write->op != SWS_OP_WRITE) {
-        av_log(ctx, AV_LOG_ERROR, "First and last operations must be a read "
-               "and write, respectively.\n");
-        return AVERROR(EINVAL);
-    }
-
-    if (flags & SWS_OP_FLAG_OPTIMIZE)
-        RET(ff_sws_op_list_optimize(ops));
-    else
-        ff_sws_op_list_update_comps(ops);
-
-    p = av_mallocz(sizeof(*p));
+    SwsOpPass *p = av_mallocz(sizeof(*p));
     if (!p)
         return AVERROR(ENOMEM);
 
-    ret = ff_sws_ops_compile(ctx, ops, &p->comp);
+    int ret = ff_sws_ops_compile(ctx, ops, &p->comp);
     if (ret < 0)
         goto fail;
 
+    const SwsOp *read = &ops->ops[0];
+    const SwsOp *write = &ops->ops[ops->num_ops - 1];
     p->planes_in  = rw_planes(read);
     p->planes_out = rw_planes(write);
     p->pixel_bits_in  = rw_pixel_bits(read);
@@ -1201,6 +1175,7 @@ int ff_sws_compile_pass(SwsGraph *graph, SwsOpList *ops, 
int flags,
         p->idx_out[i] = i < p->planes_out ? ops->order_dst.in[i] : -1;
     }
 
+    SwsPass *pass;
     pass = ff_sws_graph_add_pass(graph, dst->format, dst->width, dst->height,
                                  input, p->comp.slice_align, p, op_pass_run);
     if (!pass) {
@@ -1217,3 +1192,39 @@ fail:
     op_pass_free(p);
     return ret;
 }
+
+int ff_sws_compile_pass(SwsGraph *graph, SwsOpList *ops, int flags,
+                        const SwsFormat *dst, SwsPass *input, SwsPass **output)
+{
+    SwsContext *ctx = graph->ctx;
+    const SwsOp *read = &ops->ops[0];
+    const SwsOp *write = &ops->ops[ops->num_ops - 1];
+    int ret;
+
+    /* Check if the whole operation graph is an end-to-end no-op */
+    if (ff_sws_op_list_is_noop(ops)) {
+        *output = input;
+        return 0;
+    }
+
+    if (ops->num_ops < 2) {
+        av_log(ctx, AV_LOG_ERROR, "Need at least two operations.\n");
+        return AVERROR(EINVAL);
+    }
+
+    if (read->op != SWS_OP_READ || write->op != SWS_OP_WRITE) {
+        av_log(ctx, AV_LOG_ERROR, "First and last operations must be a read "
+               "and write, respectively.\n");
+        return AVERROR(EINVAL);
+    }
+
+    if (flags & SWS_OP_FLAG_OPTIMIZE) {
+        ret = ff_sws_op_list_optimize(ops);
+        if (ret < 0)
+            return ret;
+    } else {
+        ff_sws_op_list_update_comps(ops);
+    }
+
+    return compile(graph, ops, dst, input, output);
+}

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

Reply via email to