This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit ad452205b6ba0079c1da191f06d80524d7934301 Author: Lynne <[email protected]> AuthorDate: Wed Feb 25 19:14:22 2026 +0100 Commit: Lynne <[email protected]> CommitDate: Thu Feb 26 14:10:22 2026 +0100 swscale/ops: add SwsOpBackend.hw_format Allows to filter hardware formats. Sponsored-by: Sovereign Tech Fund --- libswscale/graph.c | 6 ++++++ libswscale/ops.c | 3 +++ libswscale/ops_backend.c | 1 + libswscale/ops_internal.h | 7 +++++++ libswscale/ops_memcpy.c | 5 +++-- libswscale/x86/ops.c | 1 + 6 files changed, 21 insertions(+), 2 deletions(-) diff --git a/libswscale/graph.c b/libswscale/graph.c index 81f378f020..6a12c661a2 100644 --- a/libswscale/graph.c +++ b/libswscale/graph.c @@ -462,6 +462,9 @@ static int add_legacy_sws_pass(SwsGraph *graph, SwsFormat src, SwsFormat dst, { int ret, warned = 0; SwsContext *const ctx = graph->ctx; + if (src.hw_format != AV_PIX_FMT_NONE || dst.hw_format != AV_PIX_FMT_NONE) + return AVERROR(ENOTSUP); + SwsContext *sws = sws_alloc_context(); if (!sws) return AVERROR(ENOMEM); @@ -658,6 +661,9 @@ static int adapt_colors(SwsGraph *graph, SwsFormat src, SwsFormat dst, if (ff_sws_color_map_noop(&map)) return 0; + if (src.hw_format != AV_PIX_FMT_NONE || dst.hw_format != AV_PIX_FMT_NONE) + return AVERROR(ENOTSUP); + lut = ff_sws_lut3d_alloc(); if (!lut) return AVERROR(ENOMEM); diff --git a/libswscale/ops.c b/libswscale/ops.c index d6930a15e5..0f9bb8d473 100644 --- a/libswscale/ops.c +++ b/libswscale/ops.c @@ -883,6 +883,9 @@ int ff_sws_ops_compile(SwsContext *ctx, const SwsOpList *ops, SwsCompiledOp *out { for (int n = 0; ff_sws_op_backends[n]; n++) { const SwsOpBackend *backend = ff_sws_op_backends[n]; + if (ops->src.hw_format != backend->hw_format || + ops->dst.hw_format != backend->hw_format) + continue; if (ff_sws_ops_compile_backend(ctx, backend, ops, out) < 0) continue; diff --git a/libswscale/ops_backend.c b/libswscale/ops_backend.c index f9e54020ba..cdbc3d2a3d 100644 --- a/libswscale/ops_backend.c +++ b/libswscale/ops_backend.c @@ -97,4 +97,5 @@ static int compile(SwsContext *ctx, SwsOpList *ops, SwsCompiledOp *out) const SwsOpBackend backend_c = { .name = "c", .compile = compile, + .hw_format = AV_PIX_FMT_NONE, }; diff --git a/libswscale/ops_internal.h b/libswscale/ops_internal.h index c0e6e0ae27..1276b78617 100644 --- a/libswscale/ops_internal.h +++ b/libswscale/ops_internal.h @@ -120,6 +120,13 @@ typedef struct SwsOpBackend { * Returns 0 or a negative error code. */ int (*compile)(SwsContext *ctx, SwsOpList *ops, SwsCompiledOp *out); + + /** + * If NONE, backend only supports software frames. + * Otherwise, frame hardware format must match hw_format for the backend + * to be used. + */ + enum AVPixelFormat hw_format; } SwsOpBackend; /* List of all backends, terminated by NULL */ diff --git a/libswscale/ops_memcpy.c b/libswscale/ops_memcpy.c index 7213b7a497..fd8b79ec34 100644 --- a/libswscale/ops_memcpy.c +++ b/libswscale/ops_memcpy.c @@ -128,6 +128,7 @@ static int compile(SwsContext *ctx, SwsOpList *ops, SwsCompiledOp *out) } const SwsOpBackend backend_murder = { - .name = "memcpy", - .compile = compile, + .name = "memcpy", + .compile = compile, + .hw_format = AV_PIX_FMT_NONE, }; diff --git a/libswscale/x86/ops.c b/libswscale/x86/ops.c index 8ac417acae..3978f8291c 100644 --- a/libswscale/x86/ops.c +++ b/libswscale/x86/ops.c @@ -757,4 +757,5 @@ static int compile(SwsContext *ctx, SwsOpList *ops, SwsCompiledOp *out) const SwsOpBackend backend_x86 = { .name = "x86", .compile = compile, + .hw_format = AV_PIX_FMT_NONE, }; _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
