]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/audioconvert.c
Optimize short-term prediction by reducing index arithmetic.
[ffmpeg] / libavcodec / audioconvert.c
index b0a8afacb4ffe2c46e8edf8cc532e96b9c8a6356..91ea7abdc4931906808de2faba7aafde0908bf50 100644 (file)
@@ -107,7 +107,6 @@ static const struct {
 } channel_layout_map[] = {
     { "mono",        1,  CH_LAYOUT_MONO },
     { "stereo",      2,  CH_LAYOUT_STEREO },
-    { "surround",    3,  CH_LAYOUT_SURROUND },
     { "4.0",         4,  CH_LAYOUT_4POINT0 },
     { "quad",        4,  CH_LAYOUT_QUAD },
     { "5.0",         5,  CH_LAYOUT_5POINT0 },
@@ -125,9 +124,6 @@ void avcodec_get_channel_layout_string(char *buf, int buf_size, int nb_channels,
 {
     int i;
 
-    if (channel_layout==0)
-        channel_layout = avcodec_guess_channel_layout(nb_channels, CODEC_ID_NONE, NULL);
-
     for (i=0; channel_layout_map[i].name; i++)
         if (nb_channels    == channel_layout_map[i].nb_channels &&
             channel_layout == channel_layout_map[i].layout) {
@@ -153,6 +149,15 @@ void avcodec_get_channel_layout_string(char *buf, int buf_size, int nb_channels,
     }
 }
 
+int avcodec_channel_layout_num_channels(int64_t channel_layout)
+{
+    int count;
+    uint64_t x = channel_layout;
+    for (count = 0; x; count++)
+        x &= x-1; // unset lowest set bit
+    return count;
+}
+
 struct AVAudioConvert {
     int in_channels, out_channels;
     int fmt_pair;