Commit 21b888d6 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

loop through all inputs instead of checking first index for getCldfbRendFlag()

parent 8c41efd6
Loading
Loading
Loading
Loading
Loading
+33 −19
Original line number Diff line number Diff line
@@ -4121,22 +4121,36 @@ static int16_t getCldfbRendFlag(
    IVAS_REND_HANDLE hIvasRend, /* i: Renderer handle               */
    IVAS_REND_AudioConfigType new_config )
{
    int16_t isMasaInputPresent, isSbaInputPresent, isISMInputPresent, isMCInputPresent, isCldfbRend;
    int16_t i;
    int16_t numMasaInputs = 0, numSbaInputs = 0, numIsmInputs = 0, numMcInputs = 0;
    int16_t isCldfbRend;

    isCldfbRend = 0;
    if ( hIvasRend->hRendererConfig != NULL )
    {
        isMasaInputPresent = ( hIvasRend->inputsMasa[0].base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN && new_config != IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) ? 0 : 1;
        isSbaInputPresent = ( hIvasRend->inputsSba[0].base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN && new_config != IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ? 0 : 1;
        isISMInputPresent = ( hIvasRend->inputsIsm[0].base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN && new_config != IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED ) ? 0 : 1;
        isMCInputPresent = ( hIvasRend->inputsMc[0].base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN && new_config != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ? 0 : 1;
        for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i )
        {
            numMasaInputs += ( hIvasRend->inputsMasa[i].base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN && new_config != IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) ? 0 : 1;
        }
        for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i )
        {
            numSbaInputs = ( hIvasRend->inputsSba[i].base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN && new_config != IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ? 0 : 1;
        }
        for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i )
        {
            numIsmInputs = ( hIvasRend->inputsIsm[i].base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN && new_config != IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED ) ? 0 : 1;
        }
        for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i )
        {
            numMcInputs = ( hIvasRend->inputsMc[i].base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN && new_config != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ? 0 : 1;
        }

        if ( isISMInputPresent || isMCInputPresent )
        if ( numIsmInputs > 0 || numMcInputs > 0 )
        {
            isCldfbRend = 0;
        }
        else if ( ( isMasaInputPresent ) ||
                  ( isSbaInputPresent && hIvasRend->hRendererConfig->split_rend_config.rendererSelection == IVAS_SPLIT_REND_RENDERER_SELECTION_FASTCONV ) )
        else if ( ( numMasaInputs > 0 ) ||
                  ( numSbaInputs > 0 && hIvasRend->hRendererConfig->split_rend_config.rendererSelection == IVAS_SPLIT_REND_RENDERER_SELECTION_FASTCONV ) )
        {
            isCldfbRend = 1;
        }