Commit 51413506 authored by bayers's avatar bayers
Browse files

JBM MASA and binaural renderer optimization, under subdefine MASA_PARAMBIN_SF_MAP

parent e255694c
Loading
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -3758,11 +3758,15 @@ void ivas_dirac_dec_output_synthesis_process_slot(
    const int16_t *azimuth,
    const int16_t *elevation,
    const float *diffuseness,
#ifndef MASA_PARAMBIN_SF_MAP
    const uint16_t coherence_flag,
#endif
#endif
    DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle                                */
#ifdef JBM_TSM_ON_TCS
#ifndef MASA_PARAMBIN_SF_MAP
    MASA_DECODER_HANDLE hMasa,
#endif
    const int16_t sh_rot_max_order,
#endif
    const float *p_Rmat,               /* i  : rotation matrix                             */
@@ -5028,11 +5032,19 @@ void ivas_masa_prerender(
#ifdef JBM_TSM_ON_TCS
void ivas_spar_param_to_masa_param_mapping_sf(
    Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct               */
#ifdef MASA_PARAMBIN_SF_MAP
    int16_t azimuth[CLDFB_NO_CHANNELS_MAX],
    int16_t elevation[CLDFB_NO_CHANNELS_MAX],
    float energy_ratio1[CLDFB_NO_CHANNELS_MAX],
    float spreadCoherence[CLDFB_NO_CHANNELS_MAX],
    float surroundingCoherence[CLDFB_NO_CHANNELS_MAX],
#else
    int16_t azimuth[][CLDFB_NO_CHANNELS_MAX],
    int16_t elevation[][CLDFB_NO_CHANNELS_MAX],
    float energy_ratio1[][CLDFB_NO_CHANNELS_MAX],
    float spreadCoherence[][CLDFB_NO_CHANNELS_MAX],
    float surroundingCoherence[][CLDFB_NO_CHANNELS_MAX],
#endif
    float inRe[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i  : Input audio in CLDFB domain, real */
    float inIm[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]  /* i  : Input audio in CLDFB domain, imag */
);
+1 −1
Original line number Diff line number Diff line
@@ -179,7 +179,7 @@
#define VARIABLE_SPEED_DECODING                         /* FhG: variable speed decoding employing the JBM functioniality */
#define JBM_TSM_ON_TCS                                  /* FhG: run the TSM part of JBM on the TCs instead of the final output pcm waveforms */
#ifdef JBM_TSM_ON_TCS
#define JBM_DIRAC_DEBUG_BE
#define MASA_PARAMBIN_SF_MAP
#endif
/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
+151 −34
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ ivas_error ivas_dirac_dec_config(
    num_outputs_diff_old = 0;
    num_protos_diff_old = 0;

#ifdef JBM_DIRAC_DEBUG_BE
#if defined( JBM_TSM_ON_TCS ) && !defined( MASA_PARAMBIN_SF_MAP )
    hDirAC->voip_active = st_ivas->hDecoderConfig->voip_active;
#endif

@@ -846,11 +846,18 @@ ivas_error ivas_dirac_dec_config(
#ifdef JBM_TSM_ON_TCS
            {
                int16_t map_idx;
                set_s( hDirAC->render_to_md_slot_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME );
                set_s( hDirAC->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME );
#ifdef MASA_PARAMBIN_SF_MAP
                for ( map_idx = 0; map_idx < DEFAULT_JBM_SUBFRAMES_5MS; map_idx++ )
                {
                    hDirAC->render_to_md_map[map_idx] = map_idx;
                }
#else
                for ( map_idx = 0; map_idx < DEFAULT_JBM_CLDFB_TIMESLOTS; map_idx++ )
                {
                    hDirAC->render_to_md_slot_map[map_idx] = map_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME;
                    hDirAC->render_to_md_map[map_idx] = map_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME;
                }
#endif
            }
#endif
        }
@@ -858,6 +865,23 @@ ivas_error ivas_dirac_dec_config(
        {
            hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR;
            hDirAC->dirac_bs_md_write_idx = DELAY_MASA_PARAM_DEC_SFR;
#ifdef JBM_TSM_ON_TCS
            {
                int16_t map_idx;
                set_s( hDirAC->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME );
#ifdef MASA_PARAMBIN_SF_MAP
                for ( map_idx = 0; map_idx < DEFAULT_JBM_SUBFRAMES_5MS; map_idx++ )
                {
                    hDirAC->render_to_md_map[map_idx] = map_idx;
                }
#else
                for ( map_idx = 0; map_idx < DEFAULT_JBM_CLDFB_TIMESLOTS; map_idx++ )
                {
                    hDirAC->render_to_md_map[map_idx] = map_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME;
                }
#endif
            }
#endif
        }
        else
        {
@@ -883,10 +907,10 @@ ivas_error ivas_dirac_dec_config(
#ifdef JBM_TSM_ON_TCS
            {
                int16_t map_idx;
                set_s( hDirAC->render_to_md_slot_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME );
                set_s( hDirAC->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME );
                for ( map_idx = 0; map_idx < DEFAULT_JBM_CLDFB_TIMESLOTS; map_idx++ )
                {
                    hDirAC->render_to_md_slot_map[map_idx] = hDirAC->dirac_read_idx + map_idx * num_slots_in_subfr / JBM_CLDFB_SLOTS_IN_SUBFRAME;
                    hDirAC->render_to_md_map[map_idx] = hDirAC->dirac_read_idx + map_idx * num_slots_in_subfr / JBM_CLDFB_SLOTS_IN_SUBFRAME;
                }
            }
#endif
@@ -2275,6 +2299,11 @@ void ivas_qmetadata_to_dirac(


#ifdef JBM_TSM_ON_TCS
/*-------------------------------------------------------------------------
 * ivas_dirac_dec_set_md_map()
 *
 * Set metadata index mapping for DirAC
 *------------------------------------------------------------------------*/
void ivas_dirac_dec_set_md_map(
    Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure  */
    int16_t nCldfbTs )
@@ -2304,13 +2333,43 @@ void ivas_dirac_dec_set_md_map(

    /* set mapping according to dirac_read_idx */

    set_s( hDirAC->render_to_md_slot_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME );

    ivas_jbm_dec_get_md_map( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, hDirAC->dirac_read_idx, hDirAC->dirac_md_buffer_length, hDirAC->render_to_md_slot_map );
    set_s( hDirAC->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME );
#ifdef MASA_PARAMBIN_SF_MAP
    if ( hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 )
    {
        ivas_jbm_dec_get_md_map( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, 0, hDirAC->dirac_md_buffer_length, hDirAC->render_to_md_map );
    }
    else
    {
#endif
        ivas_jbm_dec_get_md_map( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, hDirAC->dirac_read_idx, hDirAC->dirac_md_buffer_length, hDirAC->render_to_md_map );
#ifdef MASA_PARAMBIN_SF_MAP
    }
#endif

#ifdef MASA_PARAMBIN_SF_MAP
    if ( hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 )
    {
        float tmp;
        int16_t sf_idx, slot_idx, slot_idx_abs;
        slot_idx_abs = 0;
        for ( sf_idx = 0; sf_idx < hDirAC->nb_subframes; sf_idx++ )
        {
            tmp = 0.0f;
            for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[sf_idx]; slot_idx++ )
            {
                tmp += (float) hDirAC->render_to_md_map[slot_idx_abs];
                slot_idx_abs++;
            }
            hDirAC->render_to_md_map[sf_idx] = ( (int16_t) roundf( tmp / (float) hDirAC->subframe_nbslots[sf_idx] ) + hDirAC->dirac_read_idx ) % hDirAC->dirac_md_buffer_length;
        }
        set_s( &hDirAC->render_to_md_map[hDirAC->nb_subframes], 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME - hDirAC->nb_subframes );
    }
#endif

    return;
}

/*-------------------------------------------------------------------------
 * ivas_dirac_dec()
 *
@@ -2463,11 +2522,9 @@ void ivas_dirac_dec_render_sf(
{
    int16_t i, ch, idx_in, idx_lfe;
    DIRAC_DEC_HANDLE hDirAC;
#if defined( JBM_DIRAC_DEBUG_BE ) || !defined( JBM_TSM_ON_TCS )
    float dirEne;
    float surCohEner;
    float surCohRatio[CLDFB_NO_CHANNELS_MAX];
#endif
    int16_t subframe_idx;
#ifndef JBM_TSM_ON_TCS
    int16_t sf1, sf2;
@@ -2589,13 +2646,30 @@ void ivas_dirac_dec_render_sf(
    }

    /* copy parameters into local buffers*/
#ifdef MASA_PARAMBIN_SF_MAP
    if ( hDirAC->hConfig->dec_param_estim == TRUE )
    {
#endif
        for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ )
        {
        mvs2s( hDirAC->azimuth[hDirAC->render_to_md_slot_map[slot_idx + slot_idx_start]], azimuth[slot_idx], hDirAC->num_freq_bands );
        mvs2s( hDirAC->elevation[hDirAC->render_to_md_slot_map[slot_idx + slot_idx_start]], elevation[slot_idx], hDirAC->num_freq_bands );
        mvr2r( hDirAC->diffuseness_vector[hDirAC->render_to_md_slot_map[slot_idx + slot_idx_start]], diffuseness_vector[slot_idx], hDirAC->num_freq_bands );
            mvs2s( hDirAC->azimuth[hDirAC->render_to_md_map[slot_idx + slot_idx_start]], azimuth[slot_idx], hDirAC->num_freq_bands );
            mvs2s( hDirAC->elevation[hDirAC->render_to_md_map[slot_idx + slot_idx_start]], elevation[slot_idx], hDirAC->num_freq_bands );
            mvr2r( hDirAC->diffuseness_vector[hDirAC->render_to_md_map[slot_idx + slot_idx_start]], diffuseness_vector[slot_idx], hDirAC->num_freq_bands );
        }
#ifdef MASA_PARAMBIN_SF_MAP
    }
    else
    {
        for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ )
        {
            mvs2s( hDirAC->azimuth[hDirAC->render_to_md_map[subframe_idx]], azimuth[slot_idx], hDirAC->num_freq_bands );
            mvs2s( hDirAC->elevation[hDirAC->render_to_md_map[subframe_idx]], elevation[slot_idx], hDirAC->num_freq_bands );
            mvr2r( hDirAC->diffuseness_vector[hDirAC->render_to_md_map[subframe_idx]], diffuseness_vector[slot_idx], hDirAC->num_freq_bands );
        }
    }
#endif
#endif

    if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD )
    {
        set_zero( reference_power_smooth, hDirAC->num_freq_bands );
@@ -2645,15 +2719,18 @@ void ivas_dirac_dec_render_sf(
        p_Rmat = 0;
    }

#if defined( JBM_DIRAC_DEBUG_BE ) || !defined( JBM_TSM_ON_TCS )
#ifdef JBM_DIRAC_DEBUG_BE
#if defined( JBM_TSM_ON_TCS ) && !defined( MASA_PARAMBIN_SF_MAP )
    if ( st_ivas->hDecoderConfig->voip_active == 0 && hDirAC->hConfig->dec_param_estim == FALSE )
#else
        if ( hDirAC->hConfig->dec_param_estim == FALSE )
#endif
    {
#ifdef JBM_TSM_ON_TCS
        int16_t md_idx = hDirAC->render_to_md_slot_map[slot_idx_start];
#ifdef MASA_PARAMBIN_SF_MAP
        int16_t md_idx = hDirAC->render_to_md_map[subframe_idx];
#else
        int16_t md_idx = hDirAC->render_to_md_map[slot_idx_start];
#endif
#endif
        /* compute response */
        if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD )
@@ -2693,7 +2770,11 @@ void ivas_dirac_dec_render_sf(
        {
            ivas_dirac_dec_compute_gain_factors( hDirAC->num_freq_bands,
#ifdef JBM_TSM_ON_TCS
#ifdef MASA_PARAMBIN_SF_MAP
                                                 hDirAC->diffuseness_vector[md_idx],
#else
                                                 diffuseness_vector[0],
#endif
#else
                                                     hDirAC->diffuseness_vector[hDirAC->dirac_read_idx],
#endif
@@ -2746,7 +2827,7 @@ void ivas_dirac_dec_render_sf(
                                                          0 );
        }
    }
#endif


#ifdef JBM_TSM_ON_TCS
    for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ )
@@ -2816,7 +2897,11 @@ void ivas_dirac_dec_render_sf(
                                       Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1], Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1],
                                       slot_idx,
#ifdef JBM_TSM_ON_TCS
                                       hDirAC->render_to_md_slot_map[index_slot],
#ifdef MASA_PARAMBIN_SF_MAP
                                       hDirAC->render_to_md_map[subframe_idx],
#else
                                       hDirAC->render_to_md_map[index_slot],
#endif
#else
                                           subframe_idx,
#endif
@@ -3076,8 +3161,7 @@ void ivas_dirac_dec_render_sf(
                                                          p_Rmat,
                                                          st_ivas->hVBAPdata,
                                                          hDirAC->hOutSetup,
                                                          nchan_transport,
                                                          index_slot );
                                                          nchan_transport );
        }
        else
        {
@@ -3087,8 +3171,7 @@ void ivas_dirac_dec_render_sf(
                                                          0,
                                                          st_ivas->hVBAPdata,
                                                          hDirAC->hOutSetup,
                                                          nchan_transport,
                                                          index_slot );
                                                          nchan_transport );
        }
#else
            if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData->shd_rot_max_order > 0 )
