diff mbox series

[FFmpeg-devel,v2,4/4] fftools/cmdutils: pass sws_flags to scale filter in simple filter graph

Message ID 20210802164904.70998-4-fulinjie@zju.edu.cn
State New
Headers show
Series [FFmpeg-devel,v2,1/4] FATE: Update test refs for scale used in filter complex | 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. 2, 2021, 4:49 p.m. UTC
From: Linjie Fu <linjie.justin.fu@gmail.com>

Pass sws_flags to scale filter through scale_sws_opts and correct the
dumped flags information.

CMD:
$ffmpeg -v verbose -i input.mp4 -sws_flags lanczos+bitexact+accurate_rnd \
        -vf format=yuv420p,scale=800x600 -an -vframes 10 -f md5 -

Before:
[auto_scaler_0 @ 0x7f899a418780] w:iw h:ih flags:'bilinear' interl:0
[auto_scaler_0 @ 0x7f899a418780] w:1920 h:1080 fmt:yuvj420p sar:0/1 -> w:1920 h:1080 fmt:yuv420p sar:0/1 flags:0x2
[Parsed_scale_1 @ 0x7f899a417100] w:1920 h:1080 fmt:yuv420p sar:0/1 -> w:800 h:600 fmt:yuv420p sar:0/1 flags:0x2
MD5=ff1d6091690c6fcd36d458d2a9f648ce

After:
[auto_scaler_0 @ 0x7fc7a3a06080] w:iw h:ih flags:'lanczos+bitexact+accurate_rnd' interl:0
[auto_scaler_0 @ 0x7fc7a3a06080] w:1920 h:1080 fmt:yuvj420p sar:0/1 -> w:1920 h:1080 fmt:yuv420p sar:0/1 flags:0xc0200
[Parsed_scale_1 @ 0x7fc7a3a04780] w:1920 h:1080 fmt:yuv420p sar:0/1 -> w:800 h:600 fmt:yuv420p sar:0/1 flags:0xc0200
MD5=ff1d6091690c6fcd36d458d2a9f648ce

Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
---
 fftools/ffmpeg_filter.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Nicolas George Aug. 2, 2021, 5:07 p.m. UTC | #1
Linjie Fu (12021-08-03):
> From: Linjie Fu <linjie.justin.fu@gmail.com>
> 
> Pass sws_flags to scale filter through scale_sws_opts and correct the
> dumped flags information.
> 
> CMD:
> $ffmpeg -v verbose -i input.mp4 -sws_flags lanczos+bitexact+accurate_rnd \
>         -vf format=yuv420p,scale=800x600 -an -vframes 10 -f md5 -
> 
> Before:
> [auto_scaler_0 @ 0x7f899a418780] w:iw h:ih flags:'bilinear' interl:0
> [auto_scaler_0 @ 0x7f899a418780] w:1920 h:1080 fmt:yuvj420p sar:0/1 -> w:1920 h:1080 fmt:yuv420p sar:0/1 flags:0x2
> [Parsed_scale_1 @ 0x7f899a417100] w:1920 h:1080 fmt:yuv420p sar:0/1 -> w:800 h:600 fmt:yuv420p sar:0/1 flags:0x2
> MD5=ff1d6091690c6fcd36d458d2a9f648ce
> 
> After:
> [auto_scaler_0 @ 0x7fc7a3a06080] w:iw h:ih flags:'lanczos+bitexact+accurate_rnd' interl:0
> [auto_scaler_0 @ 0x7fc7a3a06080] w:1920 h:1080 fmt:yuvj420p sar:0/1 -> w:1920 h:1080 fmt:yuv420p sar:0/1 flags:0xc0200
> [Parsed_scale_1 @ 0x7fc7a3a04780] w:1920 h:1080 fmt:yuv420p sar:0/1 -> w:800 h:600 fmt:yuv420p sar:0/1 flags:0xc0200
> MD5=ff1d6091690c6fcd36d458d2a9f648ce
> 
> Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
> ---
>  fftools/ffmpeg_filter.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
> index 958d74f008..94838adc56 100644
> --- a/fftools/ffmpeg_filter.c
> +++ b/fftools/ffmpeg_filter.c
> @@ -977,7 +977,11 @@ int configure_filtergraph(FilterGraph *fg)
>          }
>          if (strlen(args))
>              args[strlen(args)-1] = 0;

