[FFmpeg-devel] [PATCH] lavu/parseutils: reduce fraction in av_parse_ratio()

Michael Niedermayer michaelni at gmx.at
Wed Oct 17 17:05:11 CEST 2012


On Wed, Oct 17, 2012 at 11:33:35AM +0200, Stefano Sabatini wrote:
> On date Wednesday 2012-10-17 00:19:59 +0200, Michael Niedermayer encoded:
> > On Tue, Oct 16, 2012 at 09:45:03PM +0200, Stefano Sabatini wrote:
> > > Consistent with the a/b case, and with the documentation.
> > > 
> > > TODO: bump micro
> > > ---
> > >  libavutil/parseutils.c |    2 ++
> > >  1 files changed, 2 insertions(+), 0 deletions(-)
> > > 
> > > diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c
> > > index 84bb9f7..134c07f 100644
> > > --- a/libavutil/parseutils.c
> > > +++ b/libavutil/parseutils.c
> > > @@ -57,6 +57,8 @@ int av_parse_ratio(AVRational *q, const char *str, int max,
> > >          if (ret < 0)
> > >              return ret;
> > >          *q = av_d2q(d, max);
> > > +    } else {
> > > +        av_reduce(&q->num, &q->den, q->num, q->den, max);
> > >      }
> > >  
> > >      gcd = av_gcd(FFABS(q->num), FFABS(q->den));
> > 
> > the gcd code is redundnat if reduce is run
> 
> Updated.
> -- 
> FFmpeg = Faithless & Fabulous Mind-dumbing Practical Erudite Geisha

>  parseutils.c |    8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 42284cb4e182b871ff13a6569a3a658d34bac05d  0001-lavu-parseutils-rework-rational-reduction-logic-in-a.patch
> From 30b6737361719a2d88c0105cbc403ed84eaab56b Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefasab at gmail.com>
> Date: Tue, 16 Oct 2012 18:15:58 +0200
> Subject: [PATCH] lavu/parseutils: rework rational reduction logic in
>  av_parse_ratio()
> 
> Avoid to divide num and den by gcd in case of a parsed expression, since
> that is already done in av_d2q(), and force reduction in case of "a:b"
> form, allowing to honour the max parameter.
> 
> The latter change is consistent with the a/b case, and with the
> documentation.

should be ok

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121017/5a0d27c1/attachment.asc>


More information about the ffmpeg-devel mailing list