[FFmpeg-devel] [PATCH 2/2] avutil: Move prototype of av_ctz to common.h

Timothy Gu timothygu99 at gmail.com
Sat Aug 22 19:15:49 CEST 2015


intmath.h is not installed so it cannot be considered "public".

Instead, handle av_ctz the same way as av_log2.
---
 libavcodec/flacenc.c |  2 +-
 libavutil/common.h   | 10 ++++++++++
 libavutil/intmath.c  |  1 +
 libavutil/intmath.h  |  8 +-------
 4 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
index be791b3..7ef53a4 100644
--- a/libavcodec/flacenc.c
+++ b/libavcodec/flacenc.c
@@ -21,7 +21,7 @@
 
 #include "libavutil/avassert.h"
 #include "libavutil/crc.h"
-#include "libavutil/intmath.h"
+#include "libavutil/common.h"
 #include "libavutil/md5.h"
 #include "libavutil/opt.h"
 #include "avcodec.h"
diff --git a/libavutil/common.h b/libavutil/common.h
index 3e62b6d..17290fd 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -95,6 +95,16 @@ av_const int av_log2(unsigned v);
 av_const int av_log2_16bit(unsigned v);
 #endif
 
+#ifndef av_ctz
+/**
+ * Trailing zero bit count.
+ *
+ * @param v  input value. If v is 0, the result is undefined.
+ * @return   the number of trailing 0-bits
+ */
+av_const int av_ctz(int v);
+#endif
+
 /**
  * Clip a signed integer value into the amin-amax range.
  * @param a value to clip
diff --git a/libavutil/intmath.c b/libavutil/intmath.c
index 1f725c7..3ff6123 100644
--- a/libavutil/intmath.c
+++ b/libavutil/intmath.c
@@ -21,6 +21,7 @@
 /* undef these to get the function prototypes from common.h */
 #undef av_log2
 #undef av_log2_16bit
+#undef av_ctz
 #include "common.h"
 
 int av_log2(unsigned v)
diff --git a/libavutil/intmath.h b/libavutil/intmath.h
index 08d54a6..f7c6676 100644
--- a/libavutil/intmath.h
+++ b/libavutil/intmath.h
@@ -158,13 +158,7 @@ static av_always_inline av_const int ff_ctz_c( int v )
 #endif
 #endif
 
-/**
- * Trailing zero bit count.
- *
- * @param v  input value. If v is 0, the result is undefined.
- * @return   the number of trailing 0-bits
- */
-int av_ctz(int v);
+#define av_ctz ff_ctz
 
 /**
  * @}
-- 
1.9.1



More information about the ffmpeg-devel mailing list