[FFmpeg-cvslog] audioconvert: use av_popcount64 in av_get_channel_layout_nb_channels

Anton Khirnov git at videolan.org
Sun Jun 10 21:39:49 CEST 2012


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat Jun  9 20:14:12 2012 +0200| [3596de55fc054b5c336e7e542c26ced0505d4f2e] | committer: Anton Khirnov

audioconvert: use av_popcount64 in av_get_channel_layout_nb_channels

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3596de55fc054b5c336e7e542c26ced0505d4f2e
---

 libavutil/audioconvert.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/libavutil/audioconvert.c b/libavutil/audioconvert.c
index 2560127..1a8e5ee 100644
--- a/libavutil/audioconvert.c
+++ b/libavutil/audioconvert.c
@@ -175,11 +175,7 @@ void av_get_channel_layout_string(char *buf, int buf_size,
 
 int av_get_channel_layout_nb_channels(uint64_t channel_layout)
 {
-    int count;
-    uint64_t x = channel_layout;
-    for (count = 0; x; count++)
-        x &= x-1; // unset lowest set bit
-    return count;
+    return av_popcount64(channel_layout);
 }
 
 uint64_t av_get_default_channel_layout(int nb_channels)



More information about the ffmpeg-cvslog mailing list