diff --git a/lib_com/options.h b/lib_com/options.h index 1d158b6cd10a599b49b2d63fa34d88da4164249c..6b9976ba55d749567f58c68420ddd9ce5ab176a7 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -179,7 +179,7 @@ #define FIX_869_WRONG_UVGAIN_STEP /* VA: Fix wrong decoding of uv gain quantizer for td-stereo*/ - +#define FIX_871_REMOVE_UNNECESSARY_CONDITION /* VA: remove a condition that is not needed and prevented correct frame classification of the secondary channel of the TD stereo */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 971c05ca2e0054b9e401f9829c6e91f00bd11a1d..d1c79d2f9ee1ce570728c6e3d970eeb51c371569 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -7609,10 +7609,12 @@ void FEC_clas_estim_fx( Word16 *lt_diff_etot, /* i/o: long-term total energy variation */ /*A*/ Word16 *amr_io_class, - /* i/o: classification for AMR-WB IO mode */ /*A*/ +/* i/o: classification for AMR-WB IO mode */ /*A*/ +#ifndef FIX_871_REMOVE_UNNECESSARY_CONDITION const Word32 bitrate, - /* i : Decoded bitrate */ /*A*/ - Word16 Q_syn, /* i : Synthesis scaling */ +/* i : Decoded bitrate */ /*A*/ +#endif + Word16 Q_syn, /* i : Synthesis scaling */ Word16 *class_para, /* o : classification para. fmerit1 */ /*A*/ Word16 *mem_syn_clas_estim, /* i/o: memory of the synthesis signal for frame class estimation */ diff --git a/lib_dec/FEC_clas_estim_fx.c b/lib_dec/FEC_clas_estim_fx.c index 61b21cc11c5916866533a925748fda988d8734bd..974041a9c1667b6bc12a6c61422b3c72bc0435cb 100644 --- a/lib_dec/FEC_clas_estim_fx.c +++ b/lib_dec/FEC_clas_estim_fx.c @@ -71,10 +71,12 @@ void FEC_clas_estim_fx( Word16 *lt_diff_etot, /* i/o: long-term total energy variation */ /*A*/ Word16 *amr_io_class, - /* i/o: classification for AMR-WB IO mode */ /*A*/ +/* i/o: classification for AMR-WB IO mode */ /*A*/ +#ifndef FIX_871_REMOVE_UNNECESSARY_CONDITION const Word32 bitrate, - /* i : Decoded bitrate */ /*A*/ - Word16 Q_syn, /* i : Synthesis scaling */ +/* i : Decoded bitrate */ /*A*/ +#endif + Word16 Q_syn, /* i : Synthesis scaling */ Word16 *class_para, /* o : classification para. fmerit1 */ /*A*/ Word16 *mem_syn_clas_estim, /* i/o: memory of the synthesis signal for frame class estimation */ @@ -471,9 +473,13 @@ void FEC_clas_estim_fx( /*------------------------------------------------------------------------* * frame classification *------------------------------------------------------------------------*/ +#ifndef FIX_871_REMOVE_UNNECESSARY_CONDITION test(); test(); IF( ( NE_16( coder_type, VOICED ) && LT_32( bitrate, ACELP_11k60 ) ) || Opt_AMR_WB ) +#else + IF( NE_16( coder_type, VOICED ) ) +#endif { Word16 result = UNVOICED_CLAS; move16(); diff --git a/lib_dec/acelp_core_dec_fx.c b/lib_dec/acelp_core_dec_fx.c index 024e8f1e2d30c2322c6b71a4166e58b8c3fbec97..e99d8b028886eca4d82bfa94d83dd33c9308d7a2 100644 --- a/lib_dec/acelp_core_dec_fx.c +++ b/lib_dec/acelp_core_dec_fx.c @@ -1126,12 +1126,19 @@ ivas_error acelp_core_dec_fx( * FEC - Estimate the classification information *------------------------------------------------------------*/ +#ifndef FIX_871_REMOVE_UNNECESSARY_CONDITION FEC_clas_estim_fx( st_fx, st_fx->Opt_AMR_WB, st_fx->L_frame, &st_fx->clas_dec, st_fx->coder_type, pitch_buf_fx, syn_fx, &st_fx->lp_ener_FER_fx, &st_fx->decision_hyst, NULL, NULL, NULL, NULL, 0, NULL, st_fx->core_brate, st_fx->Q_syn, temp_buf_fx, st_fx->mem_syn_clas_estim_fx, &st_fx->classifier_Q_mem_syn, 0, 0, 0, st_fx->last_core_brate, st_fx->acelp_cfg.FEC_mode ); - +#else + FEC_clas_estim_fx( st_fx, st_fx->Opt_AMR_WB, st_fx->L_frame, &st_fx->clas_dec, st_fx->coder_type, pitch_buf_fx, + syn_fx, &st_fx->lp_ener_FER_fx, &st_fx->decision_hyst, + NULL, NULL, NULL, NULL, 0, NULL, st_fx->Q_syn, temp_buf_fx, + st_fx->mem_syn_clas_estim_fx, &st_fx->classifier_Q_mem_syn, + 0, 0, 0, st_fx->last_core_brate, st_fx->acelp_cfg.FEC_mode ); +#endif /*------------------------------------------------------------* * FEC - Estimate pitch *------------------------------------------------------------*/ diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index 7ba65505a9ab9c6ca9cfb109b3603aef6edaefd9..1db6d1dd19372195e0254ac875f204581d6ce954 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -1227,11 +1227,19 @@ ivas_error acelp_core_dec_ivas_fx( * FEC - Estimate the classification information *------------------------------------------------------------*/ +#ifndef FIX_871_REMOVE_UNNECESSARY_CONDITION FEC_clas_estim_fx( st, st->Opt_AMR_WB, st->L_frame, &st->clas_dec, st->coder_type, pitch_buf_fx, psyn_fx, &st->lp_ener_FER_fx, &st->decision_hyst, NULL, NULL, NULL, NULL, 0, NULL, st->core_brate, st->Q_syn, temp_buf_fx, st->mem_syn_clas_estim_fx, &st->classifier_Q_mem_syn, 0, 0, 0, st->last_core_brate, st->acelp_cfg.FEC_mode ); +#else + FEC_clas_estim_fx( st, st->Opt_AMR_WB, st->L_frame, &st->clas_dec, st->coder_type, pitch_buf_fx, + psyn_fx, &st->lp_ener_FER_fx, &st->decision_hyst, + NULL, NULL, NULL, NULL, 0, NULL, st->Q_syn, temp_buf_fx, + st->mem_syn_clas_estim_fx, &st->classifier_Q_mem_syn, + 0, 0, 0, st->last_core_brate, st->acelp_cfg.FEC_mode ); +#endif /*------------------------------------------------------------* * FEC - Estimate pitch *------------------------------------------------------------*/ diff --git a/lib_dec/amr_wb_dec_fx.c b/lib_dec/amr_wb_dec_fx.c index 8894a571d79fc66cdb4b52b6c955c6f88587c577..f2acdde1aa2fa8058a2e4ca5779134cbe78a44b6 100644 --- a/lib_dec/amr_wb_dec_fx.c +++ b/lib_dec/amr_wb_dec_fx.c @@ -546,12 +546,19 @@ ivas_error amr_wb_dec_fx( * FEC - Estimate the classification information *------------------------------------------------------------*/ +#ifndef FIX_871_REMOVE_UNNECESSARY_CONDITION FEC_clas_estim_fx( st_fx, 1, L_FRAME, &st_fx->clas_dec, st_fx->coder_type, pitch_buf_fx, syn_fx, &st_fx->lp_ener_FER_fx, &st_fx->decision_hyst, &st_fx->hAmrwb_IO->UV_cnt_fx, &st_fx->hAmrwb_IO->LT_UV_cnt_fx, &st_fx->hAmrwb_IO->Last_ener_fx, &locattack, st_fx->hAmrwb_IO->lt_diff_etot_fx, &amr_io_class, st_fx->core_brate, st_fx->Q_syn, &class_para_fx, st_fx->mem_syn_clas_estim_fx, &st_fx->classifier_Q_mem_syn, 0, 0, 0, st_fx->last_core_brate, -1 ); - +#else + FEC_clas_estim_fx( st_fx, 1, L_FRAME, &st_fx->clas_dec, st_fx->coder_type, pitch_buf_fx, + syn_fx, &st_fx->lp_ener_FER_fx, + &st_fx->decision_hyst, &st_fx->hAmrwb_IO->UV_cnt_fx, &st_fx->hAmrwb_IO->LT_UV_cnt_fx, &st_fx->hAmrwb_IO->Last_ener_fx, &locattack, st_fx->hAmrwb_IO->lt_diff_etot_fx, + &amr_io_class, st_fx->Q_syn, &class_para_fx, st_fx->mem_syn_clas_estim_fx, &st_fx->classifier_Q_mem_syn, + 0, 0, 0, st_fx->last_core_brate, -1 ); +#endif /* update past excitation signals for LD music post-filter */ Copy( hMusicPF->dct_post_old_exc_fx + L_FRAME, hMusicPF->dct_post_old_exc_fx, DCT_L_POST - L_FRAME - OFFSET2 ); Copy( exc2_fx, hMusicPF->dct_post_old_exc_fx + ( DCT_L_POST - L_FRAME - OFFSET2 ), L_FRAME ); diff --git a/lib_dec/dec_LPD_fx.c b/lib_dec/dec_LPD_fx.c index 8e50850c41b2d5079d89b684cebee551d325d7bc..7a8abdd83c685d422a2199f29723ac1d671408bb 100644 --- a/lib_dec/dec_LPD_fx.c +++ b/lib_dec/dec_LPD_fx.c @@ -821,6 +821,7 @@ void decoder_LPD_fx( } +#ifndef FIX_871_REMOVE_UNNECESSARY_CONDITION FEC_clas_estim_fx( st, /*Opt_AMR_WB*/ 0, /*A*/ @@ -847,6 +848,33 @@ void decoder_LPD_fx( bfi, /* i : bad frame indicator */ st->last_core_brate, /* i : bitrate of previous frame */ -1 ); +#else + FEC_clas_estim_fx( + st, + /*Opt_AMR_WB*/ 0, /*A*/ + st->L_frame, + &( st->clas_dec ), + core_ext_mode, + pitch_C, + synth, + &st->lp_ener_FER_fx, + /**decision_hyst*/ NULL, /* i/o: hysteresis of the music/speech decision */ + /**UV_cnt*/ NULL, /* i/o: number of consecutive frames classified as */ + /**LT_UV_cnt*/ NULL, /* i/o: long term consecutive frames classified as UV */ + /**Last_ener*/ NULL, /* i/o: last_energy frame */ + /**locattack*/ NULL, /* i/o: detection of attack (mainly to localized speech burst) */ + /**lt_diff_etot*/ NULL, /* i/o: long-term total energy variation */ + /**amr_io_class*/ NULL, /* i/o: classification for AMR-WB IO mode */ + 0, /* i : Synthesis scaling */ + /**class_para*/ NULL, /* o : classification para. fmerit1 */ + st->mem_syn_clas_estim_fx, /* i/o: memory of the synthesis signal for frame class estimation */ + &st->classifier_Q_mem_syn, /* i/o: exponent for memory of synthesis signal for frame class estimation */ + LTP_Gain, /* i : means LTP Gain */ + 1 /*CLASSIFIER_TCX*/, /* i : signal classifier mode */ + bfi, /* i : bad frame indicator */ + st->last_core_brate, /* i : bitrate of previous frame */ + -1 ); +#endif } } diff --git a/lib_dec/dec_ace_fx.c b/lib_dec/dec_ace_fx.c index a42578389e8495e4fb8c1d17ec0e2cfd6f610049..1ba8222ead8d88ae9c8d078afbb9ef9ef8d5b8c8 100644 --- a/lib_dec/dec_ace_fx.c +++ b/lib_dec/dec_ace_fx.c @@ -627,10 +627,17 @@ void decoder_acelp_fx( move16(); } +#ifndef FIX_871_REMOVE_UNNECESSARY_CONDITION FEC_clas_estim_fx( st, /*Opt_AMR_WB*/ 0, st->L_frame, &( st->clas_dec ), st->core_ext_mode, pit16, syn, &st->lp_ener_FER_fx, /**decision_hyst*/ NULL, /**UV_cnt*/ NULL, /**LT_UV_cnt*/ NULL, /**Last_ener*/ NULL, /**locattack*/ NULL, /**lt_diff_etot*/ NULL, /**amr_io_class*/ NULL, /*bitrate*/ 0, st->Q_syn, /**class_para*/ NULL, st->mem_syn_clas_estim_fx, &st->classifier_Q_mem_syn, -32768 /*-1.f Q15*/, 0 /*CLASSIFIER_ACELP*/, 0 /*bfi*/, st->last_core_brate, -1 ); +#else + FEC_clas_estim_fx( st, /*Opt_AMR_WB*/ 0, st->L_frame, &( st->clas_dec ), st->core_ext_mode, pit16, syn, + &st->lp_ener_FER_fx, /**decision_hyst*/ NULL, /**UV_cnt*/ NULL, /**LT_UV_cnt*/ NULL, /**Last_ener*/ NULL, /**locattack*/ NULL, + /**lt_diff_etot*/ NULL, /**amr_io_class*/ NULL, st->Q_syn, /**class_para*/ NULL, st->mem_syn_clas_estim_fx, + &st->classifier_Q_mem_syn, -32768 /*-1.f Q15*/, 0 /*CLASSIFIER_ACELP*/, 0 /*bfi*/, st->last_core_brate, -1 ); +#endif } /* Update Pitch Lag memory */ diff --git a/lib_dec/er_dec_acelp_fx.c b/lib_dec/er_dec_acelp_fx.c index e0174c71eb5771036dc499068be26492f43073a8..defb1970a186ce0d5449a89edbbfb15862f861c2 100644 --- a/lib_dec/er_dec_acelp_fx.c +++ b/lib_dec/er_dec_acelp_fx.c @@ -1015,6 +1015,7 @@ void con_acelp_fx( move16(); } +#ifndef FIX_871_REMOVE_UNNECESSARY_CONDITION FEC_clas_estim_fx( st, /*Opt_AMR_WB*/ 0, /*A*/ @@ -1041,6 +1042,33 @@ void con_acelp_fx( 1 /*bfi*/, /* i : bad frame indicator */ st->last_core_brate, /* i : bitrate of previous frame */ -1 ); +#else + FEC_clas_estim_fx( + st, + /*Opt_AMR_WB*/ 0, /*A*/ + st->L_frame, + &( st->clas_dec ), + coder_type, + pit16, + syn, + &st->lp_ener_FER_fx, + /**decision_hyst*/ NULL, /* i/o: hysteresis of the music/speech decision */ + /**UV_cnt*/ NULL, /* i/o: number of consecutives frames classified as UV */ + /**LT_UV_cnt*/ NULL, /* i/o: long term consecutives frames classified as UV */ + /**Last_ener*/ NULL, /* i/o: last_energy frame */ + /**locattack*/ NULL, /* i/o: detection of attack (mainly to localized speech burst) */ + /**lt_diff_etot*/ NULL, /* i/o: long-term total energy variation */ + /**amr_io_class*/ NULL, /* i/o: classification for AMR-WB IO mode */ + Qf_syn, /* i : Synthesis scaling */ + /**class_para*/ NULL, /* o : classification para. fmerit1 */ + st->mem_syn_clas_estim_fx, /* i/o: memory of the synthesis signal for frame class estimation */ + &st->classifier_Q_mem_syn, /*i/o : exponent for memory of synthesis signal for frame class estimation */ + -32768 /*-1.f Q15*/, /* i : LTP Gain */ + 0 /*CLASSIFIER_ACELP*/, /* i : signal classifier mode */ + 1 /*bfi*/, /* i : bad frame indicator */ + st->last_core_brate, /* i : bitrate of previous frame */ + -1 ); +#endif } /* Update Pitch Lag memory */ diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index c5ccdfba2d3784725d28b64b9b32a3cabe7e4fa6..d0bed2c21df63a0c56ad97251c782a76158b6852 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -770,11 +770,19 @@ void stereo_tcx_core_dec_fx( move16(); IF( st->tcxonly ) { +#ifndef FIX_871_REMOVE_UNNECESSARY_CONDITION FEC_clas_estim_fx( st, 0, st->L_frame, &st->clas_dec, GENERIC, pitch_C, synth_fx, &st->lp_ener_FER_fx, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 /*st->core_brate*/, 0, NULL, st->mem_syn_clas_estim_fx, &st->classifier_Q_mem_syn, hTcxLtpDec->tcxltp ? hTcxDec->tcxltp_last_gain_unmodified : MIN_16, CLASSIFIER_TCX, bfi, st->last_core_brate, -1 ); +#else + FEC_clas_estim_fx( st, 0, st->L_frame, &st->clas_dec, GENERIC, pitch_C, synth_fx, &st->lp_ener_FER_fx, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, st->mem_syn_clas_estim_fx, &st->classifier_Q_mem_syn, hTcxLtpDec->tcxltp ? hTcxDec->tcxltp_last_gain_unmodified : MIN_16, CLASSIFIER_TCX, bfi, st->last_core_brate, -1 ); +#endif } ELSE { +#ifndef FIX_871_REMOVE_UNNECESSARY_CONDITION FEC_clas_estim_fx( st, 0, st->L_frame, &st->clas_dec, st->core_ext_mode, pitch_C, synth_fx, &st->lp_ener_FER_fx, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 /*st->core_brate*/, 0, NULL, st->mem_syn_clas_estim_fx, &st->classifier_Q_mem_syn, hTcxLtpDec->tcxltp ? hTcxDec->tcxltp_last_gain_unmodified : MIN_16, CLASSIFIER_TCX, bfi, st->last_core_brate, -1 ); +#else + FEC_clas_estim_fx( st, 0, st->L_frame, &st->clas_dec, st->core_ext_mode, pitch_C, synth_fx, &st->lp_ener_FER_fx, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, st->mem_syn_clas_estim_fx, &st->classifier_Q_mem_syn, hTcxLtpDec->tcxltp ? hTcxDec->tcxltp_last_gain_unmodified : MIN_16, CLASSIFIER_TCX, bfi, st->last_core_brate, -1 ); +#endif } st->codec_mode = prev_codec_mode; move16(); diff --git a/lib_dec/updt_dec_fx.c b/lib_dec/updt_dec_fx.c index 107aea626782a972a4c8f2cb44074979f32685e5..a4ec5e127164bd81514b65d6e744174316c2c58b 100644 --- a/lib_dec/updt_dec_fx.c +++ b/lib_dec/updt_dec_fx.c @@ -1351,6 +1351,7 @@ void update_decoder_LPD_cng( set16_fx( pitch, shl( L_SUBFR, 6 ), NB_SUBFR16k ); +#ifndef FIX_871_REMOVE_UNNECESSARY_CONDITION FEC_clas_estim_fx( st, /*Opt_AMR_WB*/ 0, /*A*/ @@ -1377,7 +1378,33 @@ void update_decoder_LPD_cng( 0 /*bfi*/, /* i : bad frame indicator */ st->last_core_brate, /* i : bitrate of previous frame */ -1 ); - +#else + FEC_clas_estim_fx( + st, + /*Opt_AMR_WB*/ 0, /*A*/ + st->L_frame, + &( st->clas_dec ), + coder_type, + pitch, + synth, + &st->lp_ener_FER_fx, + /**decision_hyst*/ NULL, /* i/o: hysteresis of the music/speech decision */ + /**UV_cnt*/ NULL, /* i/o: number of consecutives frames classified as UV */ + /**LT_UV_cnt*/ NULL, /* i/o: long term consecutives frames classified as UV */ + /**Last_ener*/ NULL, /* i/o: last_energy frame */ + /**locattack*/ NULL, /* i/o: detection of attack (mainly to localized speech burst) */ + /**lt_diff_etot*/ NULL, /* i/o: long-term total energy variation */ + /**amr_io_class*/ NULL, /* i/o: classification for AMR-WB IO mode */ + st->Q_syn, /* i : Synthesis scaling */ + /**class_para*/ NULL, /* o : classification para. fmerit1 */ + st->mem_syn_clas_estim_fx, /* i/o: memory of the synthesis signal for frame class estimation */ + &st->classifier_Q_mem_syn, /*i/o : exponent for memory of synthesis signal for frame class estimation */ + -32768 /*-1.f Q15*/, /* i : LTP Gain */ + 0 /*CLASSIFIER_ACELP*/, /* i : signal classifier mode */ + 0 /*bfi*/, /* i : bad frame indicator */ + st->last_core_brate, /* i : bitrate of previous frame */ + -1 ); +#endif /* Postfiltering */ set16_fx( pf_pitch, L_SUBFR, NB_SUBFR16k ); set16_fx( pf_gain, 0, NB_SUBFR16k );