From: David Conrad Date: Mon, 24 May 2010 00:44:02 +0000 (+0000) Subject: Convert NaN to 0/0 in av_d2q X-Git-Tag: v0.7b1~4056 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=31fdd641945dc5cdcfde9ee92329e22c0279981e;p=platform%2Fupstream%2Flibav.git 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 --- diff --git a/libavutil/rational.c b/libavutil/rational.c index 3217b7d..3e8b885 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;