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

Git pushed a commit to branch master
in repository ffmpeg.

commit 955cf563c8694128c1f5e76be3d60cc0674d1409
Author:     Ramiro Polla <[email protected]>
AuthorDate: Fri Mar 6 22:37:37 2026 +0100
Commit:     Ramiro Polla <[email protected]>
CommitDate: Wed Mar 11 08:05:08 2026 +0000

    swscale/tests/swscale: always allocate frame in scale_legacy()
    
    Legacy swscale may overwrite the pixel formats in the context (see
    handle_formats() in libswscale/utils.c). This may lead to an issue
    where, when sws_frame_start() allocates a new frame, it uses the wrong
    pixel format.
    
    Instead of fixing the issue in swscale, just make sure dst is always
    allocated prior to calling the legacy scaler.
    
    Sponsored-by: Sovereign Tech Fund
    Signed-off-by: Ramiro Polla <[email protected]>
---
 libswscale/tests/swscale.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/libswscale/tests/swscale.c b/libswscale/tests/swscale.c
index 8001f0d105..d85dcda726 100644
--- a/libswscale/tests/swscale.c
+++ b/libswscale/tests/swscale.c
@@ -224,14 +224,20 @@ static int scale_legacy(AVFrame *dst, const AVFrame *src, 
struct mode mode,
     sws_legacy->dither     = mode.dither;
     sws_legacy->threads    = opts.threads;
 
+    av_frame_unref(dst);
+    dst->width  = sws_legacy->dst_w;
+    dst->height = sws_legacy->dst_h;
+    dst->format = sws_legacy->dst_format;
+    ret = av_frame_get_buffer(dst, 0);
+    if (ret < 0)
+        goto error;
+
     if ((ret = sws_init_context(sws_legacy, NULL, NULL)) < 0)
         goto error;
 
     int64_t time = av_gettime_relative();
-    for (int i = 0; ret >= 0 && i < opts.iters; i++) {
-        unref_buffers(dst);
+    for (int i = 0; ret >= 0 && i < opts.iters; i++)
         ret = sws_scale_frame(sws_legacy, dst, src);
-    }
     *out_time = av_gettime_relative() - time;
 
 error:

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

Reply via email to