Commit d4db297e authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Merge remote-tracking branch 'origin/main' into 156-refactor-dirac-rendering

parents 0802e24e 37c46120
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()
+8 −2
Original line number Diff line number Diff line
@@ -4363,8 +4363,11 @@ void ivas_calc_c_p_coeffs(
    const int16_t num_dmx,
    const int16_t band_idx,
    const int16_t dtx_vad,
    const int16_t compute_p_flag,
    const int16_t compute_p_flag
#ifndef FIX_280_PLANAR_CP
    ,
    const int16_t planarCP 
#endif
);

void ivas_get_spar_md_from_dirac(
@@ -4833,8 +4836,11 @@ void ivas_copy_band_coeffs_idx_to_arr(
    const int16_t nB, 
    int16_t *pSymbol_re, 
    ivas_cell_dim_t *pCell_dims, 
    const ivas_coeffs_type_t coeff_type,
    const ivas_coeffs_type_t coeff_type
#ifndef FIX_280_PLANAR_CP
    ,
    const int16_t planarCP
#endif
);

void ivas_clear_band_coeffs( 
+18 −2
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;
}
@@ -1253,10 +1255,16 @@ void ivas_calc_c_p_coeffs(
    const int16_t num_dmx,
    const int16_t band_idx,
    const int16_t dtx_vad,
    const int16_t compute_p_flag,
    const int16_t planarCP )
    const int16_t compute_p_flag
#ifndef FIX_280_PLANAR_CP
    ,
    const int16_t planarCP
#endif
)
{
#ifndef FIX_280_PLANAR_CP
    int16_t i, j;
#endif
    float postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH];

    if ( num_dmx != num_ch )
@@ -1268,6 +1276,7 @@ void ivas_calc_c_p_coeffs(
            ivas_calc_c_coeffs_per_band( pSparMd, i_ts, postpred_cov_re, num_ch, num_dmx, band_idx, dtx_vad );
        }

#ifndef FIX_280_PLANAR_CP
        if ( planarCP )
        {
            for ( i = 0; i < num_ch - num_dmx; i++ )
@@ -1281,12 +1290,14 @@ void ivas_calc_c_p_coeffs(
                }
            }
        }
#endif

        if ( compute_p_flag == 1 )
        {
            ivas_calc_p_coeffs_per_band( pSparMd, i_ts, postpred_cov_re, num_ch, dtx_vad, num_dmx, band_idx );
        }

#ifndef FIX_280_PLANAR_CP
        if ( planarCP )
        {
            for ( i = num_dmx; i < num_ch; i++ )
@@ -1297,6 +1308,7 @@ void ivas_calc_c_p_coeffs(
                }
            }
        }
#endif
    }

    return;
@@ -1611,7 +1623,11 @@ void ivas_compute_spar_params(

        if ( ndm != num_ch )
        {
#ifndef FIX_280_PLANAR_CP
            ivas_calc_c_p_coeffs( hSparMd, cov_real, i_ts, mixer_mat, num_ch, ndm, b, dtx_vad, 1, 0 );
#else
            ivas_calc_c_p_coeffs( hSparMd, cov_real, i_ts, mixer_mat, num_ch, ndm, b, dtx_vad, 1 );
#endif

#ifdef SPAR_HOA_DBG
            /* if (b == 0) */
+12 −2
Original line number Diff line number Diff line
@@ -243,11 +243,17 @@ void ivas_copy_band_coeffs_idx_to_arr(
    const int16_t nB,
    int16_t *pSymbol_re,
    ivas_cell_dim_t *pCell_dims,
    const ivas_coeffs_type_t coeff_type,
    const int16_t planarCP )
    const ivas_coeffs_type_t coeff_type
#ifndef FIX_280_PLANAR_CP
    ,
    const int16_t planarCP
#endif
)
{
    int16_t i, len;
#ifndef FIX_280_PLANAR_CP
    int16_t j, k;
#endif
    int16_t *pPtr_idx = NULL;

    for ( i = 0; i < nB; i++ )
@@ -277,10 +283,13 @@ void ivas_copy_band_coeffs_idx_to_arr(
        len = pCell_dims[i].dim1 * pCell_dims[i].dim2;
        if ( ( coeff_type != DECX_COEFF ) )
        {
#ifndef FIX_280_PLANAR_CP
            if ( ( coeff_type == PRED_COEFF ) || !planarCP )
            {
#endif
                mvs2s( pPtr_idx, pSymbol_re, len );
                pSymbol_re += len;
#ifndef FIX_280_PLANAR_CP
            }
            else
            {
@@ -295,6 +304,7 @@ void ivas_copy_band_coeffs_idx_to_arr(
                }
                pSymbol_re += k;
            }
#endif
        }
    }

+8 −2
Original line number Diff line number Diff line
@@ -149,8 +149,8 @@
/* only BE switches wrt operation points tested in selection */

/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */


#define SBA_MODE_CLEANUP_2                              /* Dlb : changes part of fix issue #523 for unused signaling bit in SBA SID*/
#define FIX_137_SID_MD_BITS                             /* Dlb: Fix issue #137 , SID bitrate mismatch correction */
#define FIX_563_PARAMMC_LIMITER                         /* FhG: issue 563: fix ILD limiter when coming from silence w/o transient set             */
#define FIX_560_VAD_FLAG                                /* Eri: Issue 560 - VAD flag issue for unified stereo */
#define FIX_549_DMX_GAIN                                /* FhG: issue 549: ParamISM output too quiet */
@@ -179,6 +179,8 @@
#define FIX_570_SF_EXT_ORIENTATION
#define FIX_593_STL_INCLUDE                             /* FhG: Issue 593: correct include of stl.h in lib_enc/ivas_stereo_eclvq_enc.c */
#define FIX_583_CLANG_TRANS_DET                         /* FhG: Issue 583: clang left shift on ramp_up_flag in transient detector */
#define FIX_280_PLANAR_CP                               /* Dlb : fix issue 28 : remove planarCP=1 related code*/
#define CODE_CLEAN_UP_DIRAC                             /* Dlb : code clean up*/
#define NONBE_FIX_589_JBM_TC_OFFSETS                    /* FhG: issue 589: wrong offset into the TC buffers is used in some rendering paths in the JBM main rendering function */
#define FIX_MEM_REALLOC_IND_LIST                        /* VA: issue 601: failure of the automatic memory re-allocation mechanism when ind_list[] buffer is depleted in MASA mode with 2 TC*/
#define FIX_581_CLANG_OFFSET_TO_NULL                    /* FhG: issue 581: fix CLANG error about applying an offset to a NULL pointer */
@@ -205,6 +207,10 @@

/* ##################### End NON-BE CR switches ########################### */



/* ################## End DEVELOPMENT switches ######################### */

/* clang-format on */

#endif
Loading