annotate libgsmefr/enc_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 77803ce2cc22
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 encoder state structure.
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * This encoder 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_encoder_state {
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 /* from coder.c */
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 Word16 dtx_mode;
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 /* from cod_12k2.c */
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 Word16 old_speech[L_TOTAL];
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 Word16 old_wsp[L_FRAME + PIT_MAX];
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 Word16 old_exc[L_FRAME + PIT_MAX + L_INTERPOL];
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 Word16 ai_zero[L_SUBFR + MP1];
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 Word16 hvec[L_SUBFR * 2];
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 Word16 lsp_old[M];
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 Word16 lsp_old_q[M];
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 Word16 mem_syn[M];
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 Word16 mem_w0[M];
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 Word16 mem_w[M];
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 Word16 mem_err[M + L_SUBFR];
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 /* from levinson.c */
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 Word16 old_A[M + 1];
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 /* from pre_proc.c */
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 struct preproc_state {
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 Word16 y2_hi;
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 Word16 y2_lo;
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 Word16 y1_hi;
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 Word16 y1_lo;
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 Word16 x0;
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 Word16 x1;
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 } pre_proc;
48
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
33 /* from q_plsf_5.c */
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
34 Word16 past_r2_q[M];
89
77803ce2cc22 libgsmefr: q_plsf_5.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 88
diff changeset
35 Word16 lsf_p_CN[M];
48
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
36 /* from q_gains.c */
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
37 Word16 past_qua_en[4];
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
38 Word16 pred[4];
88
03599300d2db libgsmefr: q_gains.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
39 Word16 gcode0_CN;
48
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
40 /* from dtx.c */
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
41 Word16 txdtx_ctrl;
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
42 Word16 CN_excitation_gain;
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
43 Word32 L_pn_seed_tx;
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
44 Word16 txdtx_hangover;
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
45 Word16 txdtx_N_elapsed;
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
46 Word16 old_CN_mem_tx[6];
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
47 Word16 buf_p_tx;
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
48 Word16 lsf_old_tx[DTX_HANGOVER][M];
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
49 Word16 gain_code_old_tx[4 * DTX_HANGOVER];
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
50 /* from vad.c */
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
51 struct vad_state {
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
52 Word16 rvad[9];
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
53 Word16 scal_rvad;
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
54 Pfloat thvad;
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
55 Word32 L_sacf[27];
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
56 Word32 L_sav0[36];
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
57 Word16 pt_sacf;
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
58 Word16 pt_sav0;
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
59 Word32 L_lastdm;
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
60 Word16 adaptcount;
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
61 Word16 burstcount;
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
62 Word16 hangcount;
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
63 Word16 oldlagcount;
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
64 Word16 veryoldlagcount;
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
65 Word16 oldlag;
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
66 } vad;
af4b075d0313 libgsmefr: encoder state structure finished in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 42
diff changeset
67 Word16 ptch;
42
ba044871c9dd libgsmefr: beginning of encoder and decoder state structures
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 };