1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-10-03 01:21:46 +02:00

for floats fabs is better & smaller then ABS

Originally committed as revision 5801 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer 2006-07-20 09:06:23 +00:00
parent f296446564
commit 0912bf577a

View File

@ -102,7 +102,7 @@ AVRational av_sub_q(AVRational b, AVRational c){
*/ */
AVRational av_d2q(double d, int max){ AVRational av_d2q(double d, int max){
AVRational a; AVRational a;
int exponent= FFMAX( (int)(log(ABS(d) + 1e-20)/log(2)), 0); int exponent= FFMAX( (int)(log(fabs(d) + 1e-20)/log(2)), 0);
int64_t den= 1LL << (61 - exponent); int64_t den= 1LL << (61 - exponent);
av_reduce(&a.num, &a.den, (int64_t)(d * den + 0.5), den, max); av_reduce(&a.num, &a.den, (int64_t)(d * den + 0.5), den, max);