Commit 3e7fec37 authored by sagnowski's avatar sagnowski
Browse files

Finish resolving merge conflicts

parent 2721c2b5
Loading
Loading
Loading
Loading
+49 −72
Original line number Diff line number Diff line
@@ -433,16 +433,18 @@ void rotateFrame_shd(
    /* move Rmat to Rmat_prev */
    for ( i = 0; i < 3; i++ )
    {
<<<<<<< HEAD
        mvr2r( 
#ifdef API_5MS
        mvr2r( hCombinedOrientationData->Rmat[i], hCombinedOrientationData->Rmat_prev[i], 3 );
=======
            hCombinedOrientationData->Rmat[i], 
#else
            hCombinedOrientationData->Rmat[subframe_idx][i],
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
        mvr2r( hCombinedOrientationData->Rmat[subframe_idx][i], hCombinedOrientationData->Rmat_prev[0][i], 3 );
>>>>>>> main
            hCombinedOrientationData->Rmat_prev[0][i]
#else
        mvr2r( hCombinedOrientationData->Rmat[subframe_idx][i], hCombinedOrientationData->Rmat_prev[i], 3 );
            hCombinedOrientationData->Rmat_prev[i], 
#endif
            3 );
    }

    return;
@@ -576,16 +578,18 @@ void rotateFrame_sd(
    /* move Rmat to Rmat_prev */
    for ( i = 0; i < 3; i++ )
    {
<<<<<<< HEAD
        mvr2r(
#ifdef API_5MS
        mvr2r( hCombinedOrientationData->Rmat[i], hCombinedOrientationData->Rmat_prev[i], 3 );
=======
            hCombinedOrientationData->Rmat[i],
#else
            hCombinedOrientationData->Rmat[subframe_idx][i],
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
        mvr2r( hCombinedOrientationData->Rmat[subframe_idx][i], hCombinedOrientationData->Rmat_prev[0][i], 3 );
>>>>>>> main
            hCombinedOrientationData->Rmat_prev[0][i],
#else
        mvr2r( hCombinedOrientationData->Rmat[subframe_idx][i], hCombinedOrientationData->Rmat_prev[i], 3 );
            hCombinedOrientationData->Rmat_prev[i]
#endif
            3 );
    }

    /* copy to output */
@@ -928,7 +932,7 @@ ivas_error ivas_combined_orientation_open(
        set_zero( ( *hCombinedOrientationData )->Rmat[j], 3 );
        ( *hCombinedOrientationData )->Rmat[j][j] = 1.0f;
    }
#else
#else /* API_5MS */
    /* Initialise orientations to identity */
    for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ )
    {
@@ -937,7 +941,7 @@ ivas_error ivas_combined_orientation_open(
#ifndef FIX_570_SF_EXT_ORIENTATION
        ( *hCombinedOrientationData )->Quaternions_prev_headRot[i] = identity;
        ( *hCombinedOrientationData )->Quaternions_prev_extOrientation[i] = identity;
#endif
#endif /* FIX_570_SF_EXT_ORIENTATION */
        ( *hCombinedOrientationData )->listenerPos[i] = origo;

        for ( j = 0; j < 3; j++ )
@@ -946,9 +950,7 @@ ivas_error ivas_combined_orientation_open(
            ( *hCombinedOrientationData )->Rmat[i][j][j] = 1.0f;
        }
    }
<<<<<<< HEAD
#endif
=======
#endif /* API_5MS */
#ifdef SPLIT_REND_WITH_HEAD_ROT
    for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ )
    {
@@ -959,7 +961,6 @@ ivas_error ivas_combined_orientation_open(
        }
    }
#else
>>>>>>> main
    for ( j = 0; j < 3; j++ )
    {
        set_zero( ( *hCombinedOrientationData )->Rmat_prev[j], 3 );
@@ -1022,14 +1023,10 @@ ivas_error combine_external_and_head_orientations_dec(
    COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle    */
)
{
<<<<<<< HEAD
    IVAS_QUATERNION *headRotQuaternions = NULL; /* TODO(sgi): Rename to "headRotQuaternion" - it's a single value now */
=======
#ifdef SPLIT_REND_WITH_HEAD_ROT
    IVAS_SPLIT_REND_ROT_AXIS sr_pose_pred_axis;
#endif
    IVAS_QUATERNION *headRotQuaternions = NULL;
>>>>>>> main
    IVAS_QUATERNION *headRotQuaternions = NULL; /* TODO(sgi): Rename to "headRotQuaternion" - it's a single value now */
    IVAS_VECTOR3 *listenerPos = NULL;
#ifndef API_5MS
    int16_t numHeadRotQuaternions = 0;
@@ -1047,15 +1044,7 @@ ivas_error combine_external_and_head_orientations_dec(
            headRotQuaternions = hHeadTrackData->Quaternions;
            listenerPos = hHeadTrackData->Pos;
        }
<<<<<<< HEAD
#endif
    }
#ifdef API_5MS
    return combine_external_and_head_orientations( headRotQuaternions, listenerPos, hExtOrientationData, hCombinedOrientationData );
#else
    return combine_external_and_head_orientations( headRotQuaternions, listenerPos, numHeadRotQuaternions, hExtOrientationData, hCombinedOrientationData );
#endif
=======
#ifdef SPLIT_REND_WITH_HEAD_ROT
        sr_pose_pred_axis = hHeadTrackData->sr_pose_pred_axis;
#endif
@@ -1067,12 +1056,18 @@ ivas_error combine_external_and_head_orientations_dec(
    }
#endif

    return combine_external_and_head_orientations( headRotQuaternions, listenerPos,
    return combine_external_and_head_orientations( 
        headRotQuaternions,
        listenerPos,
#ifdef SPLIT_REND_WITH_HEAD_ROT
        sr_pose_pred_axis,
#endif
                                                   numHeadRotQuaternions, hExtOrientationData, hCombinedOrientationData );
>>>>>>> main
#ifndef API_5MS
        numHeadRotQuaternions,
#endif
        hExtOrientationData,
        hCombinedOrientationData,
    );
}


@@ -1136,20 +1131,18 @@ ivas_error combine_external_and_head_orientations_rend(
        }
#endif
    }
