aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-06-02 19:03:55 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-06-02 19:06:39 +0200
commit666e29fe9e7eb9a87eb870f0e6d68331c0615d43 (patch)
treec245c269d7b37b629b301aca5c8e76f20f4be04d
parente9add0d85b38db8efebd53bed83125945103e11f (diff)
downloadffmpeg-666e29fe9e7eb9a87eb870f0e6d68331c0615d43.tar.gz
avutil/mathematics/av_add_stable: Avoid av_cmp_q() call
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavutil/mathematics.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libavutil/mathematics.c b/libavutil/mathematics.c
index df7d0d88bf..126cffc3f0 100644
--- a/libavutil/mathematics.c
+++ b/libavutil/mathematics.c
@@ -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);