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

Git pushed a commit to branch master
in repository ffmpeg.

commit b8bfd7800a27f84fa91405317b6726c75356f85a
Author:     Niklas Haas <[email protected]>
AuthorDate: Wed Jun 3 21:31:21 2026 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Wed Jun 3 21:39:55 2026 +0000

    swscale/graph: only prefer unstable backends with SWS_UNSTABLE
    
    If the user passes `-backends all` but without `-flags unstable`, then the
    default/legacy backend will be picked unless it doesn't support a given
    pixel format.
    
    This allows gradually opting into the new code to handle more pixel formats
    than what the legacy backend currently supports, without disturbing the
    predictable output/behavior.
    
    Signed-off-by: Niklas Haas <[email protected]>
---
 libswscale/graph.c   | 13 +++++++++++--
 libswscale/swscale.h |  6 +++---
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/libswscale/graph.c b/libswscale/graph.c
index 941ef1cb8a..cd4498c91e 100644
--- a/libswscale/graph.c
+++ b/libswscale/graph.c
@@ -658,11 +658,20 @@ static int add_convert_pass(SwsGraph *graph, const 
SwsFormat *src,
                             const SwsFormat *dst, SwsPass *input,
                             SwsPass **output)
 {
+    SwsContext *ctx = graph->ctx;
     int ret;
 
-    ret = add_ops_convert_pass(graph, src, dst, input, output);
-    if (ret == AVERROR(ENOTSUP))
+    if (ctx->flags & SWS_UNSTABLE) {
+        /* Prefer unstable ops backend over legacy backend */
+        ret = add_ops_convert_pass(graph, src, dst, input, output);
+        if (ret == AVERROR(ENOTSUP))
+            ret = add_legacy_sws_pass(graph, src, dst, input, output);
+    } else {
+        /* Prefer legacy backend for stability reasons */
         ret = add_legacy_sws_pass(graph, src, dst, input, output);
+        if (ret == AVERROR(ENOTSUP))
+            ret = add_ops_convert_pass(graph, src, dst, input, output);
+    }
 
     return ret;
 }
diff --git a/libswscale/swscale.h b/libswscale/swscale.h
index 8954f1a7d8..9b53ebbdff 100644
--- a/libswscale/swscale.h
+++ b/libswscale/swscale.h
@@ -180,9 +180,9 @@ typedef enum SwsFlags {
     SWS_BITEXACT       = 1 << 19,
 
     /**
-     * Allow using experimental new code paths. This may be faster, slower,
-     * or produce different output, with semantics subject to change at any
-     * point in time. For testing and debugging purposes only.
+     * Allow/prefer using experimental new code paths. This may be faster,
+     * slower, or produce different output, with semantics subject to change
+     * at any point in time. For testing and debugging purposes only.
      */
     SWS_UNSTABLE = 1 << 20,
 

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

Reply via email to