<<<<<<< HEAD
#ifdef API_5MS
    return combine_external_and_head_orientations( headRotQuaternions, listenerPos, hExtOrientationData, hCombinedOrientationData );
#else
    return combine_external_and_head_orientations( headRotQuaternions, listenerPos, numHeadRotQuaternions, hExtOrientationData, hCombinedOrientationData );
#endif
=======

    return combine_external_and_head_orientations( headRotQuaternions, listenerPos,
    return combine_external_and_head_orientations( 
        headRotQuaternions,
        listenerPos,
#ifdef SPLIT_REND_WITH_HEAD_ROT
        sr_pose_pred_axis,
#endif
                                                   numHeadRotQuaternions, hExtOrientationData, hCombinedOrientationData );
>>>>>>> main
#ifndef API_5MS
        numHeadRotQuaternions,
#endif
        hExtOrientationData,
        hCombinedOrientationData );
}


@@ -1160,7 +1153,6 @@ ivas_error combine_external_and_head_orientations_rend(
 * NOTE that the external orientations are inversed.
 *------------------------------------------------------------------------*/

<<<<<<< HEAD
ivas_error combine_external_and_head_orientations(
#ifdef LIB_REND_API_5MS
    IVAS_QUATERNION *headRotQuaternion, /* i  : quaternion for head rotation                             */
@@ -1168,22 +1160,14 @@ ivas_error combine_external_and_head_orientations(
    IVAS_QUATERNION *headRotQuaternions, /* i  : quaternions for head rotation                            */
#endif
    IVAS_VECTOR3 *listenerPos, /* i  : listener position                                        */
#ifndef API_5MS
    int16_t numHeadRotQuaternions, /* i  : number of head rotation quaternions                      */
#endif
    EXTERNAL_ORIENTATION_HANDLE hExtOrientationData,     /* i  : external orientation handle                              */
    COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle                              */
=======
static ivas_error combine_external_and_head_orientations(
    IVAS_QUATERNION *headRotQuaternions, /* i  : quaternions for head rotation          */
    IVAS_VECTOR3 *listenerPos,           /* i  : listener position                      */
#ifdef SPLIT_REND_WITH_HEAD_ROT
    IVAS_SPLIT_REND_ROT_AXIS sr_pose_pred_axis, /* i : split rend pose prediction axis*/
#endif
#ifndef API_5MS
    int16_t numHeadRotQuaternions, /* i  : number of head rotation quaternions                      */
#endif
    EXTERNAL_ORIENTATION_HANDLE hExtOrientationData,     /* i  : external orientation handle                              */
    COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle                              */
>>>>>>> main
)
{
#ifndef API_5MS
@@ -1502,26 +1486,24 @@ static ivas_error combine_external_and_head_orientations(
    /* Save the current orientations */
    if ( hExtOrientationData != NULL )
    {
<<<<<<< HEAD
#ifdef API_5MS
        if ( hExtOrientationData->enableExternalOrientation > 0 )
        {
            hCombinedOrientationData->Quaternion_prev_extOrientation = hCombinedOrientationData->Quaternion;
=======
#ifdef FIX_570_SF_EXT_ORIENTATION
        }
        else
        {
            hCombinedOrientationData->Quaternion_prev_extOrientation = identity;
        }
#elif defined FIX_570_SF_EXT_ORIENTATION /* ToDo: ensure FIX_570_SF_EXT_ORIENTATION is correctly included in API_5MS */
        if ( hExtOrientationData->enableExternalOrientation[MAX_PARAM_SPATIAL_SUBFRAMES - 1] > 0 )
        {
            hCombinedOrientationData->Quaternion_prev_extOrientation = hExtOrientationData->Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES - 1];
>>>>>>> main
        }
        else
        {
            hCombinedOrientationData->Quaternion_prev_extOrientation = identity;
        }
<<<<<<< HEAD

=======
>>>>>>> main
#else
        for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ )
        {
@@ -1748,11 +1730,7 @@ void external_target_interpolation(
#endif

            /* Use the most recent external orientation as the starting orientation */
<<<<<<< HEAD
#ifdef API_5MS
            hCombinedOrientationData->Quaternions_ext_interpolation_start = hCombinedOrientationData->Quaternion_prev_extOrientation;
=======
#ifdef FIX_570_SF_EXT_ORIENTATION
#if defined FIX_570_SF_EXT_ORIENTATION || defined API_5MS
            if ( hExtOrientationData->enableExternalOrientation[i] == 1 )
            {
                if ( i > 0 )
@@ -1768,7 +1746,6 @@ void external_target_interpolation(
            {
                hCombinedOrientationData->Quaternions_ext_interpolation_start = hCombinedOrientationData->Quaternion_frozen_ext;
            }
>>>>>>> main
#else
            hCombinedOrientationData->Quaternions_ext_interpolation_start = hCombinedOrientationData->Quaternions_prev_extOrientation[i];
#endif
+1 −9
Original line number Diff line number Diff line
@@ -796,11 +796,9 @@ typedef struct
    IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME];
    IVAS_VECTOR3 Pos[RENDERER_HEAD_POSITIONS_PER_FRAME];
    float crossfade[L_FRAME48k / RENDERER_HEAD_POSITIONS_PER_FRAME];
<<<<<<< HEAD
=======
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
    IVAS_SPLIT_REND_ROT_AXIS sr_pose_pred_axis;
>>>>>>> main
#endif
    ivas_orient_trk_state_t *hOrientationTracker;

@@ -891,13 +889,10 @@ typedef struct ivas_combined_orientation_struct
    float Rmat[3][3];
#else
    float Rmat[MAX_PARAM_SPATIAL_SUBFRAMES][3][3];
<<<<<<< HEAD
#endif
=======
#ifdef SPLIT_REND_WITH_HEAD_ROT
    float Rmat_prev[MAX_HEAD_ROT_POSES][3][3];
#else
>>>>>>> main
    float Rmat_prev[3][3];
#endif
    float chEneIIR[2][MASA_FREQUENCY_BANDS]; /* independent of the format. MASA bands are suitable for the task and readily available in ROM. */
@@ -907,9 +902,7 @@ typedef struct ivas_combined_orientation_struct
    IVAS_VECTOR3 listenerPos;
#else
    IVAS_VECTOR3 listenerPos[MAX_PARAM_SPATIAL_SUBFRAMES];
<<<<<<< HEAD
#endif
=======
#ifdef SPLIT_REND_WITH_HEAD_ROT
    IVAS_SPLIT_REND_ROT_AXIS sr_pose_pred_axis;
#endif
@@ -917,7 +910,6 @@ typedef struct ivas_combined_orientation_struct
    IVAS_QUATERNION Quaternion_frozen_head;
    int8_t isExtOrientationFrozen;
    int8_t isHeadRotationFrozen;
>>>>>>> main

} COMBINED_ORIENTATION_DATA, *COMBINED_ORIENTATION_HANDLE;

+14 −60
Original line number Diff line number Diff line
@@ -6108,19 +6108,15 @@ static ivas_error renderIsmToBinauralRoom(

    if ( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM_IR,
                                           NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate
<<<<<<< HEAD
#ifdef LIB_REND_API_5MS
                                           ,
                                           num_subframes_in_buffer( &outAudio, *ismInput->base.ctx.pOutSampleRate )
#endif
                                               ) ) != IVAS_ERR_OK )
=======
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                           ,
                                           0
#endif
                                               ) ) != IVAS_ERR_OK )
>>>>>>> main
    {
        return error;
    }
@@ -6779,20 +6775,15 @@ static ivas_error renderMcToBinaural(
        /* call CREND */
        if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ),
                                               NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate
<<<<<<< HEAD
#ifdef LIB_REND_API_5MS
                                               ,
                                               num_subframes_in_buffer( &outAudio, *mcInput->base.ctx.pOutSampleRate )
#endif
                                                   ) ) != IVAS_ERR_OK )