> -        fg->graph->scale_sws_opts = av_strdup(args);
> +
> +        if (!strncmp(args, "sws_flags=", 10)) {
> +            // keep the 'flags=' part
> +            fg->graph->scale_sws_opts = av_strdup(args+4);
> +        }

What? This code does not seem to match the commit message. More
explanation needed.

>  
>          args[0] = 0;
>          while ((e = av_dict_get(ost->swr_opts, "", e,

Regards,
Linjie Fu Aug. 3, 2021, 4:15 p.m. UTC | #2
On Tue, Aug 3, 2021 at 1:07 AM Nicolas George <george@nsup.org> wrote:

> Linjie Fu (12021-08-03):
> > From: Linjie Fu <linjie.justin.fu@gmail.com>
> >
> > Pass sws_flags to scale filter through scale_sws_opts and correct the
> > dumped flags information.
> >
> > CMD:
> > $ffmpeg -v verbose -i input.mp4 -sws_flags lanczos+bitexact+accurate_rnd
> \
> >         -vf format=yuv420p,scale=800x600 -an -vframes 10 -f md5 -
> >
> > Before:
> > [auto_scaler_0 @ 0x7f899a418780] w:iw h:ih flags:'bilinear' interl:0
> > [auto_scaler_0 @ 0x7f899a418780] w:1920 h:1080 fmt:yuvj420p sar:0/1 ->
> w:1920 h:1080 fmt:yuv420p sar:0/1 flags:0x2
> > [Parsed_scale_1 @ 0x7f899a417100] w:1920 h:1080 fmt:yuv420p sar:0/1 ->
> w:800 h:600 fmt:yuv420p sar:0/1 flags:0x2
> > MD5=ff1d6091690c6fcd36d458d2a9f648ce
> >
> > After:
> > [auto_scaler_0 @ 0x7fc7a3a06080] w:iw h:ih
> flags:'lanczos+bitexact+accurate_rnd' interl:0
> > [auto_scaler_0 @ 0x7fc7a3a06080] w:1920 h:1080 fmt:yuvj420p sar:0/1 ->
> w:1920 h:1080 fmt:yuv420p sar:0/1 flags:0xc0200
> > [Parsed_scale_1 @ 0x7fc7a3a04780] w:1920 h:1080 fmt:yuv420p sar:0/1 ->
> w:800 h:600 fmt:yuv420p sar:0/1 flags:0xc0200
> > MD5=ff1d6091690c6fcd36d458d2a9f648ce
> >
> > Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
> > ---
> >  fftools/ffmpeg_filter.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
> > index 958d74f008..94838adc56 100644
> > --- a/fftools/ffmpeg_filter.c
> > +++ b/fftools/ffmpeg_filter.c
> > @@ -977,7 +977,11 @@ int configure_filtergraph(FilterGraph *fg)
> >          }
> >          if (strlen(args))
> >              args[strlen(args)-1] = 0;
>
> > -        fg->graph->scale_sws_opts = av_strdup(args);
> > +
> > +        if (!strncmp(args, "sws_flags=", 10)) {
> > +            // keep the 'flags=' part
> > +            fg->graph->scale_sws_opts = av_strdup(args+4);
> > +        }
>
> What? This code does not seem to match the commit message. More
> explanation needed.
>
> >
> >          args[0] = 0;
> >          while ((e = av_dict_get(ost->swr_opts, "", e,
>
> Regards,
>

Fixed the commit message and updated the patch set, thx.

- linjie
diff mbox series

Patch

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 958d74f008..94838adc56 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -977,7 +977,11 @@  int configure_filtergraph(FilterGraph *fg)
         }
         if (strlen(args))
             args[strlen(args)-1] = 0;
-        fg->graph->scale_sws_opts = av_strdup(args);
+
+        if (!strncmp(args, "sws_flags=", 10)) {
+            // keep the 'flags=' part
+            fg->graph->scale_sws_opts = av_strdup(args+4);
+        }
 
         args[0] = 0;
         while ((e = av_dict_get(ost->swr_opts, "", e,