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

Further simplify feeding single pi orientation function

parent bed62a10
Loading
Loading
Loading
Loading
Loading
+23 −27
Original line number Diff line number Diff line
@@ -6064,14 +6064,13 @@ ivas_error IVAS_DEC_is_split_rendering_coded_out(

static ivas_error feedSinglePIorientation(
    IVAS_DEC_HANDLE hIvasDec,         /* i/o: IVAS decoder handle                                     */
    const bool isOrientationSaved,    /* i  : flag to indicate if an orientation for this PI type was previously saved */
    IVAS_QUATERNION *savedOrientation /* i  : previously saved orientation for this PI type                            */
    IVAS_QUATERNION *orientation      /* i  : orientation for this PI type                            */
)
{
    int16_t i;
    ivas_error error;
    Decoder_Struct *st_ivas;
    IVAS_QUATERNION savedInvOrientation;
    IVAS_QUATERNION invOrientation;

    if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
    {
@@ -6080,8 +6079,6 @@ static ivas_error feedSinglePIorientation(

    st_ivas = hIvasDec->st_ivas;

    if ( isOrientationSaved )
    {
    if ( !st_ivas->hExtOrientationData )
    {
        if ( ( error = ivas_external_orientation_open( &( st_ivas->hExtOrientationData ), st_ivas->hDecoderConfig->render_framesize ) ) != IVAS_ERR_OK )
@@ -6098,18 +6095,17 @@ static ivas_error feedSinglePIorientation(
        }
    }

        QuaternionInverse( *savedOrientation, &savedInvOrientation );
    QuaternionInverse( *orientation, &invOrientation );

    /* use the new PI orientation or the previously saved orientation in processing */
    for ( i = 0; i < st_ivas->hExtOrientationData->num_subframes; i++ )
    {
            QuaternionProduct( st_ivas->hExtOrientationData->Quaternions[i], savedInvOrientation,
        QuaternionProduct( st_ivas->hExtOrientationData->Quaternions[i], invOrientation,
                           &st_ivas->hExtOrientationData->Quaternions[i] );
        st_ivas->hExtOrientationData->enableExternalOrientation[i] = true;
    }

    hIvasDec->updateOrientation = true;
    }

    return IVAS_ERR_OK;
}
@@ -6181,7 +6177,7 @@ ivas_error IVAS_DEC_FeedPiDataToDecoder(
#ifdef DEBUGGING
                fprintf( stdout, "PI_SCENE_ORIENTATION : %f, %f, %f, %f\n", quat->w, quat->x, quat->y, quat->z );
#endif
                error = feedSinglePIorientation( hIvasDec, true, quat );
                error = feedSinglePIorientation( hIvasDec, quat );
            }
            break;

@@ -6191,7 +6187,7 @@ ivas_error IVAS_DEC_FeedPiDataToDecoder(
#ifdef DEBUGGING
                fprintf( stdout, "PI_DEVICE_ORIENTATION : %f, %f, %f, %f\n", quat->w, quat->x, quat->y, quat->z );
#endif
                error = feedSinglePIorientation( hIvasDec, true, quat );
                error = feedSinglePIorientation( hIvasDec, quat );
            }
            break;