FreeCalypso > hg > efr-experiments
comparison src/codec.h @ 0:56410792419a
src: original EFR source from ETSI
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Wed, 03 Apr 2024 05:31:37 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:56410792419a |
|---|---|
| 1 void Init_Coder_12k2 (void); | |
| 2 | |
| 3 void Coder_12k2 ( | |
| 4 Word16 ana[], /* output : Analysis parameters */ | |
| 5 Word16 synth[] /* output : Local synthesis */ | |
| 6 ); | |
| 7 | |
| 8 void Init_Decoder_12k2 (void); | |
| 9 | |
| 10 void Decoder_12k2 ( | |
| 11 Word16 parm[], /* input : vector of synthesis parameters | |
| 12 parm[0] = bad frame indicator (bfi) */ | |
| 13 Word16 synth[], /* output: synthesis speech */ | |
| 14 Word16 A_t[], /* output: decoded LP filter in 4 subframes */ | |
| 15 Word16 TAF, | |
| 16 Word16 SID_flag | |
| 17 ); | |
| 18 | |
| 19 void Init_Post_Filter (void); | |
| 20 | |
| 21 void Post_Filter ( | |
| 22 Word16 *syn, /* in/out: synthesis speech (postfiltered is output) */ | |
| 23 Word16 *Az_4 /* input : interpolated LPC parameters in all subfr. */ | |
| 24 ); | |
| 25 | |
| 26 void code_10i40_35bits ( | |
| 27 Word16 x[], /* (i) : target vector */ | |
| 28 Word16 cn[], /* (i) : residual after long term prediction */ | |
| 29 Word16 h[], /* (i) : impulse response of weighted synthesis | |
| 30 filter */ | |
| 31 Word16 cod[], /* (o) : algebraic (fixed) codebook excitation */ | |
| 32 Word16 y[], /* (o) : filtered fixed codebook excitation */ | |
| 33 Word16 indx[] /* (o) : index of 10 pulses (sign + position) */ | |
| 34 ); | |
| 35 void dec_10i40_35bits ( | |
| 36 Word16 index[], /* (i) : index of 10 pulses (sign+position) */ | |
| 37 Word16 cod[] /* (o) : algebraic (fixed) codebook excitation */ | |
| 38 ); | |
| 39 Word16 Dec_lag6 ( /* output: return integer pitch lag */ | |
| 40 Word16 index, /* input : received pitch index */ | |
| 41 Word16 pit_min, /* input : minimum pitch lag */ | |
| 42 Word16 pit_max, /* input : maximum pitch lag */ | |
| 43 Word16 i_subfr, /* input : subframe flag */ | |
| 44 Word16 L_frame_by2,/* input : speech frame size divided by 2 */ | |
| 45 Word16 *T0_frac, /* output: fractional part of pitch lag */ | |
| 46 Word16 bfi /* input : bad frame indicator */ | |
| 47 ); | |
| 48 Word16 d_gain_pitch ( /* out : quantized pitch gain */ | |
| 49 Word16 index, /* in : index of quantization */ | |
| 50 Word16 bfi, /* in : bad frame indicator (good = 0) */ | |
| 51 Word16 state, /* in : state of the state machine */ | |
| 52 Word16 prev_bf, /* Previous bf */ | |
| 53 Word16 rxdtx_ctrl | |
| 54 | |
| 55 ); | |
| 56 void d_gain_code ( | |
| 57 Word16 index, /* input : received quantization index */ | |
| 58 Word16 code[], /* input : innovation codevector */ | |
| 59 Word16 lcode, /* input : codevector length */ | |
| 60 Word16 *gain_code, /* output: decoded innovation gain */ | |
| 61 Word16 bfi, /* input : bad frame indicator */ | |
| 62 Word16 state, /* in : state of the state machine */ | |
| 63 Word16 prev_bf, /* Previous bf */ | |
| 64 Word16 rxdtx_ctrl, | |
| 65 Word16 i_subfr, | |
| 66 Word16 rx_dtx_state | |
| 67 | |
| 68 ); | |
| 69 void D_plsf_5 ( | |
| 70 Word16 *indice, /* input : quantization indices of 5 submatrices */ | |
| 71 Word16 *lsp1_q, /* output: quantized 1st LSP vector */ | |
| 72 Word16 *lsp2_q, /* output: quantized 2nd LSP vector */ | |
| 73 Word16 bfi, /* input : bad frame indicator (set to 1 if a bad | |
| 74 frame is received) */ | |
| 75 Word16 rxdtx_ctrl, | |
| 76 Word16 rx_dtx_state | |
| 77 ); | |
| 78 Word16 Enc_lag6 ( /* output: Return index of encoding */ | |
| 79 Word16 T0, /* input : Pitch delay */ | |
| 80 Word16 *T0_frac, /* in/out: Fractional pitch delay */ | |
| 81 Word16 *T0_min, /* in/out: Minimum search delay */ | |
| 82 Word16 *T0_max, /* in/out: Maximum search delay */ | |
| 83 Word16 pit_min, /* input : Minimum pitch delay */ | |
| 84 Word16 pit_max, /* input : Maximum pitch delay */ | |
| 85 Word16 pit_flag /* input : Flag for 1st or 3rd subframe */ | |
| 86 ); | |
| 87 | |
| 88 Word16 q_gain_pitch ( /* Return index of quantization */ | |
| 89 Word16 *gain /* (i) : Pitch gain to quantize */ | |
| 90 ); | |
| 91 | |
| 92 Word16 q_gain_code ( /* Return quantization index */ | |
| 93 Word16 code[], /* (i) : fixed codebook excitation */ | |
| 94 Word16 lcode, /* (i) : codevector size */ | |
| 95 Word16 *gain, /* (i/o) : quantized fixed codebook gain */ | |
| 96 Word16 txdtx_ctrl, | |
| 97 Word16 i_subfr | |
| 98 ); | |
| 99 | |
| 100 Word16 G_pitch ( /* (o) : Gain of pitch lag saturated to 1.2 */ | |
| 101 Word16 xn[], /* (i) : Pitch target. */ | |
| 102 Word16 y1[], /* (i) : Filtered adaptive codebook. */ | |
| 103 Word16 L_subfr /* : Length of subframe. */ | |
| 104 ); | |
| 105 Word16 G_code ( /* out : Gain of innovation code. */ | |
| 106 Word16 xn[], /* in : target vector */ | |
| 107 Word16 y2[] /* in : filtered inovation vector */ | |
| 108 ); | |
| 109 | |
| 110 Word16 Interpol_6 ( /* (o) : interpolated value */ | |
| 111 Word16 *x, /* (i) : input vector */ | |
| 112 Word16 frac /* (i) : fraction */ | |
| 113 ); | |
| 114 void Int_lpc ( | |
| 115 Word16 lsp_old[], /* input: LSP vector at the 4th subfr. of past frame */ | |
| 116 Word16 lsp_mid[], /* input: LSP vector at the 2nd subfr. of | |
| 117 present frame */ | |
| 118 Word16 lsp_new[], /* input: LSP vector at the 4th subfr. of | |
| 119 present frame */ | |
| 120 Word16 Az[] /* output: interpolated LP parameters in all subfr. */ | |
| 121 ); | |
| 122 void Int_lpc2 ( | |
| 123 Word16 lsp_old[], /* input: LSP vector at the 4th subfr. of past frame */ | |
| 124 Word16 lsp_mid[], /* input: LSP vector at the 2nd subframe of | |
| 125 present frame */ | |
| 126 Word16 lsp_new[], /* input: LSP vector at the 4th subframe of | |
| 127 present frame */ | |
| 128 Word16 Az[] /* output:interpolated LP parameters | |
| 129 in subframes 1 and 3 */ | |
| 130 ); | |
| 131 Word16 Pitch_fr6 ( /* (o) : pitch period. */ | |
| 132 Word16 exc[], /* (i) : excitation buffer */ | |
| 133 Word16 xn[], /* (i) : target vector */ | |
| 134 Word16 h[], /* (i) : impulse response of synthesis and | |
| 135 weighting filters */ | |
| 136 Word16 L_subfr, /* (i) : Length of subframe */ | |
| 137 Word16 t0_min, /* (i) : minimum value in the searched range. */ | |
| 138 Word16 t0_max, /* (i) : maximum value in the searched range. */ | |
| 139 Word16 i_subfr, /* (i) : indicator for first subframe. */ | |
| 140 Word16 *pit_frac /* (o) : chosen fraction. */ | |
| 141 ); | |
| 142 Word16 Pitch_ol ( /* output: open loop pitch lag */ | |
| 143 Word16 signal[], /* input: signal used to compute the open loop pitch */ | |
| 144 /* signal[-pit_max] to signal[-1] should be known */ | |
| 145 Word16 pit_min, /* input : minimum pitch lag */ | |
| 146 Word16 pit_max, /* input : maximum pitch lag */ | |
| 147 Word16 L_frame /* input : length of frame to compute pitch */ | |
| 148 ); | |
| 149 void Pred_lt_6 ( | |
| 150 Word16 exc[], /* in/out: excitation buffer */ | |
| 151 Word16 T0, /* input : integer pitch lag */ | |
| 152 Word16 frac, /* input : fraction of lag */ | |
| 153 Word16 L_subfr /* input : subframe size */ | |
| 154 ); | |
| 155 void Q_plsf_5 ( | |
| 156 Word16 *lsp1, /* input : 1st LSP vector */ | |
| 157 Word16 *lsp2, /* input : 2nd LSP vector */ | |
| 158 Word16 *lsp1_q, /* output: quantized 1st LSP vector */ | |
| 159 Word16 *lsp2_q, /* output: quantized 2nd LSP vector */ | |
| 160 Word16 *indice, /* output: quantization indices of 5 matrices */ | |
| 161 Word16 txdtx_ctrl /* input : tx dtx control word */ | |
| 162 ); | |
| 163 void Bits2prm_12k2 ( | |
| 164 Word16 bits[], /* input : serial bits */ | |
| 165 Word16 prm[] /* output: analysis parameters */ | |
| 166 ); | |
| 167 void Prm2bits_12k2 ( | |
| 168 Word16 prm[], /* input : analysis parameters */ | |
| 169 Word16 bits[] /* output: serial bits */ | |
| 170 ); |
