Commit 0c59e09c authored by Jan Kiene's avatar Jan Kiene
Browse files

Accept SIMPLIFY_CORE_ENC

parent 6b289e01
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
@@ -2782,34 +2782,23 @@ void InternalTCXDecoder_fx(

void stereo_tcx_core_enc(
    Encoder_State *st,                                          /* i/o: encoder state structure                 */
#ifdef SIMPLIFY_CORE_ENC
    Word16 new_samples_12k8[],                                  /* i  : buffer of input signal @12.8 kHz        */
    Word16 new_samples_16k[],                                   /* i  : buffer of input signal @16 kHz          */
#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_CORE_ENC
    const Word16 Q_new_orig                                     /* i  : Scaling factor of new_samples_xx[]     */
#else
    Word16 Q_new
#endif
);

#ifdef SIMPLIFY_CORE_ENC
void stereo_tcx_enc_scale_buffers( 
    Encoder_State *st,                                          /* i/o: encoder state structure                 */
    const Word16 n_channels,                                    /* i  : number of core channels                 */
    const Word16 Q_spec_old                                     /* i  : Q of old spectrum                       */
);

#endif
Word16 transient_analysis_ivas_fx(
    TRAN_DET_HANDLE hTranDet,                                   /* i  : handle transient detection              */
    const Word16 cor_map_LT[],                                  /* i  : LT correlation map  Q_cor_map = Qx      */
@@ -5746,11 +5735,7 @@ void pre_proc_ivas_fx(
    const Word16 vad_hover_flag,                                /* i  : VAD hangover flag                                    Q0*/
    const Word16 flag_16k_smc,                                  /* i  : flag to indicate if the OL SMC is run at 16 kHz      Q0*/
    Word32 enerBuffer_fx[CLDFB_NO_CHANNELS_MAX],                /* i  : energy buffer                             e_enerBuffer */
#ifdef SIMPLIFY_CORE_ENC
    Word16 e_enerBuffer,                                        /* i  : Q value of energy buffer                               */
#else
    const Word16 e_enerBuffer,                                  /* i  : Q value of energy buffer                               */
#endif
    Word16 fft_buff_fx[2 * L_FFT],                              /* i  : FFT buffer                                           Qx*/
    const Word16 cor_map_sum_fx,                                /* i  : speech/music clasif. parameter                       Q8*/
    Word16 *Q_new                                               /* i/o: Q factor of speech buffers                             */
+0 −1
Original line number Diff line number Diff line
@@ -92,7 +92,6 @@
#define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */
#define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527    /* Fix crash from issue #2527 */
#define FIX_FLOAT_1539_G192_FORMAT_SWITCH               /* VA/Nokia: reintroduce format switching for g192 bitstreams */
#define SIMPLIFY_CORE_ENC                               /* VA: basop issue 2430: Simplify ivas_core_enc_fx() */
#define FIX_2402_SIMPLIFY_ARI_CODEC                     /* FhG: basop issue 2402: simplified arithmetic in TCX arithmetic coder */
#define FIX_2402_REPL_EVS_ARI_CODEC_ENC                 /* FhG: basop issue 2402: replace EVS arith encoder with IVAS arith encoder */
#define FIX_BASOP_2551_HARM_SCALAR_QUAN                 /* FhG: issue 2551: Harmonize function pair tcx_scalar_quantization_fx*/
+0 −6
Original line number Diff line number Diff line
@@ -71,11 +71,7 @@ void HQ_core_enc_init_fx(

void hq_core_enc_fx(
    Encoder_State *st, /* i/o: encoder state structure                    */
#ifdef SIMPLIFY_CORE_ENC
    Word16 *audio_fx, /* i  : input audio signal                       Q0*/
#else
    const Word16 *audio_fx, /* i  : input audio signal                       Q0*/
#endif
    const Word16 input_frame_orig, /* i  : frame length                             Q0*/
    const Word16 hq_core_type,     /* i  : HQ core type                             Q0*/
    const Word16 Voicing_flag,     /* i  : Voicing flag for FER method selection    Q0*/
@@ -127,7 +123,6 @@ void hq_core_enc_fx(
    st->hTcxCfg->tcx_curr_overlap_mode = ALDO_WINDOW;
    move16();

#ifdef SIMPLIFY_CORE_ENC
    /*--------------------------------------------------------------------------
     * Scaling of buffers
     *--------------------------------------------------------------------------*/
@@ -145,7 +140,6 @@ void hq_core_enc_fx(
        move16();
    }

#endif
    /*--------------------------------------------------------------------------
     * Preprocessing in the first HQ frame after ACELP frame
     * Find the number of bits for PVQ coding
+0 −267
Original line number Diff line number Diff line
@@ -111,11 +111,7 @@ ivas_error ivas_core_enc_fx(
    Word16 diff_nBits;
    ivas_error error;
    Word16 max_num_indices_BWE;
#ifdef SIMPLIFY_CORE_ENC
    Word16 i, shift;
#else
    Word16 i, shift, Q_min;
#endif

    FOR( i = 0; i < CPE_CHANNELS; i++ )
    {
@@ -209,22 +205,6 @@ ivas_error ivas_core_enc_fx(
         * Pre-processing, incl. Decision matrix
         *---------------------------------------------------------------------*/

#ifndef SIMPLIFY_CORE_ENC
        IF( st->cldfbAnaEnc )
        {
            Word16 tmp_shift = L_norm_arr( enerBuffer_fx[n], st->cldfbAnaEnc->no_channels );
            tmp_shift = sub( tmp_shift, 5 );
            IF( tmp_shift < 0 )
            {
                scale_sig32( enerBuffer_fx[n], st->cldfbAnaEnc->no_channels, tmp_shift ); /* enerBuffer_fx_exp[n] - tmp_shift */
                enerBuffer_fx_exp[n] = sub( enerBuffer_fx_exp[n], tmp_shift );
                move16();
            }
        }

        Scale_sig( fft_buff_fx[n], ( 2 * L_FFT ), -1 ); // To create 1 headroom for addition of magnitude square spectrum
                                                        // fft_buff_fx_exp = add(fft_buff_fx_exp,1);
#endif
        FOR( i = 0; i < st->nb_subfr; i++ )
        {
            Scale_sig( &Aw_fx[n][i * ( M + 1 )], M + 1, sub( norm_s( Aw_fx[n][i * ( M + 1 )] ), 2 ) ); // scaling to Q12
@@ -331,89 +311,12 @@ ivas_error ivas_core_enc_fx(
        IF( ( EQ_16( st->core, TCX_20_CORE ) || EQ_16( st->core, TCX_10_CORE ) ) && NE_16( st->element_mode, IVAS_CPE_MDCT ) )
        {
            /* TCX core encoder */
#ifdef SIMPLIFY_CORE_ENC
            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
            TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc;
            Word16 Q_spec_old, L_spec;

#ifdef NONBE_FIX_ISSUE_2206
            Scale_sig( st->hTcxEnc->Txnq, L_FRAME32k / 2 + 64, sub( negate( 1 ), st->hTcxEnc->q_Txnq ) ); /* Q(-1) */
            st->hTcxEnc->q_Txnq = -Q1;
            move16();

            Q_spec_old = hTcxEnc->spectrum_long_e;
            move16();

            /* TCX core encoder */
            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
            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

            Scale_sig( st->hTcxEnc->Txnq, L_FRAME32k / 2 + 64, sub( negate( 1 ), st->hTcxEnc->q_Txnq ) ); /* Q(-1) */
            st->hTcxEnc->q_Txnq = -Q1;
            move16();
            Q_spec_old = st->hTcxEnc->spectrum_long_e;
            move16();

            /* TCX core encoder */
            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

            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;
            move16();
#endif

            IF( EQ_16( hTcxEnc->tcxMode, TCX_20 ) )
            {
                L_spec = st->hTcxCfg->tcx_coded_lines;
                move16();
                Word16 e_max = s_max( hTcxEnc->spectrum_e[0], Q_spec_old );
                e_max = sub( e_max, L_norm_arr( hTcxEnc->spectrum_long_fx, N_MAX ) );
                scale_sig32( hTcxEnc->spectrum_fx[0], L_spec, sub( hTcxEnc->spectrum_e[0], e_max ) );              // exp(e_max)
                scale_sig32( hTcxEnc->spectrum_long_fx + L_spec, sub( N_MAX, L_spec ), sub( Q_spec_old, e_max ) ); // exp(e_max)

                hTcxEnc->spectrum_long_e = e_max;
                move16();
            }
            ELSE
            {
                Word16 e_max = s_max( Q_spec_old, s_max( hTcxEnc->spectrum_e[0], hTcxEnc->spectrum_e[1] ) );
                e_max = sub( e_max, L_norm_arr( hTcxEnc->spectrum_long_fx, N_MAX ) );
                L_spec = shr( st->hTcxCfg->tcx_coded_lines, 1 );
                scale_sig32( hTcxEnc->spectrum_fx[0], L_spec, sub( hTcxEnc->spectrum_e[0], e_max ) );                          // exp(e_max)
                scale_sig32( hTcxEnc->spectrum_fx[1], L_spec, sub( hTcxEnc->spectrum_e[1], e_max ) );                          // exp(e_max)
                scale_sig32( hTcxEnc->spectrum_fx[0] + L_spec, sub( N_TCX10_MAX, L_spec ), sub( Q_spec_old, e_max ) );         // exp(e_max)
                scale_sig32( hTcxEnc->spectrum_fx[1] + L_spec, sub( N_MAX - N_TCX10_MAX, L_spec ), sub( Q_spec_old, e_max ) ); // exp(e_max)

                hTcxEnc->spectrum_long_e = s_max( Q_spec_old, s_max( hTcxEnc->spectrum_e[0], hTcxEnc->spectrum_e[1] ) );
                move16();
            }
            hTcxEnc->spectrum_e[0] = hTcxEnc->spectrum_long_e;
            move16();
            hTcxEnc->spectrum_e[1] = hTcxEnc->spectrum_long_e;
            move16();
#endif
        }

        IF( EQ_16( st->core, HQ_CORE ) )
        {
            /* HQ core encoder */
#ifndef SIMPLIFY_CORE_ENC
            Scale_sig( st->input_fx, input_frame, negate( st->q_inp ) ); // Q0
            st->q_inp = 0;
            move16();
            Scale_sig( st->old_input_signal_fx, input_frame, negate( st->q_old_inp ) ); // Q0
            st->q_old_inp = 0;
            move16();
            Scale_sig( st->hTcxEnc->Txnq, L_FRAME32k / 2 + 64, sub( 0, st->hTcxEnc->q_Txnq ) ); // Q0
            st->hTcxEnc->q_Txnq = 0;
            move16();
#endif
            hq_core_enc_fx( st, st->input_fx, input_frame, NORMAL_HQ_CORE, Voicing_flag[n], vad_hover_flag[0] );
        }

@@ -442,32 +345,12 @@ ivas_error ivas_core_enc_fx(
            {
                Word16 mdst_spectrum_e[CPE_CHANNELS][NB_DIV];
                Word16 orig_spectrum_e[CPE_CHANNELS][NB_DIV];
#ifdef SIMPLIFY_CORE_ENC
                Word16 Q_spec_old[CPE_CHANNELS];
#else
                Word16 pitch_buf_fx_new[CPE_CHANNELS][NB_SUBFR16k]; /* Q6 */
                FOR( n = 0; n < n_CoreChannels; n++ )
                {
                    st = sts[n];
#ifndef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549
                    Scale_sig( old_inp_16k_fx[n], L_INP, sub( Q1, Q_new[n] ) ); // Q0
#endif
#ifndef NONBE_FIX_ISSUE_2518
                    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;
                        move16();
                    }
#endif
                }
                Word16 Q_spec_old[2], L_spec;
#endif
                Q_spec_old[0] = hCPE->hCoreCoder[0]->hTcxEnc->spectrum_long_e;
                move16();
                Q_spec_old[1] = hCPE->hCoreCoder[1]->hTcxEnc->spectrum_long_e;
                move16();

#ifdef SIMPLIFY_CORE_ENC
#ifndef NONBE_FIX_ISSUE_2206
                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 );
@@ -479,47 +362,16 @@ ivas_error ivas_core_enc_fx(
                ivas_mdct_core_whitening_enc_fx( hCPE, old_inp_16k_fx, old_wsp_fx, pitch_buf_fx, 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
#endif
#else
#ifdef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549
                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
#endif

                FOR( i = 0; i < CPE_CHANNELS; i++ )
                {
#ifndef SIMPLIFY_CORE_ENC
                    st = sts[i];
                    Word16 nSubframes = NB_DIV;
                    move16();
#ifndef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549
                    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;
                        move16();
                    }
#endif
                    hMCT->q_mdst_spectrum_long_fx[cpe_id][i][0] = sub( Q31, mdst_spectrum_e[i][0] );
                    move16();
#ifdef SIMPLIFY_CORE_ENC
                    IF( NE_16( sts[i]->hTcxEnc->tcxMode, TCX_20 ) )
#else
                    IF( EQ_16( nSubframes, NB_DIV ) )
#endif
                    {
                        hMCT->q_mdst_spectrum_long_fx[cpe_id][i][1] = sub( Q31, mdst_spectrum_e[i][1] );
                        move16();
#ifndef SIMPLIFY_CORE_ENC
                    }
                    IF( EQ_16( nSubframes, NB_DIV ) )
                    {
#endif
                        Word16 max_e = s_max( orig_spectrum_e[i][0], orig_spectrum_e[i][1] );
                        scale_sig32( hMCT->p_orig_spectrum_long_fx[cpe_id][i], N_TCX10_MAX, sub( orig_spectrum_e[i][0], max_e ) );               // exp(max_e)
                        scale_sig32( hMCT->p_orig_spectrum_long_fx[cpe_id][i] + N_TCX10_MAX, N_TCX10_MAX, sub( orig_spectrum_e[i][1], max_e ) ); // exp(max_e)
@@ -532,134 +384,15 @@ ivas_error ivas_core_enc_fx(
                        move16();
                    }

#ifdef SIMPLIFY_CORE_ENC
                    stereo_tcx_enc_scale_buffers( sts[i], CPE_CHANNELS, Q_spec_old[i] );
#else
                    IF( EQ_16( st->hTcxEnc->tcxMode, TCX_20 ) )
                    {
                        Word16 e_max = s_max( st->hTcxEnc->spectrum_e[0], Q_spec_old[i] );
                        e_max = sub( e_max, L_norm_arr( st->hTcxEnc->spectrum_long_fx, N_MAX ) );
                        L_spec = st->hTcxEnc->L_frameTCX;
                        move16();
                        scale_sig32( st->hTcxEnc->spectrum_fx[0], L_spec, sub( st->hTcxEnc->spectrum_e[0], e_max ) );             // exp(e_max)
                        scale_sig32( st->hTcxEnc->spectrum_long_fx + L_spec, sub( N_MAX, L_spec ), sub( Q_spec_old[i], e_max ) ); // exp(e_max)

                        st->hTcxEnc->spectrum_long_e = e_max;
                        move16();
                    }
                    ELSE
                    {
                        Word16 e_max = s_max( s_max( st->hTcxEnc->spectrum_e[0], st->hTcxEnc->spectrum_e[1] ), Q_spec_old[i] );
                        e_max = sub( e_max, L_norm_arr( st->hTcxEnc->spectrum_long_fx, N_MAX ) );
                        L_spec = shr( st->hTcxEnc->L_frameTCX, 1 );
                        scale_sig32( st->hTcxEnc->spectrum_fx[0], L_spec, sub( st->hTcxEnc->spectrum_e[0], e_max ) );                             // exp(e_max)
                        scale_sig32( st->hTcxEnc->spectrum_fx[0] + L_spec, sub( N_TCX10_MAX, L_spec ), sub( Q_spec_old[i], e_max ) );             // exp(e_max)
                        scale_sig32( st->hTcxEnc->spectrum_fx[1], L_spec, sub( st->hTcxEnc->spectrum_e[1], e_max ) );                             // exp(e_max)
                        scale_sig32( st->hTcxEnc->spectrum_fx[1] + L_spec, sub( ( N_MAX - N_TCX10_MAX ), L_spec ), sub( Q_spec_old[i], e_max ) ); // exp(e_max)

                        st->hTcxEnc->spectrum_long_e = e_max;
                        move16();
                    }

                    st->hTcxEnc->spectrum_e[0] = st->hTcxEnc->spectrum_long_e;
                    move16();
                    st->hTcxEnc->spectrum_e[1] = st->hTcxEnc->spectrum_long_e;
                    move16();
#endif
                }
            }
            ELSE
            {
#ifdef SIMPLIFY_CORE_ENC
#if !defined( NONBE_FIX_ISSUE_2206 ) || defined( NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 )
                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
#else
                FOR( i = 0; i < CPE_CHANNELS; i++ )
                {
                    st = sts[i];
#ifndef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549
                    Scale_sig( old_inp_16k_fx[i], L_INP, sub( Q1, Q_new[i] ) ); // Q0
#endif

#ifndef NONBE_FIX_ISSUE_2518
                    test();
                    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;
                        move16();
                    }
#endif
                    shift = norm_arr( st->input_fx, input_frame );
#ifdef NONBE_FIX_ISSUE_2206
                    Q_min = add( st->q_inp, shift );
#else
                    Q_min = s_max( -2, add( st->q_inp, shift ) );
#endif
                    scale_sig( st->input_fx, input_frame, sub( Q_min, st->q_inp ) );
                    st->q_inp = Q_min;
                    move16();

                    shift = norm_arr( st->input_fx - input_frame, input_frame );
#ifdef NONBE_FIX_ISSUE_2206
                    Q_min = add( st->q_old_inp, shift );
#else
                    Q_min = s_max( -2, add( st->q_old_inp, shift ) );
#endif
                    scale_sig( st->input_fx - input_frame, input_frame, sub( Q_min, st->q_old_inp ) );
                    st->q_old_inp = Q_min;
                    move16();
                }

                Word16 Q_spec_old[2], L_spec;
                Q_spec_old[0] = hCPE->hCoreCoder[0]->hTcxEnc->spectrum_long_e;
                move16();
                Q_spec_old[1] = hCPE->hCoreCoder[1]->hTcxEnc->spectrum_long_e;
                move16();

#ifdef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549
                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 NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549
                    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 ) )
                    {
                        L_spec = st->hTcxEnc->L_frameTCX;
                        move16();
                        Word16 e_max = s_max( st->hTcxEnc->spectrum_e[0], Q_spec_old[i] );
                        e_max = sub( e_max, L_norm_arr( st->hTcxEnc->spectrum_long_fx, N_MAX ) );
                        scale_sig32( st->hTcxEnc->spectrum_fx[0], L_spec, sub( st->hTcxEnc->spectrum_e[0], e_max ) );             // exp(e_max)
                        scale_sig32( st->hTcxEnc->spectrum_long_fx + L_spec, sub( N_MAX, L_spec ), sub( Q_spec_old[i], e_max ) ); // exp(e_max)
                        st->hTcxEnc->spectrum_long_e = e_max;
                        move16();
                    }
                    ELSE
                    {
                        L_spec = shr( st->hTcxEnc->L_frameTCX, 1 );
                        Word16 e_max = s_max( s_max( st->hTcxEnc->spectrum_e[1], st->hTcxEnc->spectrum_e[0] ), Q_spec_old[i] );
                        e_max = sub( e_max, L_norm_arr( st->hTcxEnc->spectrum_long_fx, N_MAX ) );
                        scale_sig32( st->hTcxEnc->spectrum_fx[0], L_spec, sub( st->hTcxEnc->spectrum_e[0], e_max ) );                             // exp(e_max)
                        scale_sig32( st->hTcxEnc->spectrum_fx[0] + L_spec, sub( N_TCX10_MAX, L_spec ), sub( Q_spec_old[i], e_max ) );             // exp(e_max)
                        scale_sig32( st->hTcxEnc->spectrum_fx[1], L_spec, sub( st->hTcxEnc->spectrum_e[1], e_max ) );                             // exp(e_max)
                        scale_sig32( st->hTcxEnc->spectrum_fx[1] + L_spec, sub( ( N_MAX - N_TCX10_MAX ), L_spec ), sub( Q_spec_old[i], e_max ) ); // exp(e_max)
                        st->hTcxEnc->spectrum_long_e = e_max;
                        move16();
                    }

                    st->hTcxEnc->spectrum_e[0] = st->hTcxEnc->spectrum_long_e;
                    move16();
                    st->hTcxEnc->spectrum_e[1] = st->hTcxEnc->spectrum_long_e;
                    move16();
                }
#endif
            }
        }
+0 −6
Original line number Diff line number Diff line
@@ -81,11 +81,7 @@ void pre_proc_ivas_fx(
    const Word16 vad_hover_flag,                 /* i  : VAD hangover flag                                  Q0*/
    const Word16 flag_16k_smc,                   /* i  : flag to indicate if the OL SMC is run at 16 kHz    Q0*/
    Word32 enerBuffer_fx[CLDFB_NO_CHANNELS_MAX], /* i  : energy buffer                             e_enerBuffer */
#ifdef SIMPLIFY_CORE_ENC
    Word16 e_enerBuffer, /* i  : Q value of energy buffer                               */
#else
    const Word16 e_enerBuffer, /* i  : Q value of energy buffer                               */
#endif
    Word16 fft_buff_fx[2 * L_FFT], /* i  : FFT buffer                                           Qx*/
    const Word16 cor_map_sum_fx,   /* i  : speech/music clasif. parameter                       Q8*/
    Word16 *Q_new                  /* i/o: Q factor of speech buffers                             */
@@ -98,7 +94,6 @@ void pre_proc_ivas_fx(

    push_wmops( "pre_proc" );

#ifdef SIMPLIFY_CORE_ENC
    /*----------------------------------------------------------------*
     * Scaling of buffers
     *----------------------------------------------------------------*/
@@ -117,7 +112,6 @@ void pre_proc_ivas_fx(

    Scale_sig( fft_buff_fx, ( 2 * L_FFT ), -1 ); // To create 1 headroom for addition of magnitude square spectrum
                                                 // fft_buff_fx_exp = add(fft_buff_fx_exp,1);
#endif

    /*----------------------------------------------------------------*
     * Initialization
Loading