@@ -3098,15 +3181,19 @@ void ivas_dirac_dec_render_sf(
                                                              azimuth[slot_idx],
                                                              elevation[slot_idx],
                                                              diffuseness_vector[slot_idx],
#ifndef MASA_PARAMBIN_SF_MAP
                                                              coherence_flag,
#endif
                                                              hDirAC,
#ifndef MASA_PARAMBIN_SF_MAP
                                                              st_ivas->hMasa,
#endif
                                                              st_ivas->hHeadTrackData->shd_rot_max_order,
                                                              p_Rmat,
                                                              st_ivas->hVBAPdata,
                                                              hDirAC->hOutSetup,
                                                              nchan_transport,
                                                              hDirAC->render_to_md_slot_map[index_slot] );
                                                              hDirAC->render_to_md_map[index_slot] );
            }
            else
            {
@@ -3115,15 +3202,19 @@ void ivas_dirac_dec_render_sf(
                                                              azimuth[slot_idx],
                                                              elevation[slot_idx],
                                                              diffuseness_vector[slot_idx],
#ifndef MASA_PARAMBIN_SF_MAP
                                                              coherence_flag,
#endif
                                                              hDirAC,
#ifndef MASA_PARAMBIN_SF_MAP
                                                              st_ivas->hMasa,
#endif
                                                              0,
                                                              0,
                                                              st_ivas->hVBAPdata,
                                                              hDirAC->hOutSetup,
                                                              nchan_transport,
                                                              hDirAC->render_to_md_slot_map[index_slot] );
                                                              hDirAC->render_to_md_map[index_slot] );
            }
