Commit e0cdf219 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

fixes from internal code review

parent 790e739e
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ void ivas_renderer_select(
            *renderer_type = RENDERER_NON_DIEGETIC_DOWNMIX;
#ifdef FIX_1419_SPATIAL_UMX

            if ( st_ivas->hRenderConfig->mono_stereo_upmix_config.spatialEnabled )
            if ( st_ivas->hRenderConfig != NULL && st_ivas->hRenderConfig->mono_stereo_upmix_config.spatialEnabled )
            {
                /* spatial rendering configuration */
                if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
@@ -107,7 +107,7 @@ void ivas_renderer_select(
            *renderer_type = RENDERER_DISABLE;
#ifdef FIX_1419_SPATIAL_UMX

            if ( st_ivas->hRenderConfig->mono_stereo_upmix_config.spatialEnabled )
            if ( st_ivas->hRenderConfig != NULL && st_ivas->hRenderConfig->mono_stereo_upmix_config.spatialEnabled )
            {
                /* spatial rendering configuration */
                if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
+10 −0
Original line number Diff line number Diff line
@@ -3436,6 +3436,16 @@ ivas_error IVAS_DEC_FeedRenderConfig(
            return error;
        }
    }
    else
    {
        /* reset to default if false; could be triggered at runtime */
        hRenderConfig->mono_stereo_upmix_config.radius = 0.0f;
        hRenderConfig->mono_stereo_upmix_config.spatialEnabled = FALSE;
        hRenderConfig->mono_stereo_upmix_config.stereoLR = FALSE;

        set_zero( hRenderConfig->mono_stereo_upmix_config.azi, 2 );
        set_zero( hRenderConfig->mono_stereo_upmix_config.ele, 2 );
    }
#endif

    hRenderConfig->split_rend_config = renderConfig.split_rend_config;
+16 −17
Original line number Diff line number Diff line
@@ -507,6 +507,11 @@ ivas_error ms_upmix_validate_config(
    if ( pMsUpmixConfig->radius == 0.f )
    {
        pMsUpmixConfig->spatialEnabled = FALSE;
        /* re-validate for split rendering */
        if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
        {
            return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "Configuring mono/stereo upmix for split rendering requires a spatial upmix" );
        }
        return IVAS_ERR_OK;
    }

@@ -520,11 +525,7 @@ ivas_error ms_upmix_validate_config(
    /* validate speaker positions */
    if ( ivasFormat == MONO_FORMAT )
    {
        if ( azi_abs[0] != 0 )
        {
            return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "Mono cannot be panned" );
        }
        if ( ele_abs[0] != 0 )
        if ( azi_abs[0] != 0 || ele_abs[0] != 0 )
        {
            return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "Mono cannot be panned" );
        }
@@ -534,21 +535,19 @@ ivas_error ms_upmix_validate_config(
        if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
        {
            /* validate provided positions match BRIR */
            if ( ( azi_abs[0] != 30 && azi_abs[0] != 90 ) ||
                 ( azi_abs[1] != 30 && azi_abs[1] != 90 ) )
            if ( !( ( pMsUpmixConfig->azi[0] == -pMsUpmixConfig->azi[1] ) &&
                    ( pMsUpmixConfig->azi[0] == 30 || pMsUpmixConfig->azi[0] == 90 ) ) )
            {
                return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "BINAURAL_ROOM_IR only supports ±30 and ±90 degree azimuth" );
            }
            /* flag to select ±90 azi loudspeakers */
            pMsUpmixConfig->stereoLR = ( azi_abs[0] == 90 ) ? TRUE : FALSE;

            /* validate elevation */
            if ( ele_abs[0] != 0 || ele_abs[1] != 0 )
            {
                return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "BINAURAL_ROOM_IR does not allow nonzero elevation" );
            }

            /* flag to select ±90 azi loudspeakers */
            if ( azi_abs[0] == 90 && azi_abs[1] == 90 )
            {
                pMsUpmixConfig->stereoLR = TRUE;
            }
        }
        else /* HRIR based formats and split rendering */
        {
@@ -559,15 +558,15 @@ ivas_error ms_upmix_validate_config(
            }
            if ( pMsUpmixConfig->ele[0] != pMsUpmixConfig->ele[1] )
            {
                return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "Panning stereo pair with differring elevation is not allowed" );
                return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "Panning stereo pair with differing elevation is not allowed" );
            }

            /* restrict values */
            if ( ( azi_abs[0] > 90 ) || ( azi_abs[1] > 90 ) )
            /* restrict values; test only the first value since we know the next index is symmetric (azi) or equivalent (ele) */
            if ( azi_abs[0] > 90 )
            {
                return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "Panning stereo pair beyond |90| degrees azimuth is not allowed" );
            }
            if ( ( ele_abs[0] > 45 ) || ( ele_abs[1] > 45 ) )
            if ( ele_abs[0] > 45 )
            {
                return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "Panning stereo pair beyond |45| degrees of elevation is not allowed" );
            }
+1 −1
Original line number Diff line number Diff line
@@ -142,9 +142,9 @@ ivas_error ivas_render_config_init_from_rom(
#ifdef FIX_1419_SPATIAL_UMX

    /* Mono/Stereo upmix configuration */
    ( *hRenderConfig )->mono_stereo_upmix_config.radius = 0.f;
    ( *hRenderConfig )->mono_stereo_upmix_config.spatialEnabled = FALSE;
    ( *hRenderConfig )->mono_stereo_upmix_config.stereoLR = FALSE;
    ( *hRenderConfig )->mono_stereo_upmix_config.radius = 0.f;
    set_zero( &( *hRenderConfig )->mono_stereo_upmix_config.azi[0], 2 );
    set_zero( &( *hRenderConfig )->mono_stereo_upmix_config.ele[0], 2 );
#endif
+5 −0
Original line number Diff line number Diff line
@@ -2586,6 +2586,7 @@ ivas_error RenderConfigReader_read(
                        if ( read_txt_vector( pValue, 2, &hRenderConfig->mono_stereo_upmix_config.azi[0] ) )
                        {
                            errorHandler( item, ERROR_VALUE_INVALID );
                            free( pValue );
                            return IVAS_ERR_INVALID_RENDER_CONFIG;
                        }
                        /* set flag to signal that spatial rendering is enabled */
@@ -2596,6 +2597,7 @@ ivas_error RenderConfigReader_read(
                        if ( read_txt_vector( pValue, 2, &hRenderConfig->mono_stereo_upmix_config.ele[0] ) )
                        {
                            errorHandler( item, ERROR_VALUE_INVALID );
                            free( pValue );
                            return IVAS_ERR_INVALID_RENDER_CONFIG;
                        }
                        /* set flag to signal that spatial rendering is enabled */
@@ -2606,11 +2608,14 @@ ivas_error RenderConfigReader_read(
                        if ( !sscanf( pValue, "%f", &hRenderConfig->mono_stereo_upmix_config.radius ) )
                        {
                            errorHandler( item, ERROR_VALUE_INVALID );
                            free( pValue );
                            return IVAS_ERR_INVALID_RENDER_CONFIG;
                        }
                        /* set flag to signal that spatial rendering is enabled */
                        hRenderConfig->mono_stereo_upmix_config.spatialEnabled = 1;
                    }
                }
                free( pValue );
            }
#endif
            else if ( strcmp( chapter, "SPLITREND" ) == 0 && strlen( pParams ) != 0 )