mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2026-01-23 23:21:06 +01:00
lavu/intmath: add faster clz support
This should be useful for the sofalizer filter. Reviewed-by: Kieran Kunhya <kierank@ob-encoder.com> Reviewed-by: Clément Bœsch <u@pkh.me> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
This commit is contained in:
parent
5484cbe9f7
commit
0dd8a3d71e
1 changed files with 18 additions and 0 deletions
|
|
@ -96,6 +96,9 @@ static av_always_inline av_const int ff_log2_16bit_c(unsigned int v)
|
|||
#ifndef ff_ctzll
|
||||
#define ff_ctzll(v) __builtin_ctzll(v)
|
||||
#endif
|
||||
#ifndef ff_clz
|
||||
#define ff_clz(v) __builtin_clz(v)
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
@ -135,6 +138,21 @@ static av_always_inline av_const int ff_ctzll_c(long long v)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef ff_clz
|
||||
#define ff_clz ff_clz_c
|
||||
static av_always_inline av_const unsigned ff_clz_c(unsigned x)
|
||||
{
|
||||
unsigned i = sizeof(x) * 8;
|
||||
|
||||
while (x) {
|
||||
x >>= 1;
|
||||
i--;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue