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

Code review, add more descriptive numbering and comments, also disable...

Code review, add more descriptive numbering and comments, also disable headtracking with ext orientations
parent fc124107
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -158,7 +158,7 @@
/* ################## Start DEVELOPMENT switches ######################### */


//#define RTP_S4_251135_CR26253_0016_REV1                /* RTP Pack/Unpack API corresponding to CR 26253 */
#define RTP_S4_251135_CR26253_0016_REV1                /* RTP Pack/Unpack API corresponding to CR 26253 */
#define IVAS_RTPDUMP                                   /* RTPDUMP writing and reading for IVAS payloads */

/* ################### Start BE switches ################################# */
+1 −1
Original line number Diff line number Diff line
@@ -3843,7 +3843,7 @@ void IVAS_DEC_setDiegeticInputPI(
    if ( hIvasDec->st_ivas->hCombinedOrientationData != NULL )
    {
        int8_t i;
        for ( i = 0; i < 4; i++ )
        for ( i = 0; i < (1 + IVAS_MAX_NUM_OBJECTS); i++ )
        {
            hIvasDec->st_ivas->hCombinedOrientationData->isDiegeticInputPI[i] = diegeticPIValues[i];
        }
+39 −2
Original line number Diff line number Diff line
@@ -864,7 +864,7 @@ ivas_error ivas_combined_orientation_open(
    ( *hCombinedOrientationData )->cur_subframe_samples_rendered = 0;
#ifdef RTP_S4_251135_CR26253_0016_REV1

    for ( i = 0; i < 4; i++ )
    for ( i = 0; i < (1 + IVAS_MAX_NUM_OBJECTS); i++ )
    {
        ( *hCombinedOrientationData )->isDiegeticInputPI[i] = true;
    }
@@ -1030,8 +1030,8 @@ ivas_error combine_external_and_head_orientations(
    }
    else if ( hExtOrientationData == NULL && headRotQuaternions != NULL )
    {
        /* Head rotation only */
#ifdef RTP_S4_251135_CR26253_0016_REV1
        /* Disable head rotation if diegetic PI data indicating non-diegetic audio is received */
        if ( hCombinedOrientationData->isDiegeticInputPISet && !hCombinedOrientationData->isDiegeticInputPI[0] && !hCombinedOrientationData->isDiegeticInputPI[1] && !hCombinedOrientationData->isDiegeticInputPI[2] && !hCombinedOrientationData->isDiegeticInputPI[3] && !hCombinedOrientationData->isDiegeticInputPI[4] )
        {
            for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ )
@@ -1041,12 +1041,14 @@ ivas_error combine_external_and_head_orientations(
        }
        else
        {
            /* Head rotation only */
            for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ )
            {
                hCombinedOrientationData->Quaternions[i] = headRotQuaternions[i];
            }
        }
#else
        /* Head rotation only */
        for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ )
        {
            hCombinedOrientationData->Quaternions[i] = headRotQuaternions[i];
@@ -1128,6 +1130,14 @@ ivas_error combine_external_and_head_orientations(
                hCombinedOrientationData->Quaternion_frozen_head = identity;
                hCombinedOrientationData->isHeadRotationFrozen = 0;
            }
#ifdef RTP_S4_251135_CR26253_0016_REV1
            /* Disable head rotation if diegetic PI data indicating non-diegetic audio is received */
            if ( hCombinedOrientationData->isDiegeticInputPISet && !hCombinedOrientationData->isDiegeticInputPI[0] && !hCombinedOrientationData->isDiegeticInputPI[1] && !hCombinedOrientationData->isDiegeticInputPI[2] && !hCombinedOrientationData->isDiegeticInputPI[3] && !hCombinedOrientationData->isDiegeticInputPI[4] )
            {
                continue;
            }
            else
            {
                /* Use the most recent head rotation */
                if ( hExtOrientationData->enableHeadRotation[i] == 1 )
                {
@@ -1152,6 +1162,33 @@ ivas_error combine_external_and_head_orientations(
                        hCombinedOrientationData->Quaternions[i] = hCombinedOrientationData->Quaternion_frozen_head;
                    }
                }
            }
#else
            /* Use the most recent head rotation */
            if ( hExtOrientationData->enableHeadRotation[i] == 1 )
            {
                if ( hExtOrientationData->enableExternalOrientation[i] > 0 )
                {
                    QuaternionProduct( hCombinedOrientationData->Quaternions[i], headRotQuaternions[i], &hCombinedOrientationData->Quaternions[i] );
                }
                else
                {
                    hCombinedOrientationData->Quaternions[i] = headRotQuaternions[i];
                }
            }
            /* Use the freezed head rotation */
            else if ( hExtOrientationData->enableHeadRotation[i] == 2 )
            {
                if ( hExtOrientationData->enableExternalOrientation[i] > 0 )
                {
                    QuaternionProduct( hCombinedOrientationData->Quaternions[i], hCombinedOrientationData->Quaternion_frozen_head, &hCombinedOrientationData->Quaternions[i] );
                }
                else
                {
                    hCombinedOrientationData->Quaternions[i] = hCombinedOrientationData->Quaternion_frozen_head;
                }
            }
#endif

            /* Reset the combined orientations to identity */
            if ( hExtOrientationData->enableHeadRotation[i] == 0 && hExtOrientationData->enableExternalOrientation[i] == 0 )
+1 −1
Original line number Diff line number Diff line
@@ -711,7 +711,7 @@ typedef struct ivas_combined_orientation_struct
    int16_t subframe_idx_start;
    int16_t cur_subframe_samples_rendered_start;
#ifdef RTP_S4_251135_CR26253_0016_REV1
    bool isDiegeticInputPI[5];
    bool isDiegeticInputPI[1 + IVAS_MAX_NUM_OBJECTS];
    bool isDiegeticInputPISet;
#endif
} COMBINED_ORIENTATION_DATA, *COMBINED_ORIENTATION_HANDLE;
+1 −1
Original line number Diff line number Diff line
@@ -611,7 +611,7 @@ def unpackAudioFocus(bitstrm: ConstBitStream, piSize: int) -> AUDIO_FOCUS:
    return AUDIO_FOCUS(direction=direction, level=level)

def packAudioFocus(bitstrm: BitStream, data: any):
    assert type(data) == AUDIO_FOCUS, "Diegetic type PI Data expects a data of type AUDIO_FOCUS"
    assert type(data) == AUDIO_FOCUS, "Audio focus PI Data expects a data of type AUDIO_FOCUS"
    auFocus = cast(AUDIO_FOCUS, data)
    if auFocus.direction is not None:
        packOrientations(bitstrm, [auFocus.direction])