sl@0: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: // All rights reserved.
sl@0: // This component and the accompanying materials are made available
sl@0: // under the terms of "Eclipse Public License v1.0"
sl@0: // which accompanies this distribution, and is available
sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: //
sl@0: // Initial Contributors:
sl@0: // Nokia Corporation - initial contribution.
sl@0: //
sl@0: // Contributors:
sl@0: //
sl@0: // Description:
sl@0: //
sl@0: 
sl@0: #ifndef __GSM610FR__
sl@0: #define __GSM610FR__
sl@0: 
sl@0: //  INCLUDES
sl@0: #include <e32base.h>
sl@0: 
sl@0: #include "rpeltp.h"
sl@0: 
sl@0: // DEFINES
sl@0: #define PACKSIZE 65 // Size of one bit packed block (2 frames)
sl@0: 
sl@0: //  CLASS DEFINITIONS
sl@0: /*
sl@0: -----------------------------------------------------------------------------
sl@0: 
sl@0:     CGSM610FR_Encoder
sl@0: 
sl@0:     GSM 6.10 full rate (FR) speech encoder.
sl@0: 
sl@0: -----------------------------------------------------------------------------
sl@0: */
sl@0: class CGSM610FR_Encoder
sl@0:     {
sl@0: public:
sl@0:     IMPORT_C void ConstructL();
sl@0:     IMPORT_C ~CGSM610FR_Encoder();
sl@0:     IMPORT_C void StartL();
sl@0:     IMPORT_C void ExecuteL(TUint8* aInBuf, TUint8* OutBuf);
sl@0:     IMPORT_C void StopL();
sl@0: private:
sl@0:     void PackFrame0(struct codes* aCodeBuf, TInt8* pbuf);
sl@0:     void PackFrame1(struct codes* aCodeBuf, TInt8* pbuf);
sl@0: private:
sl@0:     struct codes iCodeBuf;       // buffer for speech codewords, one frame
sl@0:     TBool iOddFrame;              // is the current frame odd or even frame?
sl@0: private:
sl@0:     friend void reset_encoder(CGSM610FR_Encoder* aEncoder);
sl@0:     friend void prepr(CGSM610FR_Encoder* aEncoder, int2 sof[], int2 so[]);
sl@0:     friend void preemp(CGSM610FR_Encoder* aEncoder, int2 s[], int2 sof[]);
sl@0:     friend void ltpcomp(CGSM610FR_Encoder* aEncoder, int2 *Nc, int2 *bc, int2 d[], int k_start);
sl@0:     friend void ltpfil(CGSM610FR_Encoder* aEncoder, int2 e[], int2 dpp[], int2 d[], int2 bc, int2 Nc, int k_start);
sl@0:     friend void ltpupd( CGSM610FR_Encoder* aEncoder, int2 dpp[], int2 ep[] );
sl@0:     friend void LPC_analysis(CGSM610FR_Encoder* aEncoder, int2 ibuf[], struct codes *ecodes);
sl@0:     friend void invfil(CGSM610FR_Encoder* aEncoder, int2 d[], int2 s[], int2 rp[], int k_start, int k_end);
sl@0: private:
sl@0:     int2 z1;            /* delay 1 of offset comp */
sl@0:     int4 L_z2;          /* delay 2 of offset comp */
sl@0:     int2 mp;            /* delay of preemphasis */
sl@0:     int2 u[8];          /* LPC analysis filter delay */
sl@0:     int2 dp[120];       /* Encoder LTP delay */
sl@0:     int2 LARpp_prev[8]; /* Encoder LARs of the prev frame */
sl@0: 
sl@0:     };
sl@0: 
sl@0: 
sl@0: /*
sl@0: -----------------------------------------------------------------------------
sl@0: 
sl@0:     CGSM610FR_Decoder
sl@0: 
sl@0:     GSM 6.10 full rate (FR) speech decoder.
sl@0: 
sl@0: -----------------------------------------------------------------------------
sl@0: */
sl@0: class CGSM610FR_Decoder
sl@0:     {
sl@0: public:
sl@0:    IMPORT_C void ConstructL();
sl@0:    IMPORT_C ~CGSM610FR_Decoder();
sl@0:    IMPORT_C void StartL();
sl@0:    IMPORT_C void ExecuteL(TUint8* aSrc, TUint8* aDst);
sl@0:    IMPORT_C void StopL();
sl@0: private:
sl@0:     void UnpackFrame0(struct codes* aCodeBuf, TInt8* pbuf);
sl@0:     void UnpackFrame1(struct codes* aCodeBuf, TInt8* pbuf);
sl@0: private:
sl@0:     struct codes iCodeBuf;       // buffer for speech codewords, one frame
sl@0:     TBool iOddFrame;             // is the current frame odd or even frame?
sl@0: private:
sl@0:     friend void reset_decoder(CGSM610FR_Decoder* aDecoder);
sl@0:     friend void ltpsyn(CGSM610FR_Decoder* aDecoder, int2 erp[], int2 wt[], int2 bcr, int2 Ncr);
sl@0:     friend void postpr(CGSM610FR_Decoder* aDecoder, int2 srop[], int2 sr[]);
sl@0:     friend void LPC_synthesis(CGSM610FR_Decoder* aDecoder, struct codes *dcodes, int2 wt[], int2 obuf[]);
sl@0:     friend void synfil(CGSM610FR_Decoder* aDecoder, int2 sr[], int2 wt[], int2 rrp[], int k_start, int k_end);
sl@0: private:
sl@0:     int2 msr;            /* de emphasis delay */
sl@0:     int2 v[9];           /* LPC synthesis filter delay */
sl@0:     int2 drp[120];       /* Decoder LTP delay */
sl@0:     int2 nrp;            /* LTP delay of the previous frame */
sl@0:     int2 LARrpp_prev[8]; /* Decoder LARs of the prev frame */
sl@0:     };
sl@0: 
sl@0: 
sl@0: #endif //__GSM610FR__
sl@0: 
sl@0: //-----------------------------------------------------------------------------
sl@0: //  End of File
sl@0: //-----------------------------------------------------------------------------