From a8778a8df5dea675311d83fa73cda41c34b5488f Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 4 Apr 2025 10:25:57 +0530 Subject: [PATCH] Fix for 3GPP issue 1381: High MLD around 15, audible differences (0 to 1s) at MC 160 kbps, 48 khz Link #1381 --- lib_enc/ivas_core_enc_fx.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib_enc/ivas_core_enc_fx.c b/lib_enc/ivas_core_enc_fx.c index 1e7a13d45..081e12814 100644 --- a/lib_enc/ivas_core_enc_fx.c +++ b/lib_enc/ivas_core_enc_fx.c @@ -445,12 +445,20 @@ ivas_error ivas_core_enc_fx( move16(); } - Scale_sig( st->input_fx, input_frame, negate( st->q_inp ) ); // Q0 - Scale_sig( st->old_input_signal_fx, input_frame, negate( st->q_old_inp ) ); // Q0 - st->q_old_inp = 0; - move16(); - st->q_inp = 0; - move16(); + test(); + test(); + test(); + test(); + test(); + IF( ( st->q_old_inp < 0 && st->q_inp < 0 && norm_arr( st->input_fx, input_frame ) && norm_arr( st->old_input_signal_fx, input_frame ) ) || ( st->q_old_inp > 0 && st->q_inp > 0 ) ) + { + scale_sig( st->input_fx, input_frame, negate( st->q_inp ) ); // Q0 + scale_sig( st->old_input_signal_fx, input_frame, negate( st->q_old_inp ) ); // Q0 + st->q_old_inp = 0; + move16(); + st->q_inp = 0; + move16(); + } } Word16 Q_spec_old[2], L_spec; Q_spec_old[0] = hCPE->hCoreCoder[0]->hTcxEnc->spectrum_long_e; -- GitLab