This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 8366d5f8d694a1885708c0c83b0b819e8f492964 Author: Niklas Haas <[email protected]> AuthorDate: Wed May 27 18:06:47 2026 +0200 Commit: Ramiro Polla <[email protected]> CommitDate: Fri Jun 5 22:22:27 2026 +0200 swscale/tests/swscale: refactor format testing logic Uses the internal ff_sws_test_pixfmt_backend() to test for format support on the concrete backend that's in-use for the auxiliary/main conversions, respectively, while taking into account the -backends and -api options. Sponsored-by: Sovereign Tech Fund Signed-off-by: Niklas Haas <[email protected]> --- libswscale/tests/swscale.c | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/libswscale/tests/swscale.c b/libswscale/tests/swscale.c index 8c51456390..b1c78d16e9 100644 --- a/libswscale/tests/swscale.c +++ b/libswscale/tests/swscale.c @@ -42,6 +42,7 @@ #include "libavutil/hwcontext.h" #include "libswscale/swscale.h" +#include "libswscale/format.h" #define IMPL_NEW 0 #define IMPL_LEGACY 1 @@ -675,9 +676,6 @@ static inline int fmt_is_subsampled(enum AVPixelFormat fmt) static inline int fmt_is_supported_by_hw(enum AVPixelFormat fmt) { - if (!hw_device_constr) - return 1; - /* Semi-planar formats are only supported by the legacy path, which * does not support hardware frames. */ if (fmt == AV_PIX_FMT_NV24 || fmt == AV_PIX_FMT_P410 || @@ -691,6 +689,28 @@ static inline int fmt_is_supported_by_hw(enum AVPixelFormat fmt) return 0; } +static inline int fmt_disabled(const struct options *opts, enum AVPixelFormat fmt) +{ + return (hw_device_constr && !fmt_is_supported_by_hw(fmt)) || + (opts->scaler < 0 && fmt_is_subsampled(fmt)); +} + +static inline int test_formats(const struct options *opts, + enum AVPixelFormat src, enum AVPixelFormat dst) +{ + /* Test auxiliary conversions */ + if (!ff_sws_test_pixfmt_backend(SWS_BACKEND_LEGACY, src, 1) || + !ff_sws_test_pixfmt_backend(SWS_BACKEND_LEGACY, dst, 0)) + return 0; + + /* Test main conversion */ + enum SwsBackend backend = opts->backends ? opts->backends : SWS_BACKEND_STABLE; + if (opts->api == IMPL_LEGACY) + backend = SWS_BACKEND_LEGACY; /* Legacy API forces legacy backend */ + return ff_sws_test_pixfmt_backend(backend, src, 0) && + ff_sws_test_pixfmt_backend(backend, dst, 1); +} + static int run_self_tests(const AVFrame *ref, const struct options *opts) { const int dst_w_values[] = { opts->w, opts->w - opts->w / 3, opts->w + opts->w / 3 }; @@ -712,16 +732,12 @@ static int run_self_tests(const AVFrame *ref, const struct options *opts) dst_fmt_min = dst_fmt_max = opts->dst_fmt; for (src_fmt = src_fmt_min; src_fmt <= src_fmt_max; src_fmt++) { - if ((!fmt_is_supported_by_hw(src_fmt)) || - (opts->scaler < 0 && fmt_is_subsampled(src_fmt))) - continue; - if (!sws_test_format(src_fmt, 0) || !sws_test_format(src_fmt, 1)) + if (fmt_disabled(opts, src_fmt)) continue; for (dst_fmt = dst_fmt_min; dst_fmt <= dst_fmt_max; dst_fmt++) { - if ((!fmt_is_supported_by_hw(dst_fmt)) || - (opts->scaler < 0 && fmt_is_subsampled(dst_fmt))) + if (fmt_disabled(opts, dst_fmt)) continue; - if (!sws_test_format(dst_fmt, 0) || !sws_test_format(dst_fmt, 1)) + if (!test_formats(opts, src_fmt, dst_fmt)) continue; for (int h = 0; h < FF_ARRAY_ELEMS(dst_h_values); h++) { for (int w = 0; w < FF_ARRAY_ELEMS(dst_w_values); w++) { _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
