Commit 3bb9ecf0 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

MSAN fixes, float buffer cleanup in ivas_dirac_dec_render_sf

[x] MSAN error fixes
[x] Cleanup of buffers/variables in MASA_STEREO_TYPE_DETECT , COMBINED_ORIENTATION_DATA, ivas_cov_smooth_cfg_t, ISM_METADATA_FRAME, IVAS_QDIRECTION_BAND_DATA, PARAM_ISM_CONFIG_DATA structures
[x] ivas_jbm_dec_copy_tc_no_tsm integration in evs_dec_main
parent 1d43b578
Loading
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -826,11 +826,6 @@ void masa_sample_rate_band_correction_fx(
    {
        FOR( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ )
        {
#if 1 /* TODO: remove float code */
            hQMetaData->q_direction[0].band_data[band].azimuth[sf] = 0.0f;
            hQMetaData->q_direction[0].band_data[band].elevation[sf] = 0.0f;
            hQMetaData->q_direction[0].band_data[band].energy_ratio[sf] = 0.0f;
#endif
            hQMetaData->q_direction[0].band_data[band].azimuth_fx[sf] = 0;
            move32();
            hQMetaData->q_direction[0].band_data[band].elevation_fx[sf] = 0;
@@ -845,11 +840,6 @@ void masa_sample_rate_band_correction_fx(

            IF( EQ_16( (Word16) hQMetaData->no_directions, 2 ) )
            {
#if 1 /* TODO: remove float code */
                hQMetaData->q_direction[1].band_data[band].azimuth[sf] = 0.0f;
                hQMetaData->q_direction[1].band_data[band].elevation[sf] = 0.0f;
                hQMetaData->q_direction[1].band_data[band].energy_ratio[sf] = 0.0f;
#endif
                hQMetaData->q_direction[1].band_data[band].azimuth_fx[sf] = 0;
                move32();
                hQMetaData->q_direction[1].band_data[band].elevation_fx[sf] = 0;
+17 −16
Original line number Diff line number Diff line
@@ -60,11 +60,11 @@ typedef struct
    int16_t last_ism_metadata_flag;       /* last frame ism_metadata_flag */

#ifdef IVAS_FLOAT_FIXED
    Word32 azimuth_fx;                        /* azimuth value read from the input metadata file */ // q = 22
    Word32 elevation_fx;                      /* elevation value read from the input metadata file */ // q = 22
    Word16 radius_fx;                         /* radius value read from the input metadata file */ // q = 9
    Word32 yaw_fx;                            /* yaw value read from the input metadata file */ // q = 22
    Word32 pitch_fx;                          /* pitch value read from the input metadata file */ // q = 22
    Word32 azimuth_fx;                        /* azimuth value read from the input metadata file */ /* Q22 */
    Word32 elevation_fx;                      /* elevation value read from the input metadata file */ /* Q22 */
    Word16 radius_fx;                         /* radius value read from the input metadata file */ /* Q9 */
    Word32 yaw_fx;                            /* yaw value read from the input metadata file */ /* Q22 */
    Word32 pitch_fx;                          /* pitch value read from the input metadata file */ /* Q22 */
#endif
    float azimuth;                        /* azimuth value read from the input metadata file */
    float elevation;                      /* elevation value read from the input metadata file */
@@ -84,10 +84,10 @@ typedef struct
    float last_true_azimuth;              /* MD smoothing in DTX- last true Q azimuth value */
    float last_true_elevation;            /* MD smoothing in DTX- last true Q elevation value */
#ifdef IVAS_FLOAT_FIXED
    Word32 last_azimuth_fx;        /* MD smoothing in DTX- last Q azimuth value */
    Word32 last_elevation_fx;      /* MD smoothing in DTX - last Q elevation value */
    Word32 last_true_azimuth_fx;   /* MD smoothing in DTX- last true Q azimuth value */
    Word32 last_true_elevation_fx; /* MD smoothing in DTX- last true Q elevation value */
    Word32 last_azimuth_fx;        /* MD smoothing in DTX- last Q azimuth value */ /* Q22 */
    Word32 last_elevation_fx;      /* MD smoothing in DTX - last Q elevation value */ /* Q22 */
    Word32 last_true_azimuth_fx;   /* MD smoothing in DTX- last true Q azimuth value */ /* Q22 */
    Word32 last_true_elevation_fx; /* MD smoothing in DTX- last true Q elevation value */ /* Q22 */
#endif

    int16_t ism_md_fec_cnt_enc;           /* counter of continuous frames where MD are not transmitted */
@@ -232,9 +232,9 @@ typedef struct ivas_spar_md_prev_t
typedef struct ivas_quant_coeffs_t
{
    float min;
    Word32 min_fx;
    Word32 min_fx; /* Q28 */
    float max;
    Word32 max_fx;
    Word32 max_fx; /* Q28 */
    int16_t q_levels[2];
} ivas_quant_coeffs_t;

@@ -375,20 +375,21 @@ typedef struct ivas_cov_smooth_state_t
    int16_t num_bins;
#ifdef IVAS_FLOAT_FIXED
    Word32 *pPrior_cov_real_fx[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH];
    Word32 *pSmoothing_factor_fx;
    Word32 *pSmoothing_factor_fx; /* Q31 */
#endif

} ivas_cov_smooth_state_t;

typedef struct ivas_cov_smooth_cfg_t
{
#ifndef IVAS_FLOAT_FIXED
    float max_update_rate;
#else
    Word32 max_update_rate_fx; /* Q31 */
#endif
    int16_t min_pool_size;
    int16_t max_bands;
    int16_t num_bins;
#ifdef IVAS_FLOAT_FIXED
    Word32 max_update_rate_fx;
#endif

} ivas_cov_smooth_cfg_t;

@@ -636,7 +637,7 @@ typedef struct ivas_param_mc_conf_struct /* structure for ROM Table */
    const float *ild_factors;
#ifdef IVAS_FLOAT_FIXED
    const Word16 *ild_factors_fx;
    const Word32 *dmx_fac_fx;
    const Word32 *dmx_fac_fx; /* Q31 */
#endif

} PARAM_MC_CONF;
+1 −30
Original line number Diff line number Diff line
@@ -3514,7 +3514,7 @@ void ivas_dirac_dec_render_sf_fx(
            offset = i_mult( hSpatParamRendCom->num_freq_bands, add( hSpatParamRendCom->slots_rendered, slot_idx ) );
            FOR( ch = 0; ch < nchan_transport; ch++ )
            {
                floatToFixed_arrL32( &st_ivas->hTcBuffer->tc[hDirACRend->sba_map_tc[ch]][offset], &st_ivas->hTcBuffer->tc_fx[hDirACRend->sba_map_tc[ch]][offset], Q11, hSpatParamRendCom->num_freq_bands );
                //floatToFixed_arrL32( &st_ivas->hTcBuffer->tc[hDirACRend->sba_map_tc[ch]][offset], &st_ivas->hTcBuffer->tc_fx[hDirACRend->sba_map_tc[ch]][offset], Q11, hSpatParamRendCom->num_freq_bands );
                floatToFixed_arrL32( st_ivas->cldfbAnaDec[ch]->cldfb_state, st_ivas->cldfbAnaDec[ch]->cldfb_state_fx, Q11, ( st_ivas->cldfbAnaDec[ch]->p_filter_length - st_ivas->cldfbAnaDec[ch]->no_channels ) );
            }
        }
@@ -3522,7 +3522,6 @@ void ivas_dirac_dec_render_sf_fx(

    IF( EQ_16( st_ivas->nchan_transport, 1 ) && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && !( L_or( EQ_16( st_ivas->ivas_format, SBA_FORMAT ), EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) ) )
    {
        floatToFixed_arrL32( st_ivas->hTcBuffer->tc[1], st_ivas->hTcBuffer->tc_fx[1], Q11, hSpatParamRendCom->num_freq_bands );
        floatToFixed_arrL32( st_ivas->cldfbAnaDec[1]->cldfb_state, st_ivas->cldfbAnaDec[1]->cldfb_state_fx, Q11, ( st_ivas->cldfbAnaDec[1]->p_filter_length - st_ivas->cldfbAnaDec[1]->no_channels ) );
    }

@@ -3553,10 +3552,6 @@ void ivas_dirac_dec_render_sf_fx(
                ELSE
                {
                    floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) );
                    IF( hDirACRend->masa_stereo_type_detect )
                    {
                        hDirACRend->masa_stereo_type_detect->subtract_power_y_fx = floatToFixed(hDirACRend->masa_stereo_type_detect->subtract_power_y, hDirACRend->masa_stereo_type_detect->q_subtract_power_y);
                    }
                }
                BREAK;
            case 1:
@@ -3688,15 +3683,6 @@ void ivas_dirac_dec_render_sf_fx(
    ELSE
    {
        floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE );
        IF( hDirACRend->masa_stereo_type_detect != NULL )
        {
            hDirACRend->masa_stereo_type_detect->q_target_power_y_smooth = L_get_q( hDirACRend->masa_stereo_type_detect->target_power_y_smooth );
            hDirACRend->masa_stereo_type_detect->target_power_y_smooth_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->target_power_y_smooth, hDirACRend->masa_stereo_type_detect->q_target_power_y_smooth );
            hDirACRend->masa_stereo_type_detect->q_subtract_power_y = L_get_q( hDirACRend->masa_stereo_type_detect->subtract_power_y );
            hDirACRend->masa_stereo_type_detect->q_subtract_power_y_smooth = L_get_q( hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth );
            hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth, hDirACRend->masa_stereo_type_detect->q_subtract_power_y_smooth );
            hDirACRend->masa_stereo_type_detect->subtract_power_y_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->subtract_power_y, hDirACRend->masa_stereo_type_detect->q_subtract_power_y );
        }

        hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, size_ho );
        floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev, size_ho );
@@ -5108,10 +5094,6 @@ void ivas_dirac_dec_render_sf_fx(
        fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) );
        fixedToFloat_arrL32( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f, hDirACRend->proto_frame_f_q, i_mult( 6, hSpatParamRendCom->num_freq_bands ) );
        fixedToFloat_arrL32( reference_power_fx, DirAC_mem.reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands );
        IF( hDirACRend->masa_stereo_type_detect )
        {
            hDirACRend->masa_stereo_type_detect->subtract_power_y = fixedToFloat_32( hDirACRend->masa_stereo_type_detect->subtract_power_y_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y );
        }
    }
    ELSE
    {
@@ -5136,10 +5118,6 @@ void ivas_dirac_dec_render_sf_fx(
                {
                    fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, i_mult( hSpatParamRendCom->subframe_nbslots[subframe_idx], i_mult( 4, hSpatParamRendCom->num_freq_bands ) ) );
                    fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) );
                    IF( hDirACRend->masa_stereo_type_detect )
                    {
                        hDirACRend->masa_stereo_type_detect->subtract_power_y = fixedToFloat_32( hDirACRend->masa_stereo_type_detect->subtract_power_y_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y );
                    }
                }
                me2f_buf( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_q, hDirACRend->proto_frame_f, i_mult( 6, hSpatParamRendCom->num_freq_bands ) );
                fixedToFloat_arrL32( reference_power_fx, DirAC_mem.reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands );
