videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_one_to_two_int16.inl
changeset 0 951a5db380a0
equal deleted inserted replaced
-1:000000000000 0:951a5db380a0
       
     1 #ifndef __RESAMPLER_SINC_CONV_ONE_TO_TWO_INT16_INL__
       
     2 #define __RESAMPLER_SINC_CONV_ONE_TO_TWO_INT16_INL__
       
     3 /*
       
     4 * Copyright (c) 2010 Ixonos Plc.
       
     5 * All rights reserved.
       
     6 * This component and the accompanying materials are made available
       
     7 * under the terms of the "Eclipse Public License v1.0"
       
     8 * which accompanies this distribution, and is available
       
     9 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    10 *
       
    11 * Initial Contributors:
       
    12 * Nokia Corporation - Initial contribution
       
    13 *
       
    14 * Contributors:
       
    15 * Ixonos Plc
       
    16 *
       
    17 * Description:
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 #include "resampler_common_defs.h"
       
    23 #include "resampler_data_types.h"
       
    24 
       
    25 
       
    26 
       
    27 /* Note! This version assumes the number of filter coefficients is 
       
    28  * divisible by four.
       
    29  */
       
    30 static FORCEINLINE int32 
       
    31 RESAMPLER_SincConvOneToTwoFilterInt16(const int16 *signalBuf, 
       
    32                                 const int16 *coeffBuf,
       
    33                                 int length)
       
    34 {
       
    35     int32 newSample = 0;
       
    36     const int16 *bufferPtr1 = signalBuf;
       
    37     const int16 *bufferPtr2 = signalBuf - 1;
       
    38 
       
    39     (void)length;
       
    40     // Calculate the filter. 
       
    41     // Keep newSample in s1.30 format to reduce rounding errors
       
    42     for (int k = length; k>0; k-=4)
       
    43     {
       
    44         newSample += (int32)(*coeffBuf  ) * (*bufferPtr1++);
       
    45         newSample += (int32)(*coeffBuf++) * (*bufferPtr2--);
       
    46         newSample += (int32)(*coeffBuf  ) * (*bufferPtr1++);
       
    47         newSample += (int32)(*coeffBuf++) * (*bufferPtr2--);
       
    48         newSample += (int32)(*coeffBuf  ) * (*bufferPtr1++);
       
    49         newSample += (int32)(*coeffBuf++) * (*bufferPtr2--);
       
    50         newSample += (int32)(*coeffBuf  ) * (*bufferPtr1++);
       
    51         newSample += (int32)(*coeffBuf++) * (*bufferPtr2--);
       
    52     }
       
    53 
       
    54     return newSample;
       
    55 }
       
    56 
       
    57 #endif /* __RESAMPLER_SINC_CONV_ONE_TO_TWO_INT16_INL__ */