Commit 5cb4d88b authored by Sumeyra Demir Kanik's avatar Sumeyra Demir Kanik
Browse files

Merging from main, ConflictsMerge branch 'main' into 356-ism-audio-and-meta-out-of-sync-in-decoder

parents 946fee59 f221482e
Loading
Loading
Loading
Loading
+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                                               */
+30 −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)                        */
+2 −0
Original line number Diff line number Diff line
@@ -204,6 +204,8 @@
#define FIX_482_DUMMYDEC_INIT                           /* Nokia: fix issue #428: missing inits for dummyDec in IVAS_rend */
#define FIX_468_16KHZ_PUPMIX                            /* Dlb: Fix issue 468 for Param Upmix at 16kHz sampling rate */

#define FIX_485_STATIC_BUFFERS                          /* FhG: move static buffers in DirAC parameter estimator to the DirAC struct */

/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */

+1 −2
Original line number Diff line number Diff line
@@ -279,7 +279,6 @@ ivas_error ivas_dirac_dec_config(
    ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
    hodirac_flag = ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order );


    if ( flag_config == DIRAC_RECONFIGURE )
    {
        hDirAC = st_ivas->hDirAC;
@@ -433,7 +432,7 @@ ivas_error ivas_dirac_dec_config(

    if ( nchan_transport_orig > 2 && hDirAC->hOutSetup.is_loudspeaker_setup && st_ivas->renderer_type == RENDERER_DIRAC
#ifdef FIX_DIRAC_LS_SYNTHESIS_CONFIG
         && !ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order )
         && !hodirac_flag
#endif
    )
    {
Loading