Commit a23b682c authored by vaclav's avatar vaclav
Browse files

consolidate switches REMOVE_SCALING_SHB_SPEECH

parent b951acfe
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -1359,19 +1359,16 @@ 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_BE
#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               */
#endif
#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           */
#ifdef SCALING_SWB_SPEECH_32
#ifdef REMOVE_SCALING_SHB_SPEECH
    const Word16 *voice_factors_fx                              /* i  : voicing factors                  Q15 */
#else
    const Word32 *voice_factors_fx                              /* i  : voicing factors                     Q31 */
+1 −2
Original line number Diff line number Diff line
@@ -107,8 +107,7 @@
#define FIX_2330_CLANG_18_WARNINGS_REND                 /* FhG: Fix renderer warnings */
#define FIX_BASOP_2350_HARM_0B_BWE                      /* VA: basop issue 2350: harmonization of the 0b BWE */
#define FIX_2349_HARM_FIND_UV                           /* VA: basop issue 2349: harmonization of find_uv() function */
#define REMOVE_SCALING_SHB_SPEECH_BE
#define SCALING_SWB_SPEECH_32
#define REMOVE_SCALING_SHB_SPEECH                       /* VA: remove unnecessary scaling and 32-bit buffers from ivas_core_enc_fx() */

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

+2 −2
Original line number Diff line number Diff line
@@ -10338,11 +10338,11 @@ 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
#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_BE
#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             */
+21 −37
Original line number Diff line number Diff line
@@ -87,18 +87,14 @@ 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_BE
#ifndef REMOVE_SCALING_SHB_SPEECH
    Word32 shb_speech_fx32[L_FRAME16k];
#endif
#ifndef SCALING_SWB_SPEECH_32
    Word32 *new_swb_speech_fx;
#endif
    Word16 *inp_fx[CPE_CHANNELS];
    Word16 *shb_speech_fx;
#ifndef REMOVE_SCALING_SHB_SPEECH_BE
#ifndef REMOVE_SCALING_SHB_SPEECH
    Word16 Q_shb_spch;
