diff mbox series

[FFmpeg-devel] avfilter/yadif: Fix time base for large denominators

Message ID 20210524155206.47644-1-tom@jwplayer.com
State Superseded
Headers show
Series [FFmpeg-devel] avfilter/yadif: Fix time base for large denominators | expand

Checks

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

Commit Message

Tom Boshoven May 24, 2021, 3:52 p.m. UTC
This fixes an issue where the yadif filter could cause the timebase denominator to overflow.

Signed-off-by: Tom Boshoven <tom@jwplayer.com>
---
 libavfilter/vf_yadif.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Andriy Gelman May 25, 2021, 2:33 a.m. UTC | #1
Hello,

On Mon, 24. May 11:52, Tom Boshoven wrote:
> This fixes an issue where the yadif filter could cause the timebase denominator to overflow.
> 
> Signed-off-by: Tom Boshoven <tom@jwplayer.com>
> ---
>  libavfilter/vf_yadif.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c
> index a6942a2aa2..b067c5eead 100644
> --- a/libavfilter/vf_yadif.c
> +++ b/libavfilter/vf_yadif.c
> @@ -293,8 +293,7 @@ static int config_output(AVFilterLink *outlink)
>      AVFilterContext *ctx = outlink->src;
>      YADIFContext *s = ctx->priv;
>  
> -    outlink->time_base.num = ctx->inputs[0]->time_base.num;
> -    outlink->time_base.den = ctx->inputs[0]->time_base.den * 2;
> +    outlink->time_base = av_mul_q(outlink->time_base, (AVRational){1, 2});
>      outlink->w             = ctx->inputs[0]->w;
>      outlink->h             = ctx->inputs[0]->h;

Some fate tests fail on patchwork:
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20210524155206.47644-1-tom@jwplayer.com/
Tom Boshoven May 25, 2021, 3:53 p.m. UTC | #2
On Mon, May 24, 2021 at 10:39 PM Andriy Gelman <andriy.gelman@gmail.com> wrote:
>
> Some fate tests fail on patchwork:
> https://patchwork.ffmpeg.org/project/ffmpeg/patch/20210524155206.47644-1-tom@jwplayer.com/

Thanks! I did not realize one could make this many mistakes in a
simple one-line patch.

Apologies for the improperly tested submissions.
I'm fairly confident that the next version will work as expected, now
I know how to fully run FATE.
diff mbox series

Patch

diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c
index a6942a2aa2..b067c5eead 100644
--- a/libavfilter/vf_yadif.c
+++ b/libavfilter/vf_yadif.c
@@ -293,8 +293,7 @@  static int config_output(AVFilterLink *outlink)
     AVFilterContext *ctx = outlink->src;
     YADIFContext *s = ctx->priv;
 
-    outlink->time_base.num = ctx->inputs[0]->time_base.num;
-    outlink->time_base.den = ctx->inputs[0]->time_base.den * 2;
+    outlink->time_base = av_mul_q(outlink->time_base, (AVRational){1, 2});
     outlink->w             = ctx->inputs[0]->w;
     outlink->h             = ctx->inputs[0]->h;