Line data Source code
1 : /*==================================================================================== 2 : EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0 3 : ====================================================================================*/ 4 : 5 : #include <stdint.h> 6 : #include <stdlib.h> 7 : #include "options.h" /* Compilation switches */ 8 : #include "prot_fx.h" /* Function prototypes */ 9 : 10 : /*===================================================================*/ 11 : /* FUNCTION : void decod_ppp_fx () */ 12 : /*-------------------------------------------------------------------*/ 13 : /* PURPOSE : decode highly voiced frames using PPP */ 14 : /*-------------------------------------------------------------------*/ 15 : /* INPUT ARGUMENTS : */ 16 : /* _ const Word16 Aq_fx[] - Q12 12k8 Lp coefficient */ 17 : /* _ Word16 bfi_fx - Q0 bad frame indicator */ 18 : /*-------------------------------------------------------------------*/ 19 : /* OUTPUT ARGUMENTS : */ 20 : /* _ Decoder_State_fx *st_fx: */ 21 : /* _ lastLgainD_fx - Q11 */ 22 : /* _ lastHgainD_fx - Q11 */ 23 : /* _ lasterbD_fx - Q13 */ 24 : /*-------------------------------------------------------------------*/ 25 : /* INPUT/OUTPUT ARGUMENTS : */ 26 : /* _ Decoder_State_fx *st_fx: */ 27 : /* _ lsp_old_fx - Q15 */ 28 : /* _ st_fx->dtfs_dec_xxxx */ 29 : /* _ a nd b in st_fx->dtfs_dec_Q */ 30 : /* rest all in Q0 */ 31 : /* _ gainp_ppp Q14 */ 32 : /* _ FadeScale_fx - Q15 */ 33 : /* _ tilt_code_fx - Q15 */ 34 : /* _ prev_tilt_code_dec_fx - Q15 */ 35 : /* _ prev_gain_pit_dec_fx - Q14 */ 36 : /* _ dm_fx.prev_state - Q0 */ 37 : /* _ dm_fx.prev_gain_code - Q16 */ 38 : /* _ .dm_fx.prev_gain_pit - Q14 */ 39 : /* _ prev_gain_pit_dec - Q14 */ 40 : /* _ Word16 *pitch_buf_fx - Q6 fixed pitch values for each subframe */ 41 : /* _ Word16 *exc_fx - Q_exc current non-enhanced excitation */ 42 : /* _ Word16 *exc2_fx - Q_exc current enhanced excitation */ 43 : /*-------------------------------------------------------------------*/ 44 : /* RETURN ARGUMENTS : */ 45 : /* _ None */ 46 : /*-------------------------------------------------------------------*/ 47 : /* CALLED FROM : RX */ 48 : /*===================================================================*/ 49 : 50 0 : ivas_error decod_ppp_fx( 51 : Decoder_State *st_fx, /* i/o: state structure */ 52 : const Word16 Aq_fx[], /* i : 12k8 Lp coefficient */ 53 : Word16 *pitch_buf_fx, /* i/o: fixed pitch values for each subframe */ 54 : Word16 *exc_fx, /* i/o: current non-enhanced excitation */ 55 : Word16 *exc2_fx, /* i/o: current enhanced excitation */ 56 : Word16 bfi, /* i : bad frame indicator */ 57 : Word16 *gain_buf, /* o : Word16 pitch gain for each subframe Q14*/ 58 : Word16 *voice_factors, /* o : voicing factors */ 59 : Word16 *bwe_exc_fx /* o : excitation for SWB TBE */ 60 : ) 61 : { 62 : Word16 k; 63 : Word16 LPC_de_curr_fx[M + 1], p_Aq_curr_fx[M], p_Aq_old_fx[M + 1]; 64 : Word16 excQ_ppp_fx[L_FRAME], pitch_fx[NB_SUBFR], LPC_de_old_fx[M + 1]; 65 : ivas_error error; 66 : 67 0 : error = IVAS_ERR_OK; 68 0 : move16(); 69 : 70 : /* call voiced decoder at this point */ 71 0 : FOR( k = 0; k < M; k++ ) 72 : { 73 0 : p_Aq_curr_fx[k] = Aq_fx[( k + ( 3 * ( M + 1 ) ) + 1 )]; 74 0 : move16(); /*Q12 */ 75 : } 76 : 77 : 78 0 : deemph_lpc_fx( p_Aq_curr_fx, p_Aq_old_fx, LPC_de_curr_fx, LPC_de_old_fx, 0 ); /*LPC in Q12 */ 79 : 80 0 : IF( ( error = ppp_voiced_decoder_fx( st_fx, excQ_ppp_fx, LPC_de_curr_fx, exc_fx, pitch_fx, bfi ) ) != IVAS_ERR_OK ) 81 : { 82 0 : return error; 83 : } 84 : 85 0 : st_fx->tilt_code_fx = st_fx->tilt_code_dec_fx[3]; 86 0 : move16(); 87 : 88 0 : Copy( excQ_ppp_fx, exc_fx, L_FRAME ); 89 0 : Copy( exc_fx, exc2_fx, L_FRAME ); 90 : 91 0 : st_fx->dm_fx.prev_state = 2; 92 0 : move16(); 93 : 94 0 : st_fx->dm_fx.prev_gain_pit[0] = st_fx->prev_gain_pit_dec_fx; 95 0 : move16(); /*Q14 */ 96 : 97 0 : FOR( k = 3; k < 7; k++ ) 98 : { 99 0 : st_fx->dm_fx.prev_gain_pit[k - 2] = st_fx->dm_fx.prev_gain_pit[k - 3]; 100 0 : move16(); /*Q14 */ 101 : } 102 : 103 0 : Copy( pitch_fx, pitch_buf_fx, NB_SUBFR ); /*Q6 */ 104 : 105 0 : IF( st_fx->hBWE_TD != NULL ) 106 : { 107 0 : interp_code_5over2_fx( exc2_fx, bwe_exc_fx, L_FRAME ); 108 : } 109 0 : set16_fx( voice_factors, 0, NB_SUBFR16k ); 110 : 111 : 112 0 : set16_fx( gain_buf, 0, NB_SUBFR16k ); 113 0 : return error; 114 : }