changeset 24701:d51389598170

Fix output channle ordering
author rtogni
date Sun, 07 Oct 2007 15:06:53 +0000
parents 16a451b9bf4b
children c288df39775c
files libmpcodecs/ad_libdca.c
diffstat 1 files changed, 26 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ad_libdca.c	Sun Oct 07 13:08:24 2007 +0000
+++ b/libmpcodecs/ad_libdca.c	Sun Oct 07 15:06:53 2007 +0000
@@ -52,7 +52,7 @@
 static const char ch2flags[6] = {
     DTS_MONO,
     DTS_STEREO,
-    DTS_2F1R,
+    DTS_3F,
     DTS_2F2R,
     DTS_3F2R,
     DTS_3F2R | DTS_LFE
@@ -90,10 +90,9 @@
         break;
     case DTS_3F:
         for(i = 0; i < 256; i++){
-            s16[5*i] = convert(f[i]);
-            s16[5*i+1] = convert(f[i+512]);
-            s16[5*i+2] = s16[5*i+3] = 0;
-            s16[5*i+4] = convert(f[i+256]);
+            s16[3*i] = convert(f[i+256]);
+            s16[3*i+1] = convert(f[i+512]);
+            s16[3*i+2] = convert(f[i]);
         }
         break;
     case DTS_2F2R:
@@ -106,57 +105,57 @@
         break;
     case DTS_3F2R:
         for(i = 0; i < 256; i++){
-            s16[5*i] = convert(f[i]);
+            s16[5*i] = convert(f[i+256]);
             s16[5*i+1] = convert(f[i+512]);
             s16[5*i+2] = convert(f[i+768]);
             s16[5*i+3] = convert(f[i+1024]);
-            s16[5*i+4] = convert(f[i+256]);
+            s16[5*i+4] = convert(f[i]);
         }
         break;
     case DTS_MONO | DTS_LFE:
         for(i = 0; i < 256; i++){
             s16[6*i] = s16[6*i+1] = s16[6*i+2] = s16[6*i+3] = 0;
-            s16[6*i+4] = convert(f[i+256]);
-            s16[6*i+5] = convert(f[i]);
+            s16[6*i+4] = convert(f[i]);
+            s16[6*i+5] = convert(f[i+256]);
         }
         break;
     case DTS_CHANNEL | DTS_LFE:
     case DTS_STEREO | DTS_LFE:
     case DTS_DOLBY | DTS_LFE:
         for(i = 0; i < 256; i++){
-            s16[6*i] = convert(f[i+256]);
-            s16[6*i+1] = convert(f[i+512]);
+            s16[6*i] = convert(f[i]);
+            s16[6*i+1] = convert(f[i+256]);
             s16[6*i+2] = s16[6*i+3] = s16[6*i+4] = 0;
-            s16[6*i+5] = convert(f[i]);
+            s16[6*i+5] = convert(f[i+512]);
         }
         break;
     case DTS_3F | DTS_LFE:
         for(i = 0; i < 256; i++){
             s16[6*i] = convert(f[i+256]);
-            s16[6*i+1] = convert(f[i+768]);
+            s16[6*i+1] = convert(f[i+512]);
             s16[6*i+2] = s16[6*i+3] = 0;
-            s16[6*i+4] = convert(f[i+512]);
-            s16[6*i+5] = convert(f[i]);
+            s16[6*i+4] = convert(f[i]);
+            s16[6*i+5] = convert(f[i+768]);
         }
         break;
     case DTS_2F2R | DTS_LFE:
         for(i = 0; i < 256; i++){
+            s16[6*i] = convert(f[i]);
+            s16[6*i+1] = convert(f[i+256]);
+            s16[6*i+2] = convert(f[i+512]);
+            s16[6*i+3] = convert(f[i+768]);
+            s16[6*i+4] = 0;
+            s16[6*i+5] = convert(f[1024]);
+        }
+        break;
+    case DTS_3F2R | DTS_LFE:
+        for(i = 0; i < 256; i++){
             s16[6*i] = convert(f[i+256]);
             s16[6*i+1] = convert(f[i+512]);
             s16[6*i+2] = convert(f[i+768]);
             s16[6*i+3] = convert(f[i+1024]);
-            s16[6*i+4] = 0;
-            s16[6*i+5] = convert(f[i]);
-        }
-        break;
-    case DTS_3F2R | DTS_LFE:
-        for(i = 0; i < 256; i++){
-            s16[6*i] = convert(f[i+256]);
-            s16[6*i+1] = convert(f[i+768]);
-            s16[6*i+2] = convert(f[i+1024]);
-            s16[6*i+3] = convert(f[i+1280]);
-            s16[6*i+4] = convert(f[i+512]);
-            s16[6*i+5] = convert(f[i]);
+            s16[6*i+4] = convert(f[i]);
+            s16[6*i+5] = convert(f[i+1280]);
         }
         break;
     }