diff mbox series

[FFmpeg-devel,v2,1/2] lavfi/vf_scale: dump the exact swscale_options to passed to libswscale

Message ID 20210809145014.98012-1-fulinjie@zju.edu.cn
State New
Headers show
Series [FFmpeg-devel,v2,1/2] lavfi/vf_scale: dump the exact swscale_options to passed to libswscale | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Linjie Fu Aug. 9, 2021, 2:50 p.m. UTC
From: Linjie Fu <linjie.justin.fu@gmail.com>

Printed verbose log doesn't match the sws_flags specified in the cmdline
for simple filter graph.

  ffmpeg .. -sws_flags bicubic ..
 [auto_scaler_0] w:iw h:ih flags:'' interl:0
 [auto_scaler_0] w:310 h:449 fmt:yuva420p sar:0/1 -> w:310 h:449 fmt:yuv420p sar:0/1 flags:0x0

Filter complex doesn't have this issue as mentioned in 12e7e1d03, the
auto-inserted scaler accepts sws_flags in filtergraph complex which
overrides the 'flags' option for vf_scale and dump it as a verbose log:

  ffmpeg ..  -filter_complex "sws_flags=bicubic;format=nv12" ..
 [auto_scaler_0] w:iw h:ih flags:'bicubic' interl:0
 [auto_scaler_0] w:310 h:449 fmt:yuva420p sar:0/1 -> w:310 h:449 fmt:nv12 sar:0/1 flags:0x2

To catch the difference, dump the exact sws_flags which is passed to
libswscale.

 [auto_scaler_0] swscale_options:'sws_flags=bicubic'

Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
---
 libavfilter/vf_scale.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index aa855b894a..dc8051a236 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -552,10 +552,16 @@  static int config_props(AVFilterLink *outlink)
                                scale->out_range == AVCOL_RANGE_JPEG, 0);
 
             if (scale->opts) {
+                char args[512] = { 0 };
                 AVDictionaryEntry *e = NULL;
                 while ((e = av_dict_get(scale->opts, "", e, AV_DICT_IGNORE_SUFFIX))) {
                     if ((ret = av_opt_set(*s, e->key, e->value, 0)) < 0)
                         return ret;
+                    av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value);
+                }
+                if (args[0] != '\0') {
+                    args[strlen(args)-1] = 0;
+                    av_log(ctx, AV_LOG_VERBOSE, "swscale_options:'%s'\n", args);
                 }
             }
             /* Override YUV420P default settings to have the correct (MPEG-2) chroma positions