os/mm/mmlibs/mmfw/Codecs/Src/MMFCodecCommon/MMFAudioPcm16ToPcm16BECodec.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // MMFAudioPcm16ToPcmU16BECodec.cpp
    15 // 
    16 //
    17 
    18 #include "MMFAudioPcm16ToPcmU16BECodec.h"
    19 
    20 /**
    21 *
    22 * Convert
    23 * @param aSrc
    24 * @param aDst
    25 * @param aSamples
    26 * Signed 16bit (le) to Unsigned 16bit (be) 
    27 */
    28 EXPORT_C void TMMFAudioPcm16ToPcmU16BECodec::Convert(TUint8* aSrc, TUint8* aDst, TInt aSamples)
    29 	{
    30 	TInt s16;
    31 	while (aSamples--)
    32 		{ 
    33 		s16 = ((aSrc[1]<<8)+aSrc[0])+KMaskSign16bit;
    34 		*aDst++ = STATIC_CAST( TInt8, (s16>>8)&KAndMask8bit);
    35 		*aDst++ = STATIC_CAST( TInt8, s16&KAndMask8bit);
    36 		aSrc += 2;
    37 		}
    38 	}