Commit aecf0f5e authored by norvell's avatar norvell
Browse files

Merge branch 'basop-2023-td-renderer-distance-attenuation-precision-problem' into 'main'

[Non BE] [Renderer Non BE] [Split Non BE] Resolve: Basop 2023 TD renderer distance attenuation precision

See merge request !2589
parents 79c1b6f1 5a0601c2
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -61,6 +61,10 @@
#define IVAS_REVERB_PREDELAY_MAX         20 /* Max input delay for reverb module */
#define IVAS_ER_LIST_HEIGHT              1.6f
#define IVAS_DEFAULT_AEID                65535
#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
#define IVAS_LISTENER_POSITION_MAX 327.67f
#endif


/* JBM constants for adaptive-playout */
#define IVAS_TIME_SCALE_MIN 50  /* min. time-scaling [%] */
+1 −0
Original line number Diff line number Diff line
@@ -171,6 +171,7 @@

#define USE_RTPDUMP                                     /* FhG: RTPDUMP format (rtptools standard) instead of custom format */
#define FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API            /* Expose Payload Type setting in RTP Header */
#define FIX_BASOP_2023_TDREND_DISTATT_PRECISION         /* Eri: Basop issue 2023: Distance attenuation scaling, synch with BASOP updates and adding clamping of distance att input and listener position  */
#define FIX_1574_EFAP_CODE_LINT                         /* FhG: issue 1574: Code quality fixes in ivas_efap.c */
#define FIX_FLOAT_1569_REND_RENDER_CONFIG_CHECKS        /* Nokia: float issue 1569: fix render config checks in renderer */
#define FIX_1571_BFI_COPY_ARRAY_CORRECT_LEN             /* FhG: issue 1571: use correct channel signal length for copying signal to buffer */
+14 −0
Original line number Diff line number Diff line
@@ -49,6 +49,14 @@
#endif
#include "wmc_auto.h"

#ifndef min
#define min( x, y ) ( ( x ) < ( y ) ? ( x ) : ( y ) )
#endif

#ifndef max
#define max( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) )
#endif

/*---------------------------------------------------------------------*
 * Local structs
 *---------------------------------------------------------------------*/
@@ -2601,9 +2609,15 @@ ivas_error IVAS_DEC_FeedHeadTrackData(
        return error;
    }

#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
    hHeadTrackData->Pos[subframe_idx].x = max( min( IVAS_LISTENER_POSITION_MAX, Pos.x ), -IVAS_LISTENER_POSITION_MAX );
    hHeadTrackData->Pos[subframe_idx].y = max( min( IVAS_LISTENER_POSITION_MAX, Pos.y ), -IVAS_LISTENER_POSITION_MAX );
    hHeadTrackData->Pos[subframe_idx].z = max( min( IVAS_LISTENER_POSITION_MAX, Pos.z ), -IVAS_LISTENER_POSITION_MAX );
#else
    hHeadTrackData->Pos[subframe_idx].x = Pos.x;
    hHeadTrackData->Pos[subframe_idx].y = Pos.y;
    hHeadTrackData->Pos[subframe_idx].z = Pos.z;
#endif

    hHeadTrackData->sr_pose_pred_axis = rot_axis;
    hIvasDec->updateOrientation = true;
+15 −0
Original line number Diff line number Diff line
@@ -71,6 +71,12 @@
#define IVAS_ER_LIST_ORIGIN_X 0.0f
#define IVAS_ER_LIST_ORIGIN_Y 0.0f

#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
#define DIST_ATT_MAX_MAXDIST 63.0f
#define DIST_ATT_MAX_REFDIST 6.3f
#define DIST_ATT_MAX_ROLLOFF 4.0f
#endif

#ifndef TRUE
#define TRUE 1
#endif
@@ -1331,11 +1337,20 @@ ivas_error RenderConfigReader_checkValues(
            }
        }

#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
        /* Verify range of distance attenuation parameters: refDist:       0.0 <= distAtt[1] <= 6.3         */
        /*                                                  maxDist:       distAtt[1] <= distAtt[0] <= 63.0 */
        /*                                                  rollOffFactor: 0 <= distAtt[2] <= 4.0           */
        hRenderConfig->distAtt[1] = min( max( 0, hRenderConfig->distAtt[1] ), DIST_ATT_MAX_REFDIST );
        hRenderConfig->distAtt[0] = min( max( hRenderConfig->distAtt[1], hRenderConfig->distAtt[0] ), DIST_ATT_MAX_MAXDIST );
        hRenderConfig->distAtt[2] = min( max( 0.0f, hRenderConfig->distAtt[2] ), DIST_ATT_MAX_ROLLOFF );
#else
        /* Verify range of distance attenuation parameters: 0.1 <= distAtt[0] <= distAtt[1] */
        /*                                                  0.0 <= distAtt[2] <= 10.0       */
        hRenderConfig->distAtt[0] = max( 0.1f, hRenderConfig->distAtt[0] );
        hRenderConfig->distAtt[1] = max( hRenderConfig->distAtt[0], hRenderConfig->distAtt[1] );
        hRenderConfig->distAtt[2] = max( 0.0f, min( 10.0f, hRenderConfig->distAtt[2] ) );
#endif

        /* Verify range of directivity patterns */
        for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; i++ )
+16 −0
Original line number Diff line number Diff line
@@ -35,6 +35,16 @@
#include <string.h>
#include <stdbool.h>

#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
#ifndef min
#define min( x, y ) ( ( x ) < ( y ) ? ( x ) : ( y ) )
#endif

#ifndef max
#define max( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) )
#endif
#endif


struct RotFileReader
{
@@ -125,9 +135,15 @@ ivas_error HeadRotationFileReading(
    pQuaternion->z = z;
    if ( pPos != NULL )
    {
#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
        pPos->x = min( max( -IVAS_LISTENER_POSITION_MAX, posx ), IVAS_LISTENER_POSITION_MAX );
        pPos->y = min( max( -IVAS_LISTENER_POSITION_MAX, posy ), IVAS_LISTENER_POSITION_MAX );
        pPos->z = min( max( -IVAS_LISTENER_POSITION_MAX, posz ), IVAS_LISTENER_POSITION_MAX );
#else
        pPos->x = posx;
        pPos->y = posy;
        pPos->z = posz;
#endif
    }

    return IVAS_ERR_OK;