Commit 5f2c97e6 authored by Mohammadreza Naghibzadeh's avatar Mohammadreza Naghibzadeh
Browse files

Merge remote-tracking branch 'origin/main' into basop-2517-click-in-omasa-ltv-2nd-masa-channel

# Conflicts:
#	lib_com/options.h
parents b248cdd8 26ae1a66
Loading
Loading
Loading
Loading
Loading
+58 −9
Original line number Diff line number Diff line
@@ -51,8 +51,6 @@
 * Local constants
 *-----------------------------------------------------------------*/

#define Mpy_32_xx Mpy_32_16_1

#define FFTC( x ) WORD322WORD16( (Word32) x )

/* DCT related */
@@ -83,17 +81,19 @@
#define FFT_C165 ( FFTC( 0x30fbc54d ) ) /* FL2WORD32( 3.826834323650898e-1)  COS_3PI_DIV8 Q15*/
#define FFT_C166 ( FFTC( 0xcf043ab3 ) ) /* FL2WORD32(-3.826834323650898e-1) -COS_3PI_DIV8 Q15*/

#define SCALEFACTOR16 ( 0 )
#define SCALEFACTOR20 ( 0 )

/*-----------------------------------------------------------------*
 * Local function prototypes
 *-----------------------------------------------------------------*/

static void cdftForw( Word16 n, Word32 *a, const Word16 *ip, const Word16 *w );
#ifndef HARMONIZE_DoRTFTn
static void bitrv2_SR( Word16 n, const Word16 *ip, Word32 *a );
#endif
static void cftfsub( Word16 n, Word32 *a, const Word16 *w );
static void cft1st( Word16 n, Word32 *a, const Word16 *w );
static void cftmdl( Word16 n, Word16 l, Word32 *a, const Word16 *w );

