Commit b0876092 authored by vaclav's avatar vaclav
Browse files

Merge remote-tracking branch 'remotes/origin/main' into cleanup_of_switches_leftovers

parents 3c022b6d 6a3fdbb9
Loading
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -4706,6 +4706,8 @@ Word32 dot_product_cholesky_fx(
    const Word32 *A, /* i  : Cholesky  matrix A              */
    const Word16 N   /* i  : vector & matrix size            */
);

#ifndef DOT_PROD_CHOLESKY_64BIT
Word32 dot_product_cholesky_fixed(
    const Word32 *x, /* i  : vector x                        */
    const Word32 *A, /* i  : Cholesky  matrix A              */
@@ -4713,6 +4715,13 @@ Word32 dot_product_cholesky_fixed(
    const Word16 exp_x,
    const Word16 exp_A,
    Word16 *exp_sum );
#else
Word64 dot_product_cholesky_fixed(
    const Word32 *x, /* i  : vector x                        */
    const Word32 *A, /* i  : Cholesky  matrix A              */
    const Word16 N   /* i  : vector & matrix size            */
);
#endif

void v_mult_mat_fx(
    Word32 *y_fx, /* o  : the product x*A                         */
@@ -5857,8 +5866,7 @@ ivas_error ivas_compute_core_buffers_fx(
    Word16 lsp_mid_fx[M],                  /* i/o: LSPs in the middle of the frame          */
    Word16 Q_old_inp_16k,
    Word16 Q_r[2],
    Word16 *Q_new,
    Word16 downscale_buf_speech_enc_pe );
    Word16 *Q_new );

ivas_error ivas_enc_fx(
    Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure      */
+39 −0
Original line number Diff line number Diff line
@@ -606,6 +606,7 @@ void v_sub32_fx(
 * Therefore, S=A*A' where A is upper triangular matrix of size (m*m+m)/2 (zeros ommitted, column-wise)
 *---------------------------------------------------------------------*/

#ifndef DOT_PROD_CHOLESKY_64BIT
/*! r: the dot product x'*A*A'*x */
Word32 dot_product_cholesky_fixed(
    const Word32 *x, /* i  : vector x                        Q31 - exp_x*/
@@ -642,6 +643,44 @@ Word32 dot_product_cholesky_fixed(

    return suma;
}
#else
/*! r: the dot product x'*A*A'*x */
Word64 dot_product_cholesky_fixed(
    const Word32 *x, /* i  : vector x                        Q31 - exp_x*/
    const Word32 *A, /* i  : Cholesky  matrix A              Q31 - exp_A*/
    const Word16 N   /* i  : vector & matrix size            Q0*/
)
{
    Word16 i, j;
    Word64 suma, tmp_sum;
    Word32 mul;
    Word32 tmp;
    const Word32 *pt_x, *pt_A;
    pt_A = A;
    suma = 0;
    move64();

    FOR( i = 0; i < N; i++ )
    {
        tmp_sum = 0;
        move32();
        pt_x = x;

        FOR( j = 0; j <= i; j++ )
        {
            mul = Mpy_32_32( *pt_x++, *pt_A++ );
            tmp_sum = W_add( tmp_sum, W_deposit32_l( mul ) );
        }

        tmp_sum = W_shr( tmp_sum, 4 ); // to make sure that the tmp_sum will not overflow
        tmp = W_extract_l( tmp_sum );
        suma = W_mac_32_32( suma, tmp, tmp );
    }

    return suma;
}
#endif

void v_mult_mat_fixed(
    Word32 *y,       /* o  : the product x*A               Qx - guardbits*/
    const Word32 *x, /* i  : vector x                      Qx*/
+1 −0
Original line number Diff line number Diff line
@@ -169,4 +169,5 @@
#define NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD      /* VA/Eri: FLP issue 1277: Fix Mismatch in DTX high-rate threshold between EVS float and BASOP */
#define NONBE_FIX_708_OSBA_BR_SWITCHING_CRASH   /* FhG: issue 708: fix crash in OSBA BR switching with long test vectors */
//#define OPT_STEREO_32KBPS_V1                    /* Optimization made in stereo decoding path for 32kbps decoding */
#define DOT_PROD_CHOLESKY_64BIT                 /* FhG: Issue 1323, optimized 64 bit implementation of dot_product_cholesky() */
#endif
+1 −0
Original line number Diff line number Diff line
@@ -761,6 +761,7 @@ void preemph_ivas_fx(
    const Word16 L,  /* i  : vector size        Q0*/
    Word32 *mem      /* i/o: memory (x[-1])     Qx*/
);

void cb_shape(
    const int16_t preemphFlag,     /* i  : flag for pre-emphasis                       */
    const int16_t pitchFlag,       /* i  : flag for pitch sharpening                   */
+30 −17
Original line number Diff line number Diff line
@@ -1375,6 +1375,7 @@ static void init_sig_buffers_ivas_fx( Encoder_State *st, const Word16 L_frame_ol
            }

            // Copy_Scale_sig( st->old_wsp_fx, st->buf_wspeech_enc + st->L_frame + L_SUBFR - L_WSP_MEM, L_WSP_MEM, sub( st->prev_Q_new, st->prev_Q_old ) );
            Scale_sig( st->buf_wspeech_enc, L_FRAME16k + L_SUBFR + L_FRAME16k + L_NEXT_MAX_16k + 320, sub( 0, sub( st->exp_old_wsp, st->exp_buf_wspeech_enc ) ) );
            Copy( st->old_wsp_fx, st->buf_wspeech_enc + st->L_frame + L_SUBFR - L_WSP_MEM, L_WSP_MEM );
            st->exp_buf_wspeech_enc = st->exp_old_wsp;
            move16();
@@ -1384,26 +1385,37 @@ static void init_sig_buffers_ivas_fx( Encoder_State *st, const Word16 L_frame_ol
            test();
            IF( EQ_16( st->L_frame, L_FRAME ) && !st->tcxonly )
            {
                // Copy_Scale_sig( st->old_inp_12k8_fx, st->buf_speech_enc_pe + st->L_frame - L_INP_MEM, L_INP_MEM, sub( st->prev_Q_new, st->prev_Q_old ) );
                if ( st->exp_buf_speech_enc_pe >= st->exp_old_inp_12k8 )
                {
                    Copy_Scale_sig( st->old_inp_12k8_fx, st->buf_speech_enc_pe + st->L_frame - L_INP_MEM, L_INP_MEM, sub( st->exp_old_inp_12k8, st->exp_buf_speech_enc_pe ) ); // Scaling to common Q
                    // st->buf_speech_enc_pe is in st->exp_buf_speech_enc_pe
                }
                else
                {
                    Scale_sig( st->buf_speech_enc_pe, L_PAST_MAX_32k + L_FRAME32k + L_NEXT_MAX_32k, sub( st->exp_buf_speech_enc_pe, st->exp_old_inp_12k8 ) ); // Scaling to common Q
                    Copy( st->old_inp_12k8_fx, st->buf_speech_enc_pe + st->L_frame - L_INP_MEM, L_INP_MEM );
                /* SCaling to common exponent*/
                Scale_sig( st->buf_speech_enc_pe + sub( st->L_frame, L_INP_MEM ), L_INP_MEM, sub( st->exp_old_inp_12k8, s_max( st->exp_old_inp_12k8, st->exp_buf_speech_enc_pe ) ) );                                           // Q(15-max( st->exp_old_inp_12k8, st->exp_buf_speech_enc_pe ))
                Scale_sig( st->buf_speech_enc_pe, sub( st->L_frame, L_INP_MEM ), sub( st->exp_buf_speech_enc_pe, s_max( st->exp_old_inp_12k8, st->exp_buf_speech_enc_pe ) ) );                                                  // Q(15-max( st->exp_old_inp_12k8, st->exp_buf_speech_enc_pe ))
                Scale_sig( st->buf_speech_enc_pe + st->L_frame, sub( L_PAST_MAX_32k + L_FRAME32k + L_NEXT_MAX_32k, st->L_frame ), sub( st->exp_buf_speech_enc_pe, s_max( st->exp_old_inp_12k8, st->exp_buf_speech_enc_pe ) ) ); // Q(15-max( st->exp_old_inp_12k8, st->exp_buf_speech_enc_pe ))
                st->exp_buf_speech_enc_pe = s_max( st->exp_old_inp_12k8, st->exp_buf_speech_enc_pe );
                    st->exp_buf_speech_enc_pe = st->exp_old_inp_12k8;
                    // st->buf_speech_enc_pe is in st->exp_buf_speech_enc_pe
                    move16();
                }
            }
            ELSE IF( EQ_16( st->L_frame, L_FRAME16k ) && !st->tcxonly )
            {
                lerp( st->buf_wspeech_enc + st->L_frame + L_SUBFR - L_WSP_MEM, st->buf_wspeech_enc + st->L_frame + L_SUBFR - 310, 310, L_WSP_MEM );
                if ( st->exp_buf_speech_enc_pe >= st->exp_old_inp_16k )
                {
                    Copy_Scale_sig( st->old_inp_16k_fx, st->buf_speech_enc_pe + st->L_frame - L_INP_MEM, L_INP_MEM, sub( st->exp_old_inp_16k, st->exp_buf_speech_enc_pe ) ); // Scaling to common Q
                    // st->buf_speech_enc_pe is in st->exp_buf_speech_enc_pe
                }
                else
                {
                    Scale_sig( st->buf_speech_enc_pe, L_PAST_MAX_32k + L_FRAME32k + L_NEXT_MAX_32k, sub( st->exp_buf_speech_enc_pe, st->exp_old_inp_16k ) ); // Scaling to common Q
                    Copy( st->old_inp_16k_fx, st->buf_speech_enc_pe + st->L_frame - L_INP_MEM, L_INP_MEM );
                /* SCaling to common exponent*/
                Scale_sig( st->buf_speech_enc_pe + sub( st->L_frame, L_INP_MEM ), L_INP_MEM, sub( st->exp_old_inp_16k, s_max( st->exp_old_inp_16k, st->exp_buf_speech_enc_pe ) ) );
                Scale_sig( st->buf_speech_enc_pe, sub( st->L_frame, L_INP_MEM ), sub( st->exp_buf_speech_enc_pe, s_max( st->exp_old_inp_16k, st->exp_buf_speech_enc_pe ) ) );
                Scale_sig( st->buf_speech_enc_pe + st->L_frame, sub( L_PAST_MAX_32k + L_FRAME32k + L_NEXT_MAX_32k, st->L_frame ), sub( st->exp_buf_speech_enc_pe, s_max( st->exp_old_inp_16k, st->exp_buf_speech_enc_pe ) ) );
                st->exp_buf_speech_enc_pe = s_max( st->exp_old_inp_16k, st->exp_buf_speech_enc_pe );
                    st->exp_buf_speech_enc_pe = st->exp_old_inp_16k;
                    // st->buf_speech_enc_pe is in st->exp_buf_speech_enc_pe
                    move16();
                }
            }

            st->mem_preemph_enc = st->buf_speech_enc[st->encoderPastSamples_enc + st->encoderLookahead_enc - 1];
            move16();
@@ -1416,6 +1428,7 @@ static void init_sig_buffers_ivas_fx( Encoder_State *st, const Word16 L_frame_ol
        ELSE IF( !st->tcxonly && GE_32( last_total_brate, ACELP_32k ) )
        {

            Scale_sig( st->buf_wspeech_enc, L_FRAME16k + L_SUBFR + L_FRAME16k + L_NEXT_MAX_16k + 320, sub( 0, sub( st->exp_old_wsp, st->exp_buf_wspeech_enc ) ) );
            Copy( st->old_wsp_fx, st->buf_wspeech_enc + st->L_frame + L_SUBFR - L_WSP_MEM, L_WSP_MEM );
            // Copy_Scale_sig( st->old_wsp_fx, st->buf_wspeech_enc + st->L_frame + L_SUBFR - L_WSP_MEM, L_WSP_MEM, sub( st->prev_Q_new, st->prev_Q_old ) );
            st->exp_buf_wspeech_enc = st->exp_old_wsp;
Loading