Commit 098a015d authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Fix for MSAN ASAN error in decoder, renderer crash fix and macro code cleanup

parent fe8d6785
Loading
Loading
Loading
Loading
Loading
+1 −10
Original line number Diff line number Diff line
@@ -266,11 +266,7 @@ ivas_error ivas_core_dec_fx(
        test();
        test();
        test();
#ifdef NONBE_MDCT_ST_PLC_DO_NOT_SCALE_OLD_OUT_IF_FIRST_GOOD_IS_SID
        IF( !st->bfi && st->prev_bfi && GT_32( st->total_brate, SID_2k40 ) && ( EQ_16( st->last_core_bfi, TCX_20_CORE ) || EQ_16( st->last_core_bfi, TCX_10_CORE ) ) && st->hTcxDec != NULL )
#else
        IF( !st->bfi && st->prev_bfi && ( EQ_16( st->last_core_bfi, TCX_20_CORE ) || EQ_16( st->last_core_bfi, TCX_10_CORE ) ) && st->hTcxDec != NULL )
#endif
        {
            conceal_eof_gain32 = L_shr_sat( st->hTcxDec->conceal_eof_gain32, sub( 16, st->hTcxDec->conceal_eof_gain_e ) ); // e = 31 - Q , 16 - e => 16 - (31 - Q) => Q - 15,
                                                                                                                           // shr(16 -e ) = shr(Q -15) => 15 - Q ==> Q15
@@ -604,7 +600,7 @@ ivas_error ivas_core_dec_fx(

            st->hHQ_core->Q_old_wtda_LB = st->hHQ_core->Q_old_wtda;
            move16();
            Copy_Scale_sig_16_32_DEPREC( output_16_fx[n], output_32_fx[n], L_FRAME48k, Q11 ); // Q11
            Copy_Scale_sig_16_32_DEPREC( output_16_fx[n], output_32_fx[n], output_frame, Q11 ); // Q11

            IF( st->hTcxDec )
            {
@@ -771,13 +767,8 @@ ivas_error ivas_core_dec_fx(

        test();
        test();
#ifdef NONBE_MDCT_ST_DTX_SKIP_DEWHITENING_OF_NOISE_SHAPES_ON_SID_FRAMES
        /* On first good active frame after frameloss undo the whitening of the bg noise shape */
        IF( GT_32( sts[0]->core_brate, SID_2k40 ) && sts[0]->bfi == 0 && EQ_16( sts[0]->prev_bfi, 1 ) )
#else
        IF( sts[0]->bfi == 0 && EQ_16( sts[0]->prev_bfi, 1 ) )
        /* On first good frame after frameloss undo the whitening of the bg noise shape */
#endif
        {
            FOR( n = 0; n < n_channels; ++n )
            {
+19 −2
Original line number Diff line number Diff line
@@ -1446,10 +1446,27 @@ void ivas_qmetadata_to_dirac_fx(
            {
                FOR( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b )
                {
                    hSpatParamRendCom->azimuth[meta_write_index][b] = extract_h( L_shr( q_direction->band_data[band].azimuth_fx[block], 6 ) );
                    /* Right shifting -1 -> -1, Hence this change is done */
                    Word32 L_tmp = L_abs( q_direction->band_data[band].azimuth_fx[block] );
                    hSpatParamRendCom->azimuth[meta_write_index][b] = extract_h( L_shr( L_tmp, 6 ) );
                    move16();
                    hSpatParamRendCom->elevation[meta_write_index][b] = extract_h( L_shr( q_direction->band_data[band].elevation_fx[block], 6 ) );

                    IF( q_direction->band_data[band].azimuth_fx[block] < 0 )
                    {
                        hSpatParamRendCom->azimuth[meta_write_index][b] = negate( hSpatParamRendCom->azimuth[meta_write_index][b] );
                        move16();
                    }

                    L_tmp = L_abs( q_direction->band_data[band].elevation_fx[block] );
                    hSpatParamRendCom->elevation[meta_write_index][b] = extract_h( L_shr( L_tmp, 6 ) );
                    move16();

                    IF( q_direction->band_data[band].elevation_fx[block] < 0 )
                    {
                        hSpatParamRendCom->elevation[meta_write_index][b] = negate( hSpatParamRendCom->elevation[meta_write_index][b] );
                        move16();
                    }

                    hSpatParamRendCom->energy_ratio1_fx[meta_write_index][b] = q_direction->band_data[band].energy_ratio_fx[block];
                    move32();
                    hSpatParamRendCom->diffuseness_vector_fx[meta_write_index][b] = L_sub( ONE_IN_Q30, q_direction->band_data[band].energy_ratio_fx[block] );
+8 −5
Original line number Diff line number Diff line
@@ -8511,13 +8511,16 @@ static void intermidiate_ext_dirac_render(
            move16();
#endif
        }
        IF( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx != NULL )
        {

            tmp = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_len );
            scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_len, tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q + tmp) */
            hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q = add( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, tmp );
            move16();
        }

        IF( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx != 0 )
        IF( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx != NULL )
        {
            tmp = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_len );
            scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_len, tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q + tmp) */