os/mm/mmlibs/mmfw/Codecs/Inc/Gsm610CodecCommon/gsm610fr.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2002-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 //
    15 
    16 #ifndef __GSM610FR__
    17 #define __GSM610FR__
    18 
    19 //  INCLUDES
    20 #include <e32base.h>
    21 
    22 #include "rpeltp.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 class CGSM610FR_Encoder
    38     {
    39 public:
    40     IMPORT_C void ConstructL();
    41     IMPORT_C ~CGSM610FR_Encoder();
    42     IMPORT_C void StartL();
    43     IMPORT_C void ExecuteL(TUint8* aInBuf, TUint8* OutBuf);
    44     IMPORT_C void StopL();
    45 private:
    46     void PackFrame0(struct codes* aCodeBuf, TInt8* pbuf);
    47     void PackFrame1(struct codes* aCodeBuf, TInt8* pbuf);
    48 private:
    49     struct codes iCodeBuf;       // buffer for speech codewords, one frame
    50     TBool iOddFrame;              // is the current frame odd or even frame?
    51 private:
    52     friend void reset_encoder(CGSM610FR_Encoder* aEncoder);
    53     friend void prepr(CGSM610FR_Encoder* aEncoder, int2 sof[], int2 so[]);
    54     friend void preemp(CGSM610FR_Encoder* aEncoder, int2 s[], int2 sof[]);
    55     friend void ltpcomp(CGSM610FR_Encoder* aEncoder, int2 *Nc, int2 *bc, int2 d[], int k_start);
    56     friend void ltpfil(CGSM610FR_Encoder* aEncoder, int2 e[], int2 dpp[], int2 d[], int2 bc, int2 Nc, int k_start);
    57     friend void ltpupd( CGSM610FR_Encoder* aEncoder, int2 dpp[], int2 ep[] );
    58     friend void LPC_analysis(CGSM610FR_Encoder* aEncoder, int2 ibuf[], struct codes *ecodes);
    59     friend void invfil(CGSM610FR_Encoder* aEncoder, int2 d[], int2 s[], int2 rp[], int k_start, int k_end);
    60 private:
    61     int2 z1;            /* delay 1 of offset comp */
    62     int4 L_z2;          /* delay 2 of offset comp */
    63     int2 mp;            /* delay of preemphasis */
    64     int2 u[8];          /* LPC analysis filter delay */
    65     int2 dp[120];       /* Encoder LTP delay */
    66     int2 LARpp_prev[8]; /* Encoder LARs of the prev frame */
    67 
    68     };
    69 
    70 
    71 /*
    72 -----------------------------------------------------------------------------
    73 
    74     CGSM610FR_Decoder
    75 
    76     GSM 6.10 full rate (FR) speech decoder.
    77 
    78 -----------------------------------------------------------------------------
    79 */
    80 class CGSM610FR_Decoder
    81     {
    82 public:
    83    IMPORT_C void ConstructL();
    84    IMPORT_C ~CGSM610FR_Decoder();
    85    IMPORT_C void StartL();
    86    IMPORT_C void ExecuteL(TUint8* aSrc, TUint8* aDst);
    87    IMPORT_C void StopL();
    88 private:
    89     void UnpackFrame0(struct codes* aCodeBuf, TInt8* pbuf);
    90     void UnpackFrame1(struct codes* aCodeBuf, TInt8* pbuf);
    91 private:
    92     struct codes iCodeBuf;       // buffer for speech codewords, one frame
    93     TBool iOddFrame;             // is the current frame odd or even frame?
    94 private:
    95     friend void reset_decoder(CGSM610FR_Decoder* aDecoder);
    96     friend void ltpsyn(CGSM610FR_Decoder* aDecoder, int2 erp[], int2 wt[], int2 bcr, int2 Ncr);
    97     friend void postpr(CGSM610FR_Decoder* aDecoder, int2 srop[], int2 sr[]);
    98     friend void LPC_synthesis(CGSM610FR_Decoder* aDecoder, struct codes *dcodes, int2 wt[], int2 obuf[]);
    99     friend void synfil(CGSM610FR_Decoder* aDecoder, int2 sr[], int2 wt[], int2 rrp[], int k_start, int k_end);
   100 private:
   101     int2 msr;            /* de emphasis delay */
   102     int2 v[9];           /* LPC synthesis filter delay */
   103     int2 drp[120];       /* Decoder LTP delay */
   104     int2 nrp;            /* LTP delay of the previous frame */
   105     int2 LARrpp_prev[8]; /* Decoder LARs of the prev frame */
   106     };
   107 
   108 
   109 #endif //__GSM610FR__
   110 
   111 //-----------------------------------------------------------------------------
   112 //  End of File
   113 //-----------------------------------------------------------------------------