Loading lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ #define FIX_BASOP_2332_ASAN_OVERFLOW_IN_EXT_DIRAC_REND /* Nokia: basop issue 2332: Uses predefined memory sizes instead computing wrong */ #define FIX_BASOP_2333_MCMASA_ANA_MEMORY_LEAK /* Nokia: basop issue 2333: Add missing free for direction_vector_e to ivas_mcmasa_ana_fx.c */ #define HARM_COREDECODER_FUNCTIONS /* VA: basop issue 2347: Remove various duplicated code in core-decoder */ #define FIX_2364_HARM_MULT_HARM /* VA: basop issue 2364 : harmonizing multi_harm_fx function */ /* #################### End BE switches ################################## */ Loading lib_enc/ivas_front_vad_fx.c +4 −0 Original line number Diff line number Diff line Loading @@ -698,7 +698,11 @@ ivas_error front_vad_spar_fx( { cor_strong_limit = &dummy_int; } #ifndef FIX_2364_HARM_MULT_HARM loc_harm = multi_harm_fx( st->lgBin_E_fx, hFrontVad->hNoiseEst->old_S_fx, hFrontVad->hNoiseEst->cor_map_fx, &hFrontVad->hNoiseEst->multi_harm_limit_fx, st->total_brate, st->bwidth, cor_strong_limit, &st->hSpMusClas->mean_avr_dyn_fx, &st->hSpMusClas->last_sw_dyn_fx, &cor_map_sum_fx, &dummy_fx, S_map_fx ); /* Q0 */ #else loc_harm = multi_harm_fx( EVS_MONO, st->lgBin_E_fx, hFrontVad->hNoiseEst->old_S_fx, hFrontVad->hNoiseEst->cor_map_fx, &hFrontVad->hNoiseEst->multi_harm_limit_fx, st->total_brate, st->bwidth, cor_strong_limit, &st->hSpMusClas->mean_avr_dyn_fx, &st->hSpMusClas->last_sw_dyn_fx, &cor_map_sum_fx, &dummy_fx, S_map_fx ); /* Q0 */ #endif } scale = getScaleFactor32( epsP_fx, M + 1 ); Loading lib_enc/multi_harm_fx.c +109 −42 Original line number Diff line number Diff line Loading @@ -22,7 +22,9 @@ /* o : frame multi-harmonicity (1-harmonic, 0-not) */ Word16 multi_harm_fx( #ifdef FIX_2364_HARM_MULT_HARM const Word16 element_mode, /* i : IVAS element_mode Q0 */ #endif const Word16 Bin_E[], /* i : log-energy spectrum of the current frame Q7 */ Word16 old_S[], /* i/o: prev. log-energy spectrum w. subtracted floor Q7 */ Word16 cor_map_LT[], /* i/o: LT correlation map Q15 */ Loading @@ -43,7 +45,9 @@ Word16 multi_harm_fx( Word32 L_acc; Word32 Lcorx2, Lcory2, Lcorxy, Lcor_map_LT_sum; Word16 mean_dyn; #ifdef FIX_2364_HARM_MULT_HARM Word32 tmp2_32; #endif /*------------------------------------------------------------------* * initialization *------------------------------------------------------------------*/ Loading Loading @@ -120,7 +124,36 @@ Word16 multi_harm_fx( move16(); step = 0; move16(); #ifdef FIX_2364_HARM_MULT_HARM IF( element_mode != EVS_MONO ) { FOR( i = ind_mins[0]; i < ind_mins[N_mins]; i++ ) { /* we are at the end of the next minimum */ IF( EQ_16( i, *pt_mins ) ) { pt_mins++; flor = Bin_E[i]; move16(); /*Q7*/ /* calculate the new step */ /*step = (Bin_E[*pt_mins] - Bin_E[i]) / (*pt_mins-i);*/ tmp16 = div_s( 1, sub( *pt_mins, i ) ); // Q15 step = msu_r( L_mult( Bin_E[*pt_mins], tmp16 ), Bin_E[i], tmp16 ); // Q7 (15+7+1-16) } /* subtract the floor */ S[i] = s_max( sub_sat( Bin_E[i], flor ), 0 ); move16(); /* update the floor */ flor = add( flor, step ); /*Q7*/ } } ELSE #endif { FOR( i = ind_mins[0]; i < ind_mins[N_mins]; i++ ) { /* we are at the end of the next minimum */ Loading Loading @@ -151,6 +184,7 @@ Word16 multi_harm_fx( flor = add( flor, step ); /*Q7*/ } } } /* Calculate the maximum dynamic per band */ /* since we are processing 40 bins we will use 1/40 in Q15 to find the mean */ Loading Loading @@ -285,13 +319,45 @@ Word16 multi_harm_fx( Lcor_map_LT_sum = L_deposit_l( 0 ); tmp2 = 0; move16(); #ifdef FIX_2364_HARM_MULT_HARM tmp2_32 = 0; move32(); #endif cor_strong = 0; move16(); pt1 = cor_map_LT; // Q15 move16(); pt2 = cor_map; move16(); #ifdef FIX_2364_HARM_MULT_HARM IF( element_mode != EVS_MONO ) { FOR( i = 0; i < L; i++ ) { /* tmp2 += S[i]; */ tmp2_32 = L_add( tmp2_32, cor_map[i] ); /* tmp2_32 in Q15; max value is 128) */ /* *pt1 = M_ALPHA_FX * *pt1 + (1-M_ALPHA_FX) * *pt2++ */ *pt1 = mac_r( L_mult( ONE_MINUS_M_ALPHA, *pt2 ), M_ALPHA_FX, *pt1 ); move16(); /* cor_map_LT_sum += *pt1 */ Lcor_map_LT_sum = L_add( Lcor_map_LT_sum, *pt1 ); /* cor_map_LT_sum in Q15; max value is 128) */ if ( GT_16( *pt1, 31130 ) /*0.95f*/ ) { cor_strong = 1; move16(); } pt1++; pt2++; } tmp2 = extract_l( L_shr_sat( tmp2_32, 7 ) ); // q15-> q8 } ELSE #endif { FOR( i = 0; i < L; i++ ) { /* tmp2 += S[i]; */ Loading @@ -313,7 +379,7 @@ Word16 multi_harm_fx( pt1++; pt2++; } } IF( ( bwidth == NB ) ) { /* cor_map_LT_sum *= 1.53f; */ Loading Loading @@ -360,7 +426,7 @@ Word16 multi_harm_fx( return harm; } #ifndef FIX_2364_HARM_MULT_HARM /* o : frame multi-harmonicity (1-harmonic, 0-not) */ Word16 multi_harm_ivas_fx( const Word16 Bin_E[], /* i : log-energy spectrum of the current frame Q7 */ Loading Loading @@ -695,3 +761,4 @@ Word16 multi_harm_ivas_fx( } return harm; } #endif No newline at end of file lib_enc/nois_est_fx.c +10 −0 Original line number Diff line number Diff line Loading @@ -1105,8 +1105,13 @@ void noise_est_fx( { i = 0; move16(); #ifndef FIX_2364_HARM_MULT_HARM *loc_harm = multi_harm_fx( EspecdB, hNoiseEst->old_S_fx, hNoiseEst->cor_map_fx, &hNoiseEst->multi_harm_limit_fx, st_fx->total_brate, st_fx->bwidth, ( st_fx->hGSCEnc != NULL ) ? &hGSCEnc->cor_strong_limit : &i, &hSpMusClas->mean_avr_dyn_fx, &hSpMusClas->last_sw_dyn_fx, cor_map_sum, sp_floor, S_map ); #else *loc_harm = multi_harm_fx( EVS_MONO, EspecdB, hNoiseEst->old_S_fx, hNoiseEst->cor_map_fx, &hNoiseEst->multi_harm_limit_fx, st_fx->total_brate, st_fx->bwidth, ( st_fx->hGSCEnc != NULL ) ? &hGSCEnc->cor_strong_limit : &i, &hSpMusClas->mean_avr_dyn_fx, &hSpMusClas->last_sw_dyn_fx, cor_map_sum, sp_floor, S_map ); #endif move16(); } Loading Loading @@ -2400,8 +2405,13 @@ void noise_est_ivas_fx( { i = 0; move16(); #ifndef FIX_2364_HARM_MULT_HARM *loc_harm = multi_harm_ivas_fx( EspecdB, hNoiseEst->old_S_fx, hNoiseEst->cor_map_fx, &hNoiseEst->multi_harm_limit_fx, st_fx->total_brate, st_fx->bwidth, ( st_fx->hGSCEnc != NULL ) ? &hGSCEnc->cor_strong_limit : &i, &hSpMusClas->mean_avr_dyn_fx, &hSpMusClas->last_sw_dyn_fx, cor_map_sum, sp_floor, S_map ); #else *loc_harm = multi_harm_fx( st_fx->element_mode, EspecdB, hNoiseEst->old_S_fx, hNoiseEst->cor_map_fx, &hNoiseEst->multi_harm_limit_fx, st_fx->total_brate, st_fx->bwidth, ( st_fx->hGSCEnc != NULL ) ? &hGSCEnc->cor_strong_limit : &i, &hSpMusClas->mean_avr_dyn_fx, &hSpMusClas->last_sw_dyn_fx, cor_map_sum, sp_floor, S_map ); #endif move16(); } } Loading lib_enc/prot_fx_enc.h +5 −0 Original line number Diff line number Diff line Loading @@ -4207,6 +4207,9 @@ Word32 mslvq_fx( /* o : frame multi-harmonicity (1-harmonic, 0-not) */ Word16 multi_harm_fx( #ifdef FIX_2364_HARM_MULT_HARM const Word16 element_mode, /* i : IVAS element_mode Q0 */ #endif const Word16 Bin_E[], /* i : log-energy spectrum of the current frame Q7 */ Word16 old_S[], /* i/o: prev. log-energy spectrum w. subtracted floor Q7 */ Word16 cor_map_LT[], /* i/o: LT correlation map Q15 */ Loading @@ -4221,6 +4224,7 @@ Word16 multi_harm_fx( Word16 S_map[] /* o : short-term correlation map Q7 */ ); #ifndef FIX_2364_HARM_MULT_HARM /* o : frame multi-harmonicity (1-harmonic, 0-not) */ Word16 multi_harm_ivas_fx( const Word16 Bin_E[], /* i : log-energy spectrum of the current frame Q7 */ Loading @@ -4236,6 +4240,7 @@ Word16 multi_harm_ivas_fx( Word16 *sp_floor, /* o: noise floor estimate Q7 */ Word16 S_map[] /* o : short-term correlation map Q7 */ ); #endif void pvq_encode_frame_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ Loading Loading
lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ #define FIX_BASOP_2332_ASAN_OVERFLOW_IN_EXT_DIRAC_REND /* Nokia: basop issue 2332: Uses predefined memory sizes instead computing wrong */ #define FIX_BASOP_2333_MCMASA_ANA_MEMORY_LEAK /* Nokia: basop issue 2333: Add missing free for direction_vector_e to ivas_mcmasa_ana_fx.c */ #define HARM_COREDECODER_FUNCTIONS /* VA: basop issue 2347: Remove various duplicated code in core-decoder */ #define FIX_2364_HARM_MULT_HARM /* VA: basop issue 2364 : harmonizing multi_harm_fx function */ /* #################### End BE switches ################################## */ Loading
lib_enc/ivas_front_vad_fx.c +4 −0 Original line number Diff line number Diff line Loading @@ -698,7 +698,11 @@ ivas_error front_vad_spar_fx( { cor_strong_limit = &dummy_int; } #ifndef FIX_2364_HARM_MULT_HARM loc_harm = multi_harm_fx( st->lgBin_E_fx, hFrontVad->hNoiseEst->old_S_fx, hFrontVad->hNoiseEst->cor_map_fx, &hFrontVad->hNoiseEst->multi_harm_limit_fx, st->total_brate, st->bwidth, cor_strong_limit, &st->hSpMusClas->mean_avr_dyn_fx, &st->hSpMusClas->last_sw_dyn_fx, &cor_map_sum_fx, &dummy_fx, S_map_fx ); /* Q0 */ #else loc_harm = multi_harm_fx( EVS_MONO, st->lgBin_E_fx, hFrontVad->hNoiseEst->old_S_fx, hFrontVad->hNoiseEst->cor_map_fx, &hFrontVad->hNoiseEst->multi_harm_limit_fx, st->total_brate, st->bwidth, cor_strong_limit, &st->hSpMusClas->mean_avr_dyn_fx, &st->hSpMusClas->last_sw_dyn_fx, &cor_map_sum_fx, &dummy_fx, S_map_fx ); /* Q0 */ #endif } scale = getScaleFactor32( epsP_fx, M + 1 ); Loading
lib_enc/multi_harm_fx.c +109 −42 Original line number Diff line number Diff line Loading @@ -22,7 +22,9 @@ /* o : frame multi-harmonicity (1-harmonic, 0-not) */ Word16 multi_harm_fx( #ifdef FIX_2364_HARM_MULT_HARM const Word16 element_mode, /* i : IVAS element_mode Q0 */ #endif const Word16 Bin_E[], /* i : log-energy spectrum of the current frame Q7 */ Word16 old_S[], /* i/o: prev. log-energy spectrum w. subtracted floor Q7 */ Word16 cor_map_LT[], /* i/o: LT correlation map Q15 */ Loading @@ -43,7 +45,9 @@ Word16 multi_harm_fx( Word32 L_acc; Word32 Lcorx2, Lcory2, Lcorxy, Lcor_map_LT_sum; Word16 mean_dyn; #ifdef FIX_2364_HARM_MULT_HARM Word32 tmp2_32; #endif /*------------------------------------------------------------------* * initialization *------------------------------------------------------------------*/ Loading Loading @@ -120,7 +124,36 @@ Word16 multi_harm_fx( move16(); step = 0; move16(); #ifdef FIX_2364_HARM_MULT_HARM IF( element_mode != EVS_MONO ) { FOR( i = ind_mins[0]; i < ind_mins[N_mins]; i++ ) { /* we are at the end of the next minimum */ IF( EQ_16( i, *pt_mins ) ) { pt_mins++; flor = Bin_E[i]; move16(); /*Q7*/ /* calculate the new step */ /*step = (Bin_E[*pt_mins] - Bin_E[i]) / (*pt_mins-i);*/ tmp16 = div_s( 1, sub( *pt_mins, i ) ); // Q15 step = msu_r( L_mult( Bin_E[*pt_mins], tmp16 ), Bin_E[i], tmp16 ); // Q7 (15+7+1-16) } /* subtract the floor */ S[i] = s_max( sub_sat( Bin_E[i], flor ), 0 ); move16(); /* update the floor */ flor = add( flor, step ); /*Q7*/ } } ELSE #endif { FOR( i = ind_mins[0]; i < ind_mins[N_mins]; i++ ) { /* we are at the end of the next minimum */ Loading Loading @@ -151,6 +184,7 @@ Word16 multi_harm_fx( flor = add( flor, step ); /*Q7*/ } } } /* Calculate the maximum dynamic per band */ /* since we are processing 40 bins we will use 1/40 in Q15 to find the mean */ Loading Loading @@ -285,13 +319,45 @@ Word16 multi_harm_fx( Lcor_map_LT_sum = L_deposit_l( 0 ); tmp2 = 0; move16(); #ifdef FIX_2364_HARM_MULT_HARM tmp2_32 = 0; move32(); #endif cor_strong = 0; move16(); pt1 = cor_map_LT; // Q15 move16(); pt2 = cor_map; move16(); #ifdef FIX_2364_HARM_MULT_HARM IF( element_mode != EVS_MONO ) { FOR( i = 0; i < L; i++ ) { /* tmp2 += S[i]; */ tmp2_32 = L_add( tmp2_32, cor_map[i] ); /* tmp2_32 in Q15; max value is 128) */ /* *pt1 = M_ALPHA_FX * *pt1 + (1-M_ALPHA_FX) * *pt2++ */ *pt1 = mac_r( L_mult( ONE_MINUS_M_ALPHA, *pt2 ), M_ALPHA_FX, *pt1 ); move16(); /* cor_map_LT_sum += *pt1 */ Lcor_map_LT_sum = L_add( Lcor_map_LT_sum, *pt1 ); /* cor_map_LT_sum in Q15; max value is 128) */ if ( GT_16( *pt1, 31130 ) /*0.95f*/ ) { cor_strong = 1; move16(); } pt1++; pt2++; } tmp2 = extract_l( L_shr_sat( tmp2_32, 7 ) ); // q15-> q8 } ELSE #endif { FOR( i = 0; i < L; i++ ) { /* tmp2 += S[i]; */ Loading @@ -313,7 +379,7 @@ Word16 multi_harm_fx( pt1++; pt2++; } } IF( ( bwidth == NB ) ) { /* cor_map_LT_sum *= 1.53f; */ Loading Loading @@ -360,7 +426,7 @@ Word16 multi_harm_fx( return harm; } #ifndef FIX_2364_HARM_MULT_HARM /* o : frame multi-harmonicity (1-harmonic, 0-not) */ Word16 multi_harm_ivas_fx( const Word16 Bin_E[], /* i : log-energy spectrum of the current frame Q7 */ Loading Loading @@ -695,3 +761,4 @@ Word16 multi_harm_ivas_fx( } return harm; } #endif No newline at end of file
lib_enc/nois_est_fx.c +10 −0 Original line number Diff line number Diff line Loading @@ -1105,8 +1105,13 @@ void noise_est_fx( { i = 0; move16(); #ifndef FIX_2364_HARM_MULT_HARM *loc_harm = multi_harm_fx( EspecdB, hNoiseEst->old_S_fx, hNoiseEst->cor_map_fx, &hNoiseEst->multi_harm_limit_fx, st_fx->total_brate, st_fx->bwidth, ( st_fx->hGSCEnc != NULL ) ? &hGSCEnc->cor_strong_limit : &i, &hSpMusClas->mean_avr_dyn_fx, &hSpMusClas->last_sw_dyn_fx, cor_map_sum, sp_floor, S_map ); #else *loc_harm = multi_harm_fx( EVS_MONO, EspecdB, hNoiseEst->old_S_fx, hNoiseEst->cor_map_fx, &hNoiseEst->multi_harm_limit_fx, st_fx->total_brate, st_fx->bwidth, ( st_fx->hGSCEnc != NULL ) ? &hGSCEnc->cor_strong_limit : &i, &hSpMusClas->mean_avr_dyn_fx, &hSpMusClas->last_sw_dyn_fx, cor_map_sum, sp_floor, S_map ); #endif move16(); } Loading Loading @@ -2400,8 +2405,13 @@ void noise_est_ivas_fx( { i = 0; move16(); #ifndef FIX_2364_HARM_MULT_HARM *loc_harm = multi_harm_ivas_fx( EspecdB, hNoiseEst->old_S_fx, hNoiseEst->cor_map_fx, &hNoiseEst->multi_harm_limit_fx, st_fx->total_brate, st_fx->bwidth, ( st_fx->hGSCEnc != NULL ) ? &hGSCEnc->cor_strong_limit : &i, &hSpMusClas->mean_avr_dyn_fx, &hSpMusClas->last_sw_dyn_fx, cor_map_sum, sp_floor, S_map ); #else *loc_harm = multi_harm_fx( st_fx->element_mode, EspecdB, hNoiseEst->old_S_fx, hNoiseEst->cor_map_fx, &hNoiseEst->multi_harm_limit_fx, st_fx->total_brate, st_fx->bwidth, ( st_fx->hGSCEnc != NULL ) ? &hGSCEnc->cor_strong_limit : &i, &hSpMusClas->mean_avr_dyn_fx, &hSpMusClas->last_sw_dyn_fx, cor_map_sum, sp_floor, S_map ); #endif move16(); } } Loading
lib_enc/prot_fx_enc.h +5 −0 Original line number Diff line number Diff line Loading @@ -4207,6 +4207,9 @@ Word32 mslvq_fx( /* o : frame multi-harmonicity (1-harmonic, 0-not) */ Word16 multi_harm_fx( #ifdef FIX_2364_HARM_MULT_HARM const Word16 element_mode, /* i : IVAS element_mode Q0 */ #endif const Word16 Bin_E[], /* i : log-energy spectrum of the current frame Q7 */ Word16 old_S[], /* i/o: prev. log-energy spectrum w. subtracted floor Q7 */ Word16 cor_map_LT[], /* i/o: LT correlation map Q15 */ Loading @@ -4221,6 +4224,7 @@ Word16 multi_harm_fx( Word16 S_map[] /* o : short-term correlation map Q7 */ ); #ifndef FIX_2364_HARM_MULT_HARM /* o : frame multi-harmonicity (1-harmonic, 0-not) */ Word16 multi_harm_ivas_fx( const Word16 Bin_E[], /* i : log-energy spectrum of the current frame Q7 */ Loading @@ -4236,6 +4240,7 @@ Word16 multi_harm_ivas_fx( Word16 *sp_floor, /* o: noise floor estimate Q7 */ Word16 S_map[] /* o : short-term correlation map Q7 */ ); #endif void pvq_encode_frame_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ Loading