FreeCalypso > hg > gsm-codec-lib
annotate libgsmefr/dec_state.h @ 183:452c1d5a6268
libgsmefr BFI w/o data: emit zero output after decoder reset
In real-life usage, each EFR decoder session will most likely begin
with lots of BFI frames before the first real frame arrives. However,
because the spec-defined home state of the decoder is speech rather
than CN, our regular logic for BFI w/o data would have to feed
pseudorandom noise to the decoder (in the "fixed codebook excitation
pulses" part), which is silly to do at the beginning of the decoder
session right out of reset. Therefore, let's check reset_flag_old,
and if we are still in the reset state, simply emit zero output.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 03 Jan 2023 00:12:18 +0000 |
parents | eefef9f6d533 |
children |
rev | line source |
---|---|
42
ba044871c9dd
libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
ba044871c9dd
libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * In this header file we define our decoder state structure. |
ba044871c9dd
libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * This decoder state structure is internal to libgsmefr, |
ba044871c9dd
libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * NOT part of our external public interface! |
ba044871c9dd
libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 */ |
ba044871c9dd
libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 |
ba044871c9dd
libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 struct EFR_decoder_state { |
ba044871c9dd
libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 /* from agc.c */ |
ba044871c9dd
libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 Word16 past_gain; |
49
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
10 /* from decoder.c */ |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
11 Word16 synth_buf[L_FRAME + M]; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
12 Word16 reset_flag_old; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
13 /* from dec_12k2.c */ |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
14 Word16 old_exc[L_FRAME + PIT_MAX + L_INTERPOL]; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
15 Word16 lsp_old[M]; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
16 Word16 mem_syn[M]; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
17 Word16 prev_bf; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
18 Word16 bf_state; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
19 /* from d_plsf_5.c */ |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
20 Word16 past_r2_q[M]; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
21 Word16 past_lsf_q[M]; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
22 Word16 lsf_p_CN[M]; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
23 Word16 lsf_old_CN[M]; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
24 Word16 lsf_new_CN[M]; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
25 /* from d_gains.c */ |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
26 Word16 pbuf[5]; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
27 Word16 past_gain_pit; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
28 Word16 prev_gp; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
29 Word16 gbuf[5]; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
30 Word16 past_gain_code; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
31 Word16 prev_gc; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
32 Word16 gcode0_CN; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
33 Word16 gain_code_old_CN; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
34 Word16 gain_code_new_CN; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
35 Word16 gain_code_muting_CN; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
36 Word16 past_qua_en[4]; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
37 Word16 pred[4]; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
38 /* from dtx.c */ |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
39 Word16 rxdtx_ctrl; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
40 Word32 L_pn_seed_rx; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
41 Word16 rx_dtx_state; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
42 Word16 rxdtx_aver_period; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
43 Word16 rxdtx_N_elapsed; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
44 Word16 prev_SID_frames_lost; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
45 Word16 buf_p_rx; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
46 Word16 lsf_old_rx[DTX_HANGOVER][M]; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
47 Word16 gain_code_old_rx[4 * DTX_HANGOVER]; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
48 /* from dec_lag6.c */ |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
49 Word16 old_T0; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
50 /* from preemph.c */ |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
51 Word16 mem_pre; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
52 /* from pstfilt2.c */ |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
53 Word16 res2[L_SUBFR]; |
dd79ec84283d
libgsmefr: decoder state structure filled in
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
54 Word16 mem_syn_pst[M]; |
160
eefef9f6d533
libgsmefr: randomize d1035pf params in no-data BFI case
Mychaela Falconia <falcon@freecalypso.org>
parents:
49
diff
changeset
|
55 /* our own addition */ |
eefef9f6d533
libgsmefr: randomize d1035pf params in no-data BFI case
Mychaela Falconia <falcon@freecalypso.org>
parents:
49
diff
changeset
|
56 Word32 L_pn_seed_nodata; |
42
ba044871c9dd
libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 }; |