[Ffmpeg-cvslog] r7431 - trunk/libavutil/rational.c

michael subversion
Tue Jan 9 12:58:07 CET 2007


Author: michael
Date: Tue Jan  9 12:58:06 2007
New Revision: 7431

Modified:
   trunk/libavutil/rational.c

Log:
fix av_reduce() with things like 1/0 and 0/0


Modified: trunk/libavutil/rational.c
==============================================================================
--- trunk/libavutil/rational.c	(original)
+++ trunk/libavutil/rational.c	Tue Jan  9 12:58:06 2007
@@ -38,8 +38,10 @@
     int sign= (nom<0) ^ (den<0);
     int64_t gcd= ff_gcd(FFABS(nom), FFABS(den));
 
-    nom = FFABS(nom)/gcd;
-    den = FFABS(den)/gcd;
+    if(gcd){
+        nom = FFABS(nom)/gcd;
+        den = FFABS(den)/gcd;
+    }
     if(nom<=max && den<=max){
         a1= (AVRational){nom, den};
         den=0;
@@ -65,7 +67,7 @@
         nom= den;
         den= next_den;
     }
-    assert(ff_gcd(a1.num, a1.den) == 1);
+    assert(ff_gcd(a1.num, a1.den) <= 1U);
 
     *dst_nom = sign ? -a1.num : a1.num;
     *dst_den = a1.den;




More information about the ffmpeg-cvslog mailing list