=======
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                               ,
                                               0
#endif
                                                   ) ) != IVAS_ERR_OK )

>>>>>>> main
        {
            return error;
        }
@@ -6911,19 +6902,15 @@ static ivas_error renderMcToBinauralRoom(
        /* call CREND */
        if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ),
                                               NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate
<<<<<<< HEAD
#ifdef LIB_REND_API_5MS
                                               ,
                                               num_subframes_in_buffer( &outAudio, *mcInput->base.ctx.pOutSampleRate )
#endif
                                                   ) ) != IVAS_ERR_OK )
=======
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                               ,
                                               0
#endif
                                                   ) ) != IVAS_ERR_OK )
>>>>>>> main
        {
            return error;
        }
@@ -7038,19 +7025,15 @@ static ivas_error renderMcCustomLsToBinauralRoom(
    /* call CREND */
    if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL,
                                           p_tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate
<<<<<<< HEAD
#ifdef LIB_REND_API_5MS
                                           ,
                                           num_subframes_in_buffer( &outAudio, *mcInput->base.ctx.pOutSampleRate )
#endif
                                               ) ) != IVAS_ERR_OK )
=======
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                           ,
                                           0
#endif
                                               ) ) != IVAS_ERR_OK )
>>>>>>> main
    {
        return error;
    }
