1e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard/* 2e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** Copyright 2003-2010, VisualOn, Inc. 3e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** 4e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** Licensed under the Apache License, Version 2.0 (the "License"); 5e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** you may not use this file except in compliance with the License. 6e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** You may obtain a copy of the License at 7e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** 8e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** http://www.apache.org/licenses/LICENSE-2.0 9e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** 10e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** Unless required by applicable law or agreed to in writing, software 11e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** distributed under the License is distributed on an "AS IS" BASIS, 12e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** See the License for the specific language governing permissions and 14e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** limitations under the License. 15e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard */ 16e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 17e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 18e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard/*-------------------------------------------------------------------* 19e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard * WB_VAD.H * 20e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard *-------------------------------------------------------------------* 21e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard * Functions and static memory for Voice Activity Detection. * 22e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard *-------------------------------------------------------------------*/ 23e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 24e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#ifndef __WB_VAD_H__ 25e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define __WB_VAD_H__ 26e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 27e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard/****************************************************************************** 28e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard * INCLUDE FILES 29e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ******************************************************************************/ 30e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#include "typedef.h" 31e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#include "wb_vad_c.h" 32e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#include "voMem.h" 33e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 34e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard/****************************************************************************** 35e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard * DEFINITION OF DATA TYPES 36e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ******************************************************************************/ 37e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 38e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgardtypedef struct 39e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard{ 40e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard Word16 bckr_est[COMPLEN]; /* background noise estimate */ 41e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard Word16 ave_level[COMPLEN]; /* averaged input components for stationary */ 42e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard /* estimation */ 43e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard Word16 old_level[COMPLEN]; /* input levels of the previous frame */ 44e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard Word16 sub_level[COMPLEN]; /* input levels calculated at the end of a frame (lookahead) */ 45e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard Word16 a_data5[F_5TH_CNT][2]; /* memory for the filter bank */ 46e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard Word16 a_data3[F_3TH_CNT]; /* memory for the filter bank */ 47e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 48e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard Word16 burst_count; /* counts length of a speech burst */ 49e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard Word16 hang_count; /* hangover counter */ 50e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard Word16 stat_count; /* stationary counter */ 51e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 52e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard /* Note that each of the following two variables holds 15 flags. Each flag reserves 1 bit of the 53e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard * variable. The newest flag is in the bit 15 (assuming that LSB is bit 1 and MSB is bit 16). */ 54e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard Word16 vadreg; /* flags for intermediate VAD decisions */ 55e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard Word16 tone_flag; /* tone detection flags */ 56e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 57e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard Word16 sp_est_cnt; /* counter for speech level estimation */ 58e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard Word16 sp_max; /* maximum level */ 59e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard Word16 sp_max_cnt; /* counts frames that contains speech */ 60e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard Word16 speech_level; /* estimated speech level */ 61e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard Word32 prev_pow_sum; /* power of previous frame */ 62e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 63e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard} VadVars; 64e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 65e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard/******************************************************************************** 66e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard * 67e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard * DECLARATION OF PROTOTYPES 68e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ********************************************************************************/ 69e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 70e2e838afcf03e603a41a0455846eaf9614537c16Mans RullgardWord16 wb_vad_init(VadVars ** st, VO_MEM_OPERATOR *pMemOP); 71e2e838afcf03e603a41a0455846eaf9614537c16Mans RullgardWord16 wb_vad_reset(VadVars * st); 72e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgardvoid wb_vad_exit(VadVars ** st, VO_MEM_OPERATOR *pMemOP); 73e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgardvoid wb_vad_tone_detection(VadVars * st, Word16 p_gain); 74e2e838afcf03e603a41a0455846eaf9614537c16Mans RullgardWord16 wb_vad(VadVars * st, Word16 in_buf[]); 75e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 76e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#endif //__WB_VAD_H__ 77e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 78e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 79