Commit cb9bb9a7 authored by Manuel Jander's avatar Manuel Jander
Browse files

Do not scale st->mem_decim16k_fx to Q(-1). Decouple scale of...

Do not scale st->mem_decim16k_fx to Q(-1). Decouple scale of st->buf_speech_enc_pe and st->buf_speech_enc from Qnew.
parent 07648776
Loading
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -9648,6 +9648,15 @@ void Copy_Scale_sig(
    const Word16 exp0 /* i  : exponent: x = round(x << exp)   Qx ?exp  */
);
#ifdef NONBE_FIX_ISSUE_2206
void Copy_Scale_sig_nosat(
    const Word16 x[], /* i  : signal to scale i             Qx        */
    Word16 y[],       /* o  : scaled signal output            Qx        */
    const Word16 lg,  /* i  : size of x[]                     Q0        */
    const Word16 exp0 /* i  : exponent: x = round(x << exp)   Qx ?exp  */
);
#endif
void Scale_sig32(
    Word32 x[],       /* i/o: signal to scale                 Qx        */
    const Word16 lg,  /* i  : size of x[]                     Q0        */
+45 −0
Original line number Diff line number Diff line
@@ -1304,6 +1304,51 @@ void Copy_Scale_sig(
    return;
}

#ifdef NONBE_FIX_ISSUE_2206
/*-------------------------------------------------------------------*
 * Copy_Scale_sig
 *
 * Up/down scale a 16 bits vector x and move it into y
 *-------------------------------------------------------------------*/

void Copy_Scale_sig_nosat(
    const Word16 x[], /* i  : signal to scale input           Qx        */
    Word16 y[],       /* o  : scaled signal output            Qx        */
    const Word16 lg,  /* i  : size of x[]                     Q0        */
    const Word16 exp0 /* i  : exponent: x = round(x << exp)   Qx ?exp  */
)
{
    Word16 i;
    Word16 tmp;

    IF( exp0 == 0 )
    {
        FOR( i = 0; i < lg; i++ )
        {
            y[i] = x[i];
            move16();
        }
        return;
    }
    IF( exp0 < 0 )
    {
        tmp = shl( -32768, exp0 ); /* we use negative to correctly represent 1.0 */
        FOR( i = 0; i < lg; i++ )
        {
            y[i] = msu_r( 0, x[i], tmp );
            move16();
        }
        return;
    }
    FOR( i = 0; i < lg; i++ )
    {
        y[i] = shl( x[i], exp0 );
        move16(); /* saturation can occur here */
    }

    return;
}
#endif

/*-------------------------------------------------------------------*
 * Copy_Scale_sig
+2 −0
Original line number Diff line number Diff line
@@ -611,9 +611,11 @@ void core_signal_analysis_high_bitrate_ivas_fx(
    move16();
    IF( Q_exp != 0 )
    {
#ifndef NONBE_FIX_ISSUE_2206
        Scale_sig( st->buf_speech_enc_pe, st->encoderPastSamples_enc + st->encoderLookahead_enc, sub( Q_exp, sub( Q15, st->exp_buf_speech_enc_pe ) ) ); // *Q_new
        st->exp_buf_speech_enc_pe = sub( Q15, Q_exp );
        move16();
#endif
        Scale_sig( &( st->mem_wsp_enc ), 1, Q_exp ); // *Q_new
    }

+3 −0
Original line number Diff line number Diff line
@@ -389,6 +389,9 @@ ivas_error init_encoder_fx(
        st->Bin_E_old_fx = st->hSignalBuf->Bin_E_old_fx;
        st->mem_decim_fx = st->hSignalBuf->mem_decim_fx;
        st->mem_decim16k_fx = st->hSignalBuf->mem_decim16k_fx;
#ifdef NONBE_FIX_ISSUE_2206
        st->q_mem_decim16k_fx = Q15;
#endif
        st->old_inp_12k8_fx = st->hSignalBuf->old_inp_12k8_fx;
        st->old_inp_16k_fx = st->hSignalBuf->old_inp_16k_fx;
        st->buf_speech_enc_pe = st->hSignalBuf->buf_speech_enc_pe;
+1 −0
Original line number Diff line number Diff line
@@ -829,6 +829,7 @@ ivas_error ivas_core_enc_fx(
        }

        Scale_sig( old_syn_12k8_16k_fx[n], L_FRAME16k, sub( Q1, Q_new[n] ) ); // Q0

        /*---------------------------------------------------------------------*
         * SWB DTX/CNG encoding
         *---------------------------------------------------------------------*/
Loading