Commit 35f48da8 authored by vaclav's avatar vaclav
Browse files

- Merge remote-tracking branch 'remotes/origin/main' into...

- Merge remote-tracking branch 'remotes/origin/main' into 2423-harmonization-of-core-coder-functions-word16-vs-word32-inputs-2
parents ea24b53a d2a25bc0
Loading
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -306,7 +306,11 @@ IF( NE_16( Opt_AMR_WB, 1 ) )

    IF( EQ_16( L_frame, L_FRAME16k ) )
    {
#ifndef FIX_2410_HARM_MODIF_FS
        modify_Fs_fx( fft_io, L_FRAME16k, 16000, fft_io, 12800, exc_mem1, 0 );
#else
        modify_Fs_fx( fft_io, L_FRAME16k, 16000, fft_io, 12800, exc_mem1, 0, NULL, NULL );
#endif
    }

    /* fft_rel(fft_io, L_FFT, LOG2_L_FFT); */
@@ -419,7 +423,11 @@ IF( NE_16( Opt_AMR_WB, 1 ) )

    IF( EQ_16( L_frame, L_FRAME16k ) )
    {
#ifndef FIX_2410_HARM_MODIF_FS
        modify_Fs_fx( fft_io, L_FFT, 12800, fft_io, 16000, exc_mem, 0 );
#else
        modify_Fs_fx( fft_io, L_FFT, 12800, fft_io, 16000, exc_mem, 0, NULL, NULL );
#endif
    }

    /* enr1 = dotp( fft_io, fft_io, L_frame ) / L_frame; */
+72 −28
Original line number Diff line number Diff line
@@ -42,7 +42,12 @@
/* CALLED FROM : TX/RX                              */
/*==============================================================================*/

#ifndef FIX_2410_HARM_MODIF_FS
Word16 modify_Fs_ivas_fx( /* o  : length of output    Q0  */
#else
/* o  : length of output    Q0  */
Word16 modify_Fs_fx(
#endif
                          const Word16 sigIn_fx[], /* i  : signal to decimate  Q0  */
                          Word16 lg,               /* i  : length of input     Q0  */
                          const Word32 fin,        /* i  : frequency of input  Q0  */
@@ -55,7 +60,6 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q
)
{
    Word16 i;

    Word16 lg_out, fac_num, fac_den, filt_len, frac, temp_n, mem_len;
    Word16 num_den;
    Word16 datastep, fracstep;
@@ -79,17 +83,28 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q
    /*-------------------------------------------------------------------*
     * Find the resampling configuration
     *-------------------------------------------------------------------*/

#ifdef FIX_2410_HARM_MODIF_FS
    if ( Q_new_inp != NULL )
#endif
    {
        *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 );
#ifdef FIX_2410_HARM_MODIF_FS
        if ( Q_new_inp != NULL )
#endif
        {
            *mem_decim_size = 0;
            *Q_new_inp = 0;
            move16();
            move16();
        }
        return lg;
    }
    ELSE
@@ -123,6 +138,7 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q
        /*-------------------------------------------------------------------*
         * Retrieve and/or calculate the resampling parameters
         *-------------------------------------------------------------------*/

        fac_num = cfg_ptr_fx->fac_num_fx;
        move16(); /*Q0*/
        fac_den = cfg_ptr_fx->fac_den_fx;
@@ -146,18 +162,23 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q
        }

        mem_len = shl( filt_len, 1 );
#ifdef FIX_2410_HARM_MODIF_FS
        if ( mem_decim_size != NULL )
#endif
        {
            *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;
        move16();
    }


    /*-------------------------------------------------------------------*
     * Resample
     *-------------------------------------------------------------------*/

    /* append filter memory */
    Copy( mem_fx, signal_fx, mem_len );

@@ -210,6 +231,7 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q
        move16();
        deemph_fx( signal_fx + mem_len + lg - LEN_WIN_SSS, mu_preemph_fx, LEN_WIN_SSS + plus_sample_in, &mem_preemph_fx );
    }

    /* interpolation */

    datastep = shr( div_s( shl( fac_den, 7 ), shl( fac_num, 10 ) ), 12 );
