comparison libtwamr/g_adapt.h @ 365:2a265be82195

libtwamr: integrate g_adapt.c
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 06 May 2024 03:01:15 +0000
parents
children
comparison
equal deleted inserted replaced
364:3f27ca24c620 365:2a265be82195
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 : g_adapt.h
11 * Purpose : gain adaptation for MR795 gain quantization
12 *
13 ********************************************************************************
14 */
15
16 /*
17 ********************************************************************************
18 * MODULE INCLUDE FILE AND VERSION ID
19 ********************************************************************************
20 */
21 #ifndef g_adapt_h
22 #define g_adapt_h "$Id $"
23
24 /*
25 ********************************************************************************
26 * INCLUDE FILES
27 ********************************************************************************
28 */
29 #include "typedef.h"
30
31 #define LTPG_MEM_SIZE 5 /* number of stored past LTP coding gains + 1 */
32
33 /*
34 ********************************************************************************
35 * DEFINITION OF DATA TYPES
36 ********************************************************************************
37 */
38 typedef struct {
39 Word16 onset; /* onset state, Q0 */
40 Word16 prev_alpha; /* previous adaptor output, Q15 */
41 Word16 prev_gc; /* previous code gain, Q1 */
42
43 Word16 ltpg_mem[LTPG_MEM_SIZE]; /* LTP coding gain history, Q13 */
44 /* (ltpg_mem[0] not used for history) */
45 } GainAdaptState;
46
47 /*
48 ********************************************************************************
49 * DECLARATION OF PROTOTYPES
50 ********************************************************************************
51 */
52
53 void gain_adapt_reset (GainAdaptState *st);
54 /* reset of gain adaptor state (i.e. set state memory to zero)
55 returns 0 on success
56 */
57
58 /*************************************************************************
59 *
60 * Function: gain_adapt()
61 * Purpose: calculate pitch/codebook gain adaptation factor alpha
62 * (and update the adaptor state)
63 *
64 **************************************************************************
65 */
66 void gain_adapt(
67 GainAdaptState *st, /* i : state struct */
68 Word16 ltpg, /* i : ltp coding gain (log2()), Q */
69 Word16 gain_cod, /* i : code gain, Q13 */
70 Word16 *alpha /* o : gain adaptation factor, Q15 */
71 );
72
73 #endif