Commit 4cbab360 authored by vaclav's avatar vaclav
Browse files
parents 85800755 db5217cd
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -3543,8 +3543,10 @@ void ivas_dirac_dec_output_synthesis_process_slot(
    const float *p_Rmat,                                        /* i  : rotation matrix                             */
    const VBAP_HANDLE hVBAPdata,                                /* i  : VBAP structure                              */
    const IVAS_OUTPUT_SETUP hOutSetup,                          /* i  : output setup structure                      */
    const int16_t nchan_transport,                              /* i  : number of transport channels                */
    const int16_t index_slot 
    const int16_t nchan_transport                               /* i  : number of transport channels                */
#ifndef FIX_401_DIRAC_RENDERER_META_READ_INDICES
    , const int16_t index_slot
#endif
);

void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd(
@@ -3597,8 +3599,10 @@ void ivas_dirac_dec_compute_directional_responses(
    DIRAC_DEC_HANDLE hDirAC,                                    /* i/o: DirAC handle                                    */
    const VBAP_HANDLE hVBAPdata,                                /* i  : VBAP structure                                  */
    const MASA_DECODER_HANDLE hMasa,                            /* i  : MASA decoder structure                          */
#ifndef FIX_401_DIRAC_RENDERER_META_READ_INDICES
    const int16_t direction_idx,                                /* i  : index for direction (azi and ele)               */
    const int16_t subframe_idx,                                 /* i  : subframe index                                  */
#endif
    const float *surCohRatio,
    const int16_t shd_rot_max_order,                            /* i  : split-order rotation method                     */
    const float *p_Rmat                                         /* i  : rotation matrix                                 */
+1 −0
Original line number Diff line number Diff line
@@ -169,6 +169,7 @@

#define ISSUE_24_CLEANUP_MCT_LFE                        /* Issue 24: Cleanup LFE path withing MCT */ 

#define FIX_401_DIRAC_RENDERER_META_READ_INDICES        /* Nokia: Issue 401: Fix metadata reading indices in DirAC renderer. */

/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
+21 −4
Original line number Diff line number Diff line
@@ -2182,6 +2182,7 @@ void ivas_dirac_dec(
                for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ )
                {
                    index_slot = subframe_idx * hDirAC->subframe_nbslots + slot_idx;
                    /* Todo: This access to azimuth & elevation may use wrong indices as access should probably be based on hDirAC->dirac_read_idx */
                    rotateAziEle_DirAC( hDirAC->azimuth[index_slot], hDirAC->elevation[index_slot], num_freq_bands, hDirAC->num_freq_bands, p_Rmat );
                }
            }
@@ -2207,7 +2208,11 @@ void ivas_dirac_dec(
                    for ( i = 0; i < hDirAC->num_freq_bands; i++ )
                    {
                        dirEne = hDirAC->h_output_synthesis_psd_state.direct_power_factor[i];
#ifdef FIX_401_DIRAC_RENDERER_META_READ_INDICES
                        surCohEner = hDirAC->h_output_synthesis_psd_state.diffuse_power_factor[i] * hDirAC->surroundingCoherence[hDirAC->dirac_read_idx][i];
#else
                        surCohEner = hDirAC->h_output_synthesis_psd_state.diffuse_power_factor[i] * hDirAC->surroundingCoherence[subframe_idx][i];
#endif
                        hDirAC->h_output_synthesis_psd_state.diffuse_power_factor[i] -= surCohEner;
                        hDirAC->h_output_synthesis_psd_state.direct_power_factor[i] += surCohEner;

@@ -2245,8 +2250,10 @@ void ivas_dirac_dec(
                ivas_dirac_dec_compute_directional_responses( hDirAC,
                                                              st_ivas->hVBAPdata,
                                                              st_ivas->hMasa,
#ifndef FIX_401_DIRAC_RENDERER_META_READ_INDICES
                                                              subframe_idx,
                                                              subframe_idx,
#endif
                                                              surCohRatio,
                                                              st_ivas->hHeadTrackData->shd_rot_max_order,
                                                              p_Rmat );
@@ -2256,8 +2263,10 @@ void ivas_dirac_dec(
                ivas_dirac_dec_compute_directional_responses( hDirAC,
                                                              st_ivas->hVBAPdata,
                                                              st_ivas->hMasa,
#ifndef FIX_401_DIRAC_RENDERER_META_READ_INDICES
                                                              subframe_idx,
                                                              subframe_idx,
#endif
                                                              surCohRatio,
                                                              0,
                                                              0 );
@@ -2555,8 +2564,12 @@ void ivas_dirac_dec(
                                                              p_Rmat,
                                                              st_ivas->hVBAPdata,
                                                              hDirAC->hOutSetup,
                                                              nchan_transport,
                                                              index_slot );
                                                              nchan_transport
#ifndef FIX_401_DIRAC_RENDERER_META_READ_INDICES
                                                              ,
                                                              index_slot
#endif
                );
            }
            else
            {
@@ -2566,8 +2579,12 @@ void ivas_dirac_dec(
                                                              0,
                                                              st_ivas->hVBAPdata,
                                                              hDirAC->hOutSetup,
                                                              nchan_transport,
                                                              index_slot );
                                                              nchan_transport
#ifndef FIX_401_DIRAC_RENDERER_META_READ_INDICES
                                                              ,
                                                              index_slot
#endif
                );
            }

            if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD )
+45 −7
Original line number Diff line number Diff line
@@ -517,8 +517,12 @@ void ivas_dirac_dec_output_synthesis_process_slot(
    const float *p_Rmat,               /* i  : rotation matrix             */
    const VBAP_HANDLE hVBAPdata,       /* i  : VBAP structure              */
    const IVAS_OUTPUT_SETUP hOutSetup, /* i  : output setup structure      */
    const int16_t nchan_transport,     /* i  : number of transport channels*/
    const int16_t index_slot )
    const int16_t nchan_transport      /* i  : number of transport channels*/
#ifndef FIX_401_DIRAC_RENDERER_META_READ_INDICES
    ,
    const int16_t index_slot
#endif
)
{
    int16_t num_freq_bands, num_channels_dir;
    int16_t num_freq_bands_diff, num_channels_diff;
@@ -556,8 +560,11 @@ void ivas_dirac_dec_output_synthesis_process_slot(
        ivas_dirac_dec_compute_directional_responses( hDirAC,
                                                      hVBAPdata,
                                                      NULL,
#ifndef FIX_401_DIRAC_RENDERER_META_READ_INDICES
                                                      index_slot,
                                                      index_slot / MAX_PARAM_SPATIAL_SUBFRAMES, NULL,
                                                      index_slot / MAX_PARAM_SPATIAL_SUBFRAMES,
#endif
                                                      NULL,
                                                      2,
                                                      p_Rmat );

@@ -1484,8 +1491,10 @@ void ivas_dirac_dec_compute_directional_responses(
    DIRAC_DEC_HANDLE hDirAC,         /* i/o: DirAC handle                   */
    const VBAP_HANDLE hVBAPdata,     /* i  : VBAP structure                 */
    const MASA_DECODER_HANDLE hMasa, /* i  : MASA decoder structure         */
#ifndef FIX_401_DIRAC_RENDERER_META_READ_INDICES
    const int16_t direction_idx, /* i  : index for direction (azi and ele), can slot index (>2TCs) or subrame index (<=2TCs)  */
    const int16_t subframe_idx,  /* i  : subframe index                 */
#endif
    const float *surCohRatio,
    const int16_t shd_rot_max_order, /* i  : split-order rotation method    */
    const float *p_Rmat              /* i  : rotation matrix                */
@@ -1522,8 +1531,8 @@ void ivas_dirac_dec_compute_directional_responses(
    elevation = hDirAC->elevation[hDirAC->dirac_read_idx];
    if ( hDirAC->numSimultaneousDirections == 2 )
    {
        azimuth2 = hDirAC->azimuth2[direction_idx];
        elevation2 = hDirAC->elevation2[direction_idx];
        azimuth2 = hDirAC->azimuth2[hDirAC->dirac_read_idx];
        elevation2 = hDirAC->elevation2[hDirAC->dirac_read_idx];
    }
    codingBand = -1;

@@ -1575,17 +1584,32 @@ void ivas_dirac_dec_compute_directional_responses(
                          hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD || hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO )
                {
                    /* Synthesize the first direction */
#ifdef FIX_401_DIRAC_RENDERER_META_READ_INDICES
                    spreadCoherencePanningHoa( azimuth[k], elevation[k], hDirAC->spreadCoherence[hDirAC->dirac_read_idx][k], direct_response_hoa, num_channels_dir, hDirAC->hOutSetup.ambisonics_order );
#else
                    spreadCoherencePanningHoa( azimuth[k], elevation[k], hDirAC->spreadCoherence[subframe_idx][k], direct_response_hoa, num_channels_dir, hDirAC->hOutSetup.ambisonics_order );
#endif

                    /* Synthesize the second direction and combine the gains */
                    if ( hDirAC->numSimultaneousDirections == 2 )
                    {
#ifdef FIX_401_DIRAC_RENDERER_META_READ_INDICES
                        spreadCoherencePanningHoa( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[hDirAC->dirac_read_idx][k], direct_response_dir2, num_channels_dir, hDirAC->hOutSetup.ambisonics_order );
#else
                        spreadCoherencePanningHoa( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[subframe_idx][k], direct_response_dir2, num_channels_dir, hDirAC->hOutSetup.ambisonics_order );
#endif

                        /* Combine gains from the two directions */
#ifdef FIX_401_DIRAC_RENDERER_META_READ_INDICES
                        totalDirect = hDirAC->energy_ratio1[hDirAC->dirac_read_idx][k] + hDirAC->energy_ratio2[hDirAC->dirac_read_idx][k] + EPSILON;
                        directRatio[0] = hDirAC->energy_ratio1[hDirAC->dirac_read_idx][k] / totalDirect;
                        directRatio[1] = hDirAC->energy_ratio2[hDirAC->dirac_read_idx][k] / totalDirect;
#else
                        totalDirect = hDirAC->energy_ratio1[subframe_idx][k] + hDirAC->energy_ratio2[subframe_idx][k] + EPSILON;
                        directRatio[0] = hDirAC->energy_ratio1[subframe_idx][k] / totalDirect;
                        directRatio[1] = hDirAC->energy_ratio2[subframe_idx][k] / totalDirect;
#endif

                        for ( l = 0; l < num_channels_dir; l++ )
                        {
                            direct_response_hoa[l] *= directRatio[0];
@@ -1633,20 +1657,34 @@ void ivas_dirac_dec_compute_directional_responses(
            else if ( hDirAC->panningConf == DIRAC_PANNING_VBAP ) /*VBAP*/
            {
                /* Synthesize the first direction */
#ifdef FIX_401_DIRAC_RENDERER_META_READ_INDICES
                spreadCoherencePanningVbap( azimuth[k], elevation[k], hDirAC->spreadCoherence[hDirAC->dirac_read_idx][k], direct_response_ls, num_channels_dir, hVBAPdata );
#else
                spreadCoherencePanningVbap( azimuth[k], elevation[k], hDirAC->spreadCoherence[subframe_idx][k], direct_response_ls, num_channels_dir, hVBAPdata );
#endif
                normalizePanningGains( direct_response_ls, num_channels_dir );

                /* Synthesize the second direction and combine the gains */
                if ( hDirAC->numSimultaneousDirections == 2 )
                {
#ifdef FIX_401_DIRAC_RENDERER_META_READ_INDICES
                    spreadCoherencePanningVbap( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[hDirAC->dirac_read_idx][k], direct_response_dir2, num_channels_dir, hVBAPdata );
#else
                    spreadCoherencePanningVbap( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[subframe_idx][k], direct_response_dir2, num_channels_dir, hVBAPdata );
#endif

                    normalizePanningGains( direct_response_dir2, num_channels_dir );

                    /* Combine gains from the two directions */
#ifdef FIX_401_DIRAC_RENDERER_META_READ_INDICES
                    totalDirect = hDirAC->energy_ratio1[hDirAC->dirac_read_idx][k] + hDirAC->energy_ratio2[hDirAC->dirac_read_idx][k] + EPSILON;
                    directRatio[0] = hDirAC->energy_ratio1[hDirAC->dirac_read_idx][k] / totalDirect;
                    directRatio[1] = hDirAC->energy_ratio2[hDirAC->dirac_read_idx][k] / totalDirect;
#else
                    totalDirect = hDirAC->energy_ratio1[subframe_idx][k] + hDirAC->energy_ratio2[subframe_idx][k] + EPSILON;
                    directRatio[0] = hDirAC->energy_ratio1[subframe_idx][k] / totalDirect;
                    directRatio[1] = hDirAC->energy_ratio2[subframe_idx][k] / totalDirect;
#endif
                    for ( l = 0; l < num_channels_dir; l++ )
                    {
                        direct_response_ls[l] *= directRatio[0];