Commit d429b6b4 authored by multrus's avatar multrus
Browse files

[cleanup] accept REMOVE_SCALING_SHB_SPEECH

parent 0e136720
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -1359,20 +1359,10 @@ void stereo_tcx_init_dec_fx(

void stereo_icBWE_enc_fx(
    CPE_ENC_HANDLE hCPE,                                        /* i/o: CPE encoder structure                */
#ifdef REMOVE_SCALING_SHB_SPEECH
    const Word16 shb_speech_ref_fx16[],                         /* i  : SHB speech ref channel             Q0*/
    Word16 shb_speech_nonref_fx_16[],                           /* i/o: SHB speech non-ref channel         shb_speech_nonref_e*/
#else
    const Word32 shb_speech_ref_fx[],                           /* i  : SHB speech ref channel               */
    const Word16 shb_speech_ref_e,                              /* i  : SHB speech ref channel               */
    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           */
#ifdef REMOVE_SCALING_SHB_SPEECH
    const Word16 *voice_factors_fx                              /* i  : voicing factors                  Q15 */
#else
    const Word32 *voice_factors_fx                              /* i  : voicing factors                     Q31 */
#endif
);

void initMdctStereoDecData_fx(
+0 −1
Original line number Diff line number Diff line
@@ -84,7 +84,6 @@
#define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR      /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */
#define NONBE_1122_KEEP_EVS_MODE_UNCHANGED              /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR.  */
#define FIX_1904_HARM_GSC_ENC                           /* VA: #1904 Harmonization of EVS and IVAS GSC code */
#define REMOVE_SCALING_SHB_SPEECH                       /* VA: remove unnecessary scaling and 32-bit buffers from ivas_core_enc_fx() */
#define FIX_2352_COPY_AQ_IN_TCX                         /* FhG: basop issue 2352: prevent copying uninitialized values from Aq_fx[][] to Aq_fx_32[][] in TCX */
#define FIX_2353_PTR_INIT                               /* FhG: basop issue 2353: initialize prm_sqQ-pointer, to prevent being uninitialized in case of bfi == 1 */
#define FIX_2356_GET_CHAN_ENERGIES                      /* FhG: basop issue 2356: correctly initialize exponents in getChannelEnergies_fx() */
+0 −6
Original line number Diff line number Diff line
@@ -10248,13 +10248,7 @@ 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 REMOVE_SCALING_SHB_SPEECH
    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 - Q0*/
#ifndef REMOVE_SCALING_SHB_SPEECH
    Word16 *Q_shb_spch,
#endif
    Word32 realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i  : real buffer Q - q_reImbuffer             */
    Word32 imagBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i  : imag buffer Q - q_reImbuffer             */
    Word16 q_reImBuffer,                                        /* i  : scale data of real and imag CLDFB buffers*/
+0 −49
Original line number Diff line number Diff line
@@ -87,16 +87,8 @@ ivas_error ivas_core_enc_fx(
    STEREO_ICBWE_ENC_HANDLE hStereoICBWE;
    STEREO_TD_ENC_DATA_HANDLE hStereoTD;
    Word16 voice_factors_fx[CPE_CHANNELS][NB_SUBFR16k]; /* Q15 */
#ifndef REMOVE_SCALING_SHB_SPEECH
    Word32 shb_speech_fx32[L_FRAME16k];
    Word32 *new_swb_speech_fx;
#endif
    Word16 *inp_fx[CPE_CHANNELS];
    Word16 *shb_speech_fx;
#ifndef REMOVE_SCALING_SHB_SPEECH
    Word16 Q_shb_spch;
    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 */
@@ -114,9 +106,6 @@ ivas_error ivas_core_enc_fx(
    Word16 max_num_indices_BWE;
    Word16 i, shift, Q_min;

#ifndef REMOVE_SCALING_SHB_SPEECH
    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 );
@@ -129,10 +118,6 @@ ivas_error ivas_core_enc_fx(
    error = IVAS_ERR_OK;
    move32();

#ifndef REMOVE_SCALING_SHB_SPEECH
    Q_shb_spch = 0;
    move16();
#endif
    /*------------------------------------------------------------------*
     * General initialization
     *-----------------------------------------------------------------*/
@@ -681,9 +666,6 @@ ivas_error ivas_core_enc_fx(
            Scale_sig( st->input_fx - input_frame, shl( input_frame, 1 ), sub( st->q_inp, q_inp_orig ) );
        }

#ifndef REMOVE_SCALING_SHB_SPEECH
        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] */
@@ -716,11 +698,7 @@ ivas_error ivas_core_enc_fx(
                st->cldfbSynTd->Q_cldfb_state = sub( q_re_im_buf[n], 1 );
            }

#ifdef REMOVE_SCALING_SHB_SPEECH
            swb_pre_proc_ivas_fx( st, new_swb_speech_fx_16, shb_speech_fx, 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 );
        }
@@ -732,16 +710,6 @@ ivas_error ivas_core_enc_fx(
            }
        }

#ifndef REMOVE_SCALING_SHB_SPEECH
        Word16 Q_shb_spch_16 = Q_shb_spch;
        move16();
        IF( st->tcxonly == 0 || hStereoICBWE != NULL || st->core == ACELP_CORE ) // temp. fix to keep BE until #1504 (FLP) is solved, then it will become:
                                                                                 // IF( st->tcxonly == 0 )
        {
            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 );
@@ -749,9 +717,6 @@ ivas_error ivas_core_enc_fx(
                move16();
                Scale_sig( st->hBWE_FD->L_old_wtda_swb_fx, L_FRAME48k, shift ); // st->Q_old_wtda
            }
#ifndef REMOVE_SCALING_SHB_SPEECH
        }
