Commit c9c94cbe authored by TYAGIRIS's avatar TYAGIRIS
Browse files

fix split rendering TODOs in lib_rend

parent f391f67d
Loading
Loading
Loading
Loading
Loading
+34 −10
Original line number Diff line number Diff line
@@ -4117,6 +4117,33 @@ static ivas_error findFreeInputSlot(
}

#ifdef SPLIT_REND_WITH_HEAD_ROT
static int16_t getCldfbRendFlag(
    IVAS_REND_HANDLE hIvasRend, /* i: Renderer handle               */
    IVAS_REND_AudioConfigType new_config )
{
    int16_t isMasaInputPresent, isSbaInputPresent, isISMInputPresent, isMCInputPresent, 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;

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

    return isCldfbRend;
}
static void closeSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REND_AudioBuffer *pSplitRendEncBuffer )
{
    ivas_split_renderer_close( pSplitRendWrapper );
@@ -4159,12 +4186,8 @@ ivas_error IVAS_REND_AddInput(
    if ( hIvasRend->splitRendEncBuffer.data == NULL && hIvasRend->hRendererConfig != NULL )
    {
        int16_t cldfb_in;
        cldfb_in = 0;
        if ( ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) ||
             ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS && hIvasRend->hRendererConfig->split_rend_config.rendererSelection == IVAS_SPLIT_REND_RENDERER_SELECTION_FASTCONV ) )
        {
            cldfb_in = 1;
        }
        cldfb_in = getCldfbRendFlag( hIvasRend, getAudioConfigType( inConfig ) );

#ifdef FIX_658_SPLIT_REND_MASA
        ivas_split_rend_choose_default_codec( &hIvasRend->hRendererConfig->split_rend_config.codec,
                                              ( cldfb_in == 0 ),
@@ -5029,10 +5052,12 @@ int16_t IVAS_REND_FeedRenderConfig(
    if ( hIvasRend->splitRendEncBuffer.data != NULL && hIvasRend->hRendererConfig != NULL )
#endif
    {
        int16_t cldfb_in;
        cldfb_in = getCldfbRendFlag( hIvasRend, IVAS_REND_AUDIO_CONFIG_TYPE_UNKNOWN );
        closeSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer );
        /* TODO : Do not hard code TDin to 1 here*/

        ivas_split_rend_choose_default_codec( &hIvasRend->hRendererConfig->split_rend_config.codec,
                                              1,
                                              ( cldfb_in == 0 ),
                                              hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM );
        if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper,
                                      &hIvasRend->splitRendEncBuffer,
@@ -5040,7 +5065,7 @@ int16_t IVAS_REND_FeedRenderConfig(
                                      hIvasRend->headRotData,
                                      hIvasRend->sampleRateOut,
                                      hIvasRend->outputConfig,
                                      0 ) ) != IVAS_ERR_OK )
                                      cldfb_in ) ) != IVAS_ERR_OK )
        {
            return error;
        }
@@ -8244,7 +8269,6 @@ static ivas_error renderInputMasa(
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
                case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED:
                case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM:
                    /* TODO: implement */
                    renderMasaToBinaural( masaInput, outAudio
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                          ,