Commit ad4102ca authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

MSAN fix for decoder, mld improvement changes for stereo

parent 54c3d2e3
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1874,7 +1874,9 @@ ivas_error acelp_core_dec_ivas_fx(
            scale_sig32_r( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); // (Q_real-1)
            st->cldfbSynHB->Q_cldfb_state = sub( Q_real, 1 );
            move16();
#ifndef MSAN_FIX
            Scale_sig32( save_hb_synth_fx, L_FRAME48k, sub( Q_real, 1 ) ); // Q_real-1
#endif

            FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ )
            {
+6 −4
Original line number Diff line number Diff line
@@ -1706,20 +1706,22 @@ void stereo_dft_enc_process_fx(

            IF( alpha_fx >= 0 )
            {
                c_fx = shr( c_fx, 1 );
                s_fx = shr( s_fx, 1 );
                FOR( i = 1; i < hStereoDft->NFFT / 2; i++ )
                {
                    // tmp = s * c1 + c * s1;
                    tmp_fx = add_sat( mult_r( s_fx, c1_fx ), mult_r( c_fx, s1_fx ) ); // saturation expected
                    tmp_fx = add( mult_r( s_fx, c1_fx ), mult_r( c_fx, s1_fx ) );
                    // c = c * c1 - s * s1;
                    c_fx = sub_sat( mult_r( c_fx, c1_fx ), mult_r( s_fx, s1_fx ) ); // saturation expected
                    c_fx = sub( mult_r( c_fx, c1_fx ), mult_r( s_fx, s1_fx ) );
                    s_fx = tmp_fx;
                    move16();

                    /*time shift of L*/
                    // tmp = pDFT_L[2 * i] * c - pDFT_L[2 * i + 1] * s;
                    tmp_32fx = BASOP_Util_Add_Mant32Exp( Mpy_32_16_1( pDFT_L_fx[2 * i], c_fx ), DFT_L_e_tmp[2 * i], L_negate( Mpy_32_16_1( pDFT_L_fx[2 * i + 1], s_fx ) ), DFT_L_e_tmp[2 * i + 1], &tmp_e );
                    tmp_32fx = BASOP_Util_Add_Mant32Exp( Mpy_32_16_1( pDFT_L_fx[2 * i], c_fx ), add( DFT_L_e_tmp[2 * i], 1 ), L_negate( Mpy_32_16_1( pDFT_L_fx[2 * i + 1], s_fx ) ), add( DFT_L_e_tmp[2 * i + 1], 1 ), &tmp_e );
                    // pDFT_L[2 * i + 1] = pDFT_L[2 * i] * s + pDFT_L[2 * i + 1] * c;
                    pDFT_L_fx[2 * i + 1] = BASOP_Util_Add_Mant32Exp( Mpy_32_16_1( pDFT_L_fx[2 * i], s_fx ), DFT_L_e_tmp[2 * i], Mpy_32_16_1( pDFT_L_fx[2 * i + 1], c_fx ), DFT_L_e_tmp[2 * i + 1], &DFT_L_e_tmp[2 * i + 1] );
                    pDFT_L_fx[2 * i + 1] = BASOP_Util_Add_Mant32Exp( Mpy_32_16_1( pDFT_L_fx[2 * i], s_fx ), add( DFT_L_e_tmp[2 * i], 1 ), Mpy_32_16_1( pDFT_L_fx[2 * i + 1], c_fx ), add( DFT_L_e_tmp[2 * i + 1], 1 ), &DFT_L_e_tmp[2 * i + 1] );
                    move32();
                    // pDFT_L[2 * i] = tmp;
                    pDFT_L_fx[2 * i] = tmp_32fx;
+1 −1
Original line number Diff line number Diff line
@@ -1892,7 +1892,7 @@ void stereo_tca_enc_fx(
        ELSE
        {
            v_multc_fixed( bufChanL_fx, ONE_IN_Q29, bufChanL_fx, L_MEM_RECALC_48K + L_MEM_RECALC_48k_SCH + L_FRAME48k + L_NCSHIFTMAX );                              /* TO make in common Q bufChan_q -2*/
            Copy32( ptrChanL_fx + add( prevNCShift, sub( lMemRecalc, lMemRecalc_SCh ) ), input_mem_loc_fx[0], add( lMemRecalc, lMemRecalc_SCh ) );                   // bufChan_q -2
            Copy32( ptrChanL_fx + sub( prevNCShift, add( lMemRecalc, lMemRecalc_SCh ) ), input_mem_loc_fx[0], add( lMemRecalc, lMemRecalc_SCh ) );                   // bufChan_q -2
            v_multc_fixed( ptrChanR_fx - add( lMemRecalc, lMemRecalc_SCh ), hStereoTCA->prevTargetGain_fx, input_mem_loc_fx[1], add( lMemRecalc, lMemRecalc_SCh ) ); // bufChan_q -2
            v_multc_fixed( bufChanR_fx, ONE_IN_Q29, bufChanR_fx, L_MEM_RECALC_48K + L_MEM_RECALC_48k_SCH + L_FRAME48k + L_NCSHIFTMAX );                              /* TO make in common Q bufChan_q -2*/
        }
+7 −7
Original line number Diff line number Diff line
@@ -1722,7 +1722,6 @@ Word16 tdm_lp_comparison_fx(
    Word32 dist_fx, ftmp_fx;
    Word16 i;
    Word32 res_fx[L_FRAME16k];
    Word16 gb1 = find_guarded_bits_fx( M );

    Word16 Q_A_SCh;
    Word32 *speech_fx = &speech_buff[M];
@@ -1733,8 +1732,8 @@ Word16 tdm_lp_comparison_fx(
    // residu( A_SCh, m, speech, res, L_frame );

    Word16 gb = find_guarded_bits_fx( L_frame );
    scale_sig32( speech_buff, L_FRAME + M, gb1 ); /* Q_speech + gb1 */
    Word16 exp = sub( 31, Q_speech );
    scale_sig32( speech_buff, L_FRAME + M, Q4 ); /* Q_speech + 4 */
    Word16 exp = sub( Q27, Q_speech );
    Word32 sum2_value = sum2_32_exp_fx( speech_fx, L_frame, &exp, gb ); // 2*Q_speech -31-gb
    IF( LT_16( exp, -5 ) )                                              /*maximum q to prevent 0.01 from saturating is 37, since we are adding it headroom of 1 is required*/
    {
@@ -1746,7 +1745,7 @@ Word16 tdm_lp_comparison_fx(
    Word32 temp32_log = L_add( BASOP_Util_Log2( sum2_value ), L_shl( sub( Q31, sub( 31, exp ) ), Q25 ) ); /* Q25 */
    ener_sig_fx = Mpy_32_32( temp32_log, 646456623 );                                                     // Q25
    // ener_sig = log10f( sum2_f( speech, L_frame ) + 0.01f );
    exp = sub( 31, sub( Q_speech, gb1 ) );
    exp = sub( Q31, Q_speech );
    sum2_value = sum2_32_exp_fx( res_fx, L_frame, &exp, gb );                                      // 2*Q_speech -31-gb
    sum2_value = BASOP_Util_Add_Mant32Exp( sum2_value, exp, 328, Q16, &exp );                      /* Q31-exp */
    temp32_log = L_add( BASOP_Util_Log2( sum2_value ), L_shl( sub( Q31, sub( 31, exp ) ), Q25 ) ); /* Q25 */
@@ -1757,9 +1756,9 @@ Word16 tdm_lp_comparison_fx(

    /* Find prediction gain when resuing the Primary Channel LP filter */
    // residu( A_PCh, m, speech, res, L_frame );
    scale_sig32( speech_buff, L_FRAME + M, negate( gb1 ) ); /* Q_speech */
    scale_sig32( speech_buff, L_FRAME + M, -4 ); /* Q_speech */
    residu_ivas_fx( A_PCh_fx, sub( 14, norm_s( A_PCh_fx[0] ) ), m, speech_fx, res_fx, L_frame );
    exp = sub( 31, sub( Q_speech, gb1 ) );
    exp = sub( Q31, Q_speech );
    sum2_value = sum2_32_exp_fx( res_fx, L_frame, &exp, gb ); // 2*Q_speech -31-gb
    sum2_value = BASOP_Util_Add_Mant32Exp( sum2_value, exp, 328, Q16, &exp );
    temp32_log = L_add( BASOP_Util_Log2( sum2_value ), L_shl( sub( Q31, sub( 31, exp ) ), Q25 ) ); /* Q25 */
@@ -1771,7 +1770,8 @@ Word16 tdm_lp_comparison_fx(
    /* Find Euclidian distance between the 2 filters */
    dist_fx = 0;
    move16();
    gb = find_guarded_bits_fx( M );
    gb = 4;
    move16();
    FOR( i = 0; i < m; i++ )
    {
        // ftmp = isp_SCh[i] - isp_PCh[i];