Commit 0d5ea7f4 authored by norvell's avatar norvell
Browse files

Merge with main

parents d77d13e1 b74476db
Loading
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -2240,5 +2240,13 @@ enum
    VOIP_RTPDUMP
};

#ifdef FIX_489_COV_SMOOTHING
typedef enum _COV_SMOOTHING_TYPE
{
    COV_SMOOTH_SPAR,
    COV_SMOOTH_MC
} COV_SMOOTHING_TYPE;
#endif

/* clang-format on */
#endif /* CNST_H */
+41 −1
Original line number Diff line number Diff line
@@ -35,6 +35,9 @@
#ifdef DEBUGGING
#include "debug.h"
#endif
#ifdef FIX_489_COV_SMOOTHING
#include "cnst.h"
#endif
#include "ivas_prot.h"
#include "wmc_auto.h"
#include "prot.h"
@@ -50,7 +53,12 @@ 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 int16_t min_pool_size
#ifdef FIX_489_COV_SMOOTHING
    ,
    const COV_SMOOTHING_TYPE smooth_mode /* i  : flag multichannel vs SPAR       */
#endif
    ,
    const int32_t ivas_total_brate )
{
    int16_t j, k;
@@ -88,7 +96,30 @@ static void ivas_set_up_cov_smoothing(
            }
        }
    }
#ifdef FIX_489_COV_SMOOTHING
    else if ( smooth_mode == COV_SMOOTH_MC )
    {
        for ( j = 0; j < pFb->filterbank_num_bands; j++ )
        {
            float update_factor;
            update_factor = 0.0f;

            for ( k = 0; k < pFb->fb_bin_to_band.pFb_active_bins_per_band[j]; k++ )
            {
                update_factor += pFb->fb_bin_to_band.pFb_bin_to_band[j][k];
            }

            hCovState->pSmoothing_factor[j] = update_factor / min_pool_size;

            if ( hCovState->pSmoothing_factor[j] > max_update_rate )
            {
                hCovState->pSmoothing_factor[j] = max_update_rate;
            }
        }
    }
#endif
    else
    {
        for ( j = 0; j < pFb->filterbank_num_bands; j++ )
        {
            float update_factor;
@@ -108,6 +139,8 @@ static void ivas_set_up_cov_smoothing(
                hCovState->pSmoothing_factor[j] = max_update_rate;
            }
        }
    }

    hCovState->prior_bank_idx = -1;

    return;
