dtx_dec.h revision 4f1efc098cb5791c3e9f483f2af84aef70d2d0a0
14f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber/* ------------------------------------------------------------------ 24f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber * Copyright (C) 1998-2009 PacketVideo 34f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber * 44f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber * Licensed under the Apache License, Version 2.0 (the "License"); 54f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber * you may not use this file except in compliance with the License. 64f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber * You may obtain a copy of the License at 74f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber * 84f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber * http://www.apache.org/licenses/LICENSE-2.0 94f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber * 104f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber * Unless required by applicable law or agreed to in writing, software 114f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber * distributed under the License is distributed on an "AS IS" BASIS, 124f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 134f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber * express or implied. 144f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber * See the License for the specific language governing permissions 154f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber * and limitations under the License. 164f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber * ------------------------------------------------------------------- 174f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber */ 184f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber/**************************************************************************************** 194f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas HuberPortions of this file are derived from the following 3GPP standard: 204f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 214f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 3GPP TS 26.073 224f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 234f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Available from http://www.3gpp.org 244f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 254f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 264f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas HuberPermission to distribute, modify and use this file under the standard license 274f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huberterms listed above has been obtained from the copyright holder. 284f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber****************************************************************************************/ 294f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber/* 304f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber------------------------------------------------------------------------------ 314f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 324f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 334f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 344f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Filename: /audio/gsm_amr/c/include/dtx_dec.h 354f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 364f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Date: 02/06/2002 374f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 384f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber------------------------------------------------------------------------------ 394f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber REVISION HISTORY 404f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 414f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Description: Replaced "int" and/or "char" with OSCL defined types. 424f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 434f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Description: Moved _cplusplus #ifdef after Include section. 444f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 454f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Description: 464f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 474f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber------------------------------------------------------------------------------ 484f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber INCLUDE DESCRIPTION 494f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 504f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber File : dtx_dec.h 514f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Purpose : Decode comfort noice when in DTX 524f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 534f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber------------------------------------------------------------------------------ 544f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber*/ 554f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 564f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber/*---------------------------------------------------------------------------- 574f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber; CONTINUE ONLY IF NOT ALREADY DEFINED 584f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber----------------------------------------------------------------------------*/ 594f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber#ifndef DTX_DEC_H 604f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber#define DTX_DEC_H 614f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber#define dtx_dec_h "$Id $" 624f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 634f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber/*---------------------------------------------------------------------------- 644f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber; INCLUDES 654f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber----------------------------------------------------------------------------*/ 664f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber#include "typedef.h" 674f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber#include "d_plsf.h" 684f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber#include "gc_pred.h" 694f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber#include "c_g_aver.h" 704f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber#include "frame.h" 714f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber#include "dtx_common_def.h" 724f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber/*--------------------------------------------------------------------------*/ 734f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber#ifdef __cplusplus 744f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huberextern "C" 754f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber{ 764f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber#endif 774f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 784f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber /*---------------------------------------------------------------------------- 794f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber ; MACROS 804f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber ; Define module specific macros here 814f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber ----------------------------------------------------------------------------*/ 824f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 834f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber /*---------------------------------------------------------------------------- 844f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber ; DEFINES 854f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber ; Include all pre-processor statements here. 864f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber ----------------------------------------------------------------------------*/ 874f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 884f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber /*---------------------------------------------------------------------------- 894f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber ; EXTERNAL VARIABLES REFERENCES 904f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber ; Declare variables used in this module but defined elsewhere 914f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber ----------------------------------------------------------------------------*/ 924f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 934f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber /*---------------------------------------------------------------------------- 944f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber ; SIMPLE TYPEDEF'S 954f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber ----------------------------------------------------------------------------*/ 964f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 974f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 984f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber /*---------------------------------------------------------------------------- 994f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber ; ENUMERATED TYPEDEF'S 1004f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber ----------------------------------------------------------------------------*/ 1014f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber enum DTXStateType {SPEECH = 0, DTX, DTX_MUTE}; 1024f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 1034f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber /*---------------------------------------------------------------------------- 1044f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber ; STRUCTURES TYPEDEF'S 1054f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber ----------------------------------------------------------------------------*/ 1064f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber typedef struct 1074f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber { 1084f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word16 since_last_sid; 1094f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word16 true_sid_period_inv; 1104f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word16 log_en; 1114f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word16 old_log_en; 1124f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word32 L_pn_seed_rx; 1134f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word16 lsp[M]; 1144f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word16 lsp_old[M]; 1154f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 1164f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word16 lsf_hist[M*DTX_HIST_SIZE]; 1174f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word16 lsf_hist_ptr; 1184f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word16 lsf_hist_mean[M*DTX_HIST_SIZE]; 1194f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word16 log_pg_mean; 1204f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word16 log_en_hist[DTX_HIST_SIZE]; 1214f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word16 log_en_hist_ptr; 1224f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 1234f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word16 log_en_adjust; 1244f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 1254f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word16 dtxHangoverCount; 1264f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word16 decAnaElapsedCount; 1274f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 1284f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word16 sid_frame; 1294f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word16 valid_data; 1304f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word16 dtxHangoverAdded; 1314f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 1324f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber enum DTXStateType dtxGlobalState; /* contains previous state */ 1334f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber /* updated in main decoder */ 1344f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 1354f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word16 data_updated; /* marker to know if CNI data is ever renewed */ 1364f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 1374f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber } dtx_decState; 1384f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 1394f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber /*---------------------------------------------------------------------------- 1404f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber ; GLOBAL FUNCTION DEFINITIONS 1414f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber ; Function Prototype declaration 1424f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber ----------------------------------------------------------------------------*/ 1434f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 1444f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber /* 1454f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber * Function : dtx_dec_reset 1464f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber * Purpose : Resets state memory 1474f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber * Returns : 0 on success 1484f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber */ 1494f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word16 dtx_dec_reset(dtx_decState *st); 1504f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 1514f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber /* 1524f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber * Function : dtx_dec 1534f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber * Purpose : 1544f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber * Description : 1554f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber */ 1564f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber void dtx_dec( 1574f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber dtx_decState *st, /* i/o : State struct */ 1584f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word16 mem_syn[], /* i/o : AMR decoder state */ 1594f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber D_plsfState* lsfState, /* i/o : decoder lsf states */ 1604f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber gc_predState* predState, /* i/o : prediction states */ 1614f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Cb_gain_averageState* averState, /* i/o : CB gain average states */ 1624f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber enum DTXStateType new_state, /* i : new DTX state */ 1634f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber enum Mode mode, /* i : AMR mode */ 1644f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word16 parm[], /* i : Vector of synthesis parameters */ 1654f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word16 synth[], /* o : synthesised speech */ 1664f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word16 A_t[], /* o : decoded LP filter in 4 subframes*/ 1674f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Flag *pOverflow 1684f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber ); 1694f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 1704f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber void dtx_dec_activity_update(dtx_decState *st, 1714f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word16 lsf[], 1724f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Word16 frame[], 1734f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Flag *pOverflow); 1744f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 1754f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber /* 1764f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber * Function : rx_dtx_handler 1774f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber * Purpose : reads the frame type and checks history 1784f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber * Description : to decide what kind of DTX/CNI action to perform 1794f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber */ 1804f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber enum DTXStateType rx_dtx_handler(dtx_decState *st, /* i/o : State struct */ 1814f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber enum RXFrameType frame_type,/* i : Frame type */ 1824f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber Flag *pOverflow); 1834f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 1844f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber /*---------------------------------------------------------------------------- 1854f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber ; END 1864f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber ----------------------------------------------------------------------------*/ 1874f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber#ifdef __cplusplus 1884f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber} 1894f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber#endif 1904f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber 1914f1efc098cb5791c3e9f483f2af84aef70d2d0a0Andreas Huber#endif /* DEC_AMR_H_ */ 192