Commit 0327bd75 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Fix for msan crashes observed for mc streams

parent f0d4f090
Loading
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -86,14 +86,22 @@ ivas_error acelp_core_dec_ivas_fx(
    Word16 lsf_new_fx[M];                                                            /* LSFs at the end of the frame  Qlog2(2.56)        */
    Word16 lsp_new_fx[M];                                                            /* LSPs at the end of the frame    Q15      */
    Word16 lsp_mid_fx[M];                                                            /* LSPs in the middle of the frame       */
#ifdef MSAN_FIX
    Word16 Aq_fx[NB_SUBFR16k * ( M + 1 )] = { 0 };                               /* A(q) quantized for the 4 subframes    */
#else
    Word16 Aq_fx[NB_SUBFR16k * ( M + 1 )];                                           /* A(q) quantized for the 4 subframes    */
#endif
    Word16 old_exc2_fx[L_FRAME16k + L_EXC_MEM], *exc2_fx;                               /* total excitation buffer               */
    Word16 mem_tmp_fx[M];                                                            /* temporary synthesis filter memory     */
    Word32 enr_q_fx;                                                                 /* E information for FER protection      */
    Word16 tmp_noise_fx;                                                             /* Long term temporary noise energy      */
    Word16 Es_pred_fx;                                                               /* predicted scaled innov. energy Q8       */
    Word16 FEC_pitch_fx;                                                             /* FEC pitch                             */
#ifdef MSAN_FIX
    Word16 old_bwe_exc_fx[( ( PIT16k_MAX + ( L_FRAME16k + 1 ) + L_SUBFR16k ) * 2 )] = { 0 }; /* excitation buffer                     */
#else
    Word16 old_bwe_exc_fx[( ( PIT16k_MAX + ( L_FRAME16k + 1 ) + L_SUBFR16k ) * 2 )]; /* excitation buffer                     */
#endif
    Word16 *bwe_exc_fx;                                                              /* Excitation for SWB TBE                */
    int16_t i, j, int_fs;
    int16_t tc_subfr;
+4 −0
Original line number Diff line number Diff line
@@ -3399,7 +3399,11 @@ void ivas_dirac_dec_render_fx(
    Word16 temp = 0;
    SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom;
    float *output_f_local[MAX_OUTPUT_CHANNELS];
#ifdef MSAN_FIX
    float output_f_local_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k] = { 0 }; // VE2SB: TBV
#else
    float output_f_local_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; // VE2SB: TBV
#endif

    Word32 *output_f_local_fx[MAX_OUTPUT_CHANNELS];
    Word32 output_f_local_buff_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; // VE2SB: TBV
+29 −0
Original line number Diff line number Diff line
@@ -157,6 +157,9 @@ ivas_error ivas_jbm_dec_tc(
#endif
#endif
        }
#ifdef MSAN_FIX
        st_ivas->hTcBuffer->no_channels = ivas_get_nchan_buffers_dec(st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate);
#endif
    }

    /*----------------------------------------------------------------*
@@ -1264,14 +1267,24 @@ ivas_error ivas_jbm_dec_tc(
                    scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) );
                    hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft;
                }
#ifdef MSAN_FIX
                FOR( i = 0; i < CPE_CHANNELS; i++ )
                Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_fx2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), hCPE->q_prev_synth_fx - 11 );
#else
                Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx) / sizeof(hCPE->prev_synth_fx[0][0]), hCPE->q_prev_synth_fx - 11);
#endif
                ivas_sba_dirac_stereo_dec_fx(st_ivas, &p_output_fx[sba_ch_idx], output_frame, 0);
                FOR(i = 0; i < 2; i++)
                {
                  Scale_sig32(p_output_fx[sba_ch_idx + i], L_FRAME48k, negate(s));
                }

#ifdef MSAN_FIX
                FOR( i = 0; i < CPE_CHANNELS; i++ )
                Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_fx2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), 11 - hCPE->q_prev_synth_fx );
#else
                Scale_sig32(&hCPE->prev_synth_fx[0][0], sizeof(hCPE->prev_synth_fx) / sizeof(hCPE->prev_synth_fx[0][0] ), 11 - hCPE->q_prev_synth_fx );
#endif

                scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) );
                FOR( i = 0; i < CPE_CHANNELS; ++i )
@@ -2166,13 +2179,23 @@ ivas_error ivas_jbm_dec_tc(
                    scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) );
                    hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft;
                }
#ifdef MSAN_FIX
                FOR ( i = 0; i < CPE_CHANNELS; i++ )
                    Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_fx2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), hCPE->q_prev_synth_fx - 11 );
#else
                Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx) / sizeof(hCPE->prev_synth_fx[0][0]), hCPE->q_prev_synth_fx - 11);
#endif
                ivas_sba_dirac_stereo_dec_fx(st_ivas, p_output_fx, output_frame, 1);
                FOR(i = 0; i < 2; i++)
                {
                  Scale_sig32(p_output_fx[i], L_FRAME48k, negate(s));
                }
#ifdef MSAN_FIX
                FOR ( i = 0; i < CPE_CHANNELS; i++ )
                    Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_fx2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), 11 - hCPE->q_prev_synth_fx);
#else
                Scale_sig32(&hCPE->prev_synth_fx[0][0], sizeof(hCPE->prev_synth_fx) / sizeof(hCPE->prev_synth_fx[0][0] ), 11 - hCPE->q_prev_synth_fx );
#endif // MSAN_FIX

                scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) );
                FOR( i = 0; i < CPE_CHANNELS; ++i )
@@ -4233,6 +4256,9 @@ ivas_error ivas_jbm_dec_render(
        }
    }

#ifdef MSAN_FIX
    st_ivas->hTcBuffer->no_channels = st_ivas->hTcBuffer->nchan_buffer_full;
#endif // MSAN_FIX
    /*----------------------------------------------------------------*
     * Update combined orientation access index
     *----------------------------------------------------------------*/
@@ -8084,6 +8110,9 @@ ivas_error ivas_jbm_dec_tc_buffer_open(
                    hTcBuffer->tc_fx[ch_idx] = NULL;
#endif
                }
#ifdef MSAN_FIX
                st_ivas->hTcBuffer->no_channels = hTcBuffer->nchan_transport_internal;
#endif // MSAN_FIX
            }
            else
            {
+9 −0
Original line number Diff line number Diff line
@@ -3619,12 +3619,21 @@ void ivas_param_mc_dec_render_fx(
    /* set everything to zero that will not be decoded */
    nband_synth = hParamMC->band_grouping[hParamMC->num_param_bands_synth];
    nbands_to_zero = sub(hParamMC->num_freq_bands , nband_synth);
#ifdef MSAN_FIX
    FOR ( ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++ )
#else
    FOR ( ch = 0; ch < nchan_out_init; ch++ )
#endif
    {
       FOR ( slot_idx = 0; slot_idx < JBM_CLDFB_SLOTS_IN_SUBFRAME; slot_idx++ )
       {
#ifdef MSAN_FIX
            set32_fx( &( Cldfb_RealBuffer_fx[ch][slot_idx][0] ), 0, CLDFB_NO_CHANNELS_MAX);
            set32_fx( &( Cldfb_ImagBuffer_fx[ch][slot_idx][0] ), 0, CLDFB_NO_CHANNELS_MAX);
#else
            set32_fx( &( Cldfb_RealBuffer_fx[ch][slot_idx][nband_synth] ), 0, nbands_to_zero );
            set32_fx( &( Cldfb_ImagBuffer_fx[ch][slot_idx][nband_synth] ), 0, nbands_to_zero );
#endif
       }
    }

+4 −4
Original line number Diff line number Diff line
@@ -1443,9 +1443,9 @@ ivas_error ivas_mc_dec_config(
                            if ( hParamMC->h_output_synthesis_cov_state.cx_old[i] )
                            {

                                floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.cx_old[i], hParamMC->h_output_synthesis_cov_state.cx_old_fx[i], 31 - cx_e, s_min(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_len, nchan_transport_old * nchan_transport_old ));
                                floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.cx_old[i], hParamMC->h_output_synthesis_cov_state.cx_old_fx[i], 31 - cx_e, nchan_transport_old * nchan_transport_old );
                                floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.cy_old[i], hParamMC->h_output_synthesis_cov_state.cy_old_fx[i], 31 - cy_e, nchan_out_cov * nchan_out_cov );
                                floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[i], 31 - mmo_e, s_min(hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_len, nchan_transport_old * nchan_out_cov) );
                                floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[i], 31 - mmo_e, nchan_transport_old * nchan_out_cov );
                            }
                        }
                        for ( int i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ )
@@ -1518,9 +1518,9 @@ ivas_error ivas_mc_dec_config(
                            {
                                if ( hParamMC->h_output_synthesis_cov_state.cx_old[i] )
                                {
                                    fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.cx_old_fx[i], hParamMC->h_output_synthesis_cov_state.cx_old[i], 31 - cx_e, s_min(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_len, nchan_transport_old * nchan_transport_old) );
                                    fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.cx_old_fx[i], hParamMC->h_output_synthesis_cov_state.cx_old[i], 31 - cx_e,  nchan_transport_old * nchan_transport_old );
                                    fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.cy_old_fx[i], hParamMC->h_output_synthesis_cov_state.cy_old[i], 31 - cy_e, nchan_out_cov * nchan_out_cov );
                                    fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i], 31 - mmo_e, s_min(hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_len, nchan_transport_old * nchan_out_cov) );
                                    fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i], 31 - mmo_e, nchan_transport_old * nchan_out_cov );
                                }
                            }
                            for ( int i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ )
Loading