diff options
author | wm4 <wm4@nowhere> | 2015-05-21 20:37:17 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-05-21 20:37:17 +0200 |
commit | 7412995c94be2a6ef8132edf3b2b637ea410edea (patch) | |
tree | 883defcb62b4a119aadb3aa287aea2aa07e59ce8 /audio/chmap.c | |
parent | 292266f26892080d905e374e03c6a8d57942ca0e (diff) | |
download | mpv-7412995c94be2a6ef8132edf3b2b637ea410edea.tar.bz2 mpv-7412995c94be2a6ef8132edf3b2b637ea410edea.tar.xz |
chmap: use av_popcount64()
Saves us some code, and also happens to fix #1968.
Diffstat (limited to 'audio/chmap.c')
-rw-r--r-- | audio/chmap.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/audio/chmap.c b/audio/chmap.c index 4fd43e3bc7..f04815d210 100644 --- a/audio/chmap.c +++ b/audio/chmap.c @@ -18,6 +18,8 @@ #include <stdlib.h> #include <assert.h> +#include <libavutil/common.h> + #include "common/common.h" #include "common/msg.h" #include "chmap.h" @@ -395,20 +397,12 @@ void mp_chmap_get_reorder(int src[MP_NUM_CHANNELS], const struct mp_chmap *from, assert(src[n] < 0 || (to->speaker[n] == from->speaker[src[n]])); } -static int popcount64(uint64_t bits) -{ - int r = 0; - for (int n = 0; n < 64; n++) - r += !!(bits & (1ULL << n)); - return r; -} - // Return the number of channels only in a. int mp_chmap_diffn(const struct mp_chmap *a, const struct mp_chmap *b) { uint64_t a_mask = mp_chmap_to_lavc_unchecked(a); uint64_t b_mask = mp_chmap_to_lavc_unchecked(b); - return popcount64((a_mask ^ b_mask) & a_mask); + return av_popcount64((a_mask ^ b_mask) & a_mask); } // Returns something like "fl-fr-fc". If there's a standard layout in lavc |