Commit 4c52d6e8 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

add FIX_1419_SPATIAL_UMX - incremental switch on top of...

add FIX_1419_SPATIAL_UMX - incremental switch on top of FIX_1419_MONO_STEREO_UMX to enable spatial upmix
parent 8ecb5300
Loading
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -222,6 +222,18 @@ typedef enum _ivas_binaural_renderer_type
    IVAS_BIN_RENDERER_TYPE_DEFAULT,

} IVAS_BIN_RENDERER_TYPE;
#ifdef FIX_1419_SPATIAL_UMX

typedef struct _IVAS_MS_UMX_CONF_DATA
{
    int16_t spatialEnabled; /* internal flag for spatial rendering */
    int16_t stereoLR;       /* internal flag to use ±90 for BRIRs */
    float radius;
    float azi[2];
    float ele[2];

} IVAS_MS_UMX_CONF_DATA, *IVAS_MS_UMX_CONF_HANDLE;
#endif

/*----------------------------------------------------------------------------------*
 * Split rendering API constants, structures, and enums
@@ -335,6 +347,9 @@ typedef struct _IVAS_RENDER_CONFIG
#endif
    IVAS_ROOM_ACOUSTICS_CONFIG_DATA roomAcoustics;
    ISAR_SPLIT_REND_CONFIG_DATA split_rend_config;
#ifdef FIX_1419_SPATIAL_UMX
    IVAS_MS_UMX_CONF_DATA mono_stereo_upmix_config;
#endif
    float directivity[IVAS_MAX_NUM_OBJECTS * 3];
    float distAtt[3];

+3 −0
Original line number Diff line number Diff line
@@ -172,6 +172,9 @@
#define FIX_1413_IGF_INIT_PRINTOUT                      /* FhG: use correct variable for IGF initiliazation */
#define RENDERER_MD_SYNC_DELAY_TO_INTEGER               /* FhG: change data type of metadata sync delay in ext renderer to int16_t for better BASOP portability (and nicer code) */
#define FIX_1419_MONO_STEREO_UMX                        /* FhG: fix for issue 1419 : support upmix to all output formats for mono and stereo */
#ifdef FIX_1419_MONO_STEREO_UMX
#define FIX_1419_SPATIAL_UMX                            /* FhG: issue 1419: enable spatial upmix for mono/stereo; configurable via renderer config. NOTE: requires FIX_1119_SPLIT_RENDERING_VOIP */
#endif


/* #################### End BE switches ################################## */
+25 −0
Original line number Diff line number Diff line
@@ -1353,6 +1353,17 @@ ivas_error ivas_init_decoder(
    {
        ivas_output_init( &( st_ivas->hTransSetup ), st_ivas->transport_config );
    }
#ifdef FIX_1419_SPATIAL_UMX

    /* Override transport config values from render config */
    if ( ( st_ivas->ivas_format == MONO_FORMAT || st_ivas->ivas_format == STEREO_FORMAT ) &&
         st_ivas->hRenderConfig != NULL &&
         st_ivas->hRenderConfig->mono_stereo_upmix_config.spatialEnabled )
    {
        st_ivas->hTransSetup.ls_azimuth = st_ivas->hRenderConfig->mono_stereo_upmix_config.azi;
        st_ivas->hTransSetup.ls_elevation = st_ivas->hRenderConfig->mono_stereo_upmix_config.ele;
    }
#endif

    if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA )
    {
@@ -2166,9 +2177,21 @@ ivas_error ivas_init_decoder(
    else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM )
    {
#ifdef IVAS_RTPDUMP
#ifdef FIX_1419_SPATIAL_UMX
        if ( ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation || st_ivas->hCombinedOrientationData ) &&
             ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM &&
               ( st_ivas->ivas_format == MONO_FORMAT || st_ivas->ivas_format == STEREO_FORMAT || st_ivas->ivas_format == MC_FORMAT ) ) )
#else
        if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM && st_ivas->ivas_format == MC_FORMAT && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation || st_ivas->hCombinedOrientationData ) )
#endif
#else
#ifdef FIX_1419_SPATIAL_UMX
        if ( ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) &&
             ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM &&
               ( st_ivas->ivas_format == MONO_FORMAT || st_ivas->ivas_format == STEREO_FORMAT || st_ivas->ivas_format == MC_FORMAT ) ) )
