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

Git pushed a commit to branch master
in repository ffmpeg.

commit 2583d7ad9b35ab89d2c20226413735cd6dbd8161
Author:     Niklas Haas <[email protected]>
AuthorDate: Fri Mar 6 20:23:24 2026 +0100
Commit:     Niklas Haas <[email protected]>
CommitDate: Sat Mar 28 18:50:14 2026 +0100

    swscale/ops_dispatch: add line offsets map to SwsOpPass
    
    And use it to look up the correct source plane line for each destination
    line. Needed for vertical scaling, in which case multiple output lines can
    reference the same input line.
    
    Sponsored-by: Sovereign Tech Fund
    Signed-off-by: Niklas Haas <[email protected]>
---
 libswscale/ops_dispatch.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/libswscale/ops_dispatch.c b/libswscale/ops_dispatch.c
index abd8810a6b..48f907e6bb 100644
--- a/libswscale/ops_dispatch.c
+++ b/libswscale/ops_dispatch.c
@@ -21,6 +21,7 @@
 #include "libavutil/avassert.h"
 #include "libavutil/mem.h"
 #include "libavutil/mem_internal.h"
+#include "libavutil/refstruct.h"
 
 #include "ops.h"
 #include "ops_internal.h"
@@ -40,6 +41,7 @@ typedef struct SwsOpPass {
     int pixel_bits_out;
     int idx_in[4];
     int idx_out[4];
+    int *offsets_y;
     bool memcpy_first;
     bool memcpy_last;
     bool memcpy_out;
@@ -109,17 +111,19 @@ static void op_pass_free(void *ptr)
         return;
 
     ff_sws_compiled_op_unref(&p->comp);
+    av_refstruct_unref(&p->offsets_y);
     av_free(p);
 }
 
-static inline void get_row_data(const SwsOpPass *p, const int y,
+static inline void get_row_data(const SwsOpPass *p, const int y_dst,
                                 const uint8_t *in[4], uint8_t *out[4])
 {
     const SwsOpExec *base = &p->exec_base;
+    const int y_src = p->offsets_y ? p->offsets_y[y_dst] : y_dst;
     for (int i = 0; i < p->planes_in; i++)
-        in[i] = base->in[i] + (y >> base->in_sub_y[i]) * base->in_stride[i];
+        in[i] = base->in[i] + (y_src >> base->in_sub_y[i]) * 
base->in_stride[i];
     for (int i = 0; i < p->planes_out; i++)
-        out[i] = base->out[i] + (y >> base->out_sub_y[i]) * 
base->out_stride[i];
+        out[i] = base->out[i] + (y_dst >> base->out_sub_y[i]) * 
base->out_stride[i];
 }
 
 static int op_pass_setup(const SwsFrame *out, const SwsFrame *in,
@@ -366,6 +370,9 @@ static int compile(SwsGraph *graph, const SwsOpList *ops, 
SwsPass *input,
         p->idx_out[i] = i < p->planes_out ? ops->order_dst.in[i] : -1;
     }
 
+    if (read->rw.filter == SWS_OP_FILTER_V)
+        p->offsets_y = av_refstruct_ref(read->rw.kernel->offsets);
+
     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);

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

Reply via email to