@@ -7857,7 +7840,11 @@ static ivas_error renderSbaToBinaural(
    else
#endif
    {
<<<<<<< HEAD
        for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ )
        {
            p_tmpCrendBuffer[i] = tmpCrendBuffer[i];
        }

#ifdef API_5MS
        /* fix compiling only, ToDo ext renderer needs to adapted to 5ms */
        if ( ( *hCombinedOrientationData )->enableCombinedOrientation != 0 )
@@ -7865,14 +7852,6 @@ static ivas_error renderSbaToBinaural(
            combinedOrientationEnabled = 1;
        }
#else
        for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ )
=======
        for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ )
>>>>>>> main
        {
            p_tmpCrendBuffer[i] = tmpCrendBuffer[i];
        }

        hCombinedOrientationData = sbaInput->base.ctx.pCombinedOrientationData;
        combinedOrientationEnabled = 0;
        if ( hCombinedOrientationData != NULL )
@@ -7886,11 +7865,7 @@ static ivas_error renderSbaToBinaural(
                }
            }
        }
<<<<<<< HEAD
#endif
    }
=======
>>>>>>> main

        /* apply rotation */
        if ( combinedOrientationEnabled )
@@ -7927,6 +7902,10 @@ static ivas_error renderSbaToBinaural(
        /* call CREND */
        if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( sbaInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ),
                                               NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate
#ifdef LIB_REND_API_5MS
                                           ,
                                           num_subframes_in_buffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate )
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                               ,
                                               0
@@ -7938,27 +7917,6 @@ static ivas_error renderSbaToBinaural(

        accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio );
    }
<<<<<<< HEAD
    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, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate
#ifdef LIB_REND_API_5MS
                                           ,
                                           num_subframes_in_buffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate )
#endif
                                               ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio );
=======
>>>>>>> main

    pop_wmops();

@@ -8060,19 +8018,15 @@ static ivas_error renderSbaToBinauralRoom(
    /* call CREND */
    if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ),
                                           NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate
<<<<<<< HEAD
#ifdef LIB_REND_API_5MS
                                           ,
                                           num_subframes_in_buffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate )
#endif
                                               ) ) != IVAS_ERR_OK )
=======
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                           ,
                                           0
#endif
                                               ) ) != IVAS_ERR_OK )
>>>>>>> main
    {
        return error;
    }