summaryrefslogtreecommitdiff
path: root/libavutil/common.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-01-04 01:12:34 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-01-04 01:12:34 +0100
commitad1c8dd6734f0aa7a7a87b4669a166715c114b46 (patch)
treec03c08f30bf1a7e8d9859abc48de3391bb05c6a0 /libavutil/common.h
parentd6da16dca5a64ed7ab2db54710a0c703f179d3ba (diff)
parentfd16f567987524a769d5d4f1f69089f000386ac2 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: fate: add dxtory test adx_parser: rewrite. adxdec: Validate channel count to fix a division by zero. adxdec: Do not require extradata. cmdutils: K&R reformatting cosmetics alacdec: implement the 2-pass prediction type. alacenc: implement the 2-pass prediction type. alacenc: do not generate invalid multi-channel ALAC files alacdec: fill in missing or guessed info about the extradata format. utvideo: proper median prediction for interlaced videos lavu: bump lavu minor for av_popcount64 dca: K&R formatting cosmetics dct: K&R formatting cosmetics lavf: flush decoders in avformat_find_stream_info(). win32: detect number of CPUs using affinity Add av_popcount64 snow: Restore three mistakenly removed casts. Conflicts: cmdutils.c doc/APIchanges libavcodec/adx_parser.c libavcodec/adxdec.c libavcodec/alacenc.c libavutil/avutil.h tests/fate/screen.mak Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/common.h')
-rw-r--r--libavutil/common.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/libavutil/common.h b/libavutil/common.h
index cf361ca15e..84290c6363 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -220,6 +220,16 @@ static av_always_inline av_const int av_popcount_c(uint32_t x)
return (x + (x >> 16)) & 0x3F;
}
+/**
+ * Count number of bits set to one in x
+ * @param x value to count bits of
+ * @return the number of bits set to one in x
+ */
+static av_always_inline av_const int av_popcount64_c(uint64_t x)
+{
+ return av_popcount(x) + av_popcount(x >> 32);
+}
+
#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24))
#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24))
@@ -385,3 +395,6 @@ static av_always_inline av_const int av_popcount_c(uint32_t x)
#ifndef av_popcount
# define av_popcount av_popcount_c
#endif
+#ifndef av_popcount64
+# define av_popcount64 av_popcount64_c
+#endif