[FFmpeg-devel] [PATCH 2/2] lavfi/framesync: use av_gcd_q().

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Thu Apr 16 23:03:32 EEST 2020


Nicolas George:
> Signed-off-by: Nicolas George <george at nsup.org>
> ---
>  libavfilter/framesync.c | 13 ++-----------
>  1 file changed, 2 insertions(+), 11 deletions(-)
> 
> diff --git a/libavfilter/framesync.c b/libavfilter/framesync.c
> index bc95f7d904..26e5219d1b 100644
> --- a/libavfilter/framesync.c
> +++ b/libavfilter/framesync.c
> @@ -142,17 +142,8 @@ int ff_framesync_configure(FFFrameSync *fs)
>          for (i = 0; i < fs->nb_in; i++) {
>              if (fs->in[i].sync) {
>                  if (fs->time_base.num) {
> -                    gcd = av_gcd(fs->time_base.den, fs->in[i].time_base.den);
> -                    lcm = (fs->time_base.den / gcd) * fs->in[i].time_base.den;
> -                    if (lcm < AV_TIME_BASE / 2) {
> -                        fs->time_base.den = lcm;
> -                        fs->time_base.num = av_gcd(fs->time_base.num,
> -                                                   fs->in[i].time_base.num);
> -                    } else {
> -                        fs->time_base.num = 1;
> -                        fs->time_base.den = AV_TIME_BASE;
> -                        break;
> -                    }
> +                    fs->time_base = av_gcd_q(fs->time_base, fs->in[i].time_base,
> +                                             AV_TIME_BASE / 2, AV_TIME_BASE_Q);
>                  } else {
>                      fs->time_base = fs->in[i].time_base;
>                  }
> 
lcm is now unused, so should be removed with this commit.
(I'm not commenting on the actual merits of the patch.)

- Andreas

PS: Thanks to Andriy for adding the functionality to patchwork to check
whether a patch introduces new compiler warnings. This has been found
this way.


More information about the ffmpeg-devel mailing list