Commit a042a3ef authored by Marek Szczerba's avatar Marek Szczerba
Browse files

Updated the early reflections text configuration parsing

parent 51c92cbe
Loading
Loading
Loading
Loading
+68 −65
Original line number Diff line number Diff line
@@ -2273,14 +2273,9 @@ ivas_error RenderConfigReader_read(
                        aeHasDsr = TRUE;
                    }
#ifdef CONTROL_METADATA_EARLY_REFLECTIONS
                    else if ( strcmp( item, "HASEARLYREFLECTIONS" ) == 0 )
                    else if ( strcmp( item, "EARLYREFLECTIONSSIZE" ) == 0 )
                    {
                        if ( read_txt_bool( pValue, &aeHasER ) )
                        {
                            errorHandler( item, ERROR_VALUE_INVALID );
                            return IVAS_ERR_INVALID_RENDER_CONFIG;
                        }
                        if ( aeHasER == TRUE )
                        if ( pRenderConfigReader->pAE[acIdx].pEarlyReflections == NULL )
                        {
                            if ( ( pRenderConfigReader->pAE[acIdx].pEarlyReflections = (EarlyReflectionsConfig *) malloc( sizeof( EarlyReflectionsConfig ) ) ) == NULL )
                            {
@@ -2288,9 +2283,7 @@ ivas_error RenderConfigReader_read(
                            }
                            pRenderConfigReader->pAE[acIdx].pEarlyReflections->pListenerOrigin = NULL;
                            pRenderConfigReader->pAE[acIdx].pEarlyReflections->lowComplexity = FALSE;
                            aeHasERsize = aeHasERabs = FALSE;
                            while ( sscanf( pParams + params_idx, "%64[^=]=%[^;];", item, pValue ) == 2 )
                            {
                        }
                        if ( strcmp( item, "EARLYREFLECTIONSSIZE" ) == 0 )
                        {
                            if ( read_txt_vector( pValue, 3, erTemp ) )
@@ -2303,22 +2296,36 @@ ivas_error RenderConfigReader_read(
                            pRenderConfigReader->pAE[acIdx].pEarlyReflections->dimensions.z = erTemp[2];
                            aeHasERsize = TRUE;
                        }
                    }
                    else if ( strcmp( item, "ABSORPTIONCOEFFS" ) == 0 )
                    {
                        if ( pRenderConfigReader->pAE[acIdx].pEarlyReflections == NULL )
                        {
#ifdef DEBUGGING
                            fprintf( stderr, "Rendering configuration: early reflections absorption coefficients specified without room size preceding." );
#endif
                            return IVAS_ERR_INVALID_RENDER_CONFIG;
                        }
                        if ( read_txt_vector( pValue, N_ABS_COEFFS, erTemp ) )
                        {
                            errorHandler( item, ERROR_VALUE_INVALID );
                            return IVAS_ERR_INVALID_RENDER_CONFIG;
                        }

                        for ( i = 0; i < N_ABS_COEFFS; i++ )
                        {
                            pRenderConfigReader->pAE[acIdx].pEarlyReflections->pAbsCoeff[i] = erTemp[i];
                        }
                        aeHasERabs = TRUE;
                    }
                                else if ( strcmp( item, "LISTENERORIGIN" ) )
                    else if ( strcmp( item, "LISTENERORIGIN" ) == 0 )
                    {
                        if ( pRenderConfigReader->pAE[acIdx].pEarlyReflections == NULL )
                        {
#ifdef DEBUGGING
                            fprintf( stderr, "Rendering configuration: early reflections listener origin specified without room size preceding." );
#endif
                            return IVAS_ERR_INVALID_RENDER_CONFIG;
                        }
                        if ( read_txt_vector( pValue, 3, erTemp ) )
                        {
                            errorHandler( item, ERROR_VALUE_INVALID );
@@ -2332,23 +2339,19 @@ ivas_error RenderConfigReader_read(
                        pRenderConfigReader->pAE[acIdx].pEarlyReflections->pListenerOrigin->y = erTemp[1];
                        pRenderConfigReader->pAE[acIdx].pEarlyReflections->pListenerOrigin->z = erTemp[2];
                    }
                                else if ( strcmp( item, "LOWCOMPLEXITY") )
                    else if ( strcmp( item, "LOWCOMPLEXITY" ) == 0 )
                    {
                                    if ( read_txt_bool( pValue, &pRenderConfigReader->pAE[acIdx].pEarlyReflections->lowComplexity ) )
                                    {
                                        errorHandler( item, ERROR_VALUE_INVALID );
                                        return IVAS_ERR_INVALID_RENDER_CONFIG;
                                    }
                                }
                                else
                        if ( pRenderConfigReader->pAE[acIdx].pEarlyReflections == NULL )
                        {
#ifdef DEBUGGING
                                    fprintf( stderr, "Rendering configuration: unsupported property %s\n", item );
                            fprintf( stderr, "Rendering configuration: early reflections low complexity flag specified without room size preceding." );
#endif
                                    break;
                                }
                                params_idx += (int32_t) ( strlen( item ) + strlen( pValue ) + 2 );
                            return IVAS_ERR_INVALID_RENDER_CONFIG;
                        }
                        if ( read_txt_bool( pValue, &pRenderConfigReader->pAE[acIdx].pEarlyReflections->lowComplexity ) )
                        {
                            errorHandler( item, ERROR_VALUE_INVALID );
                            return IVAS_ERR_INVALID_RENDER_CONFIG;
                        }
                    }
#endif