[xiph-commits] r11845 - trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisDecoder

illiminable at svn.xiph.org illiminable at svn.xiph.org
Mon Sep 18 05:51:05 PDT 2006


Author: illiminable
Date: 2006-09-18 05:50:59 -0700 (Mon, 18 Sep 2006)
New Revision: 11845

Modified:
   trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp
Log:
* Reorder channels for 5 channel audi otoo

Modified: trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp	2006-09-17 17:56:57 UTC (rev 11844)
+++ trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp	2006-09-18 12:50:59 UTC (rev 11845)
@@ -250,7 +250,7 @@
 {
     //memcpy((void*)locBuffer, (const void*)&mDecodedBuffer[locBytesCopied + locSeekStripOffset], locBytesToCopy - locSeekStripOffset);
 
-    if (((VorbisDecodeFilter*)m_pFilter)->USE_CORRECT_VORBIS_CHANNEL_MAPPING && ((mNumChannels == 6)  || (mNumChannels == 3))) {
+    if (((VorbisDecodeFilter*)m_pFilter)->USE_CORRECT_VORBIS_CHANNEL_MAPPING && ((mNumChannels == 6)  || (mNumChannels == 3) || (mNumChannels == 5))) {
         //We only have to reorder the channels if we are using the extended format, we have declared that we want to map correctly
         // and teh number channels is 3 or 6. All other cases we just memcpy
 
@@ -260,30 +260,41 @@
         short* locDest = (short*)inDestBuffer;
         const short* locSource = (short*)inSourceBuffer;
 
-        if (mNumChannels == 3)
+        if (mNumChannels == 6)
         {
             for (unsigned long i = 0; i < locSampleCount; i++)
             {
+                
                 *locDest++ = *locSource;
                 *locDest++ = locSource[2];
                 *locDest++ = locSource[1];
+                *locDest++ = locSource[5];
+                *locDest++ = locSource[3];
+                *locDest++ = locSource[4];
+
+                locSource += 6;
+             }
+
+        } else if (mNumChannels == 3) {
+            //3 channels
+            for (unsigned long i = 0; i < locSampleCount; i++)
+            {
+                *locDest++ = *locSource;
+                *locDest++ = locSource[2];
+                *locDest++ = locSource[1];
                 locSource += 3;
             }
         } else {
+            //5 channels
             for (unsigned long i = 0; i < locSampleCount; i++)
             {
-                //Must be 6.
                 *locDest++ = *locSource;
                 *locDest++ = locSource[2];
                 *locDest++ = locSource[1];
-                *locDest++ = locSource[5];
                 *locDest++ = locSource[3];
                 *locDest++ = locSource[4];
-
-                locSource += 6;
-                }
-
-
+                locSource += 5;
+            }
         }
         return;
     }



More information about the commits mailing list