From f7813a5324be39d13ab536c245d15dfc602a7849 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Sun, 29 Dec 2013 12:19:38 +0000 Subject: basic type mechanism working --- ffmpeg/libavcodec/mathops.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'ffmpeg/libavcodec/mathops.h') diff --git a/ffmpeg/libavcodec/mathops.h b/ffmpeg/libavcodec/mathops.h index 592f5a5..bad25af 100644 --- a/ffmpeg/libavcodec/mathops.h +++ b/ffmpeg/libavcodec/mathops.h @@ -195,6 +195,15 @@ if ((y) < (x)) {\ # define FASTDIV(a,b) ((uint32_t)((((uint64_t)a) * ff_inverse[b]) >> 32)) #endif /* FASTDIV */ +#ifndef MOD_UNLIKELY +# define MOD_UNLIKELY(modulus, dividend, divisor, prev_dividend) \ + do { \ + if ((prev_dividend) == 0 || (dividend) - (prev_dividend) != (divisor)) \ + (modulus) = (dividend) % (divisor); \ + (prev_dividend) = (dividend); \ + } while (0) +#endif + static inline av_const unsigned int ff_sqrt(unsigned int a) { unsigned int b; @@ -215,4 +224,14 @@ static inline av_const unsigned int ff_sqrt(unsigned int a) return b - (a < b * b); } +static inline int8_t ff_u8_to_s8(uint8_t a) +{ + union { + uint8_t u8; + int8_t s8; + } b; + b.u8 = a; + return b.s8; +} + #endif /* AVCODEC_MATHOPS_H */ -- cgit v1.2.3