diff ac3tab.c @ 9452:42803399ba8a libavcodec

ac3enc: reorder input channels to AC-3 channel order
author jbr
date Fri, 17 Apr 2009 08:39:11 +0000
parents e9d9d946f213
children 7db61b0d21f9
line wrap: on
line diff
--- a/ac3tab.c	Thu Apr 16 08:39:13 2009 +0000
+++ b/ac3tab.c	Fri Apr 17 08:39:11 2009 +0000
@@ -79,6 +79,21 @@
     2, 1, 2, 3, 3, 4, 4, 5
 };
 
+/**
+ * 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,   } },
+    { { 0, 2, 1, 3, 4, }, { 0, 2, 1, 4, 5, 3 } },
+};
+
 /* possible frequencies */
 const uint16_t ff_ac3_sample_rate_tab[3] = { 48000, 44100, 32000 };