aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/mathematics.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-12-12 07:34:13 +0100
committerAnton Khirnov <anton@khirnov.net>2014-01-03 16:39:30 +0100
commit94a417acc05cc5151b473abc0bf51fad26f8c5a0 (patch)
tree794aeeafbc1889f7bd3a5341e62fc5955c6e4352 /libavutil/mathematics.c
parent24057c83207d6ea8bfd824155ac37be8a33dfd0c (diff)
downloadffmpeg-94a417acc05cc5151b473abc0bf51fad26f8c5a0.tar.gz
mathematics: remove asserts from av_rescale_rnd()
It is a public function, it must not assert on its parameters.
Diffstat (limited to 'libavutil/mathematics.c')
-rw-r--r--libavutil/mathematics.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libavutil/mathematics.c b/libavutil/mathematics.c
index 137683eb96..1a38f64823 100644
--- a/libavutil/mathematics.c
+++ b/libavutil/mathematics.c
@@ -23,7 +23,6 @@
* miscellaneous math routines and tables
*/
-#include <assert.h>
#include <stdint.h>
#include <limits.h>
@@ -58,9 +57,9 @@ int64_t av_gcd(int64_t a, int64_t b){
int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd){
int64_t r=0;
- assert(c > 0);
- assert(b >=0);
- assert((unsigned)rnd<=5 && rnd!=4);
+
+ if (c <= 0 || b < 0 || rnd == 4 || rnd > 5)
+ return INT64_MIN;
if(a<0 && a != INT64_MIN) return -av_rescale_rnd(-a, b, c, rnd ^ ((rnd>>1)&1));