comparison libtwamr/c_g_aver.h @ 324:dc3b7caa59c4

libtwamr: integrate c_g_aver.c
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 18 Apr 2024 20:05:14 +0000
parents
children
comparison
equal deleted inserted replaced
323:dfd5f159574b 324:dc3b7caa59c4
1 /*
2 ********************************************************************************
3 *
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001
5 * R99 Version 3.3.0
6 * REL-4 Version 4.1.0
7 *
8 ********************************************************************************
9 *
10 * File : c_g_aver.h
11 * Purpose : Background noise source charateristic detector (SCD)
12 *
13 ********************************************************************************
14 */
15 #ifndef c_g_aver_h
16 #define c_g_aver_h "$Id $"
17
18 /*
19 ********************************************************************************
20 * INCLUDE FILES
21 ********************************************************************************
22 */
23 #include "tw_amr.h"
24 #include "typedef.h"
25 #include "cnst.h"
26
27 /*
28 ********************************************************************************
29 * LOCAL VARIABLES AND TABLES
30 ********************************************************************************
31 */
32 #define L_CBGAINHIST 7
33
34 /*
35 ********************************************************************************
36 * DEFINITION OF DATA TYPES
37 ********************************************************************************
38 */
39 typedef struct{
40 /* history vector of past synthesis speech energy */
41 Word16 cbGainHistory[L_CBGAINHIST];
42
43 /* state flags */
44 Word16 hangVar; /* counter; */
45 Word16 hangCount; /* counter; */
46
47 } Cb_gain_averageState;
48
49 /*
50 ********************************************************************************
51 * DECLARATION OF PROTOTYPES
52 ********************************************************************************
53 */
54 /*
55 **************************************************************************
56 *
57 * Function : Cb_gain_average_reset
58 * Purpose : Resets state memory
59 * Returns : 0 on success
60 *
61 **************************************************************************
62 */
63 void Cb_gain_average_reset (Cb_gain_averageState *st);
64
65 /*
66 **************************************************************************
67 *
68 * Function : Cb_gain_average
69 * Purpose : Charaterice synthesis speech and detect background noise
70 * Returns : background noise decision; 0 = bgn, 1 = no bgn
71 *
72 **************************************************************************
73 */
74 Word16 Cb_gain_average (
75 Cb_gain_averageState *st, /* i/o : State variables for CB gain avergeing */
76 enum Mode mode, /* i : AMR mode */
77 Word16 gain_code, /* i : CB gain Q1 */
78 Word16 lsp[], /* i : The LSP for the current frame Q15 */
79 Word16 lspAver[], /* i : The average of LSP for 8 frames Q15 */
80 Word16 bfi, /* i : bad frame indication flag */
81 Word16 prev_bf, /* i : previous bad frame indication flag */
82 Word16 pdfi, /* i : potential degraded bad frame ind flag */
83 Word16 prev_pdf, /* i : prev pot. degraded bad frame ind flag */
84 Word16 inBackgroundNoise, /* i : background noise decision */
85 Word16 voicedHangover /* i : # of frames after last voiced frame */
86 );
87
88 #endif