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

fix upper limit on polygon count and MSVC warnings

parent 385490ae
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1465,7 +1465,7 @@ typedef enum

#define EFAP_MAX_CHAN_NUM                       5                           /* Maximum number of channels that constitute a polygon, 4 or 5 */
#ifdef FIX_1050_EFAP_ALLOC
#define EFAP_MAX_POLY_SET                       36                          /* Upper bound on number of polygons */
#define EFAP_MAX_POLY_SET                       40                          /* Upper bound on number of polygons; (2 * num_spk + 8) = 40 for a speaker setup of 16.0 */
#else
#define EFAP_MAX_POLY_SET                       50                          /* Upper bound on number of polygons; with a Speaker setup of 16.0, we obtain 44 polygons/triangles in the matlab implementation. */
#endif
+5 −1
Original line number Diff line number Diff line
@@ -201,7 +201,7 @@ ivas_error efap_init_data(
    }
#ifdef FIX_1050_EFAP_ALLOC
    /* calculate upper bound of number of polygons required (heuristic) */
    polyset_size = 2 * num_speaker_nodes + 6;
    polyset_size = (int8_t) 2 * num_speaker_nodes + 8;

    /* Memory allocation for the polyset array */
    if ( ( efap->polyData.polysetArray = (EFAP_POLYSET *) malloc( polyset_size * sizeof( EFAP_POLYSET ) ) ) == NULL )
@@ -471,6 +471,10 @@ static ivas_error poly_init(
        {
            for ( j = 0; j < lengthTri2PolySorted[n]; ++j )
            {
                if ( (m + 2) > EFAP_MAX_POLY_SET )
                {
                    fprintf( stderr, "Polygon count: %d\n", m + 2 );
                }
                assert( ( m + 2 < EFAP_MAX_POLY_SET ) && "EFAP: maximum polygons exceeded!" );

                /* add two new polygons with azimuths wrapped to differing bounds */
+3 −5
Original line number Diff line number Diff line
@@ -603,15 +603,13 @@ typedef struct EFAP_VERTEX_DATA

typedef struct EFAP_POLYSET
{
    int16_t chan[EFAP_MAX_CHAN_NUM]; /* An array indicating the loudspeaker index of the polygon vertices                                 */
#ifdef FIX_1050_EFAP_ALLOC
    int8_t chan[EFAP_MAX_CHAN_NUM];  /* An array indicating the loudspeaker index of the polygon vertices                                 */
    int8_t isNaN[EFAP_MAX_CHAN_NUM]; /* Indicates if one of the vertices isNaN                                                            */
    int8_t numChan;                  /* An integer between 0 and EFAP_MAX_CHAN_NUM corresponding to the number of vertices of the polygon */
    bool isNaN[EFAP_MAX_CHAN_NUM]; /* Indicates if one of the vertices isNaN                                                            */
#else
    int16_t chan[EFAP_MAX_CHAN_NUM];              /* An array indicating the loudspeaker index of the polygon vertices                                 */
    int16_t isNaN[EFAP_MAX_CHAN_NUM];             /* Indicates if one of the vertices isNaN                                                            */
    int16_t numChan;                              /* An integer between 0 and EFAP_MAX_CHAN_NUM corresponding to the number of vertices of the polygon */
#endif
    int16_t numChan;                  /* An integer between 0 and EFAP_MAX_CHAN_NUM corresponding to the number of vertices of the polygon */
    float polyAzi[EFAP_MAX_CHAN_NUM]; /* An array (same length as "chan"), with the azimuth of the channels                                */
    float polyEle[EFAP_MAX_CHAN_NUM]; /* An array (same length as "chan"), with the elevation of the channels                              */