From 8a5ed092bf11b5322ee7c2d0566cfb1d31811efd Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Wed, 31 May 2023 10:04:14 +0300 Subject: [PATCH 1/4] Issue 511: Optimizes parametric binauralizer gain fetch. --- lib_com/options.h | 2 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 147 ++++++++++++++++++- 2 files changed, 147 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index c0f9011de9..a7d711b6be 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -226,7 +226,7 @@ #define FIX_170_DTX_MASA /* Nokia: Fix issue 170, relaxing the use of DTX in MASA format */ #define FIX_509 /* FhG: fix issue 509, too low number of bitsream indices in SBA */ - +#define FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH /* Nokia: Issue 511, significant optimization of parametric binauralizer gain fetching. */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index c3e76e7306..b8bf08d372 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -64,6 +64,19 @@ #define ADAPT_HTPROTO_ROT_LIM_0 0.4f #define ADAPT_HTPROTO_ROT_LIM_1 0.8f +#ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH +#define MAX_GAIN_CACHE_SIZE 6 + +typedef struct hrtfGainCache +{ + int16_t azi; + int16_t ele; + + float shVec[HRTF_SH_CHANNELS]; +} PARAMBIN_HRTF_GAIN_CACHE; +#endif + + /*------------------------------------------------------------------------- * Local function prototypes *------------------------------------------------------------------------*/ @@ -75,9 +88,15 @@ static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, float out #endif static void ivas_dirac_dec_decorrelate_slot( DIRAC_DEC_HANDLE hDirAC, const int16_t slot, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decRe[][CLDFB_NO_CHANNELS_MAX], float decIm[][CLDFB_NO_CHANNELS_MAX] ); +#ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH +static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( Decoder_Struct *st_ivas, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float Rmat[3][3], const int16_t subframe, const int16_t isHeadtracked ); + +static void ivas_dirac_dec_binaural_determine_processing_matrices( Decoder_Struct *st_ivas, const int16_t max_band_decorr, float Rmat[3][3], const int16_t isHeadtracked ); +#else static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( Decoder_Struct *st_ivas, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float Rmat[3][3], const int16_t subframe ); static void ivas_dirac_dec_binaural_determine_processing_matrices( Decoder_Struct *st_ivas, const int16_t max_band_decorr, float Rmat[3][3] ); +#endif #ifdef JBM_TSM_ON_TCS static void ivas_dirac_dec_binaural_process_output( Decoder_Struct *st_ivas, float *output_f[], float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const int16_t numInChannels, const int16_t subframe ); @@ -94,10 +113,15 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( HEA #endif static void formulate2x2MixingMatrix( float Ein1, float Ein2, float CinRe, float CinIm, float Eout1, float Eout2, float CoutRe, float CoutIm, float Q[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Mre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Mim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], const float regularizationFactor ); +#ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH +static void hrtfShGetHrtf( const int16_t bin, const int16_t aziDeg, const int16_t eleDeg, float *lRealp, float *lImagp, float *rRealp, float *rImagp, PARAMBIN_HRTF_GAIN_CACHE *gainCache, const int16_t useCachedValue ); +static void getDirectPartGains( const int16_t bin, int16_t aziDeg, int16_t eleDeg, float *lRealp, float *lImagp, float *rRealp, float *rImagp, const uint8_t stereoMode, float Rmat[3][3], PARAMBIN_HRTF_GAIN_CACHE *gainCache, const int16_t isHeadtracked ); +#else static void hrtfShGetHrtf( const int16_t bin, const int16_t aziDeg, const int16_t eleDeg, float *lRealp, float *lImagp, float *rRealp, float *rImagp ); static void getDirectPartGains( const int16_t bin, int16_t aziDeg, int16_t eleDeg, float *lRealp, float *lImagp, float *rRealp, float *rImagp, const uint8_t stereoMode, float Rmat[3][3] ); +#endif static void matrixMul( float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ); @@ -706,7 +730,11 @@ static void ivas_dirac_dec_binaural_internal( } } +#ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH + ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Rmat, subframe, st_ivas->hHeadTrackData && st_ivas->hHeadTrackData->num_quaternions >= 0 ); +#else ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Rmat, subframe ); +#endif if ( st_ivas->ivas_format == ISM_FORMAT ) { @@ -721,8 +749,11 @@ static void ivas_dirac_dec_binaural_internal( max_band_decorr = st_ivas->hDirAC->h_freq_domain_decorr_ap_params->max_band_decorr; } +#ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH + ivas_dirac_dec_binaural_determine_processing_matrices( st_ivas, max_band_decorr, Rmat, st_ivas->hHeadTrackData && st_ivas->hHeadTrackData->num_quaternions >= 0 ); +#else ivas_dirac_dec_binaural_determine_processing_matrices( st_ivas, max_band_decorr, Rmat ); - +#endif ivas_dirac_dec_binaural_process_output( st_ivas, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, max_band_decorr, numInChannels, subframe ); st_ivas->hDirAC->hDiffuseDist = NULL; @@ -799,7 +830,12 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float Rmat[3][3], +#ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH + const int16_t subframe, + const int16_t isHeadtracked ) +#else const int16_t subframe ) +#endif { int16_t ch, slot, bin; uint8_t separateCenterChannelRendering; @@ -813,6 +849,9 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric uint8_t applyLowBitRateEQ; int16_t dirac_read_idx; float subFrameTotalEne[CLDFB_NO_CHANNELS_MAX]; +#ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH + PARAMBIN_HRTF_GAIN_CACHE gainCache[MAX_GAIN_CACHE_SIZE]; +#endif hDirAC = st_ivas->hDirAC; h = st_ivas->hDiracDecBin; @@ -832,6 +871,13 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric set_zero( frameMeanDiffusenessEneWeight, CLDFB_NO_CHANNELS_MAX ); +#ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH + for ( idx = 0; idx < MAX_GAIN_CACHE_SIZE; idx++ ) + { + gainCache[idx].azi = -1000; /* Use -1000 as value for uninitialized cache. */ + } +#endif + /* Determine EQ for low bit rates (13.2 and 16.4 kbps) */ applyLowBitRateEQ = 0; if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MC_FORMAT ) && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE ) @@ -975,7 +1021,11 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric spreadCoh = max( spreadCoh, altSpreadCoh ); } +#ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH + getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[(dirIndex * 3)], isHeadtracked ); +#else getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, h->renderStereoOutputInsteadOfBinaural, Rmat ); +#endif if ( h->renderStereoOutputInsteadOfBinaural ) { @@ -1018,7 +1068,11 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric rImagp *= centerMul; /* Apply the gain for the left source of the three coherent sources */ +#ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH + getDirectPartGains( bin, aziDeg + 30, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[(dirIndex * 3 + 1)], isHeadtracked ); +#else getDirectPartGains( bin, aziDeg + 30, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat ); +#endif hrtfEneSides = ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); lRealp += sidesMul * lRealpTmp; @@ -1028,7 +1082,11 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Apply the gain for the right source of the three coherent sources. * -30 degrees to 330 wrapping due to internal functions. */ +#ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH + getDirectPartGains( bin, aziDeg + 330, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[(dirIndex * 3 + 2)], isHeadtracked ); +#else getDirectPartGains( bin, aziDeg + 330, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat ); +#endif hrtfEneSides += ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); lRealp += sidesMul * lRealpTmp; @@ -1215,16 +1273,29 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric static void ivas_dirac_dec_binaural_determine_processing_matrices( Decoder_Struct *st_ivas, const int16_t max_band_decorr, +#ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH + float Rmat[3][3], + const int16_t isHeadtracked ) +#else float Rmat[3][3] ) +#endif { int16_t chA, chB, bin; uint8_t separateCenterChannelRendering; int16_t nBins; DIRAC_DEC_BIN_HANDLE h; +#ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH + PARAMBIN_HRTF_GAIN_CACHE gainCache; +#endif + h = st_ivas->hDiracDecBin; separateCenterChannelRendering = st_ivas->hOutSetup.separateChannelEnabled; nBins = st_ivas->hDirAC->num_freq_bands; /* Actually bins */ +#ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH + gainCache.azi = -1000; /* Use -1000 as value for uninitialized cache. */ +#endif + for ( bin = 0; bin < nBins; bin++ ) { float tmpMtxRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], tmpMtxIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS], resultMtxRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], resultMtxIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS], gain; @@ -1367,7 +1438,11 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( h->processMtxImPrev[chA][2][bin] = h->processMtxIm[chA][2][bin]; } +#ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH + getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache, isHeadtracked ); +#else getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, h->renderStereoOutputInsteadOfBinaural, Rmat ); +#endif h->processMtxRe[0][2][bin] = lRealp * gainFactor; h->processMtxIm[0][2][bin] = lImagp * gainFactor; @@ -2108,7 +2183,13 @@ static void getDirectPartGains( float *rRealp, float *rImagp, const uint8_t renderStereoOutputInsteadOfBinaural, +#ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH + float Rmat[3][3], + PARAMBIN_HRTF_GAIN_CACHE *gainCache, + const int16_t isHeadtracked ) +#else float Rmat[3][3] ) +#endif { float aziRad, eleRad; float y, mappedX, aziRadMapped, A, A2, A3; @@ -2151,8 +2232,25 @@ static void getDirectPartGains( } else /* In regular binaural rendering mode */ { +#ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH + if ( aziDeg == gainCache->azi && eleDeg == gainCache->ele ) + { + hrtfShGetHrtf( bin, aziDeg, eleDeg, lRealp, lImagp, rRealp, rImagp, gainCache, TRUE ); + } + else + { + gainCache->azi = aziDeg; + gainCache->ele = eleDeg; + if ( isHeadtracked ) + { + rotateAziEle( (float) aziDeg, (float) eleDeg, &aziDeg, &eleDeg, Rmat, 0 ); + } + hrtfShGetHrtf( bin, aziDeg, eleDeg, lRealp, lImagp, rRealp, rImagp, gainCache, FALSE ); + } +#else rotateAziEle( (float) aziDeg, (float) eleDeg, &aziDeg, &eleDeg, Rmat, 0 ); hrtfShGetHrtf( bin, aziDeg, eleDeg, lRealp, lImagp, rRealp, rImagp ); +#endif } return; @@ -2166,9 +2264,55 @@ static void hrtfShGetHrtf( float *lRealp, float *lImagp, float *rRealp, +#ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH + float *rImagp, + PARAMBIN_HRTF_GAIN_CACHE *gainCache, + const int16_t useCachedValue ) +#else float *rImagp ) +#endif { int16_t k; +#ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH + + *lRealp = 0.0f; + *lImagp = 0.0f; + *rRealp = 0.0f; + *rImagp = 0.0f; + + if ( useCachedValue ) + { + float *shVec; + shVec = gainCache->shVec; + + for ( k = 0; k < HRTF_SH_CHANNELS; k++ ) + { + *lRealp += hrtfShCoeffsRe[0][k][bin] * shVec[k]; + *lImagp += hrtfShCoeffsIm[0][k][bin] * shVec[k]; + *rRealp += hrtfShCoeffsRe[1][k][bin] * shVec[k]; + *rImagp += hrtfShCoeffsIm[1][k][bin] * shVec[k]; + } + } + else + { + float shVec[HRTF_SH_CHANNELS]; + + ivas_dirac_dec_get_response( aziDeg, + eleDeg, + shVec, + HRTF_SH_ORDER ); + + for ( k = 0; k < HRTF_SH_CHANNELS; k++ ) + { + *lRealp += hrtfShCoeffsRe[0][k][bin] * shVec[k]; + *lImagp += hrtfShCoeffsIm[0][k][bin] * shVec[k]; + *rRealp += hrtfShCoeffsRe[1][k][bin] * shVec[k]; + *rImagp += hrtfShCoeffsIm[1][k][bin] * shVec[k]; + + gainCache->shVec[k] = shVec[k]; + } + } +#else float shVec[HRTF_SH_CHANNELS]; ivas_dirac_dec_get_response( aziDeg, @@ -2187,6 +2331,7 @@ static void hrtfShGetHrtf( *rRealp += hrtfShCoeffsRe[1][k][bin] * shVec[k]; *rImagp += hrtfShCoeffsIm[1][k][bin] * shVec[k]; } +#endif return; } -- GitLab From 2194644a0c0a9495138ffdabf44ecd427723730d Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Wed, 31 May 2023 10:45:41 +0300 Subject: [PATCH 2/4] Apply clang format. --- lib_rend/ivas_dirac_dec_binaural_functions.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index b8bf08d372..7a5a8d6dd1 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1022,7 +1022,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric } #ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH - getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[(dirIndex * 3)], isHeadtracked ); + getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 )], isHeadtracked ); #else getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, h->renderStereoOutputInsteadOfBinaural, Rmat ); #endif @@ -1069,7 +1069,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Apply the gain for the left source of the three coherent sources */ #ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH - getDirectPartGains( bin, aziDeg + 30, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[(dirIndex * 3 + 1)], isHeadtracked ); + getDirectPartGains( bin, aziDeg + 30, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 + 1 )], isHeadtracked ); #else getDirectPartGains( bin, aziDeg + 30, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat ); #endif @@ -1083,7 +1083,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Apply the gain for the right source of the three coherent sources. * -30 degrees to 330 wrapping due to internal functions. */ #ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH - getDirectPartGains( bin, aziDeg + 330, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[(dirIndex * 3 + 2)], isHeadtracked ); + getDirectPartGains( bin, aziDeg + 330, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 + 2 )], isHeadtracked ); #else getDirectPartGains( bin, aziDeg + 330, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat ); #endif -- GitLab From 59d35498f326d40f52d834d4cd64a390b253f970 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Wed, 31 May 2023 12:36:06 +0300 Subject: [PATCH 3/4] Adds one more optimization into issue 511 by checking if second direction for MASA has very low direct-to-total ratio and skipping if it does. --- lib_rend/ivas_dirac_dec_binaural_functions.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 7a5a8d6dd1..650d5c2ef4 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1000,6 +1000,16 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric } else /* For second of the two simultaneous directions */ { +#ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH + if ( ( ratio = hDirAC->energy_ratio2[dirac_read_idx][bin] ) < 0.001 ) + { + /* This touches only MASA path where second direction always has smaller ratio and + * for non-2dir it is zero. As the whole direction contribution is multiplied with + * the ratio, a very small ratio does not contribute any energy to output. Thus, + * it is better to save complexity. */ + continue; + } +#endif aziDeg = hDirAC->azimuth2[dirac_read_idx][bin]; eleDeg = hDirAC->elevation2[dirac_read_idx][bin]; ratio = hDirAC->energy_ratio2[dirac_read_idx][bin]; -- GitLab From 68dc3a8237c540c26d440a829ee17112e3166da3 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Wed, 31 May 2023 13:21:04 +0300 Subject: [PATCH 4/4] Remove duplicate assignment --- lib_rend/ivas_dirac_dec_binaural_functions.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 650d5c2ef4..a561f2ecd0 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1012,7 +1012,9 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric #endif aziDeg = hDirAC->azimuth2[dirac_read_idx][bin]; eleDeg = hDirAC->elevation2[dirac_read_idx][bin]; +#ifndef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH ratio = hDirAC->energy_ratio2[dirac_read_idx][bin]; +#endif spreadCoh = hDirAC->spreadCoherence2[dirac_read_idx][bin]; } diffuseness -= ratio; /* diffuseness = 1 - ratio1 - ratio2 */ -- GitLab