Commit 8408a13a authored by Vidhya V P's avatar Vidhya V P
Browse files

Address review comments:set 1

parent e7b3fc0a
Loading
Loading
Loading
Loading
+106 −123
Original line number Diff line number Diff line
@@ -52,11 +52,7 @@ static void ivas_get_ld_fb_resp( float **ppIdeal_FRs_re, float **ppIdeal_FRs_im,
static int16_t ivas_fb_mixer_get_band_diff_non48k( const int32_t sampling_rate, const float delay_ms );
static const float *ivas_get_cheby_ramp( const int16_t delay );
static void ivas_get_hanning_win( const int16_t len, float *pH_win );
#ifdef SBA_BR_SWITCHING_CLEAN_UP
static ivas_error ivas_filterbank_setup( IVAS_FB_MIXER_HANDLE hFbMixer, const int32_t sampling_rate, const int16_t spar_reconfig_flag );
#else
static ivas_error ivas_filterbank_setup( IVAS_FB_MIXER_HANDLE hFbMixer, const int32_t sampling_rate );
#endif
static ivas_error ivas_fb_mixer_get_window( const int16_t fade_len, const int32_t sampling_rate, const float **pWindow );


@@ -346,14 +342,18 @@ ivas_error ivas_FB_mixer_open(
#endif
    hFbMixer->fb_cfg = fb_cfg;
#ifdef SBA_BR_SWITCHING_CLEAN_UP
    if ( ( error = ivas_filterbank_setup( hFbMixer, sampling_rate, spar_reconfig_flag ) ) != IVAS_ERR_OK )
#else
    if ( ( error = ivas_filterbank_setup( hFbMixer, sampling_rate ) ) != IVAS_ERR_OK )
    set_s( hFbMixer->first_frame, 1, hFbMixer->fb_cfg->num_out_chans );
    set_s( hFbMixer->first_frame + hFbMixer->fb_cfg->num_out_chans, 0, IVAS_SPAR_MAX_CH - hFbMixer->fb_cfg->num_out_chans );
    if ( !spar_reconfig_flag )
    {
#endif
        if ( ( error = ivas_filterbank_setup( hFbMixer, sampling_rate ) ) != IVAS_ERR_OK )
        {
            return error;
        }

#ifdef SBA_BR_SWITCHING_CLEAN_UP
    }
#endif
    *hFbMixer_out = hFbMixer;

    return error;
@@ -463,12 +463,6 @@ void ivas_FB_mixer_close(
                    }
                }
            }
