Commit 9a69a5ba authored by multrus's avatar multrus
Browse files

[cleanup] accept EFAP_FIX_POLY

parent 007440d6
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -144,7 +144,6 @@
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
/*#define FIX_I1_113*/                                  /* under review : MCT bit distribution optimization for SBA high bitrates*/

#define EFAP_FIX_POLY                                   /* Issue 167: fix bug in EFAP polygon selection */
#define SBA_HOA_HBR_IMPROV                              /* issue 91: Improvements to SBA high bitrate HOA3 coding */
#define ALLRAD_OPTIM                                    /* Issue 159: Optimize memory allocation for ALLRAD */
#define FIX_I178_HQ_BUFFER_OVERRUN                      /* issue 178: Buffer overrun in HQ core decoder -- spectral filling buffer did not account for extended transition frame in IVAS */
+0 −22
Original line number Diff line number Diff line
@@ -100,9 +100,7 @@ static float vertex_distance( const EFAP_VERTEX *vtxArray, const EFAP_LS_TRIANGL

static float point_plane_distance( const float P1[3], const float P2[3], const float P3[3], const float X[3] );

#ifdef EFAP_FIX_POLY
static float point_poly_distance( const EFAP_POLYSET poly, const float X[3] );
#endif
static void efap_crossp( const float *v1, const float *v2, float *v );

static int16_t find_int_in_tri( const EFAP_LS_TRIANGLE *tri, const int16_t n, const int16_t r, int16_t *pos );
@@ -127,9 +125,7 @@ static int16_t in_poly( const float P[2], const EFAP_POLYSET poly );

static int16_t in_tri( float A[2], float B[2], float C[2], float P_minus_A[2] );

#ifdef EFAP_FIX_POLY
static void sph2cart( const float azi, const float ele, float *pos );
#endif

/*-----------------------------------------------------------------------*
 * Global function definitions
@@ -1502,13 +1498,7 @@ static void add_vertex(
    vtxArray[pos].ele = ( ( -180.0f > tmp ) ? -180.0f : tmp );

    /* Converting spherical coordinates to cartesians, assuming radius = 1 */
#ifdef EFAP_FIX_POLY
    sph2cart( vtxArray[pos].azi, vtxArray[pos].ele, &vtxArray[pos].pos[0] );
#else
    vtxArray[pos].pos[0] = cosf( vtxArray[pos].azi * PI_OVER_180 ) * cosf( vtxArray[pos].ele * PI_OVER_180 );
    vtxArray[pos].pos[1] = sinf( vtxArray[pos].azi * PI_OVER_180 ) * cosf( vtxArray[pos].ele * PI_OVER_180 );
    vtxArray[pos].pos[2] = sinf( vtxArray[pos].ele * PI_OVER_180 );
#endif

    /* Computing the index defined by idx = idxAziTmp + 181 * idxEleTmp  */

@@ -1600,7 +1590,6 @@ static float vertex_distance(
    return point_plane_distance( A, B, C, P );
}

#ifdef EFAP_FIX_POLY
/*-------------------------------------------------------------------------*
 * point_poly_distance()
 *
@@ -1620,7 +1609,6 @@ static float point_poly_distance(

    return point_plane_distance( P1, P2, P3, X );
}
#endif

/*-------------------------------------------------------------------------*
 * point_plane_distance()
@@ -2112,7 +2100,6 @@ static int16_t get_poly_num(
)
{
    int16_t i;
#ifdef EFAP_FIX_POLY
    int16_t num_poly, found_poly;
    int16_t poly_tmp[EFAP_MAX_CHAN_NUM];
    float poly_dist[EFAP_MAX_CHAN_NUM];
@@ -2125,12 +2112,10 @@ static int16_t get_poly_num(
    sph2cart( P[0], P[1], &pos[0] );

    /* Filter the polygon list with a fast 2d check */
#endif
    for ( i = 0; i < polyData->numPoly; ++i )
    {
        if ( in_poly( P, polyData->polysetArray[i] ) )
        {
#ifdef EFAP_FIX_POLY
            /* select only polygons which are visible from the point */
            dist_tmp = point_poly_distance( polyData->polysetArray[i], pos );
            if ( dist_tmp == 0 )
@@ -2143,12 +2128,8 @@ static int16_t get_poly_num(
                poly_dist[num_poly] = dist_tmp;
                num_poly++;
            }
#else
            return i;
#endif
        }
    }
#ifdef EFAP_FIX_POLY
    if ( num_poly == 0 )
    {
        return -1;
@@ -2167,9 +2148,6 @@ static int16_t get_poly_num(
    }

    return found_poly;
#else
    return -1;
#endif
}