Commit 8e2b2e40 authored by TYAGIRIS's avatar TYAGIRIS
Browse files

fix for combined orientation handling and compilation errors when disabling...

fix for combined orientation handling and compilation errors when disabling SPLIT_REND_WITH_HEAD_ROT in renderSbaToBinaural()
parent b3b134b1
Loading
Loading
Loading
Loading
Loading
+45 −25
Original line number Diff line number Diff line
@@ -7388,8 +7388,14 @@ static ivas_error renderSbaToBinaural(
    const IVAS_REND_AudioConfig outConfig,
    IVAS_REND_AudioBuffer outAudio )
{
    float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k];
    ivas_error error;
    IVAS_REND_AudioBuffer tmpRotBuffer;
    float *p_tmpCrendBuffer[MAX_OUTPUT_CHANNELS];
    int16_t i;
    const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData;
    int8_t combinedOrientationEnabled;
    int16_t subframe_idx;

    push_wmops( "renderSbaToBinaural" );

@@ -7406,16 +7412,29 @@ static ivas_error renderSbaToBinaural(
    }
    else
#endif

    {
        float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k];
#ifdef SPLIT_REND_WITH_HEAD_ROT
        float *p_tmpCrendBuffer[MAX_OUTPUT_CHANNELS];
        for ( int16_t i = 0; i < MAX_OUTPUT_CHANNELS; i++ )
        for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ )
        {
            p_tmpCrendBuffer[i] = tmpCrendBuffer[i];
        }
#endif

        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;
                }
            }
        }

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

@@ -7439,15 +7458,15 @@ static ivas_error renderSbaToBinaural(

            copyBufferTo2dArray( tmpRotBuffer, tmpCrendBuffer );
            free( tmpRotBuffer.data );
        }
        else
        {
            copyBufferTo2dArray( sbaInput->base.inputBuffer, tmpCrendBuffer );
        }

        /* call CREND */
        if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( sbaInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ),
                                               NULL, NULL, NULL, NULL,
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                               p_tmpCrendBuffer,
#else
                                               tmpCrendBuffer,
#endif
                                               *sbaInput->base.ctx.pOutSampleRate
                                               NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                               ,
                                               0
@@ -7456,6 +7475,7 @@ static ivas_error renderSbaToBinaural(
        {
            return error;
        }

        accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio );
    }