mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-17 13:04:50 +00:00
avutil/rational: avoid llrint() and rint()
This should workaround issues with these functions on ia64 and sparc64 Fixes Ticket2713 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
65abce67b5
commit
46ad287a2a
@ -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<INT_MAX)
|
||||
av_reduce(&a.num, &a.den, llrint(d * den), den, INT_MAX);
|
||||
av_reduce(&a.num, &a.den, floor(d * den + 0.5), den, INT_MAX);
|
||||
|
||||
return a;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user