[PR] swscale: print the effective scaler with SWS_PRINT_INFO (PR #24007)

ayoubnabil via ffmpeg-devel <[email protected]> Tue, 04 Aug 2026 15:34:29 -0000
Newsgroups gmane.comp.video.ffmpeg.devel
Message-ID <178585767009.59.17768819395707215200@29965ddac10e>
PR #24007 opened by ayoubnabil
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24007
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24007.patch

Fixes #23975.

`SWS_PRINT_INFO` derived the displayed scaler name from the legacy
`SwsContext.flags` bits. When the newer `SwsContext.scaler` option
overrode those flags, scaling used the requested algorithm while the
log still reported the legacy one.

This change uses the resolved luma scaler for the log message while
preserving the existing description of the legacy `SWS_BICUBLIN` mode.

A FATE regression test verifies that `scaler=lanczos` is reported as
`Lanczos scaler`.


>From 498c429af82770a6ce497d49c14e1487d0af9120 Mon Sep 17 00:00:00 2001
From: Ayoub Nabil <[email protected]>
Date: Tue, 4 Aug 2026 17:14:22 +0200
Subject: [PATCH] swscale: print the effective scaler with SWS_PRINT_INFO

SWS_PRINT_INFO derived its scaler description from the legacy flag bits.
When SwsContext.scaler overrode those flags, scaling used the requested
algorithm while the log still reported the legacy one.

Use the resolved luma scaler for the log message while preserving the
special description of the legacy SWS_BICUBLIN mode.

Fix ticket #23975.

Signed-off-by: Ayoub Nabil <[email protected]>
---
 libswscale/utils.c          | 4 +++-
 tests/fate/filter-video.mak | 5 +++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/libswscale/utils.c b/libswscale/utils.c
index 08424aa56b..0df5ae4396 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -1232,6 +1232,8 @@ av_cold int ff_sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter,
     SwsScaler scaler_sub = sws->scaler_sub ? sws->scaler_sub : sws->scaler;
     int lum_scaler = scaler_flag(sws->scaler, i == SWS_BICUBLIN ? SWS_BICUBIC  : i);
     int chr_scaler = scaler_flag(scaler_sub,  i == SWS_BICUBLIN ? SWS_BILINEAR : i);
+    const int info_scaler = sws->scaler == SWS_SCALE_AUTO && i == SWS_BICUBLIN
+                          ? i : lum_scaler;
 
     /* sanity check */
     if (srcW < 1 || srcH < 1 || dstW < 1 || dstH < 1) {
@@ -1757,7 +1759,7 @@ av_cold int ff_sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter,
         const char *scaler = NULL, *cpucaps;
 
         for (i = 0; i < FF_ARRAY_ELEMS(scale_algorithms); i++) {
-            if (flags & scale_algorithms[i].flag) {
+            if (info_scaler == scale_algorithms[i].flag) {
                 scaler = scale_algorithms[i].description;
                 break;
             }
diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index 0eb2e7076c..44c9824450 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -543,6 +543,11 @@ FATE_FILTER_VSYNTH-$(call FILTERDEMDEC, SCALE, RAWVIDEO, RAWVIDEO) += fate-filte
 fate-filter-scalechroma: tests/data/vsynth1.yuv
 fate-filter-scalechroma: CMD = framecrc -flags bitexact -s 352x288 -pix_fmt yuv444p -i $(TARGET_PATH)/tests/data/vsynth1.yuv -pix_fmt yuv420p -sws_flags +bitexact -vf scale=out_chroma_loc=bottomleft
 
+FATE_FILTER-$(call ALLYES, SCALE_FILTER TESTSRC2_FILTER LAVFI_INDEV WRAPPED_AVFRAME_ENCODER NULL_MUXER) += fate-filter-scale-print-info
+fate-filter-scale-print-info: CMD = run $(FFMPEG) -nostdin -hide_banner -filter_threads 1 -f lavfi -i "testsrc2=s=16x16:d=0.04" -vf "scale=32:32:flags=+print_info:scaler=lanczos" -frames:v 1 -f null -
+fate-filter-scale-print-info: CMP = grep
+fate-filter-scale-print-info: REF = Lanczos scaler
+
 # Regression test: cascaded scale=...:-2 on extreme aspect ratios could
 # previously produce zero output dimensions, silently accepted by scale
 # filter and potentially hanging downstream encoders (issue #22817).
-- 
2.52.0

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