diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 02326273d94568ef2311e6266bb4fa2d59eab72d..de44884898256ff7f2de65400dabada858e7cc4c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -324,15 +324,15 @@ build-codec-linux-instrumented-make: # Short test jobs # --------------------------------------------------------------- -ivas-pytest-mld-enc-dec: - extends: - - .rules-pytest-mld - - .test-job-linux - before_script: - - USE_LTV=0 - - TEST_SUITE="$SHORT_TEST_SUITE" - - LEVEL_SCALING=1.0 - <<: *ivas-pytest-mld-anchor +#ivas-pytest-mld-enc-dec: +# extends: +# - .rules-pytest-mld +# - .test-job-linux +# before_script: +# - USE_LTV=0 +# - TEST_SUITE="$SHORT_TEST_SUITE" +# - LEVEL_SCALING=1.0 +# <<: *ivas-pytest-mld-anchor ivas-pytest-mld-dec: extends: @@ -345,15 +345,15 @@ ivas-pytest-mld-dec: - LEVEL_SCALING=1.0 <<: *ivas-pytest-mld-anchor -ivas-pytest-mld-enc-dec-lev-10: - extends: - - .rules-pytest-mld - - .test-job-linux - before_script: - - USE_LTV=0 - - TEST_SUITE="$SHORT_TEST_SUITE" - - LEVEL_SCALING=0.3162 - <<: *ivas-pytest-mld-anchor +#ivas-pytest-mld-enc-dec-lev-10: +# extends: +# - .rules-pytest-mld +# - .test-job-linux +# before_script: +# - USE_LTV=0 +# - TEST_SUITE="$SHORT_TEST_SUITE" +# - LEVEL_SCALING=0.3162 +# <<: *ivas-pytest-mld-anchor ivas-pytest-mld-dec-lev-10: extends: @@ -366,15 +366,15 @@ ivas-pytest-mld-dec-lev-10: - LEVEL_SCALING=0.3162 <<: *ivas-pytest-mld-anchor -ivas-pytest-mld-enc-dec-lev+10: - extends: - - .rules-pytest-mld - - .test-job-linux - before_script: - - USE_LTV=0 - - TEST_SUITE="$SHORT_TEST_SUITE" - - LEVEL_SCALING=3.162 - <<: *ivas-pytest-mld-anchor +#ivas-pytest-mld-enc-dec-lev+10: +# extends: +# - .rules-pytest-mld +# - .test-job-linux +# before_script: +# - USE_LTV=0 +# - TEST_SUITE="$SHORT_TEST_SUITE" +# - LEVEL_SCALING=3.162 +# <<: *ivas-pytest-mld-anchor ivas-pytest-mld-dec-lev+10: extends: diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index 37977473e27b67fb8c936b6d193c68c15d64f330..e2fdcf85362fa7f7d45490ff754f3b152572a9f2 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -2461,11 +2461,8 @@ void SynthesisSTFT ( scale = 0; BASOP_rfft(fftBuffer, hFdCngCom->fftlen, &scale, 1); fftBufferExp = add(fftBufferExp, scale); -#ifdef EVS_FLOAT -#ifdef IVAS_FLOAT_FIXED hFdCngCom->fftBuffer_exp = fftBufferExp; -#endif -#endif // EVS_FLOAT + fftBufferExp = add(fftBufferExp, hFdCngCom->fftlenShift); /* Perform overlap-add */ @@ -2495,14 +2492,14 @@ void SynthesisSTFT ( { FOR (i=0; i < len4; i++) { - olapBuffer[i+1*len4] = add(olapBuffer[i+1*len4], mult_r(round_fx(L_shl(fftBuffer[i+1*len4],fftBufferExp-15)),olapWin[i].v.im)); + olapBuffer[i+1*len4] = add_sat(olapBuffer[i+1*len4], mult_r(round_fx(L_shl(fftBuffer[i+1*len4],fftBufferExp-15)),olapWin[i].v.im)); move16(); - olapBuffer[i+2*len4] = add(olapBuffer[i+2*len4], mult_r(round_fx(L_shl(fftBuffer[i+2*len4],fftBufferExp-15)),olapWin[len4-1-i].v.re)); + olapBuffer[i+2*len4] = add_sat(olapBuffer[i+2*len4], mult_r(round_fx(L_shl(fftBuffer[i+2*len4],fftBufferExp-15)),olapWin[len4-1-i].v.re)); move16(); } FOR (i=len3; i < len; i++) { - olapBuffer[i] = round_fx(L_shl(fftBuffer[i],fftBufferExp-15)); + olapBuffer[i] = round_fx_sat(L_shl_sat(fftBuffer[i],fftBufferExp-15)); } } diff --git a/lib_com/float_to_fix_ops.c b/lib_com/float_to_fix_ops.c index 137226b7e9fe3d261aaf9d0c3f4a1682a9e51311..4a8cab88a31cfa6b79b776f4ce1948644e855b97 100644 --- a/lib_com/float_to_fix_ops.c +++ b/lib_com/float_to_fix_ops.c @@ -736,17 +736,18 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( //{ // st->hFdCngDec->hFdCngCom->periodog[p] = (Word32) ( st->hFdCngDec->hFdCngCom->periodog_flt[p] * ( 1u << ( 31 - st->hFdCngDec->hFdCngCom->periodog_exp ) ) ); //} + //for ( int p = 0; p < st->hFdCngDec->hFdCngCom->fftlen; p++ ) //{ // st->hFdCngDec->hFdCngCom->fftBuffer[p] = (Word32) ( st->hFdCngDec->hFdCngCom->fftBuffer_flt[p] * ( 1u << ( 31 - st->hFdCngDec->hFdCngCom->fftBuffer_exp ) ) ); //} - st->hFdCngDec->msNoiseEst_exp = 31 - Q4; + //st->hFdCngDec->msNoiseEst_exp = 31 - Q4; + for ( int p = 0; p < st->hFdCngDec->npart_shaping; p++ ) { - st->hFdCngDec->msNoiseEst[p] = (Word32) ( st->hFdCngDec->msNoiseEst_float[p] * ( 1u << ( 31 - st->hFdCngDec->msNoiseEst_exp ) ) ); + //st->hFdCngDec->msNoiseEst[p] = (Word32) ( st->hFdCngDec->msNoiseEst_float[p] * ( 1u << ( 31 - st->hFdCngDec->msNoiseEst_exp ) ) ); // st->hFdCngDec->msPeriodog[p] = (Word32) ( st->hFdCngDec->msPeriodog_float[p] * ( 1u << ( 31 - st->hFdCngDec->msPeriodog_exp ) ) ); //st->hFdCngDec->msPeriodog_ST_fx[p] = (Word32) ( st->hFdCngDec->msPeriodog_ST[p] * ( 1u << ( 31 - st->hFdCngDec->msPeriodog_ST_exp ) ) ); - } st->hFdCngDec->hFdCngCom->cngNoiseLevelExp = 31 - Q4; // Q4 diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 0e51fe22479cb5302df9dc54e8e02cf9a2088257..6e03bb27d0f17988d3d4379df191dc90ea466d8b 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1735,7 +1735,8 @@ void TonalMDCTConceal_Detect_ivas_fx( const TonalMDCTConcealPtr hTonalMDCTConc, const Word32 pitchLag, Word16 * numIndices, - const PsychoacousticParameters* psychParamsCurrent + const PsychoacousticParameters* psychParamsCurrent, + Word16 element_mode ); Word16 GetPLCModeDecision_ivas_fx( @@ -1758,7 +1759,8 @@ void ivas_DetectTonalComponents_fx( const Word16 nSamples, const Word16 nSamplesCore, Word16 floorPowerSpectrum, /* i: lower limit for power spectrum bins */ - const PsychoacousticParameters* psychParamsCurrent + const PsychoacousticParameters* psychParamsCurrent, + Word16 element_mode ); ivas_error stereo_dft_dec_create_fx( diff --git a/lib_com/ivas_sns_com_fx.c b/lib_com/ivas_sns_com_fx.c index 31db19315c04c9a32ca09fba61e24bba5d0a2fb7..e1c22014aedf3e3a1c4928ba5348c6d3c302fcc4 100644 --- a/lib_com/ivas_sns_com_fx.c +++ b/lib_com/ivas_sns_com_fx.c @@ -87,7 +87,7 @@ void sns_compute_scf_fx( x[i] = 0; FOR( n = 0; n < bw; ( ++n, ++k ) ) { - x[i] = L_add( x[i], spectrum[k] ); + x[i] = L_add_sat( x[i], spectrum[k] ); } x[i] /= bw; } @@ -101,7 +101,7 @@ void sns_compute_scf_fx( x[i] = 0; FOR( n = 0; n < bandLengths[i]; ( ++n, ++k ) ) { - x[i] = L_add( x[i], spectrum[k] ); + x[i] = L_add_sat( x[i], spectrum[k] ); } x[i] /= bandLengths[i]; } diff --git a/lib_com/options.h b/lib_com/options.h index 1b2c564d798cfe361e91a89774ab8d5f3053f23c..885bb30557b6992892fc3a149137f66b677049a0 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -101,7 +101,7 @@ #define EVS_FUNC_MODIFIED //#define DEBUGGING //#define DBG_WAV_WRITER -#define EVS_FLOAT +//#define EVS_FLOAT #define EVS_FLOAT_ENC //#define DUMPS_ENABLED #define FIX_667_DISABLE_INITIAL_PLC_SUPPRESSION @@ -119,7 +119,6 @@ #define FIX_740_HQ_CORE_OVA // Proposed fix to solve overlap and add issue for HQ_CORE #define FIX_746 // proposed fix to solve low bit-rate frame boundaries issues #define FIX_SATURATION_725 // Propose fix for saturation in AVQ - /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_com/prot_fx2.h b/lib_com/prot_fx2.h index 4d748545e2b6c76e918e6ba3d3e1816fb8dcfeb0..103675727f0a6828c3ecdf40e9c4b20b8f2786e6 100644 --- a/lib_com/prot_fx2.h +++ b/lib_com/prot_fx2.h @@ -359,7 +359,8 @@ void SWB_BWE_decoding_fx( Word16 *prev_weight, /* i/o: excitation weight value of last frame */ const Word16 extl, /* i : extension layer */ Word16 Q_syn - , const Word16 last_extl /* i : extension layer of last frame */ + , const Word16 last_extl, /* i : extension layer of last frame */ + Word16 element_mode /* i : element mode */ ); void time_envelop_shaping_fx( @@ -2519,7 +2520,8 @@ void SWB_BWE_decoding_fx( Word16 *prev_weight, /* i/o: excitation weight value of last frame */ const Word16 extl, /* i : extension layer */ Word16 Q_syn - , const Word16 last_extl /* i : extension layer of last frame */ + , const Word16 last_extl, /* i : extension layer of last frame */ + Word16 element_mode /* i : element mode */ ); void time_envelop_shaping_fx( @@ -5904,7 +5906,8 @@ void DetectTonalComponents( const Word32 secondLastPowerSpectrum[], const Word16 nSamples, const Word16 nSamplesCore, - Word16 floorPowerSpectrum /* i: lower limit for power spectrum bins */ + Word16 floorPowerSpectrum, /* i: lower limit for power spectrum bins */ + Word16 element_mode #ifdef IVAS_CODE_MDCT_GSHAPE , const PsychoacousticParameters* psychParamsCurrent #endif @@ -5933,7 +5936,8 @@ void RefineTonalComponents( const Word32 secondLastPowerSpectrum[], const Word16 nSamples, const Word16 nSamplesCore, - const Word16 floorPowerSpectrum /* i: lower limit for power spectrum bins */ + const Word16 floorPowerSpectrum, /* i: lower limit for power spectrum bins */ + Word16 element_mode #ifdef IVAS_CODE_MDCT_GSHAPE , const PsychoacousticParameters* psychParamsCurrent #endif @@ -6014,7 +6018,8 @@ void TonalMDCTConceal_SaveTimeSignal( void TonalMDCTConceal_Detect( const TonalMDCTConcealPtr self, /*IN */ const Word32 pitchLag, /*IN */ - Word16 * umIndices /*OUT*/ + Word16 * umIndices, /*OUT*/ + Word16 element_mode /* IN */ #ifdef IVAS_CODE_MDCT_GSHAPE , const PsychoacousticParameters* psychParamsCurrent #endif @@ -7677,7 +7682,8 @@ void generate_comfort_noise_dec_hf_ivas_fx( Word16 *bfi_pitch, /* i/o: update of the estimated pitch for FEC */ Word16 *bfi_pitch_frame, /* o : frame length when pitch was updated */ Word16 *upd_cnt /* i/o: update counter */ - , const Word16 coder_type /* i : coder_type */ + , const Word16 coder_type, /* i : coder_type */ + Word16 element_mode /* i : element mode */ ); //FEC_scale_sync_fx.c @@ -7729,6 +7735,7 @@ void generate_comfort_noise_dec_hf_ivas_fx( Word16 dct_buffer_out[], /* o : DCT output buffer (qdct)*/ Word16 filt_lfE[], /* i/o: long term spectrum energy Q15 */ const Word16 last_core, /* i : last core */ + const Word16 element_mode, /* i : element mode */ const Word16 *pitch_buf, /* i : current frame pitch information Q6*/ Word16 *LDm_enh_lp_gbin, /* o : smoothed suppression gain, per bin FFT Q15*/ const Word16 Q_exc, /* i : excitation scaling */ diff --git a/lib_com/swb_bwe_com_fx.c b/lib_com/swb_bwe_com_fx.c index bcf974cdec6d4fb35491ca023cd0faacf5c9fbf5..8c7d5065629e695b8d85233e7fe8bae84f81c62f 100644 --- a/lib_com/swb_bwe_com_fx.c +++ b/lib_com/swb_bwe_com_fx.c @@ -1357,9 +1357,10 @@ void SWB_BWE_decoding_fx( Word16 *Seed, /* i/o: random generator seed */ const Word16 st_offset, /* i : offset value due to different core */ Word16 *prev_weight, /* i/o: excitation weight value of last frame */ - const Word16 extl, /* i : extension layer */ + const Word16 extl, /* i : extension layer */ Word16 Q_syn - , const Word16 last_extl /* i : extension layer of last frame */ + , const Word16 last_extl, /* i : extension layer of last frame */ + Word16 element_mode /* i : element mode */ ) { Word16 n_freq, n_band, L, L_swb_norm; @@ -1559,19 +1560,22 @@ void SWB_BWE_decoding_fx( exp = norm_s(SWB_FENV); tmp = div_s(shl(1,sub(14,exp)),SWB_FENV); /*Q(29-exp) */ L_tmp = Mult_32_16(L_energy,tmp); /*Q(1+29-exp+1)->Q(15-exp) */ -#ifdef EVS_FLOAT + IF(EQ_16(element_mode, EVS_MONO)) + { #ifdef BASOP_NOGLOB - EnergyL_16 = round_fx_sat(L_shl_sat(L_tmp, add(exp, 4))); /* Q3 */ + Energy_16 = round_fx_sat(L_shl_sat(L_tmp, add(exp, 4))); #else - Energy_16 = round_fx(L_shl(L_tmp,add(exp,4))); /*Q3 */ + EnergyL_16 = round_fx( L_shl( L_tmp, add( exp, 4 ) ) ); #endif -#else + } + ELSE + { #ifdef BASOP_NOGLOB - Energy_16 = round_fx_sat( L_shl_sat( L_tmp, add( exp, 4 ) ) ); /* Q3 */ + EnergyL_16 = round_fx_sat(L_shl_sat(L_tmp, add(exp, 4))); /* Q3 */ #else - EnergyL_16 = round_fx( L_shl( L_tmp, add( exp, 4 ) ) ); /*Q3 */ + Energy_16 = round_fx(L_shl(L_tmp,add(exp,4))); /*Q3 */ #endif -#endif // EVS_FLOAT + } IF(NE_16(last_extl, SWB_BWE) && NE_16(last_extl,FB_BWE)) { diff --git a/lib_dec/FEC_pitch_estim_fx.c b/lib_dec/FEC_pitch_estim_fx.c index 93ebde8f827d40b1709292b3dd77281dad0b5262..2b5446093a3235c7128de9a4f7ad5a6678be3661 100644 --- a/lib_dec/FEC_pitch_estim_fx.c +++ b/lib_dec/FEC_pitch_estim_fx.c @@ -46,7 +46,8 @@ void FEC_pitch_estim_fx( Word16 *bfi_pitch, /* i/o: update of the estimated pitch for FEC */ Word16 *bfi_pitch_frame, /* o : frame length when pitch was updated */ Word16 *upd_cnt /* i/o: update counter */ - ,const Word16 coder_type /* i : coder_type */ + ,const Word16 coder_type, /* i : coder_type */ + Word16 element_mode /* i : element mode */ ) { Word16 tmp,tmp1,tmp2,tmp3; @@ -63,16 +64,9 @@ void FEC_pitch_estim_fx( #else tmp16k2 = shl(tmp16k1,1); /*Q6 1.4f * old_pitch_buf[2*NB_SUBFR16k-1]*/ #endif -#ifdef EVS_FLOAT -#if 1//def IVAS_CODE + test(); test(); - IF (EQ_16(last_core, HQ_CORE) || EQ_16(last_core, TCX_20_CORE) || EQ_16(last_core, TCX_10_CORE)) -#else - IF( EQ_16(last_core,HQ_CORE)) -#endif -#else - IF( EQ_16( last_core, HQ_CORE ) ) -#endif // EVS_FLOAT + IF ((EQ_16(element_mode, EVS_MONO) && EQ_16(last_core, HQ_CORE)) || (NE_16(element_mode, EVS_MONO) && (EQ_16(last_core, HQ_CORE) || EQ_16(last_core, TCX_20_CORE) || EQ_16(last_core, TCX_10_CORE)))) { *bfi_pitch = pitch_buf[shr(L_frame,6)-1]; move16(); diff --git a/lib_dec/LD_music_post_filter_fx.c b/lib_dec/LD_music_post_filter_fx.c index 042791463c56510f66e330f8bed2aa5da12eff16..b723289bde2deb78f089fa2f30e7f4b577bd8b4b 100644 --- a/lib_dec/LD_music_post_filter_fx.c +++ b/lib_dec/LD_music_post_filter_fx.c @@ -794,6 +794,7 @@ void Prep_music_postP_fx( Word16 dct_buffer_out[], /* o : DCT output buffer (qdct)*/ Word16 filt_lfE[], /* i/o: long term spectrum energy Q15?*/ const Word16 last_core, /* i : last core */ + const Word16 element_mode, /* i : element mode */ const Word16 *pitch_buf, /* i : current frame pitch information Q6*/ Word16 *LDm_enh_lp_gbin, /* o : smoothed suppression gain, per dct bin Q14*/ const Word16 Q_exc, /* i : excitation scaling */ @@ -814,15 +815,7 @@ void Prep_music_postP_fx( /*------------------------------------------------------------* * Resetting some memories in case of switching *------------------------------------------------------------*/ -#ifdef EVS_FLOAT -#if 1//def _DIFF_FLOAT_FIX_ - IF( EQ_16(last_core,HQ_CORE) || EQ_16(last_core, TCX_20_CORE) || EQ_16(last_core, TCX_10_CORE) ) -#else - IF(EQ_16(last_core, HQ_CORE)) -#endif -#else - IF( EQ_16( last_core, HQ_CORE ) ) -#endif // EVS_FLOAT + IF( ( EQ_16( element_mode, EVS_MONO ) && EQ_16(last_core,HQ_CORE) ) || ( NE_16( element_mode, EVS_MONO ) && ( EQ_16(last_core,HQ_CORE) || EQ_16(last_core, TCX_20_CORE) || EQ_16(last_core, TCX_10_CORE) ) ) ) { set16_fx( filt_lfE, 4096, DCT_L_POST ); set16_fx( LDm_enh_lp_gbin, 16384, VOIC_BINS_HR ); diff --git a/lib_dec/TonalComponentDetection_fx.c b/lib_dec/TonalComponentDetection_fx.c index c7357cc7d342f8ae4e16d5d58824e0e0081dcc3e..1cc38172d90f9e698264281d2735d7e4aca31780 100644 --- a/lib_dec/TonalComponentDetection_fx.c +++ b/lib_dec/TonalComponentDetection_fx.c @@ -31,7 +31,7 @@ static void findCandidates(const Word16 nSamples, const Word32 * MDCTSpectrum, c static void modifyThreshold(Word16 i, Word16 F0, Word16 threshold, Word16 * thresholdModification); static void modifyThresholds(Word16 F0, Word16 origF0, Word16 * thresholdModification); static void RefineThresholdsUsingPitch(const Word16 nSamples, const Word16 nSamplesCore, const Word32 powerSpectrum[], const Word32 lastPitchLag, const Word32 currentPitchLag, Word16 * pF0, Word16 * thresholdModification); -static void findTonalComponents(Word16 * indexOfTonalPeak, Word16 * lowerIndex, Word16 * upperIndex, Word16 *numIndexes, Word16 nSamples, const Word32 * powerSpectrum, Word16 F0, Word16 * thresholdModification); +static void findTonalComponents(Word16 * indexOfTonalPeak, Word16 * lowerIndex, Word16 * upperIndex, Word16 *numIndexes, Word16 nSamples, const Word32 * powerSpectrum, Word16 F0, Word16 * thresholdModification, Word16 element_mode); /*-------------------------------------------------------------------* * DetectTonalComponents() @@ -58,7 +58,8 @@ void ivas_DetectTonalComponents_fx( const Word16 nSamples, const Word16 nSamplesCore, Word16 floorPowerSpectrum, /* i: lower limit for power spectrum bins */ - const PsychoacousticParameters* psychParamsCurrent + const PsychoacousticParameters* psychParamsCurrent, + Word16 element_mode /* i: element mode */ ) { Word16 F0; @@ -109,7 +110,7 @@ void ivas_DetectTonalComponents_fx( RefineThresholdsUsingPitch(nSamples, nSamplesCore, secondLastPowerSpectrum, lastPitchLag, currentPitchLag, &F0, thresholdModification); /* Find peaks in the second last frame */ - findTonalComponents(indexOfTonalPeak, lowerIndex, upperIndex, pNumIndexes, nSamples, secondLastPowerSpectrum, F0, thresholdModification); + findTonalComponents(indexOfTonalPeak, lowerIndex, upperIndex, pNumIndexes, nSamples, secondLastPowerSpectrum, F0, thresholdModification, element_mode); } #endif @@ -128,7 +129,8 @@ void DetectTonalComponents( const Word32 secondLastPowerSpectrum[], const Word16 nSamples, const Word16 nSamplesCore, - Word16 floorPowerSpectrum /* i: lower limit for power spectrum bins */ + Word16 floorPowerSpectrum, /* i: lower limit for power spectrum bins */ + Word16 element_mode #ifdef IVAS_CODE_MDCT_GSHAPE , const PsychoacousticParameters* psychParamsCurrent #endif @@ -164,7 +166,7 @@ void DetectTonalComponents( RefineThresholdsUsingPitch(nSamples, nSamplesCore, secondLastPowerSpectrum, lastPitchLag, currentPitchLag, &F0, thresholdModification); /* Find peaks in the second last frame */ - findTonalComponents(indexOfTonalPeak, lowerIndex, upperIndex, pNumIndexes, nSamples, secondLastPowerSpectrum, F0, thresholdModification); + findTonalComponents(indexOfTonalPeak, lowerIndex, upperIndex, pNumIndexes, nSamples, secondLastPowerSpectrum, F0, thresholdModification, element_mode); } /*-------------------------------------------------------------------* @@ -194,7 +196,8 @@ void RefineTonalComponents( const Word32 secondLastPowerSpectrum[], const Word16 nSamples, const Word16 nSamplesCore, - const Word16 floorPowerSpectrum /* i: lower limit for power spectrum bins */ + const Word16 floorPowerSpectrum, /* i: lower limit for power spectrum bins */ + Word16 element_mode #ifdef IVAS_CODE_MDCT_GSHAPE ,const PsychoacousticParameters* psychParamsCurrent #endif @@ -209,7 +212,7 @@ void RefineTonalComponents( DetectTonalComponents(newIndexOfTonalPeak, newLowerIndex, newUpperIndex, &newNumIndexes, lastPitchLag, currentPitchLag, lastMDCTSpectrum, - lastMDCTSpectrum_exp, scaleFactors, scaleFactors_exp, scaleFactors_max_e, secondLastPowerSpectrum, nSamples, nSamplesCore, floorPowerSpectrum + lastMDCTSpectrum_exp, scaleFactors, scaleFactors_exp, scaleFactors_max_e, secondLastPowerSpectrum, nSamples, nSamplesCore, floorPowerSpectrum, element_mode #ifdef IVAS_CODE_MDCT_GSHAPE , psychParamsCurrent #endif @@ -975,7 +978,8 @@ static void findTonalComponents( Word16 nSamples, /* IN */ const Word32 * powerSpectrum, /* IN */ Word16 F0, /* IN */ - Word16 * thresholdModification) /* IN */ + Word16 * thresholdModification, /* IN */ + Word16 element_mode) /* IN */ { Word32 envelope[L_FRAME_MAX]; Word32 smoothedSpectrum[L_FRAME_MAX]; @@ -1029,11 +1033,8 @@ static void findTonalComponents( } /* Side lobe increase must be 2 times smaller than the decrease to the foot */ /* Eq. to 2.0f*powerSpectrum[lowerIdx-1]/powerSpectrum[lowerIdx] > powerSpectrum[lowerIdx]/powerSpectrum[j] */ -#ifdef EVS_FLOAT - IF( GT_64( W_mult_32_32( L_shl( powerSpectrum[upperIdx + 1], 1 ), powerSpectrum[j] ), W_mult_32_32( powerSpectrum[upperIdx], powerSpectrum[upperIdx] ) ) ) -#else - IF( GT_32( Mpy_32_32( L_shl( powerSpectrum[upperIdx + 1], 1 ), powerSpectrum[j] ), Mpy_32_32( powerSpectrum[upperIdx], powerSpectrum[upperIdx] ) ) ) -#endif // EVS_FLOAT + IF( (EQ_16(element_mode, EVS_MONO) && GT_32( Mpy_32_32( L_shl( powerSpectrum[upperIdx + 1], 1 ), powerSpectrum[j] ), Mpy_32_32( powerSpectrum[upperIdx], powerSpectrum[upperIdx] ) ) ) || + (NE_16(element_mode, EVS_MONO) && ( GT_64( W_mult_32_32( L_shl( powerSpectrum[upperIdx + 1], 1 ), powerSpectrum[j] ), W_mult_32_32( powerSpectrum[upperIdx], powerSpectrum[upperIdx] ) ) ) ) ) { BREAK; } diff --git a/lib_dec/acelp_core_dec_fx.c b/lib_dec/acelp_core_dec_fx.c index a80a0853ce5abfa98692bc10892ac403e9d57257..27a72d6a4dec6f0c0534f12990f781b3643740f8 100644 --- a/lib_dec/acelp_core_dec_fx.c +++ b/lib_dec/acelp_core_dec_fx.c @@ -1051,10 +1051,10 @@ ivas_error acelp_core_dec_fx( /* Extrapolation of the last future part, windowing and high resolution DCT transform */ qdct = 0; #ifdef _DIFF_FLOAT_FIX_ /* FLoat point using last_core which fits with the inner part of the function */ - Prep_music_postP_fx(exc_buffer_fx, dct_buffer_fx, hMusicPF->filt_lfE_fx, st_fx->last_core, pitch_buf_fx, + Prep_music_postP_fx(exc_buffer_fx, dct_buffer_fx, hMusicPF->filt_lfE_fx, st_fx->last_core, st_fx->element_mode, pitch_buf_fx, hMusicPF->LDm_enh_lp_gbin_fx, st_fx->Q_exc, &qdct); #else - Prep_music_postP_fx( exc_buffer_fx, dct_buffer_fx, hMusicPF->filt_lfE_fx, st_fx->last_coder_type, pitch_buf_fx, + Prep_music_postP_fx( exc_buffer_fx, dct_buffer_fx, hMusicPF->filt_lfE_fx, st_fx->last_coder_type, st_fx->element_mode, pitch_buf_fx, hMusicPF->LDm_enh_lp_gbin_fx, st_fx->Q_exc, &qdct ); #endif /* LD music post-filter */ @@ -1117,7 +1117,7 @@ ivas_error acelp_core_dec_fx( *------------------------------------------------------------*/ FEC_pitch_estim_fx( st_fx->Opt_AMR_WB, st_fx->last_core, st_fx->L_frame, st_fx->clas_dec, st_fx->last_good, pitch_buf_fx, st_fx->old_pitch_buf_fx, - &st_fx->bfi_pitch_fx, &st_fx->bfi_pitch_frame, &st_fx->upd_cnt, st_fx->coder_type ); + &st_fx->bfi_pitch_fx, &st_fx->bfi_pitch_frame, &st_fx->upd_cnt, st_fx->coder_type, st_fx->element_mode ); /*------------------------------------------------------------* * FEC - Smooth the speech energy evolution when recovering after a BAD frame diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index b45e9fd7e4309e2602da1053004d6f2ccc31624b..46546358b126e23e33d4d43cd85f6fc4847227e3 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -209,10 +209,10 @@ ivas_error acelp_core_dec_ivas_fx( #ifdef IVAS_FLOAT_FIXED - for ( int p = 0; p < ( st->hFdCngDec->hFdCngCom->stopFFTbin - st->hFdCngDec->hFdCngCom->startBand ); p++ ) - { + //for ( int p = 0; p < ( st->hFdCngDec->hFdCngCom->stopFFTbin - st->hFdCngDec->hFdCngCom->startBand ); p++ ) + //{ //st->hFdCngDec->bandNoiseShape[p] = (Word32) ( st->hFdCngDec->bandNoiseShape_float[p] * ( 1u << ( 31 - st->hFdCngDec->bandNoiseShape_exp ) ) ); - } + //} ApplyFdCng_fx( NULL, 0, NULL, 0, NULL, NULL, NULL, st, 0, 0 ); @@ -730,7 +730,7 @@ ivas_error acelp_core_dec_ivas_fx( } #ifdef IVAS_FLOAT_FIXED /* local float2fix (to be removed) */ - for ( int p = 0; p < ( st->hFdCngDec->hFdCngCom->stopFFTbin - st->hFdCngDec->hFdCngCom->startBand ); p++ ) + //for ( int p = 0; p < ( st->hFdCngDec->hFdCngCom->stopFFTbin - st->hFdCngDec->hFdCngCom->startBand ); p++ ) { //st->hFdCngDec->bandNoiseShape[p] = (Word32) ( st->hFdCngDec->bandNoiseShape_float[p] * ( 1u << ( 31 - st->hFdCngDec->bandNoiseShape_exp ) ) ); } @@ -1199,7 +1199,7 @@ ivas_error acelp_core_dec_ivas_fx( Word16 qdct = 0; /* Extrapolation of the last future part, windowing and high resolution DCT transform */ //Prep_music_postP( exc_buffer, dct_buffer, st->hMusicPF->filt_lfE, st->last_core, pitch_buf, st->hMusicPF->LDm_enh_lp_gbin ); - Prep_music_postP_fx( exc_buffer_fx, dct_buffer_fx, st->hMusicPF->filt_lfE_fx, st->last_core, pitch_buf_fx, st->hMusicPF->LDm_enh_lp_gbin_fx, st->Q_exc, &qdct); + Prep_music_postP_fx( exc_buffer_fx, dct_buffer_fx, st->hMusicPF->filt_lfE_fx, st->last_core, st->element_mode, pitch_buf_fx, st->hMusicPF->LDm_enh_lp_gbin_fx, st->Q_exc, &qdct); /* LD music post-filter */ //LD_music_post_filter( st->hMusicPF, dct_buffer, dct_buffer, st->core_brate, AUDIO, last_coder_type ); @@ -1268,7 +1268,7 @@ ivas_error acelp_core_dec_ivas_fx( //FEC_pitch_estim( st->Opt_AMR_WB, st->last_core, st->L_frame, st->clas_dec, st->last_good, pitch_buf, st->old_pitch_buf, &st->bfi_pitch, &st->bfi_pitch_frame, &st->upd_cnt, st->coder_type ); FEC_pitch_estim_fx(st->Opt_AMR_WB, st->last_core, st->L_frame, st->clas_dec, st->last_good, pitch_buf_fx, st->old_pitch_buf_fx, - &st->bfi_pitch_fx, &st->bfi_pitch_frame, &st->upd_cnt, st->coder_type); + &st->bfi_pitch_fx, &st->bfi_pitch_frame, &st->upd_cnt, st->coder_type, st->element_mode); /*------------------------------------------------------------* * FEC - Smooth the speech energy evolution when recovering after a BAD frame @@ -2645,9 +2645,9 @@ void acelp_decoder_state_float2fix(Decoder_State *st, STEREO_CNG_DEC_HANDLE hSte { if (st->element_mode != IVAS_CPE_TD && !st->cng_ism_flag) { - st->hFdCngDec->hFdCngCom->fftBuffer_exp = st->hFdCngDec->msNoiseEst_exp = Q31 - Q4; //st->hFdCngDec->hFdCngCom->periodog_exp = st->hFdCngDec->msPsd_exp_fft = st->hFdCngDec->msPeriodog_exp = st->hFdCngDec->msPeriodog_ST_exp = 31 - Q4; Q4 + st->hFdCngDec->hFdCngCom->fftBuffer_exp = /*st->hFdCngDec->msNoiseEst_exp = */Q31 - Q4; //st->hFdCngDec->hFdCngCom->periodog_exp = st->hFdCngDec->msPsd_exp_fft = st->hFdCngDec->msPeriodog_exp = st->hFdCngDec->msPeriodog_ST_exp = 31 - Q4; Q4 //floatToFixed_arrL(st->hFdCngDec->hFdCngCom->fftBuffer_flt, st->hFdCngDec->hFdCngCom->fftBuffer, Q31 - st->hFdCngDec->hFdCngCom->fftBuffer_exp, st->hFdCngDec->hFdCngCom->fftlen); - floatToFixed_arrL(st->hFdCngDec->msNoiseEst_float, st->hFdCngDec->msNoiseEst, Q31 - st->hFdCngDec->msNoiseEst_exp, st->hFdCngDec->npart_shaping); + //floatToFixed_arrL(st->hFdCngDec->msNoiseEst_float, st->hFdCngDec->msNoiseEst, Q31 - st->hFdCngDec->msNoiseEst_exp, st->hFdCngDec->npart_shaping); //if (st->element_mode == IVAS_CPE_TD || st->element_mode == IVAS_CPE_DFT) //{ @@ -2662,7 +2662,7 @@ void acelp_decoder_state_float2fix(Decoder_State *st, STEREO_CNG_DEC_HANDLE hSte if (st->hBWE_TD) { floatToFixed_arr(st->hBWE_TD->old_bwe_exc_extended, st->hBWE_TD->old_bwe_exc_extended_fx, 0, NL_BUFF_OFFSET); } - + /*TCX_DEC_HANDLE*/ if (st->hTcxDec) { floatToFixed_arr(st->hTcxDec->syn_Overl_float, st->hTcxDec->syn_Overl, 0, L_FRAME32k / 2); diff --git a/lib_dec/amr_wb_dec_fx.c b/lib_dec/amr_wb_dec_fx.c index 63d0d75e81d72179768f7efbbcffa2ef50e76ebf..8d6c2f5d4ee59c359dbcd96375148f2e76b40bcf 100644 --- a/lib_dec/amr_wb_dec_fx.c +++ b/lib_dec/amr_wb_dec_fx.c @@ -572,7 +572,7 @@ ivas_error amr_wb_dec_fx( move16(); } /* Extrapolation of the last future part, windowing and high resolution DCT transform */ - Prep_music_postP_fx( exc_buffer_fx, dct_buffer_fx, hMusicPF->filt_lfE_fx, st_fx->last_core, pitch_buf_fx, hMusicPF->LDm_enh_lp_gbin_fx, st_fx->Q_exc, &Qdct ); + Prep_music_postP_fx( exc_buffer_fx, dct_buffer_fx, hMusicPF->filt_lfE_fx, st_fx->last_core, st_fx->element_mode, pitch_buf_fx, hMusicPF->LDm_enh_lp_gbin_fx, st_fx->Q_exc, &Qdct ); /* LD music post-filter */ LD_music_post_filter_fx( hMusicPF, dct_buffer_fx, dct_buffer_fx, st_fx->core_brate,&hMusicPF->Old_ener_Q, -1, tmp_coder_type, Qdct ); @@ -603,7 +603,7 @@ ivas_error amr_wb_dec_fx( *------------------------------------------------------------*/ FEC_pitch_estim_fx( 1, st_fx->last_core, L_FRAME, st_fx->clas_dec, st_fx->last_good, pitch_buf_fx, st_fx->old_pitch_buf_fx, &st_fx->bfi_pitch_fx, - &st_fx->bfi_pitch_frame, &st_fx->upd_cnt, GENERIC ); + &st_fx->bfi_pitch_frame, &st_fx->upd_cnt, GENERIC, st_fx->element_mode ); /*------------------------------------------------------------* * FEC - Smooth the speech energy evolution when recovering after a BAD frame diff --git a/lib_dec/er_util_fx.c b/lib_dec/er_util_fx.c index fff93ee219eea52765b7e6cc0b6ee246e90f2a86..8874251423d7ec58b5b9e2b5bd132eef88535285 100644 --- a/lib_dec/er_util_fx.c +++ b/lib_dec/er_util_fx.c @@ -465,8 +465,8 @@ Word16 GetPLCModeDecision_ivas_fx( //); TonalMDCTConceal_Detect_ivas_fx(st->hTonalMDCTConc, pitch, &numIndices - , (st->element_mode == IVAS_CPE_MDCT ? &(st->hTcxCfg->psychParamsTCX20) : st->hTcxCfg->psychParamsCurrent) - ); + , (st->element_mode == IVAS_CPE_MDCT ? &(st->hTcxCfg->psychParamsTCX20) : st->hTcxCfg->psychParamsCurrent), + st->element_mode); test(); test(); @@ -596,14 +596,14 @@ Word16 GetPLCModeDecision( } if (st->element_mode == EVS_MONO) { - TonalMDCTConceal_Detect(&st->tonalMDCTconceal, pitch, &numIndices + TonalMDCTConceal_Detect(&st->tonalMDCTconceal, pitch, &numIndices, st->element_mode #ifdef ADD_IVAS_HTONALMDCTCONC , (st->element_mode == IVAS_CPE_MDCT ? &(st->hTcxCfg->psychParamsTCX20) : st->hTcxCfg->psychParamsCurrent) #endif ); } else { - TonalMDCTConceal_Detect(st->hTonalMDCTConc, pitch, &numIndices + TonalMDCTConceal_Detect(st->hTonalMDCTConc, pitch, &numIndices, st->element_mode #ifdef ADD_IVAS_HTONALMDCTCONC , (st->element_mode == IVAS_CPE_MDCT ? &(st->hTcxCfg->psychParamsTCX20) : st->hTcxCfg->psychParamsCurrent) #endif diff --git a/lib_dec/gain_dec_fx.c b/lib_dec/gain_dec_fx.c index 787cc614e738ad14b458bc24b4b867fb96dc05c9..6b87bd222e82cbb68a0e229553c742fb52ed10f2 100644 --- a/lib_dec/gain_dec_fx.c +++ b/lib_dec/gain_dec_fx.c @@ -39,11 +39,7 @@ void Es_pred_dec_fx( #ifdef IVAS_GAIN_MOD PMT("Verify if Es_pred_dec_fx should use noltp parameters") #endif -#ifdef EVS_FLOAT -#if 1//def IVAS_GAIN_MOD IF(no_ltp == 0) -#endif -#endif // EVS_FLOAT { SWITCH(nb_bits) { @@ -55,27 +51,19 @@ void Es_pred_dec_fx( *Es_pred = Es_pred_qua_4b_fx[enr_idx]; move16(); BREAK; -#ifdef EVS_FLOAT -#if 1//def IVAS_GAIN_MOD case 3: *Es_pred = Es_pred_qua_3b_fx[enr_idx]; break; -#endif -#endif // EVS_FLOAT default: *Es_pred = Es_pred_qua_5b_fx[enr_idx]; move16(); BREAK; } } -#ifdef EVS_FLOAT -#if 1//def IVAS_GAIN_MOD ELSE { *Es_pred = Es_pred_qua_4b_no_ltp_fx[enr_idx]; } -#endif -#endif } /*======================================================================================*/ /* FUNCTION : void gain_dec_tc_fx () */ @@ -838,15 +826,12 @@ void gain_dec_lbr_fx( move16(); cdbk_fx = gp_gamma_3sfr_6b_fx; -#ifdef EVS_FLOAT -#if 1//def IVAS_GAIN_MOD + IF(EQ_16(nBits, 7)) { cdbk_fx = gp_gamma_3sfr_7b_fx; //PMT("verify if gp_gamma_3sfr_7b_fx is correct") } -#endif -#endif move16(); /* Q14/Q9*/ /* calculate predicted gain */ diff --git a/lib_dec/inov_dec_fx.c b/lib_dec/inov_dec_fx.c index 84900512024ec38d60a970aa2a1051f4d02b1ca1..23276389ebd02ddbba841b8f6011164fa16d8c26 100644 --- a/lib_dec/inov_dec_fx.c +++ b/lib_dec/inov_dec_fx.c @@ -70,8 +70,6 @@ void inov_decode_fx( IF ( !Opt_AMR_WB ) { -#ifdef EVS_FLOAT -#if 1//def IVAS_CODE if (st_fx->acelp_cfg.fcb_mode) { int16_t i; @@ -130,8 +128,6 @@ void inov_decode_fx( } } else -#endif -#endif { nBits = st_fx->acelp_cfg.fixed_cdk_index[i_subfr / L_SUBFR]; diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 675dff48ed2c72697099ee02acb4df38de923fdf..7d35e3d24d236b8de7f9e91e2d2c832d37abb224 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -647,6 +647,11 @@ ivas_error ivas_core_dec( //if (hStereoTD) { // floatToFixed_arr(hStereoTD->tdm_Pri_pitch_buf, hStereoTD->tdm_Pri_pitch_buf_fx, Q6, NB_SUBFR); //} + if(st->hFdCngDec != NULL) + { + Scale_sig32(st->hFdCngDec->msNoiseEst, NPART_SHAPING, sub(st->hFdCngDec->msNoiseEst_exp, 27)); + st->hFdCngDec->msNoiseEst_exp = 27; + } IF ( ( error = acelp_core_dec_ivas_fx( st, output_16_fx[n], synth_fxl, save_hb_synth_16_fx, bwe_exc_extended_fx[n], voice_factors_fx[n], old_syn_12k8_16k_fx_16, sharpFlag[n], pitch_buf_fx[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hCPE == NULL ? NULL : hCPE->hStereoCng, read_sid_info ) ) != IVAS_ERR_OK ) { return error; @@ -680,6 +685,8 @@ ivas_error ivas_core_dec( /* TCX decoder */ Scale_sig(st->hPFstat->mem_stp, L_SUBFR, -Qsyn_temp); Scale_sig(st->hPFstat->mem_pf_in, L_SUBFR, -Qsyn_temp); + Scale_sig32(st->hFdCngDec->msNoiseEst, NPART_SHAPING, sub(st->hFdCngDec->msNoiseEst_exp, 27)); + st->hFdCngDec->msNoiseEst_exp = 27; stereo_tcx_core_dec_fx( st, frameMode[n], output_16_fx[n], synth_16fx[n], pitch_buf_32fx[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hCPE == NULL ? NULL : hCPE->hStereoCng, nchan_out, st_ivas == NULL ? 0 : st_ivas->ivas_format ); @@ -833,20 +840,20 @@ ivas_error ivas_core_dec( //{ // sts[ch]->hFdCngDec->hFdCngCom->fftBuffer[p] = (Word32) ( sts[ch]->hFdCngDec->hFdCngCom->fftBuffer_flt[p] * ( 1u << ( 31 - sts[ch]->hFdCngDec->hFdCngCom->fftBuffer_exp ) ) ); //} - sts[ch]->hFdCngDec->msNoiseEst_exp = 31 - Q4; - for ( int p = 0; p < NPART_SHAPING; p++ ) - { - sts[ch]->hFdCngDec->msNoiseEst[p] = (Word32) ( sts[ch]->hFdCngDec->msNoiseEst_float[p] * ( 1u << ( 31 - sts[ch]->hFdCngDec->msNoiseEst_exp ) ) ); - } - sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = 31 - Q3; // Q3 - IF( st->hFdCngDec && st->hFdCngDec->hFdCngCom ) - { - FOR( Word16 ind = 0; ind < 340; ind++ ) - { - st->hFdCngDec->hFdCngCom->cngNoiseLevel[ind] = (Word32) ( st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[ind] * ( 1LL << ( 31 - st->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) ) ); - } + //sts[ch]->hFdCngDec->msNoiseEst_exp = 31 - Q4; + //for ( int p = 0; p < NPART_SHAPING; p++ ) + //{ + //sts[ch]->hFdCngDec->msNoiseEst[p] = (Word32) ( sts[ch]->hFdCngDec->msNoiseEst_float[p] * ( 1u << ( 31 - sts[ch]->hFdCngDec->msNoiseEst_exp ) ) ); + //} + //sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = 31 - Q3; // Q3 + //IF( st->hFdCngDec && st->hFdCngDec->hFdCngCom ) + //{ + //FOR( Word16 ind = 0; ind < 340; ind++ ) + //{ + //st->hFdCngDec->hFdCngCom->cngNoiseLevel[ind] = (Word32) ( st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[ind] * ( 1LL << ( 31 - st->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) ) ); + //} //st->hFdCngDec->hFdCngCom->likelihood_noisy_speech = float_to_fix16( st->hFdCngDec->hFdCngCom->likelihood_noisy_speech_flt, 15 ); - } + //} } IF( st->hTcxDec ) @@ -1152,11 +1159,13 @@ ivas_error ivas_core_dec( { IF ( NE_16(sts[n]->last_core_bfi, ACELP_CORE) ) { + //sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = 27; + //for ( int p = 0; p < sts[n]->hFdCngDec->hFdCngCom->stopFFTbin - sts[n]->hFdCngDec->hFdCngCom->startBand; p++ ) + //{ + //sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevel[p] = (Word32) ( sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[p] * ( 1u << ( 31 - sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) ) ); + //} + Scale_sig32(sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, sub(sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, 27)); sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = 27; - for ( int p = 0; p < sts[n]->hFdCngDec->hFdCngCom->stopFFTbin - sts[n]->hFdCngDec->hFdCngCom->startBand; p++ ) - { - sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevel[p] = (Word32) ( sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[p] * ( 1u << ( 31 - sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) ) ); - } for ( int p = 0; p < FDNS_NPTS; p++ ) { //sts[n]->hTonalMDCTConc->scaleFactorsBackground_fx[p] = (Word32) ( sts[n]->hTonalMDCTConc->scaleFactorsBackground_flt[p] * ONE_IN_Q16 ); diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index 249c8d4922a80d75fc9c6070c77bfe9b10be89c3..48b9c02811ca1ebf3d806ca9a5145210253d91c5 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -661,7 +661,7 @@ ivas_error ivas_cpe_dec_fx( { FOR(Word16 ch = 0; ch < CPE_CHANNELS; ++ch) { - f2me_buf(sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt, sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel, &sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, sts[ch]->hFdCngDec->hFdCngCom->stopBand - sts[ch]->hFdCngDec->hFdCngCom->startBand); + //f2me_buf(sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt, sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel, &sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, sts[ch]->hFdCngDec->hFdCngCom->stopBand - sts[ch]->hFdCngDec->hFdCngCom->startBand); floatToFixed_arr(sts[ch]->hFdCngDec->hFdCngCom->A_cng_flt, sts[ch]->hFdCngDec->hFdCngCom->A_cng, Q14, M + 1); } } @@ -874,12 +874,14 @@ ivas_error ivas_cpe_dec_fx( //floatToFixed_arr(&hCPE->hCoreCoder[0]->hTdCngDec->shb_lpcCNG[0], &hCPE->hCoreCoder[0]->hTdCngDec->shb_lpcCNG_fx[0], Q15, sizeof(hCPE->hCoreCoder[0]->hTdCngDec->shb_lpcCNG_fx) / sizeof(hCPE->hCoreCoder[0]->hTdCngDec->shb_lpcCNG_fx[0])); floatToFixed_arr(&hCPE->hStereoCng->cm[0], &hCPE->hStereoCng->cm_fx[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); floatToFixed_arr(&hCPE->hStereoCng->coh[0], &hCPE->hStereoCng->coh_fx[0], Q15, sizeof(hCPE->hStereoCng->coh_fx) / sizeof(hCPE->hStereoCng->coh_fx[0]) ); + //floatToFixed_arrL(&sts[0]->hFdCngDec->smoothed_psd[0], &sts[0]->hFdCngDec->smoothed_psd_fx[0], sts[0]->hFdCngDec->q_smoothed_psd, sizeof(sts[0]->hFdCngDec->smoothed_psd_fx) / sizeof(sts[0]->hFdCngDec->smoothed_psd_fx[0])); - hCPE->hCoreCoder[0]->hFdCngDec->hFdCngCom->q_cngNoiseLevel = s_max(0, Q31 - hCPE->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp); - floatToFixed_arrL(&hCPE->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[0], - &hCPE->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel[0], - hCPE->hCoreCoder[0]->hFdCngDec->hFdCngCom->q_cngNoiseLevel, - FFTCLDFBLEN); + //floatToFixed_arrL(&hCPE->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[0], + // &hCPE->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel[0], + // 0, + // FFTCLDFBLEN); + //TODO : To check this + hCPE->hCoreCoder[0]->hFdCngDec->hFdCngCom->q_cngNoiseLevel = Q31 - hCPE->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp; stereo_dtf_cng_fx( hCPE, ivas_total_brate, DFT_fx, output_frame, q_dft ); @@ -903,6 +905,7 @@ ivas_error ivas_cpe_dec_fx( float l_hb_nrg = 0.0, l_hb_nrg_subr = 0.0; float max_val = 0.0; int i_max_val = 0, i_max_val_psd; + #if 0 //for (int ii = 0; ii < sizeof(sts[0]->hFdCngDec->smoothed_psd) / sizeof(sts[0]->hFdCngDec->smoothed_psd[0]); ii++) //{ diff --git a/lib_dec/ivas_sce_dec_fx.c b/lib_dec/ivas_sce_dec_fx.c index 7a932b2c2b377c909d0c0f65b80df3d92ebe42a3..16f77ac251234155266092aa42e4c4b2c60a7b9b 100644 --- a/lib_dec/ivas_sce_dec_fx.c +++ b/lib_dec/ivas_sce_dec_fx.c @@ -403,14 +403,37 @@ ivas_error create_sce_dec( { st->is_ism_format = 1; } -#ifdef EVS_FLOAT - IF( ( error = init_decoder_ivas_fx( st, 0, st_ivas->mc_mode ) ) != IVAS_ERR_OK ) -#else - IF( ( error = init_decoder_fx( st, EVS_MONO ) ) != IVAS_ERR_OK ) -#endif + + //if (st_ivas->mode == IVAS_DEC_MODE_EVS) + if (st->element_mode == EVS_MONO) { - return error; + error = init_decoder_fx(st, EVS_MONO); + if (error) + { + { + return error; + } + } + } + else + { + error = init_decoder_ivas_fx(st, 0, st_ivas->mc_mode); + if (error) + { + { + return error; + } + } + } +//#ifdef EVS_FLOAT +// IF( ( error = init_decoder_ivas_fx( st, 0, st_ivas->mc_mode ) ) != IVAS_ERR_OK ) +//#else +// IF( ( error = init_decoder_fx( st, EVS_MONO ) ) != IVAS_ERR_OK ) +//#endif +// { +// return error; +// } IF( EQ_16( (Word16) st_ivas->ivas_format, SBA_FORMAT ) && ( EQ_16( (Word16) st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) || ( EQ_16( (Word16) st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) && EQ_16( st_ivas->nchan_transport, 1 ) ) ) ) { diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index a3a385a737b79c32c0aaa72e34399d0ee0a84976..de5c02b796d386b190dcaab2da71bf84cb2ccde9 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -1380,10 +1380,10 @@ static void stereo_dft_generate_comfort_noise_fx( } /* update msNoiseEst in SID and NO_DATA frames */ - bandcombinepow( &st->hFdCngDec->smoothed_psd_fx[hFdCngCom->startBand], st->hFdCngDec->q_smoothed_psd, hFdCngCom->stopFFTbin - hFdCngCom->startBand, st->hFdCngDec->part_shaping, st->hFdCngDec->nFFTpart_shaping, st->hFdCngDec->psize_inv_shaping, st->hFdCngDec->msNoiseEst, &st->hFdCngDec->msNoiseEst_exp ); - - st->hFdCngDec->first_cna_noise_updated = 1; - move16(); + bandcombinepow( &st->hFdCngDec->smoothed_psd_fx[hFdCngCom->startBand], (Q31 - st->hFdCngDec->q_smoothed_psd), hFdCngCom->stopFFTbin - hFdCngCom->startBand, st->hFdCngDec->part_shaping, st->hFdCngDec->nFFTpart_shaping, st->hFdCngDec->psize_inv_shaping, st->hFdCngDec->msNoiseEst, &st->hFdCngDec->msNoiseEst_exp); + Scale_sig32(st->hFdCngDec->msNoiseEst, NPART_SHAPING, sub( st->hFdCngDec->msNoiseEst_exp, 27 ) ); + st->hFdCngDec->msNoiseEst_exp = 27; + st->hFdCngDec->first_cna_noise_updated = 1; move16(); Copy32( st->hFdCngDec->msNoiseEst, st->hFdCngDec->msPeriodog_ST_fx, st->hFdCngDec->nFFTpart_shaping ); st->hFdCngDec->ms_last_inactive_bwidth = st->bwidth; move16(); diff --git a/lib_dec/ivas_stereo_mdct_core_dec_fx.c b/lib_dec/ivas_stereo_mdct_core_dec_fx.c index 1f92f548a252037e95ceb37decf986d07b001193..0bd8dc7942da637f94e2f52847190f272c9d4a72 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_core_dec_fx.c @@ -455,7 +455,7 @@ void stereo_mdct_core_dec_fx( { s = getScaleFactor32(sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN); Scale_sig32(sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, s); - sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = add(sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, s); + sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = sub(sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, s); } IF(sts[ch]->hFdCngDec && sts[ch]->hFdCngDec->hFdCngCom) { sts[ch]->hFdCngDec->hFdCngCom->likelihood_noisy_speech = extract_h(sts[ch]->hFdCngDec->hFdCngCom->likelihood_noisy_speech_32fx); @@ -1022,7 +1022,17 @@ static void run_min_stats_fx( } IF ( will_estimate_noise_on_channel[0] || will_estimate_noise_on_channel[1] || st->bfi ) - { + { + //for ( int p = 0; p < FFTCLDFBLEN; p++ ) + { + //st->hFdCngDec->hFdCngCom->cngNoiseLevel[p] = L_shr ( st->hFdCngDec->hFdCngCom->cngNoiseLevel[p], sub( 28, st->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) ); + } + Scale_sig32(st->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, sub(st->hFdCngDec->hFdCngCom->cngNoiseLevelExp, 28) ); + st->hFdCngDec->hFdCngCom->cngNoiseLevelExp = 31 - Q3; // Q3 + Scale_sig32(st->hFdCngDec->msNoiseEst, NPART_SHAPING, sub(st->hFdCngDec->msNoiseEst_exp, 27) ); + st->hFdCngDec->msNoiseEst_exp = 27; + //Scale_sig32(power_spec, L_FRAME16k, sub(power_spec_e, 31)); + //power_spec_e = 31; /*=================================================*/ ApplyFdCng_fx( NULL, 0, st->bfi ? NULL : power_spec, sub(31, power_spec_e), NULL, NULL, NULL, st, st->bfi, 0 ); /*=================================================*/ diff --git a/lib_dec/jbm_pcmdsp_apa.c b/lib_dec/jbm_pcmdsp_apa.c index 1164e7b07c31c9af71b5660b30609a966c7af0df..29e736952537fe63611fa3d5e66fc21edcb68a4c 100644 --- a/lib_dec/jbm_pcmdsp_apa.c +++ b/lib_dec/jbm_pcmdsp_apa.c @@ -67,7 +67,7 @@ struct apa_state_t { Word16 signalScaleForCorrelation; - Word16 frmInScaled[2 * 48000 / 50]; + Word16 frmInScaled[6 * 2 * 48000 / 50 * 2 ]; /* output buffer */ bool evs_compat_mode; float *buf_out; @@ -338,7 +338,7 @@ bool apa_set_rate( /* (the resulting maximum pitch is then p_min+l_search = 240 samples at 16 kHz) */ ps->l_search = ( ps->rate / 80 ) * ps->num_channels; -#ifndef EVS_FLOAT +#if 1//ndef EVS_FLOAT ps->win_fx = pcmdsp_window_hann_640; move16(); ps->l_halfwin_fx = 320; @@ -1219,7 +1219,7 @@ static Word8 logarithmic_search_fx(const apa_state_t * ps, { coeff_max = 0x80000000; /* will always be overwritten with result of first correlation */ move32(); - FOR(i = s_start; i < s_start + inlen; i += css) + FOR(i = s_start; i < s_start + inlen; i += css * ps->num_channels ) { test(); IF(EQ_16(wss,1) && EQ_16(ps->num_channels,1)) @@ -1381,7 +1381,8 @@ static Word16 find_synch_fx( apa_state_t *ps, fixed_pos, corr_len, ps->wss, - i_mult2( ps->css, ps->num_channels ), + //i_mult2( ps->css, ps->num_channels ), + ps->css, synch_pos ); /* assert synch_pos is cleanly divisible by number of channels */ assert( *synch_pos % ps->num_channels == 0 ); @@ -1485,9 +1486,9 @@ static bool shrink_frm( /* only 2nd input frame is used */ frm_in += l_frm; -#ifndef EVS_FLOAT - Word16 frm_in_fx[960]; - for ( i = 0; i < 960; i++ ) +#if 1//ndef EVS_FLOAT + Word16 frm_in_fx[960*4]; + for ( i = 0; i < l_frm/*960*ps->num_channels*/; i++ ) { frm_in_fx[i] = (Word16) frm_in[i]; } @@ -1501,7 +1502,7 @@ static bool shrink_frm( } /* calculate overlap position */ -#ifndef EVS_FLOAT +#if 1//ndef EVS_FLOAT if ( isSilence_fx( frm_in_fx, l_seg, 10 ) ) #else if ( isSilence( frm_in, l_seg, 10 ) ) @@ -1541,13 +1542,15 @@ static bool shrink_frm( else { /* find synch */ -#ifndef EVS_FLOAT +#if 1//ndef EVS_FLOAT Word16 energyQ8; Word32 qualityQ16=0; + //ps->signalScaleForCorrelation += 2; scaleSignal16( frm_in_fx, ps->frmInScaled, l_frm, ps->signalScaleForCorrelation ); findSynchResult = find_synch_fx( ps, ps->frmInScaled, l_frm, s_start, (uint16_t) ( s_end - s_start ), 0, l_seg, 0, &energyQ8, &qualityQ16, &xtract ); energy = fixedToFloat( energyQ8, 8 ); quality = fixedToFloat( qualityQ16, 16 ); + //ps->signalScaleForCorrelation -= 2; #else findSynchResult = find_synch( ps, frm_in, l_frm, s_start, (uint16_t) ( s_end - s_start ), 0, l_seg, 0, &energy, &quality, &xtract ); #endif @@ -1593,7 +1596,7 @@ static bool shrink_frm( { return 1; } -#ifdef EVS_FLOAT +#if 0//def EVS_FLOAT if ( ps->evs_compat_mode == true ) { overlapAddEvs( frm_in, frm_in + xtract, frm_out, l_seg, ps->num_channels, ps->win + ps->l_halfwin, ps->win ); @@ -1603,8 +1606,16 @@ static bool shrink_frm( overlapAdd_ivas( frm_in, frm_in + xtract, frm_out, l_seg, ps->num_channels, ps->win + ps->l_halfwin, ps->win ); } #else - Word16 frm_out_fx[960]; - overlapAdd( frm_in_fx, frm_in_fx + xtract, frm_out_fx, l_seg, ps->num_channels, ps->win_fx + ps->l_halfwin_fx, ps->win_fx , ps->win_incrementor); + Word16 frm_out_fx[960*8]; + IF ( ps->evs_compat_mode == true ) + { + //overlapAddEvs_fx( frm_in_fx, frm_in_fx + xtract, frm_out_fx, l_seg, ps->num_channels, ps->win_fx + ps->l_halfwin_fx, ps->win_fx ); + overlapAdd( frm_in_fx, frm_in_fx + xtract, frm_out_fx, l_seg, ps->num_channels, ps->win_fx + ps->l_halfwin_fx, ps->win_fx , ps->win_incrementor); + } + ELSE + { + overlapAdd( frm_in_fx, frm_in_fx + xtract, frm_out_fx, l_seg, ps->num_channels, ps->win_fx + ps->l_halfwin_fx, ps->win_fx , ps->win_incrementor); + } for ( i = 0; i < l_seg; i++ ) frm_out[i] = (float)frm_out_fx[i]; #endif // EVS_FLOAT @@ -1751,18 +1762,32 @@ static bool extend_frm( over[n] = 0; /* don't search/overlap (just copy down) */ } } -#ifndef EVS_FLOAT - Word16 frm_in_fx[1920]; - for ( i = 0; i < 1920; i++ ) +#if 1//ndef EVS_FLOAT + Word16 frm_in_fx[1920*2*2*2]; + Word16 max_flag = 0; + for ( i = 0; i < 2*l_frm; i++ ) { - frm_in_fx[i] = (Word16) frm_in[i]; + if(frm_in[i] > 32767) + { + max_flag = 1; + frm_in_fx[i] = 32767; + } + else if( frm_in[i] < -32767 ) + { + max_flag = 1; + frm_in_fx[i] = -32767; + } + else + { + frm_in_fx[i] = (Word16) frm_in[i]; + } } #endif // !EVS_FLOAT if ( over[n] ) { /* calculate overlap position */ -#ifndef EVS_FLOAT +#if 1//ndef EVS_FLOAT if ( isSilence_fx( frm_in_fx, l_seg, 10 ) ) #else if ( isSilence( frm_in, l_seg, 10 ) ) @@ -1782,15 +1807,23 @@ static bool extend_frm( } else { -#ifndef EVS_FLOAT +#if 1//ndef EVS_FLOAT Word16 energyQ8=0,*frmInScaled; Word32 qualityQ16=0; frmInScaled = ps->frmInScaled; + if(max_flag) + { + ps->signalScaleForCorrelation += 1; + } assert( sizeof( ps->frmInScaled ) / sizeof( ps->frmInScaled[0] ) >= 2 * (size_t) l_frm ); scaleSignal16( frm_in_fx, frmInScaled, shl(l_frm, 1), ps->signalScaleForCorrelation ); - findSynchResult = find_synch_fx( ps, frmInScaled, 2 * l_frm, s_start, s_end - s_start, sync_start, l_seg, l_frm, &energyQ8, &qualityQ16, &xtract[n] ); + findSynchResult = find_synch_fx( ps, frmInScaled, 2 * l_frm, s_start, s_end - s_start, sync_start, l_seg, l_frm, &energyQ8, &qualityQ16, &xtract[n] ); energy = fixedToFloat( energyQ8, 8 ); quality = fixedToFloat( qualityQ16, 16 ); + if(max_flag) + { + ps->signalScaleForCorrelation -= 1; + } #else /* find synch */ findSynchResult = find_synch( ps, frm_in, 2 * l_frm, s_start, s_end - s_start, sync_start, l_seg, l_frm, &energy, &quality, &xtract[n] ); @@ -1846,7 +1879,7 @@ static bool extend_frm( fadeOut = frm_in + l_frm + xtract[n - 1] + l_seg; fadeIn = frm_in + l_frm + xtract[n]; out = frm_out + ( n - 2 ) * l_seg; -#ifdef EVS_FLOAT +#if 0//def EVS_FLOAT if ( ps->evs_compat_mode == true ) { overlapAddEvs( fadeOut, fadeIn, out, l_seg, ps->num_channels, ps->win + ps->l_halfwin, ps->win ); @@ -1856,13 +1889,21 @@ static bool extend_frm( overlapAdd_ivas( fadeOut, fadeIn, out, l_seg, ps->num_channels, ps->win + ps->l_halfwin, ps->win ); } #else - Word16 fadeOut_fx[960], fadeIn_fx[960], out_fx[960]; - for ( i = 0; i < 960; i++ ) + Word16 fadeOut_fx[960*8], fadeIn_fx[960*8], out_fx[960*8]; + for ( i = 0; i < l_seg; i++ ) { fadeOut_fx[i] = (Word16) fadeOut[i]; fadeIn_fx[i] = (Word16) fadeIn[i]; } - overlapAdd( fadeOut_fx, fadeIn_fx, out_fx, l_seg, ps->num_channels, ps->win_fx + ps->l_halfwin_fx, ps->win_fx ,ps->win_incrementor); + IF ( ps->evs_compat_mode == true ) + { + //overlapAddEvs_fx( fadeOut_fx, fadeIn_fx, out_fx, l_seg, ps->num_channels, ps->win_fx + ps->l_halfwin_fx, ps->win_fx ); + overlapAdd( fadeOut_fx, fadeIn_fx, out_fx, l_seg, ps->num_channels, ps->win_fx + ps->l_halfwin_fx, ps->win_fx ,ps->win_incrementor); + } + ELSE + { + overlapAdd( fadeOut_fx, fadeIn_fx, out_fx, l_seg, ps->num_channels, ps->win_fx + ps->l_halfwin_fx, ps->win_fx ,ps->win_incrementor); + } for ( i = 0; i < l_seg; i++ ) out[i] = (float) out_fx[i]; #endif // EVS_FLOAT diff --git a/lib_dec/jbm_pcmdsp_similarityestimation.c b/lib_dec/jbm_pcmdsp_similarityestimation.c index 852d4b789fa79c648540c4d404a26ed1f20e6b6f..6bb1c3eee061817fb0d5b7188e4bbc8095230617 100644 --- a/lib_dec/jbm_pcmdsp_similarityestimation.c +++ b/lib_dec/jbm_pcmdsp_similarityestimation.c @@ -66,7 +66,7 @@ float cross_correlation_self( return c_c; } -#ifndef EVS_FLOAT +#if 1//ndef EVS_FLOAT void scaleSignal16( const Word16 *src, Word16 *dst, Word16 n, Word16 rightShift ) { Word16 i; diff --git a/lib_dec/jbm_pcmdsp_window.c b/lib_dec/jbm_pcmdsp_window.c index d05b112570a02fa928ef4b6df451c61cc8e7e52b..b4cfb9eb1a9ed4d74d4f6a20960293c68a104e52 100644 --- a/lib_dec/jbm_pcmdsp_window.c +++ b/lib_dec/jbm_pcmdsp_window.c @@ -76,7 +76,7 @@ void hannWindow( * Overlap/Add of two signal with a given window *-----------------------------------------------------------------------*/ -#ifndef EVS_FLOAT +#if 1//ndef EVS_FLOAT void overlapAdd( const Word16 *fadeOut, const Word16 *fadeIn, Word16 *out, Word16 n, Word16 nChannels, const Word16 *fadeOutWin, const Word16 *fadeInWin, Word16 hannIncrementor ) { Word32 fdOutVal, fdInVal; diff --git a/lib_dec/jbm_pcmdsp_window.h b/lib_dec/jbm_pcmdsp_window.h index cc090b781535123c5b03bac5832e7eb0e7e46899..bbd490b844fe09ee8d6208e65505bf866a17efdd 100644 --- a/lib_dec/jbm_pcmdsp_window.h +++ b/lib_dec/jbm_pcmdsp_window.h @@ -72,5 +72,7 @@ void overlapAdd_fx(const Word16 *fadeOut, const Word16 *fadeIn, Word16 *out, void overlapAdd_fx(const Word16 *fadeOut, const Word16 *fadeIn, Word16 *out, Word16 n, Word16 nChannels, const Word16 *fadeOutWin, const Word16 *fadeInWin ); + +void overlapAddEvs_fx( const Word16 *fadeOut, const Word16 *fadeIn, Word16 *out, UWord16 n, UWord16 nChannels, const Word16 *fadeOutWin, const Word16 *fadeInWin ); #endif /* IVAS_FLOAT_FIXED */ #endif /* JBM_PCMDSP_WINDOW_H */ diff --git a/lib_dec/lsf_dec_fx.c b/lib_dec/lsf_dec_fx.c index fff93a55edb23a160000efbbe1787ccf26ff6bb1..9fa9484c0e12603cb3e2235f2eb63a208bb97977 100644 --- a/lib_dec/lsf_dec_fx.c +++ b/lib_dec/lsf_dec_fx.c @@ -284,8 +284,6 @@ void lsf_dec_fx( Copy( lsp_mid, st_fx->lsp_old_fx, M ); lsp2lsf_fx( lsp_mid, st_fx->lsf_old_fx, M, st_fx->sr_core); } -#ifdef EVS_FLOAT -#if 1//def ADD_LRTD IF (EQ_16(tdm_low_rate_mode, 1) && GT_16(coder_type, UNVOICED)) { //PMT("To be verified") @@ -300,8 +298,6 @@ void lsf_dec_fx( int_lsp4_fx(st_fx->L_frame, st_fx->lsp_old_fx, lsp_mid, lsp_new, Aq, M, -2); } ELSE -#endif -#endif { /* LSP interpolation and conversion of LSPs to A(z) */ int_lsp4_fx(st_fx->L_frame, st_fx->lsp_old_fx, lsp_mid, lsp_new, Aq, M, st_fx->relax_prev_lsf_interp); @@ -878,23 +874,11 @@ void lsf_mid_dec_fx( ratio = tbl_mid_gen_wb_5b_fx; BREAK; } -#ifdef EVS_FLOAT -#if 1//def IVAS_CODE case 4: { ratio = tbl_mid_gen_wb_4b_fx; break; } -#endif -#else -#if IVAS_CODE - case 4: - { - ratio = tbl_mid_gen_wb_4b_fx; - break; - } -#endif -#endif // EVS_FLOAT case 2: { ratio = tbl_mid_gen_wb_2b_fx; diff --git a/lib_dec/swb_bwe_dec.c b/lib_dec/swb_bwe_dec.c index a4bea1d4737e136bf722df7b64818b548cfdd870..551ad48b5148ed0d2d26b78ffd8131d4349f78fd 100644 --- a/lib_dec/swb_bwe_dec.c +++ b/lib_dec/swb_bwe_dec.c @@ -1196,11 +1196,11 @@ Word16 swb_bwe_dec_fx32( IF(EQ_16(st_fx->L_frame, L_FRAME16k)) { - SWB_BWE_decoding_fx(ysynth_fx, SWB_fenv_fx, yerror_fx, L_FRAME32k - 80, mode, &frica_flag, &hBWE_FD->prev_Energy_fx, st_fx->prev_SWB_fenv_fx, &hBWE_FD->prev_L_swb_norm, st_fx->tilt_wb_fx, &hBWE_FD->Seed, 80, &hBWE_FD->prev_weight_fx, st_fx->extl, Q_syn, st_fx->last_extl); + SWB_BWE_decoding_fx(ysynth_fx, SWB_fenv_fx, yerror_fx, L_FRAME32k - 80, mode, &frica_flag, &hBWE_FD->prev_Energy_fx, st_fx->prev_SWB_fenv_fx, &hBWE_FD->prev_L_swb_norm, st_fx->tilt_wb_fx, &hBWE_FD->Seed, 80, &hBWE_FD->prev_weight_fx, st_fx->extl, Q_syn, st_fx->last_extl, st_fx->element_mode); } ELSE { - SWB_BWE_decoding_fx(ysynth_fx, SWB_fenv_fx, yerror_fx, L_FRAME32k - 80, mode, &frica_flag, &hBWE_FD->prev_Energy_fx, st_fx->prev_SWB_fenv_fx, &hBWE_FD->prev_L_swb_norm, st_fx->tilt_wb_fx, &hBWE_FD->Seed, 6, &hBWE_FD->prev_weight_fx, st_fx->extl, Q_syn, st_fx->last_extl); + SWB_BWE_decoding_fx(ysynth_fx, SWB_fenv_fx, yerror_fx, L_FRAME32k - 80, mode, &frica_flag, &hBWE_FD->prev_Energy_fx, st_fx->prev_SWB_fenv_fx, &hBWE_FD->prev_L_swb_norm, st_fx->tilt_wb_fx, &hBWE_FD->Seed, 6, &hBWE_FD->prev_weight_fx, st_fx->extl, Q_syn, st_fx->last_extl, st_fx->element_mode); } diff --git a/lib_dec/swb_bwe_dec_fx.c b/lib_dec/swb_bwe_dec_fx.c index 44b2e84ef63da96f48fee0dd8940e151e137712d..f79f1b7fe06a58d3e4cce797b792903dd32255c7 100644 --- a/lib_dec/swb_bwe_dec_fx.c +++ b/lib_dec/swb_bwe_dec_fx.c @@ -1053,13 +1053,13 @@ Word16 swb_bwe_dec_fx( { SWB_BWE_decoding_fx( ysynth_fx, SWB_fenv_fx, ysynth_32, L_FRAME32k-80, mode, &frica_flag, &hBWE_FD->prev_Energy_fx, st_fx->prev_SWB_fenv_fx, &hBWE_FD->prev_L_swb_norm, st_fx->tilt_wb_fx, &hBWE_FD->Seed, 80, &hBWE_FD->prev_weight_fx, st_fx->extl, Q_syn - ,st_fx->last_extl); + ,st_fx->last_extl, st_fx->element_mode); } ELSE { SWB_BWE_decoding_fx( ysynth_fx, SWB_fenv_fx, ysynth_32, L_FRAME32k-80, mode, &frica_flag, &hBWE_FD->prev_Energy_fx, st_fx->prev_SWB_fenv_fx, &hBWE_FD->prev_L_swb_norm, st_fx->tilt_wb_fx, &hBWE_FD->Seed, 6, &hBWE_FD->prev_weight_fx, st_fx->extl, Q_syn, - st_fx->last_extl); + st_fx->last_extl, st_fx->element_mode); } test(); diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index ee4c1d48c060ef110b971d67a2239883cbf1650a..1de27b44cfe15aca3226139d2845f2835212b3d7 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -26,7 +26,7 @@ static void CalcMDXT(const TonalMDCTConcealPtr hTonalMDCTConc, const Word16 type, const Word16 * timeSignal, Word32 * mdxtOutput, Word16 * mdxtOutput_e); static void CalcPowerSpec(const Word32 * mdctSpec, const Word16 mdctSpec_exp, const Word32 * mdstSpec, const Word16 mdstSpec_exp, const Word16 nSamples, const Word16 floorPowerSpectrum, Word32 * powerSpec, Word16 * powerSpec_exp); -static void CalcPowerSpecAndDetectTonalComponents(TonalMDCTConcealPtr const hTonalMDCTConc, Word32 secondLastMDST[], Word16 secondLastMDST_exp, Word32 secondLastMDCT[], Word16 secondLastMDCT_exp, Word32 const pitchLag); +static void CalcPowerSpecAndDetectTonalComponents(TonalMDCTConcealPtr const hTonalMDCTConc, Word32 secondLastMDST[], Word16 secondLastMDST_exp, Word32 secondLastMDCT[], Word16 secondLastMDCT_exp, Word32 const pitchLag, Word16 element_mode); static void FindPhases(TonalMDCTConcealPtr const hTonalMDCTConc, Word32 secondLastMDCT[], Word32 secondLastMDST[], Word16 diff_exp); static void FindPhaseDifferences(TonalMDCTConcealPtr const hTonalMDCTConc, Word32 powerSpectrum[]); @@ -720,7 +720,8 @@ static void ivas_CalcPowerSpecAndDetectTonalComponents_fx( Word32 secondLastMDCT[], Word16 secondLastMDCT_exp, Word32 const pitchLag, - const PsychoacousticParameters* psychParamsCurrent + const PsychoacousticParameters* psychParamsCurrent, + Word16 element_mode ) { Word16 nSamples; @@ -796,7 +797,7 @@ static void ivas_CalcPowerSpecAndDetectTonalComponents_fx( powerSpectrum, nSamples, hTonalMDCTConc->nSamplesCore, - floorPowerSpectrum, psychParamsCurrent); + floorPowerSpectrum, psychParamsCurrent, element_mode); FindPhases(hTonalMDCTConc, secondLastMDCT, secondLastMDST, sub(secondLastMDST_exp,secondLastMDCT_exp)); FindPhaseDifferences(hTonalMDCTConc, powerSpectrum); @@ -882,7 +883,8 @@ static void CalcPowerSpecAndDetectTonalComponents( Word16 secondLastMDST_exp, Word32 secondLastMDCT[], Word16 secondLastMDCT_exp, - Word32 const pitchLag + Word32 const pitchLag, + Word16 element_mode #ifdef IVAS_CODE_MDCT_GSHAPE ,const PsychoacousticParameters* psychParamsCurrent #endif @@ -942,7 +944,7 @@ static void CalcPowerSpecAndDetectTonalComponents( powerSpectrum, nSamples, hTonalMDCTConc->nSamplesCore, - floorPowerSpectrum); + floorPowerSpectrum, element_mode); FindPhases(hTonalMDCTConc, secondLastMDCT, secondLastMDST, sub(secondLastMDST_exp,secondLastMDCT_exp)); FindPhaseDifferences(hTonalMDCTConc, powerSpectrum); @@ -1046,7 +1048,8 @@ static void CalcMDXT( void TonalMDCTConceal_Detect( const TonalMDCTConcealPtr hTonalMDCTConc, const Word32 pitchLag, - Word16 * numIndices + Word16 * numIndices, + Word16 element_mode #ifdef IVAS_CODE_MDCT_GSHAPE ,const PsychoacousticParameters* psychParamsCurrent #endif @@ -1115,7 +1118,7 @@ void TonalMDCTConceal_Detect( } secondLastMDCT_exp = sub(secondLastMDCT_exp, s); move16(); - CalcPowerSpecAndDetectTonalComponents(hTonalMDCTConc, secondLastMDST, secondLastMDST_exp, secondLastMDCT, secondLastMDCT_exp, pitchLag); + CalcPowerSpecAndDetectTonalComponents(hTonalMDCTConc, secondLastMDST, secondLastMDST_exp, secondLastMDCT, secondLastMDCT_exp, pitchLag, element_mode); } ELSE { @@ -1165,7 +1168,7 @@ void TonalMDCTConceal_Detect( powerSpectrum, nSamples, hTonalMDCTConc->nSamplesCore, - extract_l(Mpy_32_16_1(L_mult0(hTonalMDCTConc->nSamples,hTonalMDCTConc->nSamples),82))); /* floorPowerSpectrum */ + extract_l(Mpy_32_16_1(L_mult0(hTonalMDCTConc->nSamples,hTonalMDCTConc->nSamples),82)), element_mode); /* floorPowerSpectrum */ } } @@ -1188,7 +1191,8 @@ void TonalMDCTConceal_Detect_ivas_fx( const TonalMDCTConcealPtr hTonalMDCTConc, const Word32 pitchLag, Word16 * numIndices, - const PsychoacousticParameters* psychParamsCurrent + const PsychoacousticParameters* psychParamsCurrent, + Word16 element_mode ) { Word32 secondLastMDST[L_FRAME_MAX]; @@ -1256,7 +1260,7 @@ void TonalMDCTConceal_Detect_ivas_fx( secondLastMDCT_exp = sub(secondLastMDCT_exp, s); move16(); //CalcPowerSpecAndDetectTonalComponents(hTonalMDCTConc, secondLastMDST, secondLastMDST_exp, secondLastMDCT, secondLastMDCT_exp, pitchLag); - ivas_CalcPowerSpecAndDetectTonalComponents_fx(hTonalMDCTConc, secondLastMDST, secondLastMDST_exp, secondLastMDCT, secondLastMDCT_exp, pitchLag, psychParamsCurrent); + ivas_CalcPowerSpecAndDetectTonalComponents_fx(hTonalMDCTConc, secondLastMDST, secondLastMDST_exp, secondLastMDCT, secondLastMDCT_exp, pitchLag, psychParamsCurrent, element_mode); } ELSE { @@ -1308,7 +1312,7 @@ void TonalMDCTConceal_Detect_ivas_fx( powerSpectrum, nSamples, hTonalMDCTConc->nSamplesCore, - extract_l(Mpy_32_16_1(L_mult0(hTonalMDCTConc->nSamples,hTonalMDCTConc->nSamples),82))); /* floorPowerSpectrum */ + extract_l(Mpy_32_16_1(L_mult0(hTonalMDCTConc->nSamples,hTonalMDCTConc->nSamples),82)), element_mode); /* floorPowerSpectrum */ } }