annotate libtwamr/bgnscd.h @ 458:e26b974f7ba3

doc/AMR-study-utils: update for the current situation
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 10 May 2024 18:45:36 +0000
parents 8dfb7cbe6b59
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
308
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 ********************************************************************************
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 *
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * R99 Version 3.3.0
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 * REL-4 Version 4.1.0
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 *
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 ********************************************************************************
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 *
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 * File : bgnscd.h
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 * Purpose : Background noise source charateristic detector (SCD)
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 *
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 ********************************************************************************
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 */
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 #ifndef bgnscd_h
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 #define bgnscd_h "$Id $"
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 /*
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 ********************************************************************************
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 * INCLUDE FILES
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 ********************************************************************************
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 */
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 #include "typedef.h"
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 #include "cnst.h"
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 /*
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 ********************************************************************************
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 * LOCAL VARIABLES AND TABLES
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 ********************************************************************************
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 */
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 #define L_ENERGYHIST 60
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 #define INV_L_FRAME 102
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 /* 2*(160*x)^2 / 65536 where x is FLP values 150,5 and 50 */
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 #define FRAMEENERGYLIMIT 17578 /* 150 */
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 #define LOWERNOISELIMIT 20 /* 5 */
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 #define UPPERNOISELIMIT 1953 /* 50 */
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 /*
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 ********************************************************************************
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 * DEFINITION OF DATA TYPES
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 ********************************************************************************
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 */
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 typedef struct{
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 /* history vector of past synthesis speech energy */
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 Word16 frameEnergyHist[L_ENERGYHIST];
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 /* state flags */
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 Word16 bgHangover; /* counter; number of frames after last speech frame */
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 } Bgn_scdState;
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 /*
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 ********************************************************************************
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 * DECLARATION OF PROTOTYPES
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 ********************************************************************************
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 */
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 /*
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 **************************************************************************
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 *
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 * Function : Bgn_scd_reset
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 * Purpose : Resets state memory
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 * Returns : 0 on success
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 *
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 **************************************************************************
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 */
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 void Bgn_scd_reset (Bgn_scdState *st);
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 /*
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 **************************************************************************
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 *
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 * Function : Bgn_scd
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 * Purpose : Charaterice synthesis speech and detect background noise
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 * Returns : background noise decision; 0 = bgn, 1 = no bgn
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 *
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 **************************************************************************
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 */
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 Word16 Bgn_scd (Bgn_scdState *st, /* i : State variables for bgn SCD */
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 Word16 ltpGainHist[], /* i : LTP gain history */
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 Word16 speech[], /* o : synthesis speech frame */
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 Word16 *voicedHangover /* o : # of frames after last voiced frame */
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 );
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84
8dfb7cbe6b59 libtwamr: integrated up to bgnscd.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 #endif