Commit 42a08c2d authored by vaclav's avatar vaclav
Browse files

formal improvements

parent 59fa101c
Loading
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -10245,6 +10245,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      */
@@ -10263,7 +10264,7 @@ void swb_pre_proc_ivas_fx(
#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                     */
+2 −2
Original line number Diff line number Diff line
@@ -419,7 +419,7 @@ ivas_error evs_enc_fx(
    {
        /* Common pre-processing for WB TBE and WB BWE */
#ifdef HARMONIZE_TBE2
        wb_pre_proc_ivas_fx( st, EVS_MONO, new_inp_resamp16k, hb_speech );
        wb_pre_proc_fx( st, EVS_MONO, new_inp_resamp16k, hb_speech );
#else
        wb_pre_proc_fx( st, new_inp_resamp16k, hb_speech );
        /* o: new_inp_resamp16k at Q = -1 */
@@ -455,7 +455,7 @@ ivas_error evs_enc_fx(
    {
        /* Common pre-processing for SWB(FB) TBE and SWB BWE */
#ifdef HARMONIZE_TBE2
        swb_pre_proc_ivas_fx( st, new_swb_speech, shb_speech, realBuffer, imagBuffer, 0, &cldfbScale, NULL );
        swb_pre_proc_fx( st, new_swb_speech, shb_speech, realBuffer, imagBuffer, 0, &cldfbScale, NULL );
#else
        swb_pre_proc_fx( st, st->input_fx, new_swb_speech, shb_speech, &Q_shb_spch, realBuffer, imagBuffer, &cldfbScale );
#endif
+12 −5
Original line number Diff line number Diff line
@@ -658,7 +658,11 @@ ivas_error ivas_core_enc_fx(
        IF( GE_32( input_Fs, 16000 ) && LT_16( st->bwidth, SWB ) && st->hBWE_TD != NULL )
        {
            /* Common pre-processing for WB TBE and WB BWE */
#ifdef HARMONIZE_TBE2
            wb_pre_proc_fx( st, last_element_mode, new_inp_resamp16k_fx[n], hb_speech_fx );
#else
            wb_pre_proc_ivas_fx( st, last_element_mode, new_inp_resamp16k_fx[n], hb_speech_fx );
#endif
        }

        test();
@@ -706,10 +710,17 @@ ivas_error ivas_core_enc_fx(
        shb_speech_fx = new_inp_resamp16k_fx[n]; /* reuse existing buffer: shb_speech[L_FRAME16k] */

        test();
#ifdef HARMONIZE_TBE2
        IF( GE_32( input_Fs, 32000 ) && st->hBWE_TD != NULL )
#else
        test();
        IF( !st->Opt_SC_VBR && GE_32( input_Fs, 32000 ) && st->hBWE_TD != NULL )
#endif
        {
            /* Common pre-processing for SWB(FB) TBE and SWB(FB) BWE */
#ifdef HARMONIZE_TBE2
            swb_pre_proc_fx( st, new_swb_speech_fx_16, shb_speech_fx, realBuffer_fx[n], imagBuffer_fx[n], q_re_im_buf[n], NULL, hCPE );
#else
            /* Scaling cldfb_state_fx */
            Word16 q_shift, scf_cldfb;
            scf_cldfb = L_norm_arr( st->cldfbSynTd->cldfb_state_fx, st->cldfbSynTd->p_filter_length );
@@ -732,18 +743,14 @@ ivas_error ivas_core_enc_fx(
                scale_sig32( st->cldfbSynTd->cldfb_state_fx, st->cldfbSynTd->p_filter_length, q_shift ); // st->cldfbSynTd->Q_cldfb_state -> q_realImagBuffer
                st->cldfbSynTd->Q_cldfb_state = sub( q_re_im_buf[n], 1 );
            }

#ifdef REMOVE_SCALING_SHB_SPEECH
#ifdef HARMONIZE_TBE2
            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], NULL, hCPE );
#else
            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 );
#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

            st->cldfbSynTd->Q_cldfb_state = sub( q_re_im_buf[n], 1 );
#endif
        }
        ELSE IF( GE_32( input_Fs, 32000 ) )
        {
+20 −1
Original line number Diff line number Diff line
@@ -593,6 +593,22 @@ void swb_CNG_enc_fx(
);

void swb_pre_proc_fx(
#ifdef HARMONIZE_TBE2
    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*/
    const CLDFB_SCALE_FACTOR *cldfbScale,                       /* i : scale data of real and imag CLDFB buffers */
    CPE_ENC_HANDLE hCPE                                         /* i/o: CPE encoder structure                    */
#else
    Encoder_State *st_fx,                                       /* i/o: encoder state structure                 */
    const Word16 *input_fx,                                     /* i  : original i   signal                     */
    Word16 *new_swb_speech_fx,                                  /* o  : original i   signal at 32kHz            */
@@ -601,6 +617,7 @@ void swb_pre_proc_fx(
    Word32 realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : real buffer                              */
    Word32 imagBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : imag buffer                              */
    const CLDFB_SCALE_FACTOR *cldfbScale                        /* i : scale data of real and imag CLDFB buffers*/
#endif
);

void InitSWBencBufferStates_fx(
@@ -687,12 +704,14 @@ void wb_bwe_enc_ivas_fx(
);

void wb_pre_proc_fx(
#ifndef HARMONIZE_TBE2
    Encoder_State *st_fx,            /* i/o: encoder state structure             */
    const Word16 *new_inp_resamp16k, /* i  : original i   signal                 */
    Word16 *hb_speech                /* o  : HB target signal (6-8kHz) at 16kHz  */
);

void wb_pre_proc_ivas_fx(
#endif
    Encoder_State *st_fx,            /* i/o: encoder state structure                   */
    const Word16 last_element_mode,  /* i  : last element mode                         */
    const Word16 *new_inp_resamp16k, /* i  : original input signal in Q-1              */
+32 −1
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
/*========================================================================*/

void wb_pre_proc_fx(
#ifndef HARMONIZE_TBE2
    Encoder_State *st_fx,            /* i/o: encoder state structure                   */
    const Word16 *new_inp_resamp16k, /* i  : original input signal in Q-1              */
    Word16 *hb_speech                /* o  : HB target signal (6-8kHz) at 16kHz in Q-1 */
@@ -189,6 +190,7 @@ void wb_pre_proc_fx(
/*========================================================================*/

void wb_pre_proc_ivas_fx(
#endif
    Encoder_State *st_fx,            /* i/o: encoder state structure                   */
    const Word16 last_element_mode,  /* i  : last element mode                         */
    const Word16 *new_inp_resamp16k, /* i  : original input signal in Q-1              */
@@ -521,7 +523,6 @@ void wb_pre_proc_ivas_fx(
/* _ (Word16*) new_swb_speech_fx : original input signal at 16kHz    Q0   */
/* _ (Word16*) shb_speech_fx     : original input signal at 16kHz    Q0   */
/*------------------------------------------------------------------------*/

/* st_fx->old_input_fx                                                    */
/* st_fx->old_wtda_shb_fx                                                 */
/*------------------------------------------------------------------------*/
@@ -530,6 +531,7 @@ void wb_pre_proc_ivas_fx(
/*========================================================================*/

void swb_pre_proc_fx(
#ifndef HARMONIZE_TBE2
    Encoder_State *st_fx,      /* i/o: encoder state structure                */
    const Word16 *input_fx,    /* i  : original input signal                  */
    Word16 *new_swb_speech_fx, /* o  : original input signal at 32kHz         */
@@ -807,6 +809,7 @@ void swb_pre_proc_fx(
 *-------------------------------------------------------------------*/

void swb_pre_proc_ivas_fx(
#endif
    Encoder_State *st,      /* i/o: encoder state structure                     */
    Word16 *new_swb_speech, /* o  : original input signal at 32kHz - st->q_inp  */
#ifndef REMOVE_SCALING_SHB_SPEECH
@@ -1293,6 +1296,31 @@ void swb_pre_proc_ivas_fx(
#endif
        ELSE
        {
#ifdef HARMONIZE_TBE2
            /* Scaling cldfb_state_fx */
            Word16 q_shift, scf_cldfb;
            scf_cldfb = L_norm_arr( st->cldfbSynTd->cldfb_state_fx, st->cldfbSynTd->p_filter_length );

            scale_sig32( st->cldfbSynTd->cldfb_state_fx, st->cldfbSynTd->p_filter_length, scf_cldfb );
            st->cldfbSynTd->Q_cldfb_state = add( st->cldfbSynTd->Q_cldfb_state, scf_cldfb );

            q_shift = sub( sub( q_reImBuffer, 1 ), st->cldfbSynTd->Q_cldfb_state ); // cldfb_state_fx will be used in cldfbSynthesis_ivas_fx and has to be aligned with (q_re_im_buf[n] - 1)
            IF( GT_32( q_shift, 0 ) )
            {
                FOR( ts = 0; ts < CLDFB_NO_COL_MAX; ts++ )
                {
                    scale_sig32( realBuffer[ts], CLDFB_NO_CHANNELS_MAX, negate( q_shift ) );
                    scale_sig32( imagBuffer[ts], CLDFB_NO_CHANNELS_MAX, negate( q_shift ) );
                }
                q_reImBuffer = add( st->cldfbSynTd->Q_cldfb_state, 1 );
            }
            ELSE
            {
                scale_sig32( st->cldfbSynTd->cldfb_state_fx, st->cldfbSynTd->p_filter_length, q_shift ); // st->cldfbSynTd->Q_cldfb_state -> q_realImagBuffer
                st->cldfbSynTd->Q_cldfb_state = sub( q_reImBuffer, 1 );
            }

#endif
            IF( EQ_16( st->L_frame, L_FRAME ) )
            {
                startB = 34;
@@ -1419,6 +1447,9 @@ void swb_pre_proc_ivas_fx(
#ifndef REMOVE_SCALING_SHB_SPEECH
            *Q_shb_spch = 0;
            move16();
#endif
#ifdef HARMONIZE_TBE2
            st->cldfbSynTd->Q_cldfb_state = sub( q_reImBuffer, 1 );
#endif
        }