summaryrefslogtreecommitdiff
path: root/libavutil
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-11-05 22:51:20 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-11-05 22:51:20 +0100
commit7d26be63c25e715f008e8923654bdf318419dd39 (patch)
treec3d598d06854085a7e9f9474dee81e543f069cdb /libavutil
parente859339e7af52210c6fe84a8e6412f0c30d1c4da (diff)
parent5ff998a233d759d0de83ea6f95c383d03d25d88e (diff)
Merge commit '5ff998a233d759d0de83ea6f95c383d03d25d88e'
* commit '5ff998a233d759d0de83ea6f95c383d03d25d88e': flacenc: use uint64_t for bit counts flacenc: remove wasted trailing 0 bits lavu: add av_ctz() for trailing zero bit count flacenc: use a separate buffer for byte-swapping for MD5 checksum on big-endian fate: aac: Place LATM tests and general AAC tests in different groups build: The A64 muxer depends on rawenc.o for ff_raw_write_packet() Conflicts: doc/APIchanges libavutil/version.h tests/fate/aac.mak Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/Makefile2
-rw-r--r--libavutil/intmath.c (renamed from libavutil/log2.c)5
-rw-r--r--libavutil/intmath.h55
-rw-r--r--libavutil/version.h2
4 files changed, 62 insertions, 2 deletions
diff --git a/libavutil/Makefile b/libavutil/Makefile
index 20dfba407a..63da9e9a80 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -73,10 +73,10 @@ OBJS = adler32.o \
float_dsp.o \
imgutils.o \
intfloat_readwrite.o \
+ intmath.o \
lfg.o \
lls.o \
log.o \
- log2.o \
log2_tab.o \
mathematics.o \
md5.o \
diff --git a/libavutil/log2.c b/libavutil/intmath.c
index b0c00e1cad..1f725c741f 100644
--- a/libavutil/log2.c
+++ b/libavutil/intmath.c
@@ -32,3 +32,8 @@ int av_log2_16bit(unsigned v)
{
return ff_log2_16bit(v);
}
+
+int av_ctz(int v)
+{
+ return ff_ctz(v);
+}
diff --git a/libavutil/intmath.h b/libavutil/intmath.h
index 9002442bef..e140d822f3 100644
--- a/libavutil/intmath.h
+++ b/libavutil/intmath.h
@@ -92,4 +92,59 @@ static av_always_inline av_const int ff_log2_16bit_c(unsigned int v)
/**
* @}
*/
+
+/**
+ * @addtogroup lavu_math
+ * @{
+ */
+
+#if HAVE_FAST_CLZ && AV_GCC_VERSION_AT_LEAST(3,4)
+#ifndef ff_ctz
+#define ff_ctz(v) __builtin_ctz(v)
+#endif
+#endif
+
+#ifndef ff_ctz
+#define ff_ctz ff_ctz_c
+static av_always_inline av_const int ff_ctz_c(int v)
+{
+ int c;
+
+ if (v & 0x1)
+ return 0;
+
+ c = 1;
+ if (!(v & 0xffff)) {
+ v >>= 16;
+ c += 16;
+ }
+ if (!(v & 0xff)) {
+ v >>= 8;
+ c += 8;
+ }
+ if (!(v & 0xf)) {
+ v >>= 4;
+ c += 4;
+ }
+ if (!(v & 0x3)) {
+ v >>= 2;
+ c += 2;
+ }
+ c -= v & 0x1;
+
+ return c;
+}
+#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);
+
+/**
+ * @}
+ */
#endif /* AVUTIL_INTMATH_H */
diff --git a/libavutil/version.h b/libavutil/version.h
index a5d3e179de..4ad244f406 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -75,7 +75,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 52
-#define LIBAVUTIL_VERSION_MINOR 4
+#define LIBAVUTIL_VERSION_MINOR 5
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \