avutil/mathematics/av_add_stable: check for the common case of inc=1

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-06-02 18:02:08 +02:00
parent 5b7519fbaa
commit 4956d0e5a6

View File

@ -188,7 +188,8 @@ simple_round:
int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc)
{
inc_tb = av_mul_q(inc_tb, (AVRational) {inc, 1});
if (inc != 1)
inc_tb = av_mul_q(inc_tb, (AVRational) {inc, 1});
if (av_cmp_q(inc_tb, ts_tb) < 0) {
//increase step is too small for even 1 step to be representable