diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2012-02-13 15:35:00 -0500 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2012-02-20 15:08:40 -0500 |
commit | 0b42a9388c98c8669811d4e7e5da7240e6707a41 (patch) | |
tree | 97898f00de8874229f6ba8ff2e077ce221b6d513 /libavutil/mathematics.c | |
parent | 0996f406c4d32858e00637206fff7c435b51488c (diff) | |
download | ffmpeg-0b42a9388c98c8669811d4e7e5da7240e6707a41.tar.gz |
avutil: add av_rescale_q_rnd() to allow different rounding
Diffstat (limited to 'libavutil/mathematics.c')
-rw-r--r-- | libavutil/mathematics.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libavutil/mathematics.c b/libavutil/mathematics.c index e6ce2f98ad..e2f06eda29 100644 --- a/libavutil/mathematics.c +++ b/libavutil/mathematics.c @@ -130,10 +130,17 @@ int64_t av_rescale(int64_t a, int64_t b, int64_t c){ return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF); } -int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq){ +int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq, + enum AVRounding rnd) +{ int64_t b= bq.num * (int64_t)cq.den; int64_t c= cq.num * (int64_t)bq.den; - return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF); + return av_rescale_rnd(a, b, c, rnd); +} + +int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) +{ + return av_rescale_q_rnd(a, bq, cq, AV_ROUND_NEAR_INF); } int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b){ |