Loading lib_enc/prot_fx_enc.h +1 −0 Original line number Diff line number Diff line Loading @@ -521,6 +521,7 @@ Word16 signal_clas_ivas_fx( Word16 *uc_clas /* o : temporary classification used in music/speech class*/ ); #endif void speech_music_classif_fx( Encoder_State *st, /* i/o: state structure */ const Word16 *new_inp, /* i : new input signal */ Loading lib_enc/sig_clas_fx.c +21 −19 Original line number Diff line number Diff line Loading @@ -31,9 +31,9 @@ #define K_SNR_FX 3541 /* Q15 .1111 */ #define C_SNR_FX -10921 /* Q15 -0.3333f */ #define THRES_EEN 514206 /* 251.077 => (10^(1/(K_EE*10))) Q11*/ /*-------------------------------------------------------------------* * signal_clas_fx() * Loading @@ -41,7 +41,8 @@ * TC frames selection *-------------------------------------------------------------------*/ Word16 signal_clas_fx( /* o : classification for current frames */ /* o : classification for current frames */ Word16 signal_clas_fx( Encoder_State *st, /* i/o: encoder state structure */ const Word16 *speech, /* i : pointer to speech signal for E computation in Qx */ const Word32 *ee, /* i : lf/hf E ration for 2 half-frames in Q6 */ Loading Loading @@ -72,7 +73,6 @@ Word16 signal_clas_fx( /* o : classification for current Ltmp = L_mult( st->voicing_fx[1], 16384 ); /* Q15*Q14->Q30 */ mean_voi2 = mac_r( Ltmp, st->voicing_fx[2], 16384 ); #ifdef FIX_2404_HARM_SIGNAL_CLAS IF( st->element_mode != EVS_MONO ) { Loading @@ -92,14 +92,12 @@ Word16 signal_clas_fx( /* o : classification for current Ltmp = BASOP_Util_Log10( Ltmp, exp_ee ); // Q25 Ltmp = Mpy_32_32( Ltmp, 671088640 /*20.f in Q25*/ ); // Q25 + Q25 -Q31 = Q19 * 0.5 = Q20 een = extract_l( L_shl( Mpy_32_16_1( Ltmp, K_EE_FX ), Q9 - Q20 ) ); // Q9 een = s_min( s_max( een, 0 ), 512 ); } } ELSE #endif { /* average spectral tilt in dB */ lo = L_Extract_lc( ee[0], &hi ); lo2 = L_Extract_lc( ee[1], &hi2 ); Loading Loading @@ -129,6 +127,7 @@ Word16 signal_clas_fx( /* o : classification for current een = mac_r( C_EE_FX, een, K_EE_FX ); } } /* compute zero crossing rate */ pt1 = speech + sub( L_look, 1 ); tmpS = shr( *pt1, 15 ); /* sets 'tmpS to -1 if *pt1 < 0 */ Loading @@ -146,6 +145,7 @@ Word16 signal_clas_fx( /* o : classification for current pc = add( abs_s( sub( st->pitch[1], st->pitch[0] ) ), abs_s( sub( st->pitch[2], st->pitch[1] ) ) ); st->tdm_pc = pc; move16(); /*-----------------------------------------------------------------* * Transform parameters to the range <0:1> * Compute the merit function Loading Loading @@ -273,8 +273,8 @@ Word16 signal_clas_fx( /* o : classification for current BREAK; } } /* Onset classification */ /* Onset classification */ /* tc_cnt == -1: frame after TC frame in continuous block of GC/VC frames */ /* tc_cnt == 0: UC frame */ /* tc_cnt == 1: onset/transition frame, coded by GC coder type */ Loading @@ -298,8 +298,10 @@ Word16 signal_clas_fx( /* o : classification for current st->tc_cnt = -1; move16(); } return clas; } #ifndef FIX_2404_HARM_SIGNAL_CLAS Word16 signal_clas_ivas_fx( /* o : classification for current frames */ Encoder_State *st, /* i/o: encoder state structure */ Loading Loading @@ -552,6 +554,7 @@ void select_TC_fx( * Select TC coder type for appropriate frames which is in general VOICED_TRANSITION, * VOICED_CLAS or ONSET frames following UNVOICED_CLAS frames *---------------------------------------------------------------------*/ test(); IF( localVAD != 0 && GE_16( tc_cnt, 1 ) ) { Loading @@ -573,21 +576,21 @@ void select_TC_fx( return; } /*-------------------------------------------------------------------* * coder_type_modif_fx() * * Coder type modification *-------------------------------------------------------------------*/ void coder_type_modif_fx( Encoder_State *st, /* i/o: encoder state structure */ const Word16 relE /* i : frame relative E to the long term average */ ) { Word16 unmod_coder_type, vbr_generic_ho; SC_VBR_ENC_HANDLE hSC_VBR = st->hSC_VBR; IF( st->Opt_SC_VBR ) { vbr_generic_ho = hSC_VBR->vbr_generic_ho; Loading Loading @@ -615,8 +618,8 @@ void coder_type_modif_fx( test(); test(); test(); if ( ( st->element_mode == 0 && GT_32( st->total_brate, ACELP_9k60 ) && EQ_16( st->coder_type, UNVOICED ) ) || ( st->element_mode > 0 && GT_32( st->total_brate, MAX_UNVOICED_BRATE ) && EQ_16( st->coder_type, UNVOICED ) ) ) if ( ( st->element_mode == EVS_MONO && GT_32( st->total_brate, ACELP_9k60 ) && EQ_16( st->coder_type, UNVOICED ) ) || ( st->element_mode > EVS_MONO && GT_32( st->total_brate, MAX_UNVOICED_BRATE ) && EQ_16( st->coder_type, UNVOICED ) ) ) { st->coder_type = GENERIC; move16(); Loading @@ -642,8 +645,7 @@ void coder_type_modif_fx( test(); test(); test(); if ( st->localVAD == 0 && ( ( EQ_16( st->coder_type, UNVOICED ) && ( ( st->Opt_SC_VBR == 0 ) || ( ( EQ_16( st->Opt_SC_VBR, 1 ) ) && vbr_generic_ho == 0 && GT_16( st->last_coder_type, UNVOICED ) ) ) ) || if ( st->localVAD == 0 && ( ( EQ_16( st->coder_type, UNVOICED ) && ( ( st->Opt_SC_VBR == 0 ) || ( ( EQ_16( st->Opt_SC_VBR, 1 ) ) && vbr_generic_ho == 0 && GT_16( st->last_coder_type, UNVOICED ) ) ) ) || EQ_16( st->coder_type, TRANSITION ) || EQ_16( st->coder_type, VOICED ) ) ) Loading Loading @@ -690,7 +692,7 @@ void coder_type_modif_fx( } } IF( st->element_mode == 0 ) IF( st->element_mode == EVS_MONO ) { /* At higher rates and with 16kHz core, allow only GC and TC coder type */ test(); Loading Loading
lib_enc/prot_fx_enc.h +1 −0 Original line number Diff line number Diff line Loading @@ -521,6 +521,7 @@ Word16 signal_clas_ivas_fx( Word16 *uc_clas /* o : temporary classification used in music/speech class*/ ); #endif void speech_music_classif_fx( Encoder_State *st, /* i/o: state structure */ const Word16 *new_inp, /* i : new input signal */ Loading
lib_enc/sig_clas_fx.c +21 −19 Original line number Diff line number Diff line Loading @@ -31,9 +31,9 @@ #define K_SNR_FX 3541 /* Q15 .1111 */ #define C_SNR_FX -10921 /* Q15 -0.3333f */ #define THRES_EEN 514206 /* 251.077 => (10^(1/(K_EE*10))) Q11*/ /*-------------------------------------------------------------------* * signal_clas_fx() * Loading @@ -41,7 +41,8 @@ * TC frames selection *-------------------------------------------------------------------*/ Word16 signal_clas_fx( /* o : classification for current frames */ /* o : classification for current frames */ Word16 signal_clas_fx( Encoder_State *st, /* i/o: encoder state structure */ const Word16 *speech, /* i : pointer to speech signal for E computation in Qx */ const Word32 *ee, /* i : lf/hf E ration for 2 half-frames in Q6 */ Loading Loading @@ -72,7 +73,6 @@ Word16 signal_clas_fx( /* o : classification for current Ltmp = L_mult( st->voicing_fx[1], 16384 ); /* Q15*Q14->Q30 */ mean_voi2 = mac_r( Ltmp, st->voicing_fx[2], 16384 ); #ifdef FIX_2404_HARM_SIGNAL_CLAS IF( st->element_mode != EVS_MONO ) { Loading @@ -92,14 +92,12 @@ Word16 signal_clas_fx( /* o : classification for current Ltmp = BASOP_Util_Log10( Ltmp, exp_ee ); // Q25 Ltmp = Mpy_32_32( Ltmp, 671088640 /*20.f in Q25*/ ); // Q25 + Q25 -Q31 = Q19 * 0.5 = Q20 een = extract_l( L_shl( Mpy_32_16_1( Ltmp, K_EE_FX ), Q9 - Q20 ) ); // Q9 een = s_min( s_max( een, 0 ), 512 ); } } ELSE #endif { /* average spectral tilt in dB */ lo = L_Extract_lc( ee[0], &hi ); lo2 = L_Extract_lc( ee[1], &hi2 ); Loading Loading @@ -129,6 +127,7 @@ Word16 signal_clas_fx( /* o : classification for current een = mac_r( C_EE_FX, een, K_EE_FX ); } } /* compute zero crossing rate */ pt1 = speech + sub( L_look, 1 ); tmpS = shr( *pt1, 15 ); /* sets 'tmpS to -1 if *pt1 < 0 */ Loading @@ -146,6 +145,7 @@ Word16 signal_clas_fx( /* o : classification for current pc = add( abs_s( sub( st->pitch[1], st->pitch[0] ) ), abs_s( sub( st->pitch[2], st->pitch[1] ) ) ); st->tdm_pc = pc; move16(); /*-----------------------------------------------------------------* * Transform parameters to the range <0:1> * Compute the merit function Loading Loading @@ -273,8 +273,8 @@ Word16 signal_clas_fx( /* o : classification for current BREAK; } } /* Onset classification */ /* Onset classification */ /* tc_cnt == -1: frame after TC frame in continuous block of GC/VC frames */ /* tc_cnt == 0: UC frame */ /* tc_cnt == 1: onset/transition frame, coded by GC coder type */ Loading @@ -298,8 +298,10 @@ Word16 signal_clas_fx( /* o : classification for current st->tc_cnt = -1; move16(); } return clas; } #ifndef FIX_2404_HARM_SIGNAL_CLAS Word16 signal_clas_ivas_fx( /* o : classification for current frames */ Encoder_State *st, /* i/o: encoder state structure */ Loading Loading @@ -552,6 +554,7 @@ void select_TC_fx( * Select TC coder type for appropriate frames which is in general VOICED_TRANSITION, * VOICED_CLAS or ONSET frames following UNVOICED_CLAS frames *---------------------------------------------------------------------*/ test(); IF( localVAD != 0 && GE_16( tc_cnt, 1 ) ) { Loading @@ -573,21 +576,21 @@ void select_TC_fx( return; } /*-------------------------------------------------------------------* * coder_type_modif_fx() * * Coder type modification *-------------------------------------------------------------------*/ void coder_type_modif_fx( Encoder_State *st, /* i/o: encoder state structure */ const Word16 relE /* i : frame relative E to the long term average */ ) { Word16 unmod_coder_type, vbr_generic_ho; SC_VBR_ENC_HANDLE hSC_VBR = st->hSC_VBR; IF( st->Opt_SC_VBR ) { vbr_generic_ho = hSC_VBR->vbr_generic_ho; Loading Loading @@ -615,8 +618,8 @@ void coder_type_modif_fx( test(); test(); test(); if ( ( st->element_mode == 0 && GT_32( st->total_brate, ACELP_9k60 ) && EQ_16( st->coder_type, UNVOICED ) ) || ( st->element_mode > 0 && GT_32( st->total_brate, MAX_UNVOICED_BRATE ) && EQ_16( st->coder_type, UNVOICED ) ) ) if ( ( st->element_mode == EVS_MONO && GT_32( st->total_brate, ACELP_9k60 ) && EQ_16( st->coder_type, UNVOICED ) ) || ( st->element_mode > EVS_MONO && GT_32( st->total_brate, MAX_UNVOICED_BRATE ) && EQ_16( st->coder_type, UNVOICED ) ) ) { st->coder_type = GENERIC; move16(); Loading @@ -642,8 +645,7 @@ void coder_type_modif_fx( test(); test(); test(); if ( st->localVAD == 0 && ( ( EQ_16( st->coder_type, UNVOICED ) && ( ( st->Opt_SC_VBR == 0 ) || ( ( EQ_16( st->Opt_SC_VBR, 1 ) ) && vbr_generic_ho == 0 && GT_16( st->last_coder_type, UNVOICED ) ) ) ) || if ( st->localVAD == 0 && ( ( EQ_16( st->coder_type, UNVOICED ) && ( ( st->Opt_SC_VBR == 0 ) || ( ( EQ_16( st->Opt_SC_VBR, 1 ) ) && vbr_generic_ho == 0 && GT_16( st->last_coder_type, UNVOICED ) ) ) ) || EQ_16( st->coder_type, TRANSITION ) || EQ_16( st->coder_type, VOICED ) ) ) Loading Loading @@ -690,7 +692,7 @@ void coder_type_modif_fx( } } IF( st->element_mode == 0 ) IF( st->element_mode == EVS_MONO ) { /* At higher rates and with 16kHz core, allow only GC and TC coder type */ test(); Loading