Loading lib_com/ivas_cnst.h +4 −0 Original line number Diff line number Diff line Loading @@ -1051,7 +1051,11 @@ enum #define IVAS_APD_16_SECT 16 #define IVAS_DECORR_PARM_LOOKAHEAD_TAU 2e-3f #ifdef IVAS_FLOAT_FIXED #define IVAS_DECORR_PARM_APD_TAU 42949673 // Q31 #else #define IVAS_DECORR_PARM_APD_TAU 20e-3f #endif /* IVAS SBA PCA */ #define IVAS_PCA_NB_SUBR 20 /* 80 -> 0.25 ms, 40 -> 0.5 ms... */ Loading lib_com/ivas_prot.h +2 −0 Original line number Diff line number Diff line Loading @@ -4621,6 +4621,7 @@ void ivas_transient_det_close( ivas_trans_det_state_t **hTranDet /* i/o: Transient detector handle */ ); #ifndef IVAS_FLOAT_FIXED void ivas_transient_det_process( ivas_trans_det_state_t *hTranDet, /* i/o: SPAR TD handle */ float *pIn_pcm, /* i : input audio channels */ Loading @@ -4636,6 +4637,7 @@ void ivas_td_decorr_get_ducking_gains( const int16_t frame_len, const int16_t tdet_flag ); #endif #define IVAS_CMULT_FLOAT( in1_re, in1_im, in2_re, in2_im, out1_re, out1_im ) \ out1_re = ( in1_re * in2_re ) - ( in1_im * in2_im ); MAC(1); MULT(1); \ Loading lib_com/ivas_prot_fx.h +17 −0 Original line number Diff line number Diff line Loading @@ -92,4 +92,21 @@ void ivas_tda_fx( const Word16 length /* i : length of time alised signal buffer */ ); #ifdef IVAS_FLOAT_FIXED void ivas_transient_det_process_fx( ivas_trans_det_state_t *hTranDet, /* i/o: SPAR TD handle */ Word32 *pIn_pcm, /* i : input audio channels */ const Word16 frame_len, /* i : frame length in samples */ Word16 transient_det[2] /* o : transient det outputs */ ); void ivas_td_decorr_get_ducking_gains_fx( ivas_trans_det_state_t *hTranDet, /* i/o: Transient detector handle */ Word32 *pIn_pcm, Word32 *pIn_duck_gains, Word32 *pOut_duck_gains, const Word16 frame_len, const Word16 tdet_flag ); #endif #endif No newline at end of file lib_com/ivas_stat_com.h +8 −1 Original line number Diff line number Diff line Loading @@ -669,12 +669,19 @@ typedef struct ivas_trans_det_state_t ivas_filters_process_state_t env_hpf; ivas_filters_process_state_t env_fast; ivas_filters_process_state_t env_slow; #ifdef IVAS_FLOAT_FIXED Word32 in_duck_coeff; Word32 out_duck_coeff; Word32 in_duck_gain; Word32 out_duck_gain; Word32 duck_mult_fac; #else float in_duck_coeff; float out_duck_coeff; float in_duck_gain; float out_duck_gain; float duck_mult_fac; #endif } ivas_trans_det_state_t; Loading lib_com/ivas_transient_det.c +189 −15 Original line number Diff line number Diff line Loading @@ -37,6 +37,9 @@ #include "prot.h" #include "ivas_cnst.h" #include "ivas_prot.h" #ifdef IVAS_FLOAT_FIXED #include "ivas_prot_fx.h" #endif #include "ivas_stat_com.h" /*------------------------------------------------------------------------------------------* Loading @@ -44,8 +47,14 @@ *------------------------------------------------------------------------------------------*/ #define IVAS_TDET_PARM_ENV_EPS ( 1e-5f ) #ifdef IVAS_FLOAT_FIXED #define IVAS_TDET_DUCK_MULT_FAC ( 590558003 ) // Q29 #define IVAS_TDET_PARM_TRANS_THR ( 107374182 ) // Q30 #define IVAS_POINT_ONE_ONE_IN_Q30 ( 118111601 ) // Q30 #else #define IVAS_TDET_DUCK_MULT_FAC ( 1.1f ) #define IVAS_TDET_PARM_TRANS_THR ( 0.1f ) #endif #define IVAS_TDET_ONLY ( 1 ) /*env_hpf*/ Loading @@ -63,6 +72,17 @@ #define IVAS_C_SLOW_32k ( 0.999609451284012f ) #define IVAS_C_SLOW_16k ( 0.999219055096324f ) #ifdef IVAS_FLOAT_FIXED /*induck*/ #define IVAS_C_IN_DUCK_48k ( 1073294525 ) // Q30 #define IVAS_C_IN_DUCK_32k ( 1073070945 ) // Q30 #define IVAS_C_IN_DUCK_16k ( 1072400485 ) // Q30 /*outduck*/ #define IVAS_C_OUT_DUCK_48k ( 1073294525 ) // Q30 #define IVAS_C_OUT_DUCK_32k ( 1073070945 ) // Q30 #define IVAS_C_OUT_DUCK_16k ( 1072400485 ) // Q30 #else /*induck*/ #define IVAS_C_IN_DUCK_48k ( 0.999583420126834f ) #define IVAS_C_IN_DUCK_32k ( 0.999375195271816f ) Loading @@ -72,7 +92,7 @@ #define IVAS_C_OUT_DUCK_48k ( 0.999583420126834f ) #define IVAS_C_OUT_DUCK_32k ( 0.999375195271816f ) #define IVAS_C_OUT_DUCK_16k ( 0.998750780924581f ) #endif /*-----------------------------------------------------------------------------------------* * Function ivas_transient_det_init() Loading @@ -88,9 +108,13 @@ static void ivas_transient_det_init( int16_t i; float filt_coeff_arr[3][IVAS_BIQUAD_FILT_LEN << 1]; #ifdef IVAS_FLOAT_FIXED hTranDet->in_duck_gain = 1073741824; // Q30 hTranDet->out_duck_gain = 1073741824; // Q30 #else hTranDet->in_duck_gain = 1.0f; hTranDet->out_duck_gain = 1.0f; #endif for ( i = 0; i < 3; i++ ) { set_zero( filt_coeff_arr[i], IVAS_BIQUAD_FILT_LEN << 1 ); Loading Loading @@ -169,12 +193,12 @@ static void ivas_transient_det_init( ivas_error ivas_transient_det_open( ivas_trans_det_state_t **hTranDet_in, /* i/o: Transient detector handle */ const int32_t sampling_rate /* i : sampling rate */ const Word32 sampling_rate /* i : sampling rate */ ) { ivas_trans_det_state_t *hTranDet; if ( ( hTranDet = (ivas_trans_det_state_t *) malloc( sizeof( ivas_trans_det_state_t ) ) ) == NULL ) IF( ( hTranDet = (ivas_trans_det_state_t *) malloc( sizeof( ivas_trans_det_state_t ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR TD\n" ); } Loading @@ -197,7 +221,7 @@ void ivas_transient_det_close( ivas_trans_det_state_t **hTranDet /* i/o: Transient detector handle */ ) { if ( hTranDet == NULL || *hTranDet == NULL ) IF( hTranDet == NULL || *hTranDet == NULL ) { return; } Loading @@ -208,7 +232,47 @@ void ivas_transient_det_close( return; } #ifdef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------------------------* * Function ivas_transient_det_process_fx() * * Transient detection process call *-----------------------------------------------------------------------------------------*/ void ivas_transient_det_process_fx( ivas_trans_det_state_t *hTranDet, /* i/o: SPAR TD handle */ Word32 *pIn_pcm, /* i : input audio channels */ const Word16 frame_len, /* i : frame length in samples */ Word16 transient_det[2] /* o : transient det outputs */ ) { Word32 in_duck_gain[L_FRAME48k]; Word16 num_sf, sf, sf_samp, idx; Word32 mem = hTranDet->in_duck_gain; ivas_td_decorr_get_ducking_gains_fx( hTranDet, pIn_pcm, in_duck_gain, NULL, frame_len, IVAS_TDET_ONLY ); transient_det[0] = 0; transient_det[1] = 0; IF( GT_32( L_sub( mem, hTranDet->in_duck_gain ), IVAS_TDET_PARM_TRANS_THR ) ) { transient_det[0] = 1; } num_sf = 16; sf_samp = frame_len / num_sf; FOR( sf = 1; sf <= num_sf; sf++ ) { idx = ( sf_samp * sf ) - 1; IF( GT_32( L_sub( mem, in_duck_gain[idx] ), IVAS_POINT_ONE_ONE_IN_Q30 ) ) { transient_det[1] = 1; } mem = in_duck_gain[idx]; } return; } #else /*-----------------------------------------------------------------------------------------* * Function ivas_transient_det_process() * Loading Loading @@ -249,8 +313,8 @@ void ivas_transient_det_process( return; } #endif #ifndef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------------------------* * Function ivas_calc_duck_gain() * Loading @@ -275,8 +339,41 @@ static float ivas_calc_duck_gain( return duck_gain_out; } #else /*-----------------------------------------------------------------------------------------* * Function ivas_calc_duck_gain_fx() * * Calculate ducking gain utility *-----------------------------------------------------------------------------------------*/ static Word32 ivas_calc_duck_gain_fx( const Word32 duck_gain, const Word32 duck_coeff, const Word32 env_1, const Word32 env_2, const Word32 duck_mult_fac ) { Word32 duck_gain_out; duck_gain_out = L_add( L_shl( Mpy_32_32( L_sub( duck_gain, ONE_IN_Q30 ), duck_coeff ), Q1 ), ONE_IN_Q30 ); IF( LT_32( Mpy_32_32( duck_mult_fac, env_1 ), Mpy_32_32( L_shr( duck_gain_out, 1 ), env_2 ) ) ) { IF( EQ_32( env_1, 0 ) || EQ_32( env_2, 0 ) ) { duck_gain_out = 0; } else { duck_gain_out = Mpy_32_32( duck_mult_fac, L_shl( (Word32) ( divide3232( env_1, env_2 ) ), Q16 ) ); duck_gain_out = L_shl( duck_gain_out, Q1 ); } } return duck_gain_out; } #endif #ifndef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------------------------* * Function ivas_td_decorr_get_ducking_gains() * Loading Loading @@ -340,3 +437,80 @@ void ivas_td_decorr_get_ducking_gains( return; } #else /*-----------------------------------------------------------------------------------------* * Function ivas_td_decorr_get_ducking_gains_fx() * * Calculate in/out ducking gains *-----------------------------------------------------------------------------------------*/ void ivas_td_decorr_get_ducking_gains_fx( ivas_trans_det_state_t *hTranDet, /* i/o: Transient detector handle */ Word32 *pIn_pcm, Word32 *pIn_duck_gains, Word32 *pOut_duck_gains, const Word16 frame_len, const Word16 tdet_flag ) { Word16 i, q = Q15; float e_fast[L_FRAME48k], e_slow[L_FRAME48k]; Word32 e_fast_fx[L_FRAME48k], e_slow_fx[L_FRAME48k]; Word32 in_duck_gain = hTranDet->in_duck_gain; Word32 out_duck_gain = hTranDet->out_duck_gain; Word32 in_duck_coeff = hTranDet->in_duck_coeff; Word32 out_duck_coeff = hTranDet->out_duck_coeff; Word32 duck_mult_fac = hTranDet->duck_mult_fac; mvl2l( pIn_pcm, e_fast_fx, frame_len ); for ( i = 0; i < frame_len; i++ ) { e_fast[i] = ( e_fast_fx[i] / (float) ( 1 << q ) ); } /* env hpf */ ivas_filter_process( &hTranDet->env_hpf, e_fast, frame_len ); for ( i = 0; i < frame_len; i++ ) { e_fast[i] = (float) fabs( e_fast[i] ) + IVAS_TDET_PARM_ENV_EPS; e_slow[i] = e_fast[i]; } /* env fast*/ ivas_filter_process( &hTranDet->env_fast, e_fast, frame_len ); /* env slow */ ivas_filter_process( &hTranDet->env_slow, e_slow, frame_len ); for ( i = 0; i < frame_len; i++ ) { e_fast_fx[i] = (Word32) ( e_fast[i] * ( 1 << q ) ); e_slow_fx[i] = (Word32) ( e_slow[i] * ( 1 << q ) ); } if ( tdet_flag ) { for ( i = 0; i < frame_len; i++ ) { in_duck_gain = ivas_calc_duck_gain_fx( in_duck_gain, in_duck_coeff, e_slow_fx[i], e_fast_fx[i], duck_mult_fac ); pIn_duck_gains[i] = in_duck_gain; } hTranDet->in_duck_gain = in_duck_gain; } else { for ( i = 0; i < frame_len; i++ ) { in_duck_gain = ivas_calc_duck_gain_fx( in_duck_gain, in_duck_coeff, e_slow_fx[i], e_fast_fx[i], duck_mult_fac ); pIn_duck_gains[i] = in_duck_gain; out_duck_gain = ivas_calc_duck_gain_fx( out_duck_gain, out_duck_coeff, e_fast_fx[i], e_slow_fx[i], duck_mult_fac ); pOut_duck_gains[i] = out_duck_gain; } hTranDet->in_duck_gain = in_duck_gain; hTranDet->out_duck_gain = out_duck_gain; } return; } #endif No newline at end of file Loading
lib_com/ivas_cnst.h +4 −0 Original line number Diff line number Diff line Loading @@ -1051,7 +1051,11 @@ enum #define IVAS_APD_16_SECT 16 #define IVAS_DECORR_PARM_LOOKAHEAD_TAU 2e-3f #ifdef IVAS_FLOAT_FIXED #define IVAS_DECORR_PARM_APD_TAU 42949673 // Q31 #else #define IVAS_DECORR_PARM_APD_TAU 20e-3f #endif /* IVAS SBA PCA */ #define IVAS_PCA_NB_SUBR 20 /* 80 -> 0.25 ms, 40 -> 0.5 ms... */ Loading
lib_com/ivas_prot.h +2 −0 Original line number Diff line number Diff line Loading @@ -4621,6 +4621,7 @@ void ivas_transient_det_close( ivas_trans_det_state_t **hTranDet /* i/o: Transient detector handle */ ); #ifndef IVAS_FLOAT_FIXED void ivas_transient_det_process( ivas_trans_det_state_t *hTranDet, /* i/o: SPAR TD handle */ float *pIn_pcm, /* i : input audio channels */ Loading @@ -4636,6 +4637,7 @@ void ivas_td_decorr_get_ducking_gains( const int16_t frame_len, const int16_t tdet_flag ); #endif #define IVAS_CMULT_FLOAT( in1_re, in1_im, in2_re, in2_im, out1_re, out1_im ) \ out1_re = ( in1_re * in2_re ) - ( in1_im * in2_im ); MAC(1); MULT(1); \ Loading
lib_com/ivas_prot_fx.h +17 −0 Original line number Diff line number Diff line Loading @@ -92,4 +92,21 @@ void ivas_tda_fx( const Word16 length /* i : length of time alised signal buffer */ ); #ifdef IVAS_FLOAT_FIXED void ivas_transient_det_process_fx( ivas_trans_det_state_t *hTranDet, /* i/o: SPAR TD handle */ Word32 *pIn_pcm, /* i : input audio channels */ const Word16 frame_len, /* i : frame length in samples */ Word16 transient_det[2] /* o : transient det outputs */ ); void ivas_td_decorr_get_ducking_gains_fx( ivas_trans_det_state_t *hTranDet, /* i/o: Transient detector handle */ Word32 *pIn_pcm, Word32 *pIn_duck_gains, Word32 *pOut_duck_gains, const Word16 frame_len, const Word16 tdet_flag ); #endif #endif No newline at end of file
lib_com/ivas_stat_com.h +8 −1 Original line number Diff line number Diff line Loading @@ -669,12 +669,19 @@ typedef struct ivas_trans_det_state_t ivas_filters_process_state_t env_hpf; ivas_filters_process_state_t env_fast; ivas_filters_process_state_t env_slow; #ifdef IVAS_FLOAT_FIXED Word32 in_duck_coeff; Word32 out_duck_coeff; Word32 in_duck_gain; Word32 out_duck_gain; Word32 duck_mult_fac; #else float in_duck_coeff; float out_duck_coeff; float in_duck_gain; float out_duck_gain; float duck_mult_fac; #endif } ivas_trans_det_state_t; Loading
lib_com/ivas_transient_det.c +189 −15 Original line number Diff line number Diff line Loading @@ -37,6 +37,9 @@ #include "prot.h" #include "ivas_cnst.h" #include "ivas_prot.h" #ifdef IVAS_FLOAT_FIXED #include "ivas_prot_fx.h" #endif #include "ivas_stat_com.h" /*------------------------------------------------------------------------------------------* Loading @@ -44,8 +47,14 @@ *------------------------------------------------------------------------------------------*/ #define IVAS_TDET_PARM_ENV_EPS ( 1e-5f ) #ifdef IVAS_FLOAT_FIXED #define IVAS_TDET_DUCK_MULT_FAC ( 590558003 ) // Q29 #define IVAS_TDET_PARM_TRANS_THR ( 107374182 ) // Q30 #define IVAS_POINT_ONE_ONE_IN_Q30 ( 118111601 ) // Q30 #else #define IVAS_TDET_DUCK_MULT_FAC ( 1.1f ) #define IVAS_TDET_PARM_TRANS_THR ( 0.1f ) #endif #define IVAS_TDET_ONLY ( 1 ) /*env_hpf*/ Loading @@ -63,6 +72,17 @@ #define IVAS_C_SLOW_32k ( 0.999609451284012f ) #define IVAS_C_SLOW_16k ( 0.999219055096324f ) #ifdef IVAS_FLOAT_FIXED /*induck*/ #define IVAS_C_IN_DUCK_48k ( 1073294525 ) // Q30 #define IVAS_C_IN_DUCK_32k ( 1073070945 ) // Q30 #define IVAS_C_IN_DUCK_16k ( 1072400485 ) // Q30 /*outduck*/ #define IVAS_C_OUT_DUCK_48k ( 1073294525 ) // Q30 #define IVAS_C_OUT_DUCK_32k ( 1073070945 ) // Q30 #define IVAS_C_OUT_DUCK_16k ( 1072400485 ) // Q30 #else /*induck*/ #define IVAS_C_IN_DUCK_48k ( 0.999583420126834f ) #define IVAS_C_IN_DUCK_32k ( 0.999375195271816f ) Loading @@ -72,7 +92,7 @@ #define IVAS_C_OUT_DUCK_48k ( 0.999583420126834f ) #define IVAS_C_OUT_DUCK_32k ( 0.999375195271816f ) #define IVAS_C_OUT_DUCK_16k ( 0.998750780924581f ) #endif /*-----------------------------------------------------------------------------------------* * Function ivas_transient_det_init() Loading @@ -88,9 +108,13 @@ static void ivas_transient_det_init( int16_t i; float filt_coeff_arr[3][IVAS_BIQUAD_FILT_LEN << 1]; #ifdef IVAS_FLOAT_FIXED hTranDet->in_duck_gain = 1073741824; // Q30 hTranDet->out_duck_gain = 1073741824; // Q30 #else hTranDet->in_duck_gain = 1.0f; hTranDet->out_duck_gain = 1.0f; #endif for ( i = 0; i < 3; i++ ) { set_zero( filt_coeff_arr[i], IVAS_BIQUAD_FILT_LEN << 1 ); Loading Loading @@ -169,12 +193,12 @@ static void ivas_transient_det_init( ivas_error ivas_transient_det_open( ivas_trans_det_state_t **hTranDet_in, /* i/o: Transient detector handle */ const int32_t sampling_rate /* i : sampling rate */ const Word32 sampling_rate /* i : sampling rate */ ) { ivas_trans_det_state_t *hTranDet; if ( ( hTranDet = (ivas_trans_det_state_t *) malloc( sizeof( ivas_trans_det_state_t ) ) ) == NULL ) IF( ( hTranDet = (ivas_trans_det_state_t *) malloc( sizeof( ivas_trans_det_state_t ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR TD\n" ); } Loading @@ -197,7 +221,7 @@ void ivas_transient_det_close( ivas_trans_det_state_t **hTranDet /* i/o: Transient detector handle */ ) { if ( hTranDet == NULL || *hTranDet == NULL ) IF( hTranDet == NULL || *hTranDet == NULL ) { return; } Loading @@ -208,7 +232,47 @@ void ivas_transient_det_close( return; } #ifdef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------------------------* * Function ivas_transient_det_process_fx() * * Transient detection process call *-----------------------------------------------------------------------------------------*/ void ivas_transient_det_process_fx( ivas_trans_det_state_t *hTranDet, /* i/o: SPAR TD handle */ Word32 *pIn_pcm, /* i : input audio channels */ const Word16 frame_len, /* i : frame length in samples */ Word16 transient_det[2] /* o : transient det outputs */ ) { Word32 in_duck_gain[L_FRAME48k]; Word16 num_sf, sf, sf_samp, idx; Word32 mem = hTranDet->in_duck_gain; ivas_td_decorr_get_ducking_gains_fx( hTranDet, pIn_pcm, in_duck_gain, NULL, frame_len, IVAS_TDET_ONLY ); transient_det[0] = 0; transient_det[1] = 0; IF( GT_32( L_sub( mem, hTranDet->in_duck_gain ), IVAS_TDET_PARM_TRANS_THR ) ) { transient_det[0] = 1; } num_sf = 16; sf_samp = frame_len / num_sf; FOR( sf = 1; sf <= num_sf; sf++ ) { idx = ( sf_samp * sf ) - 1; IF( GT_32( L_sub( mem, in_duck_gain[idx] ), IVAS_POINT_ONE_ONE_IN_Q30 ) ) { transient_det[1] = 1; } mem = in_duck_gain[idx]; } return; } #else /*-----------------------------------------------------------------------------------------* * Function ivas_transient_det_process() * Loading Loading @@ -249,8 +313,8 @@ void ivas_transient_det_process( return; } #endif #ifndef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------------------------* * Function ivas_calc_duck_gain() * Loading @@ -275,8 +339,41 @@ static float ivas_calc_duck_gain( return duck_gain_out; } #else /*-----------------------------------------------------------------------------------------* * Function ivas_calc_duck_gain_fx() * * Calculate ducking gain utility *-----------------------------------------------------------------------------------------*/ static Word32 ivas_calc_duck_gain_fx( const Word32 duck_gain, const Word32 duck_coeff, const Word32 env_1, const Word32 env_2, const Word32 duck_mult_fac ) { Word32 duck_gain_out; duck_gain_out = L_add( L_shl( Mpy_32_32( L_sub( duck_gain, ONE_IN_Q30 ), duck_coeff ), Q1 ), ONE_IN_Q30 ); IF( LT_32( Mpy_32_32( duck_mult_fac, env_1 ), Mpy_32_32( L_shr( duck_gain_out, 1 ), env_2 ) ) ) { IF( EQ_32( env_1, 0 ) || EQ_32( env_2, 0 ) ) { duck_gain_out = 0; } else { duck_gain_out = Mpy_32_32( duck_mult_fac, L_shl( (Word32) ( divide3232( env_1, env_2 ) ), Q16 ) ); duck_gain_out = L_shl( duck_gain_out, Q1 ); } } return duck_gain_out; } #endif #ifndef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------------------------* * Function ivas_td_decorr_get_ducking_gains() * Loading Loading @@ -340,3 +437,80 @@ void ivas_td_decorr_get_ducking_gains( return; } #else /*-----------------------------------------------------------------------------------------* * Function ivas_td_decorr_get_ducking_gains_fx() * * Calculate in/out ducking gains *-----------------------------------------------------------------------------------------*/ void ivas_td_decorr_get_ducking_gains_fx( ivas_trans_det_state_t *hTranDet, /* i/o: Transient detector handle */ Word32 *pIn_pcm, Word32 *pIn_duck_gains, Word32 *pOut_duck_gains, const Word16 frame_len, const Word16 tdet_flag ) { Word16 i, q = Q15; float e_fast[L_FRAME48k], e_slow[L_FRAME48k]; Word32 e_fast_fx[L_FRAME48k], e_slow_fx[L_FRAME48k]; Word32 in_duck_gain = hTranDet->in_duck_gain; Word32 out_duck_gain = hTranDet->out_duck_gain; Word32 in_duck_coeff = hTranDet->in_duck_coeff; Word32 out_duck_coeff = hTranDet->out_duck_coeff; Word32 duck_mult_fac = hTranDet->duck_mult_fac; mvl2l( pIn_pcm, e_fast_fx, frame_len ); for ( i = 0; i < frame_len; i++ ) { e_fast[i] = ( e_fast_fx[i] / (float) ( 1 << q ) ); } /* env hpf */ ivas_filter_process( &hTranDet->env_hpf, e_fast, frame_len ); for ( i = 0; i < frame_len; i++ ) { e_fast[i] = (float) fabs( e_fast[i] ) + IVAS_TDET_PARM_ENV_EPS; e_slow[i] = e_fast[i]; } /* env fast*/ ivas_filter_process( &hTranDet->env_fast, e_fast, frame_len ); /* env slow */ ivas_filter_process( &hTranDet->env_slow, e_slow, frame_len ); for ( i = 0; i < frame_len; i++ ) { e_fast_fx[i] = (Word32) ( e_fast[i] * ( 1 << q ) ); e_slow_fx[i] = (Word32) ( e_slow[i] * ( 1 << q ) ); } if ( tdet_flag ) { for ( i = 0; i < frame_len; i++ ) { in_duck_gain = ivas_calc_duck_gain_fx( in_duck_gain, in_duck_coeff, e_slow_fx[i], e_fast_fx[i], duck_mult_fac ); pIn_duck_gains[i] = in_duck_gain; } hTranDet->in_duck_gain = in_duck_gain; } else { for ( i = 0; i < frame_len; i++ ) { in_duck_gain = ivas_calc_duck_gain_fx( in_duck_gain, in_duck_coeff, e_slow_fx[i], e_fast_fx[i], duck_mult_fac ); pIn_duck_gains[i] = in_duck_gain; out_duck_gain = ivas_calc_duck_gain_fx( out_duck_gain, out_duck_coeff, e_fast_fx[i], e_slow_fx[i], duck_mult_fac ); pOut_duck_gains[i] = out_duck_gain; } hTranDet->in_duck_gain = in_duck_gain; hTranDet->out_duck_gain = out_duck_gain; } return; } #endif No newline at end of file