# HG changeset patch # User mru # Date 1278523665 0 # Node ID a3c26f53e6fa3638576c094e3fcbe5fe1247925a # Parent 009d2ce554b24766ae00f5f8f3e1f6b30a2e6afa Allow arch-overrides for all common.h clip and log2 functions diff -r 009d2ce554b2 -r a3c26f53e6fa common.h --- a/common.h Wed Jul 07 17:27:43 2010 +0000 +++ b/common.h Wed Jul 07 17:27:45 2010 +0000 @@ -100,7 +100,7 @@ * @param amax maximum value of the clip range * @return clipped value */ -static inline av_const int av_clip(int a, int amin, int amax) +static inline av_const int av_clip_c(int a, int amin, int amax) { if (a < amin) return amin; else if (a > amax) return amax; @@ -112,7 +112,7 @@ * @param a value to clip * @return clipped value */ -static inline av_const uint8_t av_clip_uint8(int a) +static inline av_const uint8_t av_clip_uint8_c(int a) { if (a&(~0xFF)) return (-a)>>31; else return a; @@ -123,7 +123,7 @@ * @param a value to clip * @return clipped value */ -static inline av_const int8_t av_clip_int8(int a) +static inline av_const int8_t av_clip_int8_c(int a) { if ((a+0x80) & ~0xFF) return (a>>31) ^ 0x7F; else return a; @@ -134,7 +134,7 @@ * @param a value to clip * @return clipped value */ -static inline av_const uint16_t av_clip_uint16(int a) +static inline av_const uint16_t av_clip_uint16_c(int a) { if (a&(~0xFFFF)) return (-a)>>31; else return a; @@ -145,7 +145,7 @@ * @param a value to clip * @return clipped value */ -static inline av_const int16_t av_clip_int16(int a) +static inline av_const int16_t av_clip_int16_c(int a) { if ((a+0x8000) & ~0xFFFF) return (a>>31) ^ 0x7FFF; else return a; @@ -156,7 +156,7 @@ * @param a value to clip * @return clipped value */ -static inline av_const int32_t av_clipl_int32(int64_t a) +static inline av_const int32_t av_clipl_int32_c(int64_t a) { if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (a>>63) ^ 0x7FFFFFFF; else return a; @@ -169,7 +169,7 @@ * @param amax maximum value of the clip range * @return clipped value */ -static inline av_const float av_clipf(float a, float amin, float amax) +static inline av_const float av_clipf_c(float a, float amin, float amax) { if (a < amin) return amin; else if (a > amax) return amax; @@ -180,7 +180,7 @@ * @param x value used to compute ceil(log2(x)) * @return computed ceiling of log2(x) */ -static inline av_const int av_ceil_log2(int x) +static inline av_const int av_ceil_log2_c(int x) { return av_log2((x - 1) << 1); } @@ -320,3 +320,27 @@ #ifndef av_log2_16bit # define av_log2_16bit av_log2_16bit_c #endif +#ifndef av_ceil_log2 +# define av_ceil_log2 av_ceil_log2_c +#endif +#ifndef av_clip +# define av_clip av_clip_c +#endif +#ifndef av_clip_uint8 +# define av_clip_uint8 av_clip_uint8_c +#endif +#ifndef av_clip_int8 +# define av_clip_int8 av_clip_int8_c +#endif +#ifndef av_clip_uint16 +# define av_clip_uint16 av_clip_uint16_c +#endif +#ifndef av_clip_int16 +# define av_clip_int16 av_clip_int16_c +#endif +#ifndef av_clipl_int32 +# define av_clipl_int32 av_clipl_int32_c +#endif +#ifndef av_clipf +# define av_clipf av_clipf_c +#endif