Commit c94ed5a8 authored by Lauros Pajunen's avatar Lauros Pajunen
Browse files

In renderer, check enabled rotations from the combined struct

parent a08937f2
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1177,7 +1177,7 @@ ivas_error combine_external_and_head_orientations(
    {
        for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ )
        {
            if ( hExtOrientationData->enableExternalOrientation[i] > 0 || hExtOrientationData->enableHeadRotation[i] > 0 )
            if ( hExtOrientationData->enableExternalOrientation[i] > 0 )
            {
                hCombinedOrientationData->enableCombinedOrientation[i] = 1;
            }
+140 −2
Original line number Diff line number Diff line
@@ -5074,6 +5074,11 @@ static ivas_error renderMcToBinaural(
    IVAS_REND_AudioConfig inConfig;
    ivas_error error;
    IVAS_REND_AudioBuffer tmpRotBuffer;
#ifdef EXTERNAL_ORIENTATIONS
    const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData;
    int8_t combinedOrientationEnabled;
    int16_t subframe_idx;
#endif
#ifdef JBM_TSM_ON_TCS
    float *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS];
    int16_t i;
@@ -5089,7 +5094,30 @@ static ivas_error renderMcToBinaural(
    headRotEnabled = mcInput->base.ctx.pHeadRotData->headRotEnabled;
    inConfig = mcInput->base.inConfig;

    if ( ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) || ( headRotEnabled && ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1 || inConfig == IVAS_REND_AUDIO_CONFIG_7_1 ) ) )
#ifdef EXTERNAL_ORIENTATIONS
    hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData;
    combinedOrientationEnabled = 0;
    if ( hCombinedOrientationData != NULL )
    {
        for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ )
        {
            if ( ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] != 0 )
            {
                combinedOrientationEnabled = 1;
                break;
            }
        }
    }
#endif

    if ( ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) || (
#ifdef EXTERNAL_ORIENTATIONS
            combinedOrientationEnabled
#else
            headRotEnabled
#endif

            && ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1 || inConfig == IVAS_REND_AUDIO_CONFIG_7_1 ) ) )
    {
        copyBufferTo2dArray( mcInput->base.inputBuffer, tmpRendBuffer );

@@ -5106,7 +5134,11 @@ static ivas_error renderMcToBinaural(
    else
    {
        /* apply rotation */
#ifdef EXTERNAL_ORIENTATIONS
        if ( combinedOrientationEnabled )
#else
        if ( headRotEnabled )
#endif
        {
            tmpRotBuffer = mcInput->base.inputBuffer;
            tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) );
@@ -5164,6 +5196,11 @@ static ivas_error renderMcToBinauralRoom(
    IVAS_REND_AudioConfig inConfig;
    ivas_error error;
    IVAS_REND_AudioBuffer tmpRotBuffer;
#ifdef EXTERNAL_ORIENTATIONS
    const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData;
    int8_t combinedOrientationEnabled;
    int16_t subframe_idx;
#endif
#ifdef JBM_TSM_ON_TCS
    float *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS];
    int16_t i;
@@ -5179,7 +5216,29 @@ static ivas_error renderMcToBinauralRoom(
    headRotEnabled = mcInput->base.ctx.pHeadRotData->headRotEnabled;
    inConfig = mcInput->base.inConfig;

    if ( ( mcInput->hReverb != NULL && mcInput->hReverb->pConfig.roomAcoustics.use_brir == 0 && mcInput->hReverb->pConfig.roomAcoustics.late_reverb_on == 1 ) && ( ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) || ( headRotEnabled && ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1 || inConfig == IVAS_REND_AUDIO_CONFIG_7_1 ) ) ) )
#ifdef EXTERNAL_ORIENTATIONS
    hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData;
    combinedOrientationEnabled = 0;
    if ( hCombinedOrientationData != NULL )
    {
        for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ )
        {
            if ( ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] != 0 )
            {
                combinedOrientationEnabled = 1;
                break;
            }
        }
    }
