videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_filter_two_to_one_int16.h
branchRCL_3
changeset 3 e0b5df5c0969
parent 0 951a5db380a0
child 5 4c409de21d23
equal deleted inserted replaced
0:951a5db380a0 3:e0b5df5c0969
     1 #ifndef __RESAMPLER_SINC_CONV_FILTER_TWO_TO_ONE_INT16_H__
       
     2 #define __RESAMPLER_SINC_CONV_FILTER_TWO_TO_ONE_INT16_H__
       
     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 static FORCEINLINE int32 
       
    26 RESAMPLER_SincConvFilterTwoToOneInt16(const int16 *signalBuf, 
       
    27 								const int16 *filterPtr,
       
    28 								int length)
       
    29 {
       
    30     int32 newSample((int32)signalBuf[0] << 14);
       
    31     
       
    32     const int16 *bufferPtr1 = signalBuf - 1; 
       
    33     const int16 *bufferPtr2 = signalBuf + 1;
       
    34     for (int l = length; l >0 ; l--)
       
    35     {
       
    36         // Calculate the filter. 
       
    37         // Keep newSample in s1.30 format to reduce rounding errors
       
    38         newSample += (int32)(*filterPtr) * (*bufferPtr1) + (int32)(*filterPtr) * (*bufferPtr2);
       
    39 		filterPtr++;
       
    40 		bufferPtr1 -= 2;
       
    41 		bufferPtr2 += 2;
       
    42 	}
       
    43 
       
    44     return newSample;
       
    45 }
       
    46 
       
    47 
       
    48 #endif /* __RESAMPLER_SINC_CONV_FILTER_TWO_TO_ONE_INT16_H__ */