From d33fae5ab7c3feb29ab9372a29130bd4997e78af Mon Sep 17 00:00:00 2001 From: rhb Date: Thu, 8 Dec 2022 16:41:39 +0100 Subject: [PATCH 1/3] FhG: Contribution 22: stabilization of global IPD in DFT Stereo Encoder --- apps/decoder.c | 5 + lib_com/ivas_cnst.h | 4 + lib_com/ivas_prot.h | 0 lib_com/options.h | 2 +- lib_enc/ivas_stat_enc.h | 6 + lib_enc/ivas_stereo_dft_enc.c | 248 +++++++++++++++++++++++++++++++++- 6 files changed, 257 insertions(+), 8 deletions(-) mode change 100644 => 100755 apps/decoder.c mode change 100644 => 100755 lib_com/ivas_cnst.h mode change 100644 => 100755 lib_com/ivas_prot.h mode change 100644 => 100755 lib_com/options.h mode change 100644 => 100755 lib_enc/ivas_stat_enc.h mode change 100644 => 100755 lib_enc/ivas_stereo_dft_enc.c diff --git a/apps/decoder.c b/apps/decoder.c old mode 100644 new mode 100755 index 6396e3ab94..e484ee58c3 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1096,6 +1096,11 @@ static void usage_dec( void ) fprintf( stdout, " left or l or 1->left, right or r or -1->right, center or c or 0->middle\n" ); fprintf( stdout, "-q : Quiet mode, no frame counter\n" ); fprintf( stdout, " default is deactivated\n" ); +#ifdef DEBUG_MODE_INFO +#ifdef DEBUG_MODE_INFO_TWEAK + fprintf( stdout, "-info : specify subfolder name for debug output\n" ); +#endif +#endif fprintf( stdout, "\n" ); return; diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h old mode 100644 new mode 100755 index 4a9ce1e080..a9fd80eb55 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -524,6 +524,10 @@ typedef enum #define STEREO_DFT_XCORR_LB_MAX 24 +#ifdef STABILIZE_GIPD +#define STEREO_DFT_IPD_BUF_LEN 5 +#endif + #define STEREO_DFT_N_COH_PRED 4 /* Number of intra-frame predictors for coherence vector */ #define STEREO_DFT_COH_PRED_COEFFS 15 /* Number of coefficients per predictor */ #define STEREO_DFT_PRED_NBITS 2 /* Bits to signal predictor (log_2(4) = 2) */ diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h old mode 100644 new mode 100755 diff --git a/lib_com/options.h b/lib_com/options.h old mode 100644 new mode 100755 index 8a84da5d9f..78612fb0e7 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -154,7 +154,7 @@ #define FIX_VBR_COMPLEXITY /* Issue 234: fix extremely high complexity numbers for IVAS EVS mode */ #define FIX_ISM_INACTIVE_BITS /* Issue 230: fix bitbudget distribution in inactive frames in ISM format */ #define IMPROVE_CMDLINE_ROBUSTNESS /* Issue 233: Improve robustness of command-line parameters */ - +#define STABILIZE_GIPD /* FhG: Contribution 22: gIPD stabilization */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h old mode 100644 new mode 100755 index dfe32a9a02..c4c131c2c3 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -212,6 +212,12 @@ typedef struct stereo_dft_enc_data_struct float sfm; float sum_dot_prod_real; float sum_dot_prod_img; +#ifdef STABILIZE_GIPD + float dot_prod_real_smooth[STEREO_DFT_BAND_MAX]; + float dot_prod_img_smooth[STEREO_DFT_BAND_MAX]; + float ipd_buf[STEREO_DFT_BAND_MAX][STEREO_DFT_IPD_BUF_LEN]; + float prev_gipd; +#endif /*ITD*/ ITD_DATA_HANDLE hItd; diff --git a/lib_enc/ivas_stereo_dft_enc.c b/lib_enc/ivas_stereo_dft_enc.c old mode 100644 new mode 100755 index e54b98a942..c5a045cb8a --- a/lib_enc/ivas_stereo_dft_enc.c +++ b/lib_enc/ivas_stereo_dft_enc.c @@ -75,6 +75,14 @@ static void stereo_dft_enc_open( STEREO_DFT_ENC_DATA_HANDLE hStereoDft, const in static void stereo_dft_enc_compute_prm( STEREO_DFT_ENC_DATA_HANDLE hStereoDft, float *DFT_L, float *DFT_R, int16_t k_offset, int16_t flag_quant, const int16_t sp_aud_decision0, const int16_t vad_flag, float *bin_nrgL, float *bin_nrgR, float *dot_prod_nrg_ratio ); +#ifdef STABILIZE_GIPD +static float stereo_dft_calc_mean_bipd( float *pIpd, float ipd_buf[STEREO_DFT_IPD_BUF_LEN] ); + +static float stereo_dft_calc_mean_ipd_change( float *pIpd, float *ipd_smooth, int16_t gipd_band_max ); + +static void stereo_dft_gipd_stabilization( float *pgIpd, float prev_gipd, float ipd_mean_change ); +#endif + #ifdef DEBUG_MODE_DFT static void stereo_dft_enc_get_nipd_flag( STEREO_DFT_ENC_DATA_HANDLE hStereoDft, float *pgIpd, const int16_t sp_aud_decision0, const float gainIPD ); #else @@ -435,6 +443,15 @@ void stereo_dft_enc_reset( hStereoDft->side_gain_counter = 0; hStereoDft->side_gain_bitdiff_lp = STEREO_DFT_BITDIFF_INIT; set_zero( hStereoDft->gipd, STEREO_DFT_ENC_DFT_NB ); +#ifdef STABILIZE_GIPD + set_zero( hStereoDft->dot_prod_real_smooth, STEREO_DFT_BAND_MAX ); + set_zero( hStereoDft->dot_prod_img_smooth, STEREO_DFT_BAND_MAX ); + for ( i = 0; i < STEREO_DFT_BAND_MAX; i++ ) + { + set_zero( hStereoDft->ipd_buf[i], STEREO_DFT_IPD_BUF_LEN); + } + hStereoDft->prev_gipd = 0.f; +#endif hStereoDft->gipd_index = 0; set_zero( hStereoDft->res_pred_gain, STEREO_DFT_ENC_DFT_NB * STEREO_DFT_BAND_MAX ); set_s( hStereoDft->res_pred_index_EC, 0, STEREO_DFT_BAND_MAX ); @@ -630,7 +647,11 @@ void stereo_dft_enc_update( hStereoDft->nbands_dmx = stereo_dft_band_config( hStereoDft->band_limits_dmx, 1, NFFT_inner, ENC ); /*Compute main parameters*/ +#ifdef STABILIZE_GIPD + hStereoDft->gipd_band_max = dft_band_ipd[1][3]; +#else hStereoDft->gipd_band_max = dft_band_ipd[hStereoDft->hConfig->band_res][3]; +#endif hStereoDft->res_cod_band_max = dft_band_res_cod[hStereoDft->hConfig->band_res][hStereoDft->res_cod_mode[k_offset]]; hStereoDft->res_cod_line_max = (int16_t) ( 0.5f + ( hStereoDft->band_limits[hStereoDft->res_cod_band_max] - 1 ) * 2.f * hStereoDft->N / (float) ( hStereoDft->NFFT ) ); hStereoDft->res_cod_line_max = 8 * ( hStereoDft->res_cod_line_max / 8 ); @@ -1281,7 +1302,11 @@ void stereo_dft_enc_process( /* Initialization */ k_offset = STEREO_DFT_OFFSET; /*Add an offset at encoder*/ +#ifdef STABILIZE_GIPD + hStereoDft->gipd_band_max = dft_band_ipd[1][3]; +#else hStereoDft->gipd_band_max = dft_band_ipd[hStereoDft->band_res[k_offset]][3]; +#endif hStereoDft->res_cod_band_max = dft_band_res_cod[hStereoDft->band_res[k_offset]][hStereoDft->res_cod_mode[k_offset]]; hStereoDft->res_cod_line_max = (int16_t) ( 0.5f + ( hStereoDft->band_limits[hStereoDft->res_cod_band_max] - 1 ) * 2.f * input_frame / (float) ( hStereoDft->NFFT ) ); hStereoDft->res_cod_line_max = 8 * ( hStereoDft->res_cod_line_max / 8 ); @@ -2606,8 +2631,14 @@ static void stereo_dft_enc_compute_prm( float sum_energy_L, sum_energy_R; float g, c; float abs_L_R; +#ifdef STABILIZE_GIPD + float abs_L_R2; +#endif float gain_IPD; float sub_nrg_DMX[STEREO_DFT_BAND_MAX]; +#ifdef STABILIZE_GIPD + float sub_nrg_DMX2; +#endif float sub_nrg_L[STEREO_DFT_BAND_MAX]; float sub_nrg_R[STEREO_DFT_BAND_MAX]; float diff_ipd; @@ -2621,6 +2652,11 @@ static void stereo_dft_enc_compute_prm( float sum_past_dot_prod_abs, sum_past_dot_prod_abs2; float sum_past_nrg_dmx; int16_t pos; +#ifdef STABILIZE_GIPD + float pIpd[STEREO_DFT_BAND_MAX]; + float ipd_smooth[STEREO_DFT_BAND_MAX]; + float ipd_mean_change; +#endif /*------------------------------------------------------------------* * Initialization @@ -2633,7 +2669,6 @@ static void stereo_dft_enc_compute_prm( set_f( sub_nrg_L, 0, STEREO_DFT_BAND_MAX ); set_f( sub_nrg_R, 0, STEREO_DFT_BAND_MAX ); - pSideGain = hStereoDft->side_gain + k_offset * STEREO_DFT_BAND_MAX; pgIpd = hStereoDft->gipd + k_offset; pPredGain = hStereoDft->res_pred_gain + k_offset * STEREO_DFT_BAND_MAX; @@ -2642,6 +2677,9 @@ static void stereo_dft_enc_compute_prm( sum_energy_R = EPSILON; sum_dot_prod_real = EPSILON; sum_dot_prod_img = EPSILON; +#ifdef STABILIZE_GIPD + sub_nrg_DMX2 = 0.f; +#endif #ifdef DEBUG_MODE_DFT sum_nrg_L = EPSILON; sum_nrg_R = EPSILON; @@ -2671,10 +2709,17 @@ static void stereo_dft_enc_compute_prm( pNrgL = bin_nrgL; pNrgR = bin_nrgR; +#ifdef STABILIZE_GIPD + sum_nrg_L2 = EPSILON; + sum_nrg_R2 = EPSILON; + dot_prod_real2 = EPSILON; + dot_prod_img2 = EPSILON; +#else sum_nrg_L2 = 0; sum_nrg_R2 = 0; dot_prod_real2 = 0; dot_prod_img2 = 0; +#endif for ( i = hStereoDft->band_limits_dmx[b2]; i < hStereoDft->band_limits_dmx[b2 + 1]; i++ ) { @@ -2684,7 +2729,23 @@ static void stereo_dft_enc_compute_prm( /* compute dot product*/ dot_prod_real2 += pDFT_L[2 * i] * pDFT_R[2 * i] + pDFT_L[2 * i + 1] * pDFT_R[2 * i + 1]; dot_prod_img2 += pDFT_L[2 * i + 1] * pDFT_R[2 * i] - pDFT_L[2 * i] * pDFT_R[2 * i + 1]; + + } +#ifdef STABILIZE_GIPD + abs_L_R2 = sqrtf( dot_prod_real2 * dot_prod_real2 + dot_prod_img2 * dot_prod_img2 ); + sub_nrg_DMX2 = sum_nrg_L2 + sum_nrg_R2 + 2 * abs_L_R2; + + if ( b2 < hStereoDft->gipd_band_max ) + { + hStereoDft->dot_prod_real_smooth[b2] = 0.5f * hStereoDft->dot_prod_real_smooth[b2] + 0.5f * dot_prod_real2; + hStereoDft->dot_prod_img_smooth[b2] = 0.5f * hStereoDft->dot_prod_img_smooth[b2] + 0.5f * dot_prod_img2; + pIpd[b2] = (float)atan2( hStereoDft->dot_prod_img_smooth[b2], hStereoDft->dot_prod_real_smooth[b2] ); + + ipd_smooth[b2] = stereo_dft_calc_mean_bipd( &pIpd[b2], hStereoDft->ipd_buf[b2] ); + + gain_IPD += (sum_nrg_L2 + sum_nrg_R2 + 2 * dot_prod_real2) / sub_nrg_DMX2 / hStereoDft->gipd_band_max; } +#endif sum_past_nrgL2 = EPSILON; sum_past_nrgR2 = EPSILON; @@ -2838,18 +2899,24 @@ static void stereo_dft_enc_compute_prm( pPredGain[b] = 0.f; } - - if ( b < hStereoDft->gipd_band_max ) - { - gain_IPD += ( sum_nrg_L + sum_nrg_R + 2 * dot_prod_real ) / sub_nrg_DMX[b] / hStereoDft->gipd_band_max; - } - +#ifdef STABILIZE_GIPD + if ( b2 == hStereoDft->gipd_band_max ) +#else if ( b == hStereoDft->gipd_band_max - 1 ) +#endif { +#ifdef STABILIZE_GIPD + ipd_mean_change = stereo_dft_calc_mean_ipd_change( pIpd, ipd_smooth, hStereoDft->gipd_band_max ); +#endif hStereoDft->sum_dot_prod_real = ( 1.f - hStereoDft->sfm ) * hStereoDft->sum_dot_prod_real + hStereoDft->sfm * sum_dot_prod_real; hStereoDft->sum_dot_prod_img = ( 1.f - hStereoDft->sfm ) * hStereoDft->sum_dot_prod_img + hStereoDft->sfm * sum_dot_prod_img; pgIpd[0] = (float) atan2( hStereoDft->sum_dot_prod_img, hStereoDft->sum_dot_prod_real ); + +#ifdef STABILIZE_GIPD + stereo_dft_gipd_stabilization( &pgIpd[0], hStereoDft->prev_gipd, ipd_mean_change ); + hStereoDft->prev_gipd = pgIpd[0]; +#endif } } @@ -3188,6 +3255,173 @@ static void res_pred_gain_mode_decision( } +#ifdef STABILIZE_GIPD +/*------------------------------------------------------------------------- + * stereo_dft_calc_mean_bipd() + * + * Calculate mean of previous bandwise IPD values + *------------------------------------------------------------------------*/ + +static float stereo_dft_calc_mean_bipd( + float *pIpd, /* i: current bandwise IPD */ + float ipd_buf[STEREO_DFT_IPD_BUF_LEN] /* i/o: previous bandwise IPDs */ +) +{ + int16_t i; + float ipd_smooth; + float diff_to_last; + + assert( *pIpd <= EVS_PI && *pIpd >= -EVS_PI ); + + ipd_smooth = 0.f; + for ( i = 0; i < STEREO_DFT_IPD_BUF_LEN; i++ ) + { + if ( i == 0 ) + { + diff_to_last = ipd_buf[0]; + } + else + { + diff_to_last = fabsf( ipd_buf[i] - ipd_smooth ); + } + if ( diff_to_last > EVS_PI ) + { + if ( ipd_buf[i] > 0 ) + { + ipd_buf[i] -= 2 * EVS_PI; + } + else + { + ipd_buf[i] += 2 * EVS_PI; + } + } + ipd_smooth = (i / (float)(i + 1)) * ipd_smooth + (1 / (float)(i + 1)) * ipd_buf[i]; + if ( ipd_smooth < -EVS_PI ) + { + ipd_smooth += 2 * EVS_PI; + } + else if ( ipd_smooth > EVS_PI ) + { + ipd_smooth -= 2 * EVS_PI; + } + } + + for ( i = 0; i < STEREO_DFT_IPD_BUF_LEN - 1; i++ ) + { + ipd_buf[i] = ipd_buf[i + 1]; + } + ipd_buf[STEREO_DFT_IPD_BUF_LEN - 1] = *pIpd; + +#ifdef DEBUG_MODE_DFT + dbgwrite( pIpd, sizeof( float ), 1, 1, "res/stereo_dft_bipd.pcm" ); + dbgwrite( &ipd_smooth, sizeof( float ), 1, 1, "res/stereo_dft_bipd_smooth.pcm" ); +#endif + + return ipd_smooth; +} + + +/*------------------------------------------------------------------------- + * stereo_dft_calc_mean_ipd_change() + * + * Calculate mean IPD change over all bands + *------------------------------------------------------------------------*/ + +static float stereo_dft_calc_mean_ipd_change( + float *pIpd, /* i: bandwise IPDs */ + float *ipd_smooth, /* i: mean of previous bandwise IPDs */ + int16_t gipd_band_max /* i: number of IPD bands */ +) +{ + int16_t b; + float ipd_mean_change; + float ipd_change[STEREO_DFT_BAND_MAX]; + + ipd_mean_change = 0.f; + for ( b = 0; b < gipd_band_max; b++ ) + { + ipd_change[b] = fabsf( pIpd[b] - ipd_smooth[b] ); + if ( ipd_change[b] > EVS_PI ) + { + ipd_change[b] = 2 * EVS_PI - ipd_change[b]; + } + ipd_mean_change += ipd_change[b]; + } + ipd_mean_change /= gipd_band_max; + +#ifdef DEBUG_MODE_DFT + dbgwrite( ipd_change, sizeof( float ), hStereoDft->gipd_band_max, 1, "res/stereo_dft_ipd_change.pcm" ); + dbgwrite( &ipd_mean_change, sizeof( float ), 1, 1, "res/stereo_dft_ipd_mean_change.pcm" ); +#endif + + return ipd_mean_change; +} + + +/*------------------------------------------------------------------------- + * stereo_dft_gipd_stabilization() + * + * stabilize global IPD based on stability of bandwise IPDs + *------------------------------------------------------------------------*/ + +static void stereo_dft_gipd_stabilization( + float *pgIpd, /* i/o: global IPD to be stabilized */ + float prev_gipd, /* i: previous global IPD */ + float ipd_mean_change /* i: mean of previous bandwise IPDs */ +) +{ + float diff_gipd; + + if ( ipd_mean_change < 0.3f ) + { + *pgIpd = prev_gipd; + } + else + { + diff_gipd = fabsf( *pgIpd - prev_gipd ); + if ( diff_gipd > EVS_PI ) + { + diff_gipd = 2 * EVS_PI - diff_gipd; + } + if ( diff_gipd > ipd_mean_change ) + { + if ( *pgIpd > prev_gipd ) + { + if ( *pgIpd - prev_gipd < EVS_PI ) + { + *pgIpd = prev_gipd + ipd_mean_change; + } + else + { + *pgIpd = prev_gipd - ipd_mean_change; + if ( *pgIpd < -EVS_PI ) + { + *pgIpd += 2 * EVS_PI; + } + } + } + else + { + if ( prev_gipd - *pgIpd < EVS_PI ) + { + *pgIpd = prev_gipd - ipd_mean_change; + } + else + { + *pgIpd = prev_gipd + ipd_mean_change; + if ( *pgIpd > EVS_PI ) + { + *pgIpd -= 2 * EVS_PI; + } + } + } + } + } + return; +} +#endif + + /*------------------------------------------------------------------------- * stereo_dft_enc_get_nipd_flag() * -- GitLab From 54e32f4828a34732e0fddb000d670c557431f250 Mon Sep 17 00:00:00 2001 From: rhb Date: Mon, 12 Dec 2022 10:16:42 +0100 Subject: [PATCH 2/3] clang format --- lib_enc/ivas_stereo_dft_enc.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) mode change 100755 => 100644 lib_enc/ivas_stereo_dft_enc.c diff --git a/lib_enc/ivas_stereo_dft_enc.c b/lib_enc/ivas_stereo_dft_enc.c old mode 100755 new mode 100644 index c5a045cb8a..103e78a594 --- a/lib_enc/ivas_stereo_dft_enc.c +++ b/lib_enc/ivas_stereo_dft_enc.c @@ -448,7 +448,7 @@ void stereo_dft_enc_reset( set_zero( hStereoDft->dot_prod_img_smooth, STEREO_DFT_BAND_MAX ); for ( i = 0; i < STEREO_DFT_BAND_MAX; i++ ) { - set_zero( hStereoDft->ipd_buf[i], STEREO_DFT_IPD_BUF_LEN); + set_zero( hStereoDft->ipd_buf[i], STEREO_DFT_IPD_BUF_LEN ); } hStereoDft->prev_gipd = 0.f; #endif @@ -2729,7 +2729,6 @@ static void stereo_dft_enc_compute_prm( /* compute dot product*/ dot_prod_real2 += pDFT_L[2 * i] * pDFT_R[2 * i] + pDFT_L[2 * i + 1] * pDFT_R[2 * i + 1]; dot_prod_img2 += pDFT_L[2 * i + 1] * pDFT_R[2 * i] - pDFT_L[2 * i] * pDFT_R[2 * i + 1]; - } #ifdef STABILIZE_GIPD abs_L_R2 = sqrtf( dot_prod_real2 * dot_prod_real2 + dot_prod_img2 * dot_prod_img2 ); @@ -2739,11 +2738,11 @@ static void stereo_dft_enc_compute_prm( { hStereoDft->dot_prod_real_smooth[b2] = 0.5f * hStereoDft->dot_prod_real_smooth[b2] + 0.5f * dot_prod_real2; hStereoDft->dot_prod_img_smooth[b2] = 0.5f * hStereoDft->dot_prod_img_smooth[b2] + 0.5f * dot_prod_img2; - pIpd[b2] = (float)atan2( hStereoDft->dot_prod_img_smooth[b2], hStereoDft->dot_prod_real_smooth[b2] ); + pIpd[b2] = (float) atan2( hStereoDft->dot_prod_img_smooth[b2], hStereoDft->dot_prod_real_smooth[b2] ); ipd_smooth[b2] = stereo_dft_calc_mean_bipd( &pIpd[b2], hStereoDft->ipd_buf[b2] ); - gain_IPD += (sum_nrg_L2 + sum_nrg_R2 + 2 * dot_prod_real2) / sub_nrg_DMX2 / hStereoDft->gipd_band_max; + gain_IPD += ( sum_nrg_L2 + sum_nrg_R2 + 2 * dot_prod_real2 ) / sub_nrg_DMX2 / hStereoDft->gipd_band_max; } #endif @@ -3263,8 +3262,8 @@ static void res_pred_gain_mode_decision( *------------------------------------------------------------------------*/ static float stereo_dft_calc_mean_bipd( - float *pIpd, /* i: current bandwise IPD */ - float ipd_buf[STEREO_DFT_IPD_BUF_LEN] /* i/o: previous bandwise IPDs */ + float *pIpd, /* i: current bandwise IPD */ + float ipd_buf[STEREO_DFT_IPD_BUF_LEN] /* i/o: previous bandwise IPDs */ ) { int16_t i; @@ -3295,7 +3294,7 @@ static float stereo_dft_calc_mean_bipd( ipd_buf[i] += 2 * EVS_PI; } } - ipd_smooth = (i / (float)(i + 1)) * ipd_smooth + (1 / (float)(i + 1)) * ipd_buf[i]; + ipd_smooth = ( i / (float) ( i + 1 ) ) * ipd_smooth + ( 1 / (float) ( i + 1 ) ) * ipd_buf[i]; if ( ipd_smooth < -EVS_PI ) { ipd_smooth += 2 * EVS_PI; @@ -3328,9 +3327,9 @@ static float stereo_dft_calc_mean_bipd( *------------------------------------------------------------------------*/ static float stereo_dft_calc_mean_ipd_change( - float *pIpd, /* i: bandwise IPDs */ - float *ipd_smooth, /* i: mean of previous bandwise IPDs */ - int16_t gipd_band_max /* i: number of IPD bands */ + float *pIpd, /* i: bandwise IPDs */ + float *ipd_smooth, /* i: mean of previous bandwise IPDs */ + int16_t gipd_band_max /* i: number of IPD bands */ ) { int16_t b; @@ -3365,9 +3364,9 @@ static float stereo_dft_calc_mean_ipd_change( *------------------------------------------------------------------------*/ static void stereo_dft_gipd_stabilization( - float *pgIpd, /* i/o: global IPD to be stabilized */ - float prev_gipd, /* i: previous global IPD */ - float ipd_mean_change /* i: mean of previous bandwise IPDs */ + float *pgIpd, /* i/o: global IPD to be stabilized */ + float prev_gipd, /* i: previous global IPD */ + float ipd_mean_change /* i: mean of previous bandwise IPDs */ ) { float diff_gipd; -- GitLab From ecdeb63f9d5ca37710bf865d5afdae49bd1d0496 Mon Sep 17 00:00:00 2001 From: rhb Date: Fri, 16 Dec 2022 10:26:13 +0100 Subject: [PATCH 3/3] bring back inadvertently removed lines when STABILIZE_GIPD is off --- lib_enc/ivas_stereo_dft_enc.c | 7 +++++++ 1 file changed, 7 insertions(+) mode change 100644 => 100755 lib_enc/ivas_stereo_dft_enc.c diff --git a/lib_enc/ivas_stereo_dft_enc.c b/lib_enc/ivas_stereo_dft_enc.c old mode 100644 new mode 100755 index 103e78a594..4dfc9781ce --- a/lib_enc/ivas_stereo_dft_enc.c +++ b/lib_enc/ivas_stereo_dft_enc.c @@ -2898,6 +2898,13 @@ static void stereo_dft_enc_compute_prm( pPredGain[b] = 0.f; } +#ifndef STABILIZE_GIPD + if ( b < hStereoDft->gipd_band_max ) + { + gain_IPD += ( sum_nrg_L + sum_nrg_R + 2 * dot_prod_real ) / sub_nrg_DMX[b] / hStereoDft->gipd_band_max; + } +#endif + #ifdef STABILIZE_GIPD if ( b2 == hStereoDft->gipd_band_max ) #else -- GitLab