#endif

@@ -3178,12 +3269,13 @@ void ivas_dirac_dec_render_sf(
            num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band];
            for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ )
            {
                mvs2s( azimuth[slot_idx], hDirAC->azimuth[hDirAC->render_to_md_slot_map[slot_idx + slot_idx_start]], num_freq_bands );
                mvs2s( elevation[slot_idx], hDirAC->elevation[hDirAC->render_to_md_slot_map[slot_idx + slot_idx_start]], num_freq_bands );
                mvr2r( diffuseness_vector[slot_idx], hDirAC->diffuseness_vector[hDirAC->render_to_md_slot_map[slot_idx + slot_idx_start]], num_freq_bands );
                mvs2s( azimuth[slot_idx], hDirAC->azimuth[hDirAC->render_to_md_map[slot_idx + slot_idx_start]], num_freq_bands );
                mvs2s( elevation[slot_idx], hDirAC->elevation[hDirAC->render_to_md_map[slot_idx + slot_idx_start]], num_freq_bands );
                mvr2r( diffuseness_vector[slot_idx], hDirAC->diffuseness_vector[hDirAC->render_to_md_map[slot_idx + slot_idx_start]], num_freq_bands );
            }
        }
        /* get the correct md index for the direction smoothing, it is always the first slot of the next subframe*/
