diff options
Diffstat (limited to 'ffmpeg/libavcodec/mathops.h')
| -rw-r--r-- | ffmpeg/libavcodec/mathops.h | 19 |
1 files changed, 19 insertions, 0 deletions
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 */ |
