diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-05-14 02:19:23 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-05-14 02:19:58 +0200 |
commit | 58c03f6d7d6eabdbc25103e8229a06ddf3718bb9 (patch) | |
tree | 9796a7be60b1b305a4e0235ffde5ede275f740b8 /libavutil/common.h | |
parent | 01d3ebaf219d83c0a70cdf9696ecb6b868e8a165 (diff) | |
parent | 9f54e461fecec7a97ec1b97ae4468135ea770609 (diff) | |
download | ffmpeg-58c03f6d7d6eabdbc25103e8229a06ddf3718bb9.tar.gz |
Merge remote branch 'qatar/master'
* qatar/master:
swscale: properly inline bits/endianness in yuv2yuvX16inC().
(We didnt pull the bug) swscale: fix clipping of 9/10bit YUV420P.
Add av_clip_uintp2() function
(our patch / duplicate) dfa: fix buffer overflow checks to avoid integer overflows.
(our patch / duplicate) movenc: always write esds descriptor length using 4 bytes.
(our patch / duplicate) ffmpeg: use parse_number_and_die() when it makes sense
(No thanks) ffmpeg: get rid of the 'q' key schizofrenia
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/common.h')
-rw-r--r-- | libavutil/common.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libavutil/common.h b/libavutil/common.h index 493c3139aa..1cd2de2909 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -172,6 +172,18 @@ static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a) } /** + * Clip a signed integer to an unsigned power of two range. + * @param a value to clip + * @param p bit position to clip at + * @return clipped value + */ +static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p) +{ + if (a & ~((1<<p) - 1)) return -a >> 31 & ((1<<p) - 1); + else return a; +} + +/** * Clip a float value into the amin-amax range. * @param a value to clip * @param amin minimum value of the clip range @@ -364,6 +376,9 @@ static av_always_inline av_const int av_popcount_c(uint32_t x) #ifndef av_clipl_int32 # define av_clipl_int32 av_clipl_int32_c #endif +#ifndef av_clip_uintp2 +# define av_clip_uintp2 av_clip_uintp2_c +#endif #ifndef av_clipf # define av_clipf av_clipf_c #endif |