Mercurial > libavutil.hg
changeset 927:1b749f49aebf libavutil
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
author | conrad |
---|---|
date | Mon, 24 May 2010 00:44:02 +0000 |
parents | c2a912cceb52 |
children | 11ae7ad12c53 |
files | rational.c |
diffstat | 1 files changed, 2 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/rational.c Sun May 23 09:45:34 2010 +0000 +++ b/rational.c Mon May 24 00:44:02 2010 +0000 @@ -98,6 +98,8 @@ #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;