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

Git pushed a commit to branch master
in repository ffmpeg.

commit a167248c4d9caea103ec01d26f45bde246f4ba38
Author:     Niklas Haas <[email protected]>
AuthorDate: Tue Aug 4 12:29:19 2026 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Sun Aug 9 21:03:33 2026 +0200

    swscale/ops_memcpy: omit memcpy() if src and dst are identical
    
    This allows already referenced planes to be skipped (and avoids UB in
    this case).
    
    Note that this is already safe for the other backends, because reading
    from and writing to the same pointer via e.g. AVX operations is also
    effectively a no-op.
    
    See-Also: 1e071c8585467539d48cb33f239811309eed46a0
    Signed-off-by: Niklas Haas <[email protected]>
---
 libswscale/ops_memcpy.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libswscale/ops_memcpy.c b/libswscale/ops_memcpy.c
index 2cbe8f314b..5940381ea0 100644
--- a/libswscale/ops_memcpy.c
+++ b/libswscale/ops_memcpy.c
@@ -57,6 +57,9 @@ static void process(const SwsOpExec *exec, const void *priv,
                 memset(out, p->clear_value[i], bytes);
                 out += exec->out_stride[i];
             }
+        } else if (out == exec->in[idx]) {
+            av_assert1(exec->out_stride[i] == exec->in_stride[idx]);
+            continue; /* plane was already ref'd */
         } else if (exec->out_stride[i] == exec->in_stride[idx] && !use_loop) {
             memcpy(out, exec->in[idx], exec->out_stride[i] * lines);
         } else {

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

Reply via email to