Commit c5b32330 authored by vaillancour's avatar vaillancour
Browse files

Merge branch '1766-spike-caused-by-basop-encoder-in-omasa-ltv-input' into 'main'

possible fix for #1766, mld goes from 23.75 to 11.72 on the mono output [allow-regression][Non-BE]

Closes #1766

See merge request !1933
parents 0ad0bbc7 74015f9f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -119,4 +119,6 @@

/* #################### End BASOP porting switches ############################ */

#define FIX_1766_TCX2ACELP_BWE_ISSUE    /* VA : Fix rare BWE issue when switching from TCX to ACELP */

#endif
+33 −1
Original line number Diff line number Diff line
@@ -9,6 +9,29 @@
#include "rom_com.h"     /* Static table prototypes                */
#include "prot_fx_enc.h" /* Function prototypes                    */


#ifdef FIX_1766_TCX2ACELP_BWE_ISSUE
static void rem_offset( const Word16 *in, Word16 *out, Word16 l_subfr )
{
    Word16 i;
    Word16 tmp;
    Word32 loffset = 0;
    move32();

    tmp = shl( 2, norm_s( l_subfr ) ); /* l_subfr is expected to be based 2 */
    FOR( i = 0; i < l_subfr; i++ )
    {
        loffset = L_mac( loffset, in[i], tmp );
    }
    tmp = round_fx_sat( loffset );
    FOR( i = 0; i < l_subfr; i++ )
    {
        out[i] = sub( in[i], tmp );
        move16();
    }
}
#endif

/*======================================================================*/
/* FUNCTION : encod_gen_voic_fx()										*/
/*----------------------------------------------------------------------*/
@@ -565,7 +588,16 @@ void encod_gen_voic_ivas_fx(
        Scale_sig( h1_fx, L_SUBFR, sub( 14, q_h1 ) );             /* set h1[] in Q14 with scaling for convolution Q14*/
        /* scaling of xn[] to limit dynamic at 12 bits */
        Scale_sig( xn_fx, L_SUBFR, shift );

#ifdef FIX_1766_TCX2ACELP_BWE_ISSUE
        test();
        test();
        IF( Es_pred_fx < 0 && LE_16( i_subfr_fx, L_SUBFR ) && NE_16( st_fx->last_core, ACELP_CORE ) )
        {
            /* During core transition, when the temporal correlation is non existent  */
            rem_offset( xn_fx, xn_fx, L_SUBFR );
            rem_offset( cn_fx, cn_fx, L_SUBFR );
        }
#endif
        *pt_pitch_fx = pit_encode_ivas_fx( hBstr, st_fx->acelp_cfg.pitch_bits, st_fx->core_brate, 0, L_frame, st_fx->coder_type, &pitch_limit_flag, i_subfr_fx, exc_fx,
                                           L_SUBFR, st_fx->pitch, &T0_min_fx, &T0_max_fx, &T0_fx, &T0_frac_fx, h1_fx, xn_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, Q_new ); /* Q6 */
        move16();