Bug 810262 - Updated libsoundtouch to r160 r=padenot
authorJacek Caban <jacek@codeweavers.com>
Tue, 13 Nov 2012 11:25:14 +0100
changeset 117712 51533e35127de613651c32689220f0b354a2c347
parent 117711 470acc9eaa36c312a0ac712243801d74ef7411e8
child 117713 93461546766e6192b7ca11a77f421587bda284b2
push idunknown
push userunknown
push dateunknown
reviewerspadenot
bugs810262
milestone19.0a1
Bug 810262 - Updated libsoundtouch to r160 r=padenot
media/libsoundtouch/README_MOZILLA
media/libsoundtouch/moz-libsoundtouch.patch
media/libsoundtouch/src/AAFilter.cpp
media/libsoundtouch/src/AAFilter.h
media/libsoundtouch/src/FIFOSampleBuffer.cpp
media/libsoundtouch/src/FIFOSampleBuffer.h
media/libsoundtouch/src/FIFOSamplePipe.h
media/libsoundtouch/src/FIRFilter.cpp
media/libsoundtouch/src/FIRFilter.h
media/libsoundtouch/src/RateTransposer.cpp
media/libsoundtouch/src/RateTransposer.h
media/libsoundtouch/src/STTypes.h
media/libsoundtouch/src/SoundTouch.cpp
media/libsoundtouch/src/SoundTouch.h
media/libsoundtouch/src/TDStretch.cpp
media/libsoundtouch/src/TDStretch.h
media/libsoundtouch/src/cpu_detect.h
media/libsoundtouch/src/cpu_detect_x86.cpp
media/libsoundtouch/src/mmx_optimized.cpp
media/libsoundtouch/src/sse_optimized.cpp
--- a/media/libsoundtouch/README_MOZILLA
+++ b/media/libsoundtouch/README_MOZILLA
@@ -1,8 +1,8 @@
 These files are from the SoundTouch library (http://www.surina.net/soundtouch/),
-and are extracted from the revision r143 of the svn repository at
+and are extracted from the revision r160 of the svn repository at
 https://soundtouch.svn.sourceforge.net/svnroot/soundtouch/trunk.
 
 The whole library is not used, only the relevant files are imported in the tree,
 using the script `update.sh`. Some changes have been made to the files, using
 the patch `moz-libsoundtouch.patch`. We also use a custom soundtouch_config.h.
 
--- a/media/libsoundtouch/moz-libsoundtouch.patch
+++ b/media/libsoundtouch/moz-libsoundtouch.patch
@@ -456,42 +456,39 @@ unchanged:
  
      /// Sets routine control parameters. These control are certain time constants
      /// defining how the sound is stretched to the desired duration.
      //
      /// 'sampleRate' = sample rate of the sound
      /// 'sequenceMS' = one processing sequence length in milliseconds
      /// 'seekwindowMS' = seeking window length for scanning the best overlapping 
      ///      position
-only in patch2:
---- /src/cpu_detect_x86.cpp	2012-04-12 19:52:12.743376976 -0700
-+++ /src/cpu_detect_x86.cpp	2012-08-02 09:54:24.561712171 -0700
-@@ -38,30 +38,35 @@
+--- /src/cpu_detect_x86.cpp
++++ /src/cpu_detect_x86.cpp
+@@ -38,28 +38,33 @@
  //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  //
  ////////////////////////////////////////////////////////////////////////////////
  
  #include "cpu_detect.h"
  #include "STTypes.h"
  
  #if defined(SOUNDTOUCH_ALLOW_X86_OPTIMIZATIONS)
 -
 -    #if defined(__GNUC__) && defined(__i386__)
 -        // gcc
 +    #if defined(__GNUC__)
 +        // gcc and clang
          #include "cpuid.h"
-     #endif
- 
-     #if defined(_M_IX86)
-         // windows
+     #elif defined(_M_IX86)
+         // windows non-gcc
          #include <intrin.h>
--        #define bit_MMX		(1 << 23)
--        #define bit_SSE		(1 << 25)
--        #define bit_SSE2	(1 << 26)
+-        #define bit_MMX     (1 << 23)
+-        #define bit_SSE     (1 << 25)
+-        #define bit_SSE2    (1 << 26)
      #endif
 -
 +    // If we still don't have the macros, define them (Windows, MacOS)
 +    #ifndef bit_MMX
 +        #define bit_MMX (1 << 23)
 +    #endif
 +    #ifndef bit_SSE
 +       #define bit_SSE (1 << 25)
--- a/media/libsoundtouch/src/AAFilter.cpp
+++ b/media/libsoundtouch/src/AAFilter.cpp
@@ -7,20 +7,20 @@
 /// transposing the sample rate with interpolation.
 ///
 /// Author        : Copyright (c) Olli Parviainen
 /// Author e-mail : oparviai 'at' iki.fi
 /// SoundTouch WWW: http://www.surina.net/soundtouch
 ///
 ////////////////////////////////////////////////////////////////////////////////
 //
-// Last changed  : $Date: 2009-01-11 03:34:24 -0800 (Sun, 11 Jan 2009) $
+// Last changed  : $Date$
 // File revision : $Revision: 4 $
 //
-// $Id: AAFilter.cpp 45 2009-01-11 11:34:24Z oparviai $
+// $Id$
 //
 ////////////////////////////////////////////////////////////////////////////////
 //
 // License :
 //
 //  SoundTouch audio processing library
 //  Copyright (c) Olli Parviainen
 //
--- a/media/libsoundtouch/src/AAFilter.h
+++ b/media/libsoundtouch/src/AAFilter.h
@@ -8,20 +8,20 @@
 /// transposing the sample rate with interpolation.
 ///
 /// Author        : Copyright (c) Olli Parviainen
 /// Author e-mail : oparviai 'at' iki.fi
 /// SoundTouch WWW: http://www.surina.net/soundtouch
 ///
 ////////////////////////////////////////////////////////////////////////////////
 //
-// Last changed  : $Date: 2008-02-10 08:26:55 -0800 (Sun, 10 Feb 2008) $
+// Last changed  : $Date$
 // File revision : $Revision: 4 $
 //
-// $Id: AAFilter.h 11 2008-02-10 16:26:55Z oparviai $
+// $Id$
 //
 ////////////////////////////////////////////////////////////////////////////////
 //
 // License :
 //
 //  SoundTouch audio processing library
 //  Copyright (c) Olli Parviainen
 //
--- a/media/libsoundtouch/src/FIFOSampleBuffer.cpp
+++ b/media/libsoundtouch/src/FIFOSampleBuffer.cpp
@@ -10,20 +10,20 @@
 /// whenever necessary.
 ///
 /// Author        : Copyright (c) Olli Parviainen
 /// Author e-mail : oparviai 'at' iki.fi
 /// SoundTouch WWW: http://www.surina.net/soundtouch
 ///
 ////////////////////////////////////////////////////////////////////////////////
 //
-// Last changed  : $Date: 2012-06-13 12:29:53 -0700 (Wed, 13 Jun 2012) $
+// Last changed  : $Date$
 // File revision : $Revision: 4 $
 //
-// $Id: FIFOSampleBuffer.cpp 143 2012-06-13 19:29:53Z oparviai $
+// $Id$
 //
 ////////////////////////////////////////////////////////////////////////////////
 //
 // License :
 //
 //  SoundTouch audio processing library
 //  Copyright (c) Olli Parviainen
 //
@@ -172,17 +172,17 @@ void FIFOSampleBuffer::ensureCapacity(ui
         sizeInBytes = (capacityRequirement * channels * sizeof(SAMPLETYPE) + 4095) & (uint)-4096;
         assert(sizeInBytes % 2 == 0);
         tempUnaligned = new SAMPLETYPE[sizeInBytes / sizeof(SAMPLETYPE) + 16 / sizeof(SAMPLETYPE)];
         if (tempUnaligned == NULL)
         {
             ST_THROW_RT_ERROR("Couldn't allocate memory!\n");
         }
         // Align the buffer to begin at 16byte cache line boundary for optimal performance
-        temp = (SAMPLETYPE *)(((ulong)tempUnaligned + 15) & (ulong)-16);
+        temp = (SAMPLETYPE *)SOUNDTOUCH_ALIGN_POINTER_16(tempUnaligned);
         if (samplesInBuffer)
         {
             memcpy(temp, ptrBegin(), samplesInBuffer * channels * sizeof(SAMPLETYPE));
         }
         delete[] bufferUnaligned;
         buffer = temp;
         bufferUnaligned = tempUnaligned;
         bufferPos = 0;
--- a/media/libsoundtouch/src/FIFOSampleBuffer.h
+++ b/media/libsoundtouch/src/FIFOSampleBuffer.h
@@ -10,20 +10,20 @@
 /// whenever necessary.
 ///
 /// Author        : Copyright (c) Olli Parviainen
 /// Author e-mail : oparviai 'at' iki.fi
 /// SoundTouch WWW: http://www.surina.net/soundtouch
 ///
 ////////////////////////////////////////////////////////////////////////////////
 //
-// Last changed  : $Date: 2012-06-13 12:29:53 -0700 (Wed, 13 Jun 2012) $
+// Last changed  : $Date$
 // File revision : $Revision: 4 $
 //
-// $Id: FIFOSampleBuffer.h 143 2012-06-13 19:29:53Z oparviai $
+// $Id$
 //
 ////////////////////////////////////////////////////////////////////////////////
 //
 // License :
 //
 //  SoundTouch audio processing library
 //  Copyright (c) Olli Parviainen
 //
--- a/media/libsoundtouch/src/FIFOSamplePipe.h
+++ b/media/libsoundtouch/src/FIFOSamplePipe.h
@@ -12,20 +12,20 @@
 /// may be either another processing stage, or a fifo sample buffer object.
 ///
 /// Author        : Copyright (c) Olli Parviainen
 /// Author e-mail : oparviai 'at' iki.fi
 /// SoundTouch WWW: http://www.surina.net/soundtouch
 ///
 ////////////////////////////////////////////////////////////////////////////////
 //
-// Last changed  : $Date: 2012-06-13 12:29:53 -0700 (Wed, 13 Jun 2012) $
+// Last changed  : $Date$
 // File revision : $Revision: 4 $
 //
-// $Id: FIFOSamplePipe.h 143 2012-06-13 19:29:53Z oparviai $
+// $Id$
 //
 ////////////////////////////////////////////////////////////////////////////////
 //
 // License :
 //
 //  SoundTouch audio processing library
 //  Copyright (c) Olli Parviainen
 //
--- a/media/libsoundtouch/src/FIRFilter.cpp
+++ b/media/libsoundtouch/src/FIRFilter.cpp
@@ -6,20 +6,20 @@
 /// e.g. 'mmx_win.cpp' or 'mmx_gcc.cpp'
 ///
 /// Author        : Copyright (c) Olli Parviainen
 /// Author e-mail : oparviai 'at' iki.fi
 /// SoundTouch WWW: http://www.surina.net/soundtouch
 ///
 ////////////////////////////////////////////////////////////////////////////////
 //
-// Last changed  : $Date: 2011-09-02 11:56:11 -0700 (Fri, 02 Sep 2011) $
+// Last changed  : $Date$
 // File revision : $Revision: 4 $
 //
-// $Id: FIRFilter.cpp 131 2011-09-02 18:56:11Z oparviai $
+// $Id$
 //
 ////////////////////////////////////////////////////////////////////////////////
 //
 // License :
 //
 //  SoundTouch audio processing library
 //  Copyright (c) Olli Parviainen
 //
--- a/media/libsoundtouch/src/FIRFilter.h
+++ b/media/libsoundtouch/src/FIRFilter.h
@@ -6,20 +6,20 @@
 /// e.g. 'mmx_win.cpp' or 'mmx_gcc.cpp'
 ///
 /// Author        : Copyright (c) Olli Parviainen
 /// Author e-mail : oparviai 'at' iki.fi
 /// SoundTouch WWW: http://www.surina.net/soundtouch
 ///
 ////////////////////////////////////////////////////////////////////////////////
 //
-// Last changed  : $Date: 2011-02-13 11:13:57 -0800 (Sun, 13 Feb 2011) $
+// Last changed  : $Date$
 // File revision : $Revision: 4 $
 //
-// $Id: FIRFilter.h 104 2011-02-13 19:13:57Z oparviai $
+// $Id$
 //
 ////////////////////////////////////////////////////////////////////////////////
 //
 // License :
 //
 //  SoundTouch audio processing library
 //  Copyright (c) Olli Parviainen
 //
--- a/media/libsoundtouch/src/RateTransposer.cpp
+++ b/media/libsoundtouch/src/RateTransposer.cpp
@@ -5,20 +5,20 @@
 /// alias filtering should be quite adequate for this application)
 ///
 /// Author        : Copyright (c) Olli Parviainen
 /// Author e-mail : oparviai 'at' iki.fi
 /// SoundTouch WWW: http://www.surina.net/soundtouch
 ///
 ////////////////////////////////////////////////////////////////////////////////
 //
-// Last changed  : $Date: 2011-09-02 11:56:11 -0700 (Fri, 02 Sep 2011) $
+// Last changed  : $Date$
 // File revision : $Revision: 4 $
 //
-// $Id: RateTransposer.cpp 131 2011-09-02 18:56:11Z oparviai $
+// $Id$
 //
 ////////////////////////////////////////////////////////////////////////////////
 //
 // License :
 //
 //  SoundTouch audio processing library
 //  Copyright (c) Olli Parviainen
 //
--- a/media/libsoundtouch/src/RateTransposer.h
+++ b/media/libsoundtouch/src/RateTransposer.h
@@ -9,20 +9,20 @@
 /// algorithm implementation.
 ///
 /// Author        : Copyright (c) Olli Parviainen
 /// Author e-mail : oparviai 'at' iki.fi
 /// SoundTouch WWW: http://www.surina.net/soundtouch
 ///
 ////////////////////////////////////////////////////////////////////////////////
 //
-// Last changed  : $Date: 2009-02-21 08:00:14 -0800 (Sat, 21 Feb 2009) $
+// Last changed  : $Date$
 // File revision : $Revision: 4 $
 //
-// $Id: RateTransposer.h 63 2009-02-21 16:00:14Z oparviai $
+// $Id$
 //
 ////////////////////////////////////////////////////////////////////////////////
 //
 // License :
 //
 //  SoundTouch audio processing library
 //  Copyright (c) Olli Parviainen
 //
--- a/media/libsoundtouch/src/STTypes.h
+++ b/media/libsoundtouch/src/STTypes.h
@@ -3,20 +3,20 @@
 /// Common type definitions for SoundTouch audio processing library.
 ///
 /// Author        : Copyright (c) Olli Parviainen
 /// Author e-mail : oparviai 'at' iki.fi
 /// SoundTouch WWW: http://www.surina.net/soundtouch
 ///
 ////////////////////////////////////////////////////////////////////////////////
 //
-// Last changed  : $Date: 2012-04-01 10:01:42 -0700 (Sun, 01 Apr 2012) $
+// Last changed  : $Date$
 // File revision : $Revision: 3 $
 //
-// $Id: STTypes.h 136 2012-04-01 17:01:42Z oparviai $
+// $Id$
 //
 ////////////////////////////////////////////////////////////////////////////////
 //
 // License :
 //
 //  SoundTouch audio processing library
 //  Copyright (c) Olli Parviainen
 //
@@ -37,16 +37,28 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 #ifndef STTypes_H
 #define STTypes_H
 
 typedef unsigned int    uint;
 typedef unsigned long   ulong;
 
+// Patch for MinGW: on Win64 long is 32-bit
+#ifdef _WIN64
+    typedef unsigned long long ulongptr;
+#else
+    typedef ulong ulongptr;
+#endif
+
+
+// Helper macro for aligning pointer up to next 16-byte boundary
+#define SOUNDTOUCH_ALIGN_POINTER_16(x)      ( ( (ulongptr)(x) + 15 ) & ~(ulongptr)15 )
+
+
 #include "soundtouch_config.h"
 
 #ifdef WIN32
 #define EXPORT __declspec(dllexport)
 #else
 #define EXPORT
 #endif
 
--- a/media/libsoundtouch/src/SoundTouch.cpp
+++ b/media/libsoundtouch/src/SoundTouch.cpp
@@ -36,20 +36,20 @@
 ///   combining the two other controls.
 ///
 /// Author        : Copyright (c) Olli Parviainen
 /// Author e-mail : oparviai 'at' iki.fi
 /// SoundTouch WWW: http://www.surina.net/soundtouch
 ///
 ////////////////////////////////////////////////////////////////////////////////
 //
-// Last changed  : $Date: 2012-06-13 12:29:53 -0700 (Wed, 13 Jun 2012) $
+// Last changed  : $Date$
 // File revision : $Revision: 4 $
 //
-// $Id: SoundTouch.cpp 143 2012-06-13 19:29:53Z oparviai $
+// $Id$
 //
 ////////////////////////////////////////////////////////////////////////////////
 //
 // License :
 //
 //  SoundTouch audio processing library
 //  Copyright (c) Olli Parviainen
 //
--- a/media/libsoundtouch/src/SoundTouch.h
+++ b/media/libsoundtouch/src/SoundTouch.h
@@ -36,20 +36,20 @@
 ///   combining the two other controls.
 ///
 /// Author        : Copyright (c) Olli Parviainen
 /// Author e-mail : oparviai 'at' iki.fi
 /// SoundTouch WWW: http://www.surina.net/soundtouch
 ///
 ////////////////////////////////////////////////////////////////////////////////
 //
-// Last changed  : $Date: 2012-04-04 12:47:28 -0700 (Wed, 04 Apr 2012) $
+// Last changed  : $Date$
 // File revision : $Revision: 4 $
 //
-// $Id: SoundTouch.h 141 2012-04-04 19:47:28Z oparviai $
+// $Id$
 //
 ////////////////////////////////////////////////////////////////////////////////
 //
 // License :
 //
 //  SoundTouch audio processing library
 //  Copyright (c) Olli Parviainen
 //
--- a/media/libsoundtouch/src/TDStretch.cpp
+++ b/media/libsoundtouch/src/TDStretch.cpp
@@ -8,20 +8,20 @@
 /// file, e.g. 'mmx_win.cpp' or 'mmx_gcc.cpp'
 ///
 /// Author        : Copyright (c) Olli Parviainen
 /// Author e-mail : oparviai 'at' iki.fi
 /// SoundTouch WWW: http://www.surina.net/soundtouch
 ///
 ////////////////////////////////////////////////////////////////////////////////
 //
-// Last changed  : $Date: 2012-04-01 12:49:30 -0700 (Sun, 01 Apr 2012) $
+// Last changed  : $Date$
 // File revision : $Revision: 1.12 $
 //
-// $Id: TDStretch.cpp 137 2012-04-01 19:49:30Z oparviai $
+// $Id$
 //
 ////////////////////////////////////////////////////////////////////////////////
 //
 // License :
 //
 //  SoundTouch audio processing library
 //  Copyright (c) Olli Parviainen
 //
@@ -585,17 +585,17 @@ void TDStretch::acceptNewOverlapLength(i
     overlapLength = newOverlapLength;
 
     if (overlapLength > prevOvl)
     {
         delete[] pMidBufferUnaligned;
 
         pMidBufferUnaligned = new SAMPLETYPE[overlapLength * 2 + 16 / sizeof(SAMPLETYPE)];
         // ensure that 'pMidBuffer' is aligned to 16 byte boundary for efficiency
-        pMidBuffer = (SAMPLETYPE *)((((ulong)pMidBufferUnaligned) + 15) & (ulong)-16);
+        pMidBuffer = (SAMPLETYPE *)SOUNDTOUCH_ALIGN_POINTER_16(pMidBufferUnaligned);
 
         clearMidBuffer();
     }
 }
 
 
 // Operator 'new' is overloaded so that it automatically creates a suitable instance 
 // depending on if we've a MMX/SSE/etc-capable CPU available or not.
--- a/media/libsoundtouch/src/TDStretch.h
+++ b/media/libsoundtouch/src/TDStretch.h
@@ -8,20 +8,20 @@
 /// 'mmx_optimized.cpp' and 'sse_optimized.cpp'
 ///
 /// Author        : Copyright (c) Olli Parviainen
 /// Author e-mail : oparviai 'at' iki.fi
 /// SoundTouch WWW: http://www.surina.net/soundtouch
 ///
 ////////////////////////////////////////////////////////////////////////////////
 //
-// Last changed  : $Date: 2012-04-01 12:49:30 -0700 (Sun, 01 Apr 2012) $
+// Last changed  : $Date$
 // File revision : $Revision: 4 $
 //
-// $Id: TDStretch.h 137 2012-04-01 19:49:30Z oparviai $
+// $Id$
 //
 ////////////////////////////////////////////////////////////////////////////////
 //
 // License :
 //
 //  SoundTouch audio processing library
 //  Copyright (c) Olli Parviainen
 //
--- a/media/libsoundtouch/src/cpu_detect.h
+++ b/media/libsoundtouch/src/cpu_detect.h
@@ -7,20 +7,20 @@
 /// platforms, respectively.
 ///
 /// Author        : Copyright (c) Olli Parviainen
 /// Author e-mail : oparviai 'at' iki.fi
 /// SoundTouch WWW: http://www.surina.net/soundtouch
 ///
 ////////////////////////////////////////////////////////////////////////////////
 //
-// Last changed  : $Date: 2008-02-10 08:26:55 -0800 (Sun, 10 Feb 2008) $
+// Last changed  : $Date$
 // File revision : $Revision: 4 $
 //
-// $Id: cpu_detect.h 11 2008-02-10 16:26:55Z oparviai $
+// $Id$
 //
 ////////////////////////////////////////////////////////////////////////////////
 //
 // License :
 //
 //  SoundTouch audio processing library
 //  Copyright (c) Olli Parviainen
 //
--- a/media/libsoundtouch/src/cpu_detect_x86.cpp
+++ b/media/libsoundtouch/src/cpu_detect_x86.cpp
@@ -6,20 +6,20 @@
 /// for the Microsoft compiler version.
 ///
 /// Author        : Copyright (c) Olli Parviainen
 /// Author e-mail : oparviai 'at' iki.fi
 /// SoundTouch WWW: http://www.surina.net/soundtouch
 ///
 ////////////////////////////////////////////////////////////////////////////////
 //
-// Last changed  : $Date: 2012-04-01 13:00:09 -0700 (Sun, 01 Apr 2012) $
+// Last changed  : $Date$
 // File revision : $Revision: 4 $
 //
-// $Id: cpu_detect_x86.cpp 138 2012-04-01 20:00:09Z oparviai $
+// $Id$
 //
 ////////////////////////////////////////////////////////////////////////////////
 //
 // License :
 //
 //  SoundTouch audio processing library
 //  Copyright (c) Olli Parviainen
 //
@@ -41,20 +41,18 @@
 
 #include "cpu_detect.h"
 #include "STTypes.h"
 
 #if defined(SOUNDTOUCH_ALLOW_X86_OPTIMIZATIONS)
     #if defined(__GNUC__)
         // gcc and clang
         #include "cpuid.h"
-    #endif
-
-    #if defined(_M_IX86)
-        // windows
+    #elif defined(_M_IX86)
+        // windows non-gcc
         #include <intrin.h>
     #endif
     // If we still don't have the macros, define them (Windows, MacOS)
     #ifndef bit_MMX
         #define bit_MMX (1 << 23)
     #endif
     #ifndef bit_SSE
        #define bit_SSE (1 << 25)
--- a/media/libsoundtouch/src/mmx_optimized.cpp
+++ b/media/libsoundtouch/src/mmx_optimized.cpp
@@ -15,20 +15,20 @@
 /// http://msdn.microsoft.com/en-us/vstudio/aa718349.aspx
 ///
 /// Author        : Copyright (c) Olli Parviainen
 /// Author e-mail : oparviai 'at' iki.fi
 /// SoundTouch WWW: http://www.surina.net/soundtouch
 ///
 ////////////////////////////////////////////////////////////////////////////////
 //
-// Last changed  : $Date: 2012-04-01 12:49:30 -0700 (Sun, 01 Apr 2012) $
+// Last changed  : $Date$
 // File revision : $Revision: 4 $
 //
-// $Id: mmx_optimized.cpp 137 2012-04-01 19:49:30Z oparviai $
+// $Id$
 //
 ////////////////////////////////////////////////////////////////////////////////
 //
 // License :
 //
 //  SoundTouch audio processing library
 //  Copyright (c) Olli Parviainen
 //
@@ -234,17 +234,17 @@ FIRFilterMMX::~FIRFilterMMX()
 void FIRFilterMMX::setCoefficients(const short *coeffs, uint newLength, uint uResultDivFactor)
 {
     uint i;
     FIRFilter::setCoefficients(coeffs, newLength, uResultDivFactor);
 
     // Ensure that filter coeffs array is aligned to 16-byte boundary
     delete[] filterCoeffsUnalign;
     filterCoeffsUnalign = new short[2 * newLength + 8];
-    filterCoeffsAlign = (short *)(((ulong)filterCoeffsUnalign + 15) & -16);
+    filterCoeffsAlign = (short *)SOUNDTOUCH_ALIGN_POINTER_16(filterCoeffsUnalign);
 
     // rearrange the filter coefficients for mmx routines 
     for (i = 0;i < length; i += 4) 
     {
         filterCoeffsAlign[2 * i + 0] = coeffs[i + 0];
         filterCoeffsAlign[2 * i + 1] = coeffs[i + 2];
         filterCoeffsAlign[2 * i + 2] = coeffs[i + 0];
         filterCoeffsAlign[2 * i + 3] = coeffs[i + 2];
--- a/media/libsoundtouch/src/sse_optimized.cpp
+++ b/media/libsoundtouch/src/sse_optimized.cpp
@@ -18,20 +18,20 @@
 /// perform a search with keywords "processor pack".
 ///
 /// Author        : Copyright (c) Olli Parviainen
 /// Author e-mail : oparviai 'at' iki.fi
 /// SoundTouch WWW: http://www.surina.net/soundtouch
 ///
 ////////////////////////////////////////////////////////////////////////////////
 //
-// Last changed  : $Date: 2012-04-01 12:49:30 -0700 (Sun, 01 Apr 2012) $
+// Last changed  : $Date$
 // File revision : $Revision: 4 $
 //
-// $Id: sse_optimized.cpp 137 2012-04-01 19:49:30Z oparviai $
+// $Id$
 //
 ////////////////////////////////////////////////////////////////////////////////
 //
 // License :
 //
 //  SoundTouch audio processing library
 //  Copyright (c) Olli Parviainen
 //
@@ -88,17 +88,17 @@ double TDStretchSSE::calcCrossCorr(const
     // for choosing if this little cheating is allowed.
 
 #ifdef SOUNDTOUCH_ALLOW_NONEXACT_SIMD_OPTIMIZATION
     // Little cheating allowed, return valid correlation only for 
     // aligned locations, meaning every second round for stereo sound.
 
     #define _MM_LOAD    _mm_load_ps
 
-    if (((ulong)pV1) & 15) return -1e50;    // skip unaligned locations
+    if (((ulongptr)pV1) & 15) return -1e50;    // skip unaligned locations
 
 #else
     // No cheating allowed, use unaligned load & take the resulting
     // performance hit.
     #define _MM_LOAD    _mm_loadu_ps
 #endif 
 
     // ensure overlapLength is divisible by 8
@@ -213,17 +213,17 @@ void FIRFilterSSE::setCoefficients(const
 
     FIRFilter::setCoefficients(coeffs, newLength, uResultDivFactor);
 
     // Scale the filter coefficients so that it won't be necessary to scale the filtering result
     // also rearrange coefficients suitably for SSE
     // Ensure that filter coeffs array is aligned to 16-byte boundary
     delete[] filterCoeffsUnalign;
     filterCoeffsUnalign = new float[2 * newLength + 4];
-    filterCoeffsAlign = (float *)(((unsigned long)filterCoeffsUnalign + 15) & (ulong)-16);
+    filterCoeffsAlign = (float *)SOUNDTOUCH_ALIGN_POINTER_16(filterCoeffsUnalign);
 
     fDivider = (float)resultDivider;
 
     // rearrange the filter coefficients for mmx routines 
     for (i = 0; i < newLength; i ++)
     {
         filterCoeffsAlign[2 * i + 0] =
         filterCoeffsAlign[2 * i + 1] = coeffs[i + 0] / fDivider;
@@ -241,17 +241,17 @@ uint FIRFilterSSE::evaluateFilterStereo(
     assert(count % 2 == 0);
 
     if (count < 2) return 0;
 
     assert(source != NULL);
     assert(dest != NULL);
     assert((length % 8) == 0);
     assert(filterCoeffsAlign != NULL);
-    assert(((ulong)filterCoeffsAlign) % 16 == 0);
+    assert(((ulongptr)filterCoeffsAlign) % 16 == 0);
 
     // filter is evaluated for two stereo samples with each iteration, thus use of 'j += 2'
     for (j = 0; j < count; j += 2)
     {
         const float *pSrc;
         const __m128 *pFil;
         __m128 sum1, sum2;
         uint i;