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

Michael Niedermayer michaelni at gmx.at
Wed Oct 17 00:19:59 CEST 2012


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

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No snowflake in an avalanche ever feels responsible. -- Voltaire
-------------- 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/b7fe9b88/attachment.asc>


More information about the ffmpeg-devel mailing list