Unverified Commit a8e3741b authored by norvell's avatar norvell
Browse files

Fix scaling for listener position input

parent 04625291
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1649,7 +1649,11 @@ static void resetHeadRotation(
        pPos[i].x_fx = 0;
        pPos[i].y_fx = 0;
        pPos[i].z_fx = 0;
#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
        pPos[i].q_fact = 22;
#else
        pPos[i].q_fact = 25;
#endif
    }

    return;
+8 −0
Original line number Diff line number Diff line
@@ -63,6 +63,10 @@
#define IVAS_ER_LIST_HEIGHT              1.6f
#define IVAS_ER_LIST_HEIGHT_FX           6710886 /* 1.6f in Q.22 */
#define IVAS_DEFAULT_AEID                65535
#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
#define IVAS_LISTENER_POSITION_MAX     327.67f
#define IVAS_LISTENER_POSITION_MAX_Q22 1374347592 /* 327.67 in Q22 */
#endif

/* JBM constants for adaptive-playout */
#define IVAS_TIME_SCALE_MIN 50  /* min. time-scaling [%] */
@@ -160,7 +164,11 @@ typedef struct
typedef struct
{
    float x, y, z;
#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
    Word32 x_fx, y_fx, z_fx; /* Q22, Q22, Q22 */
#else
    Word32 x_fx, y_fx, z_fx;
#endif
    Word16 q_fact;

} IVAS_VECTOR3;
+3 −3
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@
/* ################### Start DEBUGGING switches ######################## */

#ifndef RELEASE
#define DEBUGGING                           /* Activate debugging part of the code */
/*#define DEBUGGING*/                           /* Activate debugging part of the code */
#endif
/*#define WMOPS*/                               /* Activate complexity and memory counters */
/*#define WMOPS_PER_FRAME*/                     /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */
@@ -58,7 +58,7 @@

#ifdef DEBUGGING
/*#define DBG_BITSTREAM_ANALYSIS*/              /* Write bitstream with annotations to a text file */
/*#define DEBUG_MODE_INFO*/                         /* Define to output most important parameters to the subdirectory "res/" */
#define DEBUG_MODE_INFO                         /* Define to output most important parameters to the subdirectory "res/" */
#define DEBUG_MODE_INFO_TWEAK                   /* Enable command line switch to specify subdirectory for debug info output inside "./res/" */
#define DEBUG_FORCE_MDCT_STEREO_MODE            /* Force stereo mode decision for MDCT stereo: -stereo 3 1 forces L/R coding and -stereo 3 2 forces full M/S coding */
/*#define DEBUG_FORCE_DIR*/                     /* Force modes/parameters by reading from external binary files */
@@ -116,7 +116,7 @@
#define FIX_BASOP_2497_MCMASA_LFE_WRONG_SF_INDEX        /* Nokia: BASOP 2497: Fix wrong subframe index in McMASA LFE synth. */
#define FIX_BASOP_2496_OMASA_OBJ_EDIT_WRONG_ASSIGN      /* Nokia: BASOP 2496: Fix wrong assignment in OMASA object edit code */
#define FIX_2495_Q_ALIGN_OSBA_RENDERER                  /* FhG: Basop issue #2495: Corrected exponent scaling of outAudio.data_fx before buffer accumulation in renderSbaToBinaural(). */
#define FIX_BASOP_2023_TDREND_DISTATT_PRECISION         /* Eri: Distance attenuation scaling */
#define FIX_BASOP_2023_TDREND_DISTATT_PRECISION         /* Eri: Basop issue 2023: Distance attenuation scaling, adding clamping of distance att input and listener position  */

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

+4 −0
Original line number Diff line number Diff line
@@ -264,7 +264,11 @@ ivas_error ivas_td_binaural_renderer_sf_fx(
            enableCombinedOrientation = st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx];
            move16();

#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
            /* Shifting x_fx, y_fx, z_fx to the same Q-factor as Listener_p->Pos_q (usually Q22) */
#else
            /* Shifting x_fx, y_fx, z_fx to the same Q-factor as Listener_p->Pos_q (usually Q25) */
#endif
            Word16 pos_q = st_ivas->hBinRendererTd->Listener_p->Pos_q;
            move16();
            tmp_vector_fx->x_fx = L_shr( tmp_vector_fx->x_fx, sub( tmp_vector_fx->q_fact, pos_q ) );
+6 −0
Original line number Diff line number Diff line
@@ -2102,9 +2102,15 @@ ivas_error IVAS_DEC_FeedHeadTrackData(
        return error;
    }

#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
    hHeadTrackData->Pos[subframe_idx].x_fx = max( min( IVAS_LISTENER_POSITION_MAX_Q22, Pos.x_fx ), -IVAS_LISTENER_POSITION_MAX_Q22 );
    hHeadTrackData->Pos[subframe_idx].y_fx = max( min( IVAS_LISTENER_POSITION_MAX_Q22, Pos.y_fx ), -IVAS_LISTENER_POSITION_MAX_Q22 );
    hHeadTrackData->Pos[subframe_idx].z_fx = max( min( IVAS_LISTENER_POSITION_MAX_Q22, Pos.z_fx ), -IVAS_LISTENER_POSITION_MAX_Q22 );
#else
    hHeadTrackData->Pos[subframe_idx].x_fx = Pos.x_fx;
    hHeadTrackData->Pos[subframe_idx].y_fx = Pos.y_fx;
    hHeadTrackData->Pos[subframe_idx].z_fx = Pos.z_fx;
#endif
    hHeadTrackData->Pos[subframe_idx].q_fact = Pos.q_fact;
    move32();
    move32();
Loading