BSD doesnt have log2

Originally committed as revision 2407 to svn://svn.ffmpeg.org/ffmpeg/trunk
pull/126/head
Michael Niedermayer 22 years ago
parent 5c9e4723e0
commit 33a6984b8c
  1. 2
      libavcodec/rational.c

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

Loading…
Cancel
Save