Mercurial > libavutil.hg
comparison mathematics.c @ 632:f9884e1112d0 libavutil
add a ff_gcd() function again, for compatibility with old libavcodec
author | aurel |
---|---|
date | Tue, 27 Jan 2009 00:46:18 +0000 |
parents | e0bf946f7d23 |
children | 8c48a1b999a3 |
comparison
equal
deleted
inserted
replaced
631:f7f8673fbfb0 | 632:f9884e1112d0 |
---|---|
22 * @file mathematics.c | 22 * @file mathematics.c |
23 * Miscellaneous math routines and tables. | 23 * Miscellaneous math routines and tables. |
24 */ | 24 */ |
25 | 25 |
26 #include <assert.h> | 26 #include <assert.h> |
27 #include "avutil.h" | |
27 #include "common.h" | 28 #include "common.h" |
28 #include "mathematics.h" | 29 #include "mathematics.h" |
29 | 30 |
30 const uint8_t ff_sqrt_tab[256]={ | 31 const uint8_t ff_sqrt_tab[256]={ |
31 0, 16, 23, 28, 32, 36, 40, 43, 46, 48, 51, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 77, 79, 80, 82, 84, 85, 87, 88, 90, | 32 0, 16, 23, 28, 32, 36, 40, 43, 46, 48, 51, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 77, 79, 80, 82, 84, 85, 87, 88, 90, |
51 | 52 |
52 int64_t av_gcd(int64_t a, int64_t b){ | 53 int64_t av_gcd(int64_t a, int64_t b){ |
53 if(b) return av_gcd(b, a%b); | 54 if(b) return av_gcd(b, a%b); |
54 else return a; | 55 else return a; |
55 } | 56 } |
57 | |
58 #if LIBAVUTIL_VERSION_MAJOR < 50 | |
59 int64_t ff_gcd(int64_t a, int64_t b){ | |
60 return av_gcd(a, b); | |
61 } | |
62 #endif | |
56 | 63 |
57 int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd){ | 64 int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd){ |
58 int64_t r=0; | 65 int64_t r=0; |
59 assert(c > 0); | 66 assert(c > 0); |
60 assert(b >=0); | 67 assert(b >=0); |