#endif

        /* SWB TBE encoder */
        test();
@@ -764,11 +729,7 @@ ivas_error ivas_core_enc_fx(
                Word16 Q_fb_exc;
                Word16 fb_exc_fx[L_FRAME16k];

#ifdef REMOVE_SCALING_SHB_SPEECH
                swb_tbe_enc_ivas_fx( st, hStereoICBWE, shb_speech_fx, bwe_exc_extended_fx[n], voice_factors_fx[n], fb_exc_fx, &Q_fb_exc, Q_new[n], 0, st->voicing_fx, pitch_buf_fx[n] );
#else
                swb_tbe_enc_ivas_fx( st, hStereoICBWE, shb_speech_fx, bwe_exc_extended_fx[n], voice_factors_fx[n], fb_exc_fx, &Q_fb_exc, Q_new[n], Q_shb_spch_16, st->voicing_fx, pitch_buf_fx[n] );
#endif

                IF( EQ_16( st->extl, FB_TBE ) )
                {
@@ -783,15 +744,8 @@ ivas_error ivas_core_enc_fx(
        }
        ELSE IF( EQ_16( st->extl, SWB_BWE ) || EQ_16( st->extl, FB_BWE ) )
        {
#ifndef REMOVE_SCALING_SHB_SPEECH
            Copy_Scale_sig_32_16( shb_speech_fx32, shb_speech_fx, L_FRAME16k, -Q16 ); // Q_shb_spch - 16
#endif
            /* SWB(FB) BWE encoder */
#ifdef REMOVE_SCALING_SHB_SPEECH
            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_new[n], 1 ) );
#else
            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 ) );
#endif
        }

        Scale_sig( old_syn_12k8_16k_fx[n], L_FRAME16k, sub( Q1, Q_new[n] ) ); // Q0
@@ -813,9 +767,6 @@ 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 */
#ifndef REMOVE_SCALING_SHB_SPEECH
            Copy_Scale_sig_32_16( shb_speech_fx32, shb_speech_fx, L_FRAME16k, negate( Q_shb_spch ) ); // Q0
#endif
            swb_CNG_enc_fx( st, shb_speech_fx, old_syn_12k8_16k_fx[n] );
        }

+0 −12
Original line number Diff line number Diff line
@@ -613,20 +613,10 @@ static void icbwe_dft_stereo_param_fx(

void stereo_icBWE_enc_fx(
    CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure                */
#ifdef REMOVE_SCALING_SHB_SPEECH
    const Word16 shb_speech_ref_fx16[], /* i  : SHB speech ref channel             Q0*/
    Word16 shb_speech_nonref_fx_16[],   /* i/o: SHB speech non-ref channel         shb_speech_nonref_e*/
#else
    const Word32 shb_speech_ref_fx[], /* i  : SHB speech ref channel               shb_speech_ref_e*/
    const Word16 shb_speech_ref_e,    /* i  : SHB speech ref channel               */
    Word32 shb_speech_nonref_fx[],    /* i/o: SHB speech non-ref channel           Q31-shb_speech_nonref_e*/
#endif
    Word16 shb_speech_nonref_e, /* i/o: SHB speech non-ref channel           */
#ifdef REMOVE_SCALING_SHB_SPEECH
    const Word16 *voice_factors_fx16 /* i  : voicing factors                     Q15 */
#else
    const Word32 *voice_factors_fx    /* i  : voicing factors                     Q31 */
#endif
)
{
    Word16 i, j, k, nbSubFr;
@@ -650,7 +640,6 @@ void stereo_icBWE_enc_fx(
    Word32 temp1_fx, temp2_fx;
    Word16 temp1_e, temp2_e, shb_frame_ref_e, shb_frame_nonref_e, gDes_e, tmp, exp;

#ifdef REMOVE_SCALING_SHB_SPEECH
    Word32 shb_speech_ref_fx[L_FRAME16k];
    Word16 shb_speech_ref_e;
    Word32 shb_speech_nonref_fx[L_FRAME48k + STEREO_DFT_OVL_MAX];
@@ -663,7 +652,6 @@ void stereo_icBWE_enc_fx(
    shb_speech_nonref_e = Q15 - shb_speech_nonref_e;
    Copy_Scale_sig_16_32_no_sat( shb_speech_nonref_fx_16, shb_speech_nonref_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
    Copy_Scale_sig_16_32_no_sat( voice_factors_fx16, voice_factors_fx, NB_SUBFR16k, Q16 );                              // Q31
#endif

    /* initialization */
    hStereoDft = hCPE->hStereoDft;
Loading