1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

avutil/mathematics/av_add_stable: Avoid av_cmp_q() call

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-06-02 19:03:55 +02:00
parent e9add0d85b
commit 666e29fe9e

View File

@ -198,11 +198,10 @@ int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t i
if (m % d == 0)
return ts + m / d;
if (av_cmp_q(inc_tb, ts_tb) < 0) {
//increase step is too small for even 1 step to be representable
if (m < d)
return ts;
} else {
{
int64_t old = av_rescale_q(ts, ts_tb, inc_tb);
int64_t old_ts = av_rescale_q(old, inc_tb, ts_tb);
return av_rescale_q(old + 1, inc_tb, ts_tb) + (ts - old_ts);