diff --git a/lib_com/options.h b/lib_com/options.h index cbd62853c31127b80cd1a9b5ce4fe96c23a79aa4..47515333dcc4f0e4003436e6100d112ef88082f1 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -139,6 +139,7 @@ #define FIX_680_CNG_FRAME_BOUNDARIES_ISSUE /* Step was right shift by 2, which made the OVA wrong */ #define NONBE_FIX_1069_SVD_TUNING /* FhG: issue 1069: tune SVD constants */ #define FIX_778_STEREO_BRATE_SWITCHING +#define FIX_774_ENERGY_BURST /* Fix 0 bit BWE */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_com/prot.h b/lib_com/prot.h index 866d3aa79879add3d5a6b5132ea69d1169b451c7..698b29187389699b918361f0aae7d1eb6eff8c3b 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -819,7 +819,7 @@ void hf_synth( float *synth, /* i/o: 12.8kHz synthesis signal */ float *synth16k /* i/o: 16kHz synthesis signal */ ); - +#ifndef FIX_774_ENERGY_BURST #ifdef IVAS_FLOAT_FIXED void hf_synth_ivas_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, /* i/o: handle to 0 bit BWE parameters */ @@ -838,6 +838,7 @@ void hf_synth_ivas_fx( const Word16 CNG_mode, /* i : CNG_mode */ Word16 element_mode ); #endif +#endif int16_t lsp_convert_poly( float w[], /* i/o: LSP or ISP parameters */ const int16_t L_frame, /* i : flag for up or down conversion */ diff --git a/lib_dec/acelp_core_dec_fx.c b/lib_dec/acelp_core_dec_fx.c index bb2dfffffd38b4acf3638ccf7449f6ddde1effcb..dd25918d25b859f3281838248f80369b6b316485 100644 --- a/lib_dec/acelp_core_dec_fx.c +++ b/lib_dec/acelp_core_dec_fx.c @@ -1787,8 +1787,13 @@ ivas_error acelp_core_dec_fx( IF( ( EQ_16( st_fx->L_frame, L_FRAME ) && NE_16( st_fx->bwidth, NB ) && GE_16( output_frame, L_FRAME16k ) && ( EQ_16( st_fx->extl, -1 ) || EQ_16( st_fx->extl, SWB_CNG ) || ( EQ_16( st_fx->extl, WB_BWE ) && st_fx->extl_brate == 0 && NE_16( st_fx->coder_type, AUDIO ) ) ) ) ) { +#ifdef FIX_774_ENERGY_BURST + hf_synth_fx( st_fx->hBWE_zero, st_fx->core_brate, output_frame, Aq_fx, exc2_fx, syn_fx, synth_out, st_fx->Q_exc, + st_fx->Q_syn2, st_fx->hBWE_zero->delay_syn_hf_fx, &st_fx->hBWE_zero->memExp1, st_fx->hBWE_zero->mem_hp_interp_fx, st_fx->extl, st_fx->CNG_mode ); +#else hf_synth_fx( st_fx->hBWE_zero, st_fx->core_brate, output_frame, Aq_fx, exc2_fx, syn_fx, synth_out, st_fx->Q_exc, st_fx->Q_syn2, st_fx->hBWE_zero->delay_syn_hf_fx, &hBWE_FD->memExp1, st_fx->hBWE_zero->mem_hp_interp_fx, st_fx->extl, st_fx->CNG_mode ); +#endif } ELSE { diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index c594364118d1b75c1d338c07fbd9e508a46f50e3..89559d6c22194fa910a0bf00236833b1518f2a72 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -1882,22 +1882,29 @@ ivas_error acelp_core_dec_ivas_fx( IF( ( EQ_16( st->L_frame, L_FRAME ) && NE_16( st->bwidth, NB ) && GE_16( output_frame, L_FRAME16k ) && ( EQ_16( st->extl, -1 ) || EQ_16( st->extl, SWB_CNG ) || ( EQ_16( st->extl, WB_BWE ) && st->extl_brate == 0 && NE_16( st->coder_type, AUDIO ) ) ) ) ) { +#ifndef FIX_774_ENERGY_BURST Word16 tmp_exp = 0; +#endif #ifdef MSAN_FIX Copy_Scale_sig_32_16( synth_fx, synth_fx16, output_frame, 0 ); #else Copy_Scale_sig_32_16( synth_fx, synth_fx16, L_FRAME48k, 0 ); #endif - - hf_synth_ivas_fx( st->hBWE_zero, st->core_brate, output_frame, Aq_fx, exc_fx, - psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2, st->hBWE_zero->delay_syn_hf_fx, &tmp_exp, - st->hBWE_zero->mem_hp_interp_fx, st->extl, st->CNG_mode, st->element_mode ); +#ifdef FIX_774_ENERGY_BURST + hf_synth_fx( st->hBWE_zero, st->core_brate, output_frame, Aq_fx, exc_fx, + psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2, st->hBWE_zero->delay_syn_hf_fx, &st->hBWE_zero->memExp1, + st->hBWE_zero->mem_hp_interp_fx, st->extl, st->CNG_mode ); +#else + hf_synth_ivas_fx( st->hBWE_zero, st->core_brate, output_frame, Aq_fx, exc_fx, + psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2, st->hBWE_zero->delay_syn_hf_fx, &tmp_exp, + st->hBWE_zero->mem_hp_interp_fx, st->extl, st->CNG_mode, st->element_mode ); +#endif #ifdef MSAN_FIX Copy_Scale_sig_16_32( synth_fx16, synth_fx, output_frame, 0 ); #else Copy_Scale_sig_16_32( synth_fx16, synth_fx, L_FRAME48k, 0 ); #endif - +#ifndef FIX_774_ENERGY_BURST IF( st->hBWE_FD != NULL ) { st->hBWE_FD->memExp1 = tmp_exp; @@ -1906,6 +1913,7 @@ ivas_error acelp_core_dec_ivas_fx( { Scale_sig( st->hBWE_zero->mem_hf_fx, L_FIR - 1, -tmp_exp ); } +#endif } ELSE { diff --git a/lib_dec/hf_synth_fx.c b/lib_dec/hf_synth_fx.c index f848edd5fdb81bbe4dc84264355dfb84d9b37059..c63636e23e503ea23e4e742bec22182941f7dca4 100644 --- a/lib_dec/hf_synth_fx.c +++ b/lib_dec/hf_synth_fx.c @@ -24,9 +24,11 @@ static void filt_6k_7k_scale_fx( Word16 signal[], Word16 lg, Word16 mem[], Word16 fact, Word16 exp ); static void hf_synthesis_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, const Word32 core_brate, const Word16 output_subfr, const Word16 Aq[], const Word16 exc[], const Word16 Q_exc, Word16 synth[], Word16 synth16k[], const Word16 Q_syn, Word16 *delay_syn_hf, Word16 *memExp1, Word16 *mem_hp_interp, const Word16 extl, const Word16 CNG_mode ); +#ifndef FIX_774_ENERGY_BURST #ifdef IVAS_FLOAT_FIXED static void hf_synthesis_ivas_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, const Word32 core_brate, const Word16 output_subfr, const Word16 Aq[], const Word16 exc[], const Word16 Q_exc, Word16 synth[], Word16 synth16k[], const Word16 Q_syn, Word16 *delay_syn_hf, Word16 *memExp1, Word16 *mem_hp_interp, const Word16 extl, const Word16 CNG_mode, Word16 element_mode ); #endif +#endif static void hf_synthesis_amr_wb_fx( const Word32 core_brate, const Word16 output_subfr, const Word16 Ap[], Word16 exc16k[], Word16 synth_out[], Word16 *mem_syn_hf, Word16 *delay_syn_hf, Word16 *mem_hp_interp, Word16 p_r, Word16 HF_corr_gain, Word16 til, Word16 voice_factors, const Word16 exc[], const Word16 Q_exc, const Word16 Q_out, Word16 qhf ); static void envelope_fx( AMRWB_IO_DEC_HANDLE hAmrwb_IO, const Word32 core_brate, const Word16 Aq[], Word16 Ap[], Word16 *r, Word16 tilt0, Word16 tilt, Word16 voice_factor ); @@ -51,7 +53,10 @@ void hf_synth_init_fx( set16_fx( hBWE_zero->mem_hp400_fx, 0, 4 ); set16_fx( hBWE_zero->delay_syn_hf_fx, 0, NS2SA( 16000, DELAY_CLDFB_NS ) ); set16_fx( hBWE_zero->mem_hp_interp_fx, 0, INTERP_3_1_MEM_LEN ); - +#ifdef FIX_774_ENERGY_BURST + hBWE_zero->memExp1 = 0; + move16(); +#endif return; } void hf_synth_reset_fx( @@ -71,7 +76,10 @@ void hf_synth_reset_fx( set16_fx( hBWE_zero->delay_syn_hf_fx, 0, NS2SA( 16000, DELAY_CLDFB_NS ) ); set16_fx( hBWE_zero->mem_hp_interp_fx, 0, INTERP_3_1_MEM_LEN ); - +#ifdef FIX_774_ENERGY_BURST + hBWE_zero->memExp1 = 0; + move16(); +#endif return; } @@ -117,7 +125,7 @@ void hf_synth_fx( return; } - +#ifndef FIX_774_ENERGY_BURST #ifdef IVAS_FLOAT_FIXED void hf_synth_ivas_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, /* i/o: handle to 0 bit BWE parameters */ @@ -156,6 +164,7 @@ void hf_synth_ivas_fx( return; } #endif +#endif /*-----------------------------------------------------------------------------------* * hf_synthesis() * @@ -384,7 +393,7 @@ static void hf_synthesis_fx( return; } - +#ifndef FIX_774_ENERGY_BURST #ifdef IVAS_FLOAT_FIXED static void hf_synthesis_ivas_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, @@ -611,6 +620,7 @@ static void hf_synthesis_ivas_fx( return; } #endif +#endif /*-------------------------------------------------------------------* * filt_6k_7k: diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index 301014d926c1752df8d3914ad0abc449f394e808..29f1db0f1c0105ed35516eb489217e0ae5c62f80 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -1586,7 +1586,9 @@ typedef struct zero_bwe_dec_structure Word16 delay_syn_hf_fx[NS2SA( 16000, DELAY_CLDFB_NS )]; /* HF (6-7kHz) BWE - To synchronise BWE content with postfiltered synthesis Q0*/ Word16 mem_hp_interp_fx[INTERP_3_1_MEM_LEN]; /* HF (6-7 kHz) BWE - interp. memory */ - +#ifdef FIX_774_ENERGY_BURST + Word16 memExp1; /* Exponent for mem_hf_fx scaling*/ +#endif } ZERO_BWE_DEC_DATA, *ZERO_BWE_DEC_HANDLE;