annotate libtwamr/ton_stab.h @ 514:67b13a6a63c9

libgsmhr1: implement validation for *.dec frames
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 25 Aug 2024 19:14:40 +0000
parents 8fff74ca83e8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
405
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 ********************************************************************************
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 *
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * R99 Version 3.3.0
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 * REL-4 Version 4.1.0
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 *
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 ********************************************************************************
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 *
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 * File : ton_stab.h
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 * Purpose : Tone stabilization routines
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 *
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 ********************************************************************************
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 */
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 #ifndef ton_stab_h
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 #define ton_stab_h "$Id $"
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 /*
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 ********************************************************************************
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 * INCLUDE FILES
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 ********************************************************************************
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 */
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 #include "tw_amr.h"
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 #include "typedef.h"
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 #include "cnst.h"
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 /*
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 ********************************************************************************
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 * LOCAL VARIABLES AND TABLES
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 ********************************************************************************
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 */
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 /*
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 ********************************************************************************
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 * DEFINITION OF DATA TYPES
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 ********************************************************************************
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 */
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 /* state variable */
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 typedef struct {
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 /* counters */
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 Word16 count;
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 /* gain history Q11 */
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 Word16 gp[N_FRAME];
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 } tonStabState;
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 /*
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 ********************************************************************************
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 * DECLARATION OF PROTOTYPES
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 ********************************************************************************
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 */
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 void ton_stab_reset (tonStabState *st);
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 /* reset of pre processing state (i.e. set state memory to zero)
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 returns 0 on success
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 */
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 Word16 check_lsp(tonStabState *st, /* i/o : State struct */
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 Word16 *lsp /* i : unquantized LSP's */
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 );
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 Word16 check_gp_clipping(tonStabState *st, /* i/o : State struct */
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 Word16 g_pitch /* i : pitch gain */
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 );
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 void update_gp_clipping(tonStabState *st, /* i/o : State struct */
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 Word16 g_pitch /* i : pitch gain */
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 );
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72
8fff74ca83e8 libtwamr: integrate ton_stab.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 #endif