Home | History | Annotate | Download | only in inc
      1 /*
      2  ** Copyright 2003-2010, VisualOn, Inc.
      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 express or implied.
     13  ** See the License for the specific language governing permissions and
     14  ** limitations under the License.
     15  */
     16 
     17 
     18 /*-------------------------------------------------------------------*
     19  *                         WB_VAD.H                                  *
     20  *-------------------------------------------------------------------*
     21  * Functions and static memory for Voice Activity Detection.         *
     22  *-------------------------------------------------------------------*/
     23 
     24 #ifndef __WB_VAD_H__
     25 #define __WB_VAD_H__
     26 
     27 /******************************************************************************
     28  *                         INCLUDE FILES
     29  ******************************************************************************/
     30 #include "typedef.h"
     31 #include "wb_vad_c.h"
     32 #include "voMem.h"
     33 
     34 /******************************************************************************
     35  *                         DEFINITION OF DATA TYPES
     36  ******************************************************************************/
     37 
     38 typedef struct
     39 {
     40 	Word16 bckr_est[COMPLEN];              /* background noise estimate                */
     41 	Word16 ave_level[COMPLEN];             /* averaged input components for stationary */
     42 	/* estimation                               */
     43 	Word16 old_level[COMPLEN];             /* input levels of the previous frame       */
     44 	Word16 sub_level[COMPLEN];             /* input levels calculated at the end of a frame (lookahead)  */
     45 	Word16 a_data5[F_5TH_CNT][2];          /* memory for the filter bank               */
     46 	Word16 a_data3[F_3TH_CNT];             /* memory for the filter bank               */
     47 
     48 	Word16 burst_count;                    /* counts length of a speech burst          */
     49 	Word16 hang_count;                     /* hangover counter                         */
     50 	Word16 stat_count;                     /* stationary counter                       */
     51 
     52 	/* Note that each of the following two variables holds 15 flags. Each flag reserves 1 bit of the
     53 	 * variable. The newest flag is in the bit 15 (assuming that LSB is bit 1 and MSB is bit 16). */
     54 	Word16 vadreg;                         /* flags for intermediate VAD decisions     */
     55 	Word16 tone_flag;                      /* tone detection flags                     */
     56 
     57 	Word16 sp_est_cnt;                     /* counter for speech level estimation      */
     58 	Word16 sp_max;                         /* maximum level                            */
     59 	Word16 sp_max_cnt;                     /* counts frames that contains speech       */
     60 	Word16 speech_level;                   /* estimated speech level                   */
     61 	Word32 prev_pow_sum;                   /* power of previous frame                  */
     62 
     63 } VadVars;
     64 
     65 /********************************************************************************
     66  *
     67  * DECLARATION OF PROTOTYPES
     68  ********************************************************************************/
     69 
     70 Word16 wb_vad_init(VadVars ** st, VO_MEM_OPERATOR *pMemOP);
     71 Word16 wb_vad_reset(VadVars * st);
     72 void wb_vad_exit(VadVars ** st, VO_MEM_OPERATOR *pMemOP);
     73 void wb_vad_tone_detection(VadVars * st, Word16 p_gain);
     74 Word16 wb_vad(VadVars * st, Word16 in_buf[]);
     75 
     76 #endif  //__WB_VAD_H__
     77 
     78 
     79