#endif
#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 */
@@ -118,7 +114,7 @@ ivas_error ivas_core_enc_fx(
    Word16 max_num_indices_BWE;
    Word16 i, shift, Q_min;

#ifndef SCALING_SWB_SPEECH_32
#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++ )
@@ -133,7 +129,7 @@ ivas_error ivas_core_enc_fx(
    error = IVAS_ERR_OK;
    move32();

#ifndef REMOVE_SCALING_SHB_SPEECH_BE
#ifndef REMOVE_SCALING_SHB_SPEECH
    Q_shb_spch = 0;
    move16();
#endif
@@ -701,7 +697,7 @@ ivas_error ivas_core_enc_fx(
         * SWB(FB) BWE encoding
         *---------------------------------------------------------------------*/

#ifndef SCALING_SWB_SPEECH_32
#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;
@@ -736,12 +732,8 @@ ivas_error ivas_core_enc_fx(
                st->cldfbSynTd->Q_cldfb_state = sub( q_re_im_buf[n], 1 );
            }

#ifdef SCALING_SWB_SPEECH_32
#ifdef REMOVE_SCALING_SHB_SPEECH_BE
#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, shb_speech_fx, &Q_shb_spch, realBuffer_fx[n], imagBuffer_fx[n], q_re_im_buf[n], hCPE );
#endif
#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
@@ -756,16 +748,14 @@ ivas_error ivas_core_enc_fx(
            }
        }

#ifndef REMOVE_SCALING_SHB_SPEECH_BE
#ifndef REMOVE_SCALING_SHB_SPEECH
        Word16 Q_shb_spch_16 = Q_shb_spch;
        move16();
#endif
#ifdef FIX_2344_ALIGN_PREPROC
        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 )
#endif
        {
#ifndef REMOVE_SCALING_SHB_SPEECH_BE
            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 );
@@ -777,7 +767,9 @@ 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();
@@ -790,7 +782,7 @@ ivas_error ivas_core_enc_fx(
                Word16 Q_fb_exc;
                Word16 fb_exc_fx[L_FRAME16k];

#ifdef REMOVE_SCALING_SHB_SPEECH_BE
#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] );
@@ -805,11 +797,11 @@ 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_BE
#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_BE
#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 ) );
@@ -828,7 +820,7 @@ 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_BE
#ifndef REMOVE_SCALING_SHB_SPEECH
            Copy_Scale_sig_32_16( shb_speech_fx32, shb_speech_fx, L_FRAME16k, negate( Q_shb_spch ) ); // Q0
#endif
#ifdef HARM_NON_LINEARITY
@@ -842,7 +834,7 @@ ivas_error ivas_core_enc_fx(
         *  Inter-channel BWE encoding
         *-------------------------------------------------------------------*/

#ifndef SCALING_SWB_SPEECH_32
#ifndef REMOVE_SCALING_SHB_SPEECH
        Word16 q_new_swb_speech_buffer = getScaleFactor16( new_swb_speech_buffer_fx_16, L_FRAME48k + STEREO_DFT_OVL_MAX );
        Scale_sig( new_swb_speech_buffer_fx_16, L_FRAME48k + STEREO_DFT_OVL_MAX, q_new_swb_speech_buffer ); // st->q_inp+q_new_swb_speech_buffer
        q_new_swb_speech_buffer = add( st->q_inp, q_new_swb_speech_buffer );
@@ -851,27 +843,19 @@ ivas_error ivas_core_enc_fx(
        test();
        IF( n == 0 && GE_32( input_Fs, 32000 ) && hStereoICBWE != NULL )
        {
#ifndef SCALING_SWB_SPEECH_32
#ifndef REMOVE_SCALING_SHB_SPEECH
            Word32 voice_factors_fx32[CPE_CHANNELS][NB_SUBFR16k];
            stereo_icBWE_preproc_fx( hCPE, input_frame, new_swb_speech_buffer_fx_16 /*tmp buffer*/, q_new_swb_speech_buffer );
#else
            stereo_icBWE_preproc_fx( hCPE, input_frame, new_swb_speech_buffer_fx_16 /*tmp buffer*/, st->q_inp );
#endif

#ifndef SCALING_SWB_SPEECH_32
            q_new_swb_speech_buffer = add( q_new_swb_speech_buffer, Q16 );
            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
            Copy_Scale_sig_16_32_no_sat( voice_factors_fx[0], voice_factors_fx32[0], NB_SUBFR16k, Q16 );                                // Q31
#endif

#ifdef SCALING_SWB_SPEECH_32
#ifdef REMOVE_SCALING_SHB_SPEECH_BE
            stereo_icBWE_enc_fx( hCPE, shb_speech_fx, new_swb_speech_buffer_fx_16, st->q_inp, voice_factors_fx[0] );
#else
            stereo_icBWE_enc_fx( hCPE, shb_speech_fx32, sub( Q31, Q_shb_spch ), new_swb_speech_buffer_fx_16, st->q_inp, voice_factors_fx[0] );
#endif
#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] );
#else
            stereo_icBWE_preproc_fx( hCPE, input_frame, new_swb_speech_buffer_fx_16 /*tmp buffer*/, st->q_inp );

            stereo_icBWE_enc_fx( hCPE, shb_speech_fx, new_swb_speech_buffer_fx_16, st->q_inp, voice_factors_fx[0] );
#endif

            IF( EQ_16( st->element_mode, IVAS_CPE_DFT ) )
+6 −12
Original line number Diff line number Diff line
@@ -619,19 +619,16 @@ static void icbwe_dft_stereo_param_ivas_fx(

void stereo_icBWE_enc_fx(
    CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure                */
#ifdef REMOVE_SCALING_SHB_SPEECH_BE
#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               */
#endif
#ifdef SCALING_SWB_SPEECH_32
    Word16 shb_speech_nonref_fx_16[], /* i/o: SHB speech non-ref channel               shb_speech_nonref_e*/
#else
    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 SCALING_SWB_SPEECH_32
#ifdef REMOVE_SCALING_SHB_SPEECH
    const Word16 *voice_factors_fx16 /* i  : voicing factors                     Q15 */
#else
    const Word32 *voice_factors_fx    /* i  : voicing factors                     Q31 */
@@ -659,18 +656,15 @@ 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_BE
#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];
    Word32 voice_factors_fx[NB_SUBFR16k];

    shb_speech_ref_e = add( getScaleFactor16( shb_speech_ref_fx16, L_FRAME16k ), Q16 );
    Copy_Scale_sig_16_32_no_sat( shb_speech_ref_fx16, shb_speech_ref_fx, L_FRAME16k, shb_speech_ref_e );
    shb_speech_ref_e = Q31 - shb_speech_ref_e;
#endif

#ifdef SCALING_SWB_SPEECH_32
    Word32 shb_speech_nonref_fx[L_FRAME48k + STEREO_DFT_OVL_MAX];
    Word32 voice_factors_fx[NB_SUBFR16k];

    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
Loading