#endif

    if ( ( mcInput->hReverb != NULL && mcInput->hReverb->pConfig.roomAcoustics.use_brir == 0 && mcInput->hReverb->pConfig.roomAcoustics.late_reverb_on == 1 ) && ( ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) || (
#ifdef EXTERNAL_ORIENTATIONS
            combinedOrientationEnabled
#else
            headRotEnabled
#endif
            && ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1 || inConfig == IVAS_REND_AUDIO_CONFIG_7_1 ) ) ) )
    {
        copyBufferTo2dArray( mcInput->base.inputBuffer, tmpRendBuffer );

@@ -5195,7 +5254,11 @@ static ivas_error renderMcToBinauralRoom(
    else
    {
        /* apply rotation */
#ifdef EXTERNAL_ORIENTATIONS
        if ( combinedOrientationEnabled )
#else
        if ( headRotEnabled )
#endif
        {
            tmpRotBuffer = mcInput->base.inputBuffer;
            tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) );
@@ -5256,6 +5319,11 @@ static ivas_error renderMcCustomLsToBinauralRoom(
    IVAS_REND_AudioBuffer tmpRotBuffer;
    IVAS_REND_AudioBuffer tmpMcBuffer;
    IVAS_REND_AudioBuffer *tmpBufPtr;
#ifdef EXTERNAL_ORIENTATIONS
    const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData;
    int8_t combinedOrientationEnabled;
    int16_t subframe_idx;
#endif
#ifdef JBM_TSM_ON_TCS
    float *p_tmpCrendBuffer[MAX_OUTPUT_CHANNELS];
#endif
@@ -5273,8 +5341,28 @@ static ivas_error renderMcCustomLsToBinauralRoom(
    }
#endif

#ifdef EXTERNAL_ORIENTATIONS
    hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData;
    combinedOrientationEnabled = 0;
    if ( hCombinedOrientationData != NULL )
    {
        for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ )
        {
            if ( ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] != 0 )
            {
                combinedOrientationEnabled = 1;
                break;
            }
        }
    }
#endif

    /* apply rotation */
#ifdef EXTERNAL_ORIENTATIONS
    if ( combinedOrientationEnabled )
#else
    if ( headRotEnabled )
#endif
    {
        tmpRotBuffer = mcInput->base.inputBuffer;
        tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) );
@@ -5520,6 +5608,11 @@ static ivas_error renderSbaToBinaural(
    float *p_tmpCrendBuffer[MAX_OUTPUT_CHANNELS];
    int16_t i;
#endif
#ifdef EXTERNAL_ORIENTATIONS
    const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData;
    int8_t combinedOrientationEnabled;
    int16_t subframe_idx;
#endif

    push_wmops( "renderSbaToBinaural" );

@@ -5530,8 +5623,28 @@ static ivas_error renderSbaToBinaural(
    }
#endif

#ifdef EXTERNAL_ORIENTATIONS
    hCombinedOrientationData = sbaInput->base.ctx.pCombinedOrientationData;
    combinedOrientationEnabled = 0;
    if ( hCombinedOrientationData != NULL )
    {
        for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ )
        {
            if ( ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] != 0 )
            {
                combinedOrientationEnabled = 1;
                break;
            }
        }
    }
#endif

    /* apply rotation */
#ifdef EXTERNAL_ORIENTATIONS
    if ( combinedOrientationEnabled )
#else
    if ( sbaInput->base.ctx.pHeadRotData->headRotEnabled )
#endif
    {
        tmpRotBuffer = sbaInput->base.inputBuffer;
        tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) );
@@ -5588,6 +5701,11 @@ static ivas_error renderSbaToBinauralRoom(
    IVAS_REND_AudioBuffer tmpRotBuffer;
    IVAS_REND_AudioBuffer tmpMcBuffer;
    IVAS_REND_AudioBuffer *tmpBufPtr;
#ifdef EXTERNAL_ORIENTATIONS
    const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData;
    int8_t combinedOrientationEnabled;
    int16_t subframe_idx;
#endif
#ifdef JBM_TSM_ON_TCS
    float *p_tmpCrendBuffer[MAX_OUTPUT_CHANNELS];
#endif
@@ -5605,8 +5723,28 @@ static ivas_error renderSbaToBinauralRoom(

    headRotEnabled = sbaInput->base.ctx.pHeadRotData->headRotEnabled;

#ifdef EXTERNAL_ORIENTATIONS
    hCombinedOrientationData = sbaInput->base.ctx.pCombinedOrientationData;
    combinedOrientationEnabled = 0;
    if ( hCombinedOrientationData != NULL )
    {
        for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ )
        {
            if ( ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] != 0 )
            {
                combinedOrientationEnabled = 1;
                break;
            }
        }
    }
#endif

    /* apply rotation */
#ifdef EXTERNAL_ORIENTATIONS
    if ( combinedOrientationEnabled )
#else
    if ( headRotEnabled )
#endif
    {
        tmpRotBuffer = sbaInput->base.inputBuffer;
        tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) );