Commit e6bc3d63 authored by vaclav's avatar vaclav
Browse files

fix + OPTIMIZE_FFT_STACK

parent c8646f38
Loading
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -193,7 +193,7 @@ static Word16 const *get_edct_table(
/*-------------------------------------------------------------------------*
 * FUNCTION : edct_fx()
 *
 * PURPOSE : DCT transform
 * PURPOSE : DCT transform, 32-bit version
 *
 * INPUT ARGUMENTS :
 * _ (Word16) length             : length
@@ -463,9 +463,9 @@ void edst_fx(


/*========================================================================*/
/* FUNCTION : edct_fx()                                                   */
/* FUNCTION : edct_16fx()                                                 */
/*------------------------------------------------------------------------*/
/* PURPOSE : DCT transform                                                */
/* PURPOSE : DCT transform, 32-bit version                                */
/*------------------------------------------------------------------------*/
/* INPUT ARGUMENTS :                                                      */
/* _ (Word16) length             : length                                 */
@@ -477,7 +477,6 @@ void edst_fx(
/* OUTPUT ARGUMENTS :                                                     */
/* _ (Word16[]) y : output transform      Qx                              */
/*------------------------------------------------------------------------*/

/*------------------------------------------------------------------------*/
/* RETURN ARGUMENTS :                                                     */
/* _ None                                                                 */
+2 −2
Original line number Diff line number Diff line
@@ -353,13 +353,13 @@ void scale_sig32_cmplx(
        move32();
        if ( 0 == exp0 )
        {
            i = lg;
            break;
        }
        x[i].im = L_shl( x[i].im, exp0 );
        move32();
        if ( 0 == exp0 )
        {
            i = lg;
            break;
        }
    }

+55 −0
Original line number Diff line number Diff line
@@ -1117,6 +1117,55 @@ void enc_prm_igf_mdct(
    return;
}

#ifdef OPTIMIZE_FFT_STACK
/*-------------------------------------------------------------------*
 * compute_power_spec()
 *
 *
 *-------------------------------------------------------------------*/

static void compute_power_spec(
    TCX_ENC_HANDLE hTcxEnc,
    Word32 *mdst_spectrum_fx[NB_DIV],
    Word32 powerSpec_fx[N_MAX],
    Word16 *q_pow,
    const Word16 n,
    const Word16 L_subframeTCX )
{
    Word16 i;
    Word64 powerSpec_fx64[N_MAX];

    IF( hTcxEnc->fUseTns[n] )
    {
        FOR( i = 0; i < L_subframeTCX; i++ )
        {
            powerSpec_fx64[i] = W_mult_32_32( hTcxEnc->spectrum_fx[n][i], hTcxEnc->spectrum_fx[n][i] );
            move64();
        }
        *q_pow = W_norm_arr( powerSpec_fx64, L_subframeTCX );
    }
    ELSE
    {
        FOR( i = 0; i < L_subframeTCX; i++ )
        {
            powerSpec_fx64[i] = W_mac_32_32( W_mult_32_32( mdst_spectrum_fx[n][i], mdst_spectrum_fx[n][i] ), hTcxEnc->spectrum_fx[n][i], hTcxEnc->spectrum_fx[n][i] );
            move64();
        }
        *q_pow = W_norm_arr( powerSpec_fx64, L_subframeTCX );
    }

    FOR( i = 0; i < L_subframeTCX; i++ )
    {
        powerSpec_fx64[i] = W_shl( powerSpec_fx64[i], *q_pow );
        move64();
        powerSpec_fx[i] = W_extract_h( powerSpec_fx64[i] );
        move32();
    }

    return;
}
#endif

/*-------------------------------------------------------------------*
 * ivas_mdct_core_whitening_enc()
 *
@@ -1152,7 +1201,9 @@ void ivas_mdct_core_whitening_enc_fx(
    Word32 temp_buffer[15 * L_FRAME48k / 8];
    Word32 *windowedSignal_fx[CPE_CHANNELS];
    Word32 *powerSpec_fx = orig_spectrum_long[0];
#ifndef OPTIMIZE_FFT_STACK
    Word64 powerSpec_fx64[N_MAX];
#endif
    Word16 nrg_fx; /* Q15 */
    Encoder_State *st, **sts;
    Word32 scf_fx[CPE_CHANNELS][NB_DIV][M];
@@ -1920,6 +1971,9 @@ void ivas_mdct_core_whitening_enc_fx(
        move16();
        FOR( n = 0; n < nSubframes; n++ )
        {
#ifdef OPTIMIZE_FFT_STACK
            compute_power_spec( st->hTcxEnc, mdst_spectrum_fx[ch], powerSpec_fx, &q_pow, n, L_subframeTCX );
#else
            IF( st->hTcxEnc->fUseTns[n] )
            {
                FOR( i = 0; i < L_subframeTCX; i++ )
@@ -1946,6 +2000,7 @@ void ivas_mdct_core_whitening_enc_fx(
                powerSpec_fx[i] = W_extract_h( powerSpec_fx64[i] );
                move32();
            }
#endif
            IF( mct_on )
            {
                FOR( i = 0; i < L_subframeTCX; i++ )