diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 4d150afb388dbaffa8fcb91184a130fc64840418..74ec680c49e7c064176ef8bea0c214b3dc63fcd7 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1622,6 +1622,7 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot_fx( const Word16 nchan_in /* i : number of input channels */ ); +#ifndef HARMONIZE_2499_CONFIGUREFDCNGDEC void configureFdCngDec_ivas_fx( HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the FD-based CNG process */ const Word16 bwidth, @@ -1630,6 +1631,7 @@ void configureFdCngDec_ivas_fx( const Word16 last_L_frame, const Word16 element_mode ); +#endif void synchonize_channels_mdct_sid_fx( Decoder_State *sts[CPE_CHANNELS], /* i/o: decoder state structure */ diff --git a/lib_com/options.h b/lib_com/options.h index 7f31403c939b6f3e1722deab92545bdd7034d8c2..47582491e590969bc7f270c7fa995f7bef587733 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -95,6 +95,7 @@ #define FIX_1527_CMR_BITRATE_IDX /* Fix for incorrect bitrate idx packed in rtp CMR E-byte */ #define HARMONIZE_2494_FdCng_decodeSID_fx /* FhG: harmonize FdCng_decodeSID_fx with _ivas_ version */ #define FIX_BASOP_2509_EVS_CONCEAL_UNINIT_MEM /* FhG: BASOP 2509: st->hTcxCfg->psychParamsCurrent is not initialized */ +#define HARMONIZE_2499_CONFIGUREFDCNGDEC /* FhG: basop issue 2499: harmonoize configureFdCngDec */ /* #################### End BE switches ################################## */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 526512904aaaa78d9fe2810c84f4283f457529e8..913f00c66900321950a5d6d31fb20ca146ef801c 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -6510,6 +6510,7 @@ void initFdCngDec_fx( void deleteFdCngDec_fx( HANDLE_FD_CNG_DEC *hFdCngDec ); +#ifndef HARMONIZE_2499_CONFIGUREFDCNGDEC /* Configure CLDFB-CNG */ void configureFdCngDec_fx( HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the CLDFB-based CNG process */ @@ -6518,6 +6519,15 @@ void configureFdCngDec_fx( Word16 L_frame, const Word16 Last_L_frame, const Word16 element_mode ); +#else +void configureFdCngDec_fx( + HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the FD-based CNG process */ + const Word16 bwidth, + const Word32 total_brate, + const Word16 L_frame, + const Word16 last_L_frame, + const Word16 element_mode ); +#endif Word16 ApplyFdCng_fx( Word16 *timeDomainInput, /* i : pointer to time domain input */ @@ -8516,6 +8526,7 @@ void v_mult16_fx( const Word16 N /* i : Vector length */ ); +#ifndef HARMONIZE_2499_CONFIGUREFDCNGDEC void configureFdCngDec_fx( HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the FD-based CNG process */ const Word16 bwidth, @@ -8523,6 +8534,7 @@ void configureFdCngDec_fx( const Word16 L_frame, const Word16 last_L_frame, const Word16 element_mode ); +#endif Word32 sum2_f_16_fx( const Word16 *vec, /* i : input vector */ diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index a4badec34146c2bfceff8bbf61ab8d09d38f805e..2a7ee9fdbcb1c67571b76eb9759ae59a9e9f396e 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -1893,7 +1893,11 @@ ivas_error core_switching_pre_dec_fx( } ELSE { +#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC + configureFdCngDec_fx( st->hFdCngDec, st->bwidth, st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); +#else configureFdCngDec_ivas_fx( st->hFdCngDec, st->bwidth, st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); +#endif } } ELSE diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index aba421f957c976dee39ad86a8240cf9e41c179e6..54caafcefe758b853f23024af7a5b8e6c6e20c47 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -199,6 +199,7 @@ void initFdCngDec_fx( return; } +#ifndef HARMONIZE_2499_CONFIGUREFDCNGDEC /* configureFdCngDec_fx @@ -424,6 +425,7 @@ void configureFdCngDec_fx( hsCom->frameSize = shr( hsCom->fftlen, 1 ); move16(); } +#endif /* @@ -4279,7 +4281,11 @@ void generate_masking_noise_mdct_ivas_fx( * * Initialize an instance of type FD_CNG *-------------------------------------------------------------------*/ +#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC +void configureFdCngDec_fx( +#else void configureFdCngDec_ivas_fx( +#endif HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the FD-based CNG process */ const Word16 bwidth, /*Q0*/ const Word32 total_brate, /*Q0*/ @@ -4306,16 +4312,13 @@ void configureFdCngDec_ivas_fx( ELSE IF( EQ_32( hsCom->CngBitrate, -1 ) ) { /* set minimum active CBR bitrate IF CngBitrate is uninitialized */ - IF( element_mode > EVS_MONO ) + hsCom->CngBitrate = ACELP_7k20; + move32(); + if ( GT_16( element_mode, EVS_MONO ) ) { hsCom->CngBitrate = IVAS_13k2; move32(); } - ELSE - { - hsCom->CngBitrate = ACELP_7k20; - move32(); - } } /* FD-CNG config for MDCT-Stereo is always the same (since for > 48 kbps only) */ @@ -4464,24 +4467,31 @@ void configureFdCngDec_ivas_fx( hFdCngDec->nFFTpart_shaping = hFdCngDec->npart_shaping; /*Q0*/ move16(); - BASOP_getTables( &hsCom->olapWinAna, NULL, NULL, shr( hsCom->fftlen, 1 ) ); - BASOP_getTables( &hsCom->olapWinSyn, NULL, NULL, shr( hsCom->fftlen, 2 ) ); - SWITCH( hsCom->fftlen ) { case 512: - hsCom->olapWinAna_fx = olapWinAna512_fx; /*Q30*/ - hsCom->fftSineTab_fx = NULL; - hsCom->olapWinSyn_fx = olapWinSyn256_fx; /*Q15*/ +#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC + IF( GT_16( element_mode, EVS_MONO ) ) + { + hsCom->olapWinAna_fx = olapWinAna512_fx; /*Q30*/ + hsCom->fftSineTab_fx = NULL; + hsCom->olapWinSyn_fx = olapWinSyn256_fx; /*Q15*/ + } +#endif hsCom->fftlenShift = 8; move16(); hsCom->fftlenFac = 32767 /*1.0 Q15*/; move16(); BREAK; case 640: - hsCom->olapWinAna_fx = olapWinAna640_fx; /*Q30*/ - hsCom->fftSineTab_fx = fftSineTab640_fx; /*Q15*/ - hsCom->olapWinSyn_fx = olapWinSyn320_fx; /*Q15*/ +#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC + IF( GT_16( element_mode, EVS_MONO ) ) + { + hsCom->olapWinAna_fx = olapWinAna640_fx; /*Q30*/ + hsCom->fftSineTab_fx = fftSineTab640_fx; /*Q15*/ + hsCom->olapWinSyn_fx = olapWinSyn320_fx; /*Q15*/ + } +#endif hsCom->fftlenShift = 9; move16(); hsCom->fftlenFac = 20480 /*0.625 Q15*/; @@ -4491,6 +4501,7 @@ void configureFdCngDec_ivas_fx( assert( !"Unsupported FFT length for FD-based CNG" ); BREAK; } + BASOP_getTables( &hsCom->olapWinAna, NULL, NULL, shr( hsCom->fftlen, 1 ) ); BASOP_getTables( &hsCom->olapWinSyn, NULL, NULL, shr( hsCom->fftlen, 2 ) ); hsCom->frameSize = shr( hsCom->fftlen, 1 ); diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c index 654f2bd13ac191aa1f35845cc986f408926661c3..29df46c61945c957371b5f051c61feac1abcaabe 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c @@ -37,6 +37,9 @@ #include "prot_fx.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" +#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC +#include "prot_fx.h" +#endif /*-------------------------------------------------------------------* @@ -641,14 +644,22 @@ void synchonize_channels_mdct_sid_fx( test(); IF( EQ_16( sts[0]->first_CNG, 1 ) && EQ_16( sts[1]->first_CNG, 0 ) ) { +#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC + configureFdCngDec_fx( st->hFdCngDec, st->bwidth, st->element_brate, st->L_frame, st->last_L_frame, st->element_mode ); +#else configureFdCngDec_ivas_fx( st->hFdCngDec, st->bwidth, st->element_brate, st->L_frame, st->last_L_frame, st->element_mode ); +#endif } } IF( sts[0]->first_CNG == 0 ) { /* configure CNG after reading first side info from SID to get correct values for L_frame and bwidth if first SID is also first valid frame */ +#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC + configureFdCngDec_fx( st->hFdCngDec, st->bwidth, st->element_brate, st->L_frame, st->last_L_frame, st->element_mode ); +#else configureFdCngDec_ivas_fx( st->hFdCngDec, st->bwidth, st->element_brate, st->L_frame, st->last_L_frame, st->element_mode ); +#endif } } diff --git a/lib_dec/ivas_stereo_switching_dec_fx.c b/lib_dec/ivas_stereo_switching_dec_fx.c index 59f2223d07a32f88f624c53070a4367acaebc601..554ac92bab597ab25681e7de32a9ce82e96c4cd1 100644 --- a/lib_dec/ivas_stereo_switching_dec_fx.c +++ b/lib_dec/ivas_stereo_switching_dec_fx.c @@ -659,8 +659,11 @@ ivas_error stereo_memory_dec_fx( } initFdCngDec_fx( st, st->cldfbSyn->scale ); - +#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC + configureFdCngDec_fx( st->hFdCngDec, st->bwidth, st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); +#else configureFdCngDec_ivas_fx( st->hFdCngDec, st->bwidth, st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); +#endif } /* allocate stereo CNG structure */