diff options
author | David Conrad <lessen42@gmail.com> | 2010-05-24 04:44:02 +0400 |
---|---|---|
committer | David Conrad <lessen42@gmail.com> | 2010-05-24 04:44:02 +0400 |
commit | 31fdd641945dc5cdcfde9ee92329e22c0279981e (patch) | |
tree | 29f11982a63131a02f95331868c27b0e63e7107f /libavutil | |
parent | f1a0518524a08c5a934c4b0d2f8360b4cab4475f (diff) |
Convert NaN to 0/0 in av_d2q
This fixes aspect ratio calculation for encoding from files with 0/0 stored,
common with ogg/theora
Originally committed as revision 23280 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil')
-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 3217b7daeb..3e8b885d49 100644 --- a/libavutil/rational.c +++ b/libavutil/rational.c @@ -98,6 +98,8 @@ AVRational av_d2q(double d, int max){ #define LOG2 0.69314718055994530941723212145817656807550013436025 int exponent= FFMAX( (int)(log(fabs(d) + 1e-20)/LOG2), 0); int64_t den= 1LL << (61 - exponent); + if (isnan(d)) + return (AVRational){0,0}; av_reduce(&a.num, &a.den, (int64_t)(d * den + 0.5), den, max); return a; |