mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-02-06 23:04:54 +00:00
av_d2q: fix rounding for negative values
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
de7d290631
commit
64eacb839e
@ -114,7 +114,7 @@ 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, (int64_t)(d * den + 0.5), den, max);
|
||||
av_reduce(&a.num, &a.den, llrint(d * den), den, max);
|
||||
|
||||
return a;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user