@@ -126,6 +159,9 @@ ivas_error ivas_spar_covar_smooth_enc_open(
    ivas_filterbank_t *pFb,                      /* i/o: FB handle                      */
    const int16_t nchan_inp                      /* i  : number of input channels       */
    ,
#ifdef FIX_489_COV_SMOOTHING
    COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */
#endif
    const int32_t ivas_total_brate /* i  : IVAS total bitrate             */
)
{
@@ -155,7 +191,11 @@ ivas_error ivas_spar_covar_smooth_enc_open(
    }


#ifdef FIX_489_COV_SMOOTHING
    ivas_set_up_cov_smoothing( hCovState, pFb, cov_smooth_cfg->max_update_rate, cov_smooth_cfg->min_pool_size, smooth_mode, ivas_total_brate );
#else
    ivas_set_up_cov_smoothing( hCovState, pFb, cov_smooth_cfg->max_update_rate, cov_smooth_cfg->min_pool_size, ivas_total_brate );
#endif

    *hCovState_out = hCovState;

+26 −8
Original line number Diff line number Diff line
@@ -947,9 +947,11 @@ void deindex_spherical_component(
 *-----------------------------------------------------------------*/

void calculate_hodirac_sector_parameters(
#ifdef FIX_485_STATIC_BUFFERS
    DIRAC_ENC_HANDLE hDirAC, /* i  : DirAC handle                               */
#endif
    float RealBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i  : signal vector (L+1)^2 x N_bins, real part  */
    float ImagBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i  : signal vector, imaginary part              */
    const int16_t N_bins,                                         /* i  : number of bins                             */
    const float beta,                                             /* i  : forgetting factor for average filtering    */
    const int16_t *band_grouping,                                 /* i  : indices of band groups                     */
    const int16_t N_bands,                                        /* i  : number of bands (groups)                   */
@@ -961,13 +963,12 @@ void calculate_hodirac_sector_parameters(
)
{
    int16_t i_sec, i_bin, i_band;

    float p_real, p_imag, normI, energy, tmp_diff;

    float sec_I_vec_x[NUM_ANA_SECTORS];
    float sec_I_vec_y[NUM_ANA_SECTORS];
    float sec_I_vec_z[NUM_ANA_SECTORS];

#ifndef FIX_485_STATIC_BUFFERS
    static int16_t firstrun_sector_params = 1;

    static float sec_I_vec_smth_x[NUM_ANA_SECTORS][IVAS_MAX_NUM_BANDS];
@@ -977,9 +978,6 @@ void calculate_hodirac_sector_parameters(
    static float energy_smth[NUM_ANA_SECTORS][IVAS_MAX_NUM_BANDS];
    static float azi_prev[NUM_ANA_SECTORS * IVAS_MAX_NUM_BANDS];
    static float ele_prev[NUM_ANA_SECTORS * IVAS_MAX_NUM_BANDS];

#ifdef DEBUGGING
    assert( N_bins <= DIRAC_NO_FB_BANDS_MAX );
#endif

    for ( i_sec = 0; i_sec < NUM_ANA_SECTORS; i_sec++ )
@@ -1016,6 +1014,15 @@ void calculate_hodirac_sector_parameters(
            float *p_ene = &ene[i_sec * N_bands + i_band];

            float *p_diff = &diff[i_sec * N_bands + i_band];
#ifdef FIX_485_STATIC_BUFFERS
            float *p_azi_prev = &hDirAC->azi_prev[i_sec * N_bands + i_band];
            float *p_ele_prev = &hDirAC->ele_prev[i_sec * N_bands + i_band];

            float *p_energy_smth = &hDirAC->energy_smth[i_sec][i_band];
            float *p_sec_I_vec_smth_x = &hDirAC->sec_I_vec_smth_x[i_sec][i_band];
            float *p_sec_I_vec_smth_y = &hDirAC->sec_I_vec_smth_y[i_sec][i_band];
            float *p_sec_I_vec_smth_z = &hDirAC->sec_I_vec_smth_z[i_sec][i_band];
#else
            float *p_azi_prev = &azi_prev[i_sec * N_bands + i_band];
            float *p_ele_prev = &ele_prev[i_sec * N_bands + i_band];

@@ -1023,7 +1030,7 @@ void calculate_hodirac_sector_parameters(
            float *p_sec_I_vec_smth_x = &sec_I_vec_smth_x[i_sec][i_band];
            float *p_sec_I_vec_smth_y = &sec_I_vec_smth_y[i_sec][i_band];
            float *p_sec_I_vec_smth_z = &sec_I_vec_smth_z[i_sec][i_band];

#endif
            *p_sec_I_vec_x = 0.f;
            *p_sec_I_vec_y = 0.f;
            *p_sec_I_vec_z = 0.f;
@@ -1089,8 +1096,11 @@ void calculate_hodirac_sector_parameters(
                                       sec_z_real * sec_z_real + sec_z_imag * sec_z_imag );
                }
            }

#ifdef FIX_485_STATIC_BUFFERS
            if ( hDirAC->firstrun_sector_params )
#else
            if ( firstrun_sector_params )
#endif
            {
                *p_sec_I_vec_smth_x = *p_sec_I_vec_x;
                *p_sec_I_vec_smth_y = *p_sec_I_vec_y;
@@ -1132,7 +1142,11 @@ void calculate_hodirac_sector_parameters(
            }
            if ( tmp_diff > 0.5f )
            {
#ifdef FIX_485_STATIC_BUFFERS
                if ( hDirAC->firstrun_sector_params )
#else
                if ( firstrun_sector_params )
#endif
                {
                    *p_azi = 0.f;
                    *p_ele = 0.f;
@@ -1151,7 +1165,11 @@ void calculate_hodirac_sector_parameters(
        }
    }

#ifdef FIX_485_STATIC_BUFFERS
    hDirAC->firstrun_sector_params = 0;
#else
    firstrun_sector_params = 0;
#endif

    return;
}
+17 −4
Original line number Diff line number Diff line
@@ -49,9 +49,22 @@
 *---------------------------------------------------------------*/

#define MASA_EXTRA_BAND_META_BITS 40

#define MASA_SMALL_INC_META_BITS 10


#ifdef HR_METADATA
/*---------------------------------------------------------------
 * Local prototypes
 *---------------------------------------------------------------*/

static int16_t quantize_theta_masa( float x, const int16_t no_cb, float *xhat );

static int16_t quantize_phi_masa( float phi, const int16_t flag_delta, float *phi_hat, const int16_t n );

#endif


/*---------------------------------------------------------------
 * ivas_masa_setup()
 *
@@ -479,7 +492,7 @@ uint16_t index_theta_phi_16(
        sign_th = 1;
    }

    id_th = quantize_theta( abs_theta, gridData->no_theta, &theta_hat );
    id_th = quantize_theta_masa( abs_theta, gridData->no_theta, &theta_hat );
    if ( gridData->no_theta > 1 )
    {
        if ( gridData->no_phi[id_th] > 1 )
@@ -547,7 +560,7 @@ uint16_t index_theta_phi_16(
 *------------------------------------------------------------------------*/

/*! r: output index */
int16_t quantize_theta(
static int16_t quantize_theta_masa(
    float x,             /* i  : theta value to be quantized  */
    const int16_t no_cb, /* i  : number of codewords          */
    float *xhat          /* o  : quantized value              */
@@ -589,7 +602,7 @@ int16_t quantize_theta(
 *------------------------------------------------------------------------*/

/*! r: index azimuth */
int16_t quantize_phi_masa(
static int16_t quantize_phi_masa(
    float phi,                /* i  : azimuth value                                                   */
    const int16_t flag_delta, /* i  : flag indicating if the azimuth codebook is translated or not    */
    float *phi_hat,           /* o  : quantized azimuth                                               */
+36 −44
Original line number Diff line number Diff line
@@ -3119,21 +3119,6 @@ uint16_t index_theta_phi_16(
    float * p_phi,                                              /* i/o: input azimuth to be indexed             */
    const SPHERICAL_GRID_DATA *gridData                         /* i  : generated grid data                     */
);

/*! r: output index */
int16_t quantize_theta(
    float x,                                                    /* i  : theta value to be quantized             */
    const int16_t no_cb,                                        /* i  : number of codewords                     */
    float *xhat                                                 /* o  : quantized value                         */
);

/*! r: index azimuth */
int16_t quantize_phi_masa(
    float phi,                                                  /* i  : azimuth value                                                   */
    const int16_t flag_delta,                                   /* i  : flag indicating if the azimuth codebook is translated or not    */
    float *phi_hat,                                             /* o  : quantized azimuth                                               */
    const int16_t n                                             /* i  : azimuth codebook size                                           */
);
#endif

void reset_metadata_spatial(
@@ -3910,8 +3895,7 @@ void ivas_dirac_dec_compute_directional_responses(
#endif
    const float *surCohRatio,
    const int16_t shd_rot_max_order,                            /* i  : split-order rotation method                     */
    const float *p_Rmat              /* i  : rotation matrix                */
    ,
    const float *p_Rmat,                                        /* i  : rotation matrix                                 */
    const int16_t hodirac_flag                                  /* i  : flag to indicate HO-DirAC mode                  */
);

@@ -3921,9 +3905,11 @@ void ivas_dirac_dec_get_frequency_axis(
    const int16_t num_freq_bands );                             /* i  : number of frequency bands                         */

void calculate_hodirac_sector_parameters(
#ifdef FIX_485_STATIC_BUFFERS
	DIRAC_ENC_HANDLE hDirAC,
#endif
    float RealBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX],/* i  : signal vector (L+1)^2 x N_bins, real part      */
    float ImagBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX],/* i  : signal vector, imaginary part                  */
    const int16_t N_bins,                                           /* i  : number of bins                                  */
    const float beta,                                           /* i  : forgetting factor for average filtering         */
    const int16_t *band_grouping,                               /* i  : indices of band groups                          */
    const int16_t N_bands,                                      /* i  : number of bands (groups)                        */
@@ -4747,6 +4733,9 @@ ivas_error ivas_spar_covar_enc_open(
    const int32_t input_Fs,                                     /* i  : input sampling rate                     */
    const int16_t nchan_inp                                     /* i  : number of input channels                */
	,
#ifdef FIX_489_COV_SMOOTHING
    COV_SMOOTHING_TYPE smooth_mode,                    /* i : Smooth covariance for SPAR or MC*/
#endif
	const int32_t ivas_total_brate                              /* i  : IVAS total bitrate                      */
);

@@ -4777,6 +4766,9 @@ ivas_error ivas_spar_covar_smooth_enc_open(
    ivas_filterbank_t *pFb,                                     /* i/o: FB handle                               */
    const int16_t nchan_inp                                     /* i  : number of input channels                */
    ,
#ifdef FIX_489_COV_SMOOTHING
    COV_SMOOTHING_TYPE smooth_mode,                    /* i : Smooth covariance for SPAR or MC*/
#endif
    const int32_t ivas_total_brate                              /* i  : IVAS total bitrate             */
);

Loading