Commit a37e601c authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

[fix] missing sqrt in VectorLength_fx()

parent c0947d4a
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -113,7 +113,7 @@ void Copy_Quat_fx(


/*-------------------------------------------------------------------------
 * Scale_Quat_fx()
 * modify_Quat_q_fx()
 *
 * Quaternion q factor modification
 *------------------------------------------------------------------------*/
+1 −0
Original line number Diff line number Diff line
@@ -111,6 +111,7 @@
#define FIX_2250_LARGE_DIFFERENCES_BETWEEN_BASOP_AND_FLOAT  /* Dolby: Issue 2250:  random vector generation in GenShapedSHBExcitation() */
#define FIX_2338_HARM_GSC_GAIN_COMP                     /* VA: basop issue 2338: harmonization of band gain computation for both EVS and IVAS */
#define FIX_BASOP_2317_UNINIT_VALUE_IN_STEREO_CNG       /* Eri: Basop issue 2317: Uninitialized value read in case of DTX and BW switching   */
#define FIX_BASOP_2361_OTR                              /* FhG: Basop issue 2361: Orientation tracking tests for equivalent rotations fail */

/* ##################### End NON-BE switches ########################### */

+18 −1
Original line number Diff line number Diff line
@@ -482,12 +482,22 @@ static Word32 VectorLength_fx(
    IVAS_VECTOR3 p,
    Word16 *q_fact )
{
#ifdef FIX_BASOP_2361_OTR
    Word16 sqrt_e;
#endif
    Word32 result_fx = 0;
    move32();
    result_fx = L_add( L_add( Mpy_32_32( p.x_fx, p.x_fx ), Mpy_32_32( p.y_fx, p.y_fx ) ), Mpy_32_32( p.z_fx, p.z_fx ) ); // // Q: ( p1.q_fact + p2.q_fact ) - 31
#ifdef FIX_BASOP_2361_OTR
    sqrt_e = sub( 31, sub( add( p.q_fact, p.q_fact ), 31 ) ); /* convert Q to E */

    result_fx = Sqrt32( result_fx, &sqrt_e );
    *q_fact = sub( 31, sqrt_e ); /* back to Q again */
#else
    *q_fact = sub( add( p.q_fact, p.q_fact ), 31 );
#endif
    move16();

    return result_fx;
}

@@ -702,7 +712,14 @@ ivas_error ivas_orient_trk_SetReferenceRotation_fx(
        Euler2Quat_fx( deg2rad_fx( refRot.x_fx ), deg2rad_fx( refRot.y_fx ), deg2rad_fx( refRot.z_fx ), &pOTR->refRot );
        modify_Quat_q_fx( &pOTR->refRot, &pOTR->refRot, Q29 );
    }
#ifdef FIX_BASOP_2361_OTR
    ELSE
    {
#endif
        pOTR->refRot = refRot;
#ifdef FIX_BASOP_2361_OTR
    }
#endif

    return IVAS_ERR_OK;
}
+5 −0
Original line number Diff line number Diff line
@@ -114,8 +114,13 @@ ivas_error Vector3PairFileReader_read(
    pSecond->y = y2;
    pSecond->z = z2;

#ifdef FIX_BASOP_2361_OTR
    pFirst->q_fact = 27;  // Q27
    pSecond->q_fact = 27; // Q27
#else
    pFirst->q_fact = 29;  // Q29
    pSecond->q_fact = 29; // Q29
#endif
    pFirst->x_fx = floatToFixed_32( pFirst->x, pFirst->q_fact );
    pFirst->y_fx = floatToFixed_32( pFirst->y, pFirst->q_fact );
    pFirst->z_fx = floatToFixed_32( pFirst->z, pFirst->q_fact );