]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/ac3tab.c
fix compilation with --disable-everything --enable-decoder=mpeg2video
[ffmpeg] / libavcodec / ac3tab.c
index 36a7449a72fd4e4f82d9cd9bb13eb479d9c8abb3..e7835c6748f830b7ad2ed031ed6aecd44bd2fab2 100644 (file)
@@ -24,6 +24,7 @@
  * tables taken directly from the AC-3 spec.
  */
 
+#include "avcodec.h"
 #include "ac3tab.h"
 
 /**
@@ -79,21 +80,48 @@ const uint8_t ff_ac3_channels_tab[8] = {
     2, 1, 2, 3, 3, 4, 4, 5
 };
 
+/**
+ * Maps audio coding mode (acmod) to channel layout mask.
+ */
+const uint16_t ff_ac3_channel_layout_tab[8] = {
+    CH_LAYOUT_STEREO,
+    CH_LAYOUT_MONO,
+    CH_LAYOUT_STEREO,
+    CH_LAYOUT_SURROUND,
+    CH_LAYOUT_2_1,
+    CH_LAYOUT_4POINT0,
+    CH_LAYOUT_2_2,
+    CH_LAYOUT_5POINT0
+};
+
+#define COMMON_CHANNEL_MAP \
+    { { 0, 1,          }, { 0, 1, 2,         } },\
+    { { 0,             }, { 0, 1,            } },\
+    { { 0, 1,          }, { 0, 1, 2,         } },\
+    { { 0, 2, 1,       }, { 0, 2, 1, 3,      } },\
+    { { 0, 1, 2,       }, { 0, 1, 3, 2,      } },\
+    { { 0, 2, 1, 3,    }, { 0, 2, 1, 4, 3,   } },
+
 /**
  * Table to remap channels from SMPTE order to AC-3 order.
  * [channel_mode][lfe][ch]
  */
 const uint8_t ff_ac3_enc_channel_map[8][2][6] = {
-    { { 0, 1,          }, { 0, 1, 2,         } },
-    { { 0,             }, { 0, 1,            } },
-    { { 0, 1,          }, { 0, 1, 2,         } },
-    { { 0, 2, 1,       }, { 0, 2, 1, 3,      } },
-    { { 0, 1, 2,       }, { 0, 1, 3, 2,      } },
-    { { 0, 2, 1, 3,    }, { 0, 2, 1, 4, 3,   } },
-    { { 0, 1, 2, 3, 4, }, { 0, 1, 3, 4, 2,   } },
+    COMMON_CHANNEL_MAP
+    { { 0, 1, 2, 3,    }, { 0, 1, 3, 4, 2,   } },
     { { 0, 2, 1, 3, 4, }, { 0, 2, 1, 4, 5, 3 } },
 };
 
+/**
+ * Table to remap channels from from AC-3 order to SMPTE order.
+ * [channel_mode][lfe][ch]
+ */
+const uint8_t ff_ac3_dec_channel_map[8][2][6] = {
+    COMMON_CHANNEL_MAP
+    { { 0, 1, 2, 3,    }, { 0, 1, 4, 2, 3,   } },
+    { { 0, 2, 1, 3, 4, }, { 0, 2, 1, 5, 3, 4 } },
+};
+
 /* possible frequencies */
 const uint16_t ff_ac3_sample_rate_tab[3] = { 48000, 44100, 32000 };