mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2025-10-22 00:20:07 +08:00
Add av_clip_uintp2() function
Signed-off-by: Mans Rullgard <mans@mansr.com>
This commit is contained in:
committed by
Ronald S. Bultje
parent
2c9a5172d3
commit
1550f45a89
@@ -169,6 +169,18 @@ static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a)
|
||||
else return 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
|
||||
@@ -362,6 +374,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
|
||||
|
||||
Reference in New Issue
Block a user