videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_one_to_two_int16.inl
changeset 0 951a5db380a0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_one_to_two_int16.inl	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,57 @@
+#ifndef __RESAMPLER_SINC_CONV_ONE_TO_TWO_INT16_INL__
+#define __RESAMPLER_SINC_CONV_ONE_TO_TWO_INT16_INL__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_common_defs.h"
+#include "resampler_data_types.h"
+
+
+
+/* Note! This version assumes the number of filter coefficients is 
+ * divisible by four.
+ */
+static FORCEINLINE int32 
+RESAMPLER_SincConvOneToTwoFilterInt16(const int16 *signalBuf, 
+                                const int16 *coeffBuf,
+                                int length)
+{
+    int32 newSample = 0;
+    const int16 *bufferPtr1 = signalBuf;
+    const int16 *bufferPtr2 = signalBuf - 1;
+
+    (void)length;
+    // Calculate the filter. 
+    // Keep newSample in s1.30 format to reduce rounding errors
+    for (int k = length; k>0; k-=4)
+    {
+        newSample += (int32)(*coeffBuf  ) * (*bufferPtr1++);
+        newSample += (int32)(*coeffBuf++) * (*bufferPtr2--);
+        newSample += (int32)(*coeffBuf  ) * (*bufferPtr1++);
+        newSample += (int32)(*coeffBuf++) * (*bufferPtr2--);
+        newSample += (int32)(*coeffBuf  ) * (*bufferPtr1++);
+        newSample += (int32)(*coeffBuf++) * (*bufferPtr2--);
+        newSample += (int32)(*coeffBuf  ) * (*bufferPtr1++);
+        newSample += (int32)(*coeffBuf++) * (*bufferPtr2--);
+    }
+
+    return newSample;
+}
+
+#endif /* __RESAMPLER_SINC_CONV_ONE_TO_TWO_INT16_INL__ */