Commit 629ff241 authored by Shikha Shetgeri's avatar Shikha Shetgeri
Browse files

code clean up

parent e9bfe105
Loading
Loading
Loading
Loading
Loading
+87 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@
#include "prot.h"

#define BAND_SMOOTH_REST_START_IDX ( 2 )
#ifndef CODE_CLEAN_UP_DIRAC
/*-----------------------------------------------------------------------------------------*
 * Function ivas_set_up_cov_smoothing()
 *
@@ -138,7 +139,93 @@ static void ivas_set_up_cov_smoothing(

    return;
}
#else

/*-----------------------------------------------------------------------------------------*
 * Function ivas_calculate_update_factor()
 *
 * To calculate the update factor
 *-----------------------------------------------------------------------------------------*/

static float ivas_calculate_update_factor( float *p_bin_to_band, int16_t active_bins )
{
    float update_factor_temp = 0.0f;
    int16_t k;
    for ( k = 0; k < active_bins; k++ )
    {
        update_factor_temp += p_bin_to_band[k];
    }
    return update_factor_temp;
}

/*-----------------------------------------------------------------------------------------*
 * Function ivas_calculate_smoothning_factor()
 *
 * To calculate the Smoothning factor
 *-----------------------------------------------------------------------------------------*/

static void ivas_calculate_smoothning_factor( float *Smoothing_factor, float update_factor, const int16_t min_pool_size, const float max_update_rate, const COV_SMOOTHING_TYPE smooth_mode, const int32_t ivas_total_brate, int16_t j )
{
    float smooth_fact;
    *Smoothing_factor = update_factor / min_pool_size;
    if ( smooth_mode != COV_SMOOTH_MC )
    {
        if ( ivas_total_brate < IVAS_24k4 )
        {
            smooth_fact = 0.5f;
        }
        else
        {
            smooth_fact = 0.75f;
        }
        *Smoothing_factor *= ( j + 1 ) * smooth_fact;
    }
    if ( *Smoothing_factor > max_update_rate )
    {
        *Smoothing_factor = max_update_rate;
    }
}

/*-----------------------------------------------------------------------------------------*
 * Function ivas_set_up_cov_smoothing()
 *
 * Setup for covariance smoothing
 *-----------------------------------------------------------------------------------------*/

static void ivas_set_up_cov_smoothing(
    ivas_cov_smooth_state_t *hCovState,
    ivas_filterbank_t *pFb,
    const float max_update_rate,
    const int16_t min_pool_size,
    const COV_SMOOTHING_TYPE smooth_mode, /* i  : flag multichannel vs SPAR       */
    const int32_t ivas_total_brate )
{
    int16_t j;
    float update_factor;
    if ( smooth_mode == COV_SMOOTH_MC )
    {
        for ( j = 0; j < pFb->filterbank_num_bands; j++ )
        {
            int16_t active_bins = pFb->fb_bin_to_band.pFb_active_bins_per_band[j];
            update_factor = ivas_calculate_update_factor( pFb->fb_bin_to_band.pFb_bin_to_band[j], active_bins );
            ivas_calculate_smoothning_factor( &hCovState->pSmoothing_factor[j], update_factor, min_pool_size, max_update_rate, smooth_mode, ivas_total_brate, j );
        }
    }
    else
    {
        for ( j = 0; j < pFb->filterbank_num_bands; j++ )
        {
            float *p_bin_to_band = pFb->fb_bin_to_band.pp_short_stride_bin_to_band[j];
            int16_t active_bins = pFb->fb_bin_to_band.p_short_stride_num_bins_per_band[j];
            update_factor = ivas_calculate_update_factor( p_bin_to_band, active_bins );
            ivas_calculate_smoothning_factor( &hCovState->pSmoothing_factor[j], update_factor, min_pool_size, max_update_rate, smooth_mode, ivas_total_brate, j );
        }
    }

    hCovState->prior_bank_idx = -1;
}

#endif

/*-------------------------------------------------------------------------
 * ivas_spar_covar_smooth_enc_open()
+2 −0
Original line number Diff line number Diff line
@@ -802,6 +802,7 @@ void ivas_create_fullr_dmx_mat(
    {
        ivas_reorder_array( down_mix_mat1_re, in_chans, order, mixer_mat, start_band, end_band );
    }
#ifndef CODE_CLEAN_UP_DIRAC
    else
    {
        /* Custom 4x4 mult for WYiX case */
@@ -823,6 +824,7 @@ void ivas_create_fullr_dmx_mat(
            }
        }
    }
#endif

    return;
}
+1 −1
Original line number Diff line number Diff line
@@ -154,7 +154,7 @@
// #define FIX_532_ISM_MD_INACTIVE                         /* VA: issue 532: improve MD coding in ISM inactive frames */
#define FIX_547_NAN_IGF_DEC                             /* FhG: issue 547: fix possible nan in IGF decoder */
#define FIX_280_PLANAR_CP                               /* Dlb : fix issue 28 : remove planarCP=1 related code*/

#define CODE_CLEAN_UP_DIRAC                             /*Dlb : code clean up*/

/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
+6 −0
Original line number Diff line number Diff line
@@ -625,9 +625,11 @@ static ivas_error ivas_spar_set_dec_config(
        case 9: /* IVAS_HOA_2_CH */
            hMdDec->num_decorr = IVAS_TD_DECORR_OUT_5CH;
            break;
#ifndef CODE_CLEAN_UP_DIRAC
        case 16: /* IVAS_HOA_3_CH */ // ToDo: is this relevant?
            hMdDec->num_decorr = IVAS_TD_DECORR_OUT_12CH;
            break;
#endif
        case 6: /* IVAS_HOA_2_CH */
            hMdDec->num_decorr = IVAS_TD_DECORR_OUT_2CH;
            break;
@@ -1357,6 +1359,7 @@ static void ivas_get_spar_matrices(
                {
                    ivas_mat_col_rearrange( tmp_dm_re, order, i_ts, hMdDec->mixer_mat, b, numch_out );
                }
#ifndef CODE_CLEAN_UP_DIRAC
                else
                {
                    /* Custom 4x4 mult for WYiX case */
@@ -1375,6 +1378,7 @@ static void ivas_get_spar_matrices(
                        hMdDec->mixer_mat[i][3][b + i_ts * IVAS_MAX_NUM_BANDS] = tmp_dm_re[i][2];
                    }
                }
#endif
            }
            else
            {
@@ -1382,6 +1386,7 @@ static void ivas_get_spar_matrices(
                {
                    ivas_mat_col_rearrange( tmp_C1_re, order, i_ts, hMdDec->mixer_mat, b, numch_out );
                }
#ifndef CODE_CLEAN_UP_DIRAC
                else
                {
                    /* Custom 4x4 mult for WYiX case */
@@ -1400,6 +1405,7 @@ static void ivas_get_spar_matrices(
                        hMdDec->mixer_mat[i][3][b + i_ts * IVAS_MAX_NUM_BANDS] = tmp_C1_re[i][2];
                    }
                }
#endif
            }

            if ( dmx_ch > 0 )