#ifdef MASA_PARAMBIN_SF_MAP
        if ( slot_idx_start + hDirAC->subframe_nbslots[subframe_idx] == hDirAC->num_slots )
        {
            /* we are at the end, get the next one using the normal dirac read idx...*/
@@ -3198,8 +3290,33 @@ void ivas_dirac_dec_render_sf(
        }
        else
        {
            diff_md_idx = hDirAC->render_to_md_slot_map[slot_idx_start + hDirAC->subframe_nbslots[subframe_idx]];
            if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 )
            {
                diff_md_idx = hDirAC->render_to_md_map[slot_idx_start + hDirAC->subframe_nbslots[subframe_idx]];
            }
            else
            {
                diff_md_idx = hDirAC->render_to_md_map[subframe_idx + 1];
            }
        }
#else
        if ( slot_idx_start + hDirAC->subframe_nbslots[subframe_idx] == hDirAC->num_slots )
        {
            /* we are at the end, get the next one using the normal dirac read idx...*/
            if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 )
            {
                diff_md_idx = ( hDirAC->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % hDirAC->dirac_md_buffer_length;
            }
            else
            {
                diff_md_idx = ( hDirAC->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % hDirAC->dirac_md_buffer_length;
            }
        }
        else
        {
            diff_md_idx = hDirAC->render_to_md_map[slot_idx_start + hDirAC->subframe_nbslots[subframe_idx]];
        }
#endif

#endif
        ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( Cldfb_RealBuffer,
+37 −44

File changed.

Preview size limit exceeded, changes collapsed.

+23 −4
Original line number Diff line number Diff line
@@ -1253,6 +1253,7 @@ ivas_error ivas_masa_dec_reconfigure(

    ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &tmp, &tmp, &tmp );

#ifdef JBM_TSM_ON_TCS
    if ( st_ivas->hDecoderConfig->voip_active == 1 && st_ivas->renderer_type != RENDERER_DISABLE )
    {
        int16_t tc_nchan_to_allocate;
@@ -1272,7 +1273,7 @@ ivas_error ivas_masa_dec_reconfigure(
            }
        }
    }

#endif
    return error;
}

