diff mbox series

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

Message ID 20210521152803.119469-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 21, 2021, 3:28 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

Tom Boshoven May 21, 2021, 3:45 p.m. UTC | #1
On Fri, May 21, 2021 at 11:28 AM Tom Boshoven <tom@jwplayer.com> wrote:

> +    outlink->time_base = av_mul_q(outlink->time_base, (AVRational){2, 1});
>

This should be {1, 2} .
I'll fix this after I get some feedback.
Michael Niedermayer May 23, 2021, 12:54 p.m. UTC | #2
On Fri, May 21, 2021 at 11:45:01AM -0400, Tom Boshoven wrote:
> On Fri, May 21, 2021 at 11:28 AM Tom Boshoven <tom@jwplayer.com> wrote:
> 
> > +    outlink->time_base = av_mul_q(outlink->time_base, (AVRational){2, 1});
> >
> 
> This should be {1, 2} .
> I'll fix this after I get some feedback.

yes, av_mul_q() is better

thx

[...]
diff mbox series

Patch

diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c
index a6942a2aa2..adeec81c04 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){2, 1});
     outlink->w             = ctx->inputs[0]->w;
     outlink->h             = ctx->inputs[0]->h;