diff --git a/lib_com/calc_st_com.c b/lib_com/calc_st_com.c index 60271a77d57b25755c9ef1fb66ceea0e476b5890..62e0e808047eb5d099dca3b3b51ebf2bb438fb41 100644 --- a/lib_com/calc_st_com.c +++ b/lib_com/calc_st_com.c @@ -292,14 +292,27 @@ void scale_st( void blend_subfr2( float *sigIn1, float *sigIn2, +#ifdef FIX_FLOAT_1533_BLEND_SUBFR2 + int16_t L_subfr, +#endif float *sigOut ) { +#ifdef FIX_FLOAT_1533_BLEND_SUBFR2 + float fac1 = 1.f - ( 1.f / L_subfr ); + float fac2 = 0.f + ( 1.f / L_subfr ); + float step = 1.f / ( L_subfr / 2 ); +#else float fac1 = 1.f - ( 1.f / L_SUBFR ); float fac2 = 0.f + ( 1.f / L_SUBFR ); float step = 1.f / ( L_SUBFR / 2 ); +#endif int16_t i; +#ifdef FIX_FLOAT_1533_BLEND_SUBFR2 + for ( i = 0; i < L_subfr / 2; i++ ) +#else for ( i = 0; i < L_SUBFR / 2; i++ ) +#endif { sigOut[i] = fac1 * sigIn1[i] + fac2 * sigIn2[i]; fac1 -= step; diff --git a/lib_com/options.h b/lib_com/options.h index c0cd3fbb39c3b43142a16560c6a5f78e3881be31..7d7d95965dacd6c9a6f76f795b0a2a1b0f5a7b9d 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -173,6 +173,7 @@ #define FIX_2432_ISM_SPIKES_16KHZ /* VA: basop issue 2432: fix spikes in ISM decoding at 16kHz output sampling rate */ #define FIX_FLOAT_1518 /* FhG: fix issue 1518: loudness differences in OSBA decoding to mono or stereo output */ +#define FIX_FLOAT_1533_BLEND_SUBFR2 /* FhG: float issue 1533: correct blending in blend_subfr2() */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_com/prot.h b/lib_com/prot.h index 55453a263f42930fa70e7c43c8fe59df5161177e..dd3a1c48f4ac6725b0f2ac5c1e87df2985ae93aa 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -10045,7 +10045,10 @@ int16_t tbe_celp_exc_offset( void blend_subfr2( float *sigIn1, /* i : input signal for fade-out */ float *sigIn2, /* i : input signal for fade-in */ - float *sigOut /* o : output signal */ +#ifdef FIX_FLOAT_1533_BLEND_SUBFR2 + int16_t L_subfr, /* i : subframe length */ +#endif + float *sigOut /* o : output signal */ ); void init_tcx_window_cfg( diff --git a/lib_dec/acelp_core_dec.c b/lib_dec/acelp_core_dec.c index bafbba55351854a720cac5ea31a212fa6bc82be1..a952efd5d224a59c0708559b2536686bfae5ccf2 100644 --- a/lib_dec/acelp_core_dec.c +++ b/lib_dec/acelp_core_dec.c @@ -1091,7 +1091,11 @@ ivas_error acelp_core_dec( syn_filt( Aq, M, temp_buf + M + L_SUBFR, temp_buf, L_SUBFR, st->hPFstat->mem_stp + L_SYN_MEM - M, 0 ); scale_st( syn, temp_buf, &st->hPFstat->gain_prec, L_SUBFR, -1 ); mvr2r( temp_buf, syn, L_SUBFR / 2 ); +#ifdef FIX_FLOAT_1533_BLEND_SUBFR2 + blend_subfr2( temp_buf + L_SUBFR / 2, syn + L_SUBFR / 2, L_SUBFR, syn + L_SUBFR / 2 ); +#else blend_subfr2( temp_buf + L_SUBFR / 2, syn + L_SUBFR / 2, syn + L_SUBFR / 2 ); +#endif } st->hPFstat->on = 0; } diff --git a/lib_dec/acelp_core_switch_dec.c b/lib_dec/acelp_core_switch_dec.c index b32df0c6dd3f68df0db629ef07c2bea196dee6dd..d40d7def7cb48e0ea821987399d192c6c2fda098 100644 --- a/lib_dec/acelp_core_switch_dec.c +++ b/lib_dec/acelp_core_switch_dec.c @@ -201,7 +201,11 @@ ivas_error acelp_core_switch_dec( syn_filt( Aq, M, old_exc, bpf_error_signal, L_SUBFR, st->hPFstat->mem_stp + L_SYN_MEM - M, 0 ); scale_st( synth_intFreq, bpf_error_signal, &st->hPFstat->gain_prec, L_SUBFR, -1 ); mvr2r( bpf_error_signal, synth_intFreq, L_SUBFR / 2 ); +#ifdef FIX_FLOAT_1533_BLEND_SUBFR2 + blend_subfr2( bpf_error_signal + L_SUBFR / 2, synth_intFreq + L_SUBFR / 2, L_SUBFR, synth_intFreq + L_SUBFR / 2 ); +#else blend_subfr2( bpf_error_signal + L_SUBFR / 2, synth_intFreq + L_SUBFR / 2, synth_intFreq + L_SUBFR / 2 ); +#endif } st->hPFstat->on = 0; diff --git a/lib_dec/post_dec.c b/lib_dec/post_dec.c index c119770f7b9f232e8e59ff5b8001350dd73f9633..35d8dae700d472164487cf0ed5541a5a05aa5caa 100644 --- a/lib_dec/post_dec.c +++ b/lib_dec/post_dec.c @@ -109,7 +109,18 @@ void post_decoder( residu( A, M, synth, synth_buf, L_subfr ); syn_filt( A, M, synth_buf, synth2, L_subfr, st->hPFstat->mem_stp + L_SYN_MEM - M, 0 ); scale_st( synth, synth2, &st->hPFstat->gain_prec, L_subfr, -1 ); +#ifdef FIX_FLOAT_1533_BLEND_SUBFR2 + if ( st->element_mode == EVS_MONO ) + { + blend_subfr2( synth2 + L_subfr / 2, synth + L_subfr / 2, L_SUBFR, synth2 + L_subfr / 2 ); + } + else + { + blend_subfr2( synth2 + L_subfr / 2, synth + L_subfr / 2, L_subfr, synth2 + L_subfr / 2 ); + } +#else blend_subfr2( synth2 + L_subfr / 2, synth + L_subfr / 2, synth2 + L_subfr / 2 ); +#endif } } else