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

Git pushed a commit to branch master
in repository ffmpeg.

commit 4653e68aaba6754cd63a8da4327113564a9a9d0b
Author:     Niklas Haas <[email protected]>
AuthorDate: Fri Jun 19 14:30:25 2026 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Sat Jun 20 03:07:20 2026 +0200

    swscale/graph: nuke SwsGraph.field
    
    No longer needed after the previous commit.
    
    Sponsored-by: Sovereign Tech Fund
    Signed-off-by: Niklas Haas <[email protected]>
---
 libswscale/graph.c      | 28 +++++++++++++++-------------
 libswscale/graph.h      |  7 +++----
 libswscale/swscale.c    |  2 +-
 libswscale/vulkan/ops.c |  2 +-
 4 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/libswscale/graph.c b/libswscale/graph.c
index a765b4cd5c..73df6b8907 100644
--- a/libswscale/graph.c
+++ b/libswscale/graph.c
@@ -405,7 +405,7 @@ static void get_chroma_pos(SwsGraph *graph, int *h_chr_pos, 
int *v_chr_pos,
          * For 4x vertical subsampling (v_sub == 2), they are only placed
          * next to every *other* even row, so we need to shift by three luma
          * rows to get to the chroma sample. */
-        if (graph->field == FIELD_BOTTOM)
+        if (fmt->field == FIELD_BOTTOM)
             y_pos += (256 << sub_y) - 256;
 
         /* Luma row distance is doubled for fields, so halve offsets */
@@ -846,7 +846,7 @@ static void graph_uninit(SwsGraph *graph)
 }
 
 int ff_sws_graph_init(SwsGraph *graph, SwsContext *ctx, const SwsFormat *dst,
-                      const SwsFormat *src, int field)
+                      const SwsFormat *src)
 {
     int ret;
     if (graph->ctx) {
@@ -857,8 +857,9 @@ int ff_sws_graph_init(SwsGraph *graph, SwsContext *ctx, 
const SwsFormat *dst,
     graph->ctx = ctx;
     graph->src = *src;
     graph->dst = *dst;
-    graph->field = field;
     graph->opts_copy = *ctx;
+    av_assert0(src->interlaced == dst->interlaced);
+    av_assert0(src->field      == dst->field);
 
     if (ctx->threads == 1) {
         graph->num_threads = 1;
@@ -895,13 +896,13 @@ error:
 }
 
 int ff_sws_graph_create(SwsContext *ctx, const SwsFormat *dst, const SwsFormat 
*src,
-                        int field, SwsGraph **out_graph)
+                        SwsGraph **out_graph)
 {
     SwsGraph *graph = ff_sws_graph_alloc();
     if (!graph)
         return AVERROR(ENOMEM);
 
-    int ret = ff_sws_graph_init(graph, ctx, dst, src, field);
+    int ret = ff_sws_graph_init(graph, ctx, dst, src);
     if (ret < 0) {
         ff_sws_graph_free(&graph);
         return ret;
@@ -950,7 +951,7 @@ static int opts_equal(const SwsContext *c1, const 
SwsContext *c2)
 }
 
 int ff_sws_graph_reinit(SwsGraph *graph, SwsContext *ctx, const SwsFormat *dst,
-                        const SwsFormat *src, int field)
+                        const SwsFormat *src)
 {
     if (ff_fmt_equal(&graph->src, src) && ff_fmt_equal(&graph->dst, dst) &&
         opts_equal(ctx, &graph->opts_copy))
@@ -960,7 +961,7 @@ int ff_sws_graph_reinit(SwsGraph *graph, SwsContext *ctx, 
const SwsFormat *dst,
     }
 
     graph_uninit(graph);
-    return ff_sws_graph_init(graph, ctx, dst, src, field);
+    return ff_sws_graph_init(graph, ctx, dst, src);
 }
 
 void ff_sws_graph_update_metadata(SwsGraph *graph, const SwsColor *color)
@@ -971,16 +972,17 @@ void ff_sws_graph_update_metadata(SwsGraph *graph, const 
SwsColor *color)
     ff_color_update_dynamic(&graph->src.color, color);
 }
 
-static void get_field(SwsGraph *graph, const AVFrame *avframe, SwsFrame *frame)
+static void get_field(SwsGraph *graph, const SwsFormat *fmt,
+                      const AVFrame *avframe, SwsFrame *frame)
 {
     ff_sws_frame_from_avframe(frame, avframe);
 
     if (!(avframe->flags & AV_FRAME_FLAG_INTERLACED)) {
-        av_assert1(!graph->field);
+        av_assert1(!fmt->field);
         return;
     }
 
-    if (graph->field == FIELD_BOTTOM) {
+    if (fmt->field == FIELD_BOTTOM) {
         /* Odd rows, offset by one line */
         const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
         for (int i = 0; i < 4; i++) {
@@ -995,7 +997,7 @@ static void get_field(SwsGraph *graph, const AVFrame 
*avframe, SwsFrame *frame)
     for (int i = 0; i < 4; i++)
         frame->linesize[i] <<= 1;
 
-    frame->height = (frame->height + (graph->field == FIELD_TOP)) >> 1;
+    frame->height = (frame->height + (fmt->field == FIELD_TOP)) >> 1;
 }
 
 int ff_sws_graph_run(SwsGraph *graph, const AVFrame *dst, const AVFrame *src)
@@ -1004,8 +1006,8 @@ int ff_sws_graph_run(SwsGraph *graph, const AVFrame *dst, 
const AVFrame *src)
     av_assert0(src->format == graph->src.hw_format || src->format == 
graph->src.format);
 
     SwsFrame src_field, dst_field;
-    get_field(graph, dst, &dst_field);
-    get_field(graph, src, &src_field);
+    get_field(graph, &graph->dst, dst, &dst_field);
+    get_field(graph, &graph->src, src, &src_field);
 
     for (int i = 0; i < graph->num_passes; i++) {
         const SwsPass *pass = graph->passes[i];
diff --git a/libswscale/graph.h b/libswscale/graph.h
index eff2dcc47f..cb06f480cc 100644
--- a/libswscale/graph.h
+++ b/libswscale/graph.h
@@ -143,7 +143,6 @@ typedef struct SwsGraph {
      * Currently active format and processing parameters.
      */
     SwsFormat src, dst;
-    int field;
 
     /**
      * Temporary execution state inside ff_sws_graph_run(); used to pass
@@ -166,13 +165,13 @@ SwsGraph *ff_sws_graph_alloc(void);
  * negative error.
  */
 int ff_sws_graph_init(SwsGraph *graph, SwsContext *ctx, const SwsFormat *dst,
-                      const SwsFormat *src, int field);
+                      const SwsFormat *src);
 
 /**
  * Allocate and initialize the filter graph. Returns 0 or a negative error.
  */
 int ff_sws_graph_create(SwsContext *ctx, const SwsFormat *dst, const SwsFormat 
*src,
-                        int field, SwsGraph **out_graph);
+                        SwsGraph **out_graph);
 
 
 /**
@@ -223,7 +222,7 @@ void ff_sws_graph_update_metadata(SwsGraph *graph, const 
SwsColor *color);
  * will have no effect.
  */
 int ff_sws_graph_reinit(SwsGraph *graph, SwsContext *ctx, const SwsFormat *dst,
-                        const SwsFormat *src, int field);
+                        const SwsFormat *src);
 
 /**
  * Dispatch the filter graph on a single field of the given frames. Internally
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 508967a13c..969456efcc 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -1527,7 +1527,7 @@ int sws_frame_setup(SwsContext *ctx, const AVFrame *dst, 
const AVFrame *src)
             }
         }
 
-        ret = ff_sws_graph_reinit(s->graph[field], ctx, &dst_fmt, &src_fmt, 
field);
+        ret = ff_sws_graph_reinit(s->graph[field], ctx, &dst_fmt, &src_fmt);
         if (ret < 0) {
             err_msg = "Failed initializing scaling graph";
             goto fail;
diff --git a/libswscale/vulkan/ops.c b/libswscale/vulkan/ops.c
index 1218fab2c7..9d5f201e69 100644
--- a/libswscale/vulkan/ops.c
+++ b/libswscale/vulkan/ops.c
@@ -153,7 +153,7 @@ static void process(const SwsFrame *dst, const SwsFrame 
*src, int y, int h,
     });
 
     if (p->interlaced) {
-        uint32_t field = pass->graph ? pass->graph->field : 0;
+        uint32_t field = pass->graph ? pass->graph->dst.field : 0;
         ff_vk_shader_update_push_const(&p->s->vkctx, ec, &p->shd,
                                        VK_SHADER_STAGE_COMPUTE_BIT,
                                        0, sizeof(field), &field);

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

Reply via email to