Home | History | Annotate | Download | only in src
      1 /* ------------------------------------------------------------------
      2  * Copyright (C) 1998-2009 PacketVideo
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
     13  * express or implied.
     14  * See the License for the specific language governing permissions
     15  * and limitations under the License.
     16  * -------------------------------------------------------------------
     17  */
     18 /****************************************************************************************
     19 Portions of this file are derived from the following 3GPP standard:
     20 
     21     3GPP TS 26.073
     22     ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
     23     Available from http://www.3gpp.org
     24 
     25 (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
     26 Permission to distribute, modify and use this file under the standard license
     27 terms listed above has been obtained from the copyright holder.
     28 ****************************************************************************************/
     29 /*
     30 ------------------------------------------------------------------------------
     31 
     32 
     33 
     34  Filename: /audio/gsm_amr/c/include/cl_ltp.h
     35 
     36      Date: 02/05/2002
     37 
     38 ------------------------------------------------------------------------------
     39  REVISION HISTORY
     40 
     41  Description: Placed header file in the proper template format.  Added
     42  parameter pOverflow for the basic math ops.
     43 
     44  Description:  Replaced "int" and/or "char" with OSCL defined types.
     45 
     46  Description: Moved _cplusplus #ifdef after Include section.
     47 
     48  Description:
     49 
     50 ------------------------------------------------------------------------------
     51  INCLUDE DESCRIPTION
     52 
     53  This file contains all the constant definitions and prototype definitions
     54  needed by the cl_ltp.c
     55 
     56 ------------------------------------------------------------------------------
     57 */
     58 
     59 /*----------------------------------------------------------------------------
     60 ; CONTINUE ONLY IF NOT ALREADY DEFINED
     61 ----------------------------------------------------------------------------*/
     62 #ifndef cl_ltp_h
     63 #define cl_ltp_h "$Id $"
     64 
     65 
     66 /*----------------------------------------------------------------------------
     67 ; INCLUDES
     68 ----------------------------------------------------------------------------*/
     69 #include "typedef.h"
     70 #include "mode.h"
     71 #include "pitch_fr.h"
     72 #include "ton_stab.h"
     73 
     74 /*--------------------------------------------------------------------------*/
     75 #ifdef __cplusplus
     76 extern "C"
     77 {
     78 #endif
     79 
     80     /*----------------------------------------------------------------------------
     81     ; MACROS
     82     ; Define module specific macros here
     83     ----------------------------------------------------------------------------*/
     84 
     85     /*----------------------------------------------------------------------------
     86     ; DEFINES
     87     ; Include all pre-processor statements here.
     88     ----------------------------------------------------------------------------*/
     89 
     90     /*----------------------------------------------------------------------------
     91     ; EXTERNAL VARIABLES REFERENCES
     92     ; Declare variables used in this module but defined elsewhere
     93     ----------------------------------------------------------------------------*/
     94 
     95     /*----------------------------------------------------------------------------
     96     ; SIMPLE TYPEDEF'S
     97     ----------------------------------------------------------------------------*/
     98 
     99     /*----------------------------------------------------------------------------
    100     ; ENUMERATED TYPEDEF'S
    101     ----------------------------------------------------------------------------*/
    102 
    103     /*----------------------------------------------------------------------------
    104     ; STRUCTURES TYPEDEF'S
    105     ----------------------------------------------------------------------------*/
    106 
    107     /* state variable */
    108     typedef struct
    109     {
    110         Pitch_frState *pitchSt;
    111     } clLtpState;
    112 
    113     /*----------------------------------------------------------------------------
    114     ; GLOBAL FUNCTION DEFINITIONS
    115     ; Function Prototype declaration
    116     ----------------------------------------------------------------------------*/
    117     Word16 cl_ltp_init(clLtpState **st);
    118     /* initialize one instance of the pre processing state.
    119        Stores pointer to filter status struct in *st. This pointer has to
    120        be passed to cl_ltp in each call.
    121        returns 0 on success
    122      */
    123 
    124     Word16 cl_ltp_reset(clLtpState *st);
    125     /* reset of pre processing state (i.e. set state memory to zero)
    126        returns 0 on success
    127      */
    128     void cl_ltp_exit(clLtpState **st);
    129     /* de-initialize pre processing state (i.e. free status struct)
    130        stores NULL in *st
    131      */
    132 
    133     void cl_ltp(
    134         clLtpState *clSt,    /* i/o : State struct                              */
    135         tonStabState *tonSt, /* i/o : State struct                              */
    136         enum Mode mode,      /* i   : coder mode                                */
    137         Word16 frameOffset,  /* i   : Offset to subframe                        */
    138         Word16 T_op[],       /* i   : Open loop pitch lags                      */
    139         Word16 *h1,          /* i   : Impulse response vector               Q12 */
    140         Word16 *exc,         /* i/o : Excitation vector                      Q0 */
    141         Word16 res2[],       /* i/o : Long term prediction residual          Q0 */
    142         Word16 xn[],         /* i   : Target vector for pitch search         Q0 */
    143         Word16 lsp_flag,     /* i   : LSP resonance flag                        */
    144         Word16 xn2[],        /* o   : Target vector for codebook search      Q0 */
    145         Word16 y1[],         /* o   : Filtered adaptive excitation           Q0 */
    146         Word16 *T0,          /* o   : Pitch delay (integer part)                */
    147         Word16 *T0_frac,     /* o   : Pitch delay (fractional part)             */
    148         Word16 *gain_pit,    /* o   : Pitch gain                            Q14 */
    149         Word16 g_coeff[],    /* o   : Correlations between xn, y1, & y2         */
    150         Word16 **anap,       /* o   : Analysis parameters                       */
    151         Word16 *gp_limit,    /* o   : pitch gain limit                          */
    152         Flag   *pOverflow    /* o   : overflow indicator                        */
    153     );
    154 
    155     /*----------------------------------------------------------------------------
    156     ; END
    157     ----------------------------------------------------------------------------*/
    158 #ifdef __cplusplus
    159 }
    160 #endif
    161 
    162 #endif /* _CL_LTP_H_ */
    163 
    164