FreeCalypso > hg > efr-experiments
comparison src/dtx.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 /*************************************************************************** | |
| 2 * | |
| 3 * File Name: dtx.h | |
| 4 * | |
| 5 * Purpose: Contains the prototypes for all the functions of DTX. | |
| 6 * Also contains definitions of constants used in DTX functions. | |
| 7 * | |
| 8 **************************************************************************/ | |
| 9 | |
| 10 #define PN_INITIAL_SEED 0x70816958L /* Pseudo noise generator seed value */ | |
| 11 | |
| 12 #define CN_INT_PERIOD 24 /* Comfort noise interpolation period | |
| 13 (nbr of frames between successive | |
| 14 SID updates in the decoder) */ | |
| 15 | |
| 16 #define DTX_HANGOVER 7 /* Period when SP=1 although VAD=0. | |
| 17 Used for comfort noise averaging */ | |
| 18 | |
| 19 | |
| 20 /* Frame classification constants */ | |
| 21 | |
| 22 #define VALID_SID_FRAME 1 | |
| 23 #define INVALID_SID_FRAME 2 | |
| 24 #define GOOD_SPEECH_FRAME 3 | |
| 25 #define UNUSABLE_FRAME 4 | |
| 26 | |
| 27 /* Encoder DTX control flags */ | |
| 28 | |
| 29 #define TX_SP_FLAG 0x0001 | |
| 30 #define TX_VAD_FLAG 0x0002 | |
| 31 #define TX_HANGOVER_ACTIVE 0x0004 | |
| 32 #define TX_PREV_HANGOVER_ACTIVE 0x0008 | |
| 33 #define TX_SID_UPDATE 0x0010 | |
| 34 #define TX_USE_OLD_SID 0x0020 | |
| 35 | |
| 36 /* Decoder DTX control flags */ | |
| 37 | |
| 38 #define RX_SP_FLAG 0x0001 | |
| 39 #define RX_UPD_SID_QUANT_MEM 0x0002 | |
| 40 #define RX_FIRST_SID_UPDATE 0x0004 | |
| 41 #define RX_CONT_SID_UPDATE 0x0008 | |
| 42 #define RX_LOST_SID_FRAME 0x0010 | |
| 43 #define RX_INVALID_SID_FRAME 0x0020 | |
| 44 #define RX_NO_TRANSMISSION 0x0040 | |
| 45 #define RX_DTX_MUTING 0x0080 | |
| 46 #define RX_PREV_DTX_MUTING 0x0100 | |
| 47 #define RX_CNI_BFI 0x0200 | |
| 48 #define RX_FIRST_SP_FLAG 0x0400 | |
| 49 | |
| 50 void reset_tx_dtx (void); /* Reset tx dtx variables */ | |
| 51 void reset_rx_dtx (void); /* Reset rx dtx variables */ | |
| 52 | |
| 53 void tx_dtx ( | |
| 54 Word16 VAD_flag, | |
| 55 Word16 *txdtx_ctrl | |
| 56 ); | |
| 57 | |
| 58 void rx_dtx ( | |
| 59 Word16 *rxdtx_ctrl, | |
| 60 Word16 TAF, | |
| 61 Word16 bfi, | |
| 62 Word16 SID_flag | |
| 63 ); | |
| 64 | |
| 65 void CN_encoding ( | |
| 66 Word16 params[], | |
| 67 Word16 txdtx_ctrl | |
| 68 ); | |
| 69 | |
| 70 void sid_codeword_encoding ( | |
| 71 Word16 ser2[] | |
| 72 ); | |
| 73 | |
| 74 Word16 sid_frame_detection ( | |
| 75 Word16 ser2[] | |
| 76 ); | |
| 77 | |
| 78 void update_lsf_history ( | |
| 79 Word16 lsf1[M], | |
| 80 Word16 lsf2[M], | |
| 81 Word16 lsf_old[DTX_HANGOVER][M] | |
| 82 ); | |
| 83 | |
| 84 void update_lsf_p_CN ( | |
| 85 Word16 lsf_old[DTX_HANGOVER][M], | |
| 86 Word16 lsf_p_CN[M] | |
| 87 ); | |
| 88 | |
| 89 void aver_lsf_history ( | |
| 90 Word16 lsf_old[DTX_HANGOVER][M], | |
| 91 Word16 lsf1[M], | |
| 92 Word16 lsf2[M], | |
| 93 Word16 lsf_aver[M] | |
| 94 ); | |
| 95 | |
| 96 void update_gain_code_history_tx ( | |
| 97 Word16 new_gain_code, | |
| 98 Word16 gain_code_old_tx[4 * DTX_HANGOVER] | |
| 99 ); | |
| 100 | |
| 101 void update_gain_code_history_rx ( | |
| 102 Word16 new_gain_code, | |
| 103 Word16 gain_code_old_rx[4 * DTX_HANGOVER] | |
| 104 ); | |
| 105 | |
| 106 Word16 compute_CN_excitation_gain ( | |
| 107 Word16 res2[L_SUBFR] | |
| 108 ); | |
| 109 | |
| 110 Word16 update_gcode0_CN ( | |
| 111 Word16 gain_code_old_tx[4 * DTX_HANGOVER] | |
| 112 ); | |
| 113 | |
| 114 Word16 aver_gain_code_history ( | |
| 115 Word16 CN_excitation_gain, | |
| 116 Word16 gain_code_old[4 * DTX_HANGOVER] | |
| 117 ); | |
| 118 | |
| 119 void build_CN_code ( | |
| 120 Word16 cod[], | |
| 121 Word32 *seed | |
| 122 ); | |
| 123 | |
| 124 Word16 pseudonoise ( | |
| 125 Word32 *shift_reg, | |
| 126 Word16 no_bits | |
| 127 ); | |
| 128 | |
| 129 Word16 interpolate_CN_param ( | |
| 130 Word16 old_param, | |
| 131 Word16 new_param, | |
| 132 Word16 rx_dtx_state | |
| 133 ); | |
| 134 | |
| 135 void interpolate_CN_lsf ( | |
| 136 Word16 lsf_old_CN[M], | |
| 137 Word16 lsf_new_CN[M], | |
| 138 Word16 lsf_interp_CN[M], | |
| 139 Word16 rx_dtx_state | |
| 140 ); |