@@ -1285,11 +1286,19 @@ ivas_error ivas_masa_dec_reconfigure(
#ifdef JBM_TSM_ON_TCS
void ivas_spar_param_to_masa_param_mapping_sf(
    Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct               */
#ifdef MASA_PARAMBIN_SF_MAP
    int16_t azimuth[CLDFB_NO_CHANNELS_MAX],
    int16_t elevation[CLDFB_NO_CHANNELS_MAX],
    float energy_ratio1[CLDFB_NO_CHANNELS_MAX],
    float spreadCoherence[CLDFB_NO_CHANNELS_MAX],
    float surroundingCoherence[CLDFB_NO_CHANNELS_MAX],
#else
    int16_t azimuth[][CLDFB_NO_CHANNELS_MAX],
    int16_t elevation[][CLDFB_NO_CHANNELS_MAX],
    float energy_ratio1[][CLDFB_NO_CHANNELS_MAX],
    float spreadCoherence[][CLDFB_NO_CHANNELS_MAX],
    float surroundingCoherence[][CLDFB_NO_CHANNELS_MAX],
#endif
    float inRe[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i  : Input audio in CLDFB domain, real */
    float inIm[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]  /* i  : Input audio in CLDFB domain, imag */
)
@@ -1342,12 +1351,13 @@ void ivas_spar_param_to_masa_param_mapping_sf(
        }
    }


    slot_fac = 1.0f / (float) hSpar->subframe_nbslots[subframe_idx];

    /* Delay the SPAR mixing matrices to have them synced with the audio */
    for ( slot_idx = 0; slot_idx < hSpar->subframe_nbslots[subframe_idx]; slot_idx++ )
    {
        sf = hSpar->render_to_md_slot_map[slot_idx + slot_idx_start] / JBM_CLDFB_SLOTS_IN_SUBFRAME;
        sf = hSpar->render_to_md_map[slot_idx + slot_idx_start] / JBM_CLDFB_SLOTS_IN_SUBFRAME;
        if ( sf < SPAR_META_DELAY_SUBFRAMES )
        {
            mixer_mat_index = sf + MAX_PARAM_SPATIAL_SUBFRAMES - SPAR_META_DELAY_SUBFRAMES + 1;
@@ -1469,13 +1479,21 @@ void ivas_spar_param_to_masa_param_mapping_sf(
        ratio = I / fmaxf( 1e-12f, E );                                                                                   /* Energy ratio */
        ratio = fmaxf( 0.0f, fminf( 1.0f, ratio ) );

#ifdef MASA_PARAMBIN_SF_MAP
        azimuth[bin] = (int16_t) roundf( azi / PI_OVER_180 );
        elevation[bin] = (int16_t) roundf( ele / PI_OVER_180 );
        energy_ratio1[bin] = ratio;

        spreadCoherence[bin] = 0.0f;
        surroundingCoherence[bin] = 0.0f;
#else
        azimuth[0][bin] = (int16_t) roundf( azi / PI_OVER_180 );
        elevation[0][bin] = (int16_t) roundf( ele / PI_OVER_180 );
        energy_ratio1[0][bin] = ratio;

        spreadCoherence[0][bin] = 0.0f;
        surroundingCoherence[0][bin] = 0.0f;

#endif
        /* Determine directional distribution of the indirect audio based on the SPAR mixing matrices (and the transport audio signals when 2 TC) */
        if ( hDiffuseDist != NULL )
        {
@@ -1515,6 +1533,7 @@ void ivas_spar_param_to_masa_param_mapping_sf(
        }
    }

#ifndef MASA_PARAMBIN_SF_MAP
    for ( slot_idx = 1; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ )
    {
        mvs2s( azimuth[0], azimuth[slot_idx], nBins );
@@ -1523,7 +1542,7 @@ void ivas_spar_param_to_masa_param_mapping_sf(
        mvr2r( surroundingCoherence[0], surroundingCoherence[slot_idx], nBins );
        mvr2r( energy_ratio1[0], energy_ratio1[slot_idx], nBins );
    }

#endif

    return;
}
Loading