From dec112691561bddaea07e0ad455a71bf29ade60d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 5 Oct 2010 01:43:31 +0000 Subject: [PATCH] Make av_cmp_q() work with infinities and NAN. Originally committed as revision 25338 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavutil/avutil.h | 2 +- libavutil/rational.h | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libavutil/avutil.h b/libavutil/avutil.h index 3e23b6e0c6..31b249a9a1 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -41,7 +41,7 @@ #define LIBAVUTIL_VERSION_MAJOR 50 #define LIBAVUTIL_VERSION_MINOR 32 -#define LIBAVUTIL_VERSION_MICRO 1 +#define LIBAVUTIL_VERSION_MICRO 2 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ diff --git a/libavutil/rational.h b/libavutil/rational.h index 21542a8abe..15df06f4af 100644 --- a/libavutil/rational.h +++ b/libavutil/rational.h @@ -29,6 +29,7 @@ #define AVUTIL_RATIONAL_H #include +#include #include "attributes.h" /** @@ -49,7 +50,9 @@ static inline int av_cmp_q(AVRational a, AVRational b){ const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den; if(tmp) return ((tmp ^ a.den ^ b.den)>>63)|1; - else return 0; + else if(b.den && a.den) return 0; + else if(a.num && b.num) return (a.num>>31) - (b.num>>31); + else return INT_MIN; } /**