ac3dec: reorder output channels to SMPTE channel order

Originally committed as revision 18542 to svn://svn.ffmpeg.org/ffmpeg/trunk
diff --git a/libavcodec/ac3tab.c b/libavcodec/ac3tab.c
index 36a7449..cb07ac6 100644
--- a/libavcodec/ac3tab.c
+++ b/libavcodec/ac3tab.c
@@ -79,21 +79,34 @@
     2, 1, 2, 3, 3, 4, 4, 5
 };
 
+#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,   } },
+    COMMON_CHANNEL_MAP
     { { 0, 1, 2, 3, 4, }, { 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, 4, }, { 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 };