[FFmpeg-cvslog] lavu/intmath: add faster clz support
Ganesh Ajjanagadde
git at videolan.org
Sat Dec 19 18:42:12 CET 2015
ffmpeg | branch: master | Ganesh Ajjanagadde <gajjanagadde at gmail.com> | Wed Dec 16 13:28:39 2015 -0500| [0dd8a3d71e2c01d42e868d6c6b8974fadfcc529e] | committer: Ganesh Ajjanagadde
lavu/intmath: add faster clz support
This should be useful for the sofalizer filter.
Reviewed-by: Kieran Kunhya <kierank at ob-encoder.com>
Reviewed-by: Clément Bœsch <u at pkh.me>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0dd8a3d71e2c01d42e868d6c6b8974fadfcc529e
---
libavutil/intmath.h | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/libavutil/intmath.h b/libavutil/intmath.h
index 2016723..82193a6 100644
--- a/libavutil/intmath.h
+++ b/libavutil/intmath.h
@@ -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
+
/**
* @}
*/
More information about the ffmpeg-cvslog
mailing list