static void fft16_ivas( Word32 *x, Word32 *y, const Word16 *Idx );
static void fft5_shift1( Word16 n1, Word32 *zRe, Word32 *zIm, const Word16 *Idx );
static void fft8( Word32 *x, Word32 *y, const Word16 *Idx );
@@ -1548,7 +1548,11 @@ static void fft5_4(
 * a low complexity 2-dimensional DFT of 80 points
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
static void DoRTFT80_fx(
#else
void DoRTFT80_fx(
#endif
    Word32 *x, /* i/o: real part of input and output data Qx      */
    Word32 *y  /* i/o: imaginary part of input and output data Qx */
)
@@ -1575,7 +1579,11 @@ void DoRTFT80_fx(
 * a low complexity 2-dimensional DFT of 120 points
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
static void DoRTFT120_fx(
#else
void DoRTFT120_fx(
#endif
    Word32 *x, /* i/o: real part of input and output data Qx      */
    Word32 *y  /* i/o: imaginary part of input and output data Qx */
)
@@ -1602,7 +1610,11 @@ void DoRTFT120_fx(
 * a low complexity 2-dimensional DFT of 160 points
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
static void DoRTFT160_fx(
#else
void DoRTFT160_fx(
#endif
    Word32 x[], /* i/o: real part of input and output data Qx      */
    Word32 y[]  /* i/o: imaginary part of input and output data Qx */
)
@@ -1629,7 +1641,11 @@ void DoRTFT160_fx(
 * a low complexity 2-dimensional DFT of 320 points
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
static void DoRTFT320_fx(
#else
void DoRTFT320_fx(
#endif
    Word32 *x, /* i/o: real part of input and output data Qx      */
    Word32 *y  /* i/o: imaginary part of input and output data Qx */
)
@@ -1656,7 +1672,11 @@ void DoRTFT320_fx(
 * a low complexity 2-dimensional DFT of 480 points
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
static void DoRTFT480_fx(
#else
void DoRTFT480_fx(
#endif
    Word32 *x, /* i/o: real part of input and output data Qx      */
    Word32 *y  /* i/o: imaginary part of input and output data Qx */
)
@@ -1683,7 +1703,11 @@ void DoRTFT480_fx(
 * a low complexity 2-dimensional DFT of 40 points
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
static void DoRTFT40_fx(
#else
void DoRTFT40_fx(
#endif
    Word32 *x, /* i/o: real part of input and output data Qx      */
    Word32 *y  /* i/o: imaginary part of input and output data Qx */
)
@@ -1709,7 +1733,11 @@ void DoRTFT40_fx(
 * a low complexity 2-dimensional DFT of 20 points
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
static void DoRTFT20_fx(
#else
void DoRTFT20_fx(
#endif
    Word32 *x, /* i/o: real part of input and output data Qx      */
    Word32 *y  /* i/o: imaginary part of input and output data Qx */
)
@@ -1736,12 +1764,15 @@ void DoRTFT20_fx(
 * FFT with 128 points
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
static void DoRTFT128_fx(
#else
void DoRTFT128_fx(
#endif
    Word32 *x, /* i/o: real part of input and output data Qx      */
    Word32 *y  /* i/o: imaginary part of input and output data Qx */
)
{

    Word16 i;
    Word32 z[256];

@@ -1770,9 +1801,10 @@ void DoRTFT128_fx(
    return;
}


/*-----------------------------------------------------------------*
 * cdftForw()
 * Main fuction of Complex Discrete Fourier Transform
 * Main function of Complex Discrete Fourier Transform
 *-----------------------------------------------------------------*/

static void cdftForw(
@@ -1783,12 +1815,20 @@ static void cdftForw(
)
{
    /* bit reversal */
#ifdef HARMONIZE_DoRTFTn
    bitrv2_SR_fx( n, ip + 2, a );
#else
    bitrv2_SR( n, ip + 2, a );
#endif

    /* Do FFT */
    cftfsub( n, a, w );

    return;
}


#ifndef HARMONIZE_DoRTFTn
/*-----------------------------------------------------------------*
 * bitrv2_SR()
 * Bit reversal
@@ -1990,6 +2030,7 @@ static void bitrv2_SR(

    return;
}
#endif

/*-----------------------------------------------------------------*
 * cftfsub()
@@ -2433,7 +2474,7 @@ static void cftmdl(
    return;
}


#ifndef HARMONIZE_DoRTFTn
void DoRTFTn_fx_ivas(
    Word32 *x,     /* i/o: real part of input and output data Qx      */
    Word32 *y,     /* i/o: imaginary part of input and output data Qx */
@@ -2489,7 +2530,7 @@ void DoRTFTn_fx_ivas(

    return;
}

#endif

static void rfft_post(
    const Word16 *sine_table, // Q15
@@ -3475,7 +3516,11 @@ void DoFFT_fx(
            DoRTFT320_fx( re2, im2 );
            BREAK;
        case 256:
#ifdef HARMONIZE_DoRTFTn
            DoRTFTn_fx( re2, im2, NULL, 256 );
#else
            DoRTFTn_fx_ivas( re2, im2, 256 );
#endif
            BREAK;
        case 240:
            DoRTFT240( re2, im2 );
@@ -3499,7 +3544,11 @@ void DoFFT_fx(
            DoRTFT80_fx( re2, im2 );
            BREAK;
        case 64:
#ifdef HARMONIZE_DoRTFTn
            DoRTFTn_fx( re2, im2, NULL, 64 );
#else
            DoRTFTn_fx_ivas( re2, im2, 64 );
#endif
            BREAK;
        case 40:
            DoRTFT40_fx( re2, im2 );
+36 −2
Original line number Diff line number Diff line
@@ -37,7 +37,9 @@ static void fft5_32_16fx( Word16 *zRe, Word16 *zIm, const Word16 *Idx );
static void cdftForw_16fx( Word16 n, Word16 *a, const Word16 *ip, const Word32 *w );

static void cdftForw_fx( Word16 n, Word32 *a, const Word16 *ip, const Word16 *w );
#ifndef HARMONIZE_DoRTFTn
static void bitrv2_SR_fx( Word16 n, const Word16 *ip, Word32 *a );
#endif
static void cftfsub_fx( Word16 n, Word32 *a, const Word16 *w );
static void cft1st_fx( Word16 n, Word32 *a, const Word16 *w );
static void cftmdl_fx( Word16 n, Word16 l, Word32 *a, const Word16 *w );
@@ -84,27 +86,51 @@ void DoRTFTn_fx(

    IF( EQ_16( n, 16 ) )
    {
#ifdef HARMONIZE_DoRTFTn
        cdftForw_fx( 2 * n, z, Ip_fft16, w_fft512_fx );
#else
        cdftForw_fx( 2 * n, z, Ip_fft16, w_fft512_fx_evs );
#endif
    }
    ELSE IF( EQ_16( n, 32 ) )
    {
#ifdef HARMONIZE_DoRTFTn
        cdftForw_fx( 2 * n, z, Ip_fft32, w_fft512_fx );
#else
        cdftForw_fx( 2 * n, z, Ip_fft32, w_fft512_fx_evs );
#endif
    }
    ELSE IF( EQ_16( n, 64 ) )
    {
#ifdef HARMONIZE_DoRTFTn
        cdftForw_fx( 2 * n, z, Ip_fft64, w_fft512_fx );
#else
        cdftForw_fx( 2 * n, z, Ip_fft64, w_fft512_fx_evs );
#endif
    }
    ELSE IF( EQ_16( n, 128 ) )
    {
#ifdef HARMONIZE_DoRTFTn
        cdftForw_fx( 2 * n, z, Ip_fft128, w_fft512_fx );
#else
        cdftForw_fx( 2 * n, z, Ip_fft128, w_fft512_fx_evs );
#endif
    }
    ELSE IF( EQ_16( n, 256 ) )
    {
#ifdef HARMONIZE_DoRTFTn
        cdftForw_fx( 2 * n, z, Ip_fft256, w_fft512_fx );
#else
        cdftForw_fx( 2 * n, z, Ip_fft256, w_fft512_fx_evs );
#endif
    }
    ELSE IF( EQ_16( n, 512 ) )
    {
#ifdef HARMONIZE_DoRTFTn
        cdftForw_fx( 2 * n, z, Ip_fft512, w_fft512_fx );
#else
        cdftForw_fx( 2 * n, z, Ip_fft512, w_fft512_fx_evs );
#endif
    }
    ELSE
    {
@@ -147,8 +173,9 @@ void DoRTFTn_fx(

/*-----------------------------------------------------------------*
 * cdftForw_fx()
 * Main fuction of Complex Discrete Fourier Transform
 * Main function of Complex Discrete Fourier Transform, 32-bit data
 *-----------------------------------------------------------------*/

static void cdftForw_fx(
    Word16 n,         /* i    : data length of real and imag              */
    Word32 *a,        /* i/o  : input/output data                     Q(q)*/
@@ -169,7 +196,12 @@ static void cdftForw_fx(
 * bitrv2_SR_fx()
 * Bit reversal
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
void bitrv2_SR_fx(
#else
static void bitrv2_SR_fx(
#endif
    Word16 n,         /* i    : data length of real and imag              */
    const Word16 *ip, /* i/o  : work area for bit reversal                */
    Word32 *a         /* i/o  : input/output data                     Q(q)*/
@@ -1502,9 +1534,11 @@ void DoRTFT128_16fx(

    return;
}


/*-----------------------------------------------------------------*
 * cdftForw()
 * Main fuction of Complex Discrete Fourier Transform
 * Main function of Complex Discrete Fourier Transform, 16-bit data
 *-----------------------------------------------------------------*/
static void cdftForw_16fx(
    Word16 n,         /* i    : data length of real and imag              */
+26 −3
Original line number Diff line number Diff line
@@ -52,9 +52,17 @@
#define IVAS_MDCT_SCALING_GAIN_16k_Q31 0X00003193 /* 5.909703592235439e-06f */
#define IVAS_MDCT_SCALING_GAIN_16k_Q46 0x18C97EF4


#define IVAS_ONE_BY_IMDCT_SCALING_GAIN_Q16 0x08432A51 /* 1 / 2115.165304808f */

#ifdef HARMONIZE_DoRTFTn

/*------------------------------------------------------------------------------------------*
 * Local functions prototypes
 *------------------------------------------------------------------------------------------*/

static void ivas_get_twid_factors_fx( const Word16 length, const Word16 **pTwid_re, const Word16 **pTwid_im );

#endif

/*-----------------------------------------------------------------------------------------*
 * Function ivas_tda_fx()
@@ -154,7 +162,11 @@ void ivas_mdct_fx(
    len_by_2 = shr( length, 1 );
    ivas_mdct_scaling_gain = ivas_get_mdct_scaling_gain_fx( len_by_2 ); // Q46

#ifdef HARMONIZE_DoRTFTn
    ivas_get_twid_factors_fx( length, &pTwid_re, &pTwid_im );
#else
    ivas_get_twid_factors_fx1( length, &pTwid_re, &pTwid_im );
#endif

    FOR( i = 0; i < len_by_2; i++ )
    {
@@ -299,8 +311,11 @@ void ivas_imdct_fx(
    Word32 im[IVAS_480_PT_LEN];
    len_by_2 = shr( length, 1 );

#ifdef HARMONIZE_DoRTFTn
    ivas_get_twid_factors_fx( length, &pTwid_re, &pTwid_im );
#else
    ivas_get_twid_factors_fx1( length, &pTwid_re, &pTwid_im );

#endif
    FOR( i = 0; i < len_by_2; i++ )
    {
        re[i] = L_add( Mpy_32_16_1( pIn[length - 2 * i - 1], pTwid_re[i] ), Mpy_32_16_1( pIn[2 * i], pTwid_im[i] ) ); /*stl_arr_index  Q24*/
@@ -310,6 +325,7 @@ void ivas_imdct_fx(
    }

    ivas_ifft_cplx( &re[0], &im[0], len_by_2 );

    IF( len_by_2 > 0 )
    {
        *q_out = sub( *q_out, Q15 );
@@ -351,11 +367,16 @@ void ivas_imdct_fx(


/*-----------------------------------------------------------------------------------------*
 * Function ivas_get_twid_factors_fx1()
 * Function ivas_get_twid_factors_fx()
 *
 * Sets/Maps the fft twiddle tables based on fft length
 *-----------------------------------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
static void ivas_get_twid_factors_fx(
#else
void ivas_get_twid_factors_fx1(
#endif
    const Word16 length,      // Q0
    const Word16 **pTwid_re,  // Q15
    const Word16 **pTwid_im ) // Q15
@@ -375,11 +396,13 @@ void ivas_get_twid_factors_fx1(
        *pTwid_re = (const Word16 *) &ivas_cos_twiddle_160_fx[0]; // Q15
        *pTwid_im = (const Word16 *) &ivas_sin_twiddle_160_fx[0]; // Q15
    }
#ifndef HARMONIZE_DoRTFTn
    ELSE IF( EQ_16( length, 80 ) )
    {
        *pTwid_re = (const Word16 *) &ivas_cos_twiddle_80_fx[0]; // Q15
        *pTwid_im = (const Word16 *) &ivas_sin_twiddle_80_fx[0]; // Q15
    }
#endif
    ELSE
    {
        assert( !"Not supported FFT length!" );
+4 −0
Original line number Diff line number Diff line
@@ -216,12 +216,14 @@ void ivas_dct_windowing_fx(
    Word32 *pTemp_lfe 
);

#ifndef HARMONIZE_DoRTFTn
void ivas_get_twid_factors_fx1(
    const Word16 length,     // Q0
    const Word16 **pTwid_re, // Q15
    const Word16 **pTwid_im 
);

#endif
Word32 ivas_get_mdct_scaling_gain_fx(
    const Word16 dct_len_by_2 
);
@@ -1622,6 +1624,7 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot_fx(
    const Word16 nchan_in                                                           /* i  : number of input channels                              */
);

#ifndef HARMONIZE_2499_CONFIGUREFDCNGDEC
void configureFdCngDec_ivas_fx(
    HANDLE_FD_CNG_DEC hFdCngDec,                                /* i/o: Contains the variables related to the FD-based CNG process */
    const Word16 bwidth,
@@ -1630,6 +1633,7 @@ void configureFdCngDec_ivas_fx(
    const Word16 last_L_frame,
    const Word16 element_mode 
);
#endif

void synchonize_channels_mdct_sid_fx(
    Decoder_State *sts[CPE_CHANNELS],                           /* i/o: decoder state structure                 */
+2 −0
Original line number Diff line number Diff line
@@ -502,8 +502,10 @@ extern const Word16 ivas_sin_twiddle_320_fx[IVAS_320_PT_LEN >> 1];
extern const Word16 ivas_cos_twiddle_320_fx[IVAS_320_PT_LEN >> 1];
extern const Word16 ivas_sin_twiddle_160_fx[IVAS_160_PT_LEN >> 1];
extern const Word16 ivas_cos_twiddle_160_fx[IVAS_160_PT_LEN >> 1];
#ifndef HARMONIZE_DoRTFTn
extern const Word16 ivas_sin_twiddle_80_fx[IVAS_80_PT_LEN >> 1];
extern const Word16 ivas_cos_twiddle_80_fx[IVAS_80_PT_LEN >> 1];
#endif
extern const Word16 nf_tw_smoothing_coeffs_fx[N_LTP_GAIN_MEMS];
extern const Word32 dft_res_gains_q_fx[][2];
extern const Word16 dft_res_cod_alpha_fx[STEREO_DFT_BAND_MAX];
Loading