mmlibs/mmfw/codecs/Inc/Gsm610CodecCommon/gsm610fr.h
changeset 0 b8ed18f6c07b
equal deleted inserted replaced
-1:000000000000 0:b8ed18f6c07b
       
     1 // Copyright (c) 2002-2010 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 //
       
    15 
       
    16 #ifndef __GSM610FR__
       
    17 #define __GSM610FR__
       
    18 
       
    19 //  INCLUDES
       
    20 #include <e32base.h>
       
    21 #include "gsm610common.h"
       
    22 #include "types.h"
       
    23 
       
    24 // DEFINES
       
    25 #define PACKSIZE 65 // Size of one bit packed block (2 frames)
       
    26 
       
    27 //  CLASS DEFINITIONS
       
    28 /*
       
    29 -----------------------------------------------------------------------------
       
    30 
       
    31     CGSM610FR_Encoder
       
    32 
       
    33     GSM 6.10 full rate (FR) speech encoder.
       
    34 
       
    35 -----------------------------------------------------------------------------
       
    36 */
       
    37 NONSHARABLE_CLASS ( CGSM610FR_Encoder ) : public CBase, public MGSM610FR_Encoder
       
    38     {
       
    39 public:
       
    40     void ConstructL();
       
    41     ~CGSM610FR_Encoder();
       
    42     void StartL();
       
    43     void ExecuteL(TUint8* aInBuf, TUint8* OutBuf);
       
    44     void StopL();
       
    45     void Release();
       
    46     
       
    47 private:
       
    48     void PackFrame0(struct codes* aCodeBuf, TInt8* pbuf);
       
    49     void PackFrame1(struct codes* aCodeBuf, TInt8* pbuf);
       
    50 private:
       
    51     struct codes iCodeBuf;       // buffer for speech codewords, one frame
       
    52     TBool iOddFrame;              // is the current frame odd or even frame?
       
    53 private:
       
    54     friend void reset_encoder(CGSM610FR_Encoder* aEncoder);
       
    55     friend void prepr(CGSM610FR_Encoder* aEncoder, int2 sof[], int2 so[]);
       
    56     friend void preemp(CGSM610FR_Encoder* aEncoder, int2 s[], int2 sof[]);
       
    57     friend void ltpcomp(CGSM610FR_Encoder* aEncoder, int2 *Nc, int2 *bc, int2 d[], int k_start);
       
    58     friend void ltpfil(CGSM610FR_Encoder* aEncoder, int2 e[], int2 dpp[], int2 d[], int2 bc, int2 Nc, int k_start);
       
    59     friend void ltpupd( CGSM610FR_Encoder* aEncoder, int2 dpp[], int2 ep[] );
       
    60     friend void LPC_analysis(CGSM610FR_Encoder* aEncoder, int2 ibuf[], struct codes *ecodes);
       
    61     friend void invfil(CGSM610FR_Encoder* aEncoder, int2 d[], int2 s[], int2 rp[], int k_start, int k_end);
       
    62 private:
       
    63     int2 z1;            /* delay 1 of offset comp */
       
    64     int4 L_z2;          /* delay 2 of offset comp */
       
    65     int2 mp;            /* delay of preemphasis */
       
    66     int2 u[8];          /* LPC analysis filter delay */
       
    67     int2 dp[120];       /* Encoder LTP delay */
       
    68     int2 LARpp_prev[8]; /* Encoder LARs of the prev frame */
       
    69 
       
    70     };
       
    71 
       
    72 
       
    73 /*
       
    74 -----------------------------------------------------------------------------
       
    75 
       
    76     CGSM610FR_Decoder
       
    77 
       
    78     GSM 6.10 full rate (FR) speech decoder.
       
    79 
       
    80 -----------------------------------------------------------------------------
       
    81 */
       
    82 NONSHARABLE_CLASS ( CGSM610FR_Decoder ) : public CBase, public MGSM610FR_Decoder
       
    83     {
       
    84 public:
       
    85    void ConstructL();
       
    86    ~CGSM610FR_Decoder();
       
    87    void StartL();
       
    88    void ExecuteL(TUint8* aSrc, TUint8* aDst);
       
    89    void StopL();
       
    90    void Release();
       
    91    
       
    92 private:
       
    93     void UnpackFrame0(struct codes* aCodeBuf, TInt8* pbuf);
       
    94     void UnpackFrame1(struct codes* aCodeBuf, TInt8* pbuf);
       
    95 private:
       
    96     struct codes iCodeBuf;       // buffer for speech codewords, one frame
       
    97     TBool iOddFrame;             // is the current frame odd or even frame?
       
    98 private:
       
    99     friend void reset_decoder(CGSM610FR_Decoder* aDecoder);
       
   100     friend void ltpsyn(CGSM610FR_Decoder* aDecoder, int2 erp[], int2 wt[], int2 bcr, int2 Ncr);
       
   101     friend void postpr(CGSM610FR_Decoder* aDecoder, int2 srop[], int2 sr[]);
       
   102     friend void LPC_synthesis(CGSM610FR_Decoder* aDecoder, struct codes *dcodes, int2 wt[], int2 obuf[]);
       
   103     friend void synfil(CGSM610FR_Decoder* aDecoder, int2 sr[], int2 wt[], int2 rrp[], int k_start, int k_end);
       
   104 private:
       
   105     int2 msr;            /* de emphasis delay */
       
   106     int2 v[9];           /* LPC synthesis filter delay */
       
   107     int2 drp[120];       /* Decoder LTP delay */
       
   108     int2 nrp;            /* LTP delay of the previous frame */
       
   109     int2 LARrpp_prev[8]; /* Decoder LARs of the prev frame */
       
   110     };
       
   111 
       
   112 
       
   113 #endif //__GSM610FR__
       
   114 
       
   115 //-----------------------------------------------------------------------------
       
   116 //  End of File
       
   117 //-----------------------------------------------------------------------------