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

Git pushed a commit to branch master
in repository ffmpeg.

commit 76c60b192d006517ed6831e7e106f0e48840c2be
Author:     Niklas Haas <[email protected]>
AuthorDate: Sun Feb 22 19:30:34 2026 +0100
Commit:     Niklas Haas <[email protected]>
CommitDate: Mon Mar 9 11:25:58 2026 +0100

    swscale: restructure sws_scale_frame() slightly
    
    Results in IMHO slightly more readable code flow, and will be useful in an
    upcoming commit (that adds logic to ref individual planes).
    
    Signed-off-by: Niklas Haas <[email protected]>
---
 libswscale/swscale.c | 35 ++++++++++++++---------------------
 1 file changed, 14 insertions(+), 21 deletions(-)

diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index e4dbef8098..351c67d011 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -1376,28 +1376,21 @@ int sws_scale_frame(SwsContext *sws, AVFrame *dst, 
const AVFrame *src)
     if (!src->data[0])
         return 0;
 
-    if (c->graph[FIELD_TOP]->noop &&
-        (!c->graph[FIELD_BOTTOM] || c->graph[FIELD_BOTTOM]->noop) &&
-        src->buf[0] && !dst->buf[0] && !dst->data[0])
-    {
-        /* Lightweight refcopy */
-        ret = frame_ref(dst, src);
-        if (ret < 0)
-            return ret;
-    } else {
-        if (!dst->data[0]) {
-            ret = av_frame_get_buffer(dst, 0);
-            if (ret < 0)
-                return ret;
-        }
+    const SwsGraph *top = c->graph[FIELD_TOP];
+    const SwsGraph *bot = c->graph[FIELD_BOTTOM];
+    if (dst->data[0]) /* user-provided buffers */
+        goto process_frame;
 
-        for (int field = 0; field < 2; field++) {
-            SwsGraph *graph = c->graph[field];
-            ff_sws_graph_run(graph, dst, src);
-            if (!graph->dst.interlaced)
-                break;
-        }
-    }
+    if (src->buf[0] && top->noop && (!bot || bot->noop))
+        return frame_ref(dst, src);
+
+    ret = av_frame_get_buffer(dst, 0);
+    if (ret < 0)
+        return ret;
+
+process_frame:
+    for (int field = 0; field < (bot ? 2 : 1); field++)
+        ff_sws_graph_run(c->graph[field], dst, src);
 
     return 0;
 }

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

Reply via email to