Commit bcf6712d01 for ffmpeg
commit bcf6712d01947cdd21d4ee71c1ac48f478fdbeb7
Author: Niklas Haas <git@haasn.dev>
Date: Thu Oct 29 13:48:36 2026 +0100
swscale/uops: factor out ff_sws_uop_list_print()
The same loop was duplicated in three backends.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Niklas Haas <git@haasn.dev>
diff --git a/libswscale/uops.c b/libswscale/uops.c
index 906cb0c7be..1d06a70e5f 100644
--- a/libswscale/uops.c
+++ b/libswscale/uops.c
@@ -198,6 +198,16 @@ void ff_sws_uop_list_remove_at(SwsUOpList *uops, int index, int count)
uops->num_ops = end;
}
+void ff_sws_uop_list_print(void *log, int lev, const SwsUOpList *uops)
+{
+ av_log(log, lev, "Compiled micro-ops:\n");
+ for (int i = 0; i < uops->num_ops; i++) {
+ char name[SWS_UOP_NAME_MAX];
+ ff_sws_uop_name(&uops->ops[i], name);
+ av_log(log, lev, " %s\n", name);
+ }
+}
+
int ff_sws_dither_height(const SwsDitherUOp *dither)
{
int max_offset = 0;
diff --git a/libswscale/uops.h b/libswscale/uops.h
index a70a6ac460..506b3ff622 100644
--- a/libswscale/uops.h
+++ b/libswscale/uops.h
@@ -348,6 +348,11 @@ int ff_sws_uop_list_append(SwsUOpList *uops, SwsUOp *uop);
*/
int ff_sws_uop_list_optimize(SwsContext *ctx, SwsUOpFlags flags, SwsUOpList *uops);
+/**
+ * Print the micro-ops of a compiled list at the given log level.
+ */
+void ff_sws_uop_list_print(void *log_ctx, int log_level, const SwsUOpList *uops);
+
/**
* Translate a list of operations down to micro-ops, which can be further
* optimized and then directly executed by backends.
diff --git a/libswscale/uops_backend.c b/libswscale/uops_backend.c
index f206d45443..1fd07fdeee 100644
--- a/libswscale/uops_backend.c
+++ b/libswscale/uops_backend.c
@@ -165,12 +165,7 @@ static int compile_uops_c(SwsContext *ctx, const SwsUOpList *uops, SwsCompiledOp
memcpy(out->over_read, chain->over_read, sizeof(out->over_read));
memcpy(out->over_write, chain->over_write, sizeof(out->over_write));
- av_log(ctx, AV_LOG_DEBUG, "Compiled micro-ops:\n");
- for (int i = 0; i < uops->num_ops; i++) {
- char name[SWS_UOP_NAME_MAX];
- ff_sws_uop_name(&uops->ops[i], name);
- av_log(ctx, AV_LOG_DEBUG, " %s\n", name);
- }
+ ff_sws_uop_list_print(ctx, AV_LOG_DEBUG, uops);
return 0;
diff --git a/libswscale/vulkan/ops.c b/libswscale/vulkan/ops.c
index 915696a012..f18be1efe2 100644
--- a/libswscale/vulkan/ops.c
+++ b/libswscale/vulkan/ops.c
@@ -1317,12 +1317,7 @@ static int compile_ops_spirv(SwsContext *sws, const SwsOpList *ops,
.free = spirv_free,
};
- av_log(sws, AV_LOG_DEBUG, "Compiled micro-ops:\n");
- for (int i = 0; i < uops->num_ops; i++) {
- char name[SWS_UOP_NAME_MAX];
- ff_sws_uop_name(&uops->ops[i], name);
- av_log(sws, AV_LOG_DEBUG, " %s\n", name);
- }
+ ff_sws_uop_list_print(sws, AV_LOG_DEBUG, uops);
ff_sws_uop_list_free(&uops);
return 0;
diff --git a/libswscale/x86/ops.c b/libswscale/x86/ops.c
index fa75491036..9cc5ba7a0a 100644
--- a/libswscale/x86/ops.c
+++ b/libswscale/x86/ops.c
@@ -702,12 +702,7 @@ static int compile_uops_x86(SwsContext *ctx, const SwsUOpList *uops, SwsCompiled
memcpy(out->over_read, chain->over_read, sizeof(out->over_read));
memcpy(out->over_write, chain->over_write, sizeof(out->over_write));
- av_log(ctx, AV_LOG_DEBUG, "Compiled micro-ops:\n");
- for (int i = 0; i < uops->num_ops; i++) {
- char name[SWS_UOP_NAME_MAX];
- ff_sws_uop_name(&uops->ops[i], name);
- av_log(ctx, AV_LOG_DEBUG, " %s\n", name);
- }
+ ff_sws_uop_list_print(ctx, AV_LOG_DEBUG, uops);
return 0;