diff --git a/libavutil/rational.c b/libavutil/rational.c index aabe58f684..ec2f2e5386 100644 --- a/libavutil/rational.c +++ b/libavutil/rational.c @@ -114,9 +114,10 @@ AVRational av_d2q(double d, int max) return (AVRational) { d < 0 ? -1 : 1, 0 }; exponent = FFMAX( (int)(log(fabs(d) + 1e-20)/LOG2), 0); den = 1LL << (61 - exponent); - av_reduce(&a.num, &a.den, rint(d * den), den, max); + // (int64_t)rint() and llrint() do not work with gcc on ia64 and sparc64 + av_reduce(&a.num, &a.den, floor(d * den + 0.5), den, max); if ((!a.num || !a.den) && d && max>0 && max