diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-05-25 15:39:02 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-05-31 17:10:36 +0200 |
commit | 887d74c47efa70d7d1513e9492d41cf7f88dee0b (patch) | |
tree | 6e7d82a13892e0f0ac4ab2a7b908d907a0da574a /libavutil/rational.c | |
parent | f77467a11dbf88876e98a9cbce427c5646e1d193 (diff) | |
download | ffmpeg-887d74c47efa70d7d1513e9492d41cf7f88dee0b.tar.gz |
av_d2q: Add a special case for |value| > MAX and |value| < 1/MAX
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/rational.c')
-rw-r--r-- | libavutil/rational.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libavutil/rational.c b/libavutil/rational.c index 7abf54cd0b..aabe58f684 100644 --- a/libavutil/rational.c +++ b/libavutil/rational.c @@ -115,6 +115,8 @@ AVRational av_d2q(double d, int max) exponent = FFMAX( (int)(log(fabs(d) + 1e-20)/LOG2), 0); den = 1LL << (61 - exponent); av_reduce(&a.num, &a.den, rint(d * den), den, max); + if ((!a.num || !a.den) && d && max>0 && max<INT_MAX) + av_reduce(&a.num, &a.den, llrint(d * den), den, INT_MAX); return a; } |