videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_44_to_48_int16.inl
author Mikael Laine <mikael.laine@ixonos.com>
Fri, 29 Jan 2010 14:08:33 +0200
changeset 0 951a5db380a0
permissions -rw-r--r--
Committing the Video Editor package under the Eclipse Public License

#ifndef __RESAMPLER_SINC_CONV_44_TO_48_INT16_INL__
#define __RESAMPLER_SINC_CONV_44_TO_48_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"


static FORCEINLINE int32 
RESAMPLER_SincConv44To48FilterInt16(const int16 *signalBuf, 
                              const int16 *filterPtr1,
                              const int16 *filterPtr2,
                              int length)
{
    int32 newSample(0);
    int k = length;
    const int16 *bufferPtr1 = signalBuf;
    const int16 *bufferPtr2 = signalBuf + 1;

    // Calculate the filter. 
    // Keep newSample in s1.30 format to reduce rounding errors
    for (k = length; k > 0; k -= 4)
    {
        newSample += (int32)(*filterPtr1++) * (*bufferPtr1--) + (int32)(*filterPtr2++) * (*bufferPtr2++);    
        newSample += (int32)(*filterPtr1++) * (*bufferPtr1--) + (int32)(*filterPtr2++) * (*bufferPtr2++);
        newSample += (int32)(*filterPtr1++) * (*bufferPtr1--) + (int32)(*filterPtr2++) * (*bufferPtr2++);
        newSample += (int32)(*filterPtr1++) * (*bufferPtr1--) + (int32)(*filterPtr2++) * (*bufferPtr2++);
    }
    
    return newSample;
}


#endif /* __RESAMPLER_SINC_CONV_ONE_TO_TWO_INT16_INL__ */