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