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

Git pushed a commit to branch master
in repository ffmpeg.

commit 3a159903684db1fdb9589ed16f881d83fe5b033b
Author:     Niklas Haas <[email protected]>
AuthorDate: Wed Mar 25 12:04:09 2026 +0100
Commit:     Niklas Haas <[email protected]>
CommitDate: Fri Apr 10 15:12:18 2026 +0200

    swscale/ops_dispatch: forward correct pass alignment
    
    As a consequence of the fact that the frame pool API doesn't let us directly
    access the linesize, we have to "un-translate" the over_read/write back to
    the nearest multiple of the pixel size.
    
    Signed-off-by: Niklas Haas <[email protected]>
---
 libswscale/ops_dispatch.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/libswscale/ops_dispatch.c b/libswscale/ops_dispatch.c
index f842196265..60ef405286 100644
--- a/libswscale/ops_dispatch.c
+++ b/libswscale/ops_dispatch.c
@@ -383,6 +383,19 @@ static int rw_pixel_bits(const SwsOp *op)
     return elems * size * bits;
 }
 
+static void align_pass(SwsPass *pass, int block_size, int over_rw, int 
pixel_bits)
+{
+    if (!pass)
+        return;
+
+    /* Add at least as many pixels as needed to cover the padding requirement 
*/
+    const int pad = (over_rw * 8 + pixel_bits - 1) / pixel_bits;
+
+    SwsPassBuffer *buf = pass->output;
+    buf->width_align = FFMAX(buf->width_align, block_size);
+    buf->width_pad = FFMAX(buf->width_pad, pad);
+}
+
 static int compile(SwsGraph *graph, const SwsOpList *ops, SwsPass *input,
                    SwsPass **output)
 {
@@ -459,9 +472,15 @@ static int compile(SwsGraph *graph, const SwsOpList *ops, 
SwsPass *input,
         p->filter_size = filter->filter_size;
     }
 
-    return ff_sws_graph_add_pass(graph, dst->format, dst->width, dst->height,
-                                 input, p->comp.slice_align, op_pass_run,
-                                 op_pass_setup, p, op_pass_free, output);
+    ret = ff_sws_graph_add_pass(graph, dst->format, dst->width, dst->height,
+                                input, p->comp.slice_align, op_pass_run,
+                                op_pass_setup, p, op_pass_free, output);
+    if (ret < 0)
+        return ret;
+
+    align_pass(input,   p->comp.block_size, p->comp.over_read,  
p->pixel_bits_in);
+    align_pass(*output, p->comp.block_size, p->comp.over_write, 
p->pixel_bits_out);
+    return 0;
 
 fail:
     op_pass_free(p);

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

Reply via email to