Commit 8041f52d authored by vaclav's avatar vaclav
Browse files

SIMPLIFY_SCALING_OLD_INP, REMOVE_UNUSED_BUFFER_CORE_ENC,...

SIMPLIFY_SCALING_OLD_INP, REMOVE_UNUSED_BUFFER_CORE_ENC, REMOVE_SCALING_SHB_SPEECH, SCALING_SWB_SPEECH_32
parent 94fd13cb
Loading
Loading
Loading
Loading
+21 −2
Original line number Diff line number Diff line
@@ -1357,11 +1357,15 @@ void stereo_tcx_init_dec_fx(
    const Word16 last_element_mode                              /* i  : element mode of previous frame      */
);

void stereo_icBWE_enc_ivas_fx(
void stereo_icBWE_enc_fx(
    CPE_ENC_HANDLE hCPE,                                        /* i/o: CPE encoder structure                */
    const Word32 shb_speech_ref_fx[],                           /* i  : SHB speech ref channel               */
    const Word16 shb_speech_ref_e,                              /* i  : SHB speech ref channel               */
#ifdef SCALING_SWB_SPEECH_32
    Word16 shb_speech_nonref_fx_16[],                           /* i/o: SHB speech non-ref channel           Q15-shb_speech_nonref_e*/
#else
    Word32 shb_speech_nonref_fx[],                              /* i/o: SHB speech non-ref channel           */
#endif
    Word16 shb_speech_nonref_e,                                 /* i/o: SHB speech non-ref channel           */
    const Word32 *voice_factors_fx                              /* i  : voicing factors                     Q31 */
);
@@ -3083,15 +3087,24 @@ void InternalTCXDecoder_fx(

void stereo_tcx_core_enc(
    Encoder_State *st,                                          /* i/o: encoder state structure                 */
#ifdef SIMPLIFY_SCALING_OLD_INP
    Word16 new_samples_12k8[],                                  /* i  : buffer of input signal @12.8 kHz Q_new-1*/
    Word16 new_samples_16k[],                                   /* i  : buffer of input signal @16 kHz   Q_new-1*/
#else
    const Word16 new_samples_12k8[],                            /* i  : buffer of input signal @12.8 kHz        */
    const Word16 new_samples_16k[],                             /* i  : buffer of input signal @16 kHz          */
#endif
    const Word16 Aw_fx[],                                       /* i  : weighted A(z) unquant. for subframes,Q12*/
    Word16 lsp_new_fx[],                                        /* i  : LSPs at the end of the frame,    Q15    */
    Word16 lsp_mid_fx[],                                        /* i  : LSPs in the middle of the frame, Q15    */
    Word16 pitch_buf_fx[NB_SUBFR16k],                           /* o  : pitch for each subframe, Q6             */
    const Word16 last_element_mode,                             /* i  : last element mode, Q0                   */
    const Word16 vad_hover_flag,                                /* i  : VAD hangover flag, Q0                   */
#ifdef SIMPLIFY_SCALING_OLD_INP
    Word16 Q_new_inp                                            /* i  : Q factor of input buffer                */
#else
    Word16 Q_new 
#endif
);

Word16 transient_analysis_ivas_fx(
@@ -6420,7 +6433,10 @@ UWord16 get_indice_st(

void stereo_mdct_core_enc_fx(
    CPE_ENC_HANDLE hCPE,                                        /* i/o: CPE encoder structure                   */
    Word16 new_samples[CPE_CHANNELS][L_INP],                    /* i  : new samples                           Q0*/
    Word16 new_samples[CPE_CHANNELS][L_INP],                    /* i  : new samples                       Qnew-1*/
#ifdef SIMPLIFY_SCALING_OLD_INP
    Word16 Q_new_inp[CPE_CHANNELS],                             /* i  : Q factor of input buffer                */
#endif
    Word16 old_wsp[CPE_CHANNELS][L_WSP],                        /* i  : 12.8kHz weighted speech (for LTP      Qx*/
    Word16 pitch_buf_fx[CPE_CHANNELS][NB_SUBFR16k]              /* o  : floating pitch for each subframe      Q6*/
);
@@ -6468,6 +6484,9 @@ void stereo_switching_dec(
void ivas_mdct_core_whitening_enc_fx(
    CPE_ENC_HANDLE hCPE,                                        /* i/o: CPE encoder structure                   */
    Word16 new_samples_fx[CPE_CHANNELS][L_INP],                 /* i  : new samples                             */
#ifdef SIMPLIFY_SCALING_OLD_INP
    Word16 Q_new_inp[CPE_CHANNELS],                             /* i  : Q factor of input buffer                */
#endif
    Word16 old_wsp_fx[CPE_CHANNELS][L_WSP],                     /* i  : 12.8kHz weighted speech (for LTP        */
    Word16 pitch_buf[CPE_CHANNELS][NB_SUBFR16k],                /* o  : floating pitch for each subframe        */
    Word32 *mdst_spectrum_long[CPE_CHANNELS],                   /* o  : buffer for MDST spectrum                */
+4 −0
Original line number Diff line number Diff line
@@ -116,6 +116,10 @@
#define FIX_BASOP_2332_ASAN_OVERFLOW_IN_EXT_DIRAC_REND  /* Nokia: basop issue 2332: Uses predefined memory sizes instead computing wrong */
#define FIX_BASOP_2333_MCMASA_ANA_MEMORY_LEAK           /* Nokia: basop issue 2333: Add missing free for direction_vector_e to ivas_mcmasa_ana_fx.c */
#define HARM_COREDECODER_FUNCTIONS                      /* VA: basop issue 2347: Remove various duplicated code in core-decoder  */
#define SIMPLIFY_SCALING_OLD_INP
#define REMOVE_UNUSED_BUFFER_CORE_ENC
#define REMOVE_SCALING_SHB_SPEECH
#define SCALING_SWB_SPEECH_32

/* #################### End BE switches ################################## */

+5 −3
Original line number Diff line number Diff line
@@ -10490,7 +10490,9 @@ void Copy_Scale_sig32(
void swb_pre_proc_ivas_fx(
    Encoder_State *st,      /* i/o: encoder state structure                  */
    Word16 *new_swb_speech, /* o  : original input signal at 32kHz - Q0      */
#ifndef SCALING_SWB_SPEECH_32
    Word32 *new_swb_speech_fx, /* o  : original input signal at 32kHz - Q - q_reImBuffer */
#endif
    Word16 *shb_speech, /* o  : SHB target signal (6-14kHz) at 16kHz- Q(Q_shb_spch) */
    Word16 *Q_shb_spch,
    Word32 realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i  : real buffer Q - q_reImbuffer             */
+72 −8
Original line number Diff line number Diff line
@@ -88,11 +88,15 @@ ivas_error ivas_core_enc_fx(
    STEREO_TD_ENC_DATA_HANDLE hStereoTD;
    Word16 voice_factors_fx[CPE_CHANNELS][NB_SUBFR16k]; /* Q15 */
    Word32 shb_speech_fx32[L_FRAME16k];
#ifndef SCALING_SWB_SPEECH_32
    Word32 *new_swb_speech_fx;
#endif
    Word16 *inp_fx[CPE_CHANNELS];
    Word16 *shb_speech_fx;
    Word16 Q_shb_spch;
#ifndef SCALING_SWB_SPEECH_32
    Word32 new_swb_speech_buffer_fx[L_FRAME48k + STEREO_DFT_OVL_MAX];
#endif
    Word16 new_inp_resamp16k_fx[CPE_CHANNELS][L_FRAME16k]; /* new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE */
    Word16 *hb_speech_fx;
    Word32 bwe_exc_extended_fx[CPE_CHANNELS][L_FRAME32k + NL_BUFF_OFFSET]; /* 2 * Q_new */
@@ -110,8 +114,9 @@ ivas_error ivas_core_enc_fx(
    Word16 max_num_indices_BWE;
    Word16 i, shift, Q_min;

#ifndef SCALING_SWB_SPEECH_32
    set32_fx( new_swb_speech_buffer_fx, 0, L_FRAME48k + STEREO_DFT_OVL_MAX );

#endif
    FOR( i = 0; i < CPE_CHANNELS; i++ )
    {
        set_zero_fx( bwe_exc_extended_fx[i], L_FRAME32k + NL_BUFF_OFFSET );
@@ -364,9 +369,10 @@ ivas_error ivas_core_enc_fx(
            TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc;
            Word16 Q_spec_old, L_spec;

#ifndef SIMPLIFY_SCALING_OLD_INP
            Scale_sig( old_inp_12k8_fx[n], L_INP_12k8, sub( Q1, Q_new[n] ) ); // Q0
            Scale_sig( old_inp_16k_fx[n], L_INP, sub( Q1, Q_new[n] ) );       // Q0

#endif
            Scale_sig( st->hTcxEnc->Txnq, L_FRAME32k / 2 + 64, sub( negate( 1 ), st->hTcxEnc->q_Txnq ) ); /* Q(-1) */
            st->hTcxEnc->q_Txnq = -Q1;
            move16();
@@ -374,10 +380,14 @@ ivas_error ivas_core_enc_fx(
            move16();

            /* TCX core encoder */
#ifdef SIMPLIFY_SCALING_OLD_INP
            stereo_tcx_core_enc( st, old_inp_12k8_fx[n] + L_INP_MEM, old_inp_16k_fx[n] + L_INP_MEM, Aw_fx[n], lsp_new_fx[n], lsp_mid_fx[n], pitch_buf_fx[n], last_element_mode, vad_hover_flag[0], Q_new[n] );
#else
            stereo_tcx_core_enc( st, old_inp_12k8_fx[n] + L_INP_MEM, old_inp_16k_fx[n] + L_INP_MEM, Aw_fx[n], lsp_new_fx[n], lsp_mid_fx[n], pitch_buf_fx[n], last_element_mode, vad_hover_flag[0], 0 );

            Scale_sig( old_inp_12k8_fx[n], L_INP_12k8, sub( Q_new[n], Q1 ) ); // Q_new[n] - 1
            Scale_sig( old_inp_16k_fx[n], L_INP, sub( Q_new[n], Q1 ) );       // Q_new[n] - 1
#endif

            Scale_sig( st->hTcxEnc->old_out_fx, L_FRAME32k, negate( st->hTcxEnc->Q_old_out ) ); // scaling back to Q0
            st->hTcxEnc->Q_old_out = 0;
@@ -458,7 +468,9 @@ ivas_error ivas_core_enc_fx(
                FOR( n = 0; n < n_CoreChannels; n++ )
                {
                    st = sts[n];
#ifndef SIMPLIFY_SCALING_OLD_INP
                    Scale_sig( old_inp_16k_fx[n], L_INP, sub( Q1, Q_new[n] ) ); // Q0
#endif
                    IF( NE_16( st->element_mode, IVAS_CPE_DFT ) && NE_16( st->element_mode, IVAS_CPE_MDCT ) )
                    {
                        st->hTcxEnc->exp_buf_speech_ltp = st->exp_buf_speech_enc;
@@ -471,15 +483,22 @@ ivas_error ivas_core_enc_fx(
                Q_spec_old[1] = hCPE->hCoreCoder[1]->hTcxEnc->spectrum_long_e;
                move16();

#ifdef SIMPLIFY_SCALING_OLD_INP
                ivas_mdct_core_whitening_enc_fx( hCPE, old_inp_16k_fx, Q_new, old_wsp_fx, pitch_buf_fx_new, hMCT->p_mdst_spectrum_long_fx[cpe_id], hMCT->tnsBits[cpe_id], hMCT->p_orig_spectrum_long_fx[cpe_id],
                                                 hMCT->tnsSize[cpe_id], hMCT->p_param[cpe_id], hMCT->hBstr, 1, hMCT->nchan_out_woLFE, mdst_spectrum_e, orig_spectrum_e );
#else
                ivas_mdct_core_whitening_enc_fx( hCPE, old_inp_16k_fx, old_wsp_fx, pitch_buf_fx_new, hMCT->p_mdst_spectrum_long_fx[cpe_id], hMCT->tnsBits[cpe_id], hMCT->p_orig_spectrum_long_fx[cpe_id],
                                                 hMCT->tnsSize[cpe_id], hMCT->p_param[cpe_id], hMCT->hBstr, 1, hMCT->nchan_out_woLFE, mdst_spectrum_e, orig_spectrum_e );
#endif

                FOR( i = 0; i < CPE_CHANNELS; i++ )
                {
                    st = sts[i];
                    Word16 nSubframes = NB_DIV;
                    move16();
#ifndef SIMPLIFY_SCALING_OLD_INP
                    Scale_sig( old_inp_16k_fx[i], L_INP, sub( Q_new[i], Q1 ) ); // Q_new[n] - 1
#endif
                    if ( EQ_16( st->hTcxEnc->tcxMode, TCX_20 ) )
                    {
                        nSubframes = 1;
@@ -544,8 +563,9 @@ ivas_error ivas_core_enc_fx(
                FOR( i = 0; i < CPE_CHANNELS; i++ )
                {
                    st = sts[i];
#ifndef SIMPLIFY_SCALING_OLD_INP
                    Scale_sig( old_inp_16k_fx[i], L_INP, sub( Q1, Q_new[i] ) ); // Q0

#endif
                    test();
                    IF( NE_16( st->element_mode, IVAS_CPE_DFT ) && NE_16( st->element_mode, IVAS_CPE_MDCT ) )
                    {
@@ -571,11 +591,17 @@ ivas_error ivas_core_enc_fx(
                Q_spec_old[1] = hCPE->hCoreCoder[1]->hTcxEnc->spectrum_long_e;
                move16();

#ifdef SIMPLIFY_SCALING_OLD_INP
                stereo_mdct_core_enc_fx( hCPE, old_inp_16k_fx, Q_new, old_wsp_fx, pitch_buf_fx );
#else
                stereo_mdct_core_enc_fx( hCPE, old_inp_16k_fx, old_wsp_fx, pitch_buf_fx );
#endif

                FOR( i = 0; i < CPE_CHANNELS; i++ )
                {
#ifndef SIMPLIFY_SCALING_OLD_INP
                    Scale_sig( old_inp_16k_fx[i], L_INP, sub( Q_new[i], Q1 ) ); // Q_new[n] - 1
#endif
                    st = sts[i];
                    IF( EQ_16( st->hTcxEnc->tcxMode, TCX_20 ) )
                    {
@@ -643,8 +669,9 @@ ivas_error ivas_core_enc_fx(
     * Postprocessing, BWEs and Updates
     *---------------------------------------------------------------------*/

#ifndef REMOVE_UNUSED_BUFFER_CORE_ENC
    Word16 tmp_input_fx[L_FRAME48k], tmp_old_input_fx[L_FRAME48k], q_inp[2];

#endif
    FOR( n = 0; n < n_CoreChannels; n++ )
    {
        st = sts[n];
@@ -659,11 +686,12 @@ ivas_error ivas_core_enc_fx(
            move16();
        }

#ifndef REMOVE_UNUSED_BUFFER_CORE_ENC
        Copy( st->input_fx - input_frame, tmp_old_input_fx, input_frame );
        Copy( st->input_fx, tmp_input_fx, input_frame );
        q_inp[0] = st->q_old_inp;
        q_inp[1] = st->q_inp;

#endif
        Scale_sig( st->input_fx - input_frame, shl( input_frame, 1 ), sub( -1, st->q_inp ) );
        st->q_inp = -1;
        move16();
@@ -713,7 +741,9 @@ ivas_error ivas_core_enc_fx(
         * SWB(FB) BWE encoding
         *---------------------------------------------------------------------*/

#ifndef SCALING_SWB_SPEECH_32
        new_swb_speech_fx = new_swb_speech_buffer_fx + STEREO_DFT_OVL_MAX;
#endif
        new_swb_speech_fx_16 = new_swb_speech_buffer_fx_16 + STEREO_DFT_OVL_MAX;
        set16_fx( new_swb_speech_buffer_fx_16, 0, L_FRAME48k + STEREO_DFT_OVL_MAX );
        shb_speech_fx = new_inp_resamp16k_fx[n]; /* reuse existing buffer: shb_speech[L_FRAME16k] */
@@ -746,7 +776,17 @@ ivas_error ivas_core_enc_fx(
                st->cldfbSynTd->Q_cldfb_state = sub( q_re_im_buf[n], 1 );
            }

#ifdef SCALING_SWB_SPEECH_32
            Word32 *new_swb_speech_fx;
            Word32 new_swb_speech_buffer_fx[L_FRAME48k + STEREO_DFT_OVL_MAX];
            set32_fx( new_swb_speech_buffer_fx, 0, L_FRAME48k + STEREO_DFT_OVL_MAX );
            new_swb_speech_fx = new_swb_speech_buffer_fx + STEREO_DFT_OVL_MAX;
#endif
#ifdef SCALING_SWB_SPEECH_32
            swb_pre_proc_ivas_fx( st, new_swb_speech_fx_16, shb_speech_fx ,& Q_shb_spch, realBuffer_fx[n], imagBuffer_fx[n], q_re_im_buf[n], hCPE );
#else
            swb_pre_proc_ivas_fx( st, new_swb_speech_fx_16, new_swb_speech_fx, shb_speech_fx, &Q_shb_spch, realBuffer_fx[n], imagBuffer_fx[n], q_re_im_buf[n], hCPE );
#endif

            st->cldfbSynTd->Q_cldfb_state = sub( q_re_im_buf[n], 1 );
        }
@@ -765,10 +805,11 @@ ivas_error ivas_core_enc_fx(
                                                                                 // IF( st->tcxonly == 0 )
#endif
        {
#ifndef REMOVE_SCALING_SHB_SPEECH
            shift = add( getScaleFactor16( shb_speech_fx, L_FRAME16k ), Q16 );
            Copy_Scale_sig_16_32_no_sat( shb_speech_fx, shb_speech_fx32, L_FRAME16k, shift ); // Q_shb_spch
            Q_shb_spch = add( Q_shb_spch, shift );

#endif
            IF( st->hBWE_FD )
            {
                shift = getScaleFactor16( st->hBWE_FD->L_old_wtda_swb_fx, L_FRAME48k );
@@ -800,6 +841,11 @@ ivas_error ivas_core_enc_fx(
        }
        ELSE IF( EQ_16( st->extl, SWB_BWE ) || EQ_16( st->extl, FB_BWE ) )
        {
#ifdef REMOVE_SCALING_SHB_SPEECH
            shift = add( getScaleFactor16( shb_speech_fx, L_FRAME16k ), Q16 );
            Q_shb_spch = add( Q_shb_spch_16, shift );
            Copy_Scale_sig_16_32_no_sat( shb_speech_fx, shb_speech_fx32, L_FRAME16k, shift ); // Q_shb_spch
#endif
            Copy_Scale_sig_32_16( shb_speech_fx32, shb_speech_fx, L_FRAME16k, -Q16 ); // Q_shb_spch - 16
            /* SWB(FB) BWE encoder */
            swb_bwe_enc_ivas_fx( st, last_element_mode, old_inp_12k8_fx[n], old_inp_16k_fx[n], old_syn_12k8_16k_fx[n], new_swb_speech_fx_16, st->q_inp, shb_speech_fx, sub( Q_shb_spch, Q16 ), sub( Q_new[n], 1 ) );
@@ -817,6 +863,11 @@ ivas_error ivas_core_enc_fx(
        IF( st->hTdCngEnc != NULL && st->Opt_DTX_ON && ( GE_16( input_frame, L_FRAME32k ) || EQ_16( st->element_mode, IVAS_CPE_DFT ) ) )
        {
            /* SHB DTX/CNG encoder */
#ifdef REMOVE_SCALING_SHB_SPEECH
            shift = add( getScaleFactor16( shb_speech_fx, L_FRAME16k ), Q16 );
            Q_shb_spch = add( Q_shb_spch_16, shift );
            Copy_Scale_sig_16_32_no_sat( shb_speech_fx, shb_speech_fx32, L_FRAME16k, shift ); // Q_shb_spch
#endif
            Copy_Scale_sig_32_16( shb_speech_fx32, shb_speech_fx, L_FRAME16k, negate( Q_shb_spch ) ); // Q0
#ifdef HARM_NON_LINEARITY
            swb_CNG_enc_fx( st, shb_speech_fx /* Unmodified */, old_syn_12k8_16k_fx[n] );
@@ -840,10 +891,21 @@ ivas_error ivas_core_enc_fx(
            stereo_icBWE_preproc_fx( hCPE, input_frame, new_swb_speech_buffer_fx_16 /*tmp buffer*/, q_new_swb_speech_buffer );

            q_new_swb_speech_buffer = add( q_new_swb_speech_buffer, 16 );
#ifndef SCALING_SWB_SPEECH_32
            Copy_Scale_sig_16_32_no_sat( new_swb_speech_buffer_fx_16, new_swb_speech_buffer_fx, L_FRAME48k + STEREO_DFT_OVL_MAX, Q16 ); // q_new_swb_speech_buffer+st->q_inp - 16 - > q_new_swb_speech_buffer+st->q_inp
#endif
            Copy_Scale_sig_16_32_no_sat( voice_factors_fx[0], voice_factors_fx32[0], NB_SUBFR16k, Q16 ); // Q31

            stereo_icBWE_enc_ivas_fx( hCPE, shb_speech_fx32, sub( Q31, Q_shb_spch ), new_swb_speech_buffer_fx, sub( Q31, q_new_swb_speech_buffer ), voice_factors_fx32[0] );
#ifdef REMOVE_SCALING_SHB_SPEECH
            shift = add( getScaleFactor16( shb_speech_fx, L_FRAME16k ), Q16 );
            Q_shb_spch = add( Q_shb_spch_16, shift );
            Copy_Scale_sig_16_32_no_sat( shb_speech_fx, shb_speech_fx32, L_FRAME16k, shift ); // Q_shb_spch
#endif
#ifdef SCALING_SWB_SPEECH_32
            stereo_icBWE_enc_fx( hCPE, shb_speech_fx32, sub( Q31, Q_shb_spch ), new_swb_speech_buffer_fx_16, sub( Q31, q_new_swb_speech_buffer ), voice_factors_fx32[0] );
#else
            stereo_icBWE_enc_fx( hCPE, shb_speech_fx32, sub( Q31, Q_shb_spch ), new_swb_speech_buffer_fx, sub( Q31, q_new_swb_speech_buffer ), voice_factors_fx32[0] );
#endif

            IF( EQ_16( st->element_mode, IVAS_CPE_DFT ) )
            {
@@ -861,12 +923,14 @@ ivas_error ivas_core_enc_fx(
            }
        }

#ifndef REMOVE_UNUSED_BUFFER_CORE_ENC
        Copy( tmp_old_input_fx, st->input_fx - input_frame, input_frame );
        Copy( tmp_input_fx, st->input_fx, input_frame );
        st->q_old_inp = q_inp[0];
        move16();
        st->q_inp = q_inp[1];
        move16();
#endif

#ifndef REMOVE_CAM_FROM_IVAS
        /*---------------------------------------------------------------------*
+34 −4
Original line number Diff line number Diff line
@@ -1117,7 +1117,10 @@ void enc_prm_igf_mdct(

void ivas_mdct_core_whitening_enc_fx(
    CPE_ENC_HANDLE hCPE,                            /* i/o: CPE encoder structure                 */
    Word16 new_samples_fx[CPE_CHANNELS][L_INP],     /* i  : new samples                           Q0*/
    Word16 new_samples_fx[CPE_CHANNELS][L_INP],     /* i  : new samples                     Qnew-1*/
#ifdef SIMPLIFY_SCALING_OLD_INP
    Word16 Q_new_inp[CPE_CHANNELS],                 /* i  : Q factor of input buffer              */
#endif
    Word16 old_wsp_fx[CPE_CHANNELS][L_WSP],         /* i  : 12.8kHz weighted speech (for LTP      Qx*/
    Word16 pitch_buf_fx[CPE_CHANNELS][NB_SUBFR16k], /* o  : floating pitch for each subframe      Q6*/
    Word32 *mdst_spectrum_long_fx[CPE_CHANNELS],    /* o  : buffer for MDST spectrum              mdst_spectrum_e*/
@@ -1183,6 +1186,13 @@ void ivas_mdct_core_whitening_enc_fx(
    move16();
    move16();

#ifdef SIMPLIFY_SCALING_OLD_INP
    FOR( ch = 0; ch < CPE_CHANNELS; ch++ )
    {
        Scale_sig( new_samples_fx[ch], L_INP, sub( Q1, Q_new_inp[ch] ) ); // Q0
    }
#endif

    /*--------------------------------------------------------------*
     * Initialization
     *---------------------------------------------------------------*/
@@ -1222,6 +1232,7 @@ void ivas_mdct_core_whitening_enc_fx(

    windowedSignal_fx[0] = orig_spectrum_long[0]; /* NOTE temporarily available */
    windowedSignal_fx[1] = temp_buffer;           /* orig_spectrum_long isn't long enough */
    
    /*--------------------------------------------------------------*
     * TCX20/TCX10 switching decision
     *---------------------------------------------------------------*/
@@ -1321,6 +1332,7 @@ void ivas_mdct_core_whitening_enc_fx(
            move32();
        }
    }

    /*--------------------------------------------------------------*
     * Transform Kernel Switching, Stereo Pre-Processing, and TNS
     *---------------------------------------------------------------*/
@@ -1522,6 +1534,7 @@ void ivas_mdct_core_whitening_enc_fx(
            move16();
            move16();
        }

        FOR( n = 0; n < nSubframes; n++ )
        {
            test();
@@ -1708,7 +1721,6 @@ void ivas_mdct_core_whitening_enc_fx(

            init_tcx_enc_info_fx( sts[ch], &L_subframe, &L_subframeTCX, &tcx_subframe_coded_lines );


            nSubframes = NB_DIV;
            move16();
            shift = 1;
@@ -1758,6 +1770,7 @@ void ivas_mdct_core_whitening_enc_fx(
            }
        }
    }

    TCX_ENC_HANDLE hTcxEnc = NULL;
    q_min = 0;
    move16();
@@ -1810,9 +1823,11 @@ void ivas_mdct_core_whitening_enc_fx(
        }
    }
    TNSAnalysisStereo_fx( sts, mdst_spectrum_fx, 0, tnsSize, tnsBits, param_core, mct_on );
    
    /*--------------------------------------------------------------*
     * Envelope Quantization and FDNS
     *---------------------------------------------------------------*/
    
     /* Common q for spectrum and mdst */
    q_min = 0;
    move16();
@@ -2062,7 +2077,6 @@ void ivas_mdct_core_whitening_enc_fx(

        init_tcx_enc_info_fx( st, &L_subframe, &L_subframeTCX, &tcx_subframe_coded_lines );


        IF( NE_16( st->hTcxEnc->tcxMode, TCX_20 ) )
        {
            /* nSubframes = NB_DIV = 2 */
@@ -2091,6 +2105,7 @@ void ivas_mdct_core_whitening_enc_fx(
            Scale_sig32( st->hTcxEnc->spectrum_fx[n] + L_subframe, sub( L_subframeTCX, L_subframe ), sub( exp_tmp, st->hTcxEnc->spectrum_e[n] ) );
        }
    }

    /*--------------------------------------------------------------*
     * TNS
     *---------------------------------------------------------------*/
@@ -2313,6 +2328,7 @@ void ivas_mdct_core_whitening_enc_fx(
    /*--------------------------------------------------------------------------------*
     * SNS parameters
     *--------------------------------------------------------------------------------*/
    
    test();
    test();
    test();
@@ -2474,11 +2490,25 @@ void ivas_mdct_core_whitening_enc_fx(
        }
    }

#ifdef SIMPLIFY_SCALING_OLD_INP
    // scaling the input buffer back to Q_new-1 - actually not needed because the buffer is not used in the subsequent processing
    FOR( ch = 0; ch < CPE_CHANNELS; ch++ )
    {
        Scale_sig( new_samples_fx[ch], L_INP, sub( Q_new_inp[ch], Q1 ) ); // Q0
    }
#endif

    pop_wmops();
    return;
}


/*--------------------------------------------------------------*
 * ivas_mdct_quant_coder()
 *
 * Spectrum quantization and coding
 *---------------------------------------------------------------*/

void ivas_mdct_quant_coder_fx(
    CPE_ENC_HANDLE hCPE,                  /* i/o: Encoder CPE handle                   */
    Word16 tnsBits[CPE_CHANNELS][NB_DIV], /* i  : bits needed for TNS parameters       */
Loading