diff --git a/lib_com/options.h b/lib_com/options.h index 10396a5c34071df32d355449d6e62d8717e547a8..9cc74f220b8c41aa41ce5b1b4ac91f4e282361df 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -108,6 +108,7 @@ #define FIX_2283_ISM_MD_DELAY /* Dolby: Fix ISM metadata delay round-off */ #define FIX_2283_Q_CLDFB /* FhG: Fix Q format issue in CLDFB */ #define FIX_2283_ACCU_CLDFB /* FhG: Fix to consider Q-format differences in accumulateCLDFBArrayToBuffer_fx() */ +#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_fx.h b/lib_com/prot_fx.h index a4a32366e6dc07bb41847717659e3d5eb48f0c2b..0ba1a3200e16c3891ed58f07ff29126ee8f30d08 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -6171,7 +6171,10 @@ void scale_st_fx( void blend_subfr2_fx( Word16 *sigIn1, /* i : i signal for fade-out */ Word16 *sigIn2, /* i : i signal for fade-in */ - Word16 *sigOut /* o : output signal */ +#ifdef FIX_FLOAT_1533_BLEND_SUBFR2 + Word16 L_subfr, /* i : subframe length */ +#endif + Word16 *sigOut /* o : output signal */ ); void init_tcx_window_cfg_fx( diff --git a/lib_dec/acelp_core_dec_fx.c b/lib_dec/acelp_core_dec_fx.c index 7b06d4b0d64a521878f81473c42df863e9c031f4..eefc304e31cfd7a654bfe751b51100cb885abddd 100644 --- a/lib_dec/acelp_core_dec_fx.c +++ b/lib_dec/acelp_core_dec_fx.c @@ -1529,7 +1529,11 @@ ivas_error acelp_core_dec_fx( E_UTIL_synthesis( 1, Aq_fx, temp_buf_fx + M + L_SUBFR, temp_buf_fx, L_SUBFR, st->hPFstat->mem_stp + L_SYN_MEM - M, 0, M ); scale_st_fx( psyn_fx, temp_buf_fx, &st->hPFstat->gain_prec, L_SUBFR ); Copy( temp_buf_fx, psyn_fx, ( L_SUBFR >> 1 ) ); +#ifdef FIX_FLOAT_1533_BLEND_SUBFR2 + blend_subfr2_fx( temp_buf_fx + L_SUBFR / 2, psyn_fx + L_SUBFR / 2, L_SUBFR, psyn_fx + L_SUBFR / 2 ); +#else blend_subfr2_fx( temp_buf_fx + L_SUBFR / 2, psyn_fx + L_SUBFR / 2, psyn_fx + L_SUBFR / 2 ); +#endif } st->hPFstat->on = 0; move16(); diff --git a/lib_dec/acelp_core_switch_dec_fx.c b/lib_dec/acelp_core_switch_dec_fx.c index dd477874f1de42f56209d021d5f2a4edca6a9cde..d4ccf00f9110d78a2b2de1dba819fd261974d4c2 100644 --- a/lib_dec/acelp_core_switch_dec_fx.c +++ b/lib_dec/acelp_core_switch_dec_fx.c @@ -177,7 +177,11 @@ ivas_error acelp_core_switch_dec_fx( E_UTIL_synthesis( 1, Aq, exc, bpf_error_signal, L_SUBFR, st_fx->hPFstat->mem_stp + L_SYN_MEM - M, 0, M ); scale_st_fx( synth_intFreq, bpf_error_signal, &st_fx->hPFstat->gain_prec, L_SUBFR ); Copy( bpf_error_signal, synth_intFreq, L_SUBFR / 2 ); +#ifdef FIX_FLOAT_1533_BLEND_SUBFR2 + blend_subfr2_fx( bpf_error_signal + L_SUBFR / 2, synth_intFreq + L_SUBFR / 2, L_SUBFR, synth_intFreq + L_SUBFR / 2 ); +#else blend_subfr2_fx( bpf_error_signal + L_SUBFR / 2, synth_intFreq + L_SUBFR / 2, synth_intFreq + L_SUBFR / 2 ); +#endif } st_fx->hPFstat->on = 0; move16(); diff --git a/lib_dec/dec_post_fx.c b/lib_dec/dec_post_fx.c index 1a568cbf9a109fabc600841fc3ed3afab2f9aad7..442e0caf070b9015759f51d6f300120618ffba00 100644 --- a/lib_dec/dec_post_fx.c +++ b/lib_dec/dec_post_fx.c @@ -1513,18 +1513,41 @@ void scale_st_fx( void blend_subfr2_fx( Word16 *sigIn1, // Qx Word16 *sigIn2, // Qx - Word16 *sigOut // Qx +#ifdef FIX_FLOAT_1533_BLEND_SUBFR2 + Word16 L_subfr, // Q0 +#endif + Word16 *sigOut // Qx ) { Word16 fac1 = 32768 - 512; // 1.Q15 - ( 1.Q15 / L_SUBFR ); Word16 fac2 = 0 + 512; // 0.Q15 + ( 1.Q15 / L_SUBFR ); Word16 step = 1024; // 1.Q15 / ( L_SUBFR / 2 ); - Word16 i; + Word16 i, L_subfr_half; move16(); move16(); move16(); +#ifdef FIX_FLOAT_1533_BLEND_SUBFR2 + assert( ( L_subfr == L_SUBFR ) || ( L_subfr == 2 * L_SUBFR ) ); + + IF( EQ_16( L_subfr, 2 * L_SUBFR ) ) + { + fac1 = 32768 - 256; // 1.Q15 - ( 1.Q15 / L_SUBFR ); + fac2 = 0 + 256; // 0.Q15 + ( 1.Q15 / L_SUBFR ); + step = 512; // 1.Q15 / ( L_SUBFR / 2 ); + move16(); + move16(); + move16(); + } +#endif + +#ifdef FIX_FLOAT_1533_BLEND_SUBFR2 + L_subfr_half = shr( L_subfr, 1 ); + + FOR( i = 0; i < L_subfr_half; i++ ) +#else FOR( i = 0; i < L_SUBFR / 2; i++ ) +#endif { sigOut[i] = mac_r_sat( L_mult_sat( fac1, sigIn1[i] ), fac2, sigIn2[i] ); // Qx fac1 = sub_sat( fac1, step ); diff --git a/lib_dec/post_dec_fx.c b/lib_dec/post_dec_fx.c index 8bf9380b3fbe89ad809c452874a919b35cb61be8..6f00fd72047c3730de341bcbbf410b30e5b0866a 100644 --- a/lib_dec/post_dec_fx.c +++ b/lib_dec/post_dec_fx.c @@ -75,7 +75,11 @@ void post_decoder( Residu3_fx( st->old_Aq_12_8_fx, synth, synth_buf, L_SUBFR, 1 ); E_UTIL_synthesis( 1, st->old_Aq_12_8_fx, synth_buf, synth2, L_SUBFR, st->hPFstat->mem_stp + L_SYN_MEM - M, 0, M ); scale_st_fx( synth, synth2, &st->hPFstat->gain_prec, L_SUBFR ); +#ifdef FIX_FLOAT_1533_BLEND_SUBFR2 + blend_subfr2_fx( synth2 + L_SUBFR / 2, synth + L_SUBFR / 2, L_SUBFR, synth2 + L_SUBFR / 2 ); +#else blend_subfr2_fx( synth2 + L_SUBFR / 2, synth + L_SUBFR / 2, synth2 + L_SUBFR / 2 ); +#endif } } ELSE @@ -238,7 +242,18 @@ void post_decoder_ivas_fx( Residu3_fx( st->old_Aq_12_8_fx, synth, synth_buf, L_subfr, 1 ); E_UTIL_synthesis( 1, st->old_Aq_12_8_fx, synth_buf, synth2, L_subfr, st->hPFstat->mem_stp + L_SYN_MEM - M, 0, M ); scale_st_fx( synth, synth2, &st->hPFstat->gain_prec, L_subfr ); +#ifdef FIX_FLOAT_1533_BLEND_SUBFR2 + IF( EQ_16( st->element_mode, EVS_MONO ) ) + { + blend_subfr2_fx( synth2 + shr( L_subfr, 1 ), synth + shr( L_subfr, 1 ), L_SUBFR, synth2 + shr( L_subfr, 1 ) ); + } + ELSE + { + blend_subfr2_fx( synth2 + shr( L_subfr, 1 ), synth + shr( L_subfr, 1 ), L_subfr, synth2 + shr( L_subfr, 1 ) ); + } +#else blend_subfr2_fx( synth2 + shr( L_subfr, 1 ), synth + shr( L_subfr, 1 ), synth2 + shr( L_subfr, 1 ) ); +#endif } } ELSE