FreeCalypso > hg > gsm-codec-lib
annotate libgsmefr/dtx_dec.c @ 215:4c4649a5fec3
amrconv: new program amr-cod2ietf
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 21 Apr 2023 06:30:29 +0000 |
parents | 17f690749099 |
children |
rev | line source |
---|---|
119
c1d53064b410
libgsmefr: split dtx.c into dtx_{common,dec,enc}.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
67
diff
changeset
|
1 /* |
c1d53064b410
libgsmefr: split dtx.c into dtx_{common,dec,enc}.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
67
diff
changeset
|
2 * This file is a product of splitting ETSI EFR dtx.c into parts; |
c1d53064b410
libgsmefr: split dtx.c into dtx_{common,dec,enc}.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
67
diff
changeset
|
3 * the present module is the decoder-specific part. |
c1d53064b410
libgsmefr: split dtx.c into dtx_{common,dec,enc}.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
67
diff
changeset
|
4 */ |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
6 #include "gsm_efr.h" |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include "typedef.h" |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
8 #include "namespace.h" |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include "basic_op.h" |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include "cnst.h" |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include "sig_proc.h" |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
12 #include "memops.h" |
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
13 #include "no_count.h" |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 #include "dtx.h" |
119
c1d53064b410
libgsmefr: split dtx.c into dtx_{common,dec,enc}.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
67
diff
changeset
|
15 #include "dtx_defs.h" |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
16 #include "dec_state.h" |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 /************************************************************************* |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 * FUNCTION NAME: reset_rx_dtx |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 * PURPOSE: Resets the static variables of the RX DTX handler to their |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 * initial values |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 *************************************************************************/ |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
27 void reset_rx_dtx (struct EFR_decoder_state *st) |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 { |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 Word16 i; |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 /* suppose infinitely long speech period before start */ |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
33 st->rxdtx_aver_period = DTX_HANGOVER; |
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
34 st->rxdtx_N_elapsed = 0x7fff; |
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
35 st->rxdtx_ctrl = RX_SP_FLAG; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 for (i = 0; i < DTX_HANGOVER; i++) |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 { |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
39 st->lsf_old_rx[i][0] = 1384; |
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
40 st->lsf_old_rx[i][1] = 2077; |
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
41 st->lsf_old_rx[i][2] = 3420; |
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
42 st->lsf_old_rx[i][3] = 5108; |
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
43 st->lsf_old_rx[i][4] = 6742; |
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
44 st->lsf_old_rx[i][5] = 8122; |
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
45 st->lsf_old_rx[i][6] = 9863; |
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
46 st->lsf_old_rx[i][7] = 11092; |
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
47 st->lsf_old_rx[i][8] = 12714; |
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
48 st->lsf_old_rx[i][9] = 13701; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 for (i = 0; i < 4 * DTX_HANGOVER; i++) |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 { |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
53 st->gain_code_old_rx[i] = 0; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
56 st->L_pn_seed_rx = PN_INITIAL_SEED; |
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
57 st->rx_dtx_state = CN_INT_PERIOD - 1; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
59 st->prev_SID_frames_lost = 0; |
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
60 st->buf_p_rx = 0; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 return; |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 /************************************************************************* |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 * FUNCTION NAME: rx_dtx |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 * PURPOSE: DTX handler of the speech decoder. Determines when to update |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 * the reference comfort noise parameters (LSF and gain) at the |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 * end of the speech burst. Also classifies the incoming frames |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 * according to SID flag and BFI flag |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 * and determines when the transmission is active during comfort |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 * noise insertion. This function also initializes the pseudo |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 * noise generator shift register. |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 * Operation of the RX DTX handler is based on measuring the |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 * lengths of speech bursts and the lengths of the pauses between |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 * speech bursts to determine when there exists a hangover period |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 * at the end of a speech burst. The idea is to keep in sync with |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 * the TX DTX handler to be able to update the reference comfort |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 * noise parameters at the same time instances. |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 * INPUTS: *rxdtx_ctrl Old decoder DTX control word |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 * TAF Time alignment flag |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 * bfi Bad frame indicator flag |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 * SID_flag Silence descriptor flag |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 * OUTPUTS: *rxdtx_ctrl Updated decoder DTX control word |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 * rx_dtx_state Updated state of comfort noise interpolation |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 * period (global variable) |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 * L_pn_seed_rx Initialized pseudo noise generator shift |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 * register (global variable) |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 * RETURN VALUE: none |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 *************************************************************************/ |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 void rx_dtx ( |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
100 struct EFR_decoder_state *st, |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 Word16 TAF, |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 Word16 bfi, |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 Word16 SID_flag |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 ) |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 { |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 Word16 frame_type; |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 /* Frame classification according to bfi-flag and ternary-valued |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 SID flag. The frames between SID updates (not actually trans- |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 mitted) are also classified here; they will be discarded later |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 and provided with "NO TRANSMISSION"-flag */ |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 |
192
0303ba213e1c
libgsmefr/dtx_dec.c: perf opt
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
113 if ((SID_flag == 2) && (bfi == 0)) |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 { |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 frame_type = VALID_SID_FRAME; move16 (); |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 else if ((SID_flag == 0) && (bfi == 0)) |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 { |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 frame_type = GOOD_SPEECH_FRAME; move16 (); |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 else if ((SID_flag == 0) && (bfi != 0)) |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 { |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 frame_type = UNUSABLE_FRAME; move16 (); |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 else |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 { |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 frame_type = INVALID_SID_FRAME; move16 (); |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 /* Update of decoder state */ |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 /* Previous frame was classified as a speech frame */ |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
132 if ((st->rxdtx_ctrl & RX_SP_FLAG) != 0) |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 { |
192
0303ba213e1c
libgsmefr/dtx_dec.c: perf opt
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
134 if (frame_type == VALID_SID_FRAME) |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 { |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
136 st->rxdtx_ctrl = RX_FIRST_SID_UPDATE; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 } |
192
0303ba213e1c
libgsmefr/dtx_dec.c: perf opt
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
138 else if (frame_type == INVALID_SID_FRAME) |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 { |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
140 st->rxdtx_ctrl = RX_FIRST_SID_UPDATE |
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
141 | RX_INVALID_SID_FRAME; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 } |
192
0303ba213e1c
libgsmefr/dtx_dec.c: perf opt
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
143 else if (frame_type == UNUSABLE_FRAME) |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 { |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
145 st->rxdtx_ctrl = RX_SP_FLAG; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 } |
192
0303ba213e1c
libgsmefr/dtx_dec.c: perf opt
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
147 else if (frame_type == GOOD_SPEECH_FRAME) |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 { |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
149 st->rxdtx_ctrl = RX_SP_FLAG; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 else |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 { |
192
0303ba213e1c
libgsmefr/dtx_dec.c: perf opt
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
154 if (frame_type == VALID_SID_FRAME) |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 { |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
156 st->rxdtx_ctrl = RX_CONT_SID_UPDATE; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 } |
192
0303ba213e1c
libgsmefr/dtx_dec.c: perf opt
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
158 else if (frame_type == INVALID_SID_FRAME) |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 { |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
160 st->rxdtx_ctrl = RX_CONT_SID_UPDATE |
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
161 | RX_INVALID_SID_FRAME; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 } |
192
0303ba213e1c
libgsmefr/dtx_dec.c: perf opt
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
163 else if (frame_type == UNUSABLE_FRAME) |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 { |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
165 st->rxdtx_ctrl = RX_CNI_BFI; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
166 } |
192
0303ba213e1c
libgsmefr/dtx_dec.c: perf opt
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
167 else if (frame_type == GOOD_SPEECH_FRAME) |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
168 { |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
169 /* If the previous frame (during CNI period) was muted, |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
170 raise the RX_PREV_DTX_MUTING flag */ |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
171 if ((st->rxdtx_ctrl & RX_DTX_MUTING) != 0) |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
172 { |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
173 st->rxdtx_ctrl = RX_SP_FLAG | RX_FIRST_SP_FLAG |
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
174 | RX_PREV_DTX_MUTING; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
175 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
176 else |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
177 { |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
178 st->rxdtx_ctrl = RX_SP_FLAG | RX_FIRST_SP_FLAG; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
179 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
180 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
181 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
182 |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
183 if ((st->rxdtx_ctrl & RX_SP_FLAG) != 0) |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
184 { |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
185 st->prev_SID_frames_lost = 0; |
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
186 st->rx_dtx_state = CN_INT_PERIOD - 1; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
187 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
188 else |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
189 { |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
190 /* First SID frame */ |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
191 if ((st->rxdtx_ctrl & RX_FIRST_SID_UPDATE) != 0) |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
192 { |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
193 st->prev_SID_frames_lost = 0; |
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
194 st->rx_dtx_state = CN_INT_PERIOD - 1; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
195 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
196 |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
197 /* SID frame detected, but not the first SID */ |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
198 if ((st->rxdtx_ctrl & RX_CONT_SID_UPDATE) != 0) |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
199 { |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
200 st->prev_SID_frames_lost = 0; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
201 |
192
0303ba213e1c
libgsmefr/dtx_dec.c: perf opt
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
202 if (frame_type == VALID_SID_FRAME) |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
203 { |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
204 st->rx_dtx_state = 0; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
205 } |
192
0303ba213e1c
libgsmefr/dtx_dec.c: perf opt
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
206 else if (frame_type == INVALID_SID_FRAME) |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
207 { |
192
0303ba213e1c
libgsmefr/dtx_dec.c: perf opt
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
208 if (st->rx_dtx_state < (CN_INT_PERIOD - 1)) |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
209 { |
192
0303ba213e1c
libgsmefr/dtx_dec.c: perf opt
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
210 st->rx_dtx_state++; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
211 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
212 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
213 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
214 |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
215 /* Bad frame received in CNI mode */ |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
216 if ((st->rxdtx_ctrl & RX_CNI_BFI) != 0) |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
217 { |
192
0303ba213e1c
libgsmefr/dtx_dec.c: perf opt
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
218 if (st->rx_dtx_state < (CN_INT_PERIOD - 1)) |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
219 { |
192
0303ba213e1c
libgsmefr/dtx_dec.c: perf opt
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
220 st->rx_dtx_state++; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
221 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
222 |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
223 /* If an unusable frame is received during CNI period |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
224 when TAF == 1, the frame is classified as a lost |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
225 SID frame */ |
205
17f690749099
libgsmefr decoder: TAF is a Boolean flag, so compare against 0,
Mychaela Falconia <falcon@freecalypso.org>
parents:
192
diff
changeset
|
226 if (TAF) |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
227 { |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
228 st->rxdtx_ctrl = st->rxdtx_ctrl | RX_LOST_SID_FRAME; |
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
229 st->prev_SID_frames_lost = add (st->prev_SID_frames_lost, 1); |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
230 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
231 else /* No transmission occurred */ |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
232 { |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
233 st->rxdtx_ctrl = st->rxdtx_ctrl | RX_NO_TRANSMISSION; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
234 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
235 |
192
0303ba213e1c
libgsmefr/dtx_dec.c: perf opt
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
236 if (st->prev_SID_frames_lost > 1) |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
237 { |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
238 st->rxdtx_ctrl = st->rxdtx_ctrl | RX_DTX_MUTING; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
239 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
240 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
241 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
242 |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
243 /* N_elapsed (frames since last SID update) is incremented. If SID |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
244 is updated N_elapsed is cleared later in this function */ |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
245 |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
246 st->rxdtx_N_elapsed = add (st->rxdtx_N_elapsed, 1); |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
247 |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
248 if ((st->rxdtx_ctrl & RX_SP_FLAG) != 0) |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
249 { |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
250 st->rxdtx_aver_period = DTX_HANGOVER; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
251 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
252 else |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
253 { |
192
0303ba213e1c
libgsmefr/dtx_dec.c: perf opt
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
254 if (st->rxdtx_N_elapsed > DTX_ELAPSED_THRESHOLD) |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
255 { |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
256 st->rxdtx_ctrl |= RX_UPD_SID_QUANT_MEM; |
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
257 st->rxdtx_N_elapsed = 0; |
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
258 st->rxdtx_aver_period = 0; |
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
259 st->L_pn_seed_rx = PN_INITIAL_SEED; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
260 } |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
261 else if (st->rxdtx_aver_period == 0) |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
262 { |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
263 st->rxdtx_N_elapsed = 0; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
264 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
265 else |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
266 { |
192
0303ba213e1c
libgsmefr/dtx_dec.c: perf opt
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
267 st->rxdtx_aver_period--; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
268 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
269 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
270 |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
271 return; |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
272 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
273 |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
274 /************************************************************************* |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
275 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
276 * FUNCTION NAME: update_gain_code_history_rx |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
277 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
278 * PURPOSE: Update the fixed codebook gain parameter history of the |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
279 * decoder. The fixed codebook gain parameters kept in the buffer |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
280 * are used later for computing the reference fixed codebook |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
281 * gain parameter value. |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
282 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
283 * INPUTS: new_gain_code New fixed codebook gain value |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
284 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
285 * gain_code_old_tx[0..4*DTX_HANGOVER-1] |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
286 * Old fixed codebook gain history of decoder |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
287 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
288 * OUTPUTS: gain_code_old_tx[0..4*DTX_HANGOVER-1] |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
289 * Updated fixed codebk gain history of decoder |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
290 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
291 * RETURN VALUE: none |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
292 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
293 *************************************************************************/ |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
294 |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
295 void update_gain_code_history_rx ( |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
296 struct EFR_decoder_state *st, |
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
297 Word16 new_gain_code |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
298 ) |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
299 { |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
300 /* Circular buffer */ |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
301 st->gain_code_old_rx[st->buf_p_rx] = new_gain_code; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
302 |
192
0303ba213e1c
libgsmefr/dtx_dec.c: perf opt
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
303 if (st->buf_p_rx == (4 * DTX_HANGOVER - 1)) |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
304 { |
67
58b64224d4ac
libgsmefr: dtx.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
305 st->buf_p_rx = 0; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
306 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
307 else |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
308 { |
192
0303ba213e1c
libgsmefr/dtx_dec.c: perf opt
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
309 st->buf_p_rx++; |
66
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
310 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
311 |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
312 return; |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
313 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
314 |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
315 /************************************************************************* |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
316 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
317 * FUNCTION NAME: interpolate_CN_param |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
318 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
319 * PURPOSE: Interpolate a comfort noise parameter value over the comfort |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
320 * noise update period. |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
321 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
322 * INPUTS: old_param The older parameter of the interpolation |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
323 * (the endpoint the interpolation is started |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
324 * from) |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
325 * new_param The newer parameter of the interpolation |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
326 * (the endpoint the interpolation is ended to) |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
327 * rx_dtx_state State of the comfort noise insertion period |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
328 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
329 * OUTPUTS: none |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
330 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
331 * RETURN VALUE: Interpolated CN parameter value |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
332 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
333 *************************************************************************/ |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
334 |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
335 Word16 interpolate_CN_param ( |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
336 Word16 old_param, |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
337 Word16 new_param, |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
338 Word16 rx_dtx_state |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
339 ) |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
340 { |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
341 static const Word16 interp_factor[CN_INT_PERIOD] = |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
342 { |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
343 0x0555, 0x0aaa, 0x1000, 0x1555, 0x1aaa, 0x2000, |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
344 0x2555, 0x2aaa, 0x3000, 0x3555, 0x3aaa, 0x4000, |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
345 0x4555, 0x4aaa, 0x5000, 0x5555, 0x5aaa, 0x6000, |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
346 0x6555, 0x6aaa, 0x7000, 0x7555, 0x7aaa, 0x7fff}; |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
347 Word16 temp; |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
348 Word32 L_temp; |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
349 |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
350 L_temp = L_mult (interp_factor[rx_dtx_state], new_param); |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
351 temp = sub (0x7fff, interp_factor[rx_dtx_state]); |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
352 temp = add (temp, 1); |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
353 L_temp = L_mac (L_temp, temp, old_param); |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
354 temp = round (L_temp); |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
355 |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
356 return temp; |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
357 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
358 |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
359 /************************************************************************* |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
360 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
361 * FUNCTION NAME: interpolate_CN_lsf |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
362 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
363 * PURPOSE: Interpolate comfort noise LSF parameter vector over the comfort |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
364 * noise update period. |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
365 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
366 * INPUTS: lsf_old_CN[0..9] |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
367 * The older LSF parameter vector of the |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
368 * interpolation (the endpoint the interpolation |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
369 * is started from) |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
370 * lsf_new_CN[0..9] |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
371 * The newer LSF parameter vector of the |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
372 * interpolation (the endpoint the interpolation |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
373 * is ended to) |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
374 * rx_dtx_state State of the comfort noise insertion period |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
375 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
376 * OUTPUTS: lsf_interp_CN[0..9] |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
377 * Interpolated LSF parameter vector |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
378 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
379 * RETURN VALUE: none |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
380 * |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
381 *************************************************************************/ |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
382 |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
383 void interpolate_CN_lsf ( |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
384 Word16 lsf_old_CN[M], |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
385 Word16 lsf_new_CN[M], |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
386 Word16 lsf_interp_CN[M], |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
387 Word16 rx_dtx_state |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
388 ) |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
389 { |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
390 Word16 i; |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
391 |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
392 for (i = 0; i < M; i++) |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
393 { |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
394 lsf_interp_CN[i] = interpolate_CN_param (lsf_old_CN[i], |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
395 lsf_new_CN[i], |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
396 rx_dtx_state); move16 (); |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
397 } |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
398 |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
399 return; |
824ff833bda9
libgsmefr/dtx.c: initial import from ETSI code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
400 } |