Loading lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ #define HARMONIZE_ISSUE_2435_WRITETNSDATA /* FhG basop 2435: Harmonize WriteTnsData*_fx(), EncodeTnsData*_fx() */ #define HARM_2336_DOTP /* VA: basop 2336; Harmonisation of some dot_product function + some BE optimisation */ #define FIX_2431_AVOID_CALLOC /* VA: basp issue 2431: avoid use of calloc() */ #define FIX_2424_REMOVE_GAUSS_L2_ENC /* VA: basop issue 2424: Remove duplicated code in gauss_L2_ivas_fx() */ /* #################### End BE switches ################################## */ Loading lib_dec/dec_uv_fx.c +4 −3 Original line number Diff line number Diff line Loading @@ -78,7 +78,8 @@ void decod_unvoiced_fx( &voice_fac_fx, &gain_pit_fx, pt_pitch_fx, exc_fx, &gain_code_fx, exc2_fx, bwe_exc_fx, &( st_fx->Q_exc ), st_fx->Q_subfr ); } ELSE { /*----------------------------------------------------------------* { /*----------------------------------------------------------------* * Unvoiced subframe processing in two stages *----------------------------------------------------------------*/ Loading lib_dec/gaus_dec_fx.c +9 −5 Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ * Local function prototypes *---------------------------------------------------------------------*/ void gaus_dec2v_fx( Decoder_State *st_fx, Word16 *code, const Word16 lg, const Word16 nb_bits ); static void gaus_dec2v_fx( Decoder_State *st_fx, Word16 *code, const Word16 lg, const Word16 nb_bits ); static void dec_2pos_fx( Word16 index, Word16 *ind1, Word16 *ind2, Word16 *sign1, Word16 *sign2, Word16 log2_n ); /*---------------------------------------------------------------------* Loading @@ -22,6 +22,7 @@ static void dec_2pos_fx( Word16 index, Word16 *ind1, Word16 *ind2, Word16 *sign1 * - decode the codebook indices, * - find the excitation *---------------------------------------------------------------------*/ void gaus_dec_fx( Decoder_State *st_fx, /* i/o: decoder static memory */ const Word16 i_subfr, /* i : subframe index */ Loading Loading @@ -53,6 +54,7 @@ void gaus_dec_fx( /*------------------------------------------------------------------------------------------* * Unvoiced : Gaussian codebook *------------------------------------------------------------------------------------------*/ nb_bits = st_fx->acelp_cfg.fixed_cdk_index[( i_subfr / 64 )]; move16(); Loading @@ -61,6 +63,7 @@ void gaus_dec_fx( /*------------------------------------------------------------------------------------------* * - Gain of Gaussian excitation and normalized Gaussian excitation *------------------------------------------------------------------------------------------*/ /* gain_inov = 1.0f / (float)sqrt((dot_product(code, code, L_SUBFR) + 0.01f) / L_SUBFR) */ L_tmp = Dot_product12( code, code, L_SUBFR, &exp ); exp = sub( exp, 18 /*24*/ + 6 ); /* exp: -18 (code in Q9), -6 (/L_SUBFR) */ Loading Loading @@ -141,7 +144,7 @@ void gaus_dec_fx( * One Gaussian vector of 190 values *-----------------------------------------------------*/ void gaus_dec2v_fx( static void gaus_dec2v_fx( Decoder_State *st_fx, /* i/o: decoder state structure */ Word16 *code, /* o : decoded gaussian vector Q12-exp */ const Word16 lg, /* i : codevector length Q0 */ Loading Loading @@ -211,6 +214,7 @@ void gaus_dec2v_fx( * * Decode the codevectors positions and signs *-----------------------------------------------------*/ static void dec_2pos_fx( Word16 index, /* i : quantization index Q0 */ Word16 *ind1, /* o : 1st vector index Q0 */ Loading Loading @@ -257,6 +261,7 @@ static void dec_2pos_fx( * * One Gaussian vector *-----------------------------------------------------*/ void gaus_L2_dec( Word16 *code, /* o : decoded gaussian codevector Q9 */ Word16 tilt_code, /* i : tilt of code Q15 */ Loading Loading @@ -289,6 +294,5 @@ void gaus_L2_dec( /*Shape the gaussian excitation*/ cb_shape_fx( 1, 0, 0, 1, 0, formant_enh, FORMANT_SHARPENING_G2, A, code, tilt_code, 0, 1, L_SUBFR ); return; } lib_enc/cod_ace_fx.c +4 −0 Original line number Diff line number Diff line Loading @@ -290,8 +290,12 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision * IF( EQ_16( acelp_cfg->gains_mode[j_subfr], 7 ) ) { #ifdef FIX_2424_REMOVE_GAUSS_L2_ENC gauss_L2_fx( st->element_mode, h1, code2, y2, y22, &gain_code2, &g_corr, gain_pit, hLPDmem->tilt_code, p_Aq, acelp_cfg->formant_enh_num, &( st->seed_acelp ), shift ); #else assert( gain_pit == 0 ); gauss_L2_fx( h1, code2, y2, y22, &gain_code2, &g_corr, gain_pit, hLPDmem->tilt_code, p_Aq, acelp_cfg->formant_enh_num, &( st->seed_acelp ), shift ); #endif } ELSE { Loading lib_enc/cod_uv_fx.c +51 −5 Original line number Diff line number Diff line Loading @@ -5,7 +5,6 @@ #include <stdint.h> #include "options.h" #include <assert.h> //#include "prot_fx.h" #include "rom_com.h" /* Common constants */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ Loading @@ -19,7 +18,11 @@ * * Gaussian excitation is generated by a white noise and shapes it with LPC-derived filter *-------------------------------------------------------------------*/ void gauss_L2_fx( #ifdef FIX_2424_REMOVE_GAUSS_L2_ENC const Word16 element_mode, /* i : element mode */ #endif const Word16 h[], /* i : weighted LP filter impulse response Q14+s */ Word16 code[], /* o : gaussian excitation Q9 */ const Word16 y2[], /* i : zero-memory filtered code. excitation Q9 */ Loading @@ -35,7 +38,17 @@ void gauss_L2_fx( { Word16 i, tmp16; Word32 tmp32, tmp32_2; #ifdef FIX_2424_REMOVE_GAUSS_L2_ENC Word16 Q_fac; Q_fac = Q18; move16(); if ( element_mode != EVS_MONO ) { Q_fac = Q16; move16(); } #endif assert( gain_pit == 0 ); Loading Loading @@ -65,29 +78,61 @@ void gauss_L2_fx( Scale_sig( y11, L_SUBFR, sub( 1, shift ) ); /* Q9 */ *gain = L_deposit_l( 0 ); move32(); /*Update correlations for gains coding */ #ifdef FIX_2424_REMOVE_GAUSS_L2_ENC tmp32 = L_shr( 21474836l /*0.01f Q31*/, 31 - Q_fac ); /* Q_fac */ tmp32_2 = L_shr( 21474836l /*0.01f Q31*/, 31 - Q_fac ); /* Q_fac */ #else tmp32 = L_shr( 21474836l /*0.01f Q31*/, 31 - 18 ); /* Q18 */ tmp32_2 = L_shr( 21474836l /*0.01f Q31*/, 31 - 18 ); /* Q18 */ #endif #ifdef FIX_2424_REMOVE_GAUSS_L2_ENC IF( element_mode == EVS_MONO ) { #endif FOR( i = 0; i < L_SUBFR; i++ ) { tmp32 = L_mac0_sat( tmp32, y11[i], y11[i] ); /* Q18 */ tmp32_2 = L_mac0_sat( tmp32_2, y11[i], y2[i] ); /* Q18 */ } #ifdef FIX_2424_REMOVE_GAUSS_L2_ENC } ELSE { FOR( i = 0; i < L_SUBFR; i++ ) { tmp16 = shr( y11[i], 1 ); tmp32 = L_mac0( tmp32, tmp16, tmp16 ); /* Q16 */ tmp32_2 = L_mac0( tmp32_2, tmp16, shr( y2[i], 1 ) ); /* Q16 */ } } #endif tmp16 = norm_l( tmp32 ); g_corr->y1y1 = round_fx_sat( L_shl( tmp32, tmp16 ) ); #ifdef FIX_2424_REMOVE_GAUSS_L2_ENC g_corr->y1y1_e = sub( sub( 31, Q_fac ), tmp16 ); #else g_corr->y1y1_e = sub( 31 - 18, tmp16 ); #endif move16(); move16(); tmp16 = norm_l( tmp32_2 ); g_corr->y1y2 = round_fx_sat( L_shl( tmp32_2, tmp16 ) ); #ifdef FIX_2424_REMOVE_GAUSS_L2_ENC g_corr->y1y2_e = sub( sub( 31, Q_fac ), tmp16 ); #else g_corr->y1y2_e = sub( 31 - 18, tmp16 ); #endif move16(); move16(); } return; } #ifndef FIX_2424_REMOVE_GAUSS_L2_ENC void gauss_L2_ivas_fx( const Word16 h[], /* i : weighted LP filter impulse response Q14+s */ Word16 code[], /* o : gaussian excitation Q9 */ Loading Loading @@ -157,3 +202,4 @@ void gauss_L2_ivas_fx( move16(); move16(); } #endif Loading
lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ #define HARMONIZE_ISSUE_2435_WRITETNSDATA /* FhG basop 2435: Harmonize WriteTnsData*_fx(), EncodeTnsData*_fx() */ #define HARM_2336_DOTP /* VA: basop 2336; Harmonisation of some dot_product function + some BE optimisation */ #define FIX_2431_AVOID_CALLOC /* VA: basp issue 2431: avoid use of calloc() */ #define FIX_2424_REMOVE_GAUSS_L2_ENC /* VA: basop issue 2424: Remove duplicated code in gauss_L2_ivas_fx() */ /* #################### End BE switches ################################## */ Loading
lib_dec/dec_uv_fx.c +4 −3 Original line number Diff line number Diff line Loading @@ -78,7 +78,8 @@ void decod_unvoiced_fx( &voice_fac_fx, &gain_pit_fx, pt_pitch_fx, exc_fx, &gain_code_fx, exc2_fx, bwe_exc_fx, &( st_fx->Q_exc ), st_fx->Q_subfr ); } ELSE { /*----------------------------------------------------------------* { /*----------------------------------------------------------------* * Unvoiced subframe processing in two stages *----------------------------------------------------------------*/ Loading
lib_dec/gaus_dec_fx.c +9 −5 Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ * Local function prototypes *---------------------------------------------------------------------*/ void gaus_dec2v_fx( Decoder_State *st_fx, Word16 *code, const Word16 lg, const Word16 nb_bits ); static void gaus_dec2v_fx( Decoder_State *st_fx, Word16 *code, const Word16 lg, const Word16 nb_bits ); static void dec_2pos_fx( Word16 index, Word16 *ind1, Word16 *ind2, Word16 *sign1, Word16 *sign2, Word16 log2_n ); /*---------------------------------------------------------------------* Loading @@ -22,6 +22,7 @@ static void dec_2pos_fx( Word16 index, Word16 *ind1, Word16 *ind2, Word16 *sign1 * - decode the codebook indices, * - find the excitation *---------------------------------------------------------------------*/ void gaus_dec_fx( Decoder_State *st_fx, /* i/o: decoder static memory */ const Word16 i_subfr, /* i : subframe index */ Loading Loading @@ -53,6 +54,7 @@ void gaus_dec_fx( /*------------------------------------------------------------------------------------------* * Unvoiced : Gaussian codebook *------------------------------------------------------------------------------------------*/ nb_bits = st_fx->acelp_cfg.fixed_cdk_index[( i_subfr / 64 )]; move16(); Loading @@ -61,6 +63,7 @@ void gaus_dec_fx( /*------------------------------------------------------------------------------------------* * - Gain of Gaussian excitation and normalized Gaussian excitation *------------------------------------------------------------------------------------------*/ /* gain_inov = 1.0f / (float)sqrt((dot_product(code, code, L_SUBFR) + 0.01f) / L_SUBFR) */ L_tmp = Dot_product12( code, code, L_SUBFR, &exp ); exp = sub( exp, 18 /*24*/ + 6 ); /* exp: -18 (code in Q9), -6 (/L_SUBFR) */ Loading Loading @@ -141,7 +144,7 @@ void gaus_dec_fx( * One Gaussian vector of 190 values *-----------------------------------------------------*/ void gaus_dec2v_fx( static void gaus_dec2v_fx( Decoder_State *st_fx, /* i/o: decoder state structure */ Word16 *code, /* o : decoded gaussian vector Q12-exp */ const Word16 lg, /* i : codevector length Q0 */ Loading Loading @@ -211,6 +214,7 @@ void gaus_dec2v_fx( * * Decode the codevectors positions and signs *-----------------------------------------------------*/ static void dec_2pos_fx( Word16 index, /* i : quantization index Q0 */ Word16 *ind1, /* o : 1st vector index Q0 */ Loading Loading @@ -257,6 +261,7 @@ static void dec_2pos_fx( * * One Gaussian vector *-----------------------------------------------------*/ void gaus_L2_dec( Word16 *code, /* o : decoded gaussian codevector Q9 */ Word16 tilt_code, /* i : tilt of code Q15 */ Loading Loading @@ -289,6 +294,5 @@ void gaus_L2_dec( /*Shape the gaussian excitation*/ cb_shape_fx( 1, 0, 0, 1, 0, formant_enh, FORMANT_SHARPENING_G2, A, code, tilt_code, 0, 1, L_SUBFR ); return; }
lib_enc/cod_ace_fx.c +4 −0 Original line number Diff line number Diff line Loading @@ -290,8 +290,12 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision * IF( EQ_16( acelp_cfg->gains_mode[j_subfr], 7 ) ) { #ifdef FIX_2424_REMOVE_GAUSS_L2_ENC gauss_L2_fx( st->element_mode, h1, code2, y2, y22, &gain_code2, &g_corr, gain_pit, hLPDmem->tilt_code, p_Aq, acelp_cfg->formant_enh_num, &( st->seed_acelp ), shift ); #else assert( gain_pit == 0 ); gauss_L2_fx( h1, code2, y2, y22, &gain_code2, &g_corr, gain_pit, hLPDmem->tilt_code, p_Aq, acelp_cfg->formant_enh_num, &( st->seed_acelp ), shift ); #endif } ELSE { Loading
lib_enc/cod_uv_fx.c +51 −5 Original line number Diff line number Diff line Loading @@ -5,7 +5,6 @@ #include <stdint.h> #include "options.h" #include <assert.h> //#include "prot_fx.h" #include "rom_com.h" /* Common constants */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ Loading @@ -19,7 +18,11 @@ * * Gaussian excitation is generated by a white noise and shapes it with LPC-derived filter *-------------------------------------------------------------------*/ void gauss_L2_fx( #ifdef FIX_2424_REMOVE_GAUSS_L2_ENC const Word16 element_mode, /* i : element mode */ #endif const Word16 h[], /* i : weighted LP filter impulse response Q14+s */ Word16 code[], /* o : gaussian excitation Q9 */ const Word16 y2[], /* i : zero-memory filtered code. excitation Q9 */ Loading @@ -35,7 +38,17 @@ void gauss_L2_fx( { Word16 i, tmp16; Word32 tmp32, tmp32_2; #ifdef FIX_2424_REMOVE_GAUSS_L2_ENC Word16 Q_fac; Q_fac = Q18; move16(); if ( element_mode != EVS_MONO ) { Q_fac = Q16; move16(); } #endif assert( gain_pit == 0 ); Loading Loading @@ -65,29 +78,61 @@ void gauss_L2_fx( Scale_sig( y11, L_SUBFR, sub( 1, shift ) ); /* Q9 */ *gain = L_deposit_l( 0 ); move32(); /*Update correlations for gains coding */ #ifdef FIX_2424_REMOVE_GAUSS_L2_ENC tmp32 = L_shr( 21474836l /*0.01f Q31*/, 31 - Q_fac ); /* Q_fac */ tmp32_2 = L_shr( 21474836l /*0.01f Q31*/, 31 - Q_fac ); /* Q_fac */ #else tmp32 = L_shr( 21474836l /*0.01f Q31*/, 31 - 18 ); /* Q18 */ tmp32_2 = L_shr( 21474836l /*0.01f Q31*/, 31 - 18 ); /* Q18 */ #endif #ifdef FIX_2424_REMOVE_GAUSS_L2_ENC IF( element_mode == EVS_MONO ) { #endif FOR( i = 0; i < L_SUBFR; i++ ) { tmp32 = L_mac0_sat( tmp32, y11[i], y11[i] ); /* Q18 */ tmp32_2 = L_mac0_sat( tmp32_2, y11[i], y2[i] ); /* Q18 */ } #ifdef FIX_2424_REMOVE_GAUSS_L2_ENC } ELSE { FOR( i = 0; i < L_SUBFR; i++ ) { tmp16 = shr( y11[i], 1 ); tmp32 = L_mac0( tmp32, tmp16, tmp16 ); /* Q16 */ tmp32_2 = L_mac0( tmp32_2, tmp16, shr( y2[i], 1 ) ); /* Q16 */ } } #endif tmp16 = norm_l( tmp32 ); g_corr->y1y1 = round_fx_sat( L_shl( tmp32, tmp16 ) ); #ifdef FIX_2424_REMOVE_GAUSS_L2_ENC g_corr->y1y1_e = sub( sub( 31, Q_fac ), tmp16 ); #else g_corr->y1y1_e = sub( 31 - 18, tmp16 ); #endif move16(); move16(); tmp16 = norm_l( tmp32_2 ); g_corr->y1y2 = round_fx_sat( L_shl( tmp32_2, tmp16 ) ); #ifdef FIX_2424_REMOVE_GAUSS_L2_ENC g_corr->y1y2_e = sub( sub( 31, Q_fac ), tmp16 ); #else g_corr->y1y2_e = sub( 31 - 18, tmp16 ); #endif move16(); move16(); } return; } #ifndef FIX_2424_REMOVE_GAUSS_L2_ENC void gauss_L2_ivas_fx( const Word16 h[], /* i : weighted LP filter impulse response Q14+s */ Word16 code[], /* o : gaussian excitation Q9 */ Loading Loading @@ -157,3 +202,4 @@ void gauss_L2_ivas_fx( move16(); move16(); } #endif