Loading lib_com/gs_gains_fx.c +103 −40 Original line number Diff line number Diff line Loading @@ -564,7 +564,6 @@ static void GSC_gain_adj_ivas_fx( return; } #endif /*-------------------------------------------------------------------* * GSC_gain_DQ() Loading Loading @@ -961,7 +960,7 @@ Word16 gsc_gainQ_ivas_fx( return mean_4g_fx[0]; } #endif #ifndef OPT_BE_2311_HARM_GSC_GAIN /*==========================================================================*/ /* FUNCTION : Word16 gsc_gaindec_fx() */ Loading Loading @@ -1326,7 +1325,20 @@ Word16 gsc_gaindec_fx( /* o : average frequency gain */ * * Quantization of the energy per band *-------------------------------------------------------------------*/ #ifdef OPT_NBE_2311_HARM_GSC_GAIN Word16 gsc_gainQ_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 idchan, /* i : channel ID */ const Word16 y_gain4[], /* i : Energy per band Q12*/ Word16 y_gainQ[], /* o : quantized energy per band Q12*/ const Word32 core_brate, /* i : Core rate */ const Word16 coder_type, /* i : coding type */ const Word16 bwidth, /* i : input signal bandwidth */ const Word16 L_frame, /* i : frame length */ const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ const Word32 core_brate_inp /* i : true core bitrate */ ) #else Word16 gsc_gainQ_fx( /*Q12*/ BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ const Word16 y_gain4[], /* i : Energy per band Q12 */ Loading @@ -1335,19 +1347,34 @@ Word16 gsc_gainQ_fx( /*Q12*/ const Word16 coder_type, /* i : coding type */ const Word16 bwidth /* i : input signal bandwidth */ ) #endif { #ifdef OPT_NBE_2311_HARM_GSC_GAIN Word16 y_gain_tmp[MBANDS_GN16k], y_gain_tmp2[MBANDS_GN16k]; #else Word16 y_gain_tmp[MBANDS_GN], y_gain_tmp2[MBANDS_GN]; #endif Word16 i, idx_g = 0; move16(); Word16 mean_4g[1] = { 0 }, tmp16, tmp1, tmp2; move16(); Word16 Mbands_gn = MBANDS_GN; #ifdef OPT_NBE_2311_HARM_GSC_GAIN Word16 y_gain_tmp3[MBANDS_GN16k]; #else Word16 y_gain_tmp3[MBANDS_GN]; #endif Word16 cnt; Word32 L_tmp; mean_4g[0] = 0; #ifdef OPT_NBE_2311_HARM_GSC_GAIN if ( EQ_16( L_frame, L_FRAME16k ) ) { Mbands_gn = MBANDS_GN16k; move16(); } #endif test(); test(); IF( ( EQ_16( coder_type, AUDIO ) || ( coder_type == INACTIVE ) ) && ( bwidth == NB ) ) Loading Loading @@ -1445,7 +1472,7 @@ Word16 gsc_gainQ_fx( /*Q12*/ } tmp16 = round_fx( L_tmp ); tmp1 = sub( tmp16, 4915 ); tmp1 = sub( tmp16, 4915 ); /* 0.6 Q12 */ tmp2 = add( tmp16, 4915 ); L_tmp = 0; move32(); Loading Loading @@ -1501,6 +1528,10 @@ Word16 gsc_gainQ_fx( /*Q12*/ idx_g = vquant_fx( y_gain_tmp2, YGain_mean_LR_fx, y_gain_tmp2, YGain_dic1_LR_fx, 3, 32 ); push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); #ifdef OPT_NBE_2311_HARM_GSC_GAIN IF( !( coder_type == INACTIVE && tdm_LRTD_flag == 0 && EQ_16( idchan, 1 ) ) || GT_32( core_brate_inp, GSC_LRES_GAINQ_LIMIT ) ) { #endif idx_g = vquant_fx( y_gain_tmp2 + 3, YGain_mean_LR_fx + 3, y_gain_tmp2 + 3, YGain_dic2_LR_fx, 4, 32 ); push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); idx_g = vquant_fx( y_gain_tmp2 + 7, YGain_mean_LR_fx + 7, y_gain_tmp2 + 7, YGain_dic3_LR_fx, 5, 32 ); Loading Loading @@ -1533,9 +1564,21 @@ Word16 gsc_gainQ_fx( /*Q12*/ move16(); y_gain_tmp[14] = y_gain_tmp3[3]; move16(); #ifdef OPT_NBE_2311_HARM_GSC_GAIN } ELSE { Copy( y_gain_tmp2, y_gain_tmp, 3 ); set16_fx( y_gain_tmp + 3, 0, MBANDS_GN16k - 3 ); } #endif } ELSE { #ifdef OPT_NBE_2311_HARM_GSC_GAIN IF( EQ_16( L_frame, L_FRAME ) ) { #endif idx_g = vquant_fx( y_gain_tmp, YG_mean16_fx, y_gain_tmp, YG_dicMR_1_fx, 4, 64 ); push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 6 ); idx_g = vquant_fx( y_gain_tmp + 4, YG_mean16_fx + 4, y_gain_tmp + 4, YG_dicMR_2_fx, 4, 32 ); Loading @@ -1545,6 +1588,26 @@ Word16 gsc_gainQ_fx( /*Q12*/ idx_g = vquant_fx( y_gain_tmp + 12, YG_mean16_fx + 12, y_gain_tmp + 12, YG_dicMR_4_fx, 4, 16 ); push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 4 ); } #ifdef OPT_NBE_2311_HARM_GSC_GAIN ELSE { idx_g = vquant_fx( y_gain_tmp, YG_mean16HR_fx, y_gain_tmp, YG_dicHR_1_fx, 4, 128 ); push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 7 ); idx_g = vquant_fx( y_gain_tmp + 4, YG_mean16HR_fx + 4, y_gain_tmp + 4, YG_dicHR_2_fx, 4, 64 ); push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 6 ); idx_g = vquant_fx( y_gain_tmp + 8, YG_mean16HR_fx + 8, y_gain_tmp + 8, YG_dicHR_3_fx, 4, 64 ); push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 6 ); idx_g = vquant_fx( y_gain_tmp + 12, YG_mean16HR_16kHz_fx, y_gain_tmp + 12, YG_dicHR_4_16kHz_fx, 4, 64 ); push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 6 ); idx_g = vquant_fx( y_gain_tmp + 16, YG_meanL2G_16kHz_fx, y_gain_tmp + 16, YG_dicL2G_16kHz_fx, 2, 8 ); push_indice( hBstr, IND_Y_GAIN_HF, idx_g, 3 ); } #endif } } /* Gain adjustment to fit ACELP generic inactive coding gain at low rate */ Loading lib_com/options.h +1 −1 Original line number Diff line number Diff line Loading @@ -148,7 +148,7 @@ #define NONBE_OPT_2239_IVAS_FILTER_PROCESS /* Dolby: Issue 2239, optimize ivas_filter_process_fx. */ #define NONBE_OPT_2193_EIG2X2 /* Dolby: Issue 2193, optimize eig2x2_fx. */ #define BE_FIX_2240_COMPUTE_COV_MTC_FX_FAST /* FhG: Speeds up covariance calculation e.g. 60 WMOPS for encoding -mc 7_1_4 24400 48 */ #define OPT_BE_2311_HARM_GSC_GAIN /* VA: BE part of the GSC gain harmonization */ #define OPT_BE_2311_HARM_GSC_GAIN /* VA: BE part of the GSC gain harmonization pipeline #70380 shows the BE */ #define OPT_NBE_2311_HARM_GSC_GAIN /* VA: NBE part of the GSC gain harmonization */ /* #################### End BASOP optimization switches ############################ */ Loading lib_com/prot_fx.h +16 −0 Original line number Diff line number Diff line Loading @@ -1557,6 +1557,7 @@ Word16 gsc_gaindec_ivas_fx( const Word16 bwidth_fx /* i : input signal bandwidth */ ); #endif #ifndef OPT_NBE_2311_HARM_GSC_GAIN Word16 gsc_gainQ_fx( BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ const Word16 y_gain4[], /* i : Energy per band Q13 */ Loading @@ -1580,6 +1581,21 @@ Word16 gsc_gainQ_ivas_fx( const Word32 core_brate_inp /* i : true core bitrate */ ); #else Word16 gsc_gainQ_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 idchan, /* i : channel ID */ const Word16 y_gain4[], /* i : Energy per band Q12 */ Word16 y_gainQ[], /* o : quantized energy per band Q12 */ const Word32 core_brate, /* i : Core rate */ const Word16 coder_type, /* i : coding type */ const Word16 bwidth, /* i : input signal bandwidth */ const Word16 L_frame, /* i : frame length */ const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ const Word32 core_brate_inp /* i : true core bitrate */ ); #endif void fer_energy_fx( const Word16 L_frame, /* i : frame length */ const Word16 clas, /* i : frame classification */ Loading lib_enc/gs_enc_fx.c +6 −0 Original line number Diff line number Diff line Loading @@ -993,6 +993,7 @@ void gsc_enc_fx( { i--; } #ifndef OPT_NBE_2311_HARM_GSC_GAIN #ifdef FIX_1904_HARM_GSC_ENC IF( NE_16( st_fx->element_mode, EVS_MONO ) ) /* This could be harmonized, but won't be BE */ { Loading @@ -1006,6 +1007,11 @@ void gsc_enc_fx( *tmp_noise = mult_r( 320, mean_gain ); /*10 in Q5 lp_gainc in Q3 */ } move16(); #else mean_gain = gsc_gainQ_fx( hBstr, st_fx->idchan, Ener_per_bd_iQ, Ener_per_bd_iQ, brate_intermed_tbl[i], st_fx->coder_type, st_fx->bwidth , st_fx->L_frame, st_fx->tdm_LRTD_flag, st_fx->core_brate ); *tmp_noise = mult_r( 320, mean_gain ); /*10 in Q5 lp_gainc in Q3 */ move16(); #endif /*--------------------------------------------------------------------------------------* * Frequency encoder Loading Loading
lib_com/gs_gains_fx.c +103 −40 Original line number Diff line number Diff line Loading @@ -564,7 +564,6 @@ static void GSC_gain_adj_ivas_fx( return; } #endif /*-------------------------------------------------------------------* * GSC_gain_DQ() Loading Loading @@ -961,7 +960,7 @@ Word16 gsc_gainQ_ivas_fx( return mean_4g_fx[0]; } #endif #ifndef OPT_BE_2311_HARM_GSC_GAIN /*==========================================================================*/ /* FUNCTION : Word16 gsc_gaindec_fx() */ Loading Loading @@ -1326,7 +1325,20 @@ Word16 gsc_gaindec_fx( /* o : average frequency gain */ * * Quantization of the energy per band *-------------------------------------------------------------------*/ #ifdef OPT_NBE_2311_HARM_GSC_GAIN Word16 gsc_gainQ_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 idchan, /* i : channel ID */ const Word16 y_gain4[], /* i : Energy per band Q12*/ Word16 y_gainQ[], /* o : quantized energy per band Q12*/ const Word32 core_brate, /* i : Core rate */ const Word16 coder_type, /* i : coding type */ const Word16 bwidth, /* i : input signal bandwidth */ const Word16 L_frame, /* i : frame length */ const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ const Word32 core_brate_inp /* i : true core bitrate */ ) #else Word16 gsc_gainQ_fx( /*Q12*/ BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ const Word16 y_gain4[], /* i : Energy per band Q12 */ Loading @@ -1335,19 +1347,34 @@ Word16 gsc_gainQ_fx( /*Q12*/ const Word16 coder_type, /* i : coding type */ const Word16 bwidth /* i : input signal bandwidth */ ) #endif { #ifdef OPT_NBE_2311_HARM_GSC_GAIN Word16 y_gain_tmp[MBANDS_GN16k], y_gain_tmp2[MBANDS_GN16k]; #else Word16 y_gain_tmp[MBANDS_GN], y_gain_tmp2[MBANDS_GN]; #endif Word16 i, idx_g = 0; move16(); Word16 mean_4g[1] = { 0 }, tmp16, tmp1, tmp2; move16(); Word16 Mbands_gn = MBANDS_GN; #ifdef OPT_NBE_2311_HARM_GSC_GAIN Word16 y_gain_tmp3[MBANDS_GN16k]; #else Word16 y_gain_tmp3[MBANDS_GN]; #endif Word16 cnt; Word32 L_tmp; mean_4g[0] = 0; #ifdef OPT_NBE_2311_HARM_GSC_GAIN if ( EQ_16( L_frame, L_FRAME16k ) ) { Mbands_gn = MBANDS_GN16k; move16(); } #endif test(); test(); IF( ( EQ_16( coder_type, AUDIO ) || ( coder_type == INACTIVE ) ) && ( bwidth == NB ) ) Loading Loading @@ -1445,7 +1472,7 @@ Word16 gsc_gainQ_fx( /*Q12*/ } tmp16 = round_fx( L_tmp ); tmp1 = sub( tmp16, 4915 ); tmp1 = sub( tmp16, 4915 ); /* 0.6 Q12 */ tmp2 = add( tmp16, 4915 ); L_tmp = 0; move32(); Loading Loading @@ -1501,6 +1528,10 @@ Word16 gsc_gainQ_fx( /*Q12*/ idx_g = vquant_fx( y_gain_tmp2, YGain_mean_LR_fx, y_gain_tmp2, YGain_dic1_LR_fx, 3, 32 ); push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); #ifdef OPT_NBE_2311_HARM_GSC_GAIN IF( !( coder_type == INACTIVE && tdm_LRTD_flag == 0 && EQ_16( idchan, 1 ) ) || GT_32( core_brate_inp, GSC_LRES_GAINQ_LIMIT ) ) { #endif idx_g = vquant_fx( y_gain_tmp2 + 3, YGain_mean_LR_fx + 3, y_gain_tmp2 + 3, YGain_dic2_LR_fx, 4, 32 ); push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); idx_g = vquant_fx( y_gain_tmp2 + 7, YGain_mean_LR_fx + 7, y_gain_tmp2 + 7, YGain_dic3_LR_fx, 5, 32 ); Loading Loading @@ -1533,9 +1564,21 @@ Word16 gsc_gainQ_fx( /*Q12*/ move16(); y_gain_tmp[14] = y_gain_tmp3[3]; move16(); #ifdef OPT_NBE_2311_HARM_GSC_GAIN } ELSE { Copy( y_gain_tmp2, y_gain_tmp, 3 ); set16_fx( y_gain_tmp + 3, 0, MBANDS_GN16k - 3 ); } #endif } ELSE { #ifdef OPT_NBE_2311_HARM_GSC_GAIN IF( EQ_16( L_frame, L_FRAME ) ) { #endif idx_g = vquant_fx( y_gain_tmp, YG_mean16_fx, y_gain_tmp, YG_dicMR_1_fx, 4, 64 ); push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 6 ); idx_g = vquant_fx( y_gain_tmp + 4, YG_mean16_fx + 4, y_gain_tmp + 4, YG_dicMR_2_fx, 4, 32 ); Loading @@ -1545,6 +1588,26 @@ Word16 gsc_gainQ_fx( /*Q12*/ idx_g = vquant_fx( y_gain_tmp + 12, YG_mean16_fx + 12, y_gain_tmp + 12, YG_dicMR_4_fx, 4, 16 ); push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 4 ); } #ifdef OPT_NBE_2311_HARM_GSC_GAIN ELSE { idx_g = vquant_fx( y_gain_tmp, YG_mean16HR_fx, y_gain_tmp, YG_dicHR_1_fx, 4, 128 ); push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 7 ); idx_g = vquant_fx( y_gain_tmp + 4, YG_mean16HR_fx + 4, y_gain_tmp + 4, YG_dicHR_2_fx, 4, 64 ); push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 6 ); idx_g = vquant_fx( y_gain_tmp + 8, YG_mean16HR_fx + 8, y_gain_tmp + 8, YG_dicHR_3_fx, 4, 64 ); push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 6 ); idx_g = vquant_fx( y_gain_tmp + 12, YG_mean16HR_16kHz_fx, y_gain_tmp + 12, YG_dicHR_4_16kHz_fx, 4, 64 ); push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 6 ); idx_g = vquant_fx( y_gain_tmp + 16, YG_meanL2G_16kHz_fx, y_gain_tmp + 16, YG_dicL2G_16kHz_fx, 2, 8 ); push_indice( hBstr, IND_Y_GAIN_HF, idx_g, 3 ); } #endif } } /* Gain adjustment to fit ACELP generic inactive coding gain at low rate */ Loading
lib_com/options.h +1 −1 Original line number Diff line number Diff line Loading @@ -148,7 +148,7 @@ #define NONBE_OPT_2239_IVAS_FILTER_PROCESS /* Dolby: Issue 2239, optimize ivas_filter_process_fx. */ #define NONBE_OPT_2193_EIG2X2 /* Dolby: Issue 2193, optimize eig2x2_fx. */ #define BE_FIX_2240_COMPUTE_COV_MTC_FX_FAST /* FhG: Speeds up covariance calculation e.g. 60 WMOPS for encoding -mc 7_1_4 24400 48 */ #define OPT_BE_2311_HARM_GSC_GAIN /* VA: BE part of the GSC gain harmonization */ #define OPT_BE_2311_HARM_GSC_GAIN /* VA: BE part of the GSC gain harmonization pipeline #70380 shows the BE */ #define OPT_NBE_2311_HARM_GSC_GAIN /* VA: NBE part of the GSC gain harmonization */ /* #################### End BASOP optimization switches ############################ */ Loading
lib_com/prot_fx.h +16 −0 Original line number Diff line number Diff line Loading @@ -1557,6 +1557,7 @@ Word16 gsc_gaindec_ivas_fx( const Word16 bwidth_fx /* i : input signal bandwidth */ ); #endif #ifndef OPT_NBE_2311_HARM_GSC_GAIN Word16 gsc_gainQ_fx( BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ const Word16 y_gain4[], /* i : Energy per band Q13 */ Loading @@ -1580,6 +1581,21 @@ Word16 gsc_gainQ_ivas_fx( const Word32 core_brate_inp /* i : true core bitrate */ ); #else Word16 gsc_gainQ_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 idchan, /* i : channel ID */ const Word16 y_gain4[], /* i : Energy per band Q12 */ Word16 y_gainQ[], /* o : quantized energy per band Q12 */ const Word32 core_brate, /* i : Core rate */ const Word16 coder_type, /* i : coding type */ const Word16 bwidth, /* i : input signal bandwidth */ const Word16 L_frame, /* i : frame length */ const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ const Word32 core_brate_inp /* i : true core bitrate */ ); #endif void fer_energy_fx( const Word16 L_frame, /* i : frame length */ const Word16 clas, /* i : frame classification */ Loading
lib_enc/gs_enc_fx.c +6 −0 Original line number Diff line number Diff line Loading @@ -993,6 +993,7 @@ void gsc_enc_fx( { i--; } #ifndef OPT_NBE_2311_HARM_GSC_GAIN #ifdef FIX_1904_HARM_GSC_ENC IF( NE_16( st_fx->element_mode, EVS_MONO ) ) /* This could be harmonized, but won't be BE */ { Loading @@ -1006,6 +1007,11 @@ void gsc_enc_fx( *tmp_noise = mult_r( 320, mean_gain ); /*10 in Q5 lp_gainc in Q3 */ } move16(); #else mean_gain = gsc_gainQ_fx( hBstr, st_fx->idchan, Ener_per_bd_iQ, Ener_per_bd_iQ, brate_intermed_tbl[i], st_fx->coder_type, st_fx->bwidth , st_fx->L_frame, st_fx->tdm_LRTD_flag, st_fx->core_brate ); *tmp_noise = mult_r( 320, mean_gain ); /*10 in Q5 lp_gainc in Q3 */ move16(); #endif /*--------------------------------------------------------------------------------------* * Frequency encoder Loading