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>
This commit is contained in:
Niklas HaasandClaude Opus 5.5 authored and Niklas Haas committed 2026-10-29 15:47:35 +00:00
1 parent a16257e454
commit bcf6712d01
5 files changed
+18 -18

No files matched your search

+10
View File
@@ -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;
+5
View File
@@ -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.
+1 -6
View File
@@ -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;
+1 -6
View File
@@ -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;
+1 -6
View File
@@ -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;