Commit 17ea1e5e authored by norvell's avatar norvell
Browse files

Remove include of tools.c and write max abs search with loop

parent a38b4bfe
Loading
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -37,9 +37,6 @@
#endif
#ifdef ISM_PI_DATA
#include <stdlib.h>
#ifdef COMPACT_ORIENTATION_PI_DATA
#include "tools.c"
#endif

#ifndef min
#define min( x, y ) ( ( x ) < ( y ) ? ( x ) : ( y ) )
@@ -122,7 +119,17 @@ static uint32_t packQuaternion( IVAS_QUATERNION orientation, uint8_t *buffer )
    q[2] = orientation.y;
    q[3] = orientation.z;

    max_q_idx = maximumAbs( q, 4, &q_max );
    max_q_idx = 0;
    q_max = (float) fabs( q[0] );
    for ( n = 1; n < 4; n++ )
    {
        if ( (float) fabs( q[n] ) > q_max )
        {
            q_max = (float) fabs( q[n] );
            max_q_idx = n;
        }
    }

    if ( q[max_q_idx] < 0 )
    {
        for ( n = 0; n < 4; n++ )