@@ -225,8 +247,12 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q
    {
        filt_len_tmp = shr( add( filt_len, 1 ), 1 );
    }

    Word16 norm_cfg_ptr = norm_s( sub( cfg_ptr_fx->filter_fx[0], 1 ) );
#ifdef FIX_2410_HARM_MODIF_FS
    if ( Q_new_inp != NULL )
#endif
    {
        *Q_new_inp = negate( norm_s( sub( cfg_ptr_fx->filter_fx[0], 1 ) ) );
    }
    FOR( i = 0; i < lg_out; i++ )
    {
        sigOut_fx[i] = round_fx_sat( Interpol_lc_fx( sigIn_ptr, cfg_ptr_fx->filter_fx, frac, fac_num, filt_len_tmp ) );
@@ -240,7 +266,7 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q
        }
        sigIn_ptr += add( lshr( j, 15 ), datastep );
    }
    *Q_new_inp = negate( norm_cfg_ptr );

    move16();
    /* rescaling */
    test();
@@ -259,9 +285,14 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q
                    sigOut_fx[i] = round_fx( L_shl( L_mult( sigOut_fx[i], num_den ), 1 ) ); /*Q0*/
                    move16();
                }
#ifdef FIX_2410_HARM_MODIF_FS
                if ( Q_new_inp != NULL )
#endif
                {
                    *Q_new_inp = add( *Q_new_inp, 1 );
                    move16();
                }
            }
            ELSE
            {
                test();
@@ -270,9 +301,14 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q
                IF( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) )
                {
                    num_den = shl_sat( num_den, 1 );
#ifdef FIX_2410_HARM_MODIF_FS
                    if ( Q_new_inp != NULL )
#endif
                    {
                        *Q_new_inp = add( *Q_new_inp, 1 );
                        move16();
                    }
                }
                FOR( i = 0; i < lg_out; i++ )
                {
                    sigOut_fx[i] = mult_r( sigOut_fx[i], num_den ); /*Q0*/
@@ -300,11 +336,16 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q
                    sigOut_fx[i] = round_fx( L_mac( L_deposit_h( sigOut_fx[i] ), sigOut_fx[i], num_den ) ); /*Q0*/
                    move16();
                }
#ifdef FIX_2410_HARM_MODIF_FS
                if ( Q_new_inp != NULL )
#endif
                {
                    *Q_new_inp = add( *Q_new_inp, 1 );
                    move16();
                }
            }
        }
    }
    ELSE IF( ( LT_16( fac_num, fac_den ) ) && ( ( cfg_ptr_fx->flags_fx & RS_INV_FAC ) != 0 ) )
    {
        FOR( i = 0; i < lg_out; i++ )
@@ -319,7 +360,7 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q

    return lg_out;
}

#ifndef FIX_2410_HARM_MODIF_FS
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  */
@@ -585,6 +626,8 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */

    return lg_out;
}
#endif


/*-------------------------------------------------------------------*
 * modify_Fs_intcub3m_sup()
@@ -592,7 +635,8 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
 *
 *-------------------------------------------------------------------*/

