summaryrefslogtreecommitdiff
path: root/libavutil/mathematics.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-02 23:19:23 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-01-03 00:02:22 +0100
commit740e740895557a3b11715ccb203b7d882496046f (patch)
treec456bed782c88ccdb19797f3acbaa6318863c6cd /libavutil/mathematics.h
parent091ce6bcb21e860cfe726e83f16e99e280c90e1a (diff)
downloadffmpeg-740e740895557a3b11715ccb203b7d882496046f.tar.gz
av_rescale: support passing MIN/MAX through
Reviewed-by: Clément Bœsch <ubitux@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/mathematics.h')
-rw-r--r--libavutil/mathematics.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavutil/mathematics.h b/libavutil/mathematics.h
index 0021d523ef..479161e1fd 100644
--- a/libavutil/mathematics.h
+++ b/libavutil/mathematics.h
@@ -70,6 +70,7 @@ enum AVRounding {
AV_ROUND_DOWN = 2, ///< Round toward -infinity.
AV_ROUND_UP = 3, ///< Round toward +infinity.
AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero.
+ AV_ROUND_PASS_MINMAX = 8192, ///< Flag to pass INT64_MIN/MAX through instead of rescaling, this avoids special cases for AV_NOPTS_VALUE
};
/**
@@ -88,6 +89,9 @@ int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const;
/**
* Rescale a 64-bit integer with specified rounding.
* A simple a*b/c isn't possible as it can overflow.
+ *
+ * @return rescaled value a or if AV_ROUND_PASS_MINMAX is set and a is
+ * INT64_MIN or INT64_MAX than a is passed through unchanged.
*/
int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_const;
@@ -98,6 +102,9 @@ 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.
+ *
+ * @return rescaled value a or if AV_ROUND_PASS_MINMAX is set and a is
+ * INT64_MIN or INT64_MAX than a is passed through unchanged.
*/
int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq,
enum AVRounding) av_const;