#else
        if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM && st_ivas->ivas_format == MC_FORMAT && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) )
#endif
#endif
        {
            if ( ( error = efap_init_data( &( st_ivas->hEFAPdata ), st_ivas->hIntSetup.ls_azimuth, st_ivas->hIntSetup.ls_elevation, st_ivas->hIntSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK )
@@ -3183,11 +3206,13 @@ static ivas_error doSanityChecks_IVAS(
        {
            return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified!" );
        }
#ifndef FIX_1419_SPATIAL_UMX
        if ( ( st_ivas->ivas_format == MONO_FORMAT || st_ivas->ivas_format == STEREO_FORMAT ) &&
             ( output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
        {
            return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified!" );
        }
#endif
#ifndef FIX_1419_MONO_STEREO_UMX
    }
#endif
+50 −0
Original line number Diff line number Diff line
@@ -971,6 +971,56 @@ ivas_error ivas_jbm_dec_render(
                }
            }
        }
#ifdef FIX_1419_SPATIAL_UMX
        else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD )
        {
            /* Rendering for BINAURAL, BINAURAL_ROOM_REVERB and split rendering */
            if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
            {
                if ( ( error = ivas_td_binaural_renderer_sf_splitBinaural( st_ivas, p_output, *nSamplesRendered ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
            }
            else
            {
                if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_output, *nSamplesRendered ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
            }
        }
        else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM )
        {
            /* Rendering for BINAURAL_ROOM_IR */
            if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->ivas_format == MONO_FORMAT )
            {
                /* Since rotation is performed on 7.1+4, we treat mono as 7.1+4 with other channels zero
                 * so move the mono content in index 0 to index 2 (center channel) */
                float *tmp;
                tmp = p_output[2];
                p_output[2] = p_output[0];
                p_output[0] = tmp;
            }

            if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper,
                                                           st_ivas->intern_config,
                                                           st_ivas->hOutSetup.output_config,
                                                           st_ivas->hDecoderConfig,
                                                           st_ivas->hCombinedOrientationData,
                                                           &st_ivas->hIntSetup,
                                                           st_ivas->hEFAPdata,
                                                           st_ivas->hTcBuffer,
                                                           p_output,
                                                           p_output,
                                                           *nSamplesRendered,
                                                           output_Fs,
                                                           0 ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
#endif /* FIX_1419_SPATIAL_UMX */
#endif /* FIX_1419_MONO_STEREO_UMX */
    }
    else if ( st_ivas->ivas_format == ISM_FORMAT )
+17 −0
Original line number Diff line number Diff line
@@ -66,8 +66,22 @@ ivas_error ivas_td_binaural_open(
        return IVAS_ERROR( IVAS_ERR_INTERNAL, "HRTF binary file present but not used in TD renderer" );
    }

#ifdef FIX_1419_SPATIAL_UMX
    return ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD,
                                         st_ivas->hDecoderConfig->output_Fs,
                                         num_src,
                                         st_ivas->ivas_format,
                                         st_ivas->transport_config,
                                         st_ivas->hRenderConfig->directivity,
                                         st_ivas->hRenderConfig->distAtt,
                                         ( st_ivas->hRenderConfig != NULL ) ? &st_ivas->hRenderConfig->mono_stereo_upmix_config.radius : NULL,
                                         st_ivas->hTransSetup,
                                         &st_ivas->hBinRendererTd,
                                         &st_ivas->binaural_latency_ns );
#else
    return ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, num_src, st_ivas->ivas_format,
                                         st_ivas->transport_config, st_ivas->hRenderConfig->directivity, st_ivas->hRenderConfig->distAtt, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns );
#endif
}


@@ -312,6 +326,9 @@ ivas_error ivas_td_binaural_renderer_sf_splitBinaural(
                                                     st_ivas->transport_config,
                                                     st_ivas->hRenderConfig->directivity,
                                                     st_ivas->hRenderConfig->distAtt,
#ifdef FIX_1419_SPATIAL_UMX
                                                     ( st_ivas->hRenderConfig != NULL ) ? &st_ivas->hRenderConfig->mono_stereo_upmix_config.radius : NULL,
#endif
                                                     st_ivas->hTransSetup,
                                                     &st_ivas->hTdRendHandles[i],
                                                     &st_ivas->binaural_latency_ns ) ) != IVAS_ERR_OK )
Loading