Word16 modify_Fs_intcub3m_sup_fx(                       /* o  : length of output    */
/* o  : length of output    */
Word16 modify_Fs_intcub3m_sup_fx(
    const Word16 sigIn[], /* i  : signal to decimate with memory of 2 samples (indexes -2 & -1) */
    const Word16 lg,      /* i  : length of input (suppose that lg is such that lg_out is integer, ex multiple of 5 in case of 16kHz to 12.8 kHz) */
    const Word32 fin,     /* i  : frequency of input  */
+2 −0
Original line number Diff line number Diff line
@@ -94,6 +94,8 @@
#define FIX_2404_HARM_SIGNAL_CLAS                       /* VA: basop-2404, harmonize signal_clas and signa_ivas_clas */
#define HARMONIZE_ACELP_ENC                             /* VA: basop issue 2400: Remove duplicated main ACELP encoder function */
#define FIX_2392_MSAN_DESTROY_DEC                       /* VA: basop issue 2392: fix MSAN in ivas_destroy_dec_fx() */
#define FIX_FLOAT_1522_LTV_MSAN_QMETADATA_ENC_EC3       /* Nokia: float issue 1522: fix uninit MSAN in EC3 of qmetadata encoding */
#define FIX_2410_HARM_MODIF_FS                          /* VA: basop issue 2410: Remove duplicated modif_Fs */
#define HARM_LEV_DURBIN                                 /* VA: basop issue 2423: harmonize levinson-Durbin algorithm */

/* #################### End BE switches ################################## */
+18 −13
Original line number Diff line number Diff line
@@ -2462,7 +2462,11 @@ Word32 Interpol_lc_fx(
);
/* o  : length of output    Q0  */
Word16 modify_Fs_ivas_fx(
#ifndef FIX_2410_HARM_MODIF_FS
Word16 modify_Fs_ivas_fx( /* o  : length of output    Q0  */
#else
Word16 modify_Fs_fx(     /* o  : length of output    Q0  */
#endif
                          const Word16 sigIn_fx[], /* i  : signal to decimate  Q0  */
                          Word16 lg,               /* i  : length of input     Q0  */
                          const Word32 fin,        /* i  : frequency of input  Q0  */
@@ -2474,6 +2478,7 @@ Word16 modify_Fs_ivas_fx(
                          Word16 *mem_decim_size   /*i: size modified for mem_fx*/
);
#ifndef FIX_2410_HARM_MODIF_FS
/* o  : length of output    Q0  */
Word16 modify_Fs_fx(
    const Word16 sigIn_fx[], /* i  : signal to decimate  Q0  */
@@ -2484,7 +2489,7 @@ Word16 modify_Fs_fx(
    Word16 mem_fx[],         /* i/o: filter memory       Q0  */
    const Word16 nblp        /* i  : flag indicating if NB low-pass is applied */
);
#endif
/* o  : length of output    */
Word16 modify_Fs_intcub3m_sup_fx(
    const Word16 sigIn[], /* i  : signal to decimate with memory of 2 samples (indexes -2 & -1) */
+8 −0
Original line number Diff line number Diff line
@@ -1001,10 +1001,18 @@ void ivas_lfe_tdplc_fx(
    Copy_Scale_sig_32_16( rec_frame_fx, rec_frame_16_fx, LFE_PLC_RECLEN, -Q5 );             // Q0

    Word16 Q_new_inp, mem_decim_size, size_modified;
#ifndef FIX_2410_HARM_MODIF_FS
    size_modified = modify_Fs_ivas_fx( prevsynth_16_fx + LFE_PLC_BUFLEN - LFE_PLC_FDEL / LFE_PLC_DSF, LFE_PLC_FDEL / LFE_PLC_DSF, LFE_PLC_FS, rec_frame_us_16_fx, 48000, mem_fx, 0, &Q_new_inp, &mem_decim_size );
#else
    size_modified = modify_Fs_fx( prevsynth_16_fx + LFE_PLC_BUFLEN - LFE_PLC_FDEL / LFE_PLC_DSF, LFE_PLC_FDEL / LFE_PLC_DSF, LFE_PLC_FS, rec_frame_us_16_fx, 48000, mem_fx, 0, &Q_new_inp, &mem_decim_size );
#endif
    Scale_sig( rec_frame_us_16_fx, size_modified, negate( Q_new_inp ) ); /* scaling back to Q0 */

#ifndef FIX_2410_HARM_MODIF_FS
    size_modified = modify_Fs_ivas_fx( rec_frame_16_fx, LFE_PLC_RECLEN, LFE_PLC_FS, rec_frame_us_16_fx, 48000, mem_fx, 0, &Q_new_inp, &mem_decim_size );
#else
    size_modified = modify_Fs_fx( rec_frame_16_fx, LFE_PLC_RECLEN, LFE_PLC_FS, rec_frame_us_16_fx, 48000, mem_fx, 0, &Q_new_inp, &mem_decim_size );
#endif
    Scale_sig( rec_frame_us_16_fx, size_modified, negate( Q_new_inp ) ); /* scaling back to Q0 */

    /*samples are generated with 48k sampling rate
Loading