[FFmpeg-cvslog] avutil: add av_rescale_q_rnd() to allow different rounding
Justin Ruggles
git at videolan.org
Tue Feb 21 05:29:40 CET 2012
ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Mon Feb 13 15:35:00 2012 -0500| [0b42a9388c98c8669811d4e7e5da7240e6707a41] | committer: Justin Ruggles
avutil: add av_rescale_q_rnd() to allow different rounding
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0b42a9388c98c8669811d4e7e5da7240e6707a41
---
doc/APIchanges | 3 +++
libavutil/avutil.h | 2 +-
libavutil/mathematics.c | 11 +++++++++--
libavutil/mathematics.h | 6 ++++++
4 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index f962432..ca521d4 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil: 2011-04-18
API changes, most recent first:
+2012-02-xx - xxxxxxx - lavu 51.23.1 - mathematics.h
+ Add av_rescale_q_rnd()
+
2012-02-xx - xxxxxxx - lavu 51.22.1 - pixdesc.h
Add PIX_FMT_PSEUDOPAL flag.
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index 05e9248..b5f9a24 100644
--- a/libavutil/avutil.h
+++ b/libavutil/avutil.h
@@ -154,7 +154,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 51
-#define LIBAVUTIL_VERSION_MINOR 22
+#define LIBAVUTIL_VERSION_MINOR 23
#define LIBAVUTIL_VERSION_MICRO 1
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
diff --git a/libavutil/mathematics.c b/libavutil/mathematics.c
index e6ce2f9..e2f06ed 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){
diff --git a/libavutil/mathematics.h b/libavutil/mathematics.h
index 0b072eb..ec27979 100644
--- a/libavutil/mathematics.h
+++ b/libavutil/mathematics.h
@@ -96,6 +96,12 @@ int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_cons
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;
/**
+ * Rescale a 64-bit integer by 2 rational numbers with specified rounding.
+ */
+int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq,
+ enum AVRounding) av_const;
+
+/**
* Compare 2 timestamps each in its own timebases.
* The result of the function is undefined if one of the timestamps
* is outside the int64_t range when represented in the others timebase.
More information about the ffmpeg-cvslog
mailing list