Commit 3eaf6826 authored by conrad's avatar conrad

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

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23280 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 41685f16
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment