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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include "MMFAudioMuLawToS16PcmCodec.h"
23 EXPORT_C void TMMFAudioMuLawToS16PcmCodec::Convert(TUint8* aSrc, TUint8* aDst, TInt aSamples)
31 pcm = MulawSampleToPcm(*aSrc++);
32 *aDst++ = STATIC_CAST( TUint8, pcm&KAndMask8bit);
33 *aDst++ = STATIC_CAST( TUint8, pcm>>8);
45 TInt TMMFAudioMuLawToS16PcmCodec::MulawSampleToPcm(TUint8 aMulaw)
47 TInt sign, exponent, mantissa, sample;
49 aMulaw = STATIC_CAST( TUint8, ~aMulaw);
50 sign = ( aMulaw & KMaskSign8bit );
51 exponent = ( aMulaw >> 4 ) & 0x07;
52 mantissa = aMulaw & 0x0F;
53 sample = KExpLut[exponent] + ( mantissa << ( exponent + 3 ) );
60 const TInt TMMFAudioMuLawToS16PcmCodec::KExpLut[KMdaMulawTo16PcmExpLutSize] =
62 0, 132, 396, 924, 1980, 4092, 8316, 16764