@@ -5254,13 +5232,6 @@ void ivas_dirac_dec_render_sf_fx(
    }
    ELSE
    {
        IF( hDirACRend->masa_stereo_type_detect != NULL )
        {
            hDirACRend->masa_stereo_type_detect->target_power_y_smooth = fixedToFloat( hDirACRend->masa_stereo_type_detect->target_power_y_smooth_fx, hDirACRend->masa_stereo_type_detect->q_target_power_y_smooth );
            hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth = fixedToFloat( hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y );
            hDirACRend->masa_stereo_type_detect->subtract_power_y = fixedToFloat( hDirACRend->masa_stereo_type_detect->subtract_power_y_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y );
        }

        fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth, size );
        fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, size_ho );
        fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth, size );
+4 −0
Original line number Diff line number Diff line
@@ -2304,7 +2304,11 @@ Word16 computeMixingMatricesResidual_fx(
    Word32 mat_mult_buffer3_fx[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS];
    Word16 mixing_matrix_e = 0, mat_mult_buffer1_e, adj_e, mat_mult_buffer3_e, mat_mult_buffer2_e;

#ifdef MSAN_FIX
	Word32 svd_s_buffer_fx[MAX_OUTPUT_CHANNELS] = { 0 };
#else
    Word32 svd_s_buffer_fx[MAX_OUTPUT_CHANNELS];
#endif
    Word16 svd_s_buffer_fx_e;
    Word32 L_tmp;
    Word16 tmp_e;
+0 −6
Original line number Diff line number Diff line
@@ -1370,12 +1370,6 @@ ivas_error ivas_ism_metadata_dec_create_fx(
        move32();
        st_ivas->hIsmMetaData[ch]->last_elevation_fx = 0;
        move32();
#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED
        st_ivas->hIsmMetaData[ch]->last_true_azimuth = 0;
        st_ivas->hIsmMetaData[ch]->last_true_elevation = 0;
        st_ivas->hIsmMetaData[ch]->last_azimuth = 0;
        st_ivas->hIsmMetaData[ch]->last_elevation = 0;
#endif

        st_ivas->hIsmMetaData[ch]->ism_imp = -1;
        move16();
Loading