Commit 792164f0 authored by vaclav's avatar vaclav
Browse files

Merge branch 'basop-2399-remove-duplicated-code-tbe-2' into 'main'

Remove duplicated code: TBE, step 2

Closes #2399

See merge request !2788
parents 0572c5cf bcbedc35
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@
#define FIX_FLOAT_1522_LTV_MSAN_QMETADATA_ENC_EC3       /* Nokia: float issue 1522: fix uninit MSAN in EC3 of qmetadata encoding */
#define FIX_2410_HARM_MODIF_FS                          /* VA: basop issue 2410: Remove duplicated modif_Fs */
#define HARM_LEV_DURBIN                                 /* VA: basop issue 2423: harmonize levinson-Durbin algorithm */
#define HARMONIZE_TBE2                                  /* VA: basop issue 2399: Remove duplicated code: TBE, step 2 */

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

+16 −6
Original line number Diff line number Diff line
@@ -2891,6 +2891,7 @@ void flip_spectrum_and_decimby4_fx(
);
void GenShapedWBExcitation_fx(
#ifndef HARMONIZE_TBE2
    Word16 *excSHB,                   /* o   : synthesized shaped shb exctiation      */
    const Word16 *lpc_shb,            /* i   : lpc coefficients                       */
    Word16 *exc4kWhtnd,               /* o   : whitened synthesized shb excitation    */
@@ -2908,8 +2909,8 @@ void GenShapedWBExcitation_fx(
    const Word16 signal_type,
    const Word16 igf_flag );
#ifdef HARMONIZE_TBE
void GenShapedWBExcitation_ivas_fx(
#endif
    Word16 *excSHB,                   /* o  : synthesized shaped shb exctiation   Q_bwe_exc*/
    const Word16 *lpc_shb,            /* i  : lpc coefficients Q12                         */
    Word16 *exc4kWhtnd,               /* o  : whitened synthesized shb excitation Q_bwe_exc*/
@@ -2928,7 +2929,6 @@ void GenShapedWBExcitation_ivas_fx(
    const Word16 igf_flag             /* i  : IGF flag                                     */
);
#endif
void GenWBSynth_fx(
    const Word16 *input_synspeech, /* i  : i   synthesized speech                  */
    Word16 *shb_syn_speech_16k,    /* o  : output highband compnent                */
@@ -2967,7 +2967,12 @@ void GenShapedSHBExcitation_fx(
    const Word32 bitrate,
    const Word16 prev_bfi );
#ifdef HARMONIZE_TBE2
void GenShapedSHBExcitation_ivas_fx(
    const Word16 enc_dec, /* i  : encoder/decoder flag */
#else
void GenShapedSHBExcitation_ivas_enc_fx(
#endif
    Word16 *excSHB,                      /* o  : synthesized shaped shb excitation Q_bwe_exc*/
    const Word16 *lpc_shb,               /* i  : lpc coefficients Q12*/
    Word16 *White_exc16k_FB,             /* o  : white excitation for the Fullband extension Q_bwe_exc_fb */
@@ -3012,6 +3017,7 @@ void GenShapedSHBExcitation_ivas_enc_fx(
    Word16 Env_error_part[]       /* o  : per-segment error in SHB residual envelope modelling */
);
#ifndef HARMONIZE_TBE2
void GenShapedSHBExcitation_ivas_dec_fx(
    Word16 *excSHB,                      /* o : synthesized shaped shb excitation Q_bwe_exc*/
    const Word16 *lpc_shb,               /* i : lpc coefficients Q12*/
@@ -3053,7 +3059,7 @@ void GenShapedSHBExcitation_ivas_dec_fx(
    Word16 *Env_error,            /* o  : error in SHB residual envelope modelling*/
    Word16 Env_error_part[]       /* o  : per-segment error in SHB residual envelope modelling */
);
#endif
void GenSHBSynth_fx(
    const Word16 *shb_target_speech,  /* i  : i   synthesized speech                */
    Word16 *shb_syn_speech_32k,       /* o  : output highband component               */
@@ -10091,7 +10097,7 @@ void v_sub32_fx(
    const Word16 N     /* i  : Vector length                                    */
);
void ivas_swb_tbe_dec_fx(
void swb_tbe_dec_ivas_fx(
    Decoder_State *st,                    /* i/o: decoder state structure                           */
    STEREO_ICBWE_DEC_HANDLE hStereoICBWE, /* i/o: IC-BWE state structure                            */
    const Word32 *bwe_exc_extended_fx,    /* i  : bandwidth extended excitation : Q_exc             */
@@ -10257,6 +10263,7 @@ void Copy_Scale_sig32(
    const Word16 exp0 /* i  : exponent: x = round(x << exp)   Qx ?exp  */
);
#ifndef HARMONIZE_TBE2
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      */
@@ -10264,9 +10271,12 @@ void swb_pre_proc_ivas_fx(
    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*/
#ifdef HARMONIZE_TBE2
    const CLDFB_SCALE_FACTOR *cldfbScale, /* i : scale data of real and imag CLDFB buffers */
#endif
    CPE_ENC_HANDLE hCPE /* i/o: CPE encoder structure                    */
);
#endif
/* o  : Q(2x - 31 - gb)                      */
Word32 sum2_f_32_fx(
    const Word32 *vec, /* i  : input vector, Qx                     */
+518 −139

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
@@ -1118,7 +1118,7 @@ ivas_error ivas_core_dec_fx(
        IF( flaf_swb_tbe )
        {
            /* SWB TBE decoder */
            ivas_swb_tbe_dec_fx( st, hStereoICBWE, bwe_exc_extended_fx[n], st->Q_exc, voice_factors_fx[n], old_syn_12k8_16k_fx[n], tmp_buffer_fx /*fb_exc*/, hb_synth_32_fx[n], pitch_buf_fx[n], &Q_white_exc );
            swb_tbe_dec_ivas_fx( st, hStereoICBWE, bwe_exc_extended_fx[n], st->Q_exc, voice_factors_fx[n], old_syn_12k8_16k_fx[n], tmp_buffer_fx /*fb_exc*/, hb_synth_32_fx[n], pitch_buf_fx[n], &Q_white_exc );

            Copy_Scale_sig_16_32_no_sat( hBWE_TD->syn_overlap_fx, hBWE_TD->syn_overlap_fx_32, L_SHB_LAHEAD, sub( Q11, hBWE_TD->prev_Q_bwe_syn2 ) ); // Q11
            Copy_Scale_sig_32_16( hBWE_TD->old_tbe_synth_fx_32, hBWE_TD->old_tbe_synth_fx, L_SHB_TRANSITION_LENGTH, sub( hBWE_TD->prev_Qx, Q11 ) ); // prev_Qx
+21 −2
Original line number Diff line number Diff line
@@ -977,6 +977,12 @@ void ivas_wb_tbe_dec_fx(

        Q_bwe_exc_ext = sub( Q_bwe_exc, 16 );

#ifdef HARMONIZE_TBE2
        GenShapedWBExcitation_fx( shaped_wb_excitation + L_SHB_LAHEAD / 4, lpc_wb, exc4kWhtnd, hBWE_TD->mem_csfilt_fx,
                                  hBWE_TD->mem_genSHBexc_filt_down_shb_fx, hBWE_TD->mem_genSHBexc_filt_down_wb2_fx,
                                  hBWE_TD->mem_genSHBexc_filt_down_wb3_fx, hBWE_TD->state_lpc_syn_fx, coder_type, st_fx->element_mode,
                                  bwe_exc_extended_16, Q_bwe_exc_ext, hBWE_TD->bwe_seed, vf_modified, uv_flag, st_fx->igf );
#else
#ifdef HARMONIZE_TBE
        IF( st_fx->element_mode == EVS_MONO )
        {
@@ -993,6 +999,7 @@ void ivas_wb_tbe_dec_fx(
                                           hBWE_TD->mem_genSHBexc_filt_down_wb3_fx, hBWE_TD->state_lpc_syn_fx, coder_type, st_fx->element_mode,
                                           bwe_exc_extended_16, Q_bwe_exc_ext, hBWE_TD->bwe_seed, vf_modified, uv_flag, st_fx->igf );
        }
#endif

        curr_pow = 0;
        move32();
@@ -5641,12 +5648,12 @@ static void find_max_mem_dec_m3(


/*-------------------------------------------------------------------*
 * ivas_swb_tbe_dec_fx()
 * swb_tbe_dec_ivas_fx()
 *
 * SWB TBE decoder, 6 - 14 kHz (or 7.5 - 15.5 kHz) band decoding module
 *-------------------------------------------------------------------*/

void ivas_swb_tbe_dec_fx(
void swb_tbe_dec_ivas_fx(
    Decoder_State *st,                    /* i/o: decoder state structure                           */
    STEREO_ICBWE_DEC_HANDLE hStereoICBWE, /* i/o: IC-BWE state structure                            */
    const Word32 *bwe_exc_extended_fx,    /* i  : bandwidth extended excitation : Q_exc             */
@@ -6404,6 +6411,17 @@ void ivas_swb_tbe_dec_fx(
    move16();

    Copy( hBWE_TD->state_syn_shbexc_fx, shaped_shb_excitation_fx, L_SHB_LAHEAD );

#ifdef HARMONIZE_TBE2
    GenShapedSHBExcitation_ivas_fx( DEC, shaped_shb_excitation_fx + L_SHB_LAHEAD, lpc_shb_fx, White_exc16k_fx,
                                    hBWE_TD->mem_csfilt_fx, hBWE_TD->mem_genSHBexc_filt_down_shb_fx, hBWE_TD->state_lpc_syn_fx,
                                    st->coder_type, bwe_exc_extended_16, hBWE_TD->bwe_seed, vf_modified_fx, st->extl,
                                    &( hBWE_TD->tbe_demph_fx ), &( hBWE_TD->tbe_premph_fx ), lpc_shb_sf_fx, shb_ener_sf_32,
                                    shb_res_gshape_fx, shb_res_dummy_fx, &vind, formant_fac_fx, hBWE_TD->fb_state_lpc_syn_fx,
                                    &( hBWE_TD->fb_tbe_demph_fx ), &Q_bwe_exc, &Q_bwe_exc_fb, Q_shb, n_mem2, hBWE_TD->prev_Q_bwe_syn, st->total_brate, st->prev_bfi,
                                    st->element_mode, st->flag_ACELP16k, nlExc16k_fx, NULL, mixExc16k_fx, NULL, st->extl_brate, MSFlag,
                                    NULL, 0, &( hBWE_TD->prev_pow_exc16kWhtnd_fx32 ), &( hBWE_TD->prev_mix_factor_fx ), NULL, NULL );
#else
    GenShapedSHBExcitation_ivas_dec_fx( shaped_shb_excitation_fx + L_SHB_LAHEAD, lpc_shb_fx, White_exc16k_fx,
                                        hBWE_TD->mem_csfilt_fx, hBWE_TD->mem_genSHBexc_filt_down_shb_fx, hBWE_TD->state_lpc_syn_fx,
                                        st->coder_type, bwe_exc_extended_16, hBWE_TD->bwe_seed, vf_modified_fx, st->extl,
@@ -6412,6 +6430,7 @@ void ivas_swb_tbe_dec_fx(
                                        &( hBWE_TD->fb_tbe_demph_fx ), &Q_bwe_exc, &Q_bwe_exc_fb, Q_shb, n_mem2, hBWE_TD->prev_Q_bwe_syn, st->total_brate, st->prev_bfi,
                                        st->element_mode, st->flag_ACELP16k, nlExc16k_fx, mixExc16k_fx, st->extl_brate, MSFlag,
                                        NULL, &( hBWE_TD->prev_pow_exc16kWhtnd_fx32 ), &( hBWE_TD->prev_mix_factor_fx ), NULL, NULL );
#endif

    *Q_white_exc = Q_bwe_exc_fb;
    move16();
Loading