From d1528ba87977bbf9ee605dbe114fc66f3d048528 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 9 Sep 2024 20:41:42 +0530 Subject: [PATCH] Changes to fix high MLD issues and precision improvements [x] fix for high mld issue for the case - [ltv-OMASA 2Dir1TC 1ISM at 512 kbps, 32kHz in, 48kHz out, 7.1.4 out, FER at 5%] [x] optimization changes in ivas_rom_binauralRenderer.c [x] Q/ precision improvements in decoder_tcx_post_ivas_fx, TonalMDCTConceal_Detect_ivas_fx, ivas_RefineTonalComponents_fx --- lib_com/prot_fx.h | 21 ++++ lib_dec/TonalComponentDetection_fx.c | 87 +++++++++++++++ lib_dec/core_dec_init_fx.c | 5 +- lib_dec/core_switching_dec_fx.c | 4 +- lib_dec/dec_tcx_fx.c | 110 +++++++++++-------- lib_dec/ivas_core_dec.c | 4 +- lib_dec/ivas_mct_dec.c | 8 -- lib_dec/ivas_stereo_switching_dec.c | 4 + lib_dec/stat_dec.h | 4 + lib_dec/tonalMDCTconcealment_fx.c | 79 +++++++------ lib_rend/ivas_dirac_dec_binaural_functions.c | 77 ++++++++++++- lib_rend/ivas_rom_binauralRenderer.c | 108 +++++++++++++++++- lib_rend/ivas_vbap.c | 8 +- 13 files changed, 414 insertions(+), 105 deletions(-) diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index faa6760bb..dc75804b3 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -5882,6 +5882,27 @@ void RefineTonalComponents( #endif ); +void ivas_RefineTonalComponents_fx( + Word16 indexOfTonalPeak[], + Word16 lowerIndex[], + Word16 upperIndex[], + Word16 phaseDiff[], + Word16 phases[], + Word16 *pNumIndexes, + const Word32 lastPitchLag, + const Word32 currentPitchLag, + const Word16 lastMDCTSpectrum[], + const Word16 lastMDCTSpectrum_exp, + const Word16 scaleFactors[], + const Word16 scaleFactors_exp[], + const Word16 scaleFactors_max_e, + const Word32 secondLastPowerSpectrum[], + const Word16 nSamples, + const Word16 nSamplesCore, + const Word16 floorPowerSpectrum, /* i: lower limit for power spectrum bins */ + Word16 element_mode, + const PsychoacousticParameters *psychParamsCurrent ); + ivas_error PsychoacousticParameters_Init( const int32_t sr_core, /* i : sampling rate of core-coder */ const int16_t nBins, /* i : Number of bins (spectral lines) */ diff --git a/lib_dec/TonalComponentDetection_fx.c b/lib_dec/TonalComponentDetection_fx.c index fc05a7cfc..2c182f6c8 100644 --- a/lib_dec/TonalComponentDetection_fx.c +++ b/lib_dec/TonalComponentDetection_fx.c @@ -290,6 +290,93 @@ void RefineTonalComponents( return; } +void ivas_RefineTonalComponents_fx( + Word16 indexOfTonalPeak[], + Word16 lowerIndex[], + Word16 upperIndex[], + Word16 phaseDiff[], + Word16 phases[], + Word16 *pNumIndexes, + const Word32 lastPitchLag, + const Word32 currentPitchLag, + const Word16 lastMDCTSpectrum[], + const Word16 lastMDCTSpectrum_exp, + const Word16 scaleFactors[], + const Word16 scaleFactors_exp[], + const Word16 scaleFactors_max_e, + const Word32 secondLastPowerSpectrum[], + const Word16 nSamples, + const Word16 nSamplesCore, + const Word16 floorPowerSpectrum, /* i: lower limit for power spectrum bins */ + Word16 element_mode, + const PsychoacousticParameters *psychParamsCurrent ) +{ + Word16 newIndexOfTonalPeak[MAX_NUMBER_OF_IDX]; + Word16 newLowerIndex[MAX_NUMBER_OF_IDX]; + Word16 newUpperIndex[MAX_NUMBER_OF_IDX]; + Word16 newNumIndexes, nPreservedPeaks; + Word16 iNew, iOld, j; + Word16 *pOldPhase, *pNewPhase; + + + ivas_DetectTonalComponents_fx( newIndexOfTonalPeak, newLowerIndex, newUpperIndex, &newNumIndexes, lastPitchLag, currentPitchLag, lastMDCTSpectrum, + lastMDCTSpectrum_exp, scaleFactors, scaleFactors_exp, scaleFactors_max_e, secondLastPowerSpectrum, nSamples, nSamplesCore, floorPowerSpectrum, + psychParamsCurrent, element_mode ); + + nPreservedPeaks = 0; + move16(); + iNew = 0; + move16(); + pOldPhase = phases; + pNewPhase = phases; + + FOR( iOld = 0; iOld < *pNumIndexes; iOld++ ) + { + /* We don't want that the old peak index is at the border of the new peak region, that is why >= newUpperIndex and > newLowerIndex */ + test(); + WHILE( LT_16( iNew, newNumIndexes ) && GE_16( indexOfTonalPeak[iOld], newUpperIndex[iNew] ) ) + { + iNew = add( iNew, 1 ); + } + + test(); + IF( LT_16( iNew, newNumIndexes ) && GT_16( indexOfTonalPeak[iOld], newLowerIndex[iNew] ) ) + { + newIndexOfTonalPeak[nPreservedPeaks] = indexOfTonalPeak[iOld]; + move16(); + newLowerIndex[nPreservedPeaks] = lowerIndex[iOld]; + move16(); + newUpperIndex[nPreservedPeaks] = upperIndex[iOld]; + move16(); + phaseDiff[nPreservedPeaks] = phaseDiff[iOld]; + move16(); + + FOR( j = lowerIndex[iOld]; j <= upperIndex[iOld]; j++ ) + { + *pNewPhase++ = *pOldPhase++; + move16(); + } + nPreservedPeaks = add( nPreservedPeaks, 1 ); + } + ELSE + { + pOldPhase += sub( upperIndex[iOld], add( lowerIndex[iOld], 1 ) ); + } + } + + FOR( iNew = 0; iNew < nPreservedPeaks; iNew++ ) + { + indexOfTonalPeak[iNew] = newIndexOfTonalPeak[iNew]; + move16(); + lowerIndex[iNew] = newLowerIndex[iNew]; + move16(); + upperIndex[iNew] = newUpperIndex[iNew]; + move16(); + } + *pNumIndexes = nPreservedPeaks; + move16(); + return; +} /*-------------------------------------------------------------------* * Local functions *-------------------------------------------------------------------*/ diff --git a/lib_dec/core_dec_init_fx.c b/lib_dec/core_dec_init_fx.c index 6ba494a9b..98113e16e 100644 --- a/lib_dec/core_dec_init_fx.c +++ b/lib_dec/core_dec_init_fx.c @@ -1846,7 +1846,10 @@ void open_decoder_LPD_ivas_fx( move16(); if ( hTcxDec != NULL ) { - hTcxDec->conceal_eof_gain = 32768 / 2; /*Q14*/ + hTcxDec->conceal_eof_gain32 = ONE_IN_Q30; /*Q30*/ + hTcxDec->conceal_eof_gain_e = 1; + move16(); + move32(); move16(); } } diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index 174f33911..8e1a30d8b 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -2020,8 +2020,8 @@ ivas_error core_switching_post_dec_ivas_fx( ptmp1 = &synth[delay_comp]; FOR( i = 0; i < NS2SA_FX2( st_fx->output_Fs, 3000000 ); i++ ) { - L_tmp = L_mult0( st_fx->hTcxDec->conceal_eof_gain, *ptmp2 ); - L_tmp = L_shl( L_tmp, 1 ); + L_tmp = Mpy_32_16_1( st_fx->hTcxDec->conceal_eof_gain32, *ptmp2 ); + L_tmp = L_shl( L_tmp, st_fx->hTcxDec->conceal_eof_gain_e ); tmpV = round_fx( L_tmp ); *ptmp1 = add( mult_r( tmpF, *ptmp1 ), mult_r( sub( 32767, tmpF ), tmpV ) ); diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index 3db2e2c2d..f6ce2cd0f 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -1623,6 +1623,7 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, Word16 level_syn; Word16 level_syn_e; Word32 step; + Word16 step_e; Word16 gainCNG, gainCNG_e; Word16 xn_buf[L_FRAME_MAX]; Word16 tmp1, tmp2, s; @@ -1768,8 +1769,8 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, * PLC: fade-out in time domain */ IF( bfi != 0 ) { - Word32 conceal_eof_gain32; Word32 conceal_eof_gainFB; + Word16 conceal_eof_gainFB_e; move16(); move16(); gainCNG = 1; @@ -1777,6 +1778,17 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, IF( st_fx->tcxonly != 0 ) { /*gainCNG = st_fx->conCngLevelBackgroundTrace/(tracingLevel+0.01f);*/ + IF( level_syn ) + { + level_syn_e = BASOP_Util_Add_MantExp( level_syn, level_syn_e, 20992, -6, &level_syn ); /* 0.01 in Q21*/ + } + ELSE + { + level_syn = 328; /* (1 / 0.01) in Q15 */ + level_syn_e = 0; + move16(); + move16(); + } IF( level_syn != 0 ) { @@ -1807,6 +1819,18 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, ELSE { /*gainCNG = st_fx->cngTDLevel/(tracingLevel+0.01f);*/ + IF( level_syn ) + { + level_syn_e = BASOP_Util_Add_MantExp( level_syn, level_syn_e, 20992, -6, &level_syn ); /* 0.01 in Q21*/ + } + ELSE + { + level_syn = 328; /* (1 / 0.01) in Q15 */ + level_syn_e = 0; + move16(); + move16(); + } + IF( level_syn != 0 ) { BASOP_Util_Divide_MantExp( @@ -1821,64 +1845,57 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, if ( ( EQ_16( st_fx->nbLostCmpt, 1 ) ) ) { - hTcxDec->conceal_eof_gain = 16384 /*1.0f Q14*/; /*Q14*/ + hTcxDec->conceal_eof_gain32 = ONE_IN_Q30 /*1.0f Q30*/; + move32(); + hTcxDec->conceal_eof_gain_e = 1; move16(); } /* step = (st_fx->conceal_eof_gain - ( st_fx->conceal_eof_gain * st_fx->damping + gainCNG * (1 - st_fx->damping) )) / st_fx->L_frame; */ - tmp2 = BASOP_Util_Add_MantExp( - mult_r( hTcxDec->conceal_eof_gain /*Q14*/, - hTcxDec->damping /*Q14*/ ), - 15 - 13 /*->Q15*/, - mult_r( gainCNG /*Q15*/, sub( 0x4000, hTcxDec->damping /*Q14*/ ) ) /*Q14*/, + Word32 L_tmp = BASOP_Util_Add_Mant32Exp( + Mpy_32_16_1( hTcxDec->conceal_eof_gain32, + hTcxDec->damping /*Q14*/ ), + add( 1, hTcxDec->conceal_eof_gain_e ) /*->Q15*/, + L_mult( gainCNG /*Q15*/, sub( 0x4000, hTcxDec->damping /*Q14*/ ) ) /*Q14*/, add( gainCNG_e, 15 - 14 ) /*->Q15*/, - &tmp1 ); - tmp2 = BASOP_Util_Add_MantExp( hTcxDec->conceal_eof_gain, 15 - 14, negate( tmp1 ), tmp2, &tmp1 ); + &tmp2 ); -#ifdef BASOP_NOGLOB - step = L_shl_o( L_mult( tmp1, getInvFrameLen( st_fx->L_frame ) ), sub( tmp2, 6 /*scaling from table lookup*/ + 1 /*go to Q30*/ ), &Overflow ); /*Q30*/ -#else - step = L_shl( L_mult( tmp1, getInvFrameLen( st_fx->L_frame ) ), sub( tmp2, 6 /*scaling from table lookup*/ + 1 /*go to Q30*/ ) ); /*Q30*/ -#endif + L_tmp = BASOP_Util_Add_Mant32Exp( hTcxDec->conceal_eof_gain32, hTcxDec->conceal_eof_gain_e, L_negate( L_tmp ), tmp2, &tmp2 ); + step = Mpy_32_16_1( L_tmp, getInvFrameLen( st_fx->L_frame ) ); + step_e = sub( tmp2, 6 ); { Word32 stepFB; + Word16 stepFB_e; UWord32 dmy; - conceal_eof_gainFB = L_deposit_h( hTcxDec->conceal_eof_gain ); /*Q30*/ + Word16 tmp_shift; + conceal_eof_gainFB = hTcxDec->conceal_eof_gain32; + conceal_eof_gainFB_e = hTcxDec->conceal_eof_gain_e; + move32(); + move16(); Mpy_32_32_ss( step, L_shl( L_mult0( st_fx->L_frame, getInvFrameLen( hTcxDec->L_frameTCX ) ), 8 ), &stepFB, &dmy ); -#ifdef BASOP_NOGLOB - stepFB = L_shl_o( stepFB, 3 - 1, &Overflow ); /*Q30*/ -#else - stepFB = L_shl( stepFB, 3 - 1 ); /*Q30*/ -#endif + stepFB_e = add( step_e, 2 ); + FOR( i = 0; i < hTcxDec->L_frameTCX; i++ ) { - synthFB[i] = round_fx( L_shl( Mpy_32_16_1( conceal_eof_gainFB, synthFB[i] ), 1 ) ); + tmp_shift = conceal_eof_gainFB_e; + synthFB[i] = round_fx_sat( L_shl_sat( Mpy_32_16_1( conceal_eof_gainFB, synthFB[i] ), tmp_shift ) ); move16(); -#ifdef BASOP_NOGLOB - conceal_eof_gainFB = L_sub_o( conceal_eof_gainFB, stepFB, &Overflow ); -#else - conceal_eof_gainFB = L_sub( conceal_eof_gainFB, stepFB ); -#endif + conceal_eof_gainFB = BASOP_Util_Add_Mant32Exp( conceal_eof_gainFB, conceal_eof_gainFB_e, L_negate( stepFB ), stepFB_e, &conceal_eof_gainFB_e ); } } - conceal_eof_gain32 = L_deposit_h( hTcxDec->conceal_eof_gain ); /*Q30*/ FOR( i = 0; i < st_fx->L_frame; i++ ) { - xn_buf[i] = round_fx( L_shl( Mpy_32_16_1( conceal_eof_gain32 /*Q30*/, xn_buf[i] ), 1 ) ); + xn_buf[i] = round_fx_sat( L_shl_sat( Mpy_32_16_1( hTcxDec->conceal_eof_gain32, xn_buf[i] ), hTcxDec->conceal_eof_gain_e ) ); move16(); -#ifdef BASOP_NOGLOB - conceal_eof_gain32 = L_sub_o( conceal_eof_gain32, step, &Overflow ); -#else - conceal_eof_gain32 = L_sub( conceal_eof_gain32, step ); -#endif + hTcxDec->conceal_eof_gain32 = BASOP_Util_Add_Mant32Exp( hTcxDec->conceal_eof_gain32, hTcxDec->conceal_eof_gain_e, L_negate( step ), step_e, &hTcxDec->conceal_eof_gain_e ); + move32(); } -#ifdef BASOP_NOGLOB - hTcxDec->conceal_eof_gain = round_fx_o( conceal_eof_gain32, &Overflow ); /*Q14*/ - move16(); -#else - hTcxDec->conceal_eof_gain = round_fx( conceal_eof_gain32 ); /*Q14*/ - move16(); -#endif + Word32 temp = 0; + FOR( i = 0; i < hTcxDec->L_frameTCX; i++ ) + { + temp = L_add_sat( temp, abs( synthFB[i] ) ); + } + /* run lpc gain compensation not for waveform adjustment */ test(); IF( 0 == st_fx->enablePlcWaveadjust || EQ_16( st_fx->plcInfo.concealment_method, TCX_TONAL ) ) @@ -1901,12 +1918,12 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, } st_fx->plcInfo.step_concealgain_fx = #ifdef BASOP_NOGLOB - round_fx_sat( L_shl_sat( L_mult0( round_fx_sat( step ), round_fx_sat( L_shl_sat( L_mult0( st_fx->L_frame, getInvFrameLen( hTcxDec->L_frameTCX ) ), 8 ) ) ), 3 ) ); /*Q15*/ + round_fx_sat( L_shl_sat( L_mult0( round_fx_sat( L_shr_sat( step, sub( 1, step_e ) ) ), round_fx_sat( L_shl_sat( L_mult0( st_fx->L_frame, getInvFrameLen( hTcxDec->L_frameTCX ) ), 8 ) ) ), 4 ) ); /*Q15*/ #else round_fx( L_shl( L_mult0( - round_fx( step ), + round_fx( L_shr( step, sub( 1, step_e ) ), round_fx( L_shl( L_mult0( st_fx->L_frame, getInvFrameLen( hTcxDec->L_frameTCX ) ), 8 ) ) ), - 3 ) ); /*Q15*/ + 4 ) ); /*Q15*/ #endif move16(); } @@ -2830,11 +2847,12 @@ void IMDCT_ivas_fx( test(); IF( st->element_mode != EVS_MONO && ( frame_cnt == 0 ) && ( bfi == 0 ) && ( st->prev_bfi != 0 ) && ( EQ_16( st->last_core_bfi, TCX_20_CORE ) || EQ_16( st->last_core_bfi, TCX_10_CORE ) ) && ( hTcxCfg->last_aldo == 0 ) ) { - Word16 fac; - fac = shl_sat( mult_r( hTcxDec->conceal_eof_gain, st->last_concealed_gain_syn_deemph ), 1 ); + Word32 fac; + // fac = shl_sat( mult_r( extract_h( L_shr_sat( hTcxDec->conceal_eof_gain32, sub( 1, hTcxDec->conceal_eof_gain_e ) ) ), st->last_concealed_gain_syn_deemph ), 1 ); + fac = Mpy_32_16_1( hTcxDec->conceal_eof_gain32, st->last_concealed_gain_syn_deemph ); // q = 31 - hTcxDec->conceal_eof_gain_e FOR( Word16 ind = 0; ind < overlap; ind++ ) { - old_syn_overl_fx[ind] = mult_r( old_syn_overl_fx[ind], fac ); + old_syn_overl_fx[ind] = extract_l( L_shl_sat( Mpy_32_32( old_syn_overl_fx[ind], fac ), hTcxDec->conceal_eof_gain_e ) ); move16(); } } diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 38e590273..20468f6e5 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -46,6 +46,7 @@ #include "ivas_prot_fx.h" #endif + /*-------------------------------------------------------------------* * ivas_core_dec() * @@ -289,7 +290,8 @@ ivas_error ivas_core_dec_fx( IF( !st->bfi && st->prev_bfi && ( EQ_16( st->last_core_bfi, TCX_20_CORE ) || EQ_16( st->last_core_bfi, TCX_10_CORE ) ) && st->hTcxDec != NULL ) #endif { - conceal_eof_gain32 = L_shl( L_deposit_l( st->hTcxDec->conceal_eof_gain ), 1 ); + + conceal_eof_gain32 = L_shr_sat( st->hTcxDec->conceal_eof_gain32, sub( 16, st->hTcxDec->conceal_eof_gain_e ) ); FOR( i = 0; i < st->hTcxDec->L_frameTCX; i++ ) { diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 2e2cf4410..f3221106d 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -569,14 +569,6 @@ ivas_error ivas_mct_dec_fx( x_fx[n][0] = output_fx[add( n, shl( cpe_id, 1 /* * CPE_CHANNELS*/ ) )]; x_fx[n][1] = output_fx[add( n, shl( cpe_id, 1 /* * CPE_CHANNELS*/ ) )] + ( L_FRAME48k / 2 ); } - FOR( n = 0; n < CPE_CHANNELS; n++ ) - { - if ( sts[n]->hTcxDec && sts[n]->hTcxDec->conCngLevelBackgroundTrace_e < 0 ) - { - sts[n]->hTcxDec->conCngLevelBackgroundTrace_e = 0; - move16(); - } - } Copy_Scale_sig_16_32( hCPE->hCoreCoder[0]->old_Aq_12_8_fx, hCPE->hCoreCoder[0]->old_Aq_12_8_fx_32, add( M, 1 ), sub( 28, norm_s( sub( hCPE->hCoreCoder[0]->old_Aq_12_8_fx[0], 1 ) ) ) ); Copy_Scale_sig_16_32( hCPE->hCoreCoder[1]->old_Aq_12_8_fx, hCPE->hCoreCoder[1]->old_Aq_12_8_fx_32, add( M, 1 ), sub( 28, norm_s( sub( hCPE->hCoreCoder[1]->old_Aq_12_8_fx[0], 1 ) ) ) ); diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 853a2ff80..e5f6cc63c 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -3306,6 +3306,10 @@ void stereo_switching_dec( move16(); sts[1]->hTcxDec->conceal_eof_gain = sts[0]->hTcxDec->conceal_eof_gain; move16(); + sts[1]->hTcxDec->conceal_eof_gain32 = sts[0]->hTcxDec->conceal_eof_gain32; + move32(); + sts[1]->hTcxDec->conceal_eof_gain_e = sts[0]->hTcxDec->conceal_eof_gain_e; + move16(); } return; diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index cc055680b..b42da35ad 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -756,6 +756,10 @@ typedef struct tcx_dec_structure Word16 old_gaintcx_bfi, old_gaintcx_bfi_e; Word16 conceal_eof_gain; /*Q14*/ +#ifdef IVAS_FLOAT_FIXED + Word32 conceal_eof_gain32; /*have been created for further calculation */ + Word16 conceal_eof_gain_e; /*have been created for further calculation */ +#endif #ifndef IVAS_FLOAT_FIXED float damping_float; #endif diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index 22d278f91..69905d141 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -1307,56 +1307,67 @@ void TonalMDCTConceal_Detect_ivas_fx( { /* If the second last frame was also lost, it is expected that pastTimeSignal could hold a bit different signal (e.g. including fade-out) from the one stored in TonalMDCTConceal_SaveTimeSignal. */ /* That is why we reuse the already stored information about the concealed spectrum in the second last frame */ +#ifdef MSAN_FIX + Word16 temp_power_spectrum_q = 0; +#else + Word16 power_spectrum_q; +#endif + nSamples = hTonalMDCTConc->nNonZeroSamples; + move16(); + Copy_Scale_sig_16_32( hTonalMDCTConc->secondLastPowerSpectrum, powerSpectrum, nSamples, Q15 ); + temp_power_spectrum_q = add( Q15, sub( 15, hTonalMDCTConc->secondLastPowerSpectrum_exp ) ); IF( psychParamsCurrent == NULL ) { - nSamples = hTonalMDCTConc->nNonZeroSamples; - move16(); mdct_shaping_16( hTonalMDCTConc->secondLastPowerSpectrum, hTonalMDCTConc->nSamplesCore, nSamples, hTonalMDCTConc->secondLastBlockData.scaleFactors, hTonalMDCTConc->secondLastBlockData.scaleFactors_exp, hTonalMDCTConc->secondLastBlockData.scaleFactors_max_e, powerSpectrum ); + + powerSpectrum_exp = getScaleFactor32( powerSpectrum, nSamples ); + powerSpectrum_exp = sub( powerSpectrum_exp, 3 ); /*extra 3 bits of headroom for MA filter in getEnvelope*/ + + /* multFLOAT(powerSpectrum, powerSpectrum, powerSpectrum, nSamples); */ + FOR( i = 0; i < nSamples; i++ ) + { + Word32 const t = L_shl( powerSpectrum[i], powerSpectrum_exp ); + powerSpectrum[i] = Mpy_32_32( t, t ); + move32(); + } } ELSE { -#ifdef MSAN_FIX - Word16 power_spectrum_q = 0; -#else - Word16 power_spectrum_q; -#endif FOR( i = 0; i < FDNS_NPTS; i++ ) { sns_int_scf_fx[i] = L_shl( hTonalMDCTConc->secondLastBlockData.scaleFactors[i], add( 1, hTonalMDCTConc->secondLastBlockData.scaleFactors_exp[i] ) ); // Q16 move32(); } - sns_shape_spectrum_fx( powerSpectrum, &power_spectrum_q, psychParamsCurrent, sns_int_scf_fx, 16, hTonalMDCTConc->nSamplesCore, NULL ); - } - powerSpectrum_exp = getScaleFactor32( powerSpectrum, nSamples ); - powerSpectrum_exp = sub( powerSpectrum_exp, 3 ); /*extra 3 bits of headroom for MA filter in getEnvelope*/ + sns_shape_spectrum_fx( powerSpectrum, &temp_power_spectrum_q, psychParamsCurrent, sns_int_scf_fx, 16, hTonalMDCTConc->nSamplesCore, NULL ); + powerSpectrum_exp = sub( 31, temp_power_spectrum_q ); - /* multFLOAT(powerSpectrum, powerSpectrum, powerSpectrum, nSamples); */ - FOR( i = 0; i < nSamples; i++ ) - { - Word32 const t = L_shl( powerSpectrum[i], powerSpectrum_exp ); - powerSpectrum[i] = Mpy_32_32( t, t ); - move32(); + FOR( i = 0; i < nSamples; i++ ) + { + Word32 const t = L_shl( powerSpectrum[i], -3 ); + powerSpectrum[i] = Mpy_32_32( t, t ); + move32(); + } } - RefineTonalComponents( (Word16 *) hTonalMDCTConc->pTCI->indexOfTonalPeak, - (Word16 *) hTonalMDCTConc->pTCI->lowerIndex, - (Word16 *) hTonalMDCTConc->pTCI->upperIndex, - hTonalMDCTConc->pTCI->phaseDiff, - hTonalMDCTConc->pTCI->phase_currentFramePredicted, - (Word16 *) &hTonalMDCTConc->pTCI->numIndexes, - hTonalMDCTConc->lastPitchLag, - pitchLag, - hTonalMDCTConc->lastBlockData.spectralData, - add( hTonalMDCTConc->lastBlockData.spectralData_exp, hTonalMDCTConc->lastBlockData.gain_tcx_exp ), - hTonalMDCTConc->lastBlockData.scaleFactors, - hTonalMDCTConc->lastBlockData.scaleFactors_exp, - hTonalMDCTConc->lastBlockData.scaleFactors_max_e, - powerSpectrum, - nSamples, - hTonalMDCTConc->nSamplesCore, - extract_l( Mpy_32_16_1( L_mult0( hTonalMDCTConc->nSamples, hTonalMDCTConc->nSamples ), 82 ) ), element_mode ); /* floorPowerSpectrum */ + ivas_RefineTonalComponents_fx( (Word16 *) hTonalMDCTConc->pTCI->indexOfTonalPeak, + (Word16 *) hTonalMDCTConc->pTCI->lowerIndex, + (Word16 *) hTonalMDCTConc->pTCI->upperIndex, + hTonalMDCTConc->pTCI->phaseDiff, + hTonalMDCTConc->pTCI->phase_currentFramePredicted, + (Word16 *) &hTonalMDCTConc->pTCI->numIndexes, + hTonalMDCTConc->lastPitchLag, + pitchLag, + hTonalMDCTConc->lastBlockData.spectralData, + add( hTonalMDCTConc->lastBlockData.spectralData_exp, hTonalMDCTConc->lastBlockData.gain_tcx_exp ), + hTonalMDCTConc->lastBlockData.scaleFactors, + hTonalMDCTConc->lastBlockData.scaleFactors_exp, + hTonalMDCTConc->lastBlockData.scaleFactors_max_e, + powerSpectrum, + nSamples, + hTonalMDCTConc->nSamplesCore, + extract_l( Mpy_32_16_1( L_mult0( hTonalMDCTConc->nSamples, hTonalMDCTConc->nSamples ), 82 ) ), element_mode, psychParamsCurrent ); /* floorPowerSpectrum */ } } } diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index f9d1bdfa0..f4a8b3594 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -3940,7 +3940,24 @@ static void ivas_dirac_dec_binaural_process_output_fx( FOR( bin = 0; bin < nBins; bin++ ) { Word16 gain; +#ifdef IVAS_ENH32_CADENCE_CHANGES + /* Mixing using the formulated processing matrix M */ + gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxRePrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxRe_fx[chA][chB][bin] ) ); // Q11 + + outSlotRe_fx[bin] = Madd_32_16( outSlotRe_fx[bin], inRe_fx[chB][slot][bin], gain ); // q_inp_mix-4//q_result + outSlotIm_fx[bin] = Madd_32_16( outSlotIm_fx[bin], inIm_fx[chB][slot][bin], gain ); // q_inp_mix-4//q_result + move32(); + move32(); + gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxImPrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxIm_fx[chA][chB][bin] ) ); // Q11 + + // interpVal * hDiracDecBin->processMtxIm[chA][chB][bin]; + outSlotRe_fx[bin] = Msub_32_16( outSlotRe_fx[bin], inIm_fx[chB][slot][bin], gain ); // q_inp_mix-4//q_result + outSlotIm_fx[bin] = Madd_32_16( outSlotIm_fx[bin], inRe_fx[chB][slot][bin], gain ); // q_inp_mix-4//q_result + + move32(); + move32(); +#else /* Mixing using the formulated processing matrix M */ gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxRePrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxRe_fx[chA][chB][bin] ) ); // Q11 @@ -3957,11 +3974,27 @@ static void ivas_dirac_dec_binaural_process_output_fx( move32(); move32(); - +#endif /* #ifdef IVAS_ENH32_CADENCE_CHANGES */ /* Mixing decorrelated signals using the formulated residual processing matrix Mdec */ test(); IF( LT_16( bin, max_band_decorr ) && LT_16( chB, 2 ) ) { +#ifdef IVAS_ENH32_CADENCE_CHANGES + gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxDecRePrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxDecRe_fx[chA][chB][bin] ) ); + // interpVal * hDiracDecBin->processMtxDecRe[chA][chB][bin]; + outSlotRe_fx[bin] = Madd_32_16( outSlotRe_fx[bin], decSlotRePointer_fx[bin], gain ); // q_inp_mix-4//q_result + outSlotIm_fx[bin] = Madd_32_16( outSlotIm_fx[bin], decSlotImPointer_fx[bin], gain ); // q_inp_mix-4//q_result + move32(); + move32(); + + + gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxDecImPrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxDecIm_fx[chA][chB][bin] ) ); + outSlotRe_fx[bin] = Msub_32_16( outSlotRe_fx[bin], decSlotImPointer_fx[bin], gain ); // q_inp_mix-4//q_result + outSlotIm_fx[bin] = Madd_32_16( outSlotIm_fx[bin], decSlotRePointer_fx[bin], gain ); // q_inp_mix-4//q_result + move32(); + move32(); + +#else gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxDecRePrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxDecRe_fx[chA][chB][bin] ) ); // interpVal * hDiracDecBin->processMtxDecRe[chA][chB][bin]; outSlotRe_fx[bin] = L_add( outSlotRe_fx[bin], Mpy_32_16_1( decSlotRePointer_fx[bin], gain ) ); // q_inp_mix-4//q_result @@ -3975,6 +4008,7 @@ static void ivas_dirac_dec_binaural_process_output_fx( outSlotIm_fx[bin] = L_add( outSlotIm_fx[bin], Mpy_32_16_1( decSlotRePointer_fx[bin], gain ) ); // q_inp_mix-4//q_result move32(); move32(); +#endif /* #ifdef IVAS_ENH32_CADENCE_CHANGES */ } } } @@ -5347,6 +5381,16 @@ static void matrixMul_fx( { FOR( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) { +#ifdef IVAS_ENH64_CADENCE_CHANGES + outRe_fx[chA][chB] = W_extract_h( W_mac_32_32( W_mult_32_32( Are_fx[chA][0], Bre_fx[0][chB] ), Are_fx[chA][1], Bre_fx[1][chB] ) ); + move32(); + outRe_fx[chA][chB] = L_sub( outRe_fx[chA][chB], W_extract_h( W_mac_32_32( W_mult_32_32( Aim_fx[chA][0], Bim_fx[0][chB] ), Aim_fx[chA][1], Bim_fx[1][chB] ) ) ); + move32(); + outIm_fx[chA][chB] = W_extract_h( W_mac_32_32( W_mult_32_32( Aim_fx[chA][0], Bre_fx[0][chB] ), Aim_fx[chA][1], Bre_fx[1][chB] ) ); + move32(); + outIm_fx[chA][chB] = L_add( outIm_fx[chA][chB], W_extract_h( W_mac_32_32( W_mult_32_32( Are_fx[chA][0], Bim_fx[0][chB] ), Are_fx[chA][1], Bim_fx[1][chB] ) ) ); + move32(); +#else test(); test(); test(); @@ -5445,6 +5489,7 @@ static void matrixMul_fx( } outIm_fx[chA][chB] = L_add( outIm_fx[chA][chB], L_add( tmp1, tmp2 ) ); move32(); +#endif /* #ifdef IVAS_ENH64_CADENCE_CHANGES */ } } *q_out = sub( add( *q_A, *q_B ), 31 ); @@ -5641,6 +5686,16 @@ static void matrixTransp2Mul_fx( { FOR( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) { +#ifdef IVAS_ENH64_CADENCE_CHANGES + outRe_fx[chA][chB] = W_extract_h( W_mac_32_32( W_mult_32_32( Are_fx[chA][0], Bre_fx[chB][0] ), Are_fx[chA][1], Bre_fx[chB][1] ) ); + move32(); + outRe_fx[chA][chB] = L_sub( outRe_fx[chA][chB], W_extract_h( W_mac_32_32( W_mult_32_32( Aim_fx[chA][0], L_negate( Bim_fx[chB][0] ) ), Aim_fx[chA][1], L_negate( Bim_fx[chB][1] ) ) ) ); + move32(); + outIm_fx[chA][chB] = W_extract_h( W_mac_32_32( W_mult_32_32( Aim_fx[chA][0], Bre_fx[chB][0] ), Aim_fx[chA][1], Bre_fx[chB][1] ) ); + move32(); + outIm_fx[chA][chB] = L_add( outIm_fx[chA][chB], W_extract_h( W_mac_32_32( W_mult_32_32( Are_fx[chA][0], L_negate( Bim_fx[chB][0] ) ), Are_fx[chA][1], L_negate( Bim_fx[chB][1] ) ) ) ); + move32(); +#else test(); test(); test(); @@ -5708,6 +5763,7 @@ static void matrixTransp2Mul_fx( tmp2 = L_negate( Mpy_32_32( L_abs( Are_fx[chA][1] ), L_abs( -Bim_fx[chB][1] ) ) ); outIm_fx[chA][chB] = L_add( outIm_fx[chA][chB], L_add( tmp1, tmp2 ) ); move32(); +#endif /* #ifdef IVAS_ENH64_CADENCE_CHANGES */ } } *q_out = sub( add( *q_A, *q_B ), 31 ); @@ -6782,11 +6838,17 @@ static void hrtfShGetHrtf_fx( FOR( k = 0; k < HRTF_SH_CHANNELS; k++ ) { - +#ifdef IVAS_ENH32_CADENCE_CHANGES + *lRealp = Madd_32_16( *lRealp, shVec[k], hrtfShCoeffsRe_fx[0][k][bin] ); // Q28 + *lImagp = Madd_32_16( *lImagp, shVec[k], hrtfShCoeffsIm_fx[0][k][bin] ); // Q28 + *rRealp = Madd_32_16( *rRealp, shVec[k], hrtfShCoeffsRe_fx[1][k][bin] ); // Q28 + *rImagp = Madd_32_16( *rImagp, shVec[k], hrtfShCoeffsIm_fx[1][k][bin] ); // Q28 +#else *lRealp = L_add( *lRealp, L_shr( Mpy_32_16_1( shVec[k], hrtfShCoeffsRe_fx[0][k][bin] ), 1 ) ); // Q28 *lImagp = L_add( *lImagp, Mpy_32_16_1( shVec[k], hrtfShCoeffsIm_fx[0][k][bin] ) ); // Q28 *rRealp = L_add( *rRealp, L_shr( Mpy_32_16_1( shVec[k], hrtfShCoeffsRe_fx[1][k][bin] ), 1 ) ); // Q28 *rImagp = L_add( *rImagp, Mpy_32_16_1( shVec[k], hrtfShCoeffsIm_fx[1][k][bin] ) ); // Q28 +#endif /* #ifdef IVAS_ENH32_CADENCE_CHANGES */ move32(); move32(); move32(); @@ -6805,12 +6867,17 @@ static void hrtfShGetHrtf_fx( FOR( k = 0; k < HRTF_SH_CHANNELS; k++ ) { - +#ifdef IVAS_ENH32_CADENCE_CHANGES + *lRealp = Madd_32_16( *lRealp, shVec[k], hrtfShCoeffsRe_fx[0][k][bin] ); // Q28 + *lImagp = Madd_32_16( *lImagp, shVec[k], hrtfShCoeffsIm_fx[0][k][bin] ); // Q28 + *rRealp = Madd_32_16( *rRealp, shVec[k], hrtfShCoeffsRe_fx[1][k][bin] ); // Q28 + *rImagp = Madd_32_16( *rImagp, shVec[k], hrtfShCoeffsIm_fx[1][k][bin] ); // Q28 +#else *lRealp = L_add( *lRealp, L_shr( Mpy_32_16_1( shVec[k], hrtfShCoeffsRe_fx[0][k][bin] ), 1 ) ); // Q28 *lImagp = L_add( *lImagp, Mpy_32_16_1( shVec[k], hrtfShCoeffsIm_fx[0][k][bin] ) ); // Q28 *rRealp = L_add( *rRealp, L_shr( Mpy_32_16_1( shVec[k], hrtfShCoeffsRe_fx[1][k][bin] ), 1 ) ); // Q28 - - *rImagp = L_add( *rImagp, Mpy_32_16_1( shVec[k], hrtfShCoeffsIm_fx[1][k][bin] ) ); // Q28 + *rImagp = L_add( *rImagp, Mpy_32_16_1( shVec[k], hrtfShCoeffsIm_fx[1][k][bin] ) ); // Q28 +#endif /* #ifdef IVAS_ENH32_CADENCE_CHANGES */ gainCache->shVec_fx[k] = shVec[k]; // Q29 move32(); diff --git a/lib_rend/ivas_rom_binauralRenderer.c b/lib_rend/ivas_rom_binauralRenderer.c index 0d585b1bc..f79e4ce64 100644 --- a/lib_rend/ivas_rom_binauralRenderer.c +++ b/lib_rend/ivas_rom_binauralRenderer.c @@ -21039,7 +21039,112 @@ const float rightHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]= #endif #ifdef IVAS_FLOAT_FIXED -const Word16 hrtfShCoeffsRe_fx[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS] /* Q15 */= +#ifdef IVAS_ENH32_CADENCE_CHANGES +const Word16 hrtfShCoeffsRe_fx[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS] /* Q14 */= +{ +{ +{ +15262, 9658, 3901, -1418, -6208, 15041, 14881, 14660, 14204, 13703, 13419, 13245, 13095, 12861, 12511, 12433, 12732, 13082, 13228, 13103, 12857, 12674, 12535, 12386, 12244, 12154, 12223, 12430, 12577, 12569, 12440, 12235, 11999, 11774, 11585, 11429, 11326, 11309, 11365, 11424, 11437, 11421, 11438, 11534, 11703, 11911, 12128, 12307, 12428, 12507, 12560, 7803, 353, 233, 185, 159, 141, 129, 120, 114, +}, +{ +2512, 7073, 3663, -4932, -11832, 9125, 9258, 9001, 9549, 10692, 11890, 12599, 12894, 13032, 13105, 13144, 13280, 13430, 13430, 13294, 13274, 13495, 13890, 14466, 15013, 15123, 14698, 13966, 13231, 12756, 12530, 12357, 12159, 11993, 11874, 11774, 11758, 11938, 12322, 12777, 13151, 13382, 13513, 13613, 13702, 13762, 13802, 13836, 13861, 13868, 13854, 8509, 224, 69, 10, -28, -57, -78, -93, -103, +}, +{ +1909, 491, -1490, -1812, -1939, 2695, 2572, 2313, 2118, 1834, 2422, 3343, 4702, 6558, 8164, 8525, 7404, 5240, 2686, 530, -697, -985, -667, -226, 2, -88, -459, -927, -1247, -1175, -592, 364, 1309, 1920, 2178, 2250, 2242, 2154, 2001, 1848, 1750, 1670, 1488, 1132, 617, -25, -757, -1460, -2044, -2505, -2833, -1911, -67, -26, -8, 1, 8, 12, 16, 18, +}, +{ +1352, 749, -1645, -2697, -3639, 3522, 4737, 6008, 7651, 8786, 8842, 8532, 7930, 6997, 6499, 6176, 5536, 4673, 3558, 2162, 759, -365, -1149, -1511, -1268, -292, 1348, 3286, 5013, 6292, 7162, 7818, 8446, 9053, 9451, 9438, 9056, 8541, 8111, 7870, 7802, 7835, 7891, 7901, 7800, 7533, 7097, 6592, 6120, 5726, 5439, 3221, 144, 100, 82, 71, 64, 60, 56, 54, +}, +{ +57, -757, -2771, -4035, -4237, 2024, 3174, 4548, 5873, 6766, 6152, 5490, 5138, 4788, 4745, 4906, 4987, 4705, 3868, 2359, 537, -1152, -2449, -3071, -2949, -2363, -1674, -1022, -389, 245, 847, 1472, 2246, 3043, 3445, 3217, 2621, 2163, 2162, 2601, 3254, 3888, 4376, 4728, 5014, 5258, 5411, 5446, 5386, 5256, 5093, 3070, 89, 31, 7, -8, -19, -26, -32, -36, +}, +{ +-227, 335, -2902, -2520, -2019, 593, 199, -974, -1944, -2169, -1372, -472, 171, 1206, 2475, 2936, 2001, -88, -2808, -5241, -6657, -7056, -6750, -5825, -4122, -1873, 115, 1229, 1485, 1330, 1220, 1326, 1481, 1383, 984, 499, 99, -181, -337, -313, -61, 337, 681, 803, 661, 271, -292, -881, -1388, -1800, -2101, -1437, -88, -60, -48, -41, -36, -33, -30, -28, +}, +{ +-181, 1118, 2818, 3684, 3341, -2320, -2914, -2841, -2539, -2909, -3164, -3287, -3378, -3519, -3097, -1559, 673, 2638, 3664, 3564, 2365, 323, -2103, -4328, -5612, -5607, -4829, -4102, -4010, -4659, -5684, -6646, -7402, -8060, -8598, -8842, -8709, -8308, -7828, -7397, -7045, -6717, -6318, -5790, -5143, -4430, -3746, -3199, -2822, -2574, -2418, -1452, -44, -12, -1, 5, 10, 13, 16, 18, +}, +{ +208, -2005, -2657, -802, -194, -102, -968, -1233, -646, -223, 744, 1312, 1694, 2070, 2354, 2369, 2478, 3045, 3905, 4811, 5328, 5086, 4068, 2061, -1074, -4579, -7300, -8665, -8731, -7878, -6590, -5212, -3825, -2394, -1030, 56, 773, 1236, 1633, 2036, 2393, 2634, 2747, 2794, 2872, 3044, 3287, 3523, 3706, 3825, 3872, 2400, 105, 58, 38, 25, 17, 10, 6, 3, +}, +{ +482, 4180, 6357, 5316, 2943, 2790, 3261, 4049, 3526, 1759, 136, -746, -1202, -1670, -2389, -3083, -3580, -3766, -3721, -3504, -3243, -3066, -2918, -3002, -3503, -3982, -3623, -2223, -366, 1255, 2487, 3507, 4413, 5157, 5639, 5817, 5677, 5265, 4686, 4057, 3483, 3033, 2731, 2550, 2440, 2349, 2225, 2057, 1876, 1711, 1600, 884, 71, 81, 83, 86, 88, 90, 91, 92, +}, +{ +-673, -4039, -7432, -9477, -7969, 1394, 1273, 1722, 1589, 743, 341, 266, 539, 698, 553, 268, -124, -490, -812, -1179, -1505, -1515, -1122, -772, -964, -1612, -2162, -2151, -1583, -741, 264, 1455, 2771, 3973, 4716, 4876, 4665, 4453, 4496, 4789, 5164, 5472, 5666, 5811, 5978, 6177, 6329, 6365, 6295, 6135, 5908, 3542, 61, -23, -57, -79, -95, -107, -117, -123, +}, +{ +-25, 563, -1623, -937, 97, 143, 46, -388, 38, 771, 1168, 1016, 925, 1244, 1570, 1830, 2133, 2599, 3152, 3747, 4305, 4670, 4517, 3350, 1238, -1011, -2726, -3794, -4328, -4495, -4472, -4379, -4176, -3806, -3362, -3028, -2910, -2898, -2744, -2281, -1517, -604, 262, 937, 1394, 1727, 2068, 2457, 2851, 3224, 3538, 2357, 106, 60, 40, 29, 21, 15, 10, 7, +}, +{ +-464, -2594, -6346, -3429, -2268, 408, 1246, 1126, 1423, 370, -768, -1616, -2586, -3550, -3776, -2915, -929, 1628, 3769, 4801, 4500, 3094, 888, -1968, -4831, -6457, -6194, -4598, -2800, -1518, -815, -597, -860, -1539, -2336, -2878, -3022, -2910, -2795, -2844, -3057, -3281, -3324, -3088, -2606, -1980, -1341, -824, -474, -262, -174, -76, -24, -40, -47, -52, -57, -60, -63, -65, +}, +{ +-205, -401, 437, 1642, 494, -311, -32, 875, 1027, 701, 615, 704, 534, -104, -1146, -2140, -2371, -1570, 320, 2713, 4714, 5885, 6067, 5127, 3396, 1693, 561, 43, 10, 282, 725, 1147, 1259, 823, -236, -1691, -3113, -4191, -4872, -5275, -5531, -5700, -5772, -5722, -5552, -5275, -4867, -4361, -3849, -3371, -2970, -1636, -72, -50, -39, -32, -27, -24, -22, -21, +}, +{ +-585, -463, 924, 2364, 1444, -871, -1456, -1290, -1372, -1161, -722, -1056, -1376, -1142, -1080, -1076, -469, 674, 1657, 2449, 2920, 3102, 3447, 4242, 5372, 6064, 5466, 3614, 1237, -1079, -3078, -4664, -5730, -6180, -5973, -5235, -4293, -3464, -2894, -2547, -2265, -1879, -1315, -667, -121, 182, 242, 175, 84, 27, 23, 16, -14, -7, -3, -1, 0, 2, 3, 4, +}, +{ +108, -471, -1814, 888, 813, -1341, -518, 44, 1291, 1663, 1231, 744, 898, 1175, 1132, 992, 1153, 1783, 2823, 3915, 4657, 5033, 5245, 5052, 3755, 1132, -2032, -4707, -6378, -7010, -6834, -6122, -4960, -3218, -1003, 1201, 2935, 4075, 4749, 5071, 5039, 4652, 3991, 3191, 2419, 1815, 1415, 1186, 1070, 1013, 977, 562, 29, 21, 18, 15, 13, 11, 10, 9, +}, +{ +1, 232, -515, -204, 275, -374, -1326, -2166, -2161, -2251, -1547, -696, -539, -756, -795, -979, -1389, -1454, -1000, -231, 661, 1631, 2559, 3165, 3164, 2711, 2425, 2692, 3254, 3766, 4170, 4506, 4702, 4810, 5123, 5773, 6496, 6846, 6578, 5791, 4779, 3827, 3101, 2583, 2096, 1493, 771, 59, -528, -962, -1225, -872, -36, -12, 0, 7, 12, 16, 19, 21, +}, +}, +{ +{ +15262, 9658, 3901, -1418, -6208, 15041, 14881, 14660, 14204, 13703, 13419, 13245, 13095, 12861, 12511, 12433, 12732, 13082, 13228, 13103, 12857, 12674, 12535, 12386, 12244, 12154, 12223, 12430, 12577, 12569, 12440, 12235, 11999, 11774, 11585, 11429, 11326, 11309, 11365, 11424, 11437, 11421, 11438, 11534, 11703, 11911, 12128, 12307, 12428, 12507, 12560, 7803, 353, 233, 185, 159, 141, 129, 120, 114, +}, +{ +-2512, -7073, -3663, 4932, 11832, -9125, -9258, -9001, -9549, -10692, -11890, -12599, -12894, -13032, -13105, -13144, -13280, -13430, -13430, -13294, -13274, -13495, -13890, -14466, -15013, -15123, -14698, -13966, -13231, -12756, -12530, -12357, -12159, -11993, -11874, -11774, -11758, -11938, -12322, -12777, -13151, -13382, -13513, -13613, -13702, -13762, -13802, -13836, -13861, -13868, -13854, -8509, -224, -69, -10, 28, 57, 78, 93, 103, +}, +{ +1909, 491, -1490, -1812, -1939, 2695, 2572, 2313, 2118, 1834, 2422, 3343, 4702, 6558, 8164, 8525, 7404, 5240, 2686, 530, -697, -985, -667, -226, 2, -88, -459, -927, -1247, -1175, -592, 364, 1309, 1920, 2178, 2250, 2242, 2154, 2001, 1848, 1750, 1670, 1488, 1132, 617, -25, -757, -1460, -2044, -2505, -2833, -1911, -67, -26, -8, 1, 8, 12, 16, 18, +}, +{ +1352, 749, -1645, -2697, -3639, 3522, 4737, 6008, 7651, 8786, 8842, 8532, 7930, 6997, 6499, 6176, 5536, 4673, 3558, 2162, 759, -365, -1149, -1511, -1268, -292, 1348, 3286, 5013, 6292, 7162, 7818, 8446, 9053, 9451, 9438, 9056, 8541, 8111, 7870, 7802, 7835, 7891, 7901, 7800, 7533, 7097, 6592, 6120, 5726, 5439, 3221, 144, 100, 82, 71, 64, 60, 56, 54, +}, +{ +-57, 757, 2771, 4035, 4237, -2024, -3174, -4548, -5873, -6766, -6152, -5490, -5138, -4788, -4745, -4906, -4987, -4705, -3868, -2359, -537, 1152, 2449, 3071, 2949, 2363, 1674, 1022, 389, -245, -847, -1472, -2246, -3043, -3445, -3217, -2621, -2163, -2162, -2601, -3254, -3888, -4376, -4728, -5014, -5258, -5411, -5446, -5386, -5256, -5093, -3070, -89, -31, -7, 8, 19, 26, 32, 36, +}, +{ +227, -335, 2902, 2520, 2019, -593, -199, 974, 1944, 2169, 1372, 472, -171, -1206, -2475, -2936, -2001, 88, 2808, 5241, 6657, 7056, 6750, 5825, 4122, 1873, -115, -1229, -1485, -1330, -1220, -1326, -1481, -1383, -984, -499, -99, 181, 337, 313, 61, -337, -681, -803, -661, -271, 292, 881, 1388, 1800, 2101, 1437, 88, 60, 48, 41, 36, 33, 30, 28, +}, +{ +-181, 1118, 2818, 3684, 3341, -2320, -2914, -2841, -2539, -2909, -3164, -3287, -3378, -3519, -3097, -1559, 673, 2638, 3664, 3564, 2365, 323, -2103, -4328, -5612, -5607, -4829, -4102, -4010, -4659, -5684, -6646, -7402, -8060, -8598, -8842, -8709, -8308, -7828, -7397, -7045, -6717, -6318, -5790, -5143, -4430, -3746, -3199, -2822, -2574, -2418, -1452, -44, -12, -1, 5, 10, 13, 16, 18, +}, +{ +208, -2005, -2657, -802, -194, -102, -968, -1233, -646, -223, 744, 1312, 1694, 2070, 2354, 2369, 2478, 3045, 3905, 4811, 5328, 5086, 4068, 2061, -1074, -4579, -7300, -8665, -8731, -7878, -6590, -5212, -3825, -2394, -1030, 56, 773, 1236, 1633, 2036, 2393, 2634, 2747, 2794, 2872, 3044, 3287, 3523, 3706, 3825, 3872, 2400, 105, 58, 38, 25, 17, 10, 6, 3, +}, +{ +482, 4180, 6357, 5316, 2943, 2790, 3261, 4049, 3526, 1759, 136, -746, -1202, -1670, -2389, -3083, -3580, -3766, -3721, -3504, -3243, -3066, -2918, -3002, -3503, -3982, -3623, -2223, -366, 1255, 2487, 3507, 4413, 5157, 5639, 5817, 5677, 5265, 4686, 4057, 3483, 3033, 2731, 2550, 2440, 2349, 2225, 2057, 1876, 1711, 1600, 884, 71, 81, 83, 86, 88, 90, 91, 92, +}, +{ +673, 4039, 7432, 9477, 7969, -1394, -1273, -1722, -1589, -743, -341, -266, -539, -698, -553, -268, 124, 490, 812, 1179, 1505, 1515, 1122, 772, 964, 1612, 2162, 2151, 1583, 741, -264, -1455, -2771, -3973, -4716, -4876, -4665, -4453, -4496, -4789, -5164, -5472, -5666, -5811, -5978, -6177, -6329, -6365, -6295, -6135, -5908, -3542, -61, 23, 57, 79, 95, 107, 117, 123, +}, +{ +25, -563, 1623, 937, -97, -143, -46, 388, -38, -771, -1168, -1016, -925, -1244, -1570, -1830, -2133, -2599, -3152, -3747, -4305, -4670, -4517, -3350, -1238, 1011, 2726, 3794, 4328, 4495, 4472, 4379, 4176, 3806, 3362, 3028, 2910, 2898, 2744, 2281, 1517, 604, -262, -937, -1394, -1727, -2068, -2457, -2851, -3224, -3538, -2357, -106, -60, -40, -29, -21, -15, -10, -7, +}, +{ +464, 2594, 6346, 3429, 2268, -408, -1246, -1126, -1423, -370, 768, 1616, 2586, 3550, 3776, 2915, 929, -1628, -3769, -4801, -4500, -3094, -888, 1968, 4831, 6457, 6194, 4598, 2800, 1518, 815, 597, 860, 1539, 2336, 2878, 3022, 2910, 2795, 2844, 3057, 3281, 3324, 3088, 2606, 1980, 1341, 824, 474, 262, 174, 76, 24, 40, 47, 52, 57, 60, 63, 65, +}, +{ +-205, -401, 437, 1642, 494, -311, -32, 875, 1027, 701, 615, 704, 534, -104, -1146, -2140, -2371, -1570, 320, 2713, 4714, 5885, 6067, 5127, 3396, 1693, 561, 43, 10, 282, 725, 1147, 1259, 823, -236, -1691, -3113, -4191, -4872, -5275, -5531, -5700, -5772, -5722, -5552, -5275, -4867, -4361, -3849, -3371, -2970, -1636, -72, -50, -39, -32, -27, -24, -22, -21, +}, +{ +-585, -463, 924, 2364, 1444, -871, -1456, -1290, -1372, -1161, -722, -1056, -1376, -1142, -1080, -1076, -469, 674, 1657, 2449, 2920, 3102, 3447, 4242, 5372, 6064, 5466, 3614, 1237, -1079, -3078, -4664, -5730, -6180, -5973, -5235, -4293, -3464, -2894, -2547, -2265, -1879, -1315, -667, -121, 182, 242, 175, 84, 27, 23, 16, -14, -7, -3, -1, 0, 2, 3, 4, +}, +{ +108, -471, -1814, 888, 813, -1341, -518, 44, 1291, 1663, 1231, 744, 898, 1175, 1132, 992, 1153, 1783, 2823, 3915, 4657, 5033, 5245, 5052, 3755, 1132, -2032, -4707, -6378, -7010, -6834, -6122, -4960, -3218, -1003, 1201, 2935, 4075, 4749, 5071, 5039, 4652, 3991, 3191, 2419, 1815, 1415, 1186, 1070, 1013, 977, 562, 29, 21, 18, 15, 13, 11, 10, 9, +}, +{ +1, 232, -515, -204, 275, -374, -1326, -2166, -2161, -2251, -1547, -696, -539, -756, -795, -979, -1389, -1454, -1000, -231, 661, 1631, 2559, 3165, 3164, 2711, 2425, 2692, 3254, 3766, 4170, 4506, 4702, 4810, 5123, 5773, 6496, 6846, 6578, 5791, 4779, 3827, 3101, 2583, 2096, 1493, 771, 59, -528, -962, -1225, -872, -36, -12, 0, 7, 12, 16, 19, 21, +} +} +}; +#else +const Word16 hrtfShCoeffsRe_fx[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS] /* Q15 */ = { { { @@ -21142,6 +21247,7 @@ const Word16 hrtfShCoeffsRe_fx[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BIN } } }; +#endif #else const float hrtfShCoeffsRe[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]= { diff --git a/lib_rend/ivas_vbap.c b/lib_rend/ivas_vbap.c index d84dcba56..3d62f5952 100644 --- a/lib_rend/ivas_vbap.c +++ b/lib_rend/ivas_vbap.c @@ -1577,13 +1577,7 @@ static void determine_virtual_speaker_node_division_gains_fx( } } /*make a common exp*/ - *max_exp = MIN16B; - move16(); - FOR( i = 0; i < num_speaker_nodes; i++ ) - { - *max_exp = s_max( *max_exp, exp_virtual_node_division_gains[i] ); - move16(); - } + *max_exp = -1; /*Q16*/ FOR( i = 0; i < num_speaker_nodes; i++ ) { virtual_node_division_gains_fx[i] = shr( virtual_node_division_gains_fx[i], sub( *max_exp, exp_virtual_node_division_gains[i] ) ); -- GitLab