Mercurial > libavutil.hg
comparison common.h @ 373:c3b57cc542e0 libavutil
add a new av_clip_int16() function to libavutil
author | aurel |
---|---|
date | Sat, 11 Aug 2007 21:59:01 +0000 |
parents | 317edea5d1a8 |
children | d0f3bb6e367e |
comparison
equal
deleted
inserted
replaced
372:317edea5d1a8 | 373:c3b57cc542e0 |
---|---|
190 { | 190 { |
191 if (a&(~255)) return (-a)>>31; | 191 if (a&(~255)) return (-a)>>31; |
192 else return a; | 192 else return a; |
193 } | 193 } |
194 | 194 |
195 /** | |
196 * clip a signed integer value into the -32768,32767 range | |
197 * @param a value to clip | |
198 * @return clipped value | |
199 */ | |
200 static inline int16_t av_clip_int16(int a) | |
201 { | |
202 if ((a+32768) & ~65535) return (a>>31) ^ 32767; | |
203 else return a; | |
204 } | |
205 | |
195 /* math */ | 206 /* math */ |
196 int64_t ff_gcd(int64_t a, int64_t b); | 207 int64_t ff_gcd(int64_t a, int64_t b); |
197 | 208 |
198 /** | 209 /** |
199 * converts fourcc string to int | 210 * converts fourcc string to int |