#ifdef SBA_BR_SWITCHING_CLEAN_UP
        }

        if ( !spar_reconfig_flag )
        {
#endif
            if ( hFbMixer->pFb != NULL )
            {
                free( hFbMixer->pFb );
@@ -1058,10 +1052,6 @@ static void ivas_get_active_bins(
static ivas_error ivas_filterbank_setup(
    IVAS_FB_MIXER_HANDLE hFbMixer,
    const int32_t sampling_rate
#ifdef SBA_BR_SWITCHING_CLEAN_UP
    ,
    const int16_t spar_reconfig_flag
#endif
)
{
    int16_t i, j;
@@ -1075,13 +1065,9 @@ static ivas_error ivas_filterbank_setup(
    IVAS_FB_CFG *pCfg = hFbMixer->fb_cfg;

    error = IVAS_ERR_OK;

#ifndef SBA_BR_SWITCHING_CLEAN_UP
    set_s( hFbMixer->first_frame, 1, pCfg->num_out_chans );
    set_s( hFbMixer->first_frame + pCfg->num_out_chans, 0, IVAS_SPAR_MAX_CH - pCfg->num_out_chans );

#ifdef SBA_BR_SWITCHING_CLEAN_UP
    if ( !spar_reconfig_flag )
    {
#endif
    if ( pCfg->num_out_chans > 0 )
    {
@@ -1206,9 +1192,6 @@ static ivas_error ivas_filterbank_setup(
            ivas_calculate_abs_fr( pFb, sampling_rate, pCfg->active_w_mixing );
        }
    }
#ifdef SBA_BR_SWITCHING_CLEAN_UP
    }
#endif
    return error;
}

+2 −11
Original line number Diff line number Diff line
@@ -719,16 +719,8 @@ ivas_error ivas_sba_dec_reconfigure(
#else
        if ( hSpar != NULL )
        {
            if ( hDecoderConfig->ivas_total_brate == PCA_BRATE && sba_order_internal == 1 )
            {
                if ( ( hSpar->hPCA = (PCA_DEC_STATE *) malloc( sizeof( PCA_DEC_STATE ) ) ) == NULL )
                {
                    return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for PCA decoder" );
                }

                ivas_pca_dec_init( hSpar->hPCA );
            }
            else if ( hSpar->hPCA != NULL )
            if  ( ( hSpar->hPCA != NULL )
                && ( ( hDecoderConfig->ivas_total_brate != PCA_BRATE) || (sba_order_internal != 1 ) ) )
            {
                free( st_ivas->hSpar->hPCA );
                hSpar->hPCA = NULL;
@@ -972,7 +964,6 @@ ivas_error ivas_sba_dec_reconfigure(
            vbap_free_data( &( st_ivas->hVBAPdata ) );
        }
    }

    if ( st_ivas->hDirAC != NULL && st_ivas->sba_mode == SBA_MODE_SPAR )
    {
        mvs2s( st_ivas->hDirAC->dirac_to_spar_md_bands, st_ivas->hSpar->dirac_to_spar_md_bands, DIRAC_MAX_NBANDS );
+41 −54
Original line number Diff line number Diff line
@@ -124,10 +124,6 @@ ivas_error ivas_spar_dec_open(
    {
        return error;
    }
#ifdef SBA_BR_SWITCHING_CLEAN_UP
    if ( !spar_reconfig_flag )
    {
#endif
    /* AGC handle */
    if ( ( error = ivas_spar_agc_dec_open( &hSpar->hAgcDec, output_Fs ) ) != IVAS_ERR_OK )
    {
@@ -145,9 +141,6 @@ ivas_error ivas_spar_dec_open(

        ivas_pca_dec_init( hSpar->hPCA );
    }
#ifdef SBA_BR_SWITCHING_CLEAN_UP
    }
#endif
    /* mixer_mat intitialization */
    for ( i = 0; i < num_channels_internal; i++ )
    {
@@ -164,10 +157,7 @@ ivas_error ivas_spar_dec_open(
        }
    }
    hSpar->i_subframe = 0;
#ifdef SBA_BR_SWITCHING_CLEAN_UP
    if ( !spar_reconfig_flag )
    {
#endif

   /*-----------------------------------------------------------------*
    * Configuration - set SPAR high-level parameters
    *-----------------------------------------------------------------*/
@@ -190,9 +180,6 @@ ivas_error ivas_spar_dec_open(
    ivas_output_init( &( st_ivas->hTransSetup ), st_ivas->transport_config );

    st_ivas->hSpar = hSpar;
#ifdef SBA_BR_SWITCHING_CLEAN_UP
    }
#endif
    return error;
}

@@ -226,10 +213,7 @@ void ivas_spar_dec_close(
#else
        ivas_FB_mixer_close( &hSpar->hFbMixer, output_Fs );
#endif
#ifdef SBA_BR_SWITCHING_CLEAN_UP
        if ( !spar_reconfig_flag )
        {
#endif

        /* AGC */
        ivas_spar_agc_dec_close( &hSpar->hAgcDec );

@@ -239,7 +223,10 @@ void ivas_spar_dec_close(
            free( hSpar->hPCA );
            hSpar->hPCA = NULL;
        }

#ifdef SBA_BR_SWITCHING_CLEAN_UP
        if ( !spar_reconfig_flag )
        {
#endif
            free( hSpar );
            hSpar = NULL;
#ifdef SBA_BR_SWITCHING_CLEAN_UP
+46 −51
Original line number Diff line number Diff line
@@ -126,19 +126,16 @@ ivas_error ivas_spar_enc_open(
    {
        return error;
    }
#ifdef SBA_BR_SWITCHING_CLEAN_UP
    /* initialization */
    hSpar->hMdEnc->table_idx = -1;

    if ( !spar_reconfig_flag )
    {
#endif
    /* Transient Detector handle */
    if ( ( error = ivas_spar_transient_det_open( &( hSpar->hTranDet ), input_Fs ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    /* initialization */
    hSpar->hMdEnc->table_idx = -1;

        /* AGC handle */
#ifdef DEBUG_AGC_ENCODER_CMD_OPTION
    hSpar->AGC_Enable = ivas_agc_enc_get_flag( hEncoderConfig->Opt_AGC_ON, nchan_transport );
@@ -154,6 +151,7 @@ ivas_error ivas_spar_enc_open(
            return error;
        }
    }

    /* PCA handle */
    hSpar->hPCA = NULL;
    if ( hEncoderConfig->Opt_PCA_ON )
@@ -164,19 +162,15 @@ ivas_error ivas_spar_enc_open(
        }
        ivas_pca_enc_init( hSpar->hPCA );
    }
#ifndef SBA_BR_SWITCHING_CLEAN_UP

    /* initialization */
    hSpar->hMdEnc->table_idx = -1;
#endif

    /*-----------------------------------------------------------------*
        * Configuration - set SPAR high-level parameters
        *-----------------------------------------------------------------*/

    ivas_spar_config( hEncoderConfig->ivas_total_brate, min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ),
                        &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &hSpar->core_nominal_brate, -1 );
#ifdef SBA_BR_SWITCHING_CLEAN_UP
    }
#endif
    if ( st_ivas->nchan_transport == 1 )
    {
        hEncoderConfig->element_mode_init = IVAS_SCE;
@@ -229,10 +223,11 @@ ivas_error ivas_spar_enc_open(
         * Final assignment
         *-----------------------------------------------------------------*/

        st_ivas->hSpar = hSpar;
        
#ifdef SBA_BR_SWITCHING_CLEAN_UP
    }
#endif
    st_ivas->hSpar = hSpar;
    return error;
}

@@ -291,10 +286,7 @@ void ivas_spar_enc_close(
#else
        ivas_FB_mixer_close( &hSpar->hFbMixer, input_Fs );
#endif
#ifdef SBA_BR_SWITCHING_CLEAN_UP
        if ( !spar_reconfig_flag )
        {
#endif

        /* Trans Det handle */
        ivas_spar_transient_det_close( &hSpar->hTranDet );

@@ -307,7 +299,10 @@ void ivas_spar_enc_close(
            free( hSpar->hPCA );
            hSpar->hPCA = NULL;
        }

#ifdef SBA_BR_SWITCHING_CLEAN_UP
        if ( !spar_reconfig_flag )
        {
#endif
            free( hSpar );
            hSpar = NULL;
#ifdef SBA_BR_SWITCHING_CLEAN_UP