[FFmpeg-cvslog] mathematics: remove asserts from av_rescale_rnd()

Anton Khirnov git at videolan.org
Mon Mar 10 18:36:38 CET 2014


ffmpeg | branch: release/0.10 | Anton Khirnov <anton at khirnov.net> | Thu Dec 12 07:34:13 2013 +0100| [e03b875c0b57d458d3fc693b37b01615fc7283e7] | committer: Reinhard Tartler

mathematics: remove asserts from av_rescale_rnd()

It is a public function, it must not assert on its parameters.

(cherry picked from commit 94a417acc05cc5151b473abc0bf51fad26f8c5a0)
Signed-off-by: Reinhard Tartler <siretart at tauware.de>
(cherry picked from commit 03bfd8419fbaf9c72b293457437bd508dea64736)
Signed-off-by: Reinhard Tartler <siretart at tauware.de>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e03b875c0b57d458d3fc693b37b01615fc7283e7
---

 libavutil/mathematics.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libavutil/mathematics.c b/libavutil/mathematics.c
index e6ce2f9..51b0e95 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>
 #include "mathematics.h"
@@ -76,9 +75,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));
 



More information about the ffmpeg-cvslog mailing list