Commit 3725cb45 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'ltv_crash_msan_fix' into 'main'

MSAN error fix and LTV stereo crash issue fix

See merge request !396
parents d78d9abc ab9aad23
Loading
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -5037,6 +5037,9 @@ static void ivas_param_mc_get_mixing_matrices_fx(
    set_zero_fx( Cproto_fx, MAX_CICP_CHANNELS * MAX_CICP_CHANNELS );
    set_zero_fx( mat_mult_buffer1_fx, MAX_CICP_CHANNELS * MAX_CICP_CHANNELS );
    set_zero_fx( proto_matrix_noLFE_fx, PARAM_MC_MAX_TRANSPORT_CHANS * MAX_CICP_CHANNELS );
#ifdef MSAN_FIX
    set_zero_fx( mixing_matrix_res_local_fx, MAX_CICP_CHANNELS * MAX_CICP_CHANNELS );
#endif
    Word16 proto_matrix_noLFE_e = 0;

    Word16 guard_bit_cx = find_guarded_bits_fx( nY_intern + 1 );
+18 −6
Original line number Diff line number Diff line
@@ -688,7 +688,7 @@ static void stereo_dft_generate_comfort_noise_fx(
    Word32 *ptr0, *ptr1, *ptr2;
    Word16 dmpf[M + 2], Atmp[M + 2];
    Word32 cngNoiseLevel_upd[L_FRAME16k], cngNoiseLevel_hist[L_FRAME16k - 2];
    Word16 e_cng_temp[L_FRAME16k];
    Word16 e_norm_temp[L_FRAME16k];
    Word32 *ptr_tmp, *ptr_cng;
    Word32 E0, E1;
    Word16 b, q_cngNoiseLevel_upd, q_cngNoiseLevel;
@@ -876,7 +876,7 @@ static void stereo_dft_generate_comfort_noise_fx(
        Word16 shift = sub( getScaleFactor32( cngNoiseLevel_upd, st->L_frame ), 1 );
        scale_sig32( cngNoiseLevel_upd, st->L_frame, shift );
        q_cngNoiseLevel_upd = add( q_cngNoiseLevel_upd, shift );
        set16_fx( e_cng_temp, q_cngNoiseLevel_upd, st->L_frame );
        set16_fx( e_norm_temp, q_cngNoiseLevel_upd, st->L_frame );

        /* Compute 1/|A| */
        ptr0 = cngNoiseLevel_upd;
@@ -902,7 +902,7 @@ static void stereo_dft_generate_comfort_noise_fx(
                q_sqrt = s_max( 0, q_sqrt );
            }
            tmp = ISqrt32( ftmp, &q_sqrt );
            e_cng_temp[i] = sub( 31, add( q_sqrt, q_div ) );
            e_norm_temp[i] = sub( 31, add( q_sqrt, q_div ) );
            *ptr0++ = Mpy_32_32( factor, tmp );
            ptr1 += 2;
            ptr2 += 2;
@@ -910,11 +910,11 @@ static void stereo_dft_generate_comfort_noise_fx(

        FOR( i = 0; i < sub( shr( st->L_frame, 1 ), 1 ); i++ )
        {
            q_cngNoiseLevel_upd = s_min( q_cngNoiseLevel_upd, e_cng_temp[i] + norm_l( cngNoiseLevel_upd[i] ) );
            q_cngNoiseLevel_upd = s_min( q_cngNoiseLevel_upd, e_norm_temp[i] + norm_l( cngNoiseLevel_upd[i] ) );
        }
        FOR( i = 0; i < st->L_frame; i++ )
        {
            cngNoiseLevel_upd[i] = L_shl( cngNoiseLevel_upd[i], sub( q_cngNoiseLevel_upd, e_cng_temp[i] ) );
            cngNoiseLevel_upd[i] = L_shl( cngNoiseLevel_upd[i], sub( q_cngNoiseLevel_upd, e_norm_temp[i] ) );
        }

        IF( GT_16( sub( s_min( output_frame, L_FRAME32k ), hFdCngCom->stopFFTbin ), 0 ) )
@@ -952,6 +952,7 @@ static void stereo_dft_generate_comfort_noise_fx(
            ptr0 = shb_shape;
            ptr1 = ptr0 + 2;
            ptr2 = ptr1 + 1;
            set16_fx( e_norm_temp, q_shb_shape, st->L_frame );

            FOR( i = 0; i < L_FRAME16k / 2 - 1; i++ )
            {
@@ -968,10 +969,21 @@ static void stereo_dft_generate_comfort_noise_fx(
                and then sum up  enr = sum( *ptr0 * *ptr0 ),  in a subsequent MAC loop  */
                enr = BASOP_Util_Add_Mant32Exp( enr, q_enr, ftmp, q_div, &q_enr );
                tmp32_1 = Sqrt32( ftmp, &q_div );
                *ptr0++ = L_shl( tmp32_1, sub( q_div, sub( 31, q_shb_shape ) ) );
                *ptr0++ = tmp32_1;
                e_norm_temp[i] = sub( 31, q_div );
                ptr1 += 2;
                ptr2 += 2;
            }
            q_shb_shape = MAX_16;

            FOR( i = 0; i < L_FRAME16k; i++ )
            {
                q_shb_shape = s_min( q_shb_shape, add( e_norm_temp[i], norm_l( shb_shape[i] ) ) );
            }
            FOR( i = 0; i < L_FRAME16k; i++ )
            {
                shb_shape[i] = L_shl( shb_shape[i], sub( q_shb_shape, e_norm_temp[i] ) );
            }
        }

        /* Update CNG noise level from MS noise estimation */