Commit 815be7be authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'synth_bug_fixes_msan_fix' into 'main'

Synth scaling changes, msan fix for decoder and bug fix in fd_cng_enc [allow regression]

See merge request !1296
parents 503045da 59bcdc58
Loading
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -295,10 +295,9 @@ IF( NE_16( Opt_AMR_WB, 1 ) )
    /* calculate the spectrum of random excitation signal */
    Copy( exc2, fft_io, L_frame );

    Word16 Q_new_inp, mem_decim_size; // TO be removed
    IF( EQ_16( L_frame, L_FRAME16k ) )
    {
        modify_Fs_fx( fft_io, L_FRAME16k, 16000, fft_io, 12800, exc_mem1, 0, &Q_new_inp, &mem_decim_size );
        modify_Fs_fx( fft_io, L_FRAME16k, 16000, fft_io, 12800, exc_mem1, 0 );
    }

    /* fft_rel(fft_io, L_FFT, LOG2_L_FFT); */
@@ -411,7 +410,7 @@ IF( NE_16( Opt_AMR_WB, 1 ) )

    IF( EQ_16( L_frame, L_FRAME16k ) )
    {
        modify_Fs_fx( fft_io, L_FFT, 12800, fft_io, 16000, exc_mem, 0, &Q_new_inp, &mem_decim_size );
        modify_Fs_fx( fft_io, L_FFT, 12800, fft_io, 16000, exc_mem, 0 );
    }

    /* enr1 = dotp( fft_io, fft_io, L_frame ) / L_frame; */
+8 −26
Original line number Diff line number Diff line
@@ -330,9 +330,7 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
                     Word16 sigOut_fx[],      /* o  : decimated signal    Q0  */
                     const Word32 fout,       /* i  : frequency of output Q0  */
                     Word16 mem_fx[],         /* i/o: filter memory       Q0  */
                     const Word16 nblp,       /* i  : flag indicating if NB low-pass is applied */
                     Word16 *Q_new_inp,       // TO be removed
                     Word16 *mem_decim_size   // TO be removed
                     const Word16 nblp        /* i  : flag indicating if NB low-pass is applied */
)
{
    Word16 i;
@@ -364,17 +362,13 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
    /*-------------------------------------------------------------------*
     * Find the resampling configuration
     *-------------------------------------------------------------------*/
    *Q_new_inp = 0;
    move16();

    /* check if fin and fout are the same */
    IF( EQ_32( fin, fout ) )
    {
        /* just copy the signal_fx and quit */
        Copy( sigIn_fx, sigOut_fx, lg );
        *mem_decim_size = 0;
        *Q_new_inp = 0;
        move16();
        move16();

        return lg;
    }
    ELSE
@@ -439,8 +433,6 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
        }

        mem_len = shl( filt_len, 1 );
        *mem_decim_size = mem_len;
        move16();
        signal_fx = signal_tab_fx + 2 * L_FILT_MAX + sub( L_FRAME48k, add( mem_len, lg ) );
        signal_ana_fx = signal_fx;
        mem_len_ana = mem_len;
@@ -508,7 +500,7 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
    }
    /* interpolation */

    datastep = shr( div_s( shl( fac_den, 7 ), shl( fac_num, 10 ) ), 12 );
    datastep = shr( div_s( shl( fac_den, 8 ), shl( fac_num, 11 ) ), 12 );
    /* equivalent to 'datastep = fac_den % fac_num' */
    temp_n = i_mult2( datastep, fac_num ); /*Q0*/
    fracstep = sub( fac_den, temp_n );
@@ -550,9 +542,6 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
                FOR( i = 0; i < lg_out; i++ )
                {
                    sigOut_fx[i] = round_fx( L_shl( L_mult( sigOut_fx[i], num_den ), 1 ) ); /*Q0*/
                    *Q_new_inp = -1;
                    move16();
                    move16();
                }
            }
            ELSE
@@ -562,16 +551,17 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
                test();
                if ( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) )
                {
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
                    num_den = shl_o( num_den, 1, &Overflow );
                    //*Q_new_inp = 2;
#else
                    num_den = shl( num_den, 1 );
#endif
                }
                FOR( i = 0; i < lg_out; i++ )
                {
                    sigOut_fx[i] = mult_r( sigOut_fx[i], num_den ); /*Q0*/
                    move16();
                }
                *Q_new_inp = -1;
                move16();
            }
        }
        ELSE
@@ -579,13 +569,10 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
            IF( EQ_16( fac_num, 8 ) )
            {
                num_den = 26214;
                move16();
                FOR( i = 0; i < lg_out; i++ )
                {
                    sigOut_fx[i] = mult_r( sigOut_fx[i], num_den ); /*Q-1*/
                    move16();
                    *Q_new_inp = -2;
                    move16();
                }
            }
            ELSE
@@ -594,9 +581,6 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
                FOR( i = 0; i < lg_out; i++ )
                {
                    sigOut_fx[i] = round_fx( L_mac( L_deposit_h( sigOut_fx[i] ), sigOut_fx[i], num_den ) ); /*Q0*/
                    *Q_new_inp = -1;
                    move16();
                    move16();
                }
            }
        }
@@ -607,8 +591,6 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
        {
            sigOut_fx[i] = mult_r( sigOut_fx[i], 16384 );
            move16(); /*Q-1*/
            *Q_new_inp = -2;
            move16();
        }
    }
    /* update the filter memory */
+3 −5
Original line number Diff line number Diff line
@@ -2592,14 +2592,12 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q
// modif_fs_fx.c
Word16 modify_Fs_fx(                          /* o  : length of output    Q0  */
                     const Word16 sigIn_fx[], /* i  : signal to decimate  Q0  */
                     Word16 lg,               /* i  : length of input     Q0  */
                     const Word32 fin,        /* i  : frequency of input  Q0  */
                     Word16 lg,               /* i  : length of i       Q0  */
                     const Word32 fin,        /* i  : frequency of i    Q0  */
                     Word16 sigOut_fx[],      /* o  : decimated signal    Q0  */
                     const Word32 fout,       /* i  : frequency of output Q0  */
                     Word16 mem_fx[],         /* i/o: filter memory       Q0  */
                     const Word16 nblp,       /* i  : flag indicating if NB low-pass is applied */
                     Word16 *Q_new_inp,       // TO be removed
                     Word16 *mem_decim_size   // TO be removed
                     const Word16 nblp        /* i  : flag indicating if NB low-pass is applied */
);
Word16 modify_Fs_intcub3m_sup_fx(                       /* o  : length of output    */
+2 −3
Original line number Diff line number Diff line
@@ -262,8 +262,7 @@ void amr_wb_enc_fx(
    /*----------------------------------------------------------------*
     * Change the sampling frequency to 12.8 kHz
     *----------------------------------------------------------------*/
    Word16 Q_new_inp, mem_decim_size; // TO be removed
    modify_Fs_fx( st->input_fx, input_frame, st->input_Fs, new_inp, 12800, st->mem_decim_fx, 0, &Q_new_inp, &mem_decim_size );
    modify_Fs_fx( st->input_fx, input_frame, st->input_Fs, new_inp, 12800, st->mem_decim_fx, 0 );

    /* update signal buffer */
    Copy( new_inp, st->buf_speech_enc + L_FRAME, L_FRAME ); /* Q0 */
@@ -450,7 +449,7 @@ void amr_wb_enc_fx(
    }
    ELSE IF( EQ_32( st->input_Fs, 32000 ) || EQ_32( st->input_Fs, 48000 ) )
    {
        modify_Fs_fx( st->input_fx, input_frame, st->input_Fs, new_inp_16k, 16000, st->mem_decim16k_fx, 0, &Q_new_inp, &mem_decim_size );
        modify_Fs_fx( st->input_fx, input_frame, st->input_Fs, new_inp_16k, 16000, st->mem_decim16k_fx, 0 );
    }

    /*----------------------------------------------------------------*
+2 −4
Original line number Diff line number Diff line
@@ -761,8 +761,7 @@ void CNG_enc_fx(

    IF( EQ_16( st_fx->L_frame, L_FRAME16k ) )
    {
        Word16 Q_new_inp, mem_decim_size; // TO be removed
        modify_Fs_fx( fft_io, L_FRAME16k, 16000, fft_io, 12800, hTdCngEnc->exc_mem2_fx, 0, &Q_new_inp, &mem_decim_size );
        modify_Fs_fx( fft_io, L_FRAME16k, 16000, fft_io, 12800, hTdCngEnc->exc_mem2_fx, 0 );
    }

    fft_rel_fx( fft_io, L_FFT, LOG2_L_FFT );
@@ -1936,8 +1935,7 @@ void CNG_enc_ivas_fx(

    IF( EQ_16( st_fx->L_frame, L_FRAME16k ) )
    {
        Word16 Q_new_inp, mem_decim_size; // TO be removed
        modify_Fs_fx( fft_io, L_FRAME16k, 16000, fft_io, 12800, hTdCngEnc->exc_mem2_fx, 0, &Q_new_inp, &mem_decim_size );
        modify_Fs_fx( fft_io, L_FRAME16k, 16000, fft_io, 12800, hTdCngEnc->exc_mem2_fx, 0 );
    }

    fft_rel_fx( fft_io, L_FFT, LOG2_L_FFT );
Loading