diff options
author | Aurelien Jacobs <aurel@gnuage.org> | 2009-01-17 11:13:33 +0000 |
---|---|---|
committer | Aurelien Jacobs <aurel@gnuage.org> | 2009-01-17 11:13:33 +0000 |
commit | 9ce6c1387988bf3cdb631f3844e99a0c9bea43f2 (patch) | |
tree | bba423b9738e537a19c595ea0d78537dbe540991 /libavutil | |
parent | 3194b004793b31b89445e7a15d06c9e4acbd2e55 (diff) | |
download | ffmpeg-9ce6c1387988bf3cdb631f3844e99a0c9bea43f2.tar.gz |
export gcd function as av_gcd()
Originally committed as revision 16653 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/avutil.h | 2 | ||||
-rw-r--r-- | libavutil/common.h | 3 | ||||
-rw-r--r-- | libavutil/mathematics.c | 4 | ||||
-rw-r--r-- | libavutil/mathematics.h | 2 | ||||
-rw-r--r-- | libavutil/rational.c | 4 |
5 files changed, 7 insertions, 8 deletions
diff --git a/libavutil/avutil.h b/libavutil/avutil.h index ad5af25703..68a780e8b9 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -35,7 +35,7 @@ #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) #define LIBAVUTIL_VERSION_MAJOR 49 -#define LIBAVUTIL_VERSION_MINOR 12 +#define LIBAVUTIL_VERSION_MINOR 13 #define LIBAVUTIL_VERSION_MICRO 0 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ diff --git a/libavutil/common.h b/libavutil/common.h index ed295cfce3..e583101189 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -242,9 +242,6 @@ static inline av_const float av_clipf(float a, float amin, float amax) else return a; } -/* math */ -int64_t av_const ff_gcd(int64_t a, int64_t b); - /** * converts fourcc string to int */ diff --git a/libavutil/mathematics.c b/libavutil/mathematics.c index ef93ba4a1c..eed2241471 100644 --- a/libavutil/mathematics.c +++ b/libavutil/mathematics.c @@ -48,8 +48,8 @@ const uint8_t ff_log2_tab[256]={ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 }; -int64_t ff_gcd(int64_t a, int64_t b){ - if(b) return ff_gcd(b, a%b); +int64_t av_gcd(int64_t a, int64_t b){ + if(b) return av_gcd(b, a%b); else return a; } diff --git a/libavutil/mathematics.h b/libavutil/mathematics.h index 74385274b3..3098862364 100644 --- a/libavutil/mathematics.h +++ b/libavutil/mathematics.h @@ -49,6 +49,8 @@ enum AVRounding { AV_ROUND_NEAR_INF = 5, ///< round to nearest and halfway cases away from zero }; +int64_t av_const av_gcd(int64_t a, int64_t b); + /** * rescale a 64bit integer with rounding to nearest. * a simple a*b/c isn't possible as it can overflow diff --git a/libavutil/rational.c b/libavutil/rational.c index cac3ff5a99..4c0216e60f 100644 --- a/libavutil/rational.c +++ b/libavutil/rational.c @@ -35,7 +35,7 @@ int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max){ AVRational a0={0,1}, a1={1,0}; int sign= (nom<0) ^ (den<0); - int64_t gcd= ff_gcd(FFABS(nom), FFABS(den)); + int64_t gcd= av_gcd(FFABS(nom), FFABS(den)); if(gcd){ nom = FFABS(nom)/gcd; @@ -66,7 +66,7 @@ int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max) nom= den; den= next_den; } - assert(ff_gcd(a1.num, a1.den) <= 1U); + assert(av_gcd(a1.num, a1.den) <= 1U); *dst_nom = sign ? -a1.num : a1.num; *dst_den = a1.den; |