Commit 764c841d authored by vaclav's avatar vaclav
Browse files

updt

parent 8f55cce0
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -2973,7 +2973,12 @@ void swb_CNG_enc_fx(
void swb_CNG_enc_ivas_fx(
#endif
    Encoder_State *st, /* i/o: State structure                                     */
#ifdef REMOVE_SCALING_SHB_SPEECH_BE
    const Word16 *shb_speech_fx_orig, /* i  : SHB target signal (6-14kHz) at 16kHz    Q_shb_spch */
    const Word16 Q_shb_spch,
#else
    const Word16 *shb_speech_fx,      /* i  : SHB target signal (6-14kHz) at 16kHz             Q0 */
#endif
    const Word16 *syn_12k8_16k_fx     /* i  : ACELP core synthesis at 12.8kHz or 16kHz         Q0 */
)
{
@@ -2987,6 +2992,11 @@ void swb_CNG_enc_ivas_fx(
            test();
            IF( GE_32( st->input_Fs, L_FRAME32k * FRAMES_PER_SEC ) )
            {
#ifdef REMOVE_SCALING_SHB_SPEECH_BE
                Word16 shb_speech_fx[L_FRAME16k];
                Copy_Scale_sig( shb_speech_fx_orig, shb_speech_fx, L_FRAME16k, negate( Q_shb_spch ) ); // Q0
#endif

                /* decide if SHB SID encoding or not */
#ifdef HARM_NON_LINEARITY
                shb_SID_updt = shb_DTX_fx( st, shb_speech_fx, syn_12k8_16k_fx );
+4 −0
Original line number Diff line number Diff line
@@ -528,7 +528,11 @@ ivas_error evs_enc_fx(
    test();
    IF( st->Opt_DTX_ON && GE_16( input_frame, L_FRAME32k ) )
    {
#ifdef REMOVE_SCALING_SHB_SPEECH_BE
        swb_CNG_enc_fx( st, shb_speech, 0, old_syn_12k8_16k );
#else
        swb_CNG_enc_fx( st, shb_speech, old_syn_12k8_16k );
#endif
    }

    /*---------------------------------------------------------------------*
+24 −36
Original line number Diff line number Diff line
@@ -776,12 +776,6 @@ ivas_error ivas_core_enc_fx(
                st->cldfbSynTd->Q_cldfb_state = sub( q_re_im_buf[n], 1 );
            }

#ifdef SCALING_SWB_SPEECH_32
            Word32 *new_swb_speech_fx;
            Word32 new_swb_speech_buffer_fx[L_FRAME48k + STEREO_DFT_OVL_MAX];
            set32_fx( new_swb_speech_buffer_fx, 0, L_FRAME48k + STEREO_DFT_OVL_MAX );
            new_swb_speech_fx = new_swb_speech_buffer_fx + STEREO_DFT_OVL_MAX;
#endif
#ifdef SCALING_SWB_SPEECH_32
            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 );
#else
@@ -798,9 +792,10 @@ ivas_error ivas_core_enc_fx(
            }
        }

#ifdef REMOVE_SCALING_SHB_SPEECH_BE
        Word16 flag_shb_scale = 0;  // just temporary to keep BE, it will disappear
#ifdef REMOVE_SCALING_SHB_SPEECH_NONBE
        Word16 shift_shb_spch = 0;
#endif
        Q_shb_spch = 0;
        Word16 Q_shb_spch_16 = Q_shb_spch;
        move16();
#ifdef FIX_2344_ALIGN_PREPROC
@@ -808,11 +803,15 @@ ivas_error ivas_core_enc_fx(
                                                                                 // IF( st->tcxonly == 0 )
#endif
        {
#ifndef REMOVE_SCALING_SHB_SPEECH_BE
            shift = add( getScaleFactor16( shb_speech_fx, L_FRAME16k ), Q16 );
#ifdef REMOVE_SCALING_SHB_SPEECH_NONBE
            shift_shb_spch = shift;
#endif
#ifndef REMOVE_SCALING_SHB_SPEECH_NONBE
            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
            Q_shb_spch = add( Q_shb_spch, shift );

            IF( st->hBWE_FD )
            {
                shift = getScaleFactor16( st->hBWE_FD->L_old_wtda_swb_fx, L_FRAME48k );
@@ -844,13 +843,9 @@ ivas_error ivas_core_enc_fx(
        }
        ELSE IF( EQ_16( st->extl, SWB_BWE ) || EQ_16( st->extl, FB_BWE ) )
        {
#ifdef REMOVE_SCALING_SHB_SPEECH_BE
            flag_shb_scale = 1;
            shift = add( getScaleFactor16( shb_speech_fx, L_FRAME16k ), Q16 );
            Q_shb_spch = add( Q_shb_spch_16, shift );
            Copy_Scale_sig_16_32_no_sat( shb_speech_fx, shb_speech_fx32, L_FRAME16k, shift ); // Q_shb_spch                        
#endif
#ifndef REMOVE_SCALING_SHB_SPEECH_BE
            Copy_Scale_sig_32_16( shb_speech_fx32, shb_speech_fx, L_FRAME16k, -Q16 ); // Q_shb_spch - 16
#endif
            /* SWB(FB) BWE encoder */
            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 ) );
        }
@@ -867,18 +862,15 @@ 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 */
#ifdef REMOVE_SCALING_SHB_SPEECH_BE
            if( flag_shb_scale == 0 )
            {
                flag_shb_scale = 1;
                shift = add( getScaleFactor16( shb_speech_fx, L_FRAME16k ), Q16 );
                Q_shb_spch = add( Q_shb_spch_16, shift );
                Copy_Scale_sig_16_32_no_sat( shb_speech_fx, shb_speech_fx32, L_FRAME16k, shift ); // Q_shb_spch                
            }
#endif
#ifndef REMOVE_SCALING_SHB_SPEECH_BE
            Copy_Scale_sig_32_16( shb_speech_fx32, shb_speech_fx, L_FRAME16k, negate( Q_shb_spch ) ); // Q0
#endif
#ifdef HARM_NON_LINEARITY
#ifdef REMOVE_SCALING_SHB_SPEECH_BE
            swb_CNG_enc_fx( st, shb_speech_fx, Q_shb_spch_16, old_syn_12k8_16k_fx[n] );
#else
            swb_CNG_enc_fx( st, shb_speech_fx /* Unmodified */, old_syn_12k8_16k_fx[n] );
#endif
#else
            swb_CNG_enc_ivas_fx( st, shb_speech_fx /* Unmodified */, old_syn_12k8_16k_fx[n] );
#endif
@@ -901,20 +893,16 @@ ivas_error ivas_core_enc_fx(
#endif
            stereo_icBWE_preproc_fx( hCPE, input_frame, new_swb_speech_buffer_fx_16 /*tmp buffer*/, q_new_swb_speech_buffer );

            q_new_swb_speech_buffer = add( q_new_swb_speech_buffer, 16 );
            q_new_swb_speech_buffer = add( q_new_swb_speech_buffer, Q16 );
#ifndef SCALING_SWB_SPEECH_32
            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 REMOVE_SCALING_SHB_SPEECH_BE
            if ( flag_shb_scale == 0 )
            {
                shift = add( getScaleFactor16( shb_speech_fx, L_FRAME16k ), Q16 );
                Q_shb_spch = add( Q_shb_spch_16, shift );
                Copy_Scale_sig_16_32_no_sat( shb_speech_fx, shb_speech_fx32, L_FRAME16k, shift ); // Q_shb_spch
            }
#ifdef REMOVE_SCALING_SHB_SPEECH_NONBE
            Copy_Scale_sig_16_32_no_sat( shb_speech_fx, shb_speech_fx32, L_FRAME16k, shift_shb_spch ); // Q_shb_spch
#endif

#ifdef SCALING_SWB_SPEECH_32
            stereo_icBWE_enc_fx( hCPE, shb_speech_fx32, sub( Q31, Q_shb_spch ), new_swb_speech_buffer_fx_16, sub( Q31, q_new_swb_speech_buffer ), voice_factors_fx[0] );
#else
+8 −3
Original line number Diff line number Diff line
@@ -641,7 +641,12 @@ void swb_bwe_enc_ivas_fx(

void swb_CNG_enc_fx(
    Encoder_State *st_fx,             /* i/o: State structure                                 */
#ifdef REMOVE_SCALING_SHB_SPEECH_BE
    const Word16 *shb_speech_fx_orig, /* i  : SHB target signal (6-14kHz) at 16kHz Q_shb_spch */
    const Word16 Q_shb_spch,
#else
    const Word16 *shb_speech_fx, /* i  : SHB target signal (6-14kHz) at 16kHz            */
#endif
    const Word16 *syn_12k8_16k_fx /* i  : ACELP core synthesis at 12.8kHz or 16kHz        */
);

+11 −1
Original line number Diff line number Diff line
@@ -262,6 +262,7 @@ void wb_bwe_enc_ivas_fx(
 *
 * SWB BWE encoder (only for 32kHz signals)
 *-------------------------------------------------------------------*/

void swb_bwe_enc_ivas_fx(
    Encoder_State *st_fx,              /* i/o: encoder state structure                  */
    const Word16 last_element_mode,    /* i  : last element mode                       */
@@ -270,7 +271,11 @@ void swb_bwe_enc_ivas_fx(
    const Word16 *old_syn_12k8_16k_fx, /* i  : ACELP core synthesis at 12.8kHz or 16kHz */
    const Word16 *new_swb_speech_fx,   /* i  : original input signal at 32kHz           */
    const Word16 Q_new_swb_speech,     /* i  : Q for new_swb_speech_fx                  */
#ifdef REMOVE_SCALING_SHB_SPEECH_BE
    Word16 *shb_speech_fx_orig, /* i  : SHB target signal (6-14kHz) at 16kHz     */
#else
    Word16 *shb_speech_fx, /* i  : SHB target signal (6-14kHz) at 16kHz     */
#endif
    Word16 Q_shb_speech,
    Word16 Q_slb_speech )
{
@@ -304,6 +309,11 @@ void swb_bwe_enc_ivas_fx(
    move16();
    Word16 fb_band_begin;
    Word16 q_new_input_hp;
#ifdef REMOVE_SCALING_SHB_SPEECH_BE
    Word16 shb_speech_fx[L_FRAME16k];

    Copy_Scale_sig( shb_speech_fx_orig, shb_speech_fx, L_FRAME16k, Q_shb_speech ); // Q_shb_spch
#endif

    FD_BWE_ENC_HANDLE hBWE_FD = st_fx->hBWE_FD;
    TD_BWE_ENC_HANDLE hBWE_TD = st